diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3352c4744a3b..f3a1a4beab5d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -10,6 +10,7 @@ # Service teams /sdk/appconfiguration/ @alzimmermsft @conniey @sima-zhu +/sdk/batch/ @xingwu1 @bgklein @matthchr /sdk/core/ @alzimmermsft @jianghaolu @srnagar @hemanttanwar /sdk/cosmos/ @moderakh @christopheranderson @kushagraThapar /sdk/eventhubs/ @conniey @srnagar @mssfang @@ -18,7 +19,7 @@ /sdk/servicebus/ @yvgopal @nemakam /sdk/tracing/ @samvaity @alzimmermsft -/sdk/storage/ @rickle-msft @jaschrep-msft @alzimmermsft @sima-zhu +/sdk/storage/ @rickle-msft @jaschrep-msft @gapra-msft @alzimmermsft @sima-zhu # Management Plane /**/resource-manager/ @yaohaizh @@ -28,5 +29,8 @@ ########### /eng/ @weshaggard @mitchdenny @danieljurek /eng/code-quality-reports/ @mssfang @JonathanGiles +/eng/jacoco-test-coverage/ @srnagar @JonathanGiles +/eng/spotbugs-aggregate-report/ @srnagar @JonathanGiles + /**/tests.yml @danieljurek /**/ci.yml @mitchdenny diff --git a/README.md b/README.md index 3a89fec4d97e..a93b2e3fb049 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Each service might have a number of libraries available from each of the followi * [Management](#Management) ### Client: July 2019 Preview -New wave of packages that we are currently releasing in **preview**. These libraries follow the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html) and share a number of core features such as HTTP retries, logging, transport protocols, authentication protocols, etc., so that once you learn how to use these features in one client library, you will know how to use them in other client libraries. You can learn about these shared features [here](core). +New wave of packages that we are currently releasing in **preview**. These libraries follow the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java/guidelines/) and share a number of core features such as HTTP retries, logging, transport protocols, authentication protocols, etc., so that once you learn how to use these features in one client library, you will know how to use them in other client libraries. You can learn about these shared features [here](core). These preview libraries can be easily identified by their folder, package, and namespaces names starting with `azure-`, e.g. `azure-keyvault`. diff --git a/cosmosdb/data-plane/.github/ISSUE_TEMPLATE/Bug_report.md b/cosmosdb/data-plane/.github/ISSUE_TEMPLATE/Bug_report.md deleted file mode 100644 index 7531bf124a13..000000000000 --- a/cosmosdb/data-plane/.github/ISSUE_TEMPLATE/Bug_report.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: "Bug report" -about: Create a report to help us improve - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior. - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Actual behavior** -Provide a description of the actual behavior observed. - -**Environment summary** -SDK Version: -Java JDK version: -OS Version (e.g. Windows, Linux, MacOSX) - -**Additional context** -Add any other context about the problem here. diff --git a/cosmosdb/data-plane/.gitignore b/cosmosdb/data-plane/.gitignore deleted file mode 100644 index bdb262af0bac..000000000000 --- a/cosmosdb/data-plane/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.class -target - -# Package Files # -*.jar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -# MacOS files # -.DS_Store - -# IDE files # -.project -.settings -.classpath -.idea -*.iml - -doc -docs diff --git a/cosmosdb/data-plane/.travis.yml b/cosmosdb/data-plane/.travis.yml deleted file mode 100644 index 02ba5c532eaf..000000000000 --- a/cosmosdb/data-plane/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: java -sudo: false # faster builds - -matrix: - include: - - os: linux - jdk: oraclejdk8 -# - os: osx -# osx_image: xcode8 -script: -- mvn dependency:resolve -- mvn test -P fast -DargLine="-DACCOUNT_HOST=$ACCOUNT_HOST -DACCOUNT_KEY=$ACCOUNT_KEY" cobertura:cobertura -after_success: - - bash <(curl -s https://codecov.io/bash) - -cache: - directories: - - $HOME/.m2 diff --git a/cosmosdb/data-plane/CODEOWNERS b/cosmosdb/data-plane/CODEOWNERS deleted file mode 100644 index 26da20e9f2cf..000000000000 --- a/cosmosdb/data-plane/CODEOWNERS +++ /dev/null @@ -1,10 +0,0 @@ -# CODEOWNERS is a GitHub standard to specify who is automatically assigned pull requests to review. -# This helps to prevent pull requests from languishing without review. -# GitHub can also be configured to require review from code owners before a pull request can be merged. - -# Further reading is available from the following two URLs: -# https://blog.github.com/2017-07-06-introducing-code-owners/ -# https://help.github.com/articles/about-codeowners/ - -# Default owner for repo -* @moderakh @christopheranderson @kushagraThapar diff --git a/cosmosdb/data-plane/LICENSE b/cosmosdb/data-plane/LICENSE deleted file mode 100644 index 21071075c245..000000000000 --- a/cosmosdb/data-plane/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/cosmosdb/data-plane/README.md b/cosmosdb/data-plane/README.md deleted file mode 100644 index 19399df1e3db..000000000000 --- a/cosmosdb/data-plane/README.md +++ /dev/null @@ -1,301 +0,0 @@ -## Java SDK for SQL API of Azure Cosmos DB -[![Maven Central](https://img.shields.io/maven-central/v/com.microsoft.azure/azure-cosmosdb.svg)](https://search.maven.org/artifact/com.microsoft.azure/azure-cosmosdb/2.4.3/jar) -[![Build Status](https://api.travis-ci.org/Azure/azure-cosmosdb-java.svg?branch=master)](https://travis-ci.org/Azure/azure-cosmosdb-java) -[![Known Vulnerabilities](https://snyk.io/test/github/Azure/azure-cosmosdb-java/badge.svg?targetFile=sdk%2Fpom.xml)](https://snyk.io/test/github/Azure/azure-cosmosdb-java?targetFile=sdk%2Fpom.xml) - - - - -- [Consuming the official Microsoft Azure Cosmos DB Java SDK](#consuming-the-official-microsoft-azure-cosmos-db-java-sdk) -- [Prerequisites](#prerequisites) -- [API Documentation](#api-documentation) -- [Usage Code Sample](#usage-code-sample) -- [Guide for Prod](#guide-for-prod) -- [Future, CompletableFuture, and ListenableFuture](#future-completablefuture-and-listenablefuture) -- [Checking out the Source Code](#checking-out-the-source-code) -- [FAQ](#faq) -- [Release changes](#release-changes) -- [Contribution and Feedback](#contribution-and-feedback) -- [License](#license) - - - - -## Consuming the official Microsoft Azure Cosmos DB Java SDK - -This project provides a SDK library in Java for interacting with [SQL API](https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-sql-query) of [Azure Cosmos DB -Database Service](https://azure.microsoft.com/en-us/services/cosmos-db/). This project also includes samples, tools, and utilities. - -Jar dependency binary information for maven and gradle can be found here at [maven]( https://mvnrepository.com/artifact/com.microsoft.azure/azure-cosmosdb/2.4.3). - -For example, using maven, you can add the following dependency to your maven pom file: - -```xml - - com.microsoft.azure - azure-cosmosdb - 2.4.3 - -``` - - - -Useful links: -- [Sample Get Started APP](https://github.com/Azure-Samples/azure-cosmos-db-sql-api-async-java-getting-started) -- [Introduction to Resource Model of Azure Cosmos DB Service]( https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-resources) -- [Introduction to SQL API of Azure Cosmos DB Service](https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-sql-query) -- [SDK JavaDoc API](https://azure.github.io/azure-cosmosdb-java/2.4.0/com/microsoft/azure/cosmosdb/rx/AsyncDocumentClient.html) -- [RxJava Observable JavaDoc API](http://reactivex.io/RxJava/1.x/javadoc/rx/Observable.html) -- [SDK FAQ](faq/) - -## Prerequisites -* Java Development Kit 8 -* An active Azure account. If you don't have one, you can sign up for a [free account](https://azure.microsoft.com/free/). Alternatively, you can use the [Azure Cosmos DB Emulator](https://azure.microsoft.com/documentation/articles/documentdb-nosql-local-emulator) for development and testing. As emulator https certificate is self signed, you need to import its certificate to java trusted cert store as [explained here](https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator-export-ssl-certificates) -* (Optional) SLF4J is a logging facade. -* (Optional) [SLF4J binding](http://www.slf4j.org/manual.html) is used to associate a specific logging framework with SLF4J. -* (Optional) Maven - -SLF4J is only needed if you plan to use logging, please also download an SLF4J binding which will link the SLF4J API with the logging implementation of your choice. See the [SLF4J user manual](http://www.slf4j.org/manual.html) for more information. - - -## API Documentation -Javadoc is available [here](https://azure.github.io/azure-cosmosdb-java/2.4.0/com/microsoft/azure/cosmosdb/rx/AsyncDocumentClient.html). - -The SDK provide Reactive Extension Observable based async API. You can read more about RxJava and [Observable APIs here](http://reactivex.io/RxJava/1.x/javadoc/rx/Observable.html). - - -## Usage Code Sample - -Code Sample for creating a Document: -```java -import com.microsoft.azure.cosmosdb.rx.*; -import com.microsoft.azure.cosmosdb.*; - -ConnectionPolicy policy = new ConnectionPolicy(); -policy.setConnectionMode(ConnectionMode.Direct); - -AsyncDocumentClient asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(HOST) - .withMasterKeyOrResourceToken(MASTER_KEY) - .withConnectionPolicy(policy) - .withConsistencyLevel(ConsistencyLevel.Eventual) - .build(); - -Document doc = new Document(String.format("{ 'id': 'doc%d', 'counter': '%d'}", 1, 1)); - -Observable> createDocumentObservable = - asyncClient.createDocument(collectionLink, doc, null, false); - createDocumentObservable - .single() // we know there will be one response - .subscribe( - - documentResourceResponse -> { - System.out.println(documentResourceResponse.getRequestCharge()); - }, - - error -> { - System.err.println("an error happened: " + error.getMessage()); - }); -``` - -We have a get started sample app available [here](https://github.com/Azure-Samples/azure-cosmos-db-sql-api-async-java-getting-started). - -Also We have more examples in form of standalone unit tests in [examples project](examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples). - - -## Guide for Prod -To achieve better performance and higher throughput there are a few tips that are helpful to follow: - -### Use Appropriate Scheduler (Avoid stealing Eventloop IO Netty threads) -SDK uses [netty](https://netty.io/) for non-blocking IO. The SDK uses a fixed number of IO netty eventloop threads (as many CPU cores your machine has) for executing IO operations. - - The Observable returned by API emits the result on one of the shared IO eventloop netty threads. So it is important to not block the shared IO eventloop netty threads. Doing CPU intensive work or blocking operation on the IO eventloop netty thread may cause deadlock or significantly reduce SDK throughput. - -For example the following code executes a cpu intensive work on the eventloop IO netty thread: - - -```java -Observable> createDocObs = asyncDocumentClient.createDocument( - collectionLink, document, null, true); - -createDocObs.subscribe( - resourceResponse -> { - //this is executed on eventloop IO netty thread. - //the eventloop thread is shared and is meant to return back quickly. - // - // DON'T do this on eventloop IO netty thread. - veryCpuIntensiveWork(); - }); - -``` - -After result is received if you want to do CPU intensive work on the result you should avoid doing so on eventloop IO netty thread. You can instead provide your own Scheduler to provide your own thread for running your work. - -```java -import rx.schedulers; - -Observable> createDocObs = asyncDocumentClient.createDocument( - collectionLink, document, null, true); - -createDocObs.subscribeOn(Schedulers.computation()) -subscribe( - resourceResponse -> { - // this is executed on threads provided by Scheduler.computation() - // Schedulers.computation() should be used only the work is cpu intensive and you are not doing blocking IO, thread sleep, etc. in this thread against other resources. - veryCpuIntensiveWork(); - }); - -``` - -Based on the type of your work you should use the appropriate existing RxJava Scheduler for your work. Please read here -[``Schedulers``](http://reactivex.io/RxJava/1.x/javadoc/rx/schedulers/Schedulers.html). - - -### Disable netty's logging -Netty library logging is very chatty and need to be turned off (suppressing log in the configuration may not be enough) to avoid additional CPU costs. -If you are not in debugging mode disable netty's logging altogether. So if you are using log4j to remove the additional CPU costs incurred by ``org.apache.log4j.Category.callAppenders()`` from netty add the following line to your codebase: - -```java -org.apache.log4j.Logger.getLogger("io.netty").setLevel(org.apache.log4j.Level.OFF); -``` - -### OS Open files Resource Limit -Some Linux systems (like Redhat) have an upper limit on the number of open files and so the total number of connections. Run the following to view the current limits: - -```bash -ulimit -a -``` - -The number of open files (nofile) need to be large enough to have enough room for your configured connection pool size and other open files by the OS. It can be modified to allow for a larger connection pool size. - -Open the limits.conf file: - -```bash -vim /etc/security/limits.conf -``` -Add/modify the following lines: - -``` -* - nofile 100000 -``` - -### Use native SSL implementation for netty -Netty can use OpenSSL directly for SSL implementation stack to achieve better performance. -In the absence of this configuration netty will fall back to Java's default SSL implementation. - -on Ubuntu: -```bash -sudo apt-get install openssl -sudo apt-get install libapr1 -``` - -and add the following dependency to your project maven dependencies: -```xml - - io.netty - netty-tcnative - 2.0.20.Final - linux-x86_64 - -``` - -For other platforms (Redhat, Windows, Mac, etc) please refer to these instructions https://netty.io/wiki/forked-tomcat-native.html - -### Common Perf Tips -There is a set of common perf tips written for our sync SDK. The majority of them also apply to the async SDK. It is available [here](https://docs.microsoft.com/en-us/azure/cosmos-db/performance-tips-java). - -## Future, CompletableFuture, and ListenableFuture - -The SDK provide Reactive Extension (Rx) [Observable](http://reactivex.io/RxJava/1.x/javadoc/rx/Observable.html) based async API. - - -RX API has advantages over Future based APIs. But if you wish to use ``Future`` you can translate Observables to Java native Futures: - -```java -// You can convert an Observable to a ListenableFuture. -// ListenableFuture (part of google guava library) is a popular extension -// of Java's Future which allows registering listener callbacks: -// https://github.com/google/guava/wiki/ListenableFutureExplained - -import rx.observable.ListenableFutureObservable; - -Observable> createDocObservable = asyncClient.createDocument( - collectionLink, document, null, false); - -// NOTE: if you are going to do CPU intensive work -// on the result thread consider changing the scheduler see Use Proper Scheduler -// (Avoid Stealing Eventloop IO Netty threads) section -ListenableFuture> listenableFuture = - ListenableFutureObservable.to(createDocObservable); - -ResourceResponse rrd = listenableFuture.get(); -``` - -For this to work you will need [RxJava Guava library dependency ](https://mvnrepository.com/artifact/io.reactivex/rxjava-guava/1.0.3). More information available here https://github.com/ReactiveX/RxJavaGuava. - -You can see more details on how to convert Observables to Futures here: -https://dzone.com/articles/converting-between - -## Checking out the Source Code -The SDK is open source and is available here [sdk](sdk/). - - Clone the Repo -```bash -git clone https://github.com/Azure/azure-cosmosdb-java.git -cd azure-cosmosdb-java -``` - -### How to Build from Command Line - -* Run the following maven command to build: - -```bash -maven clean package -DskipTests -``` - -#### Running Tests from Command Line - -Running tests require Azure Cosmos DB Endpoint credentials: - -```bash -mvn test -DACCOUNT_HOST="https://REPLACE_ME_WITH_YOURS.documents.azure.com:443/" -DACCOUNT_KEY="REPLACE_ME_WITH_YOURS" -``` - -### Import into Intellij or Eclipse - -* Load the main parent project pom file in Intellij/Eclipse (That should automatically load examples). -* For running the samples you need a proper Azure Cosmos DB Endpoint. The endpoints are picked up from [TestConfigurations.java](examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TestConfigurations.java). There is a similar endpoint config file for the sdk tests [here](sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TestConfigurations.java). -* You can pass your endpoint credentials as VM Arguments in Eclipse JUnit Run Config: -```bash - -DACCOUNT_HOST="https://REPLACE_ME.documents.azure.com:443/" -DACCOUNT_KEY="REPLACE_ME" - ``` -* or you can simply put your endpoint credentials in TestConfigurations.java -* The SDK tests are written using TestNG framework, if you use Eclipse you may have to - add TestNG plugin to your eclipse IDE as explained [here](http://testng.org/doc/eclipse.html). - Intellij has builtin support for TestNG. -* Now you can run the tests in your Intellij/Eclipse IDE. - - -## FAQ -We have a frequently asked questions which is maintained [here](faq/). - -## Release changes -Release changelog is available [here](changelog/). - - -## Contribution and Feedback - -This is an open source project and we welcome contributions. - -If you would like to become an active contributor to this project please follow the instructions provided in [Azure Projects Contribution Guidelines](http://azure.github.io/guidelines/). - -We have [travis build CI](https://travis-ci.org/Azure/azure-cosmosdb-java) which should pass for any PR. - -If you encounter any bugs with the SDK please file an [issue](https://github.com/Azure/azure-cosmosdb-java/issues) in the Issues section of the project. - - -## License -MIT License -Copyright (c) 2018 Copyright (c) Microsoft Corporation diff --git a/cosmosdb/data-plane/benchmark/README.md b/cosmosdb/data-plane/benchmark/README.md deleted file mode 100644 index 4f7aadcc7796..000000000000 --- a/cosmosdb/data-plane/benchmark/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# Benchmark tool - -## Build the benchmarking tool - -```bash -git clone https://github.com/Azure/azure-cosmosdb-java.git -cd azure-cosmosdb-java - -mvn clean package -DskipTests -``` - -and then the package will be generated. - -## Run the WriteLatency workload - -```bash -java -jar benchmark/target/azure-cosmosdb-benchmark-2.4.1-SNAPSHOT-jar-with-dependencies.jar \ - -serviceEndpoint $endpoint -masterKey $masterkey \ - -databaseId $dbname -collectionId $colname \ - -consistencyLevel Eventual -concurrency 10 -numberOfOperations 1000000 \ - -operation WriteLatency -connectionMode Direct -``` - -## Sample Report: - -``` -2/13/19 9:32:39 PM ============================================================= - --- Meters ---------------------------------------------------------------------- -#Successful Operations - count = 89934 - mean rate = 1798.56 events/second - 1-minute rate = 1718.45 events/second - 5-minute rate = 1630.17 events/second - 15-minute rate = 1610.01 events/second -#Unsuccessful Operations - count = 0 - mean rate = 0.00 events/second - 1-minute rate = 0.00 events/second - 5-minute rate = 0.00 events/second - 15-minute rate = 0.00 events/second - --- Timers ---------------------------------------------------------------------- -Latency - count = 89938 - mean rate = 1798.64 calls/second - 1-minute rate = 1718.65 calls/second - 5-minute rate = 1630.37 calls/second - 15-minute rate = 1610.21 calls/second - min = 3.97 milliseconds - max = 22.81 milliseconds - mean = 5.37 milliseconds - stddev = 0.96 milliseconds - median = 5.26 milliseconds - 75% <= 5.70 milliseconds - 95% <= 6.40 milliseconds - 98% <= 6.93 milliseconds - 99% <= 7.51 milliseconds - 99.9% <= 17.37 milliseconds -``` - -## Other Currently Supported Workloads - -* ReadLatency, -* WriteLatency, -* ReadThroughput, -* WriteThroughput, -* QueryCross, -* QuerySingle, -* QuerySingleMany, -* QueryParallel, -* QueryOrderby, -* QueryAggregate, -* QueryAggregateTopOrderby, -* QueryTopOrderby, -* Mixed -* ReadMyWrites - - -You can provide ``--help`` to the tool to see the list of other work loads (read, etc) and other options. - diff --git a/cosmosdb/data-plane/benchmark/pom.xml b/cosmosdb/data-plane/benchmark/pom.xml deleted file mode 100644 index 1bf6722f0281..000000000000 --- a/cosmosdb/data-plane/benchmark/pom.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - - azure-cosmosdb-benchmark - Async SDK for SQL API of Azure Cosmos DB Service - Benchmarking tool - Benchmarking tool for Async SDK for SQL API of Azure Cosmos DB Service - - - UTF-8 - 1.7.6 - 1.2.17 - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - com.microsoft.azure.cosmosdb.benchmark.Main - - - - maven-assembly-plugin - 2.2 - - - jar-with-dependencies - - - - com.microsoft.azure.cosmosdb.benchmark.Main - - - - - - make-assembly - package - - single - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - - - - com.microsoft.azure - azure-cosmosdb - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - - - io.netty - netty-tcnative - 2.0.20.Final - linux-x86_64 - - - com.google.guava - guava - ${guava.version} - - - io.reactivex - rxjava-guava - 1.0.3 - - - org.mockito - mockito-core - ${mockito.version} - test - - - org.hamcrest - hamcrest-all - 1.3 - test - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - - - log4j - log4j - ${log4j.version} - - - io.dropwizard.metrics - metrics-core - ${metrics.version} - - - io.dropwizard.metrics - metrics-jvm - ${metrics.version} - - - io.dropwizard.metrics - metrics-graphite - ${metrics.version} - - - com.beust - jcommander - 1.58 - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - - org.testng - testng - ${testng.version} - test - - - org.assertj - assertj-core - ${assertj.version} - test - - - org.mockito - mockito-all - ${mockito.version} - test - - - diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncBenchmark.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncBenchmark.java deleted file mode 100644 index 477118e3d51c..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncBenchmark.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.codahale.metrics.ConsoleReporter; -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricFilter; -import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.ScheduledReporter; -import com.codahale.metrics.Timer; -import com.codahale.metrics.graphite.Graphite; -import com.codahale.metrics.graphite.GraphiteReporter; -import com.codahale.metrics.jvm.CachedThreadStatesGaugeSet; -import com.codahale.metrics.jvm.GarbageCollectorMetricSet; -import com.codahale.metrics.jvm.MemoryUsageGaugeSet; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.benchmark.Configuration.Operation; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.apache.commons.lang3.RandomStringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Subscriber; - -import java.net.InetSocketAddress; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.Semaphore; -import java.util.concurrent.TimeUnit; - -abstract class AsyncBenchmark { - private final MetricRegistry metricsRegistry = new MetricRegistry(); - private final ScheduledReporter reporter; - private final CountDownLatch operationCounterLatch; - private final String nameCollectionLink; - - private Meter successMeter; - private Meter failureMeter; - - final Logger logger; - final AsyncDocumentClient client; - final DocumentCollection collection; - final String partitionKey; - final Configuration configuration; - final List docsToRead; - final Semaphore concurrencyControlSemaphore; - Timer latency; - - AsyncBenchmark(Configuration cfg) { - client = new AsyncDocumentClient.Builder() - .withServiceEndpoint(cfg.getServiceEndpoint()) - .withMasterKeyOrResourceToken(cfg.getMasterKey()) - .withConnectionPolicy(cfg.getConnectionPolicy()) - .withConsistencyLevel(cfg.getConsistencyLevel()) - .build(); - - logger = LoggerFactory.getLogger(this.getClass()); - - Database database = DocDBUtils.getDatabase(client, cfg.getDatabaseId()); - collection = DocDBUtils.getCollection(client, database.getSelfLink(), cfg.getCollectionId()); - nameCollectionLink = String.format("dbs/%s/colls/%s", database.getId(), collection.getId()); - partitionKey = collection.getPartitionKey().getPaths().iterator().next().split("/")[1]; - concurrencyControlSemaphore = new Semaphore(cfg.getConcurrency()); - operationCounterLatch = new CountDownLatch(cfg.getNumberOfOperations()); - configuration = cfg; - - ArrayList> createDocumentObservables = new ArrayList<>(); - - if (configuration.getOperationType() != Operation.WriteLatency - && configuration.getOperationType() != Operation.WriteThroughput - && configuration.getOperationType() != Operation.ReadMyWrites) { - String dataFieldValue = RandomStringUtils.randomAlphabetic(cfg.getDocumentDataFieldSize()); - for (int i = 0; i < cfg.getNumberOfPreCreatedDocuments(); i++) { - String uuid = UUID.randomUUID().toString(); - Document newDoc = new Document(); - newDoc.setId(uuid); - newDoc.set(partitionKey, uuid); - newDoc.set("dataField1", dataFieldValue); - newDoc.set("dataField2", dataFieldValue); - newDoc.set("dataField3", dataFieldValue); - newDoc.set("dataField4", dataFieldValue); - newDoc.set("dataField5", dataFieldValue); - Observable obs = client.createDocument(collection.getSelfLink(), newDoc, null, false) - .map(ResourceResponse::getResource); - createDocumentObservables.add(obs); - } - } - - docsToRead = Observable.merge(createDocumentObservables, 100).toList().toBlocking().single(); - init(); - - if (configuration.isEnableJvmStats()) { - metricsRegistry.register("gc", new GarbageCollectorMetricSet()); - metricsRegistry.register("threads", new CachedThreadStatesGaugeSet(10, TimeUnit.SECONDS)); - metricsRegistry.register("memory", new MemoryUsageGaugeSet()); - } - - if (configuration.getGraphiteEndpoint() != null) { - final Graphite graphite = new Graphite(new InetSocketAddress(configuration.getGraphiteEndpoint(), configuration.getGraphiteEndpointPort())); - reporter = GraphiteReporter.forRegistry(metricsRegistry) - .prefixedWith(configuration.getOperationType().name()) - .convertRatesTo(TimeUnit.SECONDS) - .convertDurationsTo(TimeUnit.MILLISECONDS) - .filter(MetricFilter.ALL) - .build(graphite); - } else { - reporter = ConsoleReporter.forRegistry(metricsRegistry).convertRatesTo(TimeUnit.SECONDS) - .convertDurationsTo(TimeUnit.MILLISECONDS).build(); - } - } - - protected void init() { - } - - void shutdown() { - client.close(); - } - - protected void onSuccess() { - } - - protected void onError(Throwable throwable) { - } - - protected String getCollectionLink() { - if (configuration.isUseNameLink()) { - return this.nameCollectionLink; - } else { - return collection.getSelfLink(); - } - } - - protected String getDocumentLink(Document doc) { - if (configuration.isUseNameLink()) { - return this.nameCollectionLink + "/docs/" + doc.getId(); - } else { - return doc.getSelfLink(); - } - } - - protected abstract void performWorkload(Subscriber subs, long i) throws Exception; - - void run() throws Exception { - - successMeter = metricsRegistry.meter("#Successful Operations"); - failureMeter = metricsRegistry.meter("#Unsuccessful Operations"); - if (configuration.getOperationType() == Operation.ReadLatency - || configuration.getOperationType() == Operation.WriteLatency) - latency = metricsRegistry.timer("Latency"); - - reporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS); - - long startTime = System.currentTimeMillis(); - - for (long i = 1; i <= configuration.getNumberOfOperations(); i++) { - - Subscriber subs = new Subscriber() { - - @Override - public void onStart() { - } - - @Override - public void onCompleted() { - successMeter.mark(); - concurrencyControlSemaphore.release(); - operationCounterLatch.countDown(); - AsyncBenchmark.this.onSuccess(); - } - - @Override - public void onError(Throwable e) { - failureMeter.mark(); - logger.error("Encountered failure {} on thread {}" , - e.getMessage(), Thread.currentThread().getName(), e); - concurrencyControlSemaphore.release(); - operationCounterLatch.countDown(); - AsyncBenchmark.this.onError(e); - } - - @Override - public void onNext(T value) { - } - }; - - performWorkload(subs, i); - } - - operationCounterLatch.await(); - long endTime = System.currentTimeMillis(); - logger.info("[{}] operations performed in [{}] seconds.", - configuration.getNumberOfOperations(), (int) ((endTime - startTime) / 1000)); - - reporter.report(); - reporter.close(); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncMixedBenchmark.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncMixedBenchmark.java deleted file mode 100644 index 9af6ddd21e59..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncMixedBenchmark.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import org.apache.commons.lang3.RandomStringUtils; -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import java.util.Random; -import java.util.UUID; - -class AsyncMixedBenchmark extends AsyncBenchmark { - - private final String uuid; - private final String dataFieldValue; - private final Random r; - - AsyncMixedBenchmark(Configuration cfg) { - super(cfg); - uuid = UUID.randomUUID().toString(); - dataFieldValue = RandomStringUtils.randomAlphabetic(configuration.getDocumentDataFieldSize()); - r = new Random(); - } - - @Override - protected void performWorkload(Subscriber subs, long i) throws InterruptedException { - Observable obs; - if (i % 10 == 0 && i % 100 != 0) { - - String idString = uuid + i; - Document newDoc = new Document(); - newDoc.setId(idString); - newDoc.set(partitionKey, idString); - newDoc.set("dataField1", dataFieldValue); - newDoc.set("dataField2", dataFieldValue); - newDoc.set("dataField3", dataFieldValue); - newDoc.set("dataField4", dataFieldValue); - newDoc.set("dataField5", dataFieldValue); - obs = client.createDocument(getCollectionLink(), newDoc, null, false).map(ResourceResponse::getResource); - - } else if (i % 100 == 0) { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(10); - options.setEnableCrossPartitionQuery(true); - - String sqlQuery = "Select top 100 * from c order by c._ts"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options) - .map(frp -> frp.getResults().get(0)); - } else { - - int index = r.nextInt(1000); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(docsToRead.get(index).getId())); - - obs = client.readDocument(getDocumentLink(docsToRead.get(index)), options).map(ResourceResponse::getResource); - } - - concurrencyControlSemaphore.acquire(); - - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQueryBenchmark.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQueryBenchmark.java deleted file mode 100644 index 73df9a4ab81d..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQueryBenchmark.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import java.util.Random; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.benchmark.Configuration.Operation; - -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import javax.net.ssl.SSLException; - -class AsyncQueryBenchmark extends AsyncBenchmark> { - - private int pageCount = 0; - - AsyncQueryBenchmark(Configuration cfg) { - super(cfg); - } - - @Override - protected void onSuccess() { - pageCount++; - if (pageCount % 10000 == 0) { - if (pageCount == 0) { - return; - } - logger.info("total pages so far: {}", pageCount); - } - } - - @Override - protected void performWorkload(Subscriber> subs, long i) throws InterruptedException { - - Observable> obs; - Random r = new Random(); - FeedOptions options = new FeedOptions(); - - if (configuration.getOperationType() == Operation.QueryCross) { - - int index = r.nextInt(1000); - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select * from c where c._rid = \"" + docsToRead.get(index).getResourceId() + "\""; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QuerySingle) { - - int index = r.nextInt(1000); - String pk = docsToRead.get(index).getString("pk"); - options.setPartitionKey(new PartitionKey(pk)); - String sqlQuery = "Select * from c where c.pk = \"" + pk + "\""; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QueryParallel) { - - options.setMaxItemCount(10); - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select * from c"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QueryOrderby) { - - options.setMaxItemCount(10); - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select * from c order by c._ts"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QueryAggregate) { - - options.setMaxItemCount(10); - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select value max(c._ts) from c"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QueryAggregateTopOrderby) { - - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select top 1 value count(c) from c order by c._ts"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QueryTopOrderby) { - - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select top 1000 * from c order by c._ts"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else { - throw new IllegalArgumentException("Unsupported Operation: " + configuration.getOperationType()); - } - concurrencyControlSemaphore.acquire(); - - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQuerySinglePartitionMultiple.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQuerySinglePartitionMultiple.java deleted file mode 100644 index 1d515226bea8..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQuerySinglePartitionMultiple.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; - -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import javax.net.ssl.SSLException; - -class AsyncQuerySinglePartitionMultiple extends AsyncBenchmark> { - - private static final String SQL_QUERY = "Select * from c where c.pk = \"pk\""; - private FeedOptions options; - private int pageCount = 0; - - AsyncQuerySinglePartitionMultiple(Configuration cfg) { - super(cfg); - options = new FeedOptions(); - options.setPartitionKey(new PartitionKey("pk")); - options.setMaxItemCount(10); - } - - @Override - protected void onSuccess() { - pageCount++; - if (pageCount % 10000 == 0) { - if (pageCount == 0) { - return; - } - logger.info("total pages so far: {}", pageCount); - } - } - - @Override - protected void performWorkload(Subscriber> subs, long i) throws InterruptedException { - Observable> obs = client.queryDocuments(getCollectionLink(), SQL_QUERY, options); - - concurrencyControlSemaphore.acquire(); - - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncReadBenchmark.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncReadBenchmark.java deleted file mode 100644 index bdf0454f3824..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncReadBenchmark.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.codahale.metrics.Timer; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.benchmark.Configuration.Operation; - -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import javax.net.ssl.SSLException; - -class AsyncReadBenchmark extends AsyncBenchmark> { - - class LatencySubscriber extends Subscriber { - - Timer.Context context; - Subscriber subscriber; - - LatencySubscriber(Subscriber subscriber) { - this.subscriber = subscriber; - } - - @Override - public void onCompleted() { - context.stop(); - subscriber.onCompleted(); - } - - @Override - public void onError(Throwable e) { - context.stop(); - subscriber.onError(e); - } - - @Override - public void onNext(T t) { - subscriber.onNext(t); - } - } - - AsyncReadBenchmark(Configuration cfg) { - super(cfg); - } - - @Override - protected void performWorkload(Subscriber> subs, long i) throws InterruptedException { - int index = (int) (i % docsToRead.size()); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(docsToRead.get(index).getId())); - - Observable> obs = client.readDocument(getDocumentLink(docsToRead.get(index)), options); - - concurrencyControlSemaphore.acquire(); - - if (configuration.getOperationType() == Operation.ReadThroughput) { - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } else { - LatencySubscriber> latencySubscriber = new LatencySubscriber<>( - subs); - latencySubscriber.context = latency.time(); - obs.subscribeOn(Schedulers.computation()).subscribe(latencySubscriber); - } - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncWriteBenchmark.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncWriteBenchmark.java deleted file mode 100644 index 8256e1c48cba..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncWriteBenchmark.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import java.util.UUID; - -import org.apache.commons.lang3.RandomStringUtils; - -import com.codahale.metrics.Timer; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.benchmark.Configuration.Operation; - -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import javax.net.ssl.SSLException; - -class AsyncWriteBenchmark extends AsyncBenchmark> { - - private final String uuid; - private final String dataFieldValue; - - class LatencySubscriber extends Subscriber { - - Timer.Context context; - Subscriber subscriber; - - LatencySubscriber(Subscriber subscriber) { - this.subscriber = subscriber; - } - - @Override - public void onCompleted() { - context.stop(); - subscriber.onCompleted(); - } - - @Override - public void onError(Throwable e) { - context.stop(); - subscriber.onError(e); - } - - @Override - public void onNext(T t) { - subscriber.onNext(t); - } - } - - AsyncWriteBenchmark(Configuration cfg) { - super(cfg); - uuid = UUID.randomUUID().toString(); - dataFieldValue = RandomStringUtils.randomAlphabetic(configuration.getDocumentDataFieldSize()); - } - - @Override - protected void performWorkload(Subscriber> subs, long i) throws InterruptedException { - - String idString = uuid + i; - Document newDoc = new Document(); - newDoc.setId(idString); - newDoc.set(partitionKey, idString); - newDoc.set("dataField1", dataFieldValue); - newDoc.set("dataField2", dataFieldValue); - newDoc.set("dataField3", dataFieldValue); - newDoc.set("dataField4", dataFieldValue); - newDoc.set("dataField5", dataFieldValue); - Observable> obs = client.createDocument(getCollectionLink(), newDoc, null, - false); - - concurrencyControlSemaphore.acquire(); - - if (configuration.getOperationType() == Operation.WriteThroughput) { - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } else { - LatencySubscriber> latencySubscriber = new LatencySubscriber<>( - subs); - latencySubscriber.context = latency.time(); - obs.subscribeOn(Schedulers.computation()).subscribe(latencySubscriber); - } - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Configuration.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Configuration.java deleted file mode 100644 index 915591f8b7c9..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Configuration.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import java.util.Arrays; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -import com.beust.jcommander.IStringConverter; -import com.beust.jcommander.Parameter; -import com.beust.jcommander.ParameterException; -import com.google.common.base.Strings; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.benchmark.Configuration.Operation.OperationTypeConverter; - -class Configuration { - private final static int GRAPHITE_SERVER_DEFAULT_PORT = 2003; - - @Parameter(names = "-serviceEndpoint", description = "Service Endpoint") - private String serviceEndpoint; - - @Parameter(names = "-masterKey", description = "Master Key") - private String masterKey; - - @Parameter(names = "-databaseId", description = "Database ID") - private String databaseId; - - @Parameter(names = "-collectionId", description = "Collection ID") - private String collectionId; - - @Parameter(names = "-useNameLink", description = "Use name Link") - private boolean useNameLink = false; - - @Parameter(names = "-documentDataFieldSize", description = "Length of a document data field in characters (16-bit)") - private int documentDataFieldSize = 20; - - @Parameter(names = "-maxConnectionPoolSize", description = "Max Connection Pool Size") - private Integer maxConnectionPoolSize = 1000; - - @Parameter(names = "-consistencyLevel", description = "Consistency Level", converter = ConsistencyLevelConverter.class) - private ConsistencyLevel consistencyLevel = ConsistencyLevel.Session; - - @Parameter(names = "-connectionMode", description = "Connection Mode") - private ConnectionMode connectionMode = ConnectionMode.Direct; - - @Parameter(names = "-graphiteEndpoint", description = "Graphite endpoint") - private String graphiteEndpoint; - - @Parameter(names = "-enableJvmStats", description = "Enables JVM Stats") - private boolean enableJvmStats; - - @Parameter(names = "-operation", description = "Type of Workload:\n" - + "\tReadThroughput- run a Read workload that prints only throughput *\n" - + "\tWriteThroughput - run a Write workload that prints only throughput\n" - + "\tReadLatency - run a Read workload that prints both throughput and latency *\n" - + "\tWriteLatency - run a Write workload that prints both throughput and latency\n" - + "\tQueryCross - run a 'Select * from c where c._rid = SOME_RID' workload that prints throughput\n" - + "\tQuerySingle - run a 'Select * from c where c.pk = SOME_PK' workload that prints throughput\n" - + "\tQuerySingleMany - run a 'Select * from c where c.pk = \"pk\"' workload that prints throughput\n" - + "\tQueryParallel - run a 'Select * from c' workload that prints throughput\n" - + "\tQueryOrderby - run a 'Select * from c order by c._ts' workload that prints throughput\n" - + "\tQueryAggregate - run a 'Select value max(c._ts) from c' workload that prints throughput\n" - + "\tQueryAggregateTopOrderby - run a 'Select top 1 value count(c) from c order by c._ts' workload that prints throughput\n" - + "\tQueryTopOrderby - run a 'Select top 1000 * from c order by c._ts' workload that prints throughput\n" - + "\tMixed - runa workload of 90 reads, 9 writes and 1 QueryTopOrderby per 100 operations *\n" - + "\tReadMyWrites - run a workflow of writes followed by reads and queries attempting to read the write.*\n" - + "\n\t* writes 10k documents initially, which are used in the reads", converter = OperationTypeConverter.class) - private Operation operation = Operation.WriteThroughput; - - @Parameter(names = "-concurrency", description = "Degree of Concurrency in Inserting Documents." - + " If this value is not specified, the max connection pool size will be used as the concurrency level.") - private Integer concurrency; - - @Parameter(names = "-numberOfOperations", description = "Total Number Of Documents To Insert") - private int numberOfOperations = 100000; - - @Parameter(names = "-printingInterval", description = "Interval of time after which Metrics should be printed (seconds)") - private int printingInterval = 10; - - @Parameter(names = "-numberOfPreCreatedDocuments", description = "Total Number Of Documents To pre create for a read workload to use") - private int numberOfPreCreatedDocuments = 1000; - - @Parameter(names = {"-h", "-help", "--help"}, description = "Help", help = true) - private boolean help = false; - - enum Operation { - ReadThroughput, - WriteThroughput, - ReadLatency, - WriteLatency, - QueryCross, - QuerySingle, - QuerySingleMany, - QueryParallel, - QueryOrderby, - QueryAggregate, - QueryAggregateTopOrderby, - QueryTopOrderby, - Mixed, - ReadMyWrites; - - static Operation fromString(String code) { - - for (Operation output : Operation.values()) { - if (output.toString().equalsIgnoreCase(code)) { - return output; - } - } - - return null; - } - - static class OperationTypeConverter implements IStringConverter { - - /* - * (non-Javadoc) - * - * @see com.beust.jcommander.IStringConverter#convert(java.lang.String) - */ - @Override - public Operation convert(String value) { - Operation ret = fromString(value); - if (ret == null) { - throw new ParameterException("Value " + value + " can not be converted to ClientType. " - + "Available values are: " + Arrays.toString(Operation.values())); - } - return ret; - } - } - } - - private static ConsistencyLevel fromString(String code) { - for (ConsistencyLevel output : ConsistencyLevel.values()) { - if (output.toString().equalsIgnoreCase(code)) { - return output; - } - } - return null; - } - - static class ConsistencyLevelConverter implements IStringConverter { - - /* - * (non-Javadoc) - * - * @see com.beust.jcommander.IStringConverter#convert(java.lang.String) - */ - @Override - public ConsistencyLevel convert(String value) { - ConsistencyLevel ret = fromString(value); - if (ret == null) { - throw new ParameterException("Value " + value + " can not be converted to ClientType. " - + "Available values are: " + Arrays.toString(Operation.values())); - } - return ret; - } - } - - Operation getOperationType() { - return operation; - } - - int getNumberOfOperations() { - return numberOfOperations; - } - - String getServiceEndpoint() { - return serviceEndpoint; - } - - String getMasterKey() { - return masterKey; - } - - boolean isHelp() { - return help; - } - - int getDocumentDataFieldSize() { - return documentDataFieldSize; - } - - ConnectionPolicy getConnectionPolicy() { - ConnectionPolicy policy = new ConnectionPolicy(); - policy.setConnectionMode(connectionMode); - policy.setMaxPoolSize(maxConnectionPoolSize); - return policy; - } - - ConsistencyLevel getConsistencyLevel() { - return consistencyLevel; - } - - String getDatabaseId() { - return databaseId; - } - - String getCollectionId() { - return collectionId; - } - - int getNumberOfPreCreatedDocuments() { - return numberOfPreCreatedDocuments; - } - - int getPrintingInterval() { - return printingInterval; - } - - int getConcurrency() { - if (this.concurrency != null) { - return concurrency; - } else { - return this.maxConnectionPoolSize; - } - } - - boolean isUseNameLink() { - return useNameLink; - } - - public boolean isEnableJvmStats() { - return enableJvmStats; - } - - public String getGraphiteEndpoint() { - if (graphiteEndpoint == null) { - return null; - } - - return StringUtils.substringBeforeLast(graphiteEndpoint, ":"); - } - - public int getGraphiteEndpointPort() { - if (graphiteEndpoint == null) { - return -1; - } - - String portAsString = Strings.emptyToNull(StringUtils.substringAfterLast(graphiteEndpoint, ":")); - if (portAsString == null) { - return GRAPHITE_SERVER_DEFAULT_PORT; - } else { - return Integer.parseInt(portAsString); - } - } - - public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); - } - - void tryGetValuesFromSystem() { - serviceEndpoint = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("SERVICE_END_POINT")), - serviceEndpoint); - - masterKey = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("MASTER_KEY")), masterKey); - - databaseId = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("DATABASE_ID")), databaseId); - - collectionId = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("COLLECTION_ID")), - collectionId); - - documentDataFieldSize = Integer.parseInt( - StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("DOCUMENT_DATA_FIELD_SIZE")), - Integer.toString(documentDataFieldSize))); - - maxConnectionPoolSize = Integer.parseInt( - StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("MAX_CONNECTION_POOL_SIZE")), - Integer.toString(maxConnectionPoolSize))); - - ConsistencyLevelConverter consistencyLevelConverter = new ConsistencyLevelConverter(); - consistencyLevel = consistencyLevelConverter.convert(StringUtils - .defaultString(Strings.emptyToNull(System.getenv().get("CONSISTENCY_LEVEL")), consistencyLevel.name())); - - OperationTypeConverter operationTypeConverter = new OperationTypeConverter(); - operation = operationTypeConverter.convert( - StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("OPERATION")), operation.name())); - - String concurrencyValue = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("CONCURRENCY")), - concurrency == null ? null : Integer.toString(concurrency)); - concurrency = concurrencyValue == null ? null : Integer.parseInt(concurrencyValue); - - String numberOfOperationsValue = StringUtils.defaultString( - Strings.emptyToNull(System.getenv().get("NUMBER_OF_OPERATIONS")), Integer.toString(numberOfOperations)); - numberOfOperations = Integer.parseInt(numberOfOperationsValue); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/DocDBUtils.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/DocDBUtils.java deleted file mode 100644 index 4d05fb177cc6..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/DocDBUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.SqlParameter; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -class DocDBUtils { - - private DocDBUtils() { - } - - static Database getDatabase(AsyncDocumentClient client, String databaseId) { - FeedResponse feedResponsePages = client - .queryDatabases(new SqlQuerySpec("SELECT * FROM root r WHERE r.id=@id", - new SqlParameterCollection(new SqlParameter("@id", databaseId))), null) - .toBlocking().single(); - - if (feedResponsePages.getResults().isEmpty()) { - throw new RuntimeException("cannot find datatbase " + databaseId); - } - return feedResponsePages.getResults().get(0); - } - - static DocumentCollection getCollection(AsyncDocumentClient client, String databaseLink, - String collectionId) { - FeedResponse feedResponsePages = client - .queryCollections(databaseLink, - new SqlQuerySpec("SELECT * FROM root r WHERE r.id=@id", - new SqlParameterCollection(new SqlParameter("@id", collectionId))), - null) - .toBlocking().single(); - - if (feedResponsePages.getResults().isEmpty()) { - throw new RuntimeException("cannot find collection " + collectionId); - } - return feedResponsePages.getResults().get(0); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Main.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Main.java deleted file mode 100644 index 18c20c619faf..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Main.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.beust.jcommander.JCommander; -import com.beust.jcommander.ParameterException; - -public class Main { - - private final static Logger LOGGER = LoggerFactory.getLogger(Main.class); - - public static void main(String[] args) throws Exception { - org.apache.log4j.Logger.getLogger("io.netty").setLevel(org.apache.log4j.Level.OFF); - - try { - LOGGER.debug("Parsing the arguments ..."); - Configuration cfg = new Configuration(); - cfg.tryGetValuesFromSystem(); - - JCommander jcommander = new JCommander(cfg, args); - if (cfg.isHelp()) { - // prints out the usage help - jcommander.usage(); - return; - } - - AsyncBenchmark benchmark; - switch (cfg.getOperationType()) { - case WriteThroughput: - case WriteLatency: - benchmark = new AsyncWriteBenchmark(cfg); - break; - - case ReadThroughput: - case ReadLatency: - benchmark = new AsyncReadBenchmark(cfg); - break; - - case QueryCross: - case QuerySingle: - case QueryParallel: - case QueryOrderby: - case QueryAggregate: - case QueryTopOrderby: - case QueryAggregateTopOrderby: - benchmark = new AsyncQueryBenchmark(cfg); - break; - - case Mixed: - benchmark = new AsyncMixedBenchmark(cfg); - break; - - case QuerySingleMany: - benchmark = new AsyncQuerySinglePartitionMultiple(cfg); - break; - - case ReadMyWrites: - benchmark = new ReadMyWriteWorkflow(cfg); - break; - - default: - throw new RuntimeException(cfg.getOperationType() + " is not supported"); - } - - benchmark.run(); - benchmark.shutdown(); - - } catch (ParameterException e) { - // if any error in parsing the cmd-line options print out the usage help - System.err.println("Invalid Usage: " + e.getMessage()); - System.err.println("Try '-help' for more information."); - System.exit(1); - } - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/ReadMyWriteWorkflow.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/ReadMyWriteWorkflow.java deleted file mode 100644 index 5115dcfb0060..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/ReadMyWriteWorkflow.java +++ /dev/null @@ -1,419 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.SqlParameter; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.RandomUtils; -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -/** - * This workflow is intended for session and above consistency levels. - *

- * This workflow first will create some documents in cosmosdb and will store them all in its local cache. - * Then at each step will randomly will try to do a write, read its own write, or query for its own write. - */ -class ReadMyWriteWorkflow extends AsyncBenchmark { - private final static String QUERY_FIELD_NAME = "prop"; - private final static String ORDER_BY_FIELD_NAME = "_ts"; - private final static int MAX_TOP_QUERY_COUNT = 2000; - - private ConcurrentHashMap cache; - private int cacheSize; - - ReadMyWriteWorkflow(Configuration cfg) { - super(cfg); - } - - @Override - protected void init() { - this.cacheSize = configuration.getNumberOfPreCreatedDocuments(); - this.cache = new ConcurrentHashMap<>(); - this.populateCache(); - } - - @Override - protected void performWorkload(Subscriber subs, long i) throws Exception { - Observable obs; - boolean readyMyWrite = RandomUtils.nextBoolean(); - if (readyMyWrite) { - // will do a write and immediately upon success will either - // do a point read - // or single partition query - // or cross partition query to find the write. - int j = Math.toIntExact(Math.floorMod(i, 3)); - switch (j) { - case 0: - // write a random document to cosmodb and update the cache. - // then try to read the document which just was written - obs = writeDocument() - .flatMap(d -> readDocument(d)); - break; - case 1: - // write a random document to cosmodb and update the cache. - // then try to query for the document which just was written - obs = writeDocument() - .flatMap(d -> singlePartitionQuery(d) - .switchIfEmpty(Observable.error(new NotFoundException( - "couldn't find my write in a single partition query!")))); - break; - case 2: - // write a random document to cosmodb and update the cache. - // then try to query for the document which just was written - obs = writeDocument() - .flatMap(d -> xPartitionQuery(generateQuery(d)) - .switchIfEmpty(Observable.error(new NotFoundException( - "couldn't find my write in a cross partition query!")))); - break; - default: - assert false; - throw new IllegalStateException(); - } - } else { - // will either do - // a write - // a point read for a in memory cached document - // or single partition query for a in memory cached document - // or cross partition query for a in memory cached document - int j = Math.toIntExact(Math.floorMod(i, 4)); - switch (j) { - case 0: - // write a random document to cosmosdb and update the cache - obs = writeDocument(); - break; - case 1: - // randomly choose a document from the cache and do a single point read - obs = readDocument(cache.get(cacheKey())); - break; - case 2: - // randomly choose a document from the cache and do a single partition query - obs = singlePartitionQuery(cache.get(cacheKey())) - .switchIfEmpty(Observable.error(new NotFoundException( - "couldn't find my cached write in a single partition query!"))); - break; - case 3: - // randomly choose a document from the cache and do a cross partition query - obs = xPartitionQuery(generateRandomQuery()) - .switchIfEmpty(Observable.error(new NotFoundException( - "couldn't find my cached write in a cross partition query!"))); - break; - default: - assert false; - throw new IllegalStateException(); - } - } - - concurrencyControlSemaphore.acquire(); - - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } - - private void populateCache() { - ArrayList> list = new ArrayList<>(); - for (int i = 0; i < cacheSize; i++) { - Observable observable = writeDocument(i); - list.add(observable); - } - - logger.info("Pre-populating {} documents ....", cacheSize); - Observable.merge(list, configuration.getConcurrency()).toCompletable().await(); - logger.info("Finished pre-populating {} documents", cacheSize); - } - - /** - * Writes a random document to cosmosdb and store it in a random location in the cache. - * - * @return Observable of document - */ - private Observable writeDocument() { - return writeDocument(null); - } - - /** - * Writes a random document to cosmosdb and store it in the slot i-th in the cache. - * - * @return Observable of document - */ - private Observable writeDocument(Integer i) { - String idString = Utils.randomUUID().toString(); - String randomVal = Utils.randomUUID().toString(); - Document document = new Document(); - document.setId(idString); - document.set(partitionKey, idString); - document.set(QUERY_FIELD_NAME, randomVal); - document.set("dataField1", randomVal); - document.set("dataField2", randomVal); - document.set("dataField3", randomVal); - document.set("dataField4", randomVal); - - Integer key = i == null ? cacheKey() : i; - return client.createDocument(getCollectionLink(), document, null, false) - .doOnNext(r -> cache.put(key, r.getResource())) - .map(ResourceResponse::getResource); - } - - /** - * given a document tries to read it from cosmosdb - * - * @param d document to be read - * @return Observable of document - */ - private Observable readDocument(Document d) { - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(d.getString(partitionKey))); - - return client.readDocument(getDocumentLink(d), options) - .map(ResourceResponse::getResource); - } - - /** - * Generates a random query - * - * @return a randomly generated query - */ - private SqlQuerySpec generateRandomQuery() { - int docCount = RandomUtils.nextInt(1, 2); - Set keys = new HashSet<>(); - for (int i = 0; i < docCount; i++) { - int key = RandomUtils.nextInt(0, cacheSize); - keys.add(key); - } - List documentList = null; - if (RandomUtils.nextBoolean()) { - documentList = keys.stream().map(cache::get).collect(Collectors.toList()); - } - - int top = RandomUtils.nextInt(0, MAX_TOP_QUERY_COUNT); - boolean useOrderBy = RandomUtils.nextBoolean(); - - return generateQuery(documentList, top > 1000 ? top : null, useOrderBy); - } - - /** - * given a query returns the corresponding observable result - * - * @param query to find document - * @return Observable document - */ - private Observable xPartitionQuery(SqlQuerySpec query) { - FeedOptions options = new FeedOptions(); - options.setMaxDegreeOfParallelism(-1); - options.setEnableCrossPartitionQuery(true); - - return client.queryDocuments(getCollectionLink(), query, options) - .flatMap(p -> Observable.from(p.getResults())); - } - - /** - * given a document returns the corresponding observable result of issuing a single partition query - * for the document. - * - * @param d document to be queried for. - * @return Observable document - */ - private Observable singlePartitionQuery(Document d) { - FeedOptions options = new FeedOptions(); - options.setPartitionKey(new PartitionKey(d.get(partitionKey))); - - SqlQuerySpec sqlQuerySpec = new SqlQuerySpec(String.format("Select top 100 * from c where c.%s = '%s'", - QUERY_FIELD_NAME, - d.getString(QUERY_FIELD_NAME))); - return client.queryDocuments(getCollectionLink(), sqlQuerySpec, options) - .flatMap(p -> Observable.from(p.getResults())); - } - - /** - * Given a document list generates a randomly generated sql query which can find only and only the documents - *

- * The generated query may have a top, orderby, top and orderby. - * - * @param documentList list of documents to be queried for - * @return SqlQuerySpec - */ - private SqlQuerySpec generateQuery(Document... documentList) { - return generateQuery(Arrays.asList(documentList)); - } - - /** - * Given a document list generates a randomly generated sql query which can find only and only the documents - *

- * The generated query may have a top, orderby, top and orderby. - * - * @param documentList list of documents to be queried for - * @return SqlQuerySpec - */ - private SqlQuerySpec generateQuery(List documentList) { - int top = RandomUtils.nextInt(0, MAX_TOP_QUERY_COUNT); - boolean useOrderBy = RandomUtils.nextBoolean(); - - return generateQuery(documentList, top >= documentList.size() ? top : null, useOrderBy); - } - - /** - * Given a document list generates sql query which can find only and only the documents - * - * @param documentList lists of documents to find - * @param topCount if a valid top count, the query will have a top count - * @param withOrderBy if not null, the query will have an orderby clause - * @return SqlQuerySpec - */ - private SqlQuerySpec generateQuery(List documentList, Integer topCount, boolean withOrderBy) { - QueryBuilder queryBuilder = new QueryBuilder(); - if (withOrderBy) { - queryBuilder.orderBy(ORDER_BY_FIELD_NAME); - } - if (documentList != null && !documentList.isEmpty()) { - if (topCount != null) { - topCount = Math.max(topCount, documentList.size()); - } - - queryBuilder.whereClause(QueryBuilder.WhereClause.InWhereClause.asInWhereClause(QUERY_FIELD_NAME, documentList)); - } - - if ((documentList == null || documentList.isEmpty()) && (topCount == null || topCount <= 0)) { - topCount = 100; - } - - if (topCount != null) { - queryBuilder.top(topCount); - } - - return queryBuilder.toSqlQuerySpec(); - } - - private int cacheKey() { - return RandomUtils.nextInt(0, cacheSize); - } - - /** - * This is used for making random query generation with different terms (top, orderby) easier. - */ - static class QueryBuilder { - private String orderByFieldName; - private Integer topCount; - private WhereClause whereClause; - - QueryBuilder top(int top) { - this.topCount = top; - return this; - } - - QueryBuilder orderBy(String fieldName) { - this.orderByFieldName = fieldName; - return this; - } - - QueryBuilder whereClause(WhereClause whereClause) { - this.whereClause = whereClause; - return this; - } - - static abstract class WhereClause { - static class InWhereClause extends WhereClause { - private final List parameters; - private final String whereCondition; - - static InWhereClause asInWhereClause(String fieldName, List documentList) { - List parameters = new ArrayList<>(documentList.size()); - for (int i = 0; i < documentList.size(); i++) { - Object value = documentList.get(i).get(fieldName); - SqlParameter sqlParameter = new SqlParameter("@param" + i, value); - parameters.add(sqlParameter); - } - - return new InWhereClause(fieldName, parameters); - } - - InWhereClause(String fieldName, List parameters) { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(fieldName); - stringBuilder.append(" IN ("); - List params = parameters.stream().map(SqlParameter::getName).collect(Collectors.toList()); - stringBuilder.append(String.join(", ", params)); - stringBuilder.append(")"); - - this.whereCondition = stringBuilder.toString(); - this.parameters = parameters; - } - - @Override - String getWhereCondition(String rootName) { - return rootName + "." + this.whereCondition; - } - - @Override - SqlParameterCollection getSqlParameterCollection() { - return new SqlParameterCollection(this.parameters); - } - } - - abstract String getWhereCondition(String rootName); - - abstract SqlParameterCollection getSqlParameterCollection(); - } - - SqlQuerySpec toSqlQuerySpec() { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("SELECT"); - - if (topCount != null) { - stringBuilder.append(" TOP ").append(topCount); - } - - stringBuilder.append(" * FROM root"); - if (whereClause != null) { - stringBuilder.append(" WHERE "); - stringBuilder.append(whereClause.getWhereCondition("root")); - - } - - if (orderByFieldName != null) { - stringBuilder.append(" ORDER BY ").append("root.").append(orderByFieldName); - } - - return whereClause == null ? - new SqlQuerySpec(stringBuilder.toString()) : - new SqlQuerySpec(stringBuilder.toString(), whereClause.getSqlParameterCollection()); - } - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/resources/log4j.properties b/cosmosdb/data-plane/benchmark/src/main/resources/log4j.properties deleted file mode 100644 index 92751a419201..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/resources/log4j.properties +++ /dev/null @@ -1,14 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -log4j.category.com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd=WARN -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n \ No newline at end of file diff --git a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/QueryBuilderTest.java b/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/QueryBuilderTest.java deleted file mode 100644 index d83d5505e1d3..000000000000 --- a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/QueryBuilderTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.SqlParameter; -import org.testng.annotations.Test; - -import static com.microsoft.azure.cosmosdb.benchmark.ReadMyWriteWorkflow.QueryBuilder.WhereClause; -import static org.assertj.core.api.Assertions.assertThat; - -public class QueryBuilderTest { - - @Test(groups = {"unit"}) - public void basic() { - ReadMyWriteWorkflow.QueryBuilder queryBuilder = new ReadMyWriteWorkflow.QueryBuilder(); - assertThat(queryBuilder.toSqlQuerySpec().getQueryText()) - .isEqualTo("SELECT * FROM root"); - } - - @Test(groups = {"unit"}) - public void top() { - ReadMyWriteWorkflow.QueryBuilder queryBuilder = new ReadMyWriteWorkflow.QueryBuilder(); - queryBuilder.top(50); - assertThat(queryBuilder.toSqlQuerySpec().getQueryText()) - .isEqualTo("SELECT TOP 50 * FROM root"); - } - - @Test(groups = {"unit"}) - public void orderBy() { - ReadMyWriteWorkflow.QueryBuilder queryBuilder = new ReadMyWriteWorkflow.QueryBuilder(); - queryBuilder.orderBy("prop"); - assertThat(queryBuilder.toSqlQuerySpec().getQueryText()) - .isEqualTo("SELECT * FROM root ORDER BY root.prop"); - } - - @Test(groups = {"unit"}) - public void whereInClause() { - ReadMyWriteWorkflow.QueryBuilder queryBuilder = new ReadMyWriteWorkflow.QueryBuilder(); - - ImmutableList parameters = ImmutableList.of(new SqlParameter("@param1", 1), - new SqlParameter("@param2", 2)); - queryBuilder.whereClause(new WhereClause.InWhereClause("colName", - parameters)); - assertThat(queryBuilder.toSqlQuerySpec().getQueryText()) - .isEqualTo("SELECT * FROM root WHERE root.colName IN (@param1, @param2)"); - assertThat(queryBuilder.toSqlQuerySpec().getParameters()).containsExactlyElementsOf(parameters); - } - - @Test(groups = {"unit"}) - public void topOrderByWhereClause() { - ReadMyWriteWorkflow.QueryBuilder queryBuilder = new ReadMyWriteWorkflow.QueryBuilder(); - queryBuilder.orderBy("prop"); - queryBuilder.top(5); - - ImmutableList parameters = ImmutableList.of(new SqlParameter("@param1", 1), - new SqlParameter("@param2", 2)); - queryBuilder.whereClause(new WhereClause.InWhereClause("colName", - parameters)); - assertThat(queryBuilder.toSqlQuerySpec().getQueryText()) - .isEqualTo("SELECT TOP 5 * FROM root WHERE root.colName IN (@param1, @param2) ORDER BY root.prop"); - assertThat(queryBuilder.toSqlQuerySpec().getParameters()).containsExactlyElementsOf(parameters); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/Utils.java b/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/Utils.java deleted file mode 100644 index 49517fd05cb5..000000000000 --- a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/Utils.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import rx.Observable; - -public class Utils { - public static AsyncDocumentClient housekeepingClient() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - RetryOptions options = new RetryOptions(); - options.setMaxRetryAttemptsOnThrottledRequests(100); - options.setMaxRetryWaitTimeInSeconds(60); - connectionPolicy.setRetryOptions(options); - return new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - } - - public static String getCollectionLink(Database db, DocumentCollection collection) { - return "dbs/" + db.getId() + "/colls/" + collection; - } - - public static Database createDatabaseForTest(AsyncDocumentClient client) { - return DatabaseForTest.create(DatabaseManagerImpl.getInstance(client)).createdDatabase; - } - - public static void safeCleanDatabases(AsyncDocumentClient client) { - if (client != null) { - DatabaseForTest.cleanupStaleTestDatabases(DatabaseManagerImpl.getInstance(client)); - } - } - - public static void safeClean(AsyncDocumentClient client, Database database) { - if (database != null) { - safeClean(client, database.getId()); - } - } - - public static void safeClean(AsyncDocumentClient client, String databaseId) { - if (client != null) { - if (databaseId != null) { - try { - client.deleteDatabase("/dbs/" + databaseId, null).toBlocking().single(); - } catch (Exception e) { - } - } - } - } - - public static String generateDatabaseId() { - return DatabaseForTest.generateId(); - } - - public static void safeClose(AsyncDocumentClient client) { - if (client != null) { - client.close(); - } - } - - private static class DatabaseManagerImpl implements DatabaseForTest.DatabaseManager { - public static DatabaseManagerImpl getInstance(AsyncDocumentClient client) { - return new DatabaseManagerImpl(client); - } - - private final AsyncDocumentClient client; - - private DatabaseManagerImpl(AsyncDocumentClient client) { - this.client = client; - } - - @Override - public Observable> queryDatabases(SqlQuerySpec query) { - return client.queryDatabases(query, null); - } - - @Override - public Observable> createDatabase(Database databaseDefinition) { - return client.createDatabase(databaseDefinition, null); - } - - @Override - public Observable> deleteDatabase(String id) { - - return client.deleteDatabase("dbs/" + id, null); - } - } -} diff --git a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/WorkflowTest.java b/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/WorkflowTest.java deleted file mode 100644 index 6490d47bcb6d..000000000000 --- a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/WorkflowTest.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.beust.jcommander.JCommander; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.assertj.core.api.Assertions.assertThat; - -public class WorkflowTest { - private static final int TIMEOUT = 120000; - private Database database; - private DocumentCollection collection; - - @Test(groups = "simple", timeOut = TIMEOUT) - public void readMyWritesCLI() throws Exception { - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations 123" + - " -operation ReadMyWrites -connectionMode Direct -numberOfPreCreatedDocuments 100"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId()); - Main.main(StringUtils.split(cmd)); - } - - @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "simple", timeOut = TIMEOUT) - public void readMyWrites(boolean useNameLink) throws Exception { - int numberOfOperations = 123; - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations %s" + - " -operation ReadMyWrites -connectionMode Direct -numberOfPreCreatedDocuments 100"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId(), - numberOfOperations) - + (useNameLink ? " -useNameLink" : ""); - - Configuration cfg = new Configuration(); - new JCommander(cfg, StringUtils.split(cmd)); - - AtomicInteger success = new AtomicInteger(); - AtomicInteger error = new AtomicInteger(); - - ReadMyWriteWorkflow wf = new ReadMyWriteWorkflow(cfg) { - @Override - protected void onError(Throwable throwable) { - error.incrementAndGet(); - } - - @Override - protected void onSuccess() { - success.incrementAndGet(); - } - }; - - wf.run(); - wf.shutdown(); - - assertThat(error).hasValue(0); - assertThat(success).hasValue(numberOfOperations); - } - - @Test(groups = "simple", timeOut = TIMEOUT) - public void writeLatencyCLI() throws Exception { - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations 1000" + - " -operation WriteLatency -connectionMode Direct"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId()); - Main.main(StringUtils.split(cmd)); - } - - @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "simple", timeOut = TIMEOUT) - public void writeLatency(boolean useNameLink) throws Exception { - int numberOfOperations = 123; - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations %s" + - " -operation WriteLatency -connectionMode Direct"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId(), - numberOfOperations) - + (useNameLink ? " -useNameLink" : ""); - - Configuration cfg = new Configuration(); - new JCommander(cfg, StringUtils.split(cmd)); - - AtomicInteger success = new AtomicInteger(); - AtomicInteger error = new AtomicInteger(); - - AsyncWriteBenchmark wf = new AsyncWriteBenchmark(cfg) { - @Override - protected void onError(Throwable throwable) { - error.incrementAndGet(); - } - - @Override - protected void onSuccess() { - success.incrementAndGet(); - } - }; - - wf.run(); - wf.shutdown(); - - assertThat(error).hasValue(0); - assertThat(success).hasValue(numberOfOperations); - } - - @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "simple", timeOut = TIMEOUT) - public void writeThroughput(boolean useNameLink) throws Exception { - int numberOfOperations = 123; - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations %s" + - " -operation WriteThroughput -connectionMode Direct"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId(), - numberOfOperations) - + (useNameLink ? " -useNameLink" : ""); - - Configuration cfg = new Configuration(); - new JCommander(cfg, StringUtils.split(cmd)); - - AtomicInteger success = new AtomicInteger(); - AtomicInteger error = new AtomicInteger(); - - AsyncWriteBenchmark wf = new AsyncWriteBenchmark(cfg) { - @Override - protected void onError(Throwable throwable) { - error.incrementAndGet(); - } - - @Override - protected void onSuccess() { - success.incrementAndGet(); - } - }; - - wf.run(); - wf.shutdown(); - - assertThat(error).hasValue(0); - assertThat(success).hasValue(numberOfOperations); - } - - @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "simple", timeOut = TIMEOUT) - public void readLatency(boolean useNameLink) throws Exception { - int numberOfOperations = 123; - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations %s" + - " -operation ReadLatency -connectionMode Direct"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId(), - numberOfOperations) - + (useNameLink ? " -useNameLink" : ""); - - Configuration cfg = new Configuration(); - new JCommander(cfg, StringUtils.split(cmd)); - - AtomicInteger success = new AtomicInteger(); - AtomicInteger error = new AtomicInteger(); - - AsyncReadBenchmark wf = new AsyncReadBenchmark(cfg) { - @Override - protected void onError(Throwable throwable) { - error.incrementAndGet(); - } - - @Override - protected void onSuccess() { - success.incrementAndGet(); - } - }; - - wf.run(); - wf.shutdown(); - - assertThat(error).hasValue(0); - assertThat(success).hasValue(numberOfOperations); - } - - @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "simple", timeOut = TIMEOUT) - public void readThroughput(boolean useNameLink) throws Exception { - int numberOfOperations = 123; - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations %s" + - " -operation ReadThroughput -connectionMode Direct"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId(), - numberOfOperations) - + (useNameLink ? " -useNameLink" : ""); - - Configuration cfg = new Configuration(); - new JCommander(cfg, StringUtils.split(cmd)); - - AtomicInteger success = new AtomicInteger(); - AtomicInteger error = new AtomicInteger(); - - AsyncReadBenchmark wf = new AsyncReadBenchmark(cfg) { - @Override - protected void onError(Throwable throwable) { - error.incrementAndGet(); - } - - @Override - protected void onSuccess() { - success.incrementAndGet(); - } - }; - - wf.run(); - wf.shutdown(); - - assertThat(error).hasValue(0); - assertThat(success).hasValue(numberOfOperations); - } - - @BeforeClass(groups = "simple", timeOut = TIMEOUT) - public void beforeClass() { - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10000); - AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); - database = Utils.createDatabaseForTest(housekeepingClient); - collection = housekeepingClient.createCollection("dbs/"+ database.getId(), - getCollectionDefinitionWithRangeRangeIndex(), - options) - .toBlocking().single().getResource(); - housekeepingClient.close(); - } - - @DataProvider(name = "collectionLinkTypeArgProvider") - public Object[][] collectionLinkTypeArgProvider() { - return new Object[][]{ - // is namebased - {true}, - {false}, - }; - } - - @AfterClass(groups = "simple", timeOut = TIMEOUT) - public void afterClass() { - AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); - Utils.safeCleanDatabases(housekeepingClient); - Utils.safeClean(housekeepingClient, database); - Utils.safeClose(housekeepingClient); - } - - DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } -} diff --git a/cosmosdb/data-plane/changelog/README.md b/cosmosdb/data-plane/changelog/README.md deleted file mode 100644 index f72d0684abc2..000000000000 --- a/cosmosdb/data-plane/changelog/README.md +++ /dev/null @@ -1,111 +0,0 @@ -## Changelog - -### 2.4.3 -* Fixed resource leak issue on closing client - -### 2.4.2 -* Fixed bugs in continuation token support for cross partition queries - -### 2.4.1 -* Fixed some bugs in Direct mode. -* Improved logging in Direct mode. -* Improved connection management. - -### 2.4.0 -* Direct GA. -* Added support for QueryMetrics. -* Changed the APIs accepting java.util.Collection for which order is important to accept java.util.List instead. Now ConnectionPolicy#getPreferredLocations(), JsonSerialization, and PartitionKey(.) accept List. - -### 2.4.0-beta1 - -* Added support for Direct Https. -* Changed the APIs accepting java.util.Collection for which order is important to accept java.util.List instead. - Now ConnectionPolicy#getPreferredLocations(), JsonSerialization, and PartitionKey(.) accept List. -* Fixed a Session bug for Document query in Gateway mode. -* Upgraded dependencies (netty 0.4.20 [github #79](https://github.com/Azure/azure-cosmosdb-java/issues/79), RxJava 1.3.8). - -### 2.3.1 - -* Fix handling very large query responses. -* Fix resource token handling when instantiating client ([github #78](https://github.com/Azure/azure-cosmosdb-java/issues/78)). -* Upgraded vulnerable dependency jackson-databind ([github #77](https://github.com/Azure/azure-cosmosdb-java/pull/77)). - -### 2.3.0 - -* Fixed a resource leak bug. -* Added support for MultiPolygon -* Added support for custom headers in RequestOptions. - -### 2.2.2 -* Fixed a packaging bug. - -### 2.2.1 -* Fixed a NPE bug in write retry path. -* Fixed a NPE bug in endpoint management. -* Upgraded vulnerable dependencies ([github #68](https://github.com/Azure/azure-cosmosdb-java/issues/68)). -* Added support for Netty network logging for troubleshooting. - -### 2.2.0 -* Added support for Multi-region write. - -### 2.1.0 -* Added support for Proxy. -* Added support for resource token authorization. -* Fixed a bug in handling large partition keys ([github #63](https://github.com/Azure/azure-cosmosdb-java/issues/63)). -* Documentation improved. -* SDK restructured into more granular modules. - -### 2.0.1 -- Fixed a bug for non-english locales ([github #51](https://github.com/Azure/azure-cosmosdb-java/issues/51)). -- Added helper methods for Conflict resource. - -### 2.0.0 -- Replaced org.json dependency by jackson due to performance reasons and licensing ([github #29](https://github.com/Azure/azure-cosmosdb-java/issues/29)). -- Removed deprecated OfferV2 class. -- Added accessor method to Offer class for throughput content. -- Any method in Document/Resource returning org.json types changed to return a jackson object type. -- getObject(.) method of classes extending JsonSerializable changed to return a jackson ObjectNode type. -- getCollection(.) method changed to return Collection of ObjectNode. -- Removed JsonSerializable subclasses' constructors with org.json.JSONObject arg. -- JsonSerializable.toJson (SerializationFormattingPolicy.Indented) now uses two spaces for indentation. - -### 1.0.2 -- Added support for Unique Index Policy. -- Added support for limiting response continuation token size in feed options. -- Added support for Partition Split in Cross Partition Query. -- Fixed a bug in Json timestamp serialization ([github #32](https://github.com/Azure/azure-cosmosdb-java/issues/32)). -- Fixed a bug in Json enum serialization. -- Fixed a bug in managing documents of 2MB size ([github #33](https://github.com/Azure/azure-cosmosdb-java/issues/33)). -- Dependency com.fasterxml.jackson.core:jackson-databind upgraded to 2.9.5 due to a bug ([jackson-databind: github #1599](https://github.com/FasterXML/jackson-databind/issues/1599)) -- Dependency on rxjava-extras upgraded to 0.8.0.17 due to a bug ([rxjava-extras: github #30](https://github.com/davidmoten/rxjava-extras/issues/30)). -- The metadata description in pom file updated to be inline with the rest of documentation. -- Syntax improvement ([github #41](https://github.com/Azure/azure-cosmosdb-java/issues/41)), ([github #40](https://github.com/Azure/azure-cosmosdb-java/issues/40)). - -### 1.0.1 -- Added back-pressure support in query. -- Added support for partition key range id in query. -- Changed to allow larger continuation token in request header (bugfix github #24). -- netty dependency upgraded to 4.1.22.Final to ensure JVM shuts down after main thread finishes. -- Changed to avoid passing session token when reading master resources. -- Added more examples. -- Added more benchmarking scenarios. -- Fixed java header files for proper javadoc generation. - -### 1.0.0 -- Release 1.0.0 has fully end to end support for non-blocking IO using netty library in Gateway mode. -- Dependency on ``azure-documentdb`` SDK removed. -- Artifact id changed to ``azure-cosmosdb`` from ``azure-documentdb-rx`` in 0.9.0-rc2. -- Java package name changed to ``com.microsoft.azure.cosmosdb`` from ``com.microsoft.azure.documentdb`` in 0.9.0-rc2. - -### 0.9.0-rc2 -- ``FeedResponsePage`` renamed to ``FeedReponse`` -- Some minor modifications to ``ConnectionPolicy`` configuration. -All time fields and methods in ConnectionPolicy suffixed with "InMillis" to be more precise of the time unit. -- ``ConnectionPolicy#setProxy()`` removed. -- ``FeedOptions#pageSize`` renamed to -``FeedOptions#maxItemCount`` -- Release 1.0.0 deprecates 0.9.x releases. - -### 0.9.0-rc1 -- First release of ``azure-documentdb-rx`` SDK. -- CRUD Document API fully non-blocking using netty. Query async API implemented as a wrapper using blocking SDK ``azure-documentdb``. diff --git a/cosmosdb/data-plane/commons-test-utils/pom.xml b/cosmosdb/data-plane/commons-test-utils/pom.xml deleted file mode 100644 index f06ce657bcb6..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/pom.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - azure-cosmosdb-commons-test-utils - Common Test Components for Testing Async SDK for SQL API of Azure Cosmos DB Service - Common Test Components for Testing Async SDK for SQL API of Azure Cosmos DB Service - jar - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.0 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - com.microsoft.azure - azure-cosmosdb-commons - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.testng - testng - ${testng.version} - - - org.assertj - assertj-core - ${assertj.version} - - - org.mockito - mockito-all - ${mockito.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - - - log4j - log4j - ${log4j.version} - - - com.google.guava - guava - ${guava.version} - - - diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/BridgeUtils.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/BridgeUtils.java deleted file mode 100644 index f5e449b53fc9..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/BridgeUtils.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.List; - -/** - * This is a helper class for testing. - */ -public class BridgeUtils { - - public static DatabaseAccount createDatabaseAccount(List readLocations, - List writeLocations, - boolean useMultipleWriteLocations) { - DatabaseAccount dbAccount = new DatabaseAccount(); - dbAccount.setEnableMultipleWriteLocations(useMultipleWriteLocations); - - dbAccount.setReadableLocations(readLocations); - dbAccount.setWritableLocations(writeLocations); - - return dbAccount; - } - - public static DatabaseAccountLocation createDatabaseAccountLocation(String name, String endpoint) { - DatabaseAccountLocation dal = new DatabaseAccountLocation(); - dal.setName(name); - dal.setEndpoint(endpoint); - - return dal; - } - - public static ConflictResolutionPolicy createConflictResolutionPolicy() { - return new ConflictResolutionPolicy(); - } - - public static ConflictResolutionPolicy setMode(ConflictResolutionPolicy policy, ConflictResolutionMode mode) { - policy.setMode(mode); - return policy; - } - - public static ConflictResolutionPolicy setPath(ConflictResolutionPolicy policy, String path) { - policy.setConflictResolutionPath(path); - return policy; - } - - public static ConflictResolutionPolicy setStoredProc(ConflictResolutionPolicy policy, String storedProcLink) { - policy.setConflictResolutionProcedure(storedProcLink); - return policy; - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/ConfigsBuilder.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/ConfigsBuilder.java deleted file mode 100644 index ff8ec498a823..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/ConfigsBuilder.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import org.mockito.Mockito; - -/** - * This can be used for testing. - */ -public class ConfigsBuilder { - private Configs configs = Mockito.spy(new Configs()); - - public static ConfigsBuilder instance() { - return new ConfigsBuilder(); - } - - public ConfigsBuilder withProtocol(Protocol protocol) { - Mockito.doReturn(protocol).when(configs).getProtocol(); - return this; - } - - public Configs build() { - return configs; - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/DatabaseForTest.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/DatabaseForTest.java deleted file mode 100644 index 1e646d58e6eb..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/DatabaseForTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; - -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DatabaseForTest { - private static Logger logger = LoggerFactory.getLogger(DatabaseForTest.class); - public static final String SHARED_DB_ID_PREFIX = "RxJava.SDKTest.SharedDatabase"; - private static final Duration CLEANUP_THRESHOLD_DURATION = Duration.ofHours(1); - private static final String DELIMITER = "_"; - private static DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss"); - - public LocalDateTime createdTime; - public Database createdDatabase; - - private DatabaseForTest(Database db, LocalDateTime createdTime) { - this.createdDatabase = db; - this.createdTime = createdTime; - } - - private boolean isStale() { - return isOlderThan(CLEANUP_THRESHOLD_DURATION); - } - - private boolean isOlderThan(Duration dur) { - return createdTime.isBefore(LocalDateTime.now().minus(dur)); - } - - public static String generateId() { - return SHARED_DB_ID_PREFIX + DELIMITER + TIME_FORMATTER.format(LocalDateTime.now()) + DELIMITER + RandomStringUtils.randomAlphabetic(3); - } - - private static DatabaseForTest from(Database db) { - if (db == null || db.getId() == null || db.getSelfLink() == null) { - return null; - } - - String id = db.getId(); - if (id == null) { - return null; - } - - String[] parts = StringUtils.split(id, DELIMITER); - if (parts.length != 3) { - return null; - } - if (!StringUtils.equals(parts[0], SHARED_DB_ID_PREFIX)) { - return null; - } - - try { - LocalDateTime parsedTime = LocalDateTime.parse(parts[1], TIME_FORMATTER); - return new DatabaseForTest(db, parsedTime); - } catch (Exception e) { - return null; - } - } - - public static DatabaseForTest create(DatabaseManager client) { - Database dbDef = new Database(); - dbDef.setId(generateId()); - - Database db = client.createDatabase(dbDef).toBlocking().single().getResource(); - DatabaseForTest dbForTest = DatabaseForTest.from(db); - assertThat(dbForTest).isNotNull(); - return dbForTest; - } - - public static void cleanupStaleTestDatabases(DatabaseManager client) { - logger.info("Cleaning stale test databases ..."); - List dbs = client.queryDatabases( - new SqlQuerySpec("SELECT * FROM c WHERE STARTSWITH(c.id, @PREFIX)", - new SqlParameterCollection(new SqlParameter("@PREFIX", DatabaseForTest.SHARED_DB_ID_PREFIX)))) - .flatMap(page -> Observable.from(page.getResults())).toList().toBlocking().single(); - - for (Database db : dbs) { - assertThat(db.getId()).startsWith(DatabaseForTest.SHARED_DB_ID_PREFIX); - - DatabaseForTest dbForTest = DatabaseForTest.from(db); - - if (db != null && dbForTest.isStale()) { - logger.info("Deleting database {}", db.getId()); - client.deleteDatabase(db.getId()).toBlocking().single(); - } - } - } - - public interface DatabaseManager { - Observable> queryDatabases(SqlQuerySpec query); - Observable> createDatabase(Database databaseDefinition); - Observable> deleteDatabase(String id); - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUnderTestWrapper.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUnderTestWrapper.java deleted file mode 100644 index ffb118d8d852..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUnderTestWrapper.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.mockito.Mockito.doAnswer; - -/** - * This is a helper class for capturing requests sent over a httpClient. - */ -public class HttpClientUnderTestWrapper { - final private CompositeHttpClient origHttpClient; - final private CompositeHttpClient spyHttpClient; - - public final List> capturedRequest = Collections.synchronizedList(new ArrayList<>()); - - public HttpClientUnderTestWrapper(CompositeHttpClient origHttpClient) { - this.origHttpClient = origHttpClient; - this.spyHttpClient = Mockito.spy(origHttpClient); - - initRequestCapture(spyHttpClient); - } - - public CompositeHttpClient getSpyHttpClient() { - return spyHttpClient; - } - - void initRequestCapture(CompositeHttpClient spyClient) { - - doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - RxClient.ServerInfo serverInfo = invocationOnMock.getArgumentAt(0, RxClient.ServerInfo.class); - HttpClientRequest httpReq = invocationOnMock.getArgumentAt(1, HttpClientRequest.class); - capturedRequest.add(httpReq); - return origHttpClient.submit(serverInfo, httpReq); - } - }).when(spyClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class)); - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseBuilder.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseBuilder.java deleted file mode 100644 index 5a1c1900d920..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseBuilder.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -import java.math.BigDecimal; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class StoreResponseBuilder { - private int status; - private List> headerEntries; - private String content; - - public static StoreResponseBuilder create() { - return new StoreResponseBuilder(); - } - - public StoreResponseBuilder() { - headerEntries = new ArrayList<>(); - } - - public StoreResponseBuilder withHeader(String key, String value) { - headerEntries.add(new AbstractMap.SimpleEntry(key, value)); - return this; - } - - public StoreResponseBuilder withLSN(long lsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.LSN, Long.toString(lsn))); - return this; - } - - public StoreResponseBuilder withRequestCharge(BigDecimal requestCharge) { - withRequestCharge(requestCharge.doubleValue()); - return this; - } - - public StoreResponseBuilder withRequestCharge(double requestCharge) { - headerEntries.add(new AbstractMap.SimpleEntry(HttpConstants.HttpHeaders.REQUEST_CHARGE, Double.toString(requestCharge))); - return this; - } - - public StoreResponseBuilder withLocalLSN(long localLsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(localLsn))); - return this; - } - - public StoreResponseBuilder withPartitionKeyRangeId(String partitionKeyRangeId) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId)); - return this; - } - - public StoreResponseBuilder withItemLocalLSN(long itemLocalLsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.ITEM_LOCAL_LSN, Long.toString(itemLocalLsn))); - return this; - } - - public StoreResponseBuilder withQuorumAckecdLsn(long quorumAckecdLsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, Long.toString(quorumAckecdLsn))); - return this; - } - - public StoreResponseBuilder withQuorumAckecdLocalLsn(long quorumAckecdLocalLsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(quorumAckecdLocalLsn))); - return this; - } - - public StoreResponseBuilder withGlobalCommittedLsn(long globalCommittedLsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn))); - return this; - } - - public StoreResponseBuilder withSessionToken(String sessionToken) { - headerEntries.add(new AbstractMap.SimpleEntry(HttpConstants.HttpHeaders.SESSION_TOKEN, sessionToken)); - return this; - } - - public StoreResponseBuilder withStatus(int status) { - this.status = status; - return this; - } - - public StoreResponseBuilder withContent(String content) { - this.content = content; - return this; - } - - public StoreResponse build() { - return new StoreResponse(status, headerEntries, content); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestContextValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestContextValidator.java deleted file mode 100644 index 5458c36929b9..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestContextValidator.java +++ /dev/null @@ -1,97 +0,0 @@ - -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public interface DocumentServiceRequestContextValidator { - - static Builder builder() { - return new Builder(); - } - - void validate(T v); - - class Builder { - private List> validators = new ArrayList<>(); - - public DocumentServiceRequestContextValidator build() { - return new DocumentServiceRequestContextValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(T v) { - for (DocumentServiceRequestContextValidator validator : validators) { - validator.validate(v); - } - } - }; - } - - - public Builder add(DocumentServiceRequestContextValidator validator) { - validators.add(validator); - return this; - } - - public Builder qurorumSelectedLSN(long quoriumSelectedLSN) { - add(new DocumentServiceRequestContextValidator() { - @Override - public void validate(DocumentServiceRequestContext v) { - assertThat(v.quorumSelectedLSN).isEqualTo(quoriumSelectedLSN); - } - }); - return this; - } - - public Builder globalCommittedSelectedLSN(long globalCommittedSelectedLSN) { - add(new DocumentServiceRequestContextValidator() { - @Override - public void validate(DocumentServiceRequestContext v) { - assertThat(v.globalCommittedSelectedLSN).isEqualTo(globalCommittedSelectedLSN); - } - }); - return this; - } - - public Builder storeResponses(List storeResponses) { - add(new DocumentServiceRequestContextValidator() { - @Override - public void validate(DocumentServiceRequestContext v) { - assertThat(v.storeResponses).isEqualTo(storeResponses); - } - }); - return this; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestValidator.java deleted file mode 100644 index d26d13cd3c57..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestValidator.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public interface DocumentServiceRequestValidator { - - static Builder builder() { - return new Builder(); - } - - void validate(T v); - - class Builder { - private List> validators = new ArrayList<>(); - - public DocumentServiceRequestValidator build() { - return new DocumentServiceRequestValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(T v) { - for (DocumentServiceRequestValidator validator : validators) { - validator.validate(v); - } - } - }; - } - - public Builder add(DocumentServiceRequestValidator validator) { - validators.add(validator); - return this; - } - - public Builder withResourceType(ResourceType resourceType) { - add(new DocumentServiceRequestValidator() { - @Override - public void validate(T v) { - assertThat(v.getResourceType()).isEqualTo(resourceType); - } - }); - return this; - } - - public Builder withOperationType(OperationType operationType) { - add(new DocumentServiceRequestValidator() { - @Override - public void validate(T v) { - assertThat(v.getOperationType()).isEqualTo(operationType); - } - }); - return this; - } - - public Builder resourceTypeIn(ResourceType... resourceType) { - add(new DocumentServiceRequestValidator() { - @Override - public void validate(T v) { - assertThat(v.getResourceType()).isIn((Object[]) resourceType); - } - }); - return this; - } - - public Builder resourceTypeNotIn(ResourceType... resourceType) { - add(new DocumentServiceRequestValidator() { - @Override - public void validate(T v) { - assertThat(v.getResourceType()).isNotIn((Object[]) resourceType); - } - }); - return this; - } - - public Builder add(DocumentServiceRequestContextValidator validator) { - add(new DocumentServiceRequestValidator() { - @Override - public void validate(RxDocumentServiceRequest request) { - validator.validate(request.requestContext); - } - }); - return this; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FailureValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FailureValidator.java deleted file mode 100644 index 2ad5ec534aa6..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FailureValidator.java +++ /dev/null @@ -1,349 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; - -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public interface FailureValidator { - - static Builder builder() { - return new Builder(); - } - - void validate(Throwable t); - - class Builder { - private List validators = new ArrayList<>(); - - public FailureValidator build() { - return new FailureValidator() { - @Override - public void validate(Throwable t) { - for (FailureValidator validator : validators) { - validator.validate(t); - } - } - }; - } - - public Builder statusCode(int statusCode) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getStatusCode()).isEqualTo(statusCode); - } - }); - return this; - } - - public Builder lsnGreaterThan(long quorumAckedLSN) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(BridgeInternal.getLSN((DocumentClientException) t) > quorumAckedLSN).isTrue(); - } - }); - return this; - } - - public Builder lsnGreaterThanEqualsTo(long quorumAckedLSN) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(BridgeInternal.getLSN((DocumentClientException) t) >= quorumAckedLSN).isTrue(); - } - }); - return this; - } - - public Builder exceptionQuorumAckedLSNInNotNull() { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException documentClientException = (DocumentClientException) t; - long exceptionQuorumAckedLSN = -1; - if (documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.QUORUM_ACKED_LSN) != null) { - exceptionQuorumAckedLSN = Long.parseLong((String) documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.QUORUM_ACKED_LSN)); - - } - assertThat(exceptionQuorumAckedLSN).isNotEqualTo(-1); - } - }); - return this; - } - - public Builder errorMessageContains(String errorMsg) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t.getMessage()).contains(errorMsg); - } - }); - return this; - } - - public Builder notNullActivityId() { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getActivityId()).isNotNull(); - } - }); - return this; - } - - public Builder error(Error error) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getError().toJson()).isEqualTo(error.toJson()); - } - }); - return this; - } - - public Builder subStatusCode(Integer substatusCode) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getSubStatusCode()).isEqualTo(substatusCode); - } - }); - return this; - } - - public Builder unknownSubStatusCode() { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getSubStatusCode()).isEqualTo(HttpConstants.SubStatusCodes.UNKNOWN); - } - }); - return this; - } - - public Builder responseHeader(String key, String value) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getResponseHeaders().get(key)).isEqualTo(value); - } - }); - return this; - } - - public Builder lsn(long lsn) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(BridgeInternal.getLSN(ex)).isEqualTo(lsn); - } - }); - return this; - } - - public Builder partitionKeyRangeId(String pkrid) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(BridgeInternal.getPartitionKeyRangeId(ex)).isEqualTo(pkrid); - } - }); - return this; - } - - public Builder resourceAddress(String resourceAddress) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(BridgeInternal.getResourceAddress(ex)).isEqualTo(resourceAddress); - } - }); - return this; - } - - public Builder instanceOf(Class cls) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(cls); - } - }); - return this; - } - - public Builder sameAs(Exception exception) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isSameAs(exception); - } - }); - return this; - } - - public Builder resourceNotFound() { - - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(ex.getStatusCode()).isEqualTo(404); - - } - }); - return this; - } - - public Builder resourceTokenNotFound() { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(IllegalArgumentException.class); - IllegalArgumentException ex = (IllegalArgumentException) t; - assertThat(ex.getMessage()).isEqualTo(RMResources.ResourceTokenNotFound); - } - }); - return this; - } - - public Builder resourceAlreadyExists() { - - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(ex.getStatusCode()).isEqualTo(409); - - } - }); - return this; - } - - public Builder causeInstanceOf(Class cls) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t.getCause()).isNotNull(); - assertThat(t.getCause()).isInstanceOf(cls); - } - }); - return this; - } - - public Builder causeOfCauseInstanceOf(Class cls) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t.getCause()).isNotNull(); - assertThat(t.getCause().getCause()).isNotNull(); - assertThat(t.getCause().getCause()).isInstanceOf(cls); - } - }); - return this; - } - - public Builder documentClientExceptionHeaderRequestContainsEntry(String key, String value) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(BridgeInternal.getRequestHeaders(ex)).containsEntry(key, value); - } - }); - return this; - } - - public Builder withRuntimeExceptionMessage(String message) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(RuntimeException.class); - assertThat(t.getMessage()).isEqualTo(message); - } - }); - return this; - } - - public Builder withRuntimeExceptionClass(Class k) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(RuntimeException.class); - assertThat(t).isInstanceOf(k); - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseListValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseListValidator.java deleted file mode 100644 index 6356f1363fff..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseListValidator.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.Resource; - -public interface FeedResponseListValidator { - - void validate(List> feedList); - - class Builder { - private List> validators = new ArrayList<>(); - - public FeedResponseListValidator build() { - return new FeedResponseListValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(List> feedList) { - for (FeedResponseListValidator validator : validators) { - validator.validate(feedList); - } - } - }; - } - - public Builder totalSize(final int expectedCount) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - int resultCount = feedList.stream().mapToInt(f -> f.getResults().size()).sum(); - assertThat(resultCount) - .describedAs("total number of results").isEqualTo(expectedCount); - } - }); - return this; - } - - public Builder containsExactly(List expectedIds) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - List actualIds = feedList - .stream() - .flatMap(f -> f.getResults().stream()) - .map(r -> r.getResourceId()) - .collect(Collectors.toList()); - assertThat(actualIds) - .describedAs("Resource IDs of results") - .containsExactlyElementsOf(expectedIds); - } - }); - return this; - } - - public Builder validateAllResources(Map> resourceIDToValidator) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - List resources = feedList - .stream() - .flatMap(f -> f.getResults().stream()) - .collect(Collectors.toList()); - - for(T r: resources) { - ResourceValidator validator = resourceIDToValidator.get(r.getResourceId()); - assertThat(validator).isNotNull(); - validator.validate(r); - } - } - }); - return this; - } - - public Builder exactlyContainsInAnyOrder(List expectedIds) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - List actualIds = feedList - .stream() - .flatMap(f -> f.getResults().stream()) - .map(r -> r.getResourceId()) - .collect(Collectors.toList()); - assertThat(actualIds) - .describedAs("Resource IDs of results") - .containsOnlyElementsOf(expectedIds); - } - }); - return this; - } - - public Builder numberOfPages(int expectedNumberOfPages) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - assertThat(feedList) - .describedAs("number of pages") - .hasSize(expectedNumberOfPages); - } - }); - return this; - } - - public Builder numberOfPagesIsGreaterThanOrEqualTo(int leastNumber) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - assertThat(feedList.size()) - .describedAs("number of pages") - .isGreaterThanOrEqualTo(leastNumber); - } - }); - return this; - } - - public Builder totalRequestChargeIsAtLeast(double minimumCharge) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - assertThat(feedList.stream().mapToDouble(p -> p.getRequestCharge()).sum()) - .describedAs("total request charge") - .isGreaterThanOrEqualTo(minimumCharge); - } - }); - return this; - } - - public Builder pageSatisfy(int pageNumber, FeedResponseValidator pageValidator) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - assertThat(feedList.size()).isGreaterThan(pageNumber); - pageValidator.validate(feedList.get(pageNumber)); - } - }); - return this; - } - - public Builder allPagesSatisfy(FeedResponseValidator pageValidator) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - - for(FeedResponse fp: feedList) { - pageValidator.validate(fp); - } - } - }); - return this; - } - - public Builder withAggregateValue(Object value) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - List list = feedList.get(0).getResults(); - Document result = list.size() > 0 ? list.get(0) : null; - - if (result != null) { - if (value instanceof Double) { - - Double d = result.getDouble("_aggregate"); - assertThat(d).isEqualTo(value); - } else if (value instanceof Integer) { - - Integer d = result.getInt("_aggregate"); - assertThat(d).isEqualTo(value); - } else if (value instanceof String) { - - String d = result.getString("_aggregate"); - assertThat(d).isEqualTo(value); - } else if (value instanceof Document){ - - assertThat(result.toString()).isEqualTo(value.toString()); - } else { - - assertThat(result.get("_aggregate")).isNull(); - assertThat(value).isNull(); - } - } else { - - assertThat(value).isNull(); - } - - } - }); - return this; - } - - public Builder withOrderedResults(ArrayList expectedOrderedList, - ArrayList compositeIndex) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - - List resultOrderedList = feedList.stream() - .flatMap(f -> f.getResults().stream()) - .collect(Collectors.toList()); - assertThat(expectedOrderedList.size()).isEqualTo(resultOrderedList.size()); - - ArrayList paths = new ArrayList(); - Iterator compositeIndexIterator = compositeIndex.iterator(); - while (compositeIndexIterator.hasNext()) { - paths.add(compositeIndexIterator.next().getPath().replace("/", "")); - } - for (int i = 0; i < resultOrderedList.size(); i ++) { - ArrayNode resultValues = (ArrayNode) resultOrderedList.get(i).get("$1"); - assertThat(resultValues.size()).isEqualTo(paths.size()); - for (int j = 0; j < paths.size(); j++) { - if (paths.get(j).contains("number")) { - assertThat(expectedOrderedList.get(i).getInt(paths.get(j))).isEqualTo(resultValues.get(j).intValue()); - } else if (paths.get(j).toLowerCase().contains("string")) { - assertThat(expectedOrderedList.get(i).getString(paths.get(j))).isEqualTo(resultValues.get(j).asText()); - } else if (paths.get(j).contains("bool")) { - assertThat(expectedOrderedList.get(i).getBoolean(paths.get(j))).isEqualTo(resultValues.get(j).asBoolean()); - } else { - assertThat(resultValues.get(j).isNull()).isTrue(); - assertThat(expectedOrderedList.get(i).get("nullField")).isNull(); - } - } - } - - } - }); - return this; - } - - public Builder pageLengths(int[] pageLengths) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - assertThat(feedList).hasSize(pageLengths.length); - for (int i = 0; i < pageLengths.length; i++) - assertThat(feedList.get(i).getResults().size()).isEqualTo(pageLengths[i]); - } - }); - return this; - } - - public Builder hasValidQueryMetrics(boolean shouldHaveMetrics) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - for(FeedResponse feedPage: feedList) { - if (shouldHaveMetrics) { - QueryMetrics queryMetrics = BridgeInternal.createQueryMetricsFromCollection(feedPage.getQueryMetrics().values()); - assertThat(queryMetrics.getIndexHitDocumentCount()).isGreaterThanOrEqualTo(0); - assertThat(queryMetrics.getRetrievedDocumentSize()).isGreaterThan(0); - assertThat(queryMetrics.getTotalQueryExecutionTime().compareTo(Duration.ZERO)).isGreaterThan(0); - assertThat(queryMetrics.getOutputDocumentCount()).isGreaterThan(0); - assertThat(queryMetrics.getRetrievedDocumentCount()).isGreaterThan(0); - assertThat(queryMetrics.getDocumentLoadTime().compareTo(Duration.ZERO)).isGreaterThan(0); - assertThat(queryMetrics.getDocumentWriteTime().compareTo(Duration.ZERO)).isGreaterThanOrEqualTo(0); - assertThat(queryMetrics.getVMExecutionTime().compareTo(Duration.ZERO)).isGreaterThan(0); - assertThat(queryMetrics.getQueryPreparationTimes().getLogicalPlanBuildTime().compareTo(Duration.ZERO)).isGreaterThan(0); - assertThat(queryMetrics.getQueryPreparationTimes().getPhysicalPlanBuildTime().compareTo(Duration.ZERO)).isGreaterThanOrEqualTo(0); - assertThat(queryMetrics.getQueryPreparationTimes().getQueryCompilationTime().compareTo(Duration.ZERO)).isGreaterThan(0); - assertThat(queryMetrics.getRuntimeExecutionTimes().getQueryEngineExecutionTime().compareTo(Duration.ZERO)).isGreaterThanOrEqualTo(0); - assertThat(BridgeInternal.getClientSideMetrics(queryMetrics).getRequestCharge()).isGreaterThan(0); - } else { - assertThat(feedPage.getQueryMetrics().isEmpty()); - } - } - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseValidator.java deleted file mode 100644 index d245f6f49593..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseValidator.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -public interface FeedResponseValidator { - - void validate(FeedResponse feedList); - - public class Builder { - private List> validators = new ArrayList<>(); - - public FeedResponseValidator build() { - return new FeedResponseValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(FeedResponse feedPage) { - for (FeedResponseValidator validator : validators) { - validator.validate(feedPage); - } - } - }; - } - - public Builder pageSizeIsLessThanOrEqualTo(final int maxPageSize) { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getResults().size()).isLessThanOrEqualTo(maxPageSize); - } - }); - return this; - } - - public Builder pageSizeOf(final int expectedCount) { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getResults()).hasSize(expectedCount); - } - }); - return this; - } - - public Builder positiveRequestCharge() { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getRequestCharge()).isPositive(); - } - }); - return this; - } - - public Builder requestChargeGreaterThanOrEqualTo(double minRequestCharge) { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getRequestCharge()).isGreaterThanOrEqualTo(minRequestCharge); - } - }); - return this; - } - - public Builder requestChargeLessThanOrEqualTo(double maxRequestCharge) { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getRequestCharge()).isLessThanOrEqualTo(maxRequestCharge); - } - }); - return this; - } - - public Builder hasHeader(String headerKey) { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getResponseHeaders()).containsKey(headerKey); - } - }); - return this; - } - - public Builder hasRequestChargeHeader() { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getResponseHeaders()).containsKey(HttpConstants.HttpHeaders.REQUEST_CHARGE); - } - }); - return this; - } - - public Builder idsExactlyAre(final List expectedIds) { - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage - .getResults().stream() - .map(r -> r.getResourceId()) - .collect(Collectors.toList())) - .containsExactlyElementsOf(expectedIds); - } - }); - return this; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceResponseValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceResponseValidator.java deleted file mode 100644 index 0686e7df1336..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceResponseValidator.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.time.Instant; -import java.util.ArrayList; -import java.util.Date; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map.Entry; - -import org.assertj.core.api.Condition; - -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.IndexingMode; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.SpatialSpec; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.TriggerOperation; -import com.microsoft.azure.cosmosdb.TriggerType; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.SpatialType; - -public interface ResourceResponseValidator { - - static Builder builder() { - return new Builder(); - } - - void validate(ResourceResponse resourceResponse); - - class Builder { - private List> validators = new ArrayList<>(); - - public ResourceResponseValidator build() { - return new ResourceResponseValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(ResourceResponse resourceResponse) { - for (ResourceResponseValidator validator : validators) { - validator.validate(resourceResponse); - } - } - }; - } - - public Builder withId(final String resourceId) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getId()).as("check Resource Id").isEqualTo(resourceId); - } - }); - return this; - } - - public Builder nullResource() { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNull(); - } - }); - return this; - } - - public Builder withProperty(String propertyName, Condition validatingCondition) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().get(propertyName)).is(validatingCondition); - - } - }); - return this; - } - - public Builder withProperty(String propertyName, Object value) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().get(propertyName)).isEqualTo(value); - - } - }); - return this; - } - - - public Builder withTimestampIsAfterOrEqualTo(Instant time) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getTimestamp()).isNotNull(); - Date d = resourceResponse.getResource().getTimestamp(); - System.out.println(d.toString()); - assertThat(d.toInstant()).isAfterOrEqualTo(time); - } - }); - return this; - } - - public Builder withTimestampIsBeforeOrEqualTo(Instant time) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getTimestamp()).isNotNull(); - Date d = resourceResponse.getResource().getTimestamp(); - assertThat(d.toInstant()).isBeforeOrEqualTo(time); - } - }); - return this; - } - - public Builder withPermissionMode(PermissionMode mode) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getPermissionMode()).isEqualTo(mode); - } - }); - return this; - } - - public Builder withPermissionResourceLink(String link) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getResourceLink()).isEqualTo(link); - } - }); - return this; - } - - public Builder indexingMode(IndexingMode mode) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getIndexingPolicy()).isNotNull(); - assertThat(resourceResponse.getResource().getIndexingPolicy().getIndexingMode()).isEqualTo(mode); - } - }); - return this; - } - - public Builder withStoredProcedureBody(String functionBody) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getBody()).isEqualTo(functionBody); - } - }); - return this; - } - - public Builder withUserDefinedFunctionBody(String functionBody) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getBody()).isEqualTo(functionBody); - } - }); - return this; - } - - - public Builder withTriggerBody(String functionBody) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getBody()).isEqualTo(functionBody); - } - }); - return this; - } - - public Builder notNullEtag() { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getETag()).isNotNull(); - } - }); - return this; - } - - public Builder notEmptySelfLink() { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getSelfLink()).isNotEmpty(); - } - }); - return this; - } - - public Builder withTriggerInternals(TriggerType type, TriggerOperation op) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getTriggerType()).isEqualTo(type); - assertThat(resourceResponse.getResource().getTriggerOperation()).isEqualTo(op); - } - }); - return this; - } - - public Builder withContentType(final String contentType) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getContentType()).isEqualTo(contentType); - } - }); - return this; - } - - public Builder withOfferThroughput(int throughput) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getThroughput()) - .isEqualTo(throughput); - } - }); - return this; - } - - public Builder validatePropertyCondition(String key, Condition condition) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().get(key)).is(condition); - - } - }); - return this; - } - - public Builder withCompositeIndexes(Collection> compositeIndexesWritten) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - Iterator> compositeIndexesReadIterator = resourceResponse.getResource() - .getIndexingPolicy().getCompositeIndexes().iterator(); - Iterator> compositeIndexesWrittenIterator = compositeIndexesWritten.iterator(); - - ArrayList readIndexesStrings = new ArrayList(); - ArrayList writtenIndexesStrings = new ArrayList(); - - while (compositeIndexesReadIterator.hasNext() && compositeIndexesWrittenIterator.hasNext()) { - Iterator compositeIndexReadIterator = compositeIndexesReadIterator.next().iterator(); - Iterator compositeIndexWrittenIterator = compositeIndexesWrittenIterator.next().iterator(); - - StringBuilder readIndexesString = new StringBuilder(); - StringBuilder writtenIndexesString = new StringBuilder(); - - while (compositeIndexReadIterator.hasNext() && compositeIndexWrittenIterator.hasNext()) { - CompositePath compositePathRead = compositeIndexReadIterator.next(); - CompositePath compositePathWritten = compositeIndexWrittenIterator.next(); - - readIndexesString.append(compositePathRead.getPath() + ":" + compositePathRead.getOrder() + ";"); - writtenIndexesString.append(compositePathWritten.getPath() + ":" + compositePathRead.getOrder() + ";"); - } - - readIndexesStrings.add(readIndexesString.toString()); - writtenIndexesStrings.add(writtenIndexesString.toString()); - } - - assertThat(readIndexesStrings).containsExactlyInAnyOrderElementsOf(writtenIndexesStrings); - } - }); - return this; - } - - public Builder withSpatialIndexes(Collection spatialIndexes) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - Iterator spatialIndexesReadIterator = resourceResponse.getResource() - .getIndexingPolicy().getSpatialIndexes().iterator(); - Iterator spatialIndexesWrittenIterator = spatialIndexes.iterator(); - - HashMap> readIndexMap = new HashMap>(); - HashMap> writtenIndexMap = new HashMap>(); - - while (spatialIndexesReadIterator.hasNext() && spatialIndexesWrittenIterator.hasNext()) { - SpatialSpec spatialSpecRead = spatialIndexesReadIterator.next(); - SpatialSpec spatialSpecWritten = spatialIndexesWrittenIterator.next(); - - String readPath = spatialSpecRead.getPath() + ":"; - String writtenPath = spatialSpecWritten.getPath() + ":"; - - ArrayList readSpatialTypes = new ArrayList(); - ArrayList writtenSpatialTypes = new ArrayList(); - - Iterator spatialTypesReadIterator = spatialSpecRead.getSpatialTypes().iterator(); - Iterator spatialTypesWrittenIterator = spatialSpecWritten.getSpatialTypes().iterator(); - - while (spatialTypesReadIterator.hasNext() && spatialTypesWrittenIterator.hasNext()) { - readSpatialTypes.add(spatialTypesReadIterator.next()); - writtenSpatialTypes.add(spatialTypesWrittenIterator.next()); - } - - readIndexMap.put(readPath, readSpatialTypes); - writtenIndexMap.put(writtenPath, writtenSpatialTypes); - } - - for (Entry> entry : readIndexMap.entrySet()) { - assertThat(entry.getValue()) - .containsExactlyInAnyOrderElementsOf(writtenIndexMap.get(entry.getKey())); - } - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceValidator.java deleted file mode 100644 index a95a6346089c..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceValidator.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; - -import com.microsoft.azure.cosmosdb.Resource; - -interface ResourceValidator { - - void validate(T v); - - class Builder { - private List> validators = new ArrayList<>(); - - public ResourceValidator build() { - return new ResourceValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(T v) { - for (ResourceValidator validator : validators) { - validator.validate(v); - } - } - }; - } - - public Builder areEqual(T expectedValue) { - validators.add(new ResourceValidator() { - @Override - public void validate(T v) { - - assertThat(v.getHashMap().keySet()) - .describedAs("number of fields"). - hasSize(expectedValue.getHashMap().keySet().size()); - expectedValue.getHashMap().keySet(); - for(String key: expectedValue.getHashMap().keySet()) { - assertThat(expectedValue.get(key)) - .describedAs("value for " + key) - .isEqualTo(expectedValue.get(key)); - } - } - }); - return this; - } - - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/TestConfigurations.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/TestConfigurations.java deleted file mode 100644 index a6f115439e9e..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/TestConfigurations.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import org.apache.commons.lang3.StringUtils; - -import com.google.common.base.Strings; - -/** - * Contains the configurations for tests. - * - * For running tests, you can pass a customized endpoint configuration in one of the following - * ways: - *
    - *
  • -DACCOUNT_KEY="[your-key]" -ACCOUNT_HOST="[your-endpoint]" as JVM - * command-line option.
  • - *
  • You can set ACCOUNT_KEY and ACCOUNT_HOST as environment variables.
  • - *
- * - * If none of the above is set, emulator endpoint will be used. - */ -public final class TestConfigurations { - // Replace MASTER_KEY and HOST with values from your Azure Cosmos DB account. - // The default values are credentials of the local emulator, which are not used in any production environment. - // - public static String MASTER_KEY = - System.getProperty("ACCOUNT_KEY", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("ACCOUNT_KEY")), - "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")); - - public static String HOST = - System.getProperty("ACCOUNT_HOST", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("ACCOUNT_HOST")), - "https://localhost:443/")); - - public static String CONSISTENCY = - System.getProperty("ACCOUNT_CONSISTENCY", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("ACCOUNT_CONSISTENCY")), "Strong")); - - public static String PREFERRED_LOCATIONS = - System.getProperty("PREFERRED_LOCATIONS", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("PREFERRED_LOCATIONS")), null)); -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/Utils.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/Utils.java deleted file mode 100644 index 9bc18381d95d..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/Utils.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; - -public class Utils { - private static final String DATABASES_PATH_SEGMENT = "dbs"; - private static final String COLLECTIONS_PATH_SEGMENT = "colls"; - private static final String DOCUMENTS_PATH_SEGMENT = "docs"; - private static final String USERS_PATH_SEGMENT = "users"; - - public static String getDatabaseLink(Database database, boolean isNameBased) { - if (isNameBased) { - return getDatabaseNameLink(database.getId()); - } else { - return database.getSelfLink(); - } - } - - public static String getDatabaseNameLink(String databaseId) { - return DATABASES_PATH_SEGMENT + "/" + databaseId; - } - - public static String getCollectionNameLink(String databaseId, String collectionId) { - - return DATABASES_PATH_SEGMENT + "/" + databaseId + "/" + COLLECTIONS_PATH_SEGMENT + "/" + collectionId; - } - - public static String getDocumentNameLink(String databaseId, String collectionId, String docId) { - - return DATABASES_PATH_SEGMENT + "/" + databaseId + "/" + COLLECTIONS_PATH_SEGMENT + "/" +collectionId + "/" + DOCUMENTS_PATH_SEGMENT + "/" + docId; - } - - public static String getUserNameLink(String databaseId, String userId) { - - return DATABASES_PATH_SEGMENT + "/" + databaseId + "/" + USERS_PATH_SEGMENT + "/" + userId; - } - - private Utils() { - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/tests/java/com/microsoft/azure/cosmosdb/ConfigsBuilderTest.java b/cosmosdb/data-plane/commons-test-utils/src/main/tests/java/com/microsoft/azure/cosmosdb/ConfigsBuilderTest.java deleted file mode 100644 index cf49065ef5bf..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/tests/java/com/microsoft/azure/cosmosdb/ConfigsBuilderTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import org.testng.annotations.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConfigsBuilderTest { - - @Test(groups = { "unit" }) - public void defaultProtocol() { - Configs config = ConfigsBuilder.instance().build(); - assertThat(config.getProtocol()).isEqualTo(Protocol.Https); - } - - @Test(groups = { "unit" }) - public void tcp() { - Configs config = ConfigsBuilder.instance().withProtocol(Protocol.Tcp).build(); - assertThat(config.getProtocol()).isEqualTo(Protocol.Tcp); - } - - @Test(groups = { "unit" }) - public void https() { - Configs config = ConfigsBuilder.instance().withProtocol(Protocol.Https).build(); - assertThat(config.getProtocol()).isEqualTo(Protocol.Https); - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/tests/resources/log4j.properties b/cosmosdb/data-plane/commons-test-utils/src/main/tests/resources/log4j.properties deleted file mode 100644 index 1f3287c67a55..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/tests/resources/log4j.properties +++ /dev/null @@ -1,15 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# Set HTTP components' logger to INFO - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/commons/pom.xml b/cosmosdb/data-plane/commons/pom.xml deleted file mode 100644 index 103f302b51ba..000000000000 --- a/cosmosdb/data-plane/commons/pom.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - azure-cosmosdb-commons - Common Components for Async SDK for SQL API of Azure Cosmos DB Service - Common Components for Async SDK for SQL API of Azure Cosmos DB Service - jar - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.0 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind.version} - - - com.fasterxml.uuid - java-uuid-generator - ${java-uuid-generator.version} - - - commons-io - commons-io - ${commons-io.version} - - - commons-validator - commons-validator - ${commons-validator.version} - - - com.github.davidmoten - rxjava-extras - ${rxjava-extras.version} - - - io.reactivex - rxjava - ${rxjava.version} - - - io.reactivex - rxjava-string - ${rxjava-string.version} - - - io.reactivex - rxnetty - ${rxnetty.version} - - - io.netty - netty-transport-native-epoll - - - - - io.netty - netty-codec-http - ${netty.version} - - - io.netty - netty-handler - ${netty.version} - - - io.netty - netty-transport - ${netty.version} - - - io.netty - netty-handler-proxy - ${netty.version} - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - - org.apache.commons - commons-collections4 - 4.2 - - - org.apache.commons - commons-text - ${commons-text.version} - - - org.testng - testng - ${testng.version} - test - - - org.assertj - assertj-core - ${assertj.version} - test - - - org.mockito - mockito-all - ${mockito.version} - test - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - test - - - log4j - log4j - ${log4j.version} - test - - - com.google.guava - guava - ${guava.version} - test - - - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessCondition.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessCondition.java deleted file mode 100644 index ecf664d5795a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessCondition.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents a set of access conditions to be used for operations against the Azure Cosmos DB database service. - */ -public final class AccessCondition { - - private AccessConditionType type = AccessConditionType.IfMatch; - private String condition; - - /** - * Gets the condition type. - * - * @return the condition type. - */ - public AccessConditionType getType() { - return this.type; - } - - /** - * Sets the condition type. - * - * @param type the condition type to use. - */ - public void setType(AccessConditionType type) { - this.type = type; - } - - /** - * Gets the value of the condition - for AccessConditionType IfMatchs and IfNotMatch, this is the ETag that has to - * be compared to. - * - * @return the condition. - */ - public String getCondition() { - return this.condition; - } - - /** - * Sets the value of the condition - for AccessConditionType IfMatchs and IfNotMatch, this is the ETag that has to - * be compared to. - * - * @param condition the condition to use. - */ - public void setCondition(String condition) { - this.condition = condition; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessConditionType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessConditionType.java deleted file mode 100644 index 1366079dfe2a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessConditionType.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies the set of access condition types that can be used for operations in the Azure Cosmos DB database service. - */ -public enum AccessConditionType { - /** - * Check if the resource's ETag value matches the ETag value performed. - */ - IfMatch, - - /** - * Check if the resource's ETag value does not match ETag value performed. - */ - IfNoneMatch -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Attachment.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Attachment.java deleted file mode 100644 index 203c778242d3..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Attachment.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a document attachment in the Azure Cosmos DB database service. - *

- * Each document may contain zero or more attachments. Attachments can be of any MIME type - text, image, binary data. - * These are stored externally in Azure Blob storage. Attachments are automatically deleted when the parent document - * is deleted. - */ -public class Attachment extends Resource { - /** - * Initialize an attachment object. - */ - public Attachment() { - super(); - } - - /** - * Initialize an attachment object from json string. - * - * @param source the json string representation of the Attachment. - */ - public Attachment(String source) { - super(source); - } - - /** - * Gets the MIME content type of the attachment. - * - * @return the content type. - */ - public String getContentType() { - return super.getString(Constants.Properties.CONTENT_TYPE); - } - - /** - * Sets the MIME content type of the attachment. - * - * @param contentType the content type to use. - */ - public void setContentType(String contentType) { - super.set(Constants.Properties.CONTENT_TYPE, contentType); - } - - /** - * Gets the media link associated with the attachment content. - * - * @return the media link. - */ - public String getMediaLink() { - return super.getString(Constants.Properties.MEDIA_LINK); - } - - /** - * Sets the media link associated with the attachment content. - * - * @param mediaLink the media link to use. - */ - public void setMediaLink(String mediaLink) { - super.set(Constants.Properties.MEDIA_LINK, mediaLink); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/BridgeInternal.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/BridgeInternal.java deleted file mode 100644 index e0bc79144077..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/BridgeInternal.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.query.metrics.ClientSideMetrics; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import java.net.URI; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentMap; - -import static com.microsoft.azure.cosmosdb.internal.Constants.QueryExecutionContext.INCREMENTAL_FEED_HEADER_VALUE; - - -/** - * This is meant to be used only internally as a bridge access to classes in - * com.microsoft.azure.cosmosdb - **/ -public class BridgeInternal { - - public static Error createError(ObjectNode objectNode) { - return new Error(objectNode); - } - - public static Document documentFromObject(Object document, ObjectMapper mapper) { - return Document.FromObject(document, mapper); - } - - public static ResourceResponse toResourceResponse(RxDocumentServiceResponse response, - Class cls) { - return new ResourceResponse(response, cls); - } - - public static MediaResponse toMediaResponse(RxDocumentServiceResponse response, boolean willBuffer) { - return new MediaResponse(response, willBuffer); - } - - public static FeedResponse toFeedResponsePage(RxDocumentServiceResponse response, - Class cls) { - return new FeedResponse(response.getQueryResponse(cls), response.getResponseHeaders()); - } - - public static FeedResponse toChaneFeedResponsePage(RxDocumentServiceResponse response, - Class cls) { - return new FeedResponse(noChanges(response) ? Collections.emptyList(): response.getQueryResponse(cls), response.getResponseHeaders(), noChanges(response)); - } - - public static StoredProcedureResponse toStoredProcedureResponse(RxDocumentServiceResponse response) { - return new StoredProcedureResponse(response); - } - - public static DatabaseAccount toDatabaseAccount(RxDocumentServiceResponse response) { - DatabaseAccount account = response.getResource(DatabaseAccount.class); - - // read the headers and set to the account - Map responseHeader = response.getResponseHeaders(); - - account.setMaxMediaStorageUsageInMB( - Long.valueOf(responseHeader.get(HttpConstants.HttpHeaders.MAX_MEDIA_STORAGE_USAGE_IN_MB))); - account.setMediaStorageUsageInMB( - Long.valueOf(responseHeader.get(HttpConstants.HttpHeaders.CURRENT_MEDIA_STORAGE_USAGE_IN_MB))); - - return account; - } - - public static Map getFeedHeaders(FeedOptionsBase options) { - - if (options == null) - return new HashMap<>(); - - Map headers = new HashMap<>(); - - if (options.getMaxItemCount() != null) { - headers.put(HttpConstants.HttpHeaders.PAGE_SIZE, options.getMaxItemCount().toString()); - } - - if (options instanceof ChangeFeedOptions) { - ChangeFeedOptions changeFeedOptions = (ChangeFeedOptions) options; - - String ifNoneMatchValue = null; - if (changeFeedOptions.getRequestContinuation() != null) { - ifNoneMatchValue = changeFeedOptions.getRequestContinuation(); - } else if (!changeFeedOptions.isStartFromBeginning()) { - ifNoneMatchValue = "*"; - } - // On REST level, change feed is using IfNoneMatch/ETag instead of - // continuation. - if (ifNoneMatchValue != null) { - headers.put(HttpConstants.HttpHeaders.IF_NONE_MATCH, ifNoneMatchValue); - } - - headers.put(HttpConstants.HttpHeaders.A_IM, INCREMENTAL_FEED_HEADER_VALUE); - } else if (options.getRequestContinuation() != null) { - headers.put(HttpConstants.HttpHeaders.CONTINUATION, options.getRequestContinuation()); - } - - FeedOptions feedOptions = options instanceof FeedOptions ? (FeedOptions) options : null; - if (feedOptions != null) { - if (feedOptions.getSessionToken() != null) { - headers.put(HttpConstants.HttpHeaders.SESSION_TOKEN, feedOptions.getSessionToken()); - } - - if (feedOptions.getEnableScanInQuery() != null) { - headers.put(HttpConstants.HttpHeaders.ENABLE_SCAN_IN_QUERY, - feedOptions.getEnableScanInQuery().toString()); - } - - if (feedOptions.getEmitVerboseTracesInQuery() != null) { - headers.put(HttpConstants.HttpHeaders.EMIT_VERBOSE_TRACES_IN_QUERY, - feedOptions.getEmitVerboseTracesInQuery().toString()); - } - - if (feedOptions.getEnableCrossPartitionQuery() != null) { - headers.put(HttpConstants.HttpHeaders.ENABLE_CROSS_PARTITION_QUERY, - feedOptions.getEnableCrossPartitionQuery().toString()); - } - - if (feedOptions.getMaxDegreeOfParallelism() != 0) { - headers.put(HttpConstants.HttpHeaders.PARALLELIZE_CROSS_PARTITION_QUERY, Boolean.TRUE.toString()); - } - - if (feedOptions.getResponseContinuationTokenLimitInKb() > 0) { - headers.put(HttpConstants.HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB, - Strings.toString(feedOptions.getResponseContinuationTokenLimitInKb())); - } - - if(feedOptions.getPopulateQueryMetrics()){ - headers.put(HttpConstants.HttpHeaders.POPULATE_QUERY_METRICS, String.valueOf(feedOptions.getPopulateQueryMetrics())); - } - } - - return headers; - } - - public static boolean noChanges(FeedResponse page) { - return page.nochanges; - } - - public static boolean noChanges(RxDocumentServiceResponse rsp) { - return rsp.getStatusCode() == HttpConstants.StatusCodes.NOT_MODIFIED; - } - - public static FeedResponse createFeedResponse(List results, Map headers) { - return new FeedResponse<>(results, headers); - } - - public static FeedResponse createFeedResponseWithQueryMetrics(List results, Map headers, ConcurrentMap queryMetricsMap) { - return new FeedResponse<>(results, headers, queryMetricsMap); - } - - public static E setResourceAddress(E e, String resourceAddress) { - e.resourceAddress = resourceAddress; - return e; - } - - public static long getLSN(E e) { - return e.lsn; - } - - public static String getPartitionKeyRangeId(E e) { - return e.partitionKeyRangeId; - } - - public static String getResourceAddress(E e) { - return e.resourceAddress; - } - - public static E setLSN(E e, long lsn) { - e.lsn = lsn; - return e; - } - - public static E setPartitionKeyRangeId(E e, String partitionKeyRangeId) { - e.partitionKeyRangeId = partitionKeyRangeId; - return e; - } - - public static boolean isEnableMultipleWriteLocations(DatabaseAccount account) { - return account.isEnableMultipleWriteLocations(); - } - - public static boolean getUseMultipleWriteLocations(ConnectionPolicy policy) { - return policy.isUsingMultipleWriteLocations(); - } - - public static void setUseMultipleWriteLocations(ConnectionPolicy policy, boolean value) { - policy.setUsingMultipleWriteLocations(value); - } - - public static URI getRequestUri(DocumentClientException documentClientException) { - return documentClientException.requestUri; - } - - public static void setRequestHeaders(DocumentClientException documentClientException, Map requestHeaders) { - documentClientException.requestHeaders = requestHeaders; - } - - public static Map getRequestHeaders(DocumentClientException documentClientException) { - return documentClientException.requestHeaders; - } - - public static Map getQueryEngineConfiuration(DatabaseAccount databaseAccount) { - return databaseAccount.getQueryEngineConfiuration(); - } - - public static ReplicationPolicy getReplicationPolicy(DatabaseAccount databaseAccount) { - return databaseAccount.getReplicationPolicy(); - } - - public static ReplicationPolicy getSystemReplicationPolicy(DatabaseAccount databaseAccount) { - return databaseAccount.getSystemReplicationPolicy(); - } - - public static ConsistencyPolicy getConsistencyPolicy(DatabaseAccount databaseAccount) { - return databaseAccount.getConsistencyPolicy(); - } - - public static String getAltLink(Resource resource) { - return resource.getAltLink(); - } - - public static void setAltLink(Resource resource, String altLink) { - resource.setAltLink(altLink); - } - - public static void setMaxReplicaSetSize(ReplicationPolicy replicationPolicy, int value) { - replicationPolicy.setMaxReplicaSetSize(value); - } - - public static void putQueryMetricsIntoMap(FeedResponse response, - String partitionKeyRangeId, - QueryMetrics queryMetrics){ - response.getQueryMetricsMap().put(partitionKeyRangeId, queryMetrics); - } - - public static QueryMetrics createQueryMetricsFromDelimitedStringAndClientSideMetrics(String queryMetricsDelimitedString, - ClientSideMetrics clientSideMetrics, - String activityId) { - return QueryMetrics.createFromDelimitedStringAndClientSideMetrics(queryMetricsDelimitedString, clientSideMetrics, activityId); - } - - public static QueryMetrics createQueryMetricsFromCollection(Collection queryMetricsCollection) { - return QueryMetrics.createFromCollection(queryMetricsCollection); - } - - public static ClientSideMetrics getClientSideMetrics(QueryMetrics queryMetrics){ - return queryMetrics.getClientSideMetrics(); - } - - public static String getInnerErrorMessage(DocumentClientException documentClientException) { - if (documentClientException == null) { - return null; - } - return documentClientException.getInnerErrorMessage(); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ChangeFeedOptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ChangeFeedOptions.java deleted file mode 100644 index a52595d59443..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ChangeFeedOptions.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.time.ZonedDateTime; - -/** - * Specifies the options associated with change feed methods (enumeration operations) in the Azure Cosmos DB database service. - */ -public final class ChangeFeedOptions extends FeedOptionsBase { - private String partitionKeyRangeId; - private boolean startFromBeginning; - private ZonedDateTime startDateTime; - - public ChangeFeedOptions() {} - - public ChangeFeedOptions(ChangeFeedOptions options) { - super(options); - this.partitionKeyRangeId = options.partitionKeyRangeId; - this.startFromBeginning = options.startFromBeginning; - this.startDateTime = options.startDateTime; - } - - /** - * Get the partition key range id for the current request - *

- * ChangeFeed requests can be executed against specific partition key ranges. - * This is used to process the change feed in parallel across multiple consumers. - *

- * - * @return a string indicating the partition key range ID - * @see PartitionKeyRange - */ - public String getPartitionKeyRangeId() { - return partitionKeyRangeId; - } - - /** - * Set the partition key range id for the current request - *

- * ChangeFeed requests can be executed against specific partition key ranges. - * This is used to process the change feed in parallel across multiple consumers. - *

- * - * @param partitionKeyRangeId a string indicating the partition key range ID - * @see PartitionKeyRange - */ - public void setPartitionKeyRangeId(String partitionKeyRangeId) { - this.partitionKeyRangeId = partitionKeyRangeId; - } - - /** - * Get whether change feed should start from beginning (true) or from current (false). - * By default it's start from current (false). - * - * @return a boolean value indicating change feed should start from beginning or not - */ - public boolean isStartFromBeginning() { - return startFromBeginning; - } - - /** - * Set whether change feed should start from beginning (true) or from current (false). - * By default it's start from current (false). - * - * @param startFromBeginning a boolean value indicating change feed should start from beginning or not - */ - public void setStartFromBeginning(boolean startFromBeginning) { - this.startFromBeginning = startFromBeginning; - } - - /** - * Gets the zoned date time to start looking for changes after. - * @return a zoned date time to start looking for changes after, if set or null otherwise - */ - public ZonedDateTime getStartDateTime() { - return startDateTime; - } - - /** - * Sets the zoned date time (exclusive) to start looking for changes after. - * If this is specified, startFromBeginning is ignored. - * @param startDateTime a zoned date time to start looking for changes after. - */ - public void setStartDateTime(ZonedDateTime startDateTime) { - this.startDateTime = startDateTime; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ClientSideRequestStatistics.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ClientSideRequestStatistics.java deleted file mode 100644 index cc71e6b391f5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ClientSideRequestStatistics.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import java.net.URI; -import java.net.URISyntaxException; -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResult; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.lang3.StringUtils; - -public class ClientSideRequestStatistics { - - private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; - - private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); - - private ZonedDateTime requestStartTime; - private ZonedDateTime requestEndTime; - - private List responseStatisticsList; - private List supplementalResponseStatisticsList; - private Map addressResolutionStatistics; - - private List contactedReplicas; - private Set failedReplicas; - private Set regionsContacted; - - public ClientSideRequestStatistics() { - this.requestStartTime = ZonedDateTime.now(ZoneOffset.UTC); - this.requestEndTime = ZonedDateTime.now(ZoneOffset.UTC); - this.responseStatisticsList = new ArrayList<>(); - this.supplementalResponseStatisticsList = new ArrayList<>(); - this.addressResolutionStatistics = new HashMap<>(); - this.contactedReplicas = new ArrayList<>(); - this.failedReplicas = new HashSet<>(); - this.regionsContacted = new HashSet<>(); - } - - public Duration getRequestLatency() { - return Duration.between(requestStartTime, requestEndTime); - } - - private boolean isCPUOverloaded() { - // NOTE: CPUMonitor and CPULoadHistory is not implemented in async SDK yet. - return false; - } - - public void recordResponse(RxDocumentServiceRequest request, StoreResult storeResult) { - ZonedDateTime responseTime = ZonedDateTime.now(ZoneOffset.UTC); - - StoreResponseStatistics storeResponseStatistics = new StoreResponseStatistics(); - storeResponseStatistics.requestResponseTime = responseTime; - storeResponseStatistics.storeResult = storeResult; - storeResponseStatistics.requestOperationType = request.getOperationType(); - storeResponseStatistics.requestResourceType = request.getResourceType(); - - URI locationEndPoint = null; - if (request.requestContext.locationEndpointToRoute != null) { - try { - locationEndPoint = request.requestContext.locationEndpointToRoute.toURI(); - } catch (URISyntaxException e) { - throw new IllegalArgumentException(e); - } - } - - synchronized (this) { - if (responseTime.isAfter(this.requestEndTime)) { - this.requestEndTime = responseTime; - } - - if (locationEndPoint != null) { - this.regionsContacted.add(locationEndPoint); - } - - if (storeResponseStatistics.requestOperationType == OperationType.Head || - storeResponseStatistics.requestOperationType == OperationType.HeadFeed) { - this.supplementalResponseStatisticsList.add(storeResponseStatistics); - } else { - this.responseStatisticsList.add(storeResponseStatistics); - } - } - } - - public String recordAddressResolutionStart(URI targetEndpoint) { - String identifier = Utils.randomUUID().toString(); - - AddressResolutionStatistics resolutionStatistics = new AddressResolutionStatistics(); - resolutionStatistics.startTime = ZonedDateTime.now(ZoneOffset.UTC); - // Very far in the future - resolutionStatistics.endTime = ZonedDateTime.of(LocalDateTime.MAX, ZoneOffset.UTC); - resolutionStatistics.targetEndpoint = targetEndpoint == null ? "" : targetEndpoint.toString(); - - synchronized (this) { - this.addressResolutionStatistics.put(identifier, resolutionStatistics); - } - - return identifier; - } - - public void recordAddressResolutionEnd(String identifier) { - if (StringUtils.isEmpty(identifier)) { - return; - } - ZonedDateTime responseTime = ZonedDateTime.now(ZoneOffset.UTC); - - synchronized (this) { - if (!this.addressResolutionStatistics.containsKey(identifier)) { - throw new IllegalArgumentException("Identifier " + identifier + " does not exist. Please call start before calling end"); - } - - if (responseTime.isAfter(this.requestEndTime)) { - this.requestEndTime = responseTime; - } - - AddressResolutionStatistics resolutionStatistics = this.addressResolutionStatistics.get(identifier); - resolutionStatistics.endTime = responseTime; - } - } - - @Override - public String toString() { - StringBuilder stringBuilder = new StringBuilder(); - - // need to lock in case of concurrent operations. this should be extremely rare since toString() - // should only be called at the end of request. - synchronized (this) { - - // first trace request start time, as well as total non-head/headfeed requests made. - stringBuilder.append("RequestStartTime: ") - .append("\"").append(this.requestStartTime.format(responseTimeFormatter)).append("\"") - .append(", ") - .append("RequestEndTime: ") - .append("\"").append(this.requestEndTime.format(responseTimeFormatter)).append("\"") - .append(", ") - .append("Duration: ") - .append(Duration.between(requestStartTime, requestEndTime).toMillis()) - .append(" ms, ") - .append("Number of regions attempted: ") - .append(this.regionsContacted.isEmpty() ? 1 : this.regionsContacted.size()) - .append(System.lineSeparator()); - - // take all responses here - this should be limited in number and each one contains relevant information. - for (StoreResponseStatistics storeResponseStatistics : this.responseStatisticsList) { - stringBuilder.append(storeResponseStatistics.toString()).append(System.lineSeparator()); - } - - // take all responses here - this should be limited in number and each one is important. - for (AddressResolutionStatistics value : this.addressResolutionStatistics.values()) { - stringBuilder.append(value.toString()).append(System.lineSeparator()); - } - - // only take last 10 responses from this list - this has potential of having large number of entries. - // since this is for establishing consistency, we can make do with the last responses to paint a meaningful picture. - int supplementalResponseStatisticsListCount = this.supplementalResponseStatisticsList.size(); - int initialIndex = Math.max(supplementalResponseStatisticsListCount - MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING, 0); - if (initialIndex != 0) { - stringBuilder.append(" -- Displaying only the last ") - .append(MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING) - .append(" head/headfeed requests. Total head/headfeed requests: ") - .append(supplementalResponseStatisticsListCount); - } - for (int i = initialIndex; i < supplementalResponseStatisticsListCount; i++) { - stringBuilder.append(this.supplementalResponseStatisticsList.get(i).toString()).append(System.lineSeparator()); - } - } - String requestStatsString = stringBuilder.toString(); - if (!requestStatsString.isEmpty()) { - return System.lineSeparator() + requestStatsString; - } - return StringUtils.EMPTY; - } - - public List getContactedReplicas() { - return contactedReplicas; - } - - public void setContactedReplicas(List contactedReplicas) { - this.contactedReplicas = contactedReplicas; - } - - public Set getFailedReplicas() { - return failedReplicas; - } - - public void setFailedReplicas(Set failedReplicas) { - this.failedReplicas = failedReplicas; - } - - public Set getRegionsContacted() { - return regionsContacted; - } - - public void setRegionsContacted(Set regionsContacted) { - this.regionsContacted = regionsContacted; - } - - private static String formatDateTime(ZonedDateTime dateTime) { - if (dateTime == null) { - return null; - } - return dateTime.format(responseTimeFormatter); - } - - private class StoreResponseStatistics { - - private ZonedDateTime requestResponseTime; - private StoreResult storeResult; - private ResourceType requestResourceType; - private OperationType requestOperationType; - - @Override - public String toString() { - return "StoreResponseStatistics{" + - "requestResponseTime=\"" + formatDateTime(requestResponseTime) + "\"" + - ", storeResult=" + storeResult + - ", requestResourceType=" + requestResourceType + - ", requestOperationType=" + requestOperationType + - '}'; - } - } - - private class AddressResolutionStatistics { - private ZonedDateTime startTime; - private ZonedDateTime endTime; - private String targetEndpoint; - - AddressResolutionStatistics() { - } - - @Override - public String toString() { - return "AddressResolutionStatistics{" + - "startTime=\"" + formatDateTime(startTime) + "\"" + - ", endTime=\"" + formatDateTime(endTime) + "\"" + - ", targetEndpoint='" + targetEndpoint + '\'' + - '}'; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CommonsBridgeInternal.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CommonsBridgeInternal.java deleted file mode 100644 index 20009de704a8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CommonsBridgeInternal.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -public class CommonsBridgeInternal { - public static boolean isV2(PartitionKeyDefinition pkd) { - return pkd.getVersion() != null && PartitionKeyDefinitionVersion.V2.val == pkd.getVersion().val; - } - - public static void setV2(PartitionKeyDefinition pkd) { - pkd.setVersion(PartitionKeyDefinitionVersion.V2); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePath.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePath.java deleted file mode 100644 index ea9fcb67b175..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePath.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import org.apache.commons.text.WordUtils; - -/** - * Represents a composite path of the IndexingPolicy in the Azure Cosmos DB database service. - * A composite path is used in a composite index. For example if you want to run a query like - * "SELECT * FROM c ORDER BY c.age, c.height", then you need to add "/age" and "/height" - * as composite paths to your composite index. - */ -public class CompositePath extends JsonSerializable { - /** - * Constructor. - */ - public CompositePath() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the included path. - */ - public CompositePath(String jsonString) { - super(jsonString); - } - - /** - * Gets path. - * - * @return the path. - */ - public String getPath() { - return super.getString(Constants.Properties.PATH); - } - - /** - * Sets path. - * - * @param path the path. - */ - public void setPath(String path) { - super.set(Constants.Properties.PATH, path); - } - - /** - * Gets the sort order for the composite path. - * - * For example if you want to run the query "SELECT * FROM c ORDER BY c.age asc, c.height desc", - * then you need to make the order for "/age" "ascending" and the order for "/height" "descending". - * - * @return the sort order. - */ - public CompositePathSortOrder getOrder() { - String strValue = super.getString(Constants.Properties.ORDER); - if (!StringUtils.isEmpty(strValue)) { - try { - return CompositePathSortOrder.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.ORDER))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid indexingMode value {}.", super.getString(Constants.Properties.ORDER)); - return CompositePathSortOrder.Ascending; - } - } - return CompositePathSortOrder.Ascending; - } - - /** - * Gets the sort order for the composite path. - * - * For example if you want to run the query "SELECT * FROM c ORDER BY c.age asc, c.height desc", - * then you need to make the order for "/age" "ascending" and the order for "/height" "descending". - * - * @param order the sort order. - */ - public void setOrder(CompositePathSortOrder order) { - super.set(Constants.Properties.ORDER, order.toString()); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePathSortOrder.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePathSortOrder.java deleted file mode 100644 index fdb123abb0f8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePathSortOrder.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents the sorting order for a path in a composite index, for a - * collection in the Azure Cosmos DB database service. - */ -public enum CompositePathSortOrder { - /** - * Ascending sort order for composite paths. - */ - Ascending { - public String toString() { - return "ascending"; - } - }, - - /** - * Descending sort order for composite paths. - */ - Descending { - public String toString() { - return "descending"; - } - }, -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Conflict.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Conflict.java deleted file mode 100644 index 21650fe6331a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Conflict.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import java.lang.reflect.InvocationTargetException; - -/** - * Represents a conflict in the version of a particular resource in the Azure Cosmos DB database service. - *

- * During rare failure scenarios, conflicts are generated for the documents in transit. Clients can inspect the - * respective conflict instances for resources and operations in conflict. - */ -public final class Conflict extends Resource { - /** - * Initialize a conflict object. - */ - public Conflict() { - super(); - } - - /** - * Initialize a conflict object from json string. - * - * @param jsonString the json string that represents the conflict. - */ - public Conflict(String jsonString) { - super(jsonString); - } - - /** - * Gets the operation kind. - * - * @return the operation kind. - */ - public String getOperationKind() { - return super.getString(Constants.Properties.OPERATION_TYPE); - } - - /** - * Gets the type of the conflicting resource. - * - * @return the resource type. - */ - public String getResouceType() { - return super.getString(Constants.Properties.RESOURCE_TYPE); - } - - /** - * Gets the resource ID for the conflict in the Azure Cosmos DB service. - * @return resource Id for the conflict. - */ - public String getSourceResourceId() { - return super.getString(Constants.Properties.SOURCE_RESOURCE_ID); - } - - /** - * Gets the conflicting resource in the Azure Cosmos DB service. - * @param the type of the object. - * @param klass The returned type of conflicting resource. - * @return The conflicting resource. - */ - public T getResource(Class klass) { - String resourceAsString = super.getString(Constants.Properties.CONTENT); - - if (!Strings.isNullOrEmpty(resourceAsString)) { - try { - return klass.getConstructor(String.class).newInstance(resourceAsString); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - } else { - return null; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionMode.java deleted file mode 100644 index 8e605c5a0951..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionMode.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -public enum ConflictResolutionMode { - /** - * Last writer wins conflict resolution mode - * - * Setting the ConflictResolutionMode to "LastWriterWins" indicates that conflict resolution should be done by inspecting a field in the conflicting documents - * and picking the document which has the higher value in that path. See {@link ConflictResolutionPolicy#getConflictResolutionPath()} for details on how to specify the path - * to be checked for conflict resolution. Also note that Deletes win. - */ - LastWriterWins, - - /** - * Custom conflict resolution mode - * - * Setting the ConflictResolutionMode to "Custom" indicates that conflict resolution is custom handled by a user. - * The user could elect to register a user specified {@link StoredProcedure} for handling conflicting resources. - * Should the user not register a user specified StoredProcedure, conflicts will default to being made available as {@link Conflict} resources, - * which the user can inspect and manually resolve. - * See {@link ConflictResolutionPolicy#getConflictResolutionProcedure()} for details on how to specify the stored procedure - * to run for conflict resolution. - */ - Custom, - - /** - * Invalid or unknown mode. - */ - Invalid -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionPolicy.java deleted file mode 100644 index 291b24d326b9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionPolicy.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.microsoft.azure.cosmosdb; - - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.text.WordUtils; - - -/** - * Represents the conflict resolution policy configuration for specifying how to resolve conflicts - * in case writes from different regions result in conflicts on documents in the collection in the Azure Cosmos DB service. - * - * A collection with custom conflict resolution with no user-registered stored procedure. - *

{@code
- * DocumentCollection collectionSpec = new DocumentCollection();
- * collectionSpec.setId("Multi-master collection");
- *
- * ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy();
- * collectionSpec.setConflictResolutionPolicy(policy);
- *
- * DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
- *         .toBlocking().single().getResource();
- *
- * }
- * 
- * - * A collection with custom conflict resolution with a user-registered stored procedure. - *
{@code
- * DocumentCollection collectionSpec = new DocumentCollection();
- * collectionSpec.setId("Multi-master collection");
- *
- * ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy(conflictResolutionSprocName);
- * collectionSpec.setConflictResolutionPolicy(policy);
- *
- * DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
- *         .toBlocking().single().getResource();
- *
- * }
- * 
- * - * A collection with last writer wins conflict resolution, based on a path in the conflicting documents. - * A collection with custom conflict resolution with a user-registered stored procedure. - *
{@code
- * DocumentCollection collectionSpec = new DocumentCollection();
- * collectionSpec.setId("Multi-master collection");
- *
- * ConflictResolutionPolicy policy = ConflictResolutionPolicy.createLastWriterWinsPolicy("/path/for/conflict/resolution");
- * collectionSpec.setConflictResolutionPolicy(policy);
- *
- * DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
- *         .toBlocking().single().getResource();
- *
- * }
- * 
- */ -public class ConflictResolutionPolicy extends JsonSerializable { - - /** - * Creates a LastWriterWins {@link ConflictResolutionPolicy} with "/_ts" as the resolution path. - * - * In case of a conflict occurring on a document, the document with the higher integer value in the default path - * {@link Resource#getTimestamp()}, i.e., "/_ts" will be used. - * - * @return ConflictResolutionPolicy. - */ - public static ConflictResolutionPolicy createLastWriterWinsPolicy() { - ConflictResolutionPolicy policy = new ConflictResolutionPolicy(); - policy.setMode(ConflictResolutionMode.LastWriterWins); - return policy; - } - - /** - * - * Creates a LastWriterWins {@link ConflictResolutionPolicy} with path as the resolution path. - * - * The specified path must be present in each document and must be an integer value. - * In case of a conflict occurring on a document, the document with the higher integer value in the specified path - * will be picked. - * - * @param conflictResolutionPath The path to check values for last-writer wins conflict resolution. - * That path is a rooted path of the property in the document, such as "/name/first". - * @return ConflictResolutionPolicy. - */ - public static ConflictResolutionPolicy createLastWriterWinsPolicy(String conflictResolutionPath) { - ConflictResolutionPolicy policy = new ConflictResolutionPolicy(); - policy.setMode(ConflictResolutionMode.LastWriterWins); - if (conflictResolutionPath != null) { - policy.setConflictResolutionPath(conflictResolutionPath); - } - return policy; - } - - /** - * Creates a Custom {@link ConflictResolutionPolicy} which uses the specified stored procedure - * to perform conflict resolution - * - * This stored procedure may be created after the {@link DocumentCollection} is created and can be changed as required. - * - *
    - *
  • In case the stored procedure fails or throws an exception, - * the conflict resolution will default to registering conflicts in the conflicts feed
  • - *
  • The user can provide the stored procedure @see {@link Resource#getId()}
  • - *
- * @param conflictResolutionSprocName stored procedure to perform conflict resolution. - * @return ConflictResolutionPolicy. - */ - public static ConflictResolutionPolicy createCustomPolicy(String conflictResolutionSprocName) { - ConflictResolutionPolicy policy = new ConflictResolutionPolicy(); - policy.setMode(ConflictResolutionMode.Custom); - if (conflictResolutionSprocName != null) { - policy.setConflictResolutionProcedure(conflictResolutionSprocName); - } - return policy; - } - - /** - * Creates a Custom {@link ConflictResolutionPolicy} without any {@link StoredProcedure}. User manually - * should resolve conflicts. - * - * The conflicts will be registered in the conflicts feed and the user should manually resolve them. - * - * @return ConflictResolutionPolicy. - */ - public static ConflictResolutionPolicy createCustomPolicy() { - ConflictResolutionPolicy policy = new ConflictResolutionPolicy(); - policy.setMode(ConflictResolutionMode.Custom); - return policy; - } - - /** - * Initializes a new instance of the {@link ConflictResolutionPolicy} class for the Azure Cosmos DB service. - */ - ConflictResolutionPolicy() {} - - public ConflictResolutionPolicy(String jsonString) { - super(jsonString); - } - - /** - * Gets the {@link ConflictResolutionMode} in the Azure Cosmos DB service. - * By default it is {@link ConflictResolutionMode#LastWriterWins}. - * - * @return ConflictResolutionMode. - */ - public ConflictResolutionMode getConflictResolutionMode() { - - String strValue = super.getString(Constants.Properties.MODE); - - if (!Strings.isNullOrEmpty(strValue)) { - try { - return ConflictResolutionMode.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.MODE))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid ConflictResolutionMode value {}.", super.getString(Constants.Properties.MODE)); - return ConflictResolutionMode.Invalid; - } - } - - return ConflictResolutionMode.Invalid; - } - - /** - * Sets the {@link ConflictResolutionMode} in the Azure Cosmos DB service. - * By default it is {@link ConflictResolutionMode#LastWriterWins}. - * - * @param mode One of the values of the {@link ConflictResolutionMode} enum. - */ - void setMode(ConflictResolutionMode mode) { - super.set(Constants.Properties.MODE, mode.name()); - } - - /** - * Gets the path which is present in each document in the Azure Cosmos DB service for last writer wins conflict-resolution. - * This path must be present in each document and must be an integer value. - * In case of a conflict occurring on a document, the document with the higher integer value in the specified path will be picked. - * If the path is unspecified, by default the {@link Resource#getTimestamp()} path will be used. - * - * This value should only be set when using {@link ConflictResolutionMode#LastWriterWins} - * - * @return The path to check values for last-writer wins conflict resolution. - * That path is a rooted path of the property in the document, such as "/name/first". - */ - public String getConflictResolutionPath() { - return super.getString(Constants.Properties.CONFLICT_RESOLUTION_PATH); - } - - /** - * Sets the path which is present in each document in the Azure Cosmos DB service for last writer wins conflict-resolution. - * This path must be present in each document and must be an integer value. - * In case of a conflict occurring on a document, the document with the higher integer value in the specified path will be picked. - * If the path is unspecified, by default the {@link Resource#getTimestamp()} path will be used. - * - * This value should only be set when using {@link ConflictResolutionMode#LastWriterWins} - * - * @param value The path to check values for last-writer wins conflict resolution. - * That path is a rooted path of the property in the document, such as "/name/first". - */ - void setConflictResolutionPath(String value) { - super.set(Constants.Properties.CONFLICT_RESOLUTION_PATH, value); - } - - /** - * Gets the {@link StoredProcedure} which is used for conflict resolution in the Azure Cosmos DB service. - * This stored procedure may be created after the {@link DocumentCollection} is created and can be changed as required. - * - *
    - *
  • This value should only be set when using {@link ConflictResolutionMode#Custom}
  • - *
  • In case the stored procedure fails or throws an exception, - * the conflict resolution will default to registering conflicts in the conflicts feed
  • - *
  • The user can provide the stored procedure @see {@link Resource#getId()}
  • - *
- ** - * @return the stored procedure to perform conflict resolution.] - */ - public String getConflictResolutionProcedure() { - return super.getString(Constants.Properties.CONFLICT_RESOLUTION_PROCEDURE); - } - - void setConflictResolutionProcedure(String value) { - super.set(Constants.Properties.CONFLICT_RESOLUTION_PROCEDURE, value); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionMode.java deleted file mode 100644 index c534ef3394b7..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionMode.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents the connection mode to be used by the client in the Azure Cosmos DB database service. - *

- * Direct and Gateway connectivity modes are supported. Gateway is the default. - * Refer to <see>http://azure.microsoft.com/documentation/articles/documentdb- - * interactions-with-resources/#connectivity-options</see> for additional - * details. - *

- */ -public enum ConnectionMode { - - /** - * Specifies that requests to server resources are made through a gateway proxy using HTTPS. - *

- * In Gateway mode, all requests are made through a gateway proxy. - *

- */ - Gateway, - - /** - * Specifies that requests to server resources are made directly to the data nodes. - *

- * In Direct mode, all requests to server resources within a collection, such as documents, stored procedures - * and user-defined functions, etc., are made directly to the data nodes within the target Cosmos DB cluster - * using either the HTTPS or TCP/SSL transport protocol. - *

- * Certain operations on account or database level resources, such as databases, collections and users, etc., - * are always routed through the gateway using HTTPS. - *

- */ - Direct -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionPolicy.java deleted file mode 100644 index 6409218e0515..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionPolicy.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.net.InetSocketAddress; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * Represents the Connection policy associated with a DocumentClient in the Azure Cosmos DB database service. - */ -public final class ConnectionPolicy { - - private static final int DEFAULT_REQUEST_TIMEOUT_IN_MILLIS = 60 * 1000; - // defaultMediaRequestTimeout is based upon the blob client timeout and the - // retry policy. - private static final int DEFAULT_MEDIA_REQUEST_TIMEOUT_IN_MILLIS = 300 * 1000; - private static final int DEFAULT_IDLE_CONNECTION_TIMEOUT_IN_MILLIS = 60 * 1000; - - private static final int DEFAULT_MAX_POOL_SIZE = 1000; - - private static ConnectionPolicy default_policy = null; - private int requestTimeoutInMillis; - private int mediaRequestTimeoutInMillis; - private ConnectionMode connectionMode; - private MediaReadMode mediaReadMode; - private int maxPoolSize; - private int idleConnectionTimeoutInMillis; - private String userAgentSuffix; - private RetryOptions retryOptions; - private boolean enableEndpointDiscovery = true; - private List preferredLocations; - private boolean usingMultipleWriteLocations; - private InetSocketAddress inetSocketProxyAddress; - private Boolean enableReadRequestsFallback; - - /** - * Constructor. - */ - public ConnectionPolicy() { - this.connectionMode = ConnectionMode.Gateway; - this.enableReadRequestsFallback = null; - this.idleConnectionTimeoutInMillis = DEFAULT_IDLE_CONNECTION_TIMEOUT_IN_MILLIS; - this.maxPoolSize = DEFAULT_MAX_POOL_SIZE; - this.mediaReadMode = MediaReadMode.Buffered; - this.mediaRequestTimeoutInMillis = ConnectionPolicy.DEFAULT_MEDIA_REQUEST_TIMEOUT_IN_MILLIS; - this.requestTimeoutInMillis = ConnectionPolicy.DEFAULT_REQUEST_TIMEOUT_IN_MILLIS; - this.retryOptions = new RetryOptions(); - this.userAgentSuffix = ""; - } - - /** - * Gets the default connection policy. - * - * @return the default connection policy. - */ - public static ConnectionPolicy GetDefault() { - if (ConnectionPolicy.default_policy == null) { - ConnectionPolicy.default_policy = new ConnectionPolicy(); - } - return ConnectionPolicy.default_policy; - } - - /** - * Gets the request timeout (time to wait for response from network peer) in - * milliseconds. - * - * @return the request timeout in milliseconds. - */ - public int getRequestTimeoutInMillis() { - return this.requestTimeoutInMillis; - } - - /** - * Sets the request timeout (time to wait for response from network peer) in - * milliseconds. The default is 60 seconds. - * - * @param requestTimeoutInMillis the request timeout in milliseconds. - */ - public void setRequestTimeoutInMillis(int requestTimeoutInMillis) { - this.requestTimeoutInMillis = requestTimeoutInMillis; - } - - /** - * Gets or sets time to wait for response from network peer for attachment - * content (aka media) operations. - * - * @return the media request timeout in milliseconds. - */ - public int getMediaRequestTimeoutInMillis() { - return this.mediaRequestTimeoutInMillis; - } - - /** - * Gets or sets Time to wait for response from network peer for attachment - * content (aka media) operations. - * - * @param mediaRequestTimeoutInMillis the media request timeout in milliseconds. - */ - public void setMediaRequestTimeoutInMillis(int mediaRequestTimeoutInMillis) { - this.mediaRequestTimeoutInMillis = mediaRequestTimeoutInMillis; - } - - /** - * Gets the connection mode used in the client. - * - * @return the connection mode. - */ - public ConnectionMode getConnectionMode() { - return this.connectionMode; - } - - /** - * Sets the connection mode used in the client. - * - * @param connectionMode the connection mode. - */ - public void setConnectionMode(ConnectionMode connectionMode) { - this.connectionMode = connectionMode; - } - - /** - * Gets the attachment content (aka media) download mode. - * - * @return the media read mode. - */ - public MediaReadMode getMediaReadMode() { - return this.mediaReadMode; - } - - /** - * Sets the attachment content (aka media) download mode. - * - * @param mediaReadMode the media read mode. - */ - public void setMediaReadMode(MediaReadMode mediaReadMode) { - this.mediaReadMode = mediaReadMode; - } - - /** - * Gets the value of the connection pool size the client is using. - * - * @return connection pool size. - */ - public int getMaxPoolSize() { - return this.maxPoolSize; - } - - /** - * Sets the value of the connection pool size, the default - * is 1000. - * - * @param maxPoolSize The value of the connection pool size. - */ - public void setMaxPoolSize(int maxPoolSize) { - this.maxPoolSize = maxPoolSize; - } - - /** - * Gets the value of the timeout for an idle connection, the default is 60 - * seconds. - * - * @return Idle connection timeout. - */ - public int getIdleConnectionTimeoutInMillis() { - return this.idleConnectionTimeoutInMillis; - } - - /** - * sets the value of the timeout for an idle connection. After that time, - * the connection will be automatically closed. - * - * @param idleConnectionTimeoutInMillis the timeout for an idle connection in seconds. - */ - public void setIdleConnectionTimeoutInMillis(int idleConnectionTimeoutInMillis) { - this.idleConnectionTimeoutInMillis = idleConnectionTimeoutInMillis; - } - - /** - * Gets the value of user-agent suffix. - * - * @return the value of user-agent suffix. - */ - public String getUserAgentSuffix() { - return this.userAgentSuffix; - } - - /** - * sets the value of the user-agent suffix. - * - * @param userAgentSuffix The value to be appended to the user-agent header, this is - * used for monitoring purposes. - */ - public void setUserAgentSuffix(String userAgentSuffix) { - this.userAgentSuffix = userAgentSuffix; - } - - /** - * Gets the retry policy options associated with the DocumentClient instance. - * - * @return the RetryOptions instance. - */ - public RetryOptions getRetryOptions() { - return this.retryOptions; - } - - /** - * Sets the retry policy options associated with the DocumentClient instance. - *

- * Properties in the RetryOptions class allow application to customize the built-in - * retry policies. This property is optional. When it's not set, the SDK uses the - * default values for configuring the retry policies. See RetryOptions class for - * more details. - * - * @param retryOptions the RetryOptions instance. - */ - public void setRetryOptions(RetryOptions retryOptions) { - if (retryOptions == null) { - throw new IllegalArgumentException("retryOptions value must not be null."); - } - - this.retryOptions = retryOptions; - } - - /** - * Gets the flag to enable endpoint discovery for geo-replicated database accounts. - * - * @return whether endpoint discovery is enabled. - */ - public boolean getEnableEndpointDiscovery() { - return this.enableEndpointDiscovery; - } - - /** - * Sets the flag to enable endpoint discovery for geo-replicated database accounts. - *

- * When EnableEndpointDiscovery is true, the SDK will automatically discover the - * current write and read regions to ensure requests are sent to the correct region - * based on the capability of the region and the user's preference. - *

- * The default value for this property is true indicating endpoint discovery is enabled. - * - * @param enableEndpointDiscovery true if EndpointDiscovery is enabled. - */ - public void setEnableEndpointDiscovery(boolean enableEndpointDiscovery) { - this.enableEndpointDiscovery = enableEndpointDiscovery; - } - - /** - * Gets the flag to enable writes on any locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. - * - * When the value of this property is true, the SDK will direct write operations to - * available writable locations of geo-replicated database account. Writable locations - * are ordered by PreferredLocations property. Setting the property value - * to true has no effect until EnableMultipleWriteLocations in DatabaseAccount - * is also set to true. - * - * Default value is false indicating that writes are only directed to - * first region in PreferredLocations property. - * - * @return flag to enable writes on any locations (regions) for geo-replicated database accounts. - */ - public boolean isUsingMultipleWriteLocations() { - return this.usingMultipleWriteLocations; - } - - /** - * Gets whether to allow for reads to go to multiple regions configured on an account of Azure Cosmos DB service. - * - * Default value is null. - * - * If this property is not set, the default is true for all Consistency Levels other than Bounded Staleness, - * The default is false for Bounded Staleness. - * 1. {@link #enableEndpointDiscovery} is true - * 2. the Azure Cosmos DB account has more than one region - * - * @return flag to allow for reads to go to multiple regions configured on an account of Azure Cosmos DB service. - */ - public Boolean isEnableReadRequestsFallback() { - return this.enableReadRequestsFallback; - } - - /** - * Sets the flag to enable writes on any locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. - * - * When the value of this property is true, the SDK will direct write operations to - * available writable locations of geo-replicated database account. Writable locations - * are ordered by PreferredLocations property. Setting the property value - * to true has no effect until EnableMultipleWriteLocations in DatabaseAccount - * is also set to true. - * - * Default value is false indicating that writes are only directed to - * first region in PreferredLocations property. - * - * @param usingMultipleWriteLocations flag to enable writes on any locations (regions) for geo-replicated database accounts. - */ - public void setUsingMultipleWriteLocations(boolean usingMultipleWriteLocations) { - this.usingMultipleWriteLocations = usingMultipleWriteLocations; - } - - /** - * Sets whether to allow for reads to go to multiple regions configured on an account of Azure Cosmos DB service. - * - * Default value is null. - * - * If this property is not set, the default is true for all Consistency Levels other than Bounded Staleness, - * The default is false for Bounded Staleness. - * 1. {@link #enableEndpointDiscovery} is true - * 2. the Azure Cosmos DB account has more than one region - * - * @param enableReadRequestsFallback flag to enable reads to go to multiple regions configured on an account of Azure Cosmos DB service. - */ - public void setEnableReadRequestsFallback(Boolean enableReadRequestsFallback) { - this.enableReadRequestsFallback = enableReadRequestsFallback; - } - - /** - * Gets the preferred locations for geo-replicated database accounts - * - * @return the list of preferred location. - */ - public List getPreferredLocations() { - return this.preferredLocations != null ? preferredLocations : Collections.emptyList(); - } - - /** - * Sets the preferred locations for geo-replicated database accounts. For example, - * "East US" as the preferred location. - *

- * When EnableEndpointDiscovery is true and PreferredRegions is non-empty, - * the SDK will prefer to use the locations in the collection in the order - * they are specified to perform operations. - *

- * If EnableEndpointDiscovery is set to false, this property is ignored. - * - * @param preferredLocations the list of preferred locations. - */ - public void setPreferredLocations(List preferredLocations) { - this.preferredLocations = preferredLocations; - } - - /** - * Gets the InetSocketAddress of proxy server. - * - * @return the value of proxyHost. - */ - public InetSocketAddress getProxy() { - return this.inetSocketProxyAddress; - } - - /** - * This will create the InetSocketAddress for proxy server, - * all the requests to cosmoDB will route from this address. - * @param proxyHost The proxy server host. - * @param proxyPort The proxy server port. - */ - public void setProxy(String proxyHost, int proxyPort) { - this.inetSocketProxyAddress = new InetSocketAddress(proxyHost, proxyPort); - } - - @Override - public String toString() { - return "ConnectionPolicy{" + - "requestTimeoutInMillis=" + requestTimeoutInMillis + - ", mediaRequestTimeoutInMillis=" + mediaRequestTimeoutInMillis + - ", connectionMode=" + connectionMode + - ", mediaReadMode=" + mediaReadMode + - ", maxPoolSize=" + maxPoolSize + - ", idleConnectionTimeoutInMillis=" + idleConnectionTimeoutInMillis + - ", userAgentSuffix='" + userAgentSuffix + '\'' + - ", retryOptions=" + retryOptions + - ", enableEndpointDiscovery=" + enableEndpointDiscovery + - ", preferredLocations=" + preferredLocations + - ", usingMultipleWriteLocations=" + usingMultipleWriteLocations + - ", inetSocketProxyAddress=" + inetSocketProxyAddress + - '}'; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyLevel.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyLevel.java deleted file mode 100644 index a7da6d28eb8a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyLevel.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents the consistency levels supported for Cosmos DB client operations in the Azure Cosmos DB database service. - *

- * The requested ConsistencyLevel must match or be weaker than that provisioned for the database account. Consistency - * levels by order of strength are Strong, BoundedStaleness, Session and Eventual. - */ -public enum ConsistencyLevel { - - /** - * Strong Consistency guarantees that read operations always return the value that was last written. - */ - Strong, - - /** - * Bounded Staleness guarantees that reads are not too out-of-date. This can be configured based on number of - * operations (MaxStalenessPrefix) or time (MaxStalenessIntervalInSeconds) - */ - BoundedStaleness, - - /** - * Session Consistency guarantees monotonic reads (you never read old data, then new, then old again), monotonic - * writes (writes are ordered) and read your writes (your writes are immediately visible to your reads) within - * any single session. - */ - Session, - - /** - * Eventual Consistency guarantees that reads will return a subset of writes. All writes will be eventually be - * available for reads. - */ - Eventual, - - /** - * ConsistentPrefix Consistency guarantees that reads will return some prefix of all writes with no gaps. All writes - * will be eventually be available for reads. - */ - ConsistentPrefix -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyPolicy.java deleted file mode 100644 index 141a6b196795..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyPolicy.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - - -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Encapsulates the settings for consistency policy in the Azure Cosmos DB database service. - */ -public final class ConsistencyPolicy extends JsonSerializable { - private static final ConsistencyLevel DEFAULT_DEFAULT_CONSISTENCY_LEVEL = - ConsistencyLevel.Session; - - private static final int DEFAULT_MAX_STALENESS_INTERVAL = 5; - private static final int DEFAULT_MAX_STALENESS_PREFIX = 100; - - - /** - * Constructor. - */ - ConsistencyPolicy() { - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the consistency policy. - */ - public ConsistencyPolicy(String jsonString) { - super(jsonString); - } - - /** - * Get the name of the resource. - * - * @return the default consistency level. - */ - public ConsistencyLevel getDefaultConsistencyLevel() { - - ConsistencyLevel result = ConsistencyPolicy.DEFAULT_DEFAULT_CONSISTENCY_LEVEL; - try { - result = ConsistencyLevel.valueOf( - WordUtils.capitalize(super.getString(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL))); - } catch (IllegalArgumentException e) { - // ignore the exception and return the default - this.getLogger().warn("Unknown consistency level {}, value ignored.", super.getString(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL)); - } - return result; - } - - /** - * Set the name of the resource. - * - * @param level the consistency level. - */ - public void setDefaultConsistencyLevel(ConsistencyLevel level) { - super.set(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL, level.name()); - } - - /** - * Gets the bounded staleness consistency, the maximum allowed staleness in terms difference in sequence numbers - * (aka version). - * - * @return the max staleness prefix. - */ - public int getMaxStalenessPrefix() { - Integer value = super.getInt(Constants.Properties.MAX_STALENESS_PREFIX); - if (value == null) { - return ConsistencyPolicy.DEFAULT_MAX_STALENESS_PREFIX; - } - return value; - } - - /** - * Sets the bounded staleness consistency, the maximum allowed staleness in terms difference in sequence numbers - * (aka version). - * - * @param maxStalenessPrefix the max staleness prefix. - */ - public void setMaxStalenessPrefix(int maxStalenessPrefix) { - super.set(Constants.Properties.MAX_STALENESS_PREFIX, maxStalenessPrefix); - } - - /** - * Gets the in bounded staleness consistency, the maximum allowed staleness in terms time interval. - * - * @return the max staleness prefix. - */ - public int getMaxStalenessIntervalInSeconds() { - Integer value = super.getInt(Constants.Properties.MAX_STALENESS_INTERVAL_IN_SECONDS); - if (value == null) { - return ConsistencyPolicy.DEFAULT_MAX_STALENESS_INTERVAL; - } - return value; - } - - /** - * Sets the in bounded staleness consistency, the maximum allowed staleness in terms time interval. - * - * @param maxStalenessIntervalInSeconds the max staleness interval in seconds. - */ - public void setMaxStalenessIntervalInSeconds(int maxStalenessIntervalInSeconds) { - super.set(Constants.Properties.MAX_STALENESS_INTERVAL_IN_SECONDS, maxStalenessIntervalInSeconds); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CosmosResourceType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CosmosResourceType.java deleted file mode 100644 index 11029c770a91..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CosmosResourceType.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Resource types in the Azure Cosmos DB database service. - */ -public enum CosmosResourceType { - - System(-100), - Attachment(3), - DocumentCollection(1), - Conflict(107), - Database(0), - Document(2), - Index(104), - Offer(113), - Permission(5), - StoredProcedure(109), - Trigger(110), - User(4), - UserDefinedFunction(111); - - final private int value; - - CosmosResourceType(int value) { - this.value = value; - } - - public int value() { - return this.value; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DataType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DataType.java deleted file mode 100644 index 9ff43f876835..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DataType.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Data types in the Azure Cosmos DB database service. - */ -public enum DataType { - /** - * Represents a numeric data type. - */ - Number, - - /** - * Represents a string data type. - */ - String, - - /** - * Represent a point data type. - */ - Point, - - /** - * Represents a line string data type. - */ - LineString, - - /** - * Represent a polygon data type. - */ - Polygon, - - /** - * Represent a multi-polygon data type. - */ - MultiPolygon -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Database.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Database.java deleted file mode 100644 index 118eef88cf38..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Database.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a Database in the Azure Cosmos DB database service. A database manages users, permissions and a set of collections - *

- * Each Azure Cosmos DB Service is able to support multiple independent named databases, with the database being the - * logical container for data. Each Database consists of one or more collections, each of which in turn contain one or - * more documents. Since databases are an an administrative resource and the Service Master Key will be required in - * order to access and successfully complete any action using the User APIs. - */ -public final class Database extends Resource { - - /** - * Initialize a database object. - */ - public Database() { - super(); - } - - /** - * Initialize a database object from json string. - * - * @param jsonString the json string. - */ - public Database(String jsonString) { - super(jsonString); - } - - /** - * Gets the self-link for collections in the database - * - * @return the collections link. - */ - public String getCollectionsLink() { - return String.format("%s/%s", - StringUtils.stripEnd(super.getSelfLink(), "/"), - super.getString(Constants.Properties.COLLECTIONS_LINK)); - } - - /** - * Gets the self-link for users in the database. - * - * @return the users link. - */ - public String getUsersLink() { - return String.format("%s/%s", - StringUtils.stripEnd(super.getSelfLink(), "/"), - super.getString(Constants.Properties.USERS_LINK)); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccount.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccount.java deleted file mode 100644 index a8ce58bb977a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccount.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.Utils; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.StringUtils; - -/** - * Represents a database account in the Azure Cosmos DB database service. - */ -public class DatabaseAccount extends Resource { - private ConsistencyPolicy consistencyPolicy; - - private long maxMediaStorageUsageInMB; - private long mediaStorageUsageInMB; - private ReplicationPolicy replicationPolicy; - private ReplicationPolicy systemReplicationPolicy; - private Map queryEngineConfiguration; - - /** - * Constructor. - */ - DatabaseAccount() { - this.setSelfLink(""); - } - - /** - * Initialize a database account object from json string. - * - * @param jsonString the json string that represents the database account. - */ - public DatabaseAccount(String jsonString) { - super(jsonString); - } - - /** - * Get the databases link of the databaseAccount. - * - * @return the databases link. - */ - public String getDatabasesLink() { - return super.getString(Constants.Properties.DATABASES_LINK); - } - - /** - * Set the databases of the databaseAccount. - * - * @param databasesLink the databases link. - */ - void setDatabasesLink(String databasesLink) { - super.set(Constants.Properties.DATABASES_LINK, databasesLink); - } - - /** - * Get the medialink of the databaseAccount. - * - * @return the media link. - */ - public String getMediaLink() { - return super.getString(Constants.Properties.MEDIA_LINK); - } - - /** - * Set the medialink of the databaseAccount. - * - * @param medialink the media link. - */ - void setMediaLink(String medialink) { - super.set(Constants.Properties.MEDIA_LINK, medialink); - } - - /** - * Get the addresseslink of the databaseAccount. - * - * @return the addresses link. - */ - public String getAddressesLink() { - return super.getString(Constants.Properties.ADDRESS_LINK); - } - - /** - * Set the addresseslink of the databaseAccount. - * - * @param addresseslink the addresses link. - */ - void setAddressesLink(String addresseslink) { - super.set(Constants.Properties.ADDRESS_LINK, addresseslink); - } - - /** - * Attachment content (media) storage quota in MBs Retrieved from gateway. - * - * @return the max media storage usage in MB. - */ - public long getMaxMediaStorageUsageInMB() { - return this.maxMediaStorageUsageInMB; - } - - void setMaxMediaStorageUsageInMB(long value) { - this.maxMediaStorageUsageInMB = value; - } - - /** - * Current attachment content (media) usage in MBs. - *

- * Retrieved from gateway. Value is returned from cached information updated - * periodically and is not guaranteed to be real time. - * - * @return the media storage usage in MB. - */ - public long getMediaStorageUsageInMB() { - return this.mediaStorageUsageInMB; - } - - void setMediaStorageUsageInMB(long value) { - this.mediaStorageUsageInMB = value; - } - - /** - * Gets the ConsistencyPolicy settings. - * - * @return the consistency policy. - */ - public ConsistencyPolicy getConsistencyPolicy() { - if (this.consistencyPolicy == null) { - this.consistencyPolicy = super.getObject(Constants.Properties.USER_CONSISTENCY_POLICY, - ConsistencyPolicy.class); - - if (this.consistencyPolicy == null) { - this.consistencyPolicy = new ConsistencyPolicy(); - } - } - return this.consistencyPolicy; - } - - /** - * Gets the ReplicationPolicy settings. - * - * @return the replication policy. - */ - public ReplicationPolicy getReplicationPolicy() { - if (this.replicationPolicy == null) { - this.replicationPolicy = super.getObject(Constants.Properties.USER_REPLICATION_POLICY, - ReplicationPolicy.class); - - if (this.replicationPolicy == null) { - this.replicationPolicy = new ReplicationPolicy(); - } - } - - return this.replicationPolicy; - } - - /** - * Gets the SystemReplicationPolicy settings. - * - * @return the system replication policy. - */ - ReplicationPolicy getSystemReplicationPolicy() { - if (this.systemReplicationPolicy == null) { - this.systemReplicationPolicy = super.getObject(Constants.Properties.SYSTEM_REPLICATION_POLICY, - ReplicationPolicy.class); - - if (this.systemReplicationPolicy == null) { - this.systemReplicationPolicy = new ReplicationPolicy(); - } - } - - return this.systemReplicationPolicy; - } - - /** - * Gets the QueryEngineConfiuration settings. - * - * @return the query engine configuration. - */ - Map getQueryEngineConfiuration() { - if (this.queryEngineConfiguration == null) { - String queryEngineConfigurationJsonString = super.getObject(Constants.Properties.QUERY_ENGINE_CONFIGURATION, - String.class); - if (StringUtils.isNotEmpty(queryEngineConfigurationJsonString)) { - TypeReference> typeRef = new TypeReference>() { - }; - try { - this.queryEngineConfiguration = Utils.getSimpleObjectMapper() - .readValue(queryEngineConfigurationJsonString, typeRef); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - if (this.queryEngineConfiguration == null) { - this.queryEngineConfiguration = new HashMap<>(); - } - } - } - - return this.queryEngineConfiguration; - } - - /** - * Gets the list of writable locations for this database account. - * - * @return the list of writable locations. - */ - public Iterable getWritableLocations() { - return super.getCollection(Constants.Properties.WRITABLE_LOCATIONS, DatabaseAccountLocation.class); - } - - /** - * Sets the list of writable locations for this database account. - *

- * The list of writable locations are returned by the service. - * - * @param locations the list of writable locations. - */ - void setWritableLocations(Iterable locations) { - super.set(Constants.Properties.WRITABLE_LOCATIONS, locations); - } - - /** - * Gets the list of readable locations for this database account. - * - * @return the list of readable locations. - */ - public Iterable getReadableLocations() { - return super.getCollection(Constants.Properties.READABLE_LOCATIONS, DatabaseAccountLocation.class); - } - - /** - * Sets the list of readable locations for this database account. - *

- * The list of readable locations are returned by the service. - * - * @param locations the list of readable locations. - */ - void setReadableLocations(Iterable locations) { - super.set(Constants.Properties.READABLE_LOCATIONS, locations); - } - - boolean isEnableMultipleWriteLocations() { - return ObjectUtils.defaultIfNull(super.getBoolean(Constants.Properties.ENABLE_MULTIPLE_WRITE_LOCATIONS), false); - } - - void setEnableMultipleWriteLocations(boolean value) { - super.set(Constants.Properties.ENABLE_MULTIPLE_WRITE_LOCATIONS, value); - } - - @Override - void populatePropertyBag() { - if (this.consistencyPolicy != null) { - this.consistencyPolicy.populatePropertyBag(); - super.set(Constants.Properties.USER_CONSISTENCY_POLICY, this.consistencyPolicy); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountLocation.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountLocation.java deleted file mode 100644 index 2ee1cca92a09..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountLocation.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents the location of a database account in the Azure Cosmos DB database service. - */ -public class DatabaseAccountLocation extends JsonSerializable { - - /** - * Default Constructor. Creates a new instance of the - * DatabaseAccountLocation object. - */ - DatabaseAccountLocation() { - super(); - } - - /** - * Creates a new instance of the DatabaseAccountLocation object from a JSON - * string. - * - * @param jsonString the JSON string that represents the DatabaseAccountLocation object. - */ - public DatabaseAccountLocation(String jsonString) { - super(jsonString); - } - - /** - * Gets The name of the database account location. - * - * @return the name of the database account location. - */ - public String getName() { - return super.getString(Constants.Properties.Name); - } - - /** - * Sets the name of the database account location. - * - * @param name the name of the database account location. - */ - public void setName(String name) { - super.set(Constants.Properties.Name, name); - } - - /** - * Gets The endpoint (the URI) of the database account location. - * - * @return the endpoint of the database account location. - */ - public String getEndpoint() { - return super.getString(Constants.Properties.DATABASE_ACCOUNT_ENDPOINT); - } - - /** - * Sets the endpoint (the URI) of the database account location. - * - * @param endpoint the endpoint of the database account location. - */ - public void setEndpoint(String endpoint) { - super.set(Constants.Properties.DATABASE_ACCOUNT_ENDPOINT, endpoint); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Document.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Document.java deleted file mode 100644 index 31922b93adba..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Document.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.io.IOException; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a document in the Azure Cosmos DB database service. - *

- * A document is a structured JSON document. There is no set schema for the JSON documents, and a document may contain - * any number of custom properties as well as an optional list of attachments. Document is an application resource and - * can be authorized using the master key or resource keys. - */ -public class Document extends Resource { - - /** - * Initialize a document object. - */ - public Document() { - super(); - } - - /** - * Initialize a document object from json string. - * - * @param jsonString the json string that represents the document object. - * @param objectMapper the custom object mapper - */ - public Document(String jsonString, ObjectMapper objectMapper) { - super(jsonString, objectMapper); - } - - /** - * Initialize a document object from json string. - * - * @param jsonString the json string that represents the document object. - */ - public Document(String jsonString) { - super(jsonString); - } - - static Document FromObject(Object document, ObjectMapper objectMapper) { - Document typedDocument; - if (document instanceof Document) { - typedDocument = (Document) document; - } else { - try { - return new Document(objectMapper.writeValueAsString(document)); - } catch (IOException e) { - throw new IllegalArgumentException("Can't serialize the object into the json string", e); - } - } - return typedDocument; - } - - /** - * Gets the document's time-to-live value. - * - * @return the document's time-to-live value in seconds. - */ - public Integer getTimeToLive() { - if (super.has(Constants.Properties.TTL)) { - return super.getInt(Constants.Properties.TTL); - } - - return null; - } - - /** - * Sets the document's time-to-live value. - *

- * A document's time-to-live value is an optional property. If set, the document expires after the specified number - * of seconds since its last write time. The value of this property should be one of the following: - *

- * null - indicates the time-to-live value for this document inherits from the parent collection's default time-to-live value. - *

- * nonzero positive integer - indicates the number of seconds before the document expires. It overrides the default time-to-live - * value specified on the parent collection, unless the parent collection's default time-to-live is null. - *

- * -1 - indicates the document never expires. It overrides the default time-to-live - * value specified on the parent collection, unless the parent collection's default time-to-live is null. - * - * @param timeToLive the document's time-to-live value in seconds. - */ - public void setTimeToLive(Integer timeToLive) { - // a "null" value is represented as a missing element on the wire. - // setting timeToLive to null should remove the property from the property bag. - if (timeToLive != null) { - super.set(Constants.Properties.TTL, timeToLive); - } else if (super.has(Constants.Properties.TTL)) { - super.remove(Constants.Properties.TTL); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentClientException.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentClientException.java deleted file mode 100644 index c9b6d4a99fd9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentClientException.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -/** - * This class defines a custom exception type for all operations on - * DocumentClient in the Azure Cosmos DB database service. Applications are expected to catch DocumentClientException - * and handle errors as appropriate when calling methods on DocumentClient. - *

- * Errors coming from the service during normal execution are converted to - * DocumentClientException before returning to the application with the following exception: - *

- * When a BE error is encountered during a QueryIterable<T> iteration, an IllegalStateException - * is thrown instead of DocumentClientException. - *

- * When a transport level error happens that request is not able to reach the service, - * an IllegalStateException is thrown instead of DocumentClientException. - */ -public class DocumentClientException extends Exception { - private static final long serialVersionUID = 1L; - - private Error error; - private final int statusCode; - private final Map responseHeaders; - private ClientSideRequestStatistics clientSideRequestStatistics; - String resourceAddress; - String partitionKeyRangeId; - URI requestUri; - long lsn; - Map requestHeaders; - - /** - * Creates a new instance of the DocumentClientException class. - * - * @param statusCode the http status code of the response. - */ - public DocumentClientException(int statusCode) { - this.statusCode = statusCode; - this.responseHeaders = new HashMap<>(); - } - - /** - * Creates a new instance of the DocumentClientException class. - * - * @param statusCode the http status code of the response. - * @param errorMessage the error message. - */ - public DocumentClientException(int statusCode, String errorMessage) { - Error error = new Error(); - error.set(Constants.Properties.MESSAGE, errorMessage); - this.statusCode = statusCode; - this.error = error; - this.responseHeaders = new HashMap<>(); - } - - /** - * Creates a new instance of the DocumentClientException class. - * - * @param statusCode the http status code of the response. - * @param innerException the original exception. - */ - public DocumentClientException(int statusCode, Exception innerException) { - super(innerException); - this.statusCode = statusCode; - this.responseHeaders = new HashMap<>(); - } - - /** - * Creates a new instance of the DocumentClientException class. - * - * @param statusCode the http status code of the response. - * @param errorResource the error resource object. - * @param responseHeaders the response headers. - */ - public DocumentClientException(int statusCode, Error errorResource, Map responseHeaders) { - this(null, statusCode, errorResource, responseHeaders); - } - - /** - * Creates a new instance of the DocumentClientException class. - * - * @param resourceAddress the address of the resource the request is associated with. - * @param statusCode the http status code of the response. - * @param errorResource the error resource object. - * @param responseHeaders the response headers. - */ - - public DocumentClientException(String resourceAddress, int statusCode, Error errorResource, Map responseHeaders) { - - super(errorResource == null ? null : errorResource.getMessage()); - - this.responseHeaders = safeResponseHeaders(responseHeaders); - this.resourceAddress = resourceAddress; - this.statusCode = statusCode; - this.error = errorResource; - } - - /** Creates a new instance of the DocumentClientException class. - * @param message the string message. - * @param statusCode the http status code of the response. - * @param exception the exception object. - * @param responseHeaders the response headers. - * @param resourceAddress the address of the resource the request is associated with. - */ - public DocumentClientException(String message, Exception exception, Map responseHeaders, int statusCode, String resourceAddress) { - - super(message, exception); - - this.responseHeaders = safeResponseHeaders(responseHeaders); - this.resourceAddress = resourceAddress; - this.statusCode = statusCode; - } - - @Override - public String getMessage() { - if (clientSideRequestStatistics == null) { - return getInnerErrorMessage(); - } - return getInnerErrorMessage() + ", " + clientSideRequestStatistics.toString(); - } - - /** - * Gets the activity ID associated with the request. - * - * @return the activity ID. - */ - public String getActivityId() { - if (this.responseHeaders != null) { - return this.responseHeaders.get(HttpConstants.HttpHeaders.ACTIVITY_ID); - } - - return null; - } - - /** - * Gets the http status code. - * - * @return the status code. - */ - public int getStatusCode() { - return this.statusCode; - } - - /** - * Gets the sub status code. - * - * @return the status code. - */ - public int getSubStatusCode() { - int code = HttpConstants.SubStatusCodes.UNKNOWN; - if (this.responseHeaders != null) { - String subStatusString = this.responseHeaders.get(HttpConstants.HttpHeaders.SUB_STATUS); - if (StringUtils.isNotEmpty(subStatusString)) { - try { - code = Integer.parseInt(subStatusString); - } catch (NumberFormatException e) { - // If value cannot be parsed as Integer, return Unknown. - } - } - } - - return code; - } - - /** - * Gets the error code associated with the exception. - * - * @return the error. - */ - public Error getError() { - return this.error; - } - - /** - * Gets the recommended time interval after which the client can retry - * failed requests - * - * @return the recommended time interval after which the client can retry - * failed requests. - */ - public long getRetryAfterInMilliseconds() { - long retryIntervalInMilliseconds = 0; - - if (this.responseHeaders != null) { - String header = this.responseHeaders.get(HttpConstants.HttpHeaders.RETRY_AFTER_IN_MILLISECONDS); - - if (StringUtils.isNotEmpty(header)) { - try { - retryIntervalInMilliseconds = Long.parseLong(header); - } catch (NumberFormatException e) { - // If the value cannot be parsed as long, return 0. - } - } - } - - // - // In the absence of explicit guidance from the backend, don't introduce - // any unilateral retry delays here. - return retryIntervalInMilliseconds; - } - - /** - * Gets the response headers as key-value pairs - * - * @return the response headers - */ - public Map getResponseHeaders() { - return this.responseHeaders; - } - - /** - * Gets the resource address associated with this exception. - * - * @return the resource address associated with this exception. - */ - String getResourceAddress() { - return this.resourceAddress; - } - - /** - * Gets the Client side request statistics associated with this exception. - * - * @return Client side request statistics associated with this exception. - */ - public ClientSideRequestStatistics getClientSideRequestStatistics() { - return clientSideRequestStatistics; - } - - public void setClientSideRequestStatistics(ClientSideRequestStatistics clientSideRequestStatistics) { - this.clientSideRequestStatistics = clientSideRequestStatistics; - } - - @Override - public String toString() { - return getClass().getSimpleName() + "{" + - "error=" + error + - ", resourceAddress='" + resourceAddress + '\'' + - ", statusCode=" + statusCode + - ", message=" + getMessage() + - ", getCauseInfo=" + getCauseInfo() + - ", responseHeaders=" + responseHeaders + - ", requestHeaders=" + requestHeaders + - '}'; - } - - String getInnerErrorMessage() { - String innerErrorMessage = super.getMessage(); - if (error != null) { - innerErrorMessage = error.getMessage(); - if (innerErrorMessage == null) { - innerErrorMessage = String.valueOf(error.get("Errors")); - } - } - return innerErrorMessage; - } - - private String getCauseInfo() { - Throwable cause = getCause(); - if (cause != null) { - return String.format("[class: %s, message: %s]", cause.getClass(), cause.getMessage()); - } - return null; - } - - private Map safeResponseHeaders(Map map) { - if (map != null) { - return new HashMap<>(map); - } else { - return new HashMap<>(); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentCollection.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentCollection.java deleted file mode 100644 index 351b483e0dc5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentCollection.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import org.apache.commons.lang3.StringUtils; - -/** - * Represents a document collection in the Azure Cosmos DB database service. A collection is a named logical container - * for documents. - *

- * A database may contain zero or more named collections and each collection consists of zero or more JSON documents. - * Being schema-free, the documents in a collection do not need to share the same structure or fields. Since collections - * are application resources, they can be authorized using either the master key or resource keys. - */ -public final class DocumentCollection extends Resource { - private IndexingPolicy indexingPolicy; - private UniqueKeyPolicy uniqueKeyPolicy; - private PartitionKeyDefinition partitionKeyDefinition; - - /** - * Initialize a document collection object. - */ - public DocumentCollection() { - super(); - } - - /** - * Initialize a document collection object from json string. - * - * @param jsonString the json string that represents the document collection. - */ - public DocumentCollection(String jsonString) { - super(jsonString); - } - - /** - * Gets the indexing policy. - * - * @return the indexing policy. - */ - public IndexingPolicy getIndexingPolicy() { - if (this.indexingPolicy == null) { - if (super.has(Constants.Properties.INDEXING_POLICY)) { - this.indexingPolicy = super.getObject(Constants.Properties.INDEXING_POLICY, IndexingPolicy.class); - } else { - this.indexingPolicy = new IndexingPolicy(); - } - } - - return this.indexingPolicy; - } - - /** - * Sets the indexing policy. - * - * @param indexingPolicy the indexing policy. - */ - public void setIndexingPolicy(IndexingPolicy indexingPolicy) { - if (indexingPolicy == null) { - throw new IllegalArgumentException("IndexingPolicy cannot be null."); - } - - this.indexingPolicy = indexingPolicy; - } - - /** - * Gets the collection's partition key definition. - * - * @return the partition key definition. - */ - public PartitionKeyDefinition getPartitionKey() { - if (this.partitionKeyDefinition == null) { - - if (super.has(Constants.Properties.PARTITION_KEY)) { - this.partitionKeyDefinition = super.getObject(Constants.Properties.PARTITION_KEY, PartitionKeyDefinition.class); - } else { - this.partitionKeyDefinition = new PartitionKeyDefinition(); - } - } - - return this.partitionKeyDefinition; - } - - /** - * Sets the collection's partition key definition. - * - * @param partitionKey the partition key definition. - */ - public void setPartitionKey(PartitionKeyDefinition partitionKey) { - if (partitionKey == null) { - throw new IllegalArgumentException("partitionKey cannot be null."); - } - - this.partitionKeyDefinition = partitionKey; - } - - /** - * Gets the collection's default time-to-live value. - * - * @return the default time-to-live value in seconds. - */ - public Integer getDefaultTimeToLive() { - if (super.has(Constants.Properties.DEFAULT_TTL)) { - return super.getInt(Constants.Properties.DEFAULT_TTL); - } - - return null; - } - - /** - * Sets the collection's default time-to-live value. - *

- * The default time-to-live value on a collection is an optional property. If set, the documents within the collection - * expires after the specified number of seconds since their last write time. The value of this property should be one of the following: - *

- * null - indicates evaluation of time-to-live is disabled and documents within the collection will never expire, regardless whether - * individual documents have their time-to-live set. - *

- * nonzero positive integer - indicates the default time-to-live value for all documents within the collection. This value can be overridden - * by individual documents' time-to-live value. - *

- * -1 - indicates by default all documents within the collection never expire. This value can be overridden by individual documents' - * time-to-live value. - * - * @param timeToLive the default time-to-live value in seconds. - */ - public void setDefaultTimeToLive(Integer timeToLive) { - // a "null" value is represented as a missing element on the wire. - // setting timeToLive to null should remove the property from the property bag. - if (timeToLive != null) { - super.set(Constants.Properties.DEFAULT_TTL, timeToLive); - } else if (super.has(Constants.Properties.DEFAULT_TTL)) { - super.remove(Constants.Properties.DEFAULT_TTL); - } - } - - /** - * Sets the Uni that guarantees uniqueness of documents in collection in the Azure Cosmos DB service. - * @return UniqueKeyPolicy - */ - public UniqueKeyPolicy getUniqueKeyPolicy() { - - // Thread safe lazy initialization for case when collection is cached (and is basically readonly). - if (this.uniqueKeyPolicy == null) { - this.uniqueKeyPolicy = super.getObject(Constants.Properties.UNIQUE_KEY_POLICY, UniqueKeyPolicy.class); - - if (this.uniqueKeyPolicy == null) { - this.uniqueKeyPolicy = new UniqueKeyPolicy(); - } - } - - return this.uniqueKeyPolicy; - } - - public void setUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { - if (uniqueKeyPolicy == null) { - throw new IllegalArgumentException("uniqueKeyPolicy cannot be null."); - } - - this.uniqueKeyPolicy = uniqueKeyPolicy; - super.set(Constants.Properties.UNIQUE_KEY_POLICY, uniqueKeyPolicy); - } - - /** - * Gets the conflictResolutionPolicy that is used for resolving conflicting writes - * on documents in different regions, in a collection in the Azure Cosmos DB service. - * - * @return ConflictResolutionPolicy - */ - public ConflictResolutionPolicy getConflictResolutionPolicy() { - return super.getObject(Constants.Properties.CONFLICT_RESOLUTION_POLICY, ConflictResolutionPolicy.class); - } - - /** - * Sets the conflictResolutionPolicy that is used for resolving conflicting writes - * on documents in different regions, in a collection in the Azure Cosmos DB service. - * - * @param value ConflictResolutionPolicy to be used. - */ - public void setConflictResolutionPolicy(ConflictResolutionPolicy value) { - if (value == null) { - throw new IllegalArgumentException("CONFLICT_RESOLUTION_POLICY cannot be null."); - } - - super.set(Constants.Properties.CONFLICT_RESOLUTION_POLICY, value); - } - - - /** - * Gets the self-link for documents in a collection. - * - * @return the document link. - */ - public String getDocumentsLink() { - return String.format("%s/%s", - StringUtils.stripEnd(super.getSelfLink(), "/"), - super.getString(Constants.Properties.DOCUMENTS_LINK)); - } - - /** - * Gets the self-link for stored procedures in a collection. - * - * @return the stored procedures link. - */ - public String getStoredProceduresLink() { - return String.format("%s/%s", - StringUtils.stripEnd(super.getSelfLink(), "/"), - super.getString(Constants.Properties.STORED_PROCEDURES_LINK)); - } - - /** - * Gets the self-link for triggers in a collection. - * - * @return the trigger link. - */ - public String getTriggersLink() { - return StringUtils.removeEnd(this.getSelfLink(), "/") + - "/" + super.getString(Constants.Properties.TRIGGERS_LINK); - } - - /** - * Gets the self-link for user defined functions in a collection. - * - * @return the user defined functions link. - */ - public String getUserDefinedFunctionsLink() { - return StringUtils.removeEnd(this.getSelfLink(), "/") + - "/" + super.getString(Constants.Properties.USER_DEFINED_FUNCTIONS_LINK); - } - - /** - * Gets the self-link for conflicts in a collection. - * - * @return the conflicts link. - */ - public String getConflictsLink() { - return StringUtils.removeEnd(this.getSelfLink(), "/") + - "/" + super.getString(Constants.Properties.CONFLICTS_LINK); - } - - @Override - void populatePropertyBag() { - if (this.indexingPolicy == null) { - this.getIndexingPolicy(); - } - if (this.uniqueKeyPolicy == null) { - this.getUniqueKeyPolicy(); - } - - if (this.partitionKeyDefinition != null) { - this.partitionKeyDefinition.populatePropertyBag(); - super.set(Constants.Properties.PARTITION_KEY, this.partitionKeyDefinition); - } - - this.indexingPolicy.populatePropertyBag(); - this.uniqueKeyPolicy.populatePropertyBag(); - super.set(Constants.Properties.INDEXING_POLICY, this.indexingPolicy); - super.set(Constants.Properties.UNIQUE_KEY_POLICY, this.uniqueKeyPolicy); - } - - @Override - public boolean equals(Object obj) { - if (obj == null || !DocumentCollection.class.isAssignableFrom(obj.getClass())) { - return false; - } - - DocumentCollection typedObj = (DocumentCollection) obj; - return typedObj.getResourceId().equals(this.getResourceId()); - } - - @Override - public int hashCode() { - return this.getResourceId().hashCode(); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Error.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Error.java deleted file mode 100644 index 8923700be3c2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Error.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Encapsulates error related details in the Azure Cosmos DB database service. - */ -public class Error extends Resource { - /** - * Initialize a new instance of the Error object. - */ - public Error() { - super(); - } - - /** - * Initialize a new instance of the Error object from a JSON string. - * - * @param objectNode the {@link ObjectNode} that represents the error. - */ - Error(ObjectNode objectNode) { - super(objectNode); - } - - /** - * Initialize a new instance of the Error object from a JSON string. - * - * @param jsonString the jsonString that represents the error. - */ - public Error(String jsonString) { - super(jsonString); - } - - /** - * Initialize a new instance of the Error object. - * - * @param errorCode the error code. - * @param message the error message. - */ - public Error(String errorCode, String message) { - this(errorCode, message, null); - } - - /** - * Initialize a new instance of the Error object. - * - * @param errorCode - * the error code. - * @param message - * the error message. - * @param additionalErrorInfo - * additional error info. - */ - public Error(String errorCode, String message, String additionalErrorInfo) { - super(); - this.setCode(errorCode); - this.setMessage(message); - this.setAdditionalErrorInfo(additionalErrorInfo); - } - - /** - * Gets the error code. - * - * @return the error code. - */ - public String getCode() { - return super.getString(Constants.Properties.CODE); - } - - /** - * Sets the error code. - * - * @param code the error code. - */ - private void setCode(String code) { - super.set(Constants.Properties.CODE, code); - } - - /** - * Gets the error message. - * - * @return the error message. - */ - public String getMessage() { - return super.getString(Constants.Properties.MESSAGE); - } - - /** - * Sets the error message. - * - * @param message the error message. - */ - private void setMessage(String message) { - super.set(Constants.Properties.MESSAGE, message); - } - - /** - * Gets the error details. - * - * @return the error details. - */ - public String getErrorDetails() { - return super.getString(Constants.Properties.ERROR_DETAILS); - } - - /** - * Sets the partitioned query execution info. - * - * @param additionalErrorInfo - * the partitioned query execution info. - */ - private void setAdditionalErrorInfo(String additionalErrorInfo) { - super.set(Constants.Properties.ADDITIONAL_ERROR_INFO, additionalErrorInfo); - } - - /** - * Gets the partitioned query execution info. - * - * @return the partitioned query execution info. - */ - public String getPartitionedQueryExecutionInfo() { - return super.getString(Constants.Properties.ADDITIONAL_ERROR_INFO); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ExcludedPath.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ExcludedPath.java deleted file mode 100644 index 58cb1835d70d..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ExcludedPath.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents an excluded path of the IndexingPolicy in the Azure Cosmos DB database service. - */ -public class ExcludedPath extends JsonSerializable { - - /** - * Constructor. - */ - public ExcludedPath() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the excluded path. - */ - public ExcludedPath(String jsonString) { - super(jsonString); - } - - /** - * Gets path. - * - * @return the path. - */ - public String getPath() { - return super.getString(Constants.Properties.PATH); - } - - /** - * Sets path. - * - * @param path the path. - */ - public void setPath(String path) { - super.set(Constants.Properties.PATH, path); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptions.java deleted file mode 100644 index d0fd538ade3b..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptions.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies the options associated with feed methods (enumeration operations) in the Azure Cosmos DB database service. - */ -public final class FeedOptions extends FeedOptionsBase { - private String sessionToken; - private String partitionKeyRangeId; - private Boolean enableScanInQuery; - private Boolean emitVerboseTracesInQuery; - private Boolean enableCrossPartitionQuery; - private int maxDegreeOfParallelism; - private int maxBufferedItemCount; - private int responseContinuationTokenLimitInKb; - - public FeedOptions() {} - - public FeedOptions(FeedOptions options) { - super(options); - this.sessionToken = options.sessionToken; - this.partitionKeyRangeId = options.partitionKeyRangeId; - this.enableScanInQuery = options.enableScanInQuery; - this.emitVerboseTracesInQuery = options.emitVerboseTracesInQuery; - this.enableCrossPartitionQuery = options.enableCrossPartitionQuery; - this.maxDegreeOfParallelism = options.maxDegreeOfParallelism; - this.maxBufferedItemCount = options.maxBufferedItemCount; - this.responseContinuationTokenLimitInKb = options.responseContinuationTokenLimitInKb; - } - - /** - * Gets the partitionKeyRangeId. - * - * @return the partitionKeyRangeId. - */ - public String getPartitionKeyRangeIdInternal() { - return this.partitionKeyRangeId; - } - - /** - * Sets the partitionKeyRangeId. - * - * @param partitionKeyRangeId - * the partitionKeyRangeId. - */ - public void setPartitionKeyRangeIdInternal(String partitionKeyRangeId) { - this.partitionKeyRangeId = partitionKeyRangeId; - } - - /** - * Gets the session token for use with session consistency. - * - * @return the session token. - */ - public String getSessionToken() { - return this.sessionToken; - } - - /** - * Sets the session token for use with session consistency. - * - * @param sessionToken - * the session token. - */ - public void setSessionToken(String sessionToken) { - this.sessionToken = sessionToken; - } - - /** - * Gets the option to allow scan on the queries which couldn't be served as - * indexing was opted out on the requested paths. - * - * @return the option of enable scan in query. - */ - public Boolean getEnableScanInQuery() { - return this.enableScanInQuery; - } - - /** - * Sets the option to allow scan on the queries which couldn't be served as - * indexing was opted out on the requested paths. - * - * @param enableScanInQuery - * the option of enable scan in query. - */ - public void setEnableScanInQuery(Boolean enableScanInQuery) { - this.enableScanInQuery = enableScanInQuery; - } - - /** - * Gets the option to allow queries to emit out verbose traces for - * investigation. - * - * @return the emit verbose traces in query. - */ - public Boolean getEmitVerboseTracesInQuery() { - return this.emitVerboseTracesInQuery; - } - - /** - * Sets the option to allow queries to emit out verbose traces for - * investigation. - * - * @param emitVerboseTracesInQuery - * the emit verbose traces in query. - */ - public void setEmitVerboseTracesInQuery(Boolean emitVerboseTracesInQuery) { - this.emitVerboseTracesInQuery = emitVerboseTracesInQuery; - } - - /** - * Gets the option to allow queries to run across all partitions of the - * collection. - * - * @return whether to allow queries to run across all partitions of the - * collection. - */ - public Boolean getEnableCrossPartitionQuery() { - return this.enableCrossPartitionQuery; - } - - /** - * Sets the option to allow queries to run across all partitions of the - * collection. - * - * @param enableCrossPartitionQuery - * whether to allow queries to run across all partitions of the - * collection. - */ - public void setEnableCrossPartitionQuery(Boolean enableCrossPartitionQuery) { - this.enableCrossPartitionQuery = enableCrossPartitionQuery; - } - - /** - * Gets the number of concurrent operations run client side during parallel - * query execution. - * - * @return number of concurrent operations run client side during parallel - * query execution. - */ - public int getMaxDegreeOfParallelism() { - return maxDegreeOfParallelism; - } - - /** - * Sets the number of concurrent operations run client side during parallel - * query execution. - * - * @param maxDegreeOfParallelism - * number of concurrent operations. - */ - public void setMaxDegreeOfParallelism(int maxDegreeOfParallelism) { - this.maxDegreeOfParallelism = maxDegreeOfParallelism; - } - - /** - * Gets the maximum number of items that can be buffered client side during - * parallel query execution. - * - * @return maximum number of items that can be buffered client side during - * parallel query execution. - */ - public int getMaxBufferedItemCount() { - return maxBufferedItemCount; - } - - /** - * Sets the maximum number of items that can be buffered client side during - * parallel query execution. - * - * @param maxBufferedItemCount - * maximum number of items. - */ - public void setMaxBufferedItemCount(int maxBufferedItemCount) { - this.maxBufferedItemCount = maxBufferedItemCount; - } - - /** - * Sets the ResponseContinuationTokenLimitInKb request option for document query requests - * in the Azure Cosmos DB service. - * - * ResponseContinuationTokenLimitInKb is used to limit the length of continuation token in the query response. - * Valid values are >= 1. - * - * The continuation token contains both required and optional fields. - * The required fields are necessary for resuming the execution from where it was stooped. - * The optional fields may contain serialized index lookup work that was done but not yet utilized. - * This avoids redoing the work again in subsequent continuations and hence improve the query performance. - * Setting the maximum continuation size to 1KB, the Azure Cosmos DB service will only serialize required fields. - * Starting from 2KB, the Azure Cosmos DB service would serialize as much as it could fit till it reaches the maximum specified size. - * - * @param limitInKb continuation token size limit. - */ - public void setResponseContinuationTokenLimitInKb(int limitInKb) { - this.responseContinuationTokenLimitInKb = limitInKb; - } - - /** - * Gets the ResponseContinuationTokenLimitInKb request option for document query requests - * in the Azure Cosmos DB service. If not already set returns 0. - * - * ResponseContinuationTokenLimitInKb is used to limit the length of continuation token in the query response. - * Valid values are >= 1. - * - * @return return set ResponseContinuationTokenLimitInKb, or 0 if not set - */ - public int getResponseContinuationTokenLimitInKb() { - return responseContinuationTokenLimitInKb; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptionsBase.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptionsBase.java deleted file mode 100644 index d2edb4cf433f..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptionsBase.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.Map; - -/** - * Specifies the common options associated with feed methods (enumeration operations) in the Azure Cosmos DB database service. - */ -public abstract class FeedOptionsBase { - private Integer maxItemCount; - private String requestContinuation; - private PartitionKey partitionkey; - private boolean populateQueryMetrics; - private Map properties; - - protected FeedOptionsBase() {} - - FeedOptionsBase(FeedOptionsBase options) { - this.maxItemCount = options.maxItemCount; - this.requestContinuation = options.requestContinuation; - this.partitionkey = options.partitionkey; - this.populateQueryMetrics = options.populateQueryMetrics; - } - - /** - * Gets the maximum number of items to be returned in the enumeration - * operation. - * - * @return the max number of items. - */ - public Integer getMaxItemCount() { - return this.maxItemCount; - } - - /** - * Sets the maximum number of items to be returned in the enumeration - * operation. - * - * @param maxItemCount the max number of items. - */ - public void setMaxItemCount(Integer maxItemCount) { - this.maxItemCount = maxItemCount; - } - - /** - * Gets the request continuation token. - * - * @return the request continuation. - */ - public String getRequestContinuation() { - return this.requestContinuation; - } - - /** - * Sets the request continuation token. - * - * @param requestContinuation - * the request continuation. - */ - public void setRequestContinuation(String requestContinuation) { - this.requestContinuation = requestContinuation; - } - - /** - * Gets the partition key used to identify the current request's target - * partition. - * - * @return the partition key. - */ - public PartitionKey getPartitionKey() { - return this.partitionkey; - } - - /** - * Sets the partition key used to identify the current request's target - * partition. - * - * @param partitionkey - * the partition key value. - */ - public void setPartitionKey(PartitionKey partitionkey) { - this.partitionkey = partitionkey; - } - - /** - * Gets the option to enable populate query metrics - * @return whether to enable populate query metrics - */ - public boolean getPopulateQueryMetrics() { - return populateQueryMetrics; - } - - /** - * Sets the option to enable/disable getting metrics relating to query execution on document query requests - * @param populateQueryMetrics whether to enable or disable query metrics - */ - public void setPopulateQueryMetrics(boolean populateQueryMetrics) { - this.populateQueryMetrics = populateQueryMetrics; - } - - /** - * Gets the properties - * - * @return Map of request options properties - */ - public Map getProperties() { - return properties; - } - - /** - * Sets the properties used to identify the request token. - * - * @param properties the properties. - */ - public void setProperties(Map properties) { - this.properties = properties; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedResponse.java deleted file mode 100644 index 3ce9c19ed4ec..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedResponse.java +++ /dev/null @@ -1,401 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -public class FeedResponse { - - private final List results; - private final Map header; - private final HashMap usageHeaders; - private final HashMap quotaHeaders; - private final boolean useEtagAsContinuation; - boolean nochanges; - private final ConcurrentMap queryMetricsMap; - private final String DefaultPartition = "0"; - - FeedResponse(List results, Map headers) { - this(results, headers, false, false, new ConcurrentHashMap<>()); - } - - FeedResponse(List results, Map headers, ConcurrentMap queryMetricsMap) { - this(results, headers, false, false, queryMetricsMap); - } - - FeedResponse(List results, Map header, boolean nochanges) { - this(results, header, true, nochanges, new ConcurrentHashMap<>()); - } - - // TODO: need to more sure the query metrics can round trip just from the headers. - // We can then remove it as a parameter. - private FeedResponse( - List results, - Map header, - boolean useEtagAsContinuation, - boolean nochanges, - ConcurrentMap queryMetricsMap) { - this.results = results; - this.header = header; - this.usageHeaders = new HashMap<>(); - this.quotaHeaders = new HashMap<>(); - this.useEtagAsContinuation = useEtagAsContinuation; - this.nochanges = nochanges; - this.queryMetricsMap = new ConcurrentHashMap<>(queryMetricsMap); - } - - /** - * Results. - * - * @return the list of results. - */ - public List getResults() { - return results; - } - - /** - * Gets the maximum quota for database resources within the account from the Azure Cosmos DB service. - * - * @return The maximum quota for the account. - */ - public long getDatabaseQuota() { - return this.getMaxQuotaHeader(Constants.Quota.DATABASE); - } - - /** - * Gets the current number of database resources within the account from the Azure Cosmos DB service. - * - * @return The current number of databases. - */ - public long getDatabaseUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.DATABASE); - } - - /** - * Gets the maximum quota for collection resources within an account from the Azure Cosmos DB service. - * - * @return The maximum quota for the account. - */ - public long getCollectionQuota() { - return this.getMaxQuotaHeader(Constants.Quota.COLLECTION); - } - - /** - * Gets the current number of collection resources within the account from the Azure Cosmos DB service. - * - * @return The current number of collections. - */ - public long getCollectionUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.COLLECTION); - } - - /** - * Gets the maximum quota for user resources within an account from the Azure Cosmos DB service. - * - * @return The maximum quota for the account. - */ - public long getUserQuota() { - return this.getMaxQuotaHeader(Constants.Quota.USER); - } - - /** - * Gets the current number of user resources within the account from the Azure Cosmos DB service. - * - * @return The current number of users. - */ - public long getUserUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.USER); - } - - /** - * Gets the maximum quota for permission resources within an account from the Azure Cosmos DB service. - * - * @return The maximum quota for the account. - */ - public long getPermissionQuota() { - return this.getMaxQuotaHeader(Constants.Quota.PERMISSION); - } - - /** - * Gets the current number of permission resources within the account from the Azure Cosmos DB service. - * - * @return The current number of permissions. - */ - public long getPermissionUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.PERMISSION); - } - - /** - * Gets the maximum size of a collection in kilobytes from the Azure Cosmos DB service. - * - * @return The maximum quota in kilobytes. - */ - public long getCollectionSizeQuota() { - return this.getMaxQuotaHeader(Constants.Quota.COLLECTION_SIZE); - } - - /** - * Gets the current size of a collection in kilobytes from the Azure Cosmos DB service. - * - * @return The current size of a collection in kilobytes. - */ - public long getCollectionSizeUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.COLLECTION_SIZE); - } - - /** - * Gets the maximum quota of stored procedures for a collection from the Azure Cosmos DB service. - * - * @return The maximum stored procedure quota. - */ - public long getStoredProceduresQuota() { - return this.getMaxQuotaHeader(Constants.Quota.STORED_PROCEDURE); - } - - /** - * Gets the current number of stored procedures for a collection from the Azure Cosmos DB service. - * - * @return The current number of stored procedures. - */ - public long getStoredProceduresUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.STORED_PROCEDURE); - } - - /** - * Gets the maximum quota of triggers for a collection from the Azure Cosmos DB service. - * - * @return The maximum triggers quota. - */ - public long getTriggersQuota() { - return this.getMaxQuotaHeader(Constants.Quota.TRIGGER); - } - - /** - * Get the current number of triggers for a collection from the Azure Cosmos DB service. - * - * @return The current number of triggers. - */ - public long getTriggersUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.TRIGGER); - } - - /** - * Gets the maximum quota of user defined functions for a collection from the Azure Cosmos DB service. - * - * @return The maximum user defined functions quota. - */ - public long getUserDefinedFunctionsQuota() { - return this.getMaxQuotaHeader(Constants.Quota.USER_DEFINED_FUNCTION); - } - - /** - * Gets the current number of user defined functions for a collection from the Azure Cosmos DB service. - * - * @return the current number of user defined functions. - */ - public long getUserDefinedFunctionsUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.USER_DEFINED_FUNCTION); - } - - /** - * Gets the maximum size limit for this entity from the Azure Cosmos DB service. - * - * @return the maximum size limit for this entity. - * Measured in kilobytes for document resources and in counts for other resources. - */ - public String getMaxResourceQuota() { - return getValueOrNull(header, - HttpConstants.HttpHeaders.MAX_RESOURCE_QUOTA); - } - - /** - * Gets the current size of this entity from the Azure Cosmos DB service. - * - * @return the current size for this entity. Measured in kilobytes for document resources - * and in counts for other resources. - */ - public String getCurrentResourceQuotaUsage() { - return getValueOrNull(header, - HttpConstants.HttpHeaders.CURRENT_RESOURCE_QUOTA_USAGE); - } - - /** - * Gets the number of index paths (terms) generated by the operation. - * - * @return the request charge. - */ - public double getRequestCharge() { - String value = getValueOrNull(header, - HttpConstants.HttpHeaders.REQUEST_CHARGE); - if (StringUtils.isEmpty(value)) { - return 0; - } - return Double.valueOf(value); - } - - /** - * Gets the activity ID for the request. - * - * @return the activity id. - */ - public String getActivityId() { - return getValueOrNull(header, HttpConstants.HttpHeaders.ACTIVITY_ID); - } - - /** - * Gets the continuation token to be used for continuing the enumeration. - * - * @return the response continuation. - */ - public String getResponseContinuation() { - String headerName = useEtagAsContinuation - ? HttpConstants.HttpHeaders.E_TAG - : HttpConstants.HttpHeaders.CONTINUATION; - return getValueOrNull(header, headerName); - } - - /** - * Gets the session token for use in session consistency. - * - * @return the session token. - */ - public String getSessionToken() { - return getValueOrNull(header, HttpConstants.HttpHeaders.SESSION_TOKEN); - } - - /** - * Gets the response headers. - * - * @return the response headers. - */ - public Map getResponseHeaders() { - return header; - } - - private String getQueryMetricsString(){ - return getValueOrNull(getResponseHeaders(), - HttpConstants.HttpHeaders.QUERY_METRICS); - } - - /** - * Gets the QueryMetrics for each partition. - * - * @return the QueryMetrics for each partition. - */ - public ConcurrentMap getQueryMetrics() { - if (queryMetricsMap != null && !queryMetricsMap.isEmpty()) { - return queryMetricsMap; - } - - //We parse query metrics for un-partitioned collection here - if (!StringUtils.isEmpty(getQueryMetricsString())) { - String qm = getQueryMetricsString(); - qm += String.format(";%s=%.2f", QueryMetricsConstants.RequestCharge, getRequestCharge()); - queryMetricsMap.put(DefaultPartition, QueryMetrics.createFromDelimitedString(qm)); - } - return queryMetricsMap; - } - - ConcurrentMap getQueryMetricsMap(){ - return queryMetricsMap; - } - - private long getCurrentQuotaHeader(String headerName) { - if (this.usageHeaders.size() == 0 && !StringUtils.isEmpty(this.getMaxResourceQuota()) && - !StringUtils.isEmpty(this.getCurrentResourceQuotaUsage())) { - this.populateQuotaHeader(this.getMaxResourceQuota(), this.getCurrentResourceQuotaUsage()); - } - - if (this.usageHeaders.containsKey(headerName)) { - return this.usageHeaders.get(headerName); - } - - return 0; - } - - private long getMaxQuotaHeader(String headerName) { - if (this.quotaHeaders.size() == 0 && - !StringUtils.isEmpty(this.getMaxResourceQuota()) && - !StringUtils.isEmpty(this.getCurrentResourceQuotaUsage())) { - this.populateQuotaHeader(this.getMaxResourceQuota(), this.getCurrentResourceQuotaUsage()); - } - - if (this.quotaHeaders.containsKey(headerName)) { - return this.quotaHeaders.get(headerName); - } - - return 0; - } - - private void populateQuotaHeader(String headerMaxQuota, - String headerCurrentUsage) { - String[] headerMaxQuotaWords = headerMaxQuota.split(Constants.Quota.DELIMITER_CHARS, -1); - String[] headerCurrentUsageWords = headerCurrentUsage.split(Constants.Quota.DELIMITER_CHARS, -1); - - for (int i = 0; i < headerMaxQuotaWords.length; ++i) { - if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.DATABASE)) { - this.quotaHeaders.put(Constants.Quota.DATABASE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.DATABASE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.COLLECTION)) { - this.quotaHeaders.put(Constants.Quota.COLLECTION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.COLLECTION, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.USER)) { - this.quotaHeaders.put(Constants.Quota.USER, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.USER, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.PERMISSION)) { - this.quotaHeaders.put(Constants.Quota.PERMISSION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.PERMISSION, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.COLLECTION_SIZE)) { - this.quotaHeaders.put(Constants.Quota.COLLECTION_SIZE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.COLLECTION_SIZE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.STORED_PROCEDURE)) { - this.quotaHeaders.put(Constants.Quota.STORED_PROCEDURE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.STORED_PROCEDURE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.TRIGGER)) { - this.quotaHeaders.put(Constants.Quota.TRIGGER, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.TRIGGER, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.USER_DEFINED_FUNCTION)) { - this.quotaHeaders.put(Constants.Quota.USER_DEFINED_FUNCTION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.USER_DEFINED_FUNCTION, - Long.valueOf(headerCurrentUsageWords[i + 1])); - } - } - } - - private static String getValueOrNull(Map map, String key) { - if (map != null) { - return map.get(key); - } - return null; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/HashIndex.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/HashIndex.java deleted file mode 100644 index 2c351733dec8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/HashIndex.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a hash index in the Azure Cosmos DB database service. - */ -public final class HashIndex extends Index { - - /** - * Specifies an instance of HashIndex class with specified DataType. - *

- * Here is an example to instantiate HashIndex class passing in the DataType: - *

-     * {@code
-     *
-     * HashIndex hashIndex = new HashIndex(DataType.String);
-     *
-     * }
-     * 
- * - * @param dataType the data type. - */ - public HashIndex(DataType dataType) { - super(IndexKind.Hash); - this.setDataType(dataType); - } - - /** - * Initializes a new instance of the HashIndex class with specified DataType and precision. - *

- * Here is an example to instantiate HashIndex class passing in the DataType: - *

-     * {@code
-     *
-     * HashIndex hashIndex = new HashIndex(DataType.String, 3);
-     *
-     * }
-     * 
- * - * @param dataType the data type. - * @param precision the precision. - */ - public HashIndex(DataType dataType, int precision) { - super(IndexKind.Hash); - this.setDataType(dataType); - this.setPrecision(precision); - } - - /** - * Initializes a new instance of the HashIndex class with json string. - * - * @param jsonString the json string that represents the index. - */ - public HashIndex(String jsonString) { - super(jsonString, IndexKind.Hash); - if (this.getDataType() == null) { - throw new IllegalArgumentException("The jsonString doesn't contain a valid 'dataType'."); - } - } - - /** - * Gets data type. - * - * @return the data type. - */ - public DataType getDataType() { - DataType result = null; - try { - result = DataType.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.DATA_TYPE))); - } catch (IllegalArgumentException e) { - // Ignore exception and let the caller handle null value. - this.getLogger().warn("Invalid index dataType value {}.", super.getString(Constants.Properties.DATA_TYPE)); - } - return result; - } - - /** - * Sets data type. - * - * @param dataType the data type. - */ - public void setDataType(DataType dataType) { - super.set(Constants.Properties.DATA_TYPE, dataType.name()); - } - - /** - * Gets precision. - * - * @return the precision. - */ - public int getPrecision() { - return super.getInt(Constants.Properties.PRECISION); - } - - /** - * Sets precision. - * - * @param precision the precision. - */ - public void setPrecision(int precision) { - super.set(Constants.Properties.PRECISION, precision); - } - - boolean hasPrecision() { - return super.has(Constants.Properties.PRECISION); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IncludedPath.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IncludedPath.java deleted file mode 100644 index 3a630102fde8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IncludedPath.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Collection; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents an included path of the IndexingPolicy in the Azure Cosmos DB database service. - */ -public class IncludedPath extends JsonSerializable { - - private Collection indexes; - - /** - * Constructor. - */ - public IncludedPath() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the included path. - */ - public IncludedPath(String jsonString) { - super(jsonString); - } - - /** - * Gets path. - * - * @return the path. - */ - public String getPath() { - return super.getString(Constants.Properties.PATH); - } - - /** - * Sets path. - * - * @param path the path. - */ - public void setPath(String path) { - super.set(Constants.Properties.PATH, path); - } - - /** - * Gets the paths that are chosen to be indexed by the user. - * - * @return the included paths. - */ - public Collection getIndexes() { - if (this.indexes == null) { - this.indexes = this.getIndexCollection(); - - if (this.indexes == null) { - this.indexes = new ArrayList(); - } - } - - return this.indexes; - } - - public void setIndexes(Collection indexes) { - this.indexes = indexes; - } - - private Collection getIndexCollection() { - if (this.propertyBag != null && this.propertyBag.has(Constants.Properties.INDEXES)) { - ArrayNode jsonArray = (ArrayNode) this.propertyBag.get(Constants.Properties.INDEXES); - Collection result = new ArrayList(); - - for (int i = 0; i < jsonArray.size(); i++) { - JsonNode jsonObject = jsonArray.get(i); - - IndexKind indexKind = IndexKind.valueOf(WordUtils.capitalize( - jsonObject.get(Constants.Properties.INDEX_KIND).asText())); - switch (indexKind) { - case Hash: - result.add(new HashIndex(jsonObject.toString())); - break; - case Range: - result.add(new RangeIndex(jsonObject.toString())); - break; - case Spatial: - result.add(new SpatialIndex(jsonObject.toString())); - break; - } - } - - return result; - } - - return null; - } - - @Override - void populatePropertyBag() { - if (this.indexes != null) { - for (Index index : this.indexes) { - index.populatePropertyBag(); - } - - super.set(Constants.Properties.INDEXES, this.indexes); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Index.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Index.java deleted file mode 100644 index 7a3b00a6dc97..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Index.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents the index of a collection in the Azure Cosmos DB database service. - */ -public abstract class Index extends JsonSerializable { - - /** - * Constructor. - * - * @param indexKind the kind of the index - */ - protected Index(IndexKind indexKind) { - super(); - this.setKind(indexKind); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the index. - * @param indexKind the kind of the index - */ - protected Index(String jsonString, IndexKind indexKind) { - super(jsonString); - this.setKind(indexKind); - } - - /** - * Returns an instance of RangeIndex class with specified DataType. - *

- * Here is an example to create RangeIndex instance passing in the DataType: - *

-     * {@code
-     *
-     * RangeIndex rangeIndex = Index.Range(DataType.Number);
-     *
-     * }
-     * 
- * - * @param dataType the data type. - * @return an instance of RangeIndex type. - */ - public static RangeIndex Range(DataType dataType) { - return new RangeIndex(dataType); - } - - /** - * Returns an instance of RangeIndex class with specified DataType and precision. - *

- * Here is an example to create RangeIndex instance passing in the DataType and precision: - *

-     * {@code
-     *
-     * RangeIndex rangeIndex = Index.Range(DataType.Number, -1);
-     *
-     * }
-     * 
- * - * @param dataType specifies the target data type for the index path specification. - * @param precision specifies the precision to be used for the data type associated with this index. - * @return an instance of RangeIndex type. - */ - public static RangeIndex Range(DataType dataType, int precision) { - return new RangeIndex(dataType, precision); - } - - /** - * Returns an instance of HashIndex class with specified DataType. - *

- * Here is an example to create HashIndex instance passing in the DataType: - *

-     * {@code
-     *
-     * HashIndex hashIndex = Index.Hash(DataType.String);
-     * }
-     * 
- * - * @param dataType specifies the target data type for the index path specification. - * @return an instance of HashIndex type. - */ - public static HashIndex Hash(DataType dataType) { - return new HashIndex(dataType); - } - - /** - * Returns an instance of HashIndex class with specified DataType and precision. - *

- * Here is an example to create HashIndex instance passing in the DataType and precision: - *

- * HashIndex hashIndex = Index.Hash(DataType.String, 3); - * - * @param dataType specifies the target data type for the index path specification. - * @param precision specifies the precision to be used for the data type associated with this index. - * @return an instance of HashIndex type. - */ - public static HashIndex Hash(DataType dataType, int precision) { - return new HashIndex(dataType, precision); - } - - /** - * Returns an instance of SpatialIndex class with specified DataType. - *

- * Here is an example to create SpatialIndex instance passing in the DataType: - *

- * SpatialIndex spatialIndex = Index.Spatial(DataType.Point); - * - * @param dataType specifies the target data type for the index path specification. - * @return an instance of SpatialIndex type. - */ - public static SpatialIndex Spatial(DataType dataType) { - return new SpatialIndex(dataType); - } - - /** - * Gets index kind. - * - * @return the index kind. - */ - public IndexKind getKind() { - IndexKind result = null; - try { - result = IndexKind.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.INDEX_KIND))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid index kind value %s.", super.getString(Constants.Properties.INDEX_KIND)); - } - - return result; - } - - /** - * Sets index kind. - * - * @param indexKind the index kind. - */ - private void setKind(IndexKind indexKind) { - super.set(Constants.Properties.INDEX_KIND, indexKind.name()); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexKind.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexKind.java deleted file mode 100644 index 4e63ba467972..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexKind.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * These are the indexing types available for indexing a path in the Azure Cosmos DB database service. - * For additional details, refer to - * http://azure.microsoft.com/documentation/articles/documentdb-indexing-policies/#ConfigPolicy. - */ -public enum IndexKind { - // The index entries are hashed to serve point look up queries. - // Can be used to serve queries like: SELECT * FROM docs d WHERE d.prop = 5 - Hash, - - // The index entries are ordered. Range indexes are optimized for inequality predicate queries with efficient range - // scans. - // Can be used to serve queries like: SELECT * FROM docs d WHERE d.prop > 5 - Range, - - // The index entries are indexed to serve spatial queries like below: - // SELECT * FROM Root r WHERE ST_DISTANCE({"type":"Point","coordinates":[71.0589,42.3601]}, r.location) $LE 10000 - Spatial -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingDirective.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingDirective.java deleted file mode 100644 index 603191cc05c8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingDirective.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies whether or not the resource is to be indexed in the Azure Cosmos DB database service. - */ -public enum IndexingDirective { - - /** - * Use any pre-defined/pre-configured defaults. - */ - Default, - - /** - * Index the resource. - */ - Include, - - /** - * Do not index the resource. - */ - Exclude -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingMode.java deleted file mode 100644 index 54bd9b96a99e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingMode.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies the supported indexing modes in the Azure Cosmos DB database service. - */ -public enum IndexingMode { - /** - * Index is updated synchronously with a create or update operation. - *

- * With consistent indexing, query behavior is the same as the default consistency level for the collection. The - * index is always kept up to date with the data. - */ - Consistent, - - /** - * Index is updated asynchronously with respect to a create or update operation. - *

- * With lazy indexing, queries are eventually consistent. The index is updated when the collection is idle. - */ - Lazy, - - /** - * No index is provided. - *

- * Setting IndexingMode to "None" drops the index. Use this if you don't want to maintain the index for a document - * collection, to save the storage cost or improve the write throughput. Your queries will degenerate to scans of - * the entire collection. - */ - None -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingPolicy.java deleted file mode 100644 index 41650c03a562..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingPolicy.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.microsoft.azure.cosmosdb.internal.Constants; -import org.apache.commons.text.WordUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; - -/** - * Represents the indexing policy configuration for a collection in the Azure Cosmos DB database service. - */ -public final class IndexingPolicy extends JsonSerializable { - - private static final String DEFAULT_PATH = "/*"; - - private Collection includedPaths; - private Collection excludedPaths; - private Collection> compositeIndexes; - private Collection spatialIndexes; - - /** - * Constructor. - */ - public IndexingPolicy() { - this.setAutomatic(true); - this.setIndexingMode(IndexingMode.Consistent); - } - - /** - * Initializes a new instance of the IndexingPolicy class with the specified set of indexes as - * default index specifications for the root path. - *

- * The following example shows how to override the default indexingPolicy for root path: - *

-     * {@code
-     * HashIndex hashIndexOverride = Index.Hash(DataType.String, 5);
-     * RangeIndex rangeIndexOverride = Index.Range(DataType.Number, 2);
-     * SpatialIndex spatialIndexOverride = Index.Spatial(DataType.Point);
-     *
-     * IndexingPolicy indexingPolicy = new IndexingPolicy(hashIndexOverride, rangeIndexOverride, spatialIndexOverride);
-     * }
-     * 
- *

- * If you would like to just override the indexingPolicy for Numbers you can specify just that: - *

-     * {@code
-     * RangeIndex rangeIndexOverride = Index.Range(DataType.Number, 2);
-     *
-     * IndexingPolicy indexingPolicy = new IndexingPolicy(rangeIndexOverride);
-     * }
-     * 
- * - * @param defaultIndexOverrides comma separated set of indexes that serve as default index specifications for the root path. - */ - public IndexingPolicy(Index[] defaultIndexOverrides) { - this(); - - if (defaultIndexOverrides == null) { - throw new IllegalArgumentException("defaultIndexOverrides is null."); - } - - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath(IndexingPolicy.DEFAULT_PATH); - includedPath.setIndexes(new ArrayList(Arrays.asList(defaultIndexOverrides))); - this.getIncludedPaths().add(includedPath); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the indexing policy. - */ - public IndexingPolicy(String jsonString) { - super(jsonString); - } - - /** - * Gets whether automatic indexing is enabled for a collection. - *

- * In automatic indexing, documents can be explicitly excluded from indexing using RequestOptions. In manual - * indexing, documents can be explicitly included. - * - * @return the automatic - */ - public Boolean getAutomatic() { - return super.getBoolean(Constants.Properties.AUTOMATIC); - } - - /** - * Sets whether automatic indexing is enabled for a collection. - *

- * In automatic indexing, documents can be explicitly excluded from indexing using RequestOptions. In manual - * indexing, documents can be explicitly included. - * - * @param automatic the automatic - */ - public void setAutomatic(boolean automatic) { - super.set(Constants.Properties.AUTOMATIC, automatic); - } - - /** - * Gets the indexing mode (consistent or lazy). - * - * @return the indexing mode. - */ - public IndexingMode getIndexingMode() { - IndexingMode result = IndexingMode.Lazy; - try { - result = IndexingMode.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.INDEXING_MODE))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid indexingMode value {}.", super.getString(Constants.Properties.INDEXING_MODE)); - } - return result; - } - - /** - * Sets the indexing mode (consistent or lazy). - * - * @param indexingMode the indexing mode. - */ - public void setIndexingMode(IndexingMode indexingMode) { - super.set(Constants.Properties.INDEXING_MODE, indexingMode.name()); - } - - /** - * Gets the paths that are chosen to be indexed by the user. - * - * @return the included paths. - */ - public Collection getIncludedPaths() { - if (this.includedPaths == null) { - this.includedPaths = super.getCollection(Constants.Properties.INCLUDED_PATHS, IncludedPath.class); - - if (this.includedPaths == null) { - this.includedPaths = new ArrayList(); - } - } - - return this.includedPaths; - } - - public void setIncludedPaths(Collection includedPaths) { - this.includedPaths = includedPaths; - } - - /** - * Gets the paths that are not indexed. - * - * @return the excluded paths. - */ - public Collection getExcludedPaths() { - if (this.excludedPaths == null) { - this.excludedPaths = super.getCollection(Constants.Properties.EXCLUDED_PATHS, ExcludedPath.class); - - if (this.excludedPaths == null) { - this.excludedPaths = new ArrayList(); - } - } - - return this.excludedPaths; - } - - public void setExcludedPaths(Collection excludedPaths) { - this.excludedPaths = excludedPaths; - } - - /** - * Gets the composite indexes for additional indexes. - * - * @return the composite indexes. - */ - public Collection> getCompositeIndexes() { - if (this.compositeIndexes == null) { - this.compositeIndexes = new ArrayList>(); - ArrayNode compositeIndexes = (ArrayNode) super.get(Constants.Properties.COMPOSITE_INDEXES); - for (int i = 0; i < compositeIndexes.size(); i ++) { - ArrayNode compositeIndex = (ArrayNode) compositeIndexes.get(i); - ArrayList compositePaths = new ArrayList(); - for (int j = 0; j < compositeIndex.size(); j ++) { - CompositePath candidateCompositePath = new CompositePath(compositeIndex.get(j).toString()); - compositePaths.add(candidateCompositePath); - } - this.compositeIndexes.add(compositePaths); - } - } - - return this.compositeIndexes; - } - - /** - * Sets the composite indexes for additional indexes. - * - * @param compositeIndexes the composite indexes. - */ - public void setCompositeIndexes(Collection> compositeIndexes) { - this.compositeIndexes = compositeIndexes; - super.set(Constants.Properties.COMPOSITE_INDEXES, this.compositeIndexes); - } - - /** - * Sets the spatial indexes for additional indexes. - * - * @return the spatial indexes. - */ - public Collection getSpatialIndexes() { - if (this.spatialIndexes == null) { - this.spatialIndexes = super.getCollection(Constants.Properties.SPATIAL_INDEXES, SpatialSpec.class); - - if (this.spatialIndexes == null) { - this.spatialIndexes = new ArrayList(); - } - } - - return this.spatialIndexes; - } - - /** - * Sets the spatial indexes for additional indexes. - * - * @param spatialIndexes the spatial indexes. - */ - public void setSpatialIndexes(Collection spatialIndexes) { - this.spatialIndexes = spatialIndexes; - super.set(Constants.Properties.SPATIAL_INDEXES, this.spatialIndexes); - } - - @Override - void populatePropertyBag() { - // If indexing mode is not 'none' and not paths are set, set them to the defaults - if (this.getIndexingMode() != IndexingMode.None && this.getIncludedPaths().size() == 0 && - this.getExcludedPaths().size() == 0) { - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath(IndexingPolicy.DEFAULT_PATH); - this.getIncludedPaths().add(includedPath); - } - - if (this.includedPaths != null) { - for (IncludedPath includedPath : this.includedPaths) { - includedPath.populatePropertyBag(); - } - super.set(Constants.Properties.INCLUDED_PATHS, this.includedPaths); - } - - if (this.excludedPaths != null) { - for (ExcludedPath excludedPath : this.excludedPaths) { - excludedPath.populatePropertyBag(); - } - super.set(Constants.Properties.EXCLUDED_PATHS, this.excludedPaths); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/JsonSerializable.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/JsonSerializable.java deleted file mode 100644 index 27b52d80d51b..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/JsonSerializable.java +++ /dev/null @@ -1,581 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.internal.Utils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * Represents a base resource that can be serialized to JSON in the Azure Cosmos DB database service. - */ -public class JsonSerializable { - private final static Logger logger = LoggerFactory.getLogger(JsonSerializable.class); - private final static ObjectMapper OBJECT_MAPPER = Utils.getSimpleObjectMapper(); - private ObjectMapper om; - transient ObjectNode propertyBag = null; - - protected JsonSerializable() { - this.propertyBag = OBJECT_MAPPER.createObjectNode(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the JsonSerializable. - * @param objectMapper the custom object mapper - */ - protected JsonSerializable(String jsonString, ObjectMapper objectMapper) { - this.propertyBag = fromJson(jsonString); - this.om = objectMapper; - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the JsonSerializable. - */ - protected JsonSerializable(String jsonString) { - this.propertyBag = fromJson(jsonString); - } - - /** - * Constructor. - * - * @param objectNode the {@link ObjectNode} that represent the {@link JsonSerializable} - */ - JsonSerializable(ObjectNode objectNode) { - this.propertyBag = objectNode; - } - - protected ObjectMapper getMapper() { - if (this.om != null) { return this.om; } - return OBJECT_MAPPER; - } - - private static void checkForValidPOJO(Class c) { - if (c.isAnonymousClass() || c.isLocalClass()) { - throw new IllegalArgumentException( - String.format("%s can't be an anonymous or local class.", c.getName())); - } - if (c.isMemberClass() && !Modifier.isStatic(c.getModifiers())) { - throw new IllegalArgumentException( - String.format("%s must be static if it's a member class.", c.getName())); - } - } - - protected Logger getLogger() { - return logger; - } - - void populatePropertyBag() { - } - - /** - * Returns the propertybag(JSONObject) in a hashMap - * - * @return the HashMap. - */ - public HashMap getHashMap() { - return getMapper().convertValue(this.propertyBag, HashMap.class); - } - - /** - * Checks whether a property exists. - * - * @param propertyName the property to look up. - * @return true if the property exists. - */ - public boolean has(String propertyName) { - return this.propertyBag.has(propertyName); - } - - /** - * Removes a value by propertyName. - * - * @param propertyName the property to remove. - */ - public void remove(String propertyName) { - this.propertyBag.remove(propertyName); - } - - /** - * Sets the value of a property. - * - * @param the type of the object. - * @param propertyName the property to set. - * @param value the value of the property. - */ - @SuppressWarnings({"unchecked", "rawtypes"}) - public void set(String propertyName, T value) { - if (value == null) { - // Sets null. - this.propertyBag.putNull(propertyName); - } else if (value instanceof Collection) { - // Collection. - ArrayNode jsonArray = propertyBag.arrayNode(); - this.internalSetCollection(propertyName, (Collection) value, jsonArray); - this.propertyBag.set(propertyName, jsonArray); - } else if (value instanceof JsonNode) { - this.propertyBag.set(propertyName, (JsonNode) value); - } else if (value instanceof JsonSerializable) { - // JsonSerializable - JsonSerializable castedValue = (JsonSerializable) value; - if (castedValue != null) { - castedValue.populatePropertyBag(); - } - this.propertyBag.set(propertyName, castedValue != null ? castedValue.propertyBag : null); - } else { - // POJO, ObjectNode, number (includes int, float, double etc), boolean, - // and string. - this.propertyBag.set(propertyName, getMapper().valueToTree(value)); - } - } - - @SuppressWarnings({"unchecked", "rawtypes"}) - private void internalSetCollection(String propertyName, Collection collection, ArrayNode targetArray) { - for (T childValue : collection) { - if (childValue == null) { - // Sets null. - targetArray.addNull(); - } else if (childValue instanceof Collection) { - // When T is also a Collection, use recursion. - ArrayNode childArray = targetArray.addArray(); - this.internalSetCollection(propertyName, (Collection) childValue, childArray); - } else if (childValue instanceof JsonNode) { - targetArray.add((JsonNode) childValue); - } else if (childValue instanceof JsonSerializable) { - // JsonSerializable - JsonSerializable castedValue = (JsonSerializable) childValue; - castedValue.populatePropertyBag(); - targetArray.add(castedValue.propertyBag != null ? castedValue.propertyBag : this.getMapper().createObjectNode()); - } else { - // POJO, JSONObject, Number (includes Int, Float, Double etc), - // Boolean, and String. - targetArray.add(this.getMapper().valueToTree(childValue)); - } - } - } - - /** - * Gets a property value as Object. - * - * @param propertyName the property to get. - * @return the value of the property. - */ - public Object get(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return getValue(this.propertyBag.get(propertyName)); - } else { - return null; - } - } - - /** - * Gets a string value. - * - * @param propertyName the property to get. - * @return the string value. - */ - public String getString(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return this.propertyBag.get(propertyName).asText(); - } else { - return null; - } - } - - /** - * Gets a boolean value. - * - * @param propertyName the property to get. - * @return the boolean value. - */ - public Boolean getBoolean(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return this.propertyBag.get(propertyName).asBoolean(); - } else { - return null; - } - } - - /** - * Gets an integer value. - * - * @param propertyName the property to get. - * @return the boolean value - */ - public Integer getInt(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return Integer.valueOf(this.propertyBag.get(propertyName).asInt()); - } else { - return null; - } - } - - /** - * Gets a long value. - * - * @param propertyName the property to get. - * @return the long value - */ - public Long getLong(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return Long.valueOf(this.propertyBag.get(propertyName).asLong()); - } else { - return null; - } - } - - /** - * Gets a double value. - * - * @param propertyName the property to get. - * @return the double value. - */ - public Double getDouble(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return new Double(this.propertyBag.get(propertyName).asDouble()); - } else { - return null; - } - } - - /** - * Gets an object value. - * - * @param the type of the object. - * @param propertyName the property to get. - * @param c the class of the object. If c is a POJO class, it must be a member (and not an anonymous or local) - * and a static one. - * @return the object value. - */ - public T getObject(String propertyName, Class c) { - if (this.propertyBag.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - JsonNode jsonObj = propertyBag.get(propertyName); - if (Number.class.isAssignableFrom(c) || String.class.isAssignableFrom(c) - || Boolean.class.isAssignableFrom(c) || Object.class == c) { - // Number, String, Boolean - return c.cast(getValue(jsonObj)); - } else if (Enum.class.isAssignableFrom(c)) { - try { - return c.cast(c.getMethod("valueOf", String.class).invoke(null, String.class.cast(getValue(jsonObj)))); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to create enum.", e); - } - } else if (JsonSerializable.class.isAssignableFrom(c)) { - try { - return c.getConstructor(String.class).newInstance(toJson(jsonObj)); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - } else { - // POJO - JsonSerializable.checkForValidPOJO(c); - try { - return this.getMapper().treeToValue(jsonObj, c); - } catch (IOException e) { - throw new IllegalStateException("Failed to get POJO.", e); - } - } - } - - return null; - } - - /** - * Gets an object List. - * - * @param the type of the objects in the List. - * @param propertyName the property to get - * @param c the class of the object. If c is a POJO class, it must be a member (and not an anonymous or local) - * and a static one. - * @return the object collection. - */ - public List getList(String propertyName, Class c) { - if (this.propertyBag.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - ArrayNode jsonArray = (ArrayNode) this.propertyBag.get(propertyName); - ArrayList result = new ArrayList(); - - boolean isBaseClass = false; - boolean isEnumClass = false; - boolean isJsonSerializable = false; - - // Check once. - if (Number.class.isAssignableFrom(c) || String.class.isAssignableFrom(c) - || Boolean.class.isAssignableFrom(c) || Object.class == c) { - isBaseClass = true; - } else if (Enum.class.isAssignableFrom(c)) { - isEnumClass = true; - } else if (JsonSerializable.class.isAssignableFrom(c)) { - isJsonSerializable = true; - } else { - JsonSerializable.checkForValidPOJO(c); - } - - for (JsonNode n : jsonArray) { - if (isBaseClass) { - // Number, String, Boolean - result.add(c.cast(getValue(n))); - } else if (isEnumClass) { - try { - result.add(c.cast(c.getMethod("valueOf", String.class).invoke(null, - String.class.cast(getValue(n))))); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to create enum.", e); - } - } else if (isJsonSerializable) { - // JsonSerializable - try { - result.add(c.getConstructor(String.class).newInstance(toJson(n))); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - } else { - // POJO - try { - result.add(this.getMapper().treeToValue(n, c)); - } catch (IOException e) { - throw new IllegalStateException("Failed to get POJO.", e); - } - } - } - return result; - } - return null; - } - - /** - * Gets an object collection. - * - * @param the type of the objects in the collection. - * @param propertyName the property to get - * @param c the class of the object. If c is a POJO class, it must be a member (and not an anonymous or local) - * and a static one. - * @return the object collection. - */ - public Collection getCollection(String propertyName, Class c) { - return getList(propertyName, c); - } - - /** - * Gets a JSONObject. - * - * @param propertyName the property to get. - * @return the JSONObject. - */ - public ObjectNode getObject(String propertyName) { - if (this.propertyBag.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - ObjectNode jsonObj = (ObjectNode) this.propertyBag.get(propertyName); - return jsonObj; - } - return null; - } - - /** - * Gets a JSONObject collection. - * - * @param propertyName the property to get. - * @return the JSONObject collection. - */ - public Collection getCollection(String propertyName) { - Collection result = null; - if (this.propertyBag.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - result = new ArrayList(); - - for (JsonNode n : this.propertyBag.findValues(propertyName)) { - result.add((ObjectNode) n); - } - } - - return result; - } - - /** - * Gets the value of a property identified by an array of property names that forms the path. - * - * @param propertyNames that form the path to the property to get. - * @return the value of the property. - */ - public Object getObjectByPath(List propertyNames) { - ObjectNode propBag = this.propertyBag; - JsonNode value = null; - String propertyName = null; - Integer matchedProperties = 0; - Iterator iterator = propertyNames.iterator(); - if (iterator.hasNext()) { - do { - propertyName = iterator.next(); - if (propBag.has(propertyName)) { - matchedProperties++; - value = propBag.get(propertyName); - if (!value.isObject()) { - break; - } - propBag = (ObjectNode) value; - } else { - break; - } - } while (iterator.hasNext()); - - if (value != null && matchedProperties == propertyNames.size()) { - return getValue(value); - } - } - - return null; - } - - static Object getValue(JsonNode value) { - if (value.isValueNode()) { - switch (value.getNodeType()) { - case BOOLEAN: - return value.asBoolean(); - case NUMBER: - if (value.isInt()) { - return value.asInt(); - } else if (value.isLong()) { - return value.asLong(); - } else if (value.isDouble()) { - return value.asDouble(); - } - case STRING : - return value.asText(); - } - } - return value; - } - - private ObjectNode fromJson(String json){ - try { - return (ObjectNode) getMapper().readTree(json); - } catch (IOException e) { - throw new IllegalArgumentException(String.format("Unable to parse JSON %s", json), e); - } - } - - private String toJson(Object object){ - try { - return getMapper().writeValueAsString(object); - } catch (JsonProcessingException e) { - throw new IllegalStateException("Unable to convert JSON to String", e); - } - } - - private String toPrettyJson(Object object){ - try { - return getMapper().writerWithDefaultPrettyPrinter().writeValueAsString(object); - } catch (JsonProcessingException e) { - throw new IllegalStateException("Unable to convert JSON to String", e); - } - } - - /** - * Converts to an Object (only POJOs and JSONObject are supported). - * - * @param the type of the object. - * @param c the class of the object, either a POJO class or JSONObject. If c is a POJO class, it must be a member - * (and not an anonymous or local) and a static one. - * @return the POJO. - */ - public T toObject(Class c) { - if (JsonSerializable.class.isAssignableFrom(c) || String.class.isAssignableFrom(c) - || Number.class.isAssignableFrom(c) || Boolean.class.isAssignableFrom(c)) { - throw new IllegalArgumentException("c can only be a POJO class or JSONObject"); - } - if (ObjectNode.class.isAssignableFrom(c)) { - // JSONObject - if (ObjectNode.class != c) { - throw new IllegalArgumentException("We support JSONObject but not its sub-classes."); - } - return c.cast(this.propertyBag); - } else { - // POJO - JsonSerializable.checkForValidPOJO(c); - try { - return this.getMapper().readValue(this.toJson(), c); - } catch (IOException e) { - throw new IllegalStateException("Failed to get POJO.", e); - } - } - } - - /** - * Converts to a JSON string. - * - * @return the JSON string. - */ - public String toJson() { - return this.toJson(SerializationFormattingPolicy.None); - } - - /** - * Converts to a JSON string. - * - * @param formattingPolicy the formatting policy to be used. - * @return the JSON string. - */ - public String toJson(SerializationFormattingPolicy formattingPolicy) { - this.populatePropertyBag(); - if (SerializationFormattingPolicy.Indented.equals(formattingPolicy) ) { - return toPrettyJson(propertyBag); - } else { - return toJson(propertyBag); - } - } - - /** - * Gets Simple String representation of property bag. - * - * For proper conversion to json and inclusion of the default values - * use {@link #toJson()}. - * - * @return string representation of property bag. - */ - public String toString() { - return toJson(propertyBag); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaOptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaOptions.java deleted file mode 100644 index 43d38ee187d2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaOptions.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Options used with attachment content (aka media) creation in the Azure Cosmos DB database service. - */ -public final class MediaOptions { - private String slug; - private String contentType; - - /** - * Gets the HTTP Slug header value. - * - * @return the slug. - */ - public String getSlug() { - return this.slug; - } - - /** - * Sets the HTTP Slug header value. - * - * @param slug the slug. - */ - public void setSlug(String slug) { - this.slug = slug; - } - - /** - * Gets the HTTP ContentType header value. - * - * @return the content type. - */ - public String getContentType() { - return this.contentType; - } - - /** - * Sets the HTTP ContentType header value. - * - * @param contentType the content type. - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaReadMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaReadMode.java deleted file mode 100644 index 00b318ea7f58..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaReadMode.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents the mode for use with downloading attachment content (aka media) from the Azure Cosmos DB database service. - */ -public enum MediaReadMode { - - /** - * Content is buffered at the client and not directly streamed from the - * content store. Use Buffered to reduce the time taken to read and write - * media files. - */ - Buffered, - - /** - * Content is directly streamed from the content store without any buffering - * at the client. Use Streamed to reduce the client memory overhead of - * reading and writing media files. - */ - Streamed -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaResponse.java deleted file mode 100644 index cc4e1dcf3075..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.io.BufferedInputStream; -import java.io.InputStream; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; - -/** - * Response associated with retrieving attachment content in the Azure Cosmos DB database service. - */ -public final class MediaResponse { - private InputStream media = null; - private Map responseHeaders = null; - - MediaResponse(RxDocumentServiceResponse response, boolean willBuffer) { - this.media = response.getContentStream(); - if (willBuffer) { - this.media = new BufferedInputStream(this.media); - } - - this.responseHeaders = response.getResponseHeaders(); - } - - /** - * Gets the attachment content stream. - * - * @return the attachment content stream. - */ - public InputStream getMedia() { - return this.media; - } - - /** - * Gets the headers associated with the response. - * - * @return the response headers. - */ - public Map getResponseHeaders() { - return this.responseHeaders; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Offer.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Offer.java deleted file mode 100644 index 0e450510340e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Offer.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.databind.node.ObjectNode; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.Utils; - -/** - * Represents an offer in the Azure Cosmos DB database service. - */ -public class Offer extends Resource { - - /** - * Initialize an new instance of the Offer object. - * - * @param offerThroughput the throughput value for this offer. - */ - public Offer(int offerThroughput) { - super(); - this.setOfferVersion(Constants.Properties.OFFER_VERSION_V2); - this.setOfferType(""); - ObjectNode content = Utils.getSimpleObjectMapper().createObjectNode(); - content.put(Constants.Properties.OFFER_THROUGHPUT, offerThroughput); - this.setContent(content); - } - - /** - * Initialize an offer object from json string. - * - * @param jsonString the json string that represents the offer. - */ - public Offer(String jsonString) { - super(jsonString); - } - - /** - * Gets the self-link of a resource to which the resource offer applies. - * - * @return the resource link. - */ - public String getResourceLink() { - return super.getString(Constants.Properties.RESOURCE_LINK); - } - - /** - * Sets the self-link of a resource to which the resource offer applies. - * - * @param resourceLink the resource link. - */ - void setResourceLink(String resourceLink) { - super.set(Constants.Properties.RESOURCE_LINK, resourceLink); - } - - /** - * Sets the target resource id of a resource to which this offer applies. - * - * @return the resource id. - */ - public String getOfferResourceId() { - return super.getString(Constants.Properties.OFFER_RESOURCE_ID); - } - - /** - * Sets the target resource id of a resource to which this offer applies. - * - * @param resourceId the resource id. - */ - void setOfferResourceId(String resourceId) { - super.set(Constants.Properties.OFFER_RESOURCE_ID, resourceId); - } - - /** - * Gets the OfferType for the resource offer. - * - * @return the offer type. - */ - public String getOfferType() { - return super.getString(Constants.Properties.OFFER_TYPE); - } - - /** - * Sets the OfferType for the resource offer. - * - * @param offerType the offer type. - */ - public void setOfferType(String offerType) { - super.set(Constants.Properties.OFFER_TYPE, offerType); - } - - /** - * Gets the version of the current offer. - * - * @return the offer version. - */ - public String getOfferVersion() { - return super.getString(Constants.Properties.OFFER_VERSION); - } - - /** - * Sets the offer version. - * - * @param offerVersion the version of the offer. - */ - public void setOfferVersion(String offerVersion) { - super.set(Constants.Properties.OFFER_VERSION, offerVersion); - } - - /** - * Gets the offer throughput for this offer. - * - * @return the offer throughput. - */ - public int getThroughput() { - return this.getContent().get(Constants.Properties.OFFER_THROUGHPUT).asInt(); - } - - /** - * Sets the offer throughput for this offer. - * - * @param throughput the throughput of this offer. - */ - public void setThroughput(int throughput) { - this.getContent().put(Constants.Properties.OFFER_THROUGHPUT, throughput); - } - - private ObjectNode getContent() { - return super.getObject(Constants.Properties.OFFER_CONTENT); - } - - private void setContent(ObjectNode offerContent) { - super.set(Constants.Properties.OFFER_CONTENT, offerContent); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKey.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKey.java deleted file mode 100644 index 8defae8237b4..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKey.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -/** - * Represents a partition key value in the Azure Cosmos DB database service. A partition key identifies the partition - * where the document is stored in. - */ -public class PartitionKey { - - private PartitionKeyInternal internalPartitionKey; - - PartitionKey(PartitionKeyInternal partitionKeyInternal) { - this.internalPartitionKey = partitionKeyInternal; - } - - /** - * Constructor. Create a new instance of the PartitionKey object. - * - * @param key the value of the partition key. - */ - @SuppressWarnings("serial") - public PartitionKey(final Object key) { - this.internalPartitionKey = PartitionKeyInternal.fromObjectArray(new Object[] {key}, true); - } - - /** - * Create a new instance of the PartitionKey object from a serialized JSON partition key. - * - * @param jsonString the JSON string representation of this PartitionKey object. - * @return the PartitionKey instance. - */ - public static PartitionKey FromJsonString(String jsonString) { - return new PartitionKey(PartitionKeyInternal.fromJsonString(jsonString)); - } - - /** - * Serialize the PartitionKey object to a JSON string. - * - * @return the string representation of this PartitionKey object. - */ - public String toString() { - return this.internalPartitionKey.toJson(); - } - - public PartitionKeyInternal getInternalPartitionKey() { - return internalPartitionKey; - } - - /** - * Overrides the Equal operator for object comparisons between two instances of {@link PartitionKey} - * @param other The object to compare with. - * @return True if two object instance are considered equal. - */ - @Override - public boolean equals(Object other) { - if (other == null) { - return false; - } - - if (this == other) { - return true; - } - - PartitionKey otherKey = Utils.as(other, PartitionKey.class); - return otherKey != null && this.internalPartitionKey.equals(otherKey.internalPartitionKey); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinition.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinition.java deleted file mode 100644 index e9f71e9928b0..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinition.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.text.WordUtils; - -/** - * Represents a partition key definition in the Azure Cosmos DB database service. A partition key definition specifies which - * document property is used as the partition key in a collection that has multiple partitions. - */ -public final class PartitionKeyDefinition extends JsonSerializable { - private List paths; - private PartitionKind kind; - private PartitionKeyDefinitionVersion version; - - /** - * Constructor. Creates a new instance of the PartitionKeyDefinition object. - */ - public PartitionKeyDefinition() { - this.setKind(PartitionKind.Hash); - } - - /** - * Constructor. Creates a new instance of the PartitionKeyDefinition object from a - * JSON string. - * - * @param jsonString the JSON string that represents the partition key definition. - */ - public PartitionKeyDefinition(String jsonString) { - super(jsonString); - } - - /** - * Sets the partition algorithm used to calculate the partition id given a partition key. - * - * @return the partition algorithm. - */ - public PartitionKind getKind() { - if (this.kind == null) { - this.kind = super.getObject(Constants.Properties.PARTITION_KIND, PartitionKind.class); - } - - return this.kind; - } - - /** - * Sets the partition algorithm used to calculate the partition id given a partition key. - * - * @param kind the partition algorithm. - */ - public void setKind(PartitionKind kind) { - this.kind = kind; - } - - public PartitionKeyDefinitionVersion getVersion() { - if (this.version == null) { - Object versionObject = super.getObject(Constants.Properties.PARTITION_KEY_DEFINITION_VERSION, Object.class); - if (versionObject == null) { - this.version = null; - } else { - String versionStr = String.valueOf(versionObject); - if (StringUtils.isNumeric(versionStr)) { - this.version = PartitionKeyDefinitionVersion.valueOf(String.format("V%d", Integer.parseInt(versionStr))); - } else { - this.version = !Strings.isNullOrEmpty(versionStr) - ? PartitionKeyDefinitionVersion.valueOf(WordUtils.capitalize(versionStr)) - : null; - } - } - } - - return this.version; - } - - public void setVersion(PartitionKeyDefinitionVersion version) { - this.version = version; - } - - /** - * Gets the document property paths for the partition key. - * - * @return the paths to the document properties that form the partition key. - */ - public List getPaths() { - if (this.paths == null) { - if (super.has(Constants.Properties.PARTITION_KEY_PATHS)) { - paths = super.getList(Constants.Properties.PARTITION_KEY_PATHS, String.class); - } else { - paths = new ArrayList<>(); - } - } - - return paths; - } - - /** - * Sets the document property paths for the partition key. - * - * @param paths the paths to document properties that form the partition key. - */ - public void setPaths(List paths) { - if (paths == null || paths.size() == 0) { - throw new IllegalArgumentException("paths must not be null or empty."); - } - - this.paths = paths; - } - - @Override - void populatePropertyBag() { - if (this.kind != null) { - super.set(Constants.Properties.PARTITION_KIND, kind.name()); - } - if (this.paths != null) { - super.set(Constants.Properties.PARTITION_KEY_PATHS, paths); - } - - if (this.version != null) { - super.set(Constants.Properties.PARTITION_KEY_DEFINITION_VERSION, version.name()); - } - super.populatePropertyBag(); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinitionVersion.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinitionVersion.java deleted file mode 100644 index 096f2dc054f9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinitionVersion.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Partitioning version. - */ -public enum PartitionKeyDefinitionVersion { - - /** - * Original version of hash partitioning. - */ - V1(1), - - /** - * Enhanced version of hash partitioning - offers better distribution of long partition keys and uses less storage. - * - * This version should be used for any practical purpose, but it is available in newer SDKs only. - */ - V2(2); - - int val; - - private PartitionKeyDefinitionVersion(int val) { - this.val = val; - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyRange.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyRange.java deleted file mode 100644 index f74e3146a8bf..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyRange.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.List; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.routing.Range; - -/** - * Represent a partition key range in the Azure Cosmos DB database service. - */ -public class PartitionKeyRange extends Resource { - public static final String MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY = ""; - public static final String MAXIMUM_EXCLUSIVE_EFFECTIVE_PARTITION_KEY = "FF"; - public static final String MASTER_PARTITION_KEY_RANGE_ID = "M"; - - /** - * Initialize a partition key range object. - */ - public PartitionKeyRange() { - super(); - } - - /** - * Initialize a partition key range object from json string. - * - * @param jsonString - * the json string that represents the partition key range - * object. - */ - public PartitionKeyRange(String jsonString) { - super(jsonString); - } - - public PartitionKeyRange(String id, String minInclusive, String maxExclusive) { - super(); - this.setId(id); - this.setMinInclusive(minInclusive); - this.setMaxExclusive(maxExclusive); - } - - public PartitionKeyRange(String id, String minInclusive, String maxExclusive, List parents) { - super(); - this.setId(id); - this.setMinInclusive(minInclusive); - this.setMaxExclusive(maxExclusive); - this.setParents(parents); - } - - public String getMinInclusive() { - return super.getString("minInclusive"); - } - - public void setMinInclusive(String minInclusive) { - super.set("minInclusive", minInclusive); - } - - public String getMaxExclusive() { - return super.getString("maxExclusive"); - } - - public void setMaxExclusive(String maxExclusive) { - super.set("maxExclusive", maxExclusive); - } - - public Range toRange() { - return new Range(this.getMinInclusive(), this.getMaxExclusive(), true, false); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof PartitionKeyRange)) { - return false; - } - - PartitionKeyRange otherRange = (PartitionKeyRange) obj; - - return this.getId().compareTo(otherRange.getId()) == 0 - && this.getMinInclusive().compareTo(otherRange.getMinInclusive()) == 0 - && this.getMaxExclusive().compareTo(otherRange.getMaxExclusive()) == 0; - } - - @Override - public int hashCode() { - int hash = 0; - hash = (hash * 397) ^ this.getId().hashCode(); - hash = (hash * 397) ^ this.getMinInclusive().hashCode(); - hash = (hash * 397) ^ this.getMaxExclusive().hashCode(); - return hash; - } - - void setParents(List parents) { - this.set(Constants.Properties.PARENTS, parents); - } - - /** - * Used internally to indicate the ID of the parent range - * @return a list partition key range ID - */ - public List getParents() { return this.getList(Constants.Properties.PARENTS, String.class); } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKind.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKind.java deleted file mode 100644 index 4c5c94c35cd2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKind.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies the partition scheme for an multiple-partitioned collection in the Azure Cosmos DB database service. - */ -public enum PartitionKind { - /** - * The Partition of a document is calculated based on the hash value of the PartitionKey. - */ - Hash -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Permission.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Permission.java deleted file mode 100644 index a72b653582ec..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Permission.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.databind.node.ArrayNode; -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a per-User Permission to access a specific resource e.g. Document or Collection in the Azure Cosmos DB database service. - */ -public class Permission extends Resource { - /** - * Initialize a permission object. - */ - public Permission() { - super(); - } - - /** - * Initialize a permission object from json string. - * - * @param jsonString the json string that represents the permission. - */ - public Permission(String jsonString) { - super(jsonString); - } - - /** - * Gets the self-link of resource to which the permission applies. - * - * @return the resource link. - */ - public String getResourceLink() { - return super.getString(Constants.Properties.RESOURCE_LINK); - } - - /** - * Sets the self-link of resource to which the permission applies. - * - * @param resourceLink the resource link. - */ - public void setResourceLink(String resourceLink) { - super.set(Constants.Properties.RESOURCE_LINK, resourceLink); - } - - /** - * Gets the permission mode. - * - * @return the permission mode. - */ - public PermissionMode getPermissionMode() { - String value = super.getString(Constants.Properties.PERMISSION_MODE); - return PermissionMode.valueOf(WordUtils.capitalize(value)); - } - - /** - * Sets the permission mode. - * - * @param permissionMode the permission mode. - */ - public void setPermissionMode(PermissionMode permissionMode) { - this.set(Constants.Properties.PERMISSION_MODE, - permissionMode.name().toLowerCase()); - } - - /** - * Gets the access token granting the defined permission. - * - * @return the access token. - */ - public String getToken() { - return super.getString(Constants.Properties.TOKEN); - } - - /** - * Gets the resource partition key associated with this permission object. - * - * @return the partition key. - */ - public PartitionKey getResourcePartitionKey() { - PartitionKey key = null; - Object value = super.get(Constants.Properties.RESOURCE_PARTITION_KEY); - if (value != null) { - ArrayNode arrayValue = (ArrayNode) value; - key = new PartitionKey(getValue(arrayValue.get(0))); - } - - return key; - } - - /** - * Sets the resource partition key associated with this permission object. - * - * @param partitionkey the partition key. - */ - public void setResourcePartitionKey(PartitionKey partitionkey) { - super.set(Constants.Properties.RESOURCE_PARTITION_KEY, partitionkey.getInternalPartitionKey().toJson()); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PermissionMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PermissionMode.java deleted file mode 100644 index ef514dcf4573..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PermissionMode.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Enumeration specifying applicability of permission in the Azure Cosmos DB database service. - */ -public enum PermissionMode { - /** - * Permission applicable for read operations only. - */ - Read(0x1), - - /** - * Permission applicable for all operations. - */ - All(0x2); - - private int value; - - PermissionMode(int value) { - this.value = value; - } - - /** - * Gets the numerical value of the permission mode. - * - * @return the numerical value. - */ - public int getValue() { - return value; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetrics.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetrics.java deleted file mode 100644 index c333c6a757a6..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetrics.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.query.metrics.ClientSideMetrics; -import com.microsoft.azure.cosmosdb.internal.query.metrics.FetchExecutionRange; -import com.microsoft.azure.cosmosdb.internal.query.metrics.QueryMetricsTextWriter; -import com.microsoft.azure.cosmosdb.internal.query.metrics.SchedulingTimeSpan; -import org.apache.commons.lang3.tuple.ImmutablePair; - -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; - -/** - * Query metrics in the Azure Cosmos database service. - * This metric represents a moving average for a set of queries whose metrics have been aggregated together. - */ -public final class QueryMetrics { - public static QueryMetrics ZERO = new QueryMetrics( - new ArrayList<>(), /* */ - 0, /* retrievedDocumentCount */ - 0, /* retrievedDocumentSize */ - 0, /* outputDocumentCount */ - 0, /* outputDocumentSize */ - 0, /* indexHitCount */ - Duration.ZERO, - QueryPreparationTimes.ZERO, - Duration.ZERO, - Duration.ZERO, - Duration.ZERO, - RuntimeExecutionTimes.ZERO, - Duration.ZERO, - ClientSideMetrics.ZERO); - private final long retrievedDocumentCount; - private final long retrievedDocumentSize; - private final long outputDocumentCount; - private final long outputDocumentSize; - private final long indexHitDocumentCount; - private final Duration totalQueryExecutionTime; - private final QueryPreparationTimes queryPreparationTimes; - private final Duration indexLookupTime; - private final Duration documentLoadTime; - private final Duration vmExecutionTime; - private final RuntimeExecutionTimes runtimeExecutionTimes; - private final Duration documentWriteTime; - private final ClientSideMetrics clientSideMetrics; - private final List activityIds; - - public QueryMetrics(List activities, long retrievedDocumentCount, long retrievedDocumentSize, long outputDocumentCount, - long outputDocumentSize, long indexHitCount, Duration totalQueryExecutionTime, - QueryPreparationTimes queryPreparationTimes, Duration indexLookupTime, Duration documentLoadTime, - Duration vmExecutionTime, RuntimeExecutionTimes runtimeExecutionTimes, Duration documentWriteTime, - ClientSideMetrics clientSideMetrics) { - this.retrievedDocumentCount = retrievedDocumentCount; - this.retrievedDocumentSize = retrievedDocumentSize; - this.outputDocumentCount = outputDocumentCount; - this.outputDocumentSize = outputDocumentSize; - this.indexHitDocumentCount = indexHitCount; - this.totalQueryExecutionTime = totalQueryExecutionTime; - this.queryPreparationTimes = queryPreparationTimes; - this.indexLookupTime = indexLookupTime; - this.documentLoadTime = documentLoadTime; - this.vmExecutionTime = vmExecutionTime; - this.runtimeExecutionTimes = runtimeExecutionTimes; - this.documentWriteTime = documentWriteTime; - this.clientSideMetrics = clientSideMetrics; - this.activityIds = activities; - } - - /** - * @return the retrievedDocumentCount - */ - public long getRetrievedDocumentCount() { - return retrievedDocumentCount; - } - - /** - * @return the retrievedDocumentSize - */ - public long getRetrievedDocumentSize() { - return retrievedDocumentSize; - } - - /** - * @return the outputDocumentCount - */ - public long getOutputDocumentCount() { - return outputDocumentCount; - } - - /** - * @return the outputDocumentSize - */ - public long getOutputDocumentSize() { - return outputDocumentSize; - } - - /** - * @return the indexHitDocumentCount - */ - public long getIndexHitDocumentCount() { - return indexHitDocumentCount; - } - - /** - * Gets the index hit ratio by query in the Azure Cosmos database service. - * - * @return the IndexHitRatio - */ - public double getIndexHitRatio() { - return this.retrievedDocumentCount == 0 ? 1 : (double) this.indexHitDocumentCount / this.retrievedDocumentCount; - } - - /** - * @return the totalQueryExecutionTime - */ - public Duration getTotalQueryExecutionTime() { - return totalQueryExecutionTime; - } - - /** - * @return the queryPreparationTimes - */ - public QueryPreparationTimes getQueryPreparationTimes() { - return queryPreparationTimes; - } - - /** - * @return the indexLookupTime - */ - public Duration getIndexLookupTime() { - return indexLookupTime; - } - - /** - * @return the documentLoadTime - */ - public Duration getDocumentLoadTime() { - return documentLoadTime; - } - - /** - * @return the vmExecutionTime - */ - public Duration getVMExecutionTime() { - return vmExecutionTime; - } - - /** - * @return the runtimeExecutionTimes - */ - public RuntimeExecutionTimes getRuntimeExecutionTimes() { - return runtimeExecutionTimes; - } - - /** - * @return the documentWriteTime - */ - public Duration getDocumentWriteTime() { - return documentWriteTime; - } - - /** - * @return the clientSideMetrics - */ - ClientSideMetrics getClientSideMetrics() { - return clientSideMetrics; - } - - /** - * @return number of reties in the Azure Cosmos database service. - */ - public long getRetries() { - return this.clientSideMetrics.getRetries(); - } - - public QueryMetrics add(QueryMetrics... queryMetricsArgs) { - ArrayList queryMetricsList = new ArrayList(); - for (QueryMetrics queryMetrics : queryMetricsArgs) { - queryMetricsList.add(queryMetrics); - } - - queryMetricsList.add(this); - - return QueryMetrics.createFromCollection(queryMetricsList); - } - - private String toTextString() { - return toTextString(0); - } - - private String toTextString(int indentLevel) { - StringBuilder stringBuilder = new StringBuilder(); - QueryMetricsTextWriter queryMetricsTextWriter = new QueryMetricsTextWriter(stringBuilder); - queryMetricsTextWriter.writeQueryMetrics(this); - return stringBuilder.toString(); - } - - static QueryMetrics createFromCollection(Collection queryMetricsCollection) { - long retrievedDocumentCount = 0; - long retrievedDocumentSize = 0; - long outputDocumentCount = 0; - long outputDocumentSize = 0; - long indexHitDocumentCount = 0; - Duration totalQueryExecutionTime = Duration.ZERO; - Collection queryPreparationTimesCollection = new ArrayList(); - Duration indexLookupTime = Duration.ZERO; - Duration documentLoadTime = Duration.ZERO; - Duration vmExecutionTime = Duration.ZERO; - Collection runtimeExecutionTimesCollection = new ArrayList(); - Duration documentWriteTime = Duration.ZERO; - Collection clientSideMetricsCollection = new ArrayList(); - List activityIds = new ArrayList<>(); - - for (QueryMetrics queryMetrics : queryMetricsCollection) { - if (queryMetrics == null) { - throw new NullPointerException("queryMetricsList can not have null elements"); - } - activityIds.addAll(queryMetrics.activityIds); - retrievedDocumentCount += queryMetrics.retrievedDocumentCount; - retrievedDocumentSize += queryMetrics.retrievedDocumentSize; - outputDocumentCount += queryMetrics.outputDocumentCount; - outputDocumentSize += queryMetrics.outputDocumentSize; - indexHitDocumentCount += queryMetrics.indexHitDocumentCount; - totalQueryExecutionTime = totalQueryExecutionTime.plus(queryMetrics.totalQueryExecutionTime); - queryPreparationTimesCollection.add(queryMetrics.queryPreparationTimes); - indexLookupTime = indexLookupTime.plus(queryMetrics.indexLookupTime); - documentLoadTime = documentLoadTime.plus(queryMetrics.documentLoadTime); - vmExecutionTime = vmExecutionTime.plus(queryMetrics.vmExecutionTime); - runtimeExecutionTimesCollection.add(queryMetrics.runtimeExecutionTimes); - documentWriteTime = documentWriteTime.plus(queryMetrics.documentWriteTime); - clientSideMetricsCollection.add(queryMetrics.clientSideMetrics); - } - - return new QueryMetrics(activityIds, retrievedDocumentCount, retrievedDocumentSize, outputDocumentCount, - outputDocumentSize, - indexHitDocumentCount, totalQueryExecutionTime, - QueryPreparationTimes.createFromCollection(queryPreparationTimesCollection), indexLookupTime, documentLoadTime, - vmExecutionTime, RuntimeExecutionTimes.createFromCollection(runtimeExecutionTimesCollection), - documentWriteTime, ClientSideMetrics.createFromCollection(clientSideMetricsCollection)); - } - - private static double getOrDefault(HashMap metrics, String key) { - Double doubleReference = metrics.get(key); - return doubleReference == null ? 0 : doubleReference; - } - - static QueryMetrics createFromDelimitedString(String delimitedString) { - HashMap metrics = QueryMetricsUtils.parseDelimitedString(delimitedString); - return QueryMetrics.createFromDelimitedStringAndClientSideMetrics(delimitedString, - new ClientSideMetrics(0, 0, new ArrayList(), - new ArrayList>()), ""); - } - - static QueryMetrics createFromDelimitedStringAndClientSideMetrics(String delimitedString, ClientSideMetrics clientSideMetrics, - String activityId) { - HashMap metrics = QueryMetricsUtils.parseDelimitedString(delimitedString); - double indexHitRatio; - double retrievedDocumentCount; - indexHitRatio = metrics.get(QueryMetricsConstants.IndexHitRatio); - retrievedDocumentCount = metrics.get(QueryMetricsConstants.RetrievedDocumentCount); - long indexHitCount = (long) (indexHitRatio * retrievedDocumentCount); - double outputDocumentCount = metrics.get(QueryMetricsConstants.OutputDocumentCount); - double outputDocumentSize = metrics.get(QueryMetricsConstants.OutputDocumentSize); - double retrievedDocumentSize = metrics.get(QueryMetricsConstants.RetrievedDocumentSize); - Duration totalQueryExecutionTime = QueryMetricsUtils.getDurationFromMetrics(metrics, QueryMetricsConstants.TotalQueryExecutionTimeInMs); - - List activities = new ArrayList<>(); - activities.add(activityId); - - return new QueryMetrics( - activities, - (long) retrievedDocumentCount, - (long) retrievedDocumentSize, - (long) outputDocumentCount, - (long) outputDocumentSize, - indexHitCount, - totalQueryExecutionTime, - QueryPreparationTimes.createFromDelimitedString(delimitedString), - QueryMetricsUtils.getDurationFromMetrics(metrics, QueryMetricsConstants.IndexLookupTimeInMs), - QueryMetricsUtils.getDurationFromMetrics(metrics, QueryMetricsConstants.DocumentLoadTimeInMs), - QueryMetricsUtils.getDurationFromMetrics(metrics, QueryMetricsConstants.VMExecutionTimeInMs), - RuntimeExecutionTimes.createFromDelimitedString(delimitedString), - QueryMetricsUtils.getDurationFromMetrics(metrics, QueryMetricsConstants.DocumentWriteTimeInMs), - clientSideMetrics); - } - - @Override - public String toString() { - return toTextString(0); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsConstants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsConstants.java deleted file mode 100644 index f14d338e1910..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsConstants.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -public final class QueryMetricsConstants { - // QueryMetrics - public static final String RetrievedDocumentCount = "retrievedDocumentCount"; - public static final String RetrievedDocumentSize = "retrievedDocumentSize"; - public static final String OutputDocumentCount = "outputDocumentCount"; - public static final String OutputDocumentSize = "outputDocumentSize"; - public static final String IndexHitRatio = "indexUtilizationRatio"; - public static final String IndexHitDocumentCount = "indexHitDocumentCount"; - public static final String TotalQueryExecutionTimeInMs = "totalExecutionTimeInMs"; - - // QueryPreparationTimes - public static final String QueryCompileTimeInMs = "queryCompileTimeInMs"; - public static final String LogicalPlanBuildTimeInMs = "queryLogicalPlanBuildTimeInMs"; - public static final String PhysicalPlanBuildTimeInMs = "queryPhysicalPlanBuildTimeInMs"; - public static final String QueryOptimizationTimeInMs = "queryOptimizationTimeInMs"; - - // QueryTimes - public static final String IndexLookupTimeInMs = "indexLookupTimeInMs"; - public static final String DocumentLoadTimeInMs = "documentLoadTimeInMs"; - public static final String VMExecutionTimeInMs = "VMExecutionTimeInMs"; - public static final String DocumentWriteTimeInMs = "writeOutputTimeInMs"; - - // RuntimeExecutionTimes - public static final String QueryEngineTimes = "queryEngineTimes"; - public static final String SystemFunctionExecuteTimeInMs = "systemFunctionExecuteTimeInMs"; - public static final String UserDefinedFunctionExecutionTimeInMs = "userFunctionExecuteTimeInMs"; - - // ClientSideMetrics - public static final String Retries = "retries"; - public static final String RequestCharge = "requestCharge"; - - // QueryMetrics Text - public static final String ActivityIds = "Activity Ids"; - public static final String RetrievedDocumentCountText = "Retrieved Document Count"; - public static final String RetrievedDocumentSizeText = "Retrieved Document Size"; - public static final String OutputDocumentCountText = "Output Document Count"; - public static final String OutputDocumentSizeText = "Output Document Size"; - public static final String IndexUtilizationText = "Index Utilization"; - public static final String TotalQueryExecutionTimeText = "Total Query Execution Time"; - - // QueryPreparationTimes Text - public static final String QueryPreparationTimesText = "Query Preparation Times"; - public static final String QueryCompileTimeText = "Query Compilation Time"; - public static final String LogicalPlanBuildTimeText = "Logical Plan Build Time"; - public static final String PhysicalPlanBuildTimeText = "Physical Plan Build Time"; - public static final String QueryOptimizationTimeText = "Query Optimization Time"; - - // QueryTimes Text - public static final String QueryEngineTimesText = "Query Engine Times"; - public static final String IndexLookupTimeText = "Index Lookup Time"; - public static final String DocumentLoadTimeText = "Document Load Time"; - public static final String WriteOutputTimeText = "Document Write Time"; - - // RuntimeExecutionTimes Text - public static final String RuntimeExecutionTimesText = "Runtime Execution Times"; - public static final String TotalExecutionTimeText = "Query Engine Execution Time"; - public static final String SystemFunctionExecuteTimeText = "System Function Execution Time"; - public static final String UserDefinedFunctionExecutionTimeText = "User-defined Function Execution Time"; - - // ClientSideQueryMetrics Text - public static final String ClientSideQueryMetricsText = "Client Side Metrics"; - public static final String RetriesText = "Retry Count"; - public static final String RequestChargeText = "Request Charge"; - public static final String FetchExecutionRangesText = "Partition Execution Timeline"; - public static final String SchedulingMetricsText = "Scheduling Metrics"; -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsUtils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsUtils.java deleted file mode 100644 index 320e68e67346..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsUtils.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.lang3.StringUtils; - -import java.time.Duration; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; - -class QueryMetricsUtils { - static final String Indent = StringUtils.SPACE; - private static final int NANOS_TO_MILLIS = 1000000; - private static final String BytesUnitString = "bytes"; - - static HashMap parseDelimitedString(String delimitedString) { - if (delimitedString == null) { - throw new NullPointerException("delimitedString"); - } - - HashMap metrics = new HashMap<>(); - - final int key = 0; - final int value = 1; - String[] headerAttributes = StringUtils.split(delimitedString, ";"); - - for (String attribute : headerAttributes) { - String[] attributeKeyValue = StringUtils.split(attribute, "="); - - if (attributeKeyValue.length != 2) { - throw new NullPointerException("recieved a malformed delimited String"); - } - - String attributeKey = attributeKeyValue[key]; - double attributeValue = Double.parseDouble(attributeKeyValue[value]); - metrics.put(attributeKey, attributeValue); - } - - return metrics; - } - - static Duration durationFromMetrics(HashMap metrics, String key) { - // Just attempt to get the metrics - Double durationInMilliseconds = metrics.get(key); - if (durationInMilliseconds == null) { - return Duration.ZERO; - } - - long seconds = (long) (durationInMilliseconds / 1e3); - long nanoseconds = (long) ((durationInMilliseconds - (seconds * 1e3)) * 1e6); - - return Duration.ofSeconds(seconds, nanoseconds); - } - - static Duration getDurationFromMetrics(HashMap metrics, String key) { - double timeSpanInMilliseconds; - Duration timeSpanFromMetrics; - timeSpanInMilliseconds = metrics.get(key); - timeSpanFromMetrics = QueryMetricsUtils.doubleMillisecondsToDuration(timeSpanInMilliseconds); - return timeSpanFromMetrics; - } - - private static Duration doubleMillisecondsToDuration(double timeSpanInMilliseconds) { - long timeInNanoSeconds = (long) (timeSpanInMilliseconds * NANOS_TO_MILLIS); - return Duration.ofNanos(timeInNanoSeconds); - } - - private static void appendToStringBuilder(StringBuilder stringBuilder, String property, String value, - String units, int indentLevel) { - final String FormatString = "%-40s : %15s %-12s %s"; - - stringBuilder.append(String.format( - Locale.ROOT, - FormatString, - StringUtils.repeat(Indent, indentLevel) + property, - value, - units, - System.lineSeparator())); - } - - static void appendBytesToStringBuilder(StringBuilder stringBuilder, String property, long bytes, int indentLevel) { - final String BytesFormatString = "%d"; - - QueryMetricsUtils.appendToStringBuilder( - stringBuilder, - property, - String.format(BytesFormatString, bytes), - BytesUnitString, - indentLevel); - } - - static void appendMillisecondsToStringBuilder(StringBuilder stringBuilder, String property, double milliseconds, - int indentLevel) { - final String MillisecondsFormatString = "%f"; - final String MillisecondsUnitString = "milliseconds"; - - QueryMetricsUtils.appendToStringBuilder(stringBuilder, property, String.format(MillisecondsFormatString, - milliseconds), MillisecondsUnitString, indentLevel); - } - - static void appendNanosecondsToStringBuilder(StringBuilder stringBuilder, String property, double nanoSeconds, - int indentLevel) { - final String MillisecondsFormatString = "%.2f"; - final String MillisecondsUnitString = "milliseconds"; - QueryMetricsUtils.appendToStringBuilder(stringBuilder, property, String.format(MillisecondsFormatString, - nanosToMilliSeconds(nanoSeconds)), MillisecondsUnitString, indentLevel); - } - - static double nanosToMilliSeconds(double nanos) { - return nanos / NANOS_TO_MILLIS; - } - - static void appendHeaderToStringBuilder(StringBuilder stringBuilder, String headerTitle, int indentLevel) { - final String FormatString = "%s %s"; - stringBuilder.append(String.format( - Locale.ROOT, - FormatString, - String.join(StringUtils.repeat(Indent, indentLevel)) + headerTitle, - System.lineSeparator())); - } - - static void appendRUToStringBuilder(StringBuilder stringBuilder, String property, double requestCharge, - int indentLevel) { - final String RequestChargeFormatString = "%s"; - final String RequestChargeUnitString = "RUs"; - - QueryMetricsUtils.appendToStringBuilder( - stringBuilder, - property, - String.format(Locale.ROOT, RequestChargeFormatString, requestCharge), - RequestChargeUnitString, - indentLevel); - } - - static void appendActivityIdsToStringBuilder(StringBuilder stringBuilder, String activityIdsLabel, - List activityIds, int indentLevel) { - stringBuilder.append(activityIdsLabel); - stringBuilder.append(System.lineSeparator()); - for (String activityId : activityIds) { - stringBuilder.append(Indent); - stringBuilder.append(activityId); - stringBuilder.append(System.lineSeparator()); - } - } - - static void appendPercentageToStringBuilder(StringBuilder stringBuilder, String property, double percentage, - int indentLevel) { - final String PercentageFormatString = "%.2f"; - final String PercentageUnitString = "%"; - - QueryMetricsUtils.appendToStringBuilder(stringBuilder, property, String.format(PercentageFormatString, - percentage * 100), PercentageUnitString, indentLevel); - } - - static void appendCountToStringBuilder(StringBuilder stringBuilder, String property, long count, int indentLevel) { - final String CountFormatString = "%s"; - final String CountUnitString = ""; - - QueryMetricsUtils.appendToStringBuilder( - stringBuilder, - property, - String.format(CountFormatString, count), - CountUnitString, - indentLevel); - } - - static void appendNewlineToStringBuilder(StringBuilder stringBuilder) { - QueryMetricsUtils.appendHeaderToStringBuilder(stringBuilder, StringUtils.EMPTY, 0); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryPreparationTimes.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryPreparationTimes.java deleted file mode 100644 index 1ab1ae83bf75..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryPreparationTimes.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import java.time.Duration; -import java.util.Collection; -import java.util.HashMap; - -public final class QueryPreparationTimes { - - static final QueryPreparationTimes ZERO = new QueryPreparationTimes(Duration.ZERO, Duration.ZERO, Duration.ZERO, Duration.ZERO); - - private final Duration queryCompilationTime; - private final Duration logicalPlanBuildTime; - private final Duration physicalPlanBuildTime; - private final Duration queryOptimizationTime; - - /** - * @param queryCompilationTime - * @param logicalPlanBuildTime - * @param physicalPlanBuildTime - * @param queryOptimizationTime - */ - QueryPreparationTimes(Duration queryCompilationTime, Duration logicalPlanBuildTime, Duration physicalPlanBuildTime, - Duration queryOptimizationTime) { - super(); - - if (queryCompilationTime == null) { - throw new NullPointerException("queryCompilationTime"); - } - - if (logicalPlanBuildTime == null) { - throw new NullPointerException("logicalPlanBuildTime"); - } - - if (physicalPlanBuildTime == null) { - throw new NullPointerException("physicalPlanBuildTime"); - } - - if (queryOptimizationTime == null) { - throw new NullPointerException("queryOptimizationTime"); - } - - this.queryCompilationTime = queryCompilationTime; - this.logicalPlanBuildTime = logicalPlanBuildTime; - this.physicalPlanBuildTime = physicalPlanBuildTime; - this.queryOptimizationTime = queryOptimizationTime; - } - - /** - * @return the queryCompilationTime - */ - public Duration getQueryCompilationTime() { - return queryCompilationTime; - } - - /** - * @return the logicalPlanBuildTime - */ - public Duration getLogicalPlanBuildTime() { - return logicalPlanBuildTime; - } - - /** - * @return the physicalPlanBuildTime - */ - public Duration getPhysicalPlanBuildTime() { - return physicalPlanBuildTime; - } - - /** - * @return the queryOptimizationTime - */ - public Duration getQueryOptimizationTime() { - return queryOptimizationTime; - } - - static QueryPreparationTimes createFromCollection( - Collection queryPreparationTimesCollection) { - if (queryPreparationTimesCollection == null) { - throw new NullPointerException("queryPreparationTimesCollection"); - } - - Duration queryCompilationTime = Duration.ZERO; - Duration logicalPlanBuildTime = Duration.ZERO; - Duration physicalPlanBuildTime = Duration.ZERO; - Duration queryOptimizationTime = Duration.ZERO; - - for (QueryPreparationTimes queryPreparationTimes : queryPreparationTimesCollection) { - if (queryPreparationTimes == null) { - throw new NullPointerException("queryPreparationTimesList can not have a null element"); - } - - queryCompilationTime = queryCompilationTime.plus(queryPreparationTimes.queryCompilationTime); - logicalPlanBuildTime = logicalPlanBuildTime.plus(queryPreparationTimes.logicalPlanBuildTime); - physicalPlanBuildTime = physicalPlanBuildTime.plus(queryPreparationTimes.physicalPlanBuildTime); - queryOptimizationTime = queryOptimizationTime.plus(queryPreparationTimes.queryOptimizationTime); - } - - return new QueryPreparationTimes( - queryCompilationTime, - logicalPlanBuildTime, - physicalPlanBuildTime, - queryOptimizationTime); - } - - static QueryPreparationTimes createFromDelimitedString(String delimitedString) { - HashMap metrics = QueryMetricsUtils.parseDelimitedString(delimitedString); - - return new QueryPreparationTimes( - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.QueryCompileTimeInMs), - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.LogicalPlanBuildTimeInMs), - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.PhysicalPlanBuildTimeInMs), - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.QueryOptimizationTimeInMs)); - } - - String toDelimitedString() { - String formatString = "%s=%.2f;%s=%.2f;%s=%.2f;%s=%.2f"; - return String.format( - formatString, - QueryMetricsConstants.QueryCompileTimeInMs, - this.queryCompilationTime.toMillis(), - QueryMetricsConstants.LogicalPlanBuildTimeInMs, - this.logicalPlanBuildTime.toMillis(), - QueryMetricsConstants.PhysicalPlanBuildTimeInMs, - this.physicalPlanBuildTime.toMillis(), - QueryMetricsConstants.QueryOptimizationTimeInMs, - this.queryOptimizationTime.toMillis()); - } - - String toTextString(int indentLevel) { - if (indentLevel == Integer.MAX_VALUE) { - throw new NumberFormatException("indentLevel input must be less than Integer.MaxValue"); - } - - StringBuilder stringBuilder = new StringBuilder(); - - QueryMetricsUtils.appendHeaderToStringBuilder(stringBuilder, QueryMetricsConstants.QueryPreparationTimesText, - indentLevel); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, QueryMetricsConstants.QueryCompileTimeText - , this.queryCompilationTime.toNanos(), indentLevel + 1); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.LogicalPlanBuildTimeText, this.logicalPlanBuildTime.toNanos(), - indentLevel + 1); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.PhysicalPlanBuildTimeText, this.physicalPlanBuildTime.toNanos(), - indentLevel + 1); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.QueryOptimizationTimeText, this.queryOptimizationTime.toNanos(), - indentLevel + 1); - return stringBuilder.toString(); - } -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RangeIndex.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RangeIndex.java deleted file mode 100644 index 27ef781fe73a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RangeIndex.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a range index in the Azure Cosmos DB database service. - */ -public final class RangeIndex extends Index { - - /** - * Initializes a new instance of the RangeIndex class with specified DataType. - *

- * Here is an example to instantiate RangeIndex class passing in the DataType: - *

-     * {@code
-     *
-     * RangeIndex rangeIndex = new RangeIndex(DataType.Number);
-     *
-     * }
-     * 
- * - * @param dataType the data type. - */ - public RangeIndex(DataType dataType) { - super(IndexKind.Range); - this.setDataType(dataType); - } - - /** - * Initializes a new instance of the RangeIndex class with specified DataType and precision. - *
-     * {@code
-     *
-     * RangeIndex rangeIndex = new RangeIndex(DataType.Number, -1);
-     *
-     * }
-     * 
- * @param dataType the data type of the RangeIndex - * @param precision the precision of the RangeIndex - */ - public RangeIndex(DataType dataType, int precision) { - super(IndexKind.Range); - this.setDataType(dataType); - this.setPrecision(precision); - } - - /** - * Initializes a new instance of the RangeIndex class with json string. - * - * @param jsonString the json string that represents the index. - */ - public RangeIndex(String jsonString) { - super(jsonString, IndexKind.Range); - if (this.getDataType() == null) { - throw new IllegalArgumentException("The jsonString doesn't contain a valid 'dataType'."); - } - } - - /** - * Gets data type. - * - * @return the data type. - */ - public DataType getDataType() { - DataType result = null; - try { - result = DataType.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.DATA_TYPE))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid index dataType value {}.", super.getString(Constants.Properties.DATA_TYPE)); - } - return result; - } - - /** - * Sets data type. - * - * @param dataType the data type. - */ - public void setDataType(DataType dataType) { - super.set(Constants.Properties.DATA_TYPE, dataType.name()); - } - - /** - * Gets precision. - * - * @return the precision. - */ - public int getPrecision() { - return super.getInt(Constants.Properties.PRECISION); - } - - /** - * Sets precision. - * - * @param precision the precision. - */ - public void setPrecision(int precision) { - super.set(Constants.Properties.PRECISION, precision); - } - - boolean hasPrecision() { - return super.has(Constants.Properties.PRECISION); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ReplicationPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ReplicationPolicy.java deleted file mode 100644 index 727fcd588b63..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ReplicationPolicy.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Encapsulates the replication policy in the Azure Cosmos DB database service. - */ -public class ReplicationPolicy extends JsonSerializable { - private static final int DEFAULT_MAX_REPLICA_SET_SIZE = 4; - private static final int DEFAULT_MIN_REPLICA_SET_SIZE = 3; - - public ReplicationPolicy() { - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the replication policy. - */ - public ReplicationPolicy(String jsonString) { - super(jsonString); - } - - public int getMaxReplicaSetSize() { - Integer maxReplicaSetSize = super.getInt(Constants.Properties.MAX_REPLICA_SET_SIZE); - if (maxReplicaSetSize == null) { - return DEFAULT_MAX_REPLICA_SET_SIZE; - } - - return maxReplicaSetSize; - } - - void setMaxReplicaSetSize(int value) { - Integer maxReplicaSetSize = super.getInt(Constants.Properties.MAX_REPLICA_SET_SIZE); - super.set(Constants.Properties.MAX_REPLICA_SET_SIZE, value); - } - - public int getMinReplicaSetSize() { - Integer minReplicaSetSize = super.getInt(Constants.Properties.MIN_REPLICA_SET_SIZE); - if (minReplicaSetSize == null) { - return DEFAULT_MIN_REPLICA_SET_SIZE; - } - - return minReplicaSetSize; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RequestOptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RequestOptions.java deleted file mode 100644 index 9a9e77a3503e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RequestOptions.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Encapsulates options that can be specified for a request issued to the Azure Cosmos DB database service. - */ -public class RequestOptions { - private Map customOptions; - private List preTriggerInclude; - private List postTriggerInclude; - private AccessCondition accessCondition; - private IndexingDirective indexingDirective; - private ConsistencyLevel consistencyLevel; - private String sessionToken; - private Integer resourceTokenExpirySeconds; - private String offerType; - private Integer offerThroughput; - private PartitionKey partitionkey; - private String partitionKeyRangeId; - private boolean scriptLoggingEnabled; - private boolean populateQuotaInfo; - private Map properties; - - /** - * Gets the triggers to be invoked before the operation. - * - * @return the triggers to be invoked before the operation. - */ - public List getPreTriggerInclude() { - return this.preTriggerInclude; - } - - /** - * Sets the triggers to be invoked before the operation. - * - * @param preTriggerInclude the triggers to be invoked before the operation. - */ - public void setPreTriggerInclude(List preTriggerInclude) { - this.preTriggerInclude = preTriggerInclude; - } - - /** - * Gets the triggers to be invoked after the operation. - * - * @return the triggers to be invoked after the operation. - */ - public List getPostTriggerInclude() { - return this.postTriggerInclude; - } - - /** - * Sets the triggers to be invoked after the operation. - * - * @param postTriggerInclude the triggers to be invoked after the operation. - */ - public void setPostTriggerInclude(List postTriggerInclude) { - this.postTriggerInclude = postTriggerInclude; - } - - /** - * Gets the conditions associated with the request. - * - * @return the access condition. - */ - public AccessCondition getAccessCondition() { - return this.accessCondition; - } - - /** - * Sets the conditions associated with the request. - * - * @param accessCondition the access condition. - */ - public void setAccessCondition(AccessCondition accessCondition) { - this.accessCondition = accessCondition; - } - - /** - * Gets the indexing directive (index, do not index etc). - * - * @return the indexing directive. - */ - public IndexingDirective getIndexingDirective() { - return this.indexingDirective; - } - - /** - * Sets the indexing directive (index, do not index etc). - * - * @param indexingDirective the indexing directive. - */ - public void setIndexingDirective(IndexingDirective indexingDirective) { - this.indexingDirective = indexingDirective; - } - - /** - * Gets the consistency level required for the request. - * - * @return the consistency level. - */ - public ConsistencyLevel getConsistencyLevel() { - return this.consistencyLevel; - } - - /** - * Sets the consistency level required for the request. - * - * @param consistencyLevel the consistency level. - */ - public void setConsistencyLevel(ConsistencyLevel consistencyLevel) { - this.consistencyLevel = consistencyLevel; - } - - /** - * Gets the token for use with session consistency. - * - * @return the session token. - */ - public String getSessionToken() { - return this.sessionToken; - } - - /** - * Sets the token for use with session consistency. - * - * @param sessionToken the session token. - */ - public void setSessionToken(String sessionToken) { - this.sessionToken = sessionToken; - } - - /** - * Gets the expiry time for resource token. Used when creating, updating, reading permission. - * - * @return the resource token expiry seconds. - */ - public Integer getResourceTokenExpirySeconds() { - return this.resourceTokenExpirySeconds; - } - - /** - * Sets the expiry time for resource token. Used when creating, updating, reading permission. - * - * @param resourceTokenExpirySeconds the resource token expiry seconds. - */ - public void setResourceTokenExpirySeconds(Integer resourceTokenExpirySeconds) { - this.resourceTokenExpirySeconds = resourceTokenExpirySeconds; - } - - /** - * Gets the offer type when creating a document collection. - * - * @return the offer type. - */ - public String getOfferType() { - return this.offerType; - } - - /** - * Sets the offer type when creating a document collection. - * - * @param offerType the offer type. - */ - public void setOfferType(String offerType) { - this.offerType = offerType; - } - - /** - * Gets the throughput in the form of Request Units per second when creating a document collection. - * - * @return the throughput value. - */ - public Integer getOfferThroughput() { - return this.offerThroughput; - } - - /** - * Sets the throughput in the form of Request Units per second when creating a document collection. - * - * @param offerThroughput the throughput value. - */ - public void setOfferThroughput(Integer offerThroughput) { - this.offerThroughput = offerThroughput; - } - - /** - * Gets the partition key used to identify the current request's target partition. - * - * @return the partition key value. - */ - public PartitionKey getPartitionKey() { - return this.partitionkey; - } - - /** - * Sets the partition key used to identify the current request's target partition. - * - * @param partitionkey the partition key value. - */ - public void setPartitionKey(PartitionKey partitionkey) { - this.partitionkey = partitionkey; - } - - /** - * Internal usage only: Gets the partition key range id used to identify the current request's target partition. - * - * @return the partition key range id value. - */ - String getPartitionKeyRangeId() { - return this.partitionKeyRangeId; - } - - /** - * Internal usage only: Sets the partition key range id used to identify the current request's target partition. - * - * @param partitionKeyRangeId the partition key range id value. - */ - protected void setPartitionKeyRengeId(String partitionKeyRangeId) { - this.partitionKeyRangeId = partitionKeyRangeId; - } - - /** - * Gets whether Javascript stored procedure logging is enabled for the current request in the Azure Cosmos DB database - * service or not. - * - * @return true if Javascript stored procedure logging is enabled - */ - public boolean isScriptLoggingEnabled() { - return scriptLoggingEnabled; - } - - /** - * Sets whether Javascript stored procedure logging is enabled for the current request in the Azure Cosmos DB database - * service or not. - * - * @param scriptLoggingEnabled true if stored procedure Javascript logging is enabled - */ - public void setScriptLoggingEnabled(boolean scriptLoggingEnabled) { - this.scriptLoggingEnabled = scriptLoggingEnabled; - } - - /** - * Gets the PopulateQuotaInfo setting for document collection read requests in the Azure Cosmos DB database service. - * PopulateQuotaInfo is used to enable/disable getting document collection quota related stats for document - * collection read requests. - * - * @return true if PopulateQuotaInfo is enabled - */ - public boolean isPopulateQuotaInfo() { - return populateQuotaInfo; - } - - /** - * Sets the PopulateQuotaInfo setting for document collection read requests in the Azure Cosmos DB database service. - * PopulateQuotaInfo is used to enable/disable getting document collection quota related stats for document - * collection read requests. - * - * @param populateQuotaInfo a boolean value indicating whether PopulateQuotaInfo is enabled or not - */ - public void setPopulateQuotaInfo(boolean populateQuotaInfo) { - this.populateQuotaInfo = populateQuotaInfo; - } - - /** - * Sets the custom request option value by key - * - * @param name a string representing the custom option's name - * @param value a String representing the custom option's value - */ - public void setHeader(String name, String value) { - if (this.customOptions == null) { - this.customOptions = new HashMap<>(); - } - this.customOptions.put(name, value); - } - - /** - * Gets the custom request options - * - * @return Map of custom request options - */ - public Map getHeaders() { - return this.customOptions; - } - /** - * Gets the properties - * - * @return Map of request options properties - */ - public Map getProperties() { - return properties; - } - - /** - * Sets the properties used to identify the request token. - * - * @param properties the properties. - */ - public void setProperties(Map properties) { - this.properties = properties; - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Resource.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Resource.java deleted file mode 100644 index eb84bf89a0b1..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Resource.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.Date; -import java.util.concurrent.TimeUnit; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents the base resource in the Azure Cosmos DB database service. - */ -public class Resource extends JsonSerializable { - private String altLink; - - /** - * Copy constructor. - * @param resource resource to by copied. - */ - protected Resource(Resource resource) { - this.setId(resource.getId()); - this.setResourceId(resource.getResourceId()); - this.setSelfLink(resource.getSelfLink()); - this.setAltLink(resource.getAltLink()); - this.setTimestamp(resource.getTimestamp()); - this.setETag(resource.getETag()); - } - - /** - * Constructor. - */ - protected Resource() { - super(); - } - - /** - * Constructor. - * - * @param objectNode the {@link ObjectNode} that represent the {@link JsonSerializable} - */ - Resource(ObjectNode objectNode) { - super(objectNode); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the resource. - * @param objectMapper the custom object mapper - */ - protected Resource(String jsonString, ObjectMapper objectMapper) { - super(jsonString, objectMapper); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the resource. - */ - protected Resource(String jsonString) { - super(jsonString); - } - - /** - * Gets the name of the resource. - * - * @return the name of the resource. - */ - public String getId() { - return super.getString(Constants.Properties.ID); - } - - /** - * Sets the name of the resource. - * - * @param id the name of the resource. - */ - public void setId(String id) { - super.set(Constants.Properties.ID, id); - } - - /** - * Gets the ID associated with the resource. - * - * @return the ID associated with the resource. - */ - public String getResourceId() { - return super.getString(Constants.Properties.R_ID); - } - - /** - * Set the ID associated with the resource. - * - * @param resourceId the ID associated with the resource. - */ - public void setResourceId(String resourceId) { - super.set(Constants.Properties.R_ID, resourceId); - } - - /** - * Get the self-link associated with the resource. - * - * @return the self link. - */ - public String getSelfLink() { - return super.getString(Constants.Properties.SELF_LINK); - } - - /** - * Set the self-link associated with the resource. - * - * @param selfLink the self link. - */ - void setSelfLink(String selfLink) { - super.set(Constants.Properties.SELF_LINK, selfLink); - } - - /** - * Get the last modified timestamp associated with the resource. - * - * @return the timestamp. - */ - public Date getTimestamp() { - Double seconds = super.getDouble(Constants.Properties.LAST_MODIFIED); - if (seconds == null) return null; - return new Date(TimeUnit.SECONDS.toMillis(seconds.longValue())); - } - - /** - * Set the last modified timestamp associated with the resource. - * - * @param timestamp the timestamp. - */ - void setTimestamp(Date timestamp) { - double millisec = timestamp.getTime(); - super.set(Constants.Properties.LAST_MODIFIED, TimeUnit.MILLISECONDS.toSeconds((long) millisec)); - } - - /** - * Get the entity tag associated with the resource. - * - * @return the e tag. - */ - public String getETag() { - return super.getString(Constants.Properties.E_TAG); - } - - /** - * Set the self-link associated with the resource. - * - * @param eTag the e tag. - */ - void setETag(String eTag) { - super.set(Constants.Properties.E_TAG, eTag); - } - - /** - * Sets the alt-link associated with the resource from the Azure Cosmos DB service. - * @param altLink - */ - void setAltLink(String altLink) { - this.altLink = altLink; - } - - /** - * Gets the alt-link associated with the resource from the Azure Cosmos DB service. - */ - String getAltLink() { - return this.altLink; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ResourceResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ResourceResponse.java deleted file mode 100644 index d92db7263700..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ResourceResponse.java +++ /dev/null @@ -1,447 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.time.Duration; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; - -/** - * Represents the service response to a request made from DocumentClient in the Azure Cosmos DB database service. - * Contains both the resource and the response headers. - * - * @param the resource type of the resource response. - */ -public final class ResourceResponse { - private Class cls; - private T resource; - private RxDocumentServiceResponse response; - private Map usageHeaders; - private Map quotaHeaders; - - ResourceResponse(RxDocumentServiceResponse response, Class cls) { - this.response = response; - this.usageHeaders = new HashMap(); - this.quotaHeaders = new HashMap(); - this.cls = cls; - this.resource = this.response.getResource(this.cls); - } - - /** - * Max Quota. - * - * @return the database quota. - */ - public long getDatabaseQuota() { - return this.getMaxQuotaHeader(Constants.Quota.DATABASE); - } - - /** - * Current Usage. - * - * @return the current database usage. - */ - public long getDatabaseUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.DATABASE); - } - - /** - * Max Quota. - * - * @return the collection quota. - */ - public long getCollectionQuota() { - return this.getMaxQuotaHeader(Constants.Quota.COLLECTION); - } - - /** - * Current Usage. - * - * @return the current collection usage. - */ - public long getCollectionUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.COLLECTION); - } - - /** - * Max Quota. - * - * @return the user quota. - */ - public long getUserQuota() { - return this.getMaxQuotaHeader(Constants.Quota.USER); - } - - /** - * Current Usage. - * - * @return the current user usage. - */ - public long getUserUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.USER); - } - - /** - * Max Quota. - * - * @return the permission quota. - */ - public long getPermissionQuota() { - return this.getMaxQuotaHeader(Constants.Quota.PERMISSION); - } - - /** - * Current Usage. - * - * @return the current permission usage. - */ - public long getPermissionUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.PERMISSION); - } - - /** - * Max Quota. - * - * @return the collection size quota. - */ - public long getCollectionSizeQuota() { - return this.getMaxQuotaHeader(Constants.Quota.COLLECTION_SIZE); - } - - /** - * Current Usage. - * - * @return the collection size usage. - */ - public long getCollectionSizeUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.COLLECTION_SIZE); - } - - /** - * Max Quota. - * - * @return the document quota. - */ - public long getDocumentQuota() { - return this.getMaxQuotaHeader(Constants.Quota.DOCUMENTS_SIZE); - } - - /** - * Current Usage. - * - * @return the document usage. - */ - public long getDocumentUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.DOCUMENTS_SIZE); - } - - /** - * Max document count quota. - * - * @return the document count quota. - */ - public long getDocumentCountQuota() { - return this.getMaxQuotaHeader(Constants.Quota.DOCUMENTS_COUNT); - } - - /** - * Current document count usage. - * - * @return the document count usage. - */ - public long getDocumentCountUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.DOCUMENTS_COUNT); - } - - /** - * Max Quota. - * - * @return the stored procedures quota. - */ - public long getStoredProceduresQuota() { - return this.getMaxQuotaHeader(Constants.Quota.STORED_PROCEDURE); - } - - /** - * Current Usage. - * - * @return the current stored procedures usage. - */ - public long getStoredProceduresUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.STORED_PROCEDURE); - } - - /** - * Max Quota. - * - * @return the triggers quota. - */ - public long getTriggersQuota() { - return this.getMaxQuotaHeader(Constants.Quota.TRIGGER); - } - - /** - * Current Usage. - * - * @return the current triggers usage. - */ - public long getTriggersUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.TRIGGER); - } - - /** - * Max Quota. - * - * @return the user defined functions quota. - */ - public long getUserDefinedFunctionsQuota() { - return this.getMaxQuotaHeader(Constants.Quota.USER_DEFINED_FUNCTION); - } - - /** - * Current Usage. - * - * @return the current user defined functions usage. - */ - public long getUserDefinedFunctionsUsage() { - return this.getCurrentQuotaHeader( - Constants.Quota.USER_DEFINED_FUNCTION); - } - - /** - * Gets the Activity ID for the request. - * - * @return the activity id. - */ - public String getActivityId() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.ACTIVITY_ID); - } - - /** - * Gets the token used for managing client's consistency requirements. - * - * @return the session token. - */ - public String getSessionToken() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - - /** - * Gets the HTTP status code associated with the response. - * - * @return the status code. - */ - public int getStatusCode() { - return this.response.getStatusCode(); - } - - /** - * Gets the maximum size limit for this entity (in megabytes (MB) for server resources and in count for master - * resources). - * - * @return the max resource quota. - */ - public String getMaxResourceQuota() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.MAX_RESOURCE_QUOTA); - } - - /** - * Gets the current size of this entity (in megabytes (MB) for server resources and in count for master resources) - * - * @return the current resource quota usage. - */ - public String getCurrentResourceQuotaUsage() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.CURRENT_RESOURCE_QUOTA_USAGE); - } - - /** - * Gets the resource for the request. - * - * @return the resource. - */ - public T getResource() { - return this.resource; - } - - /** - * Gets the number of index paths (terms) generated by the operation. - * - * @return the request charge. - */ - public double getRequestCharge() { - String value = this.getResponseHeaders().get(HttpConstants.HttpHeaders.REQUEST_CHARGE); - if (StringUtils.isEmpty(value)) { - return 0; - } - return Double.valueOf(value); - } - - /** - * Gets the headers associated with the response. - * - * @return the response headers. - */ - public Map getResponseHeaders() { - return this.response.getResponseHeaders(); - } - - /** - * Gets the progress of an index transformation, if one is underway. - * - * @return the progress of an index transformation. - */ - public long getIndexTransformationProgress() { - String value = this.getResponseHeaders().get(HttpConstants.HttpHeaders.INDEX_TRANSFORMATION_PROGRESS); - if (StringUtils.isEmpty(value)) { - return -1; - } - return Long.parseLong(value); - } - - /** - * Gets the progress of lazy indexing. - * - * @return the progress of lazy indexing. - */ - public long getLazyIndexingProgress() { - String value = this.getResponseHeaders().get(HttpConstants.HttpHeaders.LAZY_INDEXING_PROGRESS); - if (StringUtils.isEmpty(value)) { - return -1; - } - return Long.parseLong(value); - } - - /** - * Gets the request statistics for the current request to Azure Cosmos DB service. - * - * @return request statistics for the current request to Azure Cosmos DB service. - */ - public ClientSideRequestStatistics getClientSideRequestStatistics() { - return this.response.getClientSideRequestStatistics(); - } - - /** - * Gets the end-to-end request latency for the current request to Azure Cosmos DB service. - * - * @return end-to-end request latency for the current request to Azure Cosmos DB service. - */ - public Duration getRequestLatency() { - ClientSideRequestStatistics clientSideRequestStatistics = this.response.getClientSideRequestStatistics(); - if (clientSideRequestStatistics == null) { - return Duration.ZERO; - } - - return clientSideRequestStatistics.getRequestLatency(); - } - - /** - * Gets the diagnostics information for the current request to Azure Cosmos DB service. - * - * @return diagnostics information for the current request to Azure Cosmos DB service. - */ - public String getRequestDiagnosticsString() { - ClientSideRequestStatistics clientSideRequestStatistics = this.response.getClientSideRequestStatistics(); - if (clientSideRequestStatistics == null) { - return StringUtils.EMPTY; - } - return clientSideRequestStatistics.toString(); - } - - long getCurrentQuotaHeader(String headerName) { - if (this.usageHeaders.size() == 0 && - !StringUtils.isEmpty(this.getMaxResourceQuota()) && - !StringUtils.isEmpty(this.getCurrentResourceQuotaUsage())) { - this.populateQuotaHeader(this.getMaxResourceQuota(), this.getCurrentResourceQuotaUsage()); - } - - if (this.usageHeaders.containsKey(headerName)) { - return this.usageHeaders.get(headerName); - } - - return 0; - } - - long getMaxQuotaHeader(String headerName) { - if (this.quotaHeaders.size() == 0 && - !StringUtils.isEmpty(this.getMaxResourceQuota()) && - !this.getCurrentResourceQuotaUsage().isEmpty()) { - this.populateQuotaHeader(this.getMaxResourceQuota(), this.getCurrentResourceQuotaUsage()); - } - - if (this.quotaHeaders.containsKey(headerName)) { - return this.quotaHeaders.get(headerName); - } - - return 0; - } - - private void populateQuotaHeader(String headerMaxQuota, String headerCurrentUsage) { - String[] headerMaxQuotaWords = headerMaxQuota.split(Constants.Quota.DELIMITER_CHARS, -1); - String[] headerCurrentUsageWords = headerCurrentUsage.split(Constants.Quota.DELIMITER_CHARS, -1); - - assert (headerMaxQuotaWords.length == headerCurrentUsageWords.length); - - for (int i = 0; i < headerMaxQuotaWords.length; ++i) { - if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.DATABASE)) { - this.quotaHeaders.put(Constants.Quota.DATABASE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.DATABASE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.COLLECTION)) { - this.quotaHeaders.put(Constants.Quota.COLLECTION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.COLLECTION, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.USER)) { - this.quotaHeaders.put(Constants.Quota.USER, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.USER, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.PERMISSION)) { - this.quotaHeaders.put(Constants.Quota.PERMISSION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.PERMISSION, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.COLLECTION_SIZE)) { - this.quotaHeaders.put(Constants.Quota.COLLECTION_SIZE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.COLLECTION_SIZE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.DOCUMENTS_SIZE)) { - this.quotaHeaders.put(Constants.Quota.DOCUMENTS_SIZE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.DOCUMENTS_SIZE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.STORED_PROCEDURE)) { - this.quotaHeaders.put(Constants.Quota.STORED_PROCEDURE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.STORED_PROCEDURE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.TRIGGER)) { - this.quotaHeaders.put(Constants.Quota.TRIGGER, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.TRIGGER, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.USER_DEFINED_FUNCTION)) { - this.quotaHeaders.put(Constants.Quota.USER_DEFINED_FUNCTION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.USER_DEFINED_FUNCTION, - Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.DOCUMENTS_COUNT)) { - this.quotaHeaders.put(Constants.Quota.DOCUMENTS_COUNT, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.DOCUMENTS_COUNT, - Long.valueOf(headerCurrentUsageWords[i + 1])); - } - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RetryOptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RetryOptions.java deleted file mode 100644 index 2fb19427228c..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RetryOptions.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Encapsulates retry options in the Azure Cosmos DB database service. - */ -public class RetryOptions { - private int maxRetryAttemptsOnThrottledRequests; - private int maxRetryWaitTimeInSeconds; - - /** - * Creates a new instance of the RetryOptions class and initializes all - * properties to default values. - */ - public RetryOptions() { - this.maxRetryAttemptsOnThrottledRequests = 9; - this.maxRetryWaitTimeInSeconds = 30; - } - - /** - * Gets the maximum number of retries in the case where the request fails - * because the service has applied rate limiting on the client. - * - * @return the maximum number of retries. - */ - public int getMaxRetryAttemptsOnThrottledRequests() { - return this.maxRetryAttemptsOnThrottledRequests; - } - - /** - * Sets the maximum number of retries in the case where the request fails - * because the service has applied rate limiting on the client. - *

- * When a client is sending requests faster than the allowed rate, the - * service will return HttpStatusCode 429 (Too Many Request) to throttle the - * client. The current implementation in the SDK will then wait for the - * amount of time the service tells it to wait and retry after the time has - * elapsed. - *

- * The default value is 9. This means in the case where the request is - * throttled, the same request will be issued for a maximum of 10 times to - * the server before an error is returned to the application. - * - * @param maxRetryAttemptsOnThrottledRequests the max number of retry attempts on failed requests due to a - * throttle error. - */ - public void setMaxRetryAttemptsOnThrottledRequests(int maxRetryAttemptsOnThrottledRequests) { - if (maxRetryAttemptsOnThrottledRequests < 0) { - throw new IllegalArgumentException("maxRetryAttemptsOnThrottledRequests value must be a positive integer."); - } - - this.maxRetryAttemptsOnThrottledRequests = maxRetryAttemptsOnThrottledRequests; - } - - /** - * Gets the maximum retry time in seconds. - * - * @return the maximum retry time in seconds. - */ - public int getMaxRetryWaitTimeInSeconds() { - return this.maxRetryWaitTimeInSeconds; - } - - /** - * Sets the maximum retry time in seconds. - *

- * When a request fails due to a throttle error, the service sends back a - * response that contains a value indicating the client should not retry - * before the time period has elapsed (Retry-After). The MaxRetryWaitTime - * flag allows the application to set a maximum wait time for all retry - * attempts. If the cumulative wait time exceeds the MaxRetryWaitTime, the - * SDK will stop retrying and return the error to the application. - *

- * The default value is 30 seconds. - * - * @param maxRetryWaitTimeInSeconds the maximum number of seconds a request will be retried. - */ - public void setMaxRetryWaitTimeInSeconds(int maxRetryWaitTimeInSeconds) { - if (maxRetryWaitTimeInSeconds < 0 || maxRetryWaitTimeInSeconds > Integer.MAX_VALUE / 1000) { - throw new IllegalArgumentException( - "value must be a positive integer between the range of 0 to " + Integer.MAX_VALUE / 1000); - } - - this.maxRetryWaitTimeInSeconds = maxRetryWaitTimeInSeconds; - } - - @Override - public String toString() { - return "RetryOptions{" + - "maxRetryAttemptsOnThrottledRequests=" + maxRetryAttemptsOnThrottledRequests + - ", maxRetryWaitTimeInSeconds=" + maxRetryWaitTimeInSeconds + - '}'; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RuntimeExecutionTimes.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RuntimeExecutionTimes.java deleted file mode 100644 index 0beb503a80ab..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RuntimeExecutionTimes.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import java.time.Duration; -import java.util.Collection; -import java.util.HashMap; - -/** - * Query runtime execution times in the Azure Cosmos DB service. - */ -public final class RuntimeExecutionTimes { - - static final RuntimeExecutionTimes ZERO = new RuntimeExecutionTimes(Duration.ZERO, Duration.ZERO, Duration.ZERO); - - private final Duration queryEngineExecutionTime; - private final Duration systemFunctionExecutionTime; - private final Duration userDefinedFunctionExecutionTime; - - /** - * @param queryEngineExecutionTime - * @param systemFunctionExecutionTime - * @param userDefinedFunctionExecutionTime - */ - RuntimeExecutionTimes(Duration queryEngineExecutionTime, Duration systemFunctionExecutionTime, - Duration userDefinedFunctionExecutionTime) { - super(); - - if (queryEngineExecutionTime == null) { - throw new NullPointerException("queryEngineExecutionTime"); - } - - if (systemFunctionExecutionTime == null) { - throw new NullPointerException("systemFunctionExecutionTime"); - } - - if (userDefinedFunctionExecutionTime == null) { - throw new NullPointerException("userDefinedFunctionExecutionTime"); - } - - this.queryEngineExecutionTime = queryEngineExecutionTime; - this.systemFunctionExecutionTime = systemFunctionExecutionTime; - this.userDefinedFunctionExecutionTime = userDefinedFunctionExecutionTime; - } - - /** - * @return the queryEngineExecutionTime - */ - public Duration getQueryEngineExecutionTime() { - return queryEngineExecutionTime; - } - - /** - * @return the systemFunctionExecutionTime - */ - public Duration getSystemFunctionExecutionTime() { - return systemFunctionExecutionTime; - } - - /** - * @return the userDefinedFunctionExecutionTime - */ - public Duration getUserDefinedFunctionExecutionTime() { - return userDefinedFunctionExecutionTime; - } - - static RuntimeExecutionTimes createFromCollection( - Collection runtimeExecutionTimesCollection) { - if (runtimeExecutionTimesCollection == null) { - throw new NullPointerException("runtimeExecutionTimesCollection"); - } - - Duration queryEngineExecutionTime = Duration.ZERO; - Duration systemFunctionExecutionTime = Duration.ZERO; - Duration userDefinedFunctionExecutionTime = Duration.ZERO; - - for (RuntimeExecutionTimes runtimeExecutionTime : runtimeExecutionTimesCollection) { - queryEngineExecutionTime = queryEngineExecutionTime.plus(runtimeExecutionTime.queryEngineExecutionTime); - systemFunctionExecutionTime = systemFunctionExecutionTime.plus(runtimeExecutionTime.systemFunctionExecutionTime); - userDefinedFunctionExecutionTime = userDefinedFunctionExecutionTime.plus(runtimeExecutionTime.userDefinedFunctionExecutionTime); - } - - return new RuntimeExecutionTimes( - queryEngineExecutionTime, - systemFunctionExecutionTime, - userDefinedFunctionExecutionTime); - } - - static RuntimeExecutionTimes createFromDelimitedString(String delimitedString) { - HashMap metrics = QueryMetricsUtils.parseDelimitedString(delimitedString); - - Duration vmExecutionTime = QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.VMExecutionTimeInMs); - Duration indexLookupTime = QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.IndexLookupTimeInMs); - Duration documentLoadTime = QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.DocumentLoadTimeInMs); - Duration documentWriteTime = QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.DocumentWriteTimeInMs); - - return new RuntimeExecutionTimes( - vmExecutionTime.minus(indexLookupTime).minus(documentLoadTime).minus(documentWriteTime), - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.SystemFunctionExecuteTimeInMs), - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.UserDefinedFunctionExecutionTimeInMs)); - } - - String toDelimitedString() { - String formatString = "%s=%2f;%s=%2f"; - - // queryEngineExecutionTime is not emitted, since it is calculated as - // vmExecutionTime - indexLookupTime - documentLoadTime - documentWriteTime - return String.format( - formatString, - QueryMetricsConstants.SystemFunctionExecuteTimeInMs, - this.systemFunctionExecutionTime.toMillis(), - QueryMetricsConstants.UserDefinedFunctionExecutionTimeInMs, - this.userDefinedFunctionExecutionTime.toMillis()); - } - - String toTextString(int indentLevel) { - if (indentLevel == Integer.MAX_VALUE) { - throw new NumberFormatException("indentLevel input must be less than Int32.MaxValue"); - } - StringBuilder stringBuilder = new StringBuilder(); - - QueryMetricsUtils.appendHeaderToStringBuilder(stringBuilder, QueryMetricsConstants.RuntimeExecutionTimesText, - indentLevel); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.TotalExecutionTimeText, this.queryEngineExecutionTime.toNanos(), - indentLevel + 1); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.SystemFunctionExecuteTimeText, - this.systemFunctionExecutionTime.toNanos(), indentLevel + 1); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.UserDefinedFunctionExecutionTimeText, - this.userDefinedFunctionExecutionTime.toNanos(), indentLevel + 1); - - return stringBuilder.toString(); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SerializationFormattingPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SerializationFormattingPolicy.java deleted file mode 100644 index bd753f5e394c..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SerializationFormattingPolicy.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * The formatting policy associated with JSON serialization in the Azure Cosmos DB database service. - */ -public enum SerializationFormattingPolicy { - - /** - * No additional formatting required. - */ - None, - - /** - * Indent the fields appropriately. - */ - Indented -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialIndex.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialIndex.java deleted file mode 100644 index a263640bcb3d..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialIndex.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a spatial index in the Azure Cosmos DB database service. - */ -public final class SpatialIndex extends Index { - - /** - * Initializes a new instance of the SpatialIndex class. - *

- * Here is an example to instantiate SpatialIndex class passing in the DataType - *

-     * {@code
-     *
-     * SpatialIndex spatialIndex = new SpatialIndex(DataType.Point);
-     *
-     * }
-     * 
- * - * @param dataType specifies the target data type for the index path specification. - */ - public SpatialIndex(DataType dataType) { - super(IndexKind.Spatial); - this.setDataType(dataType); - } - - /** - * Initializes a new instance of the SpatialIndex class. - * - * @param jsonString the json string that represents the index. - */ - public SpatialIndex(String jsonString) { - super(jsonString, IndexKind.Spatial); - if (this.getDataType() == null) { - throw new IllegalArgumentException("The jsonString doesn't contain a valid 'dataType'."); - } - } - - /** - * Gets data type. - * - * @return the data type. - */ - public DataType getDataType() { - DataType result = null; - try { - result = DataType.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.DATA_TYPE))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid index dataType value {}.", super.getString(Constants.Properties.DATA_TYPE)); - } - return result; - } - - /** - * Sets data type. - * - * @param dataType the data type. - */ - public void setDataType(DataType dataType) { - super.set(Constants.Properties.DATA_TYPE, dataType.name()); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialSpec.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialSpec.java deleted file mode 100644 index 828bd0895699..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialSpec.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Collection; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -public class SpatialSpec extends JsonSerializable { - - private Collection spatialTypes; - - /** - * Constructor. - */ - public SpatialSpec() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the included path. - */ - public SpatialSpec(String jsonString) { - super(jsonString); - } - - - /** - * Gets path. - * - * @return the path. - */ - public String getPath() { - return super.getString(Constants.Properties.PATH); - } - - /** - * Sets path. - * - * @param path the path. - */ - public void setPath(String path) { - super.set(Constants.Properties.PATH, path); - } - - /** - * Gets the collection of spatial types. - * - * @return the collection of spatial types. - */ - public Collection getSpatialTypes() { - if (this.spatialTypes == null) { - this.spatialTypes = super.getCollection(Constants.Properties.TYPES, SpatialType.class); - - if (this.spatialTypes == null) { - this.spatialTypes = new ArrayList(); - } - } - - return this.spatialTypes; - } - - /** - * Sets the collection of spatial types. - * - * @param spatialTypes the collection of spatial types. - */ - public void setSpatialTypes(Collection spatialTypes) { - this.spatialTypes = spatialTypes; - Collection spatialTypeNames = new ArrayList(); - for (SpatialType spatialType : this.spatialTypes) { - spatialTypeNames.add(spatialType.name()); - } - super.set(Constants.Properties.TYPES, spatialTypeNames); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialType.java deleted file mode 100644 index 23ddd664f872..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialType.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Defines the target data type of an index path specification in the Azure Cosmos DB service. - * - */ -public enum SpatialType { - /** - * Represent a point data type. - */ - Point, - - /** - * Represent a line string data type. - */ - LineString, - - /** - * Represent a polygon data type. - */ - Polygon, - - /** - * Represent a multi-polygon data type. - */ - MultiPolygon -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameter.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameter.java deleted file mode 100644 index 6d6018f04e33..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameter.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents a SQL parameter in the SqlQuerySpec used for queries in the Azure Cosmos DB database service. - */ -public final class SqlParameter extends JsonSerializable { - - - /** - * Initializes a new instance of the SqlParameter class. - */ - public SqlParameter() { - super(); - } - - /** - * Initializes a new instance of the SqlParameter class with the name and value of the parameter. - * - * @param name the name of the parameter. - * @param value the value of the parameter. - */ - public SqlParameter(String name, Object value) { - super(); - this.setName(name); - this.setValue(value); - } - - /** - * Gets the name of the parameter. - * - * @return the name of the parameter. - */ - public String getName() { - return super.getString("name"); - } - - /** - * Sets the name of the parameter. - * - * @param name the name of the parameter. - */ - public void setName(String name) { - super.set("name", name); - } - - /** - * Gets the value of the parameter. - * - * @param c the class of the parameter value. - * @param the type of the parameter - * @return the value of the parameter. - */ - public Object getValue(Class c) { - return super.getObject("value", c); - } - - /** - * Sets the value of the parameter. - * - * @param value the value of the parameter. - */ - public void setValue(Object value) { - super.set("value", value); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameterCollection.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameterCollection.java deleted file mode 100644 index 8d7a5bcbe8ac..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameterCollection.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -/** - * Represents a collection of SQL parameters to for a SQL query in the Azure Cosmos DB database service. - */ -public final class SqlParameterCollection implements Collection { - - private List parameters; - - /** - * Initializes a new instance of the SqlParameterCollection class. - */ - public SqlParameterCollection() { - this.parameters = new ArrayList(); - } - - /** - * Initializes a new instance of the SqlParameterCollection class from an array of parameters. - * - * @param parameters the array of parameters. - */ - public SqlParameterCollection(SqlParameter... parameters) { - if (parameters == null) { - throw new IllegalArgumentException("parameters"); - } - - this.parameters = Arrays.asList(parameters); - } - - /** - * Initializes a new instance of the SqlParameterCollection class from a collection of parameters. - * - * @param parameters the collection of parameters. - */ - public SqlParameterCollection(Collection parameters) { - if (parameters == null) { - throw new IllegalArgumentException("parameters"); - } - - this.parameters = new ArrayList(parameters); - } - - @Override - public boolean add(SqlParameter parameter) { - return this.parameters.add(parameter); - } - - @Override - public boolean addAll(Collection parameters) { - return this.parameters.addAll(parameters); - } - - @Override - public void clear() { - this.parameters.clear(); - } - - @Override - public boolean contains(Object parameter) { - return this.parameters.contains(parameter); - } - - @Override - public boolean containsAll(Collection parameters) { - return this.parameters.containsAll(parameters); - } - - @Override - public boolean isEmpty() { - return this.parameters.isEmpty(); - } - - @Override - public Iterator iterator() { - return this.parameters.iterator(); - } - - @Override - public boolean remove(Object parameter) { - return this.parameters.remove(parameter); - } - - @Override - public boolean removeAll(Collection parameters) { - return this.parameters.removeAll(parameters); - } - - @Override - public boolean retainAll(Collection parameters) { - return this.parameters.retainAll(parameters); - } - - @Override - public int size() { - return this.parameters.size(); - } - - @Override - public Object[] toArray() { - return this.parameters.toArray(); - } - - @Override - public T[] toArray(T[] parameters) { - return this.parameters.toArray(parameters); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlQuerySpec.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlQuerySpec.java deleted file mode 100644 index a73f3112c83a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlQuerySpec.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * Represents a SQL query in the Azure Cosmos DB database service. - */ -public final class SqlQuerySpec extends JsonSerializable { - - private SqlParameterCollection parameters; - - /** - * Initializes a new instance of the SqlQuerySpec class. - */ - public SqlQuerySpec() { - super(); - } - - /** - * Initializes a new instance of the SqlQuerySpec class with the text of the - * query. - * - * @param queryText - * the query text. - */ - public SqlQuerySpec(String queryText) { - super(); - this.setQueryText(queryText); - } - - /** - * Initializes a new instance of the SqlQuerySpec class with the text of the - * query and parameters. - * - * @param queryText the query text. - * @param parameters the query parameters. - */ - public SqlQuerySpec(String queryText, SqlParameterCollection parameters) { - super(); - this.setQueryText(queryText); - this.parameters = parameters; - } - - /** - * Gets the text of the query. - * - * @return the query text. - */ - public String getQueryText() { - return super.getString("query"); - } - - /** - * Sets the text of the query. - * - * @param queryText - * the query text. - */ - public void setQueryText(String queryText) { - super.set("query", queryText); - } - - /** - * Gets the collection of query parameters. - * - * @return the query parameters. - */ - public SqlParameterCollection getParameters() { - if (this.parameters == null) { - Collection sqlParameters = super.getCollection("parameters", SqlParameter.class); - if (sqlParameters == null) { - sqlParameters = new ArrayList(); - } - - this.parameters = new SqlParameterCollection(sqlParameters); - } - - return this.parameters; - } - - /** - * Sets the collection of query parameters. - * - * @param parameters - * the query parameters. - */ - public void setParameters(SqlParameterCollection parameters) { - this.parameters = parameters; - } - - @Override - void populatePropertyBag() { - boolean defaultParameters = (this.parameters != null && this.parameters.size() != 0); - - if (defaultParameters) { - super.set("parameters", this.parameters); - } else { - super.remove("parameters"); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedure.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedure.java deleted file mode 100644 index 0972ca2f57a7..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedure.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a stored procedure in the Azure Cosmos DB database service. - *

- * Cosmos DB allows stored procedures to be executed in the storage tier, directly against a document collection. The - * script gets executed under ACID transactions on the primary storage partition of the specified collection. For - * additional details, refer to the server-side JavaScript API documentation. - */ -public class StoredProcedure extends Resource { - - /** - * Constructor. - */ - public StoredProcedure() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the stored procedure. - */ - public StoredProcedure(String jsonString) { - super(jsonString); - } - - /** - * Get the body of the stored procedure. - * - * @return the body of the stored procedure. - */ - public String getBody() { - return super.getString(Constants.Properties.BODY); - } - - /** - * Set the body of the stored procedure. - * - * @param body the body of the stored procedure. - */ - public void setBody(String body) { - super.set(Constants.Properties.BODY, body); - } -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedureResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedureResponse.java deleted file mode 100644 index ea358de0d579..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedureResponse.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; - -/** - * Represents the response returned from a stored procedure in the Azure Cosmos DB database service. - * Wraps the response body and headers. - */ -public final class StoredProcedureResponse { - private final static Logger logger = LoggerFactory.getLogger(StoredProcedureResponse.class); - private final RxDocumentServiceResponse response; - - /** - * Constructs StoredProcedureResponse. - * - * @param response the document service response. - */ - StoredProcedureResponse(RxDocumentServiceResponse response) { - this.response = response; - } - - /** - * Gets the Activity ID of the request. - * - * @return the activity id. - */ - public String getActivityId() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.ACTIVITY_ID); - } - - /** - * Gets the token for use with session consistency requests. - * - * @return the session token. - */ - public String getSessionToken() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - - /** - * Gets the request completion status code. - * - * @return the status code. - */ - public int getStatusCode() { - return this.response.getStatusCode(); - } - - /** - * Gets the maximum size limit for this entity (in megabytes (MB) for server resources and in count for master - * resources). - * - * @return the max resource quota. - */ - public String getMaxResourceQuota() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.MAX_RESOURCE_QUOTA); - } - - /** - * Gets the current size of this entity (in megabytes (MB) for server resources and in count for master resources) - * - * @return the current resource quota usage. - */ - public String getCurrentResourceQuotaUsage() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.CURRENT_RESOURCE_QUOTA_USAGE); - } - - /** - * Gets the number of normalized requests charged. - * - * @return the request charge. - */ - public double getRequestCharge() { - String value = this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.REQUEST_CHARGE); - try { - return Double.valueOf(value); - } catch (NumberFormatException e) { - logger.warn("Invalid x-ms-request-charge value {}.", value); - return 0; - } - } - - /** - * Gets the headers associated with the response. - * - * @return the response headers. - */ - public Map getResponseHeaders() { - return this.response.getResponseHeaders(); - } - - /** - * Gets the response of a stored procedure, serialized into a document. - * - * @return the response as a document. - */ - public Document getResponseAsDocument() { - return this.response.getResource(Document.class); - } - - /** - * Gets the response of a stored procedure, serialized into an attachment. - * - * @return the response as an attachment. - */ - public Attachment getResponseAsAttachment() { - return this.response.getResource(Attachment.class); - } - - /** - * Gets the response of a stored procedure as a string. - * - * @return the response as a string. - */ - public String getResponseAsString() { - return this.response.getReponseBodyAsString(); - } - - /** - * Gets the output from stored procedure console.log() statements. - * - * @return the output string from the stored procedure console.log() statements. - */ - public String getScriptLog() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.SCRIPT_LOG_RESULTS); - } - - /** - * Gets the client side request statics for execution of stored procedure. - * - * @return client side request statistics for execution of stored procedure. - */ - public ClientSideRequestStatistics getClientSideRequestStatistics() { - return this.response.getClientSideRequestStatistics(); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TokenResolver.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TokenResolver.java deleted file mode 100644 index 363626a557ff..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TokenResolver.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.Map; - -/** - * This interface is for client side implementation, which can be used for initializing - * AsyncDocumentClient without passing master key, resource token and permission feed.
- *
- * Each time the SDK create request for CosmosDB, authorization token is generated based on that - * request at client side which enables creation of one AsyncDocumentClient per application shared across various users - * with different resource permissions. - */ -@FunctionalInterface -public interface TokenResolver { - - /** - * This method will consume the request information and based on that it will generate the authorization token. - * @param properties the user properties. - * @param requestVerb Request verb i.e. GET, POST, PUT etc. - * @param resourceIdOrFullName ResourceID or resource full name. - * @param resourceType Resource type i.e. Database, DocumentCollection, Document etc. - * @return The authorization token. - */ - public String getAuthorizationToken(String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties); - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Trigger.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Trigger.java deleted file mode 100644 index 2b71da26710f..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Trigger.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.text.WordUtils; -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a trigger in the Azure Cosmos DB database service. - *

- * Cosmos DB supports pre and post triggers defined in JavaScript to be executed on creates, updates and deletes. For - * additional details, refer to the server-side JavaScript API documentation. - */ -public class Trigger extends Resource { - - /** - * Constructor. - */ - public Trigger() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the trigger. - */ - public Trigger(String jsonString) { - super(jsonString); - } - - /** - * Get the body of the trigger. - * - * @return the body of the trigger. - */ - public String getBody() { - return super.getString(Constants.Properties.BODY); - } - - /** - * Set the body of the trigger. - * - * @param body the body of the trigger. - */ - public void setBody(String body) { - super.set(Constants.Properties.BODY, body); - } - - /** - * Get the type of the trigger. - * - * @return the trigger type. - */ - public TriggerType getTriggerType() { - TriggerType result = TriggerType.Pre; - try { - result = TriggerType.valueOf( - WordUtils.capitalize(super.getString(Constants.Properties.TRIGGER_TYPE))); - } catch (IllegalArgumentException e) { - // ignore the exception and return the default - this.getLogger().warn("Invalid triggerType value {}.", super.getString(Constants.Properties.TRIGGER_TYPE)); - } - return result; - } - - /** - * Set the type of the resource. - * - * @param triggerType the trigger type. - */ - public void setTriggerType(TriggerType triggerType) { - super.set(Constants.Properties.TRIGGER_TYPE, triggerType.name()); - } - - /** - * Get the operation type of the trigger. - * - * @return the trigger operation. - */ - public TriggerOperation getTriggerOperation() { - TriggerOperation result = TriggerOperation.Create; - try { - result = TriggerOperation.valueOf( - WordUtils.capitalize(super.getString(Constants.Properties.TRIGGER_OPERATION))); - } catch (IllegalArgumentException e) { - // ignore the exception and return the default - this.getLogger().warn("Invalid triggerOperation value {}.", super.getString(Constants.Properties.TRIGGER_OPERATION)); - } - return result; - } - - /** - * Set the operation type of the trigger. - * - * @param triggerOperation the trigger operation. - */ - public void setTriggerOperation(TriggerOperation triggerOperation) { - super.set(Constants.Properties.TRIGGER_OPERATION, triggerOperation.name()); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerOperation.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerOperation.java deleted file mode 100644 index 084250371a94..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerOperation.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies the operations on which a trigger should be executed in the Azure Cosmos DB database service. - */ -public enum TriggerOperation { - /** - * All operations. - */ - All(0x0), - - /** - * Create operations only. - */ - Create(0x1), - - /** - * Update operations only. - */ - Update(0x2), - - /** - * Delete operations only. - */ - Delete(0x3), - - /** - * Replace operations only. - */ - Replace(0x4); - - private int value; - - TriggerOperation(int value) { - this.value = value; - } - - /** - * Gets the numerical value of the trigger operation. - * - * @return the numerical value. - */ - public int getValue() { - return value; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerType.java deleted file mode 100644 index 9f46d79cd916..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerType.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * The trigger type in the Azure Cosmos DB database service. - */ -public enum TriggerType { - /** - * Trigger should be executed before the associated operation(s). - */ - Pre(0x0), - - /** - * Trigger should be executed after the associated operation(s). - */ - Post(0x1); - - private int value; - - TriggerType(int value) { - this.value = value; - } - - /** - * Gets the numerical value of the trigger type. - * - * @return the numerical value. - */ - public int getValue() { - return value; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Undefined.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Undefined.java deleted file mode 100644 index ceb3fc06bb04..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Undefined.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents the 'Undefined' partition key in the Azure Cosmos DB database service. - */ -public class Undefined extends JsonSerializable { - - private final static Undefined value = new Undefined(); - - /** - * Constructor. Create a new instance of the Undefined object. - */ - private Undefined() { - } - - /** - * Returns the singleton value of Undefined. - * - * @return the Undefined value - */ - public static Undefined Value() { - return value; - } - - /** - * Returns the string representation of Undfined. - */ - public String toString() { - return "{}"; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKey.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKey.java deleted file mode 100644 index 7a60410c8fbe..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKey.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2016 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Collection; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - * - * 1) For partitioned collections, the value of partition key is implicitly a part of each unique key. - * 2) Uniqueness constraint is also enforced for missing values. - * For instance, if unique key policy defines a unique key with single property path, there could be only one document that has missing value for this property. - * @see UniqueKeyPolicy - */ -public class UniqueKey extends JsonSerializable { - private Collection paths; - - public UniqueKey() { - super(); - } - - public UniqueKey(String jsonString) { - super(jsonString); - } - - /** - * Gets the paths, a set of which must be unique for each document in the Azure Cosmos DB service. - * - * The paths to enforce uniqueness on. Each path is a rooted path of the unique property in the document, - * such as "/name/first". - * - * @return the unique paths. - */ - public Collection getPaths() { - if (this.paths == null) { - this.paths = super.getCollection(Constants.Properties.PATHS, String.class); - - if (this.paths == null) { - this.paths = new ArrayList(); - } - } - - return this.paths; - } - - - /** - * Sets the paths, a set of which must be unique for each document in the Azure Cosmos DB service. - * - * The paths to enforce uniqueness on. Each path is a rooted path of the unique property in the document, - * such as "/name/first". - * - * @param paths the unique paths. - */ - public void setPaths(Collection paths) { - this.paths = paths; - } - - @Override - void populatePropertyBag() { - if (paths != null) { - super.set(Constants.Properties.PATHS, paths); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKeyPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKeyPolicy.java deleted file mode 100644 index 26e5983eaf77..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKeyPolicy.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Collection; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents the unique key policy configuration for specifying uniqueness constraints on documents in the - * collection in the Azure Cosmos DB service. - */ -public class UniqueKeyPolicy extends JsonSerializable { - private Collection uniqueKeys; - - public UniqueKeyPolicy() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the Unique Key policy. - */ - public UniqueKeyPolicy(String jsonString) { - super(jsonString); - } - - /** - * Gets or sets collection of {@link UniqueKey} that guarantee uniqueness of documents in collection - * in the Azure Cosmos DB service. - * - * @return the unique keys. - */ - public Collection getUniqueKeys() { - if (this.uniqueKeys == null) { - this.uniqueKeys = super.getCollection(Constants.Properties.UNIQUE_KEYS, UniqueKey.class); - if (this.uniqueKeys == null) { - this.uniqueKeys = new ArrayList<>(); - } - } - return this.uniqueKeys; - } - - public void setUniqueKeys(Collection uniqueKeys) { - if (uniqueKeys == null) { - throw new IllegalArgumentException("uniqueKeys cannot be null."); - } - this.uniqueKeys = uniqueKeys; - } - - @Override - void populatePropertyBag() { - if (this.uniqueKeys != null) { - for(UniqueKey uniqueKey: uniqueKeys) { - uniqueKey.populatePropertyBag(); - } - super.set(Constants.Properties.UNIQUE_KEYS, uniqueKeys); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/User.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/User.java deleted file mode 100644 index f3a0137051e0..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/User.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a database user in the Azure Cosmos DB database service. - */ -public class User extends Resource { - - /** - * Initialize a user object. - */ - public User() { - super(); - } - - /** - * Initialize a user object from json string. - * - * @param jsonString the json string that represents the database user. - */ - public User(String jsonString) { - super(jsonString); - } - - /** - * Gets the self-link of the permissions associated with the user. - * - * @return the permissions link. - */ - public String getPermissionsLink() { - String selfLink = this.getSelfLink(); - if (selfLink.endsWith("/")) { - return selfLink + super.getString(Constants.Properties.PERMISSIONS_LINK); - } else { - return selfLink + "/" + super.getString(Constants.Properties.PERMISSIONS_LINK); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UserDefinedFunction.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UserDefinedFunction.java deleted file mode 100644 index 7cfb585ead3e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UserDefinedFunction.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a user defined function in the Azure Cosmos DB database service. - *

- * Cosmos DB supports JavaScript UDFs which can be used inside queries, stored procedures and triggers. For additional - * details, refer to the server-side JavaScript API documentation. - */ -public class UserDefinedFunction extends Resource { - - /** - * Constructor. - */ - public UserDefinedFunction() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the user defined function. - */ - public UserDefinedFunction(String jsonString) { - super(jsonString); - } - - /** - * Get the body of the user defined function. - * - * @return the body. - */ - public String getBody() { - return super.getString(Constants.Properties.BODY); - } - - /** - * Set the body of the user defined function. - * - * @param body the body. - */ - public void setBody(String body) { - super.set(Constants.Properties.BODY, body); - } -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Bytes.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Bytes.java deleted file mode 100644 index 9220f79f73a5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Bytes.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - - -public class Bytes { - - public static void reverse(byte[] bytes, int offset, int endIndex) { - for(int i = offset, j = endIndex - 1; i < j; --j, i++) { - byte aux = bytes[i]; - bytes[i] = bytes[j]; - bytes[j] = aux; - } - } - - public static void reverse(byte[] bytes) { - Bytes.reverse(bytes, 0, bytes.length); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Constants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Constants.java deleted file mode 100644 index 6ae4ca51597a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Constants.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Used internally. Constants in the Azure Cosmos DB database service Java SDK. - */ -public final class Constants { - - public static final class Quota { - // Quota Strings - public static final String DATABASE = "databases"; - public static final String COLLECTION = "collections"; - public static final String USER = "users"; - public static final String PERMISSION = "permissions"; - public static final String COLLECTION_SIZE = "collectionSize"; - public static final String DOCUMENTS_SIZE = "documentsSize"; - public static final String STORED_PROCEDURE = "storedProcedures"; - public static final String TRIGGER = "triggers"; - public static final String USER_DEFINED_FUNCTION = "functions"; - public static final String DELIMITER_CHARS = "=|;"; - public static final String DOCUMENTS_COUNT = "documentsCount"; - } - - public static final class Properties { - public static final String ID = "id"; - public static final String R_ID = "_rid"; - public static final String SELF_LINK = "_self"; - public static final String LAST_MODIFIED = "_ts"; - public static final String COUNT = "_count"; - public static final String E_TAG = "_etag"; - public static final String AGGREGATE = "_aggregate"; - - public static final String CONSISTENCY_POLICY = "consistencyPolicy"; - public static final String DEFAULT_CONSISTENCY_LEVEL = "defaultConsistencyLevel"; - public static final String MAX_STALENESS_PREFIX = "maxStalenessPrefix"; - public static final String MAX_STALENESS_INTERVAL_IN_SECONDS = "maxIntervalInSeconds"; - public static final String PARENTS = "parents"; - - public static final String DATABASES_LINK = "_dbs"; - public static final String COLLECTIONS_LINK = "_colls"; - public static final String USERS_LINK = "_users"; - public static final String PERMISSIONS_LINK = "_permissions"; - public static final String ATTACHMENTS_LINK = "_attachments"; - public static final String STORED_PROCEDURES_LINK = "_sprocs"; - public static final String TRIGGERS_LINK = "_triggers"; - public static final String USER_DEFINED_FUNCTIONS_LINK = "_udfs"; - public static final String CONFLICTS_LINK = "_conflicts"; - public static final String DOCUMENTS_LINK = "_docs"; - public static final String RESOURCE_LINK = "resource"; - public static final String MEDIA_LINK = "media"; - - public static final String PERMISSION_MODE = "permissionMode"; - public static final String RESOURCE_KEY = "key"; - public static final String TOKEN = "_token"; - public static final String SQL_API_TYPE = "0x10"; - - // Scripting - public static final String BODY = "body"; - public static final String TRIGGER_TYPE = "triggerType"; - public static final String TRIGGER_OPERATION = "triggerOperation"; - - public static final String MAX_SIZE = "maxSize"; - public static final String CURRENT_USAGE = "currentUsage"; - - public static final String CONTENT = "content"; - - public static final String CONTENT_TYPE = "contentType"; - - // ErrorResource. - public static final String CODE = "code"; - public static final String MESSAGE = "message"; - public static final String ERROR_DETAILS = "errorDetails"; - public static final String ADDITIONAL_ERROR_INFO = "additionalErrorInfo"; - - // PartitionInfo. - public static final String RESOURCE_TYPE = "resourceType"; - public static final String SERVICE_INDEX = "serviceIndex"; - public static final String PARTITION_INDEX = "partitionIndex"; - - public static final String ADDRESS_LINK = "addresses"; - public static final String USER_REPLICATION_POLICY = "userReplicationPolicy"; - public static final String USER_CONSISTENCY_POLICY = "userConsistencyPolicy"; - public static final String SYSTEM_REPLICATION_POLICY = "systemReplicationPolicy"; - public static final String READ_POLICY = "readPolicy"; - public static final String QUERY_ENGINE_CONFIGURATION = "queryEngineConfiguration"; - - //ReplicationPolicy - public static final String REPLICATION_POLICY = "replicationPolicy"; - public static final String ASYNC_REPLICATION = "asyncReplication"; - public static final String MAX_REPLICA_SET_SIZE = "maxReplicasetSize"; - public static final String MIN_REPLICA_SET_SIZE = "minReplicaSetSize"; - - //Indexing Policy. - public static final String INDEXING_POLICY = "indexingPolicy"; - public static final String AUTOMATIC = "automatic"; - public static final String STRING_PRECISION = "StringPrecision"; - public static final String NUMERIC_PRECISION = "NumericPrecision"; - public static final String MAX_PATH_DEPTH = "maxPathDepth"; - public static final String INDEXING_MODE = "indexingMode"; - public static final String INDEX_TYPE = "IndexType"; - public static final String INDEX_KIND = "kind"; - public static final String DATA_TYPE = "dataType"; - public static final String PRECISION = "precision"; - - public static final String PATHS = "paths"; - public static final String PATH = "path"; - public static final String INCLUDED_PATHS = "includedPaths"; - public static final String EXCLUDED_PATHS = "excludedPaths"; - public static final String INDEXES = "indexes"; - public static final String COMPOSITE_INDEXES = "compositeIndexes"; - public static final String ORDER = "order"; - public static final String SPATIAL_INDEXES = "spatialIndexes"; - public static final String TYPES = "types"; - - // Unique index. - public static final String UNIQUE_KEY_POLICY = "uniqueKeyPolicy"; - public static final String UNIQUE_KEYS = "uniqueKeys"; - - // Conflict. - public static final String CONFLICT = "conflict"; - public static final String OPERATION_TYPE = "operationType"; - public static final String SOURCE_RESOURCE_ID = "resourceId"; - - // Offer resource - public static final String OFFER_TYPE = "offerType"; - public static final String OFFER_VERSION = "offerVersion"; - public static final String OFFER_CONTENT = "content"; - public static final String OFFER_THROUGHPUT = "offerThroughput"; - public static final String OFFER_VERSION_V1 = "V1"; - public static final String OFFER_VERSION_V2 = "V2"; - public static final String OFFER_RESOURCE_ID = "offerResourceId"; - - // PartitionKey - public static final String PARTITION_KEY = "partitionKey"; - public static final String PARTITION_KEY_PATHS = "paths"; - public static final String PARTITION_KIND = "kind"; - public static final String PARTITION_KEY_DEFINITION_VERSION = "version"; - - public static final String RESOURCE_PARTITION_KEY = "resourcePartitionKey"; - public static final String PARTITION_KEY_RANGE_ID = "partitionKeyRangeId"; - public static final String MIN_INCLUSIVE_EFFECTIVE_PARTITION_KEY = "minInclusiveEffectivePartitionKey"; - public static final String MAX_EXCLUSIVE_EFFECTIVE_PARTITION_KEY = "maxExclusiveEffectivePartitionKey"; - - // AddressResource - public static final String IS_PRIMARY = "isPrimary"; - public static final String PROTOCOL = "protocol"; - public static final String LOGICAL_URI = "logicalUri"; - public static final String PHYISCAL_URI = "physcialUri"; - - // Time-to-Live - public static final String TTL = "ttl"; - public static final String DEFAULT_TTL = "defaultTtl"; - - // Global DB account properties - public static final String Name = "name"; - public static final String WRITABLE_LOCATIONS = "writableLocations"; - public static final String READABLE_LOCATIONS = "readableLocations"; - public static final String DATABASE_ACCOUNT_ENDPOINT = "databaseAccountEndpoint"; - - //Authorization - public static final String MASTER_TOKEN = "master"; - public static final String RESOURCE_TOKEN = "resource"; - public static final String TOKEN_VERSION = "1.0"; - public static final String AUTH_SCHEMA_TYPE = "type"; - public static final String AUTH_VERSION = "ver"; - public static final String AUTH_SIGNATURE = "sig"; - public static final String READ_PERMISSION_MODE = "read"; - public static final String ALL_PERMISSION_MODE = "all"; - public static final String PATH_SEPARATOR = "/"; - - public static final int DEFAULT_MAX_PAGE_SIZE = 100; - public static final String ENABLE_MULTIPLE_WRITE_LOCATIONS = "enableMultipleWriteLocations"; - - // Conflict resolution policy - public static final String CONFLICT_RESOLUTION_POLICY = "conflictResolutionPolicy"; - public static final String MODE = "mode"; - public static final String CONFLICT_RESOLUTION_PATH = "conflictResolutionPath"; - public static final String CONFLICT_RESOLUTION_PROCEDURE = "conflictResolutionProcedure"; - - //Handler names for RXNetty httpClient - public static final String SSL_HANDLER_NAME = "ssl-handler"; - public static final String SSL_COMPLETION_HANDLER_NAME = "ssl-completion-handler"; - public static final String HTTP_PROXY_HANDLER_NAME = "http-proxy-handler"; - public static final String LOGGING_HANDLER_NAME = "logging-handler"; - } - - public static final class UrlEncodingInfo { - public static final String PLUS_SYMBOL_ESCAPED = "\\+"; - public static final String PLUS_SYMBOL_URI_ENCODING = "%2b"; - public static final String SINGLE_SPACE_URI_ENCODING = "%20"; - public static final String UTF_8 = "UTF-8"; - } - - public static final class PartitionedQueryExecutionInfo { - public static final int VERSION_1 = 1; - } - - public static final class QueryExecutionContext { - public static final String INCREMENTAL_FEED_HEADER_VALUE = "Incremental feed"; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/HttpConstants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/HttpConstants.java deleted file mode 100644 index 0ca46de53635..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/HttpConstants.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Used internally. HTTP constants in the Azure Cosmos DB database service Java SDK. - */ -public class HttpConstants { - public static class HttpMethods { - public static final String GET = "GET"; - public static final String POST = "POST"; - public static final String PUT = "PUT"; - public static final String DELETE = "DELETE"; - public static final String HEAD = "HEAD"; - public static final String OPTIONS = "OPTIONS"; - public static final String PATCH = "PATCH"; - } - - public static class QueryStrings { - public static final String URL = "$resolveFor"; - public static final String FILTER = "$filter"; - public static final String PARTITION_KEY_RANGE_IDS = "$partitionKeyRangeIds"; - } - - public static class HttpHeaders { - public static final String AUTHORIZATION = "authorization"; - public static final String E_TAG = "etag"; - public static final String METHOD_OVERRIDE = "X-HTTP-Method"; - public static final String SLUG = "Slug"; - public static final String CONTENT_TYPE = "Content-Type"; - public static final String LAST_MODIFIED = "Last-Modified"; - public static final String CONTENT_ENCODING = "Content-Encoding"; - public static final String CHARACTER_SET = "CharacterSet"; - public static final String USER_AGENT = "User-Agent"; - public static final String IF_MODIFIED_SINCE = "If-Modified-Since"; - public static final String IF_MATCH = "If-Match"; - public static final String IF_NONE_MATCH = "If-None-Match"; - public static final String CONTENT_LENGTH = "Content-Length"; - public static final String ACCEPT_ENCODING = "Accept-Encoding"; - public static final String KEEP_ALIVE = "Keep-Alive"; - public static final String CONNECTION = "Connection"; - public static final String CACHE_CONTROL = "Cache-Control"; - public static final String TRANSFER_ENCODING = "Transfer-Encoding"; - public static final String CONTENT_LANGUAGE = "Content-Language"; - public static final String CONTENT_LOCATION = "Content-Location"; - public static final String CONTENT_MD5 = "Content-Md5"; - public static final String CONTENT_RANGE = "Content-Range"; - public static final String ACCEPT = "Accept"; - public static final String ACCEPT_CHARSET = "Accept-Charset"; - public static final String ACCEPT_LANGUAGE = "Accept-Language"; - public static final String IF_RANGE = "If-Range"; - public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since"; - public static final String MAX_FORWARDS = "Max-Forwards"; - public static final String PROXY_AUTHORIZATION = "Proxy-Authorization"; - public static final String ACCEPT_RANGES = "Accept-Ranges"; - public static final String PROXY_AUTHENTICATE = "Proxy-Authenticate"; - public static final String RETRY_AFTER = "Retry-After"; - public static final String SET_COOKIE = "Set-Cookie"; - public static final String WWW_AUTHENTICATE = "Www-Authenticate"; - public static final String ORIGIN = "Origin"; - public static final String HOST = "Host"; - public static final String ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; - public static final String ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers"; - public static final String KEY_VALUE_ENCODING_FORMAT = "application/x-www-form-urlencoded"; - public static final String WRAP_ASSERTION_FORMAT = "wrap_assertion_format"; - public static final String WRAP_ASSERTION = "wrap_assertion"; - public static final String WRAP_SCOPE = "wrap_scope"; - public static final String SIMPLE_TOKEN = "SWT"; - public static final String HTTP_DATE = "date"; - public static final String PREFER = "Prefer"; - public static final String LOCATION = "Location"; - public static final String REFERER = "referer"; - - // Query - public static final String QUERY = "x-ms-documentdb-query"; - public static final String IS_QUERY = "x-ms-documentdb-isquery"; - public static final String ENABLE_CROSS_PARTITION_QUERY = "x-ms-documentdb-query-enablecrosspartition"; - public static final String PARALLELIZE_CROSS_PARTITION_QUERY = "x-ms-documentdb-query-parallelizecrosspartitionquery"; - - // Our custom DocDB headers - public static final String CONTINUATION = "x-ms-continuation"; - public static final String PAGE_SIZE = "x-ms-max-item-count"; - public static final String RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB = "x-ms-documentdb-responsecontinuationtokenlimitinkb"; - - // Request sender generated. Simply echoed by backend. - public static final String ACTIVITY_ID = "x-ms-activity-id"; - public static final String PRE_TRIGGER_INCLUDE = "x-ms-documentdb-pre-trigger-include"; - public static final String PRE_TRIGGER_EXCLUDE = "x-ms-documentdb-pre-trigger-exclude"; - public static final String POST_TRIGGER_INCLUDE = "x-ms-documentdb-post-trigger-include"; - public static final String POST_TRIGGER_EXCLUDE = "x-ms-documentdb-post-trigger-exclude"; - public static final String INDEXING_DIRECTIVE = "x-ms-indexing-directive"; - public static final String SESSION_TOKEN = "x-ms-session-token"; - public static final String CONSISTENCY_LEVEL = "x-ms-consistency-level"; - public static final String X_DATE = "x-ms-date"; - public static final String COLLECTION_PARTITION_INFO = "x-ms-collection-partition-info"; - public static final String COLLECTION_SERVICE_INFO = "x-ms-collection-service-info"; - public static final String RETRY_AFTER_IN_MILLISECONDS = "x-ms-retry-after-ms"; - public static final String IS_FEED_UNFILTERED = "x-ms-is-feed-unfiltered"; - public static final String RESOURCE_TOKEN_EXPIRY = "x-ms-documentdb-expiry-seconds"; - public static final String ENABLE_SCAN_IN_QUERY = "x-ms-documentdb-query-enable-scan"; - public static final String EMIT_VERBOSE_TRACES_IN_QUERY = "x-ms-documentdb-query-emit-traces"; - - // target lsn for head requests - public static final String TARGET_LSN = "x-ms-target-lsn"; - public static final String TARGET_GLOBAL_COMMITTED_LSN = "x-ms-target-global-committed-lsn"; - - //Request validation - public static final String REQUEST_VALIDATION_FAILURE = "x-ms-request-validation-failure"; - - public static final String WRITE_REQUEST_TRIGGER_ADDRESS_REFRESH = "x-ms-write-request-trigger-refresh"; - - // Quota Info - public static final String MAX_RESOURCE_QUOTA = "x-ms-resource-quota"; - public static final String CURRENT_RESOURCE_QUOTA_USAGE = "x-ms-resource-usage"; - public static final String MAX_MEDIA_STORAGE_USAGE_IN_MB = "x-ms-max-media-storage-usage-mb"; - - // Usage Info - public static final String REQUEST_CHARGE = "x-ms-request-charge"; - public static final String CURRENT_MEDIA_STORAGE_USAGE_IN_MB = "x-ms-media-storage-usage-mb"; - public static final String DATABASE_ACCOUNT_CONSUMED_DOCUMENT_STORAGE_IN_MB = "x-ms-databaseaccount-consumed-mb"; - public static final String DATABASE_ACCOUNT_RESERVED_DOCUMENT_STORAGE_IN_MB = "x-ms-databaseaccount-reserved-mb"; - public static final String DATABASE_ACCOUNT_PROVISIONED_DOCUMENT_STORAGE_IN_MB = "x-ms-databaseaccount-provisioned-mb"; - - // Address related headers. - public static final String FORCE_REFRESH = "x-ms-force-refresh"; - public static final String ITEM_COUNT = "x-ms-item-count"; - public static final String NEW_RESOURCE_ID = "x-ms-new-resource-id"; - public static final String USE_MASTER_COLLECTION_RESOLVER = "x-ms-use-master-collection-resolver"; - - // Admin Headers - public static final String FULL_UPGRADE = "x-ms-force-full-upgrade"; - public static final String ONLY_UPGRADE_SYSTEM_APPLICATIONS = "x-ms-only-upgrade-system-applications"; - public static final String ONLY_UPGRADE_NON_SYSTEM_APPLICATIONS = "x-ms-only-upgrade-non-system-applications"; - public static final String UPGRADE_FABRIC_RING_CODE_AND_CONFIG = "x-ms-upgrade-fabric-code-config"; - public static final String IGNORE_IN_PROGRESS_UPGRADE = "x-ms-ignore-inprogress-upgrade"; - public static final String UPGRADE_VERIFICATION_KIND = "x-ms-upgrade-verification-kind"; - public static final String IS_CANARY = "x-ms-iscanary"; - public static final String FORCE_DELETE = "x-ms-force-delete"; - - // Version headers and values - public static final String VERSION = "x-ms-version"; - public static final String SCHEMA_VERSION = "x-ms-schemaversion"; - public static final String SERVER_VERSION = "x-ms-serviceversion"; - public static final String GATEWAY_VERSION = "x-ms-gatewayversion"; - - // RDFE Resource Provider headers - public static final String OCP_RESOURCE_PROVIDER_REGISTERED_URI = "ocp-resourceprovider-registered-uri"; - - // For Document service management operations only. This is in - // essence a 'handle' to (long running) operations. - public static final String REQUEST_ID = "x-ms-request-id"; - - // Object returning this determines what constitutes state and what - // last state change means. For replica, it is the last role change. - public static final String LAST_STATE_CHANGE_UTC = "x-ms-last-state-change-utc"; - - // CSM specific headers - // Client-request-id: Optional caller-specified request ID, in the form - // of a GUID - public static final String CLIENT_REQUEST_ID = "x-ms-client-request-id"; - - // Offer header - public static final String OFFER_TYPE = "x-ms-offer-type"; - public static final String OFFER_THROUGHPUT = "x-ms-offer-throughput"; - public static final String OFFER_IS_RU_PER_MINUTE_THROUGHPUT_ENABLED = "x-ms-offer-is-ru-per-minute-throughput-enabled"; - - // Upsert header - public static final String IS_UPSERT = "x-ms-documentdb-is-upsert"; - - // Index progress headers - public static final String INDEX_TRANSFORMATION_PROGRESS = "x-ms-documentdb-collection-index-transformation-progress"; - public static final String LAZY_INDEXING_PROGRESS = "x-ms-documentdb-collection-lazy-indexing-progress"; - - //Owner name - public static final String OWNER_FULL_NAME = "x-ms-alt-content-path"; - - // Owner ID used for name based request in session token. - public static final String OWNER_ID = "x-ms-content-path"; - - // Partition headers - public static final String PARTITION_KEY = "x-ms-documentdb-partitionkey"; - public static final String PARTITION_KEY_RANGE_ID = "x-ms-documentdb-partitionkeyrangeid"; - - // Error response sub status code - public static final String SUB_STATUS = "x-ms-substatus"; - - public static final String LSN = "lsn"; - - // Custom DocDB JavaScript logging headers - public static final String SCRIPT_ENABLE_LOGGING = "x-ms-documentdb-script-enable-logging"; - public static final String SCRIPT_LOG_RESULTS = "x-ms-documentdb-script-log-results"; - - // Collection quota - public static final String POPULATE_QUOTA_INFO = "x-ms-documentdb-populatequotainfo"; - - // ChangeFeed - public static final String A_IM = "A-IM"; - public static final String ALLOW_TENTATIVE_WRITES = "x-ms-cosmos-allow-tentative-writes"; - - // These settings were added to support RNTBD and they've been added here to reduce merge conflicts - - public static final String CAN_CHARGE = "x-ms-cancharge"; - public static final String CAN_OFFER_REPLACE_COMPLETE = "x-ms-can-offer-replace-complete"; - public static final String CAN_THROTTLE = "x-ms-canthrottle"; - public static final String CLIENT_RETRY_ATTEMPT_COUNT = "x-ms-client-retry-attempt-count"; - public static final String COLLECTION_INDEX_TRANSFORMATION_PROGRESS = "x-ms-documentdb-collection-index-transformation-progress"; - public static final String COLLECTION_LAZY_INDEXING_PROGRESS = "x-ms-documentdb-collection-lazy-indexing-progress"; - public static final String COLLECTION_REMOTE_STORAGE_SECURITY_IDENTIFIER = "x-ms-collection-security-identifier"; - public static final String CONTENT_SERIALIZATION_FORMAT = "x-ms-documentdb-content-serialization-format"; - public static final String DISABLE_RNTBD_CHANNEL = "x-ms-disable-rntbd-channel"; - public static final String DISABLE_RU_PER_MINUTE_USAGE = "x-ms-documentdb-disable-ru-per-minute-usage"; - public static final String ENABLE_LOGGING = "x-ms-documentdb-script-enable-logging"; - public static final String ENABLE_LOW_PRECISION_ORDER_BY = "x-ms-documentdb-query-enable-low-precision-order-by"; - public static final String END_EPK = "x-ms-end-epk"; - public static final String END_ID = "x-ms-end-id"; - public static final String ENUMERATION_DIRECTION = "x-ms-enumeration-direction"; - public static final String FILTER_BY_SCHEMA_RESOURCE_ID = "x-ms-documentdb-filterby-schema-rid"; - public static final String FORCE_QUERY_SCAN = "x-ms-documentdb-force-query-scan"; - public static final String GATEWAY_SIGNATURE = "x-ms-gateway-signature"; - public static final String IS_AUTO_SCALE_REQUEST = "x-ms-is-auto-scale"; - public static final String IS_READ_ONLY_SCRIPT = "x-ms-is-readonly-script"; - public static final String LOG_RESULTS = "x-ms-documentdb-script-log-results"; - public static final String MIGRATE_COLLECTION_DIRECTIVE = "x-ms-migratecollection-directive"; - public static final String POPULATE_COLLECTION_THROUGHPUT_INFO = "x-ms-documentdb-populatecollectionthroughputinfo"; - public static final String POPULATE_PARTITION_STATISTICS = "x-ms-documentdb-populatepartitionstatistics"; - public static final String POPULATE_QUERY_METRICS = "x-ms-documentdb-populatequerymetrics"; - public static final String PROFILE_REQUEST = "x-ms-profile-request"; - public static final String READ_FEED_KEY_TYPE = "x-ms-read-key-type"; - public static final String REMAINING_TIME_IN_MS_ON_CLIENT_REQUEST = "x-ms-remaining-time-in-ms-on-client"; - public static final String RESTORE_METADATA_FILTER = "x-ms-restore-metadata-filter"; - public static final String SHARED_OFFER_THROUGHPUT = "x-ms-cosmos-shared-offer-throughput"; - public static final String START_EPK = "x-ms-start-epk"; - public static final String START_ID = "x-ms-start-id"; - public static final String SUPPORT_SPATIAL_LEGACY_COORDINATES = "x-ms-documentdb-supportspatiallegacycoordinates"; - public static final String TRANSPORT_REQUEST_ID = "x-ms-transport-request-id"; - public static final String USE_POLYGONS_SMALLER_THAN_AHEMISPHERE = "x-ms-documentdb-usepolygonssmallerthanahemisphere"; - public static final String API_TYPE = "x-ms-cosmos-apitype"; - public static final String QUERY_METRICS = "x-ms-documentdb-query-metrics"; - - } - - public static class A_IMHeaderValues { - public static final String INCREMENTAL_FEED = "Incremental Feed"; - } - - public static class Versions { - public static final String CURRENT_VERSION = "2018-09-17"; - - // TODO: FIXME we can use maven plugin for generating a version file - // @see https://stackoverflow.com/questions/2469922/generate-a-version-java-file-in-maven - public static final String SDK_VERSION = "2.4.5"; - public static final String SDK_NAME = "cosmosdb-java-sdk"; - } - - public static class StatusCodes { - public static final int NOT_MODIFIED = 304; - // Client error - public static final int MINIMUM_STATUSCODE_AS_ERROR_GATEWAY = 400; - public static final int BADREQUEST = 400; - public static final int UNAUTHORIZED = 401; - public static final int FORBIDDEN = 403; - public static final int NOTFOUND = 404; - public static final int METHOD_NOT_ALLOWED = 405; - public static final int REQUEST_TIMEOUT = 408; - public static final int CONFLICT = 409; - public static final int GONE = 410; - public static final int PRECONDITION_FAILED = 412; - public static final int REQUEST_ENTITY_TOO_LARGE = 413; - public static final int LOCKED = 423; - public static final int TOO_MANY_REQUESTS = 429; - public static final int RETRY_WITH = 449; - - public static final int SERVICE_UNAVAILABLE = 503; - public static final int INTERNAL_SERVER_ERROR = 500; - } - - public static class SubStatusCodes { - // Unknown SubStatus Code - public static final int UNKNOWN = 0; - - // 400: Bad Request substatus - public static final int PARTITION_KEY_MISMATCH = 1001; - public static final int CROSS_PARTITION_QUERY_NOT_SERVABLE = 1004; - - // 410: StatusCodeType_Gone: substatus - public static final int NAME_CACHE_IS_STALE = 1000; - public static final int PARTITION_KEY_RANGE_GONE = 1002; - public static final int COMPLETING_SPLIT = 1007; - public static final int COMPLETING_PARTITION_MIGRATION = 1008; - - // 403: Forbidden substatus - public static final int FORBIDDEN_WRITEFORBIDDEN = 3; - public static final int DATABASE_ACCOUNT_NOTFOUND = 1008; - - // 404: LSN in session token is higher - public static final int READ_SESSION_NOT_AVAILABLE = 1002; - } - - public static class HeaderValues { - public static final String NoCache = "no-cache"; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ISessionToken.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ISessionToken.java deleted file mode 100644 index 08ce7f9c1f7e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ISessionToken.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; - -/** - * Models session token. - * - * We make assumption that instances of this interface are immutable (read only after they are constructed), so if you want to change - * this behaviour please review all of its uses and make sure that mutability doesn't break anything. - */ -public interface ISessionToken { - - String PARTITION_KEY_RANGE_SESSION_SEPARATOR = ":"; - - /** - * Returns true if this instance of session token is valid with respect to other session token. - * This is used to decide if the client can accept server's response (based on comparison between client's - * and server's session token) - * - * @param other Session token to validate - * @return true if this instance of session token is valid with respect to other session token; - * false otherwise - */ - boolean isValid(ISessionToken other) throws DocumentClientException; - - /** - * Returns a new instance of session token obtained by merging this session token with - * the given session token other. - * - * Merge is commutative operation, so a.Merge(b).Equals(b.Merge(a)) - * - * @param other Other session token to merge - * @return Instance of merged session token - */ - ISessionToken merge(ISessionToken other) throws DocumentClientException; - - long getLSN(); - - String convertToString(); -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Integers.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Integers.java deleted file mode 100644 index 3d9c3cb6fdcb..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Integers.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -public class Integers { - public static int tryParse(String value, int defaultValue) { - if (Strings.isNullOrEmpty(value)) { - return defaultValue; - } - - try { - return Integer.valueOf(value); - } catch (NumberFormatException e) { - return defaultValue; - } - } - - public static Integer tryParse(String value) { - if (Strings.isNullOrEmpty(value)) { - return null; - } - - try { - return Integer.valueOf(value); - } catch (NumberFormatException e) { - return null; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/InternalServerErrorException.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/InternalServerErrorException.java deleted file mode 100644 index b6a12f08b3c6..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/InternalServerErrorException.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.net.URL; -import java.util.Map; - -/** - * This exception is thrown when DocumentServiceRequest contains x-ms-documentdb-partitionkeyrangeid - * header and such range id doesn't exist. - *

- * No retries should be made in this case, as either split or merge might have happened and query/readfeed - * must take appropriate actions. - */ -public class InternalServerErrorException extends DocumentClientException { - - public InternalServerErrorException() { - this(RMResources.InternalServerError); - } - - public InternalServerErrorException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public InternalServerErrorException(String message) { - this(message, (Exception) null, (Map) null, (String) null); - } - - - public InternalServerErrorException(String message, Exception innerException) { - this(message, innerException, (HttpResponseHeaders) null, (String) null); - } - - public InternalServerErrorException(Exception innerException) { - this(RMResources.InternalServerError, innerException, (HttpResponseHeaders) null, (String) null); - } - - public InternalServerErrorException(String message, HttpResponseHeaders headers, URI requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri != null ? requestUri.toString() : null); - } - - public InternalServerErrorException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri); - } - - public InternalServerErrorException(String message, HttpResponseHeaders headers, URL requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri != null ? requestUri.toString() : null); - } - - public InternalServerErrorException(String message, Exception innerException, HttpResponseHeaders headers, URI requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri != null ? requestUri.toString() : null); - } - - public InternalServerErrorException(String message, Exception innerException, HttpResponseHeaders headers, String requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri); - } - - public InternalServerErrorException(String message, Exception innerException, Map headers, String requestUri) { - super(message, innerException, headers, HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/JavaStreamUtils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/JavaStreamUtils.java deleted file mode 100644 index bc0c51223603..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/JavaStreamUtils.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import org.apache.commons.lang3.StringUtils; - -import java.util.Collection; -import java.util.Iterator; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class JavaStreamUtils { - - private static String safeToString(T t) { - return t != null ? t.toString() : "null"; - } - - public static String toString(Collection collection, String delimiter) { - return collection.stream() - .map( t -> safeToString(t) ) - .collect(Collectors.joining(delimiter)); - } - - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/LifeCycleUtils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/LifeCycleUtils.java deleted file mode 100644 index a5bc168b5db8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/LifeCycleUtils.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class LifeCycleUtils { - private final static Logger logger = LoggerFactory.getLogger(LifeCycleUtils.class); - public static void closeQuietly(AutoCloseable closeable) { - try { - if (closeable != null) { - logger.debug("closing an instance of {}", closeable.getClass().getCanonicalName()); - closeable.close(); - } - } catch (Exception e) { - logger.warn("attempting to close an instance of {} failed", closeable.getClass().getCanonicalName(), e); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Lists.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Lists.java deleted file mode 100644 index d3007dab8312..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Lists.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.util.List; - -public class Lists { - - public static V firstOrDefault(List list, V defaultValue) { - return list.isEmpty() ? defaultValue : list.get(0); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Longs.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Longs.java deleted file mode 100644 index 5a8c9398385f..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Longs.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -public class Longs { - public static long tryParse(String value, long defaultValue) { - if (Strings.isNullOrEmpty(value)) { - return defaultValue; - } - - try { - return Long.valueOf(value); - } catch (NumberFormatException e) { - return defaultValue; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/MutableVolatile.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/MutableVolatile.java deleted file mode 100644 index 4b4c9b2338e4..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/MutableVolatile.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -public class MutableVolatile { - - public MutableVolatile(T initValue){ - v = initValue; - } - - public MutableVolatile() {} - public volatile T v; -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/OperationType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/OperationType.java deleted file mode 100644 index 05b1a484509d..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/OperationType.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Operation types in the Azure Cosmos DB database service. - */ -public enum OperationType { - AbortPartitionMigration, - AbortSplit, - AddComputeGatewayRequestCharges, - BatchApply, - BatchReportThroughputUtilization, - CompletePartitionMigration, - CompleteSplit, - Crash, - Create, - Delete, - ExecuteJavaScript, - ForceConfigRefresh, - GetSplitPoint, - Head, - HeadFeed, - MigratePartition, - Pause, - PreCreateValidation, - OfferPreGrowValidation, - OfferUpdateOperation, - PreReplaceValidation, - Query, - Read, - ReadFeed, - Recreate, - Recycle, - Replace, - Resume, - SqlQuery, - Stop, - Throttle, - Update, - Upsert; - - public boolean isWriteOperation() { - return this == Create || - this == Delete || - this == Recreate || - this == ExecuteJavaScript || - this == Replace || - this == Upsert || - this == Update; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathInfo.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathInfo.java deleted file mode 100644 index b1884975d5f5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathInfo.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Represents a resource path's information in the Azure Cosmos DB database service. - */ -public final class PathInfo { - public boolean isFeed; - public String resourcePath; - public String resourceIdOrFullName; - public boolean isNameBased; - - public PathInfo(boolean isFeed, String resourcePath, String resourceIdOrFullName, boolean isNameBased) { - this.isFeed = isFeed; - this.resourcePath = resourcePath; - this.resourceIdOrFullName = resourceIdOrFullName; - this.isNameBased = isNameBased; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathParser.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathParser.java deleted file mode 100644 index c1f54819e453..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathParser.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * Provide functionality to parse resource paths in the Azure Cosmos DB database service. - */ -public final class PathParser { - - private static final char segmentSeparator = '/'; - - public static List getPathParts(String path) { - ArrayList tokens = new ArrayList(); - int currentIndex = 0; - - while (currentIndex < path.length()) { - if (path.charAt(currentIndex) != segmentSeparator) { - throw new IllegalArgumentException(String.format("Invalid path, failed at index %d.", currentIndex)); - } - - if (++currentIndex == path.length()) - break; - - if (path.charAt(currentIndex) == '\"' || path.charAt(currentIndex) == '\'') { - char quote = path.charAt(currentIndex); - int newIndex = ++currentIndex; - while (true) { - newIndex = path.indexOf(quote, newIndex); - if (newIndex == -1) { - throw new IllegalArgumentException(String.format("Invalid path, failed at index %d.", currentIndex)); - } - - if (path.charAt(newIndex - 1) != '\\') { - break; - } - - ++newIndex; - } - - String token = path.substring(currentIndex, newIndex); - tokens.add(token); - currentIndex = newIndex + 1; - } else { - int newIndex = path.indexOf(segmentSeparator, currentIndex); - String token = null; - if (newIndex == -1) { - token = path.substring(currentIndex); - currentIndex = path.length(); - } else { - token = path.substring(currentIndex, newIndex); - currentIndex = newIndex; - } - - token = token.trim(); - tokens.add(token); - } - } - - return tokens; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Paths.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Paths.java deleted file mode 100644 index 25b0af49db4c..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Paths.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Used internally. Contains string constants to work with the paths in the Azure Cosmos DB database service. - */ -public class Paths { - static final String ROOT = "/"; - - public static final String DATABASES_PATH_SEGMENT = "dbs"; - public static final String DATABASES_ROOT = ROOT + DATABASES_PATH_SEGMENT; - - public static final String USERS_PATH_SEGMENT = "users"; - public static final String PERMISSIONS_PATH_SEGMENT = "permissions"; - public static final String COLLECTIONS_PATH_SEGMENT = "colls"; - public static final String STORED_PROCEDURES_PATH_SEGMENT = "sprocs"; - public static final String TRIGGERS_PATH_SEGMENT = "triggers"; - public static final String USER_DEFINED_FUNCTIONS_PATH_SEGMENT = "udfs"; - public static final String CONFLICTS_PATH_SEGMENT = "conflicts"; - public static final String DOCUMENTS_PATH_SEGMENT = "docs"; - public static final String ATTACHMENTS_PATH_SEGMENT = "attachments"; - - // /offers - public static final String OFFERS_PATH_SEGMENT = "offers"; - public static final String OFFERS_ROOT = ROOT + OFFERS_PATH_SEGMENT + "/"; - - public static final String ADDRESS_PATH_SEGMENT = "addresses"; - public static final String PARTITIONS_PATH_SEGMENT = "partitions"; - public static final String DATABASE_ACCOUNT_PATH_SEGMENT = "databaseaccount"; - public static final String TOPOLOGY_PATH_SEGMENT = "topology"; - public static final String MEDIA_PATH_SEGMENT = "media"; - public static final String MEDIA_ROOT = ROOT + MEDIA_PATH_SEGMENT; - public static final String SCHEMAS_PATH_SEGMENT = "schemas"; - public static final String PARTITION_KEY_RANGES_PATH_SEGMENT = "pkranges"; - - public static final String USER_DEFINED_TYPES_PATH_SEGMENT = "udts"; - - public static final String RID_RANGE_PATH_SEGMENT = "ridranges"; -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathsHelper.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathsHelper.java deleted file mode 100644 index f65d3f5c0e6f..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathsHelper.java +++ /dev/null @@ -1,884 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.util.ArrayList; -import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import org.apache.commons.text.StringEscapeUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; - -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -/** - * Used internally to provide utility methods to work with the resource's path in the Azure Cosmos DB database service. - */ -public class PathsHelper { - private final static Logger logger = LoggerFactory.getLogger(PathsHelper.class); - - public static String generatePath(ResourceType resourceType, RxDocumentServiceRequest request, boolean isFeed) { - if (request.getIsNameBased()) { - return PathsHelper.generatePathForNameBased(resourceType, request.getResourceAddress(), isFeed); - } else { - return PathsHelper.generatePath(resourceType, request.getResourceId(), isFeed); - } - } - - public static String generatePathForNameBased(Resource resourceType, String resourceOwnerFullName, String resourceName) { - if (resourceName == null) - return null; - - if (resourceType instanceof Database) { - return Paths.DATABASES_PATH_SEGMENT + "/" + resourceName; - } else if (resourceOwnerFullName == null) { - return null; - } else if (resourceType instanceof DocumentCollection) { - return resourceOwnerFullName + "/" + Paths.COLLECTIONS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof StoredProcedure) { - return resourceOwnerFullName + "/" + Paths.STORED_PROCEDURES_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof UserDefinedFunction) { - return resourceOwnerFullName + "/" + Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Trigger) { - return resourceOwnerFullName + "/" + Paths.TRIGGERS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Conflict) { - return resourceOwnerFullName + "/" + Paths.CONFLICTS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Attachment) { - return resourceOwnerFullName + "/" + Paths.ATTACHMENTS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof User) { - return resourceOwnerFullName + "/" + Paths.USERS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Permission) { - return resourceOwnerFullName + "/" + Paths.PERMISSIONS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Document) { - return resourceOwnerFullName + "/" + Paths.DOCUMENTS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Offer) { - return Paths.OFFERS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Resource) { - // just generic Resource type. - return null; - } - - String errorMessage = String.format(RMResources.UnknownResourceType, resourceType.toString()); - assert false : errorMessage; - throw new IllegalArgumentException(errorMessage); - } - - private static String generatePathForNameBased(ResourceType resourceType, String resourceFullName, boolean isFeed) { - if (isFeed && Strings.isNullOrEmpty(resourceFullName) && resourceType != ResourceType.Database) { - String errorMessage = String.format(RMResources.UnexpectedResourceType, resourceType); - throw new IllegalArgumentException(errorMessage); - } - - String resourcePath = null; - if (!isFeed) { - resourcePath = resourceFullName; - } else if (resourceType == ResourceType.Database) { - return Paths.DATABASES_PATH_SEGMENT; - } else if (resourceType == ResourceType.DocumentCollection) { - resourcePath = resourceFullName + "/" + Paths.COLLECTIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.StoredProcedure) { - resourcePath = resourceFullName + "/" + Paths.STORED_PROCEDURES_PATH_SEGMENT; - } else if (resourceType == ResourceType.UserDefinedFunction) { - resourcePath = resourceFullName + "/" + Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Trigger) { - resourcePath = resourceFullName + "/" + Paths.TRIGGERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Conflict) { - resourcePath = resourceFullName + "/" + Paths.CONFLICTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Attachment) { - resourcePath = resourceFullName + "/" + Paths.ATTACHMENTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.User) { - resourcePath = resourceFullName + "/" + Paths.USERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Permission) { - resourcePath = resourceFullName + "/" + Paths.PERMISSIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Document) { - resourcePath = resourceFullName + "/" + Paths.DOCUMENTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Offer) { - return resourceFullName + "/" + Paths.OFFERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.PartitionKeyRange) { - return resourceFullName + "/" + Paths.PARTITION_KEY_RANGES_PATH_SEGMENT; - } else if (resourceType == ResourceType.Schema) { - resourcePath = resourceFullName + "/" + Paths.SCHEMAS_PATH_SEGMENT; - } else { - String errorMessage = String.format(RMResources.UnknownResourceType, resourceType.toString()); - assert false : errorMessage; - throw new IllegalArgumentException(errorMessage); - } - - return resourcePath; - } - - public static String generatePath(ResourceType resourceType, String ownerOrResourceId, boolean isFeed) { - if (isFeed && (ownerOrResourceId == null || ownerOrResourceId.isEmpty()) && - resourceType != ResourceType.Database && - resourceType != ResourceType.Offer && - resourceType != ResourceType.MasterPartition && - resourceType != ResourceType.ServerPartition && - resourceType != ResourceType.DatabaseAccount && - resourceType != ResourceType.Topology) { - throw new IllegalStateException("Invalid resource type"); - } - - if(ownerOrResourceId == null) { - ownerOrResourceId = StringUtils.EMPTY; - } - - if (isFeed && resourceType == ResourceType.Database) { - return Paths.DATABASES_PATH_SEGMENT; - } else if (resourceType == ResourceType.Database) { - return Paths.DATABASES_PATH_SEGMENT + "/" + ownerOrResourceId; - } else if (isFeed && resourceType == ResourceType.DocumentCollection) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.DocumentCollection) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString(); - } else if (isFeed && resourceType == ResourceType.Offer) { - return Paths.OFFERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Offer) { - return Paths.OFFERS_PATH_SEGMENT + "/" + ownerOrResourceId; - } else if (isFeed && resourceType == ResourceType.StoredProcedure) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.STORED_PROCEDURES_PATH_SEGMENT; - } else if (resourceType == ResourceType.StoredProcedure) { - ResourceId storedProcedureId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + storedProcedureId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + storedProcedureId.getDocumentCollectionId().toString() + "/" + - Paths.STORED_PROCEDURES_PATH_SEGMENT + "/" + storedProcedureId.getStoredProcedureId().toString(); - } else if (isFeed && resourceType == ResourceType.UserDefinedFunction) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.UserDefinedFunction) { - ResourceId functionId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + functionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + functionId.getDocumentCollectionId().toString() + "/" + - Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT + "/" + functionId.getUserDefinedFunctionId().toString(); - } else if (isFeed && resourceType == ResourceType.Trigger) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.TRIGGERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Trigger) { - ResourceId triggerId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + triggerId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + triggerId.getDocumentCollectionId().toString() + "/" + - Paths.TRIGGERS_PATH_SEGMENT + "/" + triggerId.getTriggerId().toString(); - } else if (isFeed && resourceType == ResourceType.Conflict) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.CONFLICTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Conflict) { - ResourceId conflictId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + conflictId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + conflictId.getDocumentCollectionId().toString() + "/" + - Paths.CONFLICTS_PATH_SEGMENT + "/" + conflictId.getConflictId().toString(); - } else if (isFeed && resourceType == ResourceType.PartitionKeyRange) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + - documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.PARTITION_KEY_RANGES_PATH_SEGMENT; - } else if (resourceType == ResourceType.PartitionKeyRange) { - ResourceId partitionKeyRangeId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + partitionKeyRangeId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + partitionKeyRangeId.getDocumentCollectionId().toString() + "/" + - Paths.PARTITION_KEY_RANGES_PATH_SEGMENT + "/" + partitionKeyRangeId.getPartitionKeyRangeId().toString(); - } else if (isFeed && resourceType == ResourceType.Attachment) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.DOCUMENTS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentId().toString() + "/" + - Paths.ATTACHMENTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Attachment) { - ResourceId attachmentId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + attachmentId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + attachmentId.getDocumentCollectionId().toString() + "/" + - Paths.DOCUMENTS_PATH_SEGMENT + "/" + attachmentId.getDocumentId().toString() + "/" + - Paths.ATTACHMENTS_PATH_SEGMENT + "/" + attachmentId.getAttachmentId().toString(); - } else if (isFeed && resourceType == ResourceType.User) { - return - Paths.DATABASES_PATH_SEGMENT + "/" + ownerOrResourceId + "/" + - Paths.USERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.User) { - ResourceId userId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + userId.getDatabaseId().toString() + "/" + - Paths.USERS_PATH_SEGMENT + "/" + userId.getUserId().toString(); - } else if (isFeed && resourceType == ResourceType.Permission) { - ResourceId userId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + userId.getDatabaseId().toString() + "/" + - Paths.USERS_PATH_SEGMENT + "/" + userId.getUserId().toString() + "/" + - Paths.PERMISSIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Permission) { - ResourceId permissionId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + permissionId.getDatabaseId().toString() + "/" + - Paths.USERS_PATH_SEGMENT + "/" + permissionId.getUserId().toString() + "/" + - Paths.PERMISSIONS_PATH_SEGMENT + "/" + permissionId.getPermissionId().toString(); - } else if (isFeed && resourceType == ResourceType.Document) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.DOCUMENTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Document) { - ResourceId documentId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + documentId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentId.getDocumentCollectionId().toString() + "/" + - Paths.DOCUMENTS_PATH_SEGMENT + "/" + documentId.getDocumentId().toString(); - } else if (isFeed && resourceType == ResourceType.MasterPartition) { - return Paths.PARTITIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.MasterPartition) { - return Paths.PARTITIONS_PATH_SEGMENT + "/" + ownerOrResourceId; - } else if (isFeed && resourceType == ResourceType.ServerPartition) { - return Paths.PARTITIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.ServerPartition) { - return Paths.PARTITIONS_PATH_SEGMENT + "/" + ownerOrResourceId; - } else if (isFeed && resourceType == ResourceType.Topology) { - return Paths.TOPOLOGY_PATH_SEGMENT; - } else if (resourceType == ResourceType.Topology) { - return Paths.TOPOLOGY_PATH_SEGMENT + "/" + ownerOrResourceId; - } else if (isFeed && resourceType == ResourceType.DatabaseAccount) { - return Paths.DATABASE_ACCOUNT_PATH_SEGMENT; - } else if (resourceType == ResourceType.DatabaseAccount) { - return Paths.DATABASE_ACCOUNT_PATH_SEGMENT + "/" + ownerOrResourceId; - } - - String errorMessage = "invalid resource type"; - throw new IllegalStateException(errorMessage); - } - - public static PathInfo parsePathSegments(String resourceUrl) { - String[] segments = StringUtils.strip(resourceUrl, "/").split("/"); - if (segments == null || segments.length < 1) { - return null; - } - - int uriSegmentsCount = segments.length; - String segmentOne = StringUtils.strip(segments[uriSegmentsCount - 1], "/"); - String segmentTwo = (uriSegmentsCount >= 2) ? StringUtils.strip(segments[uriSegmentsCount - 2], "/") - : StringUtils.EMPTY; - - // handle name based operation - if (uriSegmentsCount >= 2) { - // parse the databaseId, if failed, it is name based routing - // mediaId is special, we will treat it always as id based. - if (Paths.MEDIA_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.OFFERS_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.PARTITIONS_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.DATABASE_ACCOUNT_PATH_SEGMENT.compareTo(segments[0]) != 0) { - Pair result = ResourceId.tryParse(segments[1]); - if (!result.getLeft() || !result.getRight().isDatabaseId()) { - return parseNameSegments(resourceUrl, segments); - } - } - - } - - // Feed paths have odd number of segments - if ((uriSegmentsCount % 2 != 0) && isResourceType(segmentOne)) { - return new PathInfo(true, segmentOne, - segmentOne.compareToIgnoreCase(Paths.DATABASES_PATH_SEGMENT) != 0 ? segmentTwo : StringUtils.EMPTY, - false); - } else if (isResourceType(segmentTwo)) { - return new PathInfo(false, segmentTwo, segmentOne, false); - } - - return null; - } - - /** - * Method which will return boolean based on whether it is able to parse the - * path and name segment from resource url , and fill info in PathInfo object - * @param resourceUrl Complete ResourceLink - * @param pathInfo Path info object which will hold information - * @param clientVersion The Client version - * @return - */ - public static boolean tryParsePathSegments(String resourceUrl, PathInfo pathInfo, String clientVersion) { - pathInfo.resourcePath = StringUtils.EMPTY; - pathInfo.resourceIdOrFullName = StringUtils.EMPTY; - pathInfo.isFeed = false; - pathInfo.isNameBased = false; - if (StringUtils.isEmpty(resourceUrl)) { - return false; - } - String trimmedStr = StringUtils.strip(resourceUrl, Constants.Properties.PATH_SEPARATOR); - String[] segments = StringUtils.split(trimmedStr, Constants.Properties.PATH_SEPARATOR); - if (segments == null || segments.length < 1) { - return false; - } - int uriSegmentsCount = segments.length; - String segmentOne = segments[uriSegmentsCount - 1]; - String segmentTwo = (uriSegmentsCount >= 2) ? segments[uriSegmentsCount - 2] : StringUtils.EMPTY; - - // handle name based operation - if (uriSegmentsCount >= 2) { - // parse the databaseId, if failed, it is name based routing - // mediaId is special, we will treat it always as id based. - if (Paths.MEDIA_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.OFFERS_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.PARTITIONS_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.DATABASE_ACCOUNT_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.TOPOLOGY_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.RID_RANGE_PATH_SEGMENT.compareTo(segments[0]) != 0) { - Pair result = ResourceId.tryParse(segments[1]); - if (!result.getLeft() || !result.getRight().isDatabaseId()) { - pathInfo.isNameBased = true; - return tryParseNameSegments(resourceUrl, segments, pathInfo); - } - } - } - // Feed paths have odd number of segments - if ((uriSegmentsCount % 2 != 0) && PathsHelper.isResourceType(segmentOne)) { - pathInfo.isFeed = true; - pathInfo.resourcePath = segmentOne; - // The URL for dbs may contain the management endpoint as the segmentTwo which - // should not be used as resourceId - if (!segmentOne.equalsIgnoreCase(Paths.DATABASES_PATH_SEGMENT)) { - pathInfo.resourceIdOrFullName = segmentTwo; - } - } else if (PathsHelper.isResourceType(segmentTwo)) { - pathInfo.isFeed = false; - pathInfo.resourcePath = segmentTwo; - pathInfo.resourceIdOrFullName = segmentOne; - // Media ID is not supposed to be used for any ID verification. However, if the - // old client makes a call for media ID - // we still need to support it. - // For new clients, parse to return the attachment id. For old clients do not - // modify. - if (!StringUtils.isEmpty(clientVersion) - && pathInfo.resourcePath.equalsIgnoreCase(Paths.MEDIA_PATH_SEGMENT)) { - String attachmentId = null; - byte storeIndex = 0; - // MEDIA Id parsing code will come here , supported MediaIdHelper file missing in java sdk(Sync and Async both) - //Below code from .net - // if (!MediaIdHelper.TryParseMediaId(resourceIdOrFullName, out attachmentId, out storeIndex)) - // { - // return false; - //} - //resourceIdOrFullName = attachmentId; - } - } else { - return false; - } - - return true; - - } - - /** - * Method which will return boolean based on whether it is able to parse the - * name segment from resource url , and fill info in PathInfo object - * @param resourceUrl Complete ResourceLink - * @param segments - * @param pathInfo Path info object which will hold information - * @return - */ - private static boolean tryParseNameSegments(String resourceUrl, String[] segments, PathInfo pathInfo) { - pathInfo.isFeed = false; - pathInfo.resourceIdOrFullName = ""; - pathInfo.resourcePath = ""; - if (segments == null || segments.length < 1) { - return false; - } - if (segments.length % 2 == 0) { - // even number, assume it is individual resource - if (isResourceType(segments[segments.length - 2])) { - pathInfo.resourcePath = segments[segments.length - 2]; - pathInfo.resourceIdOrFullName = StringEscapeUtils.unescapeJava(StringUtils.removeEnd( - StringUtils.removeStart(resourceUrl, Paths.ROOT), Paths.ROOT)); - return true; - } - } else { - // odd number, assume it is feed request - if (isResourceType(segments[segments.length - 1])) { - pathInfo.isFeed = true; - pathInfo.resourcePath = segments[segments.length - 1]; - String resourceIdOrFullName = resourceUrl.substring(0, StringUtils.removeEnd(resourceUrl,Paths.ROOT).lastIndexOf(Paths.ROOT)); - pathInfo.resourceIdOrFullName = StringEscapeUtils.unescapeJava(StringUtils.removeEnd( - StringUtils.removeStart(resourceIdOrFullName, Paths.ROOT), Paths.ROOT)); - return true; - } - } - return false; - } - - public static PathInfo parseNameSegments(String resourceUrl, String[] segments) { - if (segments == null || segments.length < 1) { - return null; - } - - if (segments.length % 2 == 0) { - // even number, assume it is individual resource - if (isResourceType(segments[segments.length - 2])) { - return new PathInfo(false, segments[segments.length - 2], - StringEscapeUtils.unescapeJava(StringUtils.strip(resourceUrl, Paths.ROOT)), true); - } - } else { - // odd number, assume it is feed request - if (isResourceType(segments[segments.length - 1])) { - return new PathInfo(true, segments[segments.length - 1], - StringEscapeUtils.unescapeJava(StringUtils.strip( - resourceUrl.substring(0, - StringUtils.removeEnd(resourceUrl, Paths.ROOT).lastIndexOf(Paths.ROOT)), - Paths.ROOT)), - true); - } - } - - return null; - } - - private static boolean isResourceType(String resourcePathSegment) { - if (StringUtils.isEmpty(resourcePathSegment)) { - return false; - } - - switch (resourcePathSegment.toLowerCase()) { - case Paths.ATTACHMENTS_PATH_SEGMENT: - case Paths.COLLECTIONS_PATH_SEGMENT: - case Paths.DATABASES_PATH_SEGMENT: - case Paths.PERMISSIONS_PATH_SEGMENT: - case Paths.USERS_PATH_SEGMENT: - case Paths.DOCUMENTS_PATH_SEGMENT: - case Paths.STORED_PROCEDURES_PATH_SEGMENT: - case Paths.TRIGGERS_PATH_SEGMENT: - case Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT: - case Paths.CONFLICTS_PATH_SEGMENT: - case Paths.MEDIA_PATH_SEGMENT: - case Paths.OFFERS_PATH_SEGMENT: - case Paths.PARTITIONS_PATH_SEGMENT: - case Paths.DATABASE_ACCOUNT_PATH_SEGMENT: - case Paths.TOPOLOGY_PATH_SEGMENT: - case Paths.PARTITION_KEY_RANGES_PATH_SEGMENT: - case Paths.SCHEMAS_PATH_SEGMENT: - return true; - default: - return false; - } - } - - public static String generatePathForNameBased(ResourceType resourceType, String resourceOwnerFullName, String resourceName) { - switch (resourceType) { - case Database: - return Paths.DATABASES_PATH_SEGMENT + "/" + resourceName; - case DocumentCollection: - return resourceOwnerFullName + "/" + Paths.COLLECTIONS_PATH_SEGMENT + "/" + resourceName; - case StoredProcedure: - return resourceOwnerFullName + "/" + Paths.STORED_PROCEDURES_PATH_SEGMENT + "/" + resourceName; - case UserDefinedFunction: - return resourceOwnerFullName + "/" + Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT + "/" + resourceName; - case Trigger: - return resourceOwnerFullName + "/" + Paths.TRIGGERS_PATH_SEGMENT + "/" + resourceName; - case Attachment: - return resourceOwnerFullName + "/" + Paths.ATTACHMENTS_PATH_SEGMENT + "/" + resourceName; - case Conflict: - return resourceOwnerFullName + "/" + Paths.CONFLICTS_PATH_SEGMENT + "/" + resourceName; - case Document: - return resourceOwnerFullName + "/" + Paths.DOCUMENTS_PATH_SEGMENT + "/" + resourceName; - case Offer: - return resourceOwnerFullName + "/" + Paths.OFFERS_PATH_SEGMENT + "/" + resourceName; - case Permission: - return resourceOwnerFullName + "/" + Paths.PERMISSIONS_PATH_SEGMENT + "/" + resourceName; - case User: - return resourceOwnerFullName + "/" + Paths.USERS_PATH_SEGMENT + "/" + resourceName; - case PartitionKeyRange: - return resourceOwnerFullName + "/" + Paths.PARTITION_KEY_RANGES_PATH_SEGMENT + "/" + resourceName; - default: - return null; - } - } - - public static String getCollectionPath(String resourceFullName) { - if (resourceFullName != null) { - String trimmedResourceFullName = Utils.trimBeginningAndEndingSlashes(resourceFullName); - int index = indexOfNth(trimmedResourceFullName, '/', 4); - if (index > 0) - return trimmedResourceFullName.substring(0, index); - } - - return resourceFullName; - } - - public static String getDatabasePath(String resourceFullName) { - if (resourceFullName != null) { - int index = indexOfNth(resourceFullName, '/', 2); - if (index > 0) - return resourceFullName.substring(0, index); - } - - return resourceFullName; - } - - public static String getParentByIndex(String resourceFullName, int segmentIndex) { - int index = indexOfNth(resourceFullName, '/', segmentIndex); - if (index > 0) - return resourceFullName.substring(0, index); - else { - index = indexOfNth(resourceFullName, '/', segmentIndex - 1); - if (index > 0) - return resourceFullName; - else - return null; - } - } - public static boolean isNameBased(String resourceIdOrFullName) { - // quick way to tell whether it is resourceId nor not, non conclusively. - if (resourceIdOrFullName != null && !resourceIdOrFullName.isEmpty() - && resourceIdOrFullName.length() > 4 && resourceIdOrFullName.charAt(3) == '/') { - return true; - } - return false; - } - - private static int indexOfNth(String str, char value, int nthOccurance) { - int remaining = nthOccurance; - char[] characters = str.toCharArray(); - for (int i = 0; i < characters.length; i++) { - if (characters[i] == value) { - remaining--; - if (remaining == 0) { - return i; - } - } - } - return -1; - } - - public static ResourceType getResourcePathSegment(String resourcePathSegment) throws BadRequestException { - if (StringUtils.isEmpty(resourcePathSegment)) { - String message = String.format(RMResources.StringArgumentNullOrEmpty, "resourcePathSegment"); - throw new BadRequestException(message); - } - - switch (resourcePathSegment) { - case Paths.ATTACHMENTS_PATH_SEGMENT: - return ResourceType.Attachment; - - case Paths.COLLECTIONS_PATH_SEGMENT: - return ResourceType.DocumentCollection; - - case Paths.DATABASES_PATH_SEGMENT: - return ResourceType.Database; - - case Paths.PERMISSIONS_PATH_SEGMENT: - return ResourceType.Permission; - - case Paths.USERS_PATH_SEGMENT: - return ResourceType.User; - - case Paths.DOCUMENTS_PATH_SEGMENT: - return ResourceType.Document; - - case Paths.STORED_PROCEDURES_PATH_SEGMENT: - return ResourceType.StoredProcedure; - - case Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT: - return ResourceType.UserDefinedFunction; - - case Paths.TRIGGERS_PATH_SEGMENT: - return ResourceType.Trigger; - - case Paths.CONFLICTS_PATH_SEGMENT: - return ResourceType.Conflict; - - case Paths.OFFERS_PATH_SEGMENT: - return ResourceType.Offer; - - case Paths.SCHEMAS_PATH_SEGMENT: - return ResourceType.Schema; - } - - String errorMessage = String.format(RMResources.UnknownResourceType, resourcePathSegment); - throw new BadRequestException(errorMessage); - } - - public static String getResourcePath(ResourceType resourceType) throws BadRequestException { - switch (resourceType) { - case Database: - return Paths.DATABASES_PATH_SEGMENT; - - case DocumentCollection: - return Paths.COLLECTIONS_PATH_SEGMENT; - - case Document: - return Paths.DOCUMENTS_PATH_SEGMENT; - - case StoredProcedure: - return Paths.STORED_PROCEDURES_PATH_SEGMENT; - - case UserDefinedFunction: - return Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT; - - case Trigger: - return Paths.TRIGGERS_PATH_SEGMENT; - - case Conflict: - return Paths.CONFLICTS_PATH_SEGMENT; - - case Attachment: - return Paths.ATTACHMENTS_PATH_SEGMENT; - - case User: - return Paths.USERS_PATH_SEGMENT; - - case Permission: - return Paths.PERMISSIONS_PATH_SEGMENT; - - case Offer: - return Paths.OFFERS_PATH_SEGMENT; - - case MasterPartition: - case ServerPartition: - return Paths.PARTITIONS_PATH_SEGMENT; - - case PartitionKeyRange: - return Paths.PARTITION_KEY_RANGES_PATH_SEGMENT; - - case Media: - return Paths.MEDIA_ROOT; - - case Schema: - return Paths.SCHEMAS_PATH_SEGMENT; - - - case DatabaseAccount: - case Topology: - - return Paths.ROOT; - - default: - String errorMessage = String.format(RMResources.UnknownResourceType, resourceType.toString()); - throw new BadRequestException(errorMessage); - } - } - - public static boolean validateResourceFullName(ResourceType resourceType, String resourceFullName) { - String[] segments = StringUtils.split(resourceFullName, '/'); - String[] resourcePathArray = getResourcePathArray(resourceType); - if (resourcePathArray == null) { - return false; - } - - if (segments.length != resourcePathArray.length * 2) { - return false; - } - for (int i = 0; i < resourcePathArray.length; i++) { - if(resourcePathArray[i].compareTo(segments[2 * i]) != 0) { - return false; - } - } - return true; - } - - private static String[] getResourcePathArray(ResourceType resourceType) { - List segments = new ArrayList(); - segments.add(Paths.DATABASES_PATH_SEGMENT); - - if (resourceType == ResourceType.Permission || - resourceType == ResourceType.User) { - segments.add(Paths.USERS_PATH_SEGMENT); - if (resourceType == ResourceType.Permission) { - segments.add(Paths.PERMISSIONS_PATH_SEGMENT); - } - } else if (resourceType == ResourceType.DocumentCollection || - resourceType == ResourceType.StoredProcedure || - resourceType == ResourceType.UserDefinedFunction || - resourceType == ResourceType.Trigger || - resourceType == ResourceType.Conflict || - resourceType == ResourceType.Attachment || - resourceType == ResourceType.Document || - resourceType == ResourceType.PartitionKeyRange || - resourceType == ResourceType.Schema) { - segments.add(Paths.COLLECTIONS_PATH_SEGMENT); - if (resourceType == ResourceType.StoredProcedure) { - segments.add(Paths.STORED_PROCEDURES_PATH_SEGMENT); - } else if(resourceType == ResourceType.UserDefinedFunction) { - segments.add(Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT); - } else if(resourceType == ResourceType.Trigger) { - segments.add(Paths.TRIGGERS_PATH_SEGMENT); - } else if (resourceType == ResourceType.Conflict) { - segments.add(Paths.CONFLICTS_PATH_SEGMENT); - } else if (resourceType == ResourceType.Schema) { - segments.add(Paths.SCHEMAS_PATH_SEGMENT); - } else if(resourceType == ResourceType.Document || - resourceType == ResourceType.Attachment) { - segments.add(Paths.DOCUMENTS_PATH_SEGMENT); - if (resourceType == ResourceType.Attachment) { - segments.add(Paths.ATTACHMENTS_PATH_SEGMENT); - } - } else if(resourceType == ResourceType.PartitionKeyRange) { - segments.add(Paths.PARTITION_KEY_RANGES_PATH_SEGMENT); - } - } else if (resourceType != ResourceType.Database) { - return null; - } - return segments.stream().toArray(String[]::new); - } - - public static boolean validateResourceId(ResourceType resourceType, String resourceId) { - if (resourceType == ResourceType.Conflict) { - return PathsHelper.validateConflictId(resourceId); - } else if (resourceType == ResourceType.Database) { - return PathsHelper.validateDatabaseId(resourceId); - } else if (resourceType == ResourceType.DocumentCollection) { - return PathsHelper.validateDocumentCollectionId(resourceId); - } else if (resourceType == ResourceType.Document) { - return PathsHelper.validateDocumentId(resourceId); - } else if (resourceType == ResourceType.Permission) { - return PathsHelper.validatePermissionId(resourceId); - } else if (resourceType == ResourceType.StoredProcedure) { - return PathsHelper.validateStoredProcedureId(resourceId); - } else if (resourceType == ResourceType.Trigger) { - return PathsHelper.validateTriggerId(resourceId); - } else if (resourceType == ResourceType.UserDefinedFunction) { - return PathsHelper.validateUserDefinedFunctionId(resourceId); - } else if (resourceType == ResourceType.User) { - return PathsHelper.validateUserId(resourceId); - } else if (resourceType == ResourceType.Attachment) { - return PathsHelper.validateAttachmentId(resourceId); - } else { - logger.error(String.format("ValidateResourceId not implemented for Type %s in ResourceRequestHandler", resourceType.toString())); - return false; - } - } - - public static boolean validateDatabaseId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getDatabase() != 0; - } - - public static boolean validateDocumentCollectionId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getDocumentCollection() != 0; - } - - public static boolean validateDocumentId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getDocument() != 0; - } - - public static boolean validateConflictId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getConflict() != 0; - } - - public static boolean validateAttachmentId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getAttachment() != 0; - } - - public static boolean validatePermissionId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getPermission() != 0; - } - - public static boolean validateStoredProcedureId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getStoredProcedure() != 0; - } - - public static boolean validateTriggerId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getTrigger() != 0; - } - - public static boolean validateUserDefinedFunctionId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getUserDefinedFunction() != 0; - } - - public static boolean validateUserId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getUser() != 0; - } - - - public static boolean isPublicResource(Resource resourceType) { - if (resourceType instanceof Database || - resourceType instanceof DocumentCollection || - resourceType instanceof StoredProcedure || - resourceType instanceof UserDefinedFunction || - resourceType instanceof Trigger || - resourceType instanceof Conflict || - resourceType instanceof Attachment || - resourceType instanceof User || - resourceType instanceof Permission || - resourceType instanceof Document || - resourceType instanceof Offer - ) { - return true; - } else { - return false; - } - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Quadruple.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Quadruple.java deleted file mode 100644 index 624c12b5148e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Quadruple.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Represents class with four different generic objects. - */ -public class Quadruple { - - private final A val0; - private final B val1; - private final C val2; - private final D val3; - - public static Quadruple with(final A value0, final B value1, final C value2, - final D value3) { - return new Quadruple(value0, value1, value2, value3); - } - - public Quadruple(final A value0, final B value1, final C value2, final D value3) { - this.val0 = value0; - this.val1 = value1; - this.val2 = value2; - this.val3 = value3; - } - - public A getValue0() { - return this.val0; - } - - public B getValue1() { - return this.val1; - } - - public C getValue2() { - return this.val2; - } - - public D getValue3() { - return this.val3; - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/QueryCompatibilityMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/QueryCompatibilityMode.java deleted file mode 100644 index 77dba9f5c531..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/QueryCompatibilityMode.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * A client query compatibility mode when making query request in the Azure Cosmos DB database service. Can be used - * to force a specific query request format. - */ -public enum QueryCompatibilityMode { - Default, - Query, - SqlQuery -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RequestChargeTracker.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RequestChargeTracker.java deleted file mode 100644 index 0cb8d3468835..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RequestChargeTracker.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.util.concurrent.atomic.AtomicLong; - -/** - * Tracks requests charge in the Azure Cosmos DB database service. - */ -public final class RequestChargeTracker { - private final static int NUMBER_OF_DECIMAL_POINT_TO_RESERVE_FACTOR = 1000; - private final AtomicLong totalRUs = new AtomicLong(); - - public double getTotalRequestCharge() { - return ((double) this.totalRUs.get()) / NUMBER_OF_DECIMAL_POINT_TO_RESERVE_FACTOR; - } - - public void addCharge(double ruUsage) { - this.totalRUs.addAndGet((long) (ruUsage * NUMBER_OF_DECIMAL_POINT_TO_RESERVE_FACTOR)); - } - - public double getAndResetCharge() { - return (double) this.totalRUs.getAndSet(0) / NUMBER_OF_DECIMAL_POINT_TO_RESERVE_FACTOR; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceId.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceId.java deleted file mode 100644 index 78bd93de8946..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceId.java +++ /dev/null @@ -1,540 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; - -/** - * Used internally to represents a Resource ID in the Azure Cosmos DB database service. - */ -public class ResourceId { - static final short Length = 20; - static final short OFFER_ID_LENGTH = 3; - static final short MAX_PATH_FRAGMENT = 8; - - private int database; - private int documentCollection; - private long storedProcedure; - private long trigger; - private long userDefinedFunction; - private long conflict; - private long document; - private long partitionKeyRange; - private int user; - private long permission; - private int attachment; - private long offer; - - private ResourceId() { - this.offer = 0; - this.database = 0; - this.documentCollection = 0; - this.storedProcedure = 0; - this.trigger = 0; - this.userDefinedFunction = 0; - this.document = 0; - this.partitionKeyRange = 0; - this.user = 0; - this.conflict = 0; - this.permission = 0; - this.attachment = 0; - } - - public static ResourceId parse(String id) throws IllegalArgumentException { - Pair pair = ResourceId.tryParse(id); - - if (!pair.getKey()) { - throw new IllegalArgumentException(String.format( - "Invalid resource id %s", id)); - } - return pair.getValue(); - } - - public static byte[] parse(ResourceType type, String id) { - if (ResourceId.hasNonHierarchicalResourceId(type)) { - return id.getBytes(StandardCharsets.UTF_8); - } - return ResourceId.parse(id).getValue(); - } - - private static boolean hasNonHierarchicalResourceId(ResourceType type) { - switch (type) { - case MasterPartition: - case ServerPartition: - case RidRange: - return true; - default: - return false; - } - } - - public static ResourceId newDatabaseId(int dbid) { - ResourceId resourceId = new ResourceId(); - resourceId.database = dbid; - return resourceId; - } - - public static ResourceId newDocumentCollectionId(String databaseId, int collectionId) { - ResourceId dbId = ResourceId.parse(databaseId); - - return newDocumentCollectionId(dbId.database, collectionId); - } - - static ResourceId newDocumentCollectionId(int dbId, int collectionId) { - ResourceId collectionResourceId = new ResourceId(); - collectionResourceId.database = dbId; - collectionResourceId.documentCollection = collectionId; - - return collectionResourceId; - } - - public static ResourceId newUserId(String databaseId, int userId) { - ResourceId dbId = ResourceId.parse(databaseId); - - ResourceId userResourceId = new ResourceId(); - userResourceId.database = dbId.database; - userResourceId.user = userId; - - return userResourceId; - } - - public static ResourceId newPermissionId(String userId, long permissionId) { - ResourceId usrId = ResourceId.parse(userId); - - ResourceId permissionResourceId = new ResourceId(); - permissionResourceId.database = usrId.database; - permissionResourceId.user = usrId.user; - permissionResourceId.permission = permissionId; - return permissionResourceId; - } - - public static ResourceId newAttachmentId(String documentId, int attachmentId) { - ResourceId docId = ResourceId.parse(documentId); - - ResourceId attachmentResourceId = new ResourceId(); - attachmentResourceId.database = docId.database; - attachmentResourceId.documentCollection = docId.documentCollection; - attachmentResourceId.document = docId.document; - attachmentResourceId.attachment = attachmentId; - - return attachmentResourceId; - } - - public static Pair tryParse(String id) { - ResourceId rid = null; - - try { - if (StringUtils.isEmpty(id)) - return Pair.of(false, null); - - if (id.length() % 4 != 0) { - // our ResourceId string is always padded - return Pair.of(false, null); - } - - byte[] buffer = null; - - Pair pair = ResourceId.verify(id); - - if (!pair.getKey()) - return Pair.of(false, null); - - buffer = pair.getValue(); - - if (buffer.length % 4 != 0 && buffer.length != ResourceId.OFFER_ID_LENGTH) { - return Pair.of(false, null); - } - - rid = new ResourceId(); - - if (buffer.length == ResourceId.OFFER_ID_LENGTH) { - rid.offer = 0; - for (int index = 0; index < ResourceId.OFFER_ID_LENGTH; index++) - { - rid.offer |= (long)(buffer[index] << (index * 8)); - } - return Pair.of(true, rid); - } - - if (buffer.length >= 4) - rid.database = ByteBuffer.wrap(buffer).getInt(); - - if (buffer.length >= 8) { - byte[] temp = new byte[4]; - ResourceId.blockCopy(buffer, 4, temp, 0, 4); - - boolean isCollection = (temp[0] & (128)) > 0; - - if (isCollection) { - rid.documentCollection = ByteBuffer.wrap(temp).getInt(); - - if (buffer.length >= 16) { - byte[] subCollRes = new byte[8]; - ResourceId.blockCopy(buffer, 8, subCollRes, 0, 8); - - long subCollectionResource = ByteBuffer.wrap(buffer, 8, 8).getLong(); - if ((subCollRes[7] >> 4) == (byte) CollectionChildResourceType.Document) { - rid.document = subCollectionResource; - - if (buffer.length == 20) { - rid.attachment = ByteBuffer.wrap(buffer, 16, 4).getInt(); - } - } else if (Math.abs(subCollRes[7] >> 4) == (byte) CollectionChildResourceType.StoredProcedure) { - rid.storedProcedure = subCollectionResource; - } else if ((subCollRes[7] >> 4) == (byte) CollectionChildResourceType.Trigger) { - rid.trigger = subCollectionResource; - } else if ((subCollRes[7] >> 4) == (byte) CollectionChildResourceType.UserDefinedFunction) { - rid.userDefinedFunction = subCollectionResource; - } else if ((subCollRes[7] >> 4) == (byte) CollectionChildResourceType.Conflict) { - rid.conflict = subCollectionResource; - } else if ((subCollRes[7] >> 4) == (byte) CollectionChildResourceType.PartitionKeyRange) { - rid.partitionKeyRange = subCollectionResource; - } else { - return Pair.of(false, rid); - } - } else if (buffer.length != 8) { - return Pair.of(false, rid); - } - } else { - rid.user = ByteBuffer.wrap(temp).getInt(); - - if (buffer.length == 16) { - rid.permission = ByteBuffer.wrap(buffer, 8, 8).getLong(); - } else if (buffer.length != 8) { - return Pair.of(false, rid); - } - } - } - - return Pair.of(true, rid); - } catch (Exception e) { - return Pair.of(false, null); - } - } - - public static Pair verify(String id) { - if (StringUtils.isEmpty(id)) - throw new IllegalArgumentException("id"); - - byte[] buffer = null; - - try { - buffer = ResourceId.fromBase64String(id); - } catch (Exception e) { - } - - if (buffer == null || buffer.length > ResourceId.Length) { - buffer = null; - return Pair.of(false, buffer); - } - - return Pair.of(true, buffer); - } - - public static boolean verifyBool(String id) { - return verify(id).getKey(); - } - - static byte[] fromBase64String(String s) { - return Utils.Base64Decoder.decode(s.replace('-', '/')); - } - - static String toBase64String(byte[] buffer) { - return ResourceId.toBase64String(buffer, 0, buffer.length); - } - - static String toBase64String(byte[] buffer, int offset, int length) { - byte[] subBuffer = Arrays.copyOfRange(buffer, offset, length); - - return Utils.encodeBase64String(subBuffer).replace('/', '-'); - } - - // Copy the bytes provided with a for loop, faster when there are only a few - // bytes to copy - static void blockCopy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int count) { - int stop = srcOffset + count; - for (int i = srcOffset; i < stop; i++) - dst[dstOffset++] = src[i]; - } - - private static byte[] convertToBytesUsingByteBuffer(int value) { - ByteOrder order = ByteOrder.BIG_ENDIAN; - ByteBuffer buffer = ByteBuffer.allocate(4); - buffer.order(order); - return buffer.putInt(value).array(); - } - - private static byte[] convertToBytesUsingByteBuffer(long value) { - ByteOrder order = ByteOrder.BIG_ENDIAN; - ByteBuffer buffer = ByteBuffer.allocate(8); - buffer.order(order); - return buffer.putLong(value).array(); - } - - public boolean isDatabaseId() { - return this.getDatabase() != 0 && (this.getDocumentCollection() == 0 && this.getUser() == 0); - } - - public int getDatabase() { - return this.database; - } - - public ResourceId getDatabaseId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - return rid; - } - - public int getDocumentCollection() { - return this.documentCollection; - } - - public ResourceId getDocumentCollectionId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - return rid; - } - - /** - * Unique (across all databases) Id for the DocumentCollection. - * First 4 bytes are DatabaseId and next 4 bytes are CollectionId. - * - * @return the unique collectionId - */ - public long getUniqueDocumentCollectionId() { - return (long) this.database << 32 | this.documentCollection; - } - - public long getStoredProcedure() { - return this.storedProcedure; - } - - public ResourceId getStoredProcedureId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.storedProcedure = this.storedProcedure; - return rid; - } - - public long getTrigger() { - return this.trigger; - } - - public ResourceId getTriggerId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.trigger = this.trigger; - return rid; - } - - public long getUserDefinedFunction() { - return this.userDefinedFunction; - } - - public ResourceId getUserDefinedFunctionId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.userDefinedFunction = this.userDefinedFunction; - return rid; - } - - public long getConflict() { - return this.conflict; - } - - public ResourceId getConflictId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.conflict = this.conflict; - return rid; - } - - public long getDocument() { - return this.document; - } - - public ResourceId getDocumentId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.document = this.document; - return rid; - } - - public long getPartitionKeyRange() { - return this.partitionKeyRange; - } - - public ResourceId getPartitionKeyRangeId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.partitionKeyRange = this.partitionKeyRange; - return rid; - } - - public int getUser() { - return this.user; - } - - public ResourceId getUserId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.user = this.user; - return rid; - } - - public long getPermission() { - return this.permission; - } - - public ResourceId getPermissionId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.user = this.user; - rid.permission = this.permission; - return rid; - } - - public int getAttachment() { - return this.attachment; - } - - public ResourceId getAttachmentId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.document = this.document; - rid.attachment = this.attachment; - return rid; - } - - public long getOffer() { return this.offer; } - - public ResourceId getOfferId() { - ResourceId rid = new ResourceId(); - rid.offer = this.offer; - return rid; - } - - public byte[] getValue() { - int len = 0; - if (this.offer != 0) - len += ResourceId.OFFER_ID_LENGTH; - else if (this.database != 0) - len += 4; - if (this.documentCollection != 0 || this.user != 0) - len += 4; - if (this.document != 0 || this.permission != 0 - || this.storedProcedure != 0 || this.trigger != 0 - || this.userDefinedFunction != 0 || this.conflict != 0 - || this.partitionKeyRange != 0) - len += 8; - if (this.attachment != 0) - len += 4; - - byte[] val = new byte[len]; - - if (this.offer != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.offer), - 0, val, 0, ResourceId.OFFER_ID_LENGTH); - else if (this.database != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.database), - 0, val, 0, 4); - - if (this.documentCollection != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.documentCollection), - 0, val, 4, 4); - else if (this.user != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.user), - 0, val, 4, 4); - - if (this.storedProcedure != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.storedProcedure), - 0, val, 8, 8); - else if (this.trigger != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.trigger), - 0, val, 8, 8); - else if (this.userDefinedFunction != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.userDefinedFunction), - 0, val, 8, 8); - else if (this.conflict != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.conflict), - 0, val, 8, 8); - else if (this.document != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.document), - 0, val, 8, 8); - else if (this.permission != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.permission), - 0, val, 8, 8); - else if (this.partitionKeyRange != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.partitionKeyRange), - 0, val, 8, 8); - - if (this.attachment != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.attachment), - 0, val, 16, 4); - - return val; - } - - public String toString() { - return ResourceId.toBase64String(this.getValue()); - } - - public boolean equals(ResourceId other) { - if (other == null) { - return false; - } - - return Arrays.equals(this.getValue(), other.getValue()); - } - - // Using a byte however, we only need nibble here. - private static class CollectionChildResourceType { - public static final byte Document = 0x0; - public static final byte StoredProcedure = 0x08; - public static final byte Trigger = 0x07; - public static final byte UserDefinedFunction = 0x06; - public static final byte Conflict = 0x04; - public static final byte PartitionKeyRange = 0x05; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceTokenAuthorizationHelper.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceTokenAuthorizationHelper.java deleted file mode 100644 index 9e0577917258..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceTokenAuthorizationHelper.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.tuple.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyAndResourceTokenPair; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; - -/** - * This class is used internally and act as a helper in authorization of - * resources from permission feed and its supporting method. - * - */ -public class ResourceTokenAuthorizationHelper { - - private static final Logger logger = LoggerFactory.getLogger(ResourceTokenAuthorizationHelper.class); - - /** - * This method help to differentiate between master key and resource token - * - * @param token - * ResourceToken provide - * @return Whether given token is resource token or not - */ - public static boolean isResourceToken(String token) { - int typeSeparatorPosition = token.indexOf('&'); - if (typeSeparatorPosition == -1) { - return false; - } - String authType = token.substring(0, typeSeparatorPosition); - int typeKeyValueSepartorPosition = authType.indexOf('='); - if (typeKeyValueSepartorPosition == -1 || !authType.substring(0, typeKeyValueSepartorPosition) - .equalsIgnoreCase(Constants.Properties.AUTH_SCHEMA_TYPE)) { - return false; - } - - String authTypeValue = authType.substring(typeKeyValueSepartorPosition + 1); - - return authTypeValue.equalsIgnoreCase(Constants.Properties.RESOURCE_TOKEN); - } - - /** - * Private method which will fetch resource token based on partition key and - * resource address . - * - * @param resourceTokensMap - * @param resourceAddress - * @param partitionKey - * @return - */ - private static String getResourceToken(Map> resourceTokensMap, - String resourceAddress, - PartitionKeyInternal partitionKey) { - List partitionKeyAndResourceTokenPairs = resourceTokensMap - .get(resourceAddress); - if (partitionKeyAndResourceTokenPairs != null) { - for (PartitionKeyAndResourceTokenPair pair : partitionKeyAndResourceTokenPairs) { - if (pair.getPartitionKey().contains(partitionKey) || partitionKey.equals(PartitionKeyInternal.Empty)) { - return pair.getResourceToken(); - } - } - } - - return null; - } - - /** - * This method will try to fetch the resource token to access the resource . - * - * @param resourceTokensMap - * It contains the resource link and its partition key and resource - * token list . - * @param headers - * Header information of the request . - * @param resourceAddress - * Resource full name or ID . - * @param requestVerb - * The verb . - */ - public static String getAuthorizationTokenUsingResourceTokens( - Map> resourceTokensMap, - String requestVerb, - String resourceAddress, - Map headers) { - PartitionKeyInternal partitionKey = PartitionKeyInternal.Empty; - String partitionKeyString = headers.get(HttpConstants.HttpHeaders.PARTITION_KEY); - if (partitionKeyString != null) { - partitionKey = PartitionKeyInternal.fromJsonString(partitionKeyString); - } - - if (PathsHelper.isNameBased(resourceAddress)) { - String resourceToken = null; - for (int index = 2; index < ResourceId.MAX_PATH_FRAGMENT; index = index + 2) { - String resourceParent = PathsHelper.getParentByIndex(resourceAddress, index); - if (resourceParent == null) - break; - resourceToken = getResourceToken(resourceTokensMap, resourceParent, partitionKey); - if (resourceToken != null) - break; - } - - // Get or Head for collection can be done with any child token - if (resourceToken == null && PathsHelper.getCollectionPath(resourceAddress).equalsIgnoreCase(resourceAddress) - && HttpConstants.HttpMethods.GET.equalsIgnoreCase(requestVerb) - || HttpConstants.HttpMethods.HEAD.equalsIgnoreCase(requestVerb)) { - String resourceAddressWithSlash = resourceAddress.endsWith(Constants.Properties.PATH_SEPARATOR) - ? resourceAddress - : resourceAddress + Constants.Properties.PATH_SEPARATOR; - for (String key : resourceTokensMap.keySet()) { - if (key.startsWith(resourceAddressWithSlash)) { - if (resourceTokensMap.get(key) != null && resourceTokensMap.get(key).size() > 0) - resourceToken = resourceTokensMap.get(key).get(0).getResourceToken(); - break; - } - } - } - - if (resourceToken == null) { - throw new IllegalArgumentException(RMResources.ResourceTokenNotFound); - } - - logger.debug("returned token for resourceAddress [{}] = [{}]", - resourceAddress, resourceToken); - return resourceToken; - } else { - String resourceToken = null; - ResourceId resourceId = ResourceId.parse(resourceAddress); - if (resourceId.getAttachment() != 0 || resourceId.getPermission() != 0 - || resourceId.getStoredProcedure() != 0 || resourceId.getTrigger() != 0 - || resourceId.getUserDefinedFunction() != 0) { - // Use the leaf ID - attachment/permission/sproc/trigger/udf - resourceToken = getResourceToken(resourceTokensMap, resourceAddress, partitionKey); - } - - if (resourceToken == null && (resourceId.getAttachment() != 0 || resourceId.getDocument() != 0)) { - // Use DocumentID for attachment/document - resourceToken = getResourceToken(resourceTokensMap, resourceId.getDocumentId().toString(), - partitionKey); - } - - if (resourceToken == null && (resourceId.getAttachment() != 0 || resourceId.getDocument() != 0 - || resourceId.getStoredProcedure() != 0 || resourceId.getTrigger() != 0 - || resourceId.getUserDefinedFunction() != 0 || resourceId.getDocumentCollection() != 0)) { - // Use CollectionID for attachment/document/sproc/trigger/udf/collection - resourceToken = getResourceToken(resourceTokensMap, resourceId.getDocumentCollectionId().toString(), - partitionKey); - } - - if (resourceToken == null && (resourceId.getPermission() != 0 || resourceId.getUser() != 0)) { - // Use UserID for permission/user - resourceToken = getResourceToken(resourceTokensMap, resourceId.getUserId().toString(), partitionKey); - } - - if (resourceToken == null) { - // Use DatabaseId if all else fail - resourceToken = getResourceToken(resourceTokensMap, resourceId.getDatabaseId().toString(), - partitionKey); - } - // Get or Head for collection can be done with any child token - if (resourceToken == null && resourceId.getDocumentCollection() != 0 - && (HttpConstants.HttpMethods.GET.equalsIgnoreCase(requestVerb) - || HttpConstants.HttpMethods.HEAD.equalsIgnoreCase(requestVerb))) { - for (String key : resourceTokensMap.keySet()) { - ResourceId tokenRid; - Pair pair = ResourceId.tryParse(key); - ResourceId test1= pair.getRight().getDocumentCollectionId(); - boolean test = test1.equals(resourceId); - if (!PathsHelper.isNameBased(key) && pair.getLeft() - && pair.getRight().getDocumentCollectionId().equals(resourceId)) { - if (resourceTokensMap.get(key) != null && resourceTokensMap.get(key).size() > 0) { - resourceToken = resourceTokensMap.get(key).get(0).getResourceToken(); - } - } - } - - } - - if (resourceToken == null) { - throw new IllegalArgumentException(RMResources.ResourceTokenNotFound); - } - - logger.debug("returned token for resourceAddress [{}] = [{}]", - resourceAddress, resourceToken); - return resourceToken; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceType.java deleted file mode 100644 index cf6a2f609487..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceType.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Resource types in the Azure Cosmos DB database service. - */ -public enum ResourceType { - - // REQUIRED: This enum must be kept in sync with the ResourceType enum in backend native - - Unknown(-1), - Attachment(3), - BatchApply(112), - DocumentCollection(1), - ComputeGatewayCharges(131), - Conflict(107), - Database(0), - DatabaseAccount(118), - Document(2), - Index(104), - IndexBookmark(105), - IndexSize(106), - LargeInvalid(100), - LogStoreLogs(126), - MasterPartition(120), - Module(9), - ModuleCommand(103), - Offer(113), - PartitionKeyRange(125), - PartitionSetInformation(114), - Permission(5), - PreviousImage(128), - Progress(6), - Record(108), - Replica(7), - RestoreMetadata(127), - RidRange(130), - Schema(124), - SchemaContainer(123), - ServerPartition(121), - SmallMaxInvalid(10), - StoredProcedure(109), - Timestamp(117), - Tombstone(8), - Topology(122), - Trigger(110), - User(4), - UserDefinedFunction(111), - UserDefinedType(133), - VectorClock(129), - XPReplicatorAddress(115), - - // These names make it unclear what they map to in ResourceType. - Address(-5), - Key(-2), - Media(-3), - ServiceFabricService(-4); - - final private int value; - - ResourceType(int value) { - this.value = value; - } - - public int value() { - return this.value; - } - - public boolean isCollectionChild() { - return this == ResourceType.Document || - this == ResourceType.Attachment || - this == ResourceType.Conflict || - this == ResourceType.Schema || - this.isScript(); - } - - public boolean isMasterResource() { - return this == ResourceType.Offer || - this == ResourceType.Database || - this == ResourceType.User || - this == ResourceType.Permission || - this == ResourceType.Topology || - this == ResourceType.PartitionKeyRange || - this == ResourceType.DocumentCollection; - } - - ///

- /// Resources for which this method returns true, are spread between multiple partitions - /// - public boolean isPartitioned() { - return this == ResourceType.Document || - this == ResourceType.Attachment || - this == ResourceType.Conflict; - } - - public boolean isScript() { - return this == ResourceType.UserDefinedFunction || - this == ResourceType.Trigger || - this == ResourceType.StoredProcedure; - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RuntimeConstants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RuntimeConstants.java deleted file mode 100644 index fe1907cca044..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RuntimeConstants.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Used internally. Runtime constants in the Azure Cosmos DB database service Java SDK. - */ -public class RuntimeConstants { - public static class MediaTypes { - // http://www.iana.org/assignments/media-types/media-types.xhtml - public static final String ANY = "*/*"; - public static final String IMAGE_JPEG = "image/jpeg"; - public static final String IMAGE_PNG = "image/png"; - public static final String JAVA_SCRIPT = "application/x-javascript"; - public static final String JSON = "application/json"; - public static final String OCTET_STREAM = "application/octet-stream"; - public static final String QUERY_JSON = "application/query+json"; - public static final String SQL = "application/sql"; - public static final String TEXT_HTML = "text/html"; - public static final String TEXT_PLAIN = "text/plain"; - public static final String XML = "application/xml"; - } - - public static class ProtocolScheme { - public static final String HTTPS = "https"; - public static final String TCP = "rntbd"; - } - - static class Separators { - static final char[] Url = new char[] {'/'}; - static final char[] Quote = new char[] {'\''}; - static final char[] DomainId = new char[] {'-'}; - static final char[] Query = new char[] {'?', '&', '='}; - static final char[] Parenthesis = new char[] {'(', ')'}; - static final char[] UserAgentHeader = new char[] {'(', ')', ';', ','}; - - - //Note that the accept header separator here is ideally comma. Semicolon is used for separators within individual - //header for now cloud moe does not recognize such accept header hence we allow both semicolon or comma separated - //accept header - static final char[] Header = new char[] {';', ','}; - static final char[] CookieSeparator = new char[] {';'}; - static final char[] CookieValueSeparator = new char[] {'='}; - static final char[] PPMUserToken = new char[] {':'}; - static final char[] Identifier = new char[] {'-'}; - static final char[] Host = new char[] {'.'}; - static final char[] Version = new char[] {','}; - static final char[] Pair = new char[] {';'}; - static final char[] ETag = new char[] {'#'}; - static final char[] MemberQuery = new char[] {'+'}; - - static final String HeaderEncodingBegin = "=?"; - static final String HeaderEncodingEnd = "?="; - static final String HeaderEncodingSeparator = "?"; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Utils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Utils.java deleted file mode 100644 index 821e25392566..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Utils.java +++ /dev/null @@ -1,438 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLEncoder; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Base64; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.uuid.EthernetAddress; -import com.fasterxml.uuid.Generators; -import com.fasterxml.uuid.impl.TimeBasedGenerator; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentCollection; - -/** - * Used internally to provides utility functions for the Azure Cosmos DB database service Java SDK. - */ -public final class Utils { - private static final ZoneId GMT_ZONE_ID = ZoneId.of("GMT"); - public static final Base64.Encoder Base64Encoder = Base64.getEncoder(); - public static final Base64.Decoder Base64Decoder = Base64.getDecoder(); - - private static final ObjectMapper simpleObjectMapper = new ObjectMapper(); - private static final TimeBasedGenerator TimeUUIDGegerator = - Generators.timeBasedGenerator(EthernetAddress.constructMulticastAddress()); - - // NOTE DateTimeFormatter.RFC_1123_DATE_TIME cannot be used. - // because cosmos db rfc1123 validation requires two digits for day. - // so Thu, 04 Jan 2018 00:30:37 GMT is accepted by the cosmos db service, - // but Thu, 4 Jan 2018 00:30:37 GMT is not. - // Therefore, we need a custom date time formatter. - private static final DateTimeFormatter RFC_1123_DATE_TIME = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US); - - static { - Utils.simpleObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - Utils.simpleObjectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - Utils.simpleObjectMapper.configure(JsonParser.Feature.ALLOW_TRAILING_COMMA, true); - Utils.simpleObjectMapper.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); - } - - public static byte[] getUTF8Bytes(String str) throws UnsupportedEncodingException { - return str.getBytes("UTF-8"); - } - - public static String encodeBase64String(byte[] binaryData) { - String encodedString = Base64Encoder.encodeToString(binaryData); - - if (encodedString.endsWith("\r\n")) { - encodedString = encodedString.substring(0, encodedString.length() - 2); - } - return encodedString; - } - - /** - * Checks whether the specified link is Name based or not - * - * @param link the link to analyze. - * @return true or false - */ - public static boolean isNameBased(String link) { - if (StringUtils.isEmpty(link)) { - return false; - } - - // trimming the leading "/" - if (link.startsWith("/") && link.length() > 1) { - link = link.substring(1); - } - - // Splitting the link(separated by "/") into parts - String[] parts = StringUtils.split(link, "/"); - - // First part should be "dbs" - if (parts.length == 0 || StringUtils.isEmpty(parts[0]) - || !parts[0].equalsIgnoreCase(Paths.DATABASES_PATH_SEGMENT)) { - return false; - } - - // The second part is the database id(ResourceID or Name) and cannot be - // empty - if (parts.length < 2 || StringUtils.isEmpty(parts[1])) { - return false; - } - - // Either ResourceID or database name - String databaseID = parts[1]; - - // Length of databaseID(in case of ResourceID) is always 8 - if (databaseID.length() != 8) { - return true; - } - - // Decoding the databaseID - byte[] buffer = ResourceId.fromBase64String(databaseID); - - // Length of decoded buffer(in case of ResourceID) is always 4 - if (buffer.length != 4) { - return true; - } - - return false; - } - - /** - * Checks whether the specified link is a Database Self Link or a Database - * ID based link - * - * @param link the link to analyze. - * @return true or false - */ - public static boolean isDatabaseLink(String link) { - if (StringUtils.isEmpty(link)) { - return false; - } - - // trimming the leading and trailing "/" from the input string - link = trimBeginningAndEndingSlashes(link); - - // Splitting the link(separated by "/") into parts - String[] parts = StringUtils.split(link, "/"); - - if (parts.length != 2) { - return false; - } - - // First part should be "dbs" - if (StringUtils.isEmpty(parts[0]) || !parts[0].equalsIgnoreCase(Paths.DATABASES_PATH_SEGMENT)) { - return false; - } - - // The second part is the database id(ResourceID or Name) and cannot be - // empty - if (StringUtils.isEmpty(parts[1])) { - return false; - } - - return true; - } - - /** - * Checks whether the specified path segment is a resource type - * - * @param resourcePathSegment the path segment to analyze. - * @return true or false - */ - public static boolean IsResourceType(String resourcePathSegment) { - if (StringUtils.isEmpty(resourcePathSegment)) { - return false; - } - - switch (resourcePathSegment.toLowerCase()) { - case Paths.ATTACHMENTS_PATH_SEGMENT: - case Paths.COLLECTIONS_PATH_SEGMENT: - case Paths.DATABASES_PATH_SEGMENT: - case Paths.PERMISSIONS_PATH_SEGMENT: - case Paths.USERS_PATH_SEGMENT: - case Paths.DOCUMENTS_PATH_SEGMENT: - case Paths.STORED_PROCEDURES_PATH_SEGMENT: - case Paths.TRIGGERS_PATH_SEGMENT: - case Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT: - case Paths.CONFLICTS_PATH_SEGMENT: - case Paths.PARTITION_KEY_RANGES_PATH_SEGMENT: - return true; - - default: - return false; - } - } - - /** - * Joins the specified paths by appropriately padding them with '/' - * - * @param path1 the first path segment to join. - * @param path2 the second path segment to join. - * @return the concatenated path with '/' - */ - public static String joinPath(String path1, String path2) { - path1 = trimBeginningAndEndingSlashes(path1); - String result = "/" + path1 + "/"; - - if (!StringUtils.isEmpty(path2)) { - path2 = trimBeginningAndEndingSlashes(path2); - result += path2 + "/"; - } - - return result; - } - - /** - * Trims the beginning and ending '/' from the given path - * - * @param path the path to trim for beginning and ending slashes - * @return the path without beginning and ending '/' - */ - public static String trimBeginningAndEndingSlashes(String path) { - if(path == null) { - return null; - } - - if (path.startsWith("/")) { - path = path.substring(1); - } - - if (path.endsWith("/")) { - path = path.substring(0, path.length() - 1); - } - - return path; - } - - public static Map paramEncode(Map queryParams) { - // TODO: this is not performant revisit - HashMap map = new HashMap<>(); - for(Map.Entry paramEntry: queryParams.entrySet()) { - try { - map.put(paramEntry.getKey(), URLEncoder.encode(paramEntry.getValue(), "UTF-8")); - } catch (UnsupportedEncodingException e) { - throw new IllegalStateException(e); - } - } - return map; - } - - public static String createQuery(Map queryParameters) { - if (queryParameters == null) - return ""; - StringBuilder queryString = new StringBuilder(); - for (Map.Entry nameValuePair : queryParameters.entrySet()) { - String key = nameValuePair.getKey(); - String value = nameValuePair.getValue(); - if (key != null && !key.isEmpty()) { - if (queryString.length() > 0) { - queryString.append(RuntimeConstants.Separators.Query[1]); - } - queryString.append(key); - if (value != null) { - queryString.append(RuntimeConstants.Separators.Query[2]); - queryString.append(value); - } - } - } - return queryString.toString(); - } - - public static URL setQuery(String urlString, String query) { - - if (urlString == null) - throw new IllegalStateException("urlString parameter can't be null."); - query = Utils.removeLeadingQuestionMark(query); - try { - if (query != null && !query.isEmpty()) { - return new URI(Utils.addTrailingSlash(urlString) + RuntimeConstants.Separators.Query[0] + query) - .toURL(); - } else { - return new URI(Utils.addTrailingSlash(urlString)).toURL(); - } - } catch (MalformedURLException e) { - throw new IllegalStateException("Uri is invalid: ", e); - } catch (URISyntaxException e) { - throw new IllegalStateException("Uri is invalid: ", e); - } - } - - /** - * Given the full path to a resource, extract the collection path. - * - * @param resourceFullName the full path to the resource. - * @return the path of the collection in which the resource is. - */ - public static String getCollectionName(String resourceFullName) { - if (resourceFullName != null) { - resourceFullName = Utils.trimBeginningAndEndingSlashes(resourceFullName); - - int slashCount = 0; - for (int i = 0; i < resourceFullName.length(); i++) { - if (resourceFullName.charAt(i) == '/') { - slashCount++; - if (slashCount == 4) { - return resourceFullName.substring(0, i); - } - } - } - } - return resourceFullName; - } - - public static Boolean isCollectionPartitioned(DocumentCollection collection) { - if (collection == null) { - throw new IllegalArgumentException("collection"); - } - - return collection.getPartitionKey() != null - && collection.getPartitionKey().getPaths() != null - && collection.getPartitionKey().getPaths().size() > 0; - } - - public static boolean isCollectionChild(ResourceType type) { - return type == ResourceType.Document || type == ResourceType.Attachment || type == ResourceType.Conflict - || type == ResourceType.StoredProcedure || type == ResourceType.Trigger || type == ResourceType.UserDefinedFunction; - } - - public static boolean isWriteOperation(OperationType operationType) { - return operationType == OperationType.Create || operationType == OperationType.Upsert || operationType == OperationType.Delete || operationType == OperationType.Replace - || operationType == OperationType.ExecuteJavaScript; - } - - public static boolean isFeedRequest(OperationType requestOperationType) { - return requestOperationType == OperationType.Create || - requestOperationType == OperationType.Upsert || - requestOperationType == OperationType.ReadFeed || - requestOperationType == OperationType.Query || - requestOperationType == OperationType.SqlQuery || - requestOperationType == OperationType.HeadFeed; - } - - private static String addTrailingSlash(String path) { - if (path == null || path.isEmpty()) - path = new String(RuntimeConstants.Separators.Url); - else if (path.charAt(path.length() - 1) != RuntimeConstants.Separators.Url[0]) - path = path + RuntimeConstants.Separators.Url[0]; - - return path; - } - - private static String removeLeadingQuestionMark(String path) { - if (path == null || path.isEmpty()) - return path; - - if (path.charAt(0) == RuntimeConstants.Separators.Query[0]) - return path.substring(1); - - return path; - } - - public static boolean isValidConsistency(ConsistencyLevel backendConsistency, - ConsistencyLevel desiredConsistency) { - switch (backendConsistency) { - case Strong: - return desiredConsistency == ConsistencyLevel.Strong || - desiredConsistency == ConsistencyLevel.BoundedStaleness || - desiredConsistency == ConsistencyLevel.Session || - desiredConsistency == ConsistencyLevel.Eventual || - desiredConsistency == ConsistencyLevel.ConsistentPrefix; - - case BoundedStaleness: - return desiredConsistency == ConsistencyLevel.BoundedStaleness || - desiredConsistency == ConsistencyLevel.Session || - desiredConsistency == ConsistencyLevel.Eventual || - desiredConsistency == ConsistencyLevel.ConsistentPrefix; - - case Session: - case Eventual: - case ConsistentPrefix: - return desiredConsistency == ConsistencyLevel.Session || - desiredConsistency == ConsistencyLevel.Eventual || - desiredConsistency == ConsistencyLevel.ConsistentPrefix; - - default: - throw new IllegalArgumentException("backendConsistency"); - } - } - - public static String getUserAgent(String sdkName, String sdkVersion) { - String osName = System.getProperty("os.name"); - if (osName == null) { - osName = "Unknown"; - } - osName = osName.replaceAll("\\s", ""); - String userAgent = String.format("%s/%s JRE/%s %s/%s", - osName, - System.getProperty("os.version"), - System.getProperty("java.version"), - sdkName, - sdkVersion); - return userAgent; - } - - public static ObjectMapper getSimpleObjectMapper() { - return Utils.simpleObjectMapper; - } - - /** - * Returns Current Time in RFC 1123 format, e.g, - * Fri, 01 Dec 2017 19:22:30 GMT. - * - * @return an instance of String - */ - public static String nowAsRFC1123() { - ZonedDateTime now = ZonedDateTime.now(GMT_ZONE_ID); - return Utils.RFC_1123_DATE_TIME.format(now); - } - - public static UUID randomUUID() { - return TimeUUIDGegerator.generate(); - } - - public static String zonedDateTimeAsUTCRFC1123(ZonedDateTime zonedDateTime){ - return Utils.RFC_1123_DATE_TIME.format(zonedDateTime.withZoneSameInstant(GMT_ZONE_ID)); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Address.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Address.java deleted file mode 100644 index ac09a6669e5d..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Address.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Used internally to represent a physical address in the Azure Cosmos DB database service. - */ -public class Address extends Resource { - /** - * Initialize an offer object. - */ - public Address() { - super(); - } - - /** - * Initialize an address object from json string. - * - * @param jsonString the json string that represents the address. - */ - public Address(String jsonString) { - super(jsonString); - } - - public boolean IsPrimary() { - return super.getBoolean(Constants.Properties.IS_PRIMARY); - } - - void setIsPrimary(boolean isPrimary) { - super.set(Constants.Properties.IS_PRIMARY, isPrimary); - } - - public String getProtocolScheme() { - return super.getString(Constants.Properties.PROTOCOL); - } - - void setProtocol(String protocol) { - super.set(Constants.Properties.PROTOCOL, protocol); - } - - public String getLogicalUri() { - return super.getString(Constants.Properties.LOGICAL_URI); - } - - void setLogicalUri(String logicalUri) { - super.set(Constants.Properties.LOGICAL_URI, logicalUri); - } - - public String getPhyicalUri() { - return super.getString(Constants.Properties.PHYISCAL_URI); - } - - void setPhysicalUri(String phyicalUri) { - super.set(Constants.Properties.PHYISCAL_URI, phyicalUri); - } - - public String getPartitionIndex() { - return super.getString(Constants.Properties.PARTITION_INDEX); - } - - void setPartitionIndex(String partitionIndex) { - super.set(Constants.Properties.PARTITION_INDEX, partitionIndex); - } - - public String getParitionKeyRangeId() { - return super.getString(Constants.Properties.PARTITION_KEY_RANGE_ID); - } - - public void setPartitionKeyRangeId(String partitionKeyRangeId) { - super.set(Constants.Properties.PARTITION_KEY_RANGE_ID, partitionKeyRangeId); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressInformation.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressInformation.java deleted file mode 100644 index 10ecf29854c2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressInformation.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.util.Objects; - -/** - * Used internally to encapsulate a physical address information in the Azure Cosmos DB database service. - */ -public class AddressInformation { - private Protocol protocol; - private boolean isPublic; - private boolean isPrimary; - private String physicalUri; - - public AddressInformation(boolean isPublic, boolean isPrimary, String physicalUri, Protocol protocol) { - Objects.requireNonNull(protocol); - this.protocol = protocol; - this.isPublic = isPublic; - this.isPrimary = isPrimary; - this.physicalUri = physicalUri; - } - - public AddressInformation(boolean isPublic, boolean isPrimary, String physicalUri, String protocolScheme) { - this(isPublic, isPrimary, physicalUri, scheme2protocol(protocolScheme)); - } - - public boolean isPublic() { - return isPublic; - } - - public boolean isPrimary() { - return isPrimary; - } - - public String getPhysicalUri() { - return physicalUri; - } - - public Protocol getProtocol() { - return this.protocol; - } - - public String getProtocolName() { - return this.protocol.name(); - } - - public String getProtocolScheme() { - return this.protocol.scheme(); - } - - @Override - public String toString() { - return "AddressInformation{" + - "protocol='" + protocol + '\'' + - ", isPublic=" + isPublic + - ", isPrimary=" + isPrimary + - ", physicalUri='" + physicalUri + '\'' + - '}'; - } - - private static Protocol scheme2protocol(String scheme) { - - Objects.requireNonNull(scheme, "scheme"); - - switch (scheme.toLowerCase()) { - case "https": - return Protocol.Https; - case "rntbd": - return Protocol.Tcp; - default: - throw new IllegalArgumentException(String.format("scheme: %s", scheme)); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneException.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneException.java deleted file mode 100644 index 04aaaf9cb138..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneException.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -public class GoneException extends DocumentClientException { - - public GoneException(String msg) { - this(msg, null); - } - public GoneException() { - this(RMResources.Gone, (String) null); - } - - public GoneException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.GONE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public GoneException(String message, String requestUri) { - this(message, (Exception) null, new HashMap<>(), requestUri); - } - - public GoneException(String message, - Exception innerException, - URI requestUri, - String localIpAddress) { - this(message(localIpAddress, message), innerException, (HttpResponseHeaders) null, requestUri); - } - - public GoneException(Exception innerException) { - this(RMResources.Gone, innerException, new HashMap<>(), (String) null); - } - - public GoneException(String message, HttpResponseHeaders headers, URI requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.GONE, requestUri != null ? requestUri.toString() : null); - } - - public GoneException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.GONE, requestUri); - } - - public GoneException(String message, - Exception innerException, - HttpResponseHeaders headers, - URI requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.GONE, requestUri != null ? requestUri.toString() : null); - } - - public GoneException(String message, - Exception innerException, - Map headers, - String requestUri) { - super(message, innerException, headers, HttpConstants.StatusCodes.GONE, requestUri); - } - - public GoneException(Error error, Map headers) { - super(HttpConstants.StatusCodes.GONE, error, headers); - } - - private static String message(String localIP, String baseMessage) { - if (!Strings.isNullOrEmpty(localIP)) { - return String.format( - RMResources.ExceptionMessageAddIpAddress, - baseMessage, - localIP); - } - - return baseMessage; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtils.java deleted file mode 100644 index 13bbb27aee3f..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtils.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.Constants.UrlEncodingInfo; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import io.reactivex.netty.protocol.http.client.HttpRequestHeaders; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -public class HttpUtils { - - private static Logger log = LoggerFactory.getLogger(HttpUtils.class); - - public static String urlEncode(String url) { - try { - return URLEncoder.encode(url, UrlEncodingInfo.UTF_8).replaceAll(UrlEncodingInfo.PLUS_SYMBOL_ESCAPED, UrlEncodingInfo.SINGLE_SPACE_URI_ENCODING); - } catch (UnsupportedEncodingException e) { - log.error("failed to encode {}", url, e); - throw new IllegalArgumentException("failed to encode url " + url, e); - } - } - - public static String urlDecode(String url) { - try { - return URLDecoder.decode(url.replaceAll(UrlEncodingInfo.PLUS_SYMBOL_ESCAPED, UrlEncodingInfo.PLUS_SYMBOL_URI_ENCODING), UrlEncodingInfo.UTF_8); - } catch (UnsupportedEncodingException e) { - log.error("failed to decode {}", url, e); - throw new IllegalArgumentException("failed to decode url " + url, e); - } - } - - public static URI toURI(String uri) { - try { - return new URI(uri); - } catch (Exception e) { - log.error("failed to parse {}", uri, e); - throw new IllegalArgumentException("failed to parse uri " + uri, e); - } - } - - public static Map asMap(HttpResponseHeaders headers) { - if (headers == null) { - return new HashMap<>(); - } - - HashMap map = new HashMap<>(headers.names().size()); - for (Entry entry : headers.entries()) { - if (entry.getKey().equals(HttpConstants.HttpHeaders.OWNER_FULL_NAME)) { - map.put(entry.getKey(), HttpUtils.urlDecode(entry.getValue())); - } else { - map.put(entry.getKey(), entry.getValue()); - } - } - return map; - } - - public static Map asMap(HttpRequestHeaders headers) { - HashMap map = new HashMap<>(); - if (headers == null) { - return map; - } - for (Entry entry : headers.entries()) { - map.put(entry.getKey(), entry.getValue()); - } - return map; - } - - public static String getDateHeader(Map headerValues) { - if (headerValues == null) { - return StringUtils.EMPTY; - } - - // Since Date header is overridden by some proxies/http client libraries, we support - // an additional date header 'x-ms-date' and prefer that to the regular 'date' header. - String date = headerValues.get(HttpConstants.HttpHeaders.X_DATE); - if (Strings.isNullOrEmpty(date)) { - date = headerValues.get(HttpConstants.HttpHeaders.HTTP_DATE); - } - - return date != null ? date : StringUtils.EMPTY; - } - - public static List> unescape(List> headers) { - List> result = new ArrayList>(); - for (Entry entry : headers) { - if (entry.getKey().equals(HttpConstants.HttpHeaders.OWNER_FULL_NAME)) { - String unescapedUrl = HttpUtils.urlDecode(entry.getValue()); - entry = new AbstractMap.SimpleEntry(entry.getKey(), unescapedUrl); - } - result.add(entry); - } - return result; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Protocol.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Protocol.java deleted file mode 100644 index 5f5c1d7ef6a2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Protocol.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -public enum Protocol { - Https, Tcp; - - String scheme() { - switch (this) { - case Https: - return "https"; - case Tcp: - return "rntbd"; - default: - throw new IllegalStateException(); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestTimeoutException.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestTimeoutException.java deleted file mode 100644 index 836d4b3935dc..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestTimeoutException.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class RequestTimeoutException extends DocumentClientException { - - public RequestTimeoutException() { - this(RMResources.RequestTimeout, null); - } - - public RequestTimeoutException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.REQUEST_TIMEOUT, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public RequestTimeoutException(String message, URI requestUri) { - this(message, (Exception) null, (HttpResponseHeaders) null, requestUri); - } - - public RequestTimeoutException(String message, - Exception innerException, - URI requestUri, - String localIpAddress) { - this(message(localIpAddress, message), innerException, (HttpResponseHeaders) null, requestUri); - } - - public RequestTimeoutException(Exception innerException) { - this(RMResources.Gone, innerException, (HttpResponseHeaders) null, null); - } - - public RequestTimeoutException(String message, HttpResponseHeaders headers, URI requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.REQUEST_TIMEOUT, requestUri != null ? requestUri.toString() : null); - } - - public RequestTimeoutException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.REQUEST_TIMEOUT, requestUri); - } - - public RequestTimeoutException(String message, - Exception innerException, - HttpResponseHeaders headers, - URI requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.REQUEST_TIMEOUT, requestUri != null ? requestUri.toString() : null); - } - - private static String message(String localIP, String baseMessage) { - if (!Strings.isNullOrEmpty(localIP)) { - return String.format( - RMResources.ExceptionMessageAddIpAddress, - baseMessage, - localIP); - } - - return baseMessage; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponse.java deleted file mode 100644 index 816918cc7512..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponse.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.InputStream; -import java.util.List; -import java.util.Map.Entry; - -/** - * Used internally to represents a response from the store. - */ -public class StoreResponse { - final static Logger LOGGER = LoggerFactory.getLogger(StoreResponse.class); - final private int status; - final private String[] responseHeaderNames; - final private String[] responseHeaderValues; - final private InputStream httpEntityStream; - final private String content; - - private ClientSideRequestStatistics clientSideRequestStatistics; - - public StoreResponse(int status, List> headerEntries, InputStream inputStream) { - this(status, headerEntries, null, inputStream); - } - - public StoreResponse(int status, List> headerEntries, String content) { - this(status, headerEntries, content, null); - } - - private StoreResponse( - int status, - List> headerEntries, - String content, - InputStream inputStream) { - responseHeaderNames = new String[headerEntries.size()]; - responseHeaderValues = new String[headerEntries.size()]; - - int i = 0; - - for(Entry headerEntry: headerEntries) { - responseHeaderNames[i] = headerEntry.getKey(); - responseHeaderValues[i] = headerEntry.getValue(); - i++; - } - - this.status = status; - - this.content = content; - this.httpEntityStream = inputStream; - } - - public int getStatus() { - return status; - } - - public String[] getResponseHeaderNames() { - return responseHeaderNames; - } - - public String[] getResponseHeaderValues() { - return responseHeaderValues; - } - - public String getResponseBody() { - return this.content; - } - - public InputStream getResponseStream() { - // Some operation type doesn't have a response stream so this can be null - return this.httpEntityStream; - } - - public long getLSN() { - String lsnString = this.getHeaderValue(WFConstants.BackendHeaders.LSN); - if (StringUtils.isNotEmpty(lsnString)) { - return Long.parseLong(lsnString); - } - - return -1; - } - - public String getPartitionKeyRangeId() { - return this.getHeaderValue(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID); - } - - public String getContinuation() { - return this.getHeaderValue(HttpConstants.HttpHeaders.CONTINUATION); - } - - public String getHeaderValue(String attribute) { - if (this.responseHeaderValues == null || this.responseHeaderNames.length != this.responseHeaderValues.length) { - return null; - } - - for (int i = 0; i < responseHeaderNames.length; i++) { - if (responseHeaderNames[i].equalsIgnoreCase(attribute)) { - return responseHeaderValues[i]; - } - } - - return null; - } - - public ClientSideRequestStatistics getClientSideRequestStatistics() { - return clientSideRequestStatistics; - } - - public void setClientSideRequestStatistics(ClientSideRequestStatistics clientSideRequestStatistics) { - this.clientSideRequestStatistics = clientSideRequestStatistics; - } - - int getSubStatusCode() { - int subStatusCode = HttpConstants.SubStatusCodes.UNKNOWN; - String subStatusCodeString = this.getHeaderValue(WFConstants.BackendHeaders.SUB_STATUS); - if (StringUtils.isNotEmpty(subStatusCodeString)) { - try { - subStatusCode = Integer.parseInt(subStatusCodeString); - } catch (NumberFormatException e) { - // If value cannot be parsed as Integer, return Unknown. - } - } - return subStatusCode; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResult.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResult.java deleted file mode 100644 index 9dbb0d416052..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResult.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URI; - -public class StoreResult { - private final static Logger logger = LoggerFactory.getLogger(StoreResult.class); - - private final StoreResponse storeResponse; - private final DocumentClientException exception; - - final public long lsn; - final public String partitionKeyRangeId; - final public long quorumAckedLSN; - final public long globalCommittedLSN; - final public long numberOfReadRegions; - final public long itemLSN; - final public ISessionToken sessionToken; - final public double requestCharge; - final public int currentReplicaSetSize; - final public int currentWriteQuorum; - final public boolean isValid; - final public boolean isGoneException; - final public boolean isNotFoundException; - final public boolean isInvalidPartitionException; - final public URI storePhysicalAddress; - - public StoreResult( - StoreResponse storeResponse, - DocumentClientException exception, - String partitionKeyRangeId, - long lsn, - long quorumAckedLsn, - double requestCharge, - int currentReplicaSetSize, - int currentWriteQuorum, - boolean isValid, - URI storePhysicalAddress, - long globalCommittedLSN, - int numberOfReadRegions, - long itemLSN, - ISessionToken sessionToken) { - this.storeResponse = storeResponse; - this.exception = exception; - this.partitionKeyRangeId = partitionKeyRangeId; - this.lsn = lsn; - this.quorumAckedLSN = quorumAckedLsn; - this.requestCharge = requestCharge; - this.currentReplicaSetSize = currentReplicaSetSize; - this.currentWriteQuorum = currentWriteQuorum; - this.isValid = isValid; - this.isGoneException = this.exception != null && this.exception.getStatusCode() == HttpConstants.StatusCodes.GONE; - this.isNotFoundException = this.exception != null && this.exception.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND; - this.isInvalidPartitionException = this.exception != null - && Exceptions.isNameCacheStale(this.exception); - this.storePhysicalAddress = storePhysicalAddress; - this.globalCommittedLSN = globalCommittedLSN; - this.numberOfReadRegions = numberOfReadRegions; - this.itemLSN = itemLSN; - this.sessionToken = sessionToken; - } - - public DocumentClientException getException() throws InternalServerErrorException { - if (this.exception == null) { - String message = "Exception should be available but found none"; - assert false : message; - logger.error(message); - throw new InternalServerErrorException(RMResources.InternalServerError); - } - - return exception; - } - - public StoreResponse toResponse() throws DocumentClientException { - return toResponse(null); - } - - public StoreResponse toResponse(RequestChargeTracker requestChargeTracker) throws DocumentClientException { - if (!this.isValid) { - if (this.exception == null) { - logger.error("Exception not set for invalid response"); - throw new InternalServerErrorException(RMResources.InternalServerError); - } - - throw this.exception; - } - - if (requestChargeTracker != null && this.isValid) { - StoreResult.setRequestCharge(this.storeResponse, this.exception, requestChargeTracker.getTotalRequestCharge()); - } - - if (this.exception != null) { - throw exception; - } - - return this.storeResponse; - } - - private static void setRequestCharge(StoreResponse response, DocumentClientException documentClientException, double totalRequestCharge) { - if (documentClientException != null) { - documentClientException.getResponseHeaders().put(HttpConstants.HttpHeaders.REQUEST_CHARGE, - Double.toString(totalRequestCharge)); - } - // Set total charge as final charge for the response. - else if (response.getResponseHeaderNames() != null) { - for (int i = 0; i < response.getResponseHeaderNames().length; ++i) { - if (Strings.areEqualIgnoreCase( - response.getResponseHeaderNames()[i], - HttpConstants.HttpHeaders.REQUEST_CHARGE)) { - response.getResponseHeaderValues()[i] = Double.toString(totalRequestCharge); - break; - } - } - } - } - - @Override - public String toString() { - int statusCode = 0; - int subStatusCode = HttpConstants.SubStatusCodes.UNKNOWN; - - if (this.storeResponse != null) { - statusCode = this.storeResponse.getStatus(); - subStatusCode = this.storeResponse.getSubStatusCode(); - } else if (this.exception != null) { - statusCode = this.exception.getStatusCode(); - subStatusCode = this.exception.getSubStatusCode(); - } - - return "storePhysicalAddress: " + this.storePhysicalAddress + - ", lsn: " + this.lsn + - ", globalCommittedLsn: " + this.globalCommittedLSN + - ", partitionKeyRangeId: " + this.partitionKeyRangeId + - ", isValid: " + this.isValid + - ", statusCode: " + statusCode + - ", subStatusCode: " + subStatusCode + - ", isGone: " + this.isGoneException + - ", isNotFound: " + this.isNotFoundException + - ", isInvalidPartition: " + this.isInvalidPartitionException + - ", requestCharge: " + this.requestCharge + - ", itemLSN: " + this.itemLSN + - ", sessionToken: " + (this.sessionToken != null ? this.sessionToken.convertToString() : null) + - ", exception: " + BridgeInternal.getInnerErrorMessage(this.exception); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelper.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelper.java deleted file mode 100644 index c870d8cf6ed9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelper.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.time.Duration; -import java.time.Instant; - -public class TimeoutHelper { - private final Instant startTime; - private final Duration timeOut; - - public TimeoutHelper(Duration timeOut) { - this.startTime = Instant.now(); - this.timeOut = timeOut; - } - - public boolean isElapsed() { - Duration elapsed = Duration.ofMillis(Instant.now().toEpochMilli() - startTime.toEpochMilli()); - return elapsed.compareTo(this.timeOut) >= 0; - } - - public Duration getRemainingTime() { - Duration elapsed = Duration.ofMillis(Instant.now().toEpochMilli() - startTime.toEpochMilli()); - return this.timeOut.minus(elapsed); - } - - public void throwTimeoutIfElapsed() throws RequestTimeoutException { - if (this.isElapsed()) { - throw new RequestTimeoutException(); - } - } - - public void throwGoneIfElapsed() throws GoneException { - if (this.isElapsed()) { - throw new GoneException(); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WFConstants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WFConstants.java deleted file mode 100644 index 9d177fbffae8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WFConstants.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -public class WFConstants { - public static class BackendHeaders { - public static final String RESOURCE_ID = "x-docdb-resource-id"; - public static final String OWNER_ID = "x-docdb-owner-id"; - public static final String ENTITY_ID = "x-docdb-entity-id"; - public static final String DATABASE_ENTITY_MAX_COUNT = "x-ms-database-entity-max-count"; - public static final String DATABASE_ENTITY_CURRENT_COUNT = "x-ms-database-entity-current-count"; - public static final String COLLECTION_ENTITY_MAX_COUNT = "x-ms-collection-entity-max-count"; - public static final String COLLECTION_ENTITY_CURRENT_COUNT = "x-ms-collection-entity-current-count"; - public static final String USER_ENTITY_MAX_COUNT = "x-ms-user-entity-max-count"; - public static final String USER_ENTITY_CURRENT_COUNT = "x-ms-user-entity-current-count"; - public static final String PERMISSION_ENTITY_MAX_COUNT = "x-ms-permission-entity-max-count"; - public static final String PERMISSION_ENTITY_CURRENT_COUNT = "x-ms-permission-entity-current-count"; - public static final String ROOT_ENTITY_MAX_COUNT = "x-ms-root-entity-max-count"; - public static final String ROOT_ENTITY_CURRENT_COUNT = "x-ms-root-entity-current-count"; - public static final String RESOURCE_SCHEMA_NAME = "x-ms-resource-schema-name"; - public static final String LSN = "lsn"; - public static final String QUORUM_ACKED_LSN = "x-ms-quorum-acked-lsn"; - public static final String QUORUM_ACKED_LLSN = "x-ms-cosmos-quorum-acked-llsn"; - public static final String CURRENT_WRITE_QUORUM = "x-ms-current-write-quorum"; - public static final String CURRENT_REPLICA_SET_SIZE = "x-ms-current-replica-set-size"; - public static final String COLLECTION_PARTITION_INDEX = "collection-partition-index"; - public static final String COLLECTION_SERVICE_INDEX = "collection-service-index"; - public static final String STATUS = "Status"; - public static final String ACTIVITY_ID = "ActivityId"; - public static final String IS_FANOUT_REQUEST = "x-ms-is-fanout-request"; - public static final String PRIMARY_MASTER_KEY = "x-ms-primary-master-key"; - public static final String SECONDARY_MASTER_KEY = "x-ms-secondary-master-key"; - public static final String PRIMARY_READONLY_KEY = "x-ms-primary-readonly-key"; - public static final String SECONDARY_READONLY_KEY = "x-ms-secondary-readonly-key"; - public static final String BIND_REPLICA_DIRECTIVE = "x-ms-bind-replica"; - public static final String DATABASE_ACCOUNT_ID = "x-ms-database-account-id"; - public static final String REQUEST_VALIDATION_FAILURE = "x-ms-request-validation-failure"; - public static final String SUB_STATUS = "x-ms-substatus"; - public static final String PARTITION_KEY_RANGE_ID = "x-ms-documentdb-partitionkeyrangeid"; - public static final String BIND_MIN_EFFECTIVE_PARTITION_KEY = "x-ms-documentdb-bindmineffectivepartitionkey"; - public static final String BIND_MAX_EFFECTIVE_PARTITION_KEY = "x-ms-documentdb-bindmaxeffectivepartitionkey"; - public static final String BIND_PARTITION_KEY_RANGE_ID = "x-ms-documentdb-bindpartitionkeyrangeid"; - public static final String BIND_PARTITION_KEY_RANGE_RID_PREFIX = "x-ms-documentdb-bindpartitionkeyrangeridprefix"; - public static final String MINIMUM_ALLOWED_CLIENT_VERSION = "x-ms-documentdb-minimumallowedclientversion"; - public static final String PARTITION_COUNT = "x-ms-documentdb-partitioncount"; - public static final String COLLECTION_RID = "x-ms-documentdb-collection-rid"; - public static final String XP_ROLE = "x-ms-xp-role"; - public static final String HAS_TENTATIVE_WRITES = "x-ms-cosmosdb-has-tentative-writes"; - public static final String IS_RU_PER_MINUTE_USED = "x-ms-documentdb-is-ru-per-minute-used"; - public static final String QUERY_METRICS = "x-ms-documentdb-query-metrics"; - public static final String GLOBAL_COMMITTED_LSN = "x-ms-global-Committed-lsn"; - public static final String NUMBER_OF_READ_REGIONS = "x-ms-number-of-read-regions"; - public static final String OFFER_REPLACE_PENDING = "x-ms-offer-replace-pending"; - public static final String ITEM_LSN = "x-ms-item-lsn"; - public static final String REMOTE_STORAGE_TYPE = "x-ms-remote-storage-type"; - public static final String RESTORE_STATE = "x-ms-restore-state"; - public static final String COLLECTION_SECURITY_IDENTIFIER = "x-ms-collection-security-identifier"; - public static final String RESTORE_PARAMS = "x-ms-restore-params"; - public static final String SHARE_THROUGHPUT = "x-ms-share-throughput"; - public static final String PARTITION_RESOURCE_FILTER = "x-ms-partition-resource-filter"; - public static final String FEDERATION_ID_FOR_AUTH = "x-ms-federation-for-auth"; - public static final String FORCE_QUERY_SCAN = "x-ms-documentdb-force-query-scan"; - public static final String ENABLE_DYNAMIC_RID_RANGE_ALLOCATION = "x-ms-enable-dynamic-rid-range-allocation"; - public static final String EXCLUDE_SYSTEM_PROPERTIES = "x-ms-exclude-system-properties"; - public static final String LOCAL_LSN = "x-ms-cosmos-llsn"; - public static final String QUORUM_ACKED_LOCAL_LSN = "x-ms-cosmos-quorum-acked-llsn"; - public static final String ITEM_LOCAL_LSN = "x-ms-cosmos-item-llsn"; - public static final String BINARY_ID = "x-ms-binary-id"; - public static final String TIME_TO_LIVE_IN_SECONDS = "x-ms-time-to-live-in-seconds"; - public static final String EFFECTIVE_PARTITION_KEY = "x-ms-effective-partition-key"; - public static final String BINARY_PASSTHROUGH_REQUEST = "x-ms-binary-passthrough-request"; - public static final String FANOUT_OPERATION_STATE = "x-ms-fanout-operation-state"; - public static final String CONTENT_SERIALIZATION_FORMAT = "x-ms-documentdb-content-serialization-format"; - public static final String ALLOW_TENTATIVE_WRITES = "x-ms-cosmos-allow-tentative-writes"; - public static final String IS_USER_REQUEST = "x-ms-cosmos-internal-is-user-request"; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/ClientSideMetrics.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/ClientSideMetrics.java deleted file mode 100644 index 8a93a3a16e52..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/ClientSideMetrics.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import org.apache.commons.lang3.tuple.ImmutablePair; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; - -/** - * Client side QueryMetrics - */ -public class ClientSideMetrics { - - public static final ClientSideMetrics ZERO = new ClientSideMetrics( - 0, /* retries*/ - 0, /* requestCharge */ - new ArrayList<>(), /* fetchExecutionRanges */ - new ArrayList<>()); /* partitionSchedulingTimeSpans */ - - private final long retries; - private final double requestCharge; - private final List fetchExecutionRanges; - private final List> partitionSchedulingTimeSpans; - - /** - * Constructor - * - * @param retries The number of retries required to execute the query. - * @param requestCharge The request charge incurred from executing the query. - * @param executionRanges The fetch execution ranges from executing the query. - * @param schedulingTimeSpans The partition scheduling timespans from the query. - */ - public ClientSideMetrics(int retries, double requestCharge, List executionRanges, - List> schedulingTimeSpans) { - if (executionRanges == null || executionRanges.contains(null)) { - throw new NullPointerException("executionRanges"); - } - if (schedulingTimeSpans == null || schedulingTimeSpans.contains(null)) { - throw new NullPointerException("schedulingTimeSpans"); - } - if (retries < 0) { - throw new IllegalArgumentException("retries must not be negative"); - } - if (requestCharge < 0) { - throw new IllegalArgumentException("requestCharge must not be negative"); - } - - this.retries = retries; - this.requestCharge = requestCharge; - this.fetchExecutionRanges = executionRanges; - this.partitionSchedulingTimeSpans = schedulingTimeSpans; - } - - /** - * Gets number of retries in the Azure Cosmos database service - * - * @return the retries - */ - public long getRetries() { - return retries; - } - - /** - * Gets the request charge for this continuation of the query. - * - * @return the requestCharge - */ - public double getRequestCharge() { - return requestCharge; - } - - /** - * create ClientSideMetrics from collection - * - * @param clientSideMetricsCollection - * @return - */ - public static ClientSideMetrics createFromCollection(Collection clientSideMetricsCollection) { - if (clientSideMetricsCollection == null) { - throw new NullPointerException("clientSideMetricsCollection"); - } - - int retries = 0; - double requestCharge = 0; - List fetchExecutionRanges = new ArrayList<>(); - List> partitionSchedulingTimeSpans = new ArrayList<>(); - - for (ClientSideMetrics clientSideQueryMetrics : clientSideMetricsCollection) { - retries += clientSideQueryMetrics.retries; - requestCharge += clientSideQueryMetrics.requestCharge; - fetchExecutionRanges.addAll(clientSideQueryMetrics.fetchExecutionRanges); - partitionSchedulingTimeSpans.addAll(clientSideQueryMetrics.partitionSchedulingTimeSpans); - } - - return new ClientSideMetrics(retries, requestCharge, fetchExecutionRanges, partitionSchedulingTimeSpans); - } - - static double getOrDefault(HashMap metrics, String key) { - Double doubleReference = metrics.get(key); - return doubleReference == null ? 0 : doubleReference; - } - - /** - * Gets the Fetch Execution Ranges for this continuation of the query. - * - * @return the Fetch Execution Ranges for this continuation of the query - */ - public List getFetchExecutionRanges() { - return fetchExecutionRanges; - } - - /** - * Gets the Partition Scheduling TimeSpans for this query. - * - * @return the List of Partition Scheduling TimeSpans for this query - */ - public List> getPartitionSchedulingTimeSpans() { - return partitionSchedulingTimeSpans; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRange.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRange.java deleted file mode 100644 index 30e1e341c26d..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRange.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import java.time.Instant; - -/** - * Stores information about fetch execution - */ -public class FetchExecutionRange { - private final Instant startTime; - private final Instant endTime; - private final String partitionId; - private final long numberOfDocuments; - private final long retryCount; - private final String activityId; - - /** - * Constructor - * - * @param activityId The activityId of the fetch - * @param startTime The start time of the fetch - * @param endTime The end time of the fetch - * @param partitionId The partitionkeyrangeid from which you are fetching for - * @param numberOfDocuments The number of documents that were fetched in the particular execution range - * @param retryCount The number of times we retried for this fetch execution range - */ - FetchExecutionRange(String activityId, Instant startTime, Instant endTime, String partitionId, long numberOfDocuments, long retryCount) { - this.activityId = activityId; - this.startTime = startTime; - this.endTime = endTime; - this.partitionId = partitionId; - this.numberOfDocuments = numberOfDocuments; - this.retryCount = retryCount; - } - - /** - * Gets the start time of the fetch. - * - * @return the start time of the fetch. - */ - public Instant getStartTime() { - return startTime; - } - - /** - * Gets the end time of the fetch. - * - * @return the end time of the fetch. - */ - public Instant getEndTime() { - return endTime; - } - - /** - * Gets the partition id that was fetched from. - * - * @return the partition id that was fetched from. - */ - public String getPartitionId() { - return partitionId; - } - - /** - * Gets the number of documents that where fetched in the particular execution range. - * - * @return the number of documents that where fetched in the particular execution range. - */ - public long getNumberOfDocuments() { - return numberOfDocuments; - } - - /** - * Gets the number of times we retried for this fetch execution range. - * - * @return the number of times we retried for this fetch execution range. - */ - public long getRetryCount() { - return retryCount; - } - - /** - * Gets the activityId of the fetch. - * - * @return the activityId of the fetch. - */ - public String getActivityId() { - return activityId; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRangeAccumulator.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRangeAccumulator.java deleted file mode 100644 index cb67879c01aa..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRangeAccumulator.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import org.apache.commons.lang3.time.StopWatch; - -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * Accumlator that acts as a builder of FetchExecutionRanges - */ -public class FetchExecutionRangeAccumulator { - private final String partitionKeyRangeId; - private final Instant constructionTime; - private final StopWatch stopwatch; - private List fetchExecutionRanges; - private Instant startTime; - private Instant endTime; - private boolean isFetching; - - public FetchExecutionRangeAccumulator(String partitionKeyRangeId) { - this.partitionKeyRangeId = partitionKeyRangeId; - this.constructionTime = Instant.now(); - // This stopwatch is always running and is only used to calculate deltas that are synchronized with the construction time. - this.stopwatch = new StopWatch(); - stopwatch.start(); - this.fetchExecutionRanges = new ArrayList(); - } - - /** - * Gets the FetchExecutionRanges and resets the accumulator. - * - * @return the SchedulingMetricsResult. - */ - public List getExecutionRanges() { - List returnValue = this.fetchExecutionRanges; - this.fetchExecutionRanges = new ArrayList<>(); - return returnValue; - } - - /** - * Updates the most recent start time internally. - */ - public void beginFetchRange() { - if (!this.isFetching) { - // Calculating the start time as the construction time and the stopwatch as a delta. - this.startTime = this.constructionTime.plus(Duration.ofMillis(this.stopwatch.getTime(TimeUnit.MILLISECONDS))); - this.isFetching = true; - } - } - - /** - * Updates the most recent end time internally and constructs a new FetchExecutionRange - * - * @param numberOfDocuments The number of documents that were fetched for this range. - * @param retryCount The number of times we retried for this fetch execution range. - */ - public void endFetchRange(String activityId, long numberOfDocuments, long retryCount) { - if (this.isFetching) { - // Calculating the end time as the construction time and the stopwatch as a delta. - this.endTime = this.constructionTime.plus(Duration.ofMillis(this.stopwatch.getTime(TimeUnit.MILLISECONDS))); - FetchExecutionRange fetchExecutionRange = new FetchExecutionRange( - activityId, - this.startTime, - this.endTime, - this.partitionKeyRangeId, - numberOfDocuments, - retryCount); - this.fetchExecutionRanges.add(fetchExecutionRange); - this.isFetching = false; - } - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsTextWriter.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsTextWriter.java deleted file mode 100644 index 72c6383b0054..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsTextWriter.java +++ /dev/null @@ -1,600 +0,0 @@ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import org.apache.commons.lang3.StringUtils; - -import java.time.Duration; -import java.time.Instant; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.UUID; - -public class QueryMetricsTextWriter extends QueryMetricsWriter { - - private final StringBuilder stringBuilder; - - // QueryMetrics - private static final String ActivityIds = "Activity Ids"; - private static final String RetrievedDocumentCount = "Retrieved Document Count"; - private static final String RetrievedDocumentSize = "Retrieved Document Size"; - private static final String OutputDocumentCount = "Output Document Count"; - private static final String OutputDocumentSize = "Output Document Size"; - private static final String IndexUtilizationText = "Index Utilization"; - private static final String TotalQueryExecutionTime = "Total Query Execution Time"; - - // QueryPreparationTimes - private static final String QueryPreparationTimes = "Query Preparation Times"; - private static final String QueryCompileTime = "Query Compilation Time"; - private static final String LogicalPlanBuildTime = "Logical Plan Build Time"; - private static final String PhysicalPlanBuildTime = "Physical Plan Build Time"; - private static final String QueryOptimizationTime = "Query Optimization Time"; - - // QueryTimes - private static final String QueryEngineTimes = "Query Engine Times"; - private static final String IndexLookupTime = "Index Lookup Time"; - private static final String DocumentLoadTime = "Document Load Time"; - private static final String DocumentWriteTime = "Document Write Time"; - - // RuntimeExecutionTimes - private static final String RuntimeExecutionTimes = "Runtime Execution Times"; - private static final String TotalExecutionTime = "Query Engine Execution Time"; - private static final String SystemFunctionExecuteTime = "System Function Execution Time"; - private static final String UserDefinedFunctionExecutionTime = "User-defined Function Execution Time"; - - // ClientSideQueryMetrics - private static final String ClientSideQueryMetrics = "Client Side Metrics"; - private static final String Retries = "Retry Count"; - private static final String RequestCharge = "Request Charge"; - private static final String FetchExecutionRanges = "Partition Execution Timeline"; - private static final String SchedulingMetrics = "Scheduling Metrics"; - - // Constants for Partition Execution Timeline Table - private static final String StartTimeHeader = "Start Time (UTC)"; - private static final String EndTimeHeader = "End Time (UTC)"; - private static final String DurationHeader = "Duration (ms)"; - private static final String PartitionKeyRangeIdHeader = "Partition Id"; - private static final String NumberOfDocumentsHeader = "Number of Documents"; - private static final String RetryCountHeader = "Retry Count"; - private static final String ActivityIdHeader = "Activity Id"; - - // Constants for Scheduling Metrics Table - private static final String PartitionIdHeader = "Partition Id"; - private static final String ResponseTimeHeader = "Response Time (ms)"; - private static final String RunTimeHeader = "Run Time (ms)"; - private static final String WaitTimeHeader = "Wait Time (ms)"; - private static final String TurnaroundTimeHeader = "Turnaround Time (ms)"; - private static final String NumberOfPreemptionHeader = "Number of Preemptions"; - - // Static for Partition Execution Timeline Table - // private static int MaxDateTimeStringLength = LocalDateTime.MAX.toString().length(); - private static final int MaxDateTimeStringLength = 16; - private static final int StartTimeHeaderLength = Math.max(MaxDateTimeStringLength, StartTimeHeader.length()); - private static final int EndTimeHeaderLength = Math.max(MaxDateTimeStringLength, EndTimeHeader.length()); - private static final int DurationHeaderLength = DurationHeader.length(); - private static final int PartitionKeyRangeIdHeaderLength = PartitionKeyRangeIdHeader.length(); - private static final int NumberOfDocumentsHeaderLength = NumberOfDocumentsHeader.length(); - private static final int RetryCountHeaderLength = RetryCountHeader.length(); - private static final int ActivityIdHeaderLength = UUID.randomUUID().toString().length(); - - private static TextTable.Column[] PartitionExecutionTimelineColumns = new TextTable.Column[] - { - new TextTable.Column(PartitionKeyRangeIdHeader, PartitionKeyRangeIdHeaderLength), - new TextTable.Column(ActivityIdHeader, ActivityIdHeaderLength), - new TextTable.Column(StartTimeHeader, StartTimeHeaderLength), - new TextTable.Column(EndTimeHeader, EndTimeHeaderLength), - new TextTable.Column(DurationHeader, DurationHeaderLength), - new TextTable.Column(NumberOfDocumentsHeader, NumberOfDocumentsHeaderLength), - new TextTable.Column(RetryCountHeader, RetryCountHeaderLength), - }; - - private static TextTable PartitionExecutionTimelineTable = new TextTable(Arrays.asList(PartitionExecutionTimelineColumns)); - - // Static for Scheduling Metrics Table - //private static readonly int MaxTimeSpanStringLength = Math.Max(TimeSpan.MaxValue.TotalMilliseconds.ToString - // ("G17").Length, TurnaroundTimeHeader.Length); - private static final int PartitionIdHeaderLength = PartitionIdHeader.length(); - private static final int ResponseTimeHeaderLength = ResponseTimeHeader.length(); - private static final int RunTimeHeaderLength = RunTimeHeader.length(); - private static final int WaitTimeHeaderLength = WaitTimeHeader.length(); - private static final int TurnaroundTimeHeaderLength = TurnaroundTimeHeader.length(); - private static final int NumberOfPreemptionHeaderLength = NumberOfPreemptionHeader.length(); - - private static TextTable.Column[] SchedulingMetricsColumns = new TextTable.Column[] - { - new TextTable.Column(PartitionIdHeader, PartitionIdHeaderLength), - new TextTable.Column(ResponseTimeHeader, ResponseTimeHeaderLength), - new TextTable.Column(RunTimeHeader, RunTimeHeaderLength), - new TextTable.Column(WaitTimeHeader, WaitTimeHeaderLength), - new TextTable.Column(TurnaroundTimeHeader, TurnaroundTimeHeaderLength), - new TextTable.Column(NumberOfPreemptionHeader, NumberOfPreemptionHeaderLength), - }; - - private static TextTable SchedulingMetricsTable = new TextTable(Arrays.asList(SchedulingMetricsColumns)); - - // FetchExecutionRange state - private String lastFetchPartitionId; - private String lastActivityId; - private Instant lastStartTime; - private Instant lastEndTime; - private long lastFetchDocumentCount; - private long lastFetchRetryCount; - - // PartitionSchedulingTimeSpan state - private String lastSchedulingPartitionId; - private long lastResponseTime; - private long lastRunTime; - private long lastWaitTime; - private long lastTurnaroundTime; - private long lastNumberOfPreemptions; - - static DateTimeFormatter formatter = - DateTimeFormatter.ofPattern("HH:mm:ss:SSSS").withZone(ZoneOffset.UTC); - - public QueryMetricsTextWriter(StringBuilder stringBuilder) { - assert stringBuilder != null; - this.stringBuilder = stringBuilder; - } - - @Override - protected void writeBeforeQueryMetrics() { - // Do Nothing - } - - @Override - protected void writeRetrievedDocumentCount(long retrievedDocumentCount) { - QueryMetricsTextWriter.appendCountToStringBuilder(stringBuilder, - QueryMetricsTextWriter.RetrievedDocumentCount, retrievedDocumentCount, 0); - } - - @Override - protected void writeRetrievedDocumentSize(long retrievedDocumentSize) { - QueryMetricsTextWriter.appendBytesToStringBuilder(stringBuilder, QueryMetricsTextWriter.RetrievedDocumentSize - , retrievedDocumentSize, 0); - } - - @Override - protected void writeOutputDocumentCount(long outputDocumentCount) { - QueryMetricsTextWriter.appendCountToStringBuilder(stringBuilder, QueryMetricsTextWriter.OutputDocumentCount, - outputDocumentCount, 0); - } - - @Override - protected void writeOutputDocumentSize(long outputDocumentSize) { - QueryMetricsTextWriter.appendBytesToStringBuilder(stringBuilder, QueryMetricsTextWriter.OutputDocumentSize, - outputDocumentSize, 0); - } - - @Override - protected void writeIndexHitRatio(double indexHitRatio) { - QueryMetricsTextWriter.appendPercentageToStringBuilder(stringBuilder, QueryMetricsTextWriter.IndexUtilizationText - , indexHitRatio, 0); - } - - @Override - protected void writeTotalQueryExecutionTime(Duration totalQueryExecutionTime) { - QueryMetricsTextWriter.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.TotalQueryExecutionTime, durationToMilliseconds(totalQueryExecutionTime), 0); - } - - @Override - protected void writeBeforeQueryPreparationTimes() { - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, - QueryMetricsTextWriter.QueryPreparationTimes, 1); - } - - @Override - protected void writeQueryCompilationTime(Duration queryCompilationTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.QueryCompileTime, durationToMilliseconds(queryCompilationTime), 2); - } - - @Override - protected void writeLogicalPlanBuildTime(Duration logicalPlanBuildTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.LogicalPlanBuildTime, durationToMilliseconds(logicalPlanBuildTime), 2); - } - - @Override - protected void writePhysicalPlanBuildTime(Duration physicalPlanBuildTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.PhysicalPlanBuildTime, durationToMilliseconds(physicalPlanBuildTime), 2); - } - - @Override - protected void writeQueryOptimizationTime(Duration queryOptimizationTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.QueryOptimizationTime, durationToMilliseconds(queryOptimizationTime), 2); - } - - @Override - protected void writeAfterQueryPreparationTimes() { - // Do Nothing - } - - @Override - protected void writeIndexLookupTime(Duration indexLookupTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.IndexLookupTime, durationToMilliseconds(indexLookupTime), 1); - } - - @Override - protected void writeDocumentLoadTime(Duration documentLoadTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.DocumentLoadTime, durationToMilliseconds(documentLoadTime), 1); - } - - @Override - protected void writeVMExecutionTime(Duration vMExecutionTime) { - // Do Nothing - } - - @Override - protected void writeBeforeRuntimeExecutionTimes() { - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, - QueryMetricsTextWriter.RuntimeExecutionTimes, 1); - } - - @Override - protected void writeQueryEngineExecutionTime(Duration queryEngineExecutionTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.QueryEngineTimes, durationToMilliseconds(queryEngineExecutionTime), 2); - } - - @Override - protected void writeSystemFunctionExecutionTime(Duration systemFunctionExecutionTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.SystemFunctionExecuteTime, durationToMilliseconds(systemFunctionExecutionTime) - , 2); - } - - @Override - protected void writeUserDefinedFunctionExecutionTime(Duration userDefinedFunctionExecutionTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.UserDefinedFunctionExecutionTime, - durationToMilliseconds(userDefinedFunctionExecutionTime), 2); - } - - @Override - protected void writeAfterRuntimeExecutionTimes() { - // Do Nothing - } - - @Override - protected void writeDocumentWriteTime(Duration documentWriteTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.DocumentWriteTime, durationToMilliseconds(documentWriteTime), 1); - } - - @Override - protected void writeBeforeClientSideMetrics() { - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, - QueryMetricsTextWriter.ClientSideQueryMetrics, 0); - } - - @Override - protected void writeRetries(long retries) { - QueryMetricsTextWriter.appendCountToStringBuilder(stringBuilder, QueryMetricsTextWriter.Retries, retries, 1); - } - - @Override - protected void writeRequestCharge(double requestCharge) { - QueryMetricsTextWriter.appendRUToStringBuilder(stringBuilder, QueryMetricsTextWriter.RequestCharge, - requestCharge, 1); - } - - @Override - protected void writeBeforePartitionExecutionTimeline() { - QueryMetricsTextWriter.appendNewlineToStringBuilder(stringBuilder); - - // Building the table for fetch execution ranges - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, QueryMetricsTextWriter.FetchExecutionRanges - , 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.getTopLine(), 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.getHeader(), 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.getMiddleLine(), 1); - } - - @Override - protected void writeBeforeFetchExecutionRange() { - // Do Nothing - } - - @Override - protected void writeFetchPartitionKeyRangeId(String partitionId) { - this.lastFetchPartitionId = partitionId; - } - - @Override - protected void writeActivityId(String activityId) { - this.lastActivityId = activityId; - } - - @Override - protected void writeStartTime(Instant startTime) { - this.lastStartTime = startTime; - } - - @Override - protected void writeEndTime(Instant endTime) { - this.lastEndTime = endTime; - } - - @Override - protected void writeFetchDocumentCount(long numberOfDocuments) { - this.lastFetchDocumentCount = numberOfDocuments; - } - - @Override - protected void writeFetchRetryCount(long retryCount) { - this.lastFetchRetryCount = retryCount; - } - - @Override - protected void writeAfterFetchExecutionRange() { - QueryMetricsTextWriter.appendHeaderToStringBuilder( - stringBuilder, - PartitionExecutionTimelineTable.getRow(Arrays.asList( - this.lastFetchPartitionId, - this.lastActivityId, - formatter.format(this.lastStartTime), - formatter.format(this.lastEndTime), - nanosToMilliSeconds(this.lastEndTime.minusNanos(lastStartTime.getNano()).getNano()), - this.lastFetchDocumentCount, - this.lastFetchRetryCount)), - 1); - } - - @Override - protected void writeAfterPartitionExecutionTimeline() { - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.getBottomLine(), - 1); - } - - @Override - protected void writeBeforeSchedulingMetrics() { - QueryMetricsTextWriter.appendNewlineToStringBuilder(stringBuilder); - - // Building the table for scheduling metrics - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, QueryMetricsTextWriter.SchedulingMetrics, 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.getTopLine(), 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.getHeader(), 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.getMiddleLine(), 1); - } - - @Override - protected void writeBeforePartitionSchedulingDuration() { - // Do Nothing - } - - @Override - protected void writePartitionSchedulingDurationId(String partitionId) { - this.lastSchedulingPartitionId = partitionId; - } - - @Override - protected void writeResponseTime(long responseTime) { - this.lastResponseTime = responseTime; - } - - @Override - protected void writeRunTime(long runTime) { - this.lastRunTime = runTime; - } - - @Override - protected void writeWaitTime(long waitTime) { - this.lastWaitTime = waitTime; - } - - @Override - protected void writeTurnaroundTime(long turnaroundTime) { - this.lastTurnaroundTime = turnaroundTime; - } - - @Override - protected void writeNumberOfPreemptions(long numPreemptions) { - this.lastNumberOfPreemptions = numPreemptions; - } - - @Override - protected void writeAfterPartitionSchedulingDuration() { - QueryMetricsTextWriter.appendHeaderToStringBuilder( - stringBuilder, - SchedulingMetricsTable.getRow(Arrays.asList( - this.lastSchedulingPartitionId, - this.lastResponseTime, - this.lastRunTime, - this.lastWaitTime, - this.lastTurnaroundTime, - this.lastNumberOfPreemptions)), - 1); - } - - @Override - protected void writeAfterSchedulingMetrics() { - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.getBottomLine(), 1); - } - - @Override - protected void writeAfterClientSideMetrics() { - // Do Nothing - } - - @Override - protected void writeAfterQueryMetrics() { - // Do Nothing - } - - // Util functions - private static final int NANOS_TO_MILLIS = 1000000; - - static HashMap parseDelimitedString(String delimitedString) { - if (delimitedString == null) { - throw new NullPointerException("delimitedString"); - } - - HashMap metrics = new HashMap<>(); - - final int key = 0; - final int value = 1; - String[] headerAttributes = StringUtils.split(delimitedString, ";"); - - for (String attribute : headerAttributes) { - String[] attributeKeyValue = StringUtils.split(attribute, "="); - - if (attributeKeyValue.length != 2) { - throw new NullPointerException("recieved a malformed delimited String"); - } - - String attributeKey = attributeKeyValue[key]; - double attributeValue = Double.parseDouble(attributeKeyValue[value]); - metrics.put(attributeKey, attributeValue); - } - - return metrics; - } - - static Duration durationFromMetrics(HashMap metrics, String key) { - // Just attempt to get the metrics - Double durationInMilliseconds = metrics.get(key); - if (durationInMilliseconds == null) { - return Duration.ZERO; - } - - long seconds = (long) (durationInMilliseconds / 1e3); - long nanoseconds = (long) ((durationInMilliseconds - (seconds * 1e3)) * 1e6); - - return Duration.ofSeconds(seconds, nanoseconds); - } - - static double durationToMilliseconds(Duration duration) { - double seconds = duration.getSeconds(); - double nano = duration.getNano(); - - return (seconds * 1e3) + (nano / 1e6); - } - - static Duration getDurationFromMetrics(HashMap metrics, String key) { - double timeSpanInMilliseconds; - Duration timeSpanFromMetrics; - timeSpanInMilliseconds = metrics.get(key); - timeSpanFromMetrics = doubleMillisecondsToDuration(timeSpanInMilliseconds); - return timeSpanFromMetrics; - } - - private static Duration doubleMillisecondsToDuration(double timeSpanInMilliseconds) { - long timeInNanoSeconds = (long) (timeSpanInMilliseconds * NANOS_TO_MILLIS); - return Duration.ofNanos(timeInNanoSeconds); - } - - private static void appendToStringBuilder(StringBuilder stringBuilder, String property, String value, - String units, int indentLevel) { - final String Indent = " "; - final String FormatString = "%-40s : %15s %-12s %s"; - - stringBuilder.append(String.format( - Locale.ROOT, - FormatString, - StringUtils.repeat(Indent, indentLevel) + property, - value, - units, - System.lineSeparator())); - } - - static void appendBytesToStringBuilder(StringBuilder stringBuilder, String property, long bytes, int indentLevel) { - final String BytesFormatString = "%d"; - final String BytesUnitString = "bytes"; - - appendToStringBuilder( - stringBuilder, - property, - String.format(BytesFormatString, bytes), - BytesUnitString, - indentLevel); - } - - static void appendMillisecondsToStringBuilder(StringBuilder stringBuilder, String property, double milliseconds, - int indentLevel) { - final String MillisecondsFormatString = "%f"; - final String MillisecondsUnitString = "milliseconds"; - - appendToStringBuilder(stringBuilder, property, String.format(MillisecondsFormatString, - milliseconds), MillisecondsUnitString, indentLevel); - } - - static void appendNanosecondsToStringBuilder(StringBuilder stringBuilder, String property, double nanoSeconds, - int indentLevel) { - final String MillisecondsFormatString = "%.2f"; - final String MillisecondsUnitString = "milliseconds"; - appendToStringBuilder(stringBuilder, property, String.format(MillisecondsFormatString, - nanosToMilliSeconds(nanoSeconds)), MillisecondsUnitString, indentLevel); - } - - static double nanosToMilliSeconds(double nanos) { - return nanos / NANOS_TO_MILLIS; - } - - static void appendHeaderToStringBuilder(StringBuilder stringBuilder, String headerTitle, int indentLevel) { - final String Indent = " "; - final String FormatString = "%s %s"; - stringBuilder.append(String.format( - Locale.ROOT, - FormatString, - String.join(StringUtils.repeat(Indent, indentLevel)) + headerTitle, - System.lineSeparator())); - } - - static void appendRUToStringBuilder(StringBuilder stringBuilder, String property, double requestCharge, - int indentLevel) { - final String RequestChargeFormatString = "%s"; - final String RequestChargeUnitString = "RUs"; - - appendToStringBuilder( - stringBuilder, - property, - String.format(Locale.ROOT, RequestChargeFormatString, requestCharge), - RequestChargeUnitString, - indentLevel); - } - - static void appendActivityIdsToStringBuilder(StringBuilder stringBuilder, String activityIdsLabel, - List activityIds, int indentLevel) { - final String Indent = " "; - stringBuilder.append(activityIdsLabel); - stringBuilder.append(System.lineSeparator()); - for (String activityId : activityIds) { - stringBuilder.append(Indent); - stringBuilder.append(activityId); - stringBuilder.append(System.lineSeparator()); - } - } - - static void appendPercentageToStringBuilder(StringBuilder stringBuilder, String property, double percentage, - int indentLevel) { - final String PercentageFormatString = "%.2f"; - final String PercentageUnitString = "%"; - - appendToStringBuilder(stringBuilder, property, String.format(PercentageFormatString, - percentage * 100), PercentageUnitString, indentLevel); - } - - static void appendCountToStringBuilder(StringBuilder stringBuilder, String property, long count, int indentLevel) { - final String CountFormatString = "%s"; - final String CountUnitString = ""; - - appendToStringBuilder( - stringBuilder, - property, - String.format(CountFormatString, count), - CountUnitString, - indentLevel); - } - - static void appendNewlineToStringBuilder(StringBuilder stringBuilder) { - appendHeaderToStringBuilder(stringBuilder, StringUtils.EMPTY, 0); - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsWriter.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsWriter.java deleted file mode 100644 index 575760ec7b50..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsWriter.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.QueryPreparationTimes; -import com.microsoft.azure.cosmosdb.RuntimeExecutionTimes; -import org.apache.commons.lang3.tuple.ImmutablePair; - -import java.time.Duration; -import java.time.Instant; -import java.util.List; - -abstract class QueryMetricsWriter { - - public void writeQueryMetrics(QueryMetrics queryMetrics) { - this.writeBeforeQueryMetrics(); - - // Top Level Properties - this.writeRetrievedDocumentCount(queryMetrics.getRetrievedDocumentCount()); - this.writeRetrievedDocumentSize(queryMetrics.getRetrievedDocumentSize()); - this.writeOutputDocumentCount(queryMetrics.getOutputDocumentCount()); - this.writeOutputDocumentSize(queryMetrics.getOutputDocumentSize()); - this.writeIndexHitRatio(queryMetrics.getIndexHitRatio()); - this.writeTotalQueryExecutionTime(queryMetrics.getTotalQueryExecutionTime()); - - // QueryPreparationTimes - this.writeQueryPreparationTimes(queryMetrics.getQueryPreparationTimes()); - - this.writeIndexLookupTime(queryMetrics.getIndexLookupTime()); - this.writeDocumentLoadTime(queryMetrics.getDocumentLoadTime()); - this.writeVMExecutionTime(queryMetrics.getVMExecutionTime()); - - // RuntimesExecutionTimes - this.writeRuntimesExecutionTimes(queryMetrics.getRuntimeExecutionTimes()); - - this.writeDocumentWriteTime(queryMetrics.getDocumentWriteTime()); - - // ClientSideMetrics - this.writeClientSideMetrics(BridgeInternal.getClientSideMetrics(queryMetrics)); - - this.writeAfterQueryMetrics(); - } - - protected abstract void writeBeforeQueryMetrics(); - - protected abstract void writeRetrievedDocumentCount(long retrievedDocumentCount); - - protected abstract void writeRetrievedDocumentSize(long retrievedDocumentSize); - - protected abstract void writeOutputDocumentCount(long outputDocumentCount); - - protected abstract void writeOutputDocumentSize(long outputDocumentSize); - - protected abstract void writeIndexHitRatio(double indexHitRatio); - - protected abstract void writeTotalQueryExecutionTime(Duration totalQueryExecutionTime); - - //QueryPreparationTimes - private void writeQueryPreparationTimes(QueryPreparationTimes queryPreparationTimes) { - this.writeBeforeQueryPreparationTimes(); - - this.writeQueryCompilationTime(queryPreparationTimes.getQueryCompilationTime()); - this.writeLogicalPlanBuildTime(queryPreparationTimes.getLogicalPlanBuildTime()); - this.writePhysicalPlanBuildTime(queryPreparationTimes.getPhysicalPlanBuildTime()); - this.writeQueryOptimizationTime(queryPreparationTimes.getQueryOptimizationTime()); - - this.writeAfterQueryPreparationTimes(); - } - - protected abstract void writeBeforeQueryPreparationTimes(); - - protected abstract void writeQueryCompilationTime(Duration queryCompilationTime); - - protected abstract void writeLogicalPlanBuildTime(Duration logicalPlanBuildTime); - - protected abstract void writePhysicalPlanBuildTime(Duration physicalPlanBuildTime); - - protected abstract void writeQueryOptimizationTime(Duration queryOptimizationTime); - - protected abstract void writeAfterQueryPreparationTimes(); - - protected abstract void writeIndexLookupTime(Duration indexLookupTime); - - protected abstract void writeDocumentLoadTime(Duration documentLoadTime); - - protected abstract void writeVMExecutionTime(Duration vMExecutionTime); - - // RuntimeExecutionTimes - private void writeRuntimesExecutionTimes(RuntimeExecutionTimes runtimeExecutionTimes) { - this.writeBeforeRuntimeExecutionTimes(); - - this.writeQueryEngineExecutionTime(runtimeExecutionTimes.getQueryEngineExecutionTime()); - this.writeSystemFunctionExecutionTime(runtimeExecutionTimes.getSystemFunctionExecutionTime()); - this.writeUserDefinedFunctionExecutionTime(runtimeExecutionTimes.getUserDefinedFunctionExecutionTime()); - - this.writeAfterRuntimeExecutionTimes(); - } - - - protected abstract void writeBeforeRuntimeExecutionTimes(); - - protected abstract void writeQueryEngineExecutionTime(Duration queryEngineExecutionTime); - - protected abstract void writeSystemFunctionExecutionTime(Duration systemFunctionExecutionTime); - - protected abstract void writeUserDefinedFunctionExecutionTime(Duration userDefinedFunctionExecutionTime); - - protected abstract void writeAfterRuntimeExecutionTimes(); - - protected abstract void writeDocumentWriteTime(Duration documentWriteTime); - - // ClientSideMetrics - private void writeClientSideMetrics(ClientSideMetrics clientSideMetrics) { - this.writeBeforeClientSideMetrics(); - - this.writeRetries(clientSideMetrics.getRetries()); - this.writeRequestCharge(clientSideMetrics.getRequestCharge()); - this.writePartitionExecutionTimeline(clientSideMetrics); - this.writeSchedulingMetrics(clientSideMetrics); - - this.writeAfterClientSideMetrics(); - } - - protected abstract void writeBeforeClientSideMetrics(); - - protected abstract void writeRetries(long retries); - - protected abstract void writeRequestCharge(double requestCharge); - - private void writePartitionExecutionTimeline(ClientSideMetrics clientSideMetrics) { - this.writeBeforePartitionExecutionTimeline(); - List fetchExecutionRanges = clientSideMetrics.getFetchExecutionRanges(); - fetchExecutionRanges.sort((f1, f2) -> f2.getStartTime().compareTo(f1.getStartTime())); - for (FetchExecutionRange fetchExecutionRange : clientSideMetrics.getFetchExecutionRanges()) { - this.writeFetchExecutionRange(fetchExecutionRange); - } - this.writeAfterPartitionExecutionTimeline(); - } - - protected abstract void writeBeforePartitionExecutionTimeline(); - - private void writeFetchExecutionRange(FetchExecutionRange fetchExecutionRange) { - this.writeBeforeFetchExecutionRange(); - - this.writeFetchPartitionKeyRangeId(fetchExecutionRange.getPartitionId()); - this.writeActivityId(fetchExecutionRange.getActivityId()); - this.writeStartTime(fetchExecutionRange.getStartTime()); - this.writeEndTime(fetchExecutionRange.getEndTime()); - this.writeFetchDocumentCount(fetchExecutionRange.getNumberOfDocuments()); - this.writeFetchRetryCount(fetchExecutionRange.getRetryCount()); - - this.writeAfterFetchExecutionRange(); - } - - protected abstract void writeBeforeFetchExecutionRange(); - - protected abstract void writeFetchPartitionKeyRangeId(String partitionId); - - protected abstract void writeActivityId(String activityId); - - protected abstract void writeStartTime(Instant startTime); - - protected abstract void writeEndTime(Instant endTime); - - protected abstract void writeFetchDocumentCount(long numberOfDocuments); - - protected abstract void writeFetchRetryCount(long retryCount); - - protected abstract void writeAfterFetchExecutionRange(); - - protected abstract void writeAfterPartitionExecutionTimeline(); - - private void writeSchedulingMetrics(ClientSideMetrics clientSideMetrics) { - this.writeBeforeSchedulingMetrics(); - List> partitionSchedulingTimeSpans = clientSideMetrics.getPartitionSchedulingTimeSpans(); - partitionSchedulingTimeSpans.sort((o1, o2) -> (int) (o2.right.getResponseTime() - o1.right.getResponseTime())); - for (ImmutablePair partitionSchedulingDuration : - partitionSchedulingTimeSpans) { - String partitionId = partitionSchedulingDuration.getLeft(); - SchedulingTimeSpan schedulingDuration = partitionSchedulingDuration.getRight(); - - this.writePartitionSchedulingDuration(partitionId, schedulingDuration); - } - - this.writeAfterSchedulingMetrics(); - } - - protected abstract void writeBeforeSchedulingMetrics(); - - private void writePartitionSchedulingDuration(String partitionId, SchedulingTimeSpan schedulingDuration) { - this.writeBeforePartitionSchedulingDuration(); - - this.writePartitionSchedulingDurationId(partitionId); - this.writeResponseTime(schedulingDuration.getResponseTime()); - this.writeRunTime(schedulingDuration.getRunTime()); - this.writeWaitTime(schedulingDuration.getWaitTime()); - this.writeTurnaroundTime(schedulingDuration.getTurnaroundTime()); - this.writeNumberOfPreemptions(schedulingDuration.getNumPreemptions()); - - this.writeAfterPartitionSchedulingDuration(); - } - - protected abstract void writeBeforePartitionSchedulingDuration(); - - protected abstract void writePartitionSchedulingDurationId(String partitionId); - - protected abstract void writeResponseTime(long responseTime); - - protected abstract void writeRunTime(long runTime); - - protected abstract void writeWaitTime(long waitTime); - - protected abstract void writeTurnaroundTime(long turnaroundTime); - - protected abstract void writeNumberOfPreemptions(long numPreemptions); - - protected abstract void writeAfterPartitionSchedulingDuration(); - - protected abstract void writeAfterSchedulingMetrics(); - - protected abstract void writeAfterClientSideMetrics(); - - protected abstract void writeAfterQueryMetrics(); - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingStopwatch.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingStopwatch.java deleted file mode 100644 index eac7270f90be..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingStopwatch.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import org.apache.commons.lang3.time.StopWatch; - -public class SchedulingStopwatch { - private StopWatch turnaroundTimeStopwatch; - private StopWatch responseTimeStopwatch; - private StopWatch runTimeStopwatch; - private long numPreemptions; - private boolean responded; - - public SchedulingStopwatch() { - this.turnaroundTimeStopwatch = new StopWatch(); - this.responseTimeStopwatch = new StopWatch(); - this.runTimeStopwatch = new StopWatch(); - } - - public SchedulingTimeSpan getElapsedTime() { - return new SchedulingTimeSpan(this.turnaroundTimeStopwatch.getTime(), this.responseTimeStopwatch.getTime(), - this.runTimeStopwatch.getTime(), - this.turnaroundTimeStopwatch.getTime() - this.runTimeStopwatch.getTime(), this.numPreemptions); - } - - /** - * Tells the SchedulingStopwatch know that the process is in a state where it is ready to be worked on, - * which in turn starts the stopwatch for for response time and turnaround time. - */ - public void ready() { - startStopWatch(this.turnaroundTimeStopwatch); - startStopWatch(this.responseTimeStopwatch); - } - - public void start() { - if (!this.runTimeStopwatch.isStarted()) { - if (!this.responded) { - // This is the first time the process got a response, so the response time stopwatch needs to stop. - this.responseTimeStopwatch.stop(); - this.responded = true; - } - this.runTimeStopwatch.reset(); - startStopWatch(this.runTimeStopwatch); - } - } - - public void stop() { - if (this.runTimeStopwatch.isStarted()) { - stopStopWatch(this.runTimeStopwatch); - this.numPreemptions++; - } - } - - public void terminate() { - stopStopWatch(this.turnaroundTimeStopwatch); - stopStopWatch(this.responseTimeStopwatch); - } - - private void startStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.start(); - } - } - - private void stopStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.stop(); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingTimeSpan.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingTimeSpan.java deleted file mode 100644 index 02bd4cbd80dc..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingTimeSpan.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -public class SchedulingTimeSpan { - - /** - * The total time taken from when the process arrives to when it ended. - */ - private final long turnaroundTime; - - /** - * The total latency (time) taken from when the process arrived to when the CPU actually started working on it. - */ - private final long responseTime; - - /** - * The total time the process spent in the running state. - */ - private final long runTime; - - /** - * The total time that the process spent is on the ready or waiting state. - */ - private final long waitTime; - - /** - * Number of times the process was preempted. - */ - private final long numPreemptions; - - public SchedulingTimeSpan(long turnaroundTime, long responseTime, long runTime, long waitTime, long numPreemptions) { - this.turnaroundTime = turnaroundTime; - this.responseTime = responseTime; - this.runTime = runTime; - this.waitTime = waitTime; - this.numPreemptions = numPreemptions; - } - - public long getTurnaroundTime() { - return turnaroundTime; - } - - public long getResponseTime() { - return responseTime; - } - - public long getRunTime() { - return runTime; - } - - public long getWaitTime() { - return waitTime; - } - - public long getNumPreemptions() { - return numPreemptions; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/TextTable.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/TextTable.java deleted file mode 100644 index ca7c711ee4f1..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/TextTable.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.List; - -class TextTable { - private static final char CellLeftTop = '┌'; - private static final char CellRightTop = '┐'; - private static final char CellLeftBottom = '└'; - private static final char CellRightBottom = '┘'; - private static final char CellHorizontalJointTop = '┬'; - private static final char CellHorizontalJointBottom = '┴'; - private static final char CellVerticalJointLeft = '├'; - private static final char CellTJoint = '┼'; - private static final char CellVerticalJointRight = '┤'; - private static final char CellHorizontalLine = '-'; - private static final char CellVerticalLine = '│'; - - private List columns; - - private String header; - private String topLine; - private String middleLine; - private String bottomLine; - - private String rowFormatString; - - /** - * Initializes a new instance of the TextTable class. - * - * @param columns The columns of the table - */ - public TextTable(List columns) { - this.columns = new ArrayList<>(columns); - - // Building the table header - String headerFormatString = TextTable.buildLineFormatString(columns); - this.header = String.format(headerFormatString, columns.stream().map(textTableColumn -> textTableColumn.columnName).toArray()); - - // building the different lines - this.topLine = TextTable.buildLine(CellLeftTop, CellRightTop, CellHorizontalJointTop, columns); - this.middleLine = TextTable.buildLine(CellVerticalJointLeft, CellVerticalJointRight, CellTJoint, columns); - this.bottomLine = TextTable.buildLine(CellLeftBottom, CellRightBottom, CellHorizontalJointBottom, columns); - - // building the row format string - this.rowFormatString = TextTable.buildLineFormatString(columns); - } - - public String getRow(List cells) { - if (cells.size() != this.columns.size()) { - throw new IllegalArgumentException("Cells in a row needs to have exactly 1 element per column"); - } - return String.format(this.rowFormatString, cells.toArray()); - } - - private static String buildLine(char firstChar, char lastChar, char seperator, List columns) { - StringBuilder lineStringBuilder = new StringBuilder(); - lineStringBuilder.append(firstChar); - for (Column column : columns.subList(0, columns.size() - 1)) { - lineStringBuilder.append(StringUtils.repeat(CellHorizontalLine, column.columnWidth)); - lineStringBuilder.append(seperator); - } - - lineStringBuilder.append(StringUtils.repeat(CellHorizontalLine, columns.get(columns.size() - 1).columnWidth)); - lineStringBuilder.append(lastChar); - - return lineStringBuilder.toString(); - } - - private static String buildLineFormatString(List columns) { - StringBuilder lineFormatStringBuilder = new StringBuilder(); - lineFormatStringBuilder.append(CellVerticalLine); - for (Column column : columns) { - lineFormatStringBuilder.append("%" + column.columnWidth + "s"); - lineFormatStringBuilder.append(CellVerticalLine); - } - - return lineFormatStringBuilder.toString(); - } - - - static class Column { - String columnName; - int columnWidth; - - public Column(String columnName, int columnWidth) { - this.columnName = columnName; - this.columnWidth = columnWidth; - } - } - - public String getHeader() { - return header; - } - - public String getTopLine() { - return topLine; - } - - public String getMiddleLine() { - return middleLine; - } - - public String getBottomLine() { - return bottomLine; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/BoolPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/BoolPartitionKeyComponent.java deleted file mode 100644 index eda8dd7a9422..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/BoolPartitionKeyComponent.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class BoolPartitionKeyComponent implements IPartitionKeyComponent { - - private final boolean value; - - public BoolPartitionKeyComponent(boolean value) { - this.value = value; - } - - @Override - public int CompareTo(IPartitionKeyComponent other) { - BoolPartitionKeyComponent otherBool = Utils.as(other, BoolPartitionKeyComponent.class); - if (otherBool == null) { - throw new IllegalArgumentException("other"); - } - - return (int) Math.signum((this.value ? 1 : 0) - (otherBool.value ? 1 : 0)); - } - - @Override - public int GetTypeOrdinal() { - return this.value ? PartitionKeyComponentType.TRUE.type : PartitionKeyComponentType.FALSE.type; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - try { - writer.writeBoolean(this.value); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - try { - outputStream.write((byte) (this.value ? PartitionKeyComponentType.TRUE.type - : PartitionKeyComponentType.FALSE.type)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - try { - outputStream.write((byte) (this.value ? PartitionKeyComponentType.TRUE.type - : PartitionKeyComponentType.FALSE.type)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) (this.value ? PartitionKeyComponentType.TRUE.type - : PartitionKeyComponentType.FALSE.type)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IPartitionKeyComponent.java deleted file mode 100644 index ff21ae1d307c..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IPartitionKeyComponent.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; - -interface IPartitionKeyComponent { - int CompareTo(IPartitionKeyComponent other); - - int GetTypeOrdinal(); - - void JsonEncode(JsonGenerator writer); - - void WriteForHashing(OutputStream outputStream); - - void WriteForHashingV2(OutputStream binaryWriter); - - void WriteForBinaryEncoding(OutputStream binaryWriter); - - IPartitionKeyComponent Truncate(); -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InfinityPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InfinityPartitionKeyComponent.java deleted file mode 100644 index fb5ed45050d2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InfinityPartitionKeyComponent.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class InfinityPartitionKeyComponent implements IPartitionKeyComponent { - @Override - public int CompareTo(IPartitionKeyComponent other) { - InfinityPartitionKeyComponent otherInfinity = Utils.as(other, InfinityPartitionKeyComponent.class); - if (otherInfinity == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.INFINITY.type; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - throw new IllegalStateException(); - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - throw new IllegalStateException(); - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.INFINITY.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxNumberPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxNumberPartitionKeyComponent.java deleted file mode 100644 index c88fa8889be4..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxNumberPartitionKeyComponent.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class MaxNumberPartitionKeyComponent implements IPartitionKeyComponent { - public static final MaxNumberPartitionKeyComponent VALUE = new MaxNumberPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - MaxNumberPartitionKeyComponent otherMaxNumber = Utils.as(other, MaxNumberPartitionKeyComponent.class); - if (otherMaxNumber == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.MAXNUMBER.ordinal(); - } - - @Override - public void JsonEncode(JsonGenerator writer) { - PartitionKeyInternal.PartitionKeyInternalJsonSerializer.jsonEncode(this, writer); - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.MAXNUMBER.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxStringPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxStringPartitionKeyComponent.java deleted file mode 100644 index 0b45955919da..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxStringPartitionKeyComponent.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class MaxStringPartitionKeyComponent implements IPartitionKeyComponent { - public static final MaxStringPartitionKeyComponent VALUE = new MaxStringPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - MaxStringPartitionKeyComponent otherMaxString = Utils.as(other, MaxStringPartitionKeyComponent.class); - if (otherMaxString == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.MAXSTRING.ordinal(); - } - - @Override - public void JsonEncode(JsonGenerator writer) { - PartitionKeyInternal.PartitionKeyInternalJsonSerializer.jsonEncode(this, writer); - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.MAXSTRING.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinNumberPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinNumberPartitionKeyComponent.java deleted file mode 100644 index 7d10d3126256..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinNumberPartitionKeyComponent.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class MinNumberPartitionKeyComponent implements IPartitionKeyComponent { - public static final MinNumberPartitionKeyComponent VALUE = new MinNumberPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - MinNumberPartitionKeyComponent otherMinNumber = Utils.as(other, MinNumberPartitionKeyComponent.class); - if (otherMinNumber == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.MINNUMBER.ordinal(); - } - - @Override - public void JsonEncode(JsonGenerator writer) { - PartitionKeyInternal.PartitionKeyInternalJsonSerializer.jsonEncode(this, writer); - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.MINNUMBER.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinStringPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinStringPartitionKeyComponent.java deleted file mode 100644 index 8b765dab91d3..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinStringPartitionKeyComponent.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class MinStringPartitionKeyComponent implements IPartitionKeyComponent { - public static final MinStringPartitionKeyComponent VALUE = new MinStringPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - MinStringPartitionKeyComponent otherMinString = Utils.as(other, MinStringPartitionKeyComponent.class); - if (otherMinString == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.MINSTRING.ordinal(); - } - - @Override - public void JsonEncode(JsonGenerator writer) { - PartitionKeyInternal.PartitionKeyInternalJsonSerializer.jsonEncode(this, writer); - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.MINSTRING.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NullPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NullPartitionKeyComponent.java deleted file mode 100644 index a82585474370..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NullPartitionKeyComponent.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class NullPartitionKeyComponent implements IPartitionKeyComponent { - - public static final NullPartitionKeyComponent VALUE = new NullPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - NullPartitionKeyComponent otherMinString = Utils.as(other, NullPartitionKeyComponent.class); - if (otherMinString == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.NULL.type; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - try { - writer.writeObject(null); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NULL.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NULL.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NULL.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NumberPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NumberPartitionKeyComponent.java deleted file mode 100644 index 18eed71c03d9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NumberPartitionKeyComponent.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; -import java.math.BigInteger; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -/** - * Used internally to represent a number component in the partition key of the Azure Cosmos DB database service. - */ -public class NumberPartitionKeyComponent implements IPartitionKeyComponent { - - public static final NumberPartitionKeyComponent Zero = new NumberPartitionKeyComponent(0); - private final double value; - - public NumberPartitionKeyComponent(double value) { - this.value = value; - } - - private static byte[] doubleToByteArray(double d) { - byte[] output = new byte[8]; - long lng = Double.doubleToLongBits(d); - for (int i = 0; i < 8; i++) { - output[i] = (byte) ((lng >> (i * 8)) & 0xff); - } - return output; - } - - private static long EncodeDoubleAsUInt64(double value) { - long rawLongBits = Double.doubleToRawLongBits(value); - long mask = 0x8000000000000000L; - return Long.compareUnsigned(rawLongBits, mask) < 0 - ? rawLongBits ^ mask - : (~rawLongBits) + 1; - } - - @Override - public int CompareTo(IPartitionKeyComponent other) { - NumberPartitionKeyComponent otherBool = Utils.as(other, NumberPartitionKeyComponent.class); - if (otherBool == null) { - throw new IllegalArgumentException("other"); - } - - return Double.compare(this.value, ((NumberPartitionKeyComponent) other).value); - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.NUMBER.type; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - try { - writer.writeNumber(String.valueOf(value)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NUMBER.type); - outputStream.write(doubleToByteArray(this.value)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NUMBER.type); - outputStream.write(doubleToByteArray(this.value)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NUMBER.type); - - long payload = NumberPartitionKeyComponent.EncodeDoubleAsUInt64(this.value); - - // Encode first chunk with 8-bits of payload - outputStream.write((byte) (payload >> (64 - 8))); - payload <<= 8; - - // Encode remaining chunks with 7 bits of payload followed by single "1" bit each. - byte byteToWrite = 0; - boolean firstIteration = true; - do { - if (!firstIteration) { - outputStream.write(byteToWrite); - } else { - firstIteration = false; - } - - byteToWrite = (byte) ((payload >> (64 - 8)) | 0x01); - payload <<= 7; - } while (payload != 0); - - // Except for last chunk that ends with "0" bit. - outputStream.write((byte) (byteToWrite & 0xFE)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyAndResourceTokenPair.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyAndResourceTokenPair.java deleted file mode 100644 index f1c3c5241c79..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyAndResourceTokenPair.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.routing; - -/** - * This is the pair for Partition key and its corresponding Resource Token , - * this is the value in resource token map which is getting filled during the - * construction of AsyncDocumentClient - */ -public class PartitionKeyAndResourceTokenPair { - - private PartitionKeyInternal partitionKey; - private String resourceToken; - - public PartitionKeyAndResourceTokenPair(PartitionKeyInternal partitionKey, String resourceToken) { - this.partitionKey = partitionKey; - this.resourceToken = resourceToken; - } - - /** - * Get the Partition Key - * - * @return Partition Key - */ - public PartitionKeyInternal getPartitionKey() { - return partitionKey; - } - - /** - * Sets the PartitionKey - * - * @param partitionKey - * The Partition key - */ - public void setPartitionKey(PartitionKeyInternal partitionKey) { - this.partitionKey = partitionKey; - } - - /** - * Gets the Resource Token - * - * @return Resource Token - */ - public String getResourceToken() { - return resourceToken; - } - - /** - * Sets the Resource Token - * - * @param resourceToken - * The Resource Token - */ - public void setResourceToken(String resourceToken) { - this.resourceToken = resourceToken; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyComponentType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyComponentType.java deleted file mode 100644 index ee1180f0a2aa..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyComponentType.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -enum PartitionKeyComponentType { - UNDEFINED(0x0), - NULL(0x1), - FALSE(0x2), - TRUE(0x3), - MINNUMBER(0x4), - NUMBER(0x5), - MAXNUMBER(0x6), - MINSTRING(0x7), - STRING(0x8), - MAXSTRING(0x9), - INFINITY(0xFF); - - public final int type; - PartitionKeyComponentType(int type) { - this.type = type; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternal.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternal.java deleted file mode 100644 index 1051193584ae..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternal.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.ObjectCodec; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.node.NullNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.as; - -/** - * Used internally to encapsulate internal information of a partition key in the Azure Cosmos DB database service. - */ -@JsonSerialize(using = PartitionKeyInternal.PartitionKeyInternalJsonSerializer.class) -@JsonDeserialize(using = PartitionKeyInternal.PartitionKeyInternalJsonDeserializer.class) -public class PartitionKeyInternal implements Comparable { - - private static final String TYPE = "type"; - private static final String MIN_NUMBER = "MinNumber"; - private static final String MAX_NUMBER = "MaxNumber"; - private static final String MIN_STRING = "MinString"; - private static final String MAX_STRING = "MaxString"; - private static final String INFINITY = "Infinity"; - - public static final PartitionKeyInternal EmptyPartitionKey = - new PartitionKeyInternal(new ArrayList<>()); - - @SuppressWarnings("serial") - public static final PartitionKeyInternal InfinityPartitionKey = - new PartitionKeyInternal(new ArrayList() {{ - add(new InfinityPartitionKeyComponent()); - }}); - - public static final PartitionKeyInternal InclusiveMinimum = PartitionKeyInternal.EmptyPartitionKey; - public static final PartitionKeyInternal ExclusiveMaximum = PartitionKeyInternal.InfinityPartitionKey; - public static final PartitionKeyInternal Empty = PartitionKeyInternal.EmptyPartitionKey; - - final List components; - - public PartitionKeyInternal(List values) { - if (values == null) { - throw new IllegalArgumentException("values"); - } - - this.components = values; - } - - public static PartitionKeyInternal fromJsonString(String partitionKey) { - if (Strings.isNullOrEmpty(partitionKey)) { - throw new IllegalArgumentException(String.format(RMResources.UnableToDeserializePartitionKeyValue, partitionKey)); - } - - try { - return Utils.getSimpleObjectMapper().readValue(partitionKey, PartitionKeyInternal.class); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - } - - public static PartitionKeyInternal fromObjectArray(Object[] values, boolean strict) { - if (values == null) { - throw new IllegalArgumentException("values"); - } - - return PartitionKeyInternal.fromObjectArray(Arrays.asList(values), strict); - } - - public static PartitionKeyInternal fromObjectArray(List values, boolean strict) { - if (values == null) { - throw new IllegalArgumentException("values"); - } - - List components = new ArrayList<>(); - for (Object value : values) { - if (value == NullNode.instance || value == null) { - components.add(NullPartitionKeyComponent.VALUE); - } else if (value instanceof Undefined) { - components.add(UndefinedPartitionKeyComponent.VALUE); - } else if (value instanceof Boolean) { - components.add(new BoolPartitionKeyComponent((boolean) value)); - } else if (value instanceof String) { - components.add(new StringPartitionKeyComponent((String) value)); - } else if (isNumeric(value)) { - components.add(new NumberPartitionKeyComponent(((Number) value).doubleValue())); - } else if (value instanceof ObjectNode && ((ObjectNode) value).get(TYPE) != null) { - switch (((ObjectNode) value).get(TYPE).asText()) { - case MIN_NUMBER: - components.add(MinNumberPartitionKeyComponent.VALUE); - break; - case MAX_NUMBER: - components.add(MaxNumberPartitionKeyComponent.VALUE); - break; - case MIN_STRING: - components.add(MinStringPartitionKeyComponent.VALUE); - break; - case MAX_STRING: - components.add(MaxStringPartitionKeyComponent.VALUE); - break; - } - } else { - if (strict) { - throw new IllegalArgumentException("Unable to construct PartitionKeyInternal from objects array"); - } else { - components.add(UndefinedPartitionKeyComponent.VALUE); - } - } - } - - return new PartitionKeyInternal(components); - } - - private static boolean isNumeric(Object value) { - return value instanceof Number; - } - - private static PartitionKeyInternal getExclusiveMaximum() { - return PartitionKeyInternal.InfinityPartitionKey; - } - - public static PartitionKeyInternal getEmpty() { - return PartitionKeyInternal.EmptyPartitionKey; - } - - @Override - public boolean equals(Object obj) { - PartitionKeyInternal pki = as(obj, PartitionKeyInternal.class); - if (pki == null) { - return false; - } - - if (pki == this) { - return true; - } - - return this.compareTo(pki) == 0; - } - - public int compareTo(PartitionKeyInternal other) { - if (other == null) { - throw new IllegalArgumentException("other"); - } - - for (int i = 0; i < Math.min(this.components.size(), other.components.size()); i++) { - int leftOrdinal = this.components.get(i).GetTypeOrdinal(); - int rightOrdinal = other.components.get(i).GetTypeOrdinal(); - if (leftOrdinal != rightOrdinal) { - return (int) Math.signum(leftOrdinal - rightOrdinal); - } - - int result = this.components.get(i).CompareTo(other.components.get(i)); - if (result != 0) { - return (int) Math.signum(result); - } - } - - return (int) Math.signum(this.components.size() - other.components.size()); - } - - public String toJson() { - try { - return Utils.getSimpleObjectMapper().writeValueAsString(this); - } catch (IOException e) { - throw new IllegalArgumentException("Unable serialize the partition key internal into the JSON string", e); - } - } - - public boolean contains(PartitionKeyInternal nestedPartitionKey) { - if (this.components.size() > nestedPartitionKey.components.size()) { - return false; - } - - for (int i = 0; i < this.components.size(); i++) { - if (this.components.get(i).CompareTo(nestedPartitionKey.components.get(i)) != 0) { - return false; - } - } - - return true; - } - - public List getComponents() { - return components; - } - - @SuppressWarnings("serial") - static final class PartitionKeyInternalJsonSerializer extends StdSerializer { - - protected PartitionKeyInternalJsonSerializer() { this(null); } - - protected PartitionKeyInternalJsonSerializer(Class t) { - super(t); - } - - @Override - public void serialize(PartitionKeyInternal partitionKey, JsonGenerator writer, SerializerProvider serializerProvider) { - try { - if (partitionKey.equals(PartitionKeyInternal.getExclusiveMaximum())) { - writer.writeString(INFINITY); - return; - } - - writer.writeStartArray(); - for (IPartitionKeyComponent componentValue : partitionKey.getComponents()) { - componentValue.JsonEncode(writer); - } - writer.writeEndArray(); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - static void jsonEncode(MinNumberPartitionKeyComponent component, JsonGenerator writer) { - jsonEncodeLimit(writer, MIN_NUMBER); - } - - static void jsonEncode(MaxNumberPartitionKeyComponent component, JsonGenerator writer) { - jsonEncodeLimit(writer, MAX_NUMBER); - } - - static void jsonEncode(MinStringPartitionKeyComponent component, JsonGenerator writer) { - jsonEncodeLimit(writer, MIN_STRING); - } - - static void jsonEncode(MaxStringPartitionKeyComponent component, JsonGenerator writer) { - jsonEncodeLimit(writer, MAX_STRING); - } - - private static void jsonEncodeLimit(JsonGenerator writer, String value) { - try { - writer.writeStartObject(); - writer.writeFieldName(TYPE); - writer.writeString(value); - writer.writeEndObject(); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - } - - @SuppressWarnings("serial") - static final class PartitionKeyInternalJsonDeserializer extends StdDeserializer { - - protected PartitionKeyInternalJsonDeserializer() { this(null); } - - protected PartitionKeyInternalJsonDeserializer(Class vc) { - super(vc); - } - - @Override - public PartitionKeyInternal deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) { - - ObjectCodec objectCodec = jsonParser.getCodec(); - JsonNode root; - try { - root = objectCodec.readTree(jsonParser); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - - if (root.isTextual() && root.asText().equals(INFINITY)) { - return PartitionKeyInternal.getExclusiveMaximum(); - } - - List objects = new ArrayList<>(); - if (root.isArray()) { - Iterator iterator = root.iterator(); - while (iterator.hasNext()) { - JsonNode node = iterator.next(); - if (node.isNull()) { - objects.add(null); - } else if (node.isNumber()) { - objects.add(node.asDouble()); - } else if (node.isBoolean()) { - objects.add(node.asBoolean()); - } else if (node.isTextual()) { - objects.add(node.asText()); - } else if (node.isArray() && node.size() == 0 - || node.isObject() - && (node.fields() == null || !node.fields().hasNext())) { - objects.add(Undefined.Value()); - } else { - objects.add(node); - } - } - return PartitionKeyInternal.fromObjectArray(objects, true); - } - - throw new IllegalStateException(String.format( - "Unable to deserialize PartitionKeyInternal '%s'", - root.toString())); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyRangeIdentity.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyRangeIdentity.java deleted file mode 100644 index 41360c5e20b9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyRangeIdentity.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import org.apache.commons.lang3.StringUtils; - -/** - * Used internally to represents the identity of a partition key range in the Azure Cosmos DB database service. - */ -public final class PartitionKeyRangeIdentity { - private String collectionRid; - private String partitionKeyRangeId; - - public PartitionKeyRangeIdentity(String collectionRid, String partitionKeyRangeId) { - if (collectionRid == null) { - throw new IllegalArgumentException("collectionRid"); - } - - if (partitionKeyRangeId == null) { - throw new IllegalArgumentException("partitionKeyRangeId"); - } - - this.collectionRid = collectionRid; - this.partitionKeyRangeId = partitionKeyRangeId; - } - - /** - * This should only be used for user provided partitionKeyRangeId, because in this case - * he knows what he is doing. If collection was deleted/created with same name - it is his responsibility. - *

- * If our code infers partitionKeyRangeId automatically and uses collection information from collection cache, - * we need to ensure that request will reach correct collection. In this case constructor which takes collectionRid MUST - * be used. - * - * @param partitionKeyRangeId a string represents the partition key range Id - */ - public PartitionKeyRangeIdentity(String partitionKeyRangeId) { - if (partitionKeyRangeId == null) { - throw new IllegalArgumentException("partitionKeyRangeId"); - } - - this.partitionKeyRangeId = partitionKeyRangeId; - } - - public static PartitionKeyRangeIdentity fromHeader(String header) { - String[] parts = StringUtils.split(header,","); - if (parts.length == 2) { - return new PartitionKeyRangeIdentity(parts[0], parts[1]); - } else if (parts.length == 1) { - return new PartitionKeyRangeIdentity(parts[0]); - } else { - throw new IllegalStateException("x-ms-documentdb-partitionkeyrangeid header contains invalid value '" + header + "'"); - } - } - - public String toHeader() { - if (this.collectionRid != null) { - return String.format("%s,%s", this.collectionRid, this.partitionKeyRangeId); - } - - return String.format("%s", this.partitionKeyRangeId); - } - - @Override - public boolean equals(Object other) { - if (null == other) { - return false; - } - if (this == other) { - return true; - } - return other instanceof PartitionKeyRangeIdentity - && ((PartitionKeyRangeIdentity) other).collectionRid.equals(this.collectionRid) - && ((PartitionKeyRangeIdentity) other).partitionKeyRangeId.equals(this.partitionKeyRangeId); - } - - @Override - public int hashCode() { - return ((this.collectionRid != null ? this.collectionRid.hashCode() : 0) * 397) - ^ (this.partitionKeyRangeId != null ? this.partitionKeyRangeId.hashCode() : 0); - } - - public String getCollectionRid() { - return collectionRid; - } - - public String getPartitionKeyRangeId() { - return partitionKeyRangeId; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Range.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Range.java deleted file mode 100644 index e4a4d7ff8b39..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Range.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.Comparator; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.JsonSerializable; - -@JsonIgnoreProperties({ "empty", "singleValue", "hashMap" }) -public final class Range> extends JsonSerializable { - private static final String MIN_PROPERTY = "min"; - private static final String MAX_PROPERTY = "max"; - private static final String IS_MIN_INCLUSIVE_PROPERTY = "isMinInclusive"; - private static final String IS_MAX_INCLUSIVE_PROPERTY = "isMaxInclusive"; - - private T minValue; - private T maxValue; - - public Range() { - super(); - } - - public Range(String jsonString) { - super(jsonString); - } - - public Range(T min, T max, boolean isMinInclusive, boolean isMaxInclusive) { - this.setMin(min); - this.setMax(max); - this.setMinInclusive(isMinInclusive); - this.setMaxInclusive(isMaxInclusive); - } - - public static > Range getPointRange(T value) { - return new Range(value, value, true, true); - } - - public static > Range getEmptyRange(T value) { - return new Range(value, value, true, false); - } - - public static > boolean checkOverlapping(Range range1, Range range2) { - if (range1 == null || range2 == null || range1.isEmpty() || range2.isEmpty()) { - return false; - } - - int cmp1 = range1.getMin().compareTo(range2.getMax()); - int cmp2 = range2.getMin().compareTo(range1.getMax()); - - if (cmp1 <= 0 && cmp2 <= 0) { - return !((cmp1 == 0 && !(range1.isMinInclusive() && range2.isMaxInclusive())) - || (cmp2 == 0 && !(range2.isMinInclusive() && range1.isMaxInclusive()))); - } - - return false; - } - - @SuppressWarnings("unchecked") - public T getMin() { - if (this.minValue == null) { - this.minValue = (T) super.get(Range.MIN_PROPERTY); - } - - return this.minValue; - } - - public void setMin(T min) { - this.minValue = min; - super.set(Range.MIN_PROPERTY, min); - } - - @SuppressWarnings("unchecked") - public T getMax() { - if (this.maxValue == null) { - this.maxValue = (T) super.get(Range.MAX_PROPERTY); - } - - return this.maxValue; - } - - public void setMax(T max) { - this.maxValue = max; - super.set(Range.MAX_PROPERTY, max); - } - - @JsonProperty("isMinInclusive") - public boolean isMinInclusive() { - return super.getBoolean(Range.IS_MIN_INCLUSIVE_PROPERTY); - } - - public void setMinInclusive(boolean isMinInclusive) { - super.set(Range.IS_MIN_INCLUSIVE_PROPERTY, isMinInclusive); - } - - @JsonProperty("isMaxInclusive") - public boolean isMaxInclusive() { - return super.getBoolean(Range.IS_MAX_INCLUSIVE_PROPERTY); - } - - public void setMaxInclusive(boolean isMaxInclusive) { - super.set(Range.IS_MAX_INCLUSIVE_PROPERTY, isMaxInclusive); - } - - public boolean isSingleValue() { - return this.isMinInclusive() && this.isMaxInclusive() && this.getMin().compareTo(this.getMax()) == 0; - } - - public boolean isEmpty() { - return this.getMin().compareTo(this.getMax()) == 0 && !(this.isMinInclusive() && this.isMaxInclusive()); - } - - public boolean contains(T value) { - int minToValueRelation = this.getMin().compareTo(value); - int maxToValueRelation = this.getMax().compareTo(value); - - return ((this.isMinInclusive() && minToValueRelation <= 0) - || (!this.isMinInclusive() && minToValueRelation < 0)) - && ((this.isMaxInclusive() && maxToValueRelation >= 0) - || (!this.isMaxInclusive() && maxToValueRelation > 0)); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Range)) - return false; - if (obj == this) - return true; - @SuppressWarnings("unchecked") - Range otherRange = (Range) obj; - - return this.getMin().compareTo(otherRange.getMin()) == 0 && this.getMax().compareTo(otherRange.getMax()) == 0 - && this.isMinInclusive() == otherRange.isMinInclusive() - && this.isMaxInclusive() == otherRange.isMaxInclusive(); - } - - @Override - public int hashCode() { - int hash = 0; - hash = (hash * 397) ^ this.getMin().hashCode(); - hash = (hash * 397) ^ this.getMax().hashCode(); - hash = (hash * 397) ^ Boolean.compare(this.isMinInclusive(), false); - hash = (hash * 397) ^ Boolean.compare(this.isMaxInclusive(), false); - return hash; - } - - public static class MinComparator> implements Comparator> { - @Override - public int compare(Range range1, Range range2) { - int result = range1.getMin().compareTo(range2.getMin()); - if (result != 0 || range1.isMinInclusive() == range2.isMinInclusive()) { - return result; - } - - return range1.isMinInclusive() ? -1 : 1; - } - } - - public static class MaxComparator> implements Comparator> { - @Override - public int compare(Range range1, Range range2) { - int result = range1.getMax().compareTo(range2.getMax()); - if (result != 0 || range1.isMaxInclusive() == range2.isMaxInclusive()) { - return result; - } - - return range1.isMaxInclusive() ? 1 : -1; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponent.java deleted file mode 100644 index 5f373417d1cb..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponent.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class StringPartitionKeyComponent implements IPartitionKeyComponent { - - public static final int MAX_STRING_CHARS = 100; - public static final int MAX_STRING_BYTES_TO_APPEND = 100; - private final String value; - private final byte[] utf8Value; - - public StringPartitionKeyComponent(String value) { - if (value == null) { - throw new IllegalArgumentException("value"); - } - - this.value = value; - try { - this.utf8Value = com.microsoft.azure.cosmosdb.internal.Utils.getUTF8Bytes(value); - } catch (UnsupportedEncodingException e) { - throw new IllegalArgumentException(e); - } - } - - @Override - public int CompareTo(IPartitionKeyComponent other) { - StringPartitionKeyComponent otherString = Utils.as(other, StringPartitionKeyComponent.class) ; - if (otherString == null) { - throw new IllegalArgumentException("other"); - } - - return this.value.compareTo(otherString.value); - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.STRING.type; - } - - @Override - public int hashCode() { - // hashCode for hashmap dictionary, etc - return value.hashCode(); - } - - public IPartitionKeyComponent Truncate() { - if (this.value.length() > MAX_STRING_CHARS) { - return new StringPartitionKeyComponent(this.value.substring(0, MAX_STRING_CHARS)); - } - - return this; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - try { - writer.writeString(this.value); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.STRING.type); - outputStream.write(utf8Value); - outputStream.write((byte) 0); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.STRING.type); - outputStream.write(utf8Value); - outputStream.write((byte) 0xFF); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.STRING.type); - boolean shortString = this.utf8Value.length <= MAX_STRING_BYTES_TO_APPEND; - - for (int index = 0; index < (shortString ? this.utf8Value.length : MAX_STRING_BYTES_TO_APPEND + 1); index++) { - byte charByte = this.utf8Value[index]; - if (charByte < 0xFF) charByte++; - outputStream.write(charByte); - } - - if (shortString) { - outputStream.write((byte) 0x00); - } - } catch (IOException e) { - throw new IllegalStateException(e); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UndefinedPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UndefinedPartitionKeyComponent.java deleted file mode 100644 index 8bbad5c40153..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UndefinedPartitionKeyComponent.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class UndefinedPartitionKeyComponent implements IPartitionKeyComponent { - - public static final UndefinedPartitionKeyComponent VALUE = new UndefinedPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - UndefinedPartitionKeyComponent otherUndefined = Utils.as(other, UndefinedPartitionKeyComponent.class); - if (otherUndefined == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.UNDEFINED.type; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - try { - writer.writeStartObject(); - writer.writeEndObject(); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.UNDEFINED.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.UNDEFINED.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.UNDEFINED.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/package-info.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/package-info.java deleted file mode 100644 index 351bf1499dc6..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/package-info.java +++ /dev/null @@ -1,28 +0,0 @@ - -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * This package provides Java SDK Common Resources for Azure Cosmos DB. - */ -package com.microsoft.azure.cosmosdb; \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/AuthorizationTokenType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/AuthorizationTokenType.java deleted file mode 100644 index dc0e37c3dcc5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/AuthorizationTokenType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -public enum AuthorizationTokenType { - Invalid, - PrimaryMasterKey, - PrimaryReadonlyMasterKey, - SecondaryMasterKey, - SecondaryReadonlyMasterKey, - SystemReadOnly, - SystemReadWrite, - SystemAll, - ResourceToken -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BadRequestException.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BadRequestException.java deleted file mode 100644 index f9dc2cf70860..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BadRequestException.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class BadRequestException extends DocumentClientException { - private static final long serialVersionUID = 1L; - - public BadRequestException(String message, Exception innerException) { - super(message, innerException, new HashMap<>(), HttpConstants.StatusCodes.BADREQUEST, null); - } - - public BadRequestException() { - this(RMResources.BadRequest); - } - - public BadRequestException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.BADREQUEST, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public BadRequestException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public BadRequestException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public BadRequestException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public BadRequestException(Exception innerException) { - this(RMResources.BadRequest, innerException, null, null); - } - - public BadRequestException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.BadRequest, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.BADREQUEST, - requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Configs.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Configs.java deleted file mode 100644 index 7bd80d3fbdac..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Configs.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import io.netty.handler.ssl.SslContext; -import io.netty.handler.ssl.SslContextBuilder; -import io.netty.handler.ssl.SslProvider; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.text.WordUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.net.ssl.SSLException; - -public class Configs { - private static final Logger logger = LoggerFactory.getLogger(Configs.class); - private final SslContext sslContext; - - private static final String PROTOCOL = "COSMOS.PROTOCOL"; - private static final Protocol DEFAULT_PROTOCOL = Protocol.Https; - - private static final String UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS = "COSMOS.UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS"; - - private static final String MAX_HTTP_BODY_LENGTH_IN_BYTES = "COSMOS.MAX_HTTP_BODY_LENGTH_IN_BYTES"; - private static final String MAX_HTTP_INITIAL_LINE_LENGTH_IN_BYTES = "COSMOS.MAX_HTTP_INITIAL_LINE_LENGTH_IN_BYTES"; - private static final String MAX_HTTP_CHUNK_SIZE_IN_BYTES = "COSMOS.MAX_HTTP_CHUNK_SIZE_IN_BYTES"; - private static final String MAX_HTTP_HEADER_SIZE_IN_BYTES = "COSMOS.MAX_HTTP_HEADER_SIZE_IN_BYTES"; - private static final String MAX_DIRECT_HTTPS_POOL_SIZE = "COSMOS.MAX_DIRECT_HTTP_CONNECTION_LIMIT"; - - private static final int DEFAULT_UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS = 5 * 60; - - private static final int DEFAULT_MAX_HTTP_BODY_LENGTH_IN_BYTES = 6 * 1024 * 1024; //6MB - private static final int DEFAULT_MAX_HTTP_INITIAL_LINE_LENGTH = 4096; //4KB - private static final int DEFAULT_MAX_HTTP_CHUNK_SIZE_IN_BYTES = 8192; //8KB - private static final int DEFAULT_MAX_HTTP_REQUEST_HEADER_SIZE = 32 * 1024; //32 KB - - private static final int MAX_NUMBER_OF_READ_BARRIER_READ_RETRIES = 6; - private static final int MAX_NUMBER_OF_PRIMARY_READ_RETRIES = 6; - private static final int MAX_NUMBER_OF_READ_QUORUM_RETRIES = 6; - private static final int DELAY_BETWEEN_READ_BARRIER_CALLS_IN_MS = 5; - - private static final int MAX_BARRIER_RETRIES_FOR_MULTI_REGION = 30; - private static final int BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION = 30; - - private static final int MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION = 4; - private static final int SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION = 10; - private static final int CPU_CNT = Runtime.getRuntime().availableProcessors(); - private static final int DEFAULT_DIRECT_HTTPS_POOL_SIZE = CPU_CNT * 500; - - public Configs() { - this.sslContext = sslContextInit(); - } - - private SslContext sslContextInit() { - try { - SslProvider sslProvider = SslContext.defaultClientProvider(); - return SslContextBuilder.forClient().sslProvider(sslProvider).build(); - } catch (SSLException sslException) { - logger.error("Fatal error cannot instantiate ssl context due to {}", sslException.getMessage(), sslException); - throw new IllegalStateException(sslException); - } - } - - public SslContext getSslContext() { - return this.sslContext; - } - - public Protocol getProtocol() { - String protocol = getJVMConfigAsString(PROTOCOL, DEFAULT_PROTOCOL.name()); - try { - return Protocol.valueOf(WordUtils.capitalize(protocol.toLowerCase())); - } catch (Exception e) { - logger.error("Parsing protocol {} failed. Using the default {}.", protocol, DEFAULT_PROTOCOL, e); - return DEFAULT_PROTOCOL; - } - } - - public int getMaxNumberOfReadBarrierReadRetries() { - return MAX_NUMBER_OF_READ_BARRIER_READ_RETRIES; - } - - public int getMaxNumberOfPrimaryReadRetries() { - return MAX_NUMBER_OF_PRIMARY_READ_RETRIES; - } - - public int getMaxNumberOfReadQuorumRetries() { - return MAX_NUMBER_OF_READ_QUORUM_RETRIES; - } - - public int getDelayBetweenReadBarrierCallsInMs() { - return DELAY_BETWEEN_READ_BARRIER_CALLS_IN_MS; - } - - public int getMaxBarrierRetriesForMultiRegion() { - return MAX_BARRIER_RETRIES_FOR_MULTI_REGION; - } - - public int getBarrierRetryIntervalInMsForMultiRegion() { - return BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION; - } - - public int getMaxShortBarrierRetriesForMultiRegion() { - return MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION; - } - - public int getShortBarrierRetryIntervalInMsForMultiRegion() { - return SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION; - } - - public int getDirectHttpsMaxConnectionLimit() { - return getJVMConfigAsInt(MAX_DIRECT_HTTPS_POOL_SIZE, DEFAULT_DIRECT_HTTPS_POOL_SIZE); - } - - public int getMaxHttpHeaderSize() { - return getJVMConfigAsInt(MAX_HTTP_HEADER_SIZE_IN_BYTES, DEFAULT_MAX_HTTP_REQUEST_HEADER_SIZE); - } - - public int getMaxHttpInitialLineLength() { - return getJVMConfigAsInt(MAX_HTTP_INITIAL_LINE_LENGTH_IN_BYTES, DEFAULT_MAX_HTTP_INITIAL_LINE_LENGTH); - } - - public int getMaxHttpChunkSize() { - return getJVMConfigAsInt(MAX_HTTP_CHUNK_SIZE_IN_BYTES, DEFAULT_MAX_HTTP_CHUNK_SIZE_IN_BYTES); - } - - public int getMaxHttpBodyLength() { - return getJVMConfigAsInt(MAX_HTTP_BODY_LENGTH_IN_BYTES, DEFAULT_MAX_HTTP_BODY_LENGTH_IN_BYTES); - } - - public int getUnavailableLocationsExpirationTimeInSeconds() { - return getJVMConfigAsInt(UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS, DEFAULT_UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS); - } - - private static String getJVMConfigAsString(String propName, String defaultValue) { - String propValue = System.getProperty(propName); - return StringUtils.defaultString(propValue, defaultValue); - } - - private static int getJVMConfigAsInt(String propName, int defaultValue) { - String propValue = System.getProperty(propName); - return getIntValue(propValue, defaultValue); - } - - private static int getIntValue(String val, int defaultValue) { - if (StringUtils.isEmpty(val)) { - return defaultValue; - } else { - return Integer.valueOf(val); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentServiceRequestContext.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentServiceRequestContext.java deleted file mode 100644 index 11adef562364..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentServiceRequestContext.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.net.URL; -import java.util.List; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResult; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.TimeoutHelper; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; - -public class DocumentServiceRequestContext implements Cloneable{ - public volatile boolean forceAddressRefresh; - public volatile boolean forceRefreshAddressCache; - public volatile RequestChargeTracker requestChargeTracker; - public volatile TimeoutHelper timeoutHelper; - public volatile String resolvedCollectionRid; - public volatile ISessionToken sessionToken; - public volatile long quorumSelectedLSN; - public volatile long globalCommittedSelectedLSN; - public volatile StoreResponse globalStrongWriteResponse; - public volatile ConsistencyLevel originalRequestConsistencyLevel; - public volatile PartitionKeyRange resolvedPartitionKeyRange; - public volatile Integer regionIndex; - public volatile Boolean usePreferredLocations; - public volatile Integer locationIndexToRoute; - public volatile URL locationEndpointToRoute; - public volatile boolean performedBackgroundAddressRefresh; - public volatile boolean performLocalRefreshOnGoneException; - public volatile List storeResponses; - public volatile StoreResult quorumSelectedStoreResponse; - public volatile PartitionKeyInternal effectivePartitionKey; - public volatile ClientSideRequestStatistics clientSideRequestStatistics; - - /** - * Sets routing directive for GlobalEndpointManager to resolve the request - * to endpoint based on location index. - * - * @param locationIndex Index of the location to which the request should be routed. - * @param usePreferredLocations Use preferred locations to route request. - */ - public void RouteToLocation(int locationIndex, boolean usePreferredLocations) { - this.locationIndexToRoute = locationIndex; - this.usePreferredLocations = usePreferredLocations; - this.locationEndpointToRoute = null; - } - - /** - * Sets location-based routing directive for GlobalEndpointManager to resolve - * the request to given locationEndpoint. - * - * @param locationEndpoint Location endpoint to which the request should be routed. - */ - public void RouteToLocation(URL locationEndpoint) { - this.locationEndpointToRoute = locationEndpoint; - this.locationIndexToRoute = null; - this.usePreferredLocations = null; - } - - /** - * Clears location-based routing directive - */ - public void ClearRouteToLocation() { - this.locationIndexToRoute = null; - this.locationEndpointToRoute = null; - this.usePreferredLocations = null; - } - - @Override - public DocumentServiceRequestContext clone() { - DocumentServiceRequestContext context = new DocumentServiceRequestContext(); - context.forceAddressRefresh = this.forceAddressRefresh; - context.forceRefreshAddressCache = this.forceRefreshAddressCache; - context.requestChargeTracker = this.requestChargeTracker; - context.timeoutHelper = this.timeoutHelper; - context.resolvedCollectionRid = this.resolvedCollectionRid; - context.sessionToken = this.sessionToken; - context.quorumSelectedLSN = this.quorumSelectedLSN; - context.globalCommittedSelectedLSN = this.globalCommittedSelectedLSN; - context.globalStrongWriteResponse = this.globalStrongWriteResponse; - context.originalRequestConsistencyLevel = this.originalRequestConsistencyLevel; - context.resolvedPartitionKeyRange = this.resolvedPartitionKeyRange; - context.regionIndex = this.regionIndex; - context.usePreferredLocations = this.usePreferredLocations; - context.locationIndexToRoute = this.locationIndexToRoute; - context.locationEndpointToRoute = this.locationEndpointToRoute; - context.performLocalRefreshOnGoneException = this.performLocalRefreshOnGoneException; - context.effectivePartitionKey = this.effectivePartitionKey; - context.performedBackgroundAddressRefresh = this.performedBackgroundAddressRefresh; - context.clientSideRequestStatistics = this.clientSideRequestStatistics; - - return context; - } -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Exceptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Exceptions.java deleted file mode 100644 index 08bea22645da..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Exceptions.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class Exceptions { - - public static boolean isStatusCode(DocumentClientException e, int status) { - return status == e.getStatusCode(); - } - - public static boolean isSubStatusCode(DocumentClientException e, int subStatus) { - return subStatus == e.getSubStatusCode(); - } - - public static boolean isPartitionSplit(DocumentClientException e) { - return isStatusCode(e, HttpConstants.StatusCodes.GONE) - && isSubStatusCode(e, HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE); - } - - public static boolean isNameCacheStale(DocumentClientException e) { - return isStatusCode(e, HttpConstants.StatusCodes.GONE) - && isSubStatusCode(e, HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/HttpClientFactory.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/HttpClientFactory.java deleted file mode 100644 index 99967bb8b404..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/HttpClientFactory.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.channel.ChannelPipeline; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.logging.LoggingHandler; -import io.netty.handler.proxy.HttpProxyHandler; -import io.netty.handler.ssl.SslContext; -import io.netty.handler.ssl.SslContextBuilder; -import io.netty.handler.ssl.SslHandler; -import io.netty.handler.ssl.SslProvider; -import io.reactivex.netty.pipeline.PipelineConfigurator; -import io.reactivex.netty.pipeline.PipelineConfiguratorComposite; -import io.reactivex.netty.pipeline.ssl.SSLEngineFactory; -import io.reactivex.netty.pipeline.ssl.SslCompletionHandler; -import io.reactivex.netty.protocol.http.HttpObjectAggregationConfigurator; -import io.reactivex.netty.protocol.http.client.CompositeHttpClientBuilder; -import io.reactivex.netty.protocol.http.client.HttpClient.HttpClientConfig; -import io.reactivex.netty.protocol.http.client.HttpClientPipelineConfigurator; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; - -import javax.net.ssl.SSLEngine; -import javax.net.ssl.SSLException; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import org.slf4j.LoggerFactory; - -import java.net.InetSocketAddress; -import java.util.concurrent.TimeUnit; - -/** - * Helper class internally used for instantiating rx http client. - */ -public class HttpClientFactory { - private final static String NETWORK_LOG_CATEGORY = "com.microsoft.azure.cosmosdb.netty-network"; - - private final Configs configs; - private Integer maxPoolSize; - private Integer maxIdleConnectionTimeoutInMillis; - private Integer requestTimeoutInMillis; - private InetSocketAddress proxy; - - public HttpClientFactory(Configs configs) { - this.configs = configs; - } - - public HttpClientFactory withPoolSize(int maxPoolSize) { - this.maxPoolSize = maxPoolSize; - return this; - } - - public HttpClientFactory withHttpProxy(InetSocketAddress proxy) { - this.proxy = proxy; - return this; - } - - public HttpClientFactory withMaxIdleConnectionTimeoutInMillis(int maxIdleConnectionTimeoutInMillis) { - this.maxIdleConnectionTimeoutInMillis = maxIdleConnectionTimeoutInMillis; - return this; - } - - public HttpClientFactory withRequestTimeoutInMillis(int requestTimeoutInMillis) { - this.requestTimeoutInMillis = requestTimeoutInMillis; - return this; - } - - class DefaultSSLEngineFactory implements SSLEngineFactory { - private final SslContext sslContext; - - private DefaultSSLEngineFactory() { - this.sslContext = configs.getSslContext(); - } - - @Override - public SSLEngine createSSLEngine(ByteBufAllocator allocator) { - return sslContext.newEngine(allocator); - } - } - class SslPipelineConfiguratorUsedWithProxy implements PipelineConfigurator { - - private final SSLEngineFactory sslEngineFactory; - - private SslPipelineConfiguratorUsedWithProxy(SSLEngineFactory sslEngineFactory) { - this.sslEngineFactory = sslEngineFactory; - } - - @Override - public void configureNewPipeline(ChannelPipeline pipeline) { - final SslHandler sslHandler = new SslHandler(sslEngineFactory.createSSLEngine(pipeline.channel().alloc())); - if(proxy != null) { - pipeline.addAfter(Constants.Properties.HTTP_PROXY_HANDLER_NAME,Constants.Properties.SSL_HANDLER_NAME, sslHandler); - } else { - pipeline.addFirst(Constants.Properties.SSL_HANDLER_NAME, sslHandler); - } - pipeline.addAfter(Constants.Properties.SSL_HANDLER_NAME, Constants.Properties.SSL_COMPLETION_HANDLER_NAME, - new SslCompletionHandler(sslHandler.handshakeFuture())); - } - } - - public CompositeHttpClientBuilder toHttpClientBuilder() { - - if (configs == null) { - throw new IllegalArgumentException("configs is null"); - } - - DefaultSSLEngineFactory defaultSSLEngineFactory = new DefaultSSLEngineFactory(); - CompositeHttpClientBuilder builder = new CompositeHttpClientBuilder(); - if (maxPoolSize != null) { - builder = builder.withMaxConnections(maxPoolSize); - } - - if (maxIdleConnectionTimeoutInMillis != null) { - builder = builder.withIdleConnectionsTimeoutMillis(maxIdleConnectionTimeoutInMillis); - } - - builder = builder.pipelineConfigurator(pipeline -> { - LoggingHandler loggingHandler = getLoggingHandler(); - - if (loggingHandler != null) { - pipeline.addFirst(Constants.Properties.LOGGING_HANDLER_NAME, loggingHandler); - } - - if(proxy != null) { - pipeline.addFirst(Constants.Properties.HTTP_PROXY_HANDLER_NAME, new HttpProxyHandler(proxy)); - } - }) - .appendPipelineConfigurator(new SslPipelineConfiguratorUsedWithProxy<>(defaultSSLEngineFactory)) - .appendPipelineConfigurator(createClientPipelineConfigurator(configs)); - - if (requestTimeoutInMillis != null) { - HttpClientConfig.Builder clientConfigBuilder = new HttpClientConfig.Builder(); - clientConfigBuilder.readTimeout(requestTimeoutInMillis, TimeUnit.MILLISECONDS); - return builder.config(clientConfigBuilder.build()); - } - - return builder; - } - - private static PipelineConfigurator createClientPipelineConfigurator(Configs config) { - PipelineConfigurator clientPipelineConfigurator = new PipelineConfiguratorComposite( - new HttpClientPipelineConfigurator( - config.getMaxHttpInitialLineLength(), - config.getMaxHttpHeaderSize(), - config.getMaxHttpChunkSize(), - true), - new HttpObjectAggregationConfigurator(config.getMaxHttpBodyLength())); - return clientPipelineConfigurator; - } - - private static LoggingHandler getLoggingHandler() { - if (LoggerFactory.getLogger(NETWORK_LOG_CATEGORY).isTraceEnabled()) { - return new LoggingHandler(NETWORK_LOG_CATEGORY, LogLevel.TRACE); - } - - return null; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InternalConstants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InternalConstants.java deleted file mode 100644 index 991b807d28b6..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InternalConstants.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -class InternalConstants { - - static class ResourceKeys { - static final String ATTACHMENTS = "Attachments"; - static final String CONFLICTS = "Conflicts"; - static final String DATABASES = "Databases"; - static final String DOCUMENTS = "Documents"; - static final String DOCUMENT_COLLECTIONS = "DocumentCollections"; - static final String OFFERS = "Offers"; - static final String PERMISSIONS = "Permissions"; - static final String PARTITION_KEY_RANGES = "PartitionKeyRanges"; - static final String TRIGGERS = "Triggers"; - static final String STOREDPROCEDURES = "StoredProcedures"; - static final String USERS = "Users"; - static final String USER_DEFINED_FUNCTIONS = "UserDefinedFunctions"; - static final String ADDRESSES = "Addresss"; - } - - static class StreamApi { - static final int STREAM_LENGTH_EOF = -1; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RMResources.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RMResources.java deleted file mode 100644 index 38a08c2476d5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RMResources.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -public class RMResources { - - public static final String UnknownResourceType = "Resource type %s is unknown"; - public static final String InvalidDocumentCollection = "The specified document collection is invalid."; - public static final String StringArgumentNullOrEmpty = "String agument %s is null or empty"; - public static final String PartitionKeyAndParitionKeyRangeIdBothSpecified = "Both Partition Key and Partition Key range are Specified in %s"; - public static final String PartitionKeyRangeIdOrPartitionKeyMustBeSpecified = "One of the partition key range id or partition key must be specified"; - public static final String TooFewPartitionKeyComponents = "PartitionKey has fewer components than defined the collection resource."; - public static final String TooManyPartitionKeyComponents = "PartitionKey has more components than defined the collection resource."; - public static final String UnableToDeserializePartitionKeyValue = "Cannot deserialize PartitionKey value '%s"; - public static final String Gone = "The requested resource is no longer available at the server."; - public static final String ExceptionMessageAddIpAddress = "%s, Local IP: %s"; - public static final String ExceptionMessage = "Message: %s"; - public static final String ServiceUnavailable = "Service is currently unavailable, please retry after a while. If this problem persists please contact support."; - public static final String InternalServerError = "Unknown server error occurred when processing this request."; - public static final String InvalidBackendResponse = "The backend response was not in the correct format."; - public static final String PartitionKeyRangeNotFound = "PartitionKeyRange with id %s in collection %s doesn't exist"; - public static final String InvalidTarget = "Target for the request is invalid"; - public static final String InvalidPartitionKey = "Partition key %s is invalid."; - public static final String PartitionKeyMismatch = "Partition key provided either doesn't correspond to definition in the collection or doesn't match partition key field values specified in the document."; - public static final String MissingPartitionKeyValue = "PartitionKey value must be supplied for this operation."; - public static final String InvalidConflictResolutionMode = "Invalid mode '%s' for setting '%s'. MODE expected is '%s'."; - public static final String InvalidRegionsInSessionToken = "Compared session tokens '%s' and '%s' has unexpected regions."; - public static final String InvalidSessionToken = "The session token provided '%s' is invalid."; - public static final String ResourceTokenNotFound = "Resource token not found."; - public static final String Unauthorized = "Unable to authenticate the request. The request requires valid user authentication."; - public static final String Forbidden = "Unable to proceed with the request. Please check the authorization claims to ensure the required permissions to process the request."; - public static final String NotFound = "Entity with the specified id does not exist in the system."; - public static final String BadRequest = "One of the input values is invalid."; - public static final String MethodNotAllowed = "The requested verb is not supported."; - public static final String EntityAlreadyExists = "Entity with the specified id already exists in the system."; - public static final String PreconditionFailed = "Operation cannot be performed because one of the specified precondition is not met."; - public static final String RequestEntityTooLarge = "The size of the response exceeded the maximum allowed size, limit the response size by specifying smaller value for '%s' header."; - public static final String Locked = ""; - public static final String RetryWith = "Retry the request."; - public static final String TooManyRequests = "The request rate is too large. Please retry after sometime."; - public static final String UnexpectedResourceType = "ResourceType %s is unexpected."; - public static final String InvalidHeaderValue = "Value '%s' specified for the header '%s' is invalid."; - public static final String RequestTimeout = "Request timed out."; - public static final String GlobalStrongWriteBarrierNotMet = "Global Strong write barrier has not been met for the request."; - public static final String InvalidRequestHeaderValue = "Invalid value for request header %s: %s"; - public static final String InvalidResourceAddress = "Invalid address for resource %s: %s"; - public static final String ReadQuorumNotMet = "Read Quorum size of %d is not met for the request."; - public static final String ReadSessionNotAvailable = "The read session is not available for the input session token."; - public static final String InvalidUrl = "InvalidUrl"; - public static final String InvalidResourceUrlQuery = "The value %s specified for query %s is invalid."; - public static final String PartitionKeyRangeIdAbsentInContext = "PartitionKeyRangeId is absent in the context."; -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceRequest.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceRequest.java deleted file mode 100644 index d1346deb44c0..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceRequest.java +++ /dev/null @@ -1,1060 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.io.InputStream; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptionsBase; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathInfo; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; - -import rx.Observable; -import rx.observables.StringObservable; - -/** - * This is core Transport/Connection agnostic request to the Azure Cosmos DB database service. - */ -public class RxDocumentServiceRequest { - private static final char PREFER_HEADER_SEPERATOR = ';'; - private static final String PREFER_HEADER_VALUE_FORMAT = "%s=%s"; - - public volatile boolean forcePartitionKeyRangeRefresh; - public volatile boolean forceCollectionRoutingMapRefresh; - private String resourceId; - private final ResourceType resourceType; - private final Map headers; - private volatile String continuation; - private boolean isMedia = false; - private final boolean isNameBased; - private final OperationType operationType; - private final String resourceAddress; - public volatile boolean forceNameCacheRefresh; - private volatile URI endpointOverride = null; - private final String activityId; - private volatile String resourceFullName; - - private volatile String originalSessionToken; - private volatile PartitionKeyRangeIdentity partitionKeyRangeIdentity; - private volatile Integer defaultReplicaIndex; - - public DocumentServiceRequestContext requestContext; - - private Observable contentObservable; - private byte[] byteContent; - - // NOTE: TODO: these fields are copied from .Net SDK - // some of these fields are missing from the main java sdk service request - // so it means most likely the corresponding features are also missing from the main sdk - // we need to wire this up. - public boolean UseGatewayMode; - - private volatile boolean isDisposed = false; - public volatile String entityId; - public volatile String queryString; - public volatile boolean isFeed; - public volatile AuthorizationTokenType authorizationTokenType; - public volatile Map properties; - - public boolean isReadOnlyRequest() { - return this.operationType == OperationType.Read - || this.operationType == OperationType.ReadFeed - || this.operationType == OperationType.Head - || this.operationType == OperationType.HeadFeed - || this.operationType == OperationType.Query - || this.operationType == OperationType.SqlQuery; - } - - public boolean isReadOnlyScript() { - String isReadOnlyScript = this.headers.get(HttpConstants.HttpHeaders.IS_READ_ONLY_SCRIPT); - if(StringUtils.isEmpty(isReadOnlyScript)) { - return false; - } else { - return this.operationType.equals(OperationType.ExecuteJavaScript) && isReadOnlyScript.equalsIgnoreCase(Boolean.TRUE.toString()); - } - } - - /** - * @param operationType the operation type. - * @param resourceIdOrFullName the request id or full name. - * @param resourceType the resource type. - * @param byteContent the byte content. - * @param headers the headers. - * @param isNameBased whether request is name based. - * @param authorizationTokenType the request authorizationTokenType. - */ - private RxDocumentServiceRequest(OperationType operationType, - String resourceIdOrFullName, - ResourceType resourceType, - byte[] byteContent, - Map headers, - boolean isNameBased, - AuthorizationTokenType authorizationTokenType) { - this.operationType = operationType; - this.forceNameCacheRefresh = false; - this.resourceType = resourceType; - this.byteContent = byteContent; - this.headers = headers != null ? headers : new HashMap<>(); - this.activityId = Utils.randomUUID().toString(); - this.isFeed = false; - this.isNameBased = isNameBased; - if (!isNameBased) { - this.resourceId = resourceIdOrFullName; - } - this.resourceAddress = resourceIdOrFullName; - this.authorizationTokenType = authorizationTokenType; - this.requestContext = new DocumentServiceRequestContext(); - if (StringUtils.isNotEmpty(this.headers.get(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID))) - this.partitionKeyRangeIdentity = PartitionKeyRangeIdentity.fromHeader(this.headers.get(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID)); - } - - /** - * Creates a AbstractDocumentServiceRequest - * - * @param operationType the operation type. - * @param resourceIdOrFullName the request id or full name. - * @param resourceType the resource type. - * @param path the path. - * @param headers the headers - */ - private RxDocumentServiceRequest(OperationType operationType, - String resourceIdOrFullName, - ResourceType resourceType, - String path, - Map headers) { - this.requestContext = new DocumentServiceRequestContext(); - this.operationType = operationType; - this.resourceType = resourceType; - this.requestContext.sessionToken = null; - this.headers = headers != null ? headers : new HashMap<>(); - this.activityId = Utils.randomUUID().toString(); - this.isFeed = false; - PathInfo pathInfo = new PathInfo(false, null, null, false); - if (StringUtils.isNotEmpty(path)) { - if (PathsHelper.tryParsePathSegments(path, pathInfo, null)) { - this.isNameBased = pathInfo.isNameBased; - this.isFeed = pathInfo.isFeed; - resourceIdOrFullName = pathInfo.resourceIdOrFullName; - if (!this.isNameBased) { - if (resourceType == ResourceType.Media) { - this.resourceId = getAttachmentIdFromMediaId(resourceIdOrFullName); - } else { - this.resourceId = resourceIdOrFullName; - } - - this.resourceAddress = resourceIdOrFullName; - - // throw exception when the address parsing fail - // do not parse address for offer resource - if (StringUtils.isNotEmpty(this.resourceId) && !ResourceId.tryParse(this.resourceId).getLeft() - && !resourceType.equals(ResourceType.Offer) && !resourceType.equals(ResourceType.Media) - && !resourceType.equals(ResourceType.MasterPartition) - && !resourceType.equals(ResourceType.ServerPartition) - && !resourceType.equals(ResourceType.DatabaseAccount) - && !resourceType.equals(ResourceType.RidRange)) { - throw new IllegalArgumentException( - String.format(RMResources.InvalidResourceUrlQuery, path, HttpConstants.QueryStrings.URL)); - } - } else { - this.resourceAddress = resourceIdOrFullName; - this.resourceId = null; - } - } else { - throw new IllegalArgumentException(RMResources.NotFound); - } - } else { - this.isNameBased = false; - this.resourceAddress = resourceIdOrFullName; - } - - if (StringUtils.isNotEmpty(this.headers.get(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID))) { - this.partitionKeyRangeIdentity = PartitionKeyRangeIdentity - .fromHeader(this.headers.get(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID)); - } - } - - /** - * Creates a DocumentServiceRequest - * - * @param resourceId the resource Id. - * @param resourceType the resource type. - * @param content the byte content observable\ - * @param contentObservable the byte content observable - * @param headers the request headers. - */ - private RxDocumentServiceRequest(OperationType operationType, - String resourceId, - ResourceType resourceType, - Observable contentObservable, - byte[] content, - String path, - Map headers, - AuthorizationTokenType authorizationTokenType) { - this( operationType, - resourceId, - resourceType, - path, - headers); - this.authorizationTokenType = authorizationTokenType; - this.byteContent = content; - this.contentObservable = contentObservable; - } - - /** - * Creates a DocumentServiceRequest with an HttpEntity. - * - * @param resourceType the resource type. - * @param path the relative URI path. - * @param contentObservable the byte content observable - * @param headers the request headers. - */ - private RxDocumentServiceRequest(OperationType operationType, - ResourceType resourceType, - String path, - Observable contentObservable, - Map headers, - AuthorizationTokenType authorizationTokenType) { - this(operationType, extractIdFromUri(path), resourceType, contentObservable, null, path, headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with an HttpEntity. - * - * @param resourceType the resource type. - * @param path the relative URI path. - * @param byteContent the byte content. - * @param headers the request headers. - */ - private RxDocumentServiceRequest(OperationType operationType, - ResourceType resourceType, - String path, - byte[] byteContent, - Map headers, - AuthorizationTokenType authorizationTokenType) { - this(operationType, extractIdFromUri(path), resourceType, null, byteContent, path, headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with an HttpEntity. - * - * @param resourceType the resource type. - * @param path the relative URI path. - * @param headers the request headers. - */ - private RxDocumentServiceRequest(OperationType operationType, - ResourceType resourceType, - String path, - Map headers, - AuthorizationTokenType authorizationTokenType) { - this(operationType, extractIdFromUri(path), resourceType, null , null, path, headers, authorizationTokenType); - } - - public void setContentBytes(byte[] bytes) { - this.byteContent = bytes; - } - - /** - * Creates a DocumentServiceRequest with a stream. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param content the content observable - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Observable content, - Map headers) { - return new RxDocumentServiceRequest(operation, resourceType, relativePath, content, headers, AuthorizationTokenType.PrimaryMasterKey); - } - - /** - * Creates a DocumentServiceRequest with a stream. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param content the content observable - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Observable content, - Map headers, - AuthorizationTokenType authorizationTokenType) { - return new RxDocumentServiceRequest(operation, resourceType, relativePath, content, headers, authorizationTokenType); - } - - /** Creates a DocumentServiceRequest with a stream. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param inputStream the input stream. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - InputStream inputStream, - Map headers) { - // StringObservable is mis-named. It doesn't make any assumptions on character set - // and handles bytes only - return new RxDocumentServiceRequest(operation, resourceType, relativePath, StringObservable.from(inputStream), headers, AuthorizationTokenType.PrimaryMasterKey); - } - - /** Creates a DocumentServiceRequest with a stream. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param inputStream the input stream. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - InputStream inputStream, - Map headers, - AuthorizationTokenType authorizationTokenType) { - // StringObservable is mis-named. It doesn't make any assumptions on character set - // and handles bytes only - return new RxDocumentServiceRequest(operation, resourceType, relativePath, StringObservable.from(inputStream), headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with a resource. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param resource the resource of the request. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Resource resource, - Map headers) { - return RxDocumentServiceRequest.create(operation, resourceType, relativePath, resource, headers, (RequestOptions)null); - } - - /** - * Creates a DocumentServiceRequest with a resource. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param resource the resource of the request. - * @param headers the request headers. - * @param options the request/feed/changeFeed options. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Resource resource, - Map headers, - Object options) { - - RxDocumentServiceRequest request = new RxDocumentServiceRequest(operation, resourceType, relativePath, - // TODO: this re-encodes, can we improve performance here? - resource.toJson().getBytes(StandardCharsets.UTF_8), headers, AuthorizationTokenType.PrimaryMasterKey); - request.properties = getProperties(options); - return request; - } - - /** - * Creates a DocumentServiceRequest with a query. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param query the query. - * @param headers the request headers. - * @param options the request/feed/changeFeed options. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - String query, - Map headers, - Object options) { - RxDocumentServiceRequest request = new RxDocumentServiceRequest(operation, resourceType, relativePath, - query.getBytes(StandardCharsets.UTF_8), headers, AuthorizationTokenType.PrimaryMasterKey); - request.properties = getProperties(options); - return request; - } - - /** - * Creates a DocumentServiceRequest with a query. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param query the query. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - String query, - Map headers, - AuthorizationTokenType authorizationTokenType) { - return new RxDocumentServiceRequest(operation, resourceType, relativePath, - query.getBytes(StandardCharsets.UTF_8), headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with a query. - * - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param querySpec the query. - * @param queryCompatibilityMode the QueryCompatibilityMode mode. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(ResourceType resourceType, - String relativePath, - SqlQuerySpec querySpec, - QueryCompatibilityMode queryCompatibilityMode, - Map headers) { - OperationType operation; - String queryText; - switch (queryCompatibilityMode) { - case SqlQuery: - if (querySpec.getParameters() != null && querySpec.getParameters().size() > 0) { - throw new IllegalArgumentException( - String.format("Unsupported argument in query compatibility mode '{%s}'", - queryCompatibilityMode.name())); - } - - operation = OperationType.SqlQuery; - queryText = querySpec.getQueryText(); - break; - - case Default: - case Query: - default: - operation = OperationType.Query; - queryText = querySpec.toJson(); - break; - } - - Observable body = StringObservable.encode(Observable.just(queryText), StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operation, resourceType, relativePath, body, headers, AuthorizationTokenType.PrimaryMasterKey); - } - - /** - * Creates a DocumentServiceRequest without body. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Map headers) { - return RxDocumentServiceRequest.create(operation, resourceType, relativePath, headers, (RequestOptions)null); - } - - /** - * Creates a DocumentServiceRequest without body. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param headers the request headers. - * @param options the request/feed/changeFeed options. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Map headers, - Object options) { - RxDocumentServiceRequest request = new RxDocumentServiceRequest(operation, resourceType, relativePath, headers, AuthorizationTokenType.PrimaryMasterKey); - request.properties = getProperties(options); - return request; - } - - /** - * Creates a DocumentServiceRequest without body. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Map headers, - AuthorizationTokenType authorizationTokenType) { - return new RxDocumentServiceRequest(operation, resourceType, relativePath, headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest without body. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - Resource resource, - ResourceType resourceType, - String relativePath, - Map headers) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operation, resourceType, relativePath, resourceContent, headers, AuthorizationTokenType.PrimaryMasterKey); - } - - /** - * Creates a DocumentServiceRequest without body. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - Resource resource, - ResourceType resourceType, - String relativePath, - Map headers, - AuthorizationTokenType authorizationTokenType) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operation, resourceType, relativePath, resourceContent, headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with a resourceId. - * - * @param operation the operation type. - * @param resourceId the resource id. - * @param resourceType the resource type. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - String resourceId, - ResourceType resourceType, - Map headers) { - return new RxDocumentServiceRequest(operation, resourceId,resourceType, null, headers, false, AuthorizationTokenType.PrimaryMasterKey) ; - } - - /** - * Creates a DocumentServiceRequest with a resourceId. - * - * @param operation the operation type. - * @param resourceId the resource id. - * @param resourceType the resource type. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - String resourceId, - ResourceType resourceType, - Map headers, - AuthorizationTokenType authorizationTokenType) { - return new RxDocumentServiceRequest(operation, resourceId, resourceType, null, headers, false, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with a resourceId. - * - * @param operation the operation type. - * @param resourceId the resource id. - * @param resourceType the resource type. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - String resourceId, - ResourceType resourceType, - Resource resource, - Map headers) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operation, resourceId, resourceType, resourceContent, headers, false, AuthorizationTokenType.PrimaryMasterKey); - } - - /** - * Creates a DocumentServiceRequest with a resourceId. - * - * @param operation the operation type. - * @param resourceId the resource id. - * @param resourceType the resource type. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - String resourceId, - ResourceType resourceType, - Resource resource, - Map headers, - AuthorizationTokenType authorizationTokenType) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operation, resourceId, resourceType, resourceContent, headers, false, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with operationType and resourceType - * @param operation the operation type - * @param resourceType the resource type - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType) { - return new RxDocumentServiceRequest(operation, null, resourceType, null, null); - } - - public static RxDocumentServiceRequest createFromName( - OperationType operationType, - String resourceFullName, - ResourceType resourceType) { - return new RxDocumentServiceRequest(operationType, - resourceFullName, - resourceType, - null, - new HashMap<>(), - true, - AuthorizationTokenType.PrimaryMasterKey - ); - } - - public static RxDocumentServiceRequest createFromName( - OperationType operationType, - String resourceFullName, - ResourceType resourceType, - AuthorizationTokenType authorizationTokenType) { - return new RxDocumentServiceRequest(operationType, - resourceFullName, - resourceType, - null, - new HashMap<>(), - true, - authorizationTokenType - ); - } - - public static RxDocumentServiceRequest createFromName( - OperationType operationType, - Resource resource, - String resourceFullName, - ResourceType resourceType) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operationType, - resourceFullName, - resourceType, - resourceContent, - new HashMap<>(), - true, - AuthorizationTokenType.PrimaryMasterKey - ); - } - - public static RxDocumentServiceRequest createFromName( - OperationType operationType, - Resource resource, - String resourceFullName, - ResourceType resourceType, - AuthorizationTokenType authorizationTokenType) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operationType, - resourceFullName, - resourceType, - resourceContent, - new HashMap<>(), - true, - authorizationTokenType - ); - } - - private static String extractIdFromUri(String path) { - if (path.length() == 0) { - return path; - } - - if (path.charAt(path.length() - 1) != '/') { - path = path + '/'; - } - - if (path.charAt(0) != '/') { - path = '/' + path; - } - // This is a hack. We need a padding '=' so that path.split("/") - // returns even number of string pieces. - // TODO(pushi): Improve the code and remove the hack. - path = path + '='; - - // The path will be in the form of - // /[resourceType]/[resourceId]/ or - // /[resourceType]/[resourceId]/[resourceType]/ - // The result of split will be in the form of - // [[[resourceType], [resourceId] ... ,[resourceType], ""] - // In the first case, to extract the resourceId it will the element - // before last ( at length -2 ) and the type will before it - // ( at length -3 ) - // In the second case, to extract the resource type it will the element - // before last ( at length -2 ) - String[] pathParts = StringUtils.split(path, "/"); - if (pathParts.length % 2 == 0) { - // request in form /[resourceType]/[resourceId]/. - return pathParts[pathParts.length - 2]; - } else { - // request in form /[resourceType]/[resourceId]/[resourceType]/. - return pathParts[pathParts.length - 3]; - } - } - - static String getAttachmentIdFromMediaId(String mediaId) { - // '/' was replaced with '-'. - byte[] buffer = Utils.Base64Decoder.decode(mediaId.replace('-', '/').getBytes()); - - final int resoureIdLength = 20; - String attachmentId; - - if (buffer.length > resoureIdLength) { - // We are cuting off the storage index. - byte[] newBuffer = new byte[resoureIdLength]; - System.arraycopy(buffer, 0, newBuffer, 0, resoureIdLength); - attachmentId = Utils.encodeBase64String(newBuffer).replace('/', '-'); - } else { - attachmentId = mediaId; - } - - return attachmentId; - } - - /** - * Gets the resource id. - * - * @return the resource id. - */ - public String getResourceId() { - return this.resourceId; - } - - /** - * Sets the resource id. - * - */ - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - - /** - * Gets the resource type. - * - * @return the resource type. - */ - public ResourceType getResourceType() { - return this.resourceType; - } - - /** - * Gets the request headers. - * - * @return the request headers. - */ - public Map getHeaders() { - return this.headers; - } - - /** - * Gets the continuation. - * - * @return the continuation. - */ - public String getContinuation() { - return this.continuation; - } - - public void setContinuation(String continuation) { - this.continuation = continuation; - } - - public boolean getIsMedia() { - return this.isMedia; - } - - public void setIsMedia(boolean isMedia) { - this.isMedia = isMedia; - } - - public boolean getIsNameBased() { - return this.isNameBased; - } - - public OperationType getOperationType() { - return this.operationType; - } - - public String getResourceAddress() { - return resourceAddress; - } - - public boolean isForceNameCacheRefresh() { - return forceNameCacheRefresh; - } - - public void setForceNameCacheRefresh(boolean forceNameCacheRefresh) { - this.forceNameCacheRefresh = forceNameCacheRefresh; - } - - public URI getEndpointOverride() { - return this.endpointOverride; - } - - public void setEndpointOverride(URI endpointOverride) { - this.endpointOverride = endpointOverride; - } - - public String getActivityId() { - return this.activityId; - } - - public PartitionKeyRangeIdentity getPartitionKeyRangeIdentity() { - return partitionKeyRangeIdentity; - } - - public void routeTo(PartitionKeyRangeIdentity partitionKeyRangeIdentity) { - this.setPartitionKeyRangeIdentity(partitionKeyRangeIdentity); - } - - public void setPartitionKeyRangeIdentity(PartitionKeyRangeIdentity partitionKeyRangeIdentity) { - this.partitionKeyRangeIdentity = partitionKeyRangeIdentity; - if (partitionKeyRangeIdentity != null) { - this.headers.put(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeIdentity.toHeader()); - } else { - this.headers.remove(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID); - } - } - - public String getOriginalSessionToken() { - return originalSessionToken; - } - - public void setOriginalSessionToken(String originalSessionToken) { - this.originalSessionToken = originalSessionToken; - } - - public void setDefaultReplicaIndex(Integer defaultReplicaIndex) { - this.defaultReplicaIndex = defaultReplicaIndex; - } - - public Integer getDefaultReplicaIndex() { - return defaultReplicaIndex; - } - - public boolean isChangeFeedRequest() { - return this.headers.containsKey(HttpConstants.HttpHeaders.A_IM); - } - - public boolean isWritingToMaster() { - return operationType.isWriteOperation() && resourceType.isMasterResource(); - } - - public boolean isReadingFromMaster() { - if (resourceType == ResourceType.Offer || - resourceType == ResourceType.Database || - resourceType == ResourceType.User || - resourceType == ResourceType.Permission || - resourceType == ResourceType.Topology || - resourceType == ResourceType.DatabaseAccount || - resourceType == ResourceType.PartitionKeyRange || - (resourceType == ResourceType.DocumentCollection - && (operationType == OperationType.ReadFeed - || operationType == OperationType.Query - || operationType == OperationType.SqlQuery))) { - return true; - } - return false; - } - - public boolean isValidAddress(ResourceType resourceType) { - ResourceType resourceTypeToValidate = ResourceType.Unknown; - - if(resourceType != ResourceType.Unknown) { - resourceTypeToValidate = resourceType; - } else { - if(!this.isFeed) { - resourceTypeToValidate =this.resourceType; - } else { - if(this.resourceType == ResourceType.Database) { - return true; - } else if(this.resourceType == ResourceType.DocumentCollection || - this.resourceType == ResourceType.User) { - resourceTypeToValidate = ResourceType.Database; - } else if(this.resourceType == ResourceType.Permission) { - resourceTypeToValidate = ResourceType.User; - } else if(this.resourceType == ResourceType.Document || - this.resourceType == ResourceType.StoredProcedure || - this.resourceType == ResourceType.UserDefinedFunction || - this.resourceType == ResourceType.Trigger || - this.resourceType == ResourceType.Conflict || - this.resourceType == ResourceType.PartitionKeyRange) { - resourceTypeToValidate = ResourceType.DocumentCollection; - } else if(this.resourceType == ResourceType.Attachment) { - resourceTypeToValidate = ResourceType.Document; - } else { - return false; - } - } - } - - if (this.isNameBased) { - return PathsHelper.validateResourceFullName(resourceType != ResourceType.Unknown ? resourceType : resourceTypeToValidate, this.resourceAddress); - } else { - return PathsHelper.validateResourceId(resourceTypeToValidate, this.resourceId); - } - } - - public void addPreferHeader(String preferHeaderName, String preferHeaderValue) { - String headerToAdd = String.format(PREFER_HEADER_VALUE_FORMAT, preferHeaderName, preferHeaderValue); - String preferHeader = this.headers.get(HttpConstants.HttpHeaders.PREFER); - if(StringUtils.isNotEmpty(preferHeader)) { - preferHeader += PREFER_HEADER_SEPERATOR + headerToAdd; - } else { - preferHeader = headerToAdd; - } - this.headers.put(HttpConstants.HttpHeaders.PREFER, preferHeader); - } - - public static RxDocumentServiceRequest CreateFromResource(RxDocumentServiceRequest request, Resource modifiedResource) { - RxDocumentServiceRequest modifiedRequest; - if (!request.getIsNameBased()) { - modifiedRequest = RxDocumentServiceRequest.create(request.getOperationType(), - request.getResourceId(), - request.getResourceType(), - modifiedResource, - request.headers); - } else { - modifiedRequest = RxDocumentServiceRequest.createFromName(request.getOperationType(), - modifiedResource, - request.getResourceAddress(), - request.getResourceType()); - } - return modifiedRequest; - } - - public void clearRoutingHints() { - this.partitionKeyRangeIdentity = null; - this.requestContext.resolvedPartitionKeyRange = null; - } - - public Observable getContentObservable() { - return contentObservable; - } - - public byte[] getContent() { - return byteContent; - } - - public RxDocumentServiceRequest clone() { - RxDocumentServiceRequest rxDocumentServiceRequest = RxDocumentServiceRequest.create(this.getOperationType(), this.resourceId,this.getResourceType(),this.getHeaders()); - rxDocumentServiceRequest.setContentBytes(this.getContent()); - rxDocumentServiceRequest.setContinuation(this.getContinuation()); - rxDocumentServiceRequest.setDefaultReplicaIndex(this.getDefaultReplicaIndex()); - rxDocumentServiceRequest.setEndpointOverride(this.getEndpointOverride()); - rxDocumentServiceRequest.setForceNameCacheRefresh(this.isForceNameCacheRefresh()); - rxDocumentServiceRequest.setIsMedia(this.getIsMedia()); - rxDocumentServiceRequest.setOriginalSessionToken(this.getOriginalSessionToken()); - rxDocumentServiceRequest.setPartitionKeyRangeIdentity(this.getPartitionKeyRangeIdentity()); - rxDocumentServiceRequest.contentObservable = this.getContentObservable(); - rxDocumentServiceRequest.forceCollectionRoutingMapRefresh = this.forceCollectionRoutingMapRefresh; - rxDocumentServiceRequest.forcePartitionKeyRangeRefresh = this.forcePartitionKeyRangeRefresh; - rxDocumentServiceRequest.UseGatewayMode = this.UseGatewayMode; - rxDocumentServiceRequest.queryString = this.queryString; - rxDocumentServiceRequest.requestContext = this.requestContext; - return rxDocumentServiceRequest; - } - - public void Dispose() { - if (this.isDisposed) { - return; - } - - if (this.byteContent != null) { - this.byteContent = null; - } - - this.isDisposed = true; - } - - private static Map getProperties(Object options) { - if (options == null) { - return null; - } else if (options instanceof RequestOptions) { - return ((RequestOptions) options).getProperties(); - } else if (options instanceof FeedOptionsBase) { - return ((FeedOptionsBase) options).getProperties(); - } else { - return null; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceResponse.java deleted file mode 100644 index 0cc618257ab5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceResponse.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Address; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import org.apache.commons.lang3.StringUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * This is core Transport/Connection agnostic response for the Azure Cosmos DB database service. - */ -public class RxDocumentServiceResponse { - private final int statusCode; - private final Map headersMap; - private final StoreResponse storeResponse; - - public RxDocumentServiceResponse(StoreResponse response) { - String[] headerNames = response.getResponseHeaderNames(); - String[] headerValues = response.getResponseHeaderValues(); - - this.headersMap = new HashMap<>(headerNames.length); - - // Gets status code. - this.statusCode = response.getStatus(); - - // Extracts headers. - for (int i = 0; i < headerNames.length; i++) { - this.headersMap.put(headerNames[i], headerValues[i]); - } - - this.storeResponse = response; - } - - public static String getResourceKey(Class c) { - if (c.equals(Attachment.class)) { - return InternalConstants.ResourceKeys.ATTACHMENTS; - } else if (c.equals(Conflict.class)) { - return InternalConstants.ResourceKeys.CONFLICTS; - } else if (c.equals(Database.class)) { - return InternalConstants.ResourceKeys.DATABASES; - } else if (Document.class.isAssignableFrom(c)) { - return InternalConstants.ResourceKeys.DOCUMENTS; - } else if (c.equals(DocumentCollection.class)) { - return InternalConstants.ResourceKeys.DOCUMENT_COLLECTIONS; - } else if (c.equals(Offer.class)) { - return InternalConstants.ResourceKeys.OFFERS; - } else if (c.equals(Permission.class)) { - return InternalConstants.ResourceKeys.PERMISSIONS; - } else if (c.equals(Trigger.class)) { - return InternalConstants.ResourceKeys.TRIGGERS; - } else if (c.equals(StoredProcedure.class)) { - return InternalConstants.ResourceKeys.STOREDPROCEDURES; - } else if (c.equals(User.class)) { - return InternalConstants.ResourceKeys.USERS; - } else if (c.equals(UserDefinedFunction.class)) { - return InternalConstants.ResourceKeys.USER_DEFINED_FUNCTIONS; - } else if (c.equals(Address.class)) { - return InternalConstants.ResourceKeys.ADDRESSES; - } else if (c.equals(PartitionKeyRange.class)) { - return InternalConstants.ResourceKeys.PARTITION_KEY_RANGES; - } - - throw new IllegalArgumentException("c"); - } - - public int getStatusCode() { - return this.statusCode; - } - - public Map getResponseHeaders() { - return this.headersMap; - } - - public String getReponseBodyAsString() { - return this.storeResponse.getResponseBody(); - } - - public T getResource(Class c) { - String responseBody = this.getReponseBodyAsString(); - if (StringUtils.isEmpty(responseBody)) - return null; - - T resource = null; - try { - resource = c.getConstructor(String.class).newInstance(responseBody); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - if(PathsHelper.isPublicResource(resource)) { - BridgeInternal.setAltLink(resource, PathsHelper.generatePathForNameBased(resource, this.getOwnerFullName(),resource.getId())); - } - - return resource; - } - - public List getQueryResponse(Class c) { - String responseBody = this.getReponseBodyAsString(); - if (responseBody == null) { - return new ArrayList(); - } - - JsonNode jobject = fromJson(responseBody); - String resourceKey = RxDocumentServiceResponse.getResourceKey(c); - ArrayNode jTokenArray = (ArrayNode) jobject.get(resourceKey); - - // Aggregate queries may return a nested array - ArrayNode innerArray; - while (jTokenArray != null && jTokenArray.size() == 1 && (innerArray = toArrayNode(jTokenArray.get(0))) != null) { - jTokenArray = innerArray; - } - - List queryResults = new ArrayList(); - - if (jTokenArray != null) { - for (int i = 0; i < jTokenArray.size(); ++i) { - JsonNode jToken = jTokenArray.get(i); - // Aggregate on single partition collection may return the aggregated value only - // In that case it needs to encapsulated in a special document - String resourceJson = jToken.isNumber() || jToken.isBoolean() - ? String.format("{\"%s\": %s}", Constants.Properties.AGGREGATE, jToken.asText()) - : toJson(jToken); - T resource = null; - try { - resource = c.getConstructor(String.class).newInstance(resourceJson); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - - queryResults.add(resource); - } - } - - return queryResults; - } - - private ArrayNode toArrayNode(JsonNode n) { - if (n.isArray()) { - return (ArrayNode) n; - } else { - return null; - } - } - - private static JsonNode fromJson(String json){ - try { - return Utils.getSimpleObjectMapper().readTree(json); - } catch (IOException e) { - throw new IllegalStateException(String.format("Unable to parse JSON %s", json), e); - } - } - - private static String toJson(Object object){ - try { - return Utils.getSimpleObjectMapper().writeValueAsString(object); - } catch (JsonProcessingException e) { - throw new IllegalStateException("Can't serialize the object into the json string", e); - } - } - - private String getOwnerFullName() { - if (this.headersMap != null) { - return this.headersMap.get(HttpConstants.HttpHeaders.OWNER_FULL_NAME); - } - return null; - } - - public InputStream getContentStream() { - return this.storeResponse.getResponseStream(); - } - - public ClientSideRequestStatistics getClientSideRequestStatistics() { - if (this.storeResponse == null) { - return null; - } - return this.storeResponse.getClientSideRequestStatistics(); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Strings.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Strings.java deleted file mode 100644 index 468872ac4319..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Strings.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import org.apache.commons.lang3.StringUtils; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class Strings { - public static final String Emtpy = ""; - - public static boolean isNullOrWhiteSpace(String str) { - return StringUtils.isEmpty(str) || StringUtils.isWhitespace(str); - } - public static boolean isNullOrEmpty(String str) { - return StringUtils.isEmpty(str); - } - - public static String toString(boolean value) { - return Boolean.toString(value); - } - - public static String toString(int value) { - return Integer.toString(value); - } - - public static boolean areEqual(String str1, String str2) { - return StringUtils.equals(str1, str2); - } - - public static boolean areEqualIgnoreCase(String str1, String str2) { - return StringUtils.equalsIgnoreCase(str1, str2); - } - - public static boolean containsIgnoreCase(String str1, String str2) { - return StringUtils.containsIgnoreCase(str1, str2); - } - - public static int compare(String str1, String str2) { - return StringUtils.compare(str1, str2); - } - - public static String toCamelCase(String str) { - if (isNullOrEmpty(str)) { - return str; - } - - return str.substring(0, 1).toUpperCase() + str.substring(1, str.length()).toLowerCase(); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Utils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Utils.java deleted file mode 100644 index 118aa91d3f0b..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Utils.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class Utils { - - public static int getValueOrDefault(Integer val, int defaultValue) { - return val != null ? val.intValue() : defaultValue; - } - - public static void checkStateOrThrow(boolean value, String argumentName, String message) throws IllegalArgumentException { - - IllegalArgumentException t = checkStateOrReturnException(value, argumentName, message); - if (t != null) { - throw t; - } - } - - public static void checkNotNullOrThrow(Object val, String argumentName, String message) throws NullPointerException { - - NullPointerException t = checkNotNullOrReturnException(val, argumentName, message); - if (t != null) { - throw t; - } - } - - public static void checkStateOrThrow(boolean value, String argumentName, String messageTemplate, Object... messageTemplateParams) throws IllegalArgumentException { - IllegalArgumentException t = checkStateOrReturnException(value, argumentName, argumentName, messageTemplateParams); - if (t != null) { - throw t; - } - } - - public static IllegalArgumentException checkStateOrReturnException(boolean value, String argumentName, String message) { - - if (value) { - return null; - } - - return new IllegalArgumentException(String.format("argumentName: %s, message: %s", argumentName, message)); - } - - public static IllegalArgumentException checkStateOrReturnException(boolean value, String argumentName, String messageTemplate, Object... messageTemplateParams) { - if (value) { - return null; - } - - return new IllegalArgumentException(String.format("argumentName: %s, message: %s", argumentName, String.format(messageTemplate, messageTemplateParams))); - } - - private static NullPointerException checkNotNullOrReturnException(Object val, String argumentName, String messageTemplate, Object... messageTemplateParams) { - if (val != null) { - return null; - } - - return new NullPointerException(String.format("argumentName: %s, message: %s", argumentName, String.format(messageTemplate, messageTemplateParams))); - } - - public static BadRequestException checkRequestOrReturnException(boolean value, String argumentName, String message) { - - if (value) { - return null; - } - - return new BadRequestException(String.format("argumentName: %s, message: %s", argumentName, message)); - } - - public static BadRequestException checkRequestOrReturnException(boolean value, String argumentName, String messageTemplate, Object... messageTemplateParams) { - if (value) { - return null; - } - - return new BadRequestException(String.format("argumentName: %s, message: %s", argumentName, String.format(messageTemplate, messageTemplateParams))); - } - - @SuppressWarnings("unchecked") - public static O as(I i, Class klass) { - if (i == null) { - return null; - } - - if (klass.isInstance(i)) { - return (O) i; - } else { - return null; - } - } - - @SuppressWarnings("unchecked") - public static List immutableListOf() { - return Collections.EMPTY_LIST; - } - - public static List immutableListOf(V v1) { - List list = new ArrayList<>(); - list.add(v1); - return Collections.unmodifiableList(list); - } - - public static MapimmutableMapOf() { - return Collections.emptyMap(); - } - - public static MapimmutableMapOf(K k1, V v1) { - Map map = new HashMap(); - map.put(k1, v1); - map = Collections.unmodifiableMap(map); - return map; - } - - public static V firstOrDefault(List list) { - return list.size() > 0? list.get(0) : null ; - } - - public static class ValueHolder { - - public ValueHolder() { - } - - public ValueHolder(V v) { - this.v = v; - } - public V v; - - public static ValueHolder initialize(T v) { - return new ValueHolder(v); - } - } - - public static boolean tryGetValue(Map dictionary, K key, ValueHolder holder) { - // doesn't work for dictionary with null value - holder.v = dictionary.get(key); - return holder.v != null; - } - - public static boolean tryRemove(Map dictionary, K key, ValueHolder holder) { - // doesn't work for dictionary with null value - holder.v = dictionary.remove(key); - return holder.v != null; - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConflictTests.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConflictTests.java deleted file mode 100644 index 9139d319d52e..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConflictTests.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.io.IOUtils; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConflictTests { - private String conflictAsString; - - @BeforeClass(groups = { "unit" }) - public void setup() throws Exception { - conflictAsString = IOUtils.toString( - getClass().getClassLoader().getResourceAsStream("sampleConflict.json"), "UTF-8"); - } - - @Test(groups = { "unit" }) - public void getSourceResourceId() { - Conflict conf = new Conflict(conflictAsString); - assertThat(conf.getSourceResourceId()).isEqualTo("k6d9ALgBmD+ChB4AAAAAAA=="); - } - - @Test(groups = { "unit" }) - public void getOperationKind() { - Conflict conf = new Conflict(conflictAsString); - assertThat(conf.getOperationKind()).isEqualTo("create"); - conf.getSourceResourceId(); - } - - @Test(groups = { "unit" }) - public void getResourceType() { - Conflict conf = new Conflict(conflictAsString); - assertThat(conf.getResouceType()).isEqualTo("document"); - conf.getSourceResourceId(); - } - - @Test(groups = { "unit" }) - public void getResource() { - Conflict conf = new Conflict(conflictAsString); - Document doc = conf.getResource(Document.class); - assertThat(doc.getId()).isEqualTo("0007312a-a1c5-4b54-9e39-35de2367fa33"); - assertThat(doc.getInt("regionId")).isEqualTo(2); - assertThat(doc.getResourceId()).isEqualTo("k6d9ALgBmD+ChB4AAAAAAA=="); - assertThat(doc.getETag()).isEqualTo("\"00000200-0000-0000-0000-5b6e214b0000\""); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConnectionPolicyTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConnectionPolicyTest.java deleted file mode 100644 index 5b4d34817b6a..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConnectionPolicyTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConnectionPolicyTest { - - @DataProvider(name = "connectionModeArgProvider") - public Object[][] connectionModeArgProvider() { - return new Object[][]{ - { ConnectionMode.Gateway }, - { ConnectionMode.Direct }, - }; - } - - @Test(groups = { "unit" }, dataProvider = "connectionModeArgProvider") - public void connectionMode(ConnectionMode connectionMode) { - ConnectionPolicy policy = new ConnectionPolicy(); - policy.setConnectionMode(connectionMode); - - assertThat(policy.getConnectionMode()).isEqualTo(connectionMode); - } - - @DataProvider(name = "connectionProtocolModeArgProvider") - public Object[][] connectionProtocolModeArgProvider() { - return new Object[][]{ - { Protocol.Https }, - { Protocol.Tcp }, - }; - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentClientExceptionTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentClientExceptionTest.java deleted file mode 100644 index ddf535c3c577..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentClientExceptionTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.google.common.collect.ImmutableMap; -import org.testng.annotations.Test; - -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DocumentClientExceptionTest { - - @Test(groups = { "unit" }) - public void headerNotNull1() { - DocumentClientException dce = new DocumentClientException(0); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull2() { - DocumentClientException dce = new DocumentClientException(0, "dummy"); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull3() { - DocumentClientException dce = new DocumentClientException(0, new RuntimeException()); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull4() { - DocumentClientException dce = new DocumentClientException(0, (Error) null, (Map) null); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull5() { - DocumentClientException dce = new DocumentClientException((String) null, 0, (Error) null, (Map) null); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull6() { - DocumentClientException dce = new DocumentClientException((String) null, (Exception) null, (Map) null, 0, (String) null); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull7() { - ImmutableMap respHeaders = ImmutableMap.of("key", "value"); - DocumentClientException dce = new DocumentClientException((String) null, (Exception) null, respHeaders, 0, (String) null); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).contains(respHeaders.entrySet().iterator().next()); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentCollectionTests.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentCollectionTests.java deleted file mode 100644 index 2e11ed6134e1..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentCollectionTests.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.google.common.collect.ImmutableList; -import org.testng.annotations.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DocumentCollectionTests { - - @Test(groups = { "unit" }) - public void getPartitionKey() { - DocumentCollection collection = new DocumentCollection(); - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - partitionKeyDefinition.setPaths(ImmutableList.of("/mypk")); - collection.setPartitionKey(partitionKeyDefinition); - assertThat(collection.getPartitionKey()).isEqualTo(partitionKeyDefinition); - } - - @Test(groups = { "unit" }) - public void getPartitionKey_serializeAndDeserialize() { - DocumentCollection collection = new DocumentCollection(); - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - partitionKeyDefinition.setPaths(ImmutableList.of("/mypk")); - partitionKeyDefinition.setVersion(PartitionKeyDefinitionVersion.V2); - collection.setPartitionKey(partitionKeyDefinition); - - DocumentCollection parsedColl = new DocumentCollection(collection.toJson()); - assertThat(parsedColl.getPartitionKey().getKind().toString()).isEqualTo(partitionKeyDefinition.getKind().toString()); - assertThat(parsedColl.getPartitionKey().getPaths()).isEqualTo(partitionKeyDefinition.getPaths()); - assertThat(parsedColl.getPartitionKey().getVersion()).isEqualTo(partitionKeyDefinition.getVersion()); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentTests.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentTests.java deleted file mode 100644 index d3777240f00f..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentTests.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Date; - -import org.testng.annotations.Test; - -public class DocumentTests { - - @Test(groups = { "unit" }) - public void timestamp() { - Document d = new Document(); - Date time = new Date(86400 * 1000); - d.setTimestamp(time); - assertThat(d.getTimestamp()).isEqualTo(time); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/IncludedPathTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/IncludedPathTest.java deleted file mode 100644 index 663c2834c206..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/IncludedPathTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Collection; - -import org.testng.annotations.Test; - -public class IncludedPathTest { - - @Test(groups = {"unit"}) - public void deserialize() { - String json = "{" + - " 'path': '\\/*'," + - " 'indexes': [" + - " {" + - " 'kind': 'Range'," + - " 'dataType': 'String'," + - " 'precision': -1" + - " }," + - " {" + - " 'kind': 'Range'," + - " 'dataType': 'Number'," + - " 'precision': -1" + - " }" + - " ]" + - "}"; - IncludedPath path = new IncludedPath(json); - Collection indexes = path.getIndexes(); - assertThat(indexes).hasSize(2); - assertThat(indexes).usingFieldByFieldElementComparator().contains(Index.Range(DataType.String, -1)); - assertThat(indexes).usingFieldByFieldElementComparator().contains(Index.Range(DataType.Number, -1)); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/JsonSerializableTests.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/JsonSerializableTests.java deleted file mode 100644 index ca5c4b4af07e..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/JsonSerializableTests.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.microsoft.azure.cosmosdb; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.testng.Assert.fail; - -import java.io.Serializable; - -import org.testng.annotations.Test; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonParseException; - -public class JsonSerializableTests { - - public static class Pojo implements Serializable { - int a; - int b; - - public Pojo(int a, int b) { - this.a = a; - this.b = b; - } - - @JsonCreator - public Pojo(@JsonProperty("a") String a, @JsonProperty("b") String b) { - this.a = Integer.parseInt(a); - this.b = Integer.parseInt(b); - } - - public int getA() { - return a; - } - - public int getB() { - return b; - } - - public void setA(int a) { - this.a = a; - } - - public void setB(int b) { - this.b = b; - } - - } - - public enum enums { - first, second, third - } - - @Test(groups = { "unit" }) - public void getObjectAndCastToClass() { - Document document = new Document(); - // numeric values - document.set("intValue", Integer.MAX_VALUE); - document.set("doubleValue", Double.MAX_VALUE); - document.set("longValue", Long.MAX_VALUE); - - assertThat(document.getObject("intValue", Integer.class).intValue()).isEqualTo(Integer.MAX_VALUE); - assertThat(document.getObject("doubleValue", Double.class).doubleValue()).isEqualTo(Double.MAX_VALUE); - assertThat(document.getObject("longValue", Long.class).longValue()).isEqualTo(Long.MAX_VALUE); - - // string - document.set("stringValue", "stringField"); - assertThat(document.getObject("stringValue", String.class)).isEqualTo("stringField"); - - // boolean - document.set("boolValue", true); - assertThat(document.getObject("boolValue", Boolean.class)).isEqualTo(true); - - // enum - document.set("enumValue", "third"); - assertThat(document.getObject("enumValue", enums.class)).isEqualTo(enums.third); - - // Pojo - Pojo pojo = new Pojo(1, 2); - document.set("pojoValue", pojo); - Pojo readPojo = document.getObject("pojoValue", Pojo.class); - assertThat(readPojo.getA()).isEqualTo(pojo.getA()); - assertThat(readPojo.getB()).isEqualTo(pojo.getB()); - - // JsonSerializable - Document innerDocument = new Document(); - innerDocument.setId("innerDocument"); - document.set("innerDocument", innerDocument); - Document readInnerDocument = document.getObject("innerDocument", Document.class); - assertThat(readInnerDocument.getId()).isEqualTo(innerDocument.getId()); - } - - @Test(groups = { "unit" }) - public void objectMapperInvalidJsonNoQuotesForFieldAndValue() { - // Invalid Json - field and value must be quoted - try { - new Document("{ field: value }"); - fail("failure expected"); - } catch (Exception e) { - assertThat(e.getCause() instanceof JsonParseException).isTrue(); - } - } - - @Test(groups = { "unit" }) - public void objectMapperInvalidJsonNoQuotesForField() { - // Invalid Json - field must be quoted - try { - new Document("{ field: 'value' }"); - fail("failure expected"); - } catch (Exception e) { - assertThat(e.getCause() instanceof JsonParseException).isTrue(); - } - } - - @Test(groups = { "unit" }) - public void objectMapperInvalidJsonNoDuplicatesAllowed() { - // Invalid Json - duplicates must not exist in Json string - try { - new Document("{ 'field': 'value1', 'field': 'value2' }"); - fail("failure expected"); - } catch (Exception e) { - assertThat(e.getCause() instanceof JsonParseException).isTrue(); - } - } - - @Test(groups = { "unit" }) - public void objectMapperValidJsonWithSingleQuotesAndTrailingComma() { - Document document = null; - - // Valid Json - Single quotes and trailing commas allowed in Json string - document = new Document("{ 'field1': 'value1', 'field2': 'value2', }"); - assertThat(document.toJson().equals("{\"field1\":\"value1\",\"field2\":\"value2\"}")).isEqualTo(true); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/PermissionTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/PermissionTest.java deleted file mode 100644 index 3a4f0edd2c6e..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/PermissionTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.testng.annotations.Test; - -public class PermissionTest { - - @Test(groups = {"unit"}) - public void deserialize() { - String json = "{" + - " 'id': 'a98eb026-b66b-4cec-8fb9-9b0e10ddab76'," + - " 'permissionMode': 'read'," + - " 'resource': 'dbs/AQAAAA==/colls/AQAAAJ0fgTc='," + - " 'resourcePartitionKey': ['/id']" + - "}"; - Permission p = new Permission(json); - assertThat(p.getResourcePartitionKey()).isEqualToComparingFieldByField(new PartitionKey("/id")); - assertThat(p.getPermissionMode()).isEqualTo(PermissionMode.Read); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ResourceIdTests.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ResourceIdTests.java deleted file mode 100644 index 62c514ac318c..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ResourceIdTests.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.HashMap; -import java.util.Map; -import java.util.Random; - -import org.apache.commons.lang3.tuple.Pair; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.internal.ResourceId; - -public class ResourceIdTests { - - @Test(groups = { "unit" }) - public void resourceIdTryParsing() { - HashMap cases = new HashMap<>(); - cases.put("testDb", false); - cases.put("db", false); - cases.put("cosmosdb", false); - cases.put("asosfactor", false); - - cases.put("f", false); - cases.put("fo", false); - cases.put("foo", false); - cases.put("foob", true); - cases.put("fooba", false); - cases.put("foobar", false); - cases.put("Zm8=", false); - cases.put("Zm9v", true); - cases.put("Zm9vYg==", true); - cases.put("Zm9vYmE=", false); - cases.put("Zm9vYmFy", false); - - // collection rid - cases.put("1-MxAPlgMgA=", true); - cases.put("nJRwAA==", true); - cases.put("MaZyAA==", true); - cases.put("-qpmAA==", true); - cases.put("wsIRAA==", true); - cases.put("GJwnAA==", true); - - // document rid - cases.put("ClZUAPp9+A0=", true); - - // offer rid - cases.put("-d8Hx", false); - - for (Map.Entry testCase : cases.entrySet()) { - Pair resourcePair = ResourceId.tryParse(testCase.getKey()); - assertThat( resourcePair.getKey()).as(String.format("ResourceId.tryParse failed for '%s'", testCase.getKey())).isEqualTo(testCase.getValue()); - } - } - - private static int randomNextIntForTest(Random rnd, Boolean positive) { - return rnd.nextInt(Integer.MAX_VALUE / 2) + (positive ? Integer.MAX_VALUE / 2 : - Integer.MAX_VALUE / 2); - } - - @Test(groups = { "unit" }) - public void resourceIdParsingRoundTrip() { - Random rnd = new Random(System.currentTimeMillis()); - - ResourceId dbRid = ResourceId.newDatabaseId(randomNextIntForTest(rnd, true)); - ResourceId parsedDbRid = ResourceId.parse(dbRid.toString()); - assertThat(parsedDbRid.getDatabase()).isEqualTo(dbRid.getDatabase()); - - ResourceId collRid = ResourceId.newDocumentCollectionId(dbRid.toString(), randomNextIntForTest(rnd, false)); - ResourceId parsedCollRid = ResourceId.parse(collRid.toString()); - assertThat(parsedCollRid.getDatabase()).isEqualTo(collRid.getDatabase()); - assertThat(parsedCollRid.getDocumentCollection()).isEqualTo(collRid.getDocumentCollection()); - - ResourceId userRid = ResourceId.newUserId(dbRid.toString(), randomNextIntForTest(rnd, true)); - ResourceId parsedUserRid = ResourceId.parse(userRid.toString()); - assertThat(parsedUserRid.getDatabase()).isEqualTo(userRid.getDatabase()); - assertThat(parsedUserRid.getUser()).isEqualTo(userRid.getUser()); - - ResourceId permissionRid = ResourceId.newPermissionId(userRid.toString(), randomNextIntForTest(rnd, false)); - ResourceId parsedPermissionRid = ResourceId.parse(permissionRid.toString()); - assertThat(parsedPermissionRid.getDatabase()).isEqualTo(permissionRid.getDatabase()); - assertThat(parsedPermissionRid.getUser()).isEqualTo(permissionRid.getUser()); - assertThat(parsedPermissionRid.getPermission()).isEqualTo(permissionRid.getPermission()); - - ResourceId attachmentRid = ResourceId.newAttachmentId("wsIRALoBhyQ9AAAAAAAACA==", randomNextIntForTest(rnd, true)); - ResourceId parsedAttachmentRid = ResourceId.parse(attachmentRid.toString()); - assertThat(parsedAttachmentRid.getDatabase()).isEqualTo(attachmentRid.getDatabase()); - assertThat(parsedAttachmentRid.getDocumentCollection()).isEqualTo(attachmentRid.getDocumentCollection()); - assertThat(parsedAttachmentRid.getDocument()).isEqualTo(attachmentRid.getDocument()); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/PathsHelperTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/PathsHelperTest.java deleted file mode 100644 index ee22d54ef190..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/PathsHelperTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.Test; -import static org.assertj.core.api.Assertions.assertThat; - -public class PathsHelperTest { - - private static final String DATABASE_ID = "IXYFAA=="; - private static final String DATABASE_COLLECTION_ID = "IXYFAOHEBPM="; - private static final String DOCUMENT_ID = "IXYFAOHEBPMBAAAAAAAAAA=="; - private static final String ATTACHMENT_ID = "IXYFAOHEBPMBAAAAAAAAABJYSJk="; - private static final String PERMISSION_ID = "IXYFAE9ZOwBGkyqWIsNKAA=="; - private static final String STORED_PRCEDURE_ID = "IXYFAOHEBPMCAAAAAAAAgA=="; - private static final String TRIGGER_ID = "IXYFAOHEBPMCAAAAAAAAcA=="; - private static final String USER_DEFINED_FUNCTION_ID = "IXYFAOHEBPMBAAAAAAAAYA=="; - private static final String USER_ID = "IXYFAE9ZOwA="; - private static final String CONFLICT_ID = "k6d9ALgBmD8BAAAAAAAAQA=="; - - private static final String DATABASE_FULL_NAME = "dbs/IXYFAA==/"; - private static final String DOCUMENT_COLLECTION_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/"; - private static final String DOCUMENT_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/"; - private static final String STORED_PRCEDURE_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/sprocs/IXYFAOHEBPMCAAAAAAAAgA==/"; - private static final String USER_DEFINED_FUNCTION_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/udfs/IXYFAOHEBPMBAAAAAAAAYA==/"; - private static final String USER_FULL_NAME = "dbs/IXYFAA==/users/IXYFAE9ZOwA=/"; - private static final String PERMISSION_FULL_NAME = "dbs/IXYFAA==/users/IXYFAE9ZOwA=/permissions/IXYFAE9ZOwBGkyqWIsNKAA==/"; - private static final String ATTACHMENT_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/attachments/IXYFAOHEBPMBAAAAAAAAABJYSJk=/"; - private static final String TRIGGER_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/triggers/IXYFAOHEBPMCAAAAAAAAcA==/"; - private static final String CONFLICT_FULL_NAME = "dbs/k6d9AA==/colls/k6d9ALgBmD8=/conflicts/k6d9ALgBmD8BAAAAAAAAQA==/"; - - private static final String INCORRECT = "incorrect"; - - @Test(groups = { "unit" }) - public void validateResourceID() { - assertThat(PathsHelper.validateResourceId(ResourceType.Database, DATABASE_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.DocumentCollection, DATABASE_COLLECTION_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.Document, DOCUMENT_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.Attachment, ATTACHMENT_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.Permission, PERMISSION_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.StoredProcedure, STORED_PRCEDURE_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.Trigger, TRIGGER_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.UserDefinedFunction, USER_DEFINED_FUNCTION_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.User, USER_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.Conflict, CONFLICT_ID)).isTrue(); - - assertThat(PathsHelper.validateResourceId(ResourceType.Database, DATABASE_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.DocumentCollection, DATABASE_COLLECTION_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.Document, DOCUMENT_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.Attachment, ATTACHMENT_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.Permission, PERMISSION_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.StoredProcedure, STORED_PRCEDURE_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.Trigger, TRIGGER_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.UserDefinedFunction, USER_DEFINED_FUNCTION_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.User, USER_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.Conflict, CONFLICT_ID + INCORRECT)).isFalse(); - } - - @Test(groups = { "unit" }) - public void validateResourceFullName() { - assertThat(PathsHelper.validateResourceFullName(ResourceType.Database, DATABASE_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.DocumentCollection, DOCUMENT_COLLECTION_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Document, DOCUMENT_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Attachment, ATTACHMENT_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Permission, PERMISSION_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.User, USER_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Conflict, CONFLICT_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.UserDefinedFunction, USER_DEFINED_FUNCTION_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.StoredProcedure, STORED_PRCEDURE_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Trigger, TRIGGER_FULL_NAME)).isTrue(); - - assertThat(PathsHelper.validateResourceFullName(ResourceType.Database, DATABASE_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.DocumentCollection, DOCUMENT_COLLECTION_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Document, DOCUMENT_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Attachment, ATTACHMENT_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Permission, PERMISSION_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.User, USER_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Conflict, CONFLICT_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.UserDefinedFunction, USER_DEFINED_FUNCTION_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.StoredProcedure, STORED_PRCEDURE_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Trigger, TRIGGER_FULL_NAME + INCORRECT)).isFalse(); - - } - - @Test(groups = {"unit"}) - public void generatePathAtDBLevel() { - RxDocumentServiceRequest rxDocumentServiceRequest = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.DatabaseAccount); - String path = PathsHelper.generatePath(ResourceType.DatabaseAccount, rxDocumentServiceRequest, rxDocumentServiceRequest.isFeed); - assertThat(path).isEqualTo(Paths.DATABASE_ACCOUNT_PATH_SEGMENT + "/"); - - rxDocumentServiceRequest = RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database); - path = PathsHelper.generatePath(ResourceType.Database, rxDocumentServiceRequest, rxDocumentServiceRequest.isFeed); - assertThat(path).isEqualTo(Paths.DATABASES_PATH_SEGMENT + "/"); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/RxDocumentServiceRequestTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/RxDocumentServiceRequestTest.java deleted file mode 100644 index 2d157911e347..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/RxDocumentServiceRequestTest.java +++ /dev/null @@ -1,456 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.nio.charset.StandardCharsets; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.Resource; -import org.apache.commons.collections4.map.HashedMap; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.rx.internal.AuthorizationTokenType; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Observable; - -public class RxDocumentServiceRequestTest { - - private final static String DOCUMENT_DEFINITION = "{ " + "\"id\": \"%s\", " + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" + "}"; - private static final String PARTITION_KEY_VALUE = "1"; - - private final String DOCUMENT_URL_WITH_ID = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/"; - private final String DOCUMENT_URL_WITH_NAME = "/dbs/testDB/colls/testColl/docs/testDoc/"; - private final String DOCUMENT_URL_WITH_ID_WITHOUT_SLASH = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/"; - private final String DOCUMENT_URL_WITH_NAME_WITHOUT_SLASH = "dbs/testDB/colls/testColl/docs/testDoc/"; - - private static final String DATABASE_URL = "/dbs/IXYFAA==/"; - private static final String DOCUMENT_COLLECTION_URL = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/"; - private static final String STORED_PRCEDURE_URL = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/sprocs/IXYFAOHEBPMCAAAAAAAAgA==/"; - private static final String USER_DEFINED_FUNCTION_URL = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/udfs/IXYFAOHEBPMBAAAAAAAAYA==/"; - private static final String USER_URL = "/dbs/IXYFAA==/users/IXYFAE9ZOwA=/"; - private static final String PERMISSION_URL = "/dbs/IXYFAA==/users/IXYFAE9ZOwA=/permissions/IXYFAE9ZOwBGkyqWIsNKAA==/"; - private static final String ATTACHMENT_URL = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/attachments/IXYFAOHEBPMBAAAAAAAAABJYSJk=/"; - private static final String TRIGGER_URL = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/triggers/IXYFAOHEBPMCAAAAAAAAcA==/"; - private static final String CONFLICT_URL = "/dbs/k6d9AA==/colls/k6d9ALgBmD8=/conflicts/k6d9ALgBmD8BAAAAAAAAQA==/"; - - @DataProvider(name = "documentUrl") - public Object[][] documentUrlWithId() { - return new Object[][] { { DOCUMENT_URL_WITH_ID, DOCUMENT_URL_WITH_NAME, OperationType.Read }, - { DOCUMENT_URL_WITH_ID, DOCUMENT_URL_WITH_NAME, OperationType.Delete }, - { DOCUMENT_URL_WITH_ID, DOCUMENT_URL_WITH_NAME, OperationType.Replace }, - { DOCUMENT_URL_WITH_ID_WITHOUT_SLASH, DOCUMENT_URL_WITH_NAME_WITHOUT_SLASH, OperationType.Read }, - { DOCUMENT_URL_WITH_ID_WITHOUT_SLASH, DOCUMENT_URL_WITH_NAME_WITHOUT_SLASH, OperationType.Delete }, - { DOCUMENT_URL_WITH_ID_WITHOUT_SLASH, DOCUMENT_URL_WITH_NAME_WITHOUT_SLASH, OperationType.Replace }, }; - } - - @DataProvider(name = "resourceUrlWithOperationType") - public Object[][] resourceOperation() { - return new Object[][] { { DATABASE_URL, ResourceType.Database, OperationType.Read }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Read }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Read }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Read }, - { USER_URL, ResourceType.User, OperationType.Read }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Read }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Read }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Read }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Read }, - - { DATABASE_URL, ResourceType.Database, OperationType.Create }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Create }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Create }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Create }, - { USER_URL, ResourceType.User, OperationType.Create }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Create }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Create }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Create }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Create }, - - { DATABASE_URL, ResourceType.Database, OperationType.Delete }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Delete }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Delete }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Delete }, - { USER_URL, ResourceType.User, OperationType.Delete }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Delete }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Delete }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Delete }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Delete }, - - { DATABASE_URL, ResourceType.Database, OperationType.Replace }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Replace }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Replace }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Replace }, - { USER_URL, ResourceType.User, OperationType.Replace }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Replace }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Replace }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Replace }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Replace }, - - { DATABASE_URL, ResourceType.Database, OperationType.Query }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Query }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Query }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Query }, - { USER_URL, ResourceType.User, OperationType.Query }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Query }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Query }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Query }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Query }, - - { DATABASE_URL, ResourceType.Database, OperationType.Update }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Update }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Update }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Update }, - { USER_URL, ResourceType.User, OperationType.Update }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Update }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Update }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Update }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Update } }; - } - - @DataProvider(name = "resourceIdOrFullNameRequestAndOperationTypeData") - public Object[][] resourceIdOrFullNameRequestAndOperationTypeData() { - return new Object[][]{ - {"IXYFAA==", "dbs/testDB", ResourceType.Database, OperationType.Read}, - {"IXYFAA==", "dbs/testDB", ResourceType.Database, OperationType.Create}, - - {"IXYFAOHEBPM=", "dbs/testDB/colls/testColl", ResourceType.DocumentCollection, OperationType.Read}, - {"IXYFAOHEBPM=", "dbs/testDB/colls/testColl", ResourceType.DocumentCollection, OperationType.Create}, - {"IXYFAOHEBPM=", "dbs/testDB/colls/testColl", ResourceType.DocumentCollection, OperationType.Delete}, - {"IXYFAOHEBPM=", "dbs/testDB/colls/testColl", ResourceType.DocumentCollection, OperationType.Query}, - - {"IXYFAOHEBPMBAAAAAAAAAA==", "dbs/testDB/colls/testColl/docs/testDoc", ResourceType.Document, OperationType.Read}, - {"IXYFAOHEBPMBAAAAAAAAAA==", "dbs/testDB/colls/testColl/docs/testDoc", ResourceType.Document, OperationType.Create}, - {"IXYFAOHEBPMBAAAAAAAAAA==", "dbs/testDB/colls/testColl/docs/testDoc", ResourceType.Document, OperationType.Delete}, - {"IXYFAOHEBPMBAAAAAAAAAA==", "dbs/testDB/colls/testColl/docs/testDoc", ResourceType.Document, OperationType.Query}, - }; - } - - /** - * This test case will cover various create methods through resource url with Id in detail for document resource. - * @param documentUrlWithId Document url with id - * @param documentUrlWithName Document url with name - * @param operationType Operation type - */ - @Test(groups = { "unit" }, dataProvider = "documentUrl") - public void createWithResourceIdURL(String documentUrlWithId, String documentUrlWithName, - OperationType operationType) { - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithId, - new HashedMap(), AuthorizationTokenType.PrimaryMasterKey); - - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getResourceAddress()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getResourceId()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - - request = RxDocumentServiceRequest.create(operationType, "IXYFAOHEBPMBAAAAAAAAAA==", ResourceType.Document, - new HashedMap(), AuthorizationTokenType.PrimaryReadonlyMasterKey); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryReadonlyMasterKey); - assertThat(request.getResourceAddress()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getResourceId()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - - Document document = getDocumentDefinition(); - request = RxDocumentServiceRequest.create(operationType, document, ResourceType.Document, documentUrlWithId, - new HashedMap(), AuthorizationTokenType.Invalid); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.Invalid); - assertThat(request.getResourceAddress()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getResourceId()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getContent()).isEqualTo(document.toJson().getBytes(StandardCharsets.UTF_8)); - - Observable inputStream = Observable.just(document.toJson().getBytes(StandardCharsets.UTF_8)); - request = RxDocumentServiceRequest.create(operationType, ResourceType.Document, documentUrlWithId, inputStream, - new HashedMap(), AuthorizationTokenType.SecondaryMasterKey); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.SecondaryMasterKey); - assertThat(request.getResourceAddress()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getResourceId()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getContentObservable()).isEqualTo(inputStream); - - // Creating one request without giving AuthorizationTokenType , it should take - // PrimaryMasterKey by default - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithId, - new HashedMap()); - - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getResourceAddress()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getResourceId()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - - } - - /** - * This test case will cover various create method through resource url with name in detail for document resource. - * @param documentUrlWithId Document url with id - * @param documentUrlWithName Document url with name - * @param operationType Operation type - */ - @Test(groups = { "unit" }, dataProvider = "documentUrl") - public void createWithResourceNameURL(String documentUrlWithId, String documentUrlWithName, - OperationType operationType) { - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithName, - new HashedMap(), AuthorizationTokenType.PrimaryMasterKey); - - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getResourceAddress()) - .isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT)); - assertThat(request.getResourceId()).isNull(); - - Document document = getDocumentDefinition(); - Observable inputStream = Observable.just(document.toJson().getBytes(StandardCharsets.UTF_8)); - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithName, - inputStream, - new HashedMap(), - AuthorizationTokenType.SecondaryMasterKey); - - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.SecondaryMasterKey); - assertThat(request.getResourceAddress()) - .isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT)); - assertThat(request.getResourceId()).isNull(); - assertThat(request.getContentObservable()).isEqualTo(inputStream); - - // Creating one request without giving AuthorizationTokenType , it should take - // PrimaryMasterKey by default - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithName, - new HashedMap()); - - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getResourceAddress()) - .isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT)); - assertThat(request.getResourceId()).isNull(); - } - - - /** - * This will cover sanity for most of the combination of different source with various - * operation. - * @param resourceUrl Resource Url - * @param resourceType Resource Type - * @param operationType Operation type - */ - @Test(groups = { "unit" }, dataProvider = "resourceUrlWithOperationType") - public void createDifferentResourceRequestWithDiffOperation(String resourceUrl, ResourceType resourceType, - OperationType operationType) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, resourceType, resourceUrl, - new HashedMap(), AuthorizationTokenType.PrimaryMasterKey); - assertThat(resourceUrl.contains(request.getResourceAddress())).isTrue(); - assertThat(resourceUrl.contains(request.getResourceId())).isTrue(); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.getHeaders()).isNotNull(); - } - - /** - * This will test all the create method without request path. - * - * @param resourceId Resource id - * @param resourceType Resource Type - * @param operationType Operation type - */ - @Test(groups = {"unit"}, dataProvider = "resourceIdOrFullNameRequestAndOperationTypeData") - public void createRequestWithoutPath(String resourceId, String resourceFullName, ResourceType resourceType, - OperationType operationType) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, resourceId, resourceType, null); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceId); - assertThat(request.getResourceId()).isEqualTo(resourceId); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - - - request = RxDocumentServiceRequest.create(operationType, resourceId, resourceType, null, AuthorizationTokenType.ResourceToken); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceId); - assertThat(request.getResourceId()).isEqualTo(resourceId); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.ResourceToken); - - Document document = getDocumentDefinition(); - request = RxDocumentServiceRequest.create(operationType, resourceId, resourceType, document, null); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceId); - assertThat(request.getResourceId()).isEqualTo(resourceId); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getContent()).isEqualTo(document.toJson().getBytes(StandardCharsets.UTF_8)); - - request = RxDocumentServiceRequest.create(operationType, resourceId, resourceType, document, null, AuthorizationTokenType.ResourceToken); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceId); - assertThat(request.getResourceId()).isEqualTo(resourceId); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.ResourceToken); - assertThat(request.getContent()).isEqualTo(document.toJson().getBytes(StandardCharsets.UTF_8)); - - request = RxDocumentServiceRequest.createFromName(operationType, resourceFullName, resourceType); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceFullName); - assertThat(request.getResourceId()).isNull(); - assertThat(request.getIsNameBased()).isTrue(); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - - request = RxDocumentServiceRequest.createFromName(operationType, resourceFullName, resourceType, AuthorizationTokenType.ResourceToken); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceFullName); - assertThat(request.getResourceId()).isNull(); - assertThat(request.getIsNameBased()).isTrue(); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.ResourceToken); - - request = RxDocumentServiceRequest.createFromName(operationType, document, resourceFullName, resourceType); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceFullName); - assertThat(request.getResourceId()).isNull(); - assertThat(request.getIsNameBased()).isTrue(); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getContent()).isEqualTo(document.toJson().getBytes(StandardCharsets.UTF_8)); - - request = RxDocumentServiceRequest.createFromName(operationType, document, resourceFullName, resourceType, AuthorizationTokenType.ResourceToken); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceFullName); - assertThat(request.getResourceId()).isNull(); - assertThat(request.getIsNameBased()).isTrue(); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.ResourceToken); - assertThat(request.getContent()).isEqualTo(document.toJson().getBytes(StandardCharsets.UTF_8)); - } - - @Test(groups = { "unit" }, dataProvider = "documentUrl") - public void isValidAddress(String documentUrlWithId, String documentUrlWithName, OperationType operationType) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithId, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Database)).isTrue(); - assertThat(request.isValidAddress(ResourceType.DocumentCollection)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Document)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - assertThat(request.isValidAddress(ResourceType.User)).isFalse(); - assertThat(request.isValidAddress(ResourceType.Trigger)).isFalse(); - assertThat(request.isValidAddress(ResourceType.Offer)).isFalse(); - assertThat(request.isValidAddress(ResourceType.Permission)).isFalse(); - assertThat(request.isValidAddress(ResourceType.Attachment)).isFalse(); - assertThat(request.isValidAddress(ResourceType.StoredProcedure)).isFalse(); - assertThat(request.isValidAddress(ResourceType.Conflict)).isFalse(); - assertThat(request.isValidAddress(ResourceType.PartitionKeyRange)).isFalse(); - - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Document)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - String collectionFullName = "/dbs/testDB/colls/testColl/"; - request = RxDocumentServiceRequest.create(operationType, ResourceType.DocumentCollection, collectionFullName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.DocumentCollection)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - - String databaseFullName = "/dbs/testDB"; - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Database, - databaseFullName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Database)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - - String permissionFullName = "/dbs/testDB/users/testUser/permissions/testPermission"; - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Permission, - permissionFullName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Permission)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - - String triggerFullName = "/dbs/testDB/colls/testUser/triggers/testTrigger"; - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Trigger, - triggerFullName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Trigger)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - - String attachmentFullName = "/dbs/testDB/colls/testUser/docs/testDoc/attachments/testAttachment"; - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Attachment, - attachmentFullName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Attachment)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - } - - @Test(groups = { "unit" }, dataProvider = "documentUrl") - public void addPreferHeader(String documentUrlWithId, String documentUrlWithName, OperationType operationType) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithId, - new HashedMap()); - - request.addPreferHeader("preferHeaderName1", "preferHeaderValue1"); - assertThat(request.getHeaders().size()).isEqualTo(1); - assertThat(request.getHeaders().get(HttpConstants.HttpHeaders.PREFER)) - .isEqualTo("preferHeaderName1=preferHeaderValue1"); - - request.addPreferHeader("preferHeaderName2", "preferHeaderValue2"); - assertThat(request.getHeaders().size()).isEqualTo(1); - assertThat(request.getHeaders().get(HttpConstants.HttpHeaders.PREFER)) - .isEqualTo("preferHeaderName1=preferHeaderValue1;" + "preferHeaderName2=preferHeaderValue2"); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format(DOCUMENT_DEFINITION, uuid, PARTITION_KEY_VALUE)); - return doc; - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/TimeTokenTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/TimeTokenTest.java deleted file mode 100644 index 710d740ae9a0..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/TimeTokenTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.time.format.DateTimeFormatter; -import java.util.Locale; - -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -public class TimeTokenTest { - - private Locale defaultLocale; - - @BeforeTest(groups = { "unit" }) - public void beforeMethod() { - defaultLocale = Locale.getDefault(); - } - - @Test(groups = { "unit" }) - public void nonLocaleUS() { - Locale.setDefault(Locale.ITALIAN); - DateTimeFormatter RFC_1123_DATE_TIME = - DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US); - String time = Utils.nowAsRFC1123(); - Locale.setDefault(Locale.US); - RFC_1123_DATE_TIME.parse(time); - } - - @AfterTest(groups = { "unit" }) - public void afterMethod() { - // set back default locale before test - if (defaultLocale != null) { - Locale.setDefault(defaultLocale); - } else { - Locale.setDefault(Locale.US); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtilsTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtilsTest.java deleted file mode 100644 index de52b4fa83f7..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtilsTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2019 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; - -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -import io.netty.handler.codec.http.DefaultHttpHeaders; -import io.netty.handler.codec.http.DefaultHttpResponse; -import io.netty.handler.codec.http.HttpHeaders; -import io.netty.handler.codec.http.HttpResponse; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.handler.codec.http.HttpVersion; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -public class HttpUtilsTest { - - private static final String OWNER_FULL_NAME_VALUE = "dbs/RxJava.SDKTest.SharedDatabase_20190304T121302_iZc/colls/+%20-_,:.%7C~b2d67001-9000-454e-a140-abceb1756c48%20+-_,:.%7C~"; - - @Test(groups = { "unit" }) - public void verifyConversionOfHttpResponseHeadersToMap() throws UnsupportedEncodingException { - HttpHeaders headersMap = new DefaultHttpHeaders(); - headersMap.add(HttpConstants.HttpHeaders.OWNER_FULL_NAME, OWNER_FULL_NAME_VALUE); - - HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_0, - HttpResponseStatus.ACCEPTED, - headersMap); - HttpResponseHeaders httpResponseHeaders = new HttpClientResponse(httpResponse, null).getHeaders(); - Set> resultHeadersSet = HttpUtils.asMap(httpResponseHeaders).entrySet(); - - assertThat(resultHeadersSet.size()).isEqualTo(1); - Entry entry = resultHeadersSet.iterator().next(); - assertThat(entry.getKey()).isEqualTo(HttpConstants.HttpHeaders.OWNER_FULL_NAME); - assertThat(entry.getValue()).isEqualTo(HttpUtils.urlDecode(OWNER_FULL_NAME_VALUE)); - - List> resultHeadersList = HttpUtils.unescape(httpResponseHeaders.entries()); - assertThat(resultHeadersList.size()).isEqualTo(1); - entry = resultHeadersSet.iterator().next(); - assertThat(entry.getKey()).isEqualTo(HttpConstants.HttpHeaders.OWNER_FULL_NAME); - assertThat(entry.getValue()).isEqualTo(HttpUtils.urlDecode(OWNER_FULL_NAME_VALUE)); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseTest.java deleted file mode 100644 index d91eb8faf0fd..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.HashMap; - -import org.apache.commons.io.IOUtils; -import org.testng.annotations.Test; - -public class StoreResponseTest { - @Test(groups = { "unit" }) - public void stringContent() { - String content = "I am body"; - HashMap headerMap = new HashMap<>(); - headerMap.put("key1", "value1"); - headerMap.put("key2", "value2"); - - StoreResponse sp = new StoreResponse(200, new ArrayList<>(headerMap.entrySet()), content); - - assertThat(sp.getStatus()).isEqualTo(200); - assertThat(sp.getResponseStream()).isNull(); - assertThat(sp.getResponseBody()).isEqualTo(content); - assertThat(sp.getHeaderValue("key1")).isEqualTo("value1"); - } - - @Test(groups = { "unit" }) - public void streamContent() throws Exception { - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(new byte[] { 3, 0, 1, 9, -1, 125 }); - HashMap headerMap = new HashMap<>(); - headerMap.put("key1", "value1"); - headerMap.put("key2", "value2"); - - StoreResponse sp = new StoreResponse(200, new ArrayList<>(headerMap.entrySet()), new ByteArrayInputStream(baos.toByteArray())); - - assertThat(sp.getStatus()).isEqualTo(200); - assertThat(sp.getResponseBody()).isNull(); - assertThat(sp.getResponseStream()).isNotNull(); - assertThat(IOUtils.contentEquals(new ByteArrayInputStream(baos.toByteArray()), sp.getResponseStream())); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponentTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponentTest.java deleted file mode 100644 index 02b0bd685d80..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponentTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.microsoft.azure.cosmosdb.internal.routing; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.assertj.core.api.Assertions.assertThat; - -public class StringPartitionKeyComponentTest { - @DataProvider(name = "paramProvider") - public Object[][] paramProvider() { - return new Object[][] { - {"Friday", "Friday", 0}, - {"Friday", "Venerdì", -1}, - {"Fri", "Ven", -1}, - }; - } - - @Test(groups = { "unit" }, dataProvider = "paramProvider") - public void compare(String str1, String str2, int expectedCompare) { - StringPartitionKeyComponent spkc1 = new StringPartitionKeyComponent(str1); - StringPartitionKeyComponent spkc2 = new StringPartitionKeyComponent(str2); - - assertThat(Integer.signum(spkc1.CompareTo(spkc2))).isEqualTo(Integer.signum(expectedCompare)); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/resources/log4j.properties b/cosmosdb/data-plane/commons/src/test/resources/log4j.properties deleted file mode 100644 index 00b89ecf16b7..000000000000 --- a/cosmosdb/data-plane/commons/src/test/resources/log4j.properties +++ /dev/null @@ -1,16 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# Set HTTP components' logger to INFO - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -log4j.category.com.microsoft.azure.cosmosdb=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/commons/src/test/resources/sampleConflict.json b/cosmosdb/data-plane/commons/src/test/resources/sampleConflict.json deleted file mode 100644 index 12f2a507b7a3..000000000000 --- a/cosmosdb/data-plane/commons/src/test/resources/sampleConflict.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "id": "k6d9ALgBmD8BAAAAAAAAQA==", - "_rid": "k6d9ALgBmD8BAAAAAAAAQA==", - "_self": "dbs/k6d9AA==/colls/k6d9ALgBmD8=/conflicts/k6d9ALgBmD8BAAAAAAAAQA==/", - "_etag": "\"00004a0f-0000-0000-0000-5b6e214b0000\"", - "resourceType": "document", - "operationType": "create", - "resourceId": "k6d9ALgBmD+ChB4AAAAAAA==", - "content": "{\"id\":\"0007312a-a1c5-4b54-9e39-35de2367fa33\",\"regionId\":2,\"regionEndpoint\":\"https://test-southeastasia.documents.azure.com:443/\",\"_rid\":\"k6d9ALgBmD+ChB4AAAAAAA==\",\"_self\":\"dbs\\/k6d9AA==\\/colls\\/k6d9ALgBmD8=\\/docs\\/k6d9ALgBmD+ChB4AAAAAAA==\\/\",\"_etag\":\"\\\"00000200-0000-0000-0000-5b6e214b0000\\\"\",\"_attachments\":\"attachments\\/\",\"_ts\":1533944139}", - "_ts": 1533944139 -} diff --git a/cosmosdb/data-plane/direct-impl/pom.xml b/cosmosdb/data-plane/direct-impl/pom.xml deleted file mode 100644 index 58a49378abaf..000000000000 --- a/cosmosdb/data-plane/direct-impl/pom.xml +++ /dev/null @@ -1,327 +0,0 @@ - - - 4.0.0 - com.microsoft.azure - azure-cosmosdb-direct - Azure Cosmos DB Async SDK Direct Internal Implementation - 2.4.5 - Azure Cosmos DB Async SDK Direct Internal Implementation - https://docs.microsoft.com/en-us/azure/cosmos-db - jar - - UTF-8 - unit - 2.4.5 - 27.0.1-jre - 4.0.5 - - - - - unit - - default - unit - - - true - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - - - - - - fast - - simple - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - long - - long - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - direct - - direct - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - multi-master - - multi-master - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - emulator - - emulator - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - non-emulator - - non-emulator - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.0 - - unit - - **/*.java - - - - surefire.testng.verbose - 2 - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.22.0 - - - **/*.java - - ${test.groups} - - - surefire.testng.verbose - 2 - - - - - - - integration-test - verify - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - maven-javadoc-plugin - 3.0.1 - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - empty-javadoc-jar - package - - jar - - - empty-javadoc - ${basedir}/javadoc - - - - empty-sources-jar - package - - jar - - - empty-sources - ${basedir}/sources - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.0 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - com.microsoft.azure - azure-cosmosdb-gateway - ${cosmosdb-sdk.version} - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - ${cosmosdb-sdk.version} - test - - - com.google.guava - guava - ${guava.version} - - - io.dropwizard.metrics - metrics-core - ${metrics.version} - - - - - MIT License - http://www.opensource.org/licenses/mit-license.php - - - - scm:git:https://github.com/Azure/azure-cosmosdb-java.git - scm:git:https://github.com/Azure/azure-cosmosdb-java.git - https://github.com/Azure/azure-cosmosdb-java.git - - - - Azure Cosmos DB Developer Platform Devs - docdbdevplatdevs@microsoft.com - Microsoft - http://www.microsoft.com/ - - - diff --git a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.md b/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.md deleted file mode 100755 index aed9cacda209..000000000000 --- a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.md +++ /dev/null @@ -1,495 +0,0 @@ -This specification describes a Netty-based Java implementation for direct-mode access to Azure Cosmos using its proprietary RNTBD protocol. This enables a Java client to create direct channels to Azure Cosmos back-end endpoints. - -RNTBD is intended to be the high-performance TCP transport alternative to HTTP for Cosmos. At its core, the transport stack must implement the `Microsoft.Azure.Documents.TransportClient` contract. It must be able to: - -* Accept requests intended for a Cosmos DB replica. - -* Serialize and send the requests to the intended endpoint , - -* De-serialize the response and return a StoreResponse in a timely fashion or fail with an appropriate error. - -The `RntbdTransportClient` implements this contract. It extends `TransportClient` and implements its one-and-only-one overridable method: -``` - @Override - public Single invokeStoreAsync( - URI physicalAddress, - ResourceOperation operation, - RxDocumentServiceRequest request) -``` - -The `physicalAddress` address in the call to `invokeStoreAsync` is a request URI of the form: - - **rntbd://**_\_**:**_\_**/**_\_ - -Netty channel pipelines are created dynamically based on the host and port portion of the URI. The replica path is opaque to the `RntbdTransportClient`. - -Having one connection per remote endpoint might suffice in many cases, but there are reasons to believe the client will benefit from additional connections to the same endpoint in at least two cases: - -* Head-of-line blocking - - Requests or responses can become bottle-necked behind large payloads, as they all must pass sequentially through the same stream. - -* Object contention - - Machines with many cores might attempt to send requests to the same endpoint simultaneously, causing all requests to be sent serially, and then all responses to be dispatched serially. - -For these reasons, the `RntbdTransportClient` supports multiple connections to an endpoint. At least one channel is created for each unique combination of host name and port number. Additional channels are created when the number of pending requests on existing channels gets too high. The set of channels created for a host name and port number are represented as an `RntbdTransportClient.Endpoint`. - -The criteria and thresholds for deciding when to create new channels, when to close existing channels, how to balance traffic among multiple connections, and whether to limit the total number of requests pending to an `RntbdTransportClient.Endpoint` are to be determined. The following section briefly describes the RNTBD protocol and the `RntbdTransportClient` channel pipeline. - -## RNTBD Protocol and the RntbdTransportClient Channel Pipeline - -Following creation of a channel upon receipt of the first `RxDocumentServiceRequest` to an endpoint, the RNTBD protocol requires a two-step context negotiation to complete before message exchange begins. - -1. SSL Handshake - - At the end of this step all future messages will be encrypted. All SSL-related work--negotiation, encryption, and decryption--is performed by Netty's built-in `SSLHandler`. An RNTBD client must only negotiate TLS 1.2 or higher. This is subject to change as security requirements become more stringent over time. - -2. RNTBD context negotiation - - In this step the transport client makes a single request--an `RntbdContextRequest`--and awaits a single response--an `RntbdContext` message. - -Request messages that arrive during context negotiation are queued. After context negotiation is complete all pending requests are sent. Request messages are framed and sent one at a time in arrival order on the channel's outgoing message stream. Response messages may be received in any order. Because of this pending promises of replies are matched with incoming response messages based on Activity ID. The lifetime of an RNTBD channel is illustrated in Figure 1. - -``` -┌────────────────────────────────────────────────────────────────────────────────────┐ -│ RNTBD Channel Timeline │ -└────────────────────────────────────────────────────────────────────────────────────┘ - -┌──────────┐ ┌──────────┐ -│ │ │ │ -│ Client │ │ Service │ -│ │ │ │ -└──────────┘ └──────────┘ -┌──────────┐ ┌──────────┐ ──────────────────────┐ -│ │ │ │ │ -│ ├─────────────────┐ │ │ │ -│ │ │ │ │ │ -│ │ ┌─────────────┐ └──────────────────▶│ │ │ -│ │ │SSL Handshake│ │ │ │ -│ │ └─────────────┘ │ │ Negotiate context │ -│ │ ┌──────────────────┤ │ │ -│ │◀─────────────────┘ │ │ │ -│ │ │ │ │ -│ ├─RntbdContextRequest────────────────▶│ │ │ -│ │ │ │ │ -│ │◀──────────────────────RntbdContext──│ │ │ -│ │ │ │ ──────────────────────┘ -│ │ │ │ ──────────────────────┐ -│ │ │ │ │ -│ │ │ │ │ -│ ├─RntbdRequest[1]────────────────────▶│ │ │ -│ │ │ │ │ -│ │ │ │ │ -│ ├─RntbdRequest[2]────────────────────▶│ │ │ -│ │ │ │ │ -│ │ │ │ │ -│ │◀───────────────────RntbdResponse[2]─│ │ │ -│ │ │ │ │ -│ │ │ │ │ -│ ├──RntbdRequest[3]───────────────────▶│ │ │ -│ │ │ │ Exchange messages │ -│ │ │ │ │ -│ │◀───────────────────RntbdResponse[1]─│ │ │ -│ │ │ │ │ -│ │ │ │ │ -│ │◀───────────────────RntbdResponse[3]─│ │ │ -│ │ │ │ │ -│ │ │ │ │ -│ │ . │ │ │ -│ │ . │ │ │ -│ │ . │ │ │ -│ │ │ │ │ -│ │ │ │ │ -└──────────┘ └──────────┘ ──────────────────────┘ -``` -*Figure 1. RNTBD Channel Timeline* - -Figure 2 illustrates the `RntbdTransportClient` implementation of the RNTBD protocol. It diagrams the happy-path. Channel management, error handling, and the details of the channel pipeline will be discussed later in this document. -
- -![Figure 2. RNTBD Channel Implementation Overview ](attachments/RntbdTransportClient.sequence-diagram-1fd9c04f-87e6-472e-afe8-8b1ed30685c2.png) -*Figure 2. RNTBD Channel Implementation Overview* - -The next section describes the `RntbdTransportClient` channel implementation. - -## RNTBD Channel Implementation - -Once a connection is established on a channel, the `RntbdTransportClient` begins exchanging messages. Messages written to an RNTBD channel move through a pipeline. This pipeline is the heart of the RNTBD channel implementation. - -There are four outgoing (request) message types and three incoming (response) message types: - -| Request type | Response type | Description -| ------------------------- | ----------------| ------------------------------------------------------------------------ -| `RntbdContextRequest` | `RntbdContext` | Sent on receipt of the first request on a channel. The response indicates that the connected Cosmos Service is either ready or rejects the request to exchange messages. -| `RntbdReadRequest` | `RntbdResponse` | A request to read data with an error or non-error response. -| `RntbdHealthCheckRequest` | `RntbdHealth` | Sent before each write operation on a channel. A response indicates that the connected Cosmos Service is in good health. -| `RntbdWriteRequest` | `RntbdResponse` | A request to write data with an error or non-error response. - -Request and response message types share a common base: `RntbdRequest` and `RntbdResponse`, respectively. - -The RNTBD pipeline is composed of a small number of Netty pipeline handlers: - -| Pipeline class | Role -| ----------------------------- | -------------------------------------------------------------------------------------- -| `SslHandler` | Negotiates a secure connection. Subsequently encrypts data written to the channel's output stream and decrypts data read from the channel's input stream. The `SslHandler` reads/writes bytes. It knows nothing about RNTBD messages. -| `RntbdClientMessageFormatter` | Encodes `RntbdRequest` messages (to bytes) and decodes `RntbdResponse` messages (from bytes). -| `RntbdContextNegotiator` | Injects an `RntbdContextRequest` message upon receipt of the first `RntbdRequest` message on a channel. `RntbdRequest` messages are queued and left pending until receipt of an `RntbdContext` message. If the response acknowledges that the connected Cosmos service is ready to exchange messages, all pending messages are sent down the pipeline. On rejection, failure, cancellation, or timeout, the channel is closed and all pending responses are completed exceptionally. -| `RntbdHealthChecker` | Injects an `RntbdHealthCheckRequest` message upon receipt of an `RntbdWriteRequest` message. The `RntbdWriteRequest` is left pending until an associated `RntbdHealth` response is received. The `RntbdWriteRequest` message is then sent down the pipeline. On failure, cancellation, or timeout, the `RntbdWriteRequest` is completed exceptionally with an indication that the `RntbdWriteRequest` is retry-able. -| `RntbdClientMessageManager` | Creates and completes `CompletableFuture` instances. Handles cancellations, exceptions, and timeouts. Maintains the `RntbdContext`. - -## Health Checks, Write Operations, and Channel Failures - -Cosmos writes are not idempotent at the server. For this reason, the `RntbdTransportClient` must avoid sending writes through failed channels to whatever extent possible. This is the reason for sending write requests in two stages: - -* Check that the channel is healthy and then--only if the server reports that the connection is healthy-- - -* Proceed with the write operation - -The sequence of health check followed by write operation introduces a [time-of-check to time-of-use (TOCTOU)](https://en.wikipedia.org/wiki/Time_of_check_to_time_of_use) race condition. Even if the health check succeeds, the write operation could fail any time before the client receives a response--before sending the payload, while sending, or while waiting for a response. - -There is no way to close the race. The race window should be as small as possible. For this reason success responses to health checks aren't cached. That said, it’s not possible to reduce the probability of write failures to zero. When a failure is detected (on read, write, or health check operation), the channel will be closed and the `CompletableFuture` associated with each pending request will be completed exceptionally. The error associated with a failed `CompletableFuture` will indicate whether a failed request is retry-able. - -## Cancellations, Exceptions, and Timeouts - -Cancellations may be initiated by `RntbdTransportClient` consumers using the `Single` returned by `RntbdTransportClient.invokeStoreAsync`. - -Four types of exceptions are thrown by elements of the RNTBD pipeline: - -* IllegalArgumentException is thrown when the argument to a function doesn't conform to the contract for a method and is indicative of a bug in the RNTBD channel pipeline code. - -* IllegalStateException is thrown when the state of a pipeline, request, or response object doesn't conform to expectations. It is indicative of a bug in the RNTBD channel pipeline code or an object passed to it. - -* CorruptedFrameException is thrown when an IO error is detected. This means there was a problem reading/writing bytes to the wire. It is indicative of a channel health issue. - -* SocketException (or one of its derivatives) are raised when a connection cannot be established or an established connection drops or hangs. - -## Exception propagation - -Exception propagate through the `RntbdTransportClient` like this: - -* Connection exceptions associated with opening a channel propagate to the future listener added by RntbdTransportClient.Endpoint.write. - -* Outbound channel exceptions propagate to the future listener added by RntbdTransportClient.Endpoint.doWrite - -* Inbound channel exceptions are caught by RntbdRequestManager.exceptionCaught and propagate to the RxJava Single emitter returned by RntbdTransportClient.invokeStoreAsync. - -#### Exception mapping - -TODO: DANOBLE - -## Performance Requirements - -The performance requirements of the transport client stack are somewhat fuzzy. As it’s one of the core components of the system, the per-request overhead must be minimal. The overhead is best emphasized by tiny reads (<1 KiB) at eventual consistency, in the same region (1 ms RTT). - -Each connection should be able to handle around 2,500-5,000 requests per second. Given enough cores and memory, the transport stack must be able to handle around 30,000-60,000 requests per second, per endpoint. - -The current version of the protocol performs worse than necessary because all headers are in a flat structure. As such, the (inherently single-threaded) logic that decodes a request header to determine which pending I/O to complete must parse more data than necessary, lowering the peak attainable throughput per connection. Fixing that requires a protocol breaking change (incrementing the protocol version number and rolling out in a deliberate fashion). - -## Confidentiality & Integrity - -The client must only negotiate TLS 1.2 or newer. This is subject to change, as security requirements become more stringent over time. - -## Pass-through Tokens - -RNTBD requests carry a correlation ID which is called `activityID` throughout the `RntbdTransportClient` implementation. An `activityID` is propagated to remote endpoints on every request. -The same holds for the user agent string which is included in the `RntbdContext` associated with a channel. - -## RNTBD Message Formats - -Each RNTBD message type consists of two parts: - -* a head frame followed by -* an optional body frame. - -Each frame begins with a 32-bit integer `length` field followed by a payload. - -``` -┌─────────────┬──────────────────┐ -│ length (32) │ payload (0...) ... -└─────────────┴──────────────────┘ -``` - -The definition of the `length` field is different for the head and body frames. - -| Frame | Definition of `length` field -| ----- | -------------------------------------------------------------------------------------------------------------- -| head | Length of the frame (four plus the length of the payload) expressed as an unsigned 32-bit integer in little-endian order. Values greater than `Integer.MAX_VALUE` must not be sent. -| body | Length of the payload expressed as a 32-bit integer in little-endian order. Values greater than `Integer.MAX_VALUE` must not be sent. - -The `RntbdTransportClient` sends request messages and receives response messages. Following RNTBD context negotiation there is no guarantee that responses will be received in the order that requests are sent. Hence, it is the job of the `RntbdTransportClient` to match requests to responses based on *Activity ID*. - -## RNTBD Request Messages - -RNTBD request messages have this format: - -``` -RntbdRequestHead frame -┌────────────────────────────────────┬──────────────────┬──────────────────┬──────────────────────────────────────────── -│length (32) │resourceType (16) │operationType (16)│activityID (128) -└────────────────────────────────────┴──────────────────┴──────────────────┴────────────────────────┬──────────────────┐ - │headers (0...) ... -────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────┘ - -RntbdRequestBody frame -┌────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────┐ -│length (32) │ payload (0...) ... -└────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────┘ -``` - -The fields of the `RntbdRequestHead` are defined as: - -| Field | Definition -| ------------- | ----------------------------------------------------------------------------------------------------- -| length | Length of the frame expressed as an unsigned 32-bit integer in little-endian order. Values greater than `Integer.MAX_VALUE` must not be sent. -| resourceType | A 16-bit `RntbdResourceType.id()` value in little-endian order. -| operationType | A 16-bit `RntbdOperationType.id()` value in little-endian order. -| activityId | A 128-bit Activity ID that uniquely identifies the request message. It is a `UUID` serialized as an `int` followed by three `short` and six `byte` values in little-endian order. This serialization yields the same sequence of bytes as produced by `System.Guid.ToByteArray`. -| headers | A variable-length sequence of RNTBD headers expressed as `RntbdToken` values. - -A description of each message type follows. - -### RntbdContextRequest - -An `RntbdContextRequest` consists of a single frame: an `RntbdRequestHead` with three headers. - -``` -┌──────────────────────────────┬──────────────┬──────────────┬─────────────────────────────────────────────────────────┬ -│length (32) │0x0000 (16) │0x0000 (16) │activityID (128) ... -└──────────────────────────────┴──────────────┴──────────────┴─────────────────────────────────────────────────────────┴ -┬─────────────────────────────────────────────┬ ┬───────────────────────────────────────────────────────┐ -│protocolVersion: RntbdTokenType.ULong (56) ... │clientVersion: RntbdTokenType.SmallString (32..2072) ... -┴─────────────────────────────────────────────┴ ┴───────────────────────────────────────────────────────┘ -┬───────────────────────────────────────────────────────────┐ -│userAgent: RntbdTokenType.SmallString (32..2072) ... -┴───────────────────────────────────────────────────────────┘ -``` - -The fields of the `RntbdContextRequest` are defined as follows: - -| Field | Definition -| --------------- | ---------------------------------------------------------------------------------------------------- -| length | Length of the frame expressed as an unsigned 32-bit integer in little-endian order. -| resourceType | A 16-bit value of zero. This is the value of `RntbdResourceType.Connection.id()`. -| operationType | A 16-bit value of zero. This is the value of `RntbdOperationType.Connection.id()`. -| protocolVersion | The protocol version to be negotiated. It is represented as a 56-bit long `RntbdToken` of type `RntbdTokenType.ULong`. Its token identifier is `RntbdContextRequestHeader.ProtocolVersion.id()`. -| clientVersion | The client version string. It is represented as a variable-length `RntbdToken` of type `RntbdTokenType.ShortString`. Its token identifier is `RntbdContextRequestHeader.ClientVersion.id()`. -| userAgent | A string identifying the user agent. It is represented as a variable-length `RntbdToken` of type `RntbdTokenType.ShortString`. Its token identifier is `RntbdContextRequestHeader.UserAgent.id()`. - - -### RntbdHealthCheckRequest - -TODO: DANOBLE - -### RntbdReadRequest - -TODO: DANOBLE - -### RntbdWriteRequest - -TODO: DANOBLE - -## RNTBD Response Messages - -RNTBD response messages have this format: - -``` -RntbdResponseHead frame -┌────────────────────────────────────┬──────────────────┬─────────────────────────────────────────────────────────────── -│length (32) │status (16) │activityID (128) -└────────────────────────────────────┴──────────────────┴────────────────────────┬─────────────────────────────────────┐ - │headers (0...) ... -─────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────┘ - -RntbdResponseBody frame -┌────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────┐ -│length (32) │ payload (0...) ... -└────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────┘ -``` - -The fields of the `RntbdResponseHead` are defined as: - -| Field | Definition -| ------------- | ------------------------------------------------------------------------------------------------------ -| length | Length of the frame expressed as an unsigned 32-bit integer in little-endian order. Values greater than `Integer.MAX_VALUE` must not be sent. -| status | A 32-bit `HttpResponseStatus` code in little-endian order. -| activityId | A 128-bit Activity ID that uniquely identifies the request message. It is a `UUID` serialized as an `int` followed by three `short` and six `byte` values in little-endian order. This serialization yields the same sequence of bytes as produced by `System.Guid.ToByteArray`. -| headers | A variable-length sequence of RNTBD headers expressed as `RntbdToken` values. - - -## RNTBD Headers - -RNTBD headers are expressed as a sequence of `RntbdToken` instances with this wire format: - -``` -┌────────────────┬────────┬────────────────────────────┐ -│id (16) │type (8)│value (0...) ... -└────────────────┴────────┴────────────────────────────┘ -``` - -The fields of an `RntbdToken` instance are defined as: - -| Field | Definition -| ------ | ------------------------------------------------------------------------------------------------------ -| id | A 16-bit `RntbdRequestHeader` or `RntbdResponseHeader` identifier in little-endian order. -| type | An 8-bit `RntbdTokenType` ID. -| value | Value of the header identified by `id`. The format and length of the value depend on the `type`. - -Here are the formats of `RntbdToken` instance values by `RntbdTokenType`. - -### RntbdTokenType.Byte (0x00) - -An `RntbdToken` of type `RntbdTokenType.UShort` represents an unsigned 8-bit integer-valued header. It has a fixed -length of 4 bytes (32 bits). - -``` -┌────────────────┬────────┬────────┐ -│id (16) │0x00 (8)│val (8) │ -└────────────────┴────────┴────────┘ -``` - -### RntbdTokenType.UShort (0x01) - -An `RntbdToken` of type `RntbdTokenType.UShort` represents an unsigned 16-bit integer-valued header. It has a fixed -length of 5 bytes (40 bits). - -``` -┌────────────────┬────────┬────────────────┐ -│id (16) │0x01 (8)│ value (16) │ -└────────────────┴────────┴────────────────┘ -``` - -### RntbdTokenType.ULong (0x02) - -An `RntbdToken` of type `RntbdTokenType.ULong` represents an unsigned 32-bit integer-valued header. It has a fixed -length of 7 bytes (56 bits). - -``` -┌────────────────┬────────┬────────────────────────────────┐ -│id (16) │0x02 (8)│value (32) │ -└────────────────┴────────┴────────────────────────────────┘ -``` - -### RntbdTokenType.Long (0x03) - -An `RntbdToken` of type `RntbdTokenType.Long` represents an signed 32-bit integer-valued header. It has a fixed length of 7 bytes (56 bits). - -``` -┌────────────────┬────────┬────────────────────────────────┐ -│id (16) │0x03 (8)│value (32) │ -└────────────────┴────────┴────────────────────────────────┘ -``` - -### RntbdTokenType.ULongLong (0x04) - -An `RntbdToken` of type `RntbdTokenType.ULongLong` represents an unsigned 64-bit integer-valued header. It has a fixed length of 11 bytes (88 bits). - -``` -┌────────────────┬────────┬────────────────────────────────────────────────────────────────┐ -│id (16) │0x04 (8)│value (64) │ -└────────────────┴────────┴────────────────────────────────────────────────────────────────┘ -``` - -### RntbdTokenType.LongLong (0x05) - -An `RntbdToken` of type `RntbdTokenType.LongLong` represents a signed 64-bit integer-valued header. It has a fixed -length of 11 bytes (88 bits). - -``` -┌────────────────┬────────┬────────────────────────────────────────────────────────────────┐ -│id (16) │ 0x05 │ (64) │ -└────────────────┴────────┴────────────────────────────────────────────────────────────────┘ -``` - -### RntbdTokenType.Guid (0x06) - -An `RntbdToken` of type `RntbdTokenType.Guid` represents a 128-bit UUID serializes using an algorithm that produces -the same byte sequence as [`System.Guid.ToByteArray`](https://docs.microsoft.com/en-us/dotnet/api/system.guid.tobytearray?view=netframework-4.7.2). It has a fixed length of 19 bytes (152 bits). - -``` -┌────────────────┬────────┬───────────────────────────────────────────────────────────────────────────────────────────── -│id (16) │0x06 (8)│ value (128) -└────────────────┴────────┴───────────────────────────────────────────────────────────────────────────────────────────── -───────────────────────────────────┐ - │ -───────────────────────────────────┘ -``` - -### RntbdTokenType.SmallString (0x07) - -An `RntbdToken` of type `RntbdTokenType.SmallString` represents a UTF-8 encoded string-valued header. It has a variable length between 4 bytes (32 bits) and 259 bytes (2,072 bits). Its encoded string value can be as large as 255 bytes. - -``` -┌────────────────┬────────┬────────┬────────────────────────────┐ -│id (16) │0x07 (8)│len (8) │ val (0..0xFF) ... -└────────────────┴────────┴────────┴────────────────────────────┘ -``` - -### RntbdTokenType.String (0x08) - -An `RntbdToken` of type `RntbdTokenType.String` represents a UTF-8 encoded string-valued header. It has a variable length between 5 bytes (40 bits) and 2,147,483,654 bytes (524,320 bits). Its encoded string value can be as large as -65,535 bytes (64 KiB - 1 byte). - -``` -┌────────────────┬────────┬────────────────┬────────────────────────────┐ -│id (16) │0x08 (8)│len (16) │ val (0..0xFFFF) ... -└────────────────┴────────┴────────────────┴────────────────────────────┘ -``` - -### RntbdTokenType.ULongString (0x09) - -An `RntbdToken` of type `RntbdTokenType.ULongString` represents a UTF-8 encoded string-valued header. It has a variable length between 7 bytes (56 bits) and 2,147,483,654 bytes (a little more than 16 gibits). Its encoded string value can be as large as 2,147,483,647 (2**31 - 1) bytes. - -``` -┌────────────────┬────────┬────────────────────────────────┬────────────────────────────┐ -│id (16) │0x09 (8)│len (32) │ val (0..0x7FFFFFFF) ... -└────────────────┴────────┴────────────────────────────────┴────────────────────────────┘ -``` - -### RntbdTokenType.SmallBytes (0x0A) - -``` -┌────────────────┬────────┬────────┬────────────────────────────┐ -│id (16) │ 0x0A │len (8) │ val (0..0xFF) ... -└────────────────┴────────┴────────┴────────────────────────────┘ -``` - -### RntbdTokenType.Bytes (0x0B) - -``` -┌────────────────┬────────┬────────────────┬────────────────────────────┐ -│id (16) │ 0x0B │len (16) │ val (0..0xFFFF) ... -└────────────────┴────────┴────────────────┴────────────────────────────┘ -``` - -### RntbdTokenType.ULongBytes (0x0C) - -``` -┌────────────────┬────────┬────────────────────────────────┬────────────────────────────┐ -│id (16) │ 0x0C │len (32) │ val (0..0x7FFFFFFF) ... -└────────────────┴────────┴────────────────────────────────┴────────────────────────────┘ -``` - -### RntbdTokenType.Float (0x0D) - -``` -┌────────────────┬────────┬────────────────────────────────┐ -│id (16) │ 0x0D │ val (32) │ -└────────────────┴────────┴────────────────────────────────┘ -``` - -### RntbdTokenType.Double (0x0E) - -``` -┌────────────────┬────────┬────────────────────────────────────────────────────────────────┐ -│id (16) │ 0x0E │ val (64) │ -└────────────────┴────────┴────────────────────────────────────────────────────────────────┘ -``` - -### RntbdTokenType.Invalid (0xFF) - -``` -┌────────────────┬────────┐ -│id (16) │ 0x0F │ -└────────────────┴────────┘ -``` diff --git a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.pptx b/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.pptx deleted file mode 100644 index 11eebca00164..000000000000 Binary files a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.pptx and /dev/null differ diff --git a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/attachments/RntbdTransportClient.sequence-diagram-1fd9c04f-87e6-472e-afe8-8b1ed30685c2.png b/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/attachments/RntbdTransportClient.sequence-diagram-1fd9c04f-87e6-472e-afe8-8b1ed30685c2.png deleted file mode 100755 index 051d4c1ab632..000000000000 Binary files a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/attachments/RntbdTransportClient.sequence-diagram-1fd9c04f-87e6-472e-afe8-8b1ed30685c2.png and /dev/null differ diff --git a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient architecture.vsdx b/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient architecture.vsdx deleted file mode 100644 index e570a5bb8967..000000000000 Binary files a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient architecture.vsdx and /dev/null differ diff --git a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient sequence diagram.vsdx b/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient sequence diagram.vsdx deleted file mode 100644 index bd353b0f73b2..000000000000 Binary files a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient sequence diagram.vsdx and /dev/null differ diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ContentSerializationFormat.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ContentSerializationFormat.java deleted file mode 100644 index fb9a8fe974d3..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ContentSerializationFormat.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -public enum ContentSerializationFormat { - /** - * Standard JSON RFC UTF-8 text - */ - JsonText, - - /** - * Custom binary for Cosmos DB that encodes a superset of JSON values. - */ - CosmosBinary, -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/EnumerationDirection.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/EnumerationDirection.java deleted file mode 100644 index d4b6aed5351f..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/EnumerationDirection.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -public enum EnumerationDirection { - /** - * Use forward direction - */ - Forward, - - /** - * Use reverse direction - */ - Reverse -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/FanoutOperationState.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/FanoutOperationState.java deleted file mode 100644 index b8c3a4786e80..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/FanoutOperationState.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -public enum FanoutOperationState { - /** - * Fanout operation started - */ - Started, - - /** - * Fanout operation completed - */ - Completed -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/MigrateCollectionDirective.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/MigrateCollectionDirective.java deleted file mode 100644 index 5d3f30231fa1..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/MigrateCollectionDirective.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -public enum MigrateCollectionDirective { - /** - * Move to SSD - */ - Thaw, - - /** - * Move to HDD - */ - Freeze -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ReadFeedKeyType.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ReadFeedKeyType.java deleted file mode 100644 index f84a40047e9a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ReadFeedKeyType.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Type of Start and End key for ReadFeedKey - */ -public enum ReadFeedKeyType { - /** - * Use resource name - */ - ResourceId, - - /** - * Use effective partition key - */ - EffectivePartitionKey -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/RemoteStorageType.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/RemoteStorageType.java deleted file mode 100644 index e0f65239a64c..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/RemoteStorageType.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -public enum RemoteStorageType { - /** - * Use standard storage - */ - NotSpecified, - - /** - * Use standard storage - */ - Standard, - - /** - * Use premium storage - */ - Premium -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolver.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolver.java deleted file mode 100644 index db65feef97d5..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolver.java +++ /dev/null @@ -1,716 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.ICollectionRoutingMapCache; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; -import rx.functions.Func1; - -import java.util.concurrent.Callable; - -/** - * Abstracts out the logic to resolve physical replica addresses for the given {@link RxDocumentServiceRequest} - *

- * AddressCache internally maintains CollectionCache, CollectionRoutingMapCache and BackendAddressCache. - * Logic in this class mainly joins these 3 caches and deals with potential staleness of the caches. - */ -public class AddressResolver implements IAddressResolver { - private static Logger logger = LoggerFactory.getLogger(AddressResolver.class); - - private final static PartitionKeyRangeIdentity masterPartitionKeyRangeIdentity = - new PartitionKeyRangeIdentity(PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID); - - private RxCollectionCache collectionCache; - private ICollectionRoutingMapCache collectionRoutingMapCache; - private IAddressCache addressCache; - - public AddressResolver() { - } - - public void initializeCaches( - RxCollectionCache collectionCache, - ICollectionRoutingMapCache collectionRoutingMapCache, - IAddressCache addressCache) { - this.collectionCache = collectionCache; - this.addressCache = addressCache; - this.collectionRoutingMapCache = collectionRoutingMapCache; - } - - public Single resolveAsync( - RxDocumentServiceRequest request, - boolean forceRefreshPartitionAddresses) { - - Single resultObs = this.resolveAddressesAndIdentityAsync(request, forceRefreshPartitionAddresses); - - return resultObs.flatMap(result -> { - - try { - this.throwIfTargetChanged(request, result.TargetPartitionKeyRange); - } catch (Exception e) { - return Single.error(e); - } - - request.requestContext.resolvedPartitionKeyRange = result.TargetPartitionKeyRange; - - return Single.just(result.Addresses); - }); - } - - private static boolean isSameCollection(PartitionKeyRange initiallyResolved, PartitionKeyRange newlyResolved) { - if (initiallyResolved == null) { - throw new IllegalArgumentException("parent"); - } - - if (newlyResolved == null) { - return false; - } - - if (Strings.areEqual(initiallyResolved.getId(), PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID) && - Strings.areEqual(newlyResolved.getId(), PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID)) { - return true; - } - - if (Strings.areEqual(initiallyResolved.getId(), PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID) - || Strings.areEqual(newlyResolved.getId(), PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID)) { - String message = - "Request was resolved to master partition and then to server partition."; - assert false : message; - logger.warn(message); - return false; - } - - if (ResourceId.parse(initiallyResolved.getResourceId()).getDocumentCollection() - != ResourceId.parse(newlyResolved.getResourceId()).getDocumentCollection()) { - return false; - } - - if (!Strings.areEqual(initiallyResolved.getId(), newlyResolved.getId()) && - !(newlyResolved.getParents() != null && newlyResolved.getParents().contains(initiallyResolved.getId()))) { - // the above condition should be always false in current codebase. - // We don't need to refresh any caches if we resolved to a range which is child of previously resolved range. - // Quorum reads should be handled transparently as child partitions share LSNs with parent partitions which are gone. - String message = - "Request is targeted at a partition key range which is not child of previously targeted range."; - assert false : message; - logger.warn(message); - - return false; - } - - return true; - } - - /** - * Validates if the target partition to which the request is being sent has changed during retry. - *

- * If that happens, the request is no more valid and need to be retried. - * - * @param request Request in progress - * @param targetRange Target partition key range determined by address resolver - * @*/ - private void throwIfTargetChanged(RxDocumentServiceRequest request, PartitionKeyRange targetRange) throws DocumentClientException { - // If new range is child of previous range, we don't need to throw any exceptions - // as LSNs are continued on child ranges. - if (request.requestContext.resolvedPartitionKeyRange != null && - !isSameCollection(request.requestContext.resolvedPartitionKeyRange, targetRange)) { - if (!request.getIsNameBased()) { - String message = String.format( - "Target should not change for non name based requests. Previous target {}, Current {}", - request.requestContext.resolvedPartitionKeyRange, targetRange); - assert false : message; - logger.warn(message); - } - - request.requestContext.resolvedPartitionKeyRange = null; - throw new InvalidPartitionException(RMResources.InvalidTarget, request.getResourceAddress()); - } - } - - private static void ensureRoutingMapPresent( - RxDocumentServiceRequest request, - CollectionRoutingMap routingMap, - DocumentCollection collection) throws DocumentClientException { - if (routingMap == null && request.getIsNameBased() && request.getPartitionKeyRangeIdentity() != null - && request.getPartitionKeyRangeIdentity().getCollectionRid() != null) { - // By design, if partitionkeyrangeid header is present and it contains collectionrid for collection - // which doesn't exist, we return InvalidPartitionException. Backend does the same. - // Caller (client SDK or whoever attached the header) supposedly has outdated collection cache and will refresh it. - // We cannot retry here, as the logic for retry in this case is use-case specific. - logger.debug( - "Routing map for request with partitionkeyrageid {} was not found", - request.getPartitionKeyRangeIdentity().toHeader()); - - InvalidPartitionException invalidPartitionException = new InvalidPartitionException(); - BridgeInternal.setResourceAddress(invalidPartitionException, request.getResourceAddress()); - throw invalidPartitionException; - } - - if (routingMap == null) { - logger.debug( - "Routing map was not found although collection cache is upto date for collection {}", - collection.getResourceId()); - // Routing map not found although collection was resolved correctly. - NotFoundException e = new NotFoundException(); - BridgeInternal.setResourceAddress(e, request.getResourceAddress()); - throw e; - } - } - - private Single tryResolveServerPartitionAsync( - RxDocumentServiceRequest request, - DocumentCollection collection, - CollectionRoutingMap routingMap, - boolean collectionCacheIsUptodate, - boolean collectionRoutingMapCacheIsUptodate, - boolean forceRefreshPartitionAddresses) { - - try { - // Check if this request partitionkeyrange-aware routing logic. We cannot retry here in this case - // and need to bubble up errors. - if (request.getPartitionKeyRangeIdentity() != null) { - return this.tryResolveServerPartitionByPartitionKeyRangeIdAsync( - request, - collection, - routingMap, - collectionCacheIsUptodate, - collectionRoutingMapCacheIsUptodate, - forceRefreshPartitionAddresses); - } - - if (!request.getResourceType().isPartitioned() && - !(request.getResourceType() == ResourceType.StoredProcedure && request.getOperationType() == OperationType.ExecuteJavaScript) && - // Collection head is sent internally for strong consistency given routing hints from original requst, which is for partitioned resource. - !(request.getResourceType() == ResourceType.DocumentCollection && request.getOperationType() == OperationType.Head)) { - logger.error( - "Shouldn't come here for non partitioned resources. resourceType : {}, operationtype:{}, resourceaddress:{}", - request.getResourceType(), - request.getOperationType(), - request.getResourceAddress()); - return Single.error(BridgeInternal.setResourceAddress(new InternalServerErrorException(RMResources.InternalServerError), request.getResourceAddress())); - } - - PartitionKeyRange range; - String partitionKeyString = request.getHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY); - - if (partitionKeyString != null) { - range = this.tryResolveServerPartitionByPartitionKey( - request, - partitionKeyString, - collectionCacheIsUptodate, - collection, - routingMap); - } else { - range = this.tryResolveSinglePartitionCollection(request, routingMap, collectionCacheIsUptodate); - } - - if (range == null) { - // Collection cache or routing map cache is potentially outdated. Return null - - // upper logic will refresh cache and retry. - return null; - } - - Single addressesObs = this.addressCache.tryGetAddresses( - request, - new PartitionKeyRangeIdentity(collection.getResourceId(), range.getId()), - forceRefreshPartitionAddresses); - - return addressesObs.flatMap(addresses -> { - - if (addresses == null) { - logger.info( - "Could not resolve addresses for identity {}/{}. Potentially collection cache or routing map cache is outdated. Return null - upper logic will refresh and retry. ", - new PartitionKeyRangeIdentity(collection.getResourceId(), range.getId())); - return Single.just(null); - } - - return Single.just(new ResolutionResult(range, addresses)); - }); - - } catch (Exception e) { - return Single.error(e); - } - } - - private PartitionKeyRange tryResolveSinglePartitionCollection( - RxDocumentServiceRequest request, - CollectionRoutingMap routingMap, - boolean collectionCacheIsUptoDate) throws DocumentClientException { - // Neither partitionkey nor partitionkeyrangeid is specified. - // Three options here: - // * This is non-partitioned collection and old client SDK which doesn't send partition key. In - // this case there's single entry in routing map. But can be multiple entries if before that - // existed partitioned collection with same name. - // * This is partitioned collection and old client SDK which doesn't send partition key. - // In this case there can be multiple ranges in routing map. - // * This is partitioned collection and this is custom written REST sdk, which has a bug and doesn't send - // partition key. - // We cannot know for sure whether this is partitioned collection or not, because - // partition key definition cache can be outdated. - // So we route request to the first partition. If this is non-partitioned collection - request will succeed. - // If it is partitioned collection - backend will return bad request as partition key header is required in this case. - if (routingMap.getOrderedPartitionKeyRanges().size() == 1) { - return (PartitionKeyRange) routingMap.getOrderedPartitionKeyRanges().get(0); - } - - if (collectionCacheIsUptoDate) { - throw BridgeInternal.setResourceAddress(new BadRequestException(RMResources.MissingPartitionKeyValue), request.getResourceAddress()); - } else { - return null; - } - } - - private Single resolveMasterResourceAddress(RxDocumentServiceRequest request, - boolean forceRefreshPartitionAddresses) { - assert ReplicatedResourceClient.isReadingFromMaster(request.getResourceType(), request.getOperationType()) - && request.getPartitionKeyRangeIdentity() == null; - - // ServiceIdentity serviceIdentity = this.masterServiceIdentity; - PartitionKeyRangeIdentity partitionKeyRangeIdentity = this.masterPartitionKeyRangeIdentity; - Single addressesObs = this.addressCache.tryGetAddresses( - request, - partitionKeyRangeIdentity, - forceRefreshPartitionAddresses); - - return addressesObs.flatMap(addresses -> { - if (addresses == null) { - logger.warn("Could not get addresses for master partition"); - - // return Observable.error() - NotFoundException e = new NotFoundException(); - BridgeInternal.setResourceAddress(e, request.getResourceAddress()); - return Single.error(e); - } - - PartitionKeyRange partitionKeyRange = new PartitionKeyRange(); - partitionKeyRange.setId(PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID); - return Single.just(new ResolutionResult(partitionKeyRange, addresses)); - - }); - } - - private class RefreshState { - - volatile boolean collectionCacheIsUptoDate; - volatile boolean collectionRoutingMapCacheIsUptoDate; - volatile DocumentCollection collection; - volatile CollectionRoutingMap routingMap; - volatile ResolutionResult resolutionResult; - } - - private Single getOrRefreshRoutingMap(RxDocumentServiceRequest request, boolean forceRefreshPartitionAddresses) { - - RefreshState state = new RefreshState(); - - state.collectionCacheIsUptoDate = !request.getIsNameBased() || - (request.getPartitionKeyRangeIdentity() != null && request.getPartitionKeyRangeIdentity().getCollectionRid() != null); - state.collectionRoutingMapCacheIsUptoDate = false; - - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - - Single stateObs = collectionObs.flatMap(collection -> { - state.collection = collection; - Single routingMapObs = - this.collectionRoutingMapCache.tryLookupAsync(collection.getResourceId(), null, request.forceCollectionRoutingMapRefresh, request.properties); - final DocumentCollection underlyingCollection = collection; - return routingMapObs.flatMap(routingMap -> { - state.routingMap = routingMap; - - if (request.forcePartitionKeyRangeRefresh) { - state.collectionRoutingMapCacheIsUptoDate = true; - request.forcePartitionKeyRangeRefresh = false; - if (routingMap != null) { - return this.collectionRoutingMapCache.tryLookupAsync(underlyingCollection.getResourceId(), routingMap, request.properties) - .map(newRoutingMap -> { - state.routingMap = newRoutingMap; - return state; - }); - } - - } - - return Single.just(state); - }); - }); - - return stateObs.flatMap(newState -> { - - if (newState.routingMap == null && !newState.collectionCacheIsUptoDate) { - // Routing map was not found by resolved collection rid. Maybe collection rid is outdated. - // Refresh collection cache and reresolve routing map. - request.forceNameCacheRefresh = true; - newState.collectionCacheIsUptoDate = true; - newState.collectionRoutingMapCacheIsUptoDate = false; - - Single newCollectionObs = this.collectionCache.resolveCollectionAsync(request); - - return newCollectionObs.flatMap(collection -> { - newState.collection = collection; - Single newRoutingMapObs = this.collectionRoutingMapCache.tryLookupAsync( - collection.getResourceId(), - null, - request.properties); - - return newRoutingMapObs.map(routingMap -> { - newState.routingMap = routingMap; - return newState; - }); - } - ); - - } - - return Single.just(newState); - }); - } - - private Single getStateWithNewRoutingMap(RefreshState state, Single routingMapSingle) { - return routingMapSingle.map(r -> { - state.routingMap = r; - return state; - }); - } - - /** - * Resolves the endpoint of the partition for the given request - * - * @param request Request for which the partition endpoint resolution is to be performed - * @param forceRefreshPartitionAddresses Force refresh the partition's endpoint - * @return ResolutionResult - */ - private Single resolveAddressesAndIdentityAsync( - RxDocumentServiceRequest request, - boolean forceRefreshPartitionAddresses) { - - if (ReplicatedResourceClient.isReadingFromMaster(request.getResourceType(), request.getOperationType()) - && request.getPartitionKeyRangeIdentity() == null) { - return resolveMasterResourceAddress(request, forceRefreshPartitionAddresses); - } - - Single refreshStateObs = this.getOrRefreshRoutingMap(request, forceRefreshPartitionAddresses); - - return refreshStateObs.flatMap( - state -> { - try { - AddressResolver.ensureRoutingMapPresent(request, state.routingMap, state.collection); - - } catch (Exception e) { - return Single.error(e); - } - - // At this point we have both collection and routingMap. - Single resultObs = this.tryResolveServerPartitionAsync( - request, - state.collection, - state.routingMap, - state.collectionCacheIsUptoDate, - state.collectionRoutingMapCacheIsUptoDate, - forceRefreshPartitionAddresses); - - - return resultObs.flatMap(result -> { - Func1> addCollectionRidIfNameBased = funcResolutionResult -> { - assert funcResolutionResult != null; - if (request.getIsNameBased()) { - // Append collection rid. - // If we resolved collection rid incorrectly because of outdated cache, this can lead - // to incorrect routing decisions. But backend will validate collection rid and throw - // InvalidPartitionException if we reach wrong collection. - // Also this header will be used by backend to inject collection rid into metrics for - // throttled requests. - request.getHeaders().put(WFConstants.BackendHeaders.COLLECTION_RID, state.collection.getResourceId()); - } - - return Single.just(funcResolutionResult); - }; - - if (result != null) { - return addCollectionRidIfNameBased.call(result); - } - - // result is null: - assert result == null; - - Func1> ensureCollectionRoutingMapCacheIsUptoDateFunc = funcState -> { - if (!funcState.collectionRoutingMapCacheIsUptoDate) { - funcState.collectionRoutingMapCacheIsUptoDate = true; - Single newRoutingMapObs = this.collectionRoutingMapCache.tryLookupAsync( - funcState.collection.getResourceId(), - funcState.routingMap, - request.properties); - - return getStateWithNewRoutingMap(funcState, newRoutingMapObs); - } else { - return Single.just(state); - } - }; - - Func1> resolveServerPartition = funcState -> { - - try { - AddressResolver.ensureRoutingMapPresent(request, funcState.routingMap, funcState.collection); - } catch (Exception e) { - return Single.error(e); - } - - return this.tryResolveServerPartitionAsync( - request, - funcState.collection, - funcState.routingMap, - true, - true, - forceRefreshPartitionAddresses); - }; - - Func1> onNullThrowNotFound = funcResolutionResult -> { - if (funcResolutionResult == null) { - logger.debug("Couldn't route partitionkeyrange-oblivious request after retry/cache refresh. Collection doesn't exist."); - - // At this point collection cache and routing map caches are refreshed. - // The only reason we will get here is if collection doesn't exist. - // Case when partition-key-range doesn't exist is handled in the corresponding method. - - return Single.error(BridgeInternal.setResourceAddress(new NotFoundException(), request.getResourceAddress())); - } - - return Single.just(funcResolutionResult); - }; - - // Couldn't resolve server partition or its addresses. - // Either collection cache is outdated or routing map cache is outdated. - if (!state.collectionCacheIsUptoDate) { - request.forceNameCacheRefresh = true; - state.collectionCacheIsUptoDate = true; - - Single newCollectionObs = this.collectionCache.resolveCollectionAsync(request); - Single newRefreshStateObs = newCollectionObs.flatMap(collection -> { - state.collection = collection; - - if (collection.getResourceId() != state.routingMap.getCollectionUniqueId()) { - // Collection cache was stale. We resolved to new Rid. routing map cache is potentially stale - // for this new collection rid. Mark it as such. - state.collectionRoutingMapCacheIsUptoDate = false; - Single newRoutingMap = this.collectionRoutingMapCache.tryLookupAsync( - collection.getResourceId(), - null, - request.properties); - - return getStateWithNewRoutingMap(state, newRoutingMap); - } - - return Single.just(state); - }); - - Single newResultObs = newRefreshStateObs.flatMap(ensureCollectionRoutingMapCacheIsUptoDateFunc::call) - .flatMap(resolveServerPartition::call); - - return newResultObs.flatMap(onNullThrowNotFound::call).flatMap(addCollectionRidIfNameBased::call); - - } else { - return ensureCollectionRoutingMapCacheIsUptoDateFunc.call(state) - .flatMap(resolveServerPartition::call).flatMap(onNullThrowNotFound).flatMap(addCollectionRidIfNameBased); - } - }); - } - ); - } - - private ResolutionResult handleRangeAddressResolutionFailure( - RxDocumentServiceRequest request, - boolean collectionCacheIsUpToDate, - boolean routingMapCacheIsUpToDate, - CollectionRoutingMap routingMap) throws DocumentClientException { - // Optimization to not refresh routing map unnecessary. As we keep track of parent child relationships, - // we can determine that a range is gone just by looking up in the routing map. - if (collectionCacheIsUpToDate && routingMapCacheIsUpToDate || - collectionCacheIsUpToDate && routingMap.IsGone(request.getPartitionKeyRangeIdentity().getPartitionKeyRangeId())) { - String errorMessage = String.format( - RMResources.PartitionKeyRangeNotFound, - request.getPartitionKeyRangeIdentity().getPartitionKeyRangeId(), - request.getPartitionKeyRangeIdentity().getCollectionRid()); - throw BridgeInternal.setResourceAddress(new PartitionKeyRangeGoneException(errorMessage), request.getResourceAddress()); - } - - return null; - } - - private Single returnOrError(Callable function) { - try { - return Single.just(function.call()); - } catch (Exception e) { - return Single.error(e); - } - } - - private Single tryResolveServerPartitionByPartitionKeyRangeIdAsync( - RxDocumentServiceRequest request, - DocumentCollection collection, - CollectionRoutingMap routingMap, - boolean collectionCacheIsUpToDate, - boolean routingMapCacheIsUpToDate, - boolean forceRefreshPartitionAddresses) { - - PartitionKeyRange partitionKeyRange = routingMap.getRangeByPartitionKeyRangeId(request.getPartitionKeyRangeIdentity().getPartitionKeyRangeId()); - if (partitionKeyRange == null) { - logger.debug("Cannot resolve range '{}'", request.getPartitionKeyRangeIdentity().toHeader()); - return returnOrError(() -> this.handleRangeAddressResolutionFailure(request, collectionCacheIsUpToDate, routingMapCacheIsUpToDate, routingMap)); - } - - Single addressesObs = this.addressCache.tryGetAddresses( - request, - new PartitionKeyRangeIdentity(collection.getResourceId(), request.getPartitionKeyRangeIdentity().getPartitionKeyRangeId()), - forceRefreshPartitionAddresses); - - return addressesObs.flatMap(addresses -> { - - if (addresses == null) { - logger.debug("Cannot resolve addresses for range '{}'", request.getPartitionKeyRangeIdentity().toHeader()); - - try { - return Single.just(this.handleRangeAddressResolutionFailure(request, collectionCacheIsUpToDate, routingMapCacheIsUpToDate, routingMap)); - } catch (DocumentClientException e) { - return Single.error(e); - } - } - - return Single.just(new ResolutionResult(partitionKeyRange, addresses)); - }); - } - - private PartitionKeyRange tryResolveServerPartitionByPartitionKey( - RxDocumentServiceRequest request, - String partitionKeyString, - boolean collectionCacheUptoDate, - DocumentCollection collection, - CollectionRoutingMap routingMap) throws DocumentClientException { - if (request == null) { - throw new NullPointerException("request"); - } - - if (partitionKeyString == null) { - throw new NullPointerException("partitionKeyString"); - } - - if (collection == null) { - throw new NullPointerException("collection"); - } - - if (routingMap == null) { - throw new NullPointerException("routingMap"); - } - - PartitionKeyInternal partitionKey; - - try { - partitionKey = PartitionKeyInternal.fromJsonString(partitionKeyString); - } catch (Exception ex) { - throw BridgeInternal.setResourceAddress(new BadRequestException( - String.format(RMResources.InvalidPartitionKey, partitionKeyString), - ex), request.getResourceAddress()); - } - - if (partitionKey == null) { - throw new InternalServerErrorException(String.format("partition key is null '%s'", partitionKeyString)); - } - - if (partitionKey.getComponents().size() == collection.getPartitionKey().getPaths().size()) { - // Although we can compute effective partition key here, in general case this Gateway can have outdated - // partition key definition cached - like if collection with same name but with Range partitioning is created. - // In this case server will not pass x-ms-documentdb-collection-rid check and will return back InvalidPartitionException. - // Gateway will refresh its cache and retry. - String effectivePartitionKey = PartitionKeyInternalHelper.getEffectivePartitionKeyString(partitionKey, collection.getPartitionKey()); - - // There should be exactly one range which contains a partition key. Always. - return routingMap.getRangeByEffectivePartitionKey(effectivePartitionKey); - } - - if (collectionCacheUptoDate) { - BadRequestException badRequestException = BridgeInternal.setResourceAddress(new BadRequestException(RMResources.PartitionKeyMismatch), request.getResourceAddress()); - badRequestException.getResponseHeaders().put(WFConstants.BackendHeaders.SUB_STATUS, Integer.toString(HttpConstants.SubStatusCodes.PARTITION_KEY_MISMATCH)); - - throw badRequestException; - } - - // Partition key supplied has different number paths than locally cached partition key definition. - // Three things can happen: - // 1. User supplied wrong partition key. - // 2. Client SDK has outdated partition key definition cache and extracted wrong value from the document. - // 3. Gateway's cache is outdated. - // - // What we will do is append x-ms-documentdb-collection-rid header and forward it to random collection partition. - // * If collection rid matches, server will send back 400.1001, because it also will not be able to compute - // effective partition key. Gateway will forward this status code to client - client will handle it. - // * If collection rid doesn't match, server will send back InvalidPartiitonException and Gateway will - // refresh name routing cache - this will refresh partition key definition as well, and retry. - - logger.debug( - "Cannot compute effective partition key. Definition has '{}' paths, values supplied has '{}' paths. Will refresh cache and retry.", - collection.getPartitionKey().getPaths().size(), - partitionKey.getComponents().size()); - - return null; - } - - private class ResolutionResult { - public final PartitionKeyRange TargetPartitionKeyRange; - public final AddressInformation[] Addresses; - - public ResolutionResult( - PartitionKeyRange targetPartitionKeyRange, - AddressInformation[] addresses) { - if (targetPartitionKeyRange == null) { - throw new NullPointerException("targetPartitionKeyRange"); - } - - if (addresses == null) { - throw new NullPointerException("addresses"); - } - - this.TargetPartitionKeyRange = targetPartitionKeyRange; - this.Addresses = addresses; - } - } -} - diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelector.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelector.java deleted file mode 100644 index 24727f7a07a7..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelector.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import rx.Single; - -import java.net.URI; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -public class AddressSelector { - private final IAddressResolver addressResolver; - private final Protocol protocol; - - public AddressSelector(IAddressResolver addressResolver, Protocol protocol) { - this.addressResolver = addressResolver; - this.protocol = protocol; - } - - public Single> resolveAllUriAsync( - RxDocumentServiceRequest request, - boolean includePrimary, - boolean forceRefresh) { - Single> allReplicaAddressesObs = this.resolveAddressesAsync(request, forceRefresh); - return allReplicaAddressesObs.map(allReplicaAddresses -> allReplicaAddresses.stream().filter(a -> includePrimary || !a.isPrimary()) - .map(a -> HttpUtils.toURI(a.getPhysicalUri())).collect(Collectors.toList())); - } - - public Single resolvePrimaryUriAsync(RxDocumentServiceRequest request, boolean forceAddressRefresh) { - Single> replicaAddressesObs = this.resolveAddressesAsync(request, forceAddressRefresh); - return replicaAddressesObs.flatMap(replicaAddresses -> { - try { - return Single.just(AddressSelector.getPrimaryUri(request, replicaAddresses)); - } catch (Exception e) { - return Single.error(e); - } - }); - } - - public static URI getPrimaryUri(RxDocumentServiceRequest request, List replicaAddresses) throws GoneException { - AddressInformation primaryAddress = null; - - if (request.getDefaultReplicaIndex() != null) { - int defaultReplicaIndex = request.getDefaultReplicaIndex(); - if (defaultReplicaIndex >= 0 && defaultReplicaIndex < replicaAddresses.size()) { - primaryAddress = replicaAddresses.get(defaultReplicaIndex); - } - } else { - primaryAddress = replicaAddresses.stream().filter(address -> address.isPrimary() && !address.getPhysicalUri().contains("[")) - .findAny().orElse(null); - } - - if (primaryAddress == null) { - // Primary endpoint (of the desired protocol) was not found. - throw new GoneException(String.format("The requested resource is no longer available at the server. Returned addresses are {%s}", - String.join(",", replicaAddresses.stream().map(address -> address.getPhysicalUri()).collect(Collectors.toList()))), null); - } - - return HttpUtils.toURI(primaryAddress.getPhysicalUri()); - } - - public Single> resolveAddressesAsync(RxDocumentServiceRequest request, boolean forceAddressRefresh) { - Single> resolvedAddressesObs = - (this.addressResolver.resolveAsync(request, forceAddressRefresh)) - .map(addresses -> Arrays.stream(addresses) - .filter(address -> { - return !Strings.isNullOrEmpty(address.getPhysicalUri()) && Strings.areEqualIgnoreCase(address.getProtocolScheme(), this.protocol.scheme()); - }) - .collect(Collectors.toList())); - - return resolvedAddressesObs.map( - resolvedAddresses -> { - List r = resolvedAddresses.stream().filter(address -> !address.isPublic()).collect(Collectors.toList()); - if (r.size() > 0) { - return r; - } else { - return resolvedAddresses.stream().filter(address -> address.isPublic()).collect(Collectors.toList()); - } - } - ); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelper.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelper.java deleted file mode 100644 index dabfb9d2c96e..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelper.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.AuthorizationTokenType; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.NotImplementedException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; -import rx.exceptions.Exceptions; - -import java.util.Map; - -public class BarrierRequestHelper { - private final static Logger logger = LoggerFactory.getLogger(BarrierRequestHelper.class); - - public static Single createAsync( - RxDocumentServiceRequest request, - IAuthorizationTokenProvider authorizationTokenProvider, - Long targetLsn, - Long targetGlobalCommittedLsn) { - - boolean isCollectionHeadRequest = BarrierRequestHelper.isCollectionHeadBarrierRequest( - request.getResourceType(), - request.getOperationType()); - - AuthorizationTokenType originalRequestTokenType = request.authorizationTokenType; - - if (originalRequestTokenType == AuthorizationTokenType.Invalid) { - String message = "AuthorizationTokenType not set for the read request"; - assert false : message; - logger.error(message); - } - - String authorizationToken = Strings.Emtpy; - RxDocumentServiceRequest barrierLsnRequest = null; - if (!isCollectionHeadRequest) { - // DB Feed - barrierLsnRequest = RxDocumentServiceRequest.create( - OperationType.HeadFeed, - (String) null, - (ResourceType) ResourceType.Database, - (Map) null); - } else if (request.getIsNameBased()) { - // Name based server request - - // get the collection full name - // dbs/{id}/colls/{collid}/ - String collectionLink = PathsHelper.getCollectionPath(request.getResourceAddress()); - barrierLsnRequest = RxDocumentServiceRequest.createFromName( - OperationType.Head, - collectionLink, - ResourceType.DocumentCollection); - } else { - // RID based Server request - barrierLsnRequest = RxDocumentServiceRequest.create( - OperationType.Head, - ResourceId.parse(request.getResourceId()).getDocumentCollectionId().toString(), - ResourceType.DocumentCollection, null); - } - - barrierLsnRequest.getHeaders().put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - - if (targetLsn != null && targetLsn > 0) { - barrierLsnRequest.getHeaders().put(HttpConstants.HttpHeaders.TARGET_LSN, targetLsn.toString()); - } - - if (targetGlobalCommittedLsn != null && targetGlobalCommittedLsn > 0) { - barrierLsnRequest.getHeaders().put(HttpConstants.HttpHeaders.TARGET_GLOBAL_COMMITTED_LSN, targetGlobalCommittedLsn.toString()); - } - - switch (originalRequestTokenType) { - case PrimaryMasterKey: - case PrimaryReadonlyMasterKey: - case SecondaryMasterKey: - case SecondaryReadonlyMasterKey: - authorizationToken = authorizationTokenProvider.getUserAuthorizationToken( - barrierLsnRequest.getResourceAddress(), - isCollectionHeadRequest ? ResourceType.DocumentCollection : ResourceType.Database, - HttpConstants.HttpMethods.HEAD, - barrierLsnRequest.getHeaders(), - originalRequestTokenType, - request.properties); - break; - - - case ResourceToken: - authorizationToken = request.getHeaders().get(HttpConstants.HttpHeaders.AUTHORIZATION); - break; - - default: - String unknownAuthToken = "Unknown authorization token kind for read request"; - assert false : unknownAuthToken; - logger.error(unknownAuthToken); - Exceptions.propagate(new InternalServerErrorException(RMResources.InternalServerError)); - } - - barrierLsnRequest.getHeaders().put(HttpConstants.HttpHeaders.AUTHORIZATION, authorizationToken); - barrierLsnRequest.requestContext = request.requestContext.clone(); - - if (request.getPartitionKeyRangeIdentity() != null) { - barrierLsnRequest.routeTo(request.getPartitionKeyRangeIdentity()); - } - if (request.getHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY) != null) { - barrierLsnRequest.getHeaders().put(HttpConstants.HttpHeaders.PARTITION_KEY, request.getHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY)); - } - if (request.getHeaders().get(WFConstants.BackendHeaders.COLLECTION_RID) != null) { - barrierLsnRequest.getHeaders().put(WFConstants.BackendHeaders.COLLECTION_RID, request.getHeaders().get(WFConstants.BackendHeaders.COLLECTION_RID)); - } - - return Single.just(barrierLsnRequest); - } - - static boolean isCollectionHeadBarrierRequest(ResourceType resourceType, OperationType operationType) { - switch (resourceType) { - case Attachment: - case Document: - case Conflict: - case StoredProcedure: - case UserDefinedFunction: - case Trigger: - return true; - case DocumentCollection: - if (operationType != OperationType.ReadFeed && operationType != OperationType.Query && operationType != OperationType.SqlQuery) { - return true; - } else { - return false; - } - case PartitionKeyRange: - // no logic for OperationType.GetSplitPoint and OperationType.AbortSplit - // as they are not applicable to SDK - return false; - default: - return false; - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConflictException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConflictException.java deleted file mode 100644 index 58f7e39d3c72..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConflictException.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class ConflictException extends DocumentClientException { - - private static final long serialVersionUID = 1L; - - public ConflictException() { - this(RMResources.EntityAlreadyExists); - } - - public ConflictException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.CONFLICT, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public ConflictException(String msg) { - super(HttpConstants.StatusCodes.CONFLICT, msg); - } - - public ConflictException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.CONFLICT, resourceAddress); - } - - public ConflictException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public ConflictException(Exception innerException) { - this(RMResources.EntityAlreadyExists, innerException, null, null); - } - - public ConflictException(Error error, Map headers) { - super(HttpConstants.StatusCodes.CONFLICT, error, headers); - } - - public ConflictException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.EntityAlreadyExists, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.CONFLICT, - requestUri); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReader.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReader.java deleted file mode 100644 index ab132ebbafbd..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReader.java +++ /dev/null @@ -1,439 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.util.HashMap; -import java.util.List; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -/* - ConsistencyLevel Replication Mode Desired ReadMode - ------------------- -------------------- --------------------------------------------------------------------------- - Strong Synchronous Read from Read Quorum - Asynchronous Not supported - - Bounded Staleness Synchronous Read from Read Quorum - Asynchronous Read from Read Quorum. Performing read barrier on Primary is unsupported. - - Session Sync/Async Read Any (With LSN Cookie) - Default to Primary as last resort (which should succeed always) - - Eventual Sync/Async Read Any - - Client does validation of unsupported combinations. - - - Preliminaries - ============= - 1. We do primary copy/single master replication. - 2. We do sync or async replication depending on the value of DefaultConsistencyLevel on a database account. - If the database account is configured with DefaultConsistencyLevel = Strong, we do sync replication. By default, for all other values of DefaultConsistencyLevel, we do asynchronous replication. - - Replica set - =========== - We define N as the current number of replicas protecting a partition. - At any given point, the value of N can fluctuate between NMax and NMin. - NMax is called the target replica set size and NMin is called the minimum write availability set size. - NMin and NMax are statically defined whereas N is dynamic. - Dynamic replica set is great for dealing with successive failures. - Since N fluctuates between NMax and NMin, the value of N at the time of calculation of W may not be the same when R is calculated. - This is a side effect of dynamic quorum and requires careful consideration. - - NMin = 2, NMax >= 3 - - Simultaneous Failures - ===================== - In general N replicas imply 2f+1 simultaneous failures - N = 5 allows for 2 simultaneous failures - N = 4 allows for 1 failure - N = 3 allows for 1 failure - N < 3 allows for 0 failures - - Quorums - ======= - W = Write Quorum = Number of replicas which acknowledge a write before the primary can ack the client. It is majority set i.e. N/2 + 1 - R = Read Quorum = Set of replicas such that there is non-empty intersection between W and R that constitute N i.e. R = N -W + 1 - - For sync replication, W is used as a majority quorum. - For async replication, W = 1. We have two LSNs, one is quorum acknowledged LSN (LSN-Q) and another is what is visible to the client (LSN-C). - LSN-Q is the stable LSN which corresponds to the write quorum of Windows Fabric. LSN-C is unstable and corresponds to W=1. - - Assumptions - =========== - Nmin <= N <= Nmax - W >= N/2 + 1 - R = N -W + 1 - - N from read standpoint means number of address from BE which is returning successful response. - Successful reponse: Any BE response containing LSN response header is considered successful reponse. Typically every response other than 410 is treated as succesful response. - - Strong Consistency - ================== - Strong Read requires following guarantees. - * Read value is the latest that has been written. If a write operation finished. Any subsequent reads should see that value. - * Monotonic guarantee. Any read that starts after a previous read operation, should see atleast return equal or higher version of the value. - - To perform strong read we require that atleast R i.e. Read Quorum number of replicas have the value committed. To acheve that such read : - * Read R replicas. If they have the same LSN, use the read result - * If they don't have the same LSN, we will either return the result with the highest LSN observed from those R replicas, after ensuring that LSN - becomes available with R replicas. - * Secondary replicas are always preferred for reading. If R secondaries have returned the result but cannot agree on the resulting LSN, we can include Primary to satisfy read quorum. - * If we only have R replicas (i.e. N==R), we include primary in reading the result and validate N==R. - - Bounded Staleness - ================= - Sync Replication: - Bounded staleness uses the same logic as Strong for cases where the server is using sync replication. - - Async Replication: - For async replication, we make sure that we do not use the Primary as barrier for read quorum. This is because Primary is always going to run ahead (async replication uses W=1 on Primary). - Using primary would voilate the monotonic read guarantees when we fall back to reading from secondary in the subsequent reads as they are always running slower as compared to Primary. - - Session - ======= - We read from secondaries one by one until we find a match for the client's session token (LSN-C). - We go to primary as a last resort which should satisfy LSN-C. - - Availability for Bounded Staleness (for NMax = 4 and NMin = 2): - When there is a partition, the minority quorum can remain available for read as long as N >= 1 - When there is a partition, the minority quorum can remain available for writes as long as N >= 2 - - Eventual - ======== - We can read from any replicas. - - Availability for Bounded Staleness (for NMax = 4 and NMin = 2): - When there is a partition, the minority quorum can remain available for read as long as N >= 1 - When there is a partition, the minority quorum can remain available for writes as long as N >= 2 - - Read Retry logic - ----------------- - For Any NonQuorum Reads(A.K.A ReadAny); AddressCache is refreshed for following condition. - 1) No Secondary Address is found in Address Cache. - 2) Chosen Secondary Returned GoneException/EndpointNotFoundException. - - For Quorum Read address cache is refreshed on following condition. - 1) We found only R secondary where R < RMAX. - 2) We got GoneException/EndpointNotFoundException on all the secondary we contacted. - - */ -/** - * ConsistencyReader has a dependency on both StoreReader and QuorumReader. For Bounded Staleness and Strong Consistency, it uses the Quorum Reader - * to converge on a read from read quorum number of replicas. - * For Session and Eventual Consistency, it directly uses the store reader. - */ -public class ConsistencyReader { - private final static int MAX_NUMBER_OF_SECONDARY_READ_RETRIES = 3; - private final static Logger logger = LoggerFactory.getLogger(ConsistencyReader.class); - - private final AddressSelector addressSelector; - private final GatewayServiceConfigurationReader serviceConfigReader; - private final IAuthorizationTokenProvider authorizationTokenProvider; - private final StoreReader storeReader; - private final QuorumReader quorumReader; - private final Configs configs; - - public ConsistencyReader( - Configs configs, - AddressSelector addressSelector, - ISessionContainer sessionContainer, - TransportClient transportClient, - GatewayServiceConfigurationReader serviceConfigReader, - IAuthorizationTokenProvider authorizationTokenProvider) { - this.configs = configs; - this.addressSelector = addressSelector; - this.serviceConfigReader = serviceConfigReader; - this.authorizationTokenProvider = authorizationTokenProvider; - this.storeReader = createStoreReader(transportClient, addressSelector, sessionContainer); - this.quorumReader = createQuorumReader(transportClient, addressSelector, this.storeReader, serviceConfigReader, authorizationTokenProvider); - } - - public Single readAsync(RxDocumentServiceRequest entity, - TimeoutHelper timeout, - boolean isInRetry, - boolean forceRefresh) { - if (!isInRetry) { - if (timeout.isElapsed()) { - return Single.error(new RequestTimeoutException()); - } - - } else { - if (timeout.isElapsed()) { - return Single.error(new GoneException()); - } - } - - entity.requestContext.timeoutHelper = timeout; - - if (entity.requestContext.requestChargeTracker == null) { - entity.requestContext.requestChargeTracker = new RequestChargeTracker(); - } - - if(entity.requestContext.clientSideRequestStatistics == null) { - entity.requestContext.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - - entity.requestContext.forceRefreshAddressCache = forceRefresh; - - ValueHolder targetConsistencyLevel = ValueHolder.initialize(null); - ValueHolder useSessionToken = ValueHolder.initialize(null); - ReadMode desiredReadMode; - try { - desiredReadMode = this.deduceReadMode(entity, targetConsistencyLevel, useSessionToken); - } catch (DocumentClientException e) { - return Single.error(e); - } - int maxReplicaCount = this.getMaxReplicaSetSize(entity); - int readQuorumValue = maxReplicaCount - (maxReplicaCount / 2); - - switch (desiredReadMode) { - case Primary: - return this.readPrimaryAsync(entity, useSessionToken.v); - - case Strong: - entity.requestContext.performLocalRefreshOnGoneException = true; - return this.quorumReader.readStrongAsync(entity, readQuorumValue, desiredReadMode); - - case BoundedStaleness: - entity.requestContext.performLocalRefreshOnGoneException = true; - - // for bounded staleness, we are defaulting to read strong for local region reads. - // this can be done since we are always running with majority quorum w = 3 (or 2 during quorum downshift). - // This means that the primary will always be part of the write quorum, and - // therefore can be included for barrier reads. - - // NOTE: this assumes that we are running with SYNC replication (i.e. majority quorum). - // When we run on a minority write quorum(w=2), to ensure monotonic read guarantees - // we always contact two secondary replicas and exclude primary. - // However, this model significantly reduces availability and available throughput for serving reads for bounded staleness during reconfiguration. - // Therefore, to ensure monotonic read guarantee from any replica set we will just use regular quorum read(R=2) since our write quorum is always majority(W=3) - return this.quorumReader.readStrongAsync(entity, readQuorumValue, desiredReadMode); - - case Any: - if (targetConsistencyLevel.v == ConsistencyLevel.Session) { - return this.readSessionAsync(entity, desiredReadMode); - } else { - return this.readAnyAsync(entity, desiredReadMode); - } - - default: - throw new IllegalStateException("invalid operation " + desiredReadMode); - } - } - - private Single readPrimaryAsync(RxDocumentServiceRequest entity, - boolean useSessionToken) { - - Single responseObs = this.storeReader.readPrimaryAsync( - entity, - false /*required valid LSN*/, - useSessionToken); - return responseObs.flatMap(response -> { - try { - return Single.just(response.toResponse()); - } catch (DocumentClientException e) { - // TODO: RxJava1 due to design flaw doesn't allow throwing checked exception - // RxJava2 has fixed this design flaw, - // once we switched to RxJava2 we can get rid of unnecessary catch block - // also we can switch to Observable.map(.) - return Single.error(e); - } - }); - } - - private Single readAnyAsync(RxDocumentServiceRequest entity, - ReadMode readMode) { - Single> responsesObs = this.storeReader.readMultipleReplicaAsync( - entity, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN*/ false, - /* useSessionToken */ false, - /* readMode */ readMode); - - return responsesObs.flatMap( - responses -> { - if (responses.size() == 0) { - return Single.error(new GoneException(RMResources.Gone)); - } - - try { - return Single.just(responses.get(0).toResponse()); - } catch (DocumentClientException e) { - // TODO: RxJava1 due to design flaw doesn't allow throwing checked exception - // RxJava2 has fixed this design flaw, - // once we switched to RxJava2 we can get rid of unnecessary catch block - // also we can switch to Observable.map(.) - return Single.error(e); - } - } - ); - } - - private Single readSessionAsync(RxDocumentServiceRequest entity, - ReadMode readMode) { - - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - Single> responsesObs = this.storeReader.readMultipleReplicaAsync( - entity, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN */ true, - /* useSessionToken */ true, - /* readMode */ readMode, - /* checkMinLsn */ true, - /* forceReadAll */ false); - - return responsesObs.flatMap(responses -> { - - if (responses.size() > 0) { - try { - return Single.just(responses.get(0).toResponse(entity.requestContext.requestChargeTracker)); - } catch (NotFoundException notFoundException) { - try { - if (entity.requestContext.sessionToken != null - && responses.get(0).sessionToken != null - && !entity.requestContext.sessionToken.isValid(responses.get(0).sessionToken)) { - logger.warn("Convert to session read exception, request {} Session Lsn {}, responseLSN {}", entity.getResourceAddress(), entity.requestContext.sessionToken.convertToString(), responses.get(0).lsn); - notFoundException.getResponseHeaders().put(WFConstants.BackendHeaders.SUB_STATUS, Integer.toString(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)); - } - return Single.error(notFoundException); - } catch (DocumentClientException e) { - // TODO: RxJava1 due to design flaw doesn't allow throwing checked exception - // so we have to catch and return - // once we move to RxJava2 we can fix this. - return Single.error(e); - } - } catch (DocumentClientException dce) { - // TODO: RxJava1 due to design flaw doesn't allow throwing checked exception - // so we have to catch and return - // once we move to RxJava2 we can fix this. - return Single.error(dce); - } - - } - - // else - HashMap responseHeaders = new HashMap<>(); - responseHeaders.put(WFConstants.BackendHeaders.SUB_STATUS, Integer.toString(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)); - ISessionToken requestSessionToken = entity.requestContext.sessionToken; - logger.warn("Fail the session read {}, request session token {}", entity.getResourceAddress(), requestSessionToken == null ? "" : requestSessionToken.convertToString()); - return Single.error(new NotFoundException(RMResources.ReadSessionNotAvailable, responseHeaders, null)); - }); - } - - ReadMode deduceReadMode(RxDocumentServiceRequest request, - ValueHolder targetConsistencyLevel, - ValueHolder useSessionToken) throws DocumentClientException { - targetConsistencyLevel.v = RequestHelper.GetConsistencyLevelToUse(this.serviceConfigReader, request); - useSessionToken.v = (targetConsistencyLevel.v == ConsistencyLevel.Session); - - if (request.getDefaultReplicaIndex() != null) { - // Don't use session token - this is used by internal scenarios which technically don't intend session read when they target - // request to specific replica. - useSessionToken.v = false; - return ReadMode.Primary; //Let the addressResolver decides which replica to connect to. - } - - switch (targetConsistencyLevel.v) { - case Eventual: - return ReadMode.Any; - - case ConsistentPrefix: - return ReadMode.Any; - - case Session: - return ReadMode.Any; - - case BoundedStaleness: - return ReadMode.BoundedStaleness; - - case Strong: - return ReadMode.Strong; - - default: - throw new IllegalStateException("Invalid Consistency Level " + targetConsistencyLevel.v); - } - } - - public int getMaxReplicaSetSize(RxDocumentServiceRequest entity) { - boolean isMasterResource = ReplicatedResourceClient.isReadingFromMaster(entity.getResourceType(), entity.getOperationType()); - if (isMasterResource) { - return this.serviceConfigReader.getSystemReplicationPolicy().getMaxReplicaSetSize(); - } else { - return this.serviceConfigReader.getUserReplicationPolicy().getMaxReplicaSetSize(); - } - } - - public int getMinReplicaSetSize(RxDocumentServiceRequest entity) { - boolean isMasterResource = ReplicatedResourceClient.isReadingFromMaster(entity.getResourceType(), entity.getOperationType()); - if (isMasterResource) { - return this.serviceConfigReader.getSystemReplicationPolicy().getMinReplicaSetSize(); - } else { - return this.serviceConfigReader.getUserReplicationPolicy().getMinReplicaSetSize(); - } - } - - StoreReader createStoreReader(TransportClient transportClient, - AddressSelector addressSelector, - ISessionContainer sessionContainer) { - return new StoreReader(transportClient, - addressSelector, - sessionContainer); - } - - QuorumReader createQuorumReader(TransportClient transportClient, - AddressSelector addressSelector, - StoreReader storeReader, - GatewayServiceConfigurationReader serviceConfigurationReader, - IAuthorizationTokenProvider authorizationTokenProvider) { - return new QuorumReader(transportClient, - addressSelector, - storeReader, - serviceConfigurationReader, - authorizationTokenProvider, - configs); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriter.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriter.java deleted file mode 100644 index 2710724723c0..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriter.java +++ /dev/null @@ -1,396 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.Integers; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.SessionTokenHelper; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.collections4.ComparatorUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; -import rx.schedulers.Schedulers; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; - -/* - * ConsistencyWriter has two modes for writing - local quorum-acked write and globally strong write. - * - * The determination of whether a request is a local quorum-acked write or a globally strong write is through several factors: - * 1. Request.RequestContext.OriginalRequestConsistencyLevel - ensure that original request's consistency level, if set, is strong. - * 2. Default consistency level of the accoutn should be strong. - * 3. Number of read regions returned by write response > 0. - * - * For quorum-acked write: - * We send single request to primary of a single partition, which will take care of replicating to its secondaries. Once write quorum number of replicas commits the write, the write request returns to the user with success. There is no additional handling for this case. - * - * For globally strong write: - * Similarly, we send single request to primary of write region, which will take care of replicating to its secondaries, one of which is XPPrimary. XPPrimary will then replicate to all remote regions, which will all ack from within their region. In the write region, the request returns from the backend once write quorum number of replicas commits the write - but at this time, the response cannot be returned to caller, since linearizability guarantees will be violated. ConsistencyWriter will continuously issue barrier head requests against the partition in question, until GlobalCommittedLsn is at least as big as the lsn of the original response. - * 1. Issue write request to write region - * 2. Receive response from primary of write region, look at GlobalCommittedLsn and LSN headers. - * 3. If GlobalCommittedLSN == LSN, return response to caller - * 4. If GlobalCommittedLSN < LSN, cache LSN in request as SelectedGlobalCommittedLSN, and issue barrier requests against any/all replicas. - * 5. Each barrier response will contain its own LSN and GlobalCommittedLSN, check for any response that satisfies GlobalCommittedLSN >= SelectedGlobalCommittedLSN - * 6. Return to caller on success. - */ -public class ConsistencyWriter { - private final static int MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES = 30; - private final static int DELAY_BETWEEN_WRITE_BARRIER_CALLS_IN_MS = 30; - private final static int MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION = 4; - private final static int SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION = 10; - - private final Logger logger = LoggerFactory.getLogger(ConsistencyWriter.class); - private final TransportClient transportClient; - private final AddressSelector addressSelector; - private final ISessionContainer sessionContainer; - private final IAuthorizationTokenProvider authorizationTokenProvider; - private final boolean useMultipleWriteLocations; - private final GatewayServiceConfigurationReader serviceConfigReader; - private final StoreReader storeReader; - - public ConsistencyWriter( - AddressSelector addressSelector, - ISessionContainer sessionContainer, - TransportClient transportClient, - IAuthorizationTokenProvider authorizationTokenProvider, - GatewayServiceConfigurationReader serviceConfigReader, - boolean useMultipleWriteLocations) { - this.transportClient = transportClient; - this.addressSelector = addressSelector; - this.sessionContainer = sessionContainer; - this.authorizationTokenProvider = authorizationTokenProvider; - this.useMultipleWriteLocations = useMultipleWriteLocations; - this.serviceConfigReader = serviceConfigReader; - this.storeReader = new StoreReader(transportClient, addressSelector, null /*we need store reader only for global strong, no session is needed*/); - } - - public Single writeAsync( - RxDocumentServiceRequest entity, - TimeoutHelper timeout, - boolean forceRefresh) { - - if (timeout.isElapsed()) { - return Single.error(new RequestTimeoutException()); - } - - String sessionToken = entity.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - - return this.writePrivateAsync(entity, timeout, forceRefresh).doOnEach( - arg -> { - try { - SessionTokenHelper.setOriginalSessionToken(entity, sessionToken); - } catch (Throwable throwable) { - logger.error("Unexpected failure in handling orig [{}]: new [{}]", arg, throwable.getMessage(), throwable); - } - } - ); - } - - Single writePrivateAsync( - RxDocumentServiceRequest request, - TimeoutHelper timeout, - boolean forceRefresh) { - if (timeout.isElapsed()) { - return Single.error(new RequestTimeoutException()); - } - - request.requestContext.timeoutHelper = timeout; - - if (request.requestContext.requestChargeTracker == null) { - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - } - - if (request.requestContext.clientSideRequestStatistics == null) { - request.requestContext.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - - request.requestContext.forceRefreshAddressCache = forceRefresh; - - if (request.requestContext.globalStrongWriteResponse == null) { - - Single> replicaAddressesObs = this.addressSelector.resolveAddressesAsync(request, forceRefresh); - AtomicReference primaryURI = new AtomicReference<>(); - - return replicaAddressesObs.flatMap(replicaAddresses -> { - try { - List contactedReplicas = new ArrayList<>(); - replicaAddresses.forEach(replicaAddress -> contactedReplicas.add(HttpUtils.toURI(replicaAddress.getPhysicalUri()))); - request.requestContext.clientSideRequestStatistics.setContactedReplicas(contactedReplicas); - return Single.just(AddressSelector.getPrimaryUri(request, replicaAddresses)); - } catch (GoneException e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Single.error(e); - } - }).flatMap(primaryUri -> { - try { - primaryURI.set(primaryUri); - if (this.useMultipleWriteLocations && - RequestHelper.GetConsistencyLevelToUse(this.serviceConfigReader, request) == ConsistencyLevel.Session) { - // Set session token to ensure session consistency for write requests - // when writes can be issued to multiple locations - SessionTokenHelper.setPartitionLocalSessionToken(request, this.sessionContainer); - } else { - // When writes can only go to single location, there is no reason - // to session session token to the server. - SessionTokenHelper.validateAndRemoveSessionToken(request); - } - - } catch (Exception e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Single.error(e); - } - - return this.transportClient.invokeResourceOperationAsync(primaryUri, request) - .doOnError( - t -> { - try { - DocumentClientException ex = Utils.as(t, DocumentClientException.class); - try { - request.requestContext.clientSideRequestStatistics.recordResponse(request, - storeReader.createStoreResult(null, ex, false, false, primaryUri)); - } catch (DocumentClientException e) { - logger.error("Error occurred while recording response", e); - } - String value = ex.getResponseHeaders().get(HttpConstants.HttpHeaders.WRITE_REQUEST_TRIGGER_ADDRESS_REFRESH); - if (!Strings.isNullOrWhiteSpace(value)) { - Integer result = Integers.tryParse(value); - if (result != null && result == 1) { - startBackgroundAddressRefresh(request); - } - } - } catch (Throwable throwable) { - logger.error("Unexpected failure in handling orig [{}]", t.getMessage(), t); - logger.error("Unexpected failure in handling orig [{}] : new [{}]", t.getMessage(), throwable.getMessage(), throwable); - } - } - ); - - }).flatMap(response -> { - try { - request.requestContext.clientSideRequestStatistics.recordResponse(request, - storeReader.createStoreResult(response, null, false, false, primaryURI.get())); - } catch (DocumentClientException e) { - logger.error("Error occurred while recording response", e); - } - return barrierForGlobalStrong(request, response); - }); - } else { - - Single barrierRequestObs = BarrierRequestHelper.createAsync(request, this.authorizationTokenProvider, null, request.requestContext.globalCommittedSelectedLSN); - return barrierRequestObs.flatMap(barrierRequest -> { - return waitForWriteBarrierAsync(barrierRequest, request.requestContext.globalCommittedSelectedLSN) - .flatMap(v -> { - - if (!v.booleanValue()) { - logger.warn("ConsistencyWriter: Write barrier has not been met for global strong request. SelectedGlobalCommittedLsn: {}", request.requestContext.globalCommittedSelectedLSN); - return Single.error(new GoneException(RMResources.GlobalStrongWriteBarrierNotMet)); - } - - return Single.just(request); - }); - }).map(req -> req.requestContext.globalStrongWriteResponse); - } - } - - boolean isGlobalStrongRequest(RxDocumentServiceRequest request, StoreResponse response) { - if (this.serviceConfigReader.getDefaultConsistencyLevel() == ConsistencyLevel.Strong) { - int numberOfReadRegions = -1; - String headerValue = null; - if ((headerValue = response.getHeaderValue(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS)) != null) { - numberOfReadRegions = Integer.parseInt(headerValue); - } - - if (numberOfReadRegions > 0 && this.serviceConfigReader.getDefaultConsistencyLevel() == ConsistencyLevel.Strong) { - return true; - } - } - - return false; - } - - Single barrierForGlobalStrong(RxDocumentServiceRequest request, StoreResponse response) { - try { - if (ReplicatedResourceClient.isGlobalStrongEnabled() && this.isGlobalStrongRequest(request, response)) { - Utils.ValueHolder lsn = Utils.ValueHolder.initialize(-1l); - Utils.ValueHolder globalCommittedLsn = Utils.ValueHolder.initialize(-1l); - - getLsnAndGlobalCommittedLsn(response, lsn, globalCommittedLsn); - if (lsn.v == -1 || globalCommittedLsn.v == -1) { - logger.error("ConsistencyWriter: lsn {} or GlobalCommittedLsn {} is not set for global strong request", - lsn, globalCommittedLsn); - throw new GoneException(RMResources.Gone); - } - - request.requestContext.globalStrongWriteResponse = response; - request.requestContext.globalCommittedSelectedLSN = lsn.v; - - //if necessary we would have already refreshed cache by now. - request.requestContext.forceRefreshAddressCache = false; - - logger.debug("ConsistencyWriter: globalCommittedLsn {}, lsn {}", globalCommittedLsn, lsn); - //barrier only if necessary, i.e. when write region completes write, but read regions have not. - - if (globalCommittedLsn.v < lsn.v) { - Single barrierRequestObs = BarrierRequestHelper.createAsync(request, - this.authorizationTokenProvider, - null, - request.requestContext.globalCommittedSelectedLSN); - - return barrierRequestObs.flatMap(barrierRequest -> { - Single barrierWait = this.waitForWriteBarrierAsync(barrierRequest, request.requestContext.globalCommittedSelectedLSN); - - return barrierWait.flatMap(res -> { - if (!res) { - logger.error("ConsistencyWriter: Write barrier has not been met for global strong request. SelectedGlobalCommittedLsn: {}", - request.requestContext.globalCommittedSelectedLSN); - // RxJava1 doesn't allow throwing checked exception - return Single.error(new GoneException(RMResources.GlobalStrongWriteBarrierNotMet)); - } - - return Single.just(request.requestContext.globalStrongWriteResponse); - }); - - }); - - } else { - return Single.just(request.requestContext.globalStrongWriteResponse); - } - } else { - return Single.just(response); - } - - } catch (DocumentClientException e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Single.error(e); - } - } - - private Single waitForWriteBarrierAsync(RxDocumentServiceRequest barrierRequest, long selectedGlobalCommittedLsn) { - AtomicInteger writeBarrierRetryCount = new AtomicInteger(ConsistencyWriter.MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES); - AtomicLong maxGlobalCommittedLsnReceived = new AtomicLong(0); - return Observable.defer(() -> { - if (barrierRequest.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new RequestTimeoutException()); - } - - Single> storeResultListObs = this.storeReader.readMultipleReplicaAsync( - barrierRequest, - true /*allowPrimary*/, - 1 /*any replica with correct globalCommittedLsn is good enough*/, - false /*requiresValidLsn*/, - false /*useSessionToken*/, - ReadMode.Strong, - false /*checkMinLsn*/, - false /*forceReadAll*/); - return storeResultListObs.flatMap( - responses -> { - if (responses != null && responses.stream().anyMatch(response -> response.globalCommittedLSN >= selectedGlobalCommittedLsn)) { - return Single.just(Boolean.TRUE); - } - - //get max global committed lsn from current batch of responses, then update if greater than max of all batches. - long maxGlobalCommittedLsn = (responses != null || !responses.isEmpty()) ? - (Long) responses.stream().map(s -> s.globalCommittedLSN).max(ComparatorUtils.NATURAL_COMPARATOR).get() : - 0l; - maxGlobalCommittedLsnReceived.set(maxGlobalCommittedLsnReceived.get() > maxGlobalCommittedLsn ? - maxGlobalCommittedLsnReceived.get() : maxGlobalCommittedLsn); - - //only refresh on first barrier call, set to false for subsequent attempts. - barrierRequest.requestContext.forceRefreshAddressCache = false; - - //trace on last retry. - if (writeBarrierRetryCount.getAndDecrement() == 0) { - logger.debug("ConsistencyWriter: WaitForWriteBarrierAsync - Last barrier multi-region strong. Responses: {}", - String.join("; ", responses.stream().map(r -> r.toString()).collect(Collectors.toList()))); - } - - return Single.just(null); - }).toObservable(); - }).repeatWhen(s -> { - if (writeBarrierRetryCount.get() == 0) { - return Observable.empty(); - } else { - - if ((ConsistencyWriter.MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES - writeBarrierRetryCount.get()) > ConsistencyWriter.MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION) { - return Observable.timer(ConsistencyWriter.DELAY_BETWEEN_WRITE_BARRIER_CALLS_IN_MS, TimeUnit.MILLISECONDS); - } else { - return Observable.timer(ConsistencyWriter.SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION, TimeUnit.MILLISECONDS); - } - } - }).take(1) - .map(r -> { - if (r == null) { - // after retries exhausted print this log and return false - logger.debug("ConsistencyWriter: Highest global committed lsn received for write barrier call is {}", maxGlobalCommittedLsnReceived); - - return false; - } - return r; - }).toSingle(); - } - - static void getLsnAndGlobalCommittedLsn(StoreResponse response, Utils.ValueHolder lsn, Utils.ValueHolder globalCommittedLsn) { - lsn.v = -1l; - globalCommittedLsn.v = -1l; - - String headerValue; - - if ((headerValue = response.getHeaderValue(WFConstants.BackendHeaders.LSN)) != null) { - lsn.v = Long.parseLong(headerValue); - } - - if ((headerValue = response.getHeaderValue(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN)) != null) { - globalCommittedLsn.v = Long.parseLong(headerValue); - } - } - - void startBackgroundAddressRefresh(RxDocumentServiceRequest request) { - this.addressSelector.resolvePrimaryUriAsync(request, true) - .observeOn(Schedulers.io()) - .subscribe( - r -> { - }, - e -> logger.warn( - "Background refresh of the primary address failed with {}", e.getMessage(), e) - ); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/CustomHeaders.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/CustomHeaders.java deleted file mode 100644 index 8f3f3f8e7d6b..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/CustomHeaders.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -public final class CustomHeaders { - - public static final class HttpHeaders { - // Specify whether to exclude system properties while storing the document - public static final String EXCLUDE_SYSTEM_PROPERTIES = "x-ms-exclude-system-properties"; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ErrorUtils.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ErrorUtils.java deleted file mode 100644 index 5fdca7819b13..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ErrorUtils.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; - -import java.net.URI; - -public class ErrorUtils { - private static final Logger logger = LoggerFactory.getLogger(TransportClient.class); - - protected static Single getErrorResponseAsync(HttpClientResponse responseMessage) { - - if (responseMessage.getContent() == null) { - return Single.just(StringUtils.EMPTY); - } - - return getErrorFromStream(responseMessage.getContent()); - } - - protected static Single getErrorFromStream(Observable stream) { - return ResponseUtils.toString(stream).toSingle(); - } - - protected static void logGoneException(URI physicalAddress, String activityId) { - logger.trace("Listener not found. Store Physical Address {} ActivityId {}", - physicalAddress, activityId); - } - - protected static void logGoneException(String physicalAddress, String activityId) { - logger.trace("Listener not found. Store Physical Address {} ActivityId {}", - physicalAddress, activityId); - } - - protected static void logException(URI physicalAddress, String activityId) { - logger.trace("Store Request Failed. Store Physical Address {} ActivityId {}", - physicalAddress, activityId); - } - - protected static void logException(String physicalAddress, String activityId) { - logger.trace("Store Request Failed. Store Physical Address {} ActivityId {}", - physicalAddress, activityId); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ForbiddenException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ForbiddenException.java deleted file mode 100644 index d74feb5b911a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ForbiddenException.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class ForbiddenException extends DocumentClientException { - public ForbiddenException() { - this(RMResources.Forbidden); - } - - public ForbiddenException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.FORBIDDEN, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public ForbiddenException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public ForbiddenException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public ForbiddenException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public ForbiddenException(Exception innerException) { - this(RMResources.Forbidden, innerException, null, null); - } - - public ForbiddenException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Forbidden, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.FORBIDDEN, - requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCache.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCache.java deleted file mode 100644 index 3e3053fa7841..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCache.java +++ /dev/null @@ -1,536 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.Paths; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.AuthorizationTokenType; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.caches.AsyncCache; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Completable; -import rx.Observable; -import rx.Single; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -public class GatewayAddressCache implements IAddressCache { - private final static Logger logger = LoggerFactory.getLogger(GatewayAddressCache.class); - private final static String protocolFilterFormat = "%s eq %s"; - private final static int DefaultBatchSize = 50; - - private final static int DefaultSuboptimalPartitionForceRefreshIntervalInSeconds = 600; - private final ServiceConfig serviceConfig = ServiceConfig.getInstance(); - - private final String databaseFeedEntryUrl = PathsHelper.generatePath(ResourceType.Database, "", true); - private final URL serviceEndpoint; - private final URL addressEndpoint; - - private final AsyncCache serverPartitionAddressCache; - private final ConcurrentHashMap suboptimalServerPartitionTimestamps; - private final long suboptimalPartitionForceRefreshIntervalInSeconds; - - private final String protocolScheme; - private final String protocolFilter; - private final IAuthorizationTokenProvider tokenProvider; - private final HashMap defaultRequestHeaders; - private final CompositeHttpClient httpClient; - - private volatile Pair masterPartitionAddressCache; - private volatile Instant suboptimalMasterPartitionTimestamp; - - public GatewayAddressCache( - URL serviceEndpoint, - Protocol protocol, - IAuthorizationTokenProvider tokenProvider, - UserAgentContainer userAgent, - CompositeHttpClient httpClient, - long suboptimalPartitionForceRefreshIntervalInSeconds) { - try { - this.addressEndpoint = new URL(serviceEndpoint, Paths.ADDRESS_PATH_SEGMENT); - } catch (MalformedURLException e) { - logger.error("serviceEndpoint {} is invalid", serviceEndpoint, e); - assert false; - throw new IllegalStateException(e); - } - this.tokenProvider = tokenProvider; - this.serviceEndpoint = serviceEndpoint; - this.serverPartitionAddressCache = new AsyncCache<>(); - this.suboptimalServerPartitionTimestamps = new ConcurrentHashMap<>(); - this.suboptimalMasterPartitionTimestamp = Instant.MAX; - - this.suboptimalPartitionForceRefreshIntervalInSeconds = suboptimalPartitionForceRefreshIntervalInSeconds; - - this.protocolScheme = protocol.scheme(); - this.protocolFilter = String.format(GatewayAddressCache.protocolFilterFormat, - Constants.Properties.PROTOCOL, - this.protocolScheme); - - this.httpClient = httpClient; - - if (userAgent == null) { - userAgent = new UserAgentContainer(); - } - - defaultRequestHeaders = new HashMap<>(); - defaultRequestHeaders.put(HttpConstants.HttpHeaders.USER_AGENT, userAgent.getUserAgent()); - - // Set requested API version header for version enforcement. - defaultRequestHeaders.put(HttpConstants.HttpHeaders.VERSION, HttpConstants.Versions.CURRENT_VERSION); - } - - public GatewayAddressCache( - URL serviceEndpoint, - Protocol protocol, - IAuthorizationTokenProvider tokenProvider, - UserAgentContainer userAgent, - CompositeHttpClient httpClient) { - this(serviceEndpoint, - protocol, - tokenProvider, - userAgent, - httpClient, - DefaultSuboptimalPartitionForceRefreshIntervalInSeconds); - } - - private URL getServiceEndpoint() { - return this.serviceEndpoint; - } - - @Override - public Single tryGetAddresses(RxDocumentServiceRequest request, - PartitionKeyRangeIdentity partitionKeyRangeIdentity, - boolean forceRefreshPartitionAddresses) { - - com.microsoft.azure.cosmosdb.rx.internal.Utils.checkNotNullOrThrow(request, "request", ""); - com.microsoft.azure.cosmosdb.rx.internal.Utils.checkNotNullOrThrow(partitionKeyRangeIdentity, "partitionKeyRangeIdentity", ""); - - if (StringUtils.equals(partitionKeyRangeIdentity.getPartitionKeyRangeId(), - PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID)) { - - // if that's master partition return master partition address! - return this.resolveMasterAsync(request, forceRefreshPartitionAddresses, request.properties).map(r -> r.getRight()); - } - - Instant suboptimalServerPartitionTimestamp = this.suboptimalServerPartitionTimestamps.get(partitionKeyRangeIdentity); - - if (suboptimalServerPartitionTimestamp != null) { - boolean forceRefreshDueToSuboptimalPartitionReplicaSet = Duration.between(suboptimalServerPartitionTimestamp, Instant.now()).getSeconds() - > this.suboptimalPartitionForceRefreshIntervalInSeconds; - - if (forceRefreshDueToSuboptimalPartitionReplicaSet) { - // Compares the existing value for the specified key with a specified value, - // and if they are equal, updates the key with a third value. - Instant newValue = this.suboptimalServerPartitionTimestamps.computeIfPresent(partitionKeyRangeIdentity, - (key, oldVal) -> { - if (suboptimalServerPartitionTimestamp.equals(oldVal)) { - return Instant.MAX; - } else { - return oldVal; - } - }); - - if (!newValue.equals(suboptimalServerPartitionTimestamp)) { - // the value was replaced; - forceRefreshPartitionAddresses = true; - } - } - } - - final boolean forceRefreshPartitionAddressesModified = forceRefreshPartitionAddresses; - - if (forceRefreshPartitionAddressesModified) { - this.serverPartitionAddressCache.refresh( - partitionKeyRangeIdentity, - () -> this.getAddressesForRangeId( - request, - partitionKeyRangeIdentity.getCollectionRid(), - partitionKeyRangeIdentity.getPartitionKeyRangeId(), - true)); - - this.suboptimalServerPartitionTimestamps.remove(partitionKeyRangeIdentity); - } - - Single addressesObs = this.serverPartitionAddressCache.getAsync( - partitionKeyRangeIdentity, - null, - () -> this.getAddressesForRangeId( - request, - partitionKeyRangeIdentity.getCollectionRid(), - partitionKeyRangeIdentity.getPartitionKeyRangeId(), - false)); - - return addressesObs.map( - addresses -> { - if (notAllReplicasAvailable(addresses)) { - this.suboptimalServerPartitionTimestamps.putIfAbsent(partitionKeyRangeIdentity, Instant.now()); - } - - return addresses; - }).onErrorResumeNext(ex -> { - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(ex, DocumentClientException.class); - if (dce == null) { - if (forceRefreshPartitionAddressesModified) { - this.suboptimalServerPartitionTimestamps.remove(partitionKeyRangeIdentity); - } - return Single.error(ex); - } else { - assert dce != null; - if (Exceptions.isStatusCode(dce, HttpConstants.StatusCodes.NOTFOUND) || - Exceptions.isStatusCode(dce, HttpConstants.StatusCodes.GONE) || - Exceptions.isSubStatusCode(dce, HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE)) { - //remove from suboptimal cache in case the collection+pKeyRangeId combo is gone. - this.suboptimalServerPartitionTimestamps.remove(partitionKeyRangeIdentity); - return null; - } - return Single.error(ex); - } - - }); - } - - Single> getServerAddressesViaGatewayAsync( - RxDocumentServiceRequest request, - String collectionRid, - List partitionKeyRangeIds, - boolean forceRefresh) { - String entryUrl = PathsHelper.generatePath(ResourceType.Document, collectionRid, true); - HashMap addressQuery = new HashMap<>(); - - addressQuery.put(HttpConstants.QueryStrings.URL, HttpUtils.urlEncode(entryUrl)); - - HashMap headers = new HashMap<>(defaultRequestHeaders); - if (forceRefresh) { - headers.put(HttpConstants.HttpHeaders.FORCE_REFRESH, Boolean.TRUE.toString()); - } - - addressQuery.put(HttpConstants.QueryStrings.FILTER, HttpUtils.urlEncode(this.protocolFilter)); - - addressQuery.put(HttpConstants.QueryStrings.PARTITION_KEY_RANGE_IDS, String.join(",", partitionKeyRangeIds)); - headers.put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - String token = null; - - token = this.tokenProvider.getUserAuthorizationToken( - collectionRid, - ResourceType.Document, - HttpConstants.HttpMethods.GET, - headers, - AuthorizationTokenType.PrimaryMasterKey, - request.properties); - - if (token == null && request.getIsNameBased()) { - // User doesn't have rid based resource token. Maybe user has name based. - String collectionAltLink = PathsHelper.getCollectionPath(request.getResourceAddress()); - token = this.tokenProvider.getUserAuthorizationToken( - collectionAltLink, - ResourceType.Document, - HttpConstants.HttpMethods.GET, - headers, - AuthorizationTokenType.PrimaryMasterKey, - request.properties); - } - - token = HttpUtils.urlEncode(token); - headers.put(HttpConstants.HttpHeaders.AUTHORIZATION, token); - URL targetEndpoint = Utils.setQuery(this.addressEndpoint.toString(), Utils.createQuery(addressQuery)); - String identifier = logAddressResolutionStart(request, targetEndpoint); - HttpClientRequest httpGet = HttpClientRequest.createGet(targetEndpoint.toString()); - - for (Map.Entry entry : headers.entrySet()) { - httpGet.withHeader(entry.getKey(), entry.getValue()); - } - - RxClient.ServerInfo serverInfo = new RxClient.ServerInfo(targetEndpoint.getHost(), targetEndpoint.getPort()); - Observable> responseObs = this.httpClient.submit(serverInfo, httpGet); - - Single dsrObs = responseObs.toSingle().flatMap(rsp -> - HttpClientUtils.parseResponseAsync(rsp)); - return dsrObs.map( - dsr -> { - logAddressResolutionEnd(request, identifier); - List

addresses = dsr.getQueryResponse(Address.class); - return addresses; - }); - } - - public void dispose() { - // TODO We will implement this in future once we will move to httpClient to CompositeHttpClient - //https://msdata.visualstudio.com/CosmosDB/_workitems/edit/340842 - } - - private Single> resolveMasterAsync(RxDocumentServiceRequest request, boolean forceRefresh, Map properties) { - Pair masterAddressAndRangeInitial = this.masterPartitionAddressCache; - - forceRefresh = forceRefresh || - (masterAddressAndRangeInitial != null && - notAllReplicasAvailable(masterAddressAndRangeInitial.getRight()) && - Duration.between(this.suboptimalMasterPartitionTimestamp, Instant.now()).getSeconds() > this.suboptimalPartitionForceRefreshIntervalInSeconds); - - if (forceRefresh || this.masterPartitionAddressCache == null) { - Single> masterReplicaAddressesObs = this.getMasterAddressesViaGatewayAsync( - request, - ResourceType.Database, - null, - databaseFeedEntryUrl, - forceRefresh, - false, - properties); - - return masterReplicaAddressesObs.map( - masterAddresses -> { - Pair masterAddressAndRangeRes = - this.toPartitionAddressAndRange("", masterAddresses); - this.masterPartitionAddressCache = masterAddressAndRangeRes; - - if (notAllReplicasAvailable(masterAddressAndRangeRes.getRight()) - && this.suboptimalMasterPartitionTimestamp.equals(Instant.MAX)) { - this.suboptimalMasterPartitionTimestamp = Instant.now(); - } else { - this.suboptimalMasterPartitionTimestamp = Instant.MAX; - } - - return masterPartitionAddressCache; - }) - .doOnError( - e -> { - this.suboptimalMasterPartitionTimestamp = Instant.MAX; - }); - } else { - if (notAllReplicasAvailable(masterAddressAndRangeInitial.getRight()) - && this.suboptimalMasterPartitionTimestamp.equals(Instant.MAX)) { - this.suboptimalMasterPartitionTimestamp = Instant.now(); - } - - return Single.just(masterAddressAndRangeInitial); - } - } - - private Single getAddressesForRangeId( - RxDocumentServiceRequest request, - String collectionRid, - String partitionKeyRangeId, - boolean forceRefresh) { - Single> addressResponse = this.getServerAddressesViaGatewayAsync(request, collectionRid, Collections.singletonList(partitionKeyRangeId), forceRefresh); - - Single>> addressInfos = - addressResponse.map( - addresses -> - addresses.stream().filter(addressInfo -> - this.protocolScheme.equals(addressInfo.getProtocolScheme())) - .collect(Collectors.groupingBy( - address -> address.getParitionKeyRangeId())) - .values().stream() - .map(groupedAddresses -> toPartitionAddressAndRange(collectionRid, addresses)) - .collect(Collectors.toList())); - - Single>> result = addressInfos.map(addressInfo -> addressInfo.stream() - .filter(a -> - StringUtils.equals(a.getLeft().getPartitionKeyRangeId(), partitionKeyRangeId)) - .collect(Collectors.toList())); - - return result.flatMap( - list -> { - if (list.isEmpty()) { - - String errorMessage = String.format( - RMResources.PartitionKeyRangeNotFound, - partitionKeyRangeId, - collectionRid); - - PartitionKeyRangeGoneException e = new PartitionKeyRangeGoneException(errorMessage); - BridgeInternal.setResourceAddress(e, collectionRid); - - return Single.error(e); - } else { - return Single.just(list.get(0).getRight()); - } - }); - } - - Single> getMasterAddressesViaGatewayAsync( - RxDocumentServiceRequest request, - ResourceType resourceType, - String resourceAddress, - String entryUrl, - boolean forceRefresh, - boolean useMasterCollectionResolver, - Map properties) { - HashMap queryParameters = new HashMap<>(); - queryParameters.put(HttpConstants.QueryStrings.URL, HttpUtils.urlEncode(entryUrl)); - HashMap headers = new HashMap<>(defaultRequestHeaders); - - if (forceRefresh) { - headers.put(HttpConstants.HttpHeaders.FORCE_REFRESH, Boolean.TRUE.toString()); - } - - if (useMasterCollectionResolver) { - headers.put(HttpConstants.HttpHeaders.USE_MASTER_COLLECTION_RESOLVER, Boolean.TRUE.toString()); - } - - queryParameters.put(HttpConstants.QueryStrings.FILTER, HttpUtils.urlEncode(this.protocolFilter)); - headers.put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - String token = this.tokenProvider.getUserAuthorizationToken( - resourceAddress, - resourceType, - HttpConstants.HttpMethods.GET, - headers, - AuthorizationTokenType.PrimaryMasterKey, - properties); - - headers.put(HttpConstants.HttpHeaders.AUTHORIZATION, HttpUtils.urlEncode(token)); - URL targetEndpoint = Utils.setQuery(this.addressEndpoint.toString(), Utils.createQuery(queryParameters)); - String identifier = logAddressResolutionStart(request, targetEndpoint); - HttpClientRequest httpGet = HttpClientRequest.createGet(targetEndpoint.toString()); - - for (Map.Entry entry : headers.entrySet()) { - httpGet.withHeader(entry.getKey(), entry.getValue()); - } - - RxClient.ServerInfo serverInfo = new RxClient.ServerInfo(targetEndpoint.getHost(), targetEndpoint.getPort()); - Observable> responseObs = this.httpClient.submit(serverInfo, httpGet); - - Single dsrObs = responseObs.toSingle().flatMap(rsp -> - HttpClientUtils.parseResponseAsync(rsp)); - return dsrObs.map( - dsr -> { - logAddressResolutionEnd(request, identifier); - List
addresses = dsr.getQueryResponse(Address.class); - return addresses; - }); - } - - private Pair toPartitionAddressAndRange(String collectionRid, List
addresses) { - Address address = addresses.get(0); - - AddressInformation[] addressInfos = - addresses.stream().map(addr -> - GatewayAddressCache.toAddressInformation(addr) - ).collect(Collectors.toList()).toArray(new AddressInformation[addresses.size()]); - return Pair.of(new PartitionKeyRangeIdentity(collectionRid, address.getParitionKeyRangeId()), addressInfos); - } - - private static AddressInformation toAddressInformation(Address address) { - return new AddressInformation(true, address.IsPrimary(), address.getPhyicalUri(), address.getProtocolScheme()); - } - - public Completable openAsync( - DocumentCollection collection, - List partitionKeyRangeIdentities) { - List>> tasks = new ArrayList<>(); - int batchSize = GatewayAddressCache.DefaultBatchSize; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create( - OperationType.Read, - // collection.AltLink, - collection.getResourceId(), - ResourceType.DocumentCollection, - // AuthorizationTokenType.PrimaryMasterKey - Collections.EMPTY_MAP); - for (int i = 0; i < partitionKeyRangeIdentities.size(); i += batchSize) { - - int endIndex = i + batchSize; - endIndex = endIndex < partitionKeyRangeIdentities.size() - ? endIndex : partitionKeyRangeIdentities.size(); - - tasks.add(this.getServerAddressesViaGatewayAsync( - request, - collection.getResourceId(), - - partitionKeyRangeIdentities.subList(i, endIndex). - stream().map(range -> range.getPartitionKeyRangeId()).collect(Collectors.toList()), - false).toObservable()); - } - - return Observable.concat(tasks) - .doOnNext(list -> { - List> addressInfos = list.stream() - .filter(addressInfo -> this.protocolScheme.equals(addressInfo.getProtocolScheme())) - .collect(Collectors.groupingBy(address -> address.getParitionKeyRangeId())) - .entrySet().stream().map(group -> toPartitionAddressAndRange(collection.getResourceId(), group.getValue())) - .collect(Collectors.toList()); - - for (Pair addressInfo : addressInfos) { - this.serverPartitionAddressCache.set( - new PartitionKeyRangeIdentity(collection.getResourceId(), addressInfo.getLeft().getPartitionKeyRangeId()), - addressInfo.getRight()); - } - }).toCompletable(); - } - - private boolean notAllReplicasAvailable(AddressInformation[] addressInformations) { - return addressInformations.length < this.serviceConfig.userReplicationPolicy.MaxReplicaSetSize; - } - - private static String logAddressResolutionStart(RxDocumentServiceRequest request, URL targetEndpointUrl) { - try { - if (request.requestContext.clientSideRequestStatistics != null) { - return request.requestContext.clientSideRequestStatistics.recordAddressResolutionStart(targetEndpointUrl.toURI()); - } - } catch (URISyntaxException e) { - throw new IllegalArgumentException(e); - } - return null; - } - - private static void logAddressResolutionEnd(RxDocumentServiceRequest request, String identifier) { - if (request.requestContext.clientSideRequestStatistics != null) { - request.requestContext.clientSideRequestStatistics.recordAddressResolutionEnd(identifier); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReader.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReader.java deleted file mode 100644 index 8ce4417065d6..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReader.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.ReplicationPolicy; -import com.microsoft.azure.cosmosdb.internal.BaseAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.GlobalEndpointManager; - -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.http.HttpMethod; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import rx.Observable; -import rx.Single; -import rx.functions.Action1; - -/** - * This class will read the service configuration from the gateway. - * - * As .Net does code sharing between the SDK and GW there are two implementation to IServiceConfigurationReader - * GatewayServiceConfigurationReader which is for SDK - * DatabaseAccountConfigurationReader which is for GW - * Some of the APIs are not relevant in SDK and due to that in .Net the SDK implementation one throws not-implemented. - * - * In java, as we don't do code sharing - * and we got rid of the interface which is not needed and only implemented the methods in GatewayServiceConfigurationReader - */ -public class GatewayServiceConfigurationReader { - - public static final String GATEWAY_READER_NOT_INITIALIZED = "GatewayServiceConfigurationReader has not been initialized"; - - public ReplicationPolicy userReplicationPolicy; - private ReplicationPolicy systemReplicationPolicy; - private ConsistencyLevel consistencyLevel; - private volatile boolean initialized; - private URI serviceEndpoint; - private final ConnectionPolicy connectionPolicy; - private Map queryEngineConfiguration; - private final BaseAuthorizationTokenProvider baseAuthorizationTokenProvider; - private final boolean hasAuthKeyResourceToken; - private final String authKeyResourceToken; - private CompositeHttpClient httpClient; - - public GatewayServiceConfigurationReader(URI serviceEndpoint, boolean hasResourceToken, String resourceToken, - ConnectionPolicy connectionPolicy, BaseAuthorizationTokenProvider baseAuthorizationTokenProvider, - CompositeHttpClient httpClient) { - this.serviceEndpoint = serviceEndpoint; - this.baseAuthorizationTokenProvider = baseAuthorizationTokenProvider; - this.hasAuthKeyResourceToken = hasResourceToken; - this.authKeyResourceToken = resourceToken; - this.connectionPolicy = connectionPolicy; - this.httpClient = httpClient; - } - - public ReplicationPolicy getUserReplicationPolicy() { - this.throwIfNotInitialized(); - return this.userReplicationPolicy; - } - - public ReplicationPolicy getSystemReplicationPolicy() { - this.throwIfNotInitialized(); - return this.systemReplicationPolicy; - } - - public boolean enableAuthorization() { - return true; - } - - public ConsistencyLevel getDefaultConsistencyLevel() { - this.throwIfNotInitialized(); - return this.consistencyLevel; - } - - public void setDefaultConsistencyLevel(ConsistencyLevel value) { - this.throwIfNotInitialized(); - this.consistencyLevel = value; - } - - public Map getQueryEngineConfiguration() { - this.throwIfNotInitialized(); - return this.queryEngineConfiguration; - } - - private Single getDatabaseAccountAsync(URI serviceEndpoint) { - HttpClientRequest httpRequest = HttpClientRequest.create(HttpMethod.GET, - this.serviceEndpoint.toString()); - - httpRequest.withHeader(HttpConstants.HttpHeaders.VERSION, HttpConstants.Versions.CURRENT_VERSION); - - UserAgentContainer userAgentContainer = new UserAgentContainer(); - String userAgentSuffix = this.connectionPolicy.getUserAgentSuffix(); - if (userAgentSuffix != null && userAgentSuffix.length() > 0) { - userAgentContainer.setSuffix(userAgentSuffix); - } - - httpRequest.withHeader(HttpConstants.HttpHeaders.USER_AGENT, userAgentContainer.getUserAgent()); - httpRequest.withHeader(HttpConstants.HttpHeaders.API_TYPE, Constants.Properties.SQL_API_TYPE); - String authorizationToken = StringUtils.EMPTY; - if (this.hasAuthKeyResourceToken || baseAuthorizationTokenProvider == null) { - authorizationToken = HttpUtils.urlEncode(this.authKeyResourceToken); - } else { - // Retrieve the document service properties. - String xDate = Utils.nowAsRFC1123(); - httpRequest.withHeader(HttpConstants.HttpHeaders.X_DATE, xDate); - Map header = new HashMap<>(); - header.put(HttpConstants.HttpHeaders.X_DATE, xDate); - authorizationToken = baseAuthorizationTokenProvider - .generateKeyAuthorizationSignature(HttpConstants.HttpMethods.GET, serviceEndpoint, header); - } - - httpRequest.withHeader(HttpConstants.HttpHeaders.AUTHORIZATION, authorizationToken); - RxClient.ServerInfo serverInfo = new RxClient.ServerInfo(serviceEndpoint.getHost(), serviceEndpoint.getPort()); - - Observable> clientResponseObservable = this.httpClient.submit(serverInfo, - httpRequest); - return toDatabaseAccountObservable(clientResponseObservable.toSingle()); - } - - public Single initializeReaderAsync() { - try { - return GlobalEndpointManager.getDatabaseAccountFromAnyLocationsAsync(this.serviceEndpoint.toURL(), - - new ArrayList<>(this.connectionPolicy.getPreferredLocations()), url -> { - try { - return getDatabaseAccountAsync(url.toURI()); - } catch (URISyntaxException e) { - throw new IllegalArgumentException("URI " + url); - } - }).doOnSuccess(new Action1() { - - @Override - public void call(DatabaseAccount databaseAccount) { - userReplicationPolicy = BridgeInternal.getReplicationPolicy(databaseAccount); - systemReplicationPolicy = BridgeInternal.getSystemReplicationPolicy(databaseAccount); - queryEngineConfiguration = BridgeInternal.getQueryEngineConfiuration(databaseAccount); - consistencyLevel = BridgeInternal.getConsistencyPolicy(databaseAccount).getDefaultConsistencyLevel(); - initialized = true; - } - }); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(this.serviceEndpoint.toString(), e); - } - } - - private Single toDatabaseAccountObservable( - Single> clientResponseObservable) { - return clientResponseObservable.flatMap(clientResponse -> { - return HttpClientUtils.parseResponseAsync(clientResponse) - .map(rxDocumentServiceResponse -> rxDocumentServiceResponse.getResource(DatabaseAccount.class)); - }); - } - - private void throwIfNotInitialized() { - if (!this.initialized) { - throw new IllegalArgumentException(GATEWAY_READER_NOT_INITIALIZED); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicy.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicy.java deleted file mode 100644 index 3f519231d16f..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicy.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.time.Duration; - -import org.apache.commons.lang3.time.StopWatch; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.Quadruple; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Single; - -public class GoneAndRetryWithRetryPolicy implements IRetryPolicy { - - private final static Logger logger = LoggerFactory.getLogger(GoneAndRetryWithRetryPolicy.class); - private final static int DEFAULT_WAIT_TIME_IN_SECONDS = 30; - private final static int MAXIMUM_BACKOFF_TIME_IN_SECONDS = 15; - private final static int INITIAL_BACKOFF_TIME = 1; - private final static int BACK_OFF_MULTIPLIER = 2; - - private final RxDocumentServiceRequest request; - private volatile int attemptCount = 1; - private volatile int attemptCountInvalidPartition = 1; - private volatile int currentBackoffSeconds = GoneAndRetryWithRetryPolicy.INITIAL_BACKOFF_TIME; - private volatile RetryWithException lastRetryWithException; - private final StopWatch durationTimer = new StopWatch(); - private final int waitTimeInSeconds; - //TODO once this is moved to IRetryPolicy, remove from here. - public static Quadruple INITIAL_ARGUMENT_VALUE_POLICY_ARG = Quadruple.with(false, false, - Duration.ofSeconds(60), 0); - - public GoneAndRetryWithRetryPolicy(RxDocumentServiceRequest request, Integer waitTimeInSeconds) { - this.request = request; - startStopWatch(this.durationTimer); - if (waitTimeInSeconds != null) { - this.waitTimeInSeconds = waitTimeInSeconds; - } else { - this.waitTimeInSeconds = DEFAULT_WAIT_TIME_IN_SECONDS; - } - } - - @Override - public Single shouldRetry(Exception exception) { - DocumentClientException exceptionToThrow = null; - Duration backoffTime = Duration.ofSeconds(0); - Duration timeout = Duration.ofSeconds(0); - boolean forceRefreshAddressCache = false; - if (!(exception instanceof GoneException) && - !(exception instanceof RetryWithException) && - !(exception instanceof PartitionIsMigratingException) && - !(exception instanceof InvalidPartitionException && - (this.request.getPartitionKeyRangeIdentity() == null || - this.request.getPartitionKeyRangeIdentity().getCollectionRid() == null)) && - !(exception instanceof PartitionKeyRangeIsSplittingException)) { - logger.debug("Operation will NOT be retried. Current attempt {}, Exception: {} ", this.attemptCount, - exception); - stopStopWatch(this.durationTimer); - return Single.just(ShouldRetryResult.noRetry()); - } else if (exception instanceof RetryWithException) { - this.lastRetryWithException = (RetryWithException) exception; - } - long remainingSeconds = this.waitTimeInSeconds - this.durationTimer.getTime() / 1000; - int currentRetryAttemptCount = this.attemptCount; - if (this.attemptCount++ > 1) { - if (remainingSeconds <= 0) { - if (exception instanceof GoneException) { - if (this.lastRetryWithException != null) { - logger.warn( - "Received gone exception after backoff/retry including at least one RetryWithException. " - + "Will fail the request with RetryWithException. GoneException: {}. RetryWithException: {}", - exception, this.lastRetryWithException); - exceptionToThrow = this.lastRetryWithException; - } else { - logger.warn("Received gone exception after backoff/retry. Will fail the request. {}", - exception.toString()); - exceptionToThrow = new DocumentClientException(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE, - exception); - } - - } else if (exception instanceof PartitionKeyRangeGoneException) { - if (this.lastRetryWithException != null) { - logger.warn( - "Received partition key range gone exception after backoff/retry including at least one RetryWithException." - + "Will fail the request with RetryWithException. GoneException: {}. RetryWithException: {}", - exception, this.lastRetryWithException); - exceptionToThrow = this.lastRetryWithException; - } else { - logger.warn( - "Received partition key range gone exception after backoff/retry. Will fail the request. {}", - exception.toString()); - exceptionToThrow = new DocumentClientException(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE, - exception); - } - } else if (exception instanceof InvalidPartitionException) { - if (this.lastRetryWithException != null) { - logger.warn( - "Received InvalidPartitionException after backoff/retry including at least one RetryWithException. " - + "Will fail the request with RetryWithException. InvalidPartitionException: {}. RetryWithException: {}", - exception, this.lastRetryWithException); - } else { - logger.warn( - "Received invalid collection partition exception after backoff/retry. Will fail the request. {}", - exception.toString()); - exceptionToThrow = new DocumentClientException(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE, - exception); - } - } else { - logger.warn("Received retrywith exception after backoff/retry. Will fail the request. {}", - exception.toString()); - } - stopStopWatch(this.durationTimer); - return Single.just(ShouldRetryResult.error(exceptionToThrow)); - } - backoffTime = Duration.ofSeconds(Math.min(Math.min(this.currentBackoffSeconds, remainingSeconds), - GoneAndRetryWithRetryPolicy.MAXIMUM_BACKOFF_TIME_IN_SECONDS)); - this.currentBackoffSeconds *= GoneAndRetryWithRetryPolicy.BACK_OFF_MULTIPLIER; - logger.info("BackoffTime: {} seconds.", backoffTime.getSeconds()); - } - - // Calculate the remaining time based after accounting for the backoff that we - // will perform - long timeoutInMillSec = remainingSeconds*1000 - backoffTime.toMillis(); - timeout = timeoutInMillSec > 0 ? Duration.ofMillis(timeoutInMillSec) - : Duration.ofSeconds(GoneAndRetryWithRetryPolicy.MAXIMUM_BACKOFF_TIME_IN_SECONDS); - if (exception instanceof GoneException) { - logger.warn("Received gone exception, will retry, {}", exception.toString()); - forceRefreshAddressCache = true; // indicate we are in retry. - } else if (exception instanceof PartitionIsMigratingException) { - logger.warn("Received PartitionIsMigratingException, will retry, {}", exception.toString()); - this.request.forceCollectionRoutingMapRefresh = true; - forceRefreshAddressCache = true; - } else if (exception instanceof InvalidPartitionException) { - this.request.requestContext.quorumSelectedLSN = -1; - this.request.requestContext.resolvedPartitionKeyRange = null; - this.request.requestContext.quorumSelectedStoreResponse = null; - this.request.requestContext.globalCommittedSelectedLSN = -1; - if (this.attemptCountInvalidPartition++ > 2) { - // for second InvalidPartitionException, stop retrying. - logger.warn("Received second InvalidPartitionException after backoff/retry. Will fail the request. {}", - exception.toString()); - return Single.just(ShouldRetryResult - .error(new DocumentClientException(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE, exception))); - } - - if (this.request != null) { - logger.warn("Received invalid collection exception, will retry, {}", exception.toString()); - this.request.forceNameCacheRefresh = true; - } else { - logger.error("Received unexpected invalid collection exception, request should be non-null.", - exception); - return Single.just(ShouldRetryResult - .error(new DocumentClientException(HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, exception))); - } - forceRefreshAddressCache = false; - } else if (exception instanceof PartitionKeyRangeIsSplittingException) { - this.request.requestContext.resolvedPartitionKeyRange = null; - this.request.requestContext.quorumSelectedLSN = -1; - this.request.requestContext.quorumSelectedStoreResponse = null; - logger.info("Received partition key range splitting exception, will retry, {}", exception.toString()); - this.request.forcePartitionKeyRangeRefresh = true; - forceRefreshAddressCache = false; - } else { - logger.warn("Received retrywith exception, will retry, {}", exception); - // For RetryWithException, prevent the caller - // from refreshing any caches. - forceRefreshAddressCache = false; - } - return Single.just(ShouldRetryResult.retryAfter(backoffTime, - Quadruple.with(forceRefreshAddressCache, true, timeout, currentRetryAttemptCount))); - } - - private void stopStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.stop(); - } - } - - private void startStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.start(); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUtils.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUtils.java deleted file mode 100644 index 29e329d17cbd..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import rx.Single; - -public class HttpClientUtils { - - public static Single parseResponseAsync(HttpClientResponse responseMessage) { - - if (responseMessage.getStatus().code() < HttpConstants.StatusCodes.MINIMUM_STATUSCODE_AS_ERROR_GATEWAY) { - - Single storeResponse = ResponseUtils.toStoreResponse(responseMessage); - return storeResponse.map(sr -> new RxDocumentServiceResponse(sr)); - - // TODO: to break the dependency between RxDocumentServiceResponse and StoreResponse - // we should factor out the RxDocumentServiceResponse(StoreResponse) constructor to a helper class - - } else { - return HttpClientUtils.createDocumentClientException(responseMessage).flatMap(e -> Single.error(e)); - } - } - - private static Single createDocumentClientException(HttpClientResponse responseMessage) { - Single readStream = ResponseUtils.toString(responseMessage.getContent()).toSingle(); - - return readStream.map(body -> { - Error error = new Error(body); - - // TODO: we should set resource address in the Document Client Exception - - return new DocumentClientException(responseMessage.getStatus().code(), error, - HttpUtils.asMap(responseMessage.getHeaders())); - }); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClient.java deleted file mode 100644 index 5e7a354480c5..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClient.java +++ /dev/null @@ -1,986 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.Integers; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.Lists; -import com.microsoft.azure.cosmosdb.internal.Longs; -import com.microsoft.azure.cosmosdb.internal.MutableVolatile; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.RuntimeConstants; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.HttpClientFactory; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.http.HttpMethod; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpRequestHeaders; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -import java.net.URI; -import java.time.Instant; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static com.microsoft.azure.cosmosdb.internal.Utils.trimBeginningAndEndingSlashes; -/* - * The following code only support Document Write without any error handling support. - */ -public class HttpTransportClient extends TransportClient { - private final Logger logger = LoggerFactory.getLogger(HttpTransportClient.class); - private final CompositeHttpClient httpClient; - private final Map defaultHeaders; - private final Configs configs; - - CompositeHttpClient createHttpClient(int requestTimeout) { - // TODO: use one instance of SSL context everywhere - HttpClientFactory httpClientFactory = new HttpClientFactory(this.configs); - httpClientFactory.withRequestTimeoutInMillis(requestTimeout * 1000); - httpClientFactory.withPoolSize(configs.getDirectHttpsMaxConnectionLimit()); - - return httpClientFactory.toHttpClientBuilder().build(); - } - - public HttpTransportClient(Configs configs, int requestTimeout, UserAgentContainer userAgent) { - this.configs = configs; - this.httpClient = createHttpClient(requestTimeout); - - this.defaultHeaders = new HashMap<>(); - - // Set requested API version header for version enforcement. - this.defaultHeaders.put(HttpConstants.HttpHeaders.VERSION, HttpConstants.Versions.CURRENT_VERSION); - this.defaultHeaders.put(HttpConstants.HttpHeaders.CACHE_CONTROL, HttpConstants.HeaderValues.NoCache); - - if (userAgent == null) { - userAgent = new UserAgentContainer(); - } - - this.defaultHeaders.put(HttpConstants.HttpHeaders.USER_AGENT, userAgent.getUserAgent()); - this.defaultHeaders.put(HttpConstants.HttpHeaders.ACCEPT, RuntimeConstants.MediaTypes.JSON); - } - - @Override - public void close() { - httpClient.shutdown(); - } - - public Single invokeStoreAsync( - URI physicalAddress, - ResourceOperation resourceOperation, - RxDocumentServiceRequest request) { - - try { - - // uuid correlation manager - UUID activityId = UUID.fromString(request.getActivityId()); - - if (resourceOperation.operationType == OperationType.Recreate) { - Map errorResponseHeaders = new HashMap<>(); - errorResponseHeaders.put(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "1"); - - logger.error("Received Recreate request on Http client"); - throw new InternalServerErrorException(RMResources.InternalServerError, null, errorResponseHeaders, null); - } - - HttpClientRequest httpRequest = prepareHttpMessage(activityId, physicalAddress, resourceOperation, request); - RxClient.ServerInfo serverInfo = new RxClient.ServerInfo(physicalAddress.getHost(), physicalAddress.getPort()); - - MutableVolatile sendTimeUtc = new MutableVolatile<>(); - - Single> responseMessage = this.httpClient.submit(serverInfo, httpRequest).toSingle(); - responseMessage = responseMessage.doOnSubscribe(() -> { - sendTimeUtc.v = Instant.now(); - this.beforeRequest( - activityId, - httpRequest.getUri(), - request.getResourceType(), - httpRequest.getHeaders()); - }); - - responseMessage = responseMessage.onErrorResumeNext(t -> { - - Exception exception = Utils.as(t, Exception.class); - if (exception == null) { - logger.error("critical failure", t); - t.printStackTrace(); - assert false : "critical failure"; - return Single.error(t); - } - - //Trace.CorrelationManager.ActivityId = activityId; - if (WebExceptionUtility.isWebExceptionRetriable(exception)) { - logger.debug("Received retriable exception {} " + - "sending the request to {}, will re-resolve the address " + - "send time UTC: {}", - exception, - physicalAddress, - sendTimeUtc); - - GoneException goneException = new GoneException( - String.format( - RMResources.ExceptionMessage, - RMResources.Gone), - exception, - null, - physicalAddress); - - return Single.error(goneException); - } else if (request.isReadOnlyRequest()) { - logger.trace("Received exception {} on readonly request" + - "sending the request to {}, will reresolve the address " + - "send time UTC: {}", - exception, - physicalAddress, - sendTimeUtc); - - GoneException goneException = new GoneException( - String.format( - RMResources.ExceptionMessage, - RMResources.Gone), - exception, - null, - physicalAddress); - - return Single.error(goneException); - } else { - // We can't throw a GoneException here because it will cause retry and we don't - // know if the request failed before or after the message got sent to the server. - // So in order to avoid duplicating the request we will not retry. - // TODO: a possible solution for this is to add the ability to send a request to the server - // to check if the previous request was received or not and act accordingly. - ServiceUnavailableException serviceUnavailableException = new ServiceUnavailableException( - String.format( - RMResources.ExceptionMessage, - RMResources.ServiceUnavailable), - exception, - null, - physicalAddress.toString()); - serviceUnavailableException.getResponseHeaders().put(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "1"); - serviceUnavailableException.getResponseHeaders().put(HttpConstants.HttpHeaders.WRITE_REQUEST_TRIGGER_ADDRESS_REFRESH, "1"); - return Single.error(serviceUnavailableException); - } - }).doOnSuccess(httpClientResponse -> { - Instant receivedTimeUtc = Instant.now(); - double durationInMilliSeconds = (receivedTimeUtc.toEpochMilli() - sendTimeUtc.v.toEpochMilli()); - this.afterRequest( - activityId, - httpClientResponse.getStatus().code() , - durationInMilliSeconds, - httpClientResponse.getHeaders()); - }).doOnError( e -> { - Instant receivedTimeUtc = Instant.now(); - double durationInMilliSeconds = (receivedTimeUtc.toEpochMilli() - sendTimeUtc.v.toEpochMilli()); - this.afterRequest( - activityId, - 0, - durationInMilliSeconds, - null); - }); - - return responseMessage.flatMap(rsp -> processHttpResponse(request.getResourceAddress(), httpRequest, activityId.toString(), rsp, physicalAddress)); - - } catch (Exception e) { - // TODO improve on exception catching - return Single.error(e); - } - } - - private void beforeRequest(UUID activityId, String uri, ResourceType resourceType, HttpRequestHeaders requestHeaders) { - // TODO: perf counters - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - } - - private void afterRequest(UUID activityId, - int statusCode, - double durationInMilliSeconds, - HttpResponseHeaders responseHeaders) { - // TODO: perf counters - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - } - - private static void addHeader(HttpRequestHeaders requestHeaders, String headerName, RxDocumentServiceRequest request) { - String headerValue = request.getHeaders().get(headerName); - if (!Strings.isNullOrEmpty(headerValue)) { - requestHeaders.add(headerName, headerValue); - } - } - - private static void addHeader(HttpRequestHeaders requestHeaders, String headerName, String headerValue) { - if (!Strings.isNullOrEmpty(headerValue)) { - requestHeaders.add(headerName, headerValue); - } - } - - private String GetMatch(RxDocumentServiceRequest request, ResourceOperation resourceOperation) { - switch (resourceOperation.operationType) { - case Delete: - case ExecuteJavaScript: - case Replace: - case Update: - case Upsert: - return request.getHeaders().get(HttpConstants.HttpHeaders.IF_MATCH); - - case Read: - case ReadFeed: - return request.getHeaders().get(HttpConstants.HttpHeaders.IF_NONE_MATCH); - - default: - return null; - } - } - - private HttpClientRequest prepareHttpMessage( - UUID activityId, - URI physicalAddress, - ResourceOperation resourceOperation, - RxDocumentServiceRequest request) throws Exception { - - HttpClientRequest httpRequestMessage = null; - URI requestUri; - HttpMethod method; - - // The StreamContent created below will own and dispose its underlying stream, but we may need to reuse the stream on the - // RxDocumentServiceRequest for future requests. Hence we need to clone without incurring copy cost, so that when - // HttpRequestMessage -> StreamContent -> MemoryStream all get disposed, the original stream will be left open. - switch (resourceOperation.operationType) { - case Create: - requestUri = this.getResourceFeedUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.POST; - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - break; - - case ExecuteJavaScript: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.POST; - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - break; - - case Delete: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.DELETE; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - break; - - case Read: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.GET; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - break; - - case ReadFeed: - requestUri = this.getResourceFeedUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.GET; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - break; - - case Replace: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.PUT; - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - break; - - case Update: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = new HttpMethod("PATCH"); - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - break; - - case Query: - case SqlQuery: - requestUri = this.getResourceFeedUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.POST; - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - HttpTransportClient.addHeader(httpRequestMessage.getHeaders(), HttpConstants.HttpHeaders.CONTENT_TYPE, request); - break; - - case Upsert: - requestUri = this.getResourceFeedUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.POST; - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - break; - - case Head: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.HEAD; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - break; - - case HeadFeed: - requestUri = this.getResourceFeedUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.HEAD; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - break; - - default: - assert false : "Unsupported operation type"; - throw new IllegalStateException(); - } - - Map documentServiceRequestHeaders = request.getHeaders(); - HttpRequestHeaders httpRequestHeaders = httpRequestMessage.getHeaders(); - - // add default headers - for(Map.Entry entry: defaultHeaders.entrySet()) { - HttpTransportClient.addHeader(httpRequestHeaders, entry.getKey(), entry.getValue()); - } - - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.VERSION, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.USER_AGENT, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PAGE_SIZE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PRE_TRIGGER_INCLUDE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PRE_TRIGGER_EXCLUDE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POST_TRIGGER_INCLUDE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POST_TRIGGER_EXCLUDE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.AUTHORIZATION, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.INDEXING_DIRECTIVE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.MIGRATE_COLLECTION_DIRECTIVE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.SESSION_TOKEN, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PREFER, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.RESOURCE_TOKEN_EXPIRY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.ENABLE_SCAN_IN_QUERY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.EMIT_VERBOSE_TRACES_IN_QUERY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CAN_CHARGE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CAN_THROTTLE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.ENABLE_LOW_PRECISION_ORDER_BY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.ENABLE_LOGGING, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.IS_READ_ONLY_SCRIPT, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CONTENT_SERIALIZATION_FORMAT, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CONTINUATION, request.getContinuation()); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.ACTIVITY_ID, activityId.toString()); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PARTITION_KEY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID, request); - - String dateHeader = HttpUtils.getDateHeader(documentServiceRequestHeaders); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.X_DATE, dateHeader); - HttpTransportClient.addHeader(httpRequestHeaders, "Match", this.GetMatch(request, resourceOperation)); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.IF_MODIFIED_SINCE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.A_IM, request); - if (!request.getIsNameBased()) { - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.RESOURCE_ID, request.getResourceId()); - } - - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.ENTITY_ID, request.entityId); - - String fanoutRequestHeader = request.getHeaders().get(WFConstants.BackendHeaders.IS_FANOUT_REQUEST); - HttpTransportClient.addHeader(httpRequestMessage.getHeaders(), WFConstants.BackendHeaders.IS_FANOUT_REQUEST, fanoutRequestHeader); - - if (request.getResourceType() == ResourceType.DocumentCollection) { - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.COLLECTION_PARTITION_INDEX, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.COLLECTION_PARTITION_INDEX)); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.COLLECTION_SERVICE_INDEX, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.COLLECTION_SERVICE_INDEX)); - } - - if (documentServiceRequestHeaders.get(WFConstants.BackendHeaders.BIND_REPLICA_DIRECTIVE) != null) { - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.BIND_REPLICA_DIRECTIVE, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.BIND_REPLICA_DIRECTIVE)); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.PRIMARY_MASTER_KEY, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.PRIMARY_MASTER_KEY)); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.SECONDARY_MASTER_KEY, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.SECONDARY_MASTER_KEY)); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.PRIMARY_READONLY_KEY, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.PRIMARY_READONLY_KEY)); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.SECONDARY_READONLY_KEY, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.SECONDARY_READONLY_KEY)); - } - - if (documentServiceRequestHeaders.get(HttpConstants.HttpHeaders.CAN_OFFER_REPLACE_COMPLETE) != null) { - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CAN_OFFER_REPLACE_COMPLETE, documentServiceRequestHeaders.get(HttpConstants.HttpHeaders.CAN_OFFER_REPLACE_COMPLETE)); - } - - //Query - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.IS_QUERY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.QUERY, request); - - // Upsert - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.IS_UPSERT, request); - - // SupportSpatialLegacyCoordinates - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.SUPPORT_SPATIAL_LEGACY_COORDINATES, request); - - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.PARTITION_COUNT, request); - - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.COLLECTION_RID, request); - - // Filter by schema - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.FILTER_BY_SCHEMA_RESOURCE_ID, request); - - // UsePolygonsSmallerThanAHemisphere - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.USE_POLYGONS_SMALLER_THAN_AHEMISPHERE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.GATEWAY_SIGNATURE, request); - - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POPULATE_QUOTA_INFO, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POPULATE_QUERY_METRICS, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.FORCE_QUERY_SCAN, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB, request); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.REMOTE_STORAGE_TYPE, request); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.SHARE_THROUGHPUT, request); - - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POPULATE_PARTITION_STATISTICS, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POPULATE_COLLECTION_THROUGHPUT_INFO, request); - - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.REMAINING_TIME_IN_MS_ON_CLIENT_REQUEST, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CLIENT_RETRY_ATTEMPT_COUNT, request); - - // target lsn for head requests. - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.TARGET_LSN, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.TARGET_GLOBAL_COMMITTED_LSN, request); - - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.FEDERATION_ID_FOR_AUTH, request); - - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.FANOUT_OPERATION_STATE, request); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.ALLOW_TENTATIVE_WRITES, request); - - HttpTransportClient.addHeader(httpRequestHeaders, CustomHeaders.HttpHeaders.EXCLUDE_SYSTEM_PROPERTIES, request); - - return httpRequestMessage; - } - - static URI getResourceFeedUri(ResourceType resourceType, URI physicalAddress, RxDocumentServiceRequest request) throws Exception { - switch (resourceType) { - case Attachment: - return getAttachmentFeedUri(physicalAddress, request); - case DocumentCollection: - return getCollectionFeedUri(physicalAddress, request); - case Conflict: - return getConflictFeedUri(physicalAddress, request); - case Database: - return getDatabaseFeedUri(physicalAddress); - case Document: - return getDocumentFeedUri(physicalAddress, request); - case Permission: - return getPermissionFeedUri(physicalAddress, request); - case StoredProcedure: - return getStoredProcedureFeedUri(physicalAddress, request); - case Trigger: - return getTriggerFeedUri(physicalAddress, request); - case User: - return getUserFeedUri(physicalAddress, request); - - case UserDefinedFunction: - return getUserDefinedFunctionFeedUri(physicalAddress, request); - case Schema: - return getSchemaFeedUri(physicalAddress, request); - case Offer: - return getOfferFeedUri(physicalAddress, request); - -// Other types: Replica, Module, ModuleCommand, Record, UserDefinedType not applicable to SDK. - - default: - assert false : "Unexpected resource type: " + resourceType; - throw new NotFoundException(); - } - } - - static URI getResourceEntryUri(ResourceType resourceType, URI physicalAddress, RxDocumentServiceRequest request) throws Exception { - switch (resourceType) { - case Attachment: - return getAttachmentEntryUri(physicalAddress, request); - case DocumentCollection: - return getCollectionEntryUri(physicalAddress, request); - case Conflict: - return getConflictEntryUri(physicalAddress, request); - case Database: - return getDatabaseEntryUri(physicalAddress, request); - case Document: - return getDocumentEntryUri(physicalAddress, request); - case Permission: - return getPermissionEntryUri(physicalAddress, request); - case StoredProcedure: - return getStoredProcedureEntryUri(physicalAddress, request); - case Trigger: - return getTriggerEntryUri(physicalAddress, request); - case User: - return getUserEntryUri(physicalAddress, request); - case UserDefinedFunction: - return getUserDefinedFunctionEntryUri(physicalAddress, request); - case Schema: - return getSchemaEntryUri(physicalAddress, request); - case Offer: - return getOfferEntryUri(physicalAddress, request); - -// Other types: Replica, Module, ModuleCommand, Record, UserDefinedType not applicable to SDK. - - default: - assert false: "Unexpected resource type: " + resourceType; - throw new IllegalStateException(); - } - } - - static URI createURI(URI baseAddress, String resourcePath) { - return baseAddress.resolve(HttpUtils.urlEncode(trimBeginningAndEndingSlashes(resourcePath))); - } - - static URI getRootFeedUri(URI baseAddress) { - return baseAddress; - } - - static URI getDatabaseFeedUri(URI baseAddress) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Database, StringUtils.EMPTY, true)); - } - - static URI getDatabaseEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Database, request, false)); - } - - static URI getCollectionFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.DocumentCollection, request, true)); - } - - static URI getStoredProcedureFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.StoredProcedure, request, true)); - } - - static URI getTriggerFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Trigger, request, true)); - } - - static URI getUserDefinedFunctionFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.UserDefinedFunction, request, true)); - } - - static URI getCollectionEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.DocumentCollection, request, false)); - } - - static URI getStoredProcedureEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.StoredProcedure, request, false)); - } - - static URI getTriggerEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Trigger, request, false)); - } - - static URI getUserDefinedFunctionEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.UserDefinedFunction, request, false)); - } - - static URI getDocumentFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Document, request, true)); - } - - static URI getDocumentEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Document, request, false)); - } - - static URI getConflictFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Conflict, request, true)); - } - - static URI getConflictEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Conflict, request, false)); - } - - static URI getAttachmentFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Attachment, request, true)); - } - - static URI getAttachmentEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Attachment, request, false)); - } - - static URI getUserFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.User, request, true)); - } - - static URI getUserEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.User, request, false)); - } - - static URI getPermissionFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Permission, request, true)); - } - - static URI getPermissionEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Permission, request, false)); - } - - static URI getOfferFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Offer, request, true)); - } - - - static URI getSchemaFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Schema, request, true)); - } - - static URI getSchemaEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Schema, request, false)); - } - - static URI getOfferEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Offer, request, false)); - } - - static String getHeader(String[] names, String[] values, String name) { - for (int idx = 0; idx < names.length; idx++) { - if (Strings.areEqual(names[idx], name)) { - return values[idx]; - } - } - - return null; - } - - private Single processHttpResponse(String resourceAddress, HttpClientRequest request, String activityId, HttpClientResponse response, URI physicalAddress) { - if (response == null) { - InternalServerErrorException exception = - new InternalServerErrorException( - String.format( - RMResources.ExceptionMessage, - RMResources.InvalidBackendResponse), - null, - physicalAddress); - exception.getResponseHeaders().put(HttpConstants.HttpHeaders.ACTIVITY_ID, - activityId); - exception.getResponseHeaders().put(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "1"); - - return Single.error(exception); - } - - // If the status code is < 300 or 304 NotModified (we treat not modified as success) then it means that it's a success code and shouldn't throw. - if (response.getStatus().code() < HttpConstants.StatusCodes.MINIMUM_STATUSCODE_AS_ERROR_GATEWAY || - response.getStatus().code() == HttpConstants.StatusCodes.NOT_MODIFIED) { - return HttpTransportClient.createStoreResponseFromHttpResponse(response); - } - else { - return this.createErrorResponseFromHttpResponse(resourceAddress, activityId, request, response); - } - } - - private Single createErrorResponseFromHttpResponse(String resourceAddress, String activityId, - HttpClientRequest request, - HttpClientResponse response) { - HttpResponseStatus statusCode = response.getStatus(); - Single errorMessageObs = ErrorUtils.getErrorResponseAsync(response); - - return errorMessageObs.flatMap( - errorMessage -> { - long responseLSN = -1; - - List lsnValues; - if ((lsnValues = response.getHeaders().getAll(WFConstants.BackendHeaders.LSN)) != null) { - String temp = lsnValues.isEmpty() ? null : lsnValues.get(0); - responseLSN = Longs.tryParse(temp, responseLSN); - } - - String responsePartitionKeyRangeId = null; - List partitionKeyRangeIdValues; - if ((partitionKeyRangeIdValues = response.getHeaders().getAll(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID)) != null) { - responsePartitionKeyRangeId = Lists.firstOrDefault(partitionKeyRangeIdValues, null); - } - - DocumentClientException exception; - - switch (statusCode.code()) { - case HttpConstants.StatusCodes.UNAUTHORIZED: - exception = new UnauthorizedException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Unauthorized : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.FORBIDDEN: - exception = new ForbiddenException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Forbidden : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.NOTFOUND: - // HTTP.SYS returns NotFound (404) if the URI - // is not registered. This is really an indication that - // the replica which registered the URI is not - // available at the server. We detect this case by - // the presence of Content-Type header in the response - // and map it to HTTP Gone (410), which is the more - // appropriate response for this case. - if (response.getContent() != null && response.getHeaders() != null && response.getHeaders().get(HttpConstants.HttpHeaders.CONTENT_TYPE) != null && - !Strings.isNullOrEmpty(response.getHeaders().get(HttpConstants.HttpHeaders.CONTENT_TYPE)) && - Strings.containsIgnoreCase(response.getHeaders().get(HttpConstants.HttpHeaders.CONTENT_TYPE), RuntimeConstants.MediaTypes.TEXT_HTML)) { - // Have the request URL in the exception message for debugging purposes. - exception = new GoneException( - String.format( - RMResources.ExceptionMessage, - RMResources.Gone), - request.getUri()); - exception.getResponseHeaders().put(HttpConstants.HttpHeaders.ACTIVITY_ID, - activityId); - - break; - } else { - exception = new NotFoundException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.NotFound : errorMessage), - response.getHeaders(), - request.getUri()); - break; - } - - case HttpConstants.StatusCodes.BADREQUEST: - exception = new BadRequestException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.BadRequest : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.METHOD_NOT_ALLOWED: - exception = new MethodNotAllowedException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.MethodNotAllowed : errorMessage), - null, - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.GONE: { - - // TODO: update perf counter - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - ErrorUtils.logGoneException(request.getUri(), activityId); - - Integer nSubStatus = 0; - String valueSubStatus = null; - - valueSubStatus = response.getHeaders().get(WFConstants.BackendHeaders.SUB_STATUS); - if (!Strings.isNullOrEmpty(valueSubStatus)) { - if ((nSubStatus = Integers.tryParse(valueSubStatus)) == null) { - exception = new InternalServerErrorException( - String.format( - RMResources.ExceptionMessage, - RMResources.InvalidBackendResponse), - response.getHeaders(), - request.getUri()); - break; - } - } - - if (nSubStatus == HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE) { - exception = new InvalidPartitionException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Gone : errorMessage), - response.getHeaders(), - request.getUri()); - break; - } else if (nSubStatus == HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE) { - exception = new PartitionKeyRangeGoneException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Gone : errorMessage), - response.getHeaders(), - request.getUri()); - break; - } else if (nSubStatus == HttpConstants.SubStatusCodes.COMPLETING_SPLIT) { - exception = new PartitionKeyRangeIsSplittingException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Gone : errorMessage), - response.getHeaders(), - request.getUri()); - break; - } else if (nSubStatus == HttpConstants.SubStatusCodes.COMPLETING_PARTITION_MIGRATION) { - exception = new PartitionIsMigratingException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Gone : errorMessage), - response.getHeaders(), - request.getUri()); - break; - } else { - // Have the request URL in the exception message for debugging purposes. - exception = new GoneException( - String.format( - RMResources.ExceptionMessage, - RMResources.Gone), - response.getHeaders(), - request.getUri()); - - exception.getResponseHeaders().put(HttpConstants.HttpHeaders.ACTIVITY_ID, - activityId); - break; - } - } - - case HttpConstants.StatusCodes.CONFLICT: - exception = new ConflictException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.EntityAlreadyExists : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.PRECONDITION_FAILED: - exception = new PreconditionFailedException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.PreconditionFailed : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.REQUEST_ENTITY_TOO_LARGE: - exception = new RequestEntityTooLargeException( - String.format( - RMResources.ExceptionMessage, - String.format( - RMResources.RequestEntityTooLarge, - HttpConstants.HttpHeaders.PAGE_SIZE)), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.LOCKED: - exception = new LockedException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Locked : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.SERVICE_UNAVAILABLE: - exception = new ServiceUnavailableException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.ServiceUnavailable : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.REQUEST_TIMEOUT: - exception = new RequestTimeoutException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.RequestTimeout : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.RETRY_WITH: - exception = new RetryWithException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.RetryWith : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.TOO_MANY_REQUESTS: - exception = - new RequestRateTooLargeException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.TooManyRequests : errorMessage), - response.getHeaders(), - request.getUri()); - - List values = response.getHeaders().getAll(HttpConstants.HttpHeaders.RETRY_AFTER_IN_MILLISECONDS); - - if (values == null || values.isEmpty()) { - logger.warn("RequestRateTooLargeException being thrown without RetryAfter."); - } else { - exception.getResponseHeaders().put(HttpConstants.HttpHeaders.RETRY_AFTER_IN_MILLISECONDS, values.get(0)); - } - - break; - - case HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR: - exception = new InternalServerErrorException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.InternalServerError : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - default: - logger.error("Unrecognized status code {} returned by backend. ActivityId {}", statusCode, activityId); - ErrorUtils.logException(request.getUri(), activityId); - exception = new InternalServerErrorException( - String.format( - RMResources.ExceptionMessage, - RMResources.InvalidBackendResponse), - response.getHeaders(), - request.getUri()); - break; - } - - BridgeInternal.setLSN(exception, responseLSN); - BridgeInternal.setPartitionKeyRangeId(exception, responsePartitionKeyRangeId); - BridgeInternal.setResourceAddress(exception, resourceAddress); - BridgeInternal.setRequestHeaders(exception, HttpUtils.asMap(request.getHeaders())); - - return Single.error(exception); - } - ); - } - - private static Single createStoreResponseFromHttpResponse( - HttpClientResponse responseMessage) { - - Single storeResponse = ResponseUtils.toStoreResponse(responseMessage); - return storeResponse; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressCache.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressCache.java deleted file mode 100644 index 3e53730b86bc..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressCache.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import rx.Single; - -public interface IAddressCache { - - /** - * Resolves physical addresses by either PartitionKeyRangeIdentity. - * - * - * @param request Request is needed only by GatewayAddressCache in the only case when request is name based and user has name based auth token. - * PartitionkeyRangeIdentity can be used to locate auth token in this case. - * @param partitionKeyRangeIdentity target partition key range Id - * @param forceRefreshPartitionAddresses Whether addresses need to be refreshed as previously resolved addresses were determined to be outdated. - * @return Physical addresses. - */ - Single tryGetAddresses( - RxDocumentServiceRequest request, - PartitionKeyRangeIdentity partitionKeyRangeIdentity, - boolean forceRefreshPartitionAddresses); -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressResolver.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressResolver.java deleted file mode 100644 index d2c5dce2dc49..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressResolver.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import rx.Single; - -public interface IAddressResolver { - Single resolveAsync( - RxDocumentServiceRequest request, - boolean forceRefreshPartitionAddresses); -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IStoreClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IStoreClient.java deleted file mode 100644 index a9a1c1fffdae..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IStoreClient.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import rx.Single; -import rx.functions.Func1; - -public interface IStoreClient { - - Single processMessageAsync( - RxDocumentServiceRequest request, - IRetryPolicy retryPolicy, - Func1> prepareRequestAsyncDelegate); - - default Single processMessageAsync( - RxDocumentServiceRequest request, - Func1> prepareRequestAsyncDelegate) { - return processMessageAsync(request, null, prepareRequestAsyncDelegate); - } - - default Single processMessageAsync( - RxDocumentServiceRequest request, - IRetryPolicy retryPolicy) { - return processMessageAsync(request, retryPolicy, null); - } - - default Single processMessageAsync( - RxDocumentServiceRequest request) { - return processMessageAsync(request, null, null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/LockedException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/LockedException.java deleted file mode 100644 index 1b996af941a3..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/LockedException.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class LockedException extends DocumentClientException { - private static final long serialVersionUID = 1L; - - public LockedException() { - this(RMResources.Locked); - } - - public LockedException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.LOCKED, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public LockedException(String msg) { - super(HttpConstants.StatusCodes.LOCKED, msg); - } - - public LockedException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.LOCKED, resourceAddress); - } - - public LockedException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public LockedException(Exception innerException) { - this(RMResources.Locked, innerException, null, null); - } - - public LockedException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Locked, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.LOCKED, - requestUri); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MethodNotAllowedException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MethodNotAllowedException.java deleted file mode 100644 index 082789ba3eda..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MethodNotAllowedException.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class MethodNotAllowedException extends DocumentClientException { - public MethodNotAllowedException() { - this(RMResources.MethodNotAllowed); - } - - public MethodNotAllowedException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.METHOD_NOT_ALLOWED, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public MethodNotAllowedException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public MethodNotAllowedException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public MethodNotAllowedException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public MethodNotAllowedException(Exception innerException) { - this(RMResources.MethodNotAllowed, innerException, null, null); - } - - public MethodNotAllowedException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.MethodNotAllowed, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.METHOD_NOT_ALLOWED, - requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyRangeGoneException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyRangeGoneException.java deleted file mode 100644 index 3a8531316e03..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyRangeGoneException.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.collections4.CollectionUtils; - -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -/** - * This exception is thrown when DocumentServiceRequest contains x-ms-documentdb-partitionkeyrangeid - * header and such range id doesn't exist. - *

- * No retries should be made in this case, as either split or merge might have happened and query/readfeed - * must take appropriate actions. - */ -public class PartitionKeyRangeGoneException extends DocumentClientException { - - public PartitionKeyRangeGoneException() { - this(RMResources.Gone); - } - - public PartitionKeyRangeGoneException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.GONE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - this.setSubstatus(); - } - - public PartitionKeyRangeGoneException(String message) { - this(message, (Exception) null, null, null); - } - - public PartitionKeyRangeGoneException(String message, Exception innerException) { - this(message, innerException, (HttpResponseHeaders) null, null); - } - - public PartitionKeyRangeGoneException(Exception innerException) { - this(RMResources.Gone, innerException, (HttpResponseHeaders) null, null); - } - - - public PartitionKeyRangeGoneException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.GONE, requestUri); - this.setSubstatus(); - } - - public PartitionKeyRangeGoneException(String message, Exception innerException, HttpResponseHeaders headers, String requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.GONE, requestUri); - this.setSubstatus(); - } - - private void setSubstatus() { - this.getResponseHeaders().put(WFConstants.BackendHeaders.SUB_STATUS, Integer.toString(HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE)); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PreconditionFailedException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PreconditionFailedException.java deleted file mode 100644 index 400609c86685..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PreconditionFailedException.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class PreconditionFailedException extends DocumentClientException { - - private static final long serialVersionUID = 1L; - - public PreconditionFailedException() { - this(RMResources.PreconditionFailed); - } - - public PreconditionFailedException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.PRECONDITION_FAILED, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public PreconditionFailedException(String msg) { - super(HttpConstants.StatusCodes.PRECONDITION_FAILED, msg); - } - - public PreconditionFailedException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.PRECONDITION_FAILED, resourceAddress); - } - - public PreconditionFailedException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public PreconditionFailedException(Exception innerException) { - this(RMResources.PreconditionFailed, innerException, null, null); - } - - public PreconditionFailedException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.PreconditionFailed, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.PRECONDITION_FAILED, - requestUri); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QueryRequestPerformanceActivity.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QueryRequestPerformanceActivity.java deleted file mode 100644 index 1673bbc60d76..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QueryRequestPerformanceActivity.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -// TODO troubleshooting info -// https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 -public class QueryRequestPerformanceActivity { -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReader.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReader.java deleted file mode 100644 index 6028328a6875..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReader.java +++ /dev/null @@ -1,811 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.JavaStreamUtils; -import com.microsoft.azure.cosmosdb.internal.MutableVolatile; -import com.microsoft.azure.cosmosdb.internal.Quadruple; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.lang3.tuple.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; - -import java.util.Comparator; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; -import java.util.stream.Collectors; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -// -//================================================================================================================= -// Strong read logic: -//================================================================================================================= -// -// ------------------- PerformPrimaryRead------------------------------------------------------------- -// | ^ | -// [RetryOnSecondary] | | -// | [QuorumNotSelected] | -// \/ | \/ -// Start-------------------------->SecondaryQuorumRead-------------[QuorumMet]-------------------------------->Result -// | ^ -// [QuorumSelected] | -// | | -// \/ | -// PrimaryReadBarrier------------------------------------------------------------- -// -//================================================================================================================= -// BoundedStaleness quorum read logic: -//================================================================================================================= -// -// ------------------- PerformPrimaryRead------------------------------------------------------------- -// | ^ | -// [RetryOnSecondary] | | -// | [QuorumNotSelected] | -// \/ | \/ -// Start-------------------------->SecondaryQuorumRead-------------[QuorumMet]-------------------------------->Result -// | ^ -// [QuorumSelected] | -// | | -// | | -// --------------------------------------------------------------------------- -// -/** - * QuorumReader wraps the client side quorum logic on top of the StoreReader - */ -public class QuorumReader { - private final static Logger logger = LoggerFactory.getLogger(QuorumReader.class); - - private final int maxNumberOfReadBarrierReadRetries; - private final int maxNumberOfPrimaryReadRetries; - private final int maxNumberOfReadQuorumRetries; - private final int delayBetweenReadBarrierCallsInMs; - - private final int maxBarrierRetriesForMultiRegion; - private final int barrierRetryIntervalInMsForMultiRegion; - - private final int maxShortBarrierRetriesForMultiRegion; - private final int shortBarrierRetryIntervalInMsForMultiRegion; - - private final StoreReader storeReader; - private final GatewayServiceConfigurationReader serviceConfigReader; - private final IAuthorizationTokenProvider authorizationTokenProvider; - - public QuorumReader( - Configs configs, - TransportClient transportClient, - AddressSelector addressSelector, - StoreReader storeReader, - GatewayServiceConfigurationReader serviceConfigReader, - IAuthorizationTokenProvider authorizationTokenProvider) { - this.storeReader = storeReader; - this.serviceConfigReader = serviceConfigReader; - this.authorizationTokenProvider = authorizationTokenProvider; - - this.maxNumberOfReadBarrierReadRetries = configs.getMaxNumberOfReadBarrierReadRetries(); - this.maxNumberOfPrimaryReadRetries = configs.getMaxNumberOfPrimaryReadRetries(); - this.maxNumberOfReadQuorumRetries = configs.getMaxNumberOfReadQuorumRetries(); - this.delayBetweenReadBarrierCallsInMs = configs.getDelayBetweenReadBarrierCallsInMs(); - this.maxBarrierRetriesForMultiRegion = configs.getMaxBarrierRetriesForMultiRegion(); - this.barrierRetryIntervalInMsForMultiRegion = configs.getBarrierRetryIntervalInMsForMultiRegion(); - this.maxShortBarrierRetriesForMultiRegion = configs.getMaxShortBarrierRetriesForMultiRegion(); - this.shortBarrierRetryIntervalInMsForMultiRegion = configs.getShortBarrierRetryIntervalInMsForMultiRegion(); - } - - public QuorumReader( - TransportClient transportClient, - AddressSelector addressSelector, - StoreReader storeReader, - GatewayServiceConfigurationReader serviceConfigReader, - IAuthorizationTokenProvider authorizationTokenProvider, - Configs configs) { - this(configs, transportClient, addressSelector, storeReader, serviceConfigReader, authorizationTokenProvider); - } - - public Single readStrongAsync( - RxDocumentServiceRequest entity, - int readQuorumValue, - ReadMode readMode) { - final MutableVolatile shouldRetryOnSecondary = new MutableVolatile<>(false); - final MutableVolatile hasPerformedReadFromPrimary = new MutableVolatile<>(false); - - return Observable.defer( - // the following will be repeated till the repeat().takeUntil(.) condition is satisfied. - () -> { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new GoneException()); - } - - shouldRetryOnSecondary.v = false; - Single secondaryQuorumReadResultObs = - this.readQuorumAsync(entity, readQuorumValue, false, readMode); - - return secondaryQuorumReadResultObs.toObservable().flatMap( - secondaryQuorumReadResult -> { - - switch (secondaryQuorumReadResult.quorumResult) { - case QuorumMet: - try { - return Observable.just(secondaryQuorumReadResult.getResponse()); - } catch (DocumentClientException e) { - return Observable.error(e); - } - - case QuorumSelected: - Single barrierRequestObs = BarrierRequestHelper.createAsync( - entity, - this.authorizationTokenProvider, - secondaryQuorumReadResult.selectedLsn, - secondaryQuorumReadResult.globalCommittedSelectedLsn); - - return barrierRequestObs.toObservable().flatMap(barrierRequest -> { - Single readBarrierObs = this.waitForReadBarrierAsync( - barrierRequest, - true /* include primary */, - readQuorumValue, - secondaryQuorumReadResult.selectedLsn, - secondaryQuorumReadResult.globalCommittedSelectedLsn, - readMode); - - return readBarrierObs.toObservable().flatMap( - readBarrier -> { - - if (readBarrier) { - try { - return Observable.just(secondaryQuorumReadResult.getResponse()); - } catch (Exception e) { - return Observable.error(e); - } - } - - // else barrier was not successful - logger.warn( - "QuorumSelected: Could not converge on the LSN {} GlobalCommittedLSN {} after primary read barrier with read quorum {} for strong read, Responses: {}", - secondaryQuorumReadResult.selectedLsn, - secondaryQuorumReadResult.globalCommittedSelectedLsn, - readQuorumValue, - String.join(";", secondaryQuorumReadResult.storeResponses) - ); - - entity.requestContext.quorumSelectedStoreResponse = secondaryQuorumReadResult.selectedResponse; - entity.requestContext.storeResponses = secondaryQuorumReadResult.storeResponses; - entity.requestContext.quorumSelectedLSN = secondaryQuorumReadResult.selectedLsn; - entity.requestContext.globalCommittedSelectedLSN = secondaryQuorumReadResult.globalCommittedSelectedLsn; - - return Observable.empty(); - } - ); - }); - - case QuorumNotSelected: - if (hasPerformedReadFromPrimary.v) { - logger.warn("QuorumNotSelected: Primary read already attempted. Quorum could not be selected after retrying on secondaries."); - return Observable.error(new GoneException(RMResources.ReadQuorumNotMet)); - } - - logger.warn("QuorumNotSelected: Quorum could not be selected with read quorum of {}", readQuorumValue); - Single responseObs = this.readPrimaryAsync(entity, readQuorumValue, false); - - return responseObs.toObservable().flatMap( - response -> { - if (response.isSuccessful && response.shouldRetryOnSecondary) { - assert false : "QuorumNotSelected: PrimaryResult has both Successful and shouldRetryOnSecondary flags set"; - logger.error("PrimaryResult has both Successful and shouldRetryOnSecondary flags set"); - } else if (response.isSuccessful) { - logger.debug("QuorumNotSelected: ReadPrimary successful"); - try { - return Observable.just(response.getResponse()); - } catch (DocumentClientException e) { - return Observable.error(e); - } - } else if (response.shouldRetryOnSecondary) { - shouldRetryOnSecondary.v = true; - logger.warn("QuorumNotSelected: ReadPrimary did not succeed. Will retry on secondary."); - hasPerformedReadFromPrimary.v = true; - } else { - logger.warn("QuorumNotSelected: Could not get successful response from ReadPrimary"); - return Observable.error(new GoneException(String.format(RMResources.ReadQuorumNotMet, readQuorumValue))); - } - - return Observable.empty(); - - } - ); - - default: - logger.error("Unknown ReadQuorum result {}", secondaryQuorumReadResult.quorumResult.toString()); - return Observable.error(new InternalServerErrorException(RMResources.InternalServerError)); - } - - }); - }).repeat(maxNumberOfReadQuorumRetries) - .takeUntil(dummy -> !shouldRetryOnSecondary.v) - .concatWith(Observable.defer(() -> { - logger.warn("Could not complete read quorum with read quorum value of {}", readQuorumValue); - - return Observable.error(new GoneException( - String.format( - RMResources.ReadQuorumNotMet, - readQuorumValue))); - })) - .take(1) - .toSingle(); - } - - private Single readQuorumAsync( - RxDocumentServiceRequest entity, - int readQuorum, - boolean includePrimary, - ReadMode readMode) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - return ensureQuorumSelectedStoreResponse(entity, readQuorum, includePrimary, readMode).flatMap( - res -> { - if (res.getLeft() != null) { - // no need for barrier - return Single.just(res.getKey()); - } - - long readLsn = res.getValue().getValue0(); - long globalCommittedLSN = res.getValue().getValue1(); - StoreResult storeResult = res.getValue().getValue2(); - List storeResponses = res.getValue().getValue3(); - - // ReadBarrier required - Single barrierRequestObs = BarrierRequestHelper.createAsync(entity, this.authorizationTokenProvider, readLsn, globalCommittedLSN); - return barrierRequestObs.flatMap( - barrierRequest -> { - Single waitForObs = this.waitForReadBarrierAsync(barrierRequest, false, readQuorum, readLsn, globalCommittedLSN, readMode); - return waitForObs.flatMap( - waitFor -> { - if (!waitFor) { - return Single.just(new ReadQuorumResult( - entity.requestContext.requestChargeTracker, - ReadQuorumResultKind.QuorumSelected, - readLsn, - globalCommittedLSN, - storeResult, - storeResponses)); - } - - return Single.just(new ReadQuorumResult( - entity.requestContext.requestChargeTracker, - ReadQuorumResultKind.QuorumMet, - readLsn, - globalCommittedLSN, - storeResult, - storeResponses)); - } - ); - } - ); - } - ); - } - - private Single>>> ensureQuorumSelectedStoreResponse(RxDocumentServiceRequest entity, int readQuorum, boolean includePrimary, ReadMode readMode) { - - if (entity.requestContext.quorumSelectedStoreResponse == null) { - Single> responseResultObs = this.storeReader.readMultipleReplicaAsync( - entity, includePrimary, readQuorum, true /*required valid LSN*/, false, readMode); - - return responseResultObs.flatMap( - responseResult -> { - List storeResponses = responseResult.stream().map(response -> response.toString()).collect(Collectors.toList()); - int responseCount = (int) responseResult.stream().filter(response -> response.isValid).count(); - if (responseCount < readQuorum) { - return Single.just(Pair.of(new ReadQuorumResult(entity.requestContext.requestChargeTracker, - ReadQuorumResultKind.QuorumNotSelected, - -1, -1, null, storeResponses), null)); - } - - //either request overrides consistency level with strong, or request does not override and account default consistency level is strong - boolean isGlobalStrongReadCandidate = - (ReplicatedResourceClient.isGlobalStrongEnabled() && this.serviceConfigReader.getDefaultConsistencyLevel() == ConsistencyLevel.Strong) && - (entity.requestContext.originalRequestConsistencyLevel == null || entity.requestContext.originalRequestConsistencyLevel == ConsistencyLevel.Strong); - - ValueHolder readLsn = new ValueHolder(-1); - ValueHolder globalCommittedLSN = new ValueHolder(-1); - ValueHolder storeResult = new ValueHolder(null); - - if (this.isQuorumMet( - responseResult, - readQuorum, - false, - isGlobalStrongReadCandidate, - readLsn, - globalCommittedLSN, - storeResult)) { - return Single.just(Pair.of(new ReadQuorumResult( - entity.requestContext.requestChargeTracker, - ReadQuorumResultKind.QuorumMet, - readLsn.v, - globalCommittedLSN.v, - storeResult.v, - storeResponses), null)); - } - - // at this point, if refresh were necessary, we would have refreshed it in ReadMultipleReplicaAsync - // so set to false here to avoid further refrehses for this request. - entity.requestContext.forceRefreshAddressCache = false; - - Quadruple> state = Quadruple.with(readLsn.v, globalCommittedLSN.v, storeResult.v, storeResponses); - return Single.just(Pair.of(null, state)); - } - ); - } else { - - ValueHolder readLsn = ValueHolder.initialize(entity.requestContext.quorumSelectedLSN); - ValueHolder globalCommittedLSN = ValueHolder.initialize(entity.requestContext.globalCommittedSelectedLSN); - ValueHolder storeResult = ValueHolder.initialize(entity.requestContext.quorumSelectedStoreResponse); - List storeResponses = entity.requestContext.storeResponses; - Quadruple> state = Quadruple.with(readLsn.v, globalCommittedLSN.v, storeResult.v, storeResponses); - - return Single.just(Pair.of(null, state)); - } - } - - /** - * Read and get response from Primary - * - * @param entity - * @param readQuorum - * @param useSessionToken - * @return - */ - private Single readPrimaryAsync( - RxDocumentServiceRequest entity, - int readQuorum, - boolean useSessionToken) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - // We would have already refreshed address before reaching here. Avoid performing here. - entity.requestContext.forceRefreshAddressCache = false; - - Single storeResultObs = this.storeReader.readPrimaryAsync( - entity, true /*required valid LSN*/, useSessionToken); - - return storeResultObs.flatMap( - storeResult -> { - if (!storeResult.isValid) { - try { - return Single.error(storeResult.getException()); - } catch (InternalServerErrorException e) { - return Single.error(e); - } - } - - if (storeResult.currentReplicaSetSize <= 0 || storeResult.lsn < 0 || storeResult.quorumAckedLSN < 0) { - String message = String.format( - "Invalid value received from response header. CurrentReplicaSetSize %d, StoreLSN %d, QuorumAckedLSN %d", - storeResult.currentReplicaSetSize, storeResult.lsn, storeResult.quorumAckedLSN); - - // might not be returned if primary is still building the secondary replicas (during churn) - logger.error(message); - - // throw exception instead of returning inconsistent result. - return Single.error(new GoneException(String.format(RMResources.ReadQuorumNotMet, readQuorum))); - - } - - if (storeResult.currentReplicaSetSize > readQuorum) { - logger.warn( - "Unexpected response. Replica Set size is {} which is greater than min value {}", storeResult.currentReplicaSetSize, readQuorum); - return Single.just(new ReadPrimaryResult(entity.requestContext.requestChargeTracker, /*isSuccessful */ false, - /* shouldRetryOnSecondary: */ true, /* response: */ null)); - } - - // To accommodate for store latency, where an LSN may be acked by not persisted in the store, we compare the quorum acked LSN and store LSN. - // In case of sync replication, the store LSN will follow the quorum committed LSN - // In case of async replication (if enabled for bounded staleness), the store LSN can be ahead of the quorum committed LSN if the primary is able write to faster than secondary acks. - // We pick higher of the 2 LSN and wait for the other to reach that LSN. - if (storeResult.lsn != storeResult.quorumAckedLSN) { - logger.warn("Store LSN {} and quorum acked LSN {} don't match", storeResult.lsn, storeResult.quorumAckedLSN); - long higherLsn = storeResult.lsn > storeResult.quorumAckedLSN ? storeResult.lsn : storeResult.quorumAckedLSN; - - Single waitForLsnRequestObs = BarrierRequestHelper.createAsync(entity, this.authorizationTokenProvider, higherLsn, null); - return waitForLsnRequestObs.flatMap( - waitForLsnRequest -> { - Single primaryWaitForLsnResponseObs = this.waitForPrimaryLsnAsync(waitForLsnRequest, higherLsn, readQuorum); - return primaryWaitForLsnResponseObs.map( - primaryWaitForLsnResponse -> { - if (primaryWaitForLsnResponse == PrimaryReadOutcome.QuorumNotMet) { - return new ReadPrimaryResult( - entity.requestContext.requestChargeTracker, /*(isSuccessful: */ false, /* shouldRetryOnSecondary: */ false, /* response: */null); - } else if (primaryWaitForLsnResponse == PrimaryReadOutcome.QuorumInconclusive) { - return new ReadPrimaryResult( - entity.requestContext.requestChargeTracker, /* isSuccessful: */ false, /* shouldRetryOnSecondary: */ - true, /* response: */ null); - } - - return new ReadPrimaryResult( - entity.requestContext.requestChargeTracker, /* isSuccessful: */ true, /* shouldRetryOnSecondary: */ false, /*response: */ storeResult); - } - ); - } - ); - } - - return Single.just(new ReadPrimaryResult( - /* requestChargeTracker: */ entity.requestContext.requestChargeTracker, /* isSuccessful: */ true, /* shouldRetryOnSecondary:*/ false, - /*response: */ storeResult)); - } - ); - } - - private Single waitForPrimaryLsnAsync( - RxDocumentServiceRequest barrierRequest, - long lsnToWaitFor, - int readQuorum) { - - return Observable.defer(() -> { - if (barrierRequest.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new GoneException()); - } - - // We would have already refreshed address before reaching here. Avoid performing here. - barrierRequest.requestContext.forceRefreshAddressCache = false; - - Single storeResultObs = this.storeReader.readPrimaryAsync(barrierRequest, true /*required valid LSN*/, false); - - return storeResultObs.toObservable().flatMap( - storeResult -> { - if (!storeResult.isValid) { - try { - return Observable.error(storeResult.getException()); - } catch (InternalServerErrorException e) { - return Observable.error(e); - } - } - - if (storeResult.currentReplicaSetSize > readQuorum) { - logger.warn( - "Unexpected response. Replica Set size is {} which is greater than min value {}", storeResult.currentReplicaSetSize, readQuorum); - return Observable.just(PrimaryReadOutcome.QuorumInconclusive); - } - - // Java this will move to the repeat logic - if (storeResult.lsn < lsnToWaitFor || storeResult.quorumAckedLSN < lsnToWaitFor) { - logger.warn( - "Store LSN {} or quorum acked LSN {} are lower than expected LSN {}", storeResult.lsn, storeResult.quorumAckedLSN, lsnToWaitFor); - - return Observable.timer(delayBetweenReadBarrierCallsInMs, TimeUnit.MILLISECONDS).flatMap(dummy -> Observable.empty()); - } - - return Observable.just(PrimaryReadOutcome.QuorumMet); - } - ); - }).repeat(maxNumberOfPrimaryReadRetries) // Loop for store and quorum LSN to match - .defaultIfEmpty(PrimaryReadOutcome.QuorumNotMet) - .first() - .toSingle(); - - } - - private Single waitForReadBarrierAsync( - RxDocumentServiceRequest barrierRequest, - boolean allowPrimary, - final int readQuorum, - final long readBarrierLsn, - final long targetGlobalCommittedLSN, - ReadMode readMode) { - AtomicInteger readBarrierRetryCount = new AtomicInteger(maxNumberOfReadBarrierReadRetries); - AtomicInteger readBarrierRetryCountMultiRegion = new AtomicInteger(maxBarrierRetriesForMultiRegion); - - AtomicLong maxGlobalCommittedLsn = new AtomicLong(0); - - return Observable.defer(() -> { - - if (barrierRequest.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new GoneException()); - } - - Single> responsesObs = this.storeReader.readMultipleReplicaAsync( - barrierRequest, allowPrimary, readQuorum, - true /*required valid LSN*/, false /*useSessionToken*/, readMode, false /*checkMinLSN*/, true /*forceReadAll*/); - - return responsesObs.toObservable().flatMap( - responses -> { - - long maxGlobalCommittedLsnInResponses = responses.size() > 0 ? responses.stream() - .mapToLong(response -> response.globalCommittedLSN).max().getAsLong() : 0; - - - if ((responses.stream().filter(response -> response.lsn >= readBarrierLsn).count() >= readQuorum) && - (!(targetGlobalCommittedLSN > 0) || maxGlobalCommittedLsnInResponses >= targetGlobalCommittedLSN)) { - return Observable.just(true); - } - - maxGlobalCommittedLsn.set(maxGlobalCommittedLsn.get() > maxGlobalCommittedLsnInResponses ? - maxGlobalCommittedLsn.get() : maxGlobalCommittedLsnInResponses); - - //only refresh on first barrier call, set to false for subsequent attempts. - barrierRequest.requestContext.forceRefreshAddressCache = false; - - if (readBarrierRetryCount.decrementAndGet() == 0) { - logger.debug("QuorumReader: waitForReadBarrierAsync - Last barrier for single-region requests. Responses: {}", - JavaStreamUtils.toString(responses, "; ")); - - // retries exhausted - return Observable.just(false); - - } else { - // delay - //await Task.Delay(QuorumReader.delayBetweenReadBarrierCallsInMs); - return Observable.empty(); - - } - } - ); - }).repeatWhen(obs -> obs.flatMap(aVoid -> { - return Observable.timer(delayBetweenReadBarrierCallsInMs, TimeUnit.MILLISECONDS); - })) - .take(1) // Retry loop - .flatMap(barrierRequestSucceeded -> - Observable.defer(() -> { - - if (barrierRequestSucceeded) { - return Observable.just(true); - } - - // we will go into global strong read barrier mode for global strong requests after regular barrier calls have been exhausted. - if (targetGlobalCommittedLSN > 0) { - return Observable.defer(() -> { - - if (barrierRequest.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new GoneException()); - } - - Single> responsesObs = this.storeReader.readMultipleReplicaAsync( - barrierRequest, allowPrimary, readQuorum, - true /*required valid LSN*/, false /*useSessionToken*/, readMode, false /*checkMinLSN*/, true /*forceReadAll*/); - - return responsesObs.toObservable().flatMap( - responses -> { - long maxGlobalCommittedLsnInResponses = responses.size() > 0 ? responses.stream() - .mapToLong(response -> response.globalCommittedLSN).max().getAsLong() : 0; - - if ((responses.stream().filter(response -> response.lsn >= readBarrierLsn).count() >= readQuorum) && - maxGlobalCommittedLsnInResponses >= targetGlobalCommittedLSN) { - return Observable.just(true); - } - - maxGlobalCommittedLsn.set(maxGlobalCommittedLsn.get() > maxGlobalCommittedLsnInResponses ? - maxGlobalCommittedLsn.get() : maxGlobalCommittedLsnInResponses); - - //trace on last retry. - if (readBarrierRetryCountMultiRegion.getAndDecrement() == 0) { - logger.debug("QuorumReader: waitForReadBarrierAsync - Last barrier for mult-region strong requests. Responses: {}", - JavaStreamUtils.toString(responses, "; ")); - return Observable.just(false); - } else { - return Observable.empty(); - } - } - ); - - }).repeatWhen(obs -> obs.flatMap(aVoid -> { - - if ((maxBarrierRetriesForMultiRegion - readBarrierRetryCountMultiRegion.get()) > maxShortBarrierRetriesForMultiRegion) { - return Observable.timer(barrierRetryIntervalInMsForMultiRegion, TimeUnit.MILLISECONDS); - } else { - return Observable.timer(shortBarrierRetryIntervalInMsForMultiRegion, TimeUnit.MILLISECONDS); - } - - }) - // stop predicate, simulating while loop - ).take(1); - } - - return Observable.empty(); - })). - concatWith( - Observable.defer(() -> { - logger.debug("QuorumReader: waitForReadBarrierAsync - TargetGlobalCommittedLsn: {}, MaxGlobalCommittedLsn: {}.", targetGlobalCommittedLSN, maxGlobalCommittedLsn); - return Observable.just(false); - }) - ).take(1).toSingle(); - } - - private boolean isQuorumMet( - List readResponses, - int readQuorum, - boolean isPrimaryIncluded, - boolean isGlobalStrongRead, - ValueHolder readLsn, - ValueHolder globalCommittedLSN, - ValueHolder selectedResponse) { - long maxLsn = 0; - long minLsn = Long.MAX_VALUE; - int replicaCountMaxLsn = 0; - List validReadResponses = readResponses.stream().filter(response -> response.isValid).collect(Collectors.toList()); - int validResponsesCount = validReadResponses.size(); - - if (validResponsesCount == 0) { - readLsn.v = 0l; - globalCommittedLSN.v = -1l; - selectedResponse.v = null; - - return false; - } - - assert !validReadResponses.isEmpty(); - long numberOfReadRegions = validReadResponses.stream().map(res -> res.numberOfReadRegions).max(Comparator.naturalOrder()).get(); - boolean checkForGlobalStrong = isGlobalStrongRead && numberOfReadRegions > 0; - - // Pick any R replicas in the response and check if they are at the same LSN - for (StoreResult response : validReadResponses) { - if (response.lsn == maxLsn) { - replicaCountMaxLsn++; - } else if (response.lsn > maxLsn) { - replicaCountMaxLsn = 1; - maxLsn = response.lsn; - } - - if (response.lsn < minLsn) { - minLsn = response.lsn; - } - } - - final long maxLsnFinal = maxLsn; - selectedResponse.v = validReadResponses.stream().filter(s -> s.lsn == maxLsnFinal).findFirst().get(); - - readLsn.v = selectedResponse.v.itemLSN == -1 ? - maxLsn : Math.min(selectedResponse.v.itemLSN, maxLsn); - globalCommittedLSN.v = checkForGlobalStrong ? readLsn.v : -1l; - - long maxGlobalCommittedLSN = validReadResponses.stream().mapToLong(res -> res.globalCommittedLSN).max().getAsLong(); - - logger.debug("QuorumReader: MaxLSN {} ReplicaCountMaxLSN {} bCheckGlobalStrong {} MaxGlobalCommittedLSN {} NumberOfReadRegions {} SelectedResponseItemLSN {}", - maxLsn, replicaCountMaxLsn, checkForGlobalStrong, maxGlobalCommittedLSN, numberOfReadRegions, selectedResponse.v.itemLSN); - - // quorum is met if one of the following conditions are satisfied: - // 1. readLsn is greater than zero - // AND the number of responses that have the same LSN as the selected response is greater than or equal to the read quorum - // AND if applicable, the max GlobalCommittedLSN of all responses is greater than or equal to the lsn of the selected response. - - // 2. if the request is a point-read request, - // AND there are more than one response in the readResponses - // AND the LSN of the returned resource of the selected response is less than or equal to the minimum lsn of the all the responses, - // AND if applicable, the LSN of the returned resource of the selected response is less than or equal to the minimum globalCommittedLsn of all the responses. - // This means that the returned resource is old enough to have been committed by at least all the received responses, - // which should be larger than or equal to the read quorum, which therefore means we have strong consistency. - boolean isQuorumMet = false; - - if ((readLsn.v > 0 && replicaCountMaxLsn >= readQuorum) && - (!checkForGlobalStrong || maxGlobalCommittedLSN >= maxLsn)) { - isQuorumMet = true; - } - - if (!isQuorumMet && validResponsesCount >= readQuorum && selectedResponse.v.itemLSN != -1 && - (minLsn != Long.MAX_VALUE && selectedResponse.v.itemLSN <= minLsn) && - (!checkForGlobalStrong || (selectedResponse.v.itemLSN <= maxGlobalCommittedLSN))) { - isQuorumMet = true; - } - - return isQuorumMet; - } - - private enum ReadQuorumResultKind { - QuorumMet, - QuorumSelected, - QuorumNotSelected - } - - private abstract class ReadResult { - private final StoreResult response; - private final RequestChargeTracker requestChargeTracker; - - protected ReadResult(RequestChargeTracker requestChargeTracker, StoreResult response) { - this.requestChargeTracker = requestChargeTracker; - this.response = response; - } - - public StoreResponse getResponse() throws DocumentClientException { - if (!this.isValidResult()) { - logger.error("getResponse called for invalid result"); - throw new InternalServerErrorException(RMResources.InternalServerError); - } - - return this.response.toResponse(requestChargeTracker); - } - - protected abstract boolean isValidResult(); - } - - private class ReadQuorumResult extends ReadResult { - public ReadQuorumResult( - RequestChargeTracker requestChargeTracker, - ReadQuorumResultKind QuorumResult, - long selectedLsn, - long globalCommittedSelectedLsn, - StoreResult selectedResponse, - List storeResponses) { - super(requestChargeTracker, selectedResponse); - - this.quorumResult = QuorumResult; - this.selectedLsn = selectedLsn; - this.globalCommittedSelectedLsn = globalCommittedSelectedLsn; - this.selectedResponse = selectedResponse; - this.storeResponses = storeResponses; - } - - public final ReadQuorumResultKind quorumResult; - - /** - * Response selected to lock on the LSN. This is the response with the highest LSN - */ - public final StoreResult selectedResponse; - - /** - * All store responses from Quorum Read. - */ - public final List storeResponses; - - public final long selectedLsn; - - public final long globalCommittedSelectedLsn; - - protected boolean isValidResult() { - return this.quorumResult == ReadQuorumResultKind.QuorumMet || this.quorumResult == ReadQuorumResultKind.QuorumSelected; - } - } - - private class ReadPrimaryResult extends ReadResult { - public final boolean shouldRetryOnSecondary; - public final boolean isSuccessful; - - public ReadPrimaryResult(RequestChargeTracker requestChargeTracker, boolean isSuccessful, boolean shouldRetryOnSecondary, StoreResult response) { - super(requestChargeTracker, response); - this.isSuccessful = isSuccessful; - this.shouldRetryOnSecondary = shouldRetryOnSecondary; - } - - protected boolean isValidResult() { - return isSuccessful; - } - } - - private enum PrimaryReadOutcome { - QuorumNotMet, // Primary LSN is not committed. - QuorumInconclusive, // Secondary replicas are available. Must read R secondary's to deduce current quorum. - QuorumMet, - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReadMode.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReadMode.java deleted file mode 100644 index ebefc977a38b..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReadMode.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -public enum ReadMode { - Primary, // Test hook - Strong, - BoundedStaleness, - Any -} - diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClient.java deleted file mode 100644 index b8d116ef7408..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClient.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.time.Duration; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.ReplicatedResourceClientUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.Quadruple; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.BackoffRetryUtility; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Single; -import rx.functions.Func1; -import rx.functions.Func2; - -/** - * ReplicatedResourceClient uses the ConsistencyReader to make requests to - * backend - */ -public class ReplicatedResourceClient { - private final Logger logger = LoggerFactory.getLogger(ReplicatedResourceClient.class); - private static final int GONE_AND_RETRY_WITH_TIMEOUT_IN_SECONDS = 30; - private static final int STRONG_GONE_AND_RETRY_WITH_RETRY_TIMEOUT_SECONDS = 60; - private static final int MIN_BACKOFF_FOR_FAILLING_BACK_TO_OTHER_REGIONS_FOR_READ_REQUESTS_IN_SECONDS = 1; - - private final AddressSelector addressSelector; - private final ConsistencyReader consistencyReader; - private final ConsistencyWriter consistencyWriter; - private final Protocol protocol; - private final TransportClient transportClient; - private final boolean enableReadRequestsFallback; - private final GatewayServiceConfigurationReader serviceConfigReader; - private final Configs configs; - - public ReplicatedResourceClient( - Configs configs, - AddressSelector addressSelector, - ISessionContainer sessionContainer, - TransportClient transportClient, - GatewayServiceConfigurationReader serviceConfigReader, - IAuthorizationTokenProvider authorizationTokenProvider, - boolean enableReadRequestsFallback, - boolean useMultipleWriteLocations) { - this.configs = configs; - this.protocol = configs.getProtocol(); - this.addressSelector = addressSelector; - if (protocol != Protocol.Https && protocol != Protocol.Tcp) { - throw new IllegalArgumentException("protocol"); - } - - this.transportClient = transportClient; - this.serviceConfigReader = serviceConfigReader; - - this.consistencyReader = new ConsistencyReader(configs, - this.addressSelector, - sessionContainer, - transportClient, - serviceConfigReader, - authorizationTokenProvider); - this.consistencyWriter = new ConsistencyWriter( - this.addressSelector, - sessionContainer, - transportClient, - authorizationTokenProvider, - serviceConfigReader, - useMultipleWriteLocations); - this.enableReadRequestsFallback = enableReadRequestsFallback; - } - - public static boolean isReadingFromMaster(ResourceType resourceType, OperationType operationType) { - return ReplicatedResourceClientUtils.isReadingFromMaster(resourceType, operationType); - } - - public static boolean isMasterResource(ResourceType resourceType) { - return ReplicatedResourceClientUtils.isMasterResource(resourceType); - } - - public static boolean isGlobalStrongEnabled() { - return true; - } - - public Single invokeAsync(RxDocumentServiceRequest request, - Func1> prepareRequestAsyncDelegate) { - Func2, RxDocumentServiceRequest, Single> mainFuncDelegate = ( - Quadruple forceRefreshAndTimeout, - RxDocumentServiceRequest documentServiceRequest) -> { - documentServiceRequest.getHeaders().put(HttpConstants.HttpHeaders.CLIENT_RETRY_ATTEMPT_COUNT, - forceRefreshAndTimeout.getValue3().toString()); - documentServiceRequest.getHeaders().put(HttpConstants.HttpHeaders.REMAINING_TIME_IN_MS_ON_CLIENT_REQUEST, - Long.toString(forceRefreshAndTimeout.getValue2().toMillis())); - return invokeAsync(request, new TimeoutHelper(forceRefreshAndTimeout.getValue2()), - forceRefreshAndTimeout.getValue1(), forceRefreshAndTimeout.getValue0()); - - }; - Func1, Single> funcDelegate = ( - Quadruple forceRefreshAndTimeout) -> { - if (prepareRequestAsyncDelegate != null) { - return prepareRequestAsyncDelegate.call(request).flatMap(responseReq -> { - return mainFuncDelegate.call(forceRefreshAndTimeout, responseReq); - }); - } else { - return mainFuncDelegate.call(forceRefreshAndTimeout, request); - } - - }; - - Func1, Single> inBackoffFuncDelegate = null; - - // we will enable fallback to other regions if the following conditions are met: - // 1. request is a read operation AND - // 2. enableReadRequestsFallback is set to true. (can only ever be true if - // direct mode, on client) - if (request.isReadOnlyRequest() && this.enableReadRequestsFallback) { - if (request.requestContext.clientSideRequestStatistics == null) { - request.requestContext.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - RxDocumentServiceRequest freshRequest = request.clone(); - inBackoffFuncDelegate = (Quadruple forceRefreshAndTimeout) -> { - RxDocumentServiceRequest readRequestClone = freshRequest.clone(); - - if (prepareRequestAsyncDelegate != null) { - return prepareRequestAsyncDelegate.call(readRequestClone).flatMap(responseReq -> { - logger.trace(String.format("Executing inBackoffAlternateCallbackMethod on readRegionIndex {}", - forceRefreshAndTimeout.getValue3())); - responseReq.requestContext.RouteToLocation(forceRefreshAndTimeout.getValue3(), true); - return invokeAsync(responseReq, new TimeoutHelper(forceRefreshAndTimeout.getValue2()), - forceRefreshAndTimeout.getValue1(), - forceRefreshAndTimeout.getValue0()); - }); - } else { - logger.trace(String.format("Executing inBackoffAlternateCallbackMethod on readRegionIndex {}", - forceRefreshAndTimeout.getValue3())); - readRequestClone.requestContext.RouteToLocation(forceRefreshAndTimeout.getValue3(), true); - return invokeAsync(readRequestClone, new TimeoutHelper(forceRefreshAndTimeout.getValue2()), - forceRefreshAndTimeout.getValue1(), - forceRefreshAndTimeout.getValue0()); - } - - }; - } - - int retryTimeout = this.serviceConfigReader.getDefaultConsistencyLevel() == ConsistencyLevel.Strong ? - ReplicatedResourceClient.STRONG_GONE_AND_RETRY_WITH_RETRY_TIMEOUT_SECONDS : - ReplicatedResourceClient.GONE_AND_RETRY_WITH_TIMEOUT_IN_SECONDS; - - return BackoffRetryUtility.executeAsync(funcDelegate, new GoneAndRetryWithRetryPolicy(request, retryTimeout), - inBackoffFuncDelegate, Duration.ofSeconds( - ReplicatedResourceClient.MIN_BACKOFF_FOR_FAILLING_BACK_TO_OTHER_REGIONS_FOR_READ_REQUESTS_IN_SECONDS)); - } - - private Single invokeAsync(RxDocumentServiceRequest request, TimeoutHelper timeout, - boolean isInRetry, boolean forceRefresh) { - - if (request.getOperationType().equals(OperationType.ExecuteJavaScript)) { - if (request.isReadOnlyScript()) { - return this.consistencyReader.readAsync(request, timeout, isInRetry, forceRefresh); - } else { - return this.consistencyWriter.writeAsync(request, timeout, forceRefresh); - } - } else if (request.getOperationType().isWriteOperation()) { - return this.consistencyWriter.writeAsync(request, timeout, forceRefresh); - } else if (request.isReadOnlyRequest()) { - return this.consistencyReader.readAsync(request, timeout, isInRetry, forceRefresh); - } else { - throw new IllegalArgumentException( - String.format("Unexpected operation type %s", request.getOperationType())); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestEntityTooLargeException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestEntityTooLargeException.java deleted file mode 100644 index 1c8a33835e5e..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestEntityTooLargeException.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class RequestEntityTooLargeException extends DocumentClientException { - private static final long serialVersionUID = 1L; - - public RequestEntityTooLargeException() { - this(RMResources.RequestEntityTooLarge); - } - - public RequestEntityTooLargeException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.REQUEST_ENTITY_TOO_LARGE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public RequestEntityTooLargeException(String msg) { - super(HttpConstants.StatusCodes.REQUEST_ENTITY_TOO_LARGE, msg); - } - - public RequestEntityTooLargeException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.REQUEST_ENTITY_TOO_LARGE, resourceAddress); - } - - public RequestEntityTooLargeException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public RequestEntityTooLargeException(Exception innerException) { - this(RMResources.RequestEntityTooLarge, innerException, null, null); - } - - public RequestEntityTooLargeException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format(RMResources.RequestEntityTooLarge, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.REQUEST_ENTITY_TOO_LARGE, - requestUri); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestHelper.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestHelper.java deleted file mode 100644 index 5eb93d0acd8a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestHelper.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.EnumUtils; - -public class RequestHelper { - public static ConsistencyLevel GetConsistencyLevelToUse(GatewayServiceConfigurationReader serviceConfigReader, - RxDocumentServiceRequest request) throws DocumentClientException { - ConsistencyLevel consistencyLevelToUse = serviceConfigReader.getDefaultConsistencyLevel(); - - String requestConsistencyLevelHeaderValue = request.getHeaders().get(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL); - - if (!Strings.isNullOrEmpty(requestConsistencyLevelHeaderValue)) { - ConsistencyLevel requestConsistencyLevel = EnumUtils.getEnum(ConsistencyLevel.class, requestConsistencyLevelHeaderValue); - if (requestConsistencyLevel == null) { - throw new BadRequestException( - String.format( - RMResources.InvalidHeaderValue, - requestConsistencyLevelHeaderValue, - HttpConstants.HttpHeaders.CONSISTENCY_LEVEL)); - } - - consistencyLevelToUse = requestConsistencyLevel; - } - - return consistencyLevelToUse; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestRateTooLargeException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestRateTooLargeException.java deleted file mode 100644 index 1d5c315bade1..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestRateTooLargeException.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class RequestRateTooLargeException extends DocumentClientException { - - public RequestRateTooLargeException() { - this(RMResources.TooManyRequests, null); - } - - public RequestRateTooLargeException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.NOTFOUND, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public RequestRateTooLargeException(String message, URI requestUri) { - this(message, (Exception) null, (HttpResponseHeaders) null, requestUri); - } - - public RequestRateTooLargeException(String message, - Exception innerException, - URI requestUri) { - this(message, innerException, (HttpResponseHeaders) null, requestUri); - } - - public RequestRateTooLargeException(Exception innerException) { - this(RMResources.TooManyRequests, innerException, (HttpResponseHeaders) null, null); - } - - public RequestRateTooLargeException(String message, HttpResponseHeaders headers, URI requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.TOO_MANY_REQUESTS, requestUri != null ? requestUri.toString() : null); - } - - public RequestRateTooLargeException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.TOO_MANY_REQUESTS, requestUri); - } - - public RequestRateTooLargeException(String message, - Exception innerException, - HttpResponseHeaders headers, - URI requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.TOO_MANY_REQUESTS, requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResourceOperation.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResourceOperation.java deleted file mode 100644 index e51367dea91d..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResourceOperation.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; - -public class ResourceOperation { - public final OperationType operationType; - public final ResourceType resourceType; - - public ResourceOperation( - OperationType operationType, - ResourceType resourceType) { - this.operationType = operationType; - this.resourceType = resourceType; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResponseUtils.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResponseUtils.java deleted file mode 100644 index c37c7bef907a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResponseUtils.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; - -class ResponseUtils { - private final static int INITIAL_RESPONSE_BUFFER_SIZE = 1024; - private final static Logger logger = LoggerFactory.getLogger(ResponseUtils.class); - - public static Observable toString(Observable contentObservable) { - return contentObservable - .reduce( - new ByteArrayOutputStream(INITIAL_RESPONSE_BUFFER_SIZE), - (out, bb) -> { - try { - bb.readBytes(out, bb.readableBytes()); - return out; - } catch (IOException e) { - throw new RuntimeException(e); - } - }) - .map(out -> { - return new String(out.toByteArray(), StandardCharsets.UTF_8); - }); - } - - public static Single toStoreResponse(HttpClientResponse clientResponse) { - - HttpResponseHeaders httpResponseHeaders = clientResponse.getHeaders(); - HttpResponseStatus httpResponseStatus = clientResponse.getStatus(); - - Observable contentObservable; - - if (clientResponse.getContent() == null) { - // for delete we don't expect any body - contentObservable = Observable.just(null); - } else { - // transforms the observable to Observable - contentObservable = toString(clientResponse.getContent()); - } - - Observable storeResponseObservable = contentObservable - .flatMap(content -> { - try { - // transforms to Observable - StoreResponse rsp = new StoreResponse(httpResponseStatus.code(), HttpUtils.unescape(httpResponseHeaders.entries()), content); - return Observable.just(rsp); - } catch (Exception e) { - return Observable.error(e); - } - }); - - return storeResponseObservable.toSingle(); - } - - private static void validateOrThrow(RxDocumentServiceRequest request, HttpResponseStatus status, HttpResponseHeaders headers, String body, - InputStream inputStream) throws DocumentClientException { - - int statusCode = status.code(); - - if (statusCode >= HttpConstants.StatusCodes.MINIMUM_STATUSCODE_AS_ERROR_GATEWAY) { - if (body == null && inputStream != null) { - try { - body = IOUtils.toString(inputStream, StandardCharsets.UTF_8); - } catch (IOException e) { - logger.error("Failed to get content from the http response", e); - throw new IllegalStateException("Failed to get content from the http response", e); - } finally { - IOUtils.closeQuietly(inputStream); - } - } - - String statusCodeString = status.reasonPhrase() != null - ? status.reasonPhrase().replace(" ", "") - : ""; - Error error = null; - error = (body != null) ? new Error(body) : new Error(); - error = new Error(statusCodeString, - String.format("%s, StatusCode: %s", error.getMessage(), statusCodeString), - error.getPartitionedQueryExecutionInfo()); - - throw new DocumentClientException(statusCode, error, HttpUtils.asMap(headers)); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RetryWithException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RetryWithException.java deleted file mode 100644 index df32963da686..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RetryWithException.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class RetryWithException extends DocumentClientException { - - public RetryWithException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.RETRY_WITH, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public RetryWithException(String message, URI requestUri) { - this(message, (Exception) null, (HttpResponseHeaders) null, requestUri); - } - - public RetryWithException(String message, - Exception innerException, - URI requestUri) { - this(message, innerException, (HttpResponseHeaders) null, requestUri); - } - - public RetryWithException(String message, HttpResponseHeaders headers, URI requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.RETRY_WITH, requestUri != null ? requestUri.toString() : null); - } - - public RetryWithException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.RETRY_WITH, requestUri); - } - - public RetryWithException(String message, - Exception innerException, - HttpResponseHeaders headers, - URI requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.RETRY_WITH, requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClient.java deleted file mode 100644 index adec62b59bef..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClient.java +++ /dev/null @@ -1,393 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdEndpoint; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdMetrics; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdObjectMapper; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestArgs; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdServiceEndpoint; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.handler.ssl.SslContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; -import rx.SingleEmitter; - -import java.io.IOException; -import java.net.URI; -import java.time.Duration; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless; - -@JsonSerialize(using = RntbdTransportClient.JsonSerializer.class) -public final class RntbdTransportClient extends TransportClient implements AutoCloseable { - - // region Fields - - private static final AtomicLong instanceCount = new AtomicLong(); - private static final Logger logger = LoggerFactory.getLogger(RntbdTransportClient.class); - private static final String namePrefix = RntbdTransportClient.class.getSimpleName() + '-'; - - private final AtomicBoolean closed = new AtomicBoolean(); - private final RntbdEndpoint.Provider endpointProvider; - private final RntbdMetrics metrics; - private final String name; - - // endregion - - // region Constructors - - RntbdTransportClient(final RntbdEndpoint.Provider endpointProvider) { - this.name = RntbdTransportClient.namePrefix + RntbdTransportClient.instanceCount.incrementAndGet(); - this.endpointProvider = endpointProvider; - this.metrics = new RntbdMetrics(this.name); - } - - RntbdTransportClient(final Options options, final SslContext sslContext) { - this(new RntbdServiceEndpoint.Provider(options, sslContext)); - } - - RntbdTransportClient(final Configs configs, final int requestTimeoutInSeconds, final UserAgentContainer userAgent) { - this(new Options.Builder(requestTimeoutInSeconds).userAgent(userAgent).build(), configs.getSslContext()); - } - - // endregion - - // region Methods - - @Override - public void close() { - - logger.debug("\n [{}] CLOSE", this); - - if (this.closed.compareAndSet(false, true)) { - this.endpointProvider.close(); - this.metrics.close(); - return; - } - - logger.debug("\n [{}]\n already closed", this); - } - - @Override - public Single invokeStoreAsync( - final URI physicalAddress, final ResourceOperation unused, final RxDocumentServiceRequest request - ) { - checkNotNull(physicalAddress, "physicalAddress"); - checkNotNull(request, "request"); - this.throwIfClosed(); - - final RntbdRequestArgs requestArgs = new RntbdRequestArgs(request, physicalAddress); - - if (logger.isDebugEnabled()) { - requestArgs.traceOperation(logger, null, "invokeStoreAsync"); - logger.debug("\n [{}]\n {}\n INVOKE_STORE_ASYNC", this, requestArgs); - } - - final RntbdEndpoint endpoint = this.endpointProvider.get(physicalAddress); - this.metrics.incrementRequestCount(); - - final CompletableFuture future = endpoint.request(requestArgs); - - return Single.fromEmitter((SingleEmitter emitter) -> { - - future.whenComplete((response, error) -> { - - requestArgs.traceOperation(logger, null, "emitSingle", response, error); - this.metrics.incrementResponseCount(); - - if (error == null) { - emitter.onSuccess(response); - } else { - if (!(error instanceof DocumentClientException)) { - logger.warn("{} expected failure of {}, not ", requestArgs, DocumentClientException.class, error); - } - this.metrics.incrementErrorResponseCount(); - emitter.onError(error instanceof CompletionException ? error.getCause() : error); - } - - requestArgs.traceOperation(logger, null, "emitSingleComplete"); - }); - }); - } - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - - private void throwIfClosed() { - checkState(!this.closed.get(), "%s is closed", this); - } - - // endregion - - // region Types - - static final class JsonSerializer extends StdSerializer { - - public JsonSerializer() { - this(null); - } - - public JsonSerializer(Class type) { - super(type); - } - - @Override - public void serialize(RntbdTransportClient value, JsonGenerator generator, SerializerProvider provider) throws IOException { - - generator.writeStartObject(); - - generator.writeArrayFieldStart(value.name); - - value.endpointProvider.list().forEach(endpoint -> { - try { - generator.writeObject(endpoint); - } catch (IOException error) { - logger.error("failed to serialize {} due to ", endpoint.getName(), error); - } - }); - - generator.writeEndArray(); - - generator.writeObjectField("config", value.endpointProvider.config()); - generator.writeObjectField("metrics", value.metrics); - generator.writeEndObject(); - } - } - - public static final class Options { - - // region Fields - - private final String certificateHostNameOverride; - private final int maxChannelsPerEndpoint; - private final int maxRequestsPerChannel; - private final Duration connectionTimeout; - private final int partitionCount; - private final Duration receiveHangDetectionTime; - private final Duration requestTimeout; - private final Duration sendHangDetectionTime; - private final UserAgentContainer userAgent; - - // endregion - - // region Constructors - - private Options(Builder builder) { - - this.certificateHostNameOverride = builder.certificateHostNameOverride; - this.maxChannelsPerEndpoint = builder.maxChannelsPerEndpoint; - this.maxRequestsPerChannel = builder.maxRequestsPerChannel; - this.connectionTimeout = builder.connectionTimeout == null ? builder.requestTimeout : builder.connectionTimeout; - this.partitionCount = builder.partitionCount; - this.requestTimeout = builder.requestTimeout; - this.receiveHangDetectionTime = builder.receiveHangDetectionTime; - this.sendHangDetectionTime = builder.sendHangDetectionTime; - this.userAgent = builder.userAgent; - } - - // endregion - - // region Accessors - - public String getCertificateHostNameOverride() { - return this.certificateHostNameOverride; - } - - public int getMaxChannelsPerEndpoint() { - return this.maxChannelsPerEndpoint; - } - - public int getMaxRequestsPerChannel() { - return this.maxRequestsPerChannel; - } - - public Duration getConnectionTimeout() { - return this.connectionTimeout; - } - - public int getPartitionCount() { - return this.partitionCount; - } - - public Duration getReceiveHangDetectionTime() { - return this.receiveHangDetectionTime; - } - - public Duration getRequestTimeout() { - return this.requestTimeout; - } - - public Duration getSendHangDetectionTime() { - return this.sendHangDetectionTime; - } - - public UserAgentContainer getUserAgent() { - return this.userAgent; - } - - // endregion - - // region Methods - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - - // endregion - - // region Types - - public static class Builder { - - // region Fields - - private static final UserAgentContainer DEFAULT_USER_AGENT_CONTAINER = new UserAgentContainer(); - private static final Duration SIXTY_FIVE_SECONDS = Duration.ofSeconds(65L); - private static final Duration TEN_SECONDS = Duration.ofSeconds(10L); - - // Required parameters - - private String certificateHostNameOverride = null; - - // Optional parameters - - private int maxChannelsPerEndpoint = 10; - private int maxRequestsPerChannel = 30; - private Duration connectionTimeout = null; - private int partitionCount = 1; - private Duration receiveHangDetectionTime = SIXTY_FIVE_SECONDS; - private Duration requestTimeout; - private Duration sendHangDetectionTime = TEN_SECONDS; - private UserAgentContainer userAgent = DEFAULT_USER_AGENT_CONTAINER; - - // endregion - - // region Constructors - - public Builder(Duration requestTimeout) { - this.requestTimeout(requestTimeout); - } - - public Builder(int requestTimeoutInSeconds) { - this(Duration.ofSeconds(requestTimeoutInSeconds)); - } - - // endregion - - // region Methods - - public Options build() { - return new Options(this); - } - - public Builder certificateHostNameOverride(final String value) { - this.certificateHostNameOverride = value; - return this; - } - - public Builder connectionTimeout(final Duration value) { - checkArgument(value == null || value.compareTo(Duration.ZERO) > 0, "value: %s", value); - this.connectionTimeout = value; - return this; - } - - public Builder maxRequestsPerChannel(final int value) { - checkArgument(value > 0, "value: %s", value); - this.maxRequestsPerChannel = value; - return this; - } - - public Builder maxChannelsPerEndpoint(final int value) { - checkArgument(value > 0, "value: %s", value); - this.maxChannelsPerEndpoint = value; - return this; - } - - public Builder partitionCount(final int value) { - checkArgument(value > 0, "value: %s", value); - this.partitionCount = value; - return this; - } - - public Builder receiveHangDetectionTime(final Duration value) { - - checkNotNull(value, "value: null"); - checkArgument(value.compareTo(Duration.ZERO) > 0, "value: %s", value); - - this.receiveHangDetectionTime = value; - return this; - } - - public Builder requestTimeout(final Duration value) { - - checkNotNull(value, "value: null"); - checkArgument(value.compareTo(Duration.ZERO) > 0, "value: %s", value); - - this.requestTimeout = value; - return this; - } - - public Builder sendHangDetectionTime(final Duration value) { - - checkNotNull(value, "value: null"); - checkArgument(value.compareTo(Duration.ZERO) > 0, "value: %s", value); - - this.sendHangDetectionTime = value; - return this; - } - - public Builder userAgent(final UserAgentContainer value) { - checkNotNull(value, "value: null"); - this.userAgent = value; - return this; - } - - // endregion - } - - // endregion - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerProperties.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerProperties.java deleted file mode 100644 index d8a84ba78d61..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerProperties.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -final public class ServerProperties { - - final private String agent, version; - - public ServerProperties(String agent, String version) { - this.agent = agent; - this.version = version; - } - - public String getAgent() { - return this.agent; - } - - public String getVersion() { - return this.version; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerStoreModel.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerStoreModel.java deleted file mode 100644 index c21ad28d13e0..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerStoreModel.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.RxStoreModel; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.EnumUtils; -import rx.Observable; -import rx.Single; - -public class ServerStoreModel implements RxStoreModel { - private final StoreClient storeClient; - - public ServerStoreModel(StoreClient storeClient) { - this.storeClient = storeClient; - } - - public Observable processMessage(RxDocumentServiceRequest request) { - String requestConsistencyLevelHeaderValue = request.getHeaders().get(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL); - - request.requestContext.originalRequestConsistencyLevel = null; - - if (!Strings.isNullOrEmpty(requestConsistencyLevelHeaderValue)) { - ConsistencyLevel requestConsistencyLevel; - - if ((requestConsistencyLevel = EnumUtils.getEnum(ConsistencyLevel.class, requestConsistencyLevelHeaderValue)) == null) { - return Observable.error(new BadRequestException( - String.format( - RMResources.InvalidHeaderValue, - requestConsistencyLevelHeaderValue, - HttpConstants.HttpHeaders.CONSISTENCY_LEVEL))); - } - - request.requestContext.originalRequestConsistencyLevel = requestConsistencyLevel; - } - - if (ReplicatedResourceClient.isMasterResource(request.getResourceType())) { - request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Strong.toString()); - } - - Single response = this.storeClient.processMessageAsync(request); - return response.toObservable(); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceConfig.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceConfig.java deleted file mode 100644 index 25ae57544ce5..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -class ServiceConfig { - final static ServiceConfig instance = new ServiceConfig(); - public SystemReplicationPolicy systemReplicationPolicy = new SystemReplicationPolicy(); - public SystemReplicationPolicy userReplicationPolicy = new SystemReplicationPolicy(); - - public static ServiceConfig getInstance() { - return instance; - } - - class SystemReplicationPolicy { - public static final int MaxReplicaSetSize = 4; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceUnavailableException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceUnavailableException.java deleted file mode 100644 index e028912a9068..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceUnavailableException.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class ServiceUnavailableException extends DocumentClientException { - public ServiceUnavailableException() { - this(RMResources.ServiceUnavailable); - } - - public ServiceUnavailableException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.NOTFOUND, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public ServiceUnavailableException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public ServiceUnavailableException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public ServiceUnavailableException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public ServiceUnavailableException(Exception innerException) { - this(RMResources.ServiceUnavailable, innerException, null, null); - } - - public ServiceUnavailableException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.ServiceUnavailable, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.SERVICE_UNAVAILABLE, - requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClient.java deleted file mode 100644 index f51634e9a31c..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClient.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.internal.SessionTokenHelper; -import com.microsoft.azure.cosmosdb.rx.internal.BackoffRetryUtility; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.lang3.math.NumberUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; -import rx.functions.Func0; -import rx.functions.Func1; - -import java.util.HashMap; -import java.util.Map; - -/** - * Instantiated to issue direct connectivity requests to the backend on: - * - Gateway (for gateway mode clients) - * - Client (for direct mode clients) - * StoreClient uses the ReplicatedResourceClient to make requests to the backend. - */ -public class StoreClient implements IStoreClient { - private final Logger logger = LoggerFactory.getLogger(StoreClient.class); - private final GatewayServiceConfigurationReader serviceConfigurationReader; - - private final SessionContainer sessionContainer; - private final ReplicatedResourceClient replicatedResourceClient; - private final TransportClient transportClient; - private final String ZERO_PARTITION_KEY_RANGE = "0"; - - public StoreClient( - Configs configs, - IAddressResolver addressResolver, - SessionContainer sessionContainer, - GatewayServiceConfigurationReader serviceConfigurationReader, IAuthorizationTokenProvider userTokenProvider, - TransportClient transportClient, - boolean useMultipleWriteLocations) { - this.transportClient = transportClient; - this.sessionContainer = sessionContainer; - this.serviceConfigurationReader = serviceConfigurationReader; - this.replicatedResourceClient = new ReplicatedResourceClient( - configs, - new AddressSelector(addressResolver, configs.getProtocol()), - sessionContainer, - this.transportClient, - serviceConfigurationReader, - userTokenProvider, - false, - useMultipleWriteLocations); - } - - @Override - public Single processMessageAsync(RxDocumentServiceRequest request, IRetryPolicy retryPolicy, Func1> prepareRequestAsyncDelegate) { - if (request == null) { - throw new NullPointerException("request"); - } - - Func0> storeResponseDelegate = () -> this.replicatedResourceClient.invokeAsync(request, prepareRequestAsyncDelegate); - - Single storeResponse = retryPolicy != null - ? BackoffRetryUtility.executeRetry(storeResponseDelegate, retryPolicy) - : storeResponseDelegate.call(); - - storeResponse = storeResponse.doOnError(e -> { - try { - DocumentClientException exception = Utils.as(e, DocumentClientException.class); - - if (exception == null) { - return; - } - - exception.setClientSideRequestStatistics(request.requestContext.clientSideRequestStatistics); - - handleUnsuccessfulStoreResponse(request, exception); - } catch (Throwable throwable) { - logger.error("Unexpected failure in handling orig [{}]", e.getMessage(), e); - logger.error("Unexpected failure in handling orig [{}] : new [{}]", e.getMessage(), throwable.getMessage(), throwable); - } - } - ); - - return storeResponse.flatMap(sr -> { - try { - return Single.just(this.completeResponse(sr, request)); - } catch (Exception e) { - return Single.error(e); - } - }); - } - - private void handleUnsuccessfulStoreResponse(RxDocumentServiceRequest request, DocumentClientException exception) { - this.updateResponseHeader(request, exception.getResponseHeaders()); - if ((!ReplicatedResourceClient.isMasterResource(request.getResourceType())) && - (Exceptions.isStatusCode(exception, HttpConstants.StatusCodes.PRECONDITION_FAILED) || Exceptions.isStatusCode(exception, HttpConstants.StatusCodes.CONFLICT) || - (Exceptions.isStatusCode(exception, HttpConstants.StatusCodes.NOTFOUND) && - !Exceptions.isSubStatusCode(exception, HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)))) { - this.captureSessionToken(request, exception.getResponseHeaders()); - } - } - - private RxDocumentServiceResponse completeResponse( - StoreResponse storeResponse, - RxDocumentServiceRequest request) throws InternalServerErrorException { - if (storeResponse.getResponseHeaderNames().length != storeResponse.getResponseHeaderValues().length) { - throw new InternalServerErrorException(RMResources.InvalidBackendResponse); - } - - Map headers = new HashMap<>(storeResponse.getResponseHeaderNames().length); - for (int idx = 0; idx < storeResponse.getResponseHeaderNames().length; idx++) { - String name = storeResponse.getResponseHeaderNames()[idx]; - String value = storeResponse.getResponseHeaderValues()[idx]; - - headers.put(name, value); - } - - this.updateResponseHeader(request, headers); - this.captureSessionToken(request, headers); - storeResponse.setClientSideRequestStatistics(request.requestContext.clientSideRequestStatistics); - return new RxDocumentServiceResponse(storeResponse); - } - - private long getLSN(Map headers) { - long defaultValue = -1; - String value = headers.get(WFConstants.BackendHeaders.LSN); - - if (!Strings.isNullOrEmpty(value)) { - return NumberUtils.toLong(value, defaultValue); - - } - - return defaultValue; - } - - private void updateResponseHeader(RxDocumentServiceRequest request, Map headers) { - String requestConsistencyLevel = request.getHeaders().get(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL); - - boolean sessionConsistency = - this.serviceConfigurationReader.getDefaultConsistencyLevel() == ConsistencyLevel.Session || - (!Strings.isNullOrEmpty(requestConsistencyLevel) - && Strings.areEqualIgnoreCase(requestConsistencyLevel, ConsistencyLevel.Session.name())); - - long storeLSN = this.getLSN(headers); - if (storeLSN == -1) { - return; - } - - String partitionKeyRangeId = headers.get(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID); - - if (Strings.isNullOrEmpty(partitionKeyRangeId)) { - String inputSession = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (!Strings.isNullOrEmpty(inputSession) - && inputSession.indexOf(ISessionToken.PARTITION_KEY_RANGE_SESSION_SEPARATOR) >= 1) { - partitionKeyRangeId = inputSession.substring(0, - inputSession.indexOf(ISessionToken.PARTITION_KEY_RANGE_SESSION_SEPARATOR)); - } else { - partitionKeyRangeId = ZERO_PARTITION_KEY_RANGE; - } - } - - ISessionToken sessionToken = null; - String sessionTokenResponseHeader = headers.get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (!Strings.isNullOrEmpty(sessionTokenResponseHeader)) { - sessionToken = SessionTokenHelper.parse(sessionTokenResponseHeader); - } - - if (sessionToken != null) { - headers.put(HttpConstants.HttpHeaders.SESSION_TOKEN, String.format( - "%s:%s", - partitionKeyRangeId, - sessionToken.convertToString())); - } - - headers.remove(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID); - } - - private void captureSessionToken(RxDocumentServiceRequest request, Map headers) { - if (request.getResourceType() == ResourceType.DocumentCollection - && request.getOperationType() == OperationType.Delete) { - String resourceId; - if (request.getIsNameBased()) { - resourceId = headers.get(HttpConstants.HttpHeaders.OWNER_ID); - } else { - resourceId = request.getResourceId(); - } - this.sessionContainer.clearTokenByResourceId(resourceId); - } else { - this.sessionContainer.setSessionToken(request, headers); - } - } - - // TODO RNTBD support - // https://msdata.visualstudio.com/CosmosDB/SDK/_workitems/edit/262496 -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClientFactory.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClientFactory.java deleted file mode 100644 index 7409f7f8e005..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClientFactory.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; - -// TODO: DANOBLE: no support for ICommunicationEventSource ask Ji -// Links: -// https://msdata.visualstudio.com/CosmosDB/SDK/_workitems/edit/262496 - -public class StoreClientFactory implements AutoCloseable { - private final Configs configs; - private final int maxConcurrentConnectionOpenRequests; - private final int requestTimeoutInSeconds; - private final Protocol protocol; - private final TransportClient transportClient; - private volatile boolean isClosed; - - public StoreClientFactory( - Configs configs, - int requestTimeoutInSeconds, - int maxConcurrentConnectionOpenRequests, - UserAgentContainer userAgent) { - - this.configs = configs; - this.protocol = configs.getProtocol(); - this.requestTimeoutInSeconds = requestTimeoutInSeconds; - this.maxConcurrentConnectionOpenRequests = maxConcurrentConnectionOpenRequests; - - if (protocol == Protocol.Https) { - this.transportClient = new HttpTransportClient(configs, requestTimeoutInSeconds, userAgent); - } else if (protocol == Protocol.Tcp){ - this.transportClient = new RntbdTransportClient(configs, requestTimeoutInSeconds, userAgent); - } else { - throw new IllegalArgumentException(String.format("protocol: %s", this.protocol)); - } - } - - public void close() throws Exception { - this.transportClient.close(); - this.isClosed = true; - } - - // TODO wew don't have support for the following yet - // TODO enableReadRequestsFallback ask Ji - // TODO useFallbackClient ask Ji - public StoreClient createStoreClient( - IAddressResolver addressResolver, - SessionContainer sessionContainer, - GatewayServiceConfigurationReader serviceConfigurationReader, - IAuthorizationTokenProvider authorizationTokenProvider, - boolean useMultipleWriteLocations) { - this.throwIfClosed(); - - return new StoreClient(configs, - addressResolver, - sessionContainer, - serviceConfigurationReader, - authorizationTokenProvider, - this.transportClient, - useMultipleWriteLocations); - } - - private void throwIfClosed() { - if (isClosed) { - throw new IllegalStateException("storeClient already closed!"); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReader.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReader.java deleted file mode 100644 index b9d92218f315..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReader.java +++ /dev/null @@ -1,896 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.Integers; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.MutableVolatile; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.SessionTokenHelper; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; -import rx.exceptions.CompositeException; -import rx.schedulers.Schedulers; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -import static com.microsoft.azure.cosmosdb.rx.internal.Exceptions.isSubStatusCode; - -public class StoreReader { - private final Logger logger = LoggerFactory.getLogger(StoreReader.class); - private final TransportClient transportClient; - private final AddressSelector addressSelector; - private final ISessionContainer sessionContainer; - private String lastReadAddress; - - public StoreReader( - TransportClient transportClient, - AddressSelector addressSelector, - ISessionContainer sessionContainer) { - this.transportClient = transportClient; - this.addressSelector = addressSelector; - this.sessionContainer = sessionContainer; - } - - public Single> readMultipleReplicaAsync( - RxDocumentServiceRequest entity, - boolean includePrimary, - int replicaCountToRead, - boolean requiresValidLsn, - boolean useSessionToken, - ReadMode readMode) { - return readMultipleReplicaAsync(entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode, false, false); - } - - /** - * Makes requests to multiple replicas at once and returns responses - * @param entity RxDocumentServiceRequest - * @param includePrimary flag to indicate whether to indicate primary replica in the reads - * @param replicaCountToRead number of replicas to read from - * @param requiresValidLsn flag to indicate whether a valid lsn is required to consider a response as valid - * @param useSessionToken flag to indicate whether to use session token - * @param readMode Read mode - * @param checkMinLSN set minimum required session lsn - * @param forceReadAll reads from all available replicas to gather result from readsToRead number of replicas - * @return ReadReplicaResult which indicates the LSN and whether Quorum was Met / Not Met etc - */ - public Single> readMultipleReplicaAsync( - RxDocumentServiceRequest entity, - boolean includePrimary, - int replicaCountToRead, - boolean requiresValidLsn, - boolean useSessionToken, - ReadMode readMode, - boolean checkMinLSN, - boolean forceReadAll) { - - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - String originalSessionToken = entity.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - - if (entity.requestContext.clientSideRequestStatistics == null) { - entity.requestContext.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - - Single readQuorumResultObs = this.readMultipleReplicasInternalAsync( - entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode, checkMinLSN, forceReadAll); - - return readQuorumResultObs.flatMap(readQuorumResult -> { - if (entity.requestContext.performLocalRefreshOnGoneException && - readQuorumResult.retryWithForceRefresh && - !entity.requestContext.forceRefreshAddressCache) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - entity.requestContext.forceRefreshAddressCache = true; - - return this.readMultipleReplicasInternalAsync( - entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode, false /*checkMinLSN*/, forceReadAll) - .map(r -> r.responses); - } else { - return Single.just(readQuorumResult.responses); - } - }).toObservable().doAfterTerminate(() -> { - SessionTokenHelper.setOriginalSessionToken(entity, originalSessionToken); - }).toSingle(); - } - - private Observable earlyResultIfNotEnoughReplicas(List replicaAddresses, - RxDocumentServiceRequest request, - int replicaCountToRead) { - if (replicaAddresses.size() < replicaCountToRead) { - // if not enough replicas, return ReadReplicaResult - if (!request.requestContext.forceRefreshAddressCache) { - return Observable.just(new ReadReplicaResult(true /*retryWithForceRefresh*/, Collections.emptyList())); - } else { - return Observable.just(new ReadReplicaResult(false /*retryWithForceRefresh*/, Collections.emptyList())); - } - } else { - // if there are enough replicas, move on - return Observable.empty(); - } - } - - private Observable toStoreResult(RxDocumentServiceRequest request, - Pair, URI> storeRespAndURI, - ReadMode readMode, - boolean requiresValidLsn) { - - return storeRespAndURI.getLeft() - .flatMap(storeResponse -> { - try { - StoreResult storeResult = this.createStoreResult( - storeResponse, - null, requiresValidLsn, - readMode != ReadMode.Strong, - storeRespAndURI.getRight()); - - request.requestContext.clientSideRequestStatistics.getContactedReplicas().add(storeRespAndURI.getRight()); - return Observable.just(storeResult); - } catch (Exception e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Observable.error(e); - } - } - ).onErrorResumeNext(t -> { - - try { - logger.debug("Exception {} is thrown while doing readMany", t); - Exception storeException = Utils.as(t, Exception.class); - if (storeException == null) { - return Observable.error(t); - } - -// Exception storeException = readTask.Exception != null ? readTask.Exception.InnerException : null; - StoreResult storeResult = this.createStoreResult( - null, - storeException, requiresValidLsn, - readMode != ReadMode.Strong, - null); - if (storeException instanceof TransportException) { - request.requestContext.clientSideRequestStatistics.getFailedReplicas().add(storeRespAndURI.getRight()); - } - return Observable.just(storeResult); - } catch (Exception e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Observable.error(e); - } - }); - } - - private Observable> readFromReplicas(List resultCollector, - List resolveApiResults, - final AtomicInteger replicasToRead, - RxDocumentServiceRequest entity, - boolean includePrimary, - int replicaCountToRead, - boolean requiresValidLsn, - boolean useSessionToken, - ReadMode readMode, - boolean checkMinLSN, - boolean forceReadAll, - final MutableVolatile requestSessionToken, - final MutableVolatile hasGoneException, - boolean enforceSessionCheck, - final MutableVolatile shortCircut) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new GoneException()); - } - List, URI>> readStoreTasks = new ArrayList<>(); - int uriIndex = StoreReader.generateNextRandom(resolveApiResults.size()); - - while (resolveApiResults.size() > 0) { - uriIndex = uriIndex % resolveApiResults.size(); - URI uri = resolveApiResults.get(uriIndex); - Pair, URI> res; - try { - res = this.readFromStoreAsync(resolveApiResults.get(uriIndex), - entity); - - } catch (Exception e) { - res = Pair.of(Single.error(e), uri); - } - - readStoreTasks.add(Pair.of(res.getLeft().toObservable(), res.getRight())); - resolveApiResults.remove(uriIndex); - - - if (!forceReadAll && readStoreTasks.size() == replicasToRead.get()) { - break; - } - } - - replicasToRead.set(readStoreTasks.size() >= replicasToRead.get() ? 0 : replicasToRead.get() - readStoreTasks.size()); - - - List> storeResult = readStoreTasks - .stream() - .map(item -> toStoreResult(entity, item, readMode, requiresValidLsn)) - .collect(Collectors.toList()); - Observable allStoreResults = Observable.merge(storeResult); - - return allStoreResults.toList().onErrorResumeNext(e -> { - if (e instanceof CompositeException) { - logger.info("Captured composite exception"); - CompositeException compositeException = (CompositeException) e; - List exceptions = compositeException.getExceptions(); - assert exceptions != null && !exceptions.isEmpty(); - return Observable.error(exceptions.get(0)); - } - - return Observable.error(e); - }).map(newStoreResults -> { - for (StoreResult srr : newStoreResults) { - - entity.requestContext.requestChargeTracker.addCharge(srr.requestCharge); - entity.requestContext.clientSideRequestStatistics.recordResponse(entity, srr); - if (srr.isValid) { - - try { - - if (requestSessionToken.v == null - || (srr.sessionToken != null && requestSessionToken.v.isValid(srr.sessionToken)) - || (!enforceSessionCheck && !srr.isNotFoundException)) { - resultCollector.add(srr); - } - - } catch (Exception e) { - // TODO: what to do on exception? - } - } - - hasGoneException.v = hasGoneException.v || (srr.isGoneException && !srr.isInvalidPartitionException); - - if (resultCollector.size() >= replicaCountToRead) { - if (hasGoneException.v && !entity.requestContext.performedBackgroundAddressRefresh) { - this.startBackgroundAddressRefresh(entity); - entity.requestContext.performedBackgroundAddressRefresh = true; - } - - shortCircut.v = new ReadReplicaResult(false, resultCollector); - replicasToRead.set(0); - return resultCollector; - } - - // Remaining replicas - replicasToRead.set(replicaCountToRead - resultCollector.size()); - } - return resultCollector; - }); - } - - private ReadReplicaResult createReadReplicaResult(List responseResult, - int replicaCountToRead, - int resolvedAddressCount, - boolean hasGoneException, - RxDocumentServiceRequest entity) throws DocumentClientException { - if (responseResult.size() < replicaCountToRead) { - logger.debug("Could not get quorum number of responses. " + - "ValidResponsesReceived: {} ResponsesExpected: {}, ResolvedAddressCount: {}, ResponsesString: {}", - responseResult.size(), - replicaCountToRead, - resolvedAddressCount, - String.join(";", responseResult.stream().map(r -> r.toString()).collect(Collectors.toList()))); - - if (hasGoneException) { - if (!entity.requestContext.performLocalRefreshOnGoneException) { - // If we are not supposed to act upon GoneExceptions here, just throw them - throw new GoneException(); - } else if (!entity.requestContext.forceRefreshAddressCache) { - // We could not obtain valid read quorum number of responses even when we went through all the secondary addresses - // Attempt force refresh and start over again. - return new ReadReplicaResult(true, responseResult); - } - } - } - - return new ReadReplicaResult(false, responseResult); - } - - /** - * Makes requests to multiple replicas at once and returns responses - * @param entity DocumentServiceRequest - * @param includePrimary flag to indicate whether to indicate primary replica in the reads - * @param replicaCountToRead number of replicas to read from - * @param requiresValidLsn flag to indicate whether a valid lsn is required to consider a response as valid - * @param useSessionToken flag to indicate whether to use session token - * @param readMode Read mode - * @param checkMinLSN set minimum required session lsn - * @param forceReadAll will read from all available replicas to put together result from readsToRead number of replicas - * @return ReadReplicaResult which indicates the LSN and whether Quorum was Met / Not Met etc - */ - private Single readMultipleReplicasInternalAsync(RxDocumentServiceRequest entity, - boolean includePrimary, - int replicaCountToRead, - boolean requiresValidLsn, - boolean useSessionToken, - ReadMode readMode, - boolean checkMinLSN, - boolean forceReadAll) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - String requestedCollectionId = null; - - if (entity.forceNameCacheRefresh) { - requestedCollectionId = entity.requestContext.resolvedCollectionRid; - } - - Single> resolveApiResultsObs = this.addressSelector.resolveAllUriAsync( - entity, - includePrimary, - entity.requestContext.forceRefreshAddressCache); - - if (!StringUtils.isEmpty(requestedCollectionId) && !StringUtils.isEmpty(entity.requestContext.resolvedCollectionRid)) { - if (!requestedCollectionId.equals(entity.requestContext.resolvedCollectionRid)) { - this.sessionContainer.clearTokenByResourceId(requestedCollectionId); - } - } - - return resolveApiResultsObs.toObservable() - .map(list -> Collections.synchronizedList(new ArrayList<>(list))) - .flatMap( - resolveApiResults -> { - try { - MutableVolatile requestSessionToken = new MutableVolatile<>(); - if (useSessionToken) { - SessionTokenHelper.setPartitionLocalSessionToken(entity, this.sessionContainer); - if (checkMinLSN) { - requestSessionToken.v = entity.requestContext.sessionToken; - } - } else { - entity.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - - Observable y = earlyResultIfNotEnoughReplicas(resolveApiResults, entity, replicaCountToRead); - return y.switchIfEmpty( - Observable.defer(() -> { - - List storeResultList = Collections.synchronizedList(new ArrayList<>()); - AtomicInteger replicasToRead = new AtomicInteger(replicaCountToRead); - - // string clientVersion = entity.Headers[HttpConstants.HttpHeaders.Version]; - // enforceSessionCheck = string.IsNullOrEmpty(clientVersion) ? false : VersionUtility.IsLaterThan(clientVersion, HttpConstants.Versions.v2016_05_30); - // TODO: enforceSessionCheck is true, replace with true - boolean enforceSessionCheck = true; - - MutableVolatile hasGoneException = new MutableVolatile(false); - MutableVolatile shortCircuitResult = new MutableVolatile(); - - return Observable.defer(() -> - readFromReplicas( - storeResultList, - resolveApiResults, - replicasToRead, - entity, - includePrimary, - replicaCountToRead, - requiresValidLsn, - useSessionToken, - readMode, - checkMinLSN, - forceReadAll, - requestSessionToken, - hasGoneException, - enforceSessionCheck, - shortCircuitResult)) - // repeat().takeUntil() simulate a while loop pattern - .repeat() - .takeUntil(x -> { - // Loop until we have the read quorum number of valid responses or if we have read all the replicas - if (replicasToRead.get() > 0 && resolveApiResults.size() > 0) { - // take more from the source observable - return false; - } else { - // enough result - return true; - } - }) - .toCompletable() - .andThen( - Observable.defer(() -> { - try { - // TODO: some fields which get updated need to be thread-safe - return Observable.just(createReadReplicaResult(storeResultList, replicaCountToRead, resolveApiResults.size(), hasGoneException.v, entity)); - } catch (Exception e) { - return Observable.error(e); - } - } - )); - })); - } catch (Exception e) { - return Observable.error(e); - } - } - ).toSingle(); - } - - public Single readPrimaryAsync( - RxDocumentServiceRequest entity, - boolean requiresValidLsn, - boolean useSessionToken) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - String originalSessionToken = entity.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (entity.requestContext.clientSideRequestStatistics == null) { - entity.requestContext.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - - return this.readPrimaryInternalAsync( - entity, requiresValidLsn, useSessionToken).flatMap( - readQuorumResult -> { - - if (entity.requestContext.performLocalRefreshOnGoneException && - readQuorumResult.retryWithForceRefresh && - !entity.requestContext.forceRefreshAddressCache) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - entity.requestContext.forceRefreshAddressCache = true; - return this.readPrimaryInternalAsync(entity, requiresValidLsn, useSessionToken); - } else { - return Single.just(readQuorumResult); - } - } - ).flatMap(readQuorumResult -> { - - // RxJava1 doesn't allow throwing Typed Exception from Observable.map(.) - // this is a design flaw which was fixed in RxJava2. - - // as our core is built on top of RxJava1 here we had to use Observable.flatMap(.) not map(.) - // once we switch to RxJava2 we can move to Observable.map(.) - // https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#functional-interfaces - if (readQuorumResult.responses.size() == 0) { - return Single.error(new GoneException(RMResources.Gone)); - } - - return Single.just(readQuorumResult.responses.get(0)); - - }).doOnEach(arg -> { - try { - SessionTokenHelper.setOriginalSessionToken(entity, originalSessionToken); - } catch (Throwable throwable) { - logger.error("Unexpected failure in handling orig [{}]: new [{}]", arg, throwable.getMessage(), throwable); - } - } - ); - } - - private Single readPrimaryInternalAsync( - RxDocumentServiceRequest entity, - boolean requiresValidLsn, - boolean useSessionToken) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - Single primaryUriObs = this.addressSelector.resolvePrimaryUriAsync( - entity, - entity.requestContext.forceRefreshAddressCache); - - Single storeResultObs = primaryUriObs.flatMap( - primaryUri -> { - try { - if (useSessionToken) { - SessionTokenHelper.setPartitionLocalSessionToken(entity, this.sessionContainer); - } else { - // Remove whatever session token can be there in headers. - // We don't need it. If it is global - backend will not undersand it. - // But there's no point in producing partition local sesison token. - entity.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - - - Pair, URI> storeResponseObsAndUri = this.readFromStoreAsync(primaryUri, entity); - - return storeResponseObsAndUri.getLeft().flatMap( - storeResponse -> { - - try { - StoreResult storeResult = this.createStoreResult( - storeResponse != null ? storeResponse : null, - null, requiresValidLsn, - true, - storeResponse != null ? storeResponseObsAndUri.getRight() : null); - return Single.just(storeResult); - } catch (DocumentClientException e) { - return Single.error(e); - } - } - - ); - - } catch (DocumentClientException e) { - // RxJava1 doesn't allow throwing checked exception from Observable:map - return Single.error(e); - } - - } - ).onErrorResumeNext(t -> { - logger.debug("Exception {} is thrown while doing Read Primary", t); - - Exception storeTaskException = Utils.as(t, Exception.class); - if (storeTaskException == null) { - return Single.error(t); - } - - try { - StoreResult storeResult = this.createStoreResult( - null, - storeTaskException, requiresValidLsn, - true, - null); - return Single.just(storeResult); - } catch (DocumentClientException e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Single.error(e); - } - }); - - return storeResultObs.map(storeResult -> { - entity.requestContext.clientSideRequestStatistics.recordResponse(entity, storeResult); - entity.requestContext.requestChargeTracker.addCharge(storeResult.requestCharge); - - if (storeResult.isGoneException && !storeResult.isInvalidPartitionException) { - return new ReadReplicaResult(true, Collections.emptyList()); - } - - return new ReadReplicaResult(false, Collections.singletonList(storeResult)); - }); - } - - private Pair, URI> readFromStoreAsync( - URI physicalAddress, - RxDocumentServiceRequest request) throws DocumentClientException { - - if (request.requestContext.timeoutHelper.isElapsed()) { - throw new GoneException(); - } - - //QueryRequestPerformanceActivity activity = null; - // TODO: ifNoneMatch and maxPageSize are not used in the .Net code. check with Ji - String ifNoneMatch = request.getHeaders().get(HttpConstants.HttpHeaders.IF_NONE_MATCH); - String continuation = null; - String maxPageSize = null; - - // TODO: is this needed - this.lastReadAddress = physicalAddress.toString(); - - if (request.getOperationType() == OperationType.ReadFeed || - request.getOperationType() == OperationType.Query) { - continuation = request.getHeaders().get(HttpConstants.HttpHeaders.CONTINUATION); - maxPageSize = request.getHeaders().get(HttpConstants.HttpHeaders.PAGE_SIZE); - - if (continuation != null && continuation.contains(";")) { - String[] parts = StringUtils.split(continuation, ';'); - if (parts.length < 3) { - throw new BadRequestException(String.format( - RMResources.InvalidHeaderValue, - continuation, - HttpConstants.HttpHeaders.CONTINUATION)); - } - - continuation = parts[0]; - } - - request.setContinuation(continuation); - - // TODO: troubleshooting - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - //activity = CustomTypeExtensions.StartActivity(request); - } - - switch (request.getOperationType()) { - case Read: - case Head: { - Single storeResponseObs = this.transportClient.invokeResourceOperationAsync( - physicalAddress, - request); - - return Pair.of(storeResponseObs, physicalAddress); - - } - - case ReadFeed: - case HeadFeed: - case Query: - case SqlQuery: - case ExecuteJavaScript: { - Single storeResponseObs = StoreReader.completeActivity(this.transportClient.invokeResourceOperationAsync( - physicalAddress, - request), null); - // TODO activity); - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - return Pair.of(storeResponseObs, physicalAddress); - } - - default: - throw new IllegalStateException(String.format("Unexpected operation type {%s}", request.getOperationType())); - } - } - - - private static Single completeActivity(Single task, Object activity) { - // TODO: client statistics - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - return task; - } - - StoreResult createStoreResult(StoreResponse storeResponse, - Exception responseException, - boolean requiresValidLsn, - boolean useLocalLSNBasedHeaders, - URI storePhysicalAddress) throws DocumentClientException { - - if (responseException == null) { - String headerValue = null; - long quorumAckedLSN = -1; - int currentReplicaSetSize = -1; - int currentWriteQuorum = -1; - long globalCommittedLSN = -1; - int numberOfReadRegions = -1; - long itemLSN = -1; - if ((headerValue = storeResponse.getHeaderValue( - useLocalLSNBasedHeaders ? WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN : WFConstants.BackendHeaders.QUORUM_ACKED_LSN)) != null) { - quorumAckedLSN = Long.parseLong(headerValue); - } - - if ((headerValue = storeResponse.getHeaderValue(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE)) != null) { - currentReplicaSetSize = Integer.parseInt(headerValue); - } - - if ((headerValue = storeResponse.getHeaderValue(WFConstants.BackendHeaders.CURRENT_WRITE_QUORUM)) != null) { - currentWriteQuorum = Integer.parseInt(headerValue); - } - - double requestCharge = 0; - if ((headerValue = storeResponse.getHeaderValue(HttpConstants.HttpHeaders.REQUEST_CHARGE)) != null) { - requestCharge = Double.parseDouble(headerValue); - } - - if ((headerValue = storeResponse.getHeaderValue(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS)) != null) { - numberOfReadRegions = Integer.parseInt(headerValue); - } - - if ((headerValue = storeResponse.getHeaderValue(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN)) != null) { - globalCommittedLSN = Long.parseLong(headerValue); - } - - if ((headerValue = storeResponse.getHeaderValue( - useLocalLSNBasedHeaders ? WFConstants.BackendHeaders.ITEM_LOCAL_LSN : WFConstants.BackendHeaders.ITEM_LSN)) != null) { - itemLSN = Long.parseLong(headerValue); - } - - long lsn = -1; - if (useLocalLSNBasedHeaders) { - if ((headerValue = storeResponse.getHeaderValue(WFConstants.BackendHeaders.LOCAL_LSN)) != null) { - lsn = Long.parseLong(headerValue); - } - } else { - lsn = storeResponse.getLSN(); - } - - ISessionToken sessionToken = null; - // Session token response header is introduced from version HttpConstants.Versions.v2018_06_18 onwards. - // Previously it was only a request header - if ((headerValue = storeResponse.getHeaderValue(HttpConstants.HttpHeaders.SESSION_TOKEN)) != null) { - sessionToken = SessionTokenHelper.parse(headerValue); - } - - return new StoreResult( - /* storeResponse: */storeResponse, - /* exception: */ null, - /* partitionKeyRangeId: */ storeResponse.getPartitionKeyRangeId(), - /* lsn: */ lsn, - /* quorumAckedLsn: */ quorumAckedLSN, - /* requestCharge: */ requestCharge, - /* currentReplicaSetSize: */ currentReplicaSetSize, - /* currentWriteQuorum: */ currentWriteQuorum, - /* isValid: */true, - /* storePhysicalAddress: */ storePhysicalAddress, - /* globalCommittedLSN: */ globalCommittedLSN, - /* numberOfReadRegions: */ numberOfReadRegions, - /* itemLSN: */ itemLSN, - /* sessionToken: */ sessionToken); - } else { - DocumentClientException documentClientException = Utils.as(responseException, DocumentClientException.class); - if (documentClientException != null) { - StoreReader.verifyCanContinueOnException(documentClientException); - long quorumAckedLSN = -1; - int currentReplicaSetSize = -1; - int currentWriteQuorum = -1; - long globalCommittedLSN = -1; - int numberOfReadRegions = -1; - String headerValue = documentClientException.getResponseHeaders().get(useLocalLSNBasedHeaders ? WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN : WFConstants.BackendHeaders.QUORUM_ACKED_LSN); - if (!Strings.isNullOrEmpty(headerValue)) { - quorumAckedLSN = Long.parseLong(headerValue); - } - - headerValue = documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE); - if (!Strings.isNullOrEmpty(headerValue)) { - currentReplicaSetSize = Integer.parseInt(headerValue); - } - - headerValue = documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.CURRENT_WRITE_QUORUM); - if (!Strings.isNullOrEmpty(headerValue)) { - currentReplicaSetSize = Integer.parseInt(headerValue); - } - - double requestCharge = 0; - headerValue = documentClientException.getResponseHeaders().get(HttpConstants.HttpHeaders.REQUEST_CHARGE); - if (!Strings.isNullOrEmpty(headerValue)) { - requestCharge = Double.parseDouble(headerValue); - } - - headerValue = documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS); - if (!Strings.isNullOrEmpty(headerValue)) { - numberOfReadRegions = Integer.parseInt(headerValue); - } - - headerValue = documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN); - if (!Strings.isNullOrEmpty(headerValue)) { - globalCommittedLSN = Integer.parseInt(headerValue); - } - - long lsn = -1; - if (useLocalLSNBasedHeaders) { - headerValue = documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.LOCAL_LSN); - if (!Strings.isNullOrEmpty(headerValue)) { - lsn = Long.parseLong(headerValue); - } - } else { - lsn = BridgeInternal.getLSN(documentClientException); - } - - ISessionToken sessionToken = null; - - // Session token response header is introduced from version HttpConstants.Versions.v2018_06_18 onwards. - // Previously it was only a request header - headerValue = documentClientException.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (!Strings.isNullOrEmpty(headerValue)) { - sessionToken = SessionTokenHelper.parse(headerValue); - } - - return new StoreResult( - /* storeResponse: */ (StoreResponse) null, - /* exception: */ documentClientException, - /* partitionKeyRangeId: */BridgeInternal.getPartitionKeyRangeId(documentClientException), - /* lsn: */ lsn, - /* quorumAckedLsn: */ quorumAckedLSN, - /* requestCharge: */ requestCharge, - /* currentReplicaSetSize: */ currentReplicaSetSize, - /* currentWriteQuorum: */ currentWriteQuorum, - /* isValid: */!requiresValidLsn - || ((documentClientException.getStatusCode() != HttpConstants.StatusCodes.GONE || isSubStatusCode(documentClientException, HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE)) - && lsn >= 0), - // TODO: verify where exception.RequestURI is supposed to be set in .Net - /* storePhysicalAddress: */ storePhysicalAddress == null ? BridgeInternal.getRequestUri(documentClientException) : storePhysicalAddress, - /* globalCommittedLSN: */ globalCommittedLSN, - /* numberOfReadRegions: */ numberOfReadRegions, - /* itemLSN: */ -1, - sessionToken); - } else { - logger.error("Unexpected exception {} received while reading from store.", responseException.getMessage(), responseException); - return new StoreResult( - /* storeResponse: */ null, - /* exception: */ new InternalServerErrorException(RMResources.InternalServerError), - /* partitionKeyRangeId: */ (String) null, - /* lsn: */ -1, - /* quorumAckedLsn: */ -1, - /* requestCharge: */ 0, - /* currentReplicaSetSize: */ 0, - /* currentWriteQuorum: */ 0, - /* isValid: */ false, - /* storePhysicalAddress: */ storePhysicalAddress, - /* globalCommittedLSN: */-1, - /* numberOfReadRegions: */ 0, - /* itemLSN: */ -1, - /* sessionToken: */ null); - } - } - } - - void startBackgroundAddressRefresh(RxDocumentServiceRequest request) { - this.addressSelector.resolveAllUriAsync(request, true, true) - .observeOn(Schedulers.io()) - .subscribe( - r -> { - }, - e -> logger.warn( - "Background refresh of the addresses failed with {}", e.getMessage(), e) - ); - } - - private static int generateNextRandom(int maxValue) { - // The benefit of using ThreadLocalRandom.current() over Random is - // avoiding the synchronization contention due to multi-threading. - return ThreadLocalRandom.current().nextInt(maxValue); - } - - static void verifyCanContinueOnException(DocumentClientException ex) throws DocumentClientException { - if (ex instanceof PartitionKeyRangeGoneException) { - throw ex; - } - - if (ex instanceof PartitionKeyRangeIsSplittingException) { - throw ex; - } - - if (ex instanceof PartitionIsMigratingException) { - throw ex; - } - - String value = ex.getResponseHeaders().get(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE); - if (Strings.isNullOrWhiteSpace(value)) { - return; - } - - Integer result = Integers.tryParse(value); - if (result != null && result == 1) { - throw ex; - } - - return; - } - - private class ReadReplicaResult { - public ReadReplicaResult(boolean retryWithForceRefresh, List responses) { - this.retryWithForceRefresh = retryWithForceRefresh; - this.responses = responses; - } - - public final boolean retryWithForceRefresh; - public final List responses; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClient.java deleted file mode 100644 index b25cbe351722..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClient.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import rx.Single; - -import java.net.URI; - -public abstract class TransportClient implements AutoCloseable { - - // Uses requests's ResourceOperation to determine the operation - public Single invokeResourceOperationAsync(URI physicalAddress, RxDocumentServiceRequest request) { - return this.invokeStoreAsync(physicalAddress, new ResourceOperation(request.getOperationType(), request.getResourceType()), request); - } - - protected abstract Single invokeStoreAsync( - URI physicalAddress, - ResourceOperation resourceOperation, - RxDocumentServiceRequest request); -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportException.java deleted file mode 100644 index c1e3a499a018..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportException.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.Error; -import io.netty.handler.codec.http.HttpResponseStatus; - -import java.util.Map; - -public class TransportException extends Exception { - - final private Error error; - final private Map headers; - final private HttpResponseStatus status; - - public TransportException(HttpResponseStatus status, ObjectNode details, Map headers) { - - super("TODO: DANOBLE: format message string based on headers, and status information"); - this.error = BridgeInternal.createError(details); - this.headers = headers; - this.status = status; - } - - public Error getError() { - return error; - } - - public Map getHeaders() { - return headers; - } - - public HttpResponseStatus getStatus() { - return status; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/UnauthorizedException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/UnauthorizedException.java deleted file mode 100644 index 5caf0c8b5916..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/UnauthorizedException.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class UnauthorizedException extends DocumentClientException { - - public UnauthorizedException() { - this(RMResources.Unauthorized); - } - - public UnauthorizedException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.UNAUTHORIZED, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public UnauthorizedException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public UnauthorizedException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public UnauthorizedException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public UnauthorizedException(Exception innerException) { - this(RMResources.Unauthorized, innerException, null, null); - } - - public UnauthorizedException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Unauthorized, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.UNAUTHORIZED, - requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java deleted file mode 100644 index 7ea0ab72d948..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.channel.Channel; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.ChannelPipeline; -import io.netty.channel.EventLoop; -import io.netty.channel.pool.ChannelPool; -import io.netty.channel.pool.ChannelPoolHandler; -import io.netty.handler.logging.LoggingHandler; -import io.netty.handler.ssl.SslHandler; -import io.netty.handler.timeout.ReadTimeoutHandler; -import io.netty.handler.timeout.WriteTimeoutHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.net.ssl.SSLEngine; -import java.util.concurrent.TimeUnit; - -import static com.google.common.base.Preconditions.checkNotNull; - -public class RntbdClientChannelHandler extends ChannelInitializer implements ChannelPoolHandler { - - private static Logger logger = LoggerFactory.getLogger(RntbdClientChannelHandler.class); - private final RntbdEndpoint.Config config; - - RntbdClientChannelHandler(final RntbdEndpoint.Config config) { - checkNotNull(config, "config"); - this.config = config; - } - - /** - * Called by {@link ChannelPool#acquire} after a {@link Channel} is acquired - *

- * This method is called within the {@link EventLoop} of the {@link Channel}. - * - * @param channel a channel that was just acquired - */ - @Override - public void channelAcquired(final Channel channel) throws Exception { - logger.trace("{} CHANNEL ACQUIRED", channel); - } - - /** - * Called by {@link ChannelPool#release} after a {@link Channel} is created - *

- * This method is called within the {@link EventLoop} of the {@link Channel}. - * - * @param channel a channel that was just created - */ - @Override - public void channelCreated(final Channel channel) throws Exception { - logger.trace("{} CHANNEL CREATED", channel); - this.initChannel(channel); - } - - /** - * Called by {@link ChannelPool#release} after a {@link Channel} is released - *

- * This method is called within the {@link EventLoop} of the {@link Channel}. - * - * @param channel a channel that was just released - */ - @Override - public void channelReleased(final Channel channel) throws Exception { - logger.trace("{} CHANNEL RELEASED", channel); - } - - /** - * Called by @{ChannelPipeline} initializer after the current channel is registered to an event loop. - *

- * This method constructs this pipeline: - *

{@code
-     * ChannelPipeline {
-     *     (ReadTimeoutHandler#0 = io.netty.handler.timeout.ReadTimeoutHandler),
-     *     (SslHandler#0 = io.netty.handler.ssl.SslHandler),
-     *     (RntbdContextNegotiator#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdContextNegotiator),
-     *     (RntbdResponseDecoder#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdResponseDecoder),
-     *     (RntbdRequestEncoder#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestEncoder),
-     *     (WriteTimeoutHandler#0 = io.netty.handler.timeout.WriteTimeoutHandler),
-     *     (RntbdRequestManager#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestManager),
-     *     (SimpleChannelPool$1#0 = io.netty.channel.pool.SimpleChannelPool$1)
-     * }
-     * }
- * - * @param channel a channel that was just registered with an event loop - */ - @Override - protected void initChannel(final Channel channel) { - - checkNotNull(channel); - - assert channel.isRegistered(); - assert channel.isOpen(); - assert !channel.isActive(); - - final RntbdRequestManager requestManager = new RntbdRequestManager(); - final long readerIdleTime = this.config.getReceiveHangDetectionTime(); - final long writerIdleTime = this.config.getSendHangDetectionTime(); - final ChannelPipeline pipeline = channel.pipeline(); - - pipeline.addFirst( - new RntbdContextNegotiator(requestManager, this.config.getUserAgent()), - new RntbdResponseDecoder(), - new RntbdRequestEncoder(), - new WriteTimeoutHandler(writerIdleTime, TimeUnit.NANOSECONDS), - requestManager - ); - - if (this.config.getWireLogLevel() != null) { - pipeline.addFirst(new LoggingHandler(this.config.getWireLogLevel())); - } - - final SSLEngine sslEngine = this.config.getSslContext().newEngine(channel.alloc()); - - pipeline.addFirst( - new ReadTimeoutHandler(readerIdleTime, TimeUnit.NANOSECONDS), - new SslHandler(sslEngine) - ); - } - -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelPool.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelPool.java deleted file mode 100644 index e1ef4d31f9ee..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelPool.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelId; -import io.netty.channel.pool.ChannelHealthChecker; -import io.netty.channel.pool.FixedChannelPool; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.Promise; -import org.apache.commons.lang3.reflect.FieldUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; - -@JsonSerialize(using = RntbdClientChannelPool.JsonSerializer.class) -public final class RntbdClientChannelPool extends FixedChannelPool { - - private static final Logger logger = LoggerFactory.getLogger(RntbdClientChannelPool.class); - private static final AtomicReference pendingAcquireCount = new AtomicReference<>(); - - private final ConcurrentHashMap atCapacity; - private final AtomicInteger availableChannelCount; - private final AtomicBoolean closed; - private final int maxRequestsPerChannel; - - /** - * Creates a new instance using the {@link ChannelHealthChecker#ACTIVE} - * - * @param bootstrap the {@link Bootstrap} that is used for connections - * @param config the {@link RntbdEndpoint.Config} that is used for the channel pool instance created - */ - RntbdClientChannelPool(final Bootstrap bootstrap, final RntbdEndpoint.Config config) { - - super(bootstrap, new RntbdClientChannelHandler(config), ChannelHealthChecker.ACTIVE, null, - -1L, config.getMaxChannelsPerEndpoint(), Integer.MAX_VALUE, true - ); - - this.maxRequestsPerChannel = config.getMaxRequestsPerChannel(); - this.availableChannelCount = new AtomicInteger(); - this.atCapacity = new ConcurrentHashMap<>(); - this.closed = new AtomicBoolean(); - } - - @Override - public Future acquire(Promise promise) { - this.throwIfClosed(); - return super.acquire(promise); - } - - @Override - public Future release(Channel channel, Promise promise) { - this.throwIfClosed(); - return super.release(channel, promise); - } - - @Override - public void close() { - - if (this.closed.compareAndSet(false, true)) { - - if (!this.atCapacity.isEmpty()) { - - for (Channel channel : this.atCapacity.values()) { - super.offerChannel(channel); - } - - this.atCapacity.clear(); - } - - this.availableChannelCount.set(0); - super.close(); - } - } - - public int availableChannelCount() { - return this.availableChannelCount.get(); - } - - public int pendingAcquireCount() { - - Field field = pendingAcquireCount.get(); - - if (field == null) { - - synchronized (pendingAcquireCount) { - - field = pendingAcquireCount.get(); - - if (field == null) { - field = FieldUtils.getDeclaredField(FixedChannelPool.class, "pendingAcquireCount", true); - pendingAcquireCount.set(field); - } - } - - } - try { - return (int)FieldUtils.readField(field, this); - } catch (IllegalAccessException error) { - logger.error("could not access field due to ", error); - } - - return -1; - } - - /** - * Poll a {@link Channel} out of internal storage to reuse it - *

- * Maintainers: Implementations of this method must be thread-safe. - * - * @return a value of {@code null}, if no {@link Channel} is ready to be reused - */ - @Override - protected synchronized Channel pollChannel() { - - final Channel channel = super.pollChannel(); - - if (channel != null) { - this.availableChannelCount.decrementAndGet(); - return channel; - } - - if (this.atCapacity.isEmpty()) { - return null; - } - - return this.atCapacity.search(Long.MAX_VALUE, (id, value) -> { - if (pendingRequestCount(value) < this.maxRequestsPerChannel) { - this.availableChannelCount.decrementAndGet(); - this.atCapacity.remove(id); - return value; - } - return null; - }); - } - - /** - * Offer a {@link Channel} back to the internal storage - *

- * Maintainers: Implementations of this method must be thread-safe. - * - * @param channel the {@link Channel} to return to internal storage - * @return {@code true}, if the {@link Channel} could be added to internal storage; otherwise {@code false} - */ - @Override - protected synchronized boolean offerChannel(final Channel channel) { - - checkArgument(channel.isActive(), "%s inactive", channel); - final boolean offered; - - if (pendingRequestCount(channel) >= this.maxRequestsPerChannel) { - this.atCapacity.put(channel.id(), channel); - offered = true; - } else { - offered = super.offerChannel(channel); - } - - if (offered) { - this.availableChannelCount.incrementAndGet(); - } - - return offered; - } - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - - private static int pendingRequestCount(final Channel channel) { - return channel.pipeline().get(RntbdRequestManager.class).getPendingRequestCount(); - } - - private void throwIfClosed() { - checkState(!this.closed.get(), "%s is closed", this); - } - - // region Types - - static final class JsonSerializer extends StdSerializer { - - public JsonSerializer() { - this(null); - } - - public JsonSerializer(Class type) { - super(type); - } - - @Override - public void serialize(RntbdClientChannelPool value, JsonGenerator generator, SerializerProvider provider) throws IOException { - - generator.writeStartObject(); - generator.writeNumberField("acquiredChannelCount", value.acquiredChannelCount()); - generator.writeNumberField("availableChannelCount", value.availableChannelCount()); - generator.writeNumberField("maxRequestsPerChannel", value.maxRequestsPerChannel); - generator.writeNumberField("pendingAcquisitionCount", value.pendingAcquireCount()); - generator.writeBooleanField("isClosed", value.closed.get()); - generator.writeEndObject(); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdConstants.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdConstants.java deleted file mode 100644 index e57e7660f274..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdConstants.java +++ /dev/null @@ -1,750 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; - -import java.util.EnumSet; -import java.util.stream.Collector; - -final class RntbdConstants { - - static final int CurrentProtocolVersion = 0x00000001; - - private RntbdConstants() { - } - - public enum RntbdConsistencyLevel { - - Strong((byte)0x00), - BoundedStaleness((byte)0x01), - Session((byte)0x02), - Eventual((byte)0x03), - ConsistentPrefix((byte)0x04), - - Invalid((byte)0xFF); - - private final byte id; - - RntbdConsistencyLevel(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - public enum RntbdContentSerializationFormat { - - JsonText((byte)0x00), - CosmosBinary((byte)0x01), - - Invalid((byte)0xFF); - - private final byte id; - - RntbdContentSerializationFormat(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - enum RntbdContextHeader implements RntbdHeader { - - ProtocolVersion((short)0x0000, RntbdTokenType.ULong, false), - ClientVersion((short)0x0001, RntbdTokenType.SmallString, false), - ServerAgent((short)0x0002, RntbdTokenType.SmallString, true), - ServerVersion((short)0x0003, RntbdTokenType.SmallString, true), - IdleTimeoutInSeconds((short)0x0004, RntbdTokenType.ULong, false), - UnauthenticatedTimeoutInSeconds((short)0x0005, RntbdTokenType.ULong, false); - - public static final ImmutableMap map; - public static final ImmutableSet set = Sets.immutableEnumSet(EnumSet.allOf(RntbdContextHeader.class)); - - static { - final Collector> collector = ImmutableMap.toImmutableMap(RntbdContextHeader::id, h -> h); - map = set.stream().collect(collector); - } - - private final short id; - private final boolean isRequired; - private final RntbdTokenType type; - - RntbdContextHeader(final short id, final RntbdTokenType type, final boolean isRequired) { - this.id = id; - this.type = type; - this.isRequired = isRequired; - } - - public boolean isRequired() { - return this.isRequired; - } - - public short id() { - return this.id; - } - - public RntbdTokenType type() { - return this.type; - } - } - - enum RntbdContextRequestHeader implements RntbdHeader { - - ProtocolVersion((short)0x0000, RntbdTokenType.ULong, true), - ClientVersion((short)0x0001, RntbdTokenType.SmallString, true), - UserAgent((short)0x0002, RntbdTokenType.SmallString, true); - - public static final ImmutableMap map; - public static final ImmutableSet set = Sets.immutableEnumSet(EnumSet.allOf(RntbdContextRequestHeader.class)); - - static { - final Collector> collector = ImmutableMap.toImmutableMap(h -> h.id(), h -> h); - map = set.stream().collect(collector); - } - - private final short id; - private final boolean isRequired; - private final RntbdTokenType type; - - RntbdContextRequestHeader(final short id, final RntbdTokenType type, final boolean isRequired) { - this.id = id; - this.type = type; - this.isRequired = isRequired; - } - - public boolean isRequired() { - return this.isRequired; - } - - public short id() { - return this.id; - } - - public RntbdTokenType type() { - return this.type; - } - } - - public enum RntbdEnumerationDirection { - - Invalid((byte)0x00), - - Forward((byte)0x01), - Reverse((byte)0x02); - - private final byte id; - - RntbdEnumerationDirection(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - public enum RntbdFanoutOperationState { - - Started((byte)0x01), - Completed((byte)0x02); - - private final byte id; - - RntbdFanoutOperationState(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - enum RntbdIndexingDirective { - - Default((byte)0x00), - Include((byte)0x01), - Exclude((byte)0x02), - Invalid((byte)0xFF); - - private final byte id; - - RntbdIndexingDirective(final byte id) { - this.id = id; - } - - public static RntbdIndexingDirective fromId(final byte id) { - switch (id) { - case (byte)0x00: - return Default; - case (byte)0x01: - return Include; - case (byte)0x02: - return Exclude; - case (byte)0xFF: - return Invalid; - } - throw new IllegalArgumentException("id"); - } - - public byte id() { - return this.id; - } - } - - public enum RntbdMigrateCollectionDirective { - - Thaw((byte)0x00), - Freeze((byte)0x01), - - Invalid((byte)0xFF); - - private final byte id; - - RntbdMigrateCollectionDirective(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - enum RntbdOperationType { - - Connection((short)0x0000), - Create((short)0x0001), - Update((short)0x0002), - Read((short)0x0003), - ReadFeed((short)0x0004), - Delete((short)0x0005), - Replace((short)0x0006), - // Obsolete and now undefined: JPathQuery((short)0x0007), - ExecuteJavaScript((short)0x0008), - SQLQuery((short)0x0009), - Pause((short)0x000A), - Resume((short)0x000B), - Stop((short)0x000C), - Recycle((short)0x000D), - Crash((short)0x000E), - Query((short)0x000F), - ForceConfigRefresh((short)0x0010), - Head((short)0x0011), - HeadFeed((short)0x0012), - Upsert((short)0x0013), - Recreate((short)0x0014), - Throttle((short)0x0015), - GetSplitPoint((short)0x0016), - PreCreateValidation((short)0x0017), - BatchApply((short)0x0018), - AbortSplit((short)0x0019), - CompleteSplit((short)0x001A), - OfferUpdateOperation((short)0x001B), - OfferPreGrowValidation((short)0x001C), - BatchReportThroughputUtilization((short)0x001D), - CompletePartitionMigration((short)0x001E), - AbortPartitionMigration((short)0x001F), - PreReplaceValidation((short)0x0020), - AddComputeGatewayRequestCharges((short)0x0021), - MigratePartition((short)0x0022); - - private final short id; - - RntbdOperationType(final short id) { - this.id = id; - } - - public static RntbdOperationType fromId(final short id) throws IllegalArgumentException { - - switch (id) { - case 0x0000: - return RntbdOperationType.Connection; - case 0x0001: - return RntbdOperationType.Create; - case 0x0002: - return RntbdOperationType.Update; - case 0x0003: - return RntbdOperationType.Read; - case 0x0004: - return RntbdOperationType.ReadFeed; - case 0x0005: - return RntbdOperationType.Delete; - case 0x0006: - return RntbdOperationType.Replace; - // Obsolete and now undefined: case 0x0007: return RntbdOperationType.JPathQuery; - case 0x0008: - return RntbdOperationType.ExecuteJavaScript; - case 0x0009: - return RntbdOperationType.SQLQuery; - case 0x000A: - return RntbdOperationType.Pause; - case 0x000B: - return RntbdOperationType.Resume; - case 0x000C: - return RntbdOperationType.Stop; - case 0x000D: - return RntbdOperationType.Recycle; - case 0x000E: - return RntbdOperationType.Crash; - case 0x000F: - return RntbdOperationType.Query; - case 0x0010: - return RntbdOperationType.ForceConfigRefresh; - case 0x0011: - return RntbdOperationType.Head; - case 0x0012: - return RntbdOperationType.HeadFeed; - case 0x0013: - return RntbdOperationType.Upsert; - case 0x0014: - return RntbdOperationType.Recreate; - case 0x0015: - return RntbdOperationType.Throttle; - case 0x0016: - return RntbdOperationType.GetSplitPoint; - case 0x0017: - return RntbdOperationType.PreCreateValidation; - case 0x0018: - return RntbdOperationType.BatchApply; - case 0x0019: - return RntbdOperationType.AbortSplit; - case 0x001A: - return RntbdOperationType.CompleteSplit; - case 0x001B: - return RntbdOperationType.OfferUpdateOperation; - case 0x001C: - return RntbdOperationType.OfferPreGrowValidation; - case 0x001D: - return RntbdOperationType.BatchReportThroughputUtilization; - case 0x001E: - return RntbdOperationType.CompletePartitionMigration; - case 0x001F: - return RntbdOperationType.AbortPartitionMigration; - case 0x0020: - return RntbdOperationType.PreReplaceValidation; - case 0x0021: - return RntbdOperationType.AddComputeGatewayRequestCharges; - case 0x0022: - return RntbdOperationType.MigratePartition; - } - throw new IllegalArgumentException("id"); - } - - public short id() { - return this.id; - } - } - - public enum RntbdReadFeedKeyType { - - Invalid((byte)0x00), - ResourceId((byte)0x01), - EffectivePartitionKey((byte)0x02); - - private final byte id; - - RntbdReadFeedKeyType(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - public enum RntbdRemoteStorageType { - - Invalid((byte)0x00), - NotSpecified((byte)0x01), - Standard((byte)0x02), - Premium((byte)0x03); - - private final byte id; - - RntbdRemoteStorageType(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - public enum RntbdRequestHeader implements RntbdHeader { - - ResourceId((short)0x0000, RntbdTokenType.Bytes, false), - AuthorizationToken((short)0x0001, RntbdTokenType.String, false), - PayloadPresent((short)0x0002, RntbdTokenType.Byte, true), - Date((short)0x0003, RntbdTokenType.SmallString, false), - PageSize((short)0x0004, RntbdTokenType.ULong, false), - SessionToken((short)0x0005, RntbdTokenType.String, false), - ContinuationToken((short)0x0006, RntbdTokenType.String, false), - IndexingDirective((short)0x0007, RntbdTokenType.Byte, false), - Match((short)0x0008, RntbdTokenType.String, false), - PreTriggerInclude((short)0x0009, RntbdTokenType.String, false), - PostTriggerInclude((short)0x000A, RntbdTokenType.String, false), - IsFanout((short)0x000B, RntbdTokenType.Byte, false), - CollectionPartitionIndex((short)0x000C, RntbdTokenType.ULong, false), - CollectionServiceIndex((short)0x000D, RntbdTokenType.ULong, false), - PreTriggerExclude((short)0x000E, RntbdTokenType.String, false), - PostTriggerExclude((short)0x000F, RntbdTokenType.String, false), - ConsistencyLevel((short)0x0010, RntbdTokenType.Byte, false), - EntityId((short)0x0011, RntbdTokenType.String, false), - ResourceSchemaName((short)0x0012, RntbdTokenType.SmallString, false), - ReplicaPath((short)0x0013, RntbdTokenType.String, true), - ResourceTokenExpiry((short)0x0014, RntbdTokenType.ULong, false), - DatabaseName((short)0x0015, RntbdTokenType.String, false), - CollectionName((short)0x0016, RntbdTokenType.String, false), - DocumentName((short)0x0017, RntbdTokenType.String, false), - AttachmentName((short)0x0018, RntbdTokenType.String, false), - UserName((short)0x0019, RntbdTokenType.String, false), - PermissionName((short)0x001A, RntbdTokenType.String, false), - StoredProcedureName((short)0x001B, RntbdTokenType.String, false), - UserDefinedFunctionName((short)0x001C, RntbdTokenType.String, false), - TriggerName((short)0x001D, RntbdTokenType.String, false), - EnableScanInQuery((short)0x001E, RntbdTokenType.Byte, false), - EmitVerboseTracesInQuery((short)0x001F, RntbdTokenType.Byte, false), - ConflictName((short)0x0020, RntbdTokenType.String, false), - BindReplicaDirective((short)0x0021, RntbdTokenType.String, false), - PrimaryMasterKey((short)0x0022, RntbdTokenType.String, false), - SecondaryMasterKey((short)0x0023, RntbdTokenType.String, false), - PrimaryReadonlyKey((short)0x0024, RntbdTokenType.String, false), - SecondaryReadonlyKey((short)0x0025, RntbdTokenType.String, false), - ProfileRequest((short)0x0026, RntbdTokenType.Byte, false), - EnableLowPrecisionOrderBy((short)0x0027, RntbdTokenType.Byte, false), - ClientVersion((short)0x0028, RntbdTokenType.SmallString, false), - CanCharge((short)0x0029, RntbdTokenType.Byte, false), - CanThrottle((short)0x002A, RntbdTokenType.Byte, false), - PartitionKey((short)0x002B, RntbdTokenType.String, false), - PartitionKeyRangeId((short)0x002C, RntbdTokenType.String, false), - NotUsed2D((short)0x002D, RntbdTokenType.Invalid, false), - NotUsed2E((short)0x002E, RntbdTokenType.Invalid, false), - NotUsed2F((short)0x002F, RntbdTokenType.Invalid, false), - // not used 0x0030, - MigrateCollectionDirective((short)0x0031, RntbdTokenType.Byte, false), - NotUsed32((short)0x0032, RntbdTokenType.Invalid, false), - SupportSpatialLegacyCoordinates((short)0x0033, RntbdTokenType.Byte, false), - PartitionCount((short)0x0034, RntbdTokenType.ULong, false), - CollectionRid((short)0x0035, RntbdTokenType.String, false), - PartitionKeyRangeName((short)0x0036, RntbdTokenType.String, false), - // not used((short)0x0037), RoundTripTimeInMsec - // not used((short)0x0038), RequestMessageSentTime - // not used((short)0x0039), RequestMessageTimeOffset - SchemaName((short)0x003A, RntbdTokenType.String, false), - FilterBySchemaRid((short)0x003B, RntbdTokenType.String, false), - UsePolygonsSmallerThanAHemisphere((short)0x003C, RntbdTokenType.Byte, false), - GatewaySignature((short)0x003D, RntbdTokenType.String, false), - EnableLogging((short)0x003E, RntbdTokenType.Byte, false), - A_IM((short)0x003F, RntbdTokenType.String, false), - PopulateQuotaInfo((short)0x0040, RntbdTokenType.Byte, false), - DisableRUPerMinuteUsage((short)0x0041, RntbdTokenType.Byte, false), - PopulateQueryMetrics((short)0x0042, RntbdTokenType.Byte, false), - ResponseContinuationTokenLimitInKb((short)0x0043, RntbdTokenType.ULong, false), - PopulatePartitionStatistics((short)0x0044, RntbdTokenType.Byte, false), - RemoteStorageType((short)0x0045, RntbdTokenType.Byte, false), - CollectionRemoteStorageSecurityIdentifier((short)0x0046, RntbdTokenType.String, false), - IfModifiedSince((short)0x0047, RntbdTokenType.String, false), - PopulateCollectionThroughputInfo((short)0x0048, RntbdTokenType.Byte, false), - RemainingTimeInMsOnClientRequest((short)0x0049, RntbdTokenType.ULong, false), - ClientRetryAttemptCount((short)0x004A, RntbdTokenType.ULong, false), - TargetLsn((short)0x004B, RntbdTokenType.LongLong, false), - TargetGlobalCommittedLsn((short)0x004C, RntbdTokenType.LongLong, false), - TransportRequestID((short)0x004D, RntbdTokenType.ULong, false), - RestoreMetadaFilter((short)0x004E, RntbdTokenType.String, false), - RestoreParams((short)0x004F, RntbdTokenType.String, false), - ShareThroughput((short)0x0050, RntbdTokenType.Byte, false), - PartitionResourceFilter((short)0x0051, RntbdTokenType.String, false), - IsReadOnlyScript((short)0x0052, RntbdTokenType.Byte, false), - IsAutoScaleRequest((short)0x0053, RntbdTokenType.Byte, false), - ForceQueryScan((short)0x0054, RntbdTokenType.Byte, false), - // not used((short)0x0055), LeaseSeqNumber - CanOfferReplaceComplete((short)0x0056, RntbdTokenType.Byte, false), - ExcludeSystemProperties((short)0x0057, RntbdTokenType.Byte, false), - BinaryId((short)0x0058, RntbdTokenType.Bytes, false), - TimeToLiveInSeconds((short)0x0059, RntbdTokenType.Long, false), - EffectivePartitionKey((short)0x005A, RntbdTokenType.Bytes, false), - BinaryPassthroughRequest((short)0x005B, RntbdTokenType.Byte, false), - UserDefinedTypeName((short)0x005C, RntbdTokenType.String, false), - EnableDynamicRidRangeAllocation((short)0x005D, RntbdTokenType.Byte, false), - EnumerationDirection((short)0x005E, RntbdTokenType.Byte, false), - StartId((short)0x005F, RntbdTokenType.Bytes, false), - EndId((short)0x0060, RntbdTokenType.Bytes, false), - FanoutOperationState((short)0x0061, RntbdTokenType.Byte, false), - StartEpk((short)0x0062, RntbdTokenType.Bytes, false), - EndEpk((short)0x0063, RntbdTokenType.Bytes, false), - ReadFeedKeyType((short)0x0064, RntbdTokenType.Byte, false), - ContentSerializationFormat((short)0x0065, RntbdTokenType.Byte, false), - AllowTentativeWrites((short)0x0066, RntbdTokenType.Byte, false), - IsUserRequest((short)0x0067, RntbdTokenType.Byte, false), - SharedOfferThroughput((short)0x0068, RntbdTokenType.ULong, false); - - public static final ImmutableMap map; - public static final ImmutableSet set = Sets.immutableEnumSet(EnumSet.allOf(RntbdRequestHeader.class)); - - static { - final Collector> collector = ImmutableMap.toImmutableMap(RntbdRequestHeader::id, h -> h); - map = set.stream().collect(collector); - } - - private final short id; - private final boolean isRequired; - private final RntbdTokenType type; - - RntbdRequestHeader(final short id, final RntbdTokenType type, final boolean isRequired) { - this.id = id; - this.type = type; - this.isRequired = isRequired; - } - - public boolean isRequired() { - return this.isRequired; - } - - public short id() { - return this.id; - } - - public RntbdTokenType type() { - return this.type; - } - } - - enum RntbdResourceType { - - Connection((short)0x0000), - Database((short)0x0001), - Collection((short)0x0002), - Document((short)0x0003), - Attachment((short)0x0004), - User((short)0x0005), - Permission((short)0x0006), - StoredProcedure((short)0x0007), - Conflict((short)0x0008), - Trigger((short)0x0009), - UserDefinedFunction((short)0x000A), - Module((short)0x000B), - Replica((short)0x000C), - ModuleCommand((short)0x000D), - Record((short)0x000E), - Offer((short)0x000F), - PartitionSetInformation((short)0x0010), - XPReplicatorAddress((short)0x0011), - MasterPartition((short)0x0012), - ServerPartition((short)0x0013), - DatabaseAccount((short)0x0014), - Topology((short)0x0015), - PartitionKeyRange((short)0x0016), - // Obsolete and now undefined: Timestamp((short)0x0017), - Schema((short)0x0018), - BatchApply((short)0x0019), - RestoreMetadata((short)0x001A), - ComputeGatewayCharges((short)0x001B), - RidRange((short)0x001C), - UserDefinedType((short)0x001D); - - private final short id; - - RntbdResourceType(final short id) { - this.id = id; - } - - public static RntbdResourceType fromId(final short id) throws IllegalArgumentException { - switch (id) { - case 0x0000: - return RntbdResourceType.Connection; - case 0x0001: - return RntbdResourceType.Database; - case 0x0002: - return RntbdResourceType.Collection; - case 0x0003: - return RntbdResourceType.Document; - case 0x0004: - return RntbdResourceType.Attachment; - case 0x0005: - return RntbdResourceType.User; - case 0x0006: - return RntbdResourceType.Permission; - case 0x0007: - return RntbdResourceType.StoredProcedure; - case 0x0008: - return RntbdResourceType.Conflict; - case 0x0009: - return RntbdResourceType.Trigger; - case 0x000A: - return RntbdResourceType.UserDefinedFunction; - case 0x000B: - return RntbdResourceType.Module; - case 0x000C: - return RntbdResourceType.Replica; - case 0x000D: - return RntbdResourceType.ModuleCommand; - case 0x000E: - return RntbdResourceType.Record; - case 0x000F: - return RntbdResourceType.Offer; - case 0x0010: - return RntbdResourceType.PartitionSetInformation; - case 0x0011: - return RntbdResourceType.XPReplicatorAddress; - case 0x0012: - return RntbdResourceType.MasterPartition; - case 0x0013: - return RntbdResourceType.ServerPartition; - case 0x0014: - return RntbdResourceType.DatabaseAccount; - case 0x0015: - return RntbdResourceType.Topology; - case 0x0016: - return RntbdResourceType.PartitionKeyRange; - // Obsolete and now undefined: case 0x0017: return RntbdResourceType.Timestamp; - case 0x0018: - return RntbdResourceType.Schema; - case 0x0019: - return RntbdResourceType.BatchApply; - case 0x001A: - return RntbdResourceType.RestoreMetadata; - case 0x001B: - return RntbdResourceType.ComputeGatewayCharges; - case 0x001C: - return RntbdResourceType.RidRange; - case 0x001D: - return RntbdResourceType.UserDefinedType; - } - throw new IllegalArgumentException(String.format("id: %d", id)); - } - - public short id() { - return this.id; - } - } - - public enum RntbdResponseHeader implements RntbdHeader { - - PayloadPresent((short)0x0000, RntbdTokenType.Byte, true), - // not used((short)0x0001), - LastStateChangeDateTime((short)0x0002, RntbdTokenType.SmallString, false), - ContinuationToken((short)0x0003, RntbdTokenType.String, false), - ETag((short)0x0004, RntbdTokenType.String, false), - // not used((short)0x005,) - // not used((short)0x006,) - ReadsPerformed((short)0x0007, RntbdTokenType.ULong, false), - WritesPerformed((short)0x0008, RntbdTokenType.ULong, false), - QueriesPerformed((short)0x0009, RntbdTokenType.ULong, false), - IndexTermsGenerated((short)0x000A, RntbdTokenType.ULong, false), - ScriptsExecuted((short)0x000B, RntbdTokenType.ULong, false), - RetryAfterMilliseconds((short)0x000C, RntbdTokenType.ULong, false), - IndexingDirective((short)0x000D, RntbdTokenType.Byte, false), - StorageMaxResoureQuota((short)0x000E, RntbdTokenType.String, false), - StorageResourceQuotaUsage((short)0x000F, RntbdTokenType.String, false), - SchemaVersion((short)0x0010, RntbdTokenType.SmallString, false), - CollectionPartitionIndex((short)0x0011, RntbdTokenType.ULong, false), - CollectionServiceIndex((short)0x0012, RntbdTokenType.ULong, false), - LSN((short)0x0013, RntbdTokenType.LongLong, false), - ItemCount((short)0x0014, RntbdTokenType.ULong, false), - RequestCharge((short)0x0015, RntbdTokenType.Double, false), - // not used((short)0x0016), - OwnerFullName((short)0x0017, RntbdTokenType.String, false), - OwnerId((short)0x0018, RntbdTokenType.String, false), - DatabaseAccountId((short)0x0019, RntbdTokenType.String, false), - QuorumAckedLSN((short)0x001A, RntbdTokenType.LongLong, false), - RequestValidationFailure((short)0x001B, RntbdTokenType.Byte, false), - SubStatus((short)0x001C, RntbdTokenType.ULong, false), - CollectionUpdateProgress((short)0x001D, RntbdTokenType.ULong, false), - CurrentWriteQuorum((short)0x001E, RntbdTokenType.ULong, false), - CurrentReplicaSetSize((short)0x001F, RntbdTokenType.ULong, false), - CollectionLazyIndexProgress((short)0x0020, RntbdTokenType.ULong, false), - PartitionKeyRangeId((short)0x0021, RntbdTokenType.String, false), - // not used((short)0x0022), RequestMessageReceivedTime - // not used((short)0x0023), ResponseMessageSentTime - // not used((short)0x0024), ResponseMessageTimeOffset - LogResults((short)0x0025, RntbdTokenType.String, false), - XPRole((short)0x0026, RntbdTokenType.ULong, false), - IsRUPerMinuteUsed((short)0x0027, RntbdTokenType.Byte, false), - QueryMetrics((short)0x0028, RntbdTokenType.String, false), - GlobalCommittedLSN((short)0x0029, RntbdTokenType.LongLong, false), - NumberOfReadRegions((short)0x0030, RntbdTokenType.ULong, false), - OfferReplacePending((short)0x0031, RntbdTokenType.Byte, false), - ItemLSN((short)0x0032, RntbdTokenType.LongLong, false), - RestoreState((short)0x0033, RntbdTokenType.String, false), - CollectionSecurityIdentifier((short)0x0034, RntbdTokenType.String, false), - TransportRequestID((short)0x0035, RntbdTokenType.ULong, false), - ShareThroughput((short)0x0036, RntbdTokenType.Byte, false), - // not used((short)0x0037), LeaseSeqNumber - DisableRntbdChannel((short)0x0038, RntbdTokenType.Byte, false), - ServerDateTimeUtc((short)0x0039, RntbdTokenType.SmallString, false), - LocalLSN((short)0x003A, RntbdTokenType.LongLong, false), - QuorumAckedLocalLSN((short)0x003B, RntbdTokenType.LongLong, false), - ItemLocalLSN((short)0x003C, RntbdTokenType.LongLong, false), - HasTentativeWrites((short)0x003D, RntbdTokenType.Byte, false), - SessionToken((short)0x003E, RntbdTokenType.String, false); - - public static final ImmutableMap map; - public static final ImmutableSet set = Sets.immutableEnumSet(EnumSet.allOf(RntbdResponseHeader.class)); - - static { - final Collector> collector = ImmutableMap.toImmutableMap(RntbdResponseHeader::id, header -> header); - map = set.stream().collect(collector); - } - - private final short id; - private final boolean isRequired; - private final RntbdTokenType type; - - RntbdResponseHeader(final short id, final RntbdTokenType type, final boolean isRequired) { - this.id = id; - this.type = type; - this.isRequired = isRequired; - } - - public boolean isRequired() { - return this.isRequired; - } - - public short id() { - return this.id; - } - - public RntbdTokenType type() { - return this.type; - } - } - - interface RntbdHeader { - - boolean isRequired(); - - short id(); - - String name(); - - RntbdTokenType type(); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContext.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContext.java deleted file mode 100644 index bd506d1425af..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContext.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ServerProperties; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.TransportException; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.http.HttpResponseStatus; - -import java.util.Collections; -import java.util.HashMap; -import java.util.UUID; - -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.CurrentProtocolVersion; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdContextHeader; - -public final class RntbdContext { - - private final RntbdResponseStatus frame; - private final Headers headers; - - private RntbdContext(final RntbdResponseStatus frame, final Headers headers) { - - this.frame = frame; - this.headers = headers; - } - - @JsonProperty - UUID getActivityId() { - return this.frame.getActivityId(); - } - - @JsonProperty - String getClientVersion() { - return this.headers.clientVersion.getValue(String.class); - } - - @JsonProperty - long getIdleTimeoutInSeconds() { - return this.headers.idleTimeoutInSeconds.getValue(Long.class); - } - - @JsonProperty - int getProtocolVersion() { - return this.headers.protocolVersion.getValue(Long.class).intValue(); - } - - @JsonProperty - ServerProperties getServerProperties() { - return new ServerProperties( - this.headers.serverAgent.getValue(String.class), - this.headers.serverVersion.getValue(String.class) - ); - } - - String getServerVersion() { - return this.headers.serverVersion.getValue(String.class); - } - - @JsonProperty - int getStatusCode() { - return this.frame.getStatusCode(); - } - - @JsonProperty - long getUnauthenticatedTimeoutInSeconds() { - return this.headers.unauthenticatedTimeoutInSeconds.getValue(Long.class); - } - - static RntbdContext decode(final ByteBuf in) throws TransportException { - - in.markReaderIndex(); - - final RntbdResponseStatus frame = RntbdResponseStatus.decode(in); - final int statusCode = frame.getStatusCode(); - final int headersLength = frame.getHeadersLength(); - - if (statusCode < 200 || statusCode >= 400) { - if (!RntbdFramer.canDecodePayload(in, in.readerIndex() + headersLength)) { - in.resetReaderIndex(); - return null; - } - } - - final Headers headers = Headers.decode(in.readSlice(headersLength)); - - if (statusCode < 200 || statusCode >= 400) { - - final ObjectNode details = RntbdObjectMapper.readTree(in.readSlice(in.readIntLE())); - final HashMap map = new HashMap<>(4); - - if (headers.clientVersion.isPresent()) { - map.put("requiredClientVersion", headers.clientVersion.getValue()); - } - - if (headers.protocolVersion.isPresent()) { - map.put("requiredProtocolVersion", headers.protocolVersion.getValue()); - } - - if (headers.serverAgent.isPresent()) { - map.put("serverAgent", headers.serverAgent.getValue()); - } - - if (headers.serverVersion.isPresent()) { - map.put("serverVersion", headers.serverVersion.getValue()); - } - - throw new TransportException(frame.getStatus(), details, Collections.unmodifiableMap(map)); - } - - return new RntbdContext(frame, headers); - } - - public void encode(final ByteBuf out) { - - final int start = out.writerIndex(); - - this.frame.encode(out); - this.headers.encode(out); - - final int length = out.writerIndex() - start; - - if (length != this.frame.getLength()) { - throw new IllegalStateException(); - } - } - - public static RntbdContext from(final RntbdContextRequest request, final ServerProperties properties, final HttpResponseStatus status) { - - // NOTE TO CODE REVIEWERS - // ---------------------- - // In its current form this method is meant to enable a limited set of test scenarios. It will be revised as - // required to support test scenarios as they are developed. - - final Headers headers = new Headers(); - - headers.clientVersion.setValue(request.getClientVersion()); - headers.idleTimeoutInSeconds.setValue(0); - headers.protocolVersion.setValue(CurrentProtocolVersion); - headers.serverAgent.setValue(properties.getAgent()); - headers.serverVersion.setValue(properties.getVersion()); - headers.unauthenticatedTimeoutInSeconds.setValue(0); - - final int length = RntbdResponseStatus.LENGTH + headers.computeLength(); - final UUID activityId = request.getActivityId(); - - final RntbdResponseStatus frame = new RntbdResponseStatus(length, status, activityId); - - return new RntbdContext(frame, headers); - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } - - private static final class Headers extends RntbdTokenStream { - - RntbdToken clientVersion; - RntbdToken idleTimeoutInSeconds; - RntbdToken protocolVersion; - RntbdToken serverAgent; - RntbdToken serverVersion; - RntbdToken unauthenticatedTimeoutInSeconds; - - Headers() { - - super(RntbdContextHeader.set, RntbdContextHeader.map); - - this.clientVersion = this.get(RntbdContextHeader.ClientVersion); - this.idleTimeoutInSeconds = this.get(RntbdContextHeader.IdleTimeoutInSeconds); - this.protocolVersion = this.get(RntbdContextHeader.ProtocolVersion); - this.serverAgent = this.get(RntbdContextHeader.ServerAgent); - this.serverVersion = this.get(RntbdContextHeader.ServerVersion); - this.unauthenticatedTimeoutInSeconds = this.get(RntbdContextHeader.UnauthenticatedTimeoutInSeconds); - } - - static Headers decode(final ByteBuf in) { - final Headers headers = new Headers(); - Headers.decode(in, headers); - return headers; - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextDecoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextDecoder.java deleted file mode 100644 index 8aea47b4881d..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextDecoder.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -class RntbdContextDecoder extends ByteToMessageDecoder { - - private static final Logger logger = LoggerFactory.getLogger(RntbdContextDecoder.class); - - /** - * Deserialize from an input {@link ByteBuf} to an {@link RntbdContext} instance - *

- * This method fulfills the promise of an {@link RntbdContext} instance. It does not pass the instance down the - * pipeline. - * - * @param context the {@link ChannelHandlerContext} to which this {@link ByteToMessageDecoder} belongs - * @param in the {@link ByteBuf} from which to readTree data - * @param out the {@link List} to which decoded messages should be added - * @throws Exception thrown if an error occurs - */ - @Override - protected void decode(final ChannelHandlerContext context, final ByteBuf in, final List out) throws Exception { - - if (RntbdFramer.canDecodeHead(in)) { - - final RntbdContext rntbdContext = RntbdContext.decode(in); - context.fireUserEventTriggered(rntbdContext); - in.discardReadBytes(); - - logger.debug("{} DECODE COMPLETE: {}", context.channel(), rntbdContext); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextNegotiator.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextNegotiator.java deleted file mode 100644 index bd5f5a079c14..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextNegotiator.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.Utils; -import io.netty.buffer.ByteBuf; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelPipeline; -import io.netty.channel.ChannelPromise; -import io.netty.channel.CombinedChannelDuplexHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.concurrent.CompletableFuture; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdContextNegotiator extends CombinedChannelDuplexHandler { - - private static final Logger logger = LoggerFactory.getLogger(RntbdContextNegotiator.class); - private final RntbdRequestManager manager; - private final UserAgentContainer userAgent; - - private volatile boolean pendingRntbdContextRequest = true; - - public RntbdContextNegotiator(final RntbdRequestManager manager, final UserAgentContainer userAgent) { - - super(new RntbdContextDecoder(), new RntbdContextRequestEncoder()); - - checkNotNull(manager, "manager"); - checkNotNull(userAgent, "userAgent"); - - this.manager = manager; - this.userAgent = userAgent; - } - - /** - * Called once a write operation is made. The write operation will write the messages through the - * {@link ChannelPipeline}. Those are then ready to be flushed to the actual {@link Channel} once - * {@link Channel#flush()} is called - * - * @param context the {@link ChannelHandlerContext} for which the write operation is made - * @param message the message to write - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void write( - final ChannelHandlerContext context, final Object message, final ChannelPromise promise - ) throws Exception { - - checkArgument(message instanceof ByteBuf, "message: %s", message.getClass()); - final ByteBuf out = (ByteBuf)message; - - if (this.manager.hasRntbdContext()) { - context.writeAndFlush(out, promise); - } else { - if (this.pendingRntbdContextRequest) { - // Thread safe: netty guarantees that no channel handler methods are called concurrently - this.startRntbdContextRequest(context); - this.pendingRntbdContextRequest = false; - } - this.manager.pendWrite(out, promise); - } - } - - // region Privates - - private void startRntbdContextRequest(final ChannelHandlerContext context) throws Exception { - - logger.debug("{} START CONTEXT REQUEST", context.channel()); - - final Channel channel = context.channel(); - final RntbdContextRequest request = new RntbdContextRequest(Utils.randomUUID(), this.userAgent); - final CompletableFuture contextRequestFuture = this.manager.getRntbdContextRequestFuture(); - - super.write(context, request, channel.newPromise().addListener((ChannelFutureListener)future -> { - - if (future.isSuccess()) { - contextRequestFuture.complete(request); - return; - } - - if (future.isCancelled()) { - contextRequestFuture.cancel(true); - return; - } - - contextRequestFuture.completeExceptionally(future.cause()); - })); - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequest.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequest.java deleted file mode 100644 index 8c22180925e2..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; - -import java.nio.charset.StandardCharsets; -import java.util.UUID; - -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.Versions; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.CurrentProtocolVersion; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdContextRequestHeader; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdOperationType; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdResourceType; - -public final class RntbdContextRequest { - - @JsonProperty - private final UUID activityId; - - @JsonProperty - private final Headers headers; - - RntbdContextRequest(final UUID activityId, final UserAgentContainer userAgent) { - this(activityId, new Headers(userAgent)); - } - - private RntbdContextRequest(final UUID activityId, final Headers headers) { - this.activityId = activityId; - this.headers = headers; - } - - public UUID getActivityId() { - return this.activityId; - } - - public String getClientVersion() { - return this.headers.clientVersion.getValue(String.class); - } - - public static RntbdContextRequest decode(final ByteBuf in) { - - final int resourceOperationTypeCode = in.getInt(in.readerIndex() + Integer.BYTES); - - if (resourceOperationTypeCode != 0) { - final String reason = String.format("resourceOperationCode=0x%08X", resourceOperationTypeCode); - throw new IllegalStateException(reason); - } - - final int start = in.readerIndex(); - final int expectedLength = in.readIntLE(); - - final RntbdRequestFrame header = RntbdRequestFrame.decode(in); - final Headers headers = Headers.decode(in.readSlice(expectedLength - (in.readerIndex() - start))); - - final int observedLength = in.readerIndex() - start; - - if (observedLength != expectedLength) { - final String reason = String.format("expectedLength=%d, observeredLength=%d", expectedLength, observedLength); - throw new IllegalStateException(reason); - } - - in.discardReadBytes(); - return new RntbdContextRequest(header.getActivityId(), headers); - } - - public void encode(final ByteBuf out) { - - final int expectedLength = RntbdRequestFrame.LENGTH + this.headers.computeLength(); - final int start = out.writerIndex(); - - out.writeIntLE(expectedLength); - - final RntbdRequestFrame header = new RntbdRequestFrame(this.getActivityId(), RntbdOperationType.Connection, RntbdResourceType.Connection); - header.encode(out); - this.headers.encode(out); - - final int observedLength = out.writerIndex() - start; - - if (observedLength != expectedLength) { - final String reason = String.format("expectedLength=%d, observeredLength=%d", expectedLength, observedLength); - throw new IllegalStateException(reason); - } - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } - - private static final class Headers extends RntbdTokenStream { - - private static final byte[] ClientVersion = Versions.CURRENT_VERSION.getBytes(StandardCharsets.UTF_8); - - @JsonProperty - RntbdToken clientVersion; - - @JsonProperty - RntbdToken protocolVersion; - - @JsonProperty - RntbdToken userAgent; - - Headers(final UserAgentContainer container) { - - this(); - - this.clientVersion.setValue(ClientVersion); - this.protocolVersion.setValue(CurrentProtocolVersion); - this.userAgent.setValue(container.getUserAgent()); - } - - private Headers() { - - super(RntbdContextRequestHeader.set, RntbdContextRequestHeader.map); - - this.clientVersion = this.get(RntbdContextRequestHeader.ClientVersion); - this.protocolVersion = this.get(RntbdContextRequestHeader.ProtocolVersion); - this.userAgent = this.get(RntbdContextRequestHeader.UserAgent); - } - - static Headers decode(final ByteBuf in) { - return Headers.decode(in, new Headers()); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestDecoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestDecoder.java deleted file mode 100644 index eeb951e727d7..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestDecoder.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; - -import java.util.List; - -public class RntbdContextRequestDecoder extends ByteToMessageDecoder { - - public RntbdContextRequestDecoder() { - this.setSingleDecode(true); - } - - /** - * Prepare for decoding an @{link RntbdContextRequest} or fire a channel readTree event to pass the input message along - * - * @param context the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to - * @param message the message to be decoded - * @throws Exception thrown if an error occurs - */ - @Override - public void channelRead(final ChannelHandlerContext context, final Object message) throws Exception { - - if (message instanceof ByteBuf) { - - final ByteBuf in = (ByteBuf)message; - final int resourceOperationType = in.getInt(in.readerIndex() + Integer.BYTES); - - if (resourceOperationType == 0) { - assert this.isSingleDecode(); - super.channelRead(context, message); - return; - } - } - context.fireChannelRead(message); - } - - /** - * Decode an RntbdContextRequest from an {@link ByteBuf} stream - *

- * This method will be called till either an input {@link ByteBuf} has nothing to readTree on return from this method or - * till nothing is readTree from the input {@link ByteBuf}. - * - * @param context the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to - * @param in the {@link ByteBuf} from which to readTree data - * @param out the {@link List} to which decoded messages should be added - * @throws IllegalStateException thrown if an error occurs - */ - @Override - protected void decode(final ChannelHandlerContext context, final ByteBuf in, final List out) throws IllegalStateException { - - final RntbdContextRequest request; - in.markReaderIndex(); - - try { - request = RntbdContextRequest.decode(in); - } catch (final IllegalStateException error) { - in.resetReaderIndex(); - throw error; - } - - in.discardReadBytes(); - out.add(request); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestEncoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestEncoder.java deleted file mode 100644 index f078811f5b84..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestEncoder.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToByteEncoder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -final class RntbdContextRequestEncoder extends MessageToByteEncoder { - - private static final Logger Logger = LoggerFactory.getLogger(RntbdContextRequestEncoder.class); - - /** - * Returns {@code true} if the given message is an @{link RntbdContextRequest} instance - *

- * If {@code false} this message should be passed to the next @{link ChannelOutboundHandler} in the pipeline. - * - * @param message the message to encode - * @return @{code true}, if the given message is an an @{link RntbdContextRequest} instance; otherwise @{false} - */ - @Override - public boolean acceptOutboundMessage(final Object message) { - return message instanceof RntbdContextRequest; - } - - /** - * Encode an @{link RntbdContextRequest} message into a {@link ByteBuf} - *

- * This method will be called for each written message that can be handled by this encoder. - * - * @param context the {@link ChannelHandlerContext} which this {@link MessageToByteEncoder} belongs to - * @param message the message to encode - * @param out the {@link ByteBuf} into which the encoded message will be written - * @throws IllegalStateException is thrown if an error occurs - */ - @Override - protected void encode(final ChannelHandlerContext context, final Object message, final ByteBuf out) throws IllegalStateException { - - final RntbdContextRequest request = (RntbdContextRequest)message; - out.markWriterIndex(); - - try { - request.encode(out); - } catch (final IllegalStateException error) { - out.resetWriterIndex(); - throw error; - } - - Logger.debug("{}: ENCODE COMPLETE: request={}", context.channel(), request); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdEndpoint.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdEndpoint.java deleted file mode 100644 index 27cf10d49070..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdEndpoint.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.ssl.SslContext; - -import java.net.URI; -import java.util.concurrent.CompletableFuture; -import java.util.stream.Stream; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.RntbdTransportClient.Options; - -public interface RntbdEndpoint extends AutoCloseable { - - String getName(); - - @Override - void close() throws RuntimeException; - - CompletableFuture request(RntbdRequestArgs requestArgs); - - interface Provider extends AutoCloseable { - - @Override - void close() throws RuntimeException; - - Config config(); - - int count(); - - RntbdEndpoint get(URI physicalAddress); - - Stream list(); - } - - final class Config { - - private final Options options; - private final SslContext sslContext; - private final LogLevel wireLogLevel; - - public Config(final Options options, final SslContext sslContext, final LogLevel wireLogLevel) { - - checkNotNull(options, "options"); - checkNotNull(sslContext, "sslContext"); - - this.options = options; - this.sslContext = sslContext; - this.wireLogLevel = wireLogLevel; - } - - public int getConnectionTimeout() { - final long value = this.options.getConnectionTimeout().toMillis(); - assert value <= Integer.MAX_VALUE; - return (int)value; - } - - public int getMaxChannelsPerEndpoint() { - return this.options.getMaxChannelsPerEndpoint(); - } - - public int getMaxRequestsPerChannel() { - return this.options.getMaxRequestsPerChannel(); - } - - public long getReceiveHangDetectionTime() { - return this.options.getReceiveHangDetectionTime().toNanos(); - } - - public long getRequestTimeout() { - return this.options.getRequestTimeout().toNanos(); - } - - public long getSendHangDetectionTime() { - return this.options.getSendHangDetectionTime().toNanos(); - } - - public SslContext getSslContext() { - return this.sslContext; - } - - public UserAgentContainer getUserAgent() { - return this.options.getUserAgent(); - } - - public LogLevel getWireLogLevel() { - return this.wireLogLevel; - } - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdFramer.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdFramer.java deleted file mode 100644 index 2b38ceb4c3ff..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdFramer.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; - -import static com.google.common.base.Preconditions.checkNotNull; - -final class RntbdFramer { - - private RntbdFramer() { - } - - static boolean canDecodeHead(final ByteBuf in) throws CorruptedFrameException { - - checkNotNull(in, "in"); - - if (in.readableBytes() < RntbdResponseStatus.LENGTH) { - return false; - } - - final int start = in.readerIndex(); - final long length = in.getUnsignedIntLE(start); - - if (length > Integer.MAX_VALUE) { - final String reason = String.format("Head frame length exceeds Integer.MAX_VALUE, %d: %d", - Integer.MAX_VALUE, length - ); - throw new CorruptedFrameException(reason); - } - - if (length < Integer.BYTES) { - final String reason = String.format("Head frame length is less than size of length field, %d: %d", - Integer.BYTES, length - ); - throw new CorruptedFrameException(reason); - } - - return length <= in.readableBytes(); - } - - static boolean canDecodePayload(final ByteBuf in, final int start) { - - checkNotNull(in, "in"); - - final int readerIndex = in.readerIndex(); - - if (start < readerIndex) { - throw new IllegalArgumentException("start < in.readerIndex()"); - } - - final int offset = start - readerIndex; - - if (in.readableBytes() - offset < Integer.BYTES) { - return false; - } - - final long length = in.getUnsignedIntLE(start); - - if (length > Integer.MAX_VALUE) { - final String reason = String.format("Payload frame length exceeds Integer.MAX_VALUE, %d: %d", - Integer.MAX_VALUE, length - ); - throw new CorruptedFrameException(reason); - } - - return offset + Integer.BYTES + length <= in.readableBytes(); - } - - static boolean canDecodePayload(final ByteBuf in) { - return canDecodePayload(in, in.readerIndex()); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdMetrics.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdMetrics.java deleted file mode 100644 index a0fef0c4a43e..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdMetrics.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.codahale.metrics.Gauge; -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricFilter; -import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.RatioGauge; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.google.common.base.Stopwatch; - -import java.time.Duration; - -@JsonPropertyOrder({ - "lifetime", "requests", "responses", "errorResponses", "responseRate", "completionRate", "throughput" -}) -public final class RntbdMetrics implements AutoCloseable { - - // region Fields - - private static final MetricRegistry registry = new MetricRegistry(); - - private final Gauge completionRate; - private final Meter errorResponses; - private final Stopwatch lifetime; - private final String prefix; - private final Meter requests; - private final Gauge responseRate; - private final Meter responses; - - // endregion - - // region Constructors - - public RntbdMetrics(final String name) { - - this.lifetime = Stopwatch.createStarted(); - this.prefix = name + '.'; - - this.requests = registry.register(this.prefix + "requests", new Meter()); - this.responses = registry.register(this.prefix + "responses", new Meter()); - this.errorResponses = registry.register(this.prefix + "errorResponses", new Meter()); - this.responseRate = registry.register(this.prefix + "responseRate", new ResponseRate(this)); - this.completionRate = registry.register(this.prefix + "completionRate", new CompletionRate(this)); - } - - // endregion - - // region Accessors - - public double getCompletionRate() { - return this.completionRate.getValue(); - } - - public long getErrorResponses() { - return this.errorResponses.getCount(); - } - - public double getLifetime() { - final Duration elapsed = this.lifetime.elapsed(); - return elapsed.getSeconds() + (1E-9D * elapsed.getNano()); - } - - public long getRequests() { - return this.requests.getCount(); - } - - public double getResponseRate() { - return this.responseRate.getValue(); - } - - public long getResponses() { - return this.responses.getCount(); - } - - public double getThroughput() { - return this.responses.getMeanRate(); - } - - // endregion - - // region Methods - - @Override - public void close() { - registry.removeMatching(MetricFilter.startsWith(this.prefix)); - } - - public final void incrementErrorResponseCount() { - this.errorResponses.mark(); - } - - public final void incrementRequestCount() { - this.requests.mark(); - } - - public final void incrementResponseCount() { - this.responses.mark(); - } - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - - // endregion - - private static final class CompletionRate extends RatioGauge { - - private final RntbdMetrics metrics; - - private CompletionRate(RntbdMetrics metrics) { - this.metrics = metrics; - } - - @Override - protected Ratio getRatio() { - return Ratio.of(this.metrics.responses.getCount() - this.metrics.errorResponses.getCount(), - this.metrics.requests.getCount()); - } - } - - private static final class ResponseRate extends RatioGauge { - - private final RntbdMetrics metrics; - - private ResponseRate(RntbdMetrics metrics) { - this.metrics = metrics; - } - - @Override - protected Ratio getRatio() { - return Ratio.of(this.metrics.responses.getCount(), this.metrics.requests.getCount()); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdObjectMapper.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdObjectMapper.java deleted file mode 100644 index 6b9c7d984373..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdObjectMapper.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.node.JsonNodeType; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.databind.ser.PropertyFilter; -import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufInputStream; -import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.EncoderException; - -import java.io.IOException; -import java.io.InputStream; - -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdObjectMapper { - - private static final SimpleFilterProvider filterProvider; - private static final ObjectMapper objectMapper; - private static final ObjectWriter objectWriter; - - static { - objectMapper = new ObjectMapper().setFilterProvider(filterProvider = new SimpleFilterProvider()); - objectWriter = objectMapper.writer(); - } - - private RntbdObjectMapper() { - } - - static ObjectNode readTree(final RntbdResponse response) { - checkNotNull(response, "response"); - return readTree(response.getContent()); - } - - static ObjectNode readTree(final ByteBuf in) { - - checkNotNull(in, "in"); - final JsonNode node; - - try (final InputStream istream = new ByteBufInputStream(in)) { - node = objectMapper.readTree(istream); - } catch (final IOException error) { - throw new CorruptedFrameException(error); - } - - if (node.isObject()) { - return (ObjectNode)node; - } - - final String cause = String.format("Expected %s, not %s", JsonNodeType.OBJECT, node.getNodeType()); - throw new CorruptedFrameException(cause); - } - - static void registerPropertyFilter(final Class type, final Class filter) { - - checkNotNull(type, "type"); - checkNotNull(filter, "filter"); - - try { - filterProvider.addFilter(type.getSimpleName(), filter.newInstance()); - } catch (final ReflectiveOperationException error) { - throw new IllegalStateException(error); - } - } - - public static String toJson(Object value) { - try { - return objectWriter.writeValueAsString(value); - } catch (final JsonProcessingException error) { - throw new EncoderException(error); - } - } - - public static ObjectWriter writer() { - return objectWriter; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdReporter.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdReporter.java deleted file mode 100644 index 5f0ee7d3de0e..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdReporter.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.slf4j.Logger; -import org.slf4j.helpers.FormattingTuple; -import org.slf4j.helpers.MessageFormatter; - -import java.nio.file.Paths; - -public final class RntbdReporter { - - private static final String codeSource = Paths.get( - RntbdReporter.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getFileName().toString(); - - private RntbdReporter() { - } - - public static void reportIssue(Logger logger, Object subject, String format, Object... arguments) { - if (logger.isErrorEnabled()) { - doReportIssue(logger, subject, format, arguments); - } - } - - public static void reportIssueUnless( - boolean predicate, Logger logger, Object subject, String format, Object... arguments - ) { - if (!predicate && logger.isErrorEnabled()) { - doReportIssue(logger, subject, format, arguments); - } - } - - private static void doReportIssue(Logger logger, Object subject, String format, Object[] arguments) { - - FormattingTuple formattingTuple = MessageFormatter.arrayFormat(format, arguments); - StackTraceElement[] stackTraceElements = new Exception().getStackTrace(); - Throwable throwable = formattingTuple.getThrowable(); - - if (throwable == null) { - logger.error("Report this {} issue to ensure it is addressed:\n[{}]\n[{}]\n[{}]", - codeSource, subject, stackTraceElements[2], formattingTuple.getMessage() - ); - } else { - logger.error("Report this {} issue to ensure it is addressed:\n[{}]\n[{}]\n[{}{}{}]", - codeSource, subject, stackTraceElements[2], formattingTuple.getMessage(), - throwable, ExceptionUtils.getStackTrace(throwable) - ); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequest.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequest.java deleted file mode 100644 index 90f041a305f5..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; - -import java.util.UUID; - -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdRequest { - - private static final byte[] EmptyByteArray = {}; - - private final RntbdRequestFrame frame; - private final RntbdRequestHeaders headers; - private final byte[] payload; - - private RntbdRequest(final RntbdRequestFrame frame, final RntbdRequestHeaders headers, final byte[] payload) { - - checkNotNull(frame, "frame"); - checkNotNull(headers, "headers"); - - this.frame = frame; - this.headers = headers; - this.payload = payload == null ? EmptyByteArray : payload; - } - - public UUID getActivityId() { - return this.frame.getActivityId(); - } - - static RntbdRequest decode(final ByteBuf in) { - - final int resourceOperationCode = in.getInt(in.readerIndex() + Integer.BYTES); - - if (resourceOperationCode == 0) { - final String reason = String.format("resourceOperationCode=0x%08X", resourceOperationCode); - throw new IllegalStateException(reason); - } - - final int start = in.readerIndex(); - final int expectedLength = in.readIntLE(); - - final RntbdRequestFrame header = RntbdRequestFrame.decode(in); - final RntbdRequestHeaders metadata = RntbdRequestHeaders.decode(in); - final ByteBuf payloadBuf = in.readSlice(expectedLength - (in.readerIndex() - start)); - - final int observedLength = in.readerIndex() - start; - - if (observedLength != expectedLength) { - final String reason = String.format("expectedLength=%d, observedLength=%d", expectedLength, observedLength); - throw new IllegalStateException(reason); - } - - final byte[] payload = new byte[payloadBuf.readableBytes()]; - payloadBuf.readBytes(payload); - in.discardReadBytes(); - - return new RntbdRequest(header, metadata, payload); - } - - void encode(final ByteBuf out) { - - final int expectedLength = RntbdRequestFrame.LENGTH + this.headers.computeLength(); - final int start = out.readerIndex(); - - out.writeIntLE(expectedLength); - this.frame.encode(out); - this.headers.encode(out); - - assert out.writerIndex() - start == expectedLength; - - if (this.payload.length > 0) { - out.writeIntLE(this.payload.length); - out.writeBytes(this.payload); - } - } - - public static RntbdRequest from(final RntbdRequestArgs args) { - - final RxDocumentServiceRequest serviceRequest = args.getServiceRequest(); - - final RntbdRequestFrame frame = new RntbdRequestFrame( - args.getActivityId(), - serviceRequest.getOperationType(), - serviceRequest.getResourceType()); - - final RntbdRequestHeaders headers = new RntbdRequestHeaders(args, frame); - - return new RntbdRequest(frame, headers, serviceRequest.getContent()); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestArgs.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestArgs.java deleted file mode 100644 index 226259c6e229..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestArgs.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.google.common.base.Stopwatch; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.channel.ChannelHandlerContext; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; - -import java.math.BigDecimal; -import java.net.URI; -import java.time.Duration; -import java.util.UUID; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdRequestArgs { - - private static final String className = RntbdRequestArgs.class.getCanonicalName(); - - private final UUID activityId; - private final long birthTime; - private final Stopwatch lifetime; - private final URI physicalAddress; - private final String replicaPath; - private final RxDocumentServiceRequest serviceRequest; - - public RntbdRequestArgs(final RxDocumentServiceRequest serviceRequest, final URI physicalAddress) { - this.activityId = UUID.fromString(serviceRequest.getActivityId()); - this.birthTime = System.nanoTime(); - this.lifetime = Stopwatch.createStarted(); - this.physicalAddress = physicalAddress; - this.replicaPath = StringUtils.stripEnd(physicalAddress.getPath(), "/"); - this.serviceRequest = serviceRequest; - } - - public UUID getActivityId() { - return this.activityId; - } - - public long getBirthTime() { - return this.birthTime; - } - - public Duration getLifetime() { - return this.lifetime.elapsed(); - } - - public String getReplicaPath() { - return this.replicaPath; - } - - public URI getPhysicalAddress() { - return this.physicalAddress; - } - - public RxDocumentServiceRequest getServiceRequest() { - return this.serviceRequest; - } - - @Override - public String toString() { - return '[' + RntbdRequestArgs.className + '(' + this.serviceRequest.getActivityId() - + ", origin: " + this.physicalAddress.getScheme() + "://" + this.physicalAddress.getAuthority() - + ", operationType: " + this.serviceRequest.getOperationType() - + ", resourceType: " + this.serviceRequest.getResourceType() - + ", replicaPath: " + this.replicaPath - + ", lifetime: " + this.getLifetime() - + ")]"; - } - - public void traceOperation(final Logger logger, final ChannelHandlerContext context, final String operationName, final Object... args) { - - checkNotNull(logger, "logger"); - - if (logger.isTraceEnabled()) { - final BigDecimal lifetime = BigDecimal.valueOf(this.lifetime.elapsed().toNanos(), 6); - logger.trace("{},{},\"{}({})\",\"{}\",\"{}\"", this.birthTime, lifetime, operationName, - Stream.of(args).map(arg -> - arg == null ? "null" : arg.toString()).collect(Collectors.joining(",") - ), - this, context - ); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestDecoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestDecoder.java deleted file mode 100644 index 3f1de9c65c24..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestDecoder.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; - -import java.util.List; - -public final class RntbdRequestDecoder extends ByteToMessageDecoder { - /** - * Prepare for decoding an @{link RntbdRequest} or fire a channel readTree event to pass the input message along - * - * @param context the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to - * @param message the message to be decoded - * @throws Exception thrown if an error occurs - */ - @Override - public void channelRead(final ChannelHandlerContext context, final Object message) throws Exception { - - if (message instanceof ByteBuf) { - - final ByteBuf in = (ByteBuf)message; - final int resourceOperationType = in.getInt(in.readerIndex() + Integer.BYTES); - - if (resourceOperationType != 0) { - super.channelRead(context, message); - return; - } - } - - context.fireChannelRead(message); - } - - /** - * Decode the input {@link ByteBuf} to an RntbdRequest instance - *

- * This method will be called till either the input {@link ByteBuf} has nothing to readTree after return from this - * method or till nothing was readTree from the input {@link ByteBuf}. - * - * @param context the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to - * @param in the {@link ByteBuf} from which to readTree data - * @param out the {@link List} to which decoded messages should be added - * @throws IllegalStateException thrown if an error occurs - */ - @Override - protected void decode(final ChannelHandlerContext context, final ByteBuf in, final List out) throws IllegalStateException { - - final RntbdRequest request; - in.markReaderIndex(); - - try { - request = RntbdRequest.decode(in); - } catch (final IllegalStateException error) { - in.resetReaderIndex(); - throw error; - } - - in.discardReadBytes(); - out.add(request); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestEncoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestEncoder.java deleted file mode 100644 index 247ca7d19878..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestEncoder.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelOutboundHandler; -import io.netty.handler.codec.MessageToByteEncoder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class RntbdRequestEncoder extends MessageToByteEncoder { - - private static final Logger logger = LoggerFactory.getLogger(RntbdRequestEncoder.class); - - /** - * Returns {@code true} if the given message is an @{link RntbdRequest} instance - *

- * If {@code false} this message should be passed to the next {@link ChannelOutboundHandler} in the pipeline. - * - * @param message the message to encode - * @return {@code true}, if the given message is an an {@link RntbdRequest} instance; otherwise @{false} - */ - @Override - public boolean acceptOutboundMessage(final Object message) { - return message instanceof RntbdRequestArgs; - } - - /** - * Encode a message into a {@link ByteBuf} - *

- * This method will be called for each message that can be written by this encoder. - * - * @param context the {@link ChannelHandlerContext} which this {@link MessageToByteEncoder} belongs encode - * @param message the message to encode - * @param out the {@link ByteBuf} into which the encoded message will be written - */ - @Override - protected void encode(final ChannelHandlerContext context, final Object message, final ByteBuf out) throws Exception { - - final RntbdRequest request = RntbdRequest.from((RntbdRequestArgs)message); - final int start = out.writerIndex(); - - try { - request.encode(out); - } catch (final Throwable error) { - out.writerIndex(start); - throw error; - } - - if (logger.isDebugEnabled()) { - final int length = out.writerIndex() - start; - logger.debug("{}: ENCODE COMPLETE: length={}, request={}", context.channel(), length, request); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFrame.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFrame.java deleted file mode 100644 index 80c181d5bfb2..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFrame.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import io.netty.buffer.ByteBuf; - -import java.util.Locale; -import java.util.UUID; - -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdOperationType; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdResourceType; - -final class RntbdRequestFrame { - - // region Fields - - static final int LENGTH = Integer.BYTES // messageLength - + Short.BYTES // resourceType - + Short.BYTES // operationType - + 2 * Long.BYTES; // activityId - - private final UUID activityId; - private final RntbdOperationType operationType; - private final RntbdResourceType resourceType; - - // region Constructors - - RntbdRequestFrame(final UUID activityId, final OperationType operationType, final ResourceType resourceType) { - this(activityId, map(operationType), map(resourceType)); - } - - RntbdRequestFrame(final UUID activityId, final RntbdOperationType operationType, final RntbdResourceType resourceType) { - this.activityId = activityId; - this.operationType = operationType; - this.resourceType = resourceType; - } - - // endregion - - // region Methods - - UUID getActivityId() { - return this.activityId; - } - - RntbdOperationType getOperationType() { - return this.operationType; - } - - RntbdResourceType getResourceType() { - return this.resourceType; - } - - static RntbdRequestFrame decode(final ByteBuf in) { - - final RntbdResourceType resourceType = RntbdResourceType.fromId(in.readShortLE()); - final RntbdOperationType operationType = RntbdOperationType.fromId(in.readShortLE()); - final UUID activityId = RntbdUUID.decode(in); - - return new RntbdRequestFrame(activityId, operationType, resourceType); - } - - void encode(final ByteBuf out) { - out.writeShortLE(this.resourceType.id()); - out.writeShortLE(this.operationType.id()); - RntbdUUID.encode(this.activityId, out); - } - - private static RntbdResourceType map(final ResourceType resourceType) { - - switch (resourceType) { - case Attachment: - return RntbdResourceType.Attachment; - case DocumentCollection: - return RntbdResourceType.Collection; - case Conflict: - return RntbdResourceType.Conflict; - case Database: - return RntbdResourceType.Database; - case Document: - return RntbdResourceType.Document; - case Module: - return RntbdResourceType.Module; - case ModuleCommand: - return RntbdResourceType.ModuleCommand; - case Record: - return RntbdResourceType.Record; - case Permission: - return RntbdResourceType.Permission; - case Replica: - return RntbdResourceType.Replica; - case StoredProcedure: - return RntbdResourceType.StoredProcedure; - case Trigger: - return RntbdResourceType.Trigger; - case User: - return RntbdResourceType.User; - case UserDefinedType: - return RntbdResourceType.UserDefinedType; - case UserDefinedFunction: - return RntbdResourceType.UserDefinedFunction; - case Offer: - return RntbdResourceType.Offer; - case PartitionSetInformation: - return RntbdResourceType.PartitionSetInformation; - case XPReplicatorAddress: - return RntbdResourceType.XPReplicatorAddress; - case MasterPartition: - return RntbdResourceType.MasterPartition; - case ServerPartition: - return RntbdResourceType.ServerPartition; - case DatabaseAccount: - return RntbdResourceType.DatabaseAccount; - case Topology: - return RntbdResourceType.Topology; - case PartitionKeyRange: - return RntbdResourceType.PartitionKeyRange; - case Schema: - return RntbdResourceType.Schema; - case BatchApply: - return RntbdResourceType.BatchApply; - case RestoreMetadata: - return RntbdResourceType.RestoreMetadata; - case ComputeGatewayCharges: - return RntbdResourceType.ComputeGatewayCharges; - case RidRange: - return RntbdResourceType.RidRange; - default: - final String reason = String.format(Locale.ROOT, "Unrecognized resource type: %s", resourceType); - throw new UnsupportedOperationException(reason); - } - } - - private static RntbdOperationType map(final OperationType operationType) { - - switch (operationType) { - case Crash: - return RntbdOperationType.Crash; - case Create: - return RntbdOperationType.Create; - case Delete: - return RntbdOperationType.Delete; - case ExecuteJavaScript: - return RntbdOperationType.ExecuteJavaScript; - case Query: - return RntbdOperationType.Query; - case Pause: - return RntbdOperationType.Pause; - case Read: - return RntbdOperationType.Read; - case ReadFeed: - return RntbdOperationType.ReadFeed; - case Recreate: - return RntbdOperationType.Recreate; - case Recycle: - return RntbdOperationType.Recycle; - case Replace: - return RntbdOperationType.Replace; - case Resume: - return RntbdOperationType.Resume; - case Stop: - return RntbdOperationType.Stop; - case SqlQuery: - return RntbdOperationType.SQLQuery; - case Update: - return RntbdOperationType.Update; - case ForceConfigRefresh: - return RntbdOperationType.ForceConfigRefresh; - case Head: - return RntbdOperationType.Head; - case HeadFeed: - return RntbdOperationType.HeadFeed; - case Upsert: - return RntbdOperationType.Upsert; - case Throttle: - return RntbdOperationType.Throttle; - case PreCreateValidation: - return RntbdOperationType.PreCreateValidation; - case GetSplitPoint: - return RntbdOperationType.GetSplitPoint; - case AbortSplit: - return RntbdOperationType.AbortSplit; - case CompleteSplit: - return RntbdOperationType.CompleteSplit; - case BatchApply: - return RntbdOperationType.BatchApply; - case OfferUpdateOperation: - return RntbdOperationType.OfferUpdateOperation; - case OfferPreGrowValidation: - return RntbdOperationType.OfferPreGrowValidation; - case BatchReportThroughputUtilization: - return RntbdOperationType.BatchReportThroughputUtilization; - case AbortPartitionMigration: - return RntbdOperationType.AbortPartitionMigration; - case CompletePartitionMigration: - return RntbdOperationType.CompletePartitionMigration; - case PreReplaceValidation: - return RntbdOperationType.PreReplaceValidation; - case MigratePartition: - return RntbdOperationType.MigratePartition; - case AddComputeGatewayRequestCharges: - return RntbdOperationType.AddComputeGatewayRequestCharges; - default: - final String reason = String.format(Locale.ROOT, "Unrecognized operation type: %s", operationType); - throw new UnsupportedOperationException(reason); - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFramer.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFramer.java deleted file mode 100644 index 21a64a554ee1..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFramer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -import java.nio.ByteOrder; - -public final class RntbdRequestFramer extends LengthFieldBasedFrameDecoder { - - public RntbdRequestFramer() { - super(ByteOrder.LITTLE_ENDIAN, Integer.MAX_VALUE, 0, Integer.BYTES, -Integer.BYTES, 0, true); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestHeaders.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestHeaders.java deleted file mode 100644 index bac0da32f9b6..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestHeaders.java +++ /dev/null @@ -1,1272 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.IndexingDirective; -import com.microsoft.azure.cosmosdb.internal.ContentSerializationFormat; -import com.microsoft.azure.cosmosdb.internal.EnumerationDirection; -import com.microsoft.azure.cosmosdb.internal.FanoutOperationState; -import com.microsoft.azure.cosmosdb.internal.MigrateCollectionDirective; -import com.microsoft.azure.cosmosdb.internal.Paths; -import com.microsoft.azure.cosmosdb.internal.ReadFeedKeyType; -import com.microsoft.azure.cosmosdb.internal.RemoteStorageType; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; -import org.apache.commons.lang3.EnumUtils; -import org.apache.commons.lang3.StringUtils; - -import java.util.Base64; -import java.util.Locale; -import java.util.Map; -import java.util.function.Supplier; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.HttpHeaders; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants.BackendHeaders; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdConsistencyLevel; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdContentSerializationFormat; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdEnumerationDirection; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdFanoutOperationState; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdIndexingDirective; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdMigrateCollectionDirective; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdOperationType; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdReadFeedKeyType; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdRemoteStorageType; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdRequestHeader; - -@JsonFilter("RntbdToken") -final class RntbdRequestHeaders extends RntbdTokenStream { - - // region Fields - - private static final String UrlTrim = "/+"; - - // endregion - - // region Constructors - - RntbdRequestHeaders(final RntbdRequestArgs args, final RntbdRequestFrame frame) { - - this(); - - checkNotNull(args, "args"); - checkNotNull(frame, "frame"); - - final RxDocumentServiceRequest request = args.getServiceRequest(); - final byte[] content = request.getContent(); - - this.getPayloadPresent().setValue(content != null && content.length > 0); - this.getReplicaPath().setValue(args.getReplicaPath()); - - final Map headers = request.getHeaders(); - - // Special-case headers - - this.addAimHeader(headers); - this.addAllowScanOnQuery(headers); - this.addBinaryIdIfPresent(headers); - this.addCanCharge(headers); - this.addCanOfferReplaceComplete(headers); - this.addCanThrottle(headers); - this.addCollectionRemoteStorageSecurityIdentifier(headers); - this.addConsistencyLevelHeader(headers); - this.addContentSerializationFormat(headers); - this.addContinuationToken(request); - this.addDateHeader(headers); - this.addDisableRUPerMinuteUsage(headers); - this.addEmitVerboseTracesInQuery(headers); - this.addEnableLogging(headers); - this.addEnableLowPrecisionOrderBy(headers); - this.addEntityId(headers); - this.addEnumerationDirection(headers); - this.addExcludeSystemProperties(headers); - this.addFanoutOperationStateHeader(headers); - this.addIfModifiedSinceHeader(headers); - this.addIndexingDirectiveHeader(headers); - this.addIsAutoScaleRequest(headers); - this.addIsFanout(headers); - this.addIsReadOnlyScript(headers); - this.addIsUserRequest(headers); - this.addMatchHeader(headers, frame.getOperationType()); - this.addMigrateCollectionDirectiveHeader(headers); - this.addPageSize(headers); - this.addPopulateCollectionThroughputInfo(headers); - this.addPopulatePartitionStatistics(headers); - this.addPopulateQueryMetrics(headers); - this.addPopulateQuotaInfo(headers); - this.addProfileRequest(headers); - this.addQueryForceScan(headers); - this.addRemoteStorageType(headers); - this.addResourceIdOrPathHeaders(request); - this.addResponseContinuationTokenLimitInKb(headers); - this.addShareThroughput(headers); - this.addStartAndEndKeys(headers); - this.addSupportSpatialLegacyCoordinates(headers); - this.addUsePolygonsSmallerThanAHemisphere(headers); - - // Normal headers (Strings, Ints, Longs, etc.) - - this.fillTokenFromHeader(headers, this::getAllowTentativeWrites, BackendHeaders.ALLOW_TENTATIVE_WRITES); - this.fillTokenFromHeader(headers, this::getAuthorizationToken, HttpHeaders.AUTHORIZATION); - this.fillTokenFromHeader(headers, this::getBinaryPassThroughRequest, BackendHeaders.BINARY_PASSTHROUGH_REQUEST); - this.fillTokenFromHeader(headers, this::getBindReplicaDirective, BackendHeaders.BIND_REPLICA_DIRECTIVE); - this.fillTokenFromHeader(headers, this::getClientRetryAttemptCount, HttpHeaders.CLIENT_RETRY_ATTEMPT_COUNT); - this.fillTokenFromHeader(headers, this::getCollectionPartitionIndex, BackendHeaders.COLLECTION_PARTITION_INDEX); - this.fillTokenFromHeader(headers, this::getCollectionRid, BackendHeaders.COLLECTION_RID); - this.fillTokenFromHeader(headers, this::getCollectionServiceIndex, BackendHeaders.COLLECTION_SERVICE_INDEX); - this.fillTokenFromHeader(headers, this::getEffectivePartitionKey, BackendHeaders.EFFECTIVE_PARTITION_KEY); - this.fillTokenFromHeader(headers, this::getEnableDynamicRidRangeAllocation, BackendHeaders.ENABLE_DYNAMIC_RID_RANGE_ALLOCATION); - this.fillTokenFromHeader(headers, this::getFilterBySchemaRid, HttpHeaders.FILTER_BY_SCHEMA_RESOURCE_ID); - this.fillTokenFromHeader(headers, this::getGatewaySignature, HttpHeaders.GATEWAY_SIGNATURE); - this.fillTokenFromHeader(headers, this::getPartitionCount, BackendHeaders.PARTITION_COUNT); - this.fillTokenFromHeader(headers, this::getPartitionKey, HttpHeaders.PARTITION_KEY); - this.fillTokenFromHeader(headers, this::getPartitionKeyRangeId, HttpHeaders.PARTITION_KEY_RANGE_ID); - this.fillTokenFromHeader(headers, this::getPartitionResourceFilter, BackendHeaders.PARTITION_RESOURCE_FILTER); - this.fillTokenFromHeader(headers, this::getPostTriggerExclude, HttpHeaders.POST_TRIGGER_EXCLUDE); - this.fillTokenFromHeader(headers, this::getPostTriggerInclude, HttpHeaders.POST_TRIGGER_INCLUDE); - this.fillTokenFromHeader(headers, this::getPreTriggerExclude, HttpHeaders.PRE_TRIGGER_EXCLUDE); - this.fillTokenFromHeader(headers, this::getPreTriggerInclude, HttpHeaders.PRE_TRIGGER_INCLUDE); - this.fillTokenFromHeader(headers, this::getPrimaryMasterKey, BackendHeaders.PRIMARY_MASTER_KEY); - this.fillTokenFromHeader(headers, this::getPrimaryReadonlyKey, BackendHeaders.PRIMARY_READONLY_KEY); - this.fillTokenFromHeader(headers, this::getRemainingTimeInMsOnClientRequest, HttpHeaders.REMAINING_TIME_IN_MS_ON_CLIENT_REQUEST); - this.fillTokenFromHeader(headers, this::getResourceSchemaName, BackendHeaders.RESOURCE_SCHEMA_NAME); - this.fillTokenFromHeader(headers, this::getResourceTokenExpiry, HttpHeaders.RESOURCE_TOKEN_EXPIRY); - this.fillTokenFromHeader(headers, this::getRestoreMetadataFilter, HttpHeaders.RESTORE_METADATA_FILTER); - this.fillTokenFromHeader(headers, this::getRestoreParams, BackendHeaders.RESTORE_PARAMS); - this.fillTokenFromHeader(headers, this::getSecondaryMasterKey, BackendHeaders.SECONDARY_MASTER_KEY); - this.fillTokenFromHeader(headers, this::getSecondaryReadonlyKey, BackendHeaders.SECONDARY_READONLY_KEY); - this.fillTokenFromHeader(headers, this::getSessionToken, HttpHeaders.SESSION_TOKEN); - this.fillTokenFromHeader(headers, this::getSharedOfferThroughput, HttpHeaders.SHARED_OFFER_THROUGHPUT); - this.fillTokenFromHeader(headers, this::getTargetGlobalCommittedLsn, HttpHeaders.TARGET_GLOBAL_COMMITTED_LSN); - this.fillTokenFromHeader(headers, this::getTargetLsn, HttpHeaders.TARGET_LSN); - this.fillTokenFromHeader(headers, this::getTimeToLiveInSeconds, BackendHeaders.TIME_TO_LIVE_IN_SECONDS); - this.fillTokenFromHeader(headers, this::getTransportRequestID, HttpHeaders.TRANSPORT_REQUEST_ID); - - // Will be null in case of direct, which is fine - BE will use the value slice the connection context this. - // When this is used in Gateway, the header value will be populated with the proxied HTTP request's header, - // and BE will respect the per-request value. - - this.fillTokenFromHeader(headers, this::getClientVersion, HttpHeaders.VERSION); - } - - private RntbdRequestHeaders() { - super(RntbdRequestHeader.set, RntbdRequestHeader.map); - } - - // endregion - - // region Methods - - static RntbdRequestHeaders decode(final ByteBuf in) { - final RntbdRequestHeaders metadata = new RntbdRequestHeaders(); - return RntbdRequestHeaders.decode(in, metadata); - } - - // endregion - - // region Privates - - private RntbdToken getAIM() { - return this.get(RntbdRequestHeader.A_IM); - } - - private RntbdToken getAllowTentativeWrites() { - return this.get(RntbdRequestHeader.AllowTentativeWrites); - } - - private RntbdToken getAttachmentName() { - return this.get(RntbdRequestHeader.AttachmentName); - } - - private RntbdToken getAuthorizationToken() { - return this.get(RntbdRequestHeader.AuthorizationToken); - } - - private RntbdToken getBinaryId() { - return this.get(RntbdRequestHeader.BinaryId); - } - - private RntbdToken getBinaryPassThroughRequest() { - return this.get(RntbdRequestHeader.BinaryPassthroughRequest); - } - - private RntbdToken getBindReplicaDirective() { - return this.get(RntbdRequestHeader.BindReplicaDirective); - } - - private RntbdToken getCanCharge() { - return this.get(RntbdRequestHeader.CanCharge); - } - - private RntbdToken getCanOfferReplaceComplete() { - return this.get(RntbdRequestHeader.CanOfferReplaceComplete); - } - - private RntbdToken getCanThrottle() { - return this.get(RntbdRequestHeader.CanThrottle); - } - - private RntbdToken getClientRetryAttemptCount() { - return this.get(RntbdRequestHeader.ClientRetryAttemptCount); - } - - private RntbdToken getClientVersion() { - return this.get(RntbdRequestHeader.ClientVersion); - } - - private RntbdToken getCollectionName() { - return this.get(RntbdRequestHeader.CollectionName); - } - - private RntbdToken getCollectionPartitionIndex() { - return this.get(RntbdRequestHeader.CollectionPartitionIndex); - } - - private RntbdToken getCollectionRemoteStorageSecurityIdentifier() { - return this.get(RntbdRequestHeader.CollectionRemoteStorageSecurityIdentifier); - } - - private RntbdToken getCollectionRid() { - return this.get(RntbdRequestHeader.CollectionRid); - } - - private RntbdToken getCollectionServiceIndex() { - return this.get(RntbdRequestHeader.CollectionServiceIndex); - } - - private RntbdToken getConflictName() { - return this.get(RntbdRequestHeader.ConflictName); - } - - private RntbdToken getConsistencyLevel() { - return this.get(RntbdRequestHeader.ConsistencyLevel); - } - - private RntbdToken getContentSerializationFormat() { - return this.get(RntbdRequestHeader.ContentSerializationFormat); - } - - private RntbdToken getContinuationToken() { - return this.get(RntbdRequestHeader.ContinuationToken); - } - - private RntbdToken getDatabaseName() { - return this.get(RntbdRequestHeader.DatabaseName); - } - - private RntbdToken getDate() { - return this.get(RntbdRequestHeader.Date); - } - - private RntbdToken getDisableRUPerMinuteUsage() { - return this.get(RntbdRequestHeader.DisableRUPerMinuteUsage); - } - - private RntbdToken getDocumentName() { - return this.get(RntbdRequestHeader.DocumentName); - } - - private RntbdToken getEffectivePartitionKey() { - return this.get(RntbdRequestHeader.EffectivePartitionKey); - } - - private RntbdToken getEmitVerboseTracesInQuery() { - return this.get(RntbdRequestHeader.EmitVerboseTracesInQuery); - } - - private RntbdToken getEnableDynamicRidRangeAllocation() { - return this.get(RntbdRequestHeader.EnableDynamicRidRangeAllocation); - } - - private RntbdToken getEnableLogging() { - return this.get(RntbdRequestHeader.EnableLogging); - } - - private RntbdToken getEnableLowPrecisionOrderBy() { - return this.get(RntbdRequestHeader.EnableLowPrecisionOrderBy); - } - - private RntbdToken getEnableScanInQuery() { - return this.get(RntbdRequestHeader.EnableScanInQuery); - } - - private RntbdToken getEndEpk() { - return this.get(RntbdRequestHeader.EndEpk); - } - - private RntbdToken getEndId() { - return this.get(RntbdRequestHeader.EndId); - } - - private RntbdToken getEntityId() { - return this.get(RntbdRequestHeader.EntityId); - } - - private RntbdToken getEnumerationDirection() { - return this.get(RntbdRequestHeader.EnumerationDirection); - } - - private RntbdToken getExcludeSystemProperties() { - return this.get(RntbdRequestHeader.ExcludeSystemProperties); - } - - private RntbdToken getFanoutOperationState() { - return this.get(RntbdRequestHeader.FanoutOperationState); - } - - private RntbdToken getFilterBySchemaRid() { - return this.get(RntbdRequestHeader.FilterBySchemaRid); - } - - private RntbdToken getForceQueryScan() { - return this.get(RntbdRequestHeader.ForceQueryScan); - } - - private RntbdToken getGatewaySignature() { - return this.get(RntbdRequestHeader.GatewaySignature); - } - - private RntbdToken getIfModifiedSince() { - return this.get(RntbdRequestHeader.IfModifiedSince); - } - - private RntbdToken getIndexingDirective() { - return this.get(RntbdRequestHeader.IndexingDirective); - } - - private RntbdToken getIsAutoScaleRequest() { - return this.get(RntbdRequestHeader.IsAutoScaleRequest); - } - - private RntbdToken getIsFanout() { - return this.get(RntbdRequestHeader.IsFanout); - } - - private RntbdToken getIsReadOnlyScript() { - return this.get(RntbdRequestHeader.IsReadOnlyScript); - } - - private RntbdToken getIsUserRequest() { - return this.get(RntbdRequestHeader.IsUserRequest); - } - - private RntbdToken getMatch() { - return this.get(RntbdRequestHeader.Match); - } - - private RntbdToken getMigrateCollectionDirective() { - return this.get(RntbdRequestHeader.MigrateCollectionDirective); - } - - private RntbdToken getPageSize() { - return this.get(RntbdRequestHeader.PageSize); - } - - private RntbdToken getPartitionCount() { - return this.get(RntbdRequestHeader.PartitionCount); - } - - private RntbdToken getPartitionKey() { - return this.get(RntbdRequestHeader.PartitionKey); - } - - private RntbdToken getPartitionKeyRangeId() { - return this.get(RntbdRequestHeader.PartitionKeyRangeId); - } - - private RntbdToken getPartitionKeyRangeName() { - return this.get(RntbdRequestHeader.PartitionKeyRangeName); - } - - private RntbdToken getPartitionResourceFilter() { - return this.get(RntbdRequestHeader.PartitionResourceFilter); - } - - private RntbdToken getPayloadPresent() { - return this.get(RntbdRequestHeader.PayloadPresent); - } - - private RntbdToken getPermissionName() { - return this.get(RntbdRequestHeader.PermissionName); - } - - private RntbdToken getPopulateCollectionThroughputInfo() { - return this.get(RntbdRequestHeader.PopulateCollectionThroughputInfo); - } - - private RntbdToken getPopulatePartitionStatistics() { - return this.get(RntbdRequestHeader.PopulatePartitionStatistics); - } - - private RntbdToken getPopulateQueryMetrics() { - return this.get(RntbdRequestHeader.PopulateQueryMetrics); - } - - private RntbdToken getPopulateQuotaInfo() { - return this.get(RntbdRequestHeader.PopulateQuotaInfo); - } - - private RntbdToken getPostTriggerExclude() { - return this.get(RntbdRequestHeader.PostTriggerExclude); - } - - private RntbdToken getPostTriggerInclude() { - return this.get(RntbdRequestHeader.PostTriggerInclude); - } - - private RntbdToken getPreTriggerExclude() { - return this.get(RntbdRequestHeader.PreTriggerExclude); - } - - private RntbdToken getPreTriggerInclude() { - return this.get(RntbdRequestHeader.PreTriggerInclude); - } - - private RntbdToken getPrimaryMasterKey() { - return this.get(RntbdRequestHeader.PrimaryMasterKey); - } - - private RntbdToken getPrimaryReadonlyKey() { - return this.get(RntbdRequestHeader.PrimaryReadonlyKey); - } - - private RntbdToken getProfileRequest() { - return this.get(RntbdRequestHeader.ProfileRequest); - } - - private RntbdToken getReadFeedKeyType() { - return this.get(RntbdRequestHeader.ReadFeedKeyType); - } - - private RntbdToken getRemainingTimeInMsOnClientRequest() { - return this.get(RntbdRequestHeader.RemainingTimeInMsOnClientRequest); - } - - private RntbdToken getRemoteStorageType() { - return this.get(RntbdRequestHeader.RemoteStorageType); - } - - private RntbdToken getReplicaPath() { - return this.get(RntbdRequestHeader.ReplicaPath); - } - - private RntbdToken getResourceId() { - return this.get(RntbdRequestHeader.ResourceId); - } - - private RntbdToken getResourceSchemaName() { - return this.get(RntbdRequestHeader.ResourceSchemaName); - } - - private RntbdToken getResourceTokenExpiry() { - return this.get(RntbdRequestHeader.ResourceTokenExpiry); - } - - private RntbdToken getResponseContinuationTokenLimitInKb() { - return this.get(RntbdRequestHeader.ResponseContinuationTokenLimitInKb); - } - - private RntbdToken getRestoreMetadataFilter() { - return this.get(RntbdRequestHeader.RestoreMetadaFilter); - } - - private RntbdToken getRestoreParams() { - return this.get(RntbdRequestHeader.RestoreParams); - } - - private RntbdToken getSchemaName() { - return this.get(RntbdRequestHeader.SchemaName); - } - - private RntbdToken getSecondaryMasterKey() { - return this.get(RntbdRequestHeader.SecondaryMasterKey); - } - - private RntbdToken getSecondaryReadonlyKey() { - return this.get(RntbdRequestHeader.SecondaryReadonlyKey); - } - - private RntbdToken getSessionToken() { - return this.get(RntbdRequestHeader.SessionToken); - } - - private RntbdToken getShareThroughput() { - return this.get(RntbdRequestHeader.ShareThroughput); - } - - private RntbdToken getSharedOfferThroughput() { - return this.get(RntbdRequestHeader.SharedOfferThroughput); - } - - private RntbdToken getStartEpk() { - return this.get(RntbdRequestHeader.StartEpk); - } - - private RntbdToken getStartId() { - return this.get(RntbdRequestHeader.StartId); - } - - private RntbdToken getStoredProcedureName() { - return this.get(RntbdRequestHeader.StoredProcedureName); - } - - private RntbdToken getSupportSpatialLegacyCoordinates() { - return this.get(RntbdRequestHeader.SupportSpatialLegacyCoordinates); - } - - private RntbdToken getTargetGlobalCommittedLsn() { - return this.get(RntbdRequestHeader.TargetGlobalCommittedLsn); - } - - private RntbdToken getTargetLsn() { - return this.get(RntbdRequestHeader.TargetLsn); - } - - private RntbdToken getTimeToLiveInSeconds() { - return this.get(RntbdRequestHeader.TimeToLiveInSeconds); - } - - private RntbdToken getTransportRequestID() { - return this.get(RntbdRequestHeader.TransportRequestID); - } - - private RntbdToken getTriggerName() { - return this.get(RntbdRequestHeader.TriggerName); - } - - private RntbdToken getUsePolygonsSmallerThanAHemisphere() { - return this.get(RntbdRequestHeader.UsePolygonsSmallerThanAHemisphere); - } - - private RntbdToken getUserDefinedFunctionName() { - return this.get(RntbdRequestHeader.UserDefinedFunctionName); - } - - private RntbdToken getUserDefinedTypeName() { - return this.get(RntbdRequestHeader.UserDefinedTypeName); - } - - private RntbdToken getUserName() { - return this.get(RntbdRequestHeader.UserName); - } - - private void addAimHeader(final Map headers) { - - final String value = headers.get(HttpHeaders.A_IM); - - if (StringUtils.isNotEmpty(value)) { - this.getAIM().setValue(value); - } - } - - private void addAllowScanOnQuery(final Map headers) { - final String value = headers.get(HttpHeaders.ENABLE_SCAN_IN_QUERY); - if (StringUtils.isNotEmpty(value)) { - this.getEnableScanInQuery().setValue(Boolean.parseBoolean(value)); - } - } - - private void addBinaryIdIfPresent(final Map headers) { - final String value = headers.get(BackendHeaders.BINARY_ID); - if (StringUtils.isNotEmpty(value)) { - this.getBinaryId().setValue(Base64.getDecoder().decode(value)); - } - } - - private void addCanCharge(final Map headers) { - final String value = headers.get(HttpHeaders.CAN_CHARGE); - if (StringUtils.isNotEmpty(value)) { - this.getCanCharge().setValue(Boolean.parseBoolean(value)); - } - } - - private void addCanOfferReplaceComplete(final Map headers) { - final String value = headers.get(HttpHeaders.CAN_OFFER_REPLACE_COMPLETE); - if (StringUtils.isNotEmpty(value)) { - this.getCanOfferReplaceComplete().setValue(Boolean.parseBoolean(value)); - } - } - - private void addCanThrottle(final Map headers) { - final String value = headers.get(HttpHeaders.CAN_THROTTLE); - if (StringUtils.isNotEmpty(value)) { - this.getCanThrottle().setValue(Boolean.parseBoolean(value)); - } - } - - private void addCollectionRemoteStorageSecurityIdentifier(final Map headers) { - final String value = headers.get(HttpHeaders.COLLECTION_REMOTE_STORAGE_SECURITY_IDENTIFIER); - if (StringUtils.isNotEmpty(value)) { - this.getCollectionRemoteStorageSecurityIdentifier().setValue(value); - } - } - - private void addConsistencyLevelHeader(final Map headers) { - - final String value = headers.get(HttpHeaders.CONSISTENCY_LEVEL); - - if (StringUtils.isNotEmpty(value)) { - - final ConsistencyLevel level = EnumUtils.getEnumIgnoreCase(ConsistencyLevel.class, value); - - if (level == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.CONSISTENCY_LEVEL, - value); - throw new IllegalStateException(reason); - } - - switch (level) { - case Strong: - this.getConsistencyLevel().setValue(RntbdConsistencyLevel.Strong.id()); - break; - case BoundedStaleness: - this.getConsistencyLevel().setValue(RntbdConsistencyLevel.BoundedStaleness.id()); - break; - case Session: - this.getConsistencyLevel().setValue(RntbdConsistencyLevel.Session.id()); - break; - case Eventual: - this.getConsistencyLevel().setValue(RntbdConsistencyLevel.Eventual.id()); - break; - case ConsistentPrefix: - this.getConsistencyLevel().setValue(RntbdConsistencyLevel.ConsistentPrefix.id()); - break; - default: - assert false; - break; - } - } - } - - private void addContentSerializationFormat(final Map headers) { - - final String value = headers.get(HttpHeaders.CONTENT_SERIALIZATION_FORMAT); - - if (StringUtils.isNotEmpty(value)) { - - final ContentSerializationFormat format = EnumUtils.getEnumIgnoreCase(ContentSerializationFormat.class, value); - - if (format == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.CONTENT_SERIALIZATION_FORMAT, - value); - throw new IllegalStateException(reason); - } - - switch (format) { - case JsonText: - this.getContentSerializationFormat().setValue(RntbdContentSerializationFormat.JsonText.id()); - break; - case CosmosBinary: - this.getContentSerializationFormat().setValue(RntbdContentSerializationFormat.CosmosBinary.id()); - break; - default: - assert false; - } - } - } - - private void addContinuationToken(final RxDocumentServiceRequest request) { - final String value = request.getContinuation(); - if (StringUtils.isNotEmpty(value)) { - this.getContinuationToken().setValue(value); - } - } - - private void addDateHeader(final Map headers) { - - // Since the HTTP date header is overridden by some proxies/http client libraries, we support an additional date - // header and prefer that to the (regular) date header - - String value = headers.get(HttpHeaders.X_DATE); - - if (StringUtils.isEmpty(value)) { - value = headers.get(HttpHeaders.HTTP_DATE); - } - - if (StringUtils.isNotEmpty(value)) { - this.getDate().setValue(value); - } - } - - private void addDisableRUPerMinuteUsage(final Map headers) { - final String value = headers.get(HttpHeaders.DISABLE_RU_PER_MINUTE_USAGE); - if (StringUtils.isNotEmpty(value)) { - this.getDisableRUPerMinuteUsage().setValue(Boolean.parseBoolean(value)); - } - } - - private void addEmitVerboseTracesInQuery(final Map headers) { - final String value = headers.get(HttpHeaders.EMIT_VERBOSE_TRACES_IN_QUERY); - if (StringUtils.isNotEmpty(value)) { - this.getEmitVerboseTracesInQuery().setValue(Boolean.parseBoolean(value)); - } - } - - private void addEnableLogging(final Map headers) { - final String value = headers.get(HttpHeaders.ENABLE_LOGGING); - if (StringUtils.isNotEmpty(value)) { - this.getEnableLogging().setValue(Boolean.parseBoolean(value)); - } - } - - private void addEnableLowPrecisionOrderBy(final Map headers) { - final String value = headers.get(HttpHeaders.ENABLE_LOW_PRECISION_ORDER_BY); - if (StringUtils.isNotEmpty(value)) { - this.getEnableLowPrecisionOrderBy().setValue(Boolean.parseBoolean(value)); - } - } - - private void addEntityId(final Map headers) { - final String value = headers.get(BackendHeaders.ENTITY_ID); - if (StringUtils.isNotEmpty(value)) { - this.getEntityId().setValue(value); - } - } - - private void addEnumerationDirection(final Map headers) { - - final String value = headers.get(HttpHeaders.ENUMERATION_DIRECTION); - - if (StringUtils.isNotEmpty(value)) { - - final EnumerationDirection direction = EnumUtils.getEnumIgnoreCase(EnumerationDirection.class, value); - - if (direction == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.ENUMERATION_DIRECTION, - value); - throw new IllegalStateException(reason); - } - - switch (direction) { - case Forward: - this.getEnumerationDirection().setValue(RntbdEnumerationDirection.Forward.id()); - break; - case Reverse: - this.getEnumerationDirection().setValue(RntbdEnumerationDirection.Reverse.id()); - break; - default: - assert false; - } - } - } - - private void addExcludeSystemProperties(final Map headers) { - final String value = headers.get(BackendHeaders.EXCLUDE_SYSTEM_PROPERTIES); - if (StringUtils.isNotEmpty(value)) { - this.getExcludeSystemProperties().setValue(Boolean.parseBoolean(value)); - } - } - - private void addFanoutOperationStateHeader(final Map headers) { - - final String value = headers.get(BackendHeaders.FANOUT_OPERATION_STATE); - - if (StringUtils.isNotEmpty(value)) { - - final FanoutOperationState format = EnumUtils.getEnumIgnoreCase(FanoutOperationState.class, value); - - if (format == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - BackendHeaders.FANOUT_OPERATION_STATE, - value); - throw new IllegalStateException(reason); - } - - switch (format) { - case Started: - this.getFanoutOperationState().setValue(RntbdFanoutOperationState.Started.id()); - break; - case Completed: - this.getFanoutOperationState().setValue(RntbdFanoutOperationState.Completed.id()); - break; - default: - assert false; - } - } - } - - private void addIfModifiedSinceHeader(final Map headers) { - final String value = headers.get(HttpHeaders.IF_MODIFIED_SINCE); - if (StringUtils.isNotEmpty(value)) { - this.getIfModifiedSince().setValue(value); - } - } - - private void addIndexingDirectiveHeader(final Map headers) { - - final String value = headers.get(HttpHeaders.INDEXING_DIRECTIVE); - - if (StringUtils.isNotEmpty(value)) { - - final IndexingDirective directive = EnumUtils.getEnumIgnoreCase(IndexingDirective.class, value); - - if (directive == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.INDEXING_DIRECTIVE, - value); - throw new IllegalStateException(reason); - } - - switch (directive) { - case Default: - this.getIndexingDirective().setValue(RntbdIndexingDirective.Default.id()); - break; - case Exclude: - this.getIndexingDirective().setValue(RntbdIndexingDirective.Exclude.id()); - break; - case Include: - this.getIndexingDirective().setValue(RntbdIndexingDirective.Include.id()); - break; - default: - assert false; - } - } - } - - private void addIsAutoScaleRequest(final Map headers) { - final String value = headers.get(HttpHeaders.IS_AUTO_SCALE_REQUEST); - if (StringUtils.isNotEmpty(value)) { - this.getIsAutoScaleRequest().setValue(Boolean.parseBoolean(value)); - } - } - - private void addIsFanout(final Map headers) { - final String value = headers.get(BackendHeaders.IS_FANOUT_REQUEST); - if (StringUtils.isNotEmpty(value)) { - this.getIsFanout().setValue(Boolean.parseBoolean(value)); - } - } - - private void addIsReadOnlyScript(final Map headers) { - final String value = headers.get(HttpHeaders.IS_READ_ONLY_SCRIPT); - if (StringUtils.isNotEmpty(value)) { - this.getIsReadOnlyScript().setValue(Boolean.parseBoolean(value)); - } - } - - private void addIsUserRequest(final Map headers) { - final String value = headers.get(BackendHeaders.IS_USER_REQUEST); - if (StringUtils.isNotEmpty(value)) { - this.getIsUserRequest().setValue(Boolean.parseBoolean(value)); - } - } - - private void addMatchHeader(final Map headers, final RntbdOperationType operationType) { - - String match = null; - - switch (operationType) { - case Read: - case ReadFeed: - match = headers.get(HttpHeaders.IF_NONE_MATCH); - break; - default: - match = headers.get(HttpHeaders.IF_MATCH); - break; - } - - if (StringUtils.isNotEmpty(match)) { - this.getMatch().setValue(match); - } - } - - private void addMigrateCollectionDirectiveHeader(final Map headers) { - - final String value = headers.get(HttpHeaders.MIGRATE_COLLECTION_DIRECTIVE); - - if (StringUtils.isNotEmpty(value)) { - - final MigrateCollectionDirective directive = EnumUtils.getEnumIgnoreCase(MigrateCollectionDirective.class, value); - - if (directive == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.MIGRATE_COLLECTION_DIRECTIVE, - value); - throw new IllegalStateException(reason); - } - - switch (directive) { - case Freeze: - this.getMigrateCollectionDirective().setValue(RntbdMigrateCollectionDirective.Freeze.id()); - break; - case Thaw: - this.getMigrateCollectionDirective().setValue(RntbdMigrateCollectionDirective.Thaw.id()); - break; - default: - assert false; - break; - } - } - } - - private void addPageSize(final Map headers) { - - final String value = headers.get(HttpHeaders.PAGE_SIZE); - - if (StringUtils.isNotEmpty(value)) { - final long aLong = parseLong(HttpHeaders.PAGE_SIZE, value, -1, 0xFFFFFFFFL); - this.getPageSize().setValue((int)(aLong < 0 ? 0xFFFFFFFFL : aLong)); - } - } - - private void addPopulateCollectionThroughputInfo(final Map headers) { - final String value = headers.get(HttpHeaders.POPULATE_COLLECTION_THROUGHPUT_INFO); - if (StringUtils.isNotEmpty(value)) { - this.getPopulateCollectionThroughputInfo().setValue(Boolean.parseBoolean(value)); - } - } - - private void addPopulatePartitionStatistics(final Map headers) { - final String value = headers.get(HttpHeaders.POPULATE_PARTITION_STATISTICS); - if (StringUtils.isNotEmpty(value)) { - this.getPopulatePartitionStatistics().setValue(Boolean.parseBoolean(value)); - } - } - - private void addPopulateQueryMetrics(final Map headers) { - final String value = headers.get(HttpHeaders.POPULATE_QUERY_METRICS); - if (StringUtils.isNotEmpty(value)) { - this.getPopulateQueryMetrics().setValue(Boolean.parseBoolean(value)); - } - } - - private void addPopulateQuotaInfo(final Map headers) { - final String value = headers.get(HttpHeaders.POPULATE_QUOTA_INFO); - if (StringUtils.isNotEmpty(value)) { - this.getPopulateQuotaInfo().setValue(Boolean.parseBoolean(value)); - } - } - - private void addProfileRequest(final Map headers) { - final String value = headers.get(HttpHeaders.PROFILE_REQUEST); - if (StringUtils.isNotEmpty(value)) { - this.getProfileRequest().setValue(Boolean.parseBoolean(value)); - } - } - - private void addQueryForceScan(final Map headers) { - final String value = headers.get(HttpHeaders.FORCE_QUERY_SCAN); - if (StringUtils.isNotEmpty(value)) { - this.getForceQueryScan().setValue(Boolean.parseBoolean(value)); - } - } - - private void addRemoteStorageType(final Map headers) { - - final String value = headers.get(BackendHeaders.REMOTE_STORAGE_TYPE); - - if (StringUtils.isNotEmpty(value)) { - - final RemoteStorageType type = EnumUtils.getEnumIgnoreCase(RemoteStorageType.class, value); - - if (type == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - BackendHeaders.REMOTE_STORAGE_TYPE, - value); - throw new IllegalStateException(reason); - } - - switch (type) { - case Standard: - this.getRemoteStorageType().setValue(RntbdRemoteStorageType.Standard.id()); - break; - case Premium: - this.getRemoteStorageType().setValue(RntbdRemoteStorageType.Premium.id()); - break; - default: - assert false; - } - } - } - - private void addResourceIdOrPathHeaders(final RxDocumentServiceRequest request) { - - final String value = request.getResourceId(); - - if (StringUtils.isNotEmpty(value)) { - // Name-based can also have ResourceId because gateway might have generated it - this.getResourceId().setValue(ResourceId.parse(request.getResourceType(), value)); - } - - if (request.getIsNameBased()) { - - // Assumption: format is like "dbs/dbName/colls/collName/docs/docName" or "/dbs/dbName/colls/collName", - // not "apps/appName/partitions/partitionKey/replicas/replicaId/dbs/dbName" - - final String address = request.getResourceAddress(); - final String[] fragments = address.split(UrlTrim); - int count = fragments.length; - int index = 0; - - if (count > 0 && fragments[0].isEmpty()) { - ++index; - --count; - } - - if (count >= 2) { - switch (fragments[index]) { - case Paths.DATABASES_PATH_SEGMENT: - this.getDatabaseName().setValue(fragments[index + 1]); - break; - default: - final String reason = String.format(Locale.ROOT, RMResources.InvalidResourceAddress, - value, address); - throw new IllegalStateException(reason); - } - } - - if (count >= 4) { - switch (fragments[index + 2]) { - case Paths.COLLECTIONS_PATH_SEGMENT: - this.getCollectionName().setValue(fragments[index + 3]); - break; - case Paths.USERS_PATH_SEGMENT: - this.getUserName().setValue(fragments[index + 3]); - break; - case Paths.USER_DEFINED_TYPES_PATH_SEGMENT: - this.getUserDefinedTypeName().setValue(fragments[index + 3]); - break; - } - } - - if (count >= 6) { - switch (fragments[index + 4]) { - case Paths.DOCUMENTS_PATH_SEGMENT: - this.getDocumentName().setValue(fragments[index + 5]); - break; - case Paths.STORED_PROCEDURES_PATH_SEGMENT: - this.getStoredProcedureName().setValue(fragments[index + 5]); - break; - case Paths.PERMISSIONS_PATH_SEGMENT: - this.getPermissionName().setValue(fragments[index + 5]); - break; - case Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT: - this.getUserDefinedFunctionName().setValue(fragments[index + 5]); - break; - case Paths.TRIGGERS_PATH_SEGMENT: - this.getTriggerName().setValue(fragments[index + 5]); - break; - case Paths.CONFLICTS_PATH_SEGMENT: - this.getConflictName().setValue(fragments[index + 5]); - break; - case Paths.PARTITION_KEY_RANGES_PATH_SEGMENT: - this.getPartitionKeyRangeName().setValue(fragments[index + 5]); - break; - case Paths.SCHEMAS_PATH_SEGMENT: - this.getSchemaName().setValue(fragments[index + 5]); - break; - } - } - - if (count >= 8) { - switch (fragments[index + 6]) { - case Paths.ATTACHMENTS_PATH_SEGMENT: - this.getAttachmentName().setValue(fragments[index + 7]); - break; - } - } - } - } - - private void addResponseContinuationTokenLimitInKb(final Map headers) { - - final String value = headers.get(HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB); - - if (StringUtils.isNotEmpty(value)) { - final long aLong = parseLong(HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB, value, 0, 0xFFFFFFFFL); - this.getResponseContinuationTokenLimitInKb().setValue((int)(aLong < 0 ? 0xFFFFFFFFL : aLong)); - } - } - - private void addShareThroughput(final Map headers) { - final String value = headers.get(BackendHeaders.SHARE_THROUGHPUT); - if (StringUtils.isNotEmpty(value)) { - this.getShareThroughput().setValue(Boolean.parseBoolean(value)); - } - } - - private void addStartAndEndKeys(final Map headers) { - - String value = headers.get(HttpHeaders.READ_FEED_KEY_TYPE); - - if (StringUtils.isNotEmpty(value)) { - - final ReadFeedKeyType type = EnumUtils.getEnumIgnoreCase(ReadFeedKeyType.class, value); - - if (type == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.READ_FEED_KEY_TYPE, - value); - throw new IllegalStateException(reason); - } - - switch (type) { - case ResourceId: - this.getReadFeedKeyType().setValue(RntbdReadFeedKeyType.ResourceId.id()); - break; - case EffectivePartitionKey: - this.getReadFeedKeyType().setValue(RntbdReadFeedKeyType.EffectivePartitionKey.id()); - break; - default: - assert false; - } - } - - final Base64.Decoder decoder = Base64.getDecoder(); - - value = headers.get(HttpHeaders.START_ID); - - if (StringUtils.isNotEmpty(value)) { - this.getStartId().setValue(decoder.decode(value)); - } - - value = headers.get(HttpHeaders.END_ID); - - if (StringUtils.isNotEmpty(value)) { - this.getEndId().setValue(decoder.decode(value)); - } - - value = headers.get(HttpHeaders.START_EPK); - - if (StringUtils.isNotEmpty(value)) { - this.getStartEpk().setValue(decoder.decode(value)); - } - - value = headers.get(HttpHeaders.END_EPK); - - if (StringUtils.isNotEmpty(value)) { - this.getEndEpk().setValue(decoder.decode(value)); - } - } - - private void addSupportSpatialLegacyCoordinates(final Map headers) { - final String value = headers.get(HttpHeaders.SUPPORT_SPATIAL_LEGACY_COORDINATES); - if (StringUtils.isNotEmpty(value)) { - this.getSupportSpatialLegacyCoordinates().setValue(Boolean.parseBoolean(value)); - } - } - - private void addUsePolygonsSmallerThanAHemisphere(final Map headers) { - final String value = headers.get(HttpHeaders.USE_POLYGONS_SMALLER_THAN_AHEMISPHERE); - if (StringUtils.isNotEmpty(value)) { - this.getUsePolygonsSmallerThanAHemisphere().setValue(Boolean.parseBoolean(value)); - } - } - - private void fillTokenFromHeader(final Map headers, final Supplier supplier, final String name) { - - final String value = headers.get(name); - - if (StringUtils.isNotEmpty(value)) { - - final RntbdToken token = supplier.get(); - - switch (token.getType()) { - - case SmallString: - case String: - case ULongString: { - - token.setValue(value); - break; - } - case Byte: { - - token.setValue(Boolean.parseBoolean(value)); - break; - } - case Double: { - - token.setValue(parseDouble(name, value)); - break; - } - case Long: { - - final long aLong = parseLong(name, value, Integer.MIN_VALUE, Integer.MAX_VALUE); - token.setValue(aLong); - break; - } - case ULong: { - - final long aLong = parseLong(name, value, 0, 0xFFFFFFFFL); - token.setValue(aLong); - break; - } - case LongLong: { - - final long aLong = parseLong(name, value); - token.setValue(aLong); - break; - } - default: { - assert false : "Recognized header has neither special-case nor default handling to convert " - + "from header String to RNTBD token"; - break; - } - } - } - } - - private static double parseDouble(final String name, final String value) { - - final double aDouble; - - try { - aDouble = Double.parseDouble(value); - } catch (final NumberFormatException error) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, name, value); - throw new IllegalStateException(reason); - } - return aDouble; - } - - private static long parseLong(final String name, final String value) { - final long aLong; - try { - aLong = Long.parseLong(value); - } catch (final NumberFormatException error) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, name, value); - throw new IllegalStateException(reason); - } - return aLong; - } - - private static long parseLong(final String name, final String value, final long min, final long max) { - final long aLong = parseLong(name, value); - if (!(min <= aLong && aLong <= max)) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, name, aLong); - throw new IllegalStateException(reason); - } - return aLong; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestManager.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestManager.java deleted file mode 100644 index 10c81f854a05..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestManager.java +++ /dev/null @@ -1,774 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.google.common.base.Strings; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ConflictException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ForbiddenException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GoneException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.LockedException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.MethodNotAllowedException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.PartitionKeyRangeGoneException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.PreconditionFailedException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RequestEntityTooLargeException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RequestRateTooLargeException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RequestTimeoutException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RetryWithException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ServiceUnavailableException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.UnauthorizedException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdResponseHeader; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import io.netty.buffer.ByteBuf; -import io.netty.channel.Channel; -import io.netty.channel.ChannelException; -import io.netty.channel.ChannelHandler; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandler; -import io.netty.channel.ChannelOption; -import io.netty.channel.ChannelOutboundHandler; -import io.netty.channel.ChannelPipeline; -import io.netty.channel.ChannelPromise; -import io.netty.channel.CoalescingBufferQueue; -import io.netty.channel.EventLoop; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.util.ReferenceCountUtil; -import io.netty.util.Timeout; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.math.BigDecimal; -import java.net.SocketAddress; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; -import java.util.concurrent.CancellationException; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.StatusCodes; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdReporter.reportIssue; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless; - -public final class RntbdRequestManager implements ChannelHandler, ChannelInboundHandler, ChannelOutboundHandler { - - // region Fields - - private static final Logger logger = LoggerFactory.getLogger(RntbdRequestManager.class); - - private final CompletableFuture contextFuture = new CompletableFuture<>(); - private final CompletableFuture contextRequestFuture = new CompletableFuture<>(); - private final ConcurrentHashMap pendingRequests = new ConcurrentHashMap<>(); - - private boolean closingExceptionally = false; - private ChannelHandlerContext context; - private RntbdRequestRecord pendingRequest; - private CoalescingBufferQueue pendingWrites; - - // endregion - - // region ChannelHandler methods - - /** - * Gets called after the {@link ChannelHandler} was added to the actual context and it's ready to handle events. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void handlerAdded(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "handlerAdded"); - } - - /** - * Gets called after the {@link ChannelHandler} was removed from the actual context and it doesn't handle events - * anymore. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void handlerRemoved(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "handlerRemoved"); - } - - // endregion - - // region ChannelInboundHandler methods - - /** - * The {@link Channel} of the {@link ChannelHandlerContext} is now active - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void channelActive(final ChannelHandlerContext context) throws Exception { - this.traceOperation(this.context, "channelActive"); - context.fireChannelActive(); - } - - /** - * Completes all pending requests exceptionally when a channel reaches the end of its lifetime - *

- * This method will only be called after the channel is closed. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void channelInactive(final ChannelHandlerContext context) throws Exception { - this.traceOperation(this.context, "channelInactive"); - this.completeAllPendingRequestsExceptionally(context, ClosedWithPendingRequestsException.INSTANCE); - context.fireChannelInactive(); - } - - @Override - public void channelRead(final ChannelHandlerContext context, final Object message) throws Exception { - - this.traceOperation(context, "channelRead"); - - if (message instanceof RntbdResponse) { - try { - this.messageReceived(context, (RntbdResponse)message); - } finally { - ReferenceCountUtil.release(message); - } - this.traceOperation(context, "channelReadComplete"); - return; - } - - final String reason = Strings.lenientFormat("expected message of type %s, not %s", RntbdResponse.class, message.getClass()); - throw new IllegalStateException(reason); - } - - /** - * Invoked when the last message read by the current read operation has been consumed - *

- * If {@link ChannelOption#AUTO_READ} is off, no further attempt to read an inbound data from the current - * {@link Channel} will be made until {@link ChannelHandlerContext#read} is called. This leaves time - * for outbound messages to be written. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void channelReadComplete(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "channelReadComplete"); - context.fireChannelReadComplete(); - } - - /** - * Constructs a {@link CoalescingBufferQueue} for buffering encoded requests until we have an {@link RntbdRequest} - *

- * This method then calls {@link ChannelHandlerContext#fireChannelRegistered()} to forward to the next - * {@link ChannelInboundHandler} in the {@link ChannelPipeline}. - *

- * Sub-classes may override this method to change behavior. - * - * @param context the {@link ChannelHandlerContext} for which the bind operation is made - */ - @Override - public void channelRegistered(final ChannelHandlerContext context) throws Exception { - - this.traceOperation(context, "channelRegistered"); - - if (!(this.context == null && this.pendingWrites == null)) { - throw new IllegalStateException(); - } - - this.pendingWrites = new CoalescingBufferQueue(context.channel()); - this.context = context; - context.fireChannelRegistered(); - } - - /** - * The {@link Channel} of the {@link ChannelHandlerContext} was unregistered from its {@link EventLoop} - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void channelUnregistered(final ChannelHandlerContext context) throws Exception { - - this.traceOperation(context, "channelUnregistered"); - - if (this.context == null || this.pendingWrites == null || !this.pendingWrites.isEmpty()) { - throw new IllegalStateException(); - } - - this.pendingWrites = null; - this.context = null; - context.fireChannelUnregistered(); - } - - /** - * Gets called once the writable state of a {@link Channel} changed. You can check the state with - * {@link Channel#isWritable()}. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void channelWritabilityChanged(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "channelWritabilityChanged"); - context.fireChannelWritabilityChanged(); - } - - /** - * Processes {@link ChannelHandlerContext#fireExceptionCaught(Throwable)} in the {@link ChannelPipeline} - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - * @param cause Exception caught - */ - @Override - @SuppressWarnings("deprecation") - public void exceptionCaught(final ChannelHandlerContext context, final Throwable cause) throws Exception { - - // TODO: DANOBLE: replace RntbdRequestManager.exceptionCaught with read/write listeners - // Notes: - // ChannelInboundHandler.exceptionCaught is deprecated and--today, prior to deprecation--only catches read-- - // i.e., inbound--exceptions. - // Replacements: - // * read listener: unclear as there is no obvious replacement - // * write listener: implemented by RntbdTransportClient.DefaultEndpoint.doWrite - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/373213 - - this.traceOperation(context, "exceptionCaught", cause); - - if (!this.closingExceptionally) { - reportIssueUnless(cause != ClosedWithPendingRequestsException.INSTANCE, logger, context, - "expected an exception other than ", ClosedWithPendingRequestsException.INSTANCE); - this.completeAllPendingRequestsExceptionally(context, cause); - context.close(); - } - } - - /** - * Processes inbound events triggered by channel handlers in the {@link RntbdClientChannelHandler} pipeline - *

- * All but inbound request management events are ignored. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - * @param event An object representing a user event - */ - @Override - public void userEventTriggered(final ChannelHandlerContext context, final Object event) { - - this.traceOperation(context, "userEventTriggered", event); - - if (event instanceof RntbdContext) { - this.completeRntbdContextFuture(context, (RntbdContext)event); - return; - } - - context.fireUserEventTriggered(event); - } - - // endregion - - // region ChannelOutboundHandler methods - - /** - * Called once a bind operation is made. - * - * @param context the {@link ChannelHandlerContext} for which the bind operation is made - * @param localAddress the {@link SocketAddress} to which it should bound - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void bind(final ChannelHandlerContext context, final SocketAddress localAddress, final ChannelPromise promise) throws Exception { - this.traceOperation(context, "bind"); - context.bind(localAddress, promise); - } - - /** - * Called once a close operation is made. - * - * @param context the {@link ChannelHandlerContext} for which the close operation is made - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void close(final ChannelHandlerContext context, final ChannelPromise promise) throws Exception { - this.traceOperation(context, "close"); - context.close(promise); - } - - /** - * Called once a connect operation is made. - * - * @param context the {@link ChannelHandlerContext} for which the connect operation is made - * @param remoteAddress the {@link SocketAddress} to which it should connect - * @param localAddress the {@link SocketAddress} which is used as source on connect - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void connect(final ChannelHandlerContext context, final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelPromise promise) throws Exception { - this.traceOperation(context, "connect"); - context.connect(remoteAddress, localAddress, promise); - } - - /** - * Called once a deregister operation is made from the current registered {@link EventLoop}. - * - * @param context the {@link ChannelHandlerContext} for which the close operation is made - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void deregister(final ChannelHandlerContext context, final ChannelPromise promise) throws Exception { - this.traceOperation(context, "deregister"); - context.deregister(promise); - } - - /** - * Called once a disconnect operation is made. - * - * @param context the {@link ChannelHandlerContext} for which the disconnect operation is made - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void disconnect(final ChannelHandlerContext context, final ChannelPromise promise) throws Exception { - this.traceOperation(context, "disconnect"); - context.disconnect(promise); - } - - /** - * Called once a flush operation is made - *

- * The flush operation will try to flush out all previous written messages that are pending. - * - * @param context the {@link ChannelHandlerContext} for which the flush operation is made - * @throws Exception thrown if an error occurs - */ - @Override - public void flush(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "flush"); - context.flush(); - } - - /** - * Intercepts {@link ChannelHandlerContext#read} - * - * @param context the {@link ChannelHandlerContext} for which the read operation is made - */ - @Override - public void read(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "read"); - context.read(); - } - - /** - * Called once a write operation is made - *

- * The write operation will send messages through the {@link ChannelPipeline} which are then ready to be flushed - * to the actual {@link Channel}. This will occur when {@link Channel#flush} is called. - * - * @param context the {@link ChannelHandlerContext} for which the write operation is made - * @param message the message to write - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise promise) throws Exception { - - // TODO: DANOBLE: Ensure that all write errors are reported with a root cause of type EncoderException - - this.traceOperation(context, "write", message); - - if (message instanceof RntbdRequestRecord) { - context.write(this.addPendingRequestRecord((RntbdRequestRecord)message), promise); - } else { - final String reason = Strings.lenientFormat("Expected message of type %s, not %s", RntbdRequestArgs.class, message.getClass()); - this.exceptionCaught(context, new IllegalStateException(reason)); - } - } - - // endregion - - // region Private and package private methods - - int getPendingRequestCount() { - return this.pendingRequests.size(); - } - - CompletableFuture getRntbdContextRequestFuture() { - return this.contextRequestFuture; - } - - boolean hasRntbdContext() { - return this.contextFuture.getNow(null) != null; - } - - void pendWrite(final ByteBuf out, final ChannelPromise promise) { - - checkNotNull(out, "out"); - checkNotNull(promise, "promise"); - checkState(this.pendingWrites != null, "pendingWrite: null"); - - this.pendingWrites.add(out, promise); - } - - private RntbdRequestArgs addPendingRequestRecord(final RntbdRequestRecord requestRecord) { - - // TODO: DANOBLE: Consider revising the implementation of RntbdRequestManager.addPendingRequestRecord - // At a minimum consider these issues: - // * Do we have a requirement to support multiple concurrent operations for a single activityId? - // * Should we replace, renew, or maintain a list of pending requests for each activityId? - // We currently fail when we find an existing request record. - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/378801 - - this.pendingRequest = this.pendingRequests.compute(requestRecord.getActivityId(), (activityId, current) -> { - - checkArgument(current == null, "current: expected no request record, not %s", current); - - final Timeout pendingRequestTimeout = requestRecord.newTimeout(timeout -> { - this.pendingRequests.remove(activityId); - requestRecord.expire(); - }); - - requestRecord.whenComplete((response, error) -> { - this.pendingRequests.remove(activityId); - pendingRequestTimeout.cancel(); - }); - - return requestRecord; - }); - - return this.pendingRequest.getArgs(); - } - - private Optional getRntbdContext() { - return Optional.of(this.contextFuture.getNow(null)); - } - - private void completeAllPendingRequestsExceptionally(final ChannelHandlerContext context, final Throwable throwable) { - - checkNotNull(throwable, "throwable: null"); - - if (this.closingExceptionally) { - checkArgument(throwable == ClosedWithPendingRequestsException.INSTANCE, "throwable: %s", throwable); - return; - } - - this.closingExceptionally = true; - - if (!this.pendingWrites.isEmpty()) { - this.pendingWrites.releaseAndFailAll(context, ClosedWithPendingRequestsException.INSTANCE); - } - - if (!this.pendingRequests.isEmpty()) { - - final Channel channel = context.channel(); - - if (!this.contextRequestFuture.isDone()) { - this.contextRequestFuture.completeExceptionally(throwable); - } - - if (!this.contextFuture.isDone()) { - this.contextFuture.completeExceptionally(throwable); - } - - Exception contextRequestException = null; - - if (this.contextRequestFuture.isCompletedExceptionally()) { - try { - this.contextRequestFuture.get(); - } catch (final CancellationException error) { - logger.debug("\n {} closed: context send cancelled", channel); - contextRequestException = error; - } catch (final Throwable error) { - final String message = Strings.lenientFormat("context send failed due to %s", error); - logger.debug("\n {} closed: {}", channel, message); - contextRequestException = new ChannelException(message, error); - } - } else if (this.contextFuture.isCompletedExceptionally()) { - try { - this.contextFuture.get(); - } catch (final CancellationException error) { - logger.debug("\n {} closed: context receive cancelled", channel); - contextRequestException = error; - } catch (final Throwable error) { - final String message = Strings.lenientFormat("context receive failed due to %s", error); - logger.debug("\n {} closed: {}", channel, message); - contextRequestException = new ChannelException(message, error); - } - } - - final String origin = "rntbd:/" + channel.remoteAddress(); - final int count = this.pendingRequests.size(); - final String message; - - if (contextRequestException == null) { - message = Strings.lenientFormat("%s channel closed with %s pending requests", channel, count); - } else { - message = Strings.lenientFormat("%s context request failed with %s pending requests", channel, count); - } - - final Exception reason; - - if (throwable == ClosedWithPendingRequestsException.INSTANCE && contextRequestException != null) { - reason = contextRequestException; - } else { - reason = throwable instanceof Exception ? (Exception)throwable : new ChannelException(throwable); - } - - for (final RntbdRequestRecord requestRecord : this.pendingRequests.values()) { - - final RntbdRequestArgs args = requestRecord.getArgs(); - final String requestUri = origin + args.getReplicaPath(); - final Map headers = args.getServiceRequest().getHeaders(); - - final GoneException cause = new GoneException(message, reason, headers, requestUri); - BridgeInternal.setRequestHeaders(cause, headers); - requestRecord.completeExceptionally(cause); - } - } - } - - private void completeRntbdContextFuture(final ChannelHandlerContext context, final RntbdContext value) { - - checkNotNull(context, "context"); - checkNotNull(value, "value"); - - if (this.contextFuture.isDone()) { - throw new IllegalStateException(Strings.lenientFormat("rntbdContextFuture: %s", this.contextFuture)); - } - - this.contextFuture.complete(value); - - final RntbdContextNegotiator negotiator = context.channel().pipeline().get(RntbdContextNegotiator.class); - negotiator.removeInboundHandler(); - negotiator.removeOutboundHandler(); - - if (!this.pendingWrites.isEmpty()) { - this.pendingWrites.writeAndRemoveAll(context); - } - } - - /** - * This method is called for each incoming message of type {@link StoreResponse} to complete a request - * - * @param context {@link ChannelHandlerContext} encode to which this {@link RntbdRequestManager} belongs - * @param response the message encode handle - */ - private void messageReceived(final ChannelHandlerContext context, final RntbdResponse response) { - - final UUID activityId = response.getActivityId(); - final RntbdRequestRecord pendingRequest = this.pendingRequests.get(activityId); - - if (pendingRequest == null) { - logger.warn("[activityId: {}] no request pending", activityId); - return; - } - - final HttpResponseStatus status = response.getStatus(); - - if (HttpResponseStatus.OK.code() <= status.code() && status.code() < HttpResponseStatus.MULTIPLE_CHOICES.code()) { - - final StoreResponse storeResponse = response.toStoreResponse(this.contextFuture.getNow(null)); - pendingRequest.complete(storeResponse); - - } else { - - // Map response to a DocumentClientException - - final DocumentClientException cause; - - // ..Fetch required header values - - final long lsn = response.getHeader(RntbdResponseHeader.LSN); - final String partitionKeyRangeId = response.getHeader(RntbdResponseHeader.PartitionKeyRangeId); - - // ..Create Error instance - - final Error error = response.hasPayload() ? - BridgeInternal.createError(RntbdObjectMapper.readTree(response)) : - new Error(Integer.toString(status.code()), status.reasonPhrase(), status.codeClass().name()); - - // ..Map RNTBD response headers to HTTP response headers - - final Map responseHeaders = response.getHeaders().asMap( - this.getRntbdContext().orElseThrow(IllegalStateException::new), activityId - ); - - // ..Create DocumentClientException based on status and sub-status codes - - switch (status.code()) { - - case StatusCodes.BADREQUEST: - cause = new BadRequestException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.CONFLICT: - cause = new ConflictException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.FORBIDDEN: - cause = new ForbiddenException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.GONE: - - final int subStatusCode = Math.toIntExact(response.getHeader(RntbdResponseHeader.SubStatus)); - - switch (subStatusCode) { - case SubStatusCodes.COMPLETING_SPLIT: - cause = new PartitionKeyRangeIsSplittingException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - case SubStatusCodes.COMPLETING_PARTITION_MIGRATION: - cause = new PartitionIsMigratingException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - case SubStatusCodes.NAME_CACHE_IS_STALE: - cause = new InvalidPartitionException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - case SubStatusCodes.PARTITION_KEY_RANGE_GONE: - cause = new PartitionKeyRangeGoneException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - default: - cause = new GoneException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - } - break; - - case StatusCodes.INTERNAL_SERVER_ERROR: - cause = new InternalServerErrorException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.LOCKED: - cause = new LockedException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.METHOD_NOT_ALLOWED: - cause = new MethodNotAllowedException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.NOTFOUND: - cause = new NotFoundException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.PRECONDITION_FAILED: - cause = new PreconditionFailedException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.REQUEST_ENTITY_TOO_LARGE: - cause = new RequestEntityTooLargeException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.REQUEST_TIMEOUT: - cause = new RequestTimeoutException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.RETRY_WITH: - cause = new RetryWithException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.SERVICE_UNAVAILABLE: - cause = new ServiceUnavailableException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.TOO_MANY_REQUESTS: - cause = new RequestRateTooLargeException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.UNAUTHORIZED: - cause = new UnauthorizedException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - default: - cause = new DocumentClientException(status.code(), error, responseHeaders); - break; - } - - logger.trace("{}[activityId: {}, statusCode: {}, subStatusCode: {}] ", - context.channel(), cause.getActivityId(), cause.getStatusCode(), cause.getSubStatusCode(), cause - ); - - pendingRequest.completeExceptionally(cause); - } - } - - private void traceOperation(final ChannelHandlerContext context, final String operationName, final Object... args) { - - if (logger.isTraceEnabled()) { - - final long birthTime; - final BigDecimal lifetime; - - if (this.pendingRequest == null) { - birthTime = System.nanoTime(); - lifetime = BigDecimal.ZERO; - } else { - birthTime = this.pendingRequest.getBirthTime(); - lifetime = BigDecimal.valueOf(this.pendingRequest.getLifetime().toNanos(), 6); - } - - logger.trace("{},{},\"{}({})\",\"{}\",\"{}\"", birthTime, lifetime, operationName, Stream.of(args).map(arg -> - arg == null ? "null" : arg.toString()).collect(Collectors.joining(",") - ), this.pendingRequest, context - ); - } - } - - // endregion - - // region Types - - private static class ClosedWithPendingRequestsException extends RuntimeException { - - static ClosedWithPendingRequestsException INSTANCE = new ClosedWithPendingRequestsException(); - - // TODO: DANOBLE: Consider revising strategy for closing an RntbdTransportClient with pending requests - // One possibility: - // A channel associated with an RntbdTransportClient will not be closed immediately, if there are any pending - // requests on it. Instead it will be scheduled to close after the request timeout interval (default: 60s) has - // elapsed. - // Algorithm: - // When the RntbdTransportClient is closed, it closes each of its RntbdServiceEndpoint instances. In turn each - // RntbdServiceEndpoint closes its RntbdClientChannelPool. The RntbdClientChannelPool.close method should - // schedule closure of any channel with pending requests for later; when the request timeout interval has - // elapsed or--ideally--when all pending requests have completed. - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/388987 - - private ClosedWithPendingRequestsException() { - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestRecord.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestRecord.java deleted file mode 100644 index 108a8e106b9a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestRecord.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RequestTimeoutException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import io.netty.util.Timeout; -import io.netty.util.TimerTask; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.time.Duration; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.TimeUnit; - -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdRequestRecord extends CompletableFuture { - - private static final Logger logger = LoggerFactory.getLogger(RntbdRequestRecord.class); - - private final RntbdRequestArgs args; - private final RntbdRequestTimer timer; - - public RntbdRequestRecord(final RntbdRequestArgs args, final RntbdRequestTimer timer) { - - checkNotNull(args, "args"); - checkNotNull(timer, "timer"); - - this.args = args; - this.timer = timer; - } - - public UUID getActivityId() { - return this.args.getActivityId(); - } - - public RntbdRequestArgs getArgs() { - return this.args; - } - - public long getBirthTime() { - return this.args.getBirthTime(); - } - - public Duration getLifetime() { - return this.args.getLifetime(); - } - - public void expire() { - final RequestTimeoutException error = new RequestTimeoutException( - String.format("Request timeout interval (%,d ms) elapsed", - this.timer.getRequestTimeout(TimeUnit.MILLISECONDS)), - this.args.getPhysicalAddress()); - BridgeInternal.setRequestHeaders(error, this.args.getServiceRequest().getHeaders()); - this.completeExceptionally(error); - } - - public Timeout newTimeout(final TimerTask task) { - return this.timer.newTimeout(task); - } - - @Override - public String toString() { - return this.args.toString(); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestTimer.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestTimer.java deleted file mode 100644 index 7217dfc7f73d..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestTimer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.util.HashedWheelTimer; -import io.netty.util.Timeout; -import io.netty.util.Timer; -import io.netty.util.TimerTask; - -import java.util.concurrent.TimeUnit; - -public final class RntbdRequestTimer implements AutoCloseable { - - private static final long FIVE_MILLISECONDS = 5000000L; - private final long requestTimeout; - private final Timer timer; - - public RntbdRequestTimer(final long requestTimeout) { - - // Inspection of the HashWheelTimer code indicates that our choice of a 5 millisecond timer resolution ensures - // a request will timeout within 10 milliseconds of the specified requestTimeout interval. This is because - // cancellation of a timeout takes two timer resolution units to complete. - - this.timer = new HashedWheelTimer(FIVE_MILLISECONDS, TimeUnit.NANOSECONDS); - this.requestTimeout = requestTimeout; - } - - public long getRequestTimeout(TimeUnit unit) { - return unit.convert(requestTimeout, TimeUnit.NANOSECONDS); - } - - @Override - public void close() throws RuntimeException { - this.timer.stop(); - } - - public Timeout newTimeout(final TimerTask task) { - return this.timer.newTimeout(task, this.requestTimeout, TimeUnit.NANOSECONDS); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponse.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponse.java deleted file mode 100644 index 77142964209a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponse.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.EmptyByteBuf; -import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.util.ReferenceCounted; -import io.netty.util.ResourceLeakDetector; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdResponseHeader; -import static java.lang.Math.min; - -@JsonPropertyOrder({ "frame", "headers", "content" }) -public final class RntbdResponse implements ReferenceCounted { - - // region Fields - - @JsonProperty - @JsonSerialize(using = PayloadSerializer.class) - private final ByteBuf content; - - @JsonProperty - private final RntbdResponseStatus frame; - - @JsonProperty - private final RntbdResponseHeaders headers; - - private AtomicInteger referenceCount = new AtomicInteger(); - - // endregion - - public RntbdResponse(final UUID activityId, final int statusCode, final Map map, final ByteBuf content) { - - this.headers = RntbdResponseHeaders.fromMap(map, content.readableBytes() > 0); - this.content = content.retain(); - - final HttpResponseStatus status = HttpResponseStatus.valueOf(statusCode); - final int length = RntbdResponseStatus.LENGTH + this.headers.computeLength(); - - this.frame = new RntbdResponseStatus(length, status, activityId); - } - - private RntbdResponse(final RntbdResponseStatus frame, final RntbdResponseHeaders headers, final ByteBuf content) { - - this.frame = frame; - this.headers = headers; - this.content = content.retain(); - } - - public UUID getActivityId() { - return this.frame.getActivityId(); - } - - @JsonIgnore - public ByteBuf getContent() { - return this.content; - } - - @JsonIgnore - public RntbdResponseHeaders getHeaders() { - return this.headers; - } - - @JsonIgnore - public HttpResponseStatus getStatus() { - return this.frame.getStatus(); - } - - static RntbdResponse decode(final ByteBuf in) { - - in.markReaderIndex(); - - final RntbdResponseStatus frame = RntbdResponseStatus.decode(in); - final RntbdResponseHeaders headers = RntbdResponseHeaders.decode(in.readSlice(frame.getHeadersLength())); - - final boolean hasPayload = headers.isPayloadPresent(); - final ByteBuf content; - - if (hasPayload) { - - if (!RntbdFramer.canDecodePayload(in)) { - in.resetReaderIndex(); - return null; - } - - content = in.readSlice(in.readIntLE()); - - } else { - - content = new EmptyByteBuf(in.alloc()); - } - - return new RntbdResponse(frame, headers, content); - } - - public void encode(final ByteBuf out) { - - final int start = out.writerIndex(); - - this.frame.encode(out); - this.headers.encode(out); - - final int length = out.writerIndex() - start; - - if (length != this.frame.getLength()) { - throw new IllegalStateException(); - } - - if (this.hasPayload()) { - out.writeIntLE(this.content.readableBytes()); - out.writeBytes(this.content); - } else if (this.content.readableBytes() > 0) { - throw new IllegalStateException(); - } - } - - @JsonIgnore - public T getHeader(final RntbdResponseHeader header) { - final T value = (T)this.headers.get(header).getValue(); - return value; - } - - public boolean hasPayload() { - return this.headers.isPayloadPresent(); - } - - /** - * Returns the reference count of this object. If {@code 0}, it means this object has been deallocated. - */ - @Override - public int refCnt() { - return this.referenceCount.get(); - } - - /** - * Decreases the reference count by {@code 1} and deallocate this object if the reference count reaches {@code 0} - * - * @return {@code true} if and only if the reference count became {@code 0} and this object is de-allocated - */ - @Override - public boolean release() { - return this.release(1); - } - - /** - * Decreases the reference count by {@code decrement} and de-allocates this object if the reference count reaches {@code 0} - * - * @param decrement amount of the decrease - * @return {@code true} if and only if the reference count became {@code 0} and this object has been de-allocated - */ - @Override - public boolean release(final int decrement) { - - return this.referenceCount.getAndAccumulate(decrement, (value, n) -> { - value = value - min(value, n); - if (value == 0) { - assert this.headers != null && this.content != null; - this.headers.releaseBuffers(); - this.content.release(); - } - return value; - }) == 0; - } - - /** - * Increases the reference count by {@code 1}. - */ - @Override - public ReferenceCounted retain() { - this.referenceCount.incrementAndGet(); - return this; - } - - /** - * Increases the reference count by the specified {@code increment}. - * - * @param increment amount of the increase - */ - @Override - public ReferenceCounted retain(final int increment) { - this.referenceCount.addAndGet(increment); - return this; - } - - StoreResponse toStoreResponse(final RntbdContext context) { - - checkNotNull(context, "context"); - final int length = this.content.readableBytes(); - - return new StoreResponse( - this.getStatus().code(), - this.headers.asList(context, this.getActivityId()), - length == 0 ? null : this.content.readCharSequence(length, StandardCharsets.UTF_8).toString() - ); - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } - - /** - * Records the current access location of this object for debugging purposes - *

- * If this object is determined to be leaked, the information recorded by this operation will be provided to you - * via {@link ResourceLeakDetector}. This method is a shortcut to {@link #touch(Object) touch(null)}. - */ - @Override - public ReferenceCounted touch() { - return this; - } - - /** - * Records the current access location of this object with additional arbitrary information for debugging purposes - *

- * If this object is determined to be leaked, the information recorded by this operation will be - * provided to you via {@link ResourceLeakDetector}. - * - * @param hint information useful for debugging (unused) - */ - @Override - public ReferenceCounted touch(final Object hint) { - return this; - } - - private static class PayloadSerializer extends StdSerializer { - - public PayloadSerializer() { - super(ByteBuf.class, true); - } - - @Override - public void serialize(final ByteBuf value, final JsonGenerator generator, final SerializerProvider provider) throws IOException { - - final int length = value.readableBytes(); - - generator.writeStartObject(); - generator.writeObjectField("length", length); - generator.writeObjectField("content", ByteBufUtil.hexDump(value, 0, length)); - generator.writeEndObject(); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseDecoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseDecoder.java deleted file mode 100644 index d813233255c3..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseDecoder.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -public final class RntbdResponseDecoder extends ByteToMessageDecoder { - - private static final Logger Logger = LoggerFactory.getLogger(RntbdResponseDecoder.class); - - /** - * Deserialize from an input {@link ByteBuf} to an {@link RntbdResponse} instance - *

- * This method is called till it reads no bytes from the {@link ByteBuf} or there is no more data to be readTree. - * - * @param context the {@link ChannelHandlerContext} to which this {@link RntbdResponseDecoder} belongs - * @param in the {@link ByteBuf} to which data to be decoded is readTree - * @param out the {@link List} to which decoded messages are added - */ - @Override - protected void decode(final ChannelHandlerContext context, final ByteBuf in, final List out) { - - if (RntbdFramer.canDecodeHead(in)) { - - final RntbdResponse response = RntbdResponse.decode(in); - - if (response != null) { - Logger.debug("{} DECODE COMPLETE: {}", context.channel(), response); - in.discardReadBytes(); - out.add(response.retain()); - } - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseHeaders.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseHeaders.java deleted file mode 100644 index ef459591e8f2..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseHeaders.java +++ /dev/null @@ -1,535 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; - -import java.math.BigDecimal; -import java.util.AbstractMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.function.BiConsumer; -import java.util.function.Function; - -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.HttpHeaders; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants.BackendHeaders; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdIndexingDirective; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdResponseHeader; - -@JsonFilter("RntbdToken") -class RntbdResponseHeaders extends RntbdTokenStream { - - // region Fields - - @JsonProperty - private final RntbdToken LSN; - @JsonProperty - private final RntbdToken collectionLazyIndexProgress; - @JsonProperty - private final RntbdToken collectionPartitionIndex; - @JsonProperty - private final RntbdToken collectionSecurityIdentifier; - @JsonProperty - private final RntbdToken collectionServiceIndex; - @JsonProperty - private final RntbdToken collectionUpdateProgress; - @JsonProperty - private final RntbdToken continuationToken; - @JsonProperty - private final RntbdToken currentReplicaSetSize; - @JsonProperty - private final RntbdToken currentWriteQuorum; - @JsonProperty - private final RntbdToken databaseAccountId; - @JsonProperty - private final RntbdToken disableRntbdChannel; - @JsonProperty - private final RntbdToken eTag; - @JsonProperty - private final RntbdToken globalCommittedLSN; - @JsonProperty - private final RntbdToken hasTentativeWrites; - @JsonProperty - private final RntbdToken indexTermsGenerated; - @JsonProperty - private final RntbdToken indexingDirective; - @JsonProperty - private final RntbdToken isRUPerMinuteUsed; - @JsonProperty - private final RntbdToken itemCount; - @JsonProperty - private final RntbdToken itemLSN; - @JsonProperty - private final RntbdToken itemLocalLSN; - @JsonProperty - private final RntbdToken lastStateChangeDateTime; - @JsonProperty - private final RntbdToken localLSN; - @JsonProperty - private final RntbdToken logResults; - @JsonProperty - private final RntbdToken numberOfReadRegions; - @JsonProperty - private final RntbdToken offerReplacePending; - @JsonProperty - private final RntbdToken ownerFullName; - @JsonProperty - private final RntbdToken ownerId; - @JsonProperty - private final RntbdToken partitionKeyRangeId; - @JsonProperty - private final RntbdToken payloadPresent; - @JsonProperty - private final RntbdToken queriesPerformed; - @JsonProperty - private final RntbdToken queryMetrics; - @JsonProperty - private final RntbdToken quorumAckedLSN; - @JsonProperty - private final RntbdToken quorumAckedLocalLSN; - @JsonProperty - private final RntbdToken readsPerformed; - @JsonProperty - private final RntbdToken requestCharge; - @JsonProperty - private final RntbdToken requestValidationFailure; - @JsonProperty - private final RntbdToken restoreState; - @JsonProperty - private final RntbdToken retryAfterMilliseconds; - @JsonProperty - private final RntbdToken schemaVersion; - @JsonProperty - private final RntbdToken scriptsExecuted; - @JsonProperty - private final RntbdToken serverDateTimeUtc; - @JsonProperty - private final RntbdToken sessionToken; - @JsonProperty - private final RntbdToken shareThroughput; - @JsonProperty - private final RntbdToken storageMaxResoureQuota; - @JsonProperty - private final RntbdToken storageResourceQuotaUsage; - @JsonProperty - private final RntbdToken subStatus; - @JsonProperty - private final RntbdToken transportRequestID; - @JsonProperty - private final RntbdToken writesPerformed; - @JsonProperty - private final RntbdToken xpRole; - - // endregion - - private RntbdResponseHeaders() { - - super(RntbdResponseHeader.set, RntbdResponseHeader.map); - - this.LSN = this.get(RntbdResponseHeader.LSN); - this.collectionLazyIndexProgress = this.get(RntbdResponseHeader.CollectionLazyIndexProgress); - this.collectionPartitionIndex = this.get(RntbdResponseHeader.CollectionPartitionIndex); - this.collectionSecurityIdentifier = this.get(RntbdResponseHeader.CollectionSecurityIdentifier); - this.collectionServiceIndex = this.get(RntbdResponseHeader.CollectionServiceIndex); - this.collectionUpdateProgress = this.get(RntbdResponseHeader.CollectionUpdateProgress); - this.continuationToken = this.get(RntbdResponseHeader.ContinuationToken); - this.currentReplicaSetSize = this.get(RntbdResponseHeader.CurrentReplicaSetSize); - this.currentWriteQuorum = this.get(RntbdResponseHeader.CurrentWriteQuorum); - this.databaseAccountId = this.get(RntbdResponseHeader.DatabaseAccountId); - this.disableRntbdChannel = this.get(RntbdResponseHeader.DisableRntbdChannel); - this.eTag = this.get(RntbdResponseHeader.ETag); - this.globalCommittedLSN = this.get(RntbdResponseHeader.GlobalCommittedLSN); - this.hasTentativeWrites = this.get(RntbdResponseHeader.HasTentativeWrites); - this.indexTermsGenerated = this.get(RntbdResponseHeader.IndexTermsGenerated); - this.indexingDirective = this.get(RntbdResponseHeader.IndexingDirective); - this.isRUPerMinuteUsed = this.get(RntbdResponseHeader.IsRUPerMinuteUsed); - this.itemCount = this.get(RntbdResponseHeader.ItemCount); - this.itemLSN = this.get(RntbdResponseHeader.ItemLSN); - this.itemLocalLSN = this.get(RntbdResponseHeader.ItemLocalLSN); - this.lastStateChangeDateTime = this.get(RntbdResponseHeader.LastStateChangeDateTime); - this.localLSN = this.get(RntbdResponseHeader.LocalLSN); - this.logResults = this.get(RntbdResponseHeader.LogResults); - this.numberOfReadRegions = this.get(RntbdResponseHeader.NumberOfReadRegions); - this.offerReplacePending = this.get(RntbdResponseHeader.OfferReplacePending); - this.ownerFullName = this.get(RntbdResponseHeader.OwnerFullName); - this.ownerId = this.get(RntbdResponseHeader.OwnerId); - this.partitionKeyRangeId = this.get(RntbdResponseHeader.PartitionKeyRangeId); - this.payloadPresent = this.get(RntbdResponseHeader.PayloadPresent); - this.queriesPerformed = this.get(RntbdResponseHeader.QueriesPerformed); - this.queryMetrics = this.get(RntbdResponseHeader.QueryMetrics); - this.quorumAckedLSN = this.get(RntbdResponseHeader.QuorumAckedLSN); - this.quorumAckedLocalLSN = this.get(RntbdResponseHeader.QuorumAckedLocalLSN); - this.readsPerformed = this.get(RntbdResponseHeader.ReadsPerformed); - this.requestCharge = this.get(RntbdResponseHeader.RequestCharge); - this.requestValidationFailure = this.get(RntbdResponseHeader.RequestValidationFailure); - this.restoreState = this.get(RntbdResponseHeader.RestoreState); - this.retryAfterMilliseconds = this.get(RntbdResponseHeader.RetryAfterMilliseconds); - this.schemaVersion = this.get(RntbdResponseHeader.SchemaVersion); - this.scriptsExecuted = this.get(RntbdResponseHeader.ScriptsExecuted); - this.serverDateTimeUtc = this.get(RntbdResponseHeader.ServerDateTimeUtc); - this.sessionToken = this.get(RntbdResponseHeader.SessionToken); - this.shareThroughput = this.get(RntbdResponseHeader.ShareThroughput); - this.storageMaxResoureQuota = this.get(RntbdResponseHeader.StorageMaxResoureQuota); - this.storageResourceQuotaUsage = this.get(RntbdResponseHeader.StorageResourceQuotaUsage); - this.subStatus = this.get(RntbdResponseHeader.SubStatus); - this.transportRequestID = this.get(RntbdResponseHeader.TransportRequestID); - this.writesPerformed = this.get(RntbdResponseHeader.WritesPerformed); - this.xpRole = this.get(RntbdResponseHeader.XPRole); - } - - boolean isPayloadPresent() { - return this.payloadPresent.isPresent() && this.payloadPresent.getValue(Byte.class) != 0x00; - } - - List> asList(final RntbdContext context, final UUID activityId) { - - final ImmutableList.Builder> builder = ImmutableList.builderWithExpectedSize(this.computeCount() + 2); - builder.add(new Entry(HttpHeaders.SERVER_VERSION, context.getServerVersion())); - builder.add(new Entry(HttpHeaders.ACTIVITY_ID, activityId.toString())); - - this.collectEntries((token, toEntry) -> { - if (token.isPresent()) { - builder.add(toEntry.apply(token)); - } - }); - - return builder.build(); - } - - public Map asMap(final RntbdContext context, final UUID activityId) { - - final ImmutableMap.Builder builder = ImmutableMap.builderWithExpectedSize(this.computeCount() + 2); - builder.put(new Entry(HttpHeaders.SERVER_VERSION, context.getServerVersion())); - builder.put(new Entry(HttpHeaders.ACTIVITY_ID, activityId.toString())); - - this.collectEntries((token, toEntry) -> { - if (token.isPresent()) { - builder.put(toEntry.apply(token)); - } - }); - - return builder.build(); - } - - static RntbdResponseHeaders decode(final ByteBuf in) { - final RntbdResponseHeaders headers = new RntbdResponseHeaders(); - RntbdTokenStream.decode(in, headers); - return headers; - } - - public static RntbdResponseHeaders fromMap(final Map map, final boolean payloadPresent) { - - final RntbdResponseHeaders headers = new RntbdResponseHeaders(); - headers.payloadPresent.setValue(payloadPresent); - headers.setValues(map); - - return headers; - } - - public void setValues(final Map headers) { - - this.mapValue(this.LSN, BackendHeaders.LSN, Long::parseLong, headers); - this.mapValue(this.collectionLazyIndexProgress, HttpHeaders.COLLECTION_LAZY_INDEXING_PROGRESS, Integer::parseInt, headers); - this.mapValue(this.collectionLazyIndexProgress, BackendHeaders.COLLECTION_PARTITION_INDEX, Integer::parseInt, headers); - this.mapValue(this.collectionSecurityIdentifier, BackendHeaders.COLLECTION_SECURITY_IDENTIFIER, String::toString, headers); - this.mapValue(this.collectionServiceIndex, BackendHeaders.COLLECTION_SERVICE_INDEX, Integer::parseInt, headers); - this.mapValue(this.collectionUpdateProgress, HttpHeaders.COLLECTION_INDEX_TRANSFORMATION_PROGRESS, Integer::parseInt, headers); - this.mapValue(this.continuationToken, HttpHeaders.CONTINUATION, String::toString, headers); - this.mapValue(this.currentReplicaSetSize, BackendHeaders.CURRENT_REPLICA_SET_SIZE, Integer::parseInt, headers); - this.mapValue(this.currentWriteQuorum, BackendHeaders.CURRENT_WRITE_QUORUM, Integer::parseInt, headers); - this.mapValue(this.databaseAccountId, BackendHeaders.DATABASE_ACCOUNT_ID, String::toString, headers); - this.mapValue(this.disableRntbdChannel, HttpHeaders.DISABLE_RNTBD_CHANNEL, Boolean::parseBoolean, headers); - this.mapValue(this.eTag, HttpHeaders.E_TAG, String::toString, headers); - this.mapValue(this.globalCommittedLSN, BackendHeaders.GLOBAL_COMMITTED_LSN, Long::parseLong, headers); - this.mapValue(this.hasTentativeWrites, BackendHeaders.HAS_TENTATIVE_WRITES, Boolean::parseBoolean, headers); - this.mapValue(this.indexingDirective, HttpHeaders.INDEXING_DIRECTIVE, RntbdIndexingDirective::valueOf, headers); - this.mapValue(this.isRUPerMinuteUsed, BackendHeaders.IS_RU_PER_MINUTE_USED, Byte::parseByte, headers); - this.mapValue(this.itemCount, HttpHeaders.ITEM_COUNT, Integer::parseInt, headers); - this.mapValue(this.itemLSN, BackendHeaders.ITEM_LSN, Long::parseLong, headers); - this.mapValue(this.itemLocalLSN, BackendHeaders.ITEM_LOCAL_LSN, Long::parseLong, headers); - this.mapValue(this.lastStateChangeDateTime, HttpHeaders.LAST_STATE_CHANGE_UTC, String::toString, headers); - this.mapValue(this.lastStateChangeDateTime, HttpHeaders.LAST_STATE_CHANGE_UTC, String::toString, headers); - this.mapValue(this.localLSN, BackendHeaders.LOCAL_LSN, Long::parseLong, headers); - this.mapValue(this.logResults, HttpHeaders.LOG_RESULTS, String::toString, headers); - this.mapValue(this.numberOfReadRegions, BackendHeaders.NUMBER_OF_READ_REGIONS, Integer::parseInt, headers); - this.mapValue(this.offerReplacePending, BackendHeaders.OFFER_REPLACE_PENDING, Boolean::parseBoolean, headers); - this.mapValue(this.ownerFullName, HttpHeaders.OWNER_FULL_NAME, String::toString, headers); - this.mapValue(this.ownerId, HttpHeaders.OWNER_ID, String::toString, headers); - this.mapValue(this.partitionKeyRangeId, BackendHeaders.PARTITION_KEY_RANGE_ID, String::toString, headers); - this.mapValue(this.queryMetrics, BackendHeaders.QUERY_METRICS, String::toString, headers); - this.mapValue(this.quorumAckedLSN, BackendHeaders.QUORUM_ACKED_LSN, Long::parseLong, headers); - this.mapValue(this.quorumAckedLocalLSN, BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long::parseLong, headers); - this.mapValue(this.requestCharge, HttpHeaders.REQUEST_CHARGE, Double::parseDouble, headers); - this.mapValue(this.requestValidationFailure, BackendHeaders.REQUEST_VALIDATION_FAILURE, Byte::parseByte, headers); - this.mapValue(this.restoreState, BackendHeaders.RESTORE_STATE, String::toString, headers); - this.mapValue(this.retryAfterMilliseconds, HttpHeaders.RETRY_AFTER_IN_MILLISECONDS, Integer::parseInt, headers); - this.mapValue(this.schemaVersion, HttpHeaders.SCHEMA_VERSION, String::toString, headers); - this.mapValue(this.serverDateTimeUtc, HttpHeaders.X_DATE, String::toString, headers); - this.mapValue(this.sessionToken, HttpHeaders.SESSION_TOKEN, String::toString, headers); - this.mapValue(this.shareThroughput, BackendHeaders.SHARE_THROUGHPUT, Boolean::parseBoolean, headers); - this.mapValue(this.storageMaxResoureQuota, HttpHeaders.MAX_RESOURCE_QUOTA, String::toString, headers); - this.mapValue(this.storageResourceQuotaUsage, HttpHeaders.CURRENT_RESOURCE_QUOTA_USAGE, String::toString, headers); - this.mapValue(this.subStatus, BackendHeaders.SUB_STATUS, Integer::parseInt, headers); - this.mapValue(this.transportRequestID, HttpHeaders.TRANSPORT_REQUEST_ID, Integer::parseInt, headers); - this.mapValue(this.xpRole, BackendHeaders.XP_ROLE, Integer::parseInt, headers); - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } - - private void collectEntries(final BiConsumer>> collector) { - - collector.accept(this.LSN, token -> - toLongEntry(BackendHeaders.LSN, token) - ); - - collector.accept(this.collectionLazyIndexProgress, token -> - toIntegerEntry(HttpHeaders.COLLECTION_LAZY_INDEXING_PROGRESS, token) - ); - - collector.accept(this.collectionPartitionIndex, token -> - toIntegerEntry(BackendHeaders.COLLECTION_PARTITION_INDEX, token) - ); - - collector.accept(this.collectionSecurityIdentifier, token -> - toStringEntry(BackendHeaders.COLLECTION_SECURITY_IDENTIFIER, token) - ); - - collector.accept(this.collectionServiceIndex, token -> - toIntegerEntry(BackendHeaders.COLLECTION_SERVICE_INDEX, token) - ); - - collector.accept(this.collectionUpdateProgress, token -> - toIntegerEntry(HttpHeaders.COLLECTION_INDEX_TRANSFORMATION_PROGRESS, token) - ); - - collector.accept(this.continuationToken, token -> - toStringEntry(HttpHeaders.CONTINUATION, token) - ); - - collector.accept(this.currentReplicaSetSize, token -> - toIntegerEntry(BackendHeaders.CURRENT_REPLICA_SET_SIZE, token) - ); - - collector.accept(this.currentWriteQuorum, token -> - toIntegerEntry(BackendHeaders.CURRENT_WRITE_QUORUM, token) - ); - - collector.accept(this.databaseAccountId, token -> - toStringEntry(BackendHeaders.DATABASE_ACCOUNT_ID, token) - ); - - collector.accept(this.disableRntbdChannel, token -> - toBooleanEntry(HttpHeaders.DISABLE_RNTBD_CHANNEL, token) - ); - - collector.accept(this.eTag, token -> - toStringEntry(HttpHeaders.E_TAG, token) - ); - - collector.accept(this.globalCommittedLSN, token -> - toLongEntry(BackendHeaders.GLOBAL_COMMITTED_LSN, token) - ); - - collector.accept(this.hasTentativeWrites, token -> - toBooleanEntry(BackendHeaders.HAS_TENTATIVE_WRITES, token) - ); - - collector.accept(this.indexingDirective, token -> - new Entry(HttpHeaders.INDEXING_DIRECTIVE, RntbdIndexingDirective.fromId(token.getValue(Byte.class)).name()) - ); - - collector.accept(this.isRUPerMinuteUsed, token -> - toByteEntry(BackendHeaders.IS_RU_PER_MINUTE_USED, token) - ); - - collector.accept(this.itemCount, token -> - toIntegerEntry(HttpHeaders.ITEM_COUNT, token) - ); - - collector.accept(this.itemLSN, token -> - toLongEntry(BackendHeaders.ITEM_LSN, token) - ); - - collector.accept(this.itemLocalLSN, token -> - toLongEntry(BackendHeaders.ITEM_LOCAL_LSN, token) - ); - - collector.accept(this.lastStateChangeDateTime, token -> - toStringEntry(HttpHeaders.LAST_STATE_CHANGE_UTC, token) - ); - - collector.accept(this.localLSN, token -> - toLongEntry(BackendHeaders.LOCAL_LSN, token) - ); - - collector.accept(this.logResults, token -> - toStringEntry(HttpHeaders.LOG_RESULTS, token) - ); - - collector.accept(this.numberOfReadRegions, token -> - toIntegerEntry(BackendHeaders.NUMBER_OF_READ_REGIONS, token) - ); - - collector.accept(this.offerReplacePending, token -> - toBooleanEntry(BackendHeaders.OFFER_REPLACE_PENDING, token) - ); - - collector.accept(this.ownerFullName, token -> - toStringEntry(HttpHeaders.OWNER_FULL_NAME, token) - ); - - collector.accept(this.ownerId, token -> - toStringEntry(HttpHeaders.OWNER_ID, token) - ); - - collector.accept(this.partitionKeyRangeId, token -> - toStringEntry(BackendHeaders.PARTITION_KEY_RANGE_ID, token) - ); - - collector.accept(this.queryMetrics, token -> - toStringEntry(BackendHeaders.QUERY_METRICS, token) - ); - - collector.accept(this.quorumAckedLSN, token -> - toLongEntry(BackendHeaders.QUORUM_ACKED_LSN, token) - ); - - collector.accept(this.quorumAckedLocalLSN, token -> - toLongEntry(BackendHeaders.QUORUM_ACKED_LOCAL_LSN, token) - ); - - collector.accept(this.requestCharge, token -> - toCurrencyEntry(HttpHeaders.REQUEST_CHARGE, token) - ); - - collector.accept(this.requestValidationFailure, token -> - toByteEntry(BackendHeaders.REQUEST_VALIDATION_FAILURE, token) - ); - - collector.accept(this.restoreState, token -> - toStringEntry(BackendHeaders.RESTORE_STATE, token) - ); - - collector.accept(this.retryAfterMilliseconds, token -> - toIntegerEntry(HttpHeaders.RETRY_AFTER_IN_MILLISECONDS, token) - ); - - collector.accept(this.schemaVersion, token -> - toStringEntry(HttpHeaders.SCHEMA_VERSION, token) - ); - - collector.accept(this.serverDateTimeUtc, token -> - toStringEntry(HttpHeaders.X_DATE, token) - ); - - collector.accept(this.sessionToken, token -> - this.toSessionTokenEntry(HttpHeaders.SESSION_TOKEN, token) - ); - - collector.accept(this.shareThroughput, token -> - toBooleanEntry(BackendHeaders.SHARE_THROUGHPUT, token) - ); - - collector.accept(this.storageMaxResoureQuota, token -> - toStringEntry(HttpHeaders.MAX_RESOURCE_QUOTA, token) - ); - - collector.accept(this.storageResourceQuotaUsage, token -> - toStringEntry(HttpHeaders.CURRENT_RESOURCE_QUOTA_USAGE, token) - ); - - collector.accept(this.subStatus, token -> - toIntegerEntry(BackendHeaders.SUB_STATUS, token) - ); - - collector.accept(this.transportRequestID, token -> - toIntegerEntry(HttpHeaders.TRANSPORT_REQUEST_ID, token) - ); - - collector.accept(this.xpRole, token -> - toIntegerEntry(BackendHeaders.XP_ROLE, token) - ); - } - - private void mapValue(final RntbdToken token, final String name, final Function parse, final Map headers) { - - final String value = headers.get(name); - - if (value != null) { - token.setValue(parse.apply(value)); - } - } - - private static Map.Entry toBooleanEntry(final String name, final RntbdToken token) { - return new Entry(name, String.valueOf(token.getValue(Byte.class) != 0)); - } - - private static Map.Entry toByteEntry(final String name, final RntbdToken token) { - return new Entry(name, Byte.toString(token.getValue(Byte.class))); - } - - private static Map.Entry toCurrencyEntry(final String name, final RntbdToken token) { - final BigDecimal value = new BigDecimal(Math.round(token.getValue(Double.class) * 100D)).scaleByPowerOfTen(-2); - return new Entry(name, value.toString()); - } - - private static Map.Entry toIntegerEntry(final String name, final RntbdToken token) { - return new Entry(name, Long.toString(token.getValue(Long.class))); - } - - private static Map.Entry toLongEntry(final String name, final RntbdToken token) { - return new Entry(name, Long.toString(token.getValue(Long.class))); - } - - private Map.Entry toSessionTokenEntry(final String name, final RntbdToken token) { - return new Entry(name, this.partitionKeyRangeId.getValue(String.class) + ":" + this.sessionToken.getValue(String.class)); - } - - private static Map.Entry toStringEntry(final String name, final RntbdToken token) { - return new Entry(name, token.getValue(String.class)); - } - - private static final class Entry extends AbstractMap.SimpleImmutableEntry { - Entry(final String name, final String value) { - super(name, value); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseStatus.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseStatus.java deleted file mode 100644 index f5473084f4a0..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseStatus.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.http.HttpResponseStatus; - -import java.util.UUID; - -@JsonPropertyOrder({ "length", "status", "activityId" }) -final class RntbdResponseStatus { - - // region Fields - - static final int LENGTH = Integer.BYTES // length - + Integer.BYTES // status - + 2 * Long.BYTES; // activityId - - @JsonProperty("activityId") - private final UUID activityId; - - @JsonProperty("length") - private final int length; - - private final HttpResponseStatus status; - - // endregion - - RntbdResponseStatus(final int length, final HttpResponseStatus status, final UUID activityId) { - this.length = length; - this.status = status; - this.activityId = activityId; - } - - public UUID getActivityId() { - return this.activityId; - } - - int getHeadersLength() { - return this.length - LENGTH; - } - - public int getLength() { - return this.length; - } - - public HttpResponseStatus getStatus() { - return this.status; - } - - @JsonProperty("status") - public int getStatusCode() { - return this.status.code(); - } - - static RntbdResponseStatus decode(final ByteBuf in) { - - final long length = in.readUnsignedIntLE(); - - if (!(LENGTH <= length && length <= Integer.MAX_VALUE)) { - final String reason = String.format("frame length: %d", length); - throw new CorruptedFrameException(reason); - } - - final int code = in.readIntLE(); - final HttpResponseStatus status = HttpResponseStatus.valueOf(code); - - if (status == null) { - final String reason = String.format("status code: %d", code); - throw new CorruptedFrameException(reason); - } - - final UUID activityId = RntbdUUID.decode(in); - return new RntbdResponseStatus((int)length, status, activityId); - } - - void encode(final ByteBuf out) { - out.writeIntLE(this.getLength()); - out.writeIntLE(this.getStatusCode()); - RntbdUUID.encode(this.getActivityId(), out); - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java deleted file mode 100644 index 8c89a207f762..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java +++ /dev/null @@ -1,355 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GoneException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RntbdTransportClient.Options; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.nio.NioSocketChannel; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.ssl.SslContext; -import io.netty.util.concurrent.DefaultThreadFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.net.SocketAddress; -import java.net.URI; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; -import java.util.stream.Stream; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdReporter.reportIssue; - -@JsonSerialize(using = RntbdServiceEndpoint.JsonSerializer.class) -public final class RntbdServiceEndpoint implements RntbdEndpoint { - - private static final AtomicLong instanceCount = new AtomicLong(); - private static final Logger logger = LoggerFactory.getLogger(RntbdServiceEndpoint.class); - private static final String namePrefix = RntbdServiceEndpoint.class.getSimpleName() + '-'; - - private final RntbdClientChannelPool channelPool; - private final AtomicBoolean closed; - private final RntbdMetrics metrics; - private final String name; - private final SocketAddress remoteAddress; - private final RntbdRequestTimer requestTimer; - - // region Constructors - - private RntbdServiceEndpoint( - final Config config, final NioEventLoopGroup group, final RntbdRequestTimer timer, final URI physicalAddress - ) { - - final Bootstrap bootstrap = new Bootstrap() - .channel(NioSocketChannel.class) - .group(group) - .option(ChannelOption.AUTO_READ, true) - .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.getConnectionTimeout()) - .option(ChannelOption.SO_KEEPALIVE, true) - .remoteAddress(physicalAddress.getHost(), physicalAddress.getPort()); - - this.name = RntbdServiceEndpoint.namePrefix + instanceCount.incrementAndGet(); - this.channelPool = new RntbdClientChannelPool(bootstrap, config); - this.remoteAddress = bootstrap.config().remoteAddress(); - this.metrics = new RntbdMetrics(this.name); - this.closed = new AtomicBoolean(); - this.requestTimer = timer; - } - - // endregion - - // region Accessors - - @Override - public String getName() { - return this.name; - } - - // endregion - - // region Methods - - @Override - public void close() { - if (this.closed.compareAndSet(false, true)) { - this.channelPool.close(); - this.metrics.close(); - } - } - - public CompletableFuture request(final RntbdRequestArgs args) { - - this.throwIfClosed(); - - if (logger.isDebugEnabled()) { - args.traceOperation(logger, null, "request"); - logger.debug("\n {}\n {}\n REQUEST", this, args); - } - - final RntbdRequestRecord requestRecord = this.write(args); - this.metrics.incrementRequestCount(); - - return requestRecord.whenComplete((response, error) -> { - - args.traceOperation(logger, null, "requestComplete", response, error); - this.metrics.incrementResponseCount(); - - if (error != null) { - this.metrics.incrementErrorResponseCount(); - } - - if (logger.isDebugEnabled()) { - if (error == null) { - final int status = response.getStatus(); - logger.debug("\n [{}]\n {}\n request succeeded with response status: {}", this, args, status); - } else { - logger.debug("\n [{}]\n {}\n request failed due to ", this, args, error); - } - } - }); - } - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - - // endregion - - // region Privates - - private void releaseToPool(final Channel channel) { - - logger.debug("\n [{}]\n {}\n RELEASE", this, channel); - - this.channelPool.release(channel).addListener(future -> { - if (logger.isDebugEnabled()) { - if (future.isSuccess()) { - logger.debug("\n [{}]\n {}\n release succeeded", this, channel); - } else { - logger.debug("\n [{}]\n {}\n release failed due to {}", this, channel, future.cause()); - } - } - }); - } - - private void throwIfClosed() { - checkState(!this.closed.get(), "%s is closed", this); - } - - private RntbdRequestRecord write(final RntbdRequestArgs requestArgs) { - - final RntbdRequestRecord requestRecord = new RntbdRequestRecord(requestArgs, this.requestTimer); - logger.debug("\n [{}]\n {}\n WRITE", this, requestArgs); - - this.channelPool.acquire().addListener(connected -> { - - if (connected.isSuccess()) { - - requestArgs.traceOperation(logger, null, "write"); - final Channel channel = (Channel)connected.get(); - this.releaseToPool(channel); - - channel.write(requestRecord).addListener((ChannelFuture future) -> { - requestArgs.traceOperation(logger, null, "writeComplete", channel); - if (!future.isSuccess()) { - this.metrics.incrementErrorResponseCount(); - } - }); - - return; - } - - final UUID activityId = requestArgs.getActivityId(); - final Throwable cause = connected.cause(); - - if (connected.isCancelled()) { - - logger.debug("\n [{}]\n {}\n write cancelled: {}", this, requestArgs, cause); - requestRecord.cancel(true); - - } else { - - logger.debug("\n [{}]\n {}\n write failed due to {} ", this, requestArgs, cause); - final String reason = cause.getMessage(); - - final GoneException goneException = new GoneException( - String.format("failed to establish connection to %s: %s", this.remoteAddress, reason), - cause instanceof Exception ? (Exception)cause : new IOException(reason, cause), - ImmutableMap.of(HttpConstants.HttpHeaders.ACTIVITY_ID, activityId.toString()), - requestArgs.getReplicaPath() - ); - - BridgeInternal.setRequestHeaders(goneException, requestArgs.getServiceRequest().getHeaders()); - requestRecord.completeExceptionally(goneException); - } - }); - - return requestRecord; - } - - // endregion - - // region Types - - static final class JsonSerializer extends StdSerializer { - - public JsonSerializer() { - this(null); - } - - public JsonSerializer(Class type) { - super(type); - } - - @Override - public void serialize(RntbdServiceEndpoint value, JsonGenerator generator, SerializerProvider provider) - throws IOException { - - generator.writeStartObject(); - generator.writeStringField(value.name, value.remoteAddress.toString()); - generator.writeObjectField("channelPool", value.channelPool); - generator.writeEndObject(); - } - } - - public static final class Provider implements RntbdEndpoint.Provider { - - private static final Logger logger = LoggerFactory.getLogger(Provider.class); - - private final AtomicBoolean closed = new AtomicBoolean(); - private final Config config; - private final ConcurrentHashMap endpoints = new ConcurrentHashMap<>(); - private final NioEventLoopGroup eventLoopGroup; - private final RntbdRequestTimer requestTimer; - - public Provider(final Options options, final SslContext sslContext) { - - checkNotNull(options, "options"); - checkNotNull(sslContext, "sslContext"); - - final DefaultThreadFactory threadFactory = new DefaultThreadFactory("CosmosEventLoop", true); - final int threadCount = Runtime.getRuntime().availableProcessors(); - final LogLevel wireLogLevel; - - if (logger.isTraceEnabled()) { - wireLogLevel = LogLevel.TRACE; - } else if (logger.isDebugEnabled()) { - wireLogLevel = LogLevel.DEBUG; - } else { - wireLogLevel = null; - } - - this.config = new Config(options, sslContext, wireLogLevel); - this.requestTimer = new RntbdRequestTimer(config.getRequestTimeout()); - this.eventLoopGroup = new NioEventLoopGroup(threadCount, threadFactory); - } - - @Override - public void close() throws RuntimeException { - - if (this.closed.compareAndSet(false, true)) { - - this.requestTimer.close(); - - for (final RntbdEndpoint endpoint : this.endpoints.values()) { - endpoint.close(); - } - - this.eventLoopGroup.shutdownGracefully().addListener(future -> { - if (future.isSuccess()) { - logger.debug("\n [{}]\n closed endpoints", this); - return; - } - logger.error("\n [{}]\n failed to close endpoints due to ", this, future.cause()); - }); - return; - } - - logger.debug("\n [{}]\n already closed", this); - } - - @Override - public Config config() { - return this.config; - } - - @Override - public int count() { - return this.endpoints.size(); - } - - @Override - public RntbdEndpoint get(URI physicalAddress) { - return endpoints.computeIfAbsent(physicalAddress.getAuthority(), authority -> - new RntbdServiceEndpoint(config, eventLoopGroup, requestTimer, physicalAddress) - ); - } - - @Override - public Stream list() { - return this.endpoints.values().stream(); - } - - private void deleteEndpoint(final URI physicalAddress) { - - // TODO: DANOBLE: Utilize this method of tearing down unhealthy endpoints - // Specifically, ensure that this method is called when a Read/WriteTimeoutException occurs or a health - // check request fails. This perhaps likely requires a change to RntbdClientChannelPool. - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/331552 - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/331593 - - checkNotNull(physicalAddress, "physicalAddress: %s", physicalAddress); - - final String authority = physicalAddress.getAuthority(); - final RntbdEndpoint endpoint = this.endpoints.remove(authority); - - if (endpoint != null) { - endpoint.close(); - } - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdToken.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdToken.java deleted file mode 100644 index 555d0338a413..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdToken.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.PropertyWriter; -import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdHeader; - -@JsonPropertyOrder({ "id", "name", "type", "present", "required", "value" }) -final class RntbdToken { - - // region Fields - - private static final int HEADER_LENGTH = Short.BYTES + Byte.BYTES; - - static { - RntbdObjectMapper.registerPropertyFilter(RntbdToken.class, RntbdToken.PropertyFilter.class); - } - - private final RntbdHeader header; - private int length; - private Object value; - - // endregion - - private RntbdToken(final RntbdHeader header) { - checkNotNull(header, "header"); - this.header = header; - this.value = null; - this.length = Integer.MIN_VALUE; - } - - @JsonProperty - final short getId() { - return this.header.id(); - } - - // region Accessors - - @JsonProperty - final String getName() { - return this.header.name(); - } - - @JsonProperty - final RntbdTokenType getType() { - return this.header.type(); - } - - @JsonProperty - final Object getValue() { - - if (this.value == null) { - return this.header.type().codec().defaultValue(); - } - - if (this.value instanceof ByteBuf) { - final ByteBuf buffer = (ByteBuf)this.value; - this.value = this.header.type().codec().read(buffer); - buffer.release(); - } else { - this.value = this.header.type().codec().convert(this.value); - } - - return this.value; - } - - @JsonProperty - final void setValue(final Object value) { - this.ensureValid(value); - this.length = Integer.MIN_VALUE; - this.value = value; - } - - @JsonProperty - final boolean isPresent() { - return this.value != null; - } - - @JsonProperty - final boolean isRequired() { - return this.header.isRequired(); - } - - final int computeLength() { - - if (!this.isPresent()) { - return 0; - } - - if (this.value instanceof ByteBuf) { - final ByteBuf buffer = (ByteBuf)this.value; - assert buffer.readerIndex() == 0; - return HEADER_LENGTH + buffer.readableBytes(); - } - - if (this.length == Integer.MIN_VALUE) { - this.length = HEADER_LENGTH + this.header.type().codec().computeLength(this.value); - } - - return this.length; - } - - // endregion - - // region Methods - - static RntbdToken create(final RntbdHeader header) { - return new RntbdToken(header); - } - - void decode(final ByteBuf in) { - - checkNotNull(in, "in"); - - if (this.value instanceof ByteBuf) { - ((ByteBuf)this.value).release(); - } - - this.value = this.header.type().codec().readSlice(in).retain(); // No data transfer until the first call to RntbdToken.getValue - } - - final void encode(final ByteBuf out) { - - checkNotNull(out, "out"); - - if (!this.isPresent()) { - if (this.isRequired()) { - final String message = String.format("Missing value for required header: %s", this); - throw new IllegalStateException(message); - } - return; - } - - out.writeShortLE(this.getId()); - out.writeByte(this.getType().id()); - - if (this.value instanceof ByteBuf) { - out.writeBytes((ByteBuf)this.value); - } else { - this.ensureValid(this.value); - this.header.type().codec().write(this.value, out); - } - } - - final T getValue(final Class cls) { - return cls.cast(this.getValue()); - } - - final void releaseBuffer() { - if (this.value instanceof ByteBuf) { - final ByteBuf buffer = (ByteBuf)this.value; - buffer.release(); - } - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } - - private void ensureValid(final Object value) { - - checkNotNull(value, "value"); - - if (!this.header.type().codec().isValid(value)) { - final String reason = String.format("value: %s", value.getClass()); - throw new IllegalArgumentException(reason); - } - } - - // endregion - - // region Types - - static class PropertyFilter extends SimpleBeanPropertyFilter { - - @Override - public void serializeAsField(final Object object, final JsonGenerator generator, final SerializerProvider provider, final PropertyWriter writer) throws Exception { - - if (generator.canOmitFields()) { - - final Object value = writer.getMember().getValue(object); - - if (value instanceof RntbdToken && !((RntbdToken)value).isPresent()) { - return; - } - } - - writer.serializeAsField(object, generator, provider); - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenStream.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenStream.java deleted file mode 100644 index 6926876ebf54..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenStream.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import io.netty.buffer.ByteBuf; - -import java.util.stream.Collector; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdHeader; - -abstract class RntbdTokenStream & RntbdHeader> { - - final ImmutableMap headers; - final ImmutableMap tokens; - - RntbdTokenStream(final ImmutableSet headers, final ImmutableMap ids) { - - checkNotNull(headers, "headers"); - checkNotNull(ids, "ids"); - - final Collector> collector = Maps.toImmutableEnumMap(h -> h, RntbdToken::create); - this.tokens = headers.stream().collect(collector); - this.headers = ids; - } - - final int computeCount() { - - int count = 0; - - for (final RntbdToken token : this.tokens.values()) { - if (token.isPresent()) { - ++count; - } - } - - return count; - } - - final int computeLength() { - - int total = 0; - - for (final RntbdToken token : this.tokens.values()) { - total += token.computeLength(); - } - - return total; - } - - static > T decode(final ByteBuf in, final T stream) { - - while (in.readableBytes() > 0) { - - final short id = in.readShortLE(); - final RntbdTokenType type = RntbdTokenType.fromId(in.readByte()); - - RntbdToken token = stream.tokens.get(stream.headers.get(id)); - - if (token == null) { - token = RntbdToken.create(new UndefinedHeader(id, type)); - } - - token.decode(in); - } - - for (final RntbdToken token : stream.tokens.values()) { - if (!token.isPresent() && token.isRequired()) { - final String reason = String.format("Required token not found on RNTBD stream: type: %s, identifier: %s", - token.getType(), token.getId()); - throw new IllegalStateException(reason); - } - } - - return stream; - } - - final void encode(final ByteBuf out) { - for (final RntbdToken token : this.tokens.values()) { - token.encode(out); - } - } - - final RntbdToken get(final T header) { - return this.tokens.get(header); - } - - final void releaseBuffers() { - for (final RntbdToken token : this.tokens.values()) { - token.releaseBuffer(); - } - } - - private static final class UndefinedHeader implements RntbdHeader { - - private final short id; - private final RntbdTokenType type; - - UndefinedHeader(final short id, final RntbdTokenType type) { - this.id = id; - this.type = type; - } - - @Override - public boolean isRequired() { - return false; - } - - @Override - public short id() { - return this.id; - } - - @Override - public String name() { - return "Undefined"; - } - - @Override - public RntbdTokenType type() { - return this.type; - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenType.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenType.java deleted file mode 100644 index c6b76693087c..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenType.java +++ /dev/null @@ -1,838 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.google.common.base.Utf8; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.handler.codec.CorruptedFrameException; - -import java.nio.charset.StandardCharsets; -import java.util.UUID; - -enum RntbdTokenType { - - // All values are encoded as little endian byte sequences except for Guid - // Guid values are serialized in Microsoft GUID byte order - // Reference: GUID structure and System.Guid type - - Byte((byte)0x00, RntbdByte.codec), // byte => byte - UShort((byte)0x01, RntbdUnsignedShort.codec), // short => int - ULong((byte)0x02, RntbdUnsignedInteger.codec), // int => long - Long((byte)0x03, RntbdInteger.codec), // int => int - ULongLong((byte)0x04, RntbdLong.codec), // long => long - LongLong((byte)0x05, RntbdLong.codec), // long => long - - Guid((byte)0x06, RntbdGuid.codec), // byte[16] => UUID - SmallString((byte)0x07, RntbdShortString.codec), // (byte, byte[0..255]) => String - String((byte)0x08, RntbdString.codec), // (short, byte[0..64KiB]) => String - ULongString((byte)0x09, RntbdLongString.codec), // (int, byte[0..2GiB-1]) => String - - SmallBytes((byte)0x0A, RntbdShortBytes.codec), // (byte, byte[0..255]) => byte[] - Bytes((byte)0x0B, RntbdBytes.codec), // (short, byte[0..64KiB]) => byte[] - ULongBytes((byte)0x0C, RntbdLongBytes.codec), // (int, byte[0..2GiB-1]) => byte[] - - Float((byte)0x0D, RntbdFloat.codec), // float => float - Double((byte)0x0E, RntbdDouble.codec), // double => double - - Invalid((byte)0xFF, RntbdNone.codec); // no data - - // region Implementation - - private Codec codec; - private byte id; - - RntbdTokenType(final byte id, final Codec codec) { - this.codec = codec; - this.id = id; - } - - public Codec codec() { - return this.codec; - } - - public static RntbdTokenType fromId(final byte value) { - - for (final RntbdTokenType tokenType : RntbdTokenType.values()) { - if (value == tokenType.id) { - return tokenType; - } - } - return Invalid; - } - - public byte id() { - return this.id; - } - - // endregion - - // region Types - - public interface Codec { - - int computeLength(Object value); - - Object convert(Object value); - - Object defaultValue(); - - boolean isValid(Object value); - - Object read(ByteBuf in); - - ByteBuf readSlice(ByteBuf in); - - void write(Object value, ByteBuf out); - } - - private static class RntbdByte implements Codec { - - public static final Codec codec = new RntbdByte(); - - private RntbdByte() { - } - - @Override - public final int computeLength(final Object value) { - return java.lang.Byte.BYTES; - } - - @Override - public final Object convert(final Object value) { - - assert this.isValid(value); - - if (value instanceof Number) { - return ((Number)value).byteValue(); - } - return (boolean)value ? (byte)0x01 : (byte)0x00; - } - - @Override - public final Object defaultValue() { - return (byte)0; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number || value instanceof Boolean; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readByte(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Byte.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeByte(value instanceof Byte ? (byte)value : ((boolean)value ? 0x01 : 0x00)); - } - } - - private static class RntbdBytes implements Codec { - - public static final Codec codec = new RntbdBytes(); - private static final byte[] defaultValue = {}; - - private RntbdBytes() { - } - - @Override - public int computeLength(final Object value) { - assert this.isValid(value); - return Short.BYTES + ((byte[])value).length; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return value; - } - - @Override - public final Object defaultValue() { - return defaultValue; - } - - @Override - public boolean isValid(final Object value) { - return value instanceof byte[] && ((byte[])value).length < 0xFFFF; - } - - @Override - public Object read(final ByteBuf in) { - final int length = in.readUnsignedShortLE(); - return in.readBytes(length); - } - - @Override - public ByteBuf readSlice(final ByteBuf in) { - final int length = in.getUnsignedShortLE(in.readerIndex()); - return in.readSlice(Short.BYTES + length); - } - - @Override - public void write(final Object value, final ByteBuf out) { - - assert this.isValid(value); - - final byte[] bytes = (byte[])value; - final int length = bytes.length; - - if (length > 0xFFFF) { - throw new IllegalStateException(); - } - - out.writeShortLE((short)length); - out.writeBytes(bytes); - } - } - - private static class RntbdDouble implements Codec { - - public static final Codec codec = new RntbdDouble(); - - private RntbdDouble() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return java.lang.Double.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).doubleValue(); - } - - @Override - public final Object defaultValue() { - return 0.0D; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readDoubleLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Double.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeDoubleLE(((Number)value).doubleValue()); - } - } - - private static class RntbdFloat implements Codec { - - public static final Codec codec = new RntbdFloat(); - - private RntbdFloat() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return java.lang.Float.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).floatValue(); - } - - @Override - public final Object defaultValue() { - return 0.0F; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readFloatLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Float.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeFloatLE(((Number)value).floatValue()); - } - } - - private static class RntbdGuid implements Codec { - - public static final Codec codec = new RntbdGuid(); - - private RntbdGuid() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return 2 * java.lang.Long.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return value; - } - - @Override - public final Object defaultValue() { - return RntbdUUID.EMPTY; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof UUID; - } - - @Override - public final Object read(final ByteBuf in) { - return RntbdUUID.decode(in); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(2 * java.lang.Long.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - RntbdUUID.encode((UUID)value, out); - } - } - - private static class RntbdInteger implements Codec { - - public static final Codec codec = new RntbdInteger(); - - private RntbdInteger() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return Integer.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).intValue(); - } - - @Override - public final Object defaultValue() { - return 0; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readIntLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(Integer.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeIntLE(((Number)value).intValue()); - } - } - - private static class RntbdLong implements Codec { - - public static final Codec codec = new RntbdLong(); - - private RntbdLong() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return java.lang.Long.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).longValue(); - } - - @Override - public final Object defaultValue() { - return 0L; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readLongLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Long.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeLongLE(((Number)value).longValue()); - } - } - - private static class RntbdLongBytes extends RntbdBytes { - - public static final Codec codec = new RntbdLongBytes(); - - private RntbdLongBytes() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return Integer.BYTES + ((byte[])value).length; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof byte[] && ((byte[])value).length < 0xFFFF; - } - - @Override - public final Object read(final ByteBuf in) { - - final long length = in.readUnsignedIntLE(); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } - return in.readBytes((int)length); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - - final long length = in.getUnsignedIntLE(in.readerIndex()); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } - return in.readSlice(Integer.BYTES + (int)length); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - - assert this.isValid(value); - - final byte[] bytes = (byte[])value; - out.writeIntLE(bytes.length); - out.writeBytes(bytes); - } - } - - private static class RntbdLongString extends RntbdString { - - public static final Codec codec = new RntbdLongString(); - - private RntbdLongString() { - } - - @Override - public final int computeLength(final Object value) { - return Integer.BYTES + this.computeLength(value, Integer.MAX_VALUE); - } - - @Override - public final Object read(final ByteBuf in) { - - final long length = in.readUnsignedIntLE(); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } - - return in.readCharSequence((int)length, StandardCharsets.UTF_8).toString(); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - - final int length = this.computeLength(value, Integer.MAX_VALUE); - out.writeIntLE(length); - writeValue(out, value, length); - } - } - - private static class RntbdNone implements Codec { - - public static final Codec codec = new RntbdNone(); - - @Override - public final int computeLength(final Object value) { - return 0; - } - - @Override - public final Object convert(final Object value) { - return null; - } - - @Override - public final Object defaultValue() { - return null; - } - - @Override - public final boolean isValid(final Object value) { - return true; - } - - @Override - public final Object read(final ByteBuf in) { - return null; - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return null; - } - - @Override - public final void write(final Object value, final ByteBuf out) { - } - } - - private static class RntbdShortBytes extends RntbdBytes { - - public static final Codec codec = new RntbdShortBytes(); - - private RntbdShortBytes() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return java.lang.Byte.BYTES + ((byte[])value).length; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof byte[] && ((byte[])value).length < 0xFFFF; - } - - @Override - public final Object read(final ByteBuf in) { - - final int length = in.readUnsignedByte(); - final byte[] bytes = new byte[length]; - in.readBytes(bytes); - - return bytes; - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Byte.BYTES + in.getUnsignedByte(in.readerIndex())); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - - assert this.isValid(value); - - final byte[] bytes = (byte[])value; - final int length = bytes.length; - - if (length > 0xFF) { - throw new IllegalStateException(); - } - - out.writeByte((byte)length); - out.writeBytes(bytes); - } - } - - private static class RntbdShortString extends RntbdString { - - public static final Codec codec = new RntbdShortString(); - - private RntbdShortString() { - } - - @Override - public final int computeLength(final Object value) { - return java.lang.Byte.BYTES + this.computeLength(value, 0xFF); - } - - @Override - public final Object read(final ByteBuf in) { - return in.readCharSequence(in.readUnsignedByte(), StandardCharsets.UTF_8).toString(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Byte.BYTES + in.getUnsignedByte(in.readerIndex())); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - - final int length = this.computeLength(value, 0xFF); - out.writeByte(length); - writeValue(out, value, length); - } - } - - private static class RntbdString implements Codec { - - public static final Codec codec = new RntbdString(); - - private RntbdString() { - } - - final int computeLength(final Object value, final int maxLength) { - - assert this.isValid(value); - final int length; - - if (value instanceof String) { - - final String string = (String)value; - length = Utf8.encodedLength(string); - - } else { - - final byte[] string = (byte[])value; - - if (!Utf8.isWellFormed(string)) { - final String reason = java.lang.String.format("UTF-8 byte string is ill-formed: %s", ByteBufUtil.hexDump(string)); - throw new CorruptedFrameException(reason); - } - - length = string.length; - } - - if (length > maxLength) { - final String reason = java.lang.String.format("UTF-8 byte string exceeds %d bytes: %d bytes", maxLength, length); - throw new CorruptedFrameException(reason); - } - - return length; - } - - @Override - public int computeLength(final Object value) { - return Short.BYTES + this.computeLength(value, 0xFFFF); - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return value instanceof String ? value : new String((byte[])value, StandardCharsets.UTF_8); - } - - @Override - public final Object defaultValue() { - return ""; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof String || value instanceof byte[]; - } - - @Override - public Object read(final ByteBuf in) { - final int length = in.readUnsignedShortLE(); - return in.readCharSequence(length, StandardCharsets.UTF_8).toString(); - } - - @Override - public ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(Short.BYTES + in.getUnsignedShortLE(in.readerIndex())); - } - - @Override - public void write(final Object value, final ByteBuf out) { - - final int length = this.computeLength(value, 0xFFFF); - out.writeShortLE(length); - writeValue(out, value, length); - } - - static void writeValue(final ByteBuf out, final Object value, final int length) { - - final int start = out.writerIndex(); - - if (value instanceof String) { - out.writeCharSequence((String)value, StandardCharsets.UTF_8); - } else { - out.writeBytes((byte[])value); - } - - assert out.writerIndex() - start == length; - } - } - - private static class RntbdUnsignedInteger implements Codec { - - public static final Codec codec = new RntbdUnsignedInteger(); - - private RntbdUnsignedInteger() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return Integer.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).longValue() & 0xFFFFFFFFL; - } - - @Override - public final Object defaultValue() { - return 0L; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readUnsignedIntLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(Integer.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeIntLE(((Number)value).intValue()); - } - } - - private static class RntbdUnsignedShort implements Codec { - - public static final Codec codec = new RntbdUnsignedShort(); - - private RntbdUnsignedShort() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return Short.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).intValue() & 0xFFFF; - } - - @Override - public final Object defaultValue() { - return 0; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readUnsignedShortLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(Short.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeShortLE(((Number)value).shortValue()); - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdUUID.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdUUID.java deleted file mode 100644 index 20c9f1233528..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdUUID.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.handler.codec.CorruptedFrameException; - -import java.util.UUID; - -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdUUID { - - public static final UUID EMPTY = new UUID(0L, 0L); - - private RntbdUUID() { - } - - /** - * Decode a {@link UUID} as serialized by Microsoft APIs like {@code System.Guid.ToByteArray} - * - * @param bytes a {@link byte} array containing the serialized {@link UUID} to be decoded - * @return a new {@link UUID} - */ - public static UUID decode(final byte[] bytes) { - return decode(Unpooled.wrappedBuffer(bytes)); - } - - /** - * Decode a {@link UUID} as serialized by Microsoft APIs like {@code System.Guid.ToByteArray} - * - * @param in a {@link ByteBuf} containing the serialized {@link UUID} to be decoded - * @return a new {@link UUID} - */ - public static UUID decode(final ByteBuf in) { - - checkNotNull(in, "in"); - - if (in.readableBytes() < 2 * Long.BYTES) { - final String reason = String.format("invalid frame length: %d", in.readableBytes()); - throw new CorruptedFrameException(reason); - } - - long mostSignificantBits = in.readUnsignedIntLE() << 32; - - mostSignificantBits |= (0x000000000000FFFFL & in.readShortLE()) << 16; - mostSignificantBits |= (0x000000000000FFFFL & in.readShortLE()); - - long leastSignificantBits = (0x000000000000FFFFL & in.readShortLE()) << (32 + 16); - - for (int shift = 32 + 8; shift >= 0; shift -= 8) { - leastSignificantBits |= (0x00000000000000FFL & in.readByte()) << shift; - } - - return new UUID(mostSignificantBits, leastSignificantBits); - } - - /** - * Encodes a {@link UUID} as serialized by Microsoft APIs like {@code System.Guid.ToByteArray} - * - * @param uuid a {@link UUID} to be encoded - * @return a new byte array containing the encoded - */ - public static byte[] encode(final UUID uuid) { - final byte[] bytes = new byte[2 * Integer.BYTES]; - encode(uuid, Unpooled.wrappedBuffer(bytes)); - return bytes; - } - - /** - * Encodes a {@link UUID} as serialized by Microsoft APIs like {@code System.Guid.ToByteArray} - * - * @param uuid a {@link UUID} to be encoded - * @param out an output {@link ByteBuf} - */ - public static void encode(final UUID uuid, final ByteBuf out) { - - final long mostSignificantBits = uuid.getMostSignificantBits(); - - out.writeIntLE((int)((mostSignificantBits & 0xFFFFFFFF00000000L) >>> 32)); - out.writeShortLE((short)((mostSignificantBits & 0x00000000FFFF0000L) >>> 16)); - out.writeShortLE((short)(mostSignificantBits & 0x000000000000FFFFL)); - - final long leastSignificantBits = uuid.getLeastSignificantBits(); - - out.writeShortLE((short)((leastSignificantBits & 0xFFFF000000000000L) >>> (32 + 16))); - out.writeShort((short)((leastSignificantBits & 0x0000FFFF00000000L) >>> 32)); - out.writeInt((int)(leastSignificantBits & 0x00000000FFFFFFFFL)); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Int128.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Int128.java deleted file mode 100644 index c74a4ff99a01..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Int128.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - - -import java.math.BigInteger; - -public class Int128 { - - private final BigInteger value; - - private static final BigInteger MaxBigIntValue = - new BigInteger(new byte[] { - (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, - (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 - }); - - public static final Int128 MaxValue = new Int128( - new BigInteger(new byte[] { - (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, - (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, - }) - ); - - private Int128(BigInteger value) { - this.value = value.remainder(MaxBigIntValue); - } - - public Int128(int n) { - this(BigInteger.valueOf(n)); - } - - public Int128(byte[] data) { - if (data.length != 16) { - throw new IllegalArgumentException("data"); - } - - this.value = new BigInteger(data); - - if (this.value.compareTo(MaxValue.value) > 0) { - throw new IllegalArgumentException(); - } - } - - public static Int128 multiply(Int128 left, Int128 right) { - return new Int128(left.value.multiply(right.value)); - } - - public static Int128 add(Int128 left, Int128 right) { - return new Int128(left.value.add(right.value)); - } - - public static Int128 subtract(Int128 left, Int128 right) { - return new Int128(left.value.subtract(right.value)); - } - - public static Int128 div (Int128 left, Int128 right) { - return new Int128(left.value.divide(right.value)); - } - - public static boolean gt(Int128 left, Int128 right) { - return left.value.compareTo(right.value) > 0; - } - - public static boolean lt(Int128 left, Int128 right) { - return left.value.compareTo(right.value) < 0; - } - - public byte[] bytes() { - byte[] bytes = this.value.toByteArray(); - if (bytes.length < 16) { - byte[] paddedBytes = new byte[16]; - System.arraycopy(bytes, 0, paddedBytes, 0, bytes.length); - return paddedBytes; - } - - return bytes; - } - -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_128.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_128.java deleted file mode 100644 index 06224c795a64..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_128.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -public class MurmurHash3_128 { - - public static UInt128 hash128(byte[] bytes) { - return hash128(bytes, bytes.length, new UInt128(0, 0)); - } - - public static UInt128 hash128(byte[] bytes, int length, UInt128 seed) { - final long c1 = 0x87c37b91114253d5L; - final long c2 = 0x4cf5ad432745937fL; - - long h1 = seed.high; - long h2 = seed.low; - - // body - int position; - for (position = 0; position < length - 15; position += 16) { - long k1 = getLittleEndianLong(bytes, position); - long k2 = getLittleEndianLong(bytes, position + 8); - - // k1, h1 - k1 *= c1; - k1 = rotateLeft64(k1, 31); - k1 *= c2; - - h1 ^= k1; - h1 = rotateLeft64(h1, 27); - h1 += h2; - h1 = h1 * 5 + 0x52dce729; - - // k2, h2 - k2 *= c2; - k2 = rotateLeft64(k2, 33); - k2 *= c1; - - h2 ^= k2; - h2 = rotateLeft64(h2, 31); - h2 += h1; - h2 = h2 * 5 + 0x38495ab5; - } - - - { - // tail - long k1 = 0; - long k2 = 0; - - int n = length & 15; - if (n >= 15) k2 ^= (bytes[position + 14] & 0xffL) << 48; - if (n >= 14) k2 ^= (bytes[position + 13] & 0xffL) << 40; - if (n >= 13) k2 ^= (bytes[position + 12] & 0xffL) << 32; - if (n >= 12) k2 ^= (bytes[position + 11] & 0xffL) << 24; - if (n >= 11) k2 ^= (bytes[position + 10] & 0xffL) << 16; - if (n >= 10) k2 ^= (bytes[position + 9] & 0xffL) << 8; - if (n >= 9) k2 ^= (bytes[position + 8] & 0xffL) << 0; - - k2 *= c2; - k2 = rotateLeft64(k2, 33); - k2 *= c1; - h2 ^= k2; - - if (n >= 8) k1 ^= (bytes[position + 7] & 0xffL) << 56; - if (n >= 7) k1 ^= (bytes[position + 6] & 0xffL) << 48; - if (n >= 6) k1 ^= (bytes[position + 5] & 0xffL) << 40; - if (n >= 5) k1 ^= (bytes[position + 4] & 0xffL) << 32; - if (n >= 4) k1 ^= (bytes[position + 3] & 0xffL) << 24; - if (n >= 3) k1 ^= (bytes[position + 2] & 0xffL) << 16; - if (n >= 2) k1 ^= (bytes[position + 1] & 0xffL) << 8; - if (n >= 1) k1 ^= (bytes[position + 0] & 0xffL) << 0; - - k1 *= c1; - k1 = rotateLeft64(k1, 31); - k1 *= c2; - h1 ^= k1; - } - - // finalization - h1 ^= length; - h2 ^= length; - - h1 += h2; - h2 += h1; - - // h1 - h1 ^= h1 >>> 33; - h1 *= 0xff51afd7ed558ccdL; - h1 ^= h1 >>> 33; - h1 *= 0xc4ceb9fe1a85ec53L; - h1 ^= h1 >>> 33; - - // h2 - h2 ^= h2 >>> 33; - h2 *= 0xff51afd7ed558ccdL; - h2 ^= h2 >>> 33; - h2 *= 0xc4ceb9fe1a85ec53L; - h2 ^= h2 >>> 33; - - h1 += h2; - h2 += h1; - - h1 = Long.reverseBytes(h1); - h2 = Long.reverseBytes(h2); - - return new UInt128(h1, h2); - } - - - private static int rotateLeft32(int n, int numBits) { - assert numBits < 32; - return Integer.rotateLeft(n, numBits); - } - - private static long rotateLeft64(long n, int numBits) { - assert numBits < 64; - return Long.rotateLeft(n, numBits); - } - - private static final long getLittleEndianLong(byte[] bytes, int offset) { - return ((long) bytes[offset + 7] << 56) // no mask needed - | ((bytes[offset + 6] & 0xffL) << 48) - | ((bytes[offset + 5] & 0xffL) << 40) - | ((bytes[offset + 4] & 0xffL) << 32) - | ((bytes[offset + 3] & 0xffL) << 24) - | ((bytes[offset + 2] & 0xffL) << 16) - | ((bytes[offset + 1] & 0xffL) << 8) - | ((bytes[offset] & 0xffL)); - } - - private static int intAsLittleIndian(byte[] bytes, int i) { - return (bytes[i] & 0xff) | ((bytes[i + 1] & 0xff) << 8) | ((bytes[i + 2] & 0xff) << 16) | (bytes[i + 3] << 24); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_32.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_32.java deleted file mode 100644 index e92cb2e41187..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_32.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -/* - * The MurmurHash3 algorithm was created by Austin Appleby and placed in the public domain. - * This java port was authored by Yonik Seeley and also placed into the public domain. - * The author hereby disclaims copyright to this source code. - *

- * This produces exactly the same hash values as the final C++ - * version of MurmurHash3 and is thus suitable for producing the same hash values across - * platforms. - *

- * The 32 bit x86 version of this hash should be the fastest variant for relatively short keys like ids. - * See http://github.com/yonik/java_util for future updates to this file. - */ -public class MurmurHash3_32 { - /** - * Returns the MurmurHash3_x86_32 hash. - * - * @param data a byte array containing the data to be hashed - * @param len an integer indicating the length of data - * @param seed an integer to be used as hash seed - * @return the hash value - */ - public static int hash(byte[] data, int len, int seed) { - final int c1 = 0xcc9e2d51; - final int c2 = 0x1b873593; - - int h1 = seed; - int roundedEnd = (len & 0xfffffffc); // round down to 4 byte block - - for (int i = 0; i < roundedEnd; i += 4) { - // little endian load order - int k1 = (data[i] & 0xff) | ((data[i + 1] & 0xff) << 8) | ((data[i + 2] & 0xff) << 16) | (data[i + 3] << 24); - k1 *= c1; - k1 = (k1 << 15) | (k1 >>> 17); // ROTL32(k1,15); - k1 *= c2; - - h1 ^= k1; - h1 = (h1 << 13) | (h1 >>> 19); // ROTL32(h1,13); - h1 = h1 * 5 + 0xe6546b64; - } - - // tail - int k1 = 0; - - switch (len & 0x03) { - case 3: - k1 = (data[roundedEnd + 2] & 0xff) << 16; - // fallthrough - case 2: - k1 |= (data[roundedEnd + 1] & 0xff) << 8; - // fallthrough - case 1: - k1 |= (data[roundedEnd] & 0xff); - k1 *= c1; - k1 = (k1 << 15) | (k1 >>> 17); // ROTL32(k1,15); - k1 *= c2; - h1 ^= k1; - } - - // finalization - h1 ^= len; - - // fmix(h1); - h1 ^= h1 >>> 16; - h1 *= 0x85ebca6b; - h1 ^= h1 >>> 13; - h1 *= 0xc2b2ae35; - h1 ^= h1 >>> 16; - - return h1; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalHelper.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalHelper.java deleted file mode 100644 index 316f6e87dc35..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalHelper.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import com.microsoft.azure.cosmosdb.CommonsBridgeInternal; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKind; -import com.microsoft.azure.cosmosdb.internal.Bytes; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.List; - -public class PartitionKeyInternalHelper { - - public static final String MinimumInclusiveEffectivePartitionKey = PartitionKeyInternalHelper.toHexEncodedBinaryString(PartitionKeyInternal.EmptyPartitionKey.components); - public static final String MaximumExclusiveEffectivePartitionKey = PartitionKeyInternalHelper.toHexEncodedBinaryString(PartitionKeyInternal.InfinityPartitionKey.components); - - static final int MaxPartitionKeyBinarySize = - (1 /*type marker */ + - 9 /* hash value*/ + - 1 /* type marker*/ + StringPartitionKeyComponent.MAX_STRING_BYTES_TO_APPEND + - 1 /*trailing zero*/ - ) * 3; - private static final Int128 MaxHashV2Value = new Int128(new byte[] { - (byte) 0x3F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, - (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF}); - - static byte[] uIntToBytes(UInt128 unit) { - ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES * 2); - buffer.putLong(unit.low); - buffer.putLong(unit.high); - return buffer.array(); - } - - static long asUnsignedLong(int x) { - return x & 0x00000000ffffffffL; - } - - static byte[] longToBytes(long x) { - ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); - buffer.putLong(x); - return buffer.array(); - } - - static String toHexEncodedBinaryString(IPartitionKeyComponent... components) { - ByteArrayOutputStream stream = new ByteArrayOutputStream(MaxPartitionKeyBinarySize); - for (IPartitionKeyComponent component: components) { - component.WriteForBinaryEncoding(stream); - } - - return HexConvert.bytesToHex(stream.toByteArray()); - } - - static String toHexEncodedBinaryString(List components) { - ByteArrayOutputStream stream = new ByteArrayOutputStream(MaxPartitionKeyBinarySize); - for (IPartitionKeyComponent component: components) { - component.WriteForBinaryEncoding(stream); - } - - return HexConvert.bytesToHex(stream.toByteArray()); - } - - static public String getEffectivePartitionKeyForHashPartitioningV2(PartitionKeyInternal partitionKeyInternal) { - try(ByteArrayOutputStream byteArrayBuffer = new ByteArrayOutputStream()) { - for (int i = 0; i < partitionKeyInternal.components.size(); i++) { - partitionKeyInternal.components.get(i).WriteForHashingV2(byteArrayBuffer); - } - - byte[] bytes = byteArrayBuffer.toByteArray(); - UInt128 hashAsUnit128 = MurmurHash3_128.hash128(bytes); - - byte[] hash = uIntToBytes(hashAsUnit128); - Bytes.reverse(hash); - - // Reset 2 most significant bits, as max exclusive value is 'FF'. - // Plus one more just in case. - hash[0] &= 0x3F; - - return HexConvert.bytesToHex(hash); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - } - - static String getEffectivePartitionKeyForHashPartitioning(PartitionKeyInternal partitionKeyInternal) { - IPartitionKeyComponent[] truncatedComponents = new IPartitionKeyComponent[partitionKeyInternal.components.size()]; - - for (int i = 0; i < truncatedComponents.length; i++) { - truncatedComponents[i] = partitionKeyInternal.components.get(i).Truncate(); - } - - double hash; - try(ByteArrayOutputStream byteArrayBuffer = new ByteArrayOutputStream()) { - for (int i = 0; i < truncatedComponents.length; i++) { - truncatedComponents[i].WriteForHashing(byteArrayBuffer); - } - - byte[] bytes = byteArrayBuffer.toByteArray(); - int hashAsInt = MurmurHash3_32.hash(bytes, bytes.length, 0); - hash = (double) asUnsignedLong(hashAsInt); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - - IPartitionKeyComponent[] partitionKeyComponents = new IPartitionKeyComponent[partitionKeyInternal.components.size() + 1]; - partitionKeyComponents[0] = new NumberPartitionKeyComponent(hash); - for (int i = 0; i < truncatedComponents.length; i++) { - partitionKeyComponents[i + 1] = truncatedComponents[i]; - } - - return toHexEncodedBinaryString(partitionKeyComponents); - } - - public static String getEffectivePartitionKeyString(PartitionKeyInternal partitionKeyInternal, PartitionKeyDefinition partitionKeyDefinition) { - return getEffectivePartitionKeyString(partitionKeyInternal, partitionKeyDefinition, true); - } - - public static String getEffectivePartitionKeyString(PartitionKeyInternal partitionKeyInternal, PartitionKeyDefinition partitionKeyDefinition, boolean strict) { - if (partitionKeyInternal.equals(PartitionKeyInternal.EmptyPartitionKey)) { - return MinimumInclusiveEffectivePartitionKey; - } - - if (partitionKeyInternal.equals(PartitionKeyInternal.InfinityPartitionKey)) { - return MaximumExclusiveEffectivePartitionKey; - } - - if (partitionKeyInternal.components.size() < partitionKeyDefinition.getPaths().size()) { - throw new IllegalArgumentException(RMResources.TooFewPartitionKeyComponents); - } - - if (partitionKeyInternal.components.size() > partitionKeyDefinition.getPaths().size() && strict) { - throw new IllegalArgumentException(RMResources.TooManyPartitionKeyComponents); - } - - PartitionKind kind = partitionKeyDefinition.getKind(); - if (kind == null) { - kind = PartitionKind.Hash; - } - - switch (kind) { - case Hash: - if (CommonsBridgeInternal.isV2(partitionKeyDefinition)) { - // V2 - return getEffectivePartitionKeyForHashPartitioningV2(partitionKeyInternal); - } else { - // V1 - return getEffectivePartitionKeyForHashPartitioning(partitionKeyInternal); - } - - default: - return toHexEncodedBinaryString(partitionKeyInternal.components); - } - } - - static class HexConvert { - final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); - - public static String bytesToHex(byte[] bytes) { - char[] hexChars = new char[bytes.length * 2]; - for (int j = 0; j < bytes.length; j++) { - int v = bytes[j] & 0xFF; - hexChars[j * 2] = hexArray[v >>> 4]; - hexChars[j * 2 + 1] = hexArray[v & 0x0F]; - } - return new String(hexChars); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UInt128.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UInt128.java deleted file mode 100644 index 4241b78cd705..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UInt128.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -class UInt128 { - long low; - long high; - - UInt128(long x, long y) { - this.low = x; - this.high = y; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/PartitionKeyHashingTests.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/PartitionKeyHashingTests.java deleted file mode 100644 index 72b83febf422..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/PartitionKeyHashingTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.microsoft.azure.cosmosdb; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.testng.annotations.Test; - -import com.fasterxml.jackson.databind.node.NullNode; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -public class PartitionKeyHashingTests { - - @Test(groups = "unit") - public void effectivePartitionKeyHashV1() { - HashMap keyToEffectivePartitionKeyString = new HashMap() {{ - put("", "05C1CF33970FF80800"); - put("partitionKey", "05C1E1B3D9CD2608716273756A756A706F4C667A00"); - put(new String(new char[1024]).replace("\0", "a"), "05C1EB5921F706086262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626200"); - put(null, "05C1ED45D7475601"); - put(NullNode.getInstance(), "05C1ED45D7475601"); - put(Undefined.Value(), "05C1D529E345DC00"); - put(true, "05C1D7C5A903D803"); - put(false, "05C1DB857D857C02"); - put(Byte.MIN_VALUE, "05C1D73349F54C053FA0"); - put(Byte.MAX_VALUE, "05C1DD539DDFCC05C05FE0"); - put(Long.MIN_VALUE, "05C1DB35F33D1C053C20"); - put(Long.MAX_VALUE, "05C1B799AB2DD005C3E0"); - put(Integer.MIN_VALUE, "05C1DFBF252BCC053E20"); - put(Integer.MAX_VALUE, "05C1E1F503DFB205C1DFFFFFFFFC"); - put(Double.MIN_VALUE, "05C1E5C91F4D3005800101010101010102"); - put(Double.MAX_VALUE, "05C1CBE367C53005FFEFFFFFFFFFFFFFFE"); - }}; - - for (Map.Entry entry : keyToEffectivePartitionKeyString.entrySet()) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - partitionKeyDef.setKind(PartitionKind.Hash); - partitionKeyDef.setPaths(Arrays.asList(new String[]{"\\id"})); - String actualEffectiveKeyString = PartitionKeyInternalHelper.getEffectivePartitionKeyString(new PartitionKey(entry.getKey()).getInternalPartitionKey(),partitionKeyDef, true); - assertThat(entry.getValue()).isEqualTo(actualEffectiveKeyString); - } - } - - @Test(groups = "unit") - public void effectivePartitionKeyHashV2() { - HashMap keyToEffectivePartitionKeyString = new HashMap() {{ - put("", "32E9366E637A71B4E710384B2F4970A0"); - put("partitionKey", "013AEFCF77FA271571CF665A58C933F1"); - put(new String(new char[1024]).replace("\0", "a"), "332BDF5512AE49615F32C7D98C2DB86C"); - put(null, "378867E4430E67857ACE5C908374FE16"); - put(NullNode.getInstance(), "378867E4430E67857ACE5C908374FE16"); - put(Undefined.Value(), "11622DAA78F835834610ABE56EFF5CB5"); - put(true, "0E711127C5B5A8E4726AC6DD306A3E59"); - put(false, "2FE1BE91E90A3439635E0E9E37361EF2"); - put(Byte.MIN_VALUE, "01DAEDABF913540367FE219B2AD06148"); - put(Byte.MAX_VALUE, "0C507ACAC853ECA7977BF4CEFB562A25"); - put(Long.MIN_VALUE, "23D5C6395512BDFEAFADAD15328AD2BB"); - put(Long.MAX_VALUE, "2EDB959178DFCCA18983F89384D1629B"); - put(Integer.MIN_VALUE, "0B1660D5233C3171725B30D4A5F4CC1F"); - put(Integer.MAX_VALUE, "2D9349D64712AEB5EB1406E2F0BE2725"); - put(Double.MIN_VALUE, "0E6CBA63A280927DE485DEF865800139"); - put(Double.MAX_VALUE, "31424D996457102634591FF245DBCC4D"); - }}; - - for (Map.Entry entry : keyToEffectivePartitionKeyString.entrySet()) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - partitionKeyDef.setKind(PartitionKind.Hash); - partitionKeyDef.setVersion(PartitionKeyDefinitionVersion.V2); - partitionKeyDef.setPaths(Arrays.asList(new String[]{"\\id"})); - String actualEffectiveKeyString = PartitionKeyInternalHelper.getEffectivePartitionKeyString(new PartitionKey(entry.getKey()).getInternalPartitionKey(),partitionKeyDef, true); - assertThat(entry.getValue()).isEqualTo(actualEffectiveKeyString); - } - } - - @Test(groups = "unit") - public void hashV2PartitionKeyDeserialization() { - String partitionKeyDefinitionStr = "{\"paths\":[\"/pk\"],\"kind\":\"Hash\",\"version\":2}"; - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(partitionKeyDefinitionStr); - assertThat(partitionKeyDef.getVersion()).isEqualTo(PartitionKeyDefinitionVersion.V2); - assertThat(partitionKeyDef.getKind()).isEqualTo(PartitionKind.Hash); - assertThat(partitionKeyDef.getPaths().toArray()[0]).isEqualTo("/pk"); - } - - @Test(groups = "unit") - public void hashV1PartitionKeyDeserialization() { - String partitionKeyDefinitionStr = "{\"paths\":[\"/pk\"],\"kind\":\"Hash\"}"; - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(partitionKeyDefinitionStr); - assertThat(partitionKeyDef.getVersion()).isNull(); - assertThat(partitionKeyDef.getKind()).isEqualTo(PartitionKind.Hash); - assertThat(partitionKeyDef.getPaths().toArray()[0]).isEqualTo("/pk"); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolverTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolverTest.java deleted file mode 100644 index 4c1fadafdeca..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolverTest.java +++ /dev/null @@ -1,1008 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.IServerIdentity; -import com.microsoft.azure.cosmosdb.internal.routing.InMemoryCollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.ICollectionRoutingMapCache; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import org.apache.commons.lang3.NotImplementedException; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.mutable.MutableObject; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Single; -import rx.functions.Func1; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.fail; - -/** - * Tests that partition manager correctly resolves addresses for requests and does appropriate number of cache refreshes. - */ -public class AddressResolverTest { - - private static final Logger logger = LoggerFactory.getLogger(AddressResolverTest.class); - private static final String DOCUMENT_TEST_URL = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/"; - private AddressResolver addressResolver; - private RxCollectionCache collectionCache; - private ICollectionRoutingMapCache collectionRoutingMapCache; - private IAddressCache fabricAddressCache; - - private int collectionCacheRefreshedCount; - private Map routingMapRefreshCount; - private Map addressesRefreshCount; - - @BeforeClass(groups = "unit") - public void setup() throws Exception { - this.addressResolver = new AddressResolver(); - this.collectionCache = Mockito.mock(RxCollectionCache.class); - this.collectionRoutingMapCache = Mockito.mock(ICollectionRoutingMapCache.class); - this.fabricAddressCache = Mockito.mock(IAddressCache.class); - this.addressResolver.initializeCaches(this.collectionCache, this.collectionRoutingMapCache, this.fabricAddressCache); - - this.collection1 = new DocumentCollection(); - this.collection1.setId("coll"); - this.collection1.setResourceId("rid1"); - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - partitionKeyDef.setPaths(ImmutableList.of("/field1")); - this.collection1.setPartitionKey(partitionKeyDef); - - this.collection2 = new DocumentCollection(); - this.collection2.setId("coll"); - this.collection2.setResourceId("rid2"); - new PartitionKeyDefinition(); - partitionKeyDef.setPaths(ImmutableList.of("/field1")); - this.collection2.setPartitionKey(partitionKeyDef); - - Func1>, Void> addPartitionKeyRangeFunc = listArg -> { - listArg.forEach(tuple -> ((ServiceIdentity) tuple.right).partitionKeyRangeIds.add(new PartitionKeyRangeIdentity(collection1.getResourceId(), tuple.left.getId()))); - return null; - }; - - List> rangesBeforeSplit1 = - new ArrayList<>(); - ServiceIdentity serverServiceIdentity = new ServiceIdentity("federation1", new URI("fabric://serverservice1"), false); - - rangesBeforeSplit1.add( - ImmutablePair.of(new PartitionKeyRange("0", PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, - PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey), serverServiceIdentity)); - - addPartitionKeyRangeFunc.call(rangesBeforeSplit1); - - - this.routingMapCollection1BeforeSplit = - InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap( - rangesBeforeSplit1, - collection1.getResourceId()); - - List> rangesAfterSplit1 = - new ArrayList<>(); - ServiceIdentity serverServiceIdentity2 = new ServiceIdentity("federation1", new URI("fabric://serverservice2"), false); - ServiceIdentity serverServiceIdentity3 = new ServiceIdentity("federation1", new URI("fabric://serverservice3"), false); - - rangesAfterSplit1.add( - ImmutablePair.of( - new PartitionKeyRange("1", PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, "5E", ImmutableList.of("0")), - serverServiceIdentity2)); - - rangesAfterSplit1.add( - ImmutablePair.of( - new PartitionKeyRange("2", "5E", PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey, ImmutableList.of("0")), - serverServiceIdentity3)); - - addPartitionKeyRangeFunc.call(rangesAfterSplit1); - - this.routingMapCollection1AfterSplit = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(rangesAfterSplit1, collection1.getResourceId()); - - List> rangesBeforeSplit2 = - new ArrayList<>(); - ServiceIdentity serverServiceIdentity4 = new ServiceIdentity("federation1", new URI("fabric://serverservice4"), false); - - rangesBeforeSplit2.add( - ImmutablePair.of( - new PartitionKeyRange("0", PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey), - serverServiceIdentity4)); - - addPartitionKeyRangeFunc.call(rangesBeforeSplit2); - - - this.routingMapCollection2BeforeSplit = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(rangesBeforeSplit2, collection2.getResourceId()); - - List> rangesAfterSplit2 = - new ArrayList<>(); - - ServiceIdentity serverServiceIdentity5 = new ServiceIdentity("federation1", new URI("fabric://serverservice5"), false); - ServiceIdentity serverServiceIdentity6 = new ServiceIdentity("federation1", new URI("fabric://serverservice6"), false); - rangesAfterSplit2.add( - ImmutablePair.of( - new PartitionKeyRange("1", PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, "5E", ImmutableList.of("0")), - serverServiceIdentity5)); - - rangesAfterSplit2.add( - ImmutablePair.of( - new PartitionKeyRange("2", "5E", PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey, ImmutableList.of("0")), - serverServiceIdentity6)); - - - addPartitionKeyRangeFunc.call(rangesAfterSplit2); - - - this.routingMapCollection2AfterSplit = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(rangesAfterSplit2, collection2.getResourceId()); - } - - private void TestCacheRefreshWhileRouteByPartitionKey( - DocumentCollection collectionBeforeRefresh, - DocumentCollection collectionAfterRefresh, - Map routingMapBeforeRefresh, - Map routingMapAfterRefresh, - Map addressesBeforeRefresh, - Map addressesAfterRefresh, - AddressInformation[] targetAddresses, - ServiceIdentity targetServiceIdentity, - PartitionKeyRange targetPartitionKeyRange, - boolean forceNameCacheRefresh, - boolean forceRoutingMapRefresh, - boolean forceAddressRefresh, - int collectionCacheRefreshed, - int routingMapCacheRefreshed, - int addressCacheRefreshed, - boolean nameBased) throws Exception { - - if (targetServiceIdentity != null && targetPartitionKeyRange != null) { - targetServiceIdentity.partitionKeyRangeIds.add(new PartitionKeyRangeIdentity(collectionAfterRefresh != null ? collectionAfterRefresh.getResourceId() : collectionBeforeRefresh.getResourceId(), targetPartitionKeyRange.getId())); - } - - this.initializeMocks( - collectionBeforeRefresh, - collectionAfterRefresh, - routingMapBeforeRefresh, - routingMapAfterRefresh, - addressesBeforeRefresh, - addressesAfterRefresh); - - RxDocumentServiceRequest request; - if (nameBased) { - request = RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.Document, - "dbs/db/colls/coll/docs/doc1", - new HashMap<>()); - } else { - request = RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.Document, - DOCUMENT_TEST_URL, - new HashMap<>()); - } - - request.forceNameCacheRefresh = forceNameCacheRefresh; - request.forcePartitionKeyRangeRefresh = forceRoutingMapRefresh; - request.getHeaders().put(HttpConstants.HttpHeaders.PARTITION_KEY, new PartitionKey("foo").toString()); - AddressInformation[] resolvedAddresses = null; - try { - resolvedAddresses = this.addressResolver.resolveAsync(request, forceAddressRefresh).toBlocking().value(); - } catch (RuntimeException e) { - throw (Exception) e.getCause(); - } finally { - assertThat(collectionCacheRefreshed).isEqualTo(collectionCacheRefreshedCount).describedAs("collection cache refresh count mismath"); - - assertThat(routingMapCacheRefreshed).isEqualTo(routingMapRefreshCount.values().stream().mapToInt(v -> v).sum()).describedAs("routing map cache refresh count mismath"); - assertThat(addressCacheRefreshed).isEqualTo(addressesRefreshCount.values().stream().mapToInt(v -> v).sum()).describedAs("address cache refresh count mismatch"); - assertThat(routingMapRefreshCount.entrySet().stream().filter(pair -> pair.getValue() > 1).count()).isEqualTo(0); - assertThat(addressesRefreshCount.entrySet().stream().filter(pair -> pair.getValue() > 1).count()).isEqualTo(0); - } - - assertThat(targetAddresses[0].getPhysicalUri()).isEqualTo(resolvedAddresses[0].getPhysicalUri()); - // Assert.AreEqual(targetServiceIdentity, request.requestContext.TargetIdentity); - assertThat(targetPartitionKeyRange.getId()).isEqualTo(request.requestContext.resolvedPartitionKeyRange.getId()); - } - - private void TestCacheRefreshWhileRouteByPartitionKeyRangeId( - DocumentCollection collectionBeforeRefresh, - DocumentCollection collectionAfterRefresh, - Map routingMapBeforeRefresh, - Map routingMapAfterRefresh, - Map addressesBeforeRefresh, - Map addressesAfterRefresh, - PartitionKeyRangeIdentity rangeIdentity, - AddressInformation[] targetAddresses, - ServiceIdentity targetServiceIdentity, - PartitionKeyRange targetPartitionKeyRange, - boolean forceNameCacheRefresh, - boolean forceRoutingMapRefresh, - boolean forceAddressRefresh, - int collectionCacheRefreshed, - int routingMapCacheRefreshed, - int addressCacheRefreshed, - boolean nameBased) throws Exception { - - if (targetServiceIdentity != null && targetPartitionKeyRange != null) { - targetServiceIdentity.partitionKeyRangeIds.add(new PartitionKeyRangeIdentity(collectionAfterRefresh != null ? collectionAfterRefresh.getResourceId() : collectionBeforeRefresh.getResourceId(), targetPartitionKeyRange.getId())); - } - - this.initializeMocks( - collectionBeforeRefresh, - collectionAfterRefresh, - routingMapBeforeRefresh, - routingMapAfterRefresh, - addressesBeforeRefresh, - addressesAfterRefresh); - - RxDocumentServiceRequest request; - if (nameBased) { - request = RxDocumentServiceRequest.createFromName( - OperationType.Read, - "dbs/db/colls/coll/docs/doc1", - ResourceType.Document); - } else { - request = RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.Document, - DOCUMENT_TEST_URL, - new HashMap<>()); - } - - request.forceNameCacheRefresh = forceNameCacheRefresh; - request.forcePartitionKeyRangeRefresh = forceRoutingMapRefresh; - request.routeTo(rangeIdentity); - AddressInformation[] resolvedAddresses; - try { - resolvedAddresses = this.addressResolver.resolveAsync(request, forceAddressRefresh).toBlocking().value(); - } catch (RuntimeException e) { - e.printStackTrace(); - throw (Exception) e.getCause(); - } finally { - assertThat(collectionCacheRefreshed).isEqualTo(collectionCacheRefreshedCount).describedAs("collection cache refresh count mismath"); - - assertThat(routingMapCacheRefreshed).isEqualTo(routingMapRefreshCount.values().stream().mapToInt(v -> v).sum()).describedAs("routing map cache refresh count mismath"); - assertThat(addressCacheRefreshed).isEqualTo(addressesRefreshCount.values().stream().mapToInt(v -> v).sum()).describedAs("address cache refresh count mismatch"); - - - assertThat(routingMapRefreshCount.entrySet().stream().filter(pair -> pair.getValue() > 1).count()).isEqualTo(0); - assertThat(addressesRefreshCount.entrySet().stream().filter(pair -> pair.getValue() > 1).count()).isEqualTo(0); - } - - assertThat(targetAddresses[0].getPhysicalUri()).isEqualTo(resolvedAddresses[0].getPhysicalUri()); - // Assert.AreEqual(targetServiceIdentity, request.requestContext.TargetIdentity); - assertThat(targetPartitionKeyRange.getId()).isEqualTo(request.requestContext.resolvedPartitionKeyRange.getId()); - } - - private void initializeMocks( - DocumentCollection collectionBeforeRefresh, - DocumentCollection collectionAfterRefresh, - Map routingMapBeforeRefresh, - Map routingMapAfterRefreshInitial, - Map addressesBeforeRefresh, - Map addressesAfterRefreshInitial) { - final Map routingMapAfterRefresh = ObjectUtils.defaultIfNull(routingMapAfterRefreshInitial, routingMapBeforeRefresh); - final Map addressesAfterRefresh = ObjectUtils.defaultIfNull(addressesAfterRefreshInitial, addressesBeforeRefresh); - - // Collection cache - MutableObject currentCollection = new MutableObject(collectionBeforeRefresh); - this.collectionCacheRefreshedCount = 0; - - Mockito.doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - RxDocumentServiceRequest request = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - if (request.forceNameCacheRefresh && collectionAfterRefresh != null) { - currentCollection.setValue(collectionAfterRefresh); - AddressResolverTest.this.collectionCacheRefreshedCount++; - request.forceNameCacheRefresh = false; - return Single.just(currentCollection.getValue()); - } - - if (request.forceNameCacheRefresh && collectionAfterRefresh == null) { - currentCollection.setValue(null); - AddressResolverTest.this.collectionCacheRefreshedCount++; - request.forceNameCacheRefresh = false; - return Single.error(new NotFoundException()); - } - - if (!request.forceNameCacheRefresh && currentCollection.getValue() == null) { - return Single.error(new NotFoundException()); - - } - - if (!request.forceNameCacheRefresh && currentCollection.getValue() != null) { - return Single.just(currentCollection.getValue()); - } - - return null; - } - }).when(this.collectionCache).resolveCollectionAsync(Mockito.any(RxDocumentServiceRequest.class)); - - // Routing map cache - Map currentRoutingMap = - new HashMap<>(routingMapBeforeRefresh); - this.routingMapRefreshCount = new HashMap<>(); - - Mockito.doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - String collectionRid = invocationOnMock.getArgumentAt(0, String.class); - CollectionRoutingMap previousValue = invocationOnMock.getArgumentAt(1, CollectionRoutingMap.class); - - return collectionRoutingMapCache.tryLookupAsync(collectionRid, previousValue, false, null); - } - }).when(this.collectionRoutingMapCache).tryLookupAsync(Mockito.anyString(), Mockito.any(CollectionRoutingMap.class), Mockito.anyMap()); - - // Refresh case - Mockito.doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - String collectionRid = invocationOnMock.getArgumentAt(0, String.class); - CollectionRoutingMap previousValue = invocationOnMock.getArgumentAt(1, CollectionRoutingMap.class); - - if (previousValue == null) { - return Single.just(currentRoutingMap.containsKey(collectionRid) ? currentRoutingMap.get(collectionRid) : null); - } - - if (previousValue != null && currentRoutingMap.containsKey(previousValue.getCollectionUniqueId()) && - currentRoutingMap.get(previousValue.getCollectionUniqueId()) == previousValue) { - - - if (previousValue != null && previousValue.getCollectionUniqueId() != collectionRid) { - throw new RuntimeException("InvalidOperation"); - } - - if (routingMapAfterRefresh.containsKey(collectionRid)) { - currentRoutingMap.put(collectionRid, routingMapAfterRefresh.get(collectionRid)); - } else { - currentRoutingMap.remove(collectionRid); - } - - if (!routingMapRefreshCount.containsKey(collectionRid)) { - routingMapRefreshCount.put(collectionRid, 1); - } else { - routingMapRefreshCount.put(collectionRid, routingMapRefreshCount.get(collectionRid) + 1); - } - - - return Single.just(currentRoutingMap.containsKey(collectionRid) ? currentRoutingMap.get(collectionRid) : null); - } - - return Single.error(new NotImplementedException("not mocked")); - } - }).when(this.collectionRoutingMapCache).tryLookupAsync(Mockito.anyString(), Mockito.any(CollectionRoutingMap.class), Mockito.anyBoolean(), Mockito.anyMap()); - - - // Fabric Address Cache - Map currentAddresses = - new HashMap<>(addressesBeforeRefresh); - this.addressesRefreshCount = new HashMap<>(); - - // No refresh case - Mockito.doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Exception { - RxDocumentServiceRequest request = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - PartitionKeyRangeIdentity pkri = invocationOnMock.getArgumentAt(1, PartitionKeyRangeIdentity.class); - Boolean forceRefresh = invocationOnMock.getArgumentAt(2, Boolean.class); - - if (!forceRefresh) { - return Single.just(currentAddresses.get(findMatchingServiceIdentity(currentAddresses, pkri))); - } else { - - ServiceIdentity si; - - if ((si = findMatchingServiceIdentity(addressesAfterRefresh, pkri)) != null) { - currentAddresses.put(si, addressesAfterRefresh.get(si)); - } else { - - si = findMatchingServiceIdentity(currentAddresses, pkri); - currentAddresses.remove(si); - } - - if (si == null) { - si = ServiceIdentity.dummyInstance; - } - - if (!addressesRefreshCount.containsKey(si)) { - addressesRefreshCount.put(si, 1); - } else { - addressesRefreshCount.put(si, addressesRefreshCount.get(si) + 1); - } - - - // TODO: what to return in this case if it is null!! - return Single.just(currentAddresses.containsKey(si) ? currentAddresses.get(si) : null); - } - } - // - }).when(fabricAddressCache).tryGetAddresses(Mockito.any(RxDocumentServiceRequest.class), Mockito.any(PartitionKeyRangeIdentity.class), Mockito.anyBoolean()); - } - - private static ServiceIdentity findMatchingServiceIdentity(Map map, PartitionKeyRangeIdentity pkri) { - for (ServiceIdentity si : map.keySet()) { - if (si.partitionKeyRangeIds.contains(pkri)) { - return si; - } - - } - return null; - } - - private final AddressInformation[] addresses1 = {new AddressInformation(true, true, "tcp://host/partition1", Protocol.Https)}; - private final AddressInformation[] addresses2 = {new AddressInformation(true, true, "tcp://host/partition2", Protocol.Https)}; - private final AddressInformation[] addresses3 = {new AddressInformation(true, true, "tcp://host/partition3", Protocol.Https)}; - - private DocumentCollection collection1; - private DocumentCollection collection2; - private CollectionRoutingMap routingMapCollection1BeforeSplit; - private CollectionRoutingMap routingMapCollection1AfterSplit; - private CollectionRoutingMap routingMapCollection2BeforeSplit; - private CollectionRoutingMap routingMapCollection2AfterSplit; - - @Test(groups = "unit") - public void testCacheRefreshesWhileRoutingByPartitionKey() throws Exception { - logger.info("All caches are up to date. Name Based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 0, - 0, - 0, - true); - - logger.info("All caches are up to date. Rid Based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 0, - 0, - 0, - true); - - logger.info("Address cache is stale. Force Refresh. Name Based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses2), - this.addresses2, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - this.routingMapCollection1BeforeSplit.getOrderedPartitionKeyRanges().get(0), - false, - false, - true, - 0, - 0, - 1, - true); - - logger.info("Address cache is stale. Force Refresh. Rid Based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses2), - this.addresses2, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - true, - 0, - 0, - 1, - false); - - logger.info("Routing map cache is stale. Force Refresh. Name based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - ImmutableMap.of( - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses2, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 1), this.addresses3), - null, - this.addresses2, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - true, - false, - 0, - 1, - 0, - true); - - logger.info("Routing map cache is stale. Force Refresh. Rid based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - ImmutableMap.of( - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses2, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 1), this.addresses3), - null, - this.addresses2, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - true, - false, - 0, - 1, - 0, - false); - - logger.info("Name cache is stale. Force Refresh. Name based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection2, - ImmutableMap.of(this.collection2.getResourceId(), this.routingMapCollection2BeforeSplit), - null, - ImmutableMap.of( - getServiceIdentityAt(this.routingMapCollection2BeforeSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection2BeforeSplit, 0), - getRangeAt(this.routingMapCollection2BeforeSplit, 0), - true, - false, - false, - 1, - 0, - 0, - true); - - logger.info("Name cache is stale (collection deleted new one created same name). Routing Map Cache returns null"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection2, - ImmutableMap.of(this.collection2.getResourceId(), this.routingMapCollection2BeforeSplit), - null, - ImmutableMap.of( - getServiceIdentityAt(this.routingMapCollection2BeforeSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection2BeforeSplit, 0), - getRangeAt(this.routingMapCollection2BeforeSplit, 0), - false, - false, - false, - 1, - 0, - 0, - true); - - logger.info("Routing map cache is stale (split happened). Address Cache returns null"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 1, - 1, - 0, - true); - - - logger.info("Collection cache is stale (deleted created same name). Routing map cache is stale for new collection (split happened). Address Cache returns null"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection2, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit, - this.collection2.getResourceId(), this.routingMapCollection2BeforeSplit), - ImmutableMap.of(this.collection2.getResourceId(), this.routingMapCollection2AfterSplit), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection2AfterSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection2AfterSplit, 0), - getRangeAt(this.routingMapCollection2AfterSplit, 0), - false, - false, - false, - 1, - 1, - 0, - true); - - logger.info("Collection cache is stale (collection deleted). Routing map cache is stale (collection deleted). Address Cache returns null"); - try { - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - null, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(), - ImmutableMap.of(), - null, - null, - null, - null, - false, - false, - false, - 1, - 0, - 0, - true); - - fail("Expected NotFoundException"); - } catch (NotFoundException e) { - } - - logger.info("Collection cache is stale (collection deleted). Routing map cache returns null."); - try { - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - null, - ImmutableMap.of(), - null, - ImmutableMap.of(), - null, - null, - null, - null, - false, - false, - false, - 1, - 0, - 0, - true); - - fail("Expected NotFoundException"); - } catch (NotFoundException e) { - } - } - - private static PartitionKeyRange getRangeAt(CollectionRoutingMap routingMap, int index) { - return routingMap.getOrderedPartitionKeyRanges().get(index); - } - - private static ServiceIdentity getServiceIdentityAt(CollectionRoutingMap routingMap, int index) { - return (ServiceIdentity) routingMap.tryGetInfoByPartitionKeyRangeId(routingMap.getOrderedPartitionKeyRanges().get(index).getId()); - } - - @Test(groups = "unit") - public void testCacheRefreshesWhileRoutingByPartitionKeyRangeId() throws Exception { - logger.info("All caches are up to date. Name Based"); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(this.collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 0, - 0, - 0, - true); - - logger.info("All caches are up to date. Name Based. Non existent range with collection rid"); - try { - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(this.collection1.getResourceId(), "1"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 0, - 1, - 0, - true); - - fail("Should have gotten PartitionKeyRangeGoneException"); - } catch (PartitionKeyRangeGoneException e) { - } - - logger.info("All caches are up to date. Name Based. Non existent range withOUT collection rid"); - try { - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity("1"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 1, - 1, - 0, - true); - - fail("Should have gotten PartitionKeyRangeGoneException"); - } catch (PartitionKeyRangeGoneException e) { - } - - logger.info("All caches are up to date. Name Based.Range doesn't exist in routing map because split happened."); - try { - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 0, - 0, - 0, - true); - - fail("Should have gotten PartitionKeyRangeGoneException"); - } catch (PartitionKeyRangeGoneException e) { - } - - try { - logger.info("Name Based.Routing map cache is outdated because split happened. Address cache returns null."); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 0, - 1, - 0, - true); - - fail("Should have gotten PartitionKeyRangeGoneException"); - } catch (PartitionKeyRangeGoneException e) { - } - - logger.info("Name Based.Routing map cache is outdated because split happend."); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(collection1.getResourceId(), "1"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 0, - 1, - 0, - true); - - try { - logger.info("Collection cache is outdated. Routing map cache returns null. Collection is deleted. Range with collection rid."); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - null, - ImmutableMap.of(), - ImmutableMap.of(), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 0, - 0, - 0, - true); - - fail("Should have gotten InvalidPartitionException"); - } catch (InvalidPartitionException e) { - } - - try { - logger.info("Collection cache is outdated. Routing map cache returns null. Collection is deleted. Range without collection rid"); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - null, - ImmutableMap.of(), - ImmutableMap.of(), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity("0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 1, - 0, - 0, - true); - - fail("Should have gotten NotFoundException"); - } catch (NotFoundException e) { - } - - try { - logger.info("Collection cache is outdated. Routing map cache returns null. Collection is deleted. Range with collection rid. Rid based."); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - null, - ImmutableMap.of(), - ImmutableMap.of(), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 0, - 0, - 0, - false); - - fail("Should have gotten NotFoundException"); - } catch (NotFoundException e) { - } - - try { - logger.info("Collection cache is outdated. Routing map cache is outdated. Address cache is outdated. ForceAddressRefresh. Range with collection rid. Name based."); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection2, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection2.getResourceId(), this.routingMapCollection2BeforeSplit), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection2AfterSplit, 0), this.addresses2), - new PartitionKeyRangeIdentity(collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - true, - 0, - 1, - 1, - true); - - fail("Should have gotten InvalidPartitionException"); - } catch (InvalidPartitionException e) { - } - } - - static class ServiceIdentity implements IServerIdentity { - final boolean IsMasterService; - final URI ServiceName; - final String FederationId; - final Set partitionKeyRangeIds; - final static ServiceIdentity dummyInstance = new ServiceIdentity(null, null, true); - - public ServiceIdentity(String federationId, URI serviceName, boolean isMasterService, PartitionKeyRangeIdentity... partitionKeyRangeIdentities) { - this.FederationId = federationId; - this.ServiceName = serviceName; - this.IsMasterService = isMasterService; - this.partitionKeyRangeIds = new HashSet<>(Arrays.stream(partitionKeyRangeIdentities).collect(Collectors.toList())); - } - } -} - diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorTest.java deleted file mode 100644 index 4755646d1896..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorTest.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.testng.annotations.Test; -import rx.Single; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -public class AddressSelectorTest { - - @Test(groups = "unit", expectedExceptions = GoneException.class) - public void getPrimaryUri_NoAddress() throws Exception { - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - List replicaAddresses = new ArrayList<>(); - - AddressSelector.getPrimaryUri(request, replicaAddresses); - } - - @Test(groups = "unit", expectedExceptions = GoneException.class, expectedExceptionsMessageRegExp = - "The requested resource is no longer available at the server. Returned addresses are \\{https://cosmos1,https://cosmos2\\}") - public void getPrimaryUri_NoPrimaryAddress() throws Exception { - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos2", Protocol.Https)); - - AddressSelector.getPrimaryUri(request, replicaAddresses); - } - - @Test(groups = "unit") - public void getPrimaryUri() throws Exception { - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - URI res = AddressSelector.getPrimaryUri(request, replicaAddresses); - - assertThat(res).isEqualTo(URI.create("https://cosmos2")); - } - - @Test(groups = "unit") - public void getPrimaryUri_WithRequestReplicaIndex() throws Exception { - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(1).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - URI res = AddressSelector.getPrimaryUri(request, replicaAddresses); - - assertThat(res).isEqualTo(URI.create("https://cosmos2")); - } - - @Test(groups = "unit") - public void resolvePrimaryUriAsync() { - IAddressResolver addressResolver = Mockito.mock(IAddressResolver.class); - AddressSelector selector = new AddressSelector(addressResolver, Protocol.Https); - - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos4", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos5", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - Mockito.doReturn(Single.just(replicaAddresses.toArray(new AddressInformation[0]))).when(addressResolver).resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Matchers.eq(false)); - - URI res = selector.resolvePrimaryUriAsync(request, false).toBlocking().value(); - - assertThat(res).isEqualTo(URI.create("https://cosmos2")); - } - - @Test(groups = "unit") - public void resolveAllUriAsync() { - IAddressResolver addressResolver = Mockito.mock(IAddressResolver.class); - AddressSelector selector = new AddressSelector(addressResolver, Protocol.Https); - - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos4", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos5", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - Mockito.doReturn(Single.just(replicaAddresses.toArray(new AddressInformation[0]))).when(addressResolver).resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Matchers.eq(false)); - - List res = selector.resolveAllUriAsync(request, true, false).toBlocking().value(); - - assertThat(res).isEqualTo(ImmutableList.of(URI.create("https://cosmos1"), URI.create("https://cosmos2"), URI.create("https://cosmos3"))); - } - - @Test(groups = "unit") - public void resolveAddressesAsync() { - IAddressResolver addressResolver = Mockito.mock(IAddressResolver.class); - AddressSelector selector = new AddressSelector(addressResolver, Protocol.Https); - - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos4", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos5", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - Mockito.doReturn(Single.just(replicaAddresses.toArray(new AddressInformation[0]))).when(addressResolver).resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Matchers.eq(false)); - - List res = selector.resolveAddressesAsync(request, false).toBlocking().value(); - - assertThat(res).isEqualTo(replicaAddresses.stream().filter(a -> a.getProtocolName().equals(Protocol.Https.name())).collect(Collectors.toList())); - } - - @Test(groups = "unit") - public void resolveAllUriAsync_RNTBD() { - IAddressResolver addressResolver = Mockito.mock(IAddressResolver.class); - AddressSelector selector = new AddressSelector(addressResolver, Protocol.Tcp); - - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "rntbd://cosmos1", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, true, "rntbd://cosmos2", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - Mockito.doReturn(Single.just(replicaAddresses.toArray(new AddressInformation[0]))).when(addressResolver).resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Matchers.eq(false)); - - List res = selector.resolveAllUriAsync(request, true, false).toBlocking().value(); - - assertThat(res).isEqualTo(ImmutableList.of(URI.create("rntbd://cosmos1"), URI.create("rntbd://cosmos2"))); - } - -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorWrapper.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorWrapper.java deleted file mode 100644 index a968ffb24bc2..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorWrapper.java +++ /dev/null @@ -1,527 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import org.assertj.core.api.Condition; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import rx.Single; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Function; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddressSelectorWrapper { - - private static String resolveAllUriAsync = "resolveAllUriAsync"; - private static String resolvePrimaryUriAsync = "resolvePrimaryUriAsync"; - private static String resolveAddressesAsync = "resolveAddressesAsync"; - private final List invocationOnMockList; - - public final AddressSelector addressSelector; - - public static class InOrderVerificationBuilder { - private List> actions = new ArrayList<>(); - - public static InOrderVerificationBuilder create() { - return new InOrderVerificationBuilder(); - } - - public InOrderVerificationBuilder verify(InOrderVerification.Verifier v, int index) { - actions.add(verification -> { - verification.verify(v, index); - return null; - }); - return this; - } - - public InOrderVerificationBuilder verifyOnAll(InOrderVerification.Verifier v) { - actions.add(verification -> { - verification.verifyOnAll(v); - return null; - }); - return this; - } - - public InOrderVerificationBuilder verifyNext(InOrderVerification.Verifier v) { - actions.add(verification -> { - verification.verifyNext(v); - return null; - }); - return this; - } - - public InOrderVerificationBuilder verifyNumberOfInvocations(int expected) { - actions.add(verification -> { - verification.verifyNumberOfInvocations(expected); - return null; - }); - return this; - } - - public void execute(AddressSelectorWrapper addressSelectorWrapper) { - InOrderVerification v = new InOrderVerification(addressSelectorWrapper.invocationOnMockList); - for(Function action: actions) { - action.apply(v); - } - } - } - - public InOrderVerification getInOrderVerification() { - return new InOrderVerification(invocationOnMockList); - } - - public static class InOrderVerification { - private final List invocations; - private int internalIndex = 0; - - InOrderVerification(List invocationOnMockList) { - invocations = invocationOnMockList; - } - - public InOrderVerification verify(Verifier v, int index) { - v.verify(invocations.get(index)); - return this; - } - - public InOrderVerification verifyOnAll(Verifier v) { - for(InvocationOnMock i: invocations) { - v.verify(i); - } - return this; - } - - public InOrderVerification verifyNext(Verifier v) { - v.verify(invocations.get(internalIndex++)); - return this; - } - - public InOrderVerification verifyNumberOfInvocations(int expected) { - assertThat(invocations).hasSize(expected); - return this; - } - - interface Verifier { - - void verify(InvocationOnMock invocation); - - public static VerifierBuilder builder() { - return new VerifierBuilder(); - } - - public static class VerifierBuilder { - - public Verifier build() { - return new Verifier() { - @Override - public void verify(InvocationOnMock invocation) { - for(Verifier v: verifiers) { - v.verify(invocation); - } - } - }; - } - - List verifiers = new ArrayList<>(); - - VerifierBuilder add(Verifier verifier) { - verifiers.add(verifier); - return this; - } - - VerifierBuilder methodName(String methodName) { - add(new Verifier() { - @Override - public void verify(InvocationOnMock invocation) { - assertThat(invocation.getMethod().getName()).isEqualTo(methodName); - } - }); - return this; - } - - VerifierBuilder resolveAllUriAsync() { - methodName(resolveAllUriAsync); - return this; - } - - VerifierBuilder resolvePrimaryUriAsync() { - methodName(resolvePrimaryUriAsync); - return this; - } - - VerifierBuilder resolveAddressesAsync() { - methodName(resolveAddressesAsync); - return this; - } - - VerifierBuilder resolveAllUriAsync(Condition requestMatcher, Condition includePrimaryMatcher, Condition forceRefreshMatcher) { - methodName(resolveAllUriAsync); - add(new Verifier() { - @Override - public void verify(InvocationOnMock invocation) { - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean includePrimary = invocation.getArgumentAt(1, Boolean.class); - boolean forceRefresh = invocation.getArgumentAt(2, Boolean.class); - - assertThat(request).is(requestMatcher); - - assertThat(includePrimary).is(includePrimaryMatcher); - assertThat(forceRefresh).is(forceRefreshMatcher); - } - }); - return this; - } - - VerifierBuilder resolveAllUriAsync_IncludePrimary(boolean primaryIncluded) { - methodName(resolveAllUriAsync); - - Condition alwaysTrue = new Condition(Predicates.alwaysTrue(), "no condition"); - Condition primaryIncludedCond = new Condition(Predicates.equalTo(primaryIncluded), String.format("%b (primaryIncluded)", primaryIncluded)); - - resolveAllUriAsync(alwaysTrue, primaryIncludedCond, alwaysTrue); - return this; - } - - VerifierBuilder resolveAllUriAsync_ForceRefresh(boolean forceRefresh) { - methodName(resolveAllUriAsync); - - Condition alwaysTrue = new Condition(Predicates.alwaysTrue(), "no condition"); - Condition forceRefreshCond = new Condition(Predicates.equalTo(forceRefresh), String.format("%b (forceRefresh)", forceRefresh)); - - resolveAllUriAsync(alwaysTrue, alwaysTrue, forceRefreshCond); - return this; - } - } - } - } - - public AddressSelectorWrapper(AddressSelector addressSelector, List invocationOnMockList) { - this.addressSelector = addressSelector; - this.invocationOnMockList = invocationOnMockList; - } - - public AddressSelectorWrapper verifyNumberOfForceCachRefresh(int expectedNumber) { - int count = 0; - for (InvocationOnMock invocationOnMock : invocationOnMockList) { - boolean forceRefresh; - if (invocationOnMock.getMethod().getName().endsWith("resolveAllUriAsync")) { - forceRefresh = invocationOnMock.getArgumentAt(2, Boolean.class); - } else { - forceRefresh = invocationOnMock.getArgumentAt(1, Boolean.class); - } - if (forceRefresh) { - count++; - } - } - assertThat(count).isEqualTo(expectedNumber); - return this; - } - - public AddressSelectorWrapper verifyNumberOfForceCacheRefreshGreaterThanOrEqualTo(int minimum) { - int count = 0; - for (InvocationOnMock invocationOnMock : invocationOnMockList) { - boolean forceRefresh; - if (invocationOnMock.getMethod().getName().endsWith("resolveAllUriAsync")) { - forceRefresh = invocationOnMock.getArgumentAt(2, Boolean.class); - } else { - forceRefresh = invocationOnMock.getArgumentAt(1, Boolean.class); - } - if (forceRefresh) { - count++; - } - } - assertThat(count).isGreaterThanOrEqualTo(minimum); - return this; - } - - public AddressSelectorWrapper validate() { - // for now do nothing; - return this; - } - - public AddressSelectorWrapper verifyVesolvePrimaryUriAsyncCount(int count) { - Mockito.verify(addressSelector, Mockito.times(count)).resolvePrimaryUriAsync(Mockito.any(), Mockito.anyBoolean()); - return this; - } - - public AddressSelectorWrapper verifyResolveAddressesAsync(int count) { - Mockito.verify(addressSelector, Mockito.times(count)).resolveAddressesAsync(Mockito.any(), Mockito.anyBoolean()); - return this; - } - - public AddressSelectorWrapper verifyResolveAllUriAsync(int count) { - Mockito.verify(addressSelector, Mockito.times(count)).resolveAllUriAsync(Mockito.any(), Mockito.anyBoolean(), Mockito.anyBoolean()); - return this; - } - - public AddressSelectorWrapper verifyTotalInvocations(int count) { - assertThat(invocationOnMockList).hasSize(count); - return this; - } - - public static class Builder { - final Protocol protocol; - AddressSelector addressSelector; - List invocationOnMockList = Collections.synchronizedList(new ArrayList<>()); - - - public Builder(Protocol protocol) { - this.protocol = protocol; - } - - public static class PrimaryReplicaMoveBuilder extends Builder { - static PrimaryReplicaMoveBuilder create(Protocol protocol) { - return new PrimaryReplicaMoveBuilder(protocol); - } - - public PrimaryReplicaMoveBuilder(Protocol protocol) { - super(protocol); - addressSelector = Mockito.mock(AddressSelector.class); - } - - public PrimaryReplicaMoveBuilder withPrimaryReplicaMove(URI primaryURIBeforeForceRefresh, URI primaryURIAfterForceRefresh) { - AtomicBoolean refreshed = new AtomicBoolean(false); - Mockito.doAnswer((invocation) -> { - capture(invocation); - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean forceRefresh = invocation.getArgumentAt(1, Boolean.class); - - if (forceRefresh || refreshed.get()) { - refreshed.set(true); - return Single.just(primaryURIAfterForceRefresh); - } - - return Single.just(primaryURIBeforeForceRefresh); - }).when(addressSelector).resolvePrimaryUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - return null; - })).when(addressSelector).resolveAllUriAsync(Mockito.any(), Mockito.anyBoolean(), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - return null; - })).when(addressSelector).resolveAddressesAsync(Mockito.any(), Mockito.anyBoolean()); - - return this; - } - - public AddressSelectorWrapper build() { - return new AddressSelectorWrapper(this.addressSelector, this.invocationOnMockList); - } - } - - public static class ReplicaMoveBuilder extends Builder { - - List> secondary = new ArrayList<>(); - Pair primary; - private Function partitionKeyRangeFunction; - - static ReplicaMoveBuilder create(Protocol protocol) { - return new ReplicaMoveBuilder(protocol); - } - - public ReplicaMoveBuilder(Protocol protocol) { - super(protocol); - addressSelector = Mockito.mock(AddressSelector.class); - } - - public ReplicaMoveBuilder withPrimaryMove(URI uriBeforeForceRefresh, URI uriAfterForceRefresh) { - withReplicaMove(uriBeforeForceRefresh, uriAfterForceRefresh, true); - return this; - } - - public ReplicaMoveBuilder withSecondaryMove(URI uriBeforeForceRefresh, URI uriAfterForceRefresh) { - withReplicaMove(uriBeforeForceRefresh, uriAfterForceRefresh, false); - return this; - } - - public ReplicaMoveBuilder newPartitionKeyRangeIdOnRefresh(Function partitionKeyRangeFunction) { - this.partitionKeyRangeFunction = partitionKeyRangeFunction; - return this; - } - - public ReplicaMoveBuilder withReplicaMove(URI uriBeforeForceRefresh, URI uriAfterForceRefresh, boolean isPrimary) { - if (isPrimary) { - primary = ImmutablePair.of(uriBeforeForceRefresh, uriAfterForceRefresh); - } else { - secondary.add(ImmutablePair.of(uriBeforeForceRefresh, uriAfterForceRefresh)); - } - return this; - } - - - public AddressSelectorWrapper build() { - AtomicBoolean refreshed = new AtomicBoolean(false); - Mockito.doAnswer((invocation) -> { - capture(invocation); - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean forceRefresh = invocation.getArgumentAt(1, Boolean.class); - if (partitionKeyRangeFunction != null) { - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeFunction.apply(request); - } - if (forceRefresh || refreshed.get()) { - refreshed.set(true); - return Single.just(primary.getRight()); - } else { - return Single.just(primary.getLeft()); - } - - }).when(addressSelector).resolvePrimaryUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean includePrimary = invocation.getArgumentAt(1, Boolean.class); - boolean forceRefresh = invocation.getArgumentAt(2, Boolean.class); - - ImmutableList.Builder b = ImmutableList.builder(); - - if (forceRefresh || refreshed.get()) { - if (partitionKeyRangeFunction != null) { - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeFunction.apply(request); - } - refreshed.set(true); - if (includePrimary) { - b.add(primary.getRight()); - } - b.addAll(secondary.stream().map(s -> s.getRight()).collect(Collectors.toList())); - return Single.just(b.build()); - } else { - // old - if (includePrimary) { - b.add(primary.getLeft()); - } - b.addAll(secondary.stream().map(s -> s.getLeft()).collect(Collectors.toList())); - return Single.just(b.build()); - } - - })).when(addressSelector).resolveAllUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean(), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean forceRefresh = invocation.getArgumentAt(1, Boolean.class); - - ImmutableList.Builder b = ImmutableList.builder(); - - if (forceRefresh || refreshed.get()) { - if (partitionKeyRangeFunction != null) { - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeFunction.apply(request); - } - - refreshed.set(true); - b.add(primary.getRight()); - b.addAll(secondary.stream().map(s -> s.getRight()).collect(Collectors.toList())); - return Single.just(b.build()); - } else { - // old - b.add(primary.getLeft()); - b.addAll(secondary.stream().map(s -> s.getLeft()).collect(Collectors.toList())); - return Single.just(b.build()); - } - })).when(addressSelector).resolveAddressesAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean()); - - return new AddressSelectorWrapper(addressSelector, invocationOnMockList); - } - } - - public static class Simple extends Builder { - private URI primaryAddress; - private List secondaryAddresses; - static Simple create() { - return new Simple(Protocol.Https); - } - - public Simple(Protocol protocol) { - super(protocol); - addressSelector = Mockito.mock(AddressSelector.class); - } - - public Simple withPrimary(URI primaryAddress) { - this.primaryAddress = primaryAddress; - return this; - } - - public Simple withSecondary(List secondaryAddresses) { - this.secondaryAddresses = secondaryAddresses; - return this; - } - - public AddressSelectorWrapper build() { - Mockito.doAnswer((invocation) -> { - capture(invocation); - return Single.just(primaryAddress); - }).when(addressSelector).resolvePrimaryUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean includePrimary = invocation.getArgumentAt(1, Boolean.class); - boolean forceRefresh = invocation.getArgumentAt(2, Boolean.class); - - if (includePrimary) { - return Single.just(ImmutableList.builder().addAll(secondaryAddresses).add(primaryAddress).build()); - } else { - return Single.just(secondaryAddresses); - } - })).when(addressSelector).resolveAllUriAsync(Mockito.any(), Mockito.anyBoolean(), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - return Single.just(ImmutableList.builder() - .addAll(secondaryAddresses.stream() - .map(uri -> toAddressInformation(uri, false, protocol)) - .collect(Collectors.toList())) - .add(toAddressInformation(primaryAddress, true, protocol)) - .build()); - })).when(addressSelector).resolveAddressesAsync(Mockito.any(), Mockito.anyBoolean()); - - - return new AddressSelectorWrapper(this.addressSelector, this.invocationOnMockList); - } - - private AddressInformation toAddressInformation(URI uri, boolean isPrimary, Protocol protocol) { - return new AddressInformation(true, isPrimary, uri.toString(), protocol); - } - } - - protected void capture(InvocationOnMock invocationOnMock) { - invocationOnMockList.add(invocationOnMock); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderTest.java deleted file mode 100644 index 36c3795fe961..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderTest.java +++ /dev/null @@ -1,782 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.VectorSessionToken; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.mockito.Mockito; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.net.URI; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import static org.assertj.core.api.Assertions.assertThat; - -public class ConsistencyReaderTest { - private final Configs configs = new Configs(); - private static final int TIMEOUT = 30000; - @DataProvider(name = "deduceReadModeArgProvider") - public Object[][] deduceReadModeArgProvider() { - return new Object[][]{ - // account consistency, request consistency, expected readmode, expected consistency to use, whether use session - { ConsistencyLevel.Strong, null, ReadMode.Strong, ConsistencyLevel.Strong, false}, - { ConsistencyLevel.Strong, ConsistencyLevel.Eventual, ReadMode.Any, ConsistencyLevel.Eventual, false}, - { ConsistencyLevel.Strong, ConsistencyLevel.Session, ReadMode.Any, ConsistencyLevel.Session, true}, - { ConsistencyLevel.Session, ConsistencyLevel.Eventual, ReadMode.Any, ConsistencyLevel.Eventual, false}, - { ConsistencyLevel.Session, ConsistencyLevel.Session, ReadMode.Any, ConsistencyLevel.Session, true}, - { ConsistencyLevel.Session, ConsistencyLevel.Eventual, ReadMode.Any, ConsistencyLevel.Eventual, false}, - { ConsistencyLevel.Session, null, ReadMode.Any, ConsistencyLevel.Session, true}, - { ConsistencyLevel.Eventual, ConsistencyLevel.Eventual, ReadMode.Any, ConsistencyLevel.Eventual, false}, - { ConsistencyLevel.Eventual, null, ReadMode.Any, ConsistencyLevel.Eventual, false}, - }; - } - - @Test(groups = "unit", dataProvider = "deduceReadModeArgProvider") - public void deduceReadMode(ConsistencyLevel accountConsistencyLevel, ConsistencyLevel requestConsistency, ReadMode expectedReadMode, - ConsistencyLevel expectedConsistencyToUse, boolean expectedToUseSession) throws DocumentClientException { - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - TransportClient transportClient = Mockito.mock(TransportClient.class); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(accountConsistencyLevel); - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelector, - sessionContainer, - transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authorizationTokenProvider); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - if (requestConsistency != null) { - request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, requestConsistency.name()); - } - - ValueHolder consistencyLevel = ValueHolder.initialize(null); - ValueHolder useSession = ValueHolder.initialize(null); - - ReadMode readMode = consistencyReader.deduceReadMode(request, consistencyLevel, useSession); - - assertThat(readMode).isEqualTo(expectedReadMode); - assertThat(consistencyLevel.v).isEqualTo(expectedConsistencyToUse); - assertThat(useSession.v).isEqualTo(expectedToUseSession); - } - - @DataProvider(name = "getMaxReplicaSetSizeArgProvider") - public Object[][] getMaxReplicaSetSizeArgProvider() { - return new Object[][]{ - // system max replica count, system min replica count, user max replica count, user min replica, is reading from master operation - { 4, 3, 4, 3, false }, - { 4, 3, 4, 3, true }, - - { 4, 3, 3, 2, false }, - { 4, 3, 3, 2, true } - }; - } - - @Test(groups = "unit", dataProvider = "getMaxReplicaSetSizeArgProvider") - public void replicaSizes(int systemMaxReplicaCount, - int systemMinReplicaCount, - int userMaxReplicaCount, - int userMinReplicaCount, - boolean isReadingFromMasterOperation) { - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - TransportClient transportClient = Mockito.mock(TransportClient.class); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - systemMaxReplicaCount, - systemMinReplicaCount, - userMaxReplicaCount, - userMinReplicaCount); - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelector, - sessionContainer, - transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authorizationTokenProvider); - - RxDocumentServiceRequest request; - if (isReadingFromMasterOperation) { - request = RxDocumentServiceRequest.createFromName( - OperationType.ReadFeed, "/dbs/db/colls/col", ResourceType.DocumentCollection); - } else { - request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - } - - assertThat(consistencyReader.getMaxReplicaSetSize(request)).isEqualTo(isReadingFromMasterOperation? systemMaxReplicaCount : userMaxReplicaCount); - assertThat(consistencyReader.getMinReplicaSetSize(request)).isEqualTo(isReadingFromMasterOperation? systemMinReplicaCount : userMinReplicaCount); - } - - @Test(groups = "unit") - public void readAny() { - List secondaries = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2"), URI.create("secondary3")); - URI primaryAddress = URI.create("primary"); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryAddress) - .withSecondary(secondaries) - .build(); - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withLSN(54) - .withLocalLSN(18) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse1 = StoreResponseBuilder.create() - .withLSN(53) - .withLocalLSN(17) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse2 = StoreResponseBuilder.create() - .withLSN(52) - .withLocalLSN(16) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse3 = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(15) - .withRequestCharge(1.1) - .build(); - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryAddress, OperationType.Read, ResourceType.Document, primaryResponse, true) - .storeResponseOn(secondaries.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, true) - .storeResponseOn(secondaries.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, true) - .storeResponseOn(secondaries.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, true) - .build(); - - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReaderUnderTest consistencyReader = new ConsistencyReaderUnderTest(addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authorizationTokenProvider); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Eventual.name()); - - TimeoutHelper timeout = Mockito.mock(TimeoutHelper.class); - boolean forceRefresh = false; - boolean isInRetry = false; - Single storeResponseSingle = consistencyReader.readAsync(request, timeout, isInRetry, forceRefresh); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSNGreaterThanOrEqualTo(51) - .withRequestCharge(1.1) - .in(primaryResponse, secondaryResponse1, secondaryResponse2, secondaryResponse3) - .build(); - validateSuccess(storeResponseSingle, validator); - - Mockito.verifyZeroInteractions(consistencyReader.getSpyQuorumReader()); - - - Mockito.verify(consistencyReader.getSpyStoreReader(), Mockito.times(1)) - .readMultipleReplicaAsync(Mockito.any(RxDocumentServiceRequest.class), - Mockito.anyBoolean(), - Mockito.anyInt(), - Mockito.anyBoolean(), - Mockito.anyBoolean(), - Mockito.any(), - Mockito.anyBoolean(), - Mockito.anyBoolean()); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(1); - - addressSelectorWrapper.validate() - .verifyTotalInvocations(1) - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyResolveAllUriAsync(1); - } - - @Test(groups = "unit") - public void readSessionConsistency_SomeReplicasLagBehindAndReturningResponseWithLowerLSN_FindAnotherReplica() { - long slowReplicaLSN = 651176; - String partitionKeyRangeId = "1"; - long fasterReplicaLSN = 651177; - - List secondaries = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2"), URI.create("secondary3")); - URI primaryAddress = URI.create("primary"); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryAddress) - .withSecondary(secondaries) - .build(); - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + slowReplicaLSN) - .withLSN(slowReplicaLSN) - .withLocalLSN(slowReplicaLSN) - .withQuorumAckecdLsn(slowReplicaLSN) - .withQuorumAckecdLocalLsn(slowReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(slowReplicaLSN) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse1 = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + slowReplicaLSN) - .withLSN(slowReplicaLSN) - .withLocalLSN(slowReplicaLSN) - .withQuorumAckecdLsn(slowReplicaLSN) - .withQuorumAckecdLocalLsn(slowReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(slowReplicaLSN) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse2 = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + fasterReplicaLSN) - .withLSN(fasterReplicaLSN) - .withLocalLSN(fasterReplicaLSN) - .withQuorumAckecdLsn(fasterReplicaLSN) - .withQuorumAckecdLocalLsn(fasterReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(fasterReplicaLSN) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse3 = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + slowReplicaLSN) - .withLSN(slowReplicaLSN) - .withLocalLSN(slowReplicaLSN) - .withQuorumAckecdLsn(slowReplicaLSN) - .withQuorumAckecdLocalLsn(slowReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(slowReplicaLSN) - .withRequestCharge(1.1) - .build(); - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryAddress, OperationType.Read, ResourceType.Document, primaryResponse, true) - .storeResponseOn(secondaries.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, true) - .storeResponseOn(secondaries.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, true) - .storeResponseOn(secondaries.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, true) - .build(); - - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReaderUnderTest consistencyReader = new ConsistencyReaderUnderTest(addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authorizationTokenProvider); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - request.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - assertThat(VectorSessionToken.tryCreate("-1#" + fasterReplicaLSN , sessionToken)).isTrue(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(request), Mockito.anyString()); - - - TimeoutHelper timeout = Mockito.mock(TimeoutHelper.class); - boolean forceRefresh = false; - boolean isInRetry = false; - Single storeResponseSingle = consistencyReader.readAsync(request, timeout, isInRetry, forceRefresh); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(fasterReplicaLSN) - .withRequestChargeGreaterThanOrEqualTo(1.1) - .in(primaryResponse, secondaryResponse1, secondaryResponse2, secondaryResponse3) - .build(); - validateSuccess(storeResponseSingle, validator); - - Mockito.verifyZeroInteractions(consistencyReader.getSpyQuorumReader()); - - - Mockito.verify(consistencyReader.getSpyStoreReader(), Mockito.times(1)) - .readMultipleReplicaAsync(Mockito.any(RxDocumentServiceRequest.class), - Mockito.anyBoolean(), - Mockito.anyInt(), - Mockito.anyBoolean(), - Mockito.anyBoolean(), - Mockito.any(), - Mockito.anyBoolean(), - Mockito.anyBoolean()); - - assertThat(transportClientWrapper.validate() - .getNumberOfInvocations()) - .isGreaterThanOrEqualTo(1) - .isLessThanOrEqualTo(4); - - addressSelectorWrapper.validate() - .verifyTotalInvocations(1) - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyResolveAllUriAsync(1); - } - - /** - * reading in session consistency, if the requested session token cannot be supported by some replicas - * tries others till we find a replica which can support the given session token - */ - @Test(groups = "unit") - public void sessionNotAvailableFromSomeReplicasThrowingNotFound_FindReplicaSatisfyingRequestedSession() { - long slowReplicaLSN = 651175; - long globalCommittedLsn = 651174; - - long fasterReplicaLSN = 651176; - String partitionKeyRangeId = "1"; - - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + slowReplicaLSN); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(slowReplicaLSN)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(slowReplicaLSN)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - StoreResponse storeResponse = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + fasterReplicaLSN) - .withLSN(fasterReplicaLSN) - .withLocalLSN(fasterReplicaLSN) - .withQuorumAckecdLsn(fasterReplicaLSN) - .withQuorumAckecdLocalLsn(fasterReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(fasterReplicaLSN) - .withRequestCharge(1.1) - .build(); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read returns not found - .then(foundException) // 2nd replica read returns not found - .then(foundException) // 3rd replica read returns not found - .then(storeResponse) // 4th replica read returns storeResponse satisfying requested session token - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - Configs configs = new Configs(); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - 4, - 3, - 4, - 3); - - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authTokenProvider); - - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - assertThat(VectorSessionToken.tryCreate("-1#" + fasterReplicaLSN , sessionToken)).isTrue(); - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Single storeResponseSingle = consistencyReader.readAsync(dsr, timeoutHelper, false, false); - - StoreResponseValidator validator = StoreResponseValidator.create().isSameAs(storeResponse).isSameAs(storeResponse).build(); - validateSuccess(storeResponseSingle, validator); - } - - /** - * Reading with session consistency, replicas have session token with higher than requested and return not found - */ - @Test(groups = "unit") - public void sessionRead_LegitimateNotFound() { - long lsn = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read returns not found lsn(response) >= lsn(request) - .then(foundException) // 2nd replica read returns not found lsn(response) >= lsn(request) - .then(foundException) // 3rd replica read returns not found lsn(response) >= lsn(request) - .then(foundException) // 4th replica read returns not found lsn(response) >= lsn(request) - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - assertThat(VectorSessionToken.tryCreate("-1#" + lsn , sessionToken)).isTrue(); - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Configs configs = new Configs(); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - 4, - 3, - 4, - 3); - - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authTokenProvider); - - Single storeResponseSingle = consistencyReader.readAsync(dsr, timeoutHelper, false, false); - - FailureValidator failureValidator = FailureValidator.builder().resourceNotFound().instanceOf(NotFoundException.class).unknownSubStatusCode().build(); - validateException(storeResponseSingle, failureValidator); - } - - /** - * reading in session consistency, no replica support requested lsn - */ - @Test(groups = "unit") - public void sessionRead_ReplicasDoNotHaveTheRequestedLSN() { - long lsn = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(651175)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(651175)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read lsn lags behind the request lsn - .then(foundException) // 2nd replica read lsn lags behind the request lsn - .then(foundException) // 3rd replica read lsn lags behind the request lsn - .then(foundException) // 4th replica read lsn lags behind the request lsn - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - assertThat(VectorSessionToken.tryCreate("-1#" + (lsn + 1) , sessionToken)).isTrue(); - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Configs configs = new Configs(); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - 4, - 3, - 4, - 3); - - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authTokenProvider); - - Single storeResponseSingle = consistencyReader.readAsync(dsr, timeoutHelper, false, false); - - FailureValidator failureValidator = FailureValidator.builder().resourceNotFound().instanceOf(NotFoundException.class).subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); - validateException(storeResponseSingle, failureValidator); - } - - @Test(groups = "unit") - public void requestRateTooLarge_BubbleUp() { - long lsn = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - - RequestRateTooLargeException requestTooLargeException = new RequestRateTooLargeException(); - requestTooLargeException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - requestTooLargeException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(651175)); - requestTooLargeException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(651175)); - requestTooLargeException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(requestTooLargeException) // 1st replica read result in throttling - .then(requestTooLargeException) // 2nd replica read result in throttling - .then(requestTooLargeException) // 3rd replica read result in throttling - .then(requestTooLargeException) // 4th replica read result in throttling - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - assertThat(VectorSessionToken.tryCreate("-1#" + lsn , sessionToken)).isTrue(); - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Configs configs = new Configs(); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - 4, - 3, - 4, - 3); - - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authTokenProvider); - - Single storeResponseSingle = consistencyReader.readAsync(dsr, timeoutHelper, false, false); - - - FailureValidator failureValidator = FailureValidator.builder().instanceOf(RequestRateTooLargeException.class).unknownSubStatusCode().build(); - validateException(storeResponseSingle, failureValidator); - } - - @DataProvider(name = "simpleReadStrongArgProvider") - public Object[][] simpleReadStrongArgProvider() { - return new Object[][]{ - { 1, ReadMode.Strong }, - { 2, ReadMode.Strong }, - { 3, ReadMode.Strong }, - }; - } - - @Test(groups = "unit", dataProvider = "simpleReadStrongArgProvider") - public void basicReadStrong_AllReplicasSameLSN(int replicaCountToRead, ReadMode readMode) { - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2"), URI.create("secondary3")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - BigDecimal requestChargePerRead = new BigDecimal(1.1); - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(18) - .withRequestCharge(requestChargePerRead.doubleValue()) - .build(); - StoreResponse secondaryResponse1 = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(18) - .withRequestCharge(requestChargePerRead.doubleValue()) - .build(); - StoreResponse secondaryResponse2 = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(18) - .withRequestCharge(requestChargePerRead.doubleValue()) - .build(); - StoreResponse secondaryResponse3 = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(18) - .withRequestCharge(requestChargePerRead.doubleValue()) - .build(); - - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryReplicaURI, OperationType.Read, ResourceType.Document, primaryResponse, false) - .storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, false) - .storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, false) - .storeResponseOn(secondaryReplicaURIs.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, false) - .build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - QuorumReader quorumReader = new QuorumReader(configs, transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, storeReader, serviceConfigurator, authTokenProvider); - - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(51) - .withRequestCharge(requestChargePerRead.multiply(BigDecimal.valueOf(replicaCountToRead)).setScale(2, RoundingMode.FLOOR).doubleValue()) - .build(); - validateSuccess(storeResponseSingle, validator); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(replicaCountToRead); - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1); - } - - // TODO: add more mocking tests for when one replica lags behind and we need to do barrier request. - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator, - long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator, - long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - - public static void validateException(Single single, - FailureValidator validator, - long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - public static void validateException(Single single, - FailureValidator validator) { - validateException(single, validator, TIMEOUT); - } - - private PartitionKeyRange partitionKeyRangeWithId(String id) { - PartitionKeyRange partitionKeyRange = Mockito.mock(PartitionKeyRange.class); - Mockito.doReturn(id).when(partitionKeyRange).getId(); - return partitionKeyRange; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderUnderTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderUnderTest.java deleted file mode 100644 index 4f35b9c0e973..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderUnderTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import org.mockito.Mockito; - -public class ConsistencyReaderUnderTest extends ConsistencyReader { - private QuorumReader origQuorumReader; - private QuorumReader spyQuorumReader; - - private StoreReaderUnderTest origStoreReader; - private StoreReaderUnderTest spyStoreReader; - - public ConsistencyReaderUnderTest(AddressSelector addressSelector, - ISessionContainer sessionContainer, - TransportClient transportClient, - GatewayServiceConfigurationReader serviceConfigReader, - IAuthorizationTokenProvider authorizationTokenProvider) { - super(new Configs(), addressSelector, sessionContainer, transportClient, serviceConfigReader, authorizationTokenProvider); - - } - - public QuorumReader getOrigQuorumReader() { - return origQuorumReader; - } - - public QuorumReader getSpyQuorumReader() { - return spyQuorumReader; - } - - public StoreReaderUnderTest getOrigStoreReader() { - return origStoreReader; - } - - public StoreReaderUnderTest getSpyStoreReader() { - return spyStoreReader; - } - - @Override - QuorumReader createQuorumReader(TransportClient transportClient, - AddressSelector addressSelector, - StoreReader storeReader, - GatewayServiceConfigurationReader serviceConfigurationReader, - IAuthorizationTokenProvider authorizationTokenProvider) { - this.origQuorumReader = super.createQuorumReader(transportClient, - addressSelector, - storeReader, - serviceConfigurationReader, - authorizationTokenProvider); - this.spyQuorumReader = Mockito.spy(this.origQuorumReader); - return this.spyQuorumReader; - } - - @Override - StoreReader createStoreReader(TransportClient transportClient, - AddressSelector addressSelector, - ISessionContainer sessionContainer) { - this.origStoreReader = new StoreReaderUnderTest(transportClient, addressSelector, sessionContainer); - this.spyStoreReader = Mockito.spy(this.origStoreReader); - return this.spyStoreReader; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriterTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriterTest.java deleted file mode 100644 index 02f5b97aef37..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriterTest.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; -import rx.subjects.PublishSubject; - -import java.net.URI; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.TimeUnit; - -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.StatusCodes.GONE; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.COMPLETING_PARTITION_MIGRATION; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.COMPLETING_SPLIT; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE; -import static org.assertj.core.api.Assertions.assertThat; - -public class ConsistencyWriterTest { - - private AddressSelector addressSelector; - private ISessionContainer sessionContainer; - private TransportClient transportClient; - private GatewayServiceConfigurationReader serviceConfigReader; - private ConsistencyWriter consistencyWriter; - - @DataProvider(name = "exceptionArgProvider") - public Object[][] exceptionArgProvider() { - return new Object[][]{ - // exception to be thrown from transportClient, expected (exception type, status, subStatus) - { new PartitionKeyRangeGoneException(), PartitionKeyRangeGoneException.class, GONE, PARTITION_KEY_RANGE_GONE, }, - { new PartitionKeyRangeIsSplittingException() , PartitionKeyRangeIsSplittingException.class, GONE, COMPLETING_SPLIT, }, - { new PartitionIsMigratingException(), PartitionIsMigratingException.class, GONE, COMPLETING_PARTITION_MIGRATION, }, - }; - } - - @Test(groups = "unit", dataProvider = "exceptionArgProvider") - public void exception(Exception ex, Class klass, int expectedStatusCode, Integer expectedSubStatusCode) { - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(ex) - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - sessionContainer = Mockito.mock(ISessionContainer.class); - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - serviceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - - consistencyWriter = new ConsistencyWriter( - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - authorizationTokenProvider, - serviceConfigReader, - false); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = Mockito.mock(RxDocumentServiceRequest.class); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - Single res = consistencyWriter.writeAsync(dsr, timeoutHelper, false); - - FailureValidator failureValidator = FailureValidator.builder() - .instanceOf(klass) - .statusCode(expectedStatusCode) - .subStatusCode(expectedSubStatusCode) - .build(); - - TestSubscriber subscriber = new TestSubscriber<>(); - res.subscribe(subscriber); - subscriber.awaitTerminalEvent(); - subscriber.assertNotCompleted(); - assertThat(subscriber.getOnErrorEvents()).hasSize(1); - failureValidator.validate(subscriber.getOnErrorEvents().get(0)); - } - - @Test(groups = "unit") - public void startBackgroundAddressRefresh() throws Exception { - initializeConsistencyWriter(false); - - CyclicBarrier b = new CyclicBarrier(2); - PublishSubject subject = PublishSubject.create(); - CountDownLatch c = new CountDownLatch(1); - - URI uri = URI.create("https://localhost:5050"); - - List invocationOnMocks = Collections.synchronizedList(new ArrayList<>()); - Mockito.doAnswer(new Answer() { - @Override - public Single answer(InvocationOnMock invocationOnMock) { - invocationOnMocks.add(invocationOnMock); - return subject.toSingle().doOnSuccess(x -> c.countDown()).doAfterTerminate(() -> { - new Thread() { - @Override - public void run() { - try { - b.await(); - } catch (Exception e) { - - } - } - }.start(); - }); - } - }).when(addressSelector).resolvePrimaryUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean()); - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - consistencyWriter.startBackgroundAddressRefresh(request); - - subject.onNext(uri); - subject.onCompleted(); - - TimeUnit.MILLISECONDS.sleep(1000); - assertThat(c.getCount()).isEqualTo(0); - assertThat(b.getNumberWaiting()).isEqualTo(1); - b.await(1000, TimeUnit.MILLISECONDS); - assertThat(invocationOnMocks).hasSize(1); - assertThat(invocationOnMocks.get(0).getArgumentAt(1, Boolean.class)).isTrue(); - } - - @Test(groups = "unit") - public void getLsnAndGlobalCommittedLsn() { - ImmutableList.Builder> builder = new ImmutableList.Builder<>(); - builder.add(new AbstractMap.SimpleEntry<>(WFConstants.BackendHeaders.LSN, "3")); - builder.add(new AbstractMap.SimpleEntry<>(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "2")); - ImmutableList> headers = builder.build(); - - StoreResponse sr = new StoreResponse(0, headers, (String) null); - Utils.ValueHolder lsn = Utils.ValueHolder.initialize(-2l); - Utils.ValueHolder globalCommittedLsn = Utils.ValueHolder.initialize(-2l); - ConsistencyWriter.getLsnAndGlobalCommittedLsn(sr, lsn, globalCommittedLsn); - assertThat(lsn.v).isEqualTo(3); - assertThat(globalCommittedLsn.v).isEqualTo(2); - } - - - @Test(groups = "unit") - public void timeout1() throws Exception { - initializeConsistencyWriter(false); - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - Mockito.doReturn(true).when(timeoutHelper).isElapsed(); - ConsistencyWriter spyConsistencyWriter = Mockito.spy(this.consistencyWriter); - TestSubscriber subscriber = new TestSubscriber(); - - spyConsistencyWriter.writeAsync(Mockito.mock(RxDocumentServiceRequest.class), timeoutHelper, false) - .toObservable() - .subscribe(subscriber); - - subscriber.awaitTerminalEvent(10, TimeUnit.MILLISECONDS); - subscriber.assertNoValues(); - - subscriber.assertError(RequestTimeoutException.class); - } - - @Test(groups = "unit") - public void timeout2() throws Exception { - initializeConsistencyWriter(false); - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - Mockito.doReturn(false).doReturn(true).when(timeoutHelper).isElapsed(); - ConsistencyWriter spyConsistencyWriter = Mockito.spy(this.consistencyWriter); - TestSubscriber subscriber = new TestSubscriber(); - - spyConsistencyWriter.writeAsync(Mockito.mock(RxDocumentServiceRequest.class), timeoutHelper, false) - .toObservable() - .subscribe(subscriber); - - subscriber.awaitTerminalEvent(10, TimeUnit.MILLISECONDS); - subscriber.assertError(RequestTimeoutException.class); - } - - @DataProvider(name = "globalStrongArgProvider") - public Object[][] globalStrongArgProvider() { - return new Object[][]{ - { - ConsistencyLevel.Session, - Mockito.mock(RxDocumentServiceRequest.class), - Mockito.mock(StoreResponse.class), - - false, - }, - { - ConsistencyLevel.Eventual, - Mockito.mock(RxDocumentServiceRequest.class), - Mockito.mock(StoreResponse.class), - - false, - }, - { - - ConsistencyLevel.Eventual, - Mockito.mock(RxDocumentServiceRequest.class), - StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, Integer.toString(5)) - .build(), - false, - }, - { - - ConsistencyLevel.Strong, - Mockito.mock(RxDocumentServiceRequest.class), - StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, Integer.toString(5)) - .build(), - true, - }, - { - - ConsistencyLevel.Strong, - Mockito.mock(RxDocumentServiceRequest.class), - StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, Integer.toString(0)) - .build(), - false, - } - }; - } - - @Test(groups = "unit", dataProvider = "globalStrongArgProvider") - public void isGlobalStrongRequest(ConsistencyLevel defaultConsistencyLevel, RxDocumentServiceRequest req, StoreResponse storeResponse, boolean isGlobalStrongExpected) { - initializeConsistencyWriter(false); - Mockito.doReturn(defaultConsistencyLevel).when(this.serviceConfigReader).getDefaultConsistencyLevel(); - - - assertThat(consistencyWriter.isGlobalStrongRequest(req, storeResponse)).isEqualTo(isGlobalStrongExpected); - } - - private void initializeConsistencyWriter(boolean useMultipleWriteLocation) { - addressSelector = Mockito.mock(AddressSelector.class); - sessionContainer = Mockito.mock(ISessionContainer.class); - transportClient = Mockito.mock(TransportClient.class); - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - serviceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - - consistencyWriter = new ConsistencyWriter( - addressSelector, - sessionContainer, - transportClient, - authorizationTokenProvider, - serviceConfigReader, - useMultipleWriteLocation); - } - - // TODO: add more mocking unit tests for Global Strong (mocking unit tests) - // TODO: add more tests for Session behaviour (mocking unit tests) - // TODO: add more tests for error handling behaviour (mocking unit tests) - // TODO: add tests for replica catch up (request barrier while loop) (mocking unit tests) - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/320977 -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/EndpointMock.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/EndpointMock.java deleted file mode 100644 index d2d709b3bb18..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/EndpointMock.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.collections.map.HashedMap; - -import java.net.URI; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -abstract public class EndpointMock { - - TransportClientWrapper transportClientWrapper; - AddressSelectorWrapper addressSelectorWrapper; - - public EndpointMock(AddressSelectorWrapper addressSelectorWrapper, TransportClientWrapper transportClientWrapper) { - this.addressSelectorWrapper = addressSelectorWrapper; - this.transportClientWrapper = transportClientWrapper; - } - - public static class EndpointMockVerificationBuilder { - public static EndpointMockVerificationBuilder builder() { - return new EndpointMockVerificationBuilder(); - } - - private AddressSelectorWrapper.InOrderVerificationBuilder addressSelectorVerificationBuilder; - private TransportClientWrapper.TransportClientWrapperVerificationBuilder transportClientValidation; - - public EndpointMockVerificationBuilder withAddressSelectorValidation(AddressSelectorWrapper.InOrderVerificationBuilder addressSelectorBuilder) { - addressSelectorVerificationBuilder = addressSelectorBuilder; - return this; - } - - public EndpointMockVerificationBuilder withTransportClientValidation(TransportClientWrapper.TransportClientWrapperVerificationBuilder transportClientValidation) { - this.transportClientValidation = transportClientValidation; - return this; - } - - public void execute(EndpointMock endpointMock) { - this.addressSelectorVerificationBuilder.execute(endpointMock.addressSelectorWrapper); - this.transportClientValidation.execute(endpointMock.transportClientWrapper); - } - } - - - public void validate(EndpointMockVerificationBuilder verificationBuilder) { - this.addressSelectorWrapper.validate(); - this.transportClientWrapper.validate(); - if (verificationBuilder != null) { - verificationBuilder.execute(this); - } - } - - public static Builder.NoSecondaryReplica noSecondaryReplicaBuilder() { - return new Builder.NoSecondaryReplica(); - } - - abstract static class Builder { - - class ReplicasWithSameSpeed extends Builder { - - URI primary; - List secondaries = new ArrayList<>(); - StoreResponse headStoreResponse; - StoreResponse readStoreResponse; - - ReplicasWithSameSpeed addPrimary(URI replicaAddress) { - primary = replicaAddress; - return this; - } - - ReplicasWithSameSpeed addSecondary(URI replicaAddress) { - secondaries.add(replicaAddress); - return this; - } - - ReplicasWithSameSpeed storeResponseOnRead(StoreResponse storeResponse) { - this.readStoreResponse = storeResponse; - return this; - } - - ReplicasWithSameSpeed storeResponseOnHead(StoreResponse storeResponse) { - this.headStoreResponse = storeResponse; - return this; - } - - public EndpointMock build() { - TransportClientWrapper.Builder.ReplicaResponseBuilder transportClientWrapperBuilder = TransportClientWrapper.Builder.replicaResponseBuilder(); - - ImmutableList replicas = ImmutableList.builder().add(primary).addAll(secondaries).build(); - - for(URI replica: replicas) { - transportClientWrapperBuilder.addReplica(replica, (i, request) -> { - if (request.getOperationType() == OperationType.Head || request.getOperationType() == OperationType.HeadFeed) { - return headStoreResponse; - } else { - return readStoreResponse; - } - }); - } - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create().withPrimary(primary) - .withSecondary(secondaries).build(); - - return new EndpointMock(addressSelectorWrapper, transportClientWrapperBuilder.build()) {}; - } - } - - class QuorumNotMetSecondaryReplicasDisappear { - URI primary; - Map> disappearDictionary = new HashedMap(); - public QuorumNotMetSecondaryReplicasDisappear primaryReplica(URI primaryReplica) { - this.primary = primaryReplica; - return this; - } - - public QuorumNotMetSecondaryReplicasDisappear secondaryReplicasDisappearWhen(URI secondary, - Function2WithCheckedException disappearPredicate) { - disappearDictionary.put(secondary, disappearPredicate); - return this; - } - - public QuorumNotMetSecondaryReplicasDisappear secondaryReplicasDisappearAfter(URI secondary, int attempt) { - disappearDictionary.put(secondary, (i, r) -> i >= attempt); - return this; - } - } - - static public class NoSecondaryReplica extends Builder { - private long LOCAL_LSN = 19; - private long LSN = 52; - private URI defaultPrimaryURI = URI.create("primary"); - private URI primary = defaultPrimaryURI; - private StoreResponse defaultResponse = StoreResponseBuilder.create() - .withLSN(LSN) - .withLocalLSN(LOCAL_LSN) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, "1") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, Long.toString(LSN)) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(LOCAL_LSN)) - .withRequestCharge(0) - .build(); - - private StoreResponse headStoreResponse = defaultResponse; - private StoreResponse readStoreResponse = defaultResponse; - private Function1WithCheckedException storeResponseFunc; - - public NoSecondaryReplica primaryReplica(URI primaryReplica) { - this.primary = primaryReplica; - return this; - } - - public NoSecondaryReplica response(StoreResponse storeResponse) { - this.readStoreResponse = storeResponse; - this.headStoreResponse = storeResponse; - return this; - } - - public NoSecondaryReplica response(Function1WithCheckedException storeResponseFunc) { - this.storeResponseFunc = storeResponseFunc; - return this; - } - - public EndpointMock build() { - - TransportClientWrapper.Builder.ReplicaResponseBuilder transportClientWrapperBuilder = TransportClientWrapper.Builder.replicaResponseBuilder(); - - ImmutableList replicas = ImmutableList.builder().add(primary).build(); - - for(URI replica: replicas) { - transportClientWrapperBuilder.addReplica(replica, (i, request) -> { - - if (storeResponseFunc != null) { - return storeResponseFunc.apply(request); - } - - if (request.getOperationType() == OperationType.Head || request.getOperationType() == OperationType.HeadFeed) { - return headStoreResponse; - } else { - return readStoreResponse; - } - }); - } - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create().withPrimary(primary) - .withSecondary(ImmutableList.of()).build(); - - return new EndpointMock(addressSelectorWrapper, transportClientWrapperBuilder.build()) {}; - } - } - - static public class NoSecondaryReplica_TwoSecondaryReplicasGoLiveAfterFirstHitOnPrimary extends Builder { - private long LOCAL_LSN = 19; - private long LSN = 52; - private URI primary = URI.create("primary"); - private ImmutableList secondaryReplicas = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2")); - private StoreResponse primaryDefaultResponse = StoreResponseBuilder.create() - .withLSN(LSN) - .withLocalLSN(LOCAL_LSN) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, "3") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, Long.toString(LSN)) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(LOCAL_LSN)) - .withRequestCharge(0) - .build(); - - private StoreResponse secondaryDefaultResponse = StoreResponseBuilder.create() - .withLSN(LSN) - .withLocalLSN(LOCAL_LSN) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, Long.toString(LSN)) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(LOCAL_LSN)) - .withRequestCharge(0) - .build(); - Map> secondaryResponseFunc = - new HashMap<>(); - - - public NoSecondaryReplica_TwoSecondaryReplicasGoLiveAfterFirstHitOnPrimary primaryReplica(URI primaryReplica) { - this.primary = primaryReplica; - return this; - } - - public NoSecondaryReplica_TwoSecondaryReplicasGoLiveAfterFirstHitOnPrimary responseFromSecondary( - URI replica, - Function1WithCheckedException func) { - secondaryResponseFunc.put(replica, func); - return this; - } - - public EndpointMock build() { - - TransportClientWrapper.Builder.ReplicaResponseBuilder transportClientWrapperBuilder = TransportClientWrapper.Builder.replicaResponseBuilder(); - - transportClientWrapperBuilder.addReplica(primary, (i, request) -> { - return primaryDefaultResponse; - }); - - transportClientWrapperBuilder.addReplica(secondaryReplicas.get(0), (i, request) -> { - return secondaryDefaultResponse; - }); - - transportClientWrapperBuilder.addReplica(secondaryReplicas.get(1), (i, request) -> { - return secondaryDefaultResponse; - }); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create().withPrimary(primary) - .withSecondary(ImmutableList.of()).build(); - - return new EndpointMock(addressSelectorWrapper, transportClientWrapperBuilder.build()){}; - } - } - - public abstract EndpointMock build() ; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ExceptionBuilder.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ExceptionBuilder.java deleted file mode 100644 index d73c90350fb1..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ExceptionBuilder.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; - -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class ExceptionBuilder { - private Integer status; - private List> headerEntries; - private String message; - - public static ExceptionBuilder create() { - return new ExceptionBuilder(); - } - - public ExceptionBuilder() { - headerEntries = new ArrayList<>(); - } - - public ExceptionBuilder withHeader(String key, String value) { - headerEntries.add(new AbstractMap.SimpleEntry(key, value)); - return this; - } - - public ExceptionBuilder withStatus(int status) { - this.status = status; - return this; - } - - public ExceptionBuilder withMessage(String message) { - this.message = message; - return this; - } - - public GoneException asGoneException() { - assert status == null; - GoneException dce = new GoneException(); - dce.getResponseHeaders().putAll(headerEntries.stream().collect(Collectors.toMap(i -> i.getKey(), i -> i.getValue()))); - return dce; - } - - public InvalidPartitionException asInvalidPartitionException() { - assert status == null; - InvalidPartitionException dce = new InvalidPartitionException(); - dce.getResponseHeaders().putAll(headerEntries.stream().collect(Collectors.toMap(i -> i.getKey(), i -> i.getValue()))); - return dce; - } - - public PartitionKeyRangeGoneException asPartitionKeyRangeGoneException() { - assert status == null; - PartitionKeyRangeGoneException dce = new PartitionKeyRangeGoneException(); - dce.getResponseHeaders().putAll(headerEntries.stream().collect(Collectors.toMap(i -> i.getKey(), i -> i.getValue()))); - return dce; - } - - - public PartitionKeyRangeIsSplittingException asPartitionKeyRangeIsSplittingException() { - assert status == null; - PartitionKeyRangeIsSplittingException dce = new PartitionKeyRangeIsSplittingException(); - dce.getResponseHeaders().putAll(headerEntries.stream().collect(Collectors.toMap(i -> i.getKey(), i -> i.getValue()))); - return dce; - } - - public PartitionIsMigratingException asPartitionIsMigratingException() { - assert status == null; - PartitionIsMigratingException dce = new PartitionIsMigratingException(); - dce.getResponseHeaders().putAll(headerEntries.stream().collect(Collectors.toMap(i -> i.getKey(), i -> i.getValue()))); - return dce; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function1WithCheckedException.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function1WithCheckedException.java deleted file mode 100644 index 3e55f35763fe..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function1WithCheckedException.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -@FunctionalInterface -public interface Function1WithCheckedException{ - - R apply(T t) throws Exception; - -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function2WithCheckedException.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function2WithCheckedException.java deleted file mode 100644 index 093ce601fcfe..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function2WithCheckedException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -@FunctionalInterface -public interface Function2WithCheckedException{ - R apply(T1 t1, T2 t2) throws Exception; - -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java deleted file mode 100644 index 0b536d36c740..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.ReplicationPolicy; -import org.mockito.Mockito; -import rx.Single; - -public class GatewayServiceConfiguratorReaderMock { - - public GatewayServiceConfigurationReader gatewayServiceConfigurationReader; - - public static GatewayServiceConfiguratorReaderMock from(ConsistencyLevel accountConsistencyLevel) { - return new GatewayServiceConfiguratorReaderMock(new ReplicationPolicy("{}"), new ReplicationPolicy("{}"), accountConsistencyLevel); - } - - public static GatewayServiceConfiguratorReaderMock from(ConsistencyLevel accountConsistencyLevel, - int systemMaxReplicaCount, - int systemMinReplicaCount, - int userMaxReplicaCount, - int userMinReplicaCount) { - ReplicationPolicy userRP = Mockito.mock(ReplicationPolicy.class); - Mockito.doReturn(userMaxReplicaCount).when(userRP).getMaxReplicaSetSize(); - Mockito.doReturn(userMinReplicaCount).when(userRP).getMinReplicaSetSize(); - - ReplicationPolicy systemRP = Mockito.mock(ReplicationPolicy.class); - Mockito.doReturn(systemMaxReplicaCount).when(systemRP).getMaxReplicaSetSize(); - Mockito.doReturn(systemMinReplicaCount).when(systemRP).getMinReplicaSetSize(); - - return new GatewayServiceConfiguratorReaderMock(userRP, systemRP, accountConsistencyLevel); - } - - public static GatewayServiceConfiguratorReaderMock from(ConsistencyLevel accountConsistencyLevel, int maxReplicaSize, int minReplicaCase) { - ReplicationPolicy rp = Mockito.mock(ReplicationPolicy.class); - Mockito.doReturn(maxReplicaSize).when(rp).getMaxReplicaSetSize(); - Mockito.doReturn(minReplicaCase).when(rp).getMinReplicaSetSize(); - - return new GatewayServiceConfiguratorReaderMock(rp, rp, accountConsistencyLevel); - } - - - public GatewayServiceConfiguratorReaderMock(ReplicationPolicy userReplicationPolicy, - ReplicationPolicy systemReplicationPolicy, - ConsistencyLevel defaultConsistencyLevel) { - this.gatewayServiceConfigurationReader = Mockito.mock(GatewayServiceConfigurationReader.class); - - Mockito.doReturn(Single.just(Mockito.mock(DatabaseAccount.class))).when(this.gatewayServiceConfigurationReader).initializeReaderAsync(); - Mockito.doReturn(defaultConsistencyLevel).when(this.gatewayServiceConfigurationReader).getDefaultConsistencyLevel(); - Mockito.doReturn(systemReplicationPolicy).when(this.gatewayServiceConfigurationReader).getSystemReplicationPolicy(); - Mockito.doReturn(userReplicationPolicy).when(this.gatewayServiceConfigurationReader).getUserReplicationPolicy(); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicyTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicyTest.java deleted file mode 100644 index b9895fe301b7..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicyTest.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.testng.annotations.Test; -import rx.Single; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This test file will cover various exception on GoneAndRetryWithRetryPolicy. - * - */ -public class GoneAndRetryWithRetryPolicyTest { - protected static final int TIMEOUT = 60000; - - /** - * Retry with GoneException , retried 4 times and verified the returned - * shouldRetryResult. ShouldRetryResult - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void shouldRetryWithGoneException() { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); - Single singleShouldRetry = goneAndRetryWithRetryPolicy - .shouldRetry(new GoneException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue0()).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue3()).isEqualTo(1); - assertThat(shouldRetryResult.backOffTime.getSeconds()).isEqualTo(0); - - singleShouldRetry = goneAndRetryWithRetryPolicy.shouldRetry(new GoneException()); - shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue0()).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue3()).isEqualTo(2); - assertThat(shouldRetryResult.backOffTime.getSeconds()).isEqualTo(1); - - singleShouldRetry = goneAndRetryWithRetryPolicy.shouldRetry(new GoneException()); - shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue0()).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue3()).isEqualTo(3); - assertThat(shouldRetryResult.backOffTime.getSeconds()).isEqualTo(2); - - singleShouldRetry = goneAndRetryWithRetryPolicy.shouldRetry(new GoneException()); - shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue0()).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue3()).isEqualTo(4); - assertThat(shouldRetryResult.backOffTime.getSeconds()).isEqualTo(4); - - } - - /** - * Retry with PartitionIsMigratingException - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void shouldRetryWithPartitionIsMigratingException() { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); - Single singleShouldRetry = goneAndRetryWithRetryPolicy - .shouldRetry(new PartitionIsMigratingException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(request.forceCollectionRoutingMapRefresh).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue0()).isTrue(); - } - - /** - * Retry with InvalidPartitionException - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void shouldRetryWithInvalidPartitionException() { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); - Single singleShouldRetry = goneAndRetryWithRetryPolicy - .shouldRetry(new InvalidPartitionException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(request.requestContext.quorumSelectedLSN).isEqualTo(-1); - assertThat(request.requestContext.resolvedPartitionKeyRange).isNull(); - assertThat(request.requestContext.globalCommittedSelectedLSN).isEqualTo(-1); - assertThat(shouldRetryResult.policyArg.getValue0()).isFalse(); - - goneAndRetryWithRetryPolicy.shouldRetry(new InvalidPartitionException()); - // It will retry max till 3 attempts - shouldRetryResult = goneAndRetryWithRetryPolicy.shouldRetry(new InvalidPartitionException()).toBlocking() - .value(); - assertThat(shouldRetryResult.shouldRetry).isFalse(); - DocumentClientException clientException = (DocumentClientException) shouldRetryResult.exception; - assertThat(clientException.getStatusCode()).isEqualTo(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE); - - } - - /** - * Retry with PartitionKeyRangeIsSplittingException - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void shouldRetryWithPartitionKeyRangeIsSplittingException() { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); - Single singleShouldRetry = goneAndRetryWithRetryPolicy - .shouldRetry(new PartitionKeyRangeIsSplittingException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(request.forcePartitionKeyRangeRefresh).isTrue(); - assertThat(request.requestContext.resolvedPartitionKeyRange).isNull(); - assertThat(request.requestContext.quorumSelectedLSN).isEqualTo(-1); - assertThat(shouldRetryResult.policyArg.getValue0()).isFalse(); - - } - - /** - * No retry on bad request exception - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void shouldRetryWithGenericException() { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); - Single singleShouldRetry = goneAndRetryWithRetryPolicy - .shouldRetry(new BadRequestException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isFalse(); - } - -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientMockWrapper.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientMockWrapper.java deleted file mode 100644 index f456424a0319..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientMockWrapper.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.ByteBufUtil; -import io.netty.handler.codec.http.DefaultHttpHeaders; -import io.netty.handler.codec.http.DefaultHttpResponse; -import io.netty.handler.codec.http.HttpHeaders; -import io.netty.handler.codec.http.HttpResponse; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.handler.codec.http.HttpVersion; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import rx.Observable; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.TimeUnit; - -public class HttpClientMockWrapper { - public static HttpClientBehaviourBuilder httpClientBehaviourBuilder() { - return new HttpClientBehaviourBuilder(); - } - - public static class HttpClientBehaviourBuilder { - private int status; - private String content; - private HttpHeaders httpHeaders = new DefaultHttpHeaders(); - private Exception networkFailure; - - public HttpClientBehaviourBuilder withNetworkFailure(Exception networkFailure) { - this.networkFailure = networkFailure; - return this; - } - - public HttpClientBehaviourBuilder withStatus(int status) { - this.status = status; - return this; - } - - public HttpClientBehaviourBuilder withHeaders(HttpHeaders httpHeaders) { - this.httpHeaders = httpHeaders; - return this; - } - - public HttpClientBehaviourBuilder withHeaders(String... pairs) { - if (pairs.length % 2 != 0) { - throw new IllegalArgumentException(); - } - - for(int i = 0; i < pairs.length/ 2; i++) { - this.httpHeaders.add(pairs[2*i], pairs[2*i +1]); - } - - return this; - } - - public HttpClientBehaviourBuilder withContent(String content) { - this.content = content; - return this; - } - - public HttpClientBehaviourBuilder withHeaderLSN(long lsn) { - this.httpHeaders.add(WFConstants.BackendHeaders.LSN, Long.toString(lsn)); - return this; - } - - public HttpClientBehaviourBuilder withHeaderPartitionKeyRangeId(String partitionKeyRangeId) { - this.httpHeaders.add(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId); - return this; - } - - public HttpClientBehaviourBuilder withHeaderSubStatusCode(int subStatusCode) { - this.httpHeaders.add(WFConstants.BackendHeaders.SUB_STATUS, Integer.toString(subStatusCode)); - return this; - } - - public HttpClientResponse asHttpClientResponse() { - if (this.networkFailure != null) { - return null; - } - - HttpClientResponse resp = Mockito.mock(HttpClientResponse.class); - Mockito.doReturn(HttpResponseStatus.valueOf(status)).when(resp).getStatus(); - Mockito.doReturn(Observable.just(ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, content))).when(resp).getContent(); - - DefaultHttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.valueOf(status), httpHeaders); - - try { - Constructor constructor = HttpResponseHeaders.class.getDeclaredConstructor(HttpResponse.class); - constructor.setAccessible(true); - HttpResponseHeaders httpResponseHeaders = constructor.newInstance(httpResponse); - Mockito.doReturn(httpResponseHeaders).when(resp).getHeaders(); - - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - - return resp; - } - - public Exception asNetworkFailure() { - return this.networkFailure; - } - - @Override - public String toString() { - return "HttpClientBehaviourBuilder{" + - "status=" + status + - ", content='" + content + '\'' + - ", httpHeaders=" + httpHeaders + - ", networkFailure=" + networkFailure + - '}'; - } - } - - private final CompositeHttpClient httpClient; - private final List, RxClient.ServerInfo>> requests = Collections.synchronizedList(new ArrayList<>()); - - public HttpClientMockWrapper(long responseAfterMillis, HttpClientResponse httpClientResponse) { - this(responseAfterMillis, httpClientResponse, null); - } - - private static Observable> httpClientResponseOrException(HttpClientResponse httpClientResponse, Exception e) { - assert ((httpClientResponse != null && e == null) || (httpClientResponse == null && e != null)); - return httpClientResponse != null ? Observable.just(httpClientResponse) : Observable.error(e); - } - - public HttpClientMockWrapper(long responseAfterMillis, Exception e) { - this(responseAfterMillis, null, e); - } - - public HttpClientMockWrapper(HttpClientResponse httpClientResponse) { - this(0, httpClientResponse); - } - - private HttpClientMockWrapper(long responseAfterMillis, final HttpClientResponse httpClientResponse, final Exception e) { - httpClient = Mockito.mock(CompositeHttpClient.class); - assert httpClientResponse == null || e == null; - - Mockito.doAnswer(new Answer() { - @Override - public Observable> answer(InvocationOnMock invocationOnMock) throws Throwable { - RxClient.ServerInfo serverInfo = invocationOnMock.getArgumentAt(0, RxClient.ServerInfo.class); - HttpClientRequest req = invocationOnMock.getArgumentAt(1, HttpClientRequest.class); - - requests.add(new ImmutablePair<>(req, serverInfo)); - - if (responseAfterMillis <= 0) { - return httpClientResponseOrException(httpClientResponse, e); - } else { - return Observable.timer(responseAfterMillis, TimeUnit.MILLISECONDS).flatMap(t -> httpClientResponseOrException(httpClientResponse, e)); - } - } - }).when(httpClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class)); - } - - public HttpClientMockWrapper(HttpClientBehaviourBuilder builder) { - this(0, builder.asHttpClientResponse(), builder.asNetworkFailure()); - } - - public HttpClientMockWrapper(Exception e) { - this(0, e); - } - - public CompositeHttpClient getClient() { - return httpClient; - } - - public List, RxClient.ServerInfo>> getCapturedInvocation() { - return requests; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClientTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClientTest.java deleted file mode 100644 index f4ca18efd052..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClientTest.java +++ /dev/null @@ -1,641 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ConnectTimeoutException; -import io.netty.handler.codec.http.EmptyHttpHeaders; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.assertj.core.api.Assertions; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.net.URI; -import java.net.UnknownHostException; -import java.util.HashMap; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -/** - * Tests validating {@link HttpTransportClient} - */ -public class HttpTransportClientTest { - private final static Configs configs = new Configs(); - private final static int TIMEOUT = 1000; - - private final URI physicalAddress = URI.create( - "https://by4prdddc03-docdb-1.documents.azure.com:9056" + - "/apps/b76af614-5421-4318-4c9e-33056ff5a2bf/services/e7c8d429-c379-40c9-9486-65b89b70be2f" + - "/partitions/5f5b8766-3bdf-4713-b85a-a55ac2ccd62c/replicas/131828696163674404p/"); - - private final long lsn = 5; - private final String partitionKeyRangeId = "3"; - - @Test(groups = "unit") - public void getResourceFeedUri_Document() throws Exception { - RxDocumentServiceRequest req = RxDocumentServiceRequest.createFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document); - URI res = HttpTransportClient.getResourceFeedUri(req.getResourceType(), physicalAddress, req); - assertThat(res.toString()).isEqualTo(physicalAddress.toString() + HttpUtils.urlEncode("dbs/db/colls/col/docs")); - } - - @Test(groups = "unit") - public void getResourceFeedUri_Attachment() throws Exception { - RxDocumentServiceRequest req = RxDocumentServiceRequest.createFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Attachment); - URI res = HttpTransportClient.getResourceFeedUri(req.getResourceType(), physicalAddress, req); - assertThat(res.toString()).isEqualTo(physicalAddress.toString() + HttpUtils.urlEncode("dbs/db/colls/col/attachments")); - } - - @Test(groups = "unit") - public void getResourceFeedUri_Collection() throws Exception { - RxDocumentServiceRequest req = RxDocumentServiceRequest.createFromName( - OperationType.Create, "dbs/db", ResourceType.DocumentCollection); - URI res = HttpTransportClient.getResourceFeedUri(req.getResourceType(), physicalAddress, req); - assertThat(res.toString()).isEqualTo(physicalAddress.toString() + HttpUtils.urlEncode("dbs/db/colls")); - } - - @Test(groups = "unit") - public void getResourceFeedUri_Conflict() throws Exception { - RxDocumentServiceRequest req = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col", ResourceType.Conflict); - URI res = HttpTransportClient.getResourceFeedUri(req.getResourceType(), physicalAddress, req); - assertThat(res.toString()).isEqualTo(physicalAddress.toString() + HttpUtils.urlEncode("dbs/db/colls/col/conflicts")); - } - - @Test(groups = "unit") - public void getResourceFeedUri_Database() throws Exception { - RxDocumentServiceRequest req = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/", ResourceType.Database); - URI res = HttpTransportClient.getResourceFeedUri(req.getResourceType(), physicalAddress, req); - assertThat(res.toString()).isEqualTo(physicalAddress.toString() + "dbs"); - } - - public static HttpTransportClient getHttpTransportClientUnderTest(int requestTimeout, - UserAgentContainer userAgent, - CompositeHttpClient httpClient) { - class HttpTransportClientUnderTest extends HttpTransportClient { - public HttpTransportClientUnderTest(int requestTimeout, UserAgentContainer userAgent) { - super(configs, requestTimeout, userAgent); - } - - @Override - CompositeHttpClient createHttpClient(int requestTimeout) { - return httpClient; - } - } - - return new HttpTransportClientUnderTest(requestTimeout, userAgent); - } - - @Test(groups = "unit") - public void validateDefaultHeaders() { - HttpClientResponse mockedResponse = new HttpClientMockWrapper.HttpClientBehaviourBuilder() - .withContent("").withStatus(200) - .withHeaders(EmptyHttpHeaders.INSTANCE) - .asHttpClientResponse(); - HttpClientMockWrapper httpClientMockWrapper = new HttpClientMockWrapper(mockedResponse); - - UserAgentContainer userAgentContainer = new UserAgentContainer(); - userAgentContainer.setSuffix("i am suffix"); - - HttpTransportClient transportClient = getHttpTransportClientUnderTest(100, - userAgentContainer, - httpClientMockWrapper.getClient()); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document); - request.setContentBytes(new byte[0]); - - transportClient.invokeStoreAsync(physicalAddress, - new ResourceOperation(OperationType.Create, ResourceType.Document), - request).toBlocking().value(); - - assertThat(httpClientMockWrapper.getCapturedInvocation()).asList().hasSize(1); - ImmutablePair, RxClient.ServerInfo> httpClientInvocation = httpClientMockWrapper.getCapturedInvocation().get(0); - - assertThat(httpClientInvocation.left.getHeaders().get(HttpConstants.HttpHeaders.USER_AGENT)).endsWith("i am suffix"); - assertThat(httpClientInvocation.left.getHeaders().get(HttpConstants.HttpHeaders.CACHE_CONTROL)).isEqualTo("no-cache"); - assertThat(httpClientInvocation.left.getHeaders().get(HttpConstants.HttpHeaders.ACCEPT)).isEqualTo("application/json"); - assertThat(httpClientInvocation.left.getHeaders().get(HttpConstants.HttpHeaders.VERSION)).isEqualTo(HttpConstants.Versions.CURRENT_VERSION); - - } - - @DataProvider(name = "fromMockedHttpResponseToExpectedDocumentClientException") - public Object[][] fromMockedHttpResponseToExpectedDocumentClientException() { - return new Object[][]{ - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(401) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(UnauthorizedException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(403) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(ForbiddenException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(404) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(NotFoundException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(404) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaders(HttpConstants.HttpHeaders.CONTENT_TYPE, "text/html"), - - FailureValidator.builder() - .instanceOf(GoneException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(400) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(BadRequestException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(405) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(MethodNotAllowedException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(409) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(ConflictException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(412) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(PreconditionFailedException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(412) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(PreconditionFailedException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(413) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(RequestEntityTooLargeException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(423) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(LockedException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(503) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(ServiceUnavailableException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(408) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(RequestTimeoutException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(449) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(RetryWithException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(429) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(RequestRateTooLargeException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(500) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(InternalServerErrorException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(410) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaderSubStatusCode(HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE), - - FailureValidator.builder() - .instanceOf(InvalidPartitionException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(410) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaderSubStatusCode(HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE), - - FailureValidator.builder() - .instanceOf(PartitionKeyRangeGoneException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(410) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaderSubStatusCode(HttpConstants.SubStatusCodes.COMPLETING_SPLIT), - - FailureValidator.builder() - .instanceOf(PartitionKeyRangeIsSplittingException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(410) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaderSubStatusCode(HttpConstants.SubStatusCodes.COMPLETING_PARTITION_MIGRATION), - - FailureValidator.builder() - .instanceOf(PartitionIsMigratingException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(410) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaderSubStatusCode(0), - - FailureValidator.builder() - .instanceOf(GoneException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - }; - } - - /** - * Validates the error handling behaviour of HttpTransportClient for https status codes >= 400 - * @param mockedResponseBuilder - * @param failureValidatorBuilder - */ - @Test(groups = "unit", dataProvider = "fromMockedHttpResponseToExpectedDocumentClientException") - public void failuresWithHttpStatusCodes(HttpClientMockWrapper.HttpClientBehaviourBuilder mockedResponseBuilder, - FailureValidator.Builder failureValidatorBuilder) { - HttpClientMockWrapper httpClientMockWrapper = new HttpClientMockWrapper(mockedResponseBuilder); - UserAgentContainer userAgentContainer = new UserAgentContainer(); - HttpTransportClient transportClient = getHttpTransportClientUnderTest( - 100, - userAgentContainer, - httpClientMockWrapper.getClient()); - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document); - request.setContentBytes(new byte[0]); - - Single storeResp = transportClient.invokeStoreAsync( - physicalAddress, - new ResourceOperation(OperationType.Create, ResourceType.Document), - request); - - validateFailure(storeResp, failureValidatorBuilder.build()); - } - - @DataProvider(name = "fromMockedNetworkFailureToExpectedDocumentClientException") - public Object[][] fromMockedNetworkFailureToExpectedDocumentClientException() { - return new Object[][]{ - // create request, retriable network exception - { - createRequestFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new UnknownHostException()), - - FailureValidator.builder() - .instanceOf(GoneException.class) - }, - - // create request, retriable network exception - { - createRequestFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new UnknownHostException()), - - FailureValidator.builder() - .instanceOf(GoneException.class) - }, - - // create request, retriable network exception - { - createRequestFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new ConnectTimeoutException()), - - FailureValidator.builder() - .instanceOf(GoneException.class) - }, - - // read request, retriable network exception - { - createRequestFromName( - OperationType.Read, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new ConnectTimeoutException()), - - FailureValidator.builder() - .instanceOf(GoneException.class) - }, - - // create request, non-retriable network exception - { - createRequestFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new RuntimeException()), - - FailureValidator.builder() - .instanceOf(ServiceUnavailableException.class) - }, - - // read request, non-retriable network exception - { - createRequestFromName( - OperationType.Read, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new RuntimeException()), - - FailureValidator.builder() - .instanceOf(GoneException.class) - }, - }; - } - - /** - * Validates the error handling behaviour of HttpTransportClient for network failures from which http status codes - * cannot be derived. For example Socket Connection failure. - * @param request - * @param mockedResponseBuilder - * @param failureValidatorBuilder - */ - @Test(groups = "unit", dataProvider = "fromMockedNetworkFailureToExpectedDocumentClientException") - public void networkFailures(RxDocumentServiceRequest request, - HttpClientMockWrapper.HttpClientBehaviourBuilder mockedResponseBuilder, - FailureValidator.Builder failureValidatorBuilder) { - HttpClientMockWrapper httpClientMockWrapper = new HttpClientMockWrapper(mockedResponseBuilder); - UserAgentContainer userAgentContainer = new UserAgentContainer(); - HttpTransportClient transportClient = getHttpTransportClientUnderTest( - 100, - userAgentContainer, - httpClientMockWrapper.getClient()); - - Single storeResp = transportClient.invokeStoreAsync( - physicalAddress, - new ResourceOperation(OperationType.Create, ResourceType.Document), - request); - - validateFailure(storeResp, failureValidatorBuilder.build()); - } - - private static RxDocumentServiceRequest createRequestFromName( - OperationType operationType, - String resourceFullName, - ResourceType resourceType) { - return createRequestFromName(operationType, resourceFullName, resourceType, new byte[0]); - } - - private static RxDocumentServiceRequest createRequestFromName( - OperationType operationType, - String resourceFullName, - ResourceType resourceType, - byte[] content) { - RxDocumentServiceRequest req = RxDocumentServiceRequest.create( - operationType, - resourceType, - resourceFullName, - new HashMap<>()); - - req.setContentBytes(content); - return req; - } - - public void validateSuccess(Single single, StoreResponseValidator validator) { - validateSuccess(single, validator, TIMEOUT); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator, long timeout) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public void validateFailure(Single single, - FailureValidator validator) { - validateFailure(single, validator, TIMEOUT); - } - - public static void validateFailure(Single single, - FailureValidator validator, long timeout) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - Assertions.assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MultiStoreResultValidator.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MultiStoreResultValidator.java deleted file mode 100644 index 3b948d992ba4..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MultiStoreResultValidator.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.base.Predicates; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import org.apache.commons.lang3.mutable.MutableObject; -import org.assertj.core.description.Description; -import org.assertj.core.description.TextDescription; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.BiFunction; -import java.util.function.Predicate; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.fail; - -/** - * this is meant to be used when there reading multiple replicas for the same thing - */ -public interface MultiStoreResultValidator { - - static Builder create() { - return new Builder(); - } - - void validate(List storeResults); - - class Builder { - private List validators = new ArrayList<>(); - - public MultiStoreResultValidator build() { - return new MultiStoreResultValidator() { - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public void validate(List storeResults) { - for (MultiStoreResultValidator validator : validators) { - validator.validate(storeResults); - } - } - }; - } - - public Builder validateEachWith(StoreResultValidator storeResultValidator) { - validators.add(new MultiStoreResultValidator() { - - @Override - public void validate(List storeResults) { - for(StoreResult srr: storeResults) { - storeResultValidator.validate(srr); - } - } - }); - return this; - } - - public Builder validateEachWith(StoreResponseValidator storeResponseValidator) { - validators.add(new MultiStoreResultValidator() { - - @Override - public void validate(List storeResults) { - for(StoreResult srr: storeResults) { - try { - storeResponseValidator.validate(srr.toResponse()); - } catch (DocumentClientException e) { - fail(e.getMessage()); - } - } - } - }); - return this; - } - - public Builder withMinimumLSN(long minimumLSN) { - this.validateEachWith(StoreResultValidator.create().withMinLSN(minimumLSN).build()); - return this; - } - - public Builder withAggregate(BiFunction aggregator, - T initialValue, - Predicate finalValuePredicate, - Description description) { - MutableObject total = new MutableObject<>(initialValue); - validators.add(new MultiStoreResultValidator() { - - @Override - public void validate(List storeResults) { - for(StoreResult srr: storeResults) { - total.setValue(aggregator.apply(srr, total.getValue())); - } - - assertThat(finalValuePredicate.test(total.getValue())) - .describedAs(Description.mostRelevantDescription(description, - String.format("actual value %s.", - total.getValue().toString()))) - .isTrue(); - } - }); - return this; - } - - public Builder withTotalRequestCharge(double totalExpectedRC) { - this.withAggregate((srr, v) -> srr.requestCharge + v.doubleValue(), - 0d, - Predicates.equalTo(totalExpectedRC), - new TextDescription("total request charge is expected to be %f", totalExpectedRC)); - return this; - } - - public Builder withNonZeroRequestCharge() { - - this.withAggregate((srr, v) -> srr.requestCharge + v.doubleValue(), - 0d, - aDouble -> aDouble > 0, - new TextDescription("total request charge expected to be greater than 0")); - return this; - } - - public Builder validateEachWith(FailureValidator failureValidator) { - validators.add(new MultiStoreResultValidator() { - - @Override - public void validate(List storeResults) { - for(StoreResult srr: storeResults) { - try { - failureValidator.validate(srr.getException()); - } catch (DocumentClientException e) { - fail(e.getMessage()); - } - } - } - }); - return this; - } - - public Builder noFailure() { - this.validateEachWith(StoreResultValidator.create().isValid().noException().build()); - return this; - } - - public Builder withSize(int expectedNumber) { - validators.add(new MultiStoreResultValidator() { - - @Override - public void validate(List storeResults) { - assertThat(storeResults).hasSize(expectedNumber); - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MurmurHash3_32Test.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MurmurHash3_32Test.java deleted file mode 100644 index 0e8e01b2baa5..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MurmurHash3_32Test.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.hash.HashFunction; -import com.google.common.hash.Hashing; -import com.microsoft.azure.cosmosdb.internal.routing.MurmurHash3_32; -import org.apache.commons.lang3.RandomUtils; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import java.io.UnsupportedEncodingException; -import java.nio.charset.Charset; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * validates {@link MurmurHash3_32} against Google's murmur3_32 implementation. - */ -public class MurmurHash3_32Test { - - private MurmurHash3_32 murmurHash3_32; - - @BeforeClass(groups = "unit") - public void setup() { - murmurHash3_32 = new MurmurHash3_32(); - } - - @Test(groups = "unit") - public void murmurHash3_32_EmptyByteArray() { - byte[] byteArray = new byte[0]; - int actualHash = murmurHash3_32.hash(byteArray, byteArray.length, 0); - - HashFunction googleMurmur3_32 = Hashing.murmur3_32(0); - int expectedHash = googleMurmur3_32.hashBytes(byteArray).asInt(); - - assertThat(actualHash).isEqualTo(expectedHash); - } - - @Test(groups = "unit") - public void murmurHash3_32_String() { - byte[] byteArray = new String("test").getBytes(Charset.forName("UTF-8")); - int actualHash = murmurHash3_32.hash(byteArray, byteArray.length, 0); - - HashFunction googleMurmur3_32 = Hashing.murmur3_32(0); - int expectedHash = googleMurmur3_32.hashBytes(byteArray).asInt(); - - assertThat(actualHash).isEqualTo(expectedHash); - } - - @Test(groups = "unit") - public void murmurHash3_32_NonLatin() throws UnsupportedEncodingException { - String nonLatin = "абвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюя"; - for(int i = 0; i < nonLatin.length() + 1; i++) { - byte[] byteArray = nonLatin.substring(0, i).getBytes("UTF-8"); - int actualHash = murmurHash3_32.hash(byteArray, byteArray.length, 0); - - HashFunction googleMurmur3_32 = Hashing.murmur3_32(0); - int expectedHash = googleMurmur3_32.hashBytes(byteArray).asInt(); - - assertThat(actualHash).isEqualTo(expectedHash); - } - } - - @Test(groups = "unit") - public void murmurHash3_32_ZeroByteArray() { - byte[] byteArray = new byte[3]; - int actualHash = murmurHash3_32.hash(byteArray, byteArray.length, 0); - - HashFunction googleMurmur3_32 = Hashing.murmur3_32(0); - int expectedHash = googleMurmur3_32.hashBytes(byteArray).asInt(); - - assertThat(actualHash).isEqualTo(expectedHash); - } - - @Test(groups = "unit") - public void murmurHash3_32_RandomBytesOfAllSizes() { - for(int i = 0; i < 1000; i++) { - byte[] byteArray = randomBytes(i); - - int actualHash = murmurHash3_32.hash(byteArray, byteArray.length, 0); - - HashFunction googleMurmur3_32 = Hashing.murmur3_32(0); - int expectedHash = googleMurmur3_32.hashBytes(byteArray).asInt(); - - assertThat(actualHash).isEqualTo(expectedHash); - } - } - - private byte[] randomBytes(int count) { - return RandomUtils.nextBytes(count); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyInternalTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyInternalTest.java deleted file mode 100644 index 46d72c3e5b66..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyInternalTest.java +++ /dev/null @@ -1,473 +0,0 @@ -/* - * - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.microsoft.azure.cosmosdb.CommonsBridgeInternal; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKind; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalUtils; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.functions.Func2; - -import java.util.ArrayList; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.fail; - -public class PartitionKeyInternalTest { - - /** - * Tests serialization of empty partition key. - */ - @Test(groups="unit") - public void emptyPartitionKey() { - String json = "[]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey).isEqualTo(PartitionKeyInternal.getEmpty()); - assertThat(partitionKey.toJson()).isEqualTo("[]"); - } - - /** - * Tests serialization of various types. - */ - @Test(groups="unit") - public void variousTypes() { - String json = "[\"aa\", null, true, false, {}, 5, 5.5]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey).isEqualTo( - PartitionKeyInternal.fromObjectArray( - Lists.newArrayList(new Object[]{"aa", null, true, false, Undefined.Value(), 5, 5.5}), true)); - - assertThat(partitionKey.toJson()).isEqualTo("[\"aa\",null,true,false,{},5.0,5.5]"); - } - - /** - * Tests deserialization of empty string - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void deserializeEmptyString() { - PartitionKeyInternal.fromJsonString(""); - } - - /** - * Tests deserialization of null - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void deserializeNull() { - PartitionKeyInternal.fromJsonString(null); - } - - /** - * Tests deserialization of invalid partition key - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void invalidString() { - PartitionKeyInternal.fromJsonString("[aa]"); - } - - - /** - * Tests deserialization of invalid partition key - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void invalidNumber() { - PartitionKeyInternal.fromJsonString("[1.a]"); - } - - /** - * Tests deserialization of invalid partition key - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void missingBraces() { - PartitionKeyInternal.fromJsonString("[{]"); - } - - /** - * Missing Value - */ - @Test(groups = "unit") - public void missingValue() { - try { - PartitionKeyInternal.fromJsonString(""); - fail("should throw"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isEqualTo( - String.format( - RMResources.UnableToDeserializePartitionKeyValue, "")); - } - } - - /** - * Tests serialization of infinity value. - */ - @Test(groups = "unit") - public void maxValue() { - String json = "\"Infinity\""; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey).isEqualTo(PartitionKeyInternal.ExclusiveMaximum); - } - - /** - * Tests serialization of minimum value. - */ - @Test(groups = "unit") - public void minValue() { - String json = "[]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey).isEqualTo(PartitionKeyInternal.InclusiveMinimum); - } - - /** - * Tests serialization of undefined value. - */ - @Test(groups = "unit") - public void undefinedValue() { - String json = "[]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey).isEqualTo(PartitionKeyInternal.Empty); - } - - /** - * Tests JsonConvert.DefaultSettings that could cause indentation. - */ - @Test(groups="unit") - public void jsonConvertDefaultSettings() { - String json = "[123.0]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey.toJson()).isEqualTo(json); - } - - /** - * Tests unicode characters in partition key - */ - @Test(groups="unit") - public void unicodeCharacters() { - String json = "[\"电脑\"]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey.toJson()).isEqualTo("[\"\u7535\u8111\"]"); - } - - /** - * Tests partition key value comparisons. - */ - @Test(groups="unit") - public void comparison() { - verifyComparison("[]", "[]", 0); - verifyComparison("[]", "[{}]", -1); - verifyComparison("[]", "[false]", -1); - verifyComparison("[]", "[true]", -1); - verifyComparison("[]", "[null]", -1); - verifyComparison("[]", "[2]", -1); - verifyComparison("[]", "[\"aa\"]", -1); - verifyComparison("[]", "\"Infinity\"", -1); - - verifyComparison("[{}]", "[]", 1); - verifyComparison("[{}]", "[{}]", 0); - verifyComparison("[{}]", "[false]", -1); - verifyComparison("[{}]", "[true]", -1); - verifyComparison("[{}]", "[null]", -1); - verifyComparison("[{}]", "[2]", -1); - verifyComparison("[{}]", "[\"aa\"]", -1); - verifyComparison("[{}]", "\"Infinity\"", -1); - - verifyComparison("[false]", "[]", 1); - verifyComparison("[false]", "[{}]", 1); - verifyComparison("[false]", "[null]", 1); - verifyComparison("[false]", "[false]", 0); - verifyComparison("[false]", "[true]", -1); - verifyComparison("[false]", "[2]", -1); - verifyComparison("[false]", "[\"aa\"]", -1); - verifyComparison("[false]", "\"Infinity\"", -1); - - verifyComparison("[true]", "[]", 1); - verifyComparison("[true]", "[{}]", 1); - verifyComparison("[true]", "[null]", 1); - verifyComparison("[true]", "[false]", 1); - verifyComparison("[true]", "[true]", 0); - verifyComparison("[true]", "[2]", -1); - verifyComparison("[true]", "[\"aa\"]", -1); - verifyComparison("[true]", "\"Infinity\"", -1); - - verifyComparison("[null]", "[]", 1); - verifyComparison("[null]", "[{}]", 1); - verifyComparison("[null]", "[null]", 0); - verifyComparison("[null]", "[false]", -1); - verifyComparison("[null]", "[true]", -1); - verifyComparison("[null]", "[2]", -1); - verifyComparison("[null]", "[\"aa\"]", -1); - verifyComparison("[null]", "\"Infinity\"", -1); - - verifyComparison("[2]", "[]", 1); - verifyComparison("[2]", "[{}]", 1); - verifyComparison("[2]", "[null]", 1); - verifyComparison("[2]", "[false]", 1); - verifyComparison("[2]", "[true]", 1); - verifyComparison("[1]", "[2]", -1); - verifyComparison("[2]", "[2]", 0); - verifyComparison("[3]", "[2]", 1); - verifyComparison("[2.1234344]", "[2]", 1); - verifyComparison("[2]", "[\"aa\"]", -1); - verifyComparison("[2]", "\"Infinity\"", -1); - - verifyComparison("[\"aa\"]", "[]", 1); - verifyComparison("[\"aa\"]", "[{}]", 1); - verifyComparison("[\"aa\"]", "[null]", 1); - verifyComparison("[\"aa\"]", "[false]", 1); - verifyComparison("[\"aa\"]", "[true]", 1); - verifyComparison("[\"aa\"]", "[2]", 1); - verifyComparison("[\"\"]", "[\"aa\"]", -1); - verifyComparison("[\"aa\"]", "[\"aa\"]", 0); - verifyComparison("[\"b\"]", "[\"aa\"]", 1); - verifyComparison("[\"aa\"]", "\"Infinity\"", -1); - - verifyComparison("\"Infinity\"", "[]", 1); - verifyComparison("\"Infinity\"", "[{}]", 1); - verifyComparison("\"Infinity\"", "[null]", 1); - verifyComparison("\"Infinity\"", "[false]", 1); - verifyComparison("\"Infinity\"", "[true]", 1); - verifyComparison("\"Infinity\"", "[2]", 1); - verifyComparison("\"Infinity\"", "[\"aa\"]", 1); - verifyComparison("\"Infinity\"", "\"Infinity\"", 0); - } - - /** - * Tests that invalid partition key value will throw an exception. - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void invalidPartitionKeyValue() { - PartitionKeyInternal.fromObjectArray( - Lists.newArrayList(new Object[]{2, true, new StringBuilder()}), true); - } - - /** - * Tests {@link PartitionKeyInternal#contains(PartitionKeyInternal)} method. - */ - @Test(groups="unit") - public void contains() { - Func2 verifyContains = (parentPartitionKey, childPartitionKey) -> - PartitionKeyInternal.fromJsonString(parentPartitionKey) - .contains(PartitionKeyInternal.fromJsonString(childPartitionKey)); - - assertThat(verifyContains.call("[]", "[]")).isTrue(); - assertThat(verifyContains.call("[]", "[{}]")).isTrue(); - assertThat(verifyContains.call("[]", "[null]")).isTrue(); - assertThat(verifyContains.call("[]", "[true]")).isTrue(); - assertThat(verifyContains.call("[]", "[false]")).isTrue(); - assertThat(verifyContains.call("[]", "[2]")).isTrue(); - assertThat(verifyContains.call("[]", "[\"fdfd\"]")).isTrue(); - - assertThat(verifyContains.call("[2]", "[]")).isFalse(); - assertThat(verifyContains.call("[2]", "[2]")).isTrue(); - assertThat(verifyContains.call("[2]", "[2, \"USA\"]")).isTrue(); - assertThat(verifyContains.call("[1]", "[2, \"USA\"]")).isFalse(); - } - - @Test(groups="unit") - public void invalidPartitionKeyValueNonStrict() { - assertThat(PartitionKeyInternal.fromObjectArray(new Object[]{2, true, Undefined.Value()}, true)) - .isEqualTo( - PartitionKeyInternal.fromObjectArray(new Object[]{2, true, new StringBuilder()}, false)); - } - - /** - * Tests constructing effective partition key value. - */ - @Test(groups="unit") - public void hashEffectivePartitionKey() { - - assertThat(PartitionKeyInternalHelper.getEffectivePartitionKeyString(PartitionKeyInternal.InclusiveMinimum, new PartitionKeyDefinition())) - .isEqualTo(PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey); - - assertThat( - PartitionKeyInternalHelper.getEffectivePartitionKeyString(PartitionKeyInternal.ExclusiveMaximum, new PartitionKeyDefinition())) - .isEqualTo(PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey); - - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - partitionKeyDefinition.setPaths(Lists.newArrayList("/A", "/B", "/C", "/E", "/F", "/G")); - - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromObjectArray( - new Object[]{2, true, false, null, Undefined.Value(), "Привет!"}, true); - String effectivePartitionKey = PartitionKeyInternalHelper.getEffectivePartitionKeyString(partitionKey, partitionKeyDefinition); - - assertThat(effectivePartitionKey).isEqualTo("05C1D19581B37C05C0000302010008D1A0D281D1B9D1B3D1B6D2832200"); - } - - @DataProvider(name = "v2ParamProvider") - public Object[][] v2ParamProvider() { - return new Object[][] { - {"[5.0]", "19C08621B135968252FB34B4CF66F811"}, - { "[5.12312419050912359123]", "0EF2E2D82460884AF0F6440BE4F726A8"}, - {"[\"redmond\"]", "22E342F38A486A088463DFF7838A5963"}, - {"[true]", "0E711127C5B5A8E4726AC6DD306A3E59"}, - {"[false]", "2FE1BE91E90A3439635E0E9E37361EF2"}, - {"[]", ""}, - {"[null]", "378867E4430E67857ACE5C908374FE16"}, - {"[{}]", "11622DAA78F835834610ABE56EFF5CB5"}, - {"[5.0, \"redmond\", true, null]", "3032DECBE2AB1768D8E0AEDEA35881DF"}, - {"[\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"]", - "36375D21568760E891C9CB7002D5E059"}, - }; - } - - /** - * Tests binary encoding of partition key - */ - @Test(groups="unit", dataProvider = "v2ParamProvider") - public void partitionKeyBinaryEncodingV2(String partitionKeyRangeJson, String expectedHexEncoding) { - validateEffectivePartitionKeyV2(partitionKeyRangeJson, expectedHexEncoding); - } - - /** - * Tests that effective partition key produced by us and the backend is the same. - */ - @Test(groups="unit") - public void managedNativeCompatibility() { - PartitionKeyInternal partitionKey = - PartitionKeyInternal.fromJsonString("[\"по-русски\",null,true,false,{},5.5]"); - - PartitionKeyDefinition pkDefinition = new PartitionKeyDefinition(); - pkDefinition.setPaths(ImmutableList.of("/field1", "/field2", "/field3", "/field4", "/field5", "/field6")); - - String effectivePartitionKey = PartitionKeyInternalHelper.getEffectivePartitionKeyString(partitionKey, pkDefinition); - assertThat("05C1D39FA55F0408D1C0D1BF2ED281D284D282D282D1BBD1B9000103020005C016").isEqualTo(effectivePartitionKey); - - String latin = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"; - String nonLatin = "абвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюя"; - - verifyEffectivePartitionKeyEncoding(latin, 99, "05C19B2DC38FC00862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F7071727374757600", false); - verifyEffectivePartitionKeyEncoding(latin, 99, "072D8FA3228DD2A6C0A7129C845700E6", true); - - verifyEffectivePartitionKeyEncoding(latin, 100, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 100, "023D5F0B62EBEF22A43564F267193B4D", true); - - verifyEffectivePartitionKeyEncoding(latin, 101, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 101, "357D83181DB32D35F58CDA3C9F2E0742", true); - - verifyEffectivePartitionKeyEncoding(latin, 102, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 102, "12B320F72959AB449FD8E090C6B23B88", true); - - verifyEffectivePartitionKeyEncoding(latin, 103, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 103, "25FD21A31C69A8C8AD994F7FAC2B2B9F", true); - - verifyEffectivePartitionKeyEncoding(latin, 104, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 104, "1DC6FB1CF6E1228C506AA6C8735023C4", true); - - verifyEffectivePartitionKeyEncoding(latin, 105, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 105, "308E1E7870956CE5D9BDAD01200E09BD", true); - - verifyEffectivePartitionKeyEncoding(latin, 106, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 106, "362E21ABDEA7179DBDF7BF549DD8303B", true); - - verifyEffectivePartitionKeyEncoding(latin, 107, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 107, "1EBE932ECEFA4F53CE339D31B6BF53FD", true); - - verifyEffectivePartitionKeyEncoding(latin, 108, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 108, "3BFA3A6E9CBABA0EF756AEDEC66B1B3C", true); - - verifyEffectivePartitionKeyEncoding(latin, 109, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 109, "2880BF78DE0CE2CD1B0120EDA22601C4", true); - - verifyEffectivePartitionKeyEncoding(latin, 110, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 110, "1F3577D1D9CA7FC56100AED11F4DC646", true); - - verifyEffectivePartitionKeyEncoding(latin, 111, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 111, "205A9EB61F3B063E61C6ED655C9220E6", true); - - verifyEffectivePartitionKeyEncoding(latin, 112, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 112, "1152A43F1A852AFDDD4518C9CDD48616", true); - - verifyEffectivePartitionKeyEncoding(latin, 113, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 113, "38E2EB2EF54012B5CA40CDA34F1C7736", true); - - verifyEffectivePartitionKeyEncoding(latin, 114, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 114, "19BCC416843B9085DBBC18E8C7C80D72", true); - - verifyEffectivePartitionKeyEncoding(latin, 115, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 115, "03F1BB89FD8E9747B047281E80FA2E84", true); - - verifyEffectivePartitionKeyEncoding(latin, 116, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 116, "2BA0757B833F3922A3CBBB6DDA3803B4", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 49, "05C1C1BD37FE08D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BF00", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 49, "3742C1AF65AFA809282539F4BCDF2F6F", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 50, "05C1B339EF472008D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C000", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 50, "399CF1F141E066E09CC7557EA7F0977A", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 51, "05C1EB1F29DBFA08D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D2", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 51, "2D63C2F5FDAC6EFE5660CD509A723A90", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 99, "05C1E72F79C71608D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D2", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 99, "1E9836D9BCB67FDB2B5C984BD40AFAF9", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 100, "05C1E3653D9F3E08D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D2", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 100, "16102F19448867537E51BB4377962AF9", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 101, "05C1E3653D9F3E08D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D2", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 101, "0B6D25D07748AB9CA0F523D4BAD146C8", true); - } - - private static void validateEffectivePartitionKeyV2(String partitionKeyRangeJson, String expectedHexEncoding) { - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(partitionKeyRangeJson); - - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - partitionKeyDefinition.setKind(PartitionKind.Hash); - CommonsBridgeInternal.setV2(partitionKeyDefinition); - ArrayList paths = new ArrayList(); - for (int i = 0; i < partitionKey.getComponents().size(); i++) { - paths.add("/path" + i); - } - - if (paths.size() > 0) { - partitionKeyDefinition.setPaths(paths); - } - - String hexEncodedEffectivePartitionKey = PartitionKeyInternalHelper.getEffectivePartitionKeyString(partitionKey, partitionKeyDefinition); - assertThat(hexEncodedEffectivePartitionKey).isEqualTo(expectedHexEncoding); - } - - private void verifyComparison(String leftKey, String rightKey, int result) { - assertThat(PartitionKeyInternal.fromJsonString(leftKey). - compareTo(PartitionKeyInternal.fromJsonString(rightKey))).isEqualTo(result); - } - - private static void verifyEffectivePartitionKeyEncoding(String buffer, int length, String expectedValue, boolean v2) { - PartitionKeyDefinition pkDefinition = new PartitionKeyDefinition(); - pkDefinition.setPaths(ImmutableList.of("/field1")); - if (v2) { - CommonsBridgeInternal.setV2(pkDefinition); - } - - PartitionKeyInternal pk = PartitionKeyInternalUtils.createPartitionKeyInternal(buffer.substring(0, length)); - assertThat(PartitionKeyInternalHelper.getEffectivePartitionKeyString(pk, pkDefinition)).isEqualTo(expectedValue); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyTest.java deleted file mode 100644 index 31164b31156c..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.fail; - -public class PartitionKeyTest { - - @DataProvider(name = "paramProvider") - public Object[][] paramProvider() { - return new Object[][] { - { Undefined.Value(), "[{}]" }, - { null, "[null]"}, - { false, "[false]"}, - { true, "[true]"}, - { 123.456, "[123.456]"}, - { 5, "[5.0]"}, - { "PartitionKeyValue", "[\"PartitionKeyValue\"]"}, - }; - } - - /** - * Simple test for @{@link PartitionKey}. - */ - @Test(groups = "unit", dataProvider = "paramProvider") - public void partitionKey(Object partitionKey, String partitionKeyAsJson) { - assertThat(new PartitionKey(partitionKey).toString()).isEqualTo(partitionKeyAsJson); - } - - /** - * Test equals override for @{@link PartitionKey} - */ - @Test(groups = "unit", dataProvider = "paramProvider") - public void partitionKeyCompare(Object partitionKey, String partitionKeyAsJson) { - assertThat(new PartitionKey(partitionKey)).isEqualTo(PartitionKey.FromJsonString(partitionKeyAsJson)); - } - - /** - * too few partition key values. - */ - @Test(groups = "unit") - public void tooFewPartitionKeyComponents() { - PartitionKeyDefinition pkd = new PartitionKeyDefinition(); - pkd.setPaths(ImmutableList.of("/pk1", "/pk2")); - PartitionKey pk = PartitionKey.FromJsonString("[\"PartitionKeyValue\"]"); - - try { - PartitionKeyInternalHelper.getEffectivePartitionKeyString(pk.getInternalPartitionKey(), pkd); - fail("should throw"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isEqualTo(RMResources.TooFewPartitionKeyComponents); - } - } - - /** - * too many partition key values. - */ - @Test(groups = "unit") - public void tooManyPartitionKeyComponents() { - PartitionKeyDefinition pkd = new PartitionKeyDefinition(); - pkd.setPaths(ImmutableList.of("/pk1")); - PartitionKey pk = PartitionKey.FromJsonString("[true, false]"); - - try { - PartitionKeyInternalHelper.getEffectivePartitionKeyString(pk.getInternalPartitionKey(), pkd); - fail("should throw"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isEqualTo(RMResources.TooManyPartitionKeyComponents); - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReaderTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReaderTest.java deleted file mode 100644 index cff71c20577a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReaderTest.java +++ /dev/null @@ -1,677 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.base.Stopwatch; -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.DocumentServiceRequestContextValidator; -import com.microsoft.azure.cosmosdb.rx.DocumentServiceRequestValidator; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.mockito.Mockito; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.net.URI; -import java.time.Duration; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; - -public class QuorumReaderTest { - private final Duration timeResolution = Duration.ofMillis(10); - private final Configs configs; - - public QuorumReaderTest() { - configs = new Configs(); - } - - @DataProvider(name = "simpleReadStrongArgProvider") - public Object[][] simpleReadStrongArgProvider() { - return new Object[][]{ - //int replicaCountToRead, ReadMode readMode, Long lsn, Long localLSN - { 1, ReadMode.Strong, 51l, 18l }, - { 2, ReadMode.Strong, 51l, 18l }, - { 3, ReadMode.Strong, 51l, 18l }, - - { 2, ReadMode.Any, 51l, 18l }, - { 1, ReadMode.Any, 51l, 18l }, - - { 2, ReadMode.Any, null, 18l }, - { 1, ReadMode.Any, null, 18l }, - }; - } - - private StoreResponse storeResponse(Long lsn, Long localLSN, Double rc) { - StoreResponseBuilder srb = StoreResponseBuilder.create(); - if (rc != null) { - srb.withRequestCharge(rc); - } - - if (lsn != null) { - srb.withLSN(lsn); - } - - if (localLSN != null) { - srb.withLocalLSN(localLSN); - } - - return srb.build(); - } - - @Test(groups = "unit", dataProvider = "simpleReadStrongArgProvider") - public void basicReadStrong_AllReplicasSameLSN(int replicaCountToRead, ReadMode readMode, Long lsn, Long localLSN) { - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2"), URI.create("secondary3")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - BigDecimal requestChargePerRead = new BigDecimal(1.1); - - StoreResponse primaryResponse = storeResponse(lsn, localLSN, requestChargePerRead.doubleValue()); - StoreResponse secondaryResponse1 = storeResponse(lsn, localLSN, requestChargePerRead.doubleValue()); - StoreResponse secondaryResponse2 = storeResponse(lsn, localLSN, requestChargePerRead.doubleValue()); - StoreResponse secondaryResponse3 = storeResponse(lsn, localLSN, requestChargePerRead.doubleValue()); - - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryReplicaURI, OperationType.Read, ResourceType.Document, primaryResponse, false) - .storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, false) - .storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, false) - .storeResponseOn(secondaryReplicaURIs.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, false) - .build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - QuorumReader quorumReader = new QuorumReader(configs, transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, storeReader, serviceConfigurator, authTokenProvider); - - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - StoreResponseValidator.Builder validatorBuilder = StoreResponseValidator.create() - .withBELocalLSN(localLSN) - .withRequestCharge(requestChargePerRead.multiply(BigDecimal.valueOf(replicaCountToRead)).setScale(2, RoundingMode.FLOOR).doubleValue()); - - if (lsn != null) { - validatorBuilder.withBELSN(lsn); - } - - validateSuccess(storeResponseSingle, validatorBuilder.build()); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(replicaCountToRead); - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1); - } - - @DataProvider(name = "readStrong_RequestBarrierArgProvider") - public Object[][] readStrong_RequestBarrierArgProvider() { - return new Object[][]{ - { 1 }, - { 2 }, - { configs.getMaxNumberOfReadBarrierReadRetries() - 1 }, - { configs.getMaxNumberOfReadBarrierReadRetries() }, - }; - } - - @Test(groups = "unit", dataProvider = "readStrong_RequestBarrierArgProvider") - public void readStrong_OnlySecondary_RequestBarrier_Success(int numberOfBarrierRequestTillCatchUp) { - // scenario: we get lsn l1, l2 where l1 > l2 - // we do barrier request and send it to all replicas till we have two replicas with at least l1 lsn - - ReadMode readMode = ReadMode.Strong; - int replicaCountToRead = 2; - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - BigDecimal requestChargePerRead = new BigDecimal(1.1); - BigDecimal requestChargePerHead = BigDecimal.ZERO; - - long expectedQuorumLsn = 53; - long expectedQuorumLocalLSN = 20; - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 2) - .withLocalLSN(expectedQuorumLocalLSN - 2) - .withRequestCharge(requestChargePerRead) - .build(); - - TransportClientWrapper.Builder.UriToResultBuilder builder = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryReplicaURI, OperationType.Read, ResourceType.Document, primaryResponse, false); - - // slow replica - StoreResponse readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1) - .withLocalLSN(expectedQuorumLocalLSN -1) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, readResponse, false); - - for(int i = 0; i < numberOfBarrierRequestTillCatchUp; i++) { - int lsnIncrement = (i == numberOfBarrierRequestTillCatchUp - 1) ? 1 : 0; - readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1 + lsnIncrement) - .withLocalLSN(expectedQuorumLocalLSN - 1 + lsnIncrement) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, readResponse, false); - - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1 + lsnIncrement) - .withLocalLSN(expectedQuorumLocalLSN - 1 + lsnIncrement) - .withRequestCharge(requestChargePerHead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Head, ResourceType.DocumentCollection, headResponse, false); - } - - // faster replica - readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn) - .withLocalLSN(expectedQuorumLocalLSN) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Read, ResourceType.Document, readResponse, false); - for(int i = 0; i < numberOfBarrierRequestTillCatchUp; i++) { - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn + 10 * (i + 1)) - .withLocalLSN(expectedQuorumLocalLSN + 10 * (i + 1)) - .withRequestCharge(requestChargePerHead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Head, ResourceType.DocumentCollection, headResponse, false); - } - - TransportClientWrapper transportClientWrapper = builder.build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - QuorumReader quorumReader = new QuorumReader(configs, transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, storeReader, serviceConfigurator, authTokenProvider); - - int expectedNumberOfReads = 2; - int expectedNumberOfHeads = 2 * numberOfBarrierRequestTillCatchUp; - - double expectedRequestCharge = requestChargePerRead.multiply(BigDecimal.valueOf(expectedNumberOfReads)).add( - requestChargePerHead.multiply(BigDecimal.valueOf(expectedNumberOfHeads))).setScale(4, RoundingMode.FLOOR).doubleValue(); - - Stopwatch stopwatch = Stopwatch.createStarted(); - - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(expectedQuorumLsn) - .withRequestCharge(expectedRequestCharge) - .build(); - - validateSuccess(storeResponseSingle, validator); - - assertThat(stopwatch.elapsed().plus(timeResolution)).isGreaterThanOrEqualTo(Duration.ofMillis( - numberOfBarrierRequestTillCatchUp * configs.getDelayBetweenReadBarrierCallsInMs())); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(expectedNumberOfReads + expectedNumberOfHeads); - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1 + numberOfBarrierRequestTillCatchUp); - - AddressSelectorWrapper.InOrderVerification.Verifier addressSelectorVerifier = AddressSelectorWrapper.InOrderVerification.Verifier.builder() - .resolveAllUriAsync_IncludePrimary(false) - .resolveAllUriAsync_ForceRefresh(false) - .build(); - - addressSelectorWrapper.getInOrderVerification() - .verifyNumberOfInvocations(1 + numberOfBarrierRequestTillCatchUp) - .verifyOnAll(addressSelectorVerifier); - - DocumentServiceRequestValidator requestValidator = DocumentServiceRequestValidator.builder() - .add(DocumentServiceRequestContextValidator.builder() - .qurorumSelectedLSN(0l) - .globalCommittedSelectedLSN(0l) - .storeResponses(null) - .build()) - .build(); - requestValidator.validate(request); - } - - @DataProvider(name = "readStrong_SecondaryReadBarrierExhausted_ReadBarrierOnPrimary_SuccessArgProvider") - public Object[][] readStrong_SecondaryReadBarrierExhausted_ReadBarrierOnPrimary_SuccessArgProvider() { - return new Object[][]{ - { 1 }, - { 2 }, - { configs.getMaxNumberOfReadBarrierReadRetries() - 1 }, - { configs.getMaxNumberOfReadBarrierReadRetries() }, - }; - } - - @Test(groups = "unit", dataProvider = "readStrong_SecondaryReadBarrierExhausted_ReadBarrierOnPrimary_SuccessArgProvider") - public void readStrong_SecondaryReadBarrierExhausted_ReadBarrierOnPrimary_Success(int numberOfHeadBarriersWithPrimaryIncludedTillQuorumMet) { - // scenario: we exhaust all barrier request retries on secondaries - // after that we start barrier requests including the primary - - int numberOfBarrierRequestTillCatchUp = configs.getMaxNumberOfReadBarrierReadRetries() + numberOfHeadBarriersWithPrimaryIncludedTillQuorumMet; - - ReadMode readMode = ReadMode.Strong; - int replicaCountToRead = 2; - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - BigDecimal requestChargePerRead = new BigDecimal(1.1); - BigDecimal requestChargePerHead = BigDecimal.ZERO; - - TransportClientWrapper.Builder.UriToResultBuilder builder = TransportClientWrapper.Builder.uriToResultBuilder(); - - long expectedQuorumLsn = 53; - long expectedQuorumLocalLSN = 20; - - for(int i = 0; i < numberOfHeadBarriersWithPrimaryIncludedTillQuorumMet; i++) { - int lsnIncrement = (i == numberOfHeadBarriersWithPrimaryIncludedTillQuorumMet - 1) ? 1 : 0; - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1 + lsnIncrement) - .withLocalLSN(expectedQuorumLocalLSN - 1 + lsnIncrement) - .withRequestCharge(requestChargePerHead) - .build(); - builder.storeResponseOn(primaryReplicaURI, OperationType.Head, ResourceType.DocumentCollection, headResponse, false); - } - - // slow replica - StoreResponse readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1) - .withLocalLSN(expectedQuorumLocalLSN - 1) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, readResponse, false); - - for(int i = 0; i < numberOfBarrierRequestTillCatchUp; i++) { - int lsnIncrement = (i == numberOfBarrierRequestTillCatchUp - 1) ? 1 : 0; - readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1 + lsnIncrement) - .withLocalLSN(expectedQuorumLocalLSN - 1 + lsnIncrement) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, readResponse, false); - - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1 + lsnIncrement) - .withLocalLSN(expectedQuorumLocalLSN - 1 + lsnIncrement) - .withRequestCharge(requestChargePerHead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Head, ResourceType.DocumentCollection, headResponse, false); - } - - // faster replica - readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn) - .withLocalLSN(expectedQuorumLocalLSN) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Read, ResourceType.Document, readResponse, false); - for(int i = 0; i < numberOfBarrierRequestTillCatchUp; i++) { - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn + 10 * (i + 1)) - .withLocalLSN(expectedQuorumLocalLSN + 10 * (i + 1)) - .withRequestCharge(requestChargePerHead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Head, ResourceType.DocumentCollection, headResponse, false); - } - - TransportClientWrapper transportClientWrapper = builder.build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - QuorumReader quorumReader = new QuorumReader(configs, transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, storeReader, serviceConfigurator, authTokenProvider); - - int beforeSecondariesRetriesExhausted_expectedNumberOfReads = 2; - int beforeSecondariesRetriesExhausted_expectedNumberOfHeads = 2 * configs.getMaxNumberOfReadBarrierReadRetries(); - - int numberOfHeadRetriesRequestWhenPrimaryIncluded = 3 * numberOfHeadBarriersWithPrimaryIncludedTillQuorumMet; - - double expectedRequestCharge = requestChargePerRead.multiply(BigDecimal.valueOf(beforeSecondariesRetriesExhausted_expectedNumberOfReads)) - .add(requestChargePerHead.multiply(BigDecimal.valueOf(beforeSecondariesRetriesExhausted_expectedNumberOfHeads))) - .setScale(4, RoundingMode.FLOOR).doubleValue(); - - Stopwatch stopwatch = Stopwatch.createStarted(); - - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(expectedQuorumLsn) - .withRequestCharge(expectedRequestCharge) - .build(); - - validateSuccess(storeResponseSingle, validator); - - assertThat(stopwatch.elapsed().plus(timeResolution)).isGreaterThanOrEqualTo(Duration.ofMillis( - numberOfBarrierRequestTillCatchUp * configs.getDelayBetweenReadBarrierCallsInMs())); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(beforeSecondariesRetriesExhausted_expectedNumberOfReads - + beforeSecondariesRetriesExhausted_expectedNumberOfHeads - + numberOfHeadRetriesRequestWhenPrimaryIncluded); - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1 + numberOfBarrierRequestTillCatchUp); - - AddressSelectorWrapper.InOrderVerification.Verifier primaryNotIncludedVerifier = AddressSelectorWrapper - .InOrderVerification.Verifier.builder() - .resolveAllUriAsync_IncludePrimary(false) - .resolveAllUriAsync_ForceRefresh(false) - .build(); - - AddressSelectorWrapper.InOrderVerification.Verifier primaryIncludedVerifier = AddressSelectorWrapper - .InOrderVerification.Verifier.builder() - .resolveAllUriAsync_IncludePrimary(true) - .resolveAllUriAsync_ForceRefresh(false) - .build(); - - int numberOfAddressResolutionWithoutPrimary = configs.getMaxNumberOfReadBarrierReadRetries()+ 1; - int numberOfAddressResolutionWithPrimary = 1; - - AddressSelectorWrapper.InOrderVerification ov = addressSelectorWrapper.getInOrderVerification(); - - for(int i = 0; i < numberOfAddressResolutionWithoutPrimary; i++) { - ov.verifyNext(primaryNotIncludedVerifier); - } - - for(int i = 0; i < numberOfAddressResolutionWithPrimary; i++) { - ov.verifyNext(primaryIncludedVerifier); - } - - DocumentServiceRequestValidator requestValidator = DocumentServiceRequestValidator.builder() - .add(DocumentServiceRequestContextValidator.builder() - .qurorumSelectedLSN(0l) - .globalCommittedSelectedLSN(0l) - .storeResponses(null) - .build()) - .build(); - requestValidator.validate(request); - } - - @Test(groups = "unit") - public void readStrong_QuorumNotSelected_ReadPrimary() { - // scenario: attempts to read from secondaries, - // only one secondary is available so ends in QuorumNotSelected State - // reads from Primary and succeeds - - ReadMode readMode = ReadMode.Strong; - int replicaCountToRead = 2; - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - BigDecimal requestChargePerRead = new BigDecimal(1.1); - BigDecimal requestChargePerHead = BigDecimal.ZERO; - - TransportClientWrapper.Builder.UriToResultBuilder builder = TransportClientWrapper.Builder.uriToResultBuilder(); - - long primaryLSN = 52; - long primaryLocalLSN = 19; - - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(primaryLSN) - .withLocalLSN(primaryLocalLSN) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, "2") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, Long.toString(primaryLSN)) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(primaryLocalLSN)) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(primaryReplicaURI, OperationType.Read, ResourceType.Document, headResponse, false); - - StoreResponse readResponse = StoreResponseBuilder.create() - .withLSN(primaryLSN) - .withLocalLSN(primaryLocalLSN) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, readResponse, false); - - TransportClientWrapper transportClientWrapper = builder.build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - QuorumReader quorumReader = new QuorumReader(configs, transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, storeReader, serviceConfigurator, authTokenProvider); - - double expectedRequestCharge = requestChargePerRead.multiply(BigDecimal.valueOf(1)) - .add(requestChargePerHead.multiply(BigDecimal.valueOf(0))) - .setScale(4, RoundingMode.FLOOR).doubleValue(); - - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(primaryLSN) - .withBELocalLSN(primaryLocalLSN) - .withRequestCharge(expectedRequestCharge) - .build(); - - validateSuccess(storeResponseSingle, validator); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(1); - - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(1) - .verifyTotalInvocations(2); - - AddressSelectorWrapper.InOrderVerification.Verifier primaryNotIncludedVerifier = AddressSelectorWrapper - .InOrderVerification.Verifier.builder() - .resolveAllUriAsync_IncludePrimary(false) - .resolveAllUriAsync_ForceRefresh(false) - .build(); - - AddressSelectorWrapper.InOrderVerification.Verifier resolvePrimaryVerifier = AddressSelectorWrapper - .InOrderVerification.Verifier.builder() - .resolvePrimaryUriAsync() - .build(); - - AddressSelectorWrapper.InOrderVerification ov = addressSelectorWrapper.getInOrderVerification(); - ov.verifyNext(primaryNotIncludedVerifier); - ov.verifyNext(resolvePrimaryVerifier); - - DocumentServiceRequestValidator requestValidator = DocumentServiceRequestValidator.builder() - .add(DocumentServiceRequestContextValidator.builder() - .qurorumSelectedLSN(0l) - .globalCommittedSelectedLSN(0l) - .storeResponses(null) - .build()) - .build(); - requestValidator.validate(request); - } - - @DataProvider(name = "readPrimaryArgProvider") - public Object[][] readPrimaryArgProvider() { - return new Object[][]{ - // endpoint, verifier for endpoint expected result, verifying the StoreResponse returned - { - EndpointMock.noSecondaryReplicaBuilder() - .response(StoreResponseBuilder.create() - .withLSN(52) - .withLocalLSN(19) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, "1") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, "19") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, "19") - .withRequestCharge(0) - .build()) - .build(), - - EndpointMock.EndpointMockVerificationBuilder.builder() - .withAddressSelectorValidation(AddressSelectorWrapper - .InOrderVerificationBuilder - .create() - .verifyNumberOfInvocations(2) - .verifyNext(AddressSelectorWrapper.InOrderVerification.Verifier.builder() - .resolveAllUriAsync_IncludePrimary(false) - .resolveAllUriAsync_ForceRefresh(false) - .build()) - .verifyNext(AddressSelectorWrapper.InOrderVerification.Verifier.builder() - .resolvePrimaryUriAsync() - .build())) - .withTransportClientValidation(TransportClientWrapper.TransportClientWrapperVerificationBuilder.create().verifyNumberOfInvocations(1)), - - StoreResponseValidator.create() - .withBELSN(52) - .build() - } - }; - } - - @Test(groups = "unit", dataProvider = "readPrimaryArgProvider") - public void readPrimary(EndpointMock endpointMock, - EndpointMock.EndpointMockVerificationBuilder verification, - StoreResponseValidator storeResponseValidator) { - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - - QuorumReader quorumReader = new QuorumReader(configs, endpointMock.transportClientWrapper.transportClient, - endpointMock.addressSelectorWrapper.addressSelector, - new StoreReader(endpointMock.transportClientWrapper.transportClient, - endpointMock.addressSelectorWrapper.addressSelector, - sessionContainer), - serviceConfigurator, - authTokenProvider); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - int replicaCountToRead = 1; - ReadMode readMode = ReadMode.Strong; - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - validateSuccess(storeResponseSingle, storeResponseValidator); - endpointMock.validate(verification); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator, - long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator, - long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicaAddressFactory.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicaAddressFactory.java deleted file mode 100644 index 472f9e19eb7d..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicaAddressFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import org.apache.commons.lang3.RandomStringUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -public class ReplicaAddressFactory { - private static String TEMPLATE = "https://by4prdddc03-docdb-1.documents.azure.com:9056" + - "/apps/%s/services/e7c8d429-c379-40c9-9486-65b89b70be2f" + - "/partitions/%s/replicas/%s/"; - - public static String createPartitionPhysicalURI(String partitionId, boolean isPrimary) { - return String.format(TEMPLATE, UUID.randomUUID(), partitionId, RandomStringUtils.randomNumeric(18) + (isPrimary ? "p" : "s")); - } - - public static String createPrimaryPhysicalURI(String partitionId) { - return createPartitionPhysicalURI(partitionId, true); - } - - public static String createSecondaryPhysicalURI(String partitionId) { - return createPartitionPhysicalURI(partitionId, false); - } - - public static AddressInformation createAddressInformation(String partitionId, boolean isPrimary, Protocol protocol) { - String loc = createPartitionPhysicalURI(partitionId, isPrimary); - return new AddressInformation(true, isPrimary, loc, protocol); - } - - public static List createPartitionAddressInformation(String partitionId, - boolean includePrimary, - int numberOfAllReplicas, - Protocol protocol) { - List addressInformationList = new ArrayList<>(); - for (boolean isPrimary = includePrimary; numberOfAllReplicas > 0; numberOfAllReplicas--) { - addressInformationList.add(createAddressInformation(partitionId, isPrimary, protocol)); - isPrimary = false; - } - - return addressInformationList; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientPartitionSplitTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientPartitionSplitTest.java deleted file mode 100644 index dfc26fef75a4..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientPartitionSplitTest.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.assertj.core.api.Assertions; -import org.mockito.Mockito; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.functions.Func1; -import rx.observers.TestSubscriber; - -import java.net.URI; -import java.util.List; -import java.util.concurrent.TimeUnit; - -public class ReplicatedResourceClientPartitionSplitTest { - protected static final int TIMEOUT = 120000; - - @DataProvider(name = "partitionIsSplittingArgProvider") - public Object[][] partitionIsSplittingArgProvider() { - return new Object[][]{ - // Consistency mode, number of partition splitting exception till split migration completes - { ConsistencyLevel.Eventual, 1}, - { ConsistencyLevel.Eventual, 2}, - { ConsistencyLevel.Eventual, Integer.MAX_VALUE }, // server side partition split operation never completes - }; - } - - @Test(groups = { "unit" }, dataProvider = "partitionIsSplittingArgProvider", timeOut = TIMEOUT) - public void partitionSplit_RefreshCache_Read(ConsistencyLevel consistencyLevel, int partitionIsSplitting) { - URI secondary1AddressBeforeMove = URI.create("secondary"); - URI secondary1AddressAfterMove = URI.create("secondaryNew"); - - URI primaryAddressBeforeMove = URI.create("primary"); - URI primaryAddressAfterMove = URI.create("primaryNew"); - - String partitionKeyRangeIdBeforeSplit = "1"; - String partitionKeyRangeIdAfterSplit = "2"; - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.ReplicaMoveBuilder.create(Protocol.Https) - .withPrimaryMove(primaryAddressBeforeMove, primaryAddressAfterMove) - .withSecondaryMove(secondary1AddressBeforeMove, secondary1AddressAfterMove) - .newPartitionKeyRangeIdOnRefresh(r -> partitionKeyRangeWithId(partitionKeyRangeIdAfterSplit)) - .build(); - - long lsn = 54; - long localLsn = 18; - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withLSN(lsn) - .withLocalLSN(localLsn) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(localLsn)) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, partitionKeyRangeIdAfterSplit) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse1 = StoreResponseBuilder.create() - .withLSN(lsn) - .withLocalLSN(localLsn) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(localLsn)) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, partitionKeyRangeIdAfterSplit) - .withRequestCharge(1.1) - .build(); - - TransportClientWrapper.Builder.UriToResultBuilder transportClientWrapperBuilder = TransportClientWrapper.Builder.uriToResultBuilder(); - - PartitionKeyRangeIsSplittingException splittingException = new PartitionKeyRangeIsSplittingException(); - if (partitionIsSplitting == Integer.MAX_VALUE) { - transportClientWrapperBuilder - .exceptionOn(primaryAddressBeforeMove, OperationType.Read, ResourceType.Document, splittingException, true) - .exceptionOn(secondary1AddressBeforeMove, OperationType.Read, ResourceType.Document, splittingException, true); - } else { - for (int i = 0; i < partitionIsSplitting; i++) { - transportClientWrapperBuilder - .exceptionOn(primaryAddressBeforeMove, OperationType.Read, ResourceType.Document, splittingException, false) - .exceptionOn(secondary1AddressBeforeMove, OperationType.Read, ResourceType.Document, splittingException, false); - } - } - - GoneException goneException = new GoneException(); - transportClientWrapperBuilder - .exceptionOn(primaryAddressBeforeMove, OperationType.Read, ResourceType.Document, goneException, true) - .exceptionOn(secondary1AddressBeforeMove, OperationType.Read, ResourceType.Document, goneException, true) - .storeResponseOn(primaryAddressAfterMove, OperationType.Read, ResourceType.Document, secondaryResponse1, true) - .storeResponseOn(secondary1AddressAfterMove, OperationType.Read, ResourceType.Document, primaryResponse, true); - - - TransportClientWrapper transportClientWrapper = transportClientWrapperBuilder.build(); - - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - 4, - 3, - 4, - 3); - - SessionContainer sessionContainer = new SessionContainer("test"); - - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ReplicatedResourceClient resourceClient = new ReplicatedResourceClient(new Configs(), - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authorizationTokenProvider, - false, - false); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeIdBeforeSplit); - request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, consistencyLevel.name()); - - Func1> prepareRequestAsyncDelegate = null; - Single storeResponseObs = resourceClient.invokeAsync(request, prepareRequestAsyncDelegate); - - if (partitionIsSplitting < Integer.MAX_VALUE) { - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(lsn) - .withRequestCharge(1.1) - .build(); - validateSuccess(storeResponseObs, validator); - - addressSelectorWrapper.verifyNumberOfForceCacheRefreshGreaterThanOrEqualTo(1); - } else { - FailureValidator validator = FailureValidator.builder().instanceOf(DocumentClientException.class) - .statusCode(503).build(); - validateFailure(storeResponseObs, validator, TIMEOUT); - } - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator) { - validateSuccess(single, validator, TIMEOUT); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator, long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator) { - validateSuccess(single, validator, TIMEOUT); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - - public static void validateFailure(Single single, FailureValidator validator, long timeout) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - Assertions.assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - private PartitionKeyRange partitionKeyRangeWithId(String id) { - PartitionKeyRange partitionKeyRange = Mockito.mock(PartitionKeyRange.class); - Mockito.doReturn(id).when(partitionKeyRange).getId(); - return partitionKeyRange; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientTest.java deleted file mode 100644 index 55c8c4c6da04..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.assertj.core.api.Assertions; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.util.concurrent.TimeUnit; - -public class ReplicatedResourceClientTest { - protected static final int TIMEOUT = 60000; - private IAddressResolver addressResolver; - private TransportClient transportClient; - private boolean enableReadRequestsFallback; - public boolean forceAddressRefresh; - private GatewayServiceConfigurationReader serviceConfigReader; - private IAuthorizationTokenProvider authorizationTokenProvider; - - @BeforeClass(groups = "unit") - public void setup() throws Exception { - addressResolver = Mockito.mock(IAddressResolver.class); - transportClient = Mockito.mock(TransportClient.class); - serviceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - } - - /** - * This test will verify that Gone exception will be retired - * fixed number of time before throwing error. - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void invokeAsyncWithGoneException() { - Configs configs = new Configs(); - ReplicatedResourceClient resourceClient = new ReplicatedResourceClient(configs, new AddressSelector(addressResolver, Protocol.Https), null, - transportClient, serviceConfigReader, authorizationTokenProvider, enableReadRequestsFallback, false); - FailureValidator validator = FailureValidator.builder().instanceOf(DocumentClientException.class).build(); - RxDocumentServiceRequest request = Mockito.spy(RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document)); - - Mockito.when(addressResolver.resolveAsync(Matchers.any(), Matchers.anyBoolean())) - .thenReturn(Single.error(new GoneException())); - Single response = resourceClient.invokeAsync(request, null); - - validateFailure(response, validator, TIMEOUT); - //method will fail 7 time (first try ,last try , and 5 retries within 30 sec(1,2,4,8,15 wait)) - Mockito.verify(addressResolver, Mockito.times(7)).resolveAsync(Matchers.any(), Matchers.anyBoolean()); - } - - public static void validateFailure(Single single, FailureValidator validator, long timeout) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - Assertions.assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClientTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClientTest.java deleted file mode 100644 index 0bdb62448466..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClientTest.java +++ /dev/null @@ -1,914 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.BaseAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.Paths; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdContext; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdContextNegotiator; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdContextRequest; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdEndpoint; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestArgs; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestEncoder; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestManager; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestRecord; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestTimer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdResponseDecoder; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdUUID; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.ChannelHandler; -import io.netty.channel.embedded.EmbeddedChannel; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.ssl.SslContext; -import io.netty.handler.ssl.SslContextBuilder; -import org.apache.commons.lang3.StringUtils; -import org.assertj.core.api.Assertions; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.Subscriber; -import rx.observers.TestSubscriber; - -import java.net.ConnectException; -import java.net.URI; -import java.time.Duration; -import java.util.Arrays; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.TimeUnit; -import java.util.stream.Stream; - -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.HttpHeaders; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.HttpMethods; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -public final class RntbdTransportClientTest { - - private static final Logger logger = LoggerFactory.getLogger(RntbdTransportClientTest.class); - private static final int lsn = 5; - private static final ByteBuf noContent = Unpooled.wrappedBuffer(new byte[0]); - private static final String partitionKeyRangeId = "3"; - private static final URI physicalAddress = URI.create("rntbd://host:10251/replica-path/"); - private static final Duration requestTimeout = Duration.ofSeconds(1000); - - @DataProvider(name = "fromMockedNetworkFailureToExpectedDocumentClientException") - public Object[][] fromMockedNetworkFailureToExpectedDocumentClientException() { - - return new Object[][] { - }; - } - - @DataProvider(name = "fromMockedRntbdResponseToExpectedDocumentClientException") - public Object[][] fromMockedRntbdResponseToExpectedDocumentClientException() { - - return new Object[][] { - { - // 1 BadRequestException - - FailureValidator.builder() - .instanceOf(BadRequestException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 400, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 2 UnauthorizedException - - FailureValidator.builder() - .instanceOf(UnauthorizedException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 401, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 3 ForbiddenException - - FailureValidator.builder() - .instanceOf(ForbiddenException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 403, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 4 NotFoundException - - FailureValidator.builder() - .instanceOf(NotFoundException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 404, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 5 MethodNotAllowedException - - FailureValidator.builder() - .instanceOf(MethodNotAllowedException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 405, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 6 RequestTimeoutException - - FailureValidator.builder() - .instanceOf(RequestTimeoutException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 408, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 7 ConflictException - - FailureValidator.builder() - .instanceOf(ConflictException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 409, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 8 InvalidPartitionException - - FailureValidator.builder() - .instanceOf(InvalidPartitionException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 410, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId, - HttpHeaders.SUB_STATUS, Integer.toString(SubStatusCodes.NAME_CACHE_IS_STALE) - ), - noContent) - }, - { - // 9 PartitionKeyRangeGoneException - - FailureValidator.builder() - .instanceOf(PartitionKeyRangeGoneException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 410, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId, - HttpHeaders.SUB_STATUS, Integer.toString(SubStatusCodes.PARTITION_KEY_RANGE_GONE) - ), - noContent) - }, - { - // 10 PartitionKeyRangeIsSplittingException - - FailureValidator.builder() - .instanceOf(PartitionKeyRangeIsSplittingException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 410, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId, - HttpHeaders.SUB_STATUS, Integer.toString(SubStatusCodes.COMPLETING_SPLIT) - ), - noContent) - }, - { - // 11 PartitionIsMigratingException - - FailureValidator.builder() - .instanceOf(PartitionIsMigratingException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 410, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId, - HttpHeaders.SUB_STATUS, Integer.toString(SubStatusCodes.COMPLETING_PARTITION_MIGRATION) - ), - noContent) - }, - { - // 12 GoneException - - FailureValidator.builder() - .instanceOf(GoneException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 410, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId, - HttpHeaders.SUB_STATUS, String.valueOf(SubStatusCodes.UNKNOWN)), - noContent) - }, - { - // 13 PreconditionFailedException - - FailureValidator.builder() - .instanceOf(PreconditionFailedException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 412, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 14 RequestEntityTooLargeException - - FailureValidator.builder() - .instanceOf(RequestEntityTooLargeException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 413, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 15 LockedException - - FailureValidator.builder() - .instanceOf(LockedException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 423, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 16 RequestRateTooLargeException - - FailureValidator.builder() - .instanceOf(RequestRateTooLargeException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 429, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 17 RetryWithException - - FailureValidator.builder() - .instanceOf(RetryWithException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 449, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 18 InternalServerErrorException - - FailureValidator.builder() - .instanceOf(InternalServerErrorException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 500, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 19 ServiceUnavailableException - - FailureValidator.builder() - .instanceOf(ServiceUnavailableException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 503, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - }; - } - - /** - * Verifies that a request for a non-existent resource produces a {@link }GoneException} - */ - @Test(enabled = false, groups = "direct") - public void verifyGoneResponseMapsToGoneException() throws Exception { - - final RntbdTransportClient.Options options = new RntbdTransportClient.Options.Builder(requestTimeout).build(); - final SslContext sslContext = SslContextBuilder.forClient().build(); - - try (final RntbdTransportClient transportClient = new RntbdTransportClient(options, sslContext)) { - - final BaseAuthorizationTokenProvider authorizationTokenProvider = new BaseAuthorizationTokenProvider( - RntbdTestConfiguration.AccountKey - ); - - final URI physicalAddress = new URI("rntbd://" - + RntbdTestConfiguration.RntbdAuthority - + "/apps/DocDbApp/services/DocDbMaster0/partitions/780e44f4-38c8-11e6-8106-8cdcd42c33be/replicas/1p/" - ); - - final ImmutableMap.Builder builder = ImmutableMap.builder(); - - builder.put(HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - - final String token = authorizationTokenProvider.generateKeyAuthorizationSignature(HttpMethods.GET, - Paths.DATABASE_ACCOUNT_PATH_SEGMENT, - ResourceType.DatabaseAccount, - builder.build() - ); - - builder.put(HttpHeaders.AUTHORIZATION, token); - - final RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.DatabaseAccount, - Paths.DATABASE_ACCOUNT_PATH_SEGMENT, - builder.build() - ); - - final Single responseSingle = transportClient.invokeStoreAsync(physicalAddress, null, request); - - responseSingle.toObservable().toBlocking().subscribe(new Subscriber() { - @Override - public void onCompleted() { - } - - @Override - public void onError(final Throwable error) { - final String format = "Expected %s, not %s"; - assertTrue(error instanceof GoneException, String.format(format, GoneException.class, error.getClass())); - final Throwable cause = error.getCause(); - if (cause != null) { - // assumption: cosmos isn't listening on 10251 - assertTrue(cause instanceof ConnectException, String.format(format, ConnectException.class, error.getClass())); - } - } - - @Override - public void onNext(final StoreResponse response) { - fail(String.format("Expected GoneException, not a StoreResponse: %s", response)); - } - }); - - } catch (final Exception error) { - final String message = String.format("%s: %s", error.getClass(), error.getMessage()); - fail(message, error); - } - } - - /** - * Validates the error handling behavior of {@link RntbdTransportClient} for network failures - *

- * These are the exceptions that cannot be derived from server responses. They are mapped from Netty channel - * failures simulated by {@link FakeChannel}. - * - * @param builder A feature validator builder to confirm that response is correctly mapped to an exception - * @param request An RNTBD request instance - * @param exception An exception mapping - */ - @Test(enabled = false, groups = "unit", dataProvider = "fromMockedNetworkFailureToExpectedDocumentClientException") - public void verifyNetworkFailure( - final FailureValidator.Builder builder, - final RxDocumentServiceRequest request, - final DocumentClientException exception - ) { - // TODO: DANOBLE: Implement RntbdTransportClientTest.verifyNetworkFailure - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/378750 - throw new UnsupportedOperationException("TODO: DANOBLE: Implement this test"); - } - - /** - * Validates the error handling behavior of the {@link RntbdTransportClient} for HTTP status codes >= 400 - * - * @param builder A feature validator builder to confirm that response is correctly mapped to an exception - * @param request An RNTBD request instance - * @param response The RNTBD response instance to be returned as a result of the request - */ - @Test(enabled = true, groups = "unit", dataProvider = "fromMockedRntbdResponseToExpectedDocumentClientException") - public void verifyRequestFailures( - final FailureValidator.Builder builder, - final RxDocumentServiceRequest request, - final RntbdResponse response - ) { - final UserAgentContainer userAgent = new UserAgentContainer(); - final Duration timeout = Duration.ofMillis(100); - - try (final RntbdTransportClient client = getRntbdTransportClientUnderTest(userAgent, timeout, response)) { - - final Single responseSingle; - - try { - responseSingle = client.invokeStoreAsync( - physicalAddress, new ResourceOperation(request.getOperationType(), request.getResourceType()), request - ); - } catch (final Exception error) { - throw new AssertionError(String.format("%s: %s", error.getClass(), error.getMessage())); - } - - this.validateFailure(responseSingle, builder.build()); - } - } - - private static RntbdTransportClient getRntbdTransportClientUnderTest( - final UserAgentContainer userAgent, - final Duration requestTimeout, - final RntbdResponse expected - ) { - - final RntbdTransportClient.Options options = new RntbdTransportClient.Options.Builder(requestTimeout) - .userAgent(userAgent) - .build(); - - final SslContext sslContext; - - try { - sslContext = SslContextBuilder.forClient().build(); - } catch (final Exception error) { - throw new AssertionError(String.format("%s: %s", error.getClass(), error.getMessage())); - } - - return new RntbdTransportClient(new FakeEndpoint.Provider(options, sslContext, expected)); - } - - private void validateFailure(final Single single, final FailureValidator validator) { - validateFailure(single, validator, requestTimeout.toMillis()); - } - - private static void validateFailure( - final Single single, final FailureValidator validator, final long timeout - ) { - - final TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - Assertions.assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - // region Types - - private static final class FakeChannel extends EmbeddedChannel { - - private static final ServerProperties serverProperties = new ServerProperties("agent", "3.0.0"); - private final BlockingQueue responses; - - FakeChannel(final BlockingQueue responses, final ChannelHandler... handlers) { - super(handlers); - this.responses = responses; - } - - @Override - protected void handleInboundMessage(final Object message) { - super.handleInboundMessage(message); - assertTrue(message instanceof ByteBuf); - } - - @Override - protected void handleOutboundMessage(final Object message) { - - assertTrue(message instanceof ByteBuf); - - final ByteBuf out = Unpooled.buffer(); - final ByteBuf in = (ByteBuf) message; - - // This is the end of the outbound pipeline and so we can do what we wish with the outbound message - - if (in.getUnsignedIntLE(4) == 0) { - - final RntbdContextRequest request = RntbdContextRequest.decode(in.copy()); - final RntbdContext rntbdContext = RntbdContext.from(request, serverProperties, HttpResponseStatus.OK); - - rntbdContext.encode(out); - - } else { - - final RntbdResponse rntbdResponse; - - try { - rntbdResponse = this.responses.take(); - } catch (final Exception error) { - throw new AssertionError(String.format("%s: %s", error.getClass(), error.getMessage())); - } - - rntbdResponse.encode(out); - out.setBytes(8, in.slice(8, 16)); // Overwrite activityId - } - - this.writeInbound(out); - } - } - - private static final class FakeEndpoint implements RntbdEndpoint { - - final RntbdRequestTimer requestTimer; - final FakeChannel fakeChannel; - final URI physicalAddress; - - private FakeEndpoint( - final Config config, final RntbdRequestTimer timer, final URI physicalAddress, - final RntbdResponse... expected - ) { - - final ArrayBlockingQueue responses = new ArrayBlockingQueue<>( - expected.length, true, Arrays.asList(expected) - ); - - RntbdRequestManager requestManager = new RntbdRequestManager(); - this.physicalAddress = physicalAddress; - this.requestTimer = timer; - - this.fakeChannel = new FakeChannel(responses, - new RntbdContextNegotiator(requestManager, config.getUserAgent()), - new RntbdRequestEncoder(), - new RntbdResponseDecoder(), - requestManager - ); - } - - @Override - public String getName() { - return "FakeEndpoint"; - } - - @Override - public void close() { - this.fakeChannel.close().syncUninterruptibly(); - } - - @Override - public RntbdRequestRecord request(final RntbdRequestArgs requestArgs) { - final RntbdRequestRecord requestRecord = new RntbdRequestRecord(requestArgs, this.requestTimer); - this.fakeChannel.writeOutbound(requestRecord); - return requestRecord; - } - - static class Provider implements RntbdEndpoint.Provider { - - final Config config; - final RntbdResponse expected; - final RntbdRequestTimer timer; - - Provider(RntbdTransportClient.Options options, SslContext sslContext, RntbdResponse expected) { - this.config = new Config(options, sslContext, LogLevel.WARN); - this.timer = new RntbdRequestTimer(config.getRequestTimeout()); - this.expected = expected; - } - - @Override - public void close() throws RuntimeException { - this.timer.close(); - } - - @Override - public Config config() { - return this.config; - } - - @Override - public int count() { - return 1; - } - - @Override - public RntbdEndpoint get(URI physicalAddress) { - return new FakeEndpoint(config, timer, physicalAddress, expected); - } - - @Override - public Stream list() { - return Stream.empty(); - } - } - } - - private static final class RntbdTestConfiguration { - - static String AccountHost = System.getProperty("ACCOUNT_HOST", - StringUtils.defaultString( - Strings.emptyToNull(System.getenv().get("ACCOUNT_HOST")), - "https://localhost:8081/" - ) - ); - - static String AccountKey = System.getProperty("ACCOUNT_KEY", - StringUtils.defaultString( - Strings.emptyToNull(System.getenv().get("ACCOUNT_KEY")), - "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==" - ) - ); - - static String RntbdAuthority = System.getProperty("rntbd.authority", - StringUtils.defaultString( - Strings.emptyToNull(System.getenv().get("RNTBD_AUTHORITY")), - String.format("%s:10251", URI.create(AccountHost).getHost()) - ) - ); - - private RntbdTestConfiguration() { - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderDotNetTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderDotNetTest.java deleted file mode 100644 index 9b0d4bfa0b98..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderDotNetTest.java +++ /dev/null @@ -1,903 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.ReplicationPolicy; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.AuthorizationTokenType; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.StringUtils; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.net.URI; -import java.net.URISyntaxException; -import java.time.Duration; -import java.util.ArrayDeque; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Queue; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; - -public class StoreReaderDotNetTest { - private static final Logger logger = LoggerFactory.getLogger(StoreReaderDotNetTest.class); - @Test(groups = "unit") - public void addressCache() { - // create a real document service request - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - - // setup mocks for address information - AddressInformation[] addressInformation = new AddressInformation[3]; - for (int i = 0; i < 3; i++) { - addressInformation[i] = new AddressInformation(true, true, "http://replica-" + i, Protocol.Https); - } - - IAddressResolver mockAddressCache = Mockito.mock(IAddressResolver.class); - - Mockito.doReturn(Single.just(addressInformation)) - .when(mockAddressCache) - .resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.eq(false)); - - // validate that the mock works - AddressInformation[] addressInfo = mockAddressCache.resolveAsync(entity, false).toBlocking().value(); - assertThat(addressInfo[0]).isEqualTo(addressInformation[0]); - } - - /** - * Tests for TransportClient - */ - @Test(groups = "unit") - public void transportClient() { - // create a real document service request - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - - // setup mocks for address information - AddressInformation[] addressInformation = new AddressInformation[3]; - - // construct URIs that look like the actual uri - // rntbd://yt1prdddc01-docdb-1.documents.azure.com:14003/apps/ce8ab332-f59e-4ce7-a68e-db7e7cfaa128/services/68cc0b50-04c6-4716-bc31-2dfefd29e3ee/partitions/5604283d-0907-4bf4-9357-4fa9e62de7b5/replicas/131170760736528207s/ - for (int i = 0; i < 3; i++) { - String physicalUri = - "rntbd://dummytenant.documents.azure.com:14003/apps/APPGUID/services/SERVICEGUID/partitions/PARTITIONGUID/replicas/" - + Integer.toString(i) + (i == 0 ? "p" : "s") + "/"; - addressInformation[i] = new AddressInformation(true, true, physicalUri, Protocol.Tcp); - - } - - // create objects for all the dependencies of the StoreReader - TransportClient mockTransportClient = Mockito.mock(TransportClient.class); - - // create mock store response object - StoreResponseBuilder srb = new StoreResponseBuilder(); - - - // set lsn and activityid on the store response. - srb.withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1" ); - srb.withHeader(WFConstants.BackendHeaders.LSN, "50"); - - // setup mock transport client - Mockito.doReturn(Single.just(srb.build())) - .when(mockTransportClient) - .invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[0].getPhysicalUri())), - Mockito.any(RxDocumentServiceRequest.class)); - - - - // get response from mock object - StoreResponse response = mockTransportClient.invokeResourceOperationAsync(URI.create(addressInformation[0].getPhysicalUri()), entity).toBlocking().value(); - - // validate that the LSN matches - // validate that the ActivityId Matches - - StoreResponseValidator validator = StoreResponseValidator.create().withBELSN(50).withBEActivityId("ACTIVITYID1_1").build(); - validator.validate(response); - } - - private TransportClient getMockTransportClientDuringUpgrade(AddressInformation[] addressInformation) { - // create objects for all the dependencies of the StoreReader - TransportClient mockTransportClient = Mockito.mock(TransportClient.class); - - // create mock store response object - // set lsn and activityid on the store response. - StoreResponse mockStoreResponseFast = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "50") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1") - .build(); - - StoreResponse mockStoreResponseSlow = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "30") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1") - .build(); - - // setup mock transport client for the first replica - Mockito.doReturn(Single.just(mockStoreResponseFast)) - .when(mockTransportClient) - .invokeResourceOperationAsync(Mockito.eq(URI.create(addressInformation[0].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - - // setup mock transport client with a sequence of outputs - Mockito.doReturn(Single.just(mockStoreResponseFast)) // initial read response - .doReturn(Single.just(mockStoreResponseFast)) // barrier retry, count 1 - .doReturn(Single.just(mockStoreResponseFast)) // barrier retry, count 2 - .doReturn(Single.error(new InvalidPartitionException())) // throw invalid partition exception to simulate collection recreate with same name - .doReturn(Single.just(mockStoreResponseFast)) // new read - .doReturn(Single.just(mockStoreResponseFast)) // subsequent barriers - .doReturn(Single.just(mockStoreResponseFast)) - .doReturn(Single.just(mockStoreResponseFast)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[1].getPhysicalUri())), - Mockito.any(RxDocumentServiceRequest.class)); - - // After this, the product code should reset target identity, and lsn response - Queue queueOfResponses = new ArrayDeque<>(); - - // let the first 10 responses be slow, and then fast - for (int i = 0; i < 20; i++) { - queueOfResponses.add(i <= 2 ? mockStoreResponseSlow : mockStoreResponseFast); - } - - // setup mock transport client with a sequence of outputs, for the second replica - // This replica behaves in the following manner: - // calling InvokeResourceOperationAsync - // 1st time: returns valid LSN - // 2nd time: returns InvalidPartitionException - // initial read response - - Mockito.doAnswer((params) -> Single.just(queueOfResponses.poll())) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[2].getPhysicalUri())), - Mockito.any(RxDocumentServiceRequest.class)); - - return mockTransportClient; - } - - private enum ReadQuorumResultKind { - QuorumMet, - QuorumSelected, - QuorumNotSelected - } - - private TransportClient getMockTransportClientForGlobalStrongReads(AddressInformation[] addressInformation, ReadQuorumResultKind result) { - // create objects for all the dependencies of the StoreReader - TransportClient mockTransportClient = Mockito.mock(TransportClient.class); - - // create mock store response object - - StoreResponse mockStoreResponse1 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "100") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "90") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse2 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "90") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "90") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_2") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - - StoreResponse mockStoreResponse3 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "92") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "90") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse4 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "100") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "92") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse5 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "100") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "100") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, "1") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, "100") - .build(); - // set lsn and activityid on the store response. - - StoreResponse mockStoreResponseFast = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "50") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1") - .build(); - - if(result == ReadQuorumResultKind.QuorumMet) { - // setup mock transport client for the first replica - Mockito.doReturn(Single.just(mockStoreResponse5)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[0].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - Mockito.doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse5)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[1].getPhysicalUri())), - Mockito.any(RxDocumentServiceRequest.class)); - - Mockito.doReturn(Single.just(mockStoreResponse2)) - .doReturn(Single.just(mockStoreResponse2)) - .doReturn(Single.just(mockStoreResponse2)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse4)) - .doReturn(Single.just(mockStoreResponse5)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[2].getPhysicalUri())), - Mockito.any(RxDocumentServiceRequest.class)); - } - - if (result == ReadQuorumResultKind.QuorumSelected) { - // setup mock transport client for the first replica - Mockito.doReturn(Single.just(mockStoreResponse2)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[0].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - // setup mock transport client with a sequence of outputs - Mockito.doReturn(Single.just(mockStoreResponse1)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[1].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - - // setup mock transport client with a sequence of outputs - Mockito.doReturn(Single.just(mockStoreResponse2)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[2].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - } else if (result == ReadQuorumResultKind.QuorumNotSelected) { - // setup mock transport client for the first replica - - Mockito.doReturn(Single.just(mockStoreResponse5)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[0].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - Mockito.doReturn(Single.just(mockStoreResponse5)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[1].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - Mockito.doReturn(Single.error(new GoneException("test"))) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[2].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - } - - return mockTransportClient; - } - - private TransportClient getMockTransportClientForGlobalStrongWrites( - AddressInformation[] addressInformation, - int indexOfCaughtUpReplica, - boolean undershootGlobalCommittedLsnDuringBarrier, - boolean overshootLsnDuringBarrier, - boolean overshootGlobalCommittedLsnDuringBarrier) - { - TransportClient mockTransportClient = Mockito.mock(TransportClient.class); - - // create mock store response object - - // set lsn and activityid on the store response. - StoreResponse mockStoreResponse1 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "100") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "90") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse2 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "100") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_2") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "100") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse3 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "103") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "100") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse4 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "103") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "103") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse5 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "106") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "103") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse finalResponse = null; - if (undershootGlobalCommittedLsnDuringBarrier) { - finalResponse = mockStoreResponse1; - } else { - if (overshootLsnDuringBarrier) { - if (overshootGlobalCommittedLsnDuringBarrier) { - finalResponse = mockStoreResponse5; - } else { - finalResponse = mockStoreResponse3; - } - } else { - if (overshootGlobalCommittedLsnDuringBarrier) { - finalResponse = mockStoreResponse4; - } else { - finalResponse = mockStoreResponse2; - } - } - } - - for (int i = 0; i < addressInformation.length; i++) { - if (i == indexOfCaughtUpReplica) { - Mockito.doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(finalResponse)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[i].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - } else { - Mockito.doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[i].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - } - } - - return mockTransportClient; - } - - /** - * We are simulating upgrade scenario where one of the secondary replicas is down. - * And one of the other secondary replicas is an XP Primary (lagging behind). - * Dyanmic Quorum is in effect, so Write Quorum = 2 - * @return array of AddressInformation - */ - private AddressInformation[] getMockAddressInformationDuringUpgrade() { - // setup mocks for address information - AddressInformation[] addressInformation = new AddressInformation[3]; - - // construct URIs that look like the actual uri - // rntbd://yt1prdddc01-docdb-1.documents.azure.com:14003/apps/ce8ab332-f59e-4ce7-a68e-db7e7cfaa128/services/68cc0b50-04c6-4716-bc31-2dfefd29e3ee/partitions/5604283d-0907-4bf4-9357-4fa9e62de7b5/replicas/131170760736528207s/ - for (int i = 0; i <= 2; i++) { - String physicalUri = - "rntbd://dummytenant.documents.azure.com:14003/apps/APPGUID/services/SERVICEGUID/partitions/PARTITIONGUID/replicas/" - + Integer.toString(i) + (i == 0 ? "p" : "s") + "/"; - addressInformation[i] = new AddressInformation(true, i == 0 ? true : false, physicalUri, Protocol.Tcp); - } - - return addressInformation; - } - - /** - * Given an array of address information, gives mock address cache. - * @param addressInformation - * @return - */ - private IAddressResolver getMockAddressCache(AddressInformation[] addressInformation) - { - // Address Selector is an internal sealed class that can't be mocked, but its dependency - // AddressCache can be mocked. - IAddressResolver mockAddressCache = Mockito.mock(IAddressResolver.class); - - Mockito.doReturn(Single.just(addressInformation)).when(mockAddressCache) - .resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.eq(false) /*forceRefresh*/); - - Mockito.doReturn(Single.just(new AddressInformation[0])).when(mockAddressCache) - .resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.eq(true) /*forceRefresh*/); - - return mockAddressCache; - } - - /** - * Tests for {@link StoreReader} - */ - @Test(groups = "unit") - public void storeReaderBarrier() { - // create a real document service request - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - - // set request charge tracker - this is referenced in store reader (ReadMultipleReplicaAsync) - DocumentServiceRequestContext requestContext = new DocumentServiceRequestContext(); - // requestContext.ClientRequestStatistics = new ClientSideRequestStatistics(); - requestContext.requestChargeTracker = new RequestChargeTracker(); - entity.requestContext = requestContext; - - // also setup timeout helper, used in store reader - // entity.requestContext.timeoutHelper = new TimeoutHelper(new TimeSpan(2, 2, 2)); - entity.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - - // when the store reader throws Invalid Partition exception, the higher layer should - // clear this target identity. - // entity.requestContext.TargetIdentity = new ServiceIdentity("dummyTargetIdentity1", new Uri("http://dummyTargetIdentity1"), false); - entity.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - - AddressInformation[] addressInformation = getMockAddressInformationDuringUpgrade(); - IAddressResolver mockAddressCache = getMockAddressCache(addressInformation); - - // validate that the mock works - AddressInformation[] addressInfo = mockAddressCache.resolveAsync(entity, false).toBlocking().value(); - - assertThat(addressInfo[0]).isEqualTo(addressInformation[0]); - - AddressSelector addressSelector = new AddressSelector(mockAddressCache, Protocol.Tcp); - URI primaryAddress = addressSelector.resolvePrimaryUriAsync(entity, false /*forceAddressRefresh*/).toBlocking().value(); - - // check if the address return from Address Selector matches the original address info - assertThat(primaryAddress.toString()).isEqualTo(addressInformation[0].getPhysicalUri()); - - // get mock transport client that returns a sequence of responses to simulate upgrade - TransportClient mockTransportClient = getMockTransportClientDuringUpgrade(addressInformation); - - // get response from mock object - StoreResponse response = mockTransportClient.invokeResourceOperationAsync(URI.create(addressInformation[0].getPhysicalUri()), entity).toBlocking().value(); - - // validate that the LSN matches - assertThat(response.getLSN()).isEqualTo(50); - - String activityId = response.getHeaderValue(WFConstants.BackendHeaders.ACTIVITY_ID); - - // validate that the ActivityId Matches - assertThat(activityId).isEqualTo("ACTIVITYID1_1"); - - // create a real session container - we don't need session for this test anyway - ISessionContainer sessionContainer = new SessionContainer(Strings.Emtpy); - - // create store reader with mock transport client, real address selector (that has mock address cache), and real session container - StoreReader storeReader = - new StoreReader(mockTransportClient, - addressSelector, - sessionContainer); - - // reads always go to read quorum (2) replicas - int replicaCountToRead = 2; - - List result = storeReader.readMultipleReplicaAsync( - entity, - false /*includePrimary*/, - replicaCountToRead, - true /*requiresValidLSN*/, - false /*useSessionToken*/, - ReadMode.Strong).toBlocking().value(); - - // make sure we got 2 responses from the store reader - assertThat(result).hasSize(2); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator, long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateSuccess(Single single, - StoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single single, - StoreResultValidator validator, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateException(Single single, - FailureValidator validator) { - validateException(single, validator, 10000); - } - - public static void validateException(Single single, - FailureValidator validator, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - /** - * StoreClient uses ReplicatedResourceClient uses ConsistencyReader uses QuorumReader uses StoreReader uses TransportClient uses RntbdConnection - */ - @Test(groups = "unit", enabled = false) - public void storeClient() throws URISyntaxException { - // create a real document service request (with auth token level = god) - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - entity.authorizationTokenType = AuthorizationTokenType.PrimaryMasterKey; - - // set request charge tracker - this is referenced in store reader (ReadMultipleReplicaAsync) - DocumentServiceRequestContext requestContext = new DocumentServiceRequestContext(); - requestContext.requestChargeTracker = new RequestChargeTracker(); - entity.requestContext = requestContext; - - // set a dummy resource id on the request. - entity.setResourceId("1-MxAPlgMgA="); - - // set consistency level on the request to Bounded Staleness - entity.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.BoundedStaleness.toString()); - - // also setup timeout helper, used in store reader - entity.requestContext.timeoutHelper = new TimeoutHelper(Duration.ofSeconds(2 * 60 * 60 + 2 * 60 + 2)); - - // when the store reader throws Invalid Partition exception, the higher layer should - entity.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - - AddressInformation[] addressInformations = getMockAddressInformationDuringUpgrade(); - IAddressResolver mockAddressCache = getMockAddressCache(addressInformations); - - // validate that the mock works - AddressInformation[] addressInfo = mockAddressCache.resolveAsync(entity, false).toBlocking().value(); - assertThat(addressInfo[0]).isEqualTo(addressInformations[0]); - - AddressSelector addressSelector = new AddressSelector(mockAddressCache, Protocol.Tcp); - URI primaryAddress = addressSelector.resolvePrimaryUriAsync(entity, false).toBlocking().value(); - - // check if the address return from Address Selector matches the original address info - assertThat(primaryAddress.toString()).isEqualTo(addressInformations[0].getPhysicalUri()); - - // get mock transport client that returns a sequence of responses to simulate upgrade - TransportClient mockTransportClient = getMockTransportClientDuringUpgrade(addressInformations); - - // get response from mock object - StoreResponse response = mockTransportClient.invokeResourceOperationAsync(new URI(addressInformations[0].getPhysicalUri()), entity).toBlocking().value(); - - // validate that the LSN matches - assertThat(response.getLSN()).isEqualTo(50); - - String activityId = response.getHeaderValue(WFConstants.BackendHeaders.ACTIVITY_ID); - // validate that the ActivityId Matches - assertThat(activityId).isEqualTo("ACTIVITYID1_1"); - - // create a real session container - we don't need session for this test anyway - SessionContainer sessionContainer = new SessionContainer(StringUtils.EMPTY); - - // create store reader with mock transport client, real address selector (that has mock address cache), and real session container - StoreReader storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - - IAuthorizationTokenProvider mockAuthorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - Mockito.when(mockAuthorizationTokenProvider.getUserAuthorizationToken(Matchers.anyString(), Matchers.any(), Matchers.anyString(), Matchers.anyMap(), - Matchers.any(), Matchers.anyMap())).thenReturn("dummyauthtoken"); - - // setup max replica set size on the config reader - ReplicationPolicy replicationPolicy = new ReplicationPolicy(); - GatewayServiceConfigurationReader mockServiceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - Mockito.when(mockServiceConfigReader.getUserReplicationPolicy()).thenReturn(replicationPolicy); - - try { - StoreClient storeClient = new StoreClient(new Configs(),mockAddressCache, sessionContainer, mockServiceConfigReader, mockAuthorizationTokenProvider, mockTransportClient, false); - - ServerStoreModel storeModel = new ServerStoreModel(storeClient); - Single result = storeModel.processMessage(entity).toSingle(); - result.toBlocking().value(); - - // if we have reached this point, there was a successful request. - // validate if the target identity has been cleared out. - // If the target identity is null and the request still succeeded, it means - // that the very first read succeeded without a barrier request. - assertThat(entity.requestContext.resolvedPartitionKeyRange).isNotNull(); - } catch (Exception e) { - assertThat(e instanceof ServiceUnavailableException - || e instanceof IllegalArgumentException - || e instanceof NullPointerException - || e instanceof NoSuchElementException).isTrue(); - } - } - - /** - * test consistency writer for global strong - */ - @Test(groups = "unit") - public void globalStrongConsistentWrite() { - // create a real document service request (with auth token level = god) - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document); - entity.authorizationTokenType = AuthorizationTokenType.PrimaryMasterKey; - - // set request charge tracker - this is referenced in store reader (ReadMultipleReplicaAsync) - DocumentServiceRequestContext requestContext = new DocumentServiceRequestContext(); - requestContext.requestChargeTracker = new RequestChargeTracker(); - entity.requestContext = requestContext; - - // set a dummy resource id on the request. - entity.setResourceId("1-MxAPlgMgA="); - - // set consistency level on the request to Bounded Staleness - entity.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Strong.toString()); - - // also setup timeout helper, used in store reader - entity.requestContext.timeoutHelper = new TimeoutHelper(Duration.ofSeconds(2 * 60 * 60 + 2 * 60 + 2)); - - // when the store reader throws Invalid Partition exception, the higher layer should - // clear this target identity. - entity.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - - AddressInformation[] addressInformations = getMockAddressInformationDuringUpgrade(); - IAddressResolver mockAddressCache = getMockAddressCache(addressInformations); - - // validate that the mock works - AddressInformation[] addressInfo = mockAddressCache.resolveAsync(entity, false).toBlocking().value(); - assertThat(addressInformations[0]).isEqualTo(addressInfo[0]); - - AddressSelector addressSelector = new AddressSelector(mockAddressCache, Protocol.Tcp); - URI primaryAddress = addressSelector.resolvePrimaryUriAsync(entity, false).toBlocking().value(); - - // check if the address return from Address Selector matches the original address info - assertThat(primaryAddress.toString()).isEqualTo(addressInformations[0].getPhysicalUri()); - - // create a real session container - we don't need session for this test anyway - SessionContainer sessionContainer = new SessionContainer(StringUtils.EMPTY); - GatewayServiceConfigurationReader serviceConfigurationReader = Mockito.mock(GatewayServiceConfigurationReader.class); - - IAuthorizationTokenProvider mockAuthorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - Mockito.when(mockAuthorizationTokenProvider.getUserAuthorizationToken(Matchers.anyString(),Matchers.any(), Matchers.anyString(), Matchers.anyMap(), - Matchers.any(), Matchers.anyMap())).thenReturn("dummyauthtoken"); - - for (int i = 0; i < addressInformations.length; i++) { - TransportClient mockTransportClient = getMockTransportClientForGlobalStrongWrites(addressInformations, i, false, false, false); - StoreReader storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - ConsistencyWriter consistencyWriter = new ConsistencyWriter(addressSelector, sessionContainer, mockTransportClient, mockAuthorizationTokenProvider, serviceConfigurationReader, false); - StoreResponse response = consistencyWriter.writeAsync(entity, new TimeoutHelper(Duration.ofSeconds(30)), false).toBlocking().value(); - assertThat(response.getLSN()).isEqualTo(100); - - //globalCommittedLsn never catches up in this case - mockTransportClient = getMockTransportClientForGlobalStrongWrites(addressInformations, i, true, false, false); - consistencyWriter = new ConsistencyWriter(addressSelector, sessionContainer, mockTransportClient, mockAuthorizationTokenProvider, serviceConfigurationReader, false); - try { - response = consistencyWriter.writeAsync(entity, new TimeoutHelper(Duration.ofSeconds(30)), false).toBlocking().value(); - // fail("it should throw exception"); - } catch (Exception e) { - } - - mockTransportClient = getMockTransportClientForGlobalStrongWrites(addressInformations, i, false, true, false); - storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - consistencyWriter = new ConsistencyWriter(addressSelector, sessionContainer, mockTransportClient, mockAuthorizationTokenProvider, serviceConfigurationReader, false); - response = consistencyWriter.writeAsync(entity, new TimeoutHelper(Duration.ofSeconds(30)), false).toBlocking().value(); - assertThat(response.getLSN()).isEqualTo(100); - - mockTransportClient = getMockTransportClientForGlobalStrongWrites(addressInformations, i, false, true, true); - storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - consistencyWriter = new ConsistencyWriter(addressSelector, sessionContainer, mockTransportClient, mockAuthorizationTokenProvider, serviceConfigurationReader, false); - response = consistencyWriter.writeAsync(entity, new TimeoutHelper(Duration.ofSeconds(30)), false).toBlocking().value(); - assertThat(response.getLSN()).isEqualTo(100); - - - mockTransportClient = getMockTransportClientForGlobalStrongWrites(addressInformations, i, false, false, true); - storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - consistencyWriter = new ConsistencyWriter(addressSelector, sessionContainer, mockTransportClient, mockAuthorizationTokenProvider, serviceConfigurationReader, false); - response = consistencyWriter.writeAsync(entity, new TimeoutHelper(Duration.ofSeconds(30)), false).toBlocking().value(); - assertThat(response.getLSN()).isEqualTo(100); - - } - } - - /** - * Mocking Consistency - */ - @Test(groups = "unit", priority = 1) - public void globalStrongConsistency() { - // create a real document service request (with auth token level = god) - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - entity.authorizationTokenType = AuthorizationTokenType.PrimaryMasterKey; - - // set request charge tracker - this is referenced in store reader (ReadMultipleReplicaAsync) - DocumentServiceRequestContext requestContext = new DocumentServiceRequestContext(); - requestContext.requestChargeTracker = new RequestChargeTracker(); - entity.requestContext = requestContext; - - // set a dummy resource id on the request. - entity.setResourceId("1-MxAPlgMgA="); - - // set consistency level on the request to Bounded Staleness - entity.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.BoundedStaleness.toString()); - - // also setup timeout helper, used in store reader - entity.requestContext.timeoutHelper = new TimeoutHelper(Duration.ofSeconds(2 * 60 * 60 + 2 * 60 + 2)); - - // when the store reader throws Invalid Partition exception, the higher layer should - // clear this target identity. - entity.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - - AddressInformation[] addressInformations = getMockAddressInformationDuringUpgrade(); - IAddressResolver mockAddressCache = getMockAddressCache(addressInformations); - - // validate that the mock works - AddressInformation[] addressInfo = mockAddressCache.resolveAsync(entity, false).toBlocking().value(); - assertThat(addressInfo[0]).isEqualTo(addressInformations[0]); - - AddressSelector addressSelector = new AddressSelector(mockAddressCache, Protocol.Tcp); - URI primaryAddress = addressSelector.resolvePrimaryUriAsync(entity, false).toBlocking().value(); - - // check if the address return from Address Selector matches the original address info - assertThat(primaryAddress.toString()).isEqualTo(addressInformations[0].getPhysicalUri()); - - // Quorum Met scenario Start - { - // get mock transport client that returns a sequence of responses to simulate upgrade - TransportClient mockTransportClient = getMockTransportClientForGlobalStrongReads(addressInformations, ReadQuorumResultKind.QuorumMet); - - // create a real session container - we don't need session for this test anyway - SessionContainer sessionContainer = new SessionContainer(StringUtils.EMPTY); - - // create store reader with mock transport client, real address selector (that has mock address cache), and real session container - StoreReader storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - - IAuthorizationTokenProvider mockAuthorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - Mockito.when(mockAuthorizationTokenProvider.getUserAuthorizationToken(Matchers.anyString(), Matchers.any(), Matchers.anyString(), Matchers.anyMap(), - Matchers.any(), Matchers.anyMap())).thenReturn("dummyauthtoken"); - - // setup max replica set size on the config reader - ReplicationPolicy replicationPolicy = new ReplicationPolicy(); - GatewayServiceConfigurationReader mockServiceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - Mockito.when(mockServiceConfigReader.getUserReplicationPolicy()).thenReturn(replicationPolicy); - - QuorumReader reader = new QuorumReader(new Configs(),mockTransportClient, addressSelector, storeReader, mockServiceConfigReader, mockAuthorizationTokenProvider); - - entity.requestContext.originalRequestConsistencyLevel = ConsistencyLevel.Strong; - - StoreResponse result = reader.readStrongAsync(entity, 2, ReadMode.Strong).toBlocking().value(); - assertThat(result.getLSN()).isEqualTo(100); - - String globalCommitedLSN = result.getHeaderValue(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN); - - long nGlobalCommitedLSN = Long.parseLong(globalCommitedLSN); - assertThat(nGlobalCommitedLSN).isEqualTo(90); - } - - // Quorum Selected scenario - { - // get mock transport client that returns a sequence of responses to simulate upgrade - TransportClient mockTransportClient = getMockTransportClientForGlobalStrongReads(addressInformations, ReadQuorumResultKind.QuorumSelected); - - // create a real session container - we don't need session for this test anyway - SessionContainer sessionContainer = new SessionContainer(StringUtils.EMPTY); - - // create store reader with mock transport client, real address selector (that has mock address cache), and real session container - StoreReader storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - - IAuthorizationTokenProvider mockAuthorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - Mockito.when(mockAuthorizationTokenProvider.getUserAuthorizationToken(Matchers.anyString(), Matchers.any(), Matchers.anyString(), Matchers.anyMap(), - Matchers.any(), Matchers.anyMap())).thenReturn("dummyauthtoken"); - - // setup max replica set size on the config reader - ReplicationPolicy replicationPolicy = new ReplicationPolicy(); - BridgeInternal.setMaxReplicaSetSize(replicationPolicy,4); - - GatewayServiceConfigurationReader mockServiceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - Mockito.when(mockServiceConfigReader.getUserReplicationPolicy()).thenReturn(replicationPolicy); - Mockito.when(mockServiceConfigReader.getDefaultConsistencyLevel()).thenReturn(ConsistencyLevel.Strong); - - QuorumReader reader = new QuorumReader(new Configs(), mockTransportClient, addressSelector, storeReader, mockServiceConfigReader, mockAuthorizationTokenProvider); - entity.requestContext.originalRequestConsistencyLevel = ConsistencyLevel.Strong; - entity.requestContext.quorumSelectedLSN = -1; - entity.requestContext.globalCommittedSelectedLSN = -1; - try { - StoreResponse result = reader.readStrongAsync(entity, 2, ReadMode.Strong).toBlocking().value(); - assertThat(false).isTrue(); - } catch (Exception ex) { - if (ex.getCause() instanceof GoneException) { - logger.info("Gone exception expected!"); - } - } - - assertThat(entity.requestContext.quorumSelectedLSN).isEqualTo(100); - assertThat(entity.requestContext.globalCommittedSelectedLSN).isEqualTo(100); - } - - // Quorum not met scenario - { - // get mock transport client that returns a sequence of responses to simulate upgrade - TransportClient mockTransportClient = getMockTransportClientForGlobalStrongReads(addressInformations, ReadQuorumResultKind.QuorumNotSelected); - - // create a real session container - we don't need session for this test anyway - SessionContainer sessionContainer = new SessionContainer(StringUtils.EMPTY); - - // create store reader with mock transport client, real address selector (that has mock address cache), and real session container - StoreReader storeReader = - new StoreReader(mockTransportClient, - addressSelector, - sessionContainer); - - IAuthorizationTokenProvider mockAuthorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - Mockito.when(mockAuthorizationTokenProvider.getUserAuthorizationToken(Matchers.anyString(), Matchers.any(), Matchers.anyString(), Matchers.anyMap(), - Matchers.any(), Matchers.anyMap())).thenReturn("dummyauthtoken"); - // setup max replica set size on the config reader - ReplicationPolicy replicationPolicy = new ReplicationPolicy(); - BridgeInternal.setMaxReplicaSetSize(replicationPolicy,4); - - GatewayServiceConfigurationReader mockServiceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - Mockito.when(mockServiceConfigReader.getUserReplicationPolicy()).thenReturn(replicationPolicy); - Mockito.when(mockServiceConfigReader.getDefaultConsistencyLevel()).thenReturn(ConsistencyLevel.Strong); - - QuorumReader reader = new QuorumReader(new Configs(), mockTransportClient, addressSelector, storeReader, mockServiceConfigReader, mockAuthorizationTokenProvider); - entity.requestContext.originalRequestConsistencyLevel = ConsistencyLevel.Strong; - entity.requestContext.performLocalRefreshOnGoneException = true; - - StoreResponse result = reader.readStrongAsync(entity, 2, ReadMode.Strong).toBlocking().value(); - assertThat(result.getLSN()).isEqualTo(100); - - String globalCommitedLSN; - globalCommitedLSN = result.getHeaderValue(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN); - long nGlobalCommitedLSN = Long.parseLong(globalCommitedLSN); - assertThat(nGlobalCommitedLSN).isEqualTo(90); - } - - } - - // TODO: more mocking unit tests for different scenarios in StoreReader - // TODO: more mocking tests on how session work for StoreReader -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderTest.java deleted file mode 100644 index 7ed77154118c..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderTest.java +++ /dev/null @@ -1,831 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.VectorSessionToken; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.assertj.core.api.AssertionsForClassTypes; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; -import rx.subjects.PublishSubject; - -import java.net.URI; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.TimeUnit; - -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.StatusCodes.GONE; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.COMPLETING_PARTITION_MIGRATION; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.COMPLETING_SPLIT; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE; -import static org.assertj.core.api.Assertions.assertThat; - -public class StoreReaderTest { - private static final int TIMEOUT = 30000; - - - /** - * Tests for {@link StoreReader} - */ - @Test(groups = "unit") - public void startBackgroundAddressRefresh() throws Exception { - TransportClient transportClient = Mockito.mock(TransportClient.class); - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - StoreReader storeReader = new StoreReader(transportClient, addressSelector, sessionContainer); - - CyclicBarrier b = new CyclicBarrier(2); - PublishSubject> subject = PublishSubject.create(); - CountDownLatch c = new CountDownLatch(1); - - List uris = ImmutableList.of(URI.create("https://localhost:5050"), URI.create("https://localhost:5051"), - URI.create("https://localhost:50502"), URI.create("https://localhost:5053")); - - Mockito.doAnswer(new Answer() { - @Override - public Single> answer(InvocationOnMock invocationOnMock) throws Throwable { - - return subject.toSingle().doOnSuccess(x -> c.countDown()).doAfterTerminate(() -> { - new Thread() { - @Override - public void run() { - try { - b.await(); - } catch (Exception e) { - - } - } - }.start(); - }); - } - }).when(addressSelector).resolveAllUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.eq(true), Mockito.eq(true)); - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - storeReader.startBackgroundAddressRefresh(request); - - subject.onNext(uris); - subject.onCompleted(); - - TimeUnit.MILLISECONDS.sleep(100); - AssertionsForClassTypes.assertThat(c.getCount()).isEqualTo(0); - AssertionsForClassTypes.assertThat(b.getNumberWaiting()).isEqualTo(1); - b.await(1000, TimeUnit.MILLISECONDS); - } - - @DataProvider(name = "verifyCanContinueOnExceptionArgProvider") - public Object[][] verifyCanContinueOnExceptionArgProvider() { - return new Object[][]{ - {new PartitionKeyRangeGoneException(), false,}, - {new PartitionKeyRangeIsSplittingException(), false,}, - {new PartitionKeyRangeGoneException(), false,}, - {new PartitionIsMigratingException(), false,}, - {new GoneException(), true,}, - {ExceptionBuilder.create().withHeader(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "").asGoneException(), true,}, - {ExceptionBuilder.create().withHeader(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "0").asGoneException(), true,}, - {ExceptionBuilder.create().withHeader(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "1").asGoneException(), false,}, - }; - } - - @Test(groups = "unit", dataProvider = "verifyCanContinueOnExceptionArgProvider") - public void verifyCanContinueOnException(DocumentClientException dce, Boolean shouldVerify) { - DocumentClientException capturedFailure = null; - try { - StoreReader.verifyCanContinueOnException(dce); - } catch (DocumentClientException e) { - capturedFailure = e; - } - - if (shouldVerify) { - assertThat(capturedFailure).isNull(); - } else { - assertThat(capturedFailure).isEqualTo(dce); - } - } - - @DataProvider(name = "exceptionArgProvider") - public Object[][] exceptionArgProvider() { - return new Object[][]{ - // exception to be thrown from transportClient, expected (exception type, status, subStatus) - { new PartitionKeyRangeGoneException(), PartitionKeyRangeGoneException.class, GONE, PARTITION_KEY_RANGE_GONE, }, - { new PartitionKeyRangeIsSplittingException() , PartitionKeyRangeIsSplittingException.class, GONE, COMPLETING_SPLIT, }, - { new PartitionIsMigratingException(), PartitionIsMigratingException.class, GONE, COMPLETING_PARTITION_MIGRATION, }, - }; - } - - @Test(groups = "unit", dataProvider = "exceptionArgProvider") - public void exception(Exception ex, Class klass, int expectedStatusCode, Integer expectedSubStatusCode) { - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(ex) - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("1"); - Single> res = storeReader.readMultipleReplicaAsync(dsr, true, 3, true, true, ReadMode.Strong); - - FailureValidator failureValidator = FailureValidator.builder() - .instanceOf(klass) - .statusCode(expectedStatusCode) - .subStatusCode(expectedSubStatusCode) - .build(); - - TestSubscriber> subscriber = new TestSubscriber<>(); - res.subscribe(subscriber); - subscriber.awaitTerminalEvent(); - subscriber.assertNotCompleted(); - assertThat(subscriber.getOnErrorEvents()).hasSize(1); - failureValidator.validate(subscriber.getOnErrorEvents().get(0)); - } - - /** - * reading in session consistency, if the requested session token cannot be supported by some replicas - * tries others till we find a replica which can support the given session token - */ - @Test(groups = "unit") - public void sessionNotAvailableFromSomeReplicas_FindReplicaSatisfyingRequestedSession() { - long slowReplicaLSN = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + slowReplicaLSN); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(slowReplicaLSN)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(slowReplicaLSN)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - long fasterReplicaLSN = 651176; - - StoreResponse storeResponse = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + fasterReplicaLSN) - .withLSN(fasterReplicaLSN) - .withLocalLSN(fasterReplicaLSN) - .withQuorumAckecdLsn(fasterReplicaLSN) - .withQuorumAckecdLocalLsn(fasterReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(fasterReplicaLSN) - .withRequestCharge(1.1) - .build(); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read returns not found with lower lsn - .then(foundException) // 2nd replica read returns not found with lower lsn - .then(foundException) // 3rd replica read returns not found with lower lsn - .then(storeResponse) // 4th replica read returns storeResponse satisfying requested session token - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - dsr.requestContext.sessionToken = sessionToken.v; - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - assertThat(VectorSessionToken.tryCreate("-1#" + fasterReplicaLSN , sessionToken)).isTrue(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Single> readResult = storeReader.readMultipleReplicaAsync( - dsr, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN */ true, - /* useSessionToken */ true, - /* readMode */ ReadMode.Any, - /* checkMinLsn */ true, - /* forceReadAll */ false); - - MultiStoreResultValidator validator = MultiStoreResultValidator.create() - .withSize(1) - .validateEachWith(StoreResultValidator.create() - .isValid() - .noException() - .withStoreResponse(StoreResponseValidator.create() - .isSameAs(storeResponse) - .build()) - .build()) - .build(); - validateSuccess(readResult, validator); - - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1); - } - - /** - * Reading with session consistency, replicas have session token with higher than requested and return not found - */ - @Test(groups = "unit") - public void sessionRead_LegitimateNotFound() { - long lsn = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read returns not found - .then(foundException) // 2nd replica read returns not found - .then(foundException) // 3rd replica read returns not found - .then(foundException) // 4th replica read returns not found - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - dsr.requestContext.sessionToken = sessionToken.v; - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - assertThat(VectorSessionToken.tryCreate("-1#" + (lsn - 1) , sessionToken)).isTrue(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Single> readResult = storeReader.readMultipleReplicaAsync( - dsr, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN */ true, - /* useSessionToken */ true, - /* readMode */ ReadMode.Any, - /* checkMinLsn */ true, - /* forceReadAll */ false); - - MultiStoreResultValidator validator = MultiStoreResultValidator.create() - .withSize(1) - .validateEachWith(StoreResultValidator.create() - .isValid() - .withException(FailureValidator.builder().instanceOf(NotFoundException.class).build()) - .build()) - .build(); - validateSuccess(readResult, validator); - } - - /** - * reading in session consistency, none of the replicas can support the requested session token. - */ - @Test(groups = "unit") - public void sessionRead_ReplicasDoNotHaveTheRequestedLSN_NoResult() { - long lsn = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read returns not found - .then(foundException) // 2nd replica read returns not found - .then(foundException) // 3rd replica read returns not found - .then(foundException) // 4th replica read returns not found - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - dsr.requestContext.sessionToken = sessionToken.v; - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - assertThat(VectorSessionToken.tryCreate("-1#" + (lsn + 1) , sessionToken)).isTrue(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Single> readResult = storeReader.readMultipleReplicaAsync( - dsr, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN */ true, - /* useSessionToken */ true, - /* readMode */ ReadMode.Any, - /* checkMinLsn */ true, - /* forceReadAll */ false); - - MultiStoreResultValidator validator = MultiStoreResultValidator.create() - .withSize(0) - .build(); - validateSuccess(readResult, validator); - } - - @Test(groups = "unit") - public void requestRateTooLarge_BubbleUp() { - long lsn = 1045395; - long globalCommittedLsn = 1045395; - String partitionKeyRangeId = "257"; - - RequestRateTooLargeException requestRateTooLargeException = new RequestRateTooLargeException(); - requestRateTooLargeException.getResponseHeaders().put(HttpConstants.HttpHeaders.LSN, Long.toString(lsn)); - requestRateTooLargeException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - requestRateTooLargeException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(lsn)); - requestRateTooLargeException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(requestRateTooLargeException) // 1st replica read returns 429 - .then(requestRateTooLargeException) // 2nd replica read returns 429 - .then(requestRateTooLargeException) // 3rd replica read returns 429 - .then(requestRateTooLargeException) // 4th replica read returns 429 - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - dsr.requestContext.sessionToken = sessionToken.v; - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("1"); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - assertThat(VectorSessionToken.tryCreate("-1#" + (lsn - 1) , sessionToken)).isTrue(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Single> readResult = storeReader.readMultipleReplicaAsync( - dsr, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN */ true, - /* useSessionToken */ true, - /* readMode */ ReadMode.Any, - /* checkMinLsn */ true, - /* forceReadAll */ false); - - MultiStoreResultValidator validator = MultiStoreResultValidator.create() - .withSize(1) - .validateEachWith(FailureValidator.builder().instanceOf(RequestRateTooLargeException.class).build()) - .build(); - validateSuccess(readResult, validator); - } - - @Test(groups = "unit") - public void readPrimaryAsync() { - TransportClient transportClient = Mockito.mock(TransportClient.class); - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - URI primaryURI = URI.create("primaryLoc"); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12"); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(Single.just(primaryURI)).when(addressSelector).resolvePrimaryUriAsync( - Mockito.eq(request) , Mockito.eq(false)); - - StoreResponse storeResponse = Mockito.mock(StoreResponse.class); - Mockito.doReturn(Single.just(storeResponse)).when(transportClient).invokeResourceOperationAsync(Mockito.eq(primaryURI), Mockito.eq(request)); - - StoreReader storeReader = new StoreReader(transportClient, addressSelector, sessionContainer); - - Single readResult = storeReader.readPrimaryAsync(request, true, true); - StoreResultValidator validator = StoreResultValidator.create() - .withStoreResponse(StoreResponseValidator.create().isSameAs(storeResponse).build()) - .build(); - validateSuccess(readResult, validator); - } - - @Test(groups = "unit") - public void readPrimaryAsync_GoneFromReplica() { - TransportClient transportClient = Mockito.mock(TransportClient.class); - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - URI primaryURI = URI.create("primaryLoc"); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12"); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(Single.just(primaryURI)).when(addressSelector).resolvePrimaryUriAsync( - Mockito.eq(request) , Mockito.eq(false)); - - Mockito.doReturn(Single.error(ExceptionBuilder.create().asGoneException())).when(transportClient).invokeResourceOperationAsync(Mockito.eq(primaryURI), Mockito.eq(request)); - StoreReader storeReader = new StoreReader(transportClient, addressSelector, sessionContainer); - Single readResult = storeReader.readPrimaryAsync(request, true, true); - - FailureValidator validator = FailureValidator.builder().instanceOf(GoneException.class).build(); - validateException(readResult, validator); - } - - @Test(groups = "unit") - public void readPrimaryAsync_GoneExceptionOnTimeout() { - TransportClient transportClient = Mockito.mock(TransportClient.class); - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - URI primaryURI = URI.create("primaryLoc"); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - Mockito.doReturn(true).when(request.requestContext.timeoutHelper).isElapsed(); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12"); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(Single.just(primaryURI)).when(addressSelector).resolvePrimaryUriAsync( - Mockito.eq(request) , Mockito.eq(false)); - - StoreResponse storeResponse = Mockito.mock(StoreResponse.class); - Mockito.doReturn(Single.just(storeResponse)).when(transportClient).invokeResourceOperationAsync(Mockito.eq(primaryURI), Mockito.eq(request)); - - StoreReader storeReader = new StoreReader(transportClient, addressSelector, sessionContainer); - - Single readResult = storeReader.readPrimaryAsync(request, true, true); - FailureValidator validator = FailureValidator.builder().instanceOf(GoneException.class).build(); - validateException(readResult, validator); - } - - @DataProvider(name = "readPrimaryAsync_RetryOnGoneArgProvider") - public Object[][] readPrimaryAsync_RetryOnGoneArgProvider() { - return new Object[][]{ - // first exception from TransportClient, - // performLocalRefreshOnGoneException, - // retry with force refresh expected, - // validator for expected Exception from Single - // StoreResult has a successful StoreResponse - { - // partition moved, refresh replica address cache and retry - ExceptionBuilder.create().asGoneException(), true, true, null, true - }, - - { - // partition moved, refresh replica address cache is not requested, fail - ExceptionBuilder.create().asGoneException(), false, false, FailureValidator.builder().instanceOf(GoneException.class).build(), false - }, - - { - // invalid partition exception represents collection stale, cannot succeed, propagate failure - ExceptionBuilder.create().asInvalidPartitionException(), true, false, null, false - }, - - { - // cannot continue on partition key range gone, require address cache refresh - ExceptionBuilder.create().asPartitionKeyRangeGoneException(), true, false, - FailureValidator.builder().instanceOf(PartitionKeyRangeGoneException.class).build(), true - }, - - { - // cannot continue on partition split, require address cache refresh - ExceptionBuilder.create().asPartitionKeyRangeIsSplittingException(), true, false, - FailureValidator.builder().instanceOf(PartitionKeyRangeIsSplittingException.class).build(), true - }, - - { - // cannot continue on partition split, require address cache refresh - ExceptionBuilder.create().asPartitionIsMigratingException(), true, false, - FailureValidator.builder().instanceOf(PartitionIsMigratingException.class).build(), true - }, - }; - } - - @Test(groups = "unit", dataProvider = "readPrimaryAsync_RetryOnGoneArgProvider") - public void readPrimaryAsync_RetryOnPrimaryReplicaMove(Exception firstExceptionFromTransport, - boolean performLocalRefreshOnGoneException, - boolean retryWithForceRefreshExpected, - FailureValidator failureFromSingle, - boolean expectedStoreResponseInStoredReadResult) { - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreResponse response = StoreResponseBuilder.create().build(); - - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.sequentialBuilder() - .then(firstExceptionFromTransport) - .then(response) - .build(); - - URI primaryURIPriorToRefresh = URI.create("stale"); - URI primaryURIAfterRefresh = URI.create("new"); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext.performLocalRefreshOnGoneException = performLocalRefreshOnGoneException; - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12"); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.PrimaryReplicaMoveBuilder.create(Protocol.Https) - .withPrimaryReplicaMove(primaryURIPriorToRefresh, primaryURIAfterRefresh).build(); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - Single readResult = storeReader.readPrimaryAsync(request, true, true); - - if (failureFromSingle == null) { - StoreResultValidator validator; - if (expectedStoreResponseInStoredReadResult) { - validator = StoreResultValidator.create().withStoreResponse(StoreResponseValidator.create().isSameAs(response).build()).build(); - } else { - validator = StoreResultValidator.create().withException(FailureValidator.builder().sameAs(firstExceptionFromTransport).build()).build(); - } - - validateSuccess(readResult, validator); - } else { - validateException(readResult, failureFromSingle); - } - - int numberOfAttempts = 1 + (retryWithForceRefreshExpected ? 1: 0); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(numberOfAttempts); - - addressSelectorWrapper.validate() - .verifyResolveAddressesAsync(0) - .verifyResolveAllUriAsync(0) - .verifyVesolvePrimaryUriAsyncCount(numberOfAttempts) - .verifyNumberOfForceCachRefresh(retryWithForceRefreshExpected ? 1: 0); - } - - @DataProvider(name = "readMultipleReplicasAsyncArgProvider") - public Object[][] readMultipleReplicasAsyncArgProvider() { - return new Object[][]{ - // boolean includePrimary, int replicaCountToRead, ReadMode.Strong - { false, 3, ReadMode.Strong }, - { true, 3, ReadMode.Strong }, - { false, 3, ReadMode.Any }, - { true, 3, ReadMode.Any }, - { true, 2, ReadMode.Any }, - { false, 2, ReadMode.Any }, - { true, 1, ReadMode.Any }, - { false, 1, ReadMode.Any }, - }; - } - - @Test(groups = "unit", dataProvider = "readMultipleReplicasAsyncArgProvider") - public void readMultipleReplicasAsync(boolean includePrimary, int replicaCountToRead, ReadMode readMode) { - // This adds basic tests for StoreReader.readMultipleReplicasAsync(.) without failure - // TODO: add some tests for readMultipleReplicasAsync which mock behaviour of failure of reading from a replica - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2"), URI.create("secondary3")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12"); - - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - double requestChargePerRead = 1.1; - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(18) - .withRequestCharge(requestChargePerRead) - .build(); - StoreResponse secondaryResponse1 = StoreResponseBuilder.create() - .withLSN(50) - .withLocalLSN(17) - .withRequestCharge(requestChargePerRead) - .build(); - StoreResponse secondaryResponse2 = StoreResponseBuilder.create() - .withLSN(49) - .withLocalLSN(16) - .withRequestCharge(requestChargePerRead) - .build(); - StoreResponse secondaryResponse3 = StoreResponseBuilder.create() - .withLSN(48) - .withLocalLSN(15) - .withRequestCharge(requestChargePerRead) - .build(); - - List responseList = ImmutableList.of(primaryResponse, secondaryResponse1, secondaryResponse2, secondaryResponse3); - - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryReplicaURI, OperationType.Read, ResourceType.Document, primaryResponse, false) - .storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, false) - .storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, false) - .storeResponseOn(secondaryReplicaURIs.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, false) - .build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - Single> readResult = storeReader.readMultipleReplicaAsync(request, includePrimary, replicaCountToRead, true, true, readMode); - - long expectedMinLsn = - responseList - .stream() - .filter(sr -> (sr != primaryResponse || includePrimary)) - .mapToLong(sr -> - { - String value = (ReadMode.Strong == readMode)? - sr.getHeaderValue(WFConstants.BackendHeaders.LSN) : - sr.getHeaderValue(WFConstants.BackendHeaders.LOCAL_LSN); - return Long.parseLong(value); - }) - .min().orElse(-1); - - - MultiStoreResultValidator validator = MultiStoreResultValidator.create() - .withSize(replicaCountToRead) - .withMinimumLSN(expectedMinLsn) - .noFailure() - .withTotalRequestCharge(requestChargePerRead * replicaCountToRead) - .build(); - validateSuccess(readResult, validator); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(replicaCountToRead); - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator, long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateSuccess(Single single, - StoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single single, - StoreResultValidator validator, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateException(Single single, - FailureValidator validator, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - public static void validateException(Single single, - FailureValidator validator) { - validateException(single, validator, TIMEOUT); - } - - private PartitionKeyRange partitionKeyRangeWithId(String id) { - PartitionKeyRange partitionKeyRange = Mockito.mock(PartitionKeyRange.class); - Mockito.doReturn(id).when(partitionKeyRange).getId(); - return partitionKeyRange; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderUnderTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderUnderTest.java deleted file mode 100644 index f2953ac71c4e..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderUnderTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.lang3.tuple.Pair; -import rx.Single; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class StoreReaderUnderTest extends StoreReader { - - public List>> invocations = Collections.synchronizedList(new ArrayList<>()); - - public StoreReaderUnderTest(TransportClient transportClient, AddressSelector addressSelector, ISessionContainer sessionContainer) { - super(transportClient, addressSelector, sessionContainer); - } - - @Override - public Single> readMultipleReplicaAsync(RxDocumentServiceRequest entity, boolean includePrimary, int replicaCountToRead, boolean requiresValidLsn, boolean useSessionToken, ReadMode readMode) { - Method method = new Object(){}.getClass().getEnclosingMethod(); - ImmutableList list = ImmutableList.of(entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode); - invocations.add(Pair.of(method, list)); - - return super.readMultipleReplicaAsync(entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode); - } - - @Override - public Single> readMultipleReplicaAsync(RxDocumentServiceRequest entity, boolean includePrimary, int replicaCountToRead, boolean requiresValidLsn, boolean useSessionToken, ReadMode readMode, boolean checkMinLSN, boolean forceReadAll) { - Method method = new Object(){}.getClass().getEnclosingMethod(); - ImmutableList list = ImmutableList.of(entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode, checkMinLSN, forceReadAll); - invocations.add(Pair.of(method, list)); - return super.readMultipleReplicaAsync(entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode, checkMinLSN, forceReadAll); - } - - @Override - public Single readPrimaryAsync(RxDocumentServiceRequest entity, boolean requiresValidLsn, boolean useSessionToken) { - Method method = new Object(){}.getClass().getEnclosingMethod(); - ImmutableList list = ImmutableList.of(entity, requiresValidLsn, useSessionToken); - invocations.add(Pair.of(method, list)); - return super.readPrimaryAsync(entity, requiresValidLsn, useSessionToken); - } - -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseValidator.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseValidator.java deleted file mode 100644 index 708d2a36b9a3..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseValidator.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import org.assertj.core.api.Condition; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public interface StoreResponseValidator { - - void validate(StoreResponse storeResponse); - - public static Builder create() { - return new Builder(); - } - - public class Builder { - private List validators = new ArrayList<>(); - - public StoreResponseValidator build() { - return new StoreResponseValidator() { - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public void validate(StoreResponse resp) { - for (StoreResponseValidator validator : validators) { - validator.validate(resp); - } - } - }; - } - public Builder hasHeader(String headerKey) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(Arrays.asList(resp.getResponseHeaderNames())).asList().contains(headerKey); - } - }); - return this; - } - public Builder withHeader(String headerKey, String headerValue) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(Arrays.asList(resp.getResponseHeaderNames())).asList().contains(headerKey); - int index = Arrays.asList(resp.getResponseHeaderNames()).indexOf(headerKey); - assertThat(resp.getResponseHeaderValues()[index]).isEqualTo(headerValue); - } - }); - return this; - } - - public Builder withHeaderValueCondition(String headerKey, Condition condition) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(Arrays.asList(resp.getResponseHeaderNames())).asList().contains(headerKey); - int index = Arrays.asList(resp.getResponseHeaderNames()).indexOf(headerKey); - String value = resp.getResponseHeaderValues()[index]; - condition.matches(value); - } - }); - return this; - } - - public Builder isSameAs(StoreResponse storeResponse) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(resp).isSameAs(storeResponse); - } - }); - return this; - } - - public Builder withContent(String content) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(content).isEqualTo(resp.getResponseBody()); - } - }); - return this; - } - - public Builder withStatus(int status) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(status == resp.getStatus()).isTrue(); - } - }); - return this; - } - - public Builder in(StoreResponse... storeResponse) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(resp).isIn((Object[]) storeResponse); - } - }); - return this; - } - - public Builder withBEActivityId(String activityId) { - withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, activityId); - return this; - } - - public Builder withRequestCharge(double value) { - withHeader(HttpConstants.HttpHeaders.REQUEST_CHARGE, Double.toString(value)); - return this; - } - - public Builder withRequestChargeGreaterThanOrEqualTo(double value) { - withHeaderValueCondition(HttpConstants.HttpHeaders.REQUEST_CHARGE, new Condition<>(s -> { - try { - double parsed = Double.parseDouble(s); - return parsed >= value; - } catch (Exception e) { - return false; - } - }, "request charge should be greater than or equal to " + value)); - return this; - } - - public Builder withRequestChargeLessThanOrEqualTo(double value) { - withHeaderValueCondition(HttpConstants.HttpHeaders.REQUEST_CHARGE, new Condition<>(s -> { - try { - double parsed = Double.parseDouble(s); - return parsed <= value; - } catch (Exception e) { - return false; - } - }, "request charge should be greater than or equal to " + value)); - return this; - } - - - public Builder withBELSN(long lsn) { - withHeader(WFConstants.BackendHeaders.LSN, Long.toString(lsn)); - return this; - } - - public Builder withBELocalLSN(long lsn) { - withHeader(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(lsn)); - return this; - } - - public Builder withBELSNGreaterThanOrEqualTo(long minLSN) { - Condition condition = new Condition<>(value -> { - try { - Long valueAsLong = Long.parseLong(value); - return valueAsLong > minLSN; - } catch (Exception e) { - return false; - } - }, "min lsn"); - withHeaderValueCondition(WFConstants.BackendHeaders.LSN, condition); - return this; - } - - public Builder withBEGlobalLSNGreaterThanOrEqualTo(long minLSN) { - Condition condition = new Condition<>(value -> { - try { - Long valueAsLong = Long.parseLong(value); - return valueAsLong > minLSN; - } catch (Exception e) { - return false; - } - }, "min global lsn"); - withHeaderValueCondition(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, condition); - return this; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResultValidator.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResultValidator.java deleted file mode 100644 index a526001f84dd..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResultValidator.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.fail; - - -public interface StoreResultValidator { - - static Builder create() { - return new Builder(); - } - - void validate(StoreResult storeResult); - - class Builder { - private List validators = new ArrayList<>(); - - public StoreResultValidator build() { - return new StoreResultValidator() { - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public void validate(StoreResult storeResult) { - for (StoreResultValidator validator : validators) { - validator.validate(storeResult); - } - } - }; - } - - public Builder withStoreResponse(StoreResponseValidator storeResponseValidator) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - try { - storeResponseValidator.validate(storeResult.toResponse()); - }catch (DocumentClientException e) { - fail(e.getMessage()); - } - } - }); - return this; - } - - public Builder withException(FailureValidator failureValidator) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - try { - failureValidator.validate(storeResult.getException()); - }catch (DocumentClientException e) { - fail(e.getMessage()); - } - } - }); - return this; - } - - public Builder withLSN(long lsn) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.lsn).isEqualTo(lsn); - } - }); - return this; - } - - public Builder withMinLSN(long minLSN) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.lsn).isGreaterThanOrEqualTo(minLSN); - } - }); - return this; - } - - public Builder withGlobalCommitedLSN(long globalLsn) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.globalCommittedLSN).isEqualTo(globalLsn); - } - }); - return this; - } - - public Builder withQuorumAckedLsn(long quorumAckedLsn) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.quorumAckedLSN).isEqualTo(quorumAckedLsn); - } - }); - return this; - } - - public Builder noException() { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult).hasFieldOrPropertyWithValue("exception", null); - assertThat(storeResult.isGoneException).isFalse(); - } - }); - return this; - } - - public Builder isValid() { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.isValid).isTrue(); - } - }); - return this; - } - - public Builder withReplicaSize(int count) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.currentReplicaSetSize).isEqualTo(count); - } - }); - return this; - } - - public Builder withStorePhysicalURI(URI expectedURi) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.storePhysicalAddress).isEqualTo(expectedURi); - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelperTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelperTest.java deleted file mode 100644 index 4f0b3105087b..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelperTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import org.testng.annotations.Test; - -import java.time.Duration; - -import static org.assertj.core.api.Assertions.assertThat; - -public class TimeoutHelperTest { - - @Test(groups = "unit") - public void isElapsed() throws InterruptedException { - Duration duration1 = Duration.ofMillis(100); - TimeoutHelper timeoutHelper1 = new TimeoutHelper(duration1); - assertThat(timeoutHelper1.isElapsed()).isFalse(); - - Duration duration2 = Duration.ofMillis(100); - TimeoutHelper timeoutHelper2 = new TimeoutHelper(duration2); - Thread.sleep(100); - assertThat(timeoutHelper2.isElapsed()).isTrue(); - } - - @Test(groups = "unit") - public void getRemainingTime() throws InterruptedException { - for (int i = 1; i <= 5; i++) { - Duration duration = Duration.ofMillis(100); - TimeoutHelper timeoutHelper = new TimeoutHelper(duration); - Thread.sleep((10*i)); - Duration remainingTime1 = timeoutHelper.getRemainingTime(); - //Giving 5 ms extra buffer in case thread sleep complete early - assertThat(remainingTime1.toMillis()).isLessThanOrEqualTo(100-10*i+5); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClientWrapper.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClientWrapper.java deleted file mode 100644 index c92b6204b3ec..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClientWrapper.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.lang3.tuple.Pair; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Function; - -import static org.assertj.core.api.Assertions.assertThat; - -public class TransportClientWrapper { - private static Logger logger = LoggerFactory.getLogger(TransportClientWrapper.class); - public final TransportClient transportClient; - private final AtomicBoolean valid; - private final AtomicInteger cnt; - private final List> requests; - - TransportClientWrapper(TransportClient transportClient, AtomicInteger cnt, AtomicBoolean valid, List> requests) { - this.transportClient = transportClient; - this.valid = valid; - this.cnt = cnt; - this.requests = requests; - } - - public static class TransportClientWrapperVerificationBuilder { - private List> actions = new ArrayList<>(); - - public static TransportClientWrapperVerificationBuilder create() { - return new TransportClientWrapperVerificationBuilder(); - } - - public TransportClientWrapperVerificationBuilder verifyNumberOfInvocations(int count) { - actions.add(transportClientWrapper -> { - assertThat(transportClientWrapper.getNumberOfInvocations()).isEqualTo(count); - return null; - }); - return this; - } - - public void execute(TransportClientWrapper transportClientWrapper) { - for(Function action: actions) { - action.apply(transportClientWrapper); - } - } - } - - public TransportClientWrapper verifyNumberOfInvocations(int count) { - assertThat(cnt.get()).isEqualTo(count); - return this; - } - - public List> getCapturedArgs() { - return requests; - } - - public int getNumberOfInvocations() { - return cnt.get(); - } - - public TransportClientWrapper validate() { - assertThat(valid).isTrue(); - return this; - } - - public interface Builder { - - static void capture(List> capturedRequests, InvocationOnMock invocation) { - URI physicalUri = invocation.getArgumentAt(0, URI.class); - RxDocumentServiceRequest request = invocation.getArgumentAt(1, RxDocumentServiceRequest.class); - logger.debug("URI: {}, request {}", physicalUri, request); - capturedRequests.add(Pair.of(physicalUri, request)); - } - - TransportClientWrapper build(); - - public static ReplicaResponseBuilder replicaResponseBuilder() { - return new ReplicaResponseBuilder(); - } - - class ReplicaResponseBuilder implements Builder { - Map responseFunctionDictionary = new HashMap<>(); - - public ReplicaResponseBuilder addReplica(URI replicaURI, - Function2WithCheckedException invocationNumberToStoreResponse) { - - responseFunctionDictionary.put(replicaURI, invocationNumberToStoreResponse); - return this; - } - - public TransportClientWrapper build() { - - Map replicaResponseCounterDict = new HashMap<>(); - - AtomicInteger i = new AtomicInteger(0); - AtomicBoolean valid = new AtomicBoolean(true); - List> capturedArgs = Collections.synchronizedList(new ArrayList<>()); - - TransportClient transportClient = Mockito.mock(TransportClient.class); - Mockito.doAnswer(invocation -> { - i.incrementAndGet(); - URI physicalUri = invocation.getArgumentAt(0, URI.class); - RxDocumentServiceRequest request = invocation.getArgumentAt(1, RxDocumentServiceRequest.class); - Function2WithCheckedException function = responseFunctionDictionary.get(physicalUri); - if (function == null) { - valid.set(false); - return Single.error(new IllegalStateException("no registered function for replica " + physicalUri)); - } - int current; - synchronized (transportClient) { - capture(capturedArgs, invocation); - - AtomicInteger cnt = replicaResponseCounterDict.get(physicalUri); - if (cnt == null) { - cnt = new AtomicInteger(0); - replicaResponseCounterDict.put(physicalUri, cnt); - } - - current = cnt.getAndIncrement(); - } - - try { - return Single.just(function.apply(current, request)); - } catch (Exception e) { - return Single.error(e); - } - - }).when(transportClient).invokeResourceOperationAsync(Mockito.any(URI.class), Mockito.any(RxDocumentServiceRequest.class)); - - return new TransportClientWrapper(transportClient, i, valid, capturedArgs); - } - } - - - static SequentialBuilder sequentialBuilder() { - return new SequentialBuilder(); - } - - class SequentialBuilder implements Builder { - private List list = new ArrayList<>(); - - public SequentialBuilder then(StoreResponse response) { - list.add(response); - return this; - } - - public SequentialBuilder then(Exception exception) { - list.add(exception); - return this; - } - - public TransportClientWrapper build() { - AtomicInteger i = new AtomicInteger(0); - AtomicBoolean valid = new AtomicBoolean(true); - List> capturedArgs = Collections.synchronizedList(new ArrayList<>()); - - TransportClient transportClient = Mockito.mock(TransportClient.class); - Mockito.doAnswer(invocation -> { - capture(capturedArgs, invocation); - - int current = i.getAndIncrement(); - if (current >= list.size()) { - valid.set(false); - return Single.error(new IllegalStateException()); - } - Object obj = list.get(current); - StoreResponse response = Utils.as(obj, StoreResponse.class); - if (response != null) { - return Single.just(response); - } else { - return Single.error((Exception) obj); - } - - }).when(transportClient).invokeResourceOperationAsync(Mockito.any(URI.class), Mockito.any(RxDocumentServiceRequest.class)); - - return new TransportClientWrapper(transportClient, i, valid, capturedArgs); - } - } - - static UriToResultBuilder uriToResultBuilder() { - return new UriToResultBuilder(); - } - - class UriToResultBuilder implements Builder { - private static class Result { - StoreResponse storeResponse; - Exception exception; - boolean stickyResult; - - public Result(StoreResponse storeResponse, Exception exception, boolean stickyResult) { - this.storeResponse = storeResponse; - this.exception = exception; - this.stickyResult = stickyResult; - } - } - - private static class Tuple { - URI replicaURI; - OperationType operationType; - ResourceType resourceType; - - public Tuple(URI replicaURI, OperationType operationType, ResourceType resourceType) { - this.replicaURI = replicaURI; - this.operationType = operationType; - this.resourceType = resourceType; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Tuple tuple = (Tuple) o; - return Objects.equals(replicaURI, tuple.replicaURI) && - operationType == tuple.operationType && - resourceType == tuple.resourceType; - } - - @Override - public int hashCode() { - return Objects.hash(replicaURI, operationType, resourceType); - } - - @Override - public String toString() { - return "Tuple{" + - "replicaURI=" + replicaURI + - ", operationType=" + operationType + - ", resourceType=" + resourceType + - '}'; - } - } - private Map> uriToResult = new HashMap<>(); - - - private UriToResultBuilder resultOn(URI replicaURI, OperationType operationType, ResourceType resourceType, StoreResponse rsp, Exception ex, boolean stickyResult) { - Tuple key = new Tuple(replicaURI, operationType, resourceType); - List list = uriToResult.get(key); - if (list == null) { - list = new ArrayList<>(); - uriToResult.put(key, list); - } - list.add(new Result(rsp, ex, stickyResult)); - return this; - } - - public UriToResultBuilder storeResponseOn(URI replicaURI, OperationType operationType, ResourceType resourceType, StoreResponse response, boolean stickyResult) { - resultOn(replicaURI, operationType, resourceType, response, null, stickyResult); - return this; - } - - public UriToResultBuilder exceptionOn(URI replicaURI, OperationType operationType, ResourceType resourceType, Exception exception, boolean stickyResult) { - resultOn(replicaURI, operationType, resourceType, null, exception, stickyResult); - return this; - } - - public TransportClientWrapper build() { - AtomicBoolean valid = new AtomicBoolean(true); - AtomicInteger cnt = new AtomicInteger(0); - List> capturedArgs = Collections.synchronizedList(new ArrayList<>()); - TransportClient transportClient = Mockito.mock(TransportClient.class); - Mockito.doAnswer(invocation -> { - cnt.getAndIncrement(); - URI physicalUri = invocation.getArgumentAt(0, URI.class); - RxDocumentServiceRequest request = invocation.getArgumentAt(1, RxDocumentServiceRequest.class); - capture(capturedArgs, invocation); - - Tuple tuple = new Tuple(physicalUri, request.getOperationType(), request.getResourceType()); - List list = uriToResult.get(tuple); - if (list == null || list.isEmpty()) { - // unknown - valid.set(false); - return Single.error(new IllegalStateException(tuple.toString())); - } - - Result result = list.get(0); - - if (!result.stickyResult) { - list.remove(0); - } - if (result.storeResponse != null) { - return Single.just(result.storeResponse); - } else { - return Single.error(result.exception); - } - - }).when(transportClient).invokeResourceOperationAsync(Mockito.any(URI.class), Mockito.any(RxDocumentServiceRequest.class)); - - return new TransportClientWrapper(transportClient, cnt, valid, capturedArgs); - } - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtilityTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtilityTest.java deleted file mode 100644 index 8d80eece8e9f..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtilityTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import io.netty.channel.ChannelException; -import io.netty.channel.ConnectTimeoutException; -import io.netty.handler.timeout.ReadTimeoutException; -import io.reactivex.netty.client.PoolExhaustedException; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import javax.net.ssl.SSLHandshakeException; -import javax.net.ssl.SSLPeerUnverifiedException; -import java.net.ConnectException; -import java.net.NoRouteToHostException; -import java.net.SocketTimeoutException; -import java.net.UnknownHostException; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -/** - * validation tests for {@link WebExceptionUtility} - */ -public class WebExceptionUtilityTest { - - @DataProvider(name = "exceptionToIsRetriable") - public Object[][] exceptionToIsRetriable() { - return new Object[][]{ - // exception, is retriable - { - new RuntimeException(), false - }, - { - new ConnectException(), true - }, - { - new ConnectTimeoutException(), true - }, - { - new UnknownHostException(), true - }, - { - ReadTimeoutException.INSTANCE, false - }, - { - new SSLHandshakeException("dummy"), true - }, - { - new NoRouteToHostException(), true, - }, - { - new SSLPeerUnverifiedException("dummy"), true - }, - { - new SocketTimeoutException(), false - }, - { - new PoolExhaustedException(), true - } - }; - } - - @Test(groups = "unit", dataProvider = "exceptionToIsRetriable") - public void isWebExceptionRetriable(Exception e, boolean isRetriable) { - boolean actualRes = WebExceptionUtility.isWebExceptionRetriable(e); - if (isRetriable) { - assertThat(actualRes).describedAs(e.toString()).isTrue(); - } else { - assertThat(actualRes).describedAs(e.toString()).isFalse(); - } - } - - @DataProvider(name = "networkFailure") - public Object[][] networkFailure() { - return new Object[][]{ - // exception, is retriable - { - new RuntimeException(), false - }, - { - new ConnectException(), true - }, - { - new ConnectTimeoutException(), true - }, - { - new UnknownHostException(), true - }, - { - ReadTimeoutException.INSTANCE, true - }, - { - new SSLHandshakeException("dummy"), true - }, - { - new NoRouteToHostException(), true, - }, - { - new SSLPeerUnverifiedException("dummy"), true - }, - { - new SocketTimeoutException(), true - }, - { - new ChannelException(), true - } - }; - } - - @Test(groups = "unit", dataProvider = "networkFailure") - public void isNetworkFailure(Exception e, boolean isNetworkFailure) { - boolean actualRes = WebExceptionUtility.isNetworkFailure(e); - if (isNetworkFailure) { - assertThat(actualRes).describedAs(e.toString()).isTrue(); - } else { - assertThat(actualRes).describedAs(e.toString()).isFalse(); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalUtils.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalUtils.java deleted file mode 100644 index b4e9875f6cf8..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalUtils.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import com.google.common.collect.ImmutableList; - -public class PartitionKeyInternalUtils { - - public static PartitionKeyInternal createPartitionKeyInternal(String str) { - return new PartitionKeyInternal(ImmutableList.of( - new StringPartitionKeyComponent(str))); - - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtilsTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtilsTest.java deleted file mode 100644 index 606380453aba..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtilsTest.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.internal.Quadruple; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GoneException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponseBuilder; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponseValidator; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RetryUtils; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy.ShouldRetryResult; - -import rx.Single; -import rx.functions.Func1; -import rx.observers.TestSubscriber; - -public class RetryUtilsTest { - IRetryPolicy retryPolicy; - Func1, Single> callbackMethod; - Func1, Single> inBackoffAlternateCallbackMethod; - private static final Duration minBackoffForInBackoffCallback = Duration.ofMillis(10); - private static final int TIMEOUT = 30000; - private static final Duration BACK_OFF_DURATION = Duration.ofMillis(20); - private StoreResponse storeResponse; - - @BeforeClass(groups = { "unit" }) - public void beforeClass() throws Exception { - retryPolicy = Mockito.mock(IRetryPolicy.class); - callbackMethod = Mockito.mock(Func1.class); - inBackoffAlternateCallbackMethod = Mockito.mock(Func1.class); - storeResponse = getStoreResponse(); - } - - /** - * This method will make sure we are throwing original exception in case of - * ShouldRetryResult.noRetry() instead of Single.error(null). - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void toRetryWithAlternateFuncWithNoRetry() { - Func1> onErrorFunc = RetryUtils.toRetryWithAlternateFunc(callbackMethod, - retryPolicy, inBackoffAlternateCallbackMethod, minBackoffForInBackoffCallback); - Mockito.when(retryPolicy.shouldRetry(Matchers.any())).thenReturn(Single.just(ShouldRetryResult.noRetry())); - Single response = onErrorFunc.call(new GoneException()); - validateFailure(response, TIMEOUT, GoneException.class); - } - - /** - * This method will test retries on callbackMethod, eventually returning success - * response after some failures and making sure it failed for at least specific - * number before passing. - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void toRetryWithAlternateFuncTestingMethodOne() { - Func1> onErrorFunc = RetryUtils.toRetryWithAlternateFunc(callbackMethod, - retryPolicy, null, minBackoffForInBackoffCallback); - - toggleMockFuncBtwFailureSuccess(callbackMethod); - Mockito.when(retryPolicy.shouldRetry(Matchers.any())) - .thenReturn(Single.just(ShouldRetryResult.retryAfter(BACK_OFF_DURATION))); - Single response = onErrorFunc.call(new GoneException()); - StoreResponseValidator validator = StoreResponseValidator.create().withStatus(storeResponse.getStatus()) - .withContent(storeResponse.getResponseBody()).build(); - validateSuccess(response, validator, TIMEOUT); - Mockito.verify(callbackMethod, Mockito.times(4)).call(Matchers.any()); - } - - /** - * This method will test retries on inBackoffAlternateCallbackMethod, eventually - * returning success response after some failures and making sure it failed for - * at least specific number before passing. - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void toRetryWithAlternateFuncTestingMethodTwo() { - Func1> onErrorFunc = RetryUtils.toRetryWithAlternateFunc(callbackMethod, - retryPolicy, inBackoffAlternateCallbackMethod, minBackoffForInBackoffCallback); - Mockito.when(callbackMethod.call(Matchers.any())).thenReturn(Single.error(new GoneException())); - toggleMockFuncBtwFailureSuccess(inBackoffAlternateCallbackMethod); - Mockito.when(retryPolicy.shouldRetry(Matchers.any())) - .thenReturn(Single.just(ShouldRetryResult.retryAfter(BACK_OFF_DURATION))); - Single response = onErrorFunc.call(new GoneException()); - StoreResponseValidator validator = StoreResponseValidator.create().withStatus(storeResponse.getStatus()) - .withContent(storeResponse.getResponseBody()).build(); - validateSuccess(response, validator, TIMEOUT); - Mockito.verify(inBackoffAlternateCallbackMethod, Mockito.times(4)).call(Matchers.any()); - } - - private void validateFailure(Single single, long timeout, Class class1) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - if (!(testSubscriber.getOnErrorEvents().get(0).getClass().equals(class1))) { - fail("Not expecting " + testSubscriber.getOnErrorEvents().get(0)); - } - } - - private void validateSuccess(Single single, StoreResponseValidator validator, long timeout) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - assertThat(testSubscriber.getOnNextEvents()).hasSize(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - private void toggleMockFuncBtwFailureSuccess( - Func1, Single> method) { - Mockito.when(method.call(Matchers.any())).thenAnswer(new Answer>() { - - private int count = 0; - - @Override - public Single answer(InvocationOnMock invocation) throws Throwable { - if (count++ < 3) { - return Single.error(new GoneException()); - } - return Single.just(storeResponse); - } - }); - } - - private StoreResponse getStoreResponse() { - StoreResponseBuilder storeResponseBuilder = new StoreResponseBuilder().withContent("Test content") - .withStatus(200); - return storeResponseBuilder.build(); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/resources/log4j.properties b/cosmosdb/data-plane/direct-impl/src/test/resources/log4j.properties deleted file mode 100644 index 00b89ecf16b7..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/resources/log4j.properties +++ /dev/null @@ -1,16 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# Set HTTP components' logger to INFO - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -log4j.category.com.microsoft.azure.cosmosdb=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/examples/pom.xml b/cosmosdb/data-plane/examples/pom.xml deleted file mode 100644 index 52ef7db4eeda..000000000000 --- a/cosmosdb/data-plane/examples/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - - azure-cosmosdb-examples - Async SDK for SQL API of Azure Cosmos DB Service - Examples - Examples for Async SDK for SQL API of Azure Cosmos DB Service - - - UTF-8 - 1.7.6 - 1.2.17 - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - com.microsoft.azure.cosmosdb.benchmark.Main - - - - maven-assembly-plugin - 2.2 - - - jar-with-dependencies - - - - com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples.Main - - - - - - make-assembly - package - - single - - - - - - - - - com.microsoft.azure - azure-cosmosdb - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - - - com.google.guava - guava - ${guava.version} - - - io.reactivex - rxjava-guava - 1.0.3 - test - - - org.testng - testng - ${testng.version} - test - - - org.mockito - mockito-core - ${mockito.version} - test - - - org.hamcrest - hamcrest-all - 1.3 - test - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - - - log4j - log4j - ${log4j.version} - - - diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/ConfigurationManager.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/ConfigurationManager.java deleted file mode 100644 index a09f58c3da25..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/ConfigurationManager.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster; - -import java.util.Properties; - -public class ConfigurationManager { - public static Properties getAppSettings() { - return System.getProperties(); - } -} diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/Helpers.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/Helpers.java deleted file mode 100644 index 389faee55a6e..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/Helpers.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import rx.Observable; -import rx.Single; - -public class Helpers { - - static public String createDocumentCollectionUri(String databaseName, String collectionName) { - return String.format("/dbs/%s/colls/%s", databaseName, collectionName); - } - - static public String createDatabaseUri(String databaseName) { - return String.format("/dbs/%s", databaseName); - } - - static public Single createDatabaseIfNotExists(AsyncDocumentClient client, String databaseName) { - - return client.readDatabase("/dbs/" + databaseName, null) - .onErrorResumeNext( - e -> { - if (e instanceof DocumentClientException) { - DocumentClientException dce = (DocumentClientException) e; - if (dce.getStatusCode() == 404) { - // if doesn't exist create it - - Database d = new Database(); - d.setId(databaseName); - - return client.createDatabase(d, null); - } - } - - return Observable.error(e); - } - ).map(ResourceResponse::getResource).toSingle(); - } - - static public Single createCollectionIfNotExists(AsyncDocumentClient client, String databaseName, String collectionName) { - return client.readCollection(createDocumentCollectionUri(databaseName, collectionName), null) - .onErrorResumeNext( - e -> { - if (e instanceof DocumentClientException) { - DocumentClientException dce = (DocumentClientException) e; - if (dce.getStatusCode() == 404) { - // if doesn't exist create it - - DocumentCollection collection = new DocumentCollection(); - collection.setId(collectionName); - - return client.createCollection(createDatabaseUri(databaseName), collection, null); - } - } - - return Observable.error(e); - } - ).map(ResourceResponse::getResource).toSingle(); - } - - static public Single createCollectionIfNotExists(AsyncDocumentClient client, String databaseName, DocumentCollection collection) { - return client.readCollection(createDocumentCollectionUri(databaseName, collection.getId()), null) - .onErrorResumeNext( - e -> { - if (e instanceof DocumentClientException) { - DocumentClientException dce = (DocumentClientException) e; - if (dce.getStatusCode() == 404) { - // if doesn't exist create it - - return client.createCollection(createDatabaseUri(databaseName), collection, null); - } - } - - return Observable.error(e); - } - ).map(ResourceResponse::getResource).toSingle(); - } -} diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/ConflictWorker.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/ConflictWorker.java deleted file mode 100644 index 6f6f4548f7f0..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/ConflictWorker.java +++ /dev/null @@ -1,877 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples; - -import com.microsoft.azure.cosmosdb.AccessCondition; -import com.microsoft.azure.cosmosdb.AccessConditionType; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.ConflictResolutionMode; -import com.microsoft.azure.cosmosdb.ConflictResolutionPolicy; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.examples.multimaster.Helpers; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Scheduler; -import rx.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -public class ConflictWorker { - private static Logger logger = LoggerFactory.getLogger(ConflictWorker.class); - - private final Scheduler schedulerForBlockingWork; - private final List clients; - private final String basicCollectionUri; - private final String manualCollectionUri; - private final String lwwCollectionUri; - private final String udpCollectionUri; - private final String databaseName; - private final String basicCollectionName; - private final String manualCollectionName; - private final String lwwCollectionName; - private final String udpCollectionName; - private final ExecutorService executor; - - public ConflictWorker(String databaseName, String basicCollectionName, String manualCollectionName, String lwwCollectionName, String udpCollectionName) { - this.clients = new ArrayList<>(); - this.basicCollectionUri = Helpers.createDocumentCollectionUri(databaseName, basicCollectionName); - this.manualCollectionUri = Helpers.createDocumentCollectionUri(databaseName, manualCollectionName); - this.lwwCollectionUri = Helpers.createDocumentCollectionUri(databaseName, lwwCollectionName); - this.udpCollectionUri = Helpers.createDocumentCollectionUri(databaseName, udpCollectionName); - - this.databaseName = databaseName; - this.basicCollectionName = basicCollectionName; - this.manualCollectionName = manualCollectionName; - this.lwwCollectionName = lwwCollectionName; - this.udpCollectionName = udpCollectionName; - - this.executor = Executors.newFixedThreadPool(100); - this.schedulerForBlockingWork = Schedulers.from(executor); - } - - public void addClient(AsyncDocumentClient client) { - this.clients.add(client); - } - - private DocumentCollection createCollectionIfNotExists(AsyncDocumentClient createClient, String databaseName, DocumentCollection collection) { - return Helpers.createCollectionIfNotExists(createClient, this.databaseName, collection) - .subscribeOn(schedulerForBlockingWork).toBlocking().value(); - } - - private DocumentCollection createCollectionIfNotExists(AsyncDocumentClient createClient, String databaseName, String collectionName) { - - return Helpers.createCollectionIfNotExists(createClient, this.databaseName, this.basicCollectionName) - .subscribeOn(schedulerForBlockingWork).toBlocking().value(); - } - - private DocumentCollection getCollectionDefForManual(String id) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(id); - ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy(); - collection.setConflictResolutionPolicy(policy); - return collection; - } - - private DocumentCollection getCollectionDefForLastWinWrites(String id, String conflictResolutionPath) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(id); - ConflictResolutionPolicy policy = ConflictResolutionPolicy.createLastWriterWinsPolicy(conflictResolutionPath); - collection.setConflictResolutionPolicy(policy); - return collection; - } - - private DocumentCollection getCollectionDefForCustom(String id, String storedProc) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(id); - ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy(storedProc); - collection.setConflictResolutionPolicy(policy); - return collection; - } - - public void initialize() throws Exception { - AsyncDocumentClient createClient = this.clients.get(0); - - Helpers.createDatabaseIfNotExists(createClient, this.databaseName).subscribeOn(schedulerForBlockingWork).toBlocking().value(); - - DocumentCollection basic = createCollectionIfNotExists(createClient, this.databaseName, this.basicCollectionName); - - DocumentCollection manualCollection = createCollectionIfNotExists(createClient, - Helpers.createDatabaseUri(this.databaseName), getCollectionDefForManual(this.manualCollectionName)); - - DocumentCollection lwwCollection = createCollectionIfNotExists(createClient, - Helpers.createDatabaseUri(this.databaseName), getCollectionDefForLastWinWrites(this.lwwCollectionName, "/regionId")); - - DocumentCollection udpCollection = createCollectionIfNotExists(createClient, - Helpers.createDatabaseUri(this.databaseName), getCollectionDefForCustom(this.udpCollectionName, - String.format("dbs/%s/colls/%s/sprocs/%s", this.databaseName, this.udpCollectionName, "resolver"))); - - StoredProcedure lwwSproc = new StoredProcedure(); - lwwSproc.setId("resolver"); - lwwSproc.setBody(IOUtils.toString( - getClass().getClassLoader().getResourceAsStream("resolver-storedproc.txt"), "UTF-8")); - - lwwSproc = - getResource(createClient.upsertStoredProcedure( - Helpers.createDocumentCollectionUri(this.databaseName, this.udpCollectionName), lwwSproc, null)); - - } - - private T getResource(Observable> obs) { - return obs.subscribeOn(schedulerForBlockingWork).toBlocking().single().getResource(); - } - - public void runManualConflict() throws Exception { - logger.info("\r\nInsert Conflict\r\n"); - this.runInsertConflictOnManual(); - - logger.info("\r\nUpdate Conflict\r\n"); - this.runUpdateConflictOnManual(); - - logger.info("\r\nDelete Conflict\r\n"); - this.runDeleteConflictOnManual(); - } - - public void runLWWConflict() throws Exception { - logger.info("\r\nInsert Conflict\r\n"); - this.runInsertConflictOnLWW(); - - logger.info("\r\nUpdate Conflict\r\n"); - this.runUpdateConflictOnLWW(); - - logger.info("\r\nDelete Conflict\r\n"); - this.runDeleteConflictOnLWW(); - } - - public void runUDPConflict() throws Exception { - logger.info("\r\nInsert Conflict\r\n"); - this.runInsertConflictOnUdp(); - - logger.info("\r\nUpdate Conflict\r\n"); - this.runUpdateConflictOnUdp(); - - logger.info("\r\nDelete Conflict\r\n"); - this.runDeleteConflictOnUdp(); - } - - public void runInsertConflictOnManual() throws Exception { - do { - logger.info("1) Performing conflicting insert across {} regions on {}", this.clients.size(), this.manualCollectionName); - - ArrayList> insertTask = new ArrayList>(); - - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - insertTask.add(this.tryInsertDocument(client, this.manualCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(insertTask).toList().subscribeOn(schedulerForBlockingWork).toBlocking().single(); - - if (conflictDocuments.size() == this.clients.size()) { - logger.info("2) Caused {} insert conflicts, verifying conflict resolution", conflictDocuments.size()); - - for (Document conflictingInsert : conflictDocuments) { - this.validateManualConflict(this.clients, conflictingInsert); - } - break; - } else { - logger.info("Retrying insert to induce conflicts"); - } - } while (true); - } - - public void runUpdateConflictOnManual() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - - conflictDocument = this.tryInsertDocument(clients.get(0), this.manualCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - TimeUnit.SECONDS.sleep(1);//1 Second for write to sync. - - - logger.info("1) Performing conflicting update across 3 regions on {}", this.manualCollectionName); - - ArrayList> updateTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - updateTask.add(this.tryUpdateDocument(client, this.manualCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(updateTask).toList().toBlocking().single(); - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} updated conflicts, verifying conflict resolution", conflictDocuments.size()); - - for (Document conflictingUpdate : conflictDocuments) { - this.validateManualConflict(this.clients, conflictingUpdate); - } - break; - } else { - logger.info("Retrying update to induce conflicts"); - } - } while (true); - } - - public void runDeleteConflictOnManual() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - conflictDocument = this.tryInsertDocument(clients.get(0), this.manualCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - TimeUnit.SECONDS.sleep(10);//1 Second for write to sync. - - logger.info("1) Performing conflicting delete across 3 regions on {}", this.manualCollectionName); - - ArrayList> deleteTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - deleteTask.add(this.tryDeleteDocument(client, this.manualCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(deleteTask).toList() - .subscribeOn(schedulerForBlockingWork) - .toBlocking().single(); - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} delete conflicts, verifying conflict resolution", conflictDocuments.size()); - - for (Document conflictingDelete : conflictDocuments) { - this.validateManualConflict(this.clients, conflictingDelete); - } - - break; - } else { - logger.info("Retrying update to induce conflicts"); - } - } while (true); - } - - public void runInsertConflictOnLWW() throws Exception { - do { - logger.info("Performing conflicting insert across 3 regions"); - - ArrayList> insertTask = new ArrayList>(); - - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - insertTask.add(this.tryInsertDocument(client, this.lwwCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(insertTask).toList().toBlocking().single(); - - - if (conflictDocuments.size() > 1) { - logger.info("Inserted {} conflicts, verifying conflict resolution", conflictDocuments.size()); - - this.validateLWW(this.clients, conflictDocuments); - - break; - } else { - logger.info("Retrying insert to induce conflicts"); - } - } while (true); - } - - public void runUpdateConflictOnLWW() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - conflictDocument = this.tryInsertDocument(clients.get(0), this.lwwCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - - TimeUnit.SECONDS.sleep(1); //1 Second for write to sync. - - logger.info("1) Performing conflicting update across {} regions on {}", this.clients.size(), this.lwwCollectionUri); - - ArrayList> insertTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - insertTask.add(this.tryUpdateDocument(client, this.lwwCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(insertTask).toList().toBlocking().single(); - - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} update conflicts, verifying conflict resolution", conflictDocuments.size()); - - this.validateLWW(this.clients, conflictDocuments); - - break; - } else { - logger.info("Retrying insert to induce conflicts"); - } - } while (true); - } - - public void runDeleteConflictOnLWW() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - conflictDocument = this.tryInsertDocument(clients.get(0), this.lwwCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - - TimeUnit.SECONDS.sleep(1); //1 Second for write to sync. - - logger.info("1) Performing conflicting delete across {} regions on {}", this.clients.size(), this.lwwCollectionUri); - - ArrayList> insertTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - if (index % 2 == 1) { - //We delete from region 1, even though region 2 always win. - insertTask.add(this.tryDeleteDocument(client, this.lwwCollectionUri, conflictDocument, index++)); - } else { - insertTask.add(this.tryUpdateDocument(client, this.lwwCollectionUri, conflictDocument, index++)); - } - } - - List conflictDocuments = Observable.merge(insertTask).toList().toBlocking().single(); - - if (conflictDocuments.size() > 1) { - logger.info("Inserted {} conflicts, verifying conflict resolution", conflictDocuments.size()); - - //Delete should always win. irrespective of LWW. - this.validateLWW(this.clients, conflictDocuments, true); - break; - } else { - logger.info("Retrying update/delete to induce conflicts"); - } - } while (true); - } - - public void runInsertConflictOnUdp() throws Exception { - do { - logger.info("1) Performing conflicting insert across 3 regions on {}", this.udpCollectionName); - - ArrayList> insertTask = new ArrayList>(); - - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - insertTask.add(this.tryInsertDocument(client, this.udpCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(insertTask).toList().toBlocking().single(); - - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} insert conflicts, verifying conflict resolution", conflictDocuments.size()); - - this.validateUDPAsync(this.clients, conflictDocuments); - - break; - } else { - logger.info("Retrying insert to induce conflicts"); - } - } while (true); - } - - public void runUpdateConflictOnUdp() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - conflictDocument = this.tryInsertDocument(clients.get(0), this.udpCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - TimeUnit.SECONDS.sleep(1); //1 Second for write to sync. - - logger.info("1) Performing conflicting update across 3 regions on {}", this.udpCollectionUri); - - ArrayList> updateTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - updateTask.add(this.tryUpdateDocument(client, this.udpCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(updateTask).toList().toBlocking().single(); - - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} update conflicts, verifying conflict resolution", conflictDocuments.size()); - - this.validateUDPAsync(this.clients, conflictDocuments); - - break; - } else { - logger.info("Retrying update to induce conflicts"); - } - } while (true); - } - - public void runDeleteConflictOnUdp() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - conflictDocument = this.tryInsertDocument(clients.get(0), this.udpCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - TimeUnit.SECONDS.sleep(1); //1 Second for write to sync. - - logger.info("1) Performing conflicting update/delete across 3 regions on {}", this.udpCollectionUri); - - ArrayList> deleteTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - if (index % 2 == 1) { - //We delete from region 1, even though region 2 always win. - deleteTask.add(this.tryDeleteDocument(client, this.udpCollectionUri, conflictDocument, index++)); - } else { - deleteTask.add(this.tryUpdateDocument(client, this.udpCollectionUri, conflictDocument, index++)); - } - } - - List conflictDocuments = Observable.merge(deleteTask).toList().toBlocking().single(); - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} delete conflicts, verifying conflict resolution", conflictDocuments.size()); - - //Delete should always win. irrespective of LWW. - this.validateUDPAsync(this.clients, conflictDocuments, true); - break; - } else { - logger.info("Retrying update/delete to induce conflicts"); - } - } while (true); - } - - private Observable tryInsertDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { - - logger.debug("region: {}", client.getWriteEndpoint()); - document.set("regionId", index); - document.set("regionEndpoint", client.getReadEndpoint()); - return client.createDocument(collectionUri, document, null, false) - .onErrorResumeNext(e -> { - if (hasDocumentClientException(e, 409)) { - return Observable.empty(); - } else { - return Observable.error(e); - } - }).map(ResourceResponse::getResource); - } - - private boolean hasDocumentClientException(Throwable e, int statusCode) { - if (e instanceof DocumentClientException) { - DocumentClientException dce = (DocumentClientException) e; - return dce.getStatusCode() == statusCode; - } - - return false; - } - - private boolean hasDocumentClientExceptionCause(Throwable e) { - while (e != null) { - if (e instanceof DocumentClientException) { - return true; - } - - e = e.getCause(); - } - return false; - } - - private boolean hasDocumentClientExceptionCause(Throwable e, int statusCode) { - while (e != null) { - if (e instanceof DocumentClientException) { - DocumentClientException dce = (DocumentClientException) e; - return dce.getStatusCode() == statusCode; - } - - e = e.getCause(); - } - - return false; - } - - private Observable tryUpdateDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { - document.set("regionId", index); - document.set("regionEndpoint", client.getReadEndpoint()); - - RequestOptions options = new RequestOptions(); - options.setAccessCondition(new AccessCondition()); - options.getAccessCondition().setType(AccessConditionType.IfMatch); - options.getAccessCondition().setCondition(document.getETag()); - - - return client.replaceDocument(document.getSelfLink(), document, null).onErrorResumeNext(e -> { - - // pre condition failed - if (hasDocumentClientException(e, 412)) { - //Lost synchronously or not document yet. No conflict is induced. - return Observable.empty(); - - } - return Observable.error(e); - }).map(ResourceResponse::getResource); - } - - private Observable tryDeleteDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { - document.set("regionId", index); - document.set("regionEndpoint", client.getReadEndpoint()); - - RequestOptions options = new RequestOptions(); - options.setAccessCondition(new AccessCondition()); - options.getAccessCondition().setType(AccessConditionType.IfMatch); - options.getAccessCondition().setCondition(document.getETag()); - - - return client.deleteDocument(document.getSelfLink(), options).onErrorResumeNext(e -> { - - // pre condition failed - if (hasDocumentClientException(e, 412)) { - //Lost synchronously. No conflict is induced. - return Observable.empty(); - - } - return Observable.error(e); - }).map(rr -> document); - } - - private void validateManualConflict(List clients, Document conflictDocument) throws Exception { - boolean conflictExists = false; - for (AsyncDocumentClient client : clients) { - conflictExists = this.validateManualConflict(client, conflictDocument); - } - - if (conflictExists) { - this.deleteConflict(conflictDocument); - } - } - - private boolean isDelete(Conflict conflict) { - return StringUtils.equalsIgnoreCase(conflict.getOperationKind(), "delete"); - } - - - private boolean equals(String a, String b) { - return StringUtils.equals(a, b); - } - - private boolean validateManualConflict(AsyncDocumentClient client, Document conflictDocument) throws Exception { - while (true) { - FeedResponse response = client.readConflicts(this.manualCollectionUri, null) - .first().toBlocking().single(); - - for (Conflict conflict : response.getResults()) { - if (!isDelete(conflict)) { - Document conflictDocumentContent = conflict.getResource(Document.class); - if (equals(conflictDocument.getId(), conflictDocumentContent.getId())) { - if (equals(conflictDocument.getResourceId(), conflictDocumentContent.getResourceId()) && - equals(conflictDocument.getETag(), conflictDocumentContent.getETag())) { - logger.info("Document from Region {} lost conflict @ {}", - conflictDocument.getId(), - conflictDocument.getInt("regionId"), - client.getReadEndpoint()); - return true; - } else { - try { - //Checking whether this is the winner. - Document winnerDocument = client.readDocument(conflictDocument.getSelfLink(), null) - .toBlocking().single().getResource(); - logger.info("Document from region {} won the conflict @ {}", - conflictDocument.getInt("regionId"), - client.getReadEndpoint()); - return false; - } - catch (Exception exception) { - if (hasDocumentClientException(exception, 404)) { - throw exception; - } else { - logger.info( - "Document from region {} not found @ {}", - conflictDocument.getInt("regionId"), - client.getReadEndpoint()); - } - } - } - } - } else { - if (equals(conflict.getSourceResourceId(), conflictDocument.getResourceId())) { - logger.info("Delete conflict found @ {}", - client.getReadEndpoint()); - return false; - } - } - } - - logger.error("Document {} is not found in conflict feed @ {}, retrying", - conflictDocument.getId(), - client.getReadEndpoint()); - - TimeUnit.MILLISECONDS.sleep(500); - } - } - - private void deleteConflict(Document conflictDocument) { - AsyncDocumentClient delClient = clients.get(0); - - FeedResponse conflicts = delClient.readConflicts(this.manualCollectionUri, null).first().toBlocking().single(); - - for (Conflict conflict : conflicts.getResults()) { - if (!isDelete(conflict)) { - Document conflictContent = conflict.getResource(Document.class); - if (equals(conflictContent.getResourceId(), conflictDocument.getResourceId()) - && equals(conflictContent.getETag(), conflictDocument.getETag())) { - logger.info("Deleting manual conflict {} from region {}", - conflict.getSourceResourceId(), - conflictContent.getInt("regionId")); - delClient.deleteConflict(conflict.getSelfLink(), null) - .toBlocking().single(); - - } - } else if (equals(conflict.getSourceResourceId(), conflictDocument.getResourceId())) { - logger.info("Deleting manual conflict {} from region {}", - conflict.getSourceResourceId(), - conflictDocument.getInt("regionId")); - delClient.deleteConflict(conflict.getSelfLink(), null) - .toBlocking().single(); - } - } - } - - private void validateLWW(List clients, List conflictDocument) throws Exception { - validateLWW(clients, conflictDocument, false); - } - - - private void validateLWW(List clients, List conflictDocument, boolean hasDeleteConflict) throws Exception { - for (AsyncDocumentClient client : clients) { - this.validateLWW(client, conflictDocument, hasDeleteConflict); - } - } - - private void validateLWW(AsyncDocumentClient client, List conflictDocument, boolean hasDeleteConflict) throws Exception { - FeedResponse response = client.readConflicts(this.lwwCollectionUri, null) - .first().toBlocking().single(); - - if (response.getResults().size() != 0) { - logger.error("Found {} conflicts in the lww collection", response.getResults().size()); - return; - } - - if (hasDeleteConflict) { - do { - try { - client.readDocument(conflictDocument.get(0).getSelfLink(), null).toBlocking().single(); - - logger.error("Delete conflict for document {} didnt win @ {}", - conflictDocument.get(0).getId(), - client.getReadEndpoint()); - - TimeUnit.MILLISECONDS.sleep(500); - } catch (Exception exception) { - if (!hasDocumentClientExceptionCause(exception)) { - throw exception; - } - - // NotFound - if (hasDocumentClientExceptionCause(exception, 404)) { - - logger.info("Delete conflict won @ {}", client.getReadEndpoint()); - return; - } else { - logger.error("Delete conflict for document {} didnt win @ {}", - conflictDocument.get(0).getId(), - client.getReadEndpoint()); - - TimeUnit.MILLISECONDS.sleep(500); - } - } - } while (true); - } - - Document winnerDocument = null; - - for (Document document : conflictDocument) { - if (winnerDocument == null || - winnerDocument.getInt("regionId") <= document.getInt("regionId")) { - winnerDocument = document; - } - } - - logger.info("Document from region {} should be the winner", - winnerDocument.getInt("regionId")); - - while (true) { - try { - Document existingDocument = client.readDocument(winnerDocument.getSelfLink(), null) - .toBlocking().single().getResource(); - - if (existingDocument.getInt("regionId") == winnerDocument.getInt("regionId")) { - logger.info("Winner document from region {} found at {}", - existingDocument.getInt("regionId"), - client.getReadEndpoint()); - break; - } else { - logger.error("Winning document version from region {} is not found @ {}, retrying...", - winnerDocument.getInt("regionId"), - client.getWriteEndpoint()); - TimeUnit.MILLISECONDS.sleep(500); - } - } catch (Exception e) { - logger.error("Winner document from region {} is not found @ {}, retrying...", - winnerDocument.getInt("regionId"), - client.getWriteEndpoint()); - TimeUnit.MILLISECONDS.sleep(500); - } - } - } - - private void validateUDPAsync(List clients, List conflictDocument) throws Exception { - validateUDPAsync(clients, conflictDocument, false); - } - - private void validateUDPAsync(List clients, List conflictDocument, boolean hasDeleteConflict) throws Exception { - for (AsyncDocumentClient client : clients) { - this.validateUDPAsync(client, conflictDocument, hasDeleteConflict); - } - } - - private String documentNameLink(String collectionId, String documentId) { - return String.format("dbs/%s/colls/%s/docs/%s", databaseName, collectionId, documentId); - } - - private void validateUDPAsync(AsyncDocumentClient client, List conflictDocument, boolean hasDeleteConflict) throws Exception { - FeedResponse response = client.readConflicts(this.udpCollectionUri, null).first().toBlocking().single(); - - if (response.getResults().size() != 0) { - logger.error("Found {} conflicts in the udp collection", response.getResults().size()); - return; - } - - if (hasDeleteConflict) { - do { - try { - client.readDocument( - documentNameLink(udpCollectionName, conflictDocument.get(0).getId()), null) - .toBlocking().single(); - - logger.error("Delete conflict for document {} didnt win @ {}", - conflictDocument.get(0).getId(), - client.getReadEndpoint()); - - TimeUnit.MILLISECONDS.sleep(500); - - } catch (Exception exception) { - if (hasDocumentClientExceptionCause(exception, 404)) { - logger.info("Delete conflict won @ {}", client.getReadEndpoint()); - return; - } else { - logger.error("Delete conflict for document {} didnt win @ {}", - conflictDocument.get(0).getId(), - client.getReadEndpoint()); - - TimeUnit.MILLISECONDS.sleep(500); - } - } - } while (true); - } - - Document winnerDocument = null; - - for (Document document : conflictDocument) { - if (winnerDocument == null || - winnerDocument.getInt("regionId") <= document.getInt("regionId")) { - winnerDocument = document; - } - } - - logger.info("Document from region {} should be the winner", - winnerDocument.getInt("regionId")); - - while (true) { - try { - - Document existingDocument = client.readDocument( - documentNameLink(udpCollectionName, winnerDocument.getId()), null) - .toBlocking().single().getResource(); - - if (existingDocument.getInt("regionId") == winnerDocument.getInt( - ("regionId"))) { - logger.info("Winner document from region {} found at {}", - existingDocument.getInt("regionId"), - client.getReadEndpoint()); - break; - } else { - logger.error("Winning document version from region {} is not found @ {}, retrying...", - winnerDocument.getInt("regionId"), - client.getWriteEndpoint()); - TimeUnit.MILLISECONDS.sleep(500); - } - } catch (Exception e) { - logger.error("Winner document from region {} is not found @ {}, retrying...", - winnerDocument.getInt("regionId"), - client.getWriteEndpoint()); - TimeUnit.MILLISECONDS.sleep(500); - } - } - } - - public void shutdown() { - this.executor.shutdown(); - for(AsyncDocumentClient client: clients) { - client.close(); - } - } -} diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Main.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Main.java deleted file mode 100644 index 58f1864a54d3..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Main.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples; - -import com.microsoft.azure.cosmosdb.rx.examples.multimaster.ConfigurationManager; -import org.apache.commons.io.IOUtils; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - - -public class Main { - public static void main(String[] args) throws Exception { - - if (args.length != 1) { - help(); - System.exit(1); - } - - try (InputStream inputStream = new FileInputStream(args[0])) { - ConfigurationManager.getAppSettings().load(inputStream); - System.out.println("Using file " + args[0] + " for the setting."); - } - - Main.runScenarios(); - } - - private static void runScenarios() throws Exception { - MultiMasterScenario scenario = new MultiMasterScenario(); - scenario.initialize(); - - scenario.runBasic(); - - scenario.runManualConflict(); - scenario.runLWW(); - scenario.runUDP(); - - System.out.println("Finished"); - - //shutting down the active the resources - scenario.shutdown(); - } - - private static void help() throws IOException { - System.out.println("Provide the path to setting file in the following format: "); - try (InputStream inputStream = - Main.class.getClassLoader() - .getResourceAsStream("multi-master-sample-config.properties")) { - - IOUtils.copy(inputStream, System.out); - - System.out.println(); - } catch (Exception e) { - throw e; - } - } -} diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/MultiMasterScenario.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/MultiMasterScenario.java deleted file mode 100644 index 5c127de357fc..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/MultiMasterScenario.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples; - -import com.google.common.base.Preconditions; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.examples.multimaster.ConfigurationManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Completable; - -import javax.net.ssl.SSLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class MultiMasterScenario { - - private final static Logger logger = LoggerFactory.getLogger(MultiMasterScenario.class); - - final private String accountEndpoint; - final private String accountKey; - final private List workers; - final private ConflictWorker conflictWorker; - - public MultiMasterScenario() { - this.accountEndpoint = ConfigurationManager.getAppSettings().getProperty("endpoint"); - this.accountKey = ConfigurationManager.getAppSettings().getProperty("key"); - - String databaseName = ConfigurationManager.getAppSettings().getProperty("databaseName"); - String manualCollectionName = ConfigurationManager.getAppSettings().getProperty("manualCollectionName"); - String lwwCollectionName = ConfigurationManager.getAppSettings().getProperty("lwwCollectionName"); - String udpCollectionName = ConfigurationManager.getAppSettings().getProperty("udpCollectionName"); - String basicCollectionName = ConfigurationManager.getAppSettings().getProperty("basicCollectionName"); - String regionsAsString = ConfigurationManager.getAppSettings().getProperty("regions"); - Preconditions.checkNotNull(regionsAsString, "regions is required"); - String[] regions = regionsAsString.split(";"); - Preconditions.checkArgument(regions.length > 0, "at least one region is required"); - Preconditions.checkNotNull(accountEndpoint, "accountEndpoint is required"); - Preconditions.checkNotNull(accountKey, "accountKey is required"); - Preconditions.checkNotNull(databaseName, "databaseName is required"); - Preconditions.checkNotNull(manualCollectionName, "manualCollectionName is required"); - Preconditions.checkNotNull(lwwCollectionName, "lwwCollectionName is required"); - Preconditions.checkNotNull(udpCollectionName, "udpCollectionName is required"); - Preconditions.checkNotNull(basicCollectionName, "basicCollectionName is required"); - - this.workers = new ArrayList<>(); - this.conflictWorker = new ConflictWorker(databaseName, basicCollectionName, manualCollectionName, lwwCollectionName, udpCollectionName); - - for (String region : regions) { - ConnectionPolicy policy = new ConnectionPolicy(); - policy.setUsingMultipleWriteLocations(true); - policy.setPreferredLocations(Collections.singletonList(region)); - - AsyncDocumentClient client = - new AsyncDocumentClient.Builder() - .withMasterKeyOrResourceToken(this.accountKey) - .withServiceEndpoint(this.accountEndpoint) - .withConsistencyLevel(ConsistencyLevel.Eventual) - .withConnectionPolicy(policy).build(); - - - workers.add(new Worker(client, databaseName, basicCollectionName)); - - conflictWorker.addClient(client); - } - } - - public void initialize() throws Exception { - this.conflictWorker.initialize(); - logger.info("Initialized collections."); - } - - public void runBasic() throws Exception { - logger.info("\n####################################################"); - logger.info("Basic Active-Active"); - logger.info("####################################################"); - - logger.info("1) Starting insert loops across multiple regions ..."); - - List basicTask = new ArrayList(); - - int documentsToInsertPerWorker = 100; - - for (Worker worker : this.workers) { - basicTask.add(worker.runLoopAsync(documentsToInsertPerWorker)); - } - - Completable.merge(basicTask).await(); - - basicTask.clear(); - - logger.info("2) Reading from every region ..."); - - int expectedDocuments = this.workers.size() * documentsToInsertPerWorker; - for (Worker worker : this.workers) { - basicTask.add(worker.readAllAsync(expectedDocuments)); - } - - Completable.merge(basicTask).await(); - - basicTask.clear(); - - logger.info("3) Deleting all the documents ..."); - - this.workers.get(0).deleteAll(); - - logger.info("####################################################"); - } - - public void runManualConflict() throws Exception { - logger.info("\n####################################################"); - logger.info("Manual Conflict Resolution"); - logger.info("####################################################"); - - this.conflictWorker.runManualConflict(); - logger.info("####################################################"); - } - - public void runLWW() throws Exception { - logger.info("\n####################################################"); - logger.info("LWW Conflict Resolution"); - logger.info("####################################################"); - - this.conflictWorker.runLWWConflict(); - logger.info("####################################################"); - } - - public void runUDP() throws Exception { - logger.info("\n####################################################"); - logger.info("UDP Conflict Resolution"); - logger.info("####################################################"); - - this.conflictWorker.runUDPConflict(); - logger.info("####################################################"); - } - - public void shutdown() { - conflictWorker.shutdown(); - for(Worker worker: this.workers) { - worker.shutdown(); - } - } -} diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Worker.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Worker.java deleted file mode 100644 index 90a5ab77aaff..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Worker.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples; - - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Completable; -import rx.Scheduler; -import rx.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -public class Worker { - private final static Logger logger = LoggerFactory.getLogger(Worker.class); - - private final AsyncDocumentClient client; - private final String documentCollectionUri; - - // scheduler for blocking work - private final Scheduler schedulerForBlockingWork; - private final ExecutorService executor; - - public Worker(AsyncDocumentClient client, String databaseName, String collectionName) { - this.client = client; - this.documentCollectionUri = String.format("/dbs/%s/colls/%s", databaseName, collectionName); - this.executor = Executors.newSingleThreadExecutor(); - this.schedulerForBlockingWork = Schedulers.from(executor); - } - - public Completable runLoopAsync(int documentsToInsert) { - return Completable.defer(() -> { - - int iterationCount = 0; - - List latency = new ArrayList<>(); - while (iterationCount++ < documentsToInsert) { - long startTick = System.currentTimeMillis(); - - Document d = new Document(); - d.setId(UUID.randomUUID().toString()); - - this.client.createDocument(this.documentCollectionUri, d, null, false) - .subscribeOn(schedulerForBlockingWork).toBlocking().single(); - - long endTick = System.currentTimeMillis(); - - latency.add(endTick - startTick); - } - - Collections.sort(latency); - int p50Index = (latency.size() / 2); - - logger.info("Inserted {} documents at {} with p50 {} ms", - documentsToInsert, - this.client.getWriteEndpoint(), - latency.get(p50Index)); - - return Completable.complete(); - - }); - - } - - - public Completable readAllAsync(int expectedNumberOfDocuments) { - - return Completable.defer(() -> { - - while (true) { - int totalItemRead = 0; - FeedResponse response = null; - do { - - FeedOptions options = new FeedOptions(); - options.setRequestContinuation(response != null ? response.getResponseContinuation() : null); - - response = this.client.readDocuments(this.documentCollectionUri, options).first() - .subscribeOn(schedulerForBlockingWork).toBlocking().single(); - - totalItemRead += response.getResults().size(); - } while (response.getResponseContinuation() != null); - - if (totalItemRead < expectedNumberOfDocuments) { - logger.info("Total item read {} from {} is less than {}, retrying reads", - totalItemRead, - this.client.getReadEndpoint(), - expectedNumberOfDocuments); - - try { - TimeUnit.SECONDS.sleep(1); - } catch (InterruptedException e) { - logger.info("interrupted"); - break; - } - continue; - } else { - logger.info("Read {} items from {}", totalItemRead, this.client.getReadEndpoint()); - break; - } - } - - return Completable.complete(); - }); - } - - void deleteAll() { - List documents = new ArrayList<>(); - FeedResponse response = null; - do { - - FeedOptions options = new FeedOptions(); - options.setRequestContinuation(response != null ? response.getResponseContinuation() : null); - - response = this.client.readDocuments(this.documentCollectionUri, options).first() - .subscribeOn(schedulerForBlockingWork).toBlocking().single(); - - documents.addAll(response.getResults()); - } while (response.getResponseContinuation() != null); - - for (Document document : documents) { - try { - this.client.deleteDocument(document.getSelfLink(), null) - .subscribeOn(schedulerForBlockingWork).toBlocking().single(); - } catch (RuntimeException exEx) { - DocumentClientException dce = getDocumentClientExceptionCause(exEx); - - if (dce.getStatusCode() != 404) { - logger.info("Error occurred while deleting {} from {}", dce, client.getWriteEndpoint()); - } - } - } - - logger.info("Deleted all documents from region {}", this.client.getWriteEndpoint()); - } - - private DocumentClientException getDocumentClientExceptionCause(Throwable e) { - while (e != null) { - - if (e instanceof DocumentClientException) { - return (DocumentClientException) e; - } - - e = e.getCause(); - } - - return null; - } - - public void shutdown() { - executor.shutdown(); - client.close(); - } -} diff --git a/cosmosdb/data-plane/examples/src/main/resources/log4j.properties b/cosmosdb/data-plane/examples/src/main/resources/log4j.properties deleted file mode 100644 index 00b7fefa6413..000000000000 --- a/cosmosdb/data-plane/examples/src/main/resources/log4j.properties +++ /dev/null @@ -1,23 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=WARN, A1 - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples.ConflictWorker=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples.Main=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples.Worker=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples.MultiMasterScenario=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.ConfigurationManager=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.Helpers=INFO - -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -#log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p - %m%n - -log4j.appender.A1.layout.ConversionPattern=%m%n - diff --git a/cosmosdb/data-plane/examples/src/main/resources/multi-master-sample-config.properties b/cosmosdb/data-plane/examples/src/main/resources/multi-master-sample-config.properties deleted file mode 100644 index 42c20302edc1..000000000000 --- a/cosmosdb/data-plane/examples/src/main/resources/multi-master-sample-config.properties +++ /dev/null @@ -1,8 +0,0 @@ -endpoint= -key= -regions=North Central US;North Europe;Southeast Asia -databaseName=multiMasterDemoDB -manualCollectionName=myManualCollection -lwwCollectionName=myLwwCollection -udpCollectionName=myUdpCollection -basicCollectionName=myBasicCollection \ No newline at end of file diff --git a/cosmosdb/data-plane/examples/src/main/resources/resolver-storedproc.txt b/cosmosdb/data-plane/examples/src/main/resources/resolver-storedproc.txt deleted file mode 100644 index e856721a979a..000000000000 --- a/cosmosdb/data-plane/examples/src/main/resources/resolver-storedproc.txt +++ /dev/null @@ -1,45 +0,0 @@ -function resolver(incomingRecord, existingRecord, isTombstone, conflictingRecords) { - var collection = getContext().getCollection(); - if (!incomingRecord) { - if (existingRecord) { - collection.deleteDocument(existingRecord._self, {}, function(err, responseOptions) { - if (err) throw err; - }); - } - } else if (isTombstone) { - // delete always wins. - } else { - var documentToUse = incomingRecord; - if (existingRecord) { - if (documentToUse.regionId < existingRecord.regionId) { - documentToUse = existingRecord; - } - } - var i; - for (i = 0; i < conflictingRecords.length; i++) { - if (documentToUse.regionId < conflictingRecords[i].regionId) { - documentToUse = conflictingRecords[i]; - } - } - tryDelete(conflictingRecords, incomingRecord, existingRecord, documentToUse); - } - function tryDelete(documents, incoming, existing, documentToInsert) { - if (documents.length > 0) { - collection.deleteDocument(documents[0]._self, {}, function(err, responseOptions) { - if (err) throw err; - documents.shift(); - tryDelete(documents, incoming, existing, documentToInsert); - }); - } else if (existing) { - collection.replaceDocument(existing._self, documentToInsert, - function(err, documentCreated) { - if (err) throw err; - }); - } else { - collection.createDocument(collection.getSelfLink(), documentToInsert, - function(err, documentCreated) { - if (err) throw err; - }); - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/CollectionCRUDAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/CollectionCRUDAsyncAPITest.java deleted file mode 100644 index e9d0c4d33604..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/CollectionCRUDAsyncAPITest.java +++ /dev/null @@ -1,410 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import rx.Observable; -import rx.functions.Action1; -import rx.observable.ListenableFutureObservable; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.greaterThan; - -/** - * This integration test class demonstrates how to use Async API to create, - * delete, replace, and update Document Collections. - *

- * NOTE: you can use rxJava based async api with java8 lambda expression. Use of - * rxJava based async APIs with java8 lambda expressions is much prettier. - *

- * You can also use the async API without java8 lambda expression support. - *

- * For example - *

    - *
  • {@link #createCollection_MultiPartition_Async()} demonstrates how to use async api - * with java8 lambda expression. - * - *
  • {@link #createCollection_Async_withoutLambda()} demonstrates how to - * do the same thing without lambda expression. - *
- *

- * Also if you need to work with Future or ListenableFuture it is possible to - * transform an observable to ListenableFuture. Please see - * {@link #transformObservableToGoogleGuavaListenableFuture()} - *

- * To Modify the Collection's throughput after it has been created, you need to - * update the corresponding Offer. Please see - * {@see com.microsoft.azure.cosmosdb.rx.examples.OfferCRUDAsyncAPITest#testUpdateOffer()} - */ -public class CollectionCRUDAsyncAPITest { - private final static int TIMEOUT = 120000; - private static Database createdDatabase; - private static AsyncDocumentClient asyncClient; - private DocumentCollection collectionDefinition; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - createdDatabase = Utils.createDatabaseForTest(asyncClient); - } - - @BeforeMethod(groups = "samples", timeOut = TIMEOUT) - public void before() { - collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } - - /** - * Create a document collection using async api. - * If you want a single partition collection with 10,000 RU/s throughput, - * the only way to do so is to create a single partition collection with lower - * throughput (400) and then increase the throughput. - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createCollection_SinglePartition_Async() throws Exception { - RequestOptions singlePartitionRequestOptions = new RequestOptions(); - singlePartitionRequestOptions.setOfferThroughput(400); - Observable> createCollectionObservable = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, singlePartitionRequestOptions); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - - createCollectionObservable.single() // We know there is only single result - .subscribe(collectionResourceResponse -> { - System.out.println(collectionResourceResponse.getActivityId()); - countDownLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while creating the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - }); - - // Wait till collection creation completes - countDownLatch.await(); - } - - /** - * Create a document collection using async api. - * This test uses java8 lambda expression. - * See testCreateCollection_Async_withoutLambda for usage without lambda - * expressions. - * Set the throughput to be > 10,000 RU/s - * to create a multi partition collection. - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createCollection_MultiPartition_Async() throws Exception { - RequestOptions multiPartitionRequestOptions = new RequestOptions(); - multiPartitionRequestOptions.setOfferThroughput(20000); - - Observable> createCollectionObservable = asyncClient.createCollection( - getDatabaseLink(), getMultiPartitionCollectionDefinition(), multiPartitionRequestOptions); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - - createCollectionObservable.single() // We know there is only single result - .subscribe(collectionResourceResponse -> { - System.out.println(collectionResourceResponse.getActivityId()); - countDownLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while creating the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - }); - - // Wait till collection creation completes - countDownLatch.await(); - } - - /** - * Create a document Collection using async api, without java8 lambda expressions - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createCollection_Async_withoutLambda() throws Exception { - Observable> createCollectionObservable = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - Action1> onCollectionCreationAction = new Action1>() { - - @Override - public void call(ResourceResponse resourceResponse) { - // Collection is created - System.out.println(resourceResponse.getActivityId()); - countDownLatch.countDown(); - } - }; - - Action1 onError = new Action1() { - @Override - public void call(Throwable error) { - System.err.println( - "an error occurred while creating the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - } - }; - - createCollectionObservable.single() // We know there is only a single event - .subscribe(onCollectionCreationAction, onError); - - // Wait till collection creation completes - countDownLatch.await(); - } - - /** - * Create a collection in a blocking manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createCollection_toBlocking() { - Observable> createCollectionObservable = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null); - - // toBlocking() converts the observable to a blocking observable. - // single() gets the only result. - createCollectionObservable.toBlocking().single(); - } - - /** - * Attempt to create a Collection which already exists - * - First create a Collection - * - Using the async api generate an async collection creation observable - * - Converts the Observable to blocking using Observable.toBlocking() api - * - Catch already exist failure (409) - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createCollection_toBlocking_CollectionAlreadyExists_Fails() { - asyncClient.createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single(); - - // Create the collection for test. - Observable> collectionForTestObservable = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null); - - try { - collectionForTestObservable.toBlocking() // Blocks - .single(); // Gets the single result - assertThat("Should not reach here", false); - } catch (Exception e) { - assertThat("Collection already exists.", ((DocumentClientException) e.getCause()).getStatusCode(), - equalTo(409)); - } - } - - /** - * You can convert an Observable to a ListenableFuture. - * ListenableFuture (part of google guava library) is a popular extension - * of Java's Future which allows registering listener callbacks: - * https://github.com/google/guava/wiki/ListenableFutureExplained - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void transformObservableToGoogleGuavaListenableFuture() throws Exception { - Observable> createCollectionObservable = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null); - ListenableFuture> future = ListenableFutureObservable - .to(createCollectionObservable); - - ResourceResponse rrd = future.get(); - - assertThat(rrd.getRequestCharge(), greaterThan((double) 0)); - System.out.println(rrd.getRequestCharge()); - } - - /** - * Read a Collection in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createAndReadCollection() throws Exception { - // Create a Collection - DocumentCollection documentCollection = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single() - .getResource(); - - // Read the created collection using async api - Observable> readCollectionObservable = asyncClient - .readCollection(getCollectionLink(documentCollection), null); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - - readCollectionObservable.single() // We know there is only single result - .subscribe(collectionResourceResponse -> { - System.out.println(collectionResourceResponse.getActivityId()); - countDownLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while reading the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - }); - - // Wait till read collection completes - countDownLatch.await(); - } - - /** - * Delete a Collection in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createAndDeleteCollection() throws Exception { - // Create a Collection - DocumentCollection documentCollection = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single() - .getResource(); - - // Delete the created collection using async api - Observable> deleteCollectionObservable = asyncClient - .deleteCollection(getCollectionLink(documentCollection), null); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - - deleteCollectionObservable.single() // We know there is only single result - .subscribe(collectionResourceResponse -> { - System.out.println(collectionResourceResponse.getActivityId()); - countDownLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while deleting the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - }); - - // Wait till collection deletion completes - countDownLatch.await(); - } - - /** - * Query a Collection in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void collectionCreateAndQuery() throws Exception { - // Create a Collection - DocumentCollection collection = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single() - .getResource(); - - // Query the created collection using async api - Observable> queryCollectionObservable = asyncClient.queryCollections( - getDatabaseLink(), String.format("SELECT * FROM r where r.id = '%s'", collection.getId()), - null); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - - queryCollectionObservable.toList().subscribe(collectionFeedResponseList -> { - // toList() should return a list of size 1 - assertThat(collectionFeedResponseList.size(), equalTo(1)); - - // First element of the list should have only 1 result - FeedResponse collectionFeedResponse = collectionFeedResponseList.get(0); - assertThat(collectionFeedResponse.getResults().size(), equalTo(1)); - - // This collection should have the same id as the one we created - DocumentCollection foundCollection = collectionFeedResponse.getResults().get(0); - assertThat(foundCollection.getId(), equalTo(collection.getId())); - - System.out.println(collectionFeedResponse.getActivityId()); - countDownLatch.countDown(); - }, error -> { - System.err.println("an error occurred while querying the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - }); - - // Wait till collection query completes - countDownLatch.await(); - } - - private String getDatabaseLink() { - return "dbs/" + createdDatabase.getId(); - } - - private String getCollectionLink(DocumentCollection collection) { - return "dbs/" + createdDatabase.getId() + "/colls/" + collection.getId(); - } - - private DocumentCollection getMultiPartitionCollectionDefinition() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Set the partitionKeyDefinition for a partitioned collection. - // Here, we are setting the partitionKey of the Collection to be /city - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - List paths = new ArrayList<>(); - paths.add("/city"); - partitionKeyDefinition.setPaths(paths); - collectionDefinition.setPartitionKey(partitionKeyDefinition); - - // Set indexing policy to be range range for string and number - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - collectionDefinition.setIndexingPolicy(indexingPolicy); - - return collectionDefinition; - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/ConflictAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/ConflictAPITest.java deleted file mode 100644 index 8aad1f45b8e9..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/ConflictAPITest.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.observable.ListenableFutureObservable; - -import java.util.Iterator; -import java.util.List; -import java.util.UUID; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.notNullValue; - -/** - * This integration test class demonstrates how to use Async API for - * Conflicts. - *

- * Also if you need to work with Future or ListenableFuture it is possible to - * transform an observable to ListenableFuture. Please see - * {@link #transformObservableToGoogleGuavaListenableFuture()} - */ -public class ConflictAPITest { - private final static int TIMEOUT = 60000; - - private AsyncDocumentClient client; - private DocumentCollection createdCollection; - private Database createdDatabase; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - client = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Create database - createdDatabase = Utils.createDatabaseForTest(client); - - // Create collection - createdCollection = client - .createCollection("/dbs/" + createdDatabase.getId(), collectionDefinition, null) - .toBlocking().single().getResource(); - - int numberOfDocuments = 20; - // Add documents - for (int i = 0; i < numberOfDocuments; i++) { - Document doc = new Document(String.format("{ 'id': 'loc%d', 'counter': %d}", i, i)); - client.createDocument(getCollectionLink(), doc, null, true).toBlocking().single(); - } - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(client, createdDatabase); - Utils.safeClose(client); - } - - /** - * Read conflicts - * Converts the conflict read feed observable to blocking observable and - * uses that to find all conflicts - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void readConflicts_toBlocking_toIterator() { - // read all conflicts - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> conflictReadFeedObservable = client - .readConflicts(getCollectionLink(), options); - - // Covert the observable to a blocking observable, then convert the blocking - // observable to an iterator - Iterator> it = conflictReadFeedObservable.toBlocking().getIterator(); - - int expectedNumberOfConflicts = 0; - - int numberOfResults = 0; - while (it.hasNext()) { - FeedResponse page = it.next(); - System.out.println("items: " + page.getResults()); - String pageSizeAsString = page.getResponseHeaders().get(HttpConstants.HttpHeaders.ITEM_COUNT); - assertThat("header item count must be present", pageSizeAsString, notNullValue()); - int pageSize = Integer.valueOf(pageSizeAsString); - assertThat("Result size must match header item count", page.getResults(), hasSize(pageSize)); - numberOfResults += pageSize; - } - assertThat("number of total results", numberOfResults, equalTo(expectedNumberOfConflicts)); - } - - /** - * You can convert an Observable to a ListenableFuture. - * ListenableFuture (part of google guava library) is a popular extension - * of Java's Future which allows registering listener callbacks: - * https://github.com/google/guava/wiki/ListenableFutureExplained - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void transformObservableToGoogleGuavaListenableFuture() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> conflictReadFeedObservable = client - .readConflicts(getCollectionLink(), options); - - // Convert to observable of list of pages - Observable>> allPagesObservable = conflictReadFeedObservable.toList(); - - // Convert the observable of list of pages to a Future - ListenableFuture>> future = ListenableFutureObservable.to(allPagesObservable); - - List> pageList = future.get(); - - int totalNumberOfRetrievedConflicts = 0; - for (FeedResponse page : pageList) { - totalNumberOfRetrievedConflicts += page.getResults().size(); - } - assertThat(0, equalTo(totalNumberOfRetrievedConflicts)); - } - - private String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } -} - diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DatabaseCRUDAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DatabaseCRUDAsyncAPITest.java deleted file mode 100644 index 1f2fdfde4b64..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DatabaseCRUDAsyncAPITest.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.functions.Action1; -import rx.observable.ListenableFutureObservable; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CountDownLatch; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.greaterThan; - -/** - * This integration test class demonstrates how to use Async API to create, - * delete, replace, and update Databases. - *

- * NOTE: you can use rxJava based async api with java8 lambda expression. Use of - * rxJava based async APIs with java8 lambda expressions is much prettier. - *

- * You can also use the async API without java8 lambda expression support. - *

- * For example - *

    - *
  • {@link #createDatabase_Async()} demonstrates how to use async api - * with java8 lambda expression. - * - *
  • {@link #createDatabase_Async_withoutLambda()} demonstrates how to - * do the same thing without lambda expression. - *
- *

- * Also if you need to work with Future or ListenableFuture it is possible to - * transform an observable to ListenableFuture. Please see - * {@link #transformObservableToGoogleGuavaListenableFuture()} - */ -public class DatabaseCRUDAsyncAPITest { - private final static int TIMEOUT = 60000; - private final List databaseIds = new ArrayList<>(); - - private AsyncDocumentClient asyncClient; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - } - - private Database getDatabaseDefinition() { - Database databaseDefinition = new Database(); - databaseDefinition.setId(Utils.generateDatabaseId()); - - databaseIds.add(databaseDefinition.getId()); - - return databaseDefinition; - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - for (String id : databaseIds) { - Utils.safeClean(asyncClient, id); - } - Utils.safeClose(asyncClient); - } - - /** - * Create a database using async api. - * This test uses java8 lambda expression. - * See testCreateDatabase_Async_withoutLambda for usage without lambda. - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDatabase_Async() throws Exception { - Observable> createDatabaseObservable = asyncClient.createDatabase(getDatabaseDefinition(), - null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - createDatabaseObservable.single() // We know there is only single result - .subscribe(databaseResourceResponse -> { - System.out.println(databaseResourceResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while creating the database: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - // Wait till database creation completes - completionLatch.await(); - } - - /** - * Create a database using async api, without java8 lambda expressions - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDatabase_Async_withoutLambda() throws Exception { - Observable> createDatabaseObservable = asyncClient.createDatabase(getDatabaseDefinition(), - null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - Action1> onDatabaseCreationAction = new Action1>() { - - @Override - public void call(ResourceResponse resourceResponse) { - // Database is created - System.out.println(resourceResponse.getActivityId()); - completionLatch.countDown(); - } - }; - - Action1 onError = new Action1() { - @Override - public void call(Throwable error) { - System.err - .println("an error occurred while creating the database: actual cause: " + error.getMessage()); - completionLatch.countDown(); - } - }; - - createDatabaseObservable.single() // We know there is only a single event - .subscribe(onDatabaseCreationAction, onError); - - // Wait till database creation completes - completionLatch.await(); - } - - /** - * Create a database in a blocking manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDatabase_toBlocking() { - Observable> createDatabaseObservable = asyncClient.createDatabase(getDatabaseDefinition(), - null); - - // toBlocking() converts to a blocking observable. - // single() gets the only result. - createDatabaseObservable.toBlocking().single(); - } - - /** - * Attempt to create a database which already exists - * - First create a database - * - Using the async api generate an async database creation observable - * - Converts the Observable to blocking using Observable.toBlocking() api - * - Catch already exist failure (409) - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDatabase_toBlocking_DatabaseAlreadyExists_Fails() { - Database databaseDefinition = getDatabaseDefinition(); - asyncClient.createDatabase(databaseDefinition, null).toBlocking().single(); - - // Create the database for test. - Observable> databaseForTestObservable = asyncClient - .createDatabase(databaseDefinition, null); - - try { - databaseForTestObservable.toBlocking() // Blocks - .single(); // Gets the single result - assertThat("Should not reach here", false); - } catch (Exception e) { - assertThat("Database already exists.", ((DocumentClientException) e.getCause()).getStatusCode(), - equalTo(409)); - } - } - - /** - * You can convert an Observable to a ListenableFuture. - * ListenableFuture (part of google guava library) is a popular extension - * of Java's Future which allows registering listener callbacks: - * https://github.com/google/guava/wiki/ListenableFutureExplained - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void transformObservableToGoogleGuavaListenableFuture() throws Exception { - Observable> createDatabaseObservable = asyncClient.createDatabase(getDatabaseDefinition(), - null); - ListenableFuture> future = ListenableFutureObservable.to(createDatabaseObservable); - - ResourceResponse rrd = future.get(); - - assertThat(rrd.getRequestCharge(), greaterThan((double) 0)); - System.out.print(rrd.getRequestCharge()); - } - - /** - * Read a Database in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createAndReadDatabase() throws Exception { - // Create a database - Database database = asyncClient.createDatabase(getDatabaseDefinition(), null).toBlocking().single().getResource(); - - // Read the created database using async api - Observable> readDatabaseObservable = asyncClient.readDatabase("dbs/" + database.getId(), - null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - readDatabaseObservable.single() // We know there is only single result - .subscribe(databaseResourceResponse -> { - System.out.println(databaseResourceResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while reading the database: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - // Wait till read database completes - completionLatch.await(); - } - - /** - * Delete a Database in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createAndDeleteDatabase() throws Exception { - // Create a database - Database database = asyncClient.createDatabase(getDatabaseDefinition(), null).toBlocking().single().getResource(); - - // Delete the created database using async api - Observable> deleteDatabaseObservable = asyncClient - .deleteDatabase("dbs/" + database.getId(), null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - deleteDatabaseObservable.single() // We know there is only single result - .subscribe(databaseResourceResponse -> { - System.out.println(databaseResourceResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while deleting the database: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - // Wait till database deletion completes - completionLatch.await(); - } - - /** - * Query a Database in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void databaseCreateAndQuery() throws Exception { - // Create a database - Database databaseDefinition = getDatabaseDefinition(); - asyncClient.createDatabase(databaseDefinition, null).toBlocking().single().getResource(); - - // Query the created database using async api - Observable> queryDatabaseObservable = asyncClient - .queryDatabases(String.format("SELECT * FROM r where r.id = '%s'", databaseDefinition.getId()), null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - queryDatabaseObservable.toList().subscribe(databaseFeedResponseList -> { - // toList() should return a list of size 1 - assertThat(databaseFeedResponseList.size(), equalTo(1)); - - // First element of the list should have only 1 result - FeedResponse databaseFeedResponse = databaseFeedResponseList.get(0); - assertThat(databaseFeedResponse.getResults().size(), equalTo(1)); - - // This database should have the same id as the one we created - Database foundDatabase = databaseFeedResponse.getResults().get(0); - assertThat(foundDatabase.getId(), equalTo(databaseDefinition.getId())); - - System.out.println(databaseFeedResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println("an error occurred while querying the database: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - // Wait till database query completes - completionLatch.await(); - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentCRUDAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentCRUDAsyncAPITest.java deleted file mode 100644 index a9df3991e84c..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentCRUDAsyncAPITest.java +++ /dev/null @@ -1,540 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.apache.commons.lang3.RandomUtils; -import org.assertj.core.api.Assertions; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.functions.Action1; -import rx.observable.ListenableFutureObservable; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.is; - -/** - * This integration test class demonstrates how to use Async API to create, - * delete, replace, and upsert Documents. If you are interested in examples for - * querying for documents please see {@link DocumentQueryAsyncAPITest} - *

- * NOTE: you can use rxJava based async api with java8 lambda expression. Use - * of rxJava based async APIs with java8 lambda expressions is much prettier. - *

- * You can also use the async API without java8 lambda expression. - *

- * For example - *

    - *
  • {@link #createDocument_Async()} demonstrates how to use async api - * with java8 lambda expression. - * - *
  • {@link #createDocument_Async_withoutLambda()} demonstrates how to do - * the same thing without lambda expression. - *
- *

- * Also if you need to work with Future or ListenableFuture it is possible to - * transform an observable to ListenableFuture. Please see - * {@link #transformObservableToGoogleGuavaListenableFuture()} - */ -public class DocumentCRUDAsyncAPITest { - private final static String PARTITION_KEY_PATH = "/mypk"; - private final static int TIMEOUT = 60000; - private AsyncDocumentClient asyncClient; - private Database createdDatabase; - private DocumentCollection createdCollection; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - // Sets up the requirements for each test - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - ArrayList partitionKeyPaths = new ArrayList(); - partitionKeyPaths.add(PARTITION_KEY_PATH); - partitionKeyDefinition.setPaths(partitionKeyPaths); - collectionDefinition.setPartitionKey(partitionKeyDefinition); - - // Create database - createdDatabase = Utils.createDatabaseForTest(asyncClient); - - // Create collection - createdCollection = asyncClient - .createCollection("dbs/" + createdDatabase.getId(), collectionDefinition, null) - .toBlocking().single().getResource(); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } - - /** - * Create a document using java8 lambda expressions - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocument_Async() throws Exception { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, true); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - // Subscribe to Document resource response emitted by the observable - createDocumentObservable.single() // We know there will be one response - .subscribe(documentResourceResponse -> { - System.out.println(documentResourceResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while creating the document: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - // Wait till document creation completes - completionLatch.await(); - } - - /** - * Create a document without java8 lambda expressions - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocument_Async_withoutLambda() throws Exception { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, true); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - Action1> onNext = new Action1>() { - - @Override - public void call(ResourceResponse documentResourceResponse) { - System.out.println(documentResourceResponse.getActivityId()); - completionLatch.countDown(); - } - }; - - Action1 onError = new Action1() { - - public void call(Throwable error) { - System.err - .println("an error occurred while creating the document: actual cause: " + error.getMessage()); - completionLatch.countDown(); - } - }; - - // Subscribe to Document resource response emitted by the observable - createDocumentObservable.single() // We know there will be one response - .subscribe(onNext, onError); - - // Wait till document creation completes - completionLatch.await(); - } - - /** - * Create a document in a blocking manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocument_toBlocking() { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, true); - - // toBlocking() converts to a blocking observable. - // single() gets the only result. - createDocumentObservable.toBlocking().single(); - } - - /** - * Create a document with a programmatically set definition, in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocumentWithProgrammableDocumentDefinition() throws Exception { - Document documentDefinition = new Document(); - documentDefinition.setId("test-document"); - documentDefinition.set("counter", 1); - - // Create a document - Document createdDocument = asyncClient - .createDocument(getCollectionLink(), documentDefinition, null, false).toBlocking().single() - .getResource(); - - // Read the created document - Observable> readDocumentObservable = asyncClient - .readDocument(getDocumentLink(createdDocument), null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - readDocumentObservable.subscribe(documentResourceResponse -> { - Document readDocument = documentResourceResponse.getResource(); - - // The read document must be the same as the written document - assertThat(readDocument.getId(), equalTo("test-document")); - assertThat(readDocument.getInt("counter"), equalTo(1)); - System.out.println(documentResourceResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println("an error occured while creating the document: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - completionLatch.await(); - } - - /** - * Create 10 documents and sum up all the documents creation request charges - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void documentCreation_SumUpRequestCharge() throws Exception { - // Create 10 documents - List>> listOfCreateDocumentObservables = new ArrayList<>(); - for (int i = 0; i < 10; i++) { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), i)); - - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, false); - listOfCreateDocumentObservables.add(createDocumentObservable); - } - - // Merge all document creation observables into one observable - Observable> mergedObservable = Observable.merge(listOfCreateDocumentObservables); - - // Create a new observable emitting the total charge of creating all 10 - // documents. - Observable totalChargeObservable = mergedObservable - .map(ResourceResponse::getRequestCharge) - // Map to request charge - .reduce((totalCharge, charge) -> totalCharge + charge); - // Sum up all the charges - - final CountDownLatch completionLatch = new CountDownLatch(1); - - // Subscribe to the total request charge observable - totalChargeObservable.subscribe(totalCharge -> { - // Print the total charge - System.out.println(totalCharge); - completionLatch.countDown(); - }, e -> completionLatch.countDown() - ); - - completionLatch.await(); - } - - /** - * Attempt to create a document which already exists - * - First create a document - * - Using the async api generate an async document creation observable - * - Converts the Observable to blocking using Observable.toBlocking() api - * - Catch already exist failure (409) - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocument_toBlocking_DocumentAlreadyExists_Fails() { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - asyncClient.createDocument(getCollectionLink(), doc, null, false).toBlocking().single(); - - // Create the document - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, false); - - try { - createDocumentObservable.toBlocking() // Converts the observable to a blocking observable - .single(); // Gets the single result - Assert.fail("Document Already Exists. Document Creation must fail"); - } catch (Exception e) { - assertThat("Document already exists.", ((DocumentClientException) e.getCause()).getStatusCode(), - equalTo(409)); - } - } - - /** - * Attempt to create a document which already exists - * - First create a document - * - Using the async api generate an async document creation observable - * - Converts the Observable to blocking using Observable.toBlocking() api - * - Catch already exist failure (409) - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocument_Async_DocumentAlreadyExists_Fails() throws Exception { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - asyncClient.createDocument(getCollectionLink(), doc, null, false).toBlocking().single(); - - // Create the document - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, false); - - List errorList = Collections.synchronizedList(new ArrayList<>()); - - createDocumentObservable.subscribe(resourceResponse -> { - }, error -> { - errorList.add(error); - System.err.println("failed to create a document due to: " + error.getMessage()); - }); - - Thread.sleep(2000); - assertThat(errorList, hasSize(1)); - assertThat(errorList.get(0), is(instanceOf(DocumentClientException.class))); - assertThat(((DocumentClientException) errorList.get(0)).getStatusCode(), equalTo(409)); - } - - /** - * Replace a document - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void documentReplace_Async() throws Exception { - // Create a document - Document createdDocument = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - createdDocument = asyncClient.createDocument(getCollectionLink(), createdDocument, null, false).toBlocking() - .single().getResource(); - - // Try to replace the existing document - Document replacingDocument = new Document( - String.format("{ 'id': 'doc%s', 'counter': '%d', 'new-prop' : '2'}", createdDocument.getId(), 1)); - Observable> replaceDocumentObservable = asyncClient - .replaceDocument(getDocumentLink(createdDocument), replacingDocument, null); - - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - - replaceDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - - Thread.sleep(2000); - - assertThat(capturedResponse, hasSize(1)); - assertThat(capturedResponse.get(0).getResource().get("new-prop"), equalTo("2")); - } - - /** - * Upsert a document - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void documentUpsert_Async() throws Exception { - // Create a document - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - asyncClient.createDocument(getCollectionLink(), doc, null, false).toBlocking().single(); - - // Upsert the existing document - Document upsertingDocument = new Document( - String.format("{ 'id': 'doc%s', 'counter': '%d', 'new-prop' : '2'}", doc.getId(), 1)); - Observable> upsertDocumentObservable = asyncClient - .upsertDocument(getCollectionLink(), upsertingDocument, null, false); - - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - - upsertDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - - Thread.sleep(4000); - - assertThat(capturedResponse, hasSize(1)); - assertThat(capturedResponse.get(0).getResource().get("new-prop"), equalTo("2")); - } - - /** - * Delete a document - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void documentDelete_Async() throws Exception { - // Create a document - Document createdDocument = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d', 'mypk' : '%s'}", UUID.randomUUID().toString(), 1, UUID.randomUUID().toString())); - createdDocument = asyncClient.createDocument(getCollectionLink(), createdDocument, null, false).toBlocking() - .single().getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getString("mypk"))); - - // Delete the existing document - Observable> deleteDocumentObservable = asyncClient - .deleteDocument(getDocumentLink(createdDocument), options); - - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - - deleteDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - - Thread.sleep(2000); - - assertThat(capturedResponse, hasSize(1)); - - // Assert document is deleted - FeedOptions queryOptions = new FeedOptions(); - queryOptions.setEnableCrossPartitionQuery(true); - List listOfDocuments = asyncClient - .queryDocuments(getCollectionLink(), String.format("SELECT * FROM r where r.id = '%s'", createdDocument.getId()), queryOptions) - .map(FeedResponse::getResults) // Map page to its list of documents - .concatMap(Observable::from) // Flatten the observable - .toList() // Transform to a observable - .toBlocking() // Block - .single(); // Gets the List - - // Assert that there is no document found - assertThat(listOfDocuments, hasSize(0)); - } - - /** - * Read a document - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void documentRead_Async() throws Exception { - // Create a document - Document createdDocument = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d', 'mypk' : '%s'}", UUID.randomUUID().toString(), 1, UUID.randomUUID().toString())); - createdDocument = asyncClient.createDocument(getCollectionLink(), createdDocument, null, false).toBlocking() - .single().getResource(); - - // Read the document - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getString("mypk"))); - Observable> readDocumentObservable = asyncClient - .readDocument(getDocumentLink(createdDocument), options); - - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - - readDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - - Thread.sleep(2000); - - // Assert document is retrieved - assertThat(capturedResponse, hasSize(1)); - } - - private static class TestObject { - @JsonProperty("mypk") - private String mypk; - - @JsonProperty("id") - private String id; - - @JsonProperty("prop") - private String prop; - } - - @Test(groups = {"samples"}, timeOut = TIMEOUT) - public void customSerialization() throws Exception { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); - - TestObject testObject = new TestObject(); - testObject.id = UUID.randomUUID().toString(); - testObject.mypk = UUID.randomUUID().toString(); - testObject.prop = UUID.randomUUID().toString(); - String itemAsJsonString = mapper.writeValueAsString(testObject); - Document doc = new Document(itemAsJsonString); - - Document createdDocument = asyncClient - .createDocument(getCollectionLink(), doc, null, false) - .toBlocking() - .single() - .getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(testObject.mypk)); - - Document readDocument = asyncClient - .readDocument(createdDocument.getSelfLink(), options) - .toBlocking() - .single() - .getResource(); - - TestObject readObject = mapper.readValue(readDocument.toJson(), TestObject.class); - assertThat(readObject.prop, equalTo(testObject.prop)); - } - - /** - * You can convert an Observable to a ListenableFuture. - * ListenableFuture (part of google guava library) is a popular extension - * of Java's Future which allows registering listener callbacks: - * https://github.com/google/guava/wiki/ListenableFutureExplained - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void transformObservableToGoogleGuavaListenableFuture() throws Exception { - Document doc = new Document(String.format("{ 'id': 'doc%d', 'counter': '%d'}", RandomUtils.nextInt(), 1)); - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, false); - ListenableFuture> listenableFuture = ListenableFutureObservable - .to(createDocumentObservable); - - ResourceResponse rrd = listenableFuture.get(); - - assertThat(rrd.getRequestCharge(), greaterThan((double) 0)); - System.out.print(rrd.getRequestCharge()); - } - - private String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } - - private String getDocumentLink(Document createdDocument) { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/docs/" + createdDocument.getId(); - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentQueryAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentQueryAsyncAPITest.java deleted file mode 100644 index 35d652c3efdf..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentQueryAsyncAPITest.java +++ /dev/null @@ -1,491 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.apache.commons.lang3.RandomStringUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.Subscriber; -import rx.functions.Action1; -import rx.functions.Func1; -import rx.observable.ListenableFutureObservable; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.notNullValue; - -/** - * This integration test class demonstrates how to use Async API to query for - * Documents. - *

- * NOTE: you can use rxJava based async api with java8 lambda expression. Use - * of rxJava based async APIs with java8 lambda expressions is much prettier. - *

- * You can also use the async API without java8 lambda expression. - *

- * For example - *

    - *
  • {@link #queryDocuments_Async()} demonstrates how to use async api - * with java8 lambda expression. - * - *
  • {@link #queryDocuments_Async_withoutLambda()} demonstrates how to do - * the same thing without lambda expression. - *
- *

- * Also if you need to work with Future or ListenableFuture it is possible to - * transform an observable to ListenableFuture. Please see - * {@link #transformObservableToGoogleGuavaListenableFuture()} - */ -public class DocumentQueryAsyncAPITest { - private final static int TIMEOUT = 60000; - private AsyncDocumentClient asyncClient; - private DocumentCollection createdCollection; - private Database createdDatabase; - private int numberOfDocuments; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Create database - - createdDatabase = Utils.createDatabaseForTest(asyncClient); - - // Create collection - createdCollection = asyncClient - .createCollection("dbs/" + createdDatabase.getId(), collectionDefinition, null) - .toBlocking().single().getResource(); - - numberOfDocuments = 20; - // Add documents - for (int i = 0; i < numberOfDocuments; i++) { - Document doc = new Document(String.format("{ 'id': 'loc%d', 'counter': %d}", i, i)); - asyncClient.createDocument(getCollectionLink(), doc, null, true).toBlocking().single(); - } - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } - - /** - * Query for documents using java8 lambda expressions - * Creates a document query observable and verifies the async behavior - * of document query observable - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_Async() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> documentQueryObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options); - - final CountDownLatch mainThreadBarrier = new CountDownLatch(1); - - final CountDownLatch resultsCountDown = new CountDownLatch(numberOfDocuments); - - // forEach(.) is an alias for subscribe(.) - documentQueryObservable.forEach(page -> { - try { - // Waits on the barrier - mainThreadBarrier.await(); - } catch (InterruptedException e) { - } - - for (@SuppressWarnings("unused") - Document d : page.getResults()) { - resultsCountDown.countDown(); - } - }); - - // The following code will run concurrently - System.out.println("action is subscribed to the observable"); - - // Release main thread barrier - System.out.println("after main thread barrier is released, subscribed observable action can continue"); - mainThreadBarrier.countDown(); - - System.out.println("waiting for all the results using result count down latch"); - - resultsCountDown.await(); - } - - /** - * Query for documents, without using java8 lambda expressions - * Creates a document query observable and verifies the async behavior - * of document query observable - * NOTE: does the same thing as testQueryDocuments_Async without java8 lambda - * expression - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_Async_withoutLambda() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> documentQueryObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options); - - final CountDownLatch mainThreadBarrier = new CountDownLatch(1); - - final CountDownLatch resultsCountDown = new CountDownLatch(numberOfDocuments); - - Action1> actionPerPage = new Action1>() { - - @SuppressWarnings("unused") - @Override - public void call(FeedResponse t) { - - try { - // waits on the barrier - mainThreadBarrier.await(); - } catch (InterruptedException e) { - } - - for (Document d : t.getResults()) { - resultsCountDown.countDown(); - } - } - }; - - // forEach(.) is an alias for subscribe(.) - documentQueryObservable.forEach(actionPerPage); - // The following code will run concurrently - - System.out.println("action is subscribed to the observable"); - - // Release main thread barrier - System.out.println("after main thread barrier is released, subscribed observable action can continue"); - mainThreadBarrier.countDown(); - - System.out.println("waiting for all the results using result count down latch"); - - resultsCountDown.await(); - } - - /** - * Queries for documents and sum up the total request charge - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_findTotalRequestCharge() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable totalChargeObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options) - .map(FeedResponse::getRequestCharge) // Map the page to its request charge - .reduce((totalCharge, charge) -> totalCharge + charge); // Sum up all the request charges - - final CountDownLatch successfulCompletionLatch = new CountDownLatch(1); - - // subscribe(.) is the same as forEach(.) - totalChargeObservable.subscribe(totalCharge -> { - System.out.println(totalCharge); - successfulCompletionLatch.countDown(); - }); - - successfulCompletionLatch.await(); - } - - /** - * Subscriber unsubscribes after first page - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_unsubscribeAfterFirstPage() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> requestChargeObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options); - - AtomicInteger onNextCounter = new AtomicInteger(); - AtomicInteger onCompletedCounter = new AtomicInteger(); - AtomicInteger onErrorCounter = new AtomicInteger(); - - // Subscribe to the pages of Documents emitted by the observable - requestChargeObservable.subscribe(new Subscriber>() { - - @Override - public void onCompleted() { - onCompletedCounter.incrementAndGet(); - } - - @Override - public void onError(Throwable e) { - onErrorCounter.incrementAndGet(); - } - - @Override - public void onNext(FeedResponse page) { - onNextCounter.incrementAndGet(); - unsubscribe(); - } - }); - - Thread.sleep(4000); - - // After subscriber unsubscribes, it doesn't receive any more pages. - assertThat(onNextCounter.get(), equalTo(1)); - assertThat(onCompletedCounter.get(), equalTo(0)); - assertThat(onErrorCounter.get(), equalTo(0)); - } - - /** - * Queries for documents and filter out the fetched results - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_filterFetchedResults() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Func1 isPrimeNumber = new Func1() { - - @Override - public Boolean call(Document doc) { - int n = doc.getInt("counter"); - if (n <= 1) - return false; - for (int i = 2; 2 * i < n; i++) { - if (n % i == 0) - return false; - } - return true; - } - }; - - List resultList = Collections.synchronizedList(new ArrayList()); - - asyncClient.queryDocuments(getCollectionLink(), "SELECT * FROM root", options) - .map(FeedResponse::getResults) // Map the page to the list of documents - .concatMap(Observable::from) // Flatten the observable> to observable - .filter(isPrimeNumber) // Filter documents using isPrimeNumber predicate - .subscribe(doc -> resultList.add(doc)); // Collect the results - - Thread.sleep(4000); - - int expectedNumberOfPrimes = 0; - // Find all the documents with prime number counter - for (int i = 0; i < numberOfDocuments; i++) { - boolean isPrime = true; - if (i <= 1) - isPrime = false; - for (int j = 2; 2 * j < i; j++) { - if (i % j == 0) { - isPrime = false; - break; - } - } - - if (isPrime) { - expectedNumberOfPrimes++; - } - } - - // Assert that we only collected what's expected - assertThat(resultList, hasSize(expectedNumberOfPrimes)); - } - - /** - * Queries for documents - * Converts the document query observable to blocking observable and - * uses that to find all documents - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_toBlocking_toIterator() { - // Query for documents - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> documentQueryObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options); - - // Covert the observable to a blocking observable, then convert the blocking - // observable to an iterator - Iterator> it = documentQueryObservable.toBlocking().getIterator(); - - int pageCounter = 0; - int numberOfResults = 0; - while (it.hasNext()) { - FeedResponse page = it.next(); - pageCounter++; - - String pageSizeAsString = page.getResponseHeaders().get(HttpConstants.HttpHeaders.ITEM_COUNT); - assertThat("header item count must be present", pageSizeAsString, notNullValue()); - int pageSize = Integer.valueOf(pageSizeAsString); - assertThat("Result size must match header item count", page.getResults(), hasSize(pageSize)); - numberOfResults += pageSize; - } - assertThat("number of total results", numberOfResults, equalTo(numberOfDocuments)); - assertThat("number of result pages", pageCounter, - equalTo((numberOfDocuments + requestPageSize - 1) / requestPageSize)); - } - - /** - * Queries for documents using an Orderby query. - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void qrderBy_Async() throws Exception { - // Create a partitioned collection - String collectionId = UUID.randomUUID().toString(); - DocumentCollection multiPartitionCollection = createMultiPartitionCollection("dbs/" + createdDatabase.getId(), - collectionId, "/key"); - - // Insert documents - int totalNumberOfDocumentsInMultiPartitionCollection = 10; - for (int i = 0; i < totalNumberOfDocumentsInMultiPartitionCollection; i++) { - - Document doc = new Document(String.format("{\"id\":\"documentId%d\",\"key\":\"%s\",\"prop\":%d}", i, - RandomStringUtils.randomAlphabetic(2), i)); - asyncClient.createDocument("dbs/" + createdDatabase.getId() + "/colls/" + multiPartitionCollection.getId(), - doc, null, true).toBlocking().single(); - } - - // Query for the documents order by the prop field - SqlQuerySpec query = new SqlQuerySpec("SELECT r.id FROM r ORDER BY r.prop", new SqlParameterCollection()); - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(5); - - // Max degree of parallelism determines the number of partitions that - // the SDK establishes simultaneous connections to. - options.setMaxDegreeOfParallelism(2); - - // Get the observable order by query documents - Observable> documentQueryObservable = asyncClient.queryDocuments( - "dbs/" + createdDatabase.getId() + "/colls/" + multiPartitionCollection.getId(), query, options); - - List resultList = Collections.synchronizedList(new ArrayList<>()); - - documentQueryObservable.map(FeedResponse::getResults) - // Map the logical page to the list of documents in the page - .concatMap(Observable::from) // Flatten the list of documents - .map(doc -> doc.getId()) // Map to the document Id - .forEach(docId -> resultList.add(docId)); // Add each document Id to the resultList - - Thread.sleep(4000); - - // Assert we found all the results - assertThat(resultList, hasSize(totalNumberOfDocumentsInMultiPartitionCollection)); - for (int i = 0; i < totalNumberOfDocumentsInMultiPartitionCollection; i++) { - String docId = resultList.get(i); - // Assert that the order of the documents are valid - assertThat(docId, equalTo("documentId" + i)); - } - } - - /** - * You can convert an Observable to a ListenableFuture. - * ListenableFuture (part of google guava library) is a popular extension - * of Java's Future which allows registering listener callbacks: - * https://github.com/google/guava/wiki/ListenableFutureExplained - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void transformObservableToGoogleGuavaListenableFuture() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> documentQueryObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options); - - // Convert to observable of list of pages - Observable>> allPagesObservable = documentQueryObservable.toList(); - - // Convert the observable of list of pages to a Future - ListenableFuture>> future = ListenableFutureObservable.to(allPagesObservable); - - List> pageList = future.get(); - - int totalNumberOfRetrievedDocuments = 0; - for (FeedResponse page : pageList) { - totalNumberOfRetrievedDocuments += page.getResults().size(); - } - assertThat(numberOfDocuments, equalTo(totalNumberOfRetrievedDocuments)); - } - - private String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } - - private DocumentCollection createMultiPartitionCollection(String databaseLink, String collectionId, - String partitionKeyPath) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add(partitionKeyPath); - partitionKeyDef.setPaths(paths); - - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10100); - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(collectionId); - collectionDefinition.setPartitionKey(partitionKeyDef); - DocumentCollection createdCollection = asyncClient.createCollection(databaseLink, collectionDefinition, options) - .toBlocking().single().getResource(); - - return createdCollection; - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/InMemoryGroupbyTest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/InMemoryGroupbyTest.java deleted file mode 100644 index baeac40b2a02..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/InMemoryGroupbyTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.SqlParameter; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.observables.GroupedObservable; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.UUID; - -public class InMemoryGroupbyTest { - private final static int TIMEOUT = 60000; - - private static AsyncDocumentClient asyncClient; - private static Database createdDatabase; - private static DocumentCollection createdCollection; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public static void setUp() throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - // Create database - createdDatabase = Utils.createDatabaseForTest(asyncClient); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Create collection - createdCollection = asyncClient - .createCollection("dbs/" + createdDatabase.getId(), collectionDefinition, null) - .toBlocking().single().getResource(); - - int numberOfPayers = 10; - int numberOfDocumentsPerPayer = 10; - - for (int i = 0; i < numberOfPayers; i++) { - - for (int j = 0; j < numberOfDocumentsPerPayer; j++) { - - LocalDateTime currentTime = LocalDateTime.now(); - - Document doc = new Document(String.format("{ " - + "'id' : '%s'," - + "'site_id': 'ABC', " - + "'payer_id': %d, " - + " 'created_time' : %d " - + "}", UUID.randomUUID().toString(), i, currentTime.getSecond())); - asyncClient.createDocument(getCollectionLink(), doc, null, true).toBlocking().single(); - - Thread.sleep(100); - } - } - System.out.println("finished inserting documents"); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public static void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - asyncClient.close(); - } - - /** - * Queries Documents and performs Group by operation after fetching the Documents. - * If you want to understand the steps in more details see {@link #groupByInMemory_MoreDetail()} - * @throws Exception - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void groupByInMemory() { - // If you want to understand the steps in more details see groupByInMemoryMoreDetail() - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable documentsObservable = asyncClient - .queryDocuments(getCollectionLink(), - new SqlQuerySpec("SELECT * FROM root r WHERE r.site_id=@site_id", - new SqlParameterCollection(new SqlParameter("@site_id", "ABC"))), - options) - .flatMap(page -> Observable.from(page.getResults())); - - final LocalDateTime now = LocalDateTime.now(); - - List> resultsGroupedAsLists = documentsObservable - .filter(doc -> Math.abs(now.getSecond() - doc.getInt("created_time")) <= 90) - .groupBy(doc -> doc.getInt("payer_id")).flatMap(grouped -> grouped.toList()) - .toList() - .toBlocking() - .single(); - - for(List resultsForEachPayer :resultsGroupedAsLists) { - System.out.println("documents with payer_id : " + resultsForEachPayer.get(0).getInt("payer_id") + " are " + resultsForEachPayer); - } - } - - /** - * This does the same thing as {@link #groupByInMemory_MoreDetail()} but with pedagogical details - * @throws Exception - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void groupByInMemory_MoreDetail() { - - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - - Observable documentsObservable = asyncClient - .queryDocuments(getCollectionLink(), - new SqlQuerySpec("SELECT * FROM root r WHERE r.site_id=@site_id", - new SqlParameterCollection(new SqlParameter("@site_id", "ABC"))), - options) - .flatMap(page -> Observable.from(page.getResults())); - - final LocalDateTime now = LocalDateTime.now(); - - Observable> groupedByPayerIdObservable = documentsObservable - .filter(doc -> Math.abs(now.getSecond() - doc.getInt("created_time")) <= 90) - .groupBy(doc -> doc.getInt("payer_id")); - - Observable> docsGroupedAsList = groupedByPayerIdObservable.flatMap(grouped -> { - Observable> list = grouped.toList(); - return list; - }); - - List> resultsGroupedAsLists = docsGroupedAsList.toList().toBlocking().single(); - - for(List resultsForEachPayer : resultsGroupedAsLists) { - System.out.println("documents with payer_id : " + resultsForEachPayer.get(0).getInt("payer_id") + " are " + resultsForEachPayer); - } - } - - private static String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/OfferCRUDAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/OfferCRUDAsyncAPITest.java deleted file mode 100644 index f64d4ec20fc3..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/OfferCRUDAsyncAPITest.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2017 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; - -/** - * This integration test class demonstrates how to use Async API to query and - * replace an Offer. - */ -public class OfferCRUDAsyncAPITest { - private final static int TIMEOUT = 60000; - private Database createdDatabase; - private AsyncDocumentClient asyncClient; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - // Create database - createdDatabase = Utils.createDatabaseForTest(asyncClient); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } - - /** - * Query for all the offers existing in the database account. - * Replace the required offer so that it has a higher throughput. - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void updateOffer() throws Exception { - - int initialThroughput = 10200; - int newThroughput = 10300; - - // Set the throughput to be 10,200 - RequestOptions multiPartitionRequestOptions = new RequestOptions(); - multiPartitionRequestOptions.setOfferThroughput(initialThroughput); - - // Create the collection - DocumentCollection createdCollection = asyncClient.createCollection("dbs/" + createdDatabase.getId(), - getMultiPartitionCollectionDefinition(), multiPartitionRequestOptions).toBlocking().single() - .getResource(); - - final CountDownLatch successfulCompletionLatch = new CountDownLatch(1); - - // Find offer associated with this collection - asyncClient.queryOffers( - String.format("SELECT * FROM r where r.offerResourceId = '%s'", createdCollection.getResourceId()), - null).flatMap(offerFeedResponse -> { - List offerList = offerFeedResponse.getResults(); - // Number of offers returned should be 1 - assertThat(offerList.size(), equalTo(1)); - - // This offer must correspond to the collection we created - Offer offer = offerList.get(0); - int currentThroughput = offer.getThroughput(); - assertThat(offer.getString("offerResourceId"), equalTo(createdCollection.getResourceId())); - assertThat(currentThroughput, equalTo(initialThroughput)); - System.out.println("initial throughput: " + currentThroughput); - - // Update the offer's throughput - offer.setThroughput(newThroughput); - - // Replace the offer - return asyncClient.replaceOffer(offer); - }).subscribe(offerResourceResponse -> { - Offer offer = offerResourceResponse.getResource(); - int currentThroughput = offer.getThroughput(); - - // The current throughput of the offer must be equal to the new throughput value - assertThat(offer.getString("offerResourceId"), equalTo(createdCollection.getResourceId())); - assertThat(currentThroughput, equalTo(newThroughput)); - - System.out.println("updated throughput: " + currentThroughput); - successfulCompletionLatch.countDown(); - }, error -> { - System.err - .println("an error occurred while updating the offer: actual cause: " + error.getMessage()); - }); - - successfulCompletionLatch.await(); - } - - private DocumentCollection getMultiPartitionCollectionDefinition() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Set the partitionKeyDefinition for a partitioned collection - // Here, we are setting the partitionKey of the Collection to be /city - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - List paths = new ArrayList<>(); - paths.add("/city"); - partitionKeyDefinition.setPaths(paths); - collectionDefinition.setPartitionKey(partitionKeyDefinition); - - // Set indexing policy to be range range for string and number - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - collectionDefinition.setIndexingPolicy(indexingPolicy); - - return collectionDefinition; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/StoredProcedureAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/StoredProcedureAsyncAPITest.java deleted file mode 100644 index aa06bf501397..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/StoredProcedureAsyncAPITest.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2017 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; - -import javax.net.ssl.SSLException; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.core.Is.is; - -/** - * This integration test class demonstrates how to use Async API to create - * and execute Stored Procedures. - */ -public class StoredProcedureAsyncAPITest { - private final static int TIMEOUT = 60000; - - private Database createdDatabase; - private DocumentCollection createdCollection; - private AsyncDocumentClient asyncClient; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - createdDatabase = Utils.createDatabaseForTest(asyncClient); - - createdCollection = asyncClient - .createCollection("dbs/" + createdDatabase.getId(), getMultiPartitionCollectionDefinition(), null) - .toBlocking().single().getResource(); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } - - /** - * Execute Stored Procedure and retrieve the Script Log - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void scriptConsoleLogEnabled() throws Exception { - // Create a stored procedure - StoredProcedure storedProcedure = new StoredProcedure( - "{" + - " 'id':'storedProcedureSample'," + - " 'body':" + - " 'function() {" + - " var mytext = \"x\";" + - " var myval = 1;" + - " try {" + - " console.log(\"The value of %s is %s.\", mytext, myval);" + - " getContext().getResponse().setBody(\"Success!\");" + - " }" + - " catch(err) {" + - " getContext().getResponse().setBody(\"inline err: [\" + err.number + \"] \" + err);" + - " }" + - " }'" + - "}"); - - storedProcedure = asyncClient.createStoredProcedure(getCollectionLink(), storedProcedure, null) - .toBlocking().single().getResource(); - - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setScriptLoggingEnabled(true); - requestOptions.setPartitionKey(new PartitionKey("Seattle")); - - final CountDownLatch successfulCompletionLatch = new CountDownLatch(1); - - // Execute the stored procedure - asyncClient.executeStoredProcedure(getSprocLink(storedProcedure), requestOptions, new Object[]{}) - .subscribe(storedProcedureResponse -> { - String logResult = "The value of x is 1."; - try { - assertThat(URLDecoder.decode(storedProcedureResponse.getScriptLog(), "UTF-8"), is(logResult)); - assertThat(URLDecoder.decode(storedProcedureResponse.getResponseHeaders() - .get(HttpConstants.HttpHeaders.SCRIPT_LOG_RESULTS), "UTF-8"), is(logResult)); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - successfulCompletionLatch.countDown(); - System.out.println(storedProcedureResponse.getActivityId()); - }, error -> { - System.err.println("an error occurred while executing the stored procedure: actual cause: " - + error.getMessage()); - }); - - successfulCompletionLatch.await(); - } - - /** - * Execute Stored Procedure that takes arguments - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void executeStoredProcWithArgs() throws Exception { - // Create stored procedure - StoredProcedure storedProcedure = new StoredProcedure( - "{" + - " 'id': 'multiplySample'," + - " 'body':" + - " 'function (value, num) {" + - " getContext().getResponse().setBody(" + - " \"2*\" + value + \" is \" + num * 2 );" + - " }'" + - "}"); - - storedProcedure = asyncClient.createStoredProcedure(getCollectionLink(), storedProcedure, null) - .toBlocking().single().getResource(); - - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey("Seattle")); - - final CountDownLatch successfulCompletionLatch = new CountDownLatch(1); - - // Execute the stored procedure - Object[] storedProcedureArgs = new Object[]{"a", 123}; - asyncClient.executeStoredProcedure(getSprocLink(storedProcedure), requestOptions, storedProcedureArgs) - .subscribe(storedProcedureResponse -> { - String storedProcResultAsString = storedProcedureResponse.getResponseAsString(); - assertThat(storedProcResultAsString, equalTo("\"2*a is 246\"")); - successfulCompletionLatch.countDown(); - System.out.println(storedProcedureResponse.getActivityId()); - }, error -> { - System.err.println("an error occurred while executing the stored procedure: actual cause: " - + error.getMessage()); - }); - - successfulCompletionLatch.await(); - } - - /** - * Execute Stored Procedure that takes arguments, passing a Pojo object - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void executeStoredProcWithPojoArgs() throws Exception { - // create stored procedure - StoredProcedure storedProcedure = new StoredProcedure( - "{" + - " 'id': 'storedProcedurePojoSample'," + - " 'body':" + - " 'function (value) {" + - " getContext().getResponse().setBody(" + - " \"a is \" + value.temp);" + - " }'" + - "}"); - - storedProcedure = asyncClient.createStoredProcedure(getCollectionLink(), storedProcedure, null) - .toBlocking().single().getResource(); - - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey("Seattle")); - - final CountDownLatch successfulCompletionLatch = new CountDownLatch(1); - - // POJO - class SamplePojo { - public String temp = "my temp value"; - } - SamplePojo samplePojo = new SamplePojo(); - - // Execute the stored procedure - Object[] storedProcedureArgs = new Object[]{samplePojo}; - asyncClient.executeStoredProcedure(getSprocLink(storedProcedure), requestOptions, storedProcedureArgs) - .subscribe(storedProcedureResponse -> { - String storedProcResultAsString = storedProcedureResponse.getResponseAsString(); - assertThat(storedProcResultAsString, equalTo("\"a is my temp value\"")); - successfulCompletionLatch.countDown(); - System.out.println(storedProcedureResponse.getActivityId()); - }, error -> { - System.err.println("an error occurred while executing the stored procedure: actual cause: " - + error.getMessage()); - }); - - successfulCompletionLatch.await(); - } - - private static DocumentCollection getMultiPartitionCollectionDefinition() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Set the partitionKeyDefinition for a partitioned collection - // Here, we are setting the partitionKey of the Collection to be /city - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - List paths = new ArrayList(); - paths.add("/city"); - partitionKeyDefinition.setPaths(paths); - collectionDefinition.setPartitionKey(partitionKeyDefinition); - - // Set indexing policy to be range range for string and number - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - collectionDefinition.setIndexingPolicy(indexingPolicy); - - return collectionDefinition; - } - - private String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } - - private String getSprocLink(StoredProcedure sproc) { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/sprocs/" + sproc.getId(); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TestConfigurations.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TestConfigurations.java deleted file mode 100644 index f48ee5da652c..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TestConfigurations.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import org.apache.commons.lang3.StringUtils; - -import com.google.common.base.Strings; - -/** - * Contains the configurations for tests. - *

- * For running tests, you can pass a customized endpoint configuration in one of the following - * ways: - *

    - *
  • -DACCOUNT_KEY="[your-key]" -ACCOUNT_HOST="[your-endpoint]" as JVM - * command-line option.
  • - *
  • You can set ACCOUNT_KEY and ACCOUNT_HOST as environment variables.
  • - *
- *

- * If none of the above is set, emulator endpoint will be used. - */ -public final class TestConfigurations { - // Replace MASTER_KEY and HOST with values from your Azure Cosmos DB account. - // The default values are credentials of the local emulator, which are not used in any production environment. - // - public static String MASTER_KEY = - System.getProperty("ACCOUNT_KEY", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("ACCOUNT_KEY")), - "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")); - - public static String HOST = - System.getProperty("ACCOUNT_HOST", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("ACCOUNT_HOST")), - "https://localhost:443/")); -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TokenResolverTest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TokenResolverTest.java deleted file mode 100644 index c33f14fdc2b3..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TokenResolverTest.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.CosmosResourceType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.TokenResolver; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.core.IsInstanceOf.instanceOf; - -public class TokenResolverTest { - private final static int TIMEOUT = 60000; - private final static String USER_ID = "userId"; - private AsyncDocumentClient asyncClient; - private Database createdDatabase; - private DocumentCollection createdCollection; - private Map userToReadOnlyResourceTokenMap = new HashMap<>(); - private Map documentToReadUserMap = new HashMap<>(); - - private Map documentToReadWriteUserMap = new HashMap<>(); - private Map userToReadWriteResourceTokenMap = new HashMap<>(); - - - /** - * This Example walks you through how to use a token resolver to - * control authorization and access to Cosmos DB resources. - */ - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - // Sets up the requirements for each test - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Create database - createdDatabase = Utils.createDatabaseForTest(asyncClient); - - // Create collection - createdCollection = asyncClient - .createCollection("dbs/" + createdDatabase.getId(), collectionDefinition, null) - .toBlocking().single().getResource(); - - for (int i = 0; i < 10; i++) { - // Create a document - Document documentDefinition = new Document(); - documentDefinition.setId(UUID.randomUUID().toString()); - Document createdDocument = asyncClient.createDocument(createdCollection.getSelfLink(), documentDefinition, null, true).toBlocking().first().getResource(); - - // Create a User who is meant to only read this document - User readUserDefinition = new User(); - readUserDefinition.setId(UUID.randomUUID().toString()); - User createdReadUser = asyncClient.createUser(createdDatabase.getSelfLink(), readUserDefinition, null).toBlocking().first().getResource(); - - // Create a read only permission for the above document - Permission readOnlyPermissionDefinition = new Permission(); - readOnlyPermissionDefinition.setId(UUID.randomUUID().toString()); - readOnlyPermissionDefinition.setResourceLink(createdDocument.getSelfLink()); - readOnlyPermissionDefinition.setPermissionMode(PermissionMode.Read); - - // Assign the permission to the above user - Permission readOnlyCreatedPermission = asyncClient.createPermission(createdReadUser.getSelfLink(), readOnlyPermissionDefinition, null).toBlocking().first().getResource(); - userToReadOnlyResourceTokenMap.put(createdReadUser.getId(), readOnlyCreatedPermission.getToken()); - - documentToReadUserMap.put(createdDocument.getSelfLink(), createdReadUser.getId()); - - // Create a User who can both read and write this document - User readWriteUserDefinition = new User(); - readWriteUserDefinition.setId(UUID.randomUUID().toString()); - User createdReadWriteUser = asyncClient.createUser(createdDatabase.getSelfLink(), readWriteUserDefinition, null).toBlocking().first().getResource(); - - // Create a read/write permission for the above document - Permission readWritePermissionDefinition = new Permission(); - readWritePermissionDefinition.setId(UUID.randomUUID().toString()); - readWritePermissionDefinition.setResourceLink(createdDocument.getSelfLink()); - readWritePermissionDefinition.setPermissionMode(PermissionMode.All); - - // Assign the permission to the above user - Permission readWriteCreatedPermission = asyncClient.createPermission(createdReadWriteUser.getSelfLink(), readWritePermissionDefinition, null).toBlocking().first().getResource(); - userToReadWriteResourceTokenMap.put(createdReadWriteUser.getId(), readWriteCreatedPermission.getToken()); - - documentToReadWriteUserMap.put(createdDocument.getSelfLink(), createdReadWriteUser.getId()); - } - } - - /** - * Read a document with a user having read permission - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void readDocumentThroughTokenResolver() throws Exception { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolverForRead()) - .build(); - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - for (String documentLink : documentToReadUserMap.keySet()) { - - // Each document has one User who can only read it. Pass that User Id in the properties. - // The token resolver will resolve the token for that User based on 'userId'. - ImmutableMap properties = ImmutableMap. builder() - .put(USER_ID, documentToReadUserMap.get(documentLink)) - .build(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setProperties(properties); - Observable> readDocumentObservable = asyncClientWithTokenResolver - .readDocument(documentLink, requestOptions); - readDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - } - Thread.sleep(2000); - System.out.println("capturedResponse.size() = " + capturedResponse.size()); - assertThat(capturedResponse, hasSize(10)); - } finally { - Utils.safeClose(asyncClientWithTokenResolver); - } - } - - /** - * Delete a document with a user having all permission - */ - @Test(groups = "samples", timeOut = TIMEOUT, dependsOnMethods = {"readDocumentThroughTokenResolver"}) - public void deleteDocumentThroughTokenResolver() throws Exception { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolverForReadWrite()) - .build(); - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - for (String documentLink : documentToReadWriteUserMap.keySet()) { - - // Each document has one User who can read and write it. Pass that User Id in the properties. - // The token resolver will resolve the token for that User based on 'userId'. - ImmutableMap properties = ImmutableMap. builder() - .put(USER_ID, documentToReadWriteUserMap.get(documentLink)) - .build(); - - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setProperties(properties); - Observable> readDocumentObservable = asyncClientWithTokenResolver - .deleteDocument(documentLink, requestOptions); - readDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - } - Thread.sleep(2000); - assertThat(capturedResponse, hasSize(10)); - } finally { - Utils.safeClose(asyncClientWithTokenResolver); - } - } - - /** - * Block list an user and throw error from token resolver - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void blockListUserThroughTokenResolver() throws Exception { - String blockListedUserId = "block listed user"; - String errorMessage = "block listed user! access denied!"; - - AsyncDocumentClient asyncClientWithTokenResolver = null; - - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolverWithBlockList(blockListedUserId, errorMessage)) - .build(); - - // Read a document using a block listed user, passing the 'userId' in the properties. - // Token resolver will throw RuntimeException. - RequestOptions options = new RequestOptions(); - ImmutableMap properties = ImmutableMap. builder() - .put(USER_ID, blockListedUserId) - .build(); - - options.setProperties(properties); - Observable> readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), options); - List capturedErrors = Collections - .synchronizedList(new ArrayList<>()); - readObservable.subscribe(response -> {}, throwable -> capturedErrors.add(throwable)); - Thread.sleep(2000); - assertThat(capturedErrors, hasSize(1)); - assertThat(capturedErrors.get(0), instanceOf(RuntimeException.class)); - assertThat(capturedErrors.get(0).getMessage(), equalTo(errorMessage)); - - // Read a document using a valid user, passing the 'userId' in the properties. - // Token resolver will pass on the correct token for authentication. - String validUserId = userToReadWriteResourceTokenMap.keySet().iterator().next(); - System.out.println(validUserId); - properties = ImmutableMap. builder() - .put(USER_ID, validUserId) - .build(); - options.setProperties(properties); - readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), options); - List capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - readObservable.subscribe(resourceResponse -> capturedResponse.add(resourceResponse.getResource()), error -> error.printStackTrace()); - Thread.sleep(2000); - assertThat(capturedErrors, hasSize(1)); - assertThat(capturedResponse.get(0).getId(), equalTo(createdCollection.getId())); - } finally { - Utils.safeClose(asyncClientWithTokenResolver); - } - } - - /** - * For Reading DatabaseAccount on client initialization, use any User's token. - * For subsequent Reads, get the correct read only token based on 'userId'. - */ - private TokenResolver getTokenResolverForRead() { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - if (resourceType.equals(CosmosResourceType.System)) { - //Choose any token it should have the read access on database account - for (String token : userToReadOnlyResourceTokenMap.values()) { - return token; - } - } else { - return userToReadOnlyResourceTokenMap.get(properties.get(USER_ID)); - } - return null; - }; - } - - /** - * For Reading DatabaseAccount on client initialization, use any User's token. - * For subsequent Reads/Writes, get the correct read/write token based on 'userId'. - */ - private TokenResolver getTokenResolverForReadWrite() { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - if (resourceType.equals(CosmosResourceType.System)) { - //Choose any token it should have the read access on database account - for (String token : userToReadWriteResourceTokenMap.values()) { - return token; - } - } else { - return userToReadWriteResourceTokenMap.get(properties.get(USER_ID)); - } - return null; - }; - } - - /** - * For Reading DatabaseAccount on client initialization, use any User's token. - * For subsequent Reads, get the correct read/write token based on 'userId', - * only if user is not block listed. In this scenario, the block listed user id - * is compared to the current user's id, passed into the properties for the request. - */ - private TokenResolver getTokenResolverWithBlockList(String blockListedUserId, String errorMessage) { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - if (resourceType == CosmosResourceType.System) { - return userToReadWriteResourceTokenMap.values().iterator().next(); - } else if (!properties.get(USER_ID).toString().equals(blockListedUserId)) { - return userToReadWriteResourceTokenMap.get(properties.get(USER_ID)); - } else { - throw new RuntimeException(errorMessage); - } - }; - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/UniqueIndexAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/UniqueIndexAsyncAPITest.java deleted file mode 100644 index e253729f1ee4..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/UniqueIndexAsyncAPITest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.UniqueKey; -import com.microsoft.azure.cosmosdb.UniqueKeyPolicy; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.observers.TestSubscriber; - -import java.util.Collections; -import java.util.UUID; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; - -public class UniqueIndexAsyncAPITest { - private final static int TIMEOUT = 60000; - - private AsyncDocumentClient client; - private Database createdDatabase; - - @Test(groups = "samples", timeOut = TIMEOUT) - public void uniqueIndex() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - UniqueKeyPolicy uniqueKeyPolicy = new UniqueKeyPolicy(); - UniqueKey uniqueKey = new UniqueKey(); - uniqueKey.setPaths(ImmutableList.of("/name", "/field")); - uniqueKeyPolicy.setUniqueKeys(Collections.singleton(uniqueKey)); - collectionDefinition.setUniqueKeyPolicy(uniqueKeyPolicy); - - DocumentCollection collection = client.createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single().getResource(); - - Document doc1 = new Document("{ 'name':'Alan Turning', 'field': 'Mathematics', 'other' : 'Logic' }"); - Document doc2 = new Document("{ 'name':'Al-Khwarizmi', 'field': 'Mathematics' , 'other' : 'Algebra '}"); - Document doc3 = new Document("{ 'name':'Alan Turning', 'field': 'Mathematics', 'other' : 'CS' }"); - - client.createDocument(getCollectionLink(collection), doc1, null, false).toBlocking().single().getResource(); - client.createDocument(getCollectionLink(collection), doc2, null, false).toBlocking().single().getResource(); - - // doc1 got inserted with the same values for 'name' and 'field' - // so inserting a new one with the same values will violate unique index constraint. - Observable> docCreation = - client.createDocument(getCollectionLink(collection), doc3, null, false); - - TestSubscriber> subscriber = new TestSubscriber<>(); - docCreation.subscribe(subscriber); - - subscriber.awaitTerminalEvent(); - subscriber.assertError(DocumentClientException.class); - assertThat(subscriber.getOnErrorEvents(), hasSize(1)); - - // error code for failure is conflict - assertThat(((DocumentClientException) subscriber.getOnErrorEvents().get(0)).getStatusCode(), equalTo(409)); - } - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - // Sets up the requirements for each test - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - client = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Create database - createdDatabase = Utils.createDatabaseForTest(client); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(client, createdDatabase); - Utils.safeClose(client); - } - - private String getCollectionLink(DocumentCollection collection) { - return "dbs/" + createdDatabase.getId() + "/colls/" + collection.getId(); - } - - private String getDatabaseLink() { - return "dbs/" + createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/Utils.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/Utils.java deleted file mode 100644 index 5e498bcc2e2a..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/Utils.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import org.testng.annotations.AfterSuite; -import rx.Observable; - -public class Utils { - - @AfterSuite(groups = "samples") - public void cleanupStaleDatabase() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - RetryOptions options = new RetryOptions(); - connectionPolicy.setRetryOptions(options); - AsyncDocumentClient client = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - safeCleanDatabases(client); - client.close(); - } - - public static String getCollectionLink(Database db, DocumentCollection collection) { - return "dbs/" + db.getId() + "/colls/" + collection; - } - - public static Database createDatabaseForTest(AsyncDocumentClient client) { - return DatabaseForTest.create(DatabaseManagerImpl.getInstance(client)).createdDatabase; - } - - private static void safeCleanDatabases(AsyncDocumentClient client) { - if (client != null) { - DatabaseForTest.cleanupStaleTestDatabases(DatabaseManagerImpl.getInstance(client)); - } - } - - public static void safeClean(AsyncDocumentClient client, Database database) { - if (database != null) { - safeClean(client, database.getId()); - } - } - - public static void safeClean(AsyncDocumentClient client, String databaseId) { - if (client != null) { - if (databaseId != null) { - try { - client.deleteDatabase("/dbs/" + databaseId, null).toBlocking().single(); - } catch (Exception e) { - } - } - } - } - - public static String generateDatabaseId() { - return DatabaseForTest.generateId(); - } - - public static void safeClose(AsyncDocumentClient client) { - if (client != null) { - client.close(); - } - } - - private static class DatabaseManagerImpl implements DatabaseForTest.DatabaseManager { - public static DatabaseManagerImpl getInstance(AsyncDocumentClient client) { - return new DatabaseManagerImpl(client); - } - - private final AsyncDocumentClient client; - - private DatabaseManagerImpl(AsyncDocumentClient client) { - this.client = client; - } - - @Override - public Observable> queryDatabases(SqlQuerySpec query) { - return client.queryDatabases(query, null); - } - - @Override - public Observable> createDatabase(Database databaseDefinition) { - return client.createDatabase(databaseDefinition, null); - } - - @Override - public Observable> deleteDatabase(String id) { - - return client.deleteDatabase("dbs/" + id, null); - } - } -} diff --git a/cosmosdb/data-plane/examples/src/test/resources/log4j.properties b/cosmosdb/data-plane/examples/src/test/resources/log4j.properties deleted file mode 100644 index b7947ea7907d..000000000000 --- a/cosmosdb/data-plane/examples/src/test/resources/log4j.properties +++ /dev/null @@ -1,13 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/faq/README.md b/cosmosdb/data-plane/faq/README.md deleted file mode 100644 index 8fa637f1570d..000000000000 --- a/cosmosdb/data-plane/faq/README.md +++ /dev/null @@ -1,9 +0,0 @@ - -### FAQ - -#### I am getting this error: - -- ``Request Rate too Large`` Request too large is an error from service indicating that you temporarily went beyond the provisioned throughput. You should retry after the provided -``DocumentClientException#getRetryAfterInMilliseconds()``. - -- ``CollectionPoolExhausted`` this is a SDK side error indicating that the SDK's connection pool is saturated. Consider to retry later, increase the connection pool size or use a semaphore to throttle your workload. diff --git a/cosmosdb/data-plane/gateway/pom.xml b/cosmosdb/data-plane/gateway/pom.xml deleted file mode 100644 index a51483cb36f6..000000000000 --- a/cosmosdb/data-plane/gateway/pom.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - azure-cosmosdb-gateway - Common Gateway Components for Async SDK for SQL API of Azure Cosmos DB Service - Common Gateway Components for Async SDK for SQL API of Azure Cosmos DB Service - jar - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.0 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - com.microsoft.azure - azure-cosmosdb-commons - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - test - - - org.testng - testng - ${testng.version} - test - - - org.assertj - assertj-core - ${assertj.version} - test - - - org.mockito - mockito-all - ${mockito.version} - test - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - test - - - log4j - log4j - ${log4j.version} - test - - - com.google.guava - guava - ${guava.version} - test - - - diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountManagerInternal.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountManagerInternal.java deleted file mode 100644 index 670153b18672..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountManagerInternal.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import rx.Observable; - -import java.net.URI; - -public interface DatabaseAccountManagerInternal { - - /** - * Gets database account information. - * - * @param endpoint the endpoint from which gets the database account - * @return the database account. - */ - Observable getDatabaseAccountFromEndpoint(URI endpoint); - - /** - * Gets the connection policy - * - * @return connection policy - */ - ConnectionPolicy getConnectionPolicy(); - - /** - * Gets the service endpoint - * - * @return service endpoint - */ - URI getServiceEndpoint(); - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/ISessionContainer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/ISessionContainer.java deleted file mode 100644 index 24abe4825075..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/ISessionContainer.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import java.util.Map; - -public interface ISessionContainer { - /** - * Returns a serialized map of partitionKeyRangeId to session token. If a entity is name based then the method extracts name from - * ResourceAddress and use it to identify collection otherwise it uses ResourceId. Returns empty string if collection is unknown - * @param entity {@link RxDocumentServiceRequest entity} - * @return serialzed map of partitionKeyRangeId to session token or empty string is collection is unknown - */ - String resolveGlobalSessionToken(RxDocumentServiceRequest entity); - - /** - * Returns a session token identified by partitionKeyRangeId(*) from a collection identified either by ResourceAddress - * (in case of name based entity) or either by ResourceId. - * - * If partitionKeyRangeId is not in the collection's partitionKeyRangeId token map then method - * iterates through request.RequestContext.ResolvedPartitionKeyRange.Parents starting from tail and - * returns a corresponding token if there is a match. - * @param entity {@link RxDocumentServiceRequest} - * @param partitionKeyRangeId partitionKeyRangeId - * @return Returns a session token identified by partitionKeyRangeId(*) from a collection identified either by ResourceAddress - * (in case of name based entity) or either by ResourceId. - */ - ISessionToken resolvePartitionLocalSessionToken(RxDocumentServiceRequest entity, String partitionKeyRangeId); - - /** - * Atomically: removes partitionKeyRangeId token map associated with resourceId, - * maps resourceId to collectionFullName and removes its map as well - * @param resourceId resourceId - */ - void clearTokenByResourceId(String resourceId); - - /** - * Atomically: removes partitionKeyRangeId token map associated with collectionFullName, maps collectionFullName to resourceId and - * removes its map as well. - * @param collectionFullName collectionFullName - */ - void clearTokenByCollectionFullName(String collectionFullName); - - /** - * Infers collectionFullName using responseHeaders[HttpConstants.HttpHeaders.OwnerFullName] or request.ResourceAddress, - * infers resourceId using responseHeaders[HttpConstants.HttpHeaders.OwnerId] or request.ResourceId, - * and adds responseHeaders[HttpConstants.HttpHeaders.SessionToken] session token to the (collectionFullName, resourceId)'s - * partitionKeyRangeId token map. - * - * NB: Silently does nothing for master queries, or when it's impossible to infer collectionRid and collectionFullName - * from the request, or then SessionToken is missing in responseHeader. - * - * @param request {@link RxDocumentServiceRequest} - * @param responseHeaders responseHeaders - */ - void setSessionToken(RxDocumentServiceRequest request, Map responseHeaders); - - /** - * Adds responseHeaders[HttpConstants.HttpHeaders.SessionToken] session token to the (collectionFullName, collectionRid)'s partitionKeyRangeId token map. - * @param collectionRid collectionRid - * @param collectionFullName collectionFullName - * @param responseHeaders responseHeaders - */ - void setSessionToken(String collectionRid, String collectionFullName, Map responseHeaders); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/AuthorizationTokenProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/AuthorizationTokenProvider.java deleted file mode 100644 index 3aaa9f60dbc5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/AuthorizationTokenProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.util.Map; - -/** - * Represents types that can provide functionality to generate authorization token for the Azure Cosmos DB database - * service. - */ -public interface AuthorizationTokenProvider { - String generateKeyAuthorizationSignature(String verb, - String resourceIdOrFullName, - ResourceType resourceType, - Map headers); - - String getAuthorizationTokenUsingResourceTokens(Map resourceTokens, - String path, - String resourceId); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseAuthorizationTokenProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseAuthorizationTokenProvider.java deleted file mode 100644 index f04df192d7f4..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseAuthorizationTokenProvider.java +++ /dev/null @@ -1,373 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.net.URI; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.util.Collections; -import java.util.HashSet; -import java.util.Locale; -import java.util.Map; - -import javax.crypto.Mac; -import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; - -/** - * This class is used internally by both client (for generating the auth header with master/system key) and by the Gateway when - * verifying the auth header in the Azure Cosmos DB database service. - */ -public class BaseAuthorizationTokenProvider implements AuthorizationTokenProvider { - - private static final String AUTH_PREFIX = "type=master&ver=1.0&sig="; - private final String masterKey; - private final Mac macInstance; - - public BaseAuthorizationTokenProvider(String masterKey) { - this.masterKey = masterKey; - byte[] masterKeyDecodedBytes = Utils.Base64Decoder.decode(this.masterKey.getBytes()); - SecretKey signingKey = new SecretKeySpec(masterKeyDecodedBytes, "HMACSHA256"); - try { - this.macInstance = Mac.getInstance("HMACSHA256"); - this.macInstance.init(signingKey); - } catch (NoSuchAlgorithmException | InvalidKeyException e) { - throw new IllegalStateException(e); - } - } - - private static String getResourceSegment(ResourceType resourceType) { - switch (resourceType) { - case Attachment: - return Paths.ATTACHMENTS_PATH_SEGMENT; - case Database: - return Paths.DATABASES_PATH_SEGMENT; - case Conflict: - return Paths.CONFLICTS_PATH_SEGMENT; - case Document: - return Paths.DOCUMENTS_PATH_SEGMENT; - case DocumentCollection: - return Paths.COLLECTIONS_PATH_SEGMENT; - case Offer: - return Paths.OFFERS_PATH_SEGMENT; - case Permission: - return Paths.PERMISSIONS_PATH_SEGMENT; - case StoredProcedure: - return Paths.STORED_PROCEDURES_PATH_SEGMENT; - case Trigger: - return Paths.TRIGGERS_PATH_SEGMENT; - case UserDefinedFunction: - return Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT; - case User: - return Paths.USERS_PATH_SEGMENT; - case PartitionKeyRange: - return Paths.PARTITION_KEY_RANGES_PATH_SEGMENT; - case Media: - return Paths.MEDIA_PATH_SEGMENT; - case DatabaseAccount: - return ""; - default: - return null; - } - } - - /** - * This API is a helper method to create auth header based on client request using masterkey. - * - * @param verb the verb. - * @param resourceIdOrFullName the resource id or full name - * @param resourceType the resource type. - * @param headers the request headers. - * @return the key authorization signature. - */ - public String generateKeyAuthorizationSignature(String verb, - String resourceIdOrFullName, - ResourceType resourceType, - Map headers) { - return this.generateKeyAuthorizationSignature(verb, resourceIdOrFullName, - BaseAuthorizationTokenProvider.getResourceSegment(resourceType).toLowerCase(), headers); - } - - /** - * This API is a helper method to create auth header based on client request using masterkey. - * - * @param verb the verb - * @param resourceIdOrFullName the resource id or full name - * @param resourceSegment the resource segment - * @param headers the request headers - * @return the key authorization signature - */ - public String generateKeyAuthorizationSignature(String verb, - String resourceIdOrFullName, - String resourceSegment, - Map headers) { - if (verb == null || verb.isEmpty()) { - throw new IllegalArgumentException("verb"); - } - - if (resourceIdOrFullName == null) { - resourceIdOrFullName = ""; - } - - if (resourceSegment == null) { - throw new IllegalArgumentException("resourceSegment"); - } - - if (headers == null) { - throw new IllegalArgumentException("headers"); - } - - if (this.masterKey == null || this.masterKey.isEmpty()) { - throw new IllegalArgumentException("masterKey"); - } - - if(!PathsHelper.isNameBased(resourceIdOrFullName)) { - resourceIdOrFullName = resourceIdOrFullName.toLowerCase(Locale.ROOT); - } - - // Skipping lower casing of resourceId since it may now contain "ID" of the resource as part of the FullName - StringBuilder body = new StringBuilder(); - body.append(verb.toLowerCase()) - .append('\n') - .append(resourceSegment) - .append('\n') - .append(resourceIdOrFullName) - .append('\n'); - - if (headers.containsKey(HttpConstants.HttpHeaders.X_DATE)) { - body.append(headers.get(HttpConstants.HttpHeaders.X_DATE).toLowerCase()); - } - - body.append('\n'); - - if (headers.containsKey(HttpConstants.HttpHeaders.HTTP_DATE)) { - body.append(headers.get(HttpConstants.HttpHeaders.HTTP_DATE).toLowerCase()); - } - - body.append('\n'); - - Mac mac = null; - try { - mac = (Mac) this.macInstance.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException(e); - } - - byte[] digest = mac.doFinal(body.toString().getBytes()); - - String auth = Utils.encodeBase64String(digest); - - return AUTH_PREFIX + auth; - } - - /** - * This API is a helper method to create auth header based on client request using resourceTokens. - * - * @param resourceTokens the resource tokens. - * @param path the path. - * @param resourceId the resource id. - * @return the authorization token. - */ - public String getAuthorizationTokenUsingResourceTokens(Map resourceTokens, - String path, - String resourceId) { - if (resourceTokens == null) { - throw new IllegalArgumentException("resourceTokens"); - } - - String resourceToken = null; - if (resourceTokens.containsKey(resourceId) && resourceTokens.get(resourceId) != null) { - resourceToken = resourceTokens.get(resourceId); - } else if (StringUtils.isEmpty(path) || StringUtils.isEmpty(resourceId)) { - if (resourceTokens.size() > 0) { - resourceToken = resourceTokens.values().iterator().next(); - } - } else { - // Get the last resource id from the path and use that to find the corresponding token. - String[] pathParts = StringUtils.split(path, "/"); - String[] resourceTypes = {"dbs", "colls", "docs", "sprocs", "udfs", "triggers", "users", "permissions", - "attachments", "media", "conflicts"}; - HashSet resourceTypesSet = new HashSet(); - Collections.addAll(resourceTypesSet, resourceTypes); - - for (int i = pathParts.length - 1; i >= 0; --i) { - - if (!resourceTypesSet.contains(pathParts[i]) && resourceTokens.containsKey(pathParts[i])) { - resourceToken = resourceTokens.get(pathParts[i]); - } - } - } - - return resourceToken; - } - public String generateKeyAuthorizationSignature(String verb, URI uri, Map headers) { - if (StringUtils.isEmpty(verb)) { - throw new IllegalArgumentException(String.format(RMResources.StringArgumentNullOrEmpty, "verb")); - } - - if (uri == null) { - throw new IllegalArgumentException("uri"); - } - - if (headers == null) { - throw new IllegalArgumentException("headers"); - } - PathInfo pathInfo = new PathInfo(false, StringUtils.EMPTY, StringUtils.EMPTY, false); - getResourceTypeAndIdOrFullName(uri, pathInfo); - return generateKeyAuthorizationSignatureNew(verb, pathInfo.resourceIdOrFullName, pathInfo.resourcePath, - headers); - } - - public String generateKeyAuthorizationSignatureNew(String verb, String resourceIdValue, String resourceType, - Map headers) { - if (StringUtils.isEmpty(verb)) { - throw new IllegalArgumentException(String.format(RMResources.StringArgumentNullOrEmpty, "verb")); - } - - if (resourceType == null) { - throw new IllegalArgumentException(String.format(RMResources.StringArgumentNullOrEmpty, "resourceType")); // can be empty - } - - if (headers == null) { - throw new IllegalArgumentException("headers"); - } - // Order of the values included in the message payload is a protocol that - // clients/BE need to follow exactly. - // More headers can be added in the future. - // If any of the value is optional, it should still have the placeholder value - // of "" - // OperationType -> ResourceType -> ResourceId/OwnerId -> XDate -> Date - String verbInput = verb; - String resourceIdInput = resourceIdValue; - String resourceTypeInput = resourceType; - - String authResourceId = getAuthorizationResourceIdOrFullName(resourceTypeInput, resourceIdInput); - String payLoad = generateMessagePayload(verbInput, authResourceId, resourceTypeInput, headers); - Mac mac = null; - try { - mac = (Mac) this.macInstance.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException(e); - } - byte[] digest = mac.doFinal(payLoad.getBytes()); - String authorizationToken = Utils.encodeBase64String(digest); - String authtoken = AUTH_PREFIX + authorizationToken; - return HttpUtils.urlEncode(authtoken); - } - - private String generateMessagePayload(String verb, String resourceId, String resourceType, - Map headers) { - String xDate = headers.get(HttpConstants.HttpHeaders.X_DATE); - String date = headers.get(HttpConstants.HttpHeaders.HTTP_DATE); - // At-least one of date header should present - // https://docs.microsoft.com/en-us/rest/api/documentdb/access-control-on-documentdb-resources - if (StringUtils.isEmpty(xDate) && (StringUtils.isEmpty(date) || StringUtils.isWhitespace(date))) { - headers.put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - xDate = Utils.nowAsRFC1123(); - } - - // for name based, it is case sensitive, we won't use the lower case - if (!PathsHelper.isNameBased(resourceId)) { - resourceId = resourceId.toLowerCase(); - } - - StringBuilder payload = new StringBuilder(); - payload.append(verb.toLowerCase()) - .append('\n') - .append(resourceType.toLowerCase()) - .append('\n') - .append(resourceId) - .append('\n') - .append(xDate.toLowerCase()) - .append('\n') - .append(StringUtils.isEmpty(xDate) ? date.toLowerCase() : "") - .append('\n'); - - return payload.toString(); - } - - private String getAuthorizationResourceIdOrFullName(String resourceType, String resourceIdOrFullName) { - if (StringUtils.isEmpty(resourceType) || StringUtils.isEmpty(resourceIdOrFullName)) { - return resourceIdOrFullName; - } - if (PathsHelper.isNameBased(resourceIdOrFullName)) { - // resource fullname is always end with name (not type segment like docs/colls). - return resourceIdOrFullName; - } - - if (resourceType.equalsIgnoreCase(Paths.OFFERS_PATH_SEGMENT) - || resourceType.equalsIgnoreCase(Paths.PARTITIONS_PATH_SEGMENT) - || resourceType.equalsIgnoreCase(Paths.TOPOLOGY_PATH_SEGMENT) - || resourceType.equalsIgnoreCase(Paths.RID_RANGE_PATH_SEGMENT)) { - return resourceIdOrFullName; - } - - ResourceId parsedRId = ResourceId.parse(resourceIdOrFullName); - if (resourceType.equalsIgnoreCase(Paths.DATABASES_PATH_SEGMENT)) { - return parsedRId.getDatabaseId().toString(); - } else if (resourceType.equalsIgnoreCase(Paths.USERS_PATH_SEGMENT)) { - return parsedRId.getUserId().toString(); - } else if (resourceType.equalsIgnoreCase(Paths.COLLECTIONS_PATH_SEGMENT)) { - return parsedRId.getDocumentCollectionId().toString(); - } else if (resourceType.equalsIgnoreCase(Paths.DOCUMENTS_PATH_SEGMENT)) { - return parsedRId.getDocumentId().toString(); - } else { - // leaf node - return resourceIdOrFullName; - } - } - - private void getResourceTypeAndIdOrFullName(URI uri, PathInfo pathInfo) { - if (uri == null) { - throw new IllegalArgumentException("uri"); - } - - pathInfo.resourcePath = StringUtils.EMPTY; - pathInfo.resourceIdOrFullName = StringUtils.EMPTY; - - String[] segments = StringUtils.split(uri.toString(), Constants.Properties.PATH_SEPARATOR); - if (segments == null || segments.length < 1) { - throw new IllegalArgumentException(RMResources.InvalidUrl); - } - // Authorization code is fine with Uri not having resource id and path. - // We will just return empty in that case - String pathAndQuery = StringUtils.EMPTY ; - if(StringUtils.isNotEmpty(uri.getPath())) { - pathAndQuery+= uri.getPath(); - } - if(StringUtils.isNotEmpty(uri.getQuery())) { - pathAndQuery+="?"; - pathAndQuery+= uri.getQuery(); - } - if (!PathsHelper.tryParsePathSegments(pathAndQuery, pathInfo, null)) { - pathInfo.resourcePath = StringUtils.EMPTY; - pathInfo.resourceIdOrFullName = StringUtils.EMPTY; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseDatabaseAccountConfigurationProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseDatabaseAccountConfigurationProvider.java deleted file mode 100644 index a9faa3657514..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseDatabaseAccountConfigurationProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DatabaseAccount; - -/** - * Used internally to provides functionality to work with database account configuration in the Azure Cosmos DB database service. - */ -public class BaseDatabaseAccountConfigurationProvider implements DatabaseAccountConfigurationProvider { - private ConsistencyLevel desiredConsistencyLevel; - private DatabaseAccount databaseAccount; - - public BaseDatabaseAccountConfigurationProvider(DatabaseAccount databaseAccount, ConsistencyLevel desiredConsistencyLevel) { - this.databaseAccount = databaseAccount; - this.desiredConsistencyLevel = desiredConsistencyLevel; - } - - public ConsistencyLevel getStoreConsistencyPolicy() { - ConsistencyLevel databaseAccountConsistency = this.databaseAccount.getConsistencyPolicy().getDefaultConsistencyLevel(); - if (this.desiredConsistencyLevel == null) { - return databaseAccountConsistency; - } else if (!Utils.isValidConsistency(databaseAccountConsistency, this.desiredConsistencyLevel)) { - throw new IllegalArgumentException(String.format( - "ConsistencyLevel %1s specified in the request is invalid when service is configured with consistency level %2s. Ensure the request consistency level is not stronger than the service consistency level.", - this.desiredConsistencyLevel.toString(), - databaseAccountConsistency.toString())); - } else { - return this.desiredConsistencyLevel; - } - } - - public int getMaxReplicaSetSize() { - return this.databaseAccount.getReplicationPolicy().getMaxReplicaSetSize(); - } - - @Override - public String getQueryEngineConfiguration() { - return databaseAccount.get("queryEngineConfiguration").toString(); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/DatabaseAccountConfigurationProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/DatabaseAccountConfigurationProvider.java deleted file mode 100644 index 15ef723956d9..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/DatabaseAccountConfigurationProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; - -/** - * Defines an interface to work with database account configuration in the Azure Cosmos DB database service. - */ -public interface DatabaseAccountConfigurationProvider { - ConsistencyLevel getStoreConsistencyPolicy(); - - int getMaxReplicaSetSize(); - - String getQueryEngineConfiguration(); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/RetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/RetryPolicy.java deleted file mode 100644 index 9b1b5eec6312..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/RetryPolicy.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; - -/** - * Used internally to define the interface for retry policy in the Azure Cosmos DB database service Java SDK. - */ -public interface RetryPolicy { - boolean shouldRetry(DocumentClientException exception) ; - - long getRetryAfterInMilliseconds(); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionContainer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionContainer.java deleted file mode 100644 index 58e4ff4f65f1..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionContainer.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.internal.ReplicatedResourceClientUtils; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -/** - * Used internally to cache the collections' session tokens in the Azure Cosmos DB database service. - */ -public final class SessionContainer implements ISessionContainer { - private final Logger logger = LoggerFactory.getLogger(SessionContainer.class); - - /** - * Session token cache that maps collection ResourceID to session tokens - */ - private final ConcurrentHashMap> collectionResourceIdToSessionTokens = new ConcurrentHashMap<>(); - /** - * Collection ResourceID cache that maps collection name to collection ResourceID - * When collection name is provided instead of self-link, this is used in combination with - * collectionResourceIdToSessionTokens to retrieve the session token for the collection by name - */ - private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock(); - private final ReentrantReadWriteLock.ReadLock readLock = readWriteLock.readLock(); - private final ReentrantReadWriteLock.WriteLock writeLock = readWriteLock.writeLock(); - - private final ConcurrentHashMap collectionNameToCollectionResourceId = new ConcurrentHashMap<>(); - private final ConcurrentHashMap collectionResourceIdToCollectionName = new ConcurrentHashMap<>(); - private final String hostName; - - public SessionContainer(final String hostName) { - this.hostName = hostName; - } - - public String getHostName() { - return this.hostName; - } - - public String getSessionToken(String collectionLink) { - - PathInfo pathInfo = new PathInfo(false, null, null, false); - ConcurrentHashMap partitionKeyRangeIdToTokenMap = null; - if (PathsHelper.tryParsePathSegments(collectionLink, pathInfo, null)) { - Long UniqueDocumentCollectionId = null; - if (pathInfo.isNameBased) { - String collectionName = PathsHelper.getCollectionPath(pathInfo.resourceIdOrFullName); - UniqueDocumentCollectionId = this.collectionNameToCollectionResourceId.get(collectionName); - } else { - ResourceId resourceId = ResourceId.parse(pathInfo.resourceIdOrFullName); - if (resourceId.getDocumentCollection() != 0) { - UniqueDocumentCollectionId = resourceId.getUniqueDocumentCollectionId(); - } - } - - if (UniqueDocumentCollectionId != null) { - partitionKeyRangeIdToTokenMap = this.collectionResourceIdToSessionTokens.get(UniqueDocumentCollectionId); - } - } - - if (partitionKeyRangeIdToTokenMap == null) { - return StringUtils.EMPTY; - } - - return SessionContainer.getCombinedSessionToken(partitionKeyRangeIdToTokenMap); - } - - private ConcurrentHashMap getPartitionKeyRangeIdToTokenMap(RxDocumentServiceRequest request) { - return getPartitionKeyRangeIdToTokenMap(request.getIsNameBased(), request.getResourceId(), request.getResourceAddress()); - } - - private ConcurrentHashMap getPartitionKeyRangeIdToTokenMap(boolean isNameBased, String rId, String resourceAddress) { - ConcurrentHashMap rangeIdToTokenMap = null; - if (!isNameBased) { - if (!StringUtils.isEmpty(rId)) { - ResourceId resourceId = ResourceId.parse(rId); - if (resourceId.getDocumentCollection() != 0) { - rangeIdToTokenMap = - this.collectionResourceIdToSessionTokens.get(resourceId.getUniqueDocumentCollectionId()); - } - } - } else { - String collectionName = Utils.getCollectionName(resourceAddress); - if (!StringUtils.isEmpty(collectionName) && this.collectionNameToCollectionResourceId.containsKey(collectionName)) { - rangeIdToTokenMap = this.collectionResourceIdToSessionTokens.get( - this.collectionNameToCollectionResourceId.get(collectionName)); - } - } - return rangeIdToTokenMap; - } - - - public String resolveGlobalSessionToken(RxDocumentServiceRequest request) { - ConcurrentHashMap partitionKeyRangeIdToTokenMap = this.getPartitionKeyRangeIdToTokenMap(request); - if (partitionKeyRangeIdToTokenMap != null) { - return SessionContainer.getCombinedSessionToken(partitionKeyRangeIdToTokenMap); - } - - return StringUtils.EMPTY; - } - - @Override - public ISessionToken resolvePartitionLocalSessionToken(RxDocumentServiceRequest request, String partitionKeyRangeId) { - return SessionTokenHelper.resolvePartitionLocalSessionToken(request, - partitionKeyRangeId, - this.getPartitionKeyRangeIdToTokenMap(request)); - } - - @Override - public void clearTokenByCollectionFullName(String collectionFullName) { - if (!Strings.isNullOrEmpty(collectionFullName)) { - String collectionName = PathsHelper.getCollectionPath(collectionFullName); - this.writeLock.lock(); - try { - if (this.collectionNameToCollectionResourceId.containsKey(collectionName)) { - Long rid = this.collectionNameToCollectionResourceId.get(collectionName); - this.collectionResourceIdToSessionTokens.remove(rid); - this.collectionResourceIdToCollectionName.remove(rid); - this.collectionNameToCollectionResourceId.remove(collectionName); - } - } finally { - this.writeLock.unlock(); - } - } - } - - @Override - public void clearTokenByResourceId(String resourceId) { - if (!StringUtils.isEmpty(resourceId)) { - ResourceId resource = ResourceId.parse(resourceId); - if (resource.getDocumentCollection() != 0) { - Long rid = resource.getUniqueDocumentCollectionId(); - this.writeLock.lock(); - try { - if (this.collectionResourceIdToCollectionName.containsKey(rid)) { - String collectionName = this.collectionResourceIdToCollectionName.get(rid); - this.collectionResourceIdToSessionTokens.remove(rid); - this.collectionResourceIdToCollectionName.remove(rid); - this.collectionNameToCollectionResourceId.remove(collectionName); - } - } finally { - this.writeLock.unlock(); - } - } - } - } - - @Override - public void setSessionToken(RxDocumentServiceRequest request, Map responseHeaders) { - String token = responseHeaders.get(HttpConstants.HttpHeaders.SESSION_TOKEN); - - if (!Strings.isNullOrEmpty(token)) { - ValueHolder resourceId = ValueHolder.initialize(null); - ValueHolder collectionName = ValueHolder.initialize(null); - - if (shouldUpdateSessionToken(request, responseHeaders, resourceId, collectionName)) { - this.setSessionToken(resourceId.v, collectionName.v, token); - } - } - } - - @Override - public void setSessionToken(String collectionRid, String collectionFullName, Map responseHeaders) { - ResourceId resourceId = ResourceId.parse(collectionRid); - String collectionName = PathsHelper.getCollectionPath(collectionFullName); - String token = responseHeaders.get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (!Strings.isNullOrEmpty(token)) { - this.setSessionToken(resourceId, collectionName, token); - } - } - - private void setSessionToken(ResourceId resourceId, String collectionName, String token) { - String partitionKeyRangeId; - ISessionToken parsedSessionToken; - - String[] tokenParts = StringUtils.split(token, ':'); - partitionKeyRangeId = tokenParts[0]; - parsedSessionToken = SessionTokenHelper.parse(tokenParts[1]); - - logger.trace("Update Session token {} {} {}", resourceId.getUniqueDocumentCollectionId(), collectionName, parsedSessionToken); - - boolean isKnownCollection; - - this.readLock.lock(); - try { - isKnownCollection = this.collectionNameToCollectionResourceId.containsKey(collectionName) && - this.collectionResourceIdToCollectionName.containsKey(resourceId.getUniqueDocumentCollectionId()) && - this.collectionNameToCollectionResourceId.get(collectionName) == resourceId.getUniqueDocumentCollectionId() && - this.collectionResourceIdToCollectionName.get(resourceId.getUniqueDocumentCollectionId()).equals(collectionName); - if (isKnownCollection) { - this.addSessionToken(resourceId, partitionKeyRangeId, parsedSessionToken); - } - } finally { - this.readLock.unlock(); - } - - if (!isKnownCollection) { - this.writeLock.lock(); - try { - if (collectionName != null && resourceId.getUniqueDocumentCollectionId() != 0) { - this.collectionNameToCollectionResourceId.compute(collectionName, (k, v) -> resourceId.getUniqueDocumentCollectionId()); - this.collectionResourceIdToCollectionName.compute(resourceId.getUniqueDocumentCollectionId(), (k, v) -> collectionName); - } - addSessionToken(resourceId, partitionKeyRangeId, parsedSessionToken); - } finally { - this.writeLock.unlock(); - } - } - } - - private void addSessionToken(ResourceId resourceId, String partitionKeyRangeId, ISessionToken parsedSessionToken) { - this.collectionResourceIdToSessionTokens.compute( - resourceId.getUniqueDocumentCollectionId(), (k, existingTokens) -> { - if (existingTokens == null) { - ConcurrentHashMap tokens = new ConcurrentHashMap<>(); - tokens.put(partitionKeyRangeId, parsedSessionToken); - return tokens; - } - - existingTokens.merge(partitionKeyRangeId, parsedSessionToken, (existingSessionTokens, newSessionToken) -> { - try { - if (existingSessionTokens == null) { - return newSessionToken; - } - - return existingSessionTokens.merge(newSessionToken); - } catch (DocumentClientException e) { - throw new IllegalStateException(e); - } - }); - - return existingTokens; - } - ); - } - - private static String getCombinedSessionToken(ConcurrentHashMap tokens) { - StringBuilder result = new StringBuilder(); - if (tokens != null) { - for (Iterator> iterator = tokens.entrySet().iterator(); iterator.hasNext(); ) { - Entry entry = iterator.next(); - result = result.append(entry.getKey()).append(":").append(entry.getValue().convertToString()); - if (iterator.hasNext()) { - result = result.append(","); - } - } - } - - return result.toString(); - } - - private static boolean shouldUpdateSessionToken( - RxDocumentServiceRequest request, - Map responseHeaders, - ValueHolder resourceId, - ValueHolder collectionName) { - resourceId.v = null; - String ownerFullName = responseHeaders.get(HttpConstants.HttpHeaders.OWNER_FULL_NAME); - if (Strings.isNullOrEmpty(ownerFullName)) ownerFullName = request.getResourceAddress(); - - collectionName.v = PathsHelper.getCollectionPath(ownerFullName); - String resourceIdString; - - if (!request.getIsNameBased()) { - resourceIdString = request.getResourceId(); - } else { - resourceIdString = responseHeaders.get(HttpConstants.HttpHeaders.OWNER_ID); - if (Strings.isNullOrEmpty(resourceIdString)) resourceIdString = request.getResourceId(); - } - - if (!Strings.isNullOrEmpty(resourceIdString)) { - resourceId.v = ResourceId.parse(resourceIdString); - - if (resourceId.v.getDocumentCollection() != 0 && - collectionName != null && - !ReplicatedResourceClientUtils.isReadingFromMaster(request.getResourceType(), request.getOperationType())) { - return true; - } - } - - return false; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionTokenHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionTokenHelper.java deleted file mode 100644 index 5906ade34050..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionTokenHelper.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -/** - * Used internally to provides helper functions to work with session tokens in the Azure Cosmos DB database service. - */ -public class SessionTokenHelper { - - public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { - if (request == null) { - throw new IllegalArgumentException("request is null"); - } - - if (originalSessionToken == null) { - request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } else { - request.getHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, originalSessionToken); - } - } - - public static void setPartitionLocalSessionToken(RxDocumentServiceRequest request, ISessionContainer sessionContainer) throws DocumentClientException { - String originalSessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); - - - if (Strings.isNullOrEmpty(partitionKeyRangeId)) { - // AddressCache/address resolution didn't produce partition key range id. - // In this case it is a bug. - throw new InternalServerErrorException(RMResources.PartitionKeyRangeIdAbsentInContext); - } - - if (StringUtils.isNotEmpty(originalSessionToken)) { - ISessionToken sessionToken = getLocalSessionToken(request, originalSessionToken, partitionKeyRangeId); - request.requestContext.sessionToken = sessionToken; - } else { - // use ambient session token. - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, partitionKeyRangeId); - request.requestContext.sessionToken = sessionToken; - } - - if (request.requestContext.sessionToken == null) { - request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } else { - request.getHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, - String.format("%1s:%2s", partitionKeyRangeId, request.requestContext.sessionToken.convertToString())); - } - } - - private static ISessionToken getLocalSessionToken( - RxDocumentServiceRequest request, - String globalSessionToken, - String partitionKeyRangeId) throws DocumentClientException { - - if (partitionKeyRangeId == null || partitionKeyRangeId.isEmpty()) { - // AddressCache/address resolution didn't produce partition key range id. - // In this case it is a bug. - throw new IllegalStateException("Partition key range Id is absent in the context."); - } - - // Convert global session token to local - there's no point in sending global token over the wire to the backend. - // Global session token is comma separated array of : pairs. For example: - // 2:425344,748:2341234,99:42344 - // Local session token is single : pair. - // Backend only cares about pair which relates to the range owned by the partition. - String[] localTokens = StringUtils.split(globalSessionToken, ","); - Set partitionKeyRangeSet = new HashSet<>(); - partitionKeyRangeSet.add(partitionKeyRangeId); - - ISessionToken highestSessionToken = null; - - if (request.requestContext.resolvedPartitionKeyRange != null && request.requestContext.resolvedPartitionKeyRange.getParents() != null) { - partitionKeyRangeSet.addAll(request.requestContext.resolvedPartitionKeyRange.getParents()); - } - - for (String localToken : localTokens) { - String[] items = StringUtils.split(localToken, ":"); - if (items.length != 2) { - throw new BadRequestException(String.format(RMResources.InvalidSessionToken, partitionKeyRangeId)); - } - - ISessionToken parsedSessionToken = SessionTokenHelper.parse(items[1]); - - if (partitionKeyRangeSet.contains(items[0])) { - - if (highestSessionToken == null) { - highestSessionToken = parsedSessionToken; - } else { - highestSessionToken = highestSessionToken.merge(parsedSessionToken); - } - - } - } - - return highestSessionToken; - } - - static ISessionToken resolvePartitionLocalSessionToken(RxDocumentServiceRequest request, - String partitionKeyRangeId, - ConcurrentHashMap rangeIdToTokenMap) { - if (rangeIdToTokenMap != null) { - if (rangeIdToTokenMap.containsKey(partitionKeyRangeId)) { - return rangeIdToTokenMap.get(partitionKeyRangeId); - } else { - Collection parents = request.requestContext.resolvedPartitionKeyRange.getParents(); - if (parents != null) { - List parentsList = new ArrayList<>(parents); - for (int i = parentsList.size() - 1; i >= 0; i--) { - String parentId = parentsList.get(i); - if (rangeIdToTokenMap.containsKey(parentId)) { - return rangeIdToTokenMap.get(parentId); - } - } - } - } - } - - return null; - } - - public static ISessionToken parse(String sessionToken) { - ValueHolder partitionKeyRangeSessionToken = ValueHolder.initialize(null); - - if (SessionTokenHelper.tryParse(sessionToken, partitionKeyRangeSessionToken)) { - return partitionKeyRangeSessionToken.v; - } else { - throw new RuntimeException(new BadRequestException(String.format(RMResources.InvalidSessionToken, sessionToken))); - } - } - - static boolean tryParse(String sessionToken, ValueHolder parsedSessionToken) { - parsedSessionToken.v = null; - if (!Strings.isNullOrEmpty(sessionToken)) { - String[] sessionTokenSegments = StringUtils.split(sessionToken,":"); - return VectorSessionToken.tryCreate(sessionTokenSegments[sessionTokenSegments.length - 1], parsedSessionToken); - } else { - return false; - } - } - - public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) throws DocumentClientException { - String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (!Strings.isNullOrEmpty(sessionToken)) { - getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); - request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/UserAgentContainer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/UserAgentContainer.java deleted file mode 100644 index 5f11ff50fe5f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/UserAgentContainer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Used internally. The user agent object, which is used to track the version of the Java SDK of the Azure Cosmos DB database service. - */ -public class UserAgentContainer { - - private static final int MAX_SUFFIX_LENGTH = 64; - private final String baseUserAgent; - private String suffix; - private String userAgent; - - private UserAgentContainer(String sdkName, String sdkVersion) { - this.baseUserAgent = Utils.getUserAgent(sdkName, sdkVersion); - this.suffix = ""; - this.userAgent = baseUserAgent; - } - - public UserAgentContainer() { - this(HttpConstants.Versions.SDK_NAME, HttpConstants.Versions.SDK_VERSION); - } - - public String getSuffix() { - return this.suffix; - } - - public void setSuffix(String suffix) { - if (suffix.length() > MAX_SUFFIX_LENGTH) { - suffix = suffix.substring(0, MAX_SUFFIX_LENGTH); - } - - this.suffix = suffix; - this.userAgent = baseUserAgent.concat(this.suffix); - } - - public String getUserAgent() { - return this.userAgent; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/VectorSessionToken.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/VectorSessionToken.java deleted file mode 100644 index f3b04712dbda..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/VectorSessionToken.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.collections4.map.UnmodifiableMap; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.HashMap; -import java.util.Map; -import java.util.stream.Collectors; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -/** - * Models vector clock bases session token. Session token has the following format: - * {Version}#{GlobalLSN}#{RegionId1}={LocalLsn1}#{RegionId2}={LocalLsn2}....#{RegionIdN}={LocalLsnN} - * 'Version' captures the configuration number of the partition which returned this session token. - * 'Version' is incremented everytime topology of the partition is updated (say due to Add/Remove/Failover). - * * The choice of separators '#' and '=' is important. Separators ';' and ',' are used to delimit - * per-partitionKeyRange session token - * session - * - * We make assumption that instances of this class are immutable (read only after they are constructed), so if you want to change - * this behaviour please review all of its uses and make sure that mutability doesn't break anything. - */ -public class VectorSessionToken implements ISessionToken { - private final static Logger logger = LoggerFactory.getLogger(VectorSessionToken.class); - private final static char SegmentSeparator = '#'; - private final static char RegionProgressSeparator = '='; - - private final long version; - private final long globalLsn; - private final UnmodifiableMap localLsnByRegion; - private final String sessionToken; - - private VectorSessionToken(long version, long globalLsn, UnmodifiableMap localLsnByRegion) { - this(version, globalLsn, localLsnByRegion, null); - } - - private VectorSessionToken(long version, long globalLsn, UnmodifiableMap localLsnByRegion, String sessionToken) { - this.version = version; - this.globalLsn = globalLsn; - this.localLsnByRegion = localLsnByRegion; - if (sessionToken == null) { - String regionProgress = String.join( - Character.toString(VectorSessionToken.SegmentSeparator), - localLsnByRegion. - entrySet() - .stream() - .map(kvp -> new StringBuilder().append(kvp.getKey()).append(VectorSessionToken.RegionProgressSeparator).append(kvp.getValue())) - .collect(Collectors.toList())); - - if (Strings.isNullOrEmpty(regionProgress)) { - StringBuilder sb = new StringBuilder(); - sb.append(this.version) - .append(VectorSessionToken.SegmentSeparator) - .append(this.globalLsn); - this.sessionToken = sb.toString(); - } else { - StringBuilder sb = new StringBuilder(); - sb.append(this.version) - .append(VectorSessionToken.SegmentSeparator) - .append(this.globalLsn) - .append(VectorSessionToken.SegmentSeparator) - .append(regionProgress); - this.sessionToken = sb.toString(); - } - } else { - this.sessionToken = sessionToken; - } - } - - public static boolean tryCreate(String sessionToken, ValueHolder parsedSessionToken) { - ValueHolder versionHolder = ValueHolder.initialize(-1l); - ValueHolder globalLsnHolder = ValueHolder.initialize(-1l); - - ValueHolder> localLsnByRegion = ValueHolder.initialize(null); - - if (VectorSessionToken.tryParseSessionToken( - sessionToken, - versionHolder, - globalLsnHolder, - localLsnByRegion)) { - parsedSessionToken.v = new VectorSessionToken(versionHolder.v, globalLsnHolder.v, localLsnByRegion.v, sessionToken); - return true; - } else { - return false; - } - } - - public long getLSN() { - return this.globalLsn; - } - - @Override - public boolean equals(Object obj) { - VectorSessionToken other = Utils.as(obj, VectorSessionToken.class); - - if (other == null) { - return false; - } - - return this.version == other.version - && this.globalLsn == other.globalLsn - && this.areRegionProgressEqual(other.localLsnByRegion); - } - - public boolean isValid(ISessionToken otherSessionToken) throws DocumentClientException { - VectorSessionToken other = Utils.as(otherSessionToken, VectorSessionToken.class); - - if (other == null) { - throw new IllegalArgumentException("otherSessionToken"); - } - - if (other.version < this.version || other.globalLsn < this.globalLsn) { - return false; - } - - if (other.version == this.version && other.localLsnByRegion.size() != this.localLsnByRegion.size()) { - throw new InternalServerErrorException( - String.format(RMResources.InvalidRegionsInSessionToken, this.sessionToken, other.sessionToken)); - } - - for (Map.Entry kvp : other.localLsnByRegion.entrySet()) { - Integer regionId = kvp.getKey(); - long otherLocalLsn = kvp.getValue(); - ValueHolder localLsn = ValueHolder.initialize(-1l); - - - if (!Utils.tryGetValue(this.localLsnByRegion, regionId, localLsn)) { - // Region mismatch: other session token has progress for a region which is missing in this session token - // Region mismatch can be ignored only if this session token version is smaller than other session token version - if (this.version == other.version) { - throw new InternalServerErrorException( - String.format(RMResources.InvalidRegionsInSessionToken, this.sessionToken, other.sessionToken)); - } else { - // ignore missing region as other session token version > this session token version - } - } else { - // region is present in both session tokens. - if (otherLocalLsn < localLsn.v) { - return false; - } - } - } - - return true; - } - - // Merge is commutative operation, so a.Merge(b).Equals(b.Merge(a)) - public ISessionToken merge(ISessionToken obj) throws DocumentClientException { - VectorSessionToken other = Utils.as(obj, VectorSessionToken.class); - - if (other == null) { - throw new IllegalArgumentException("obj"); - } - - if (this.version == other.version && this.localLsnByRegion.size() != other.localLsnByRegion.size()) { - throw new InternalServerErrorException( - String.format(RMResources.InvalidRegionsInSessionToken, this.sessionToken, other.sessionToken)); - } - - VectorSessionToken sessionTokenWithHigherVersion; - VectorSessionToken sessionTokenWithLowerVersion; - - if (this.version < other.version) { - sessionTokenWithLowerVersion = this; - sessionTokenWithHigherVersion = other; - } else { - sessionTokenWithLowerVersion = other; - sessionTokenWithHigherVersion = this; - } - - Map highestLocalLsnByRegion = new HashMap<>(); - - for (Map.Entry kvp : sessionTokenWithHigherVersion.localLsnByRegion.entrySet()) { - Integer regionId = kvp.getKey(); - - long localLsn1 = kvp.getValue(); - ValueHolder localLsn2 = ValueHolder.initialize(-1l); - - if (Utils.tryGetValue(sessionTokenWithLowerVersion.localLsnByRegion, regionId, localLsn2)) { - highestLocalLsnByRegion.put(regionId, Math.max(localLsn1, localLsn2.v)); - } else if (this.version == other.version) { - throw new InternalServerErrorException( - String.format(RMResources.InvalidRegionsInSessionToken, this.sessionToken, other.sessionToken)); - } else { - highestLocalLsnByRegion.put(regionId, localLsn1); - } - } - - return new VectorSessionToken( - Math.max(this.version, other.version), - Math.max(this.globalLsn, other.globalLsn), - (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(highestLocalLsnByRegion)); - } - - public String convertToString() { - return this.sessionToken; - } - - private boolean areRegionProgressEqual(UnmodifiableMap other) { - if (this.localLsnByRegion.size() != other.size()) { - return false; - } - - for (Map.Entry kvp : this.localLsnByRegion.entrySet()) { - Integer regionId = kvp.getKey(); - ValueHolder localLsn1 = ValueHolder.initialize(kvp.getValue()); - ValueHolder localLsn2 = ValueHolder.initialize(-1l); - - if (Utils.tryGetValue(other, regionId, localLsn2)) { - if (ObjectUtils.notEqual(localLsn1.v, localLsn2.v)) { - return false; - } - } - } - - return true; - } - - private static boolean tryParseSessionToken( - String sessionToken, - ValueHolder version, - ValueHolder globalLsn, - ValueHolder> localLsnByRegion) { - version.v = 0L; - localLsnByRegion.v = null; - globalLsn.v = -1L; - - if (Strings.isNullOrEmpty(sessionToken)) { - logger.warn("Session token is empty"); - return false; - } - - String[] segments = StringUtils.split(sessionToken, VectorSessionToken.SegmentSeparator); - - if (segments.length < 2) { - return false; - } - - if (!tryParseLong(segments[0], version) - || !tryParseLong(segments[1], globalLsn)) { - logger.warn("Unexpected session token version number '{}' OR global lsn '{}'.", segments[0], segments[1]); - return false; - } - - Map lsnByRegion = new HashMap<>(); - - for (int i = 2; i < segments.length; i++) { - String regionSegment = segments[i]; - - String[] regionIdWithLsn = StringUtils.split(regionSegment, VectorSessionToken.RegionProgressSeparator); - - if (regionIdWithLsn.length != 2) { - logger.warn("Unexpected region progress segment length '{}' in session token.", regionIdWithLsn.length); - return false; - } - - ValueHolder regionId = ValueHolder.initialize(0); - ValueHolder localLsn = ValueHolder.initialize(-1l); - - if (!tryParseInt(regionIdWithLsn[0], regionId) - || !tryParseLong(regionIdWithLsn[1], localLsn)) { - logger.warn("Unexpected region progress '{}' for region '{}' in session token.", regionIdWithLsn[0], regionIdWithLsn[1]); - return false; - } - - lsnByRegion.put(regionId.v, localLsn.v); - } - - localLsnByRegion.v = (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(lsnByRegion); - return true; - } - - private static boolean tryParseLong(String str, ValueHolder value) { - try { - value.v = Long.parseLong(str); - return true; - } catch (Exception e) { - return false; - } - } - - private static boolean tryParseInt(String str, ValueHolder value) { - try { - value.v = Integer.parseInt(str); - return true; - } catch (Exception e) { - return false; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtility.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtility.java deleted file mode 100644 index c90fdf1e1b47..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtility.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import io.netty.channel.ChannelException; -import io.reactivex.netty.client.PoolExhaustedException; - -import javax.net.ssl.SSLHandshakeException; -import javax.net.ssl.SSLPeerUnverifiedException; -import java.io.IOException; -import java.net.ConnectException; -import java.net.NoRouteToHostException; -import java.net.UnknownHostException; - -public class WebExceptionUtility { - public static boolean isWebExceptionRetriable(Exception ex) { - Exception iterator = ex; - - while (iterator != null) { - if (WebExceptionUtility.isWebExceptionRetriableInternal(iterator)) { - return true; - } - - Throwable t = iterator.getCause(); - iterator = Utils.as(t, Exception.class); - } - - return false; - } - - private static boolean isWebExceptionRetriableInternal(Exception ex) { - if (ex instanceof PoolExhaustedException) { - return true; - } - - IOException webEx = Utils.as(ex, IOException.class); - if (webEx == null) { - return false; - } - - // any network failure for which we are certain the request hasn't reached the service endpoint. - if (webEx instanceof ConnectException || - webEx instanceof UnknownHostException || - webEx instanceof SSLHandshakeException || - webEx instanceof NoRouteToHostException || - webEx instanceof SSLPeerUnverifiedException) { - return true; - } - - return false; - } - - public static boolean isNetworkFailure(Exception ex) { - Exception iterator = ex; - - while (iterator != null) { - if (WebExceptionUtility.isNetworkFailureInternal(iterator)) { - return true; - } - - Throwable t = iterator.getCause(); - iterator = Utils.as(t, Exception.class); - } - - return false; - } - - private static boolean isNetworkFailureInternal(Exception ex) { - if (ex instanceof IOException) { - return true; - } - - if (ex instanceof ChannelException) { - return true; - } - - return false; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ExceptionHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ExceptionHelper.java deleted file mode 100644 index 1bf8481c9add..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ExceptionHelper.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import java.util.concurrent.ExecutionException; - -class ExceptionHelper { - - private ExceptionHelper() {} - - public static Throwable unwrap(Throwable e) { - if (e.getCause() == null) { - return e; - } - if (e instanceof IllegalStateException || e instanceof ExecutionException) { - return unwrap(e.getCause()); - } - return e; - } - - public static Throwable unwrapIllegalStateException(Exception e) { - if (e instanceof IllegalStateException && e.getCause() != null) { - return e.getCause(); - } - return e; - } - - public static Throwable unwrapExecutionException(Exception e) { - if (e instanceof RuntimeException && e.getCause() != null) { - return e.getCause(); - } - return e; - } - - public static RuntimeException toRuntimeException(Throwable e) { - if (e instanceof RuntimeException) { - return (RuntimeException) e; - } - throw new IllegalStateException(e); - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemComparator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemComparator.java deleted file mode 100644 index a3f35ee181f3..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemComparator.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import java.util.Comparator; - -public final class ItemComparator implements Comparator { - private ItemComparator() { - } - - private static class SingletonHelper { - private static final ItemComparator INSTANCE = new ItemComparator(); - } - - public static ItemComparator getInstance() { - return SingletonHelper.INSTANCE; - } - - @Override - public int compare(Object obj1, Object obj2) { - ItemType type1 = ItemTypeHelper.getOrderByItemType(obj1); - ItemType type2 = ItemTypeHelper.getOrderByItemType(obj2); - - int cmp = Integer.compare(type1.getVal(), type2.getVal()); - - if (cmp != 0) { - return cmp; - } - - switch (type1) { - case NoValue: - case Null: - return 0; - case Boolean: - return Boolean.compare((Boolean) obj1, (Boolean) obj2); - case Number: - return Double.compare(((Number) obj1).doubleValue(), ((Number) obj2).doubleValue()); - case String: - return ((String) obj1).compareTo((String) obj2); - default: - throw new ClassCastException(String.format("Unexpected type: %s", type1.toString())); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemType.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemType.java deleted file mode 100644 index 508e8f7cdd9d..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemType.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -public enum ItemType { - NoValue(0x0), Null(0x1), Boolean(0x2), Number(0x4), String(0x5); - - private final int val; - - ItemType(int val) { - this.val = val; - } - - public int getVal() { - return this.val; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemTypeHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemTypeHelper.java deleted file mode 100644 index 9798739b6ea5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemTypeHelper.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import com.microsoft.azure.cosmosdb.Undefined; - -public final class ItemTypeHelper { - public static ItemType getOrderByItemType(Object obj) { - if (obj == null) { - return ItemType.Null; - } - - if (obj instanceof Undefined) { - return ItemType.NoValue; - } - - if (obj instanceof Boolean) { - return ItemType.Boolean; - } - - if (obj instanceof Number) { - return ItemType.Number; - } - - if (obj instanceof String) { - return ItemType.String; - } - - throw new IllegalArgumentException(String.format("Unexpected type: %s", obj.getClass().toString())); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfo.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfo.java deleted file mode 100644 index 5bcf61ef9ba2..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import java.util.List; - -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.routing.Range; - -/** - * Used internally to encapsulates execution information for a query in the Azure Cosmos DB database service. - */ -public final class PartitionedQueryExecutionInfo extends JsonSerializable { - @SuppressWarnings("unchecked") - private static final Class> QUERY_RANGES_CLASS = (Class>) Range - .getEmptyRange((String) null).getClass(); - - private QueryInfo queryInfo; - private List> queryRanges; - - PartitionedQueryExecutionInfo(QueryInfo queryInfo, List> queryRanges) { - this.queryInfo = queryInfo; - this.queryRanges = queryRanges; - - super.set( - PartitionedQueryExecutionInfoInternal.PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY, - Constants.PartitionedQueryExecutionInfo.VERSION_1); - } - - public PartitionedQueryExecutionInfo(String jsonString) { - super(jsonString); - } - - public int getVersion() { - return super.getInt(PartitionedQueryExecutionInfoInternal.PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY); - } - - public QueryInfo getQueryInfo() { - return this.queryInfo != null ? this.queryInfo - : (this.queryInfo = super.getObject( - PartitionedQueryExecutionInfoInternal.QUERY_INFO_PROPERTY, QueryInfo.class)); - } - - public List> getQueryRanges() { - return this.queryRanges != null ? this.queryRanges - : (this.queryRanges = super.getList( - PartitionedQueryExecutionInfoInternal.QUERY_RANGES_PROPERTY, QUERY_RANGES_CLASS)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfoInternal.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfoInternal.java deleted file mode 100644 index cd4e4d673ebc..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfoInternal.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import java.util.List; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.Range; - -public final class PartitionedQueryExecutionInfoInternal extends JsonSerializable { - static final String QUERY_INFO_PROPERTY = "queryInfo"; - static final String QUERY_RANGES_PROPERTY = "queryRanges"; - static final String PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY = "partitionedQueryExecutionInfoVersion"; - - @SuppressWarnings("unchecked") - private static final Class> QUERY_RANGE_CLASS = (Class>) Range - .getEmptyRange((PartitionKeyInternal) null).getClass(); - - private QueryInfo queryInfo; - private List> queryRanges; - - public PartitionedQueryExecutionInfoInternal() { - super.set(PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY, Constants.PartitionedQueryExecutionInfo.VERSION_1); - } - - public PartitionedQueryExecutionInfoInternal(String jsonString) { - super(jsonString); - } - - public int getVersion() { - return super.getInt(PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY); - } - - public QueryInfo getQueryInfo() { - return this.queryInfo != null ? this.queryInfo - : (this.queryInfo = super.getObject(QUERY_INFO_PROPERTY, QueryInfo.class)); - } - - public void setQueryInfo(QueryInfo queryInfo) { - this.queryInfo = queryInfo; - } - - public List> getQueryRanges() { - return this.queryRanges != null ? this.queryRanges - : (this.queryRanges = super.getList(QUERY_RANGES_PROPERTY, QUERY_RANGE_CLASS)); - } - - public void setQueryRanges(List> queryRanges) { - this.queryRanges = queryRanges; - } - - public String toJson() { - try { - return Utils.getSimpleObjectMapper().writeValueAsString(this); - } catch (JsonProcessingException e) { - throw new IllegalStateException("Unable to serialize partition query execution info internal."); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryInfo.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryInfo.java deleted file mode 100644 index 666011b837da..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryInfo.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import java.util.Collection; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.AggregateOperator; - -/** - * Used internally to encapsulates a query's information in the Azure Cosmos DB database service. - */ -public final class QueryInfo extends JsonSerializable { - private Integer top; - private List orderBy; - private Collection aggregates; - private Collection orderByExpressions; - private String rewrittenQuery; - - public QueryInfo() { } - - public QueryInfo(String jsonString) { - super(jsonString); - } - - public Integer getTop() { - return this.top != null ? this.top : (this.top = super.getInt("top")); - } - - public List getOrderBy() { - return this.orderBy != null ? this.orderBy : (this.orderBy = super.getList("orderBy", SortOrder.class)); - } - - public String getRewrittenQuery() { - return this.rewrittenQuery != null ? this.rewrittenQuery - : (this.rewrittenQuery = super.getString("rewrittenQuery")); - } - - public boolean hasTop() { - return this.getTop() != null; - } - - public boolean hasOrderBy() { - Collection orderBy = this.getOrderBy(); - return orderBy != null && orderBy.size() > 0; - } - - public boolean hasRewrittenQuery() { - return !StringUtils.isEmpty(this.getRewrittenQuery()); - } - - public boolean hasAggregates() { - Collection aggregates = this.getAggregates(); - return aggregates != null && aggregates.size() > 0; - } - - public Collection getAggregates() { - return this.aggregates != null - ? this.aggregates - : (this.aggregates = super.getCollection("aggregates", AggregateOperator.class)); - } - - public Collection getOrderByExpressions() { - return this.orderByExpressions != null - ? this.orderByExpressions - : (this.orderByExpressions = super.getCollection("orderByExpressions", String.class)); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryItem.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryItem.java deleted file mode 100644 index e9756aa55161..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryItem.java +++ /dev/null @@ -1,48 +0,0 @@ - -/** - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.Undefined; - -/** - * Used internally for query in the Azure Cosmos DB database service. - */ -public final class QueryItem extends JsonSerializable { - private Object item; - - public QueryItem(String jsonString) { - super(jsonString); - } - - public Object getItem() { - if (this.item == null) { - Object rawItem = super.get("item"); - this.item = super.has("item") ? rawItem : Undefined.Value(); - } - - return this.item; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/SortOrder.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/SortOrder.java deleted file mode 100644 index af02ac9530ab..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/SortOrder.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -/** - * Sort order in the Azure Cosmos DB database service. - */ -public enum SortOrder { - Ascending, Descending, -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AggregateOperator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AggregateOperator.java deleted file mode 100644 index 18b9b7edeb8b..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AggregateOperator.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -public enum AggregateOperator { - Average, - Count, - Max, - Min, - Sum -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/Aggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/Aggregator.java deleted file mode 100644 index ea4ad348f5ec..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/Aggregator.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -public interface Aggregator { - void aggregate(Object item); - - Object getResult(); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AverageAggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AverageAggregator.java deleted file mode 100644 index d2b66dd60826..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AverageAggregator.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -import java.io.IOException; - -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.Utils; - -public class AverageAggregator implements Aggregator { - private AverageInfo averageInfo; - - public AverageAggregator() { - this.averageInfo = new AverageInfo(); - } - - @Override - public void aggregate(Object item) { - AverageInfo averageInfo; - try { - averageInfo = Utils.getSimpleObjectMapper().readValue(item.toString(), AverageInfo.class); - } catch (IOException e) { - throw new IllegalStateException("Failed to deserialize aggregate result"); - } - this.averageInfo.add(averageInfo); - } - - @Override - public Object getResult() { - return this.averageInfo.getAverage(); - } - - private static class AverageInfo { - public Double sum; - public long count; - - public void add(AverageInfo other) { - if (other == null) { - throw new IllegalArgumentException("other"); - } - if (other.sum == null) { - return; - } - if (this.sum == null) { - this.sum = 0.0; - } - - this.sum += other.sum; - this.count += other.count; - } - - Object getAverage() { - if (this.sum == null || this.count <= 0) { - return Undefined.Value(); - } - return this.sum / this.count; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/CountAggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/CountAggregator.java deleted file mode 100644 index 2589f0699006..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/CountAggregator.java +++ /dev/null @@ -1,39 +0,0 @@ - -/** - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -public class CountAggregator implements Aggregator { - private long value; - - @Override - public void aggregate(Object item) { - value += Long.parseLong(item.toString()); - } - - @Override - public Object getResult() { - return value; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MaxAggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MaxAggregator.java deleted file mode 100644 index fc3ba6d86094..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MaxAggregator.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.query.ItemComparator; - -public class MaxAggregator implements Aggregator { - private Object value; - - public MaxAggregator() { - this.value = Undefined.Value(); - } - - @Override - public void aggregate(Object item) { - if (Undefined.Value().equals(this.value)) { - this.value = item; - } else if (ItemComparator.getInstance().compare(item, this.value) > 0) { - this.value = item; - } - - } - - @Override - public Object getResult() { - return this.value; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MinAggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MinAggregator.java deleted file mode 100644 index 344b24f3ba80..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MinAggregator.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.query.ItemComparator; - -public class MinAggregator implements Aggregator { - private Object value; - - public MinAggregator() { - this.value = Undefined.Value(); - } - - @Override - public void aggregate(Object item) { - if (Undefined.Value().equals(this.value)) { - this.value = item; - } else if (ItemComparator.getInstance().compare(item, this.value) < 0) { - this.value = item; - } - } - - @Override - public Object getResult() { - return this.value; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/SumAggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/SumAggregator.java deleted file mode 100644 index ebf2b23437e0..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/SumAggregator.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -import com.microsoft.azure.cosmosdb.Undefined; - -public class SumAggregator implements Aggregator { - private Double sum; - - @Override - public void aggregate(Object item) { - if (Undefined.Value().equals(item)) { - return; - } - - if (this.sum == null) { - this.sum = 0.0; - } - this.sum += ((Number) item).doubleValue(); - } - - @Override - public Object getResult() { - if (this.sum == null) { - return Undefined.Value(); - } - return this.sum; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderByRowResult.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderByRowResult.java deleted file mode 100644 index 18a0ffa102d0..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderByRowResult.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.orderbyquery; - -import java.util.List; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; - -/** - * Represents the result of a query in the Azure Cosmos DB database service. - */ -public final class OrderByRowResult extends Document { - private final Class klass; - private volatile List orderByItems; - private volatile T payload; - private final PartitionKeyRange targetRange; - private final String backendContinuationToken; - - public OrderByRowResult( - Class klass, - String jsonString, - PartitionKeyRange targetRange, - String backendContinuationToken) { - super(jsonString); - this.klass = klass; - this.targetRange = targetRange; - this.backendContinuationToken = backendContinuationToken; - } - - public List getOrderByItems() { - return this.orderByItems != null ? this.orderByItems - : (this.orderByItems = super.getList("orderByItems", QueryItem.class)); - } - - public T getPayload() { - return this.payload != null ? this.payload : (this.payload = super.getObject("payload", klass)); - } - - public PartitionKeyRange getSourcePartitionKeyRange() { - return this.targetRange; - } - - public String getSourceBackendContinuationToken() { - return this.backendContinuationToken; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderbyRowComparer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderbyRowComparer.java deleted file mode 100644 index 7606c7262949..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderbyRowComparer.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.orderbyquery; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.internal.query.ItemComparator; -import com.microsoft.azure.cosmosdb.internal.query.ItemType; -import com.microsoft.azure.cosmosdb.internal.query.ItemTypeHelper; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.query.SortOrder; - -public final class OrderbyRowComparer implements Comparator> { - private static final Logger logger = LoggerFactory.getLogger(OrderbyRowComparer.class); - - private final List sortOrders; - private volatile List itemTypes; - - public OrderbyRowComparer(Collection sortOrders) { - this.sortOrders = new ArrayList<>(sortOrders); - } - - @Override - public int compare(OrderByRowResult r1, OrderByRowResult r2) { - try { - // comparing document (row) vs document (row) - List result1 = r1.getOrderByItems(); - List result2 = r2.getOrderByItems(); - - if (result1.size() != result2.size()) { - throw new IllegalStateException("OrderByItems cannot have different sizes."); - } - - if (result1.size() != this.sortOrders.size()) { - throw new IllegalStateException( - String.format("OrderByItems cannot have a different size than sort orders.")); - } - - if (this.itemTypes == null) { - synchronized (this) { - if (this.itemTypes == null) { - this.itemTypes = new ArrayList(result1.size()); - for (QueryItem item : result1) { - this.itemTypes.add(ItemTypeHelper.getOrderByItemType(item.getItem())); - } - } - } - } - - this.checkOrderByItemType(result1); - this.checkOrderByItemType(result2); - - for (int i = 0; i < result1.size(); ++i) { - int cmp = ItemComparator.getInstance().compare(result1.get(i).getItem(), result2.get(i).getItem()); - if (cmp != 0) { - switch (this.sortOrders.get(i)) { - case Ascending: - return cmp; - case Descending: - return -cmp; - } - } - } - - return r1.getSourcePartitionKeyRange().getMinInclusive().compareTo(r2.getSourcePartitionKeyRange().getMinInclusive()); - } catch (Exception e) { - // Due to a bug in rxjava-extras <= 0.8.0.15 dependency, - // if OrderbyRowComparer throws an unexpected exception, - // then the observable returned by Transformers.orderedMergeWith(.) will never emit a terminal event. - // rxjava-extras lib provided a quick fix on the bugreport: - // https://github.com/davidmoten/rxjava-extras/issues/30 (0.8.0.16) - // we are also capturing the exception stacktrace here - logger.error("Orderby Row comparision failed {}, {}", r1.toJson(), r2.toJson(), e); - throw e; - } - } - - private void checkOrderByItemType(List orderByItems) { - for (int i = 0; i < this.itemTypes.size(); ++i) { - ItemType type = ItemTypeHelper.getOrderByItemType(orderByItems.get(i).getItem()); - if (type != this.itemTypes.get(i)) { - throw new UnsupportedOperationException( - String.format("Expected %s, but got %s.", this.itemTypes.get(i).toString(), type.toString())); - } - } - } - - public List getSortOrders() { - return this.sortOrders; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CaseInsensitiveHashMap.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CaseInsensitiveHashMap.java deleted file mode 100644 index 086508469532..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CaseInsensitiveHashMap.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.BiFunction; -import java.util.function.Function; - - -// TODO: commons-collections lib has CaseInsensitiveHashMap we should switch to that. -// https://commons.apache.org/proper/commons-collections/javadocs/api-3.2.2/org/apache/commons/collections/map/CaseInsensitiveMap.html -public class CaseInsensitiveHashMap extends HashMap { - - private static String safeToLower(String key) { - return key != null ? key.toLowerCase() : null; - } - - @Override - public V get(Object key) { - return super.get(safeToLower((String) key)); - } - - - @Override - public void putAll(Map m) { - super.putAll(m); - } - - @Override - public V put(String key, V value) { - return super.put(safeToLower(key), value); - } - - @Override - public V putIfAbsent(String key, V value) { - return super.putIfAbsent(safeToLower(key), value); - } - - @Override - public V compute(String key, BiFunction remappingFunction) { - return super.compute(safeToLower(key), remappingFunction); - } - - @Override - public V computeIfAbsent(String key, Function mappingFunction) { - return super.computeIfAbsent(safeToLower(key), mappingFunction); - } - - @Override - public V computeIfPresent(String key, BiFunction remappingFunction) { - return super.computeIfPresent(safeToLower(key), remappingFunction); - } - - @Override - public boolean containsKey(Object key) { - return super.containsKey(safeToLower((String) key)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CollectionRoutingMap.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CollectionRoutingMap.java deleted file mode 100644 index 5cc477ac4694..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CollectionRoutingMap.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.Collection; -import java.util.List; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import org.apache.commons.lang3.tuple.ImmutablePair; - -/** - * Used internally in request routing in the Azure Cosmos DB database service. - */ -public interface CollectionRoutingMap { - List getOrderedPartitionKeyRanges(); - - PartitionKeyRange getRangeByEffectivePartitionKey(String effectivePartitionKeyValue); - - PartitionKeyRange getRangeByPartitionKeyRangeId(String partitionKeyRangeId); - - Collection getOverlappingRanges(Range range); - - Collection getOverlappingRanges(Collection> providedPartitionKeyRanges); - - PartitionKeyRange tryGetRangeByPartitionKeyRangeId(String partitionKeyRangeId); - - IServerIdentity tryGetInfoByPartitionKeyRangeId(String partitionKeyRangeId); - - boolean IsGone(String partitionKeyRangeId); - - String getCollectionUniqueId(); - - CollectionRoutingMap tryCombine(List> ranges); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IServerIdentity.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IServerIdentity.java deleted file mode 100644 index ca5a849739e8..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IServerIdentity.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -public interface IServerIdentity { -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMap.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMap.java deleted file mode 100644 index b17205ddd6e8..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMap.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.stream.Collectors; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import org.apache.commons.lang3.tuple.Pair; - -/** - * Used internally to cache partition key ranges of a collection in the Azure Cosmos DB database service. - */ -public class InMemoryCollectionRoutingMap implements CollectionRoutingMap { - private final Map> rangeById; - private final List orderedPartitionKeyRanges; - private final List> orderedRanges; - - private final Set goneRanges; - - private String collectionUniqueId; - - private InMemoryCollectionRoutingMap(Map> rangeById, - List orderedPartitionKeyRanges, - String collectionUniqueId) { - this.rangeById = rangeById; - this.orderedPartitionKeyRanges = orderedPartitionKeyRanges; - this.orderedRanges = orderedPartitionKeyRanges.stream().map( - range -> - new Range<>( - range.getMinInclusive(), - range.getMaxExclusive(), - true, - false)).collect(Collectors.toList()); - - this.collectionUniqueId = collectionUniqueId; - this.goneRanges = new HashSet<>(orderedPartitionKeyRanges.stream().flatMap(r -> CollectionUtils.emptyIfNull(r.getParents()).stream()).collect(Collectors.toSet())); - - } - - public static InMemoryCollectionRoutingMap tryCreateCompleteRoutingMap( - Iterable> ranges, String collectionUniqueId) { - - Map> rangeById = - new HashMap<>(); - - for (ImmutablePair range: ranges) { - rangeById.put(range.left.getId(), range); - } - - List> sortedRanges = new ArrayList<>(rangeById.values()); - Collections.sort(sortedRanges, new MinPartitionKeyPairComparator()); - List orderedRanges = sortedRanges.stream().map(range -> range.left).collect(Collectors.toList()); - - if (!isCompleteSetOfRanges(orderedRanges)) { - return null; - } - - return new InMemoryCollectionRoutingMap(rangeById, orderedRanges, collectionUniqueId); - } - - private static boolean isCompleteSetOfRanges(List orderedRanges) { - boolean isComplete = false; - if (orderedRanges.size() > 0) { - PartitionKeyRange firstRange = orderedRanges.get(0); - PartitionKeyRange lastRange = orderedRanges.get(orderedRanges.size() - 1); - isComplete = firstRange.getMinInclusive() - .compareTo(PartitionKeyRange.MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY) == 0; - isComplete &= lastRange.getMaxExclusive() - .compareTo(PartitionKeyRange.MAXIMUM_EXCLUSIVE_EFFECTIVE_PARTITION_KEY) == 0; - - for (int i = 1; i < orderedRanges.size(); i++) { - PartitionKeyRange previousRange = orderedRanges.get(i - 1); - PartitionKeyRange currentRange = orderedRanges.get(i); - isComplete &= previousRange.getMaxExclusive().compareTo(currentRange.getMinInclusive()) == 0; - - if (!isComplete) { - if (previousRange.getMaxExclusive().compareTo(currentRange.getMinInclusive()) > 0) { - throw new IllegalStateException("Ranges overlap"); - } - - break; - } - } - } - - return isComplete; - } - - public String getCollectionUniqueId() { - return collectionUniqueId; - } - - @Override - public List getOrderedPartitionKeyRanges() { - return this.orderedPartitionKeyRanges; - } - - @Override - public PartitionKeyRange getRangeByEffectivePartitionKey(String effectivePartitionKeyValue) { - if (PartitionKeyRange.MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY.compareTo(effectivePartitionKeyValue) == 0) { - return this.orderedPartitionKeyRanges.get(0); - } - - if (PartitionKeyRange.MAXIMUM_EXCLUSIVE_EFFECTIVE_PARTITION_KEY.compareTo(effectivePartitionKeyValue) == 0) { - return null; - } - - int index = Collections.binarySearch(this.orderedRanges, Range.getPointRange(effectivePartitionKeyValue), - new Range.MinComparator()); - - if (index < 0) { - index = Math.max(0, -index - 2); - } - - return this.orderedPartitionKeyRanges.get(index); - } - - @Override - public PartitionKeyRange getRangeByPartitionKeyRangeId(String partitionKeyRangeId) { - ImmutablePair pair = this.rangeById.get(partitionKeyRangeId); - return pair == null ? null : pair.left; - } - - - @Override - public Collection getOverlappingRanges(Range range) { - return this.getOverlappingRanges(Collections.singletonList(range)); - } - - @Override - public Collection getOverlappingRanges(Collection> providedPartitionKeyRanges) { - if (providedPartitionKeyRanges == null) { - throw new IllegalArgumentException("providedPartitionKeyRanges"); - } - - Map partitionRanges = new TreeMap(); - - for (Range range : providedPartitionKeyRanges) { - int minIndex = Collections.binarySearch(this.orderedRanges, range, new Range.MinComparator()); - if (minIndex < 0) { - minIndex = Math.max(minIndex, -minIndex - 2); - } - - int maxIndex = Collections.binarySearch(this.orderedRanges, range, new Range.MaxComparator()); - if (maxIndex < 0) { - maxIndex = Math.min(this.orderedRanges.size() - 1, -maxIndex - 1); - } - - for (int i = minIndex; i <= maxIndex; ++i) { - if (Range.checkOverlapping(this.orderedRanges.get(i), range)) { - PartitionKeyRange partitionKeyRange = this.orderedPartitionKeyRanges.get(i); - partitionRanges.put(partitionKeyRange.getMinInclusive(), partitionKeyRange); - } - } - } - - return partitionRanges.values(); - } - - - @Override - public PartitionKeyRange tryGetRangeByPartitionKeyRangeId(String partitionKeyRangeId) - { - Pair addresses; - addresses = this.rangeById.get(partitionKeyRangeId); - if (addresses != null) { - return addresses.getLeft(); - } - - return null; - } - - @Override - public IServerIdentity tryGetInfoByPartitionKeyRangeId(String partitionKeyRangeId) - { - Pair addresses; - addresses = this.rangeById.get(partitionKeyRangeId); - if (addresses != null) { - return addresses.getRight(); - } - - return null; - } - - @Override - public boolean IsGone(String partitionKeyRangeId) { - return this.goneRanges.contains(partitionKeyRangeId); - } - - private static class MinPartitionKeyPairComparator - implements Comparator> { - public int compare(ImmutablePair pair1, - ImmutablePair pair2) { - return pair1.left.getMinInclusive().compareTo(pair2.left.getMinInclusive()); - } - } - - - public CollectionRoutingMap tryCombine( - List> ranges) { - Set newGoneRanges = new HashSet<>(ranges.stream().flatMap(tuple -> CollectionUtils.emptyIfNull(tuple.getLeft().getParents()).stream()).collect(Collectors.toSet())); - newGoneRanges.addAll(this.goneRanges); - - Map> newRangeById = - this.rangeById.values().stream().filter(tuple -> !newGoneRanges.contains(tuple.left.getId())).collect(Collectors. - toMap(tuple -> tuple.left.getId(), tuple -> tuple)); - - for (ImmutablePair tuple : ranges.stream().filter(tuple -> !newGoneRanges.contains(tuple.getLeft().getId())).collect(Collectors.toList())) { - newRangeById.put(tuple.getLeft().getId(), tuple); - } - - List> sortedRanges = newRangeById.values().stream().collect(Collectors.toList()); - - Collections.sort(sortedRanges, new MinPartitionKeyPairComparator()); - - List newOrderedRanges = sortedRanges.stream().map(range -> range.left).collect(Collectors.toList()); - - if (!isCompleteSetOfRanges(newOrderedRanges)) { - return null; - } - - return new InMemoryCollectionRoutingMap(newRangeById, newOrderedRanges, this.getCollectionUniqueId()); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCache.java deleted file mode 100644 index d730343526ab..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCache.java +++ /dev/null @@ -1,581 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.DatabaseAccountLocation; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.collections4.map.CaseInsensitiveMap; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.commons.collections4.list.UnmodifiableList; -import org.apache.commons.collections4.map.UnmodifiableMap; -import java.net.URL; -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.BiFunction; -import java.util.stream.Collectors; - -/** - * Implements the abstraction to resolve target location for geo-replicated DatabaseAccount - * with multiple writable and readable locations. - */ -public class LocationCache { - private final static Logger logger = LoggerFactory.getLogger(LocationCache.class); - - private final boolean enableEndpointDiscovery; - private final URL defaultEndpoint; - private final boolean useMultipleWriteLocations; - private final Object lockObject; - private final Duration unavailableLocationsExpirationTime; - private final ConcurrentHashMap locationUnavailabilityInfoByEndpoint; - - private DatabaseAccountLocationsInfo locationInfo; - - private Instant lastCacheUpdateTimestamp; - private boolean enableMultipleWriteLocations; - - public LocationCache( - List preferredLocations, - URL defaultEndpoint, - boolean enableEndpointDiscovery, - boolean useMultipleWriteLocations, - Configs configs) { - this.locationInfo = new DatabaseAccountLocationsInfo(preferredLocations, defaultEndpoint); - this.defaultEndpoint = defaultEndpoint; - this.enableEndpointDiscovery = enableEndpointDiscovery; - this.useMultipleWriteLocations = useMultipleWriteLocations; - - this.lockObject = new Object(); - - - this.locationUnavailabilityInfoByEndpoint = new ConcurrentHashMap<>(); - - this.lastCacheUpdateTimestamp = Instant.MIN; - this.enableMultipleWriteLocations = false; - this.unavailableLocationsExpirationTime = Duration.ofSeconds(configs.getUnavailableLocationsExpirationTimeInSeconds()); - } - - /** - * Gets list of read endpoints ordered by - * - * 1. Preferred location - * 2. Endpoint availability - * @return - */ - public UnmodifiableList getReadEndpoints() { - if (this.locationUnavailabilityInfoByEndpoint.size() > 0 - && unavailableLocationsExpirationTimePassed()) { - this.updateLocationCache(); - } - - return this.locationInfo.readEndpoints; - } - - /** - * Gets list of write endpoints ordered by - * 1. Preferred location - * 2. Endpoint availability - * @return - */ - public UnmodifiableList getWriteEndpoints() { - if (this.locationUnavailabilityInfoByEndpoint.size() > 0 - && unavailableLocationsExpirationTimePassed()) { - this.updateLocationCache(); - } - - return this.locationInfo.writeEndpoints; - } - - /** - * Marks the current location unavailable for read - */ - public void markEndpointUnavailableForRead(URL endpoint) { - this.markEndpointUnavailable(endpoint, OperationType.Read); - } - - /** - * Marks the current location unavailable for write - */ - public void markEndpointUnavailableForWrite(URL endpoint) { - this.markEndpointUnavailable(endpoint, OperationType.Write); - } - - /** - * Invoked when {@link DatabaseAccount} is read - * @param databaseAccount Read DatabaseAccount - */ - public void onDatabaseAccountRead(DatabaseAccount databaseAccount) { - this.updateLocationCache( - databaseAccount.getWritableLocations(), - databaseAccount.getReadableLocations(), - null, - BridgeInternal.isEnableMultipleWriteLocations(databaseAccount)); - } - - void onLocationPreferenceChanged(UnmodifiableList preferredLocations) { - this.updateLocationCache( - null, null , preferredLocations, null); - } - - /** - * Resolves request to service endpoint. - * 1. If this is a write request - * (a) If UseMultipleWriteLocations = true - * (i) For document writes, resolve to most preferred and available write endpoint. - * Once the endpoint is marked unavailable, it is moved to the end of available write endpoint. Current request will - * be retried on next preferred available write endpoint. - * (ii) For all other resources, always resolve to first/second (regardless of preferred locations) - * write endpoint in {@link DatabaseAccount#getWritableLocations()}. - * Endpoint of first write location in {@link DatabaseAccount#getWritableLocations()} is the only endpoint that supports - * write operation on all resource types (except during that region's failover). - * Only during manual failover, client would retry write on second write location in {@link DatabaseAccount#getWritableLocations()}. - * (b) Else resolve the request to first write endpoint in {@link DatabaseAccount#getWritableLocations()} OR - * second write endpoint in {@link DatabaseAccount#getWritableLocations()} in case of manual failover of that location. - * 2. Else resolve the request to most preferred available read endpoint (automatic failover for read requests) - * @param request Request for which endpoint is to be resolved - * @return Resolved endpoint - */ - public URL resolveServiceEndpoint(RxDocumentServiceRequest request) { - if(request.requestContext != null && request.requestContext.locationEndpointToRoute != null) { - return request.requestContext.locationEndpointToRoute; - } - - int locationIndex = Utils.getValueOrDefault(request.requestContext.locationIndexToRoute, 0); - - boolean usePreferredLocations = request.requestContext.usePreferredLocations != null ? request.requestContext.usePreferredLocations : true; - if(!usePreferredLocations || (request.getOperationType().isWriteOperation() && !this.canUseMultipleWriteLocations(request))) { - // For non-document resource types in case of client can use multiple write locations - // or when client cannot use multiple write locations, flip-flop between the - // first and the second writable region in DatabaseAccount (for manual failover) - DatabaseAccountLocationsInfo currentLocationInfo = this.locationInfo; - - if(this.enableEndpointDiscovery && currentLocationInfo.availableWriteLocations.size() > 0) { - locationIndex = Math.min(locationIndex%2, currentLocationInfo.availableWriteLocations.size()-1); - String writeLocation = currentLocationInfo.availableWriteLocations.get(locationIndex); - return currentLocationInfo.availableWriteEndpointByLocation.get(writeLocation); - } else { - return this.defaultEndpoint; - } - } else { - UnmodifiableList endpoints = request.getOperationType().isWriteOperation()? this.getWriteEndpoints() : this.getReadEndpoints(); - return endpoints.get(locationIndex % endpoints.size()); - } - } - - public boolean shouldRefreshEndpoints(Utils.ValueHolder canRefreshInBackground) { - canRefreshInBackground.v = true; - DatabaseAccountLocationsInfo currentLocationInfo = this.locationInfo; - String mostPreferredLocation = Utils.firstOrDefault(currentLocationInfo.preferredLocations); - - // we should schedule refresh in background if we are unable to target the user's most preferredLocation. - if (this.enableEndpointDiscovery) { - - boolean shouldRefresh = this.useMultipleWriteLocations && !this.enableMultipleWriteLocations; - if (!Strings.isNullOrEmpty(mostPreferredLocation)) { - Utils.ValueHolder mostPreferredReadEndpointHolder = new Utils.ValueHolder<>(); - List readLocationEndpoints = currentLocationInfo.readEndpoints; - logger.debug("getReadEndpoints [{}]", readLocationEndpoints); - - if (Utils.tryGetValue(currentLocationInfo.availableReadEndpointByLocation, mostPreferredLocation, mostPreferredReadEndpointHolder)) { - logger.debug("most preferred is [{}], most preferred available is [{}]", - mostPreferredLocation, mostPreferredReadEndpointHolder.v); - if (!areEqual(mostPreferredReadEndpointHolder.v, readLocationEndpoints.get(0))) { - // For reads, we can always refresh in background as we can alternate to - // other available read endpoints - logger.debug("shouldRefreshEndpoints = true, most preferred location [{}]" + - " is not available for read.", mostPreferredLocation); - return true; - } - - logger.debug("most preferred is [{}], and most preferred available [{}] are the same", - mostPreferredLocation, mostPreferredReadEndpointHolder.v); - } - else { - logger.debug("shouldRefreshEndpoints = true, most preferred location [{}] " + - "is not in available read locations.", mostPreferredLocation); - return true; - } - } - - Utils.ValueHolder mostPreferredWriteEndpointHolder = new Utils.ValueHolder<>(); - List writeLocationEndpoints = currentLocationInfo.writeEndpoints; - logger.debug("getWriteEndpoints [{}]", writeLocationEndpoints); - - if (!this.canUseMultipleWriteLocations()) { - if (this.isEndpointUnavailable(writeLocationEndpoints.get(0), OperationType.Write)) { - // Since most preferred write endpoint is unavailable, we can only refresh in background if - // we have an alternate write endpoint - canRefreshInBackground.v = writeLocationEndpoints.size() > 1; - logger.debug("shouldRefreshEndpoints = true, most preferred location " + - "[{}] endpoint [{}] is not available for write. canRefreshInBackground = [{}]", - mostPreferredLocation, - writeLocationEndpoints.get(0), - canRefreshInBackground.v); - - return true; - } else { - logger.debug("shouldRefreshEndpoints: false, [{}] is available for Write", writeLocationEndpoints.get(0)); - return shouldRefresh; - } - } else if (!Strings.isNullOrEmpty(mostPreferredLocation)) { - if (Utils.tryGetValue(currentLocationInfo.availableWriteEndpointByLocation, mostPreferredLocation, mostPreferredWriteEndpointHolder)) { - shouldRefresh = ! areEqual(mostPreferredWriteEndpointHolder.v,writeLocationEndpoints.get(0)); - - if (shouldRefresh) { - logger.debug("shouldRefreshEndpoints: true, write endpoint [{}] is not the same as most preferred [{}]", - writeLocationEndpoints.get(0), mostPreferredWriteEndpointHolder.v); - } else { - logger.debug("shouldRefreshEndpoints: false, write endpoint [{}] is the same as most preferred [{}]", - writeLocationEndpoints.get(0), mostPreferredWriteEndpointHolder.v); - } - - return shouldRefresh; - } else { - logger.debug("shouldRefreshEndpoints = true, most preferred location [{}] is not in available write locations", - mostPreferredLocation); - return true; - } - } else { - logger.debug("shouldRefreshEndpoints: false, mostPreferredLocation [{}] is empty", mostPreferredLocation); - return shouldRefresh; - } - } else { - logger.debug("shouldRefreshEndpoints: false, endpoint discovery not enabled"); - return false; - } - } - private boolean areEqual(URL url1, URL url2) { - return url1.equals(url2); - } - - private void clearStaleEndpointUnavailabilityInfo() { - if (!this.locationUnavailabilityInfoByEndpoint.isEmpty()) { - List unavailableEndpoints = new ArrayList<>(this.locationUnavailabilityInfoByEndpoint.keySet()); - - for (URL unavailableEndpoint: unavailableEndpoints) { - Utils.ValueHolder unavailabilityInfoHolder = new Utils.ValueHolder<>(); - Utils.ValueHolder removedHolder = new Utils.ValueHolder<>(); - - if (Utils.tryGetValue(this.locationUnavailabilityInfoByEndpoint, unavailableEndpoint, unavailabilityInfoHolder) - && - durationPassed(Instant.now(), unavailabilityInfoHolder.v.LastUnavailabilityCheckTimeStamp, - this.unavailableLocationsExpirationTime) - - && Utils.tryRemove(this.locationUnavailabilityInfoByEndpoint, unavailableEndpoint, removedHolder)) { - logger.debug( - "Removed endpoint [{}] unavailable for operations [{}] from unavailableEndpoints", - unavailableEndpoint, - unavailabilityInfoHolder.v.UnavailableOperations); - } - } - } - } - - private boolean isEndpointUnavailable(URL endpoint, OperationType expectedAvailableOperations) { - Utils.ValueHolder unavailabilityInfoHolder = new Utils.ValueHolder<>(); - - if (expectedAvailableOperations == OperationType.None - || !Utils.tryGetValue(this.locationUnavailabilityInfoByEndpoint, endpoint, unavailabilityInfoHolder) - || !unavailabilityInfoHolder.v.UnavailableOperations.supports(expectedAvailableOperations)) { - return false; - } else { - if (durationPassed(Instant.now(), unavailabilityInfoHolder.v.LastUnavailabilityCheckTimeStamp, this.unavailableLocationsExpirationTime)) { - return false; - } else { - logger.debug( - "Endpoint [{}] unavailable for operations [{}] present in unavailableEndpoints", - endpoint, - unavailabilityInfoHolder.v.UnavailableOperations); - // Unexpired entry present. Endpoint is unavailable - return true; - } - } - } - - private void markEndpointUnavailable( - URL unavailableEndpoint, - OperationType unavailableOperationType) { - Instant currentTime = Instant.now(); - LocationUnavailabilityInfo updatedInfo = this.locationUnavailabilityInfoByEndpoint.compute( - unavailableEndpoint, - new BiFunction() { - @Override - public LocationUnavailabilityInfo apply(URL url, LocationUnavailabilityInfo info) { - - if (info == null) { - // not already present, add - return new LocationUnavailabilityInfo(currentTime, unavailableOperationType); - } else { - // already present, update - info.LastUnavailabilityCheckTimeStamp = currentTime; - info.UnavailableOperations = OperationType.combine(info.UnavailableOperations, unavailableOperationType); - return info; - } - - } - }); - - this.updateLocationCache(); - - logger.debug( - "Endpoint [{}] unavailable for [{}] added/updated to unavailableEndpoints with timestamp [{}]", - unavailableEndpoint, - unavailableOperationType, - updatedInfo.LastUnavailabilityCheckTimeStamp); - } - - private void updateLocationCache(){ - updateLocationCache(null, null, null, null); - } - - private void updateLocationCache( - Iterable writeLocations, - Iterable readLocations, - UnmodifiableList preferenceList, - Boolean enableMultipleWriteLocations) { - synchronized (this.lockObject) { - DatabaseAccountLocationsInfo nextLocationInfo = new DatabaseAccountLocationsInfo(this.locationInfo); - logger.debug("updating location cache ..., current readLocations [{}], current writeLocations [{}]", - nextLocationInfo.readEndpoints, nextLocationInfo.writeEndpoints); - - if (preferenceList != null) { - nextLocationInfo.preferredLocations = preferenceList; - } - - if (enableMultipleWriteLocations != null) { - this.enableMultipleWriteLocations = enableMultipleWriteLocations; - } - - this.clearStaleEndpointUnavailabilityInfo(); - - if (readLocations != null) { - Utils.ValueHolder> out = Utils.ValueHolder.initialize(nextLocationInfo.availableReadLocations); - nextLocationInfo.availableReadEndpointByLocation = this.getEndpointByLocation(readLocations, out); - nextLocationInfo.availableReadLocations = out.v; - } - - if (writeLocations != null) { - Utils.ValueHolder> out = Utils.ValueHolder.initialize(nextLocationInfo.availableWriteLocations); - nextLocationInfo.availableWriteEndpointByLocation = this.getEndpointByLocation(writeLocations, out); - nextLocationInfo.availableWriteLocations = out.v; - } - - nextLocationInfo.writeEndpoints = this.getPreferredAvailableEndpoints(nextLocationInfo.availableWriteEndpointByLocation, nextLocationInfo.availableWriteLocations, OperationType.Write, this.defaultEndpoint); - nextLocationInfo.readEndpoints = this.getPreferredAvailableEndpoints(nextLocationInfo.availableReadEndpointByLocation, nextLocationInfo.availableReadLocations, OperationType.Read, nextLocationInfo.writeEndpoints.get(0)); - this.lastCacheUpdateTimestamp = Instant.now(); - - logger.debug("updating location cache finished, new readLocations [{}], new writeLocations [{}]", - nextLocationInfo.readEndpoints, nextLocationInfo.writeEndpoints); - this.locationInfo = nextLocationInfo; - } - } - - private UnmodifiableList getPreferredAvailableEndpoints(UnmodifiableMap endpointsByLocation, - UnmodifiableList orderedLocations, - OperationType expectedAvailableOperation, - URL fallbackEndpoint) { - List endpoints = new ArrayList<>(); - DatabaseAccountLocationsInfo currentLocationInfo = this.locationInfo; - // if enableEndpointDiscovery is false, we always use the defaultEndpoint that user passed in during documentClient init - if (this.enableEndpointDiscovery) { - if (this.canUseMultipleWriteLocations() || expectedAvailableOperation.supports(OperationType.Read)) { - List unavailableEndpoints = new ArrayList<>(); - - // When client can not use multiple write locations, preferred locations list should only be used - // determining read endpoints order. - // If client can use multiple write locations, preferred locations list should be used for determining - // both read and write endpoints order. - - for (String location: currentLocationInfo.preferredLocations) { - Utils.ValueHolder endpoint = new Utils.ValueHolder<>(); - if (Utils.tryGetValue(endpointsByLocation, location, endpoint)) { - if (this.isEndpointUnavailable(endpoint.v, expectedAvailableOperation)) { - unavailableEndpoints.add(endpoint.v); - } else { - endpoints.add(endpoint.v); - } - } - } - - if (endpoints.isEmpty()) { - endpoints.add(fallbackEndpoint); - } - - endpoints.addAll(unavailableEndpoints); - } else { - for (String location : orderedLocations) { - - Utils.ValueHolder endpoint = Utils.ValueHolder.initialize(null); - if (!Strings.isNullOrEmpty(location) && // location is empty during manual failover - Utils.tryGetValue(endpointsByLocation, location, endpoint)) { - endpoints.add(endpoint.v); - } - } - } - } - - if (endpoints.isEmpty()) { - endpoints.add(fallbackEndpoint); - } - - return new UnmodifiableList(endpoints); - } - - private UnmodifiableMap getEndpointByLocation(Iterable locations, - Utils.ValueHolder> orderedLocations) { - Map endpointsByLocation = new CaseInsensitiveMap<>(); - List parsedLocations = new ArrayList<>(); - - for (DatabaseAccountLocation location: locations) { - if (!Strings.isNullOrEmpty(location.getName())) { - try { - URL endpoint = new URL(location.getEndpoint().toLowerCase()); - endpointsByLocation.put(location.getName().toLowerCase(), endpoint); - parsedLocations.add(location.getName()); - - } catch (Exception e) { - logger.warn("GetAvailableEndpointsByLocation() - skipping add for location = [{}] as it is location name is either empty or endpoint is malformed [{}]", - location.getName(), - location.getEndpoint()); - } - } - } - - orderedLocations.v = new UnmodifiableList(parsedLocations); - return (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(endpointsByLocation); - } - - private boolean canUseMultipleWriteLocations() { - return this.useMultipleWriteLocations && this.enableMultipleWriteLocations; - } - - public boolean canUseMultipleWriteLocations(RxDocumentServiceRequest request) { - return this.canUseMultipleWriteLocations() && - (request.getResourceType() == ResourceType.Document || - (request.getResourceType() == ResourceType.StoredProcedure && request.getOperationType() == - com.microsoft.azure.cosmosdb.internal.OperationType.ExecuteJavaScript)); - } - - - private class LocationUnavailabilityInfo { - LocationUnavailabilityInfo(Instant instant, OperationType type) { - this.LastUnavailabilityCheckTimeStamp = instant; - this.UnavailableOperations = type; - } - - public Instant LastUnavailabilityCheckTimeStamp; - public OperationType UnavailableOperations; - } - - private enum OperationType { - None(0x0), - Read(0x1), - Write(0x2), - ReadAndWrite(0x3); - - private final int flag; - - public boolean hasReadFlag() { - return (flag & Read.flag) != 0; - } - - public boolean hasWriteFlag() { - return (flag & Write.flag) != 0; - } - - public static OperationType combine(OperationType t1, OperationType t2) { - switch (t1.flag | t2.flag) { - case 0x0: - return None; - case 0x1: - return Read; - case 0x2: - return Write; - default: - return ReadAndWrite; - } - } - - public boolean supports(OperationType type) { - return (flag & type.flag) != 0; - } - - OperationType(int flag) { - this.flag = flag; - } - } - - private boolean durationPassed(Instant end, Instant start, Duration duration) { - return end.minus(duration).isAfter(start); - } - - private boolean unavailableLocationsExpirationTimePassed() { - return durationPassed(Instant.now(), this.lastCacheUpdateTimestamp, this.unavailableLocationsExpirationTime); - } - - class DatabaseAccountLocationsInfo { - private UnmodifiableList preferredLocations; - // lower-case region - private UnmodifiableList availableWriteLocations; - // lower-case region - private UnmodifiableList availableReadLocations; - private UnmodifiableMap availableWriteEndpointByLocation; - private UnmodifiableMap availableReadEndpointByLocation; - - private UnmodifiableList writeEndpoints; - private UnmodifiableList readEndpoints; - - public DatabaseAccountLocationsInfo(List preferredLocations, - URL defaultEndpoint) { - this.preferredLocations = new UnmodifiableList<>(preferredLocations.stream().map(loc -> loc.toLowerCase()).collect(Collectors.toList())); - this.availableWriteEndpointByLocation = (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(new CaseInsensitiveMap<>()); - this.availableReadEndpointByLocation = (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(new CaseInsensitiveMap<>()); - this.availableReadLocations = new UnmodifiableList<>(Collections.emptyList()); - this.availableWriteLocations = new UnmodifiableList<>(Collections.emptyList()); - this.readEndpoints = new UnmodifiableList<>(Collections.singletonList(defaultEndpoint)); - this.writeEndpoints = new UnmodifiableList<>(Collections.singletonList(defaultEndpoint)); - } - - public DatabaseAccountLocationsInfo(DatabaseAccountLocationsInfo other) { - this.preferredLocations = other.preferredLocations; - this.availableWriteLocations = other.availableWriteLocations; - this.availableReadLocations = other.availableReadLocations; - this.availableWriteEndpointByLocation = other.availableWriteEndpointByLocation; - this.availableReadEndpointByLocation = other.availableReadEndpointByLocation; - this.writeEndpoints = other.writeEndpoints; - this.readEndpoints = other.readEndpoints; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProvider.java deleted file mode 100644 index ce7be3bdf86c..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.Collection; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; - -/** - * Used internally in request routing in the Azure Cosmos DB database service. - */ -public interface RoutingMapProvider { - Collection getOverlappingRanges(String collectionSelfLink, Range range, boolean forceRefresh); - - PartitionKeyRange tryGetRangeByEffectivePartitionKey(String collectionSelfLink, String effectivePartitionKey); - - PartitionKeyRange getPartitionKeyRangeById(String collectionSelfLink, String partitionKeyRangeId, boolean forceRefresh); - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelper.java deleted file mode 100644 index ef4311699fa3..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelper.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; - -/** - * Provide utility functionality to route request in direct connectivity mode in the Azure Cosmos DB database service. - */ -public final class RoutingMapProviderHelper { - private static final Range.MaxComparator MAX_COMPARATOR = new Range.MaxComparator(); - - private static String max(String left, String right) { - return left.compareTo(right) < 0 ? right : left; - } - - private static > boolean IsSortedAndNonOverlapping(List> list) { - for (int i = 1; i < list.size(); i++) { - Range previousRange = list.get(i - 1); - Range currentRange = list.get(i); - - int compareResult = previousRange.getMax().compareTo(currentRange.getMin()); - if (compareResult > 0) { - return false; - } else if (compareResult == 0 && previousRange.isMaxInclusive() && currentRange.isMinInclusive()) { - return false; - } - } - - return true; - } - - public static Collection getOverlappingRanges(RoutingMapProvider routingMapProvider, - String collectionSelfLink, List> sortedRanges) { - if (!IsSortedAndNonOverlapping(sortedRanges)) { - throw new IllegalArgumentException("sortedRanges"); - } - - List targetRanges = new ArrayList(); - int currentProvidedRange = 0; - while (currentProvidedRange < sortedRanges.size()) { - if (sortedRanges.get(currentProvidedRange).isEmpty()) { - currentProvidedRange++; - continue; - } - - Range queryRange; - if (!targetRanges.isEmpty()) { - String left = max(targetRanges.get(targetRanges.size() - 1).getMaxExclusive(), - sortedRanges.get(currentProvidedRange).getMin()); - - boolean leftInclusive = left.compareTo(sortedRanges.get(currentProvidedRange).getMin()) == 0 - ? sortedRanges.get(currentProvidedRange).isMinInclusive() : false; - - queryRange = new Range(left, sortedRanges.get(currentProvidedRange).getMax(), leftInclusive, - sortedRanges.get(currentProvidedRange).isMaxInclusive()); - } else { - queryRange = sortedRanges.get(currentProvidedRange); - } - - targetRanges.addAll(routingMapProvider.getOverlappingRanges(collectionSelfLink, queryRange, false)); - - Range lastKnownTargetRange = targetRanges.get(targetRanges.size() - 1).toRange(); - while (currentProvidedRange < sortedRanges.size() - && MAX_COMPARATOR.compare(sortedRanges.get(currentProvidedRange), lastKnownTargetRange) <= 0) { - currentProvidedRange++; - } - } - - return targetRanges; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BackoffRetryUtility.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BackoffRetryUtility.java deleted file mode 100644 index e5240e2fd093..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BackoffRetryUtility.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; - - -import com.microsoft.azure.cosmosdb.internal.Quadruple; - -import rx.Observable; -import rx.Single; -import rx.functions.Action1; -import rx.functions.Func0; -import rx.functions.Func1; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class BackoffRetryUtility { - - // transforms a retryFunc to a function which can be used by Observable.retryWhen(.) - // also it invokes preRetryCallback prior to doing retry. - public static final Quadruple InitialArgumentValuePolicyArg = Quadruple.with(false, false, - Duration.ofSeconds(60), 0); - - static Func1, Observable> toRetryWhenFunc( - Func1> retryFunc, Action1 preRetryCallback) { - - return new Func1, Observable>() { - - @Override - public Observable call(Observable t) { - - return t.flatMap(f -> { - Exception e = Utils.as(f, Exception.class); - if (e instanceof Exception) { - if (preRetryCallback != null) { - - // TODO: is retry callback invoked immediately on the same thread? - // we should verify this - return retryFunc.call(e).doOnSuccess(v -> preRetryCallback.call(e)).toObservable(); - } else { - return retryFunc.call(e).toObservable(); - } - } else { - return Observable.error(f); - } - }); - } - }; - } - - @SuppressWarnings("unused") - static private Single executeRetry(Func0> callbackMethod, - Func1> callShouldRetry, Action1 preRetryCallback) { - - return Single.defer(() -> { - return callbackMethod.call(); - - }).retryWhen(toRetryWhenFunc(callShouldRetry, preRetryCallback)); - } - - // a helper method for invoking callback method given the retry policy. - // it also invokes the pre retry callback prior to retrying - static public Single executeRetry(Func0> callbackMethod, - IRetryPolicy retryPolicy, - Action1 preRetryCallback) { - - return Single.defer(() -> { - // TODO: is defer required? - return callbackMethod.call(); - }).retryWhen(RetryUtils.toRetryWhenFunc(retryPolicy)); - } - - // a helper method for invoking callback method given the retry policy - static public Single executeRetry(Func0> callbackMethod, - IRetryPolicy retryPolicy) { - - return Single.defer(() -> { - // TODO: is defer required? - return callbackMethod.call(); - }).retryWhen(RetryUtils.toRetryWhenFunc(retryPolicy)); - } - - static public Single executeAsync( - Func1, Single> callbackMethod, IRetryPolicy retryPolicy, - Func1, Single> inBackoffAlternateCallbackMethod, - Duration minBackoffForInBackoffCallback) { - Quadruple policyArg1 = InitialArgumentValuePolicyArg; - - return Single.defer(() -> { - // TODO: is defer required? - return callbackMethod.call(policyArg1).onErrorResumeNext( - RetryUtils.toRetryWithAlternateFunc(callbackMethod,retryPolicy, inBackoffAlternateCallbackMethod,minBackoffForInBackoffCallback)); - }); - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClearingSessionContainerClientRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClearingSessionContainerClientRetryPolicy.java deleted file mode 100644 index 0ba6bb83f53e..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClearingSessionContainerClientRetryPolicy.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * This retry policy is designed to work with in a pair with ClientRetryPolicy. - * The inner retryPolicy must be a ClientRetryPolicy or a retry policy delegating to it. - * - * The expectation that is the outer retry policy in the retry policy chain and nobody can overwrite ShouldRetryResult. - * Once we clear the session we expect call to fail and throw exception to the client. Otherwise we may violate session consistency. - */ -public class ClearingSessionContainerClientRetryPolicy implements IDocumentClientRetryPolicy { - - private final static Logger logger = LoggerFactory.getLogger(ClearingSessionContainerClientRetryPolicy.class); - - private final IDocumentClientRetryPolicy retryPolicy; - private final ISessionContainer sessionContainer; - private RxDocumentServiceRequest request; - private boolean hasTriggered = false; - - public ClearingSessionContainerClientRetryPolicy(ISessionContainer sessionContainer, IDocumentClientRetryPolicy retryPolicy) { - this.sessionContainer = sessionContainer; - this.retryPolicy = retryPolicy; - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - this.request = request; - this.retryPolicy.onBeforeSendRequest(request); - } - - @Override - public Single shouldRetry(Exception e) { - - return this.retryPolicy.shouldRetry(e).flatMap(shouldRetryResult -> { - - if (!shouldRetryResult.shouldRetry && !this.hasTriggered) - { - DocumentClientException clientException = Utils.as(e, DocumentClientException.class); - - if (this.request == null) { - // someone didn't call OnBeforeSendRequest - nothing we can do - logger.error("onBeforeSendRequest is not invoked, encountered failure due to request being null", e); - return Single.just(ShouldRetryResult.error(e)); - } - - if (clientException != null && this.request.getIsNameBased() && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.NOTFOUND) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)) - { - // Clear the session token, because the collection name might be reused. - logger.warn("Clear the token for named base request {}", request.getResourceAddress()); - - this.sessionContainer.clearTokenByCollectionFullName(request.getResourceAddress()); - - this.hasTriggered = true; - } - } - - return Single.just(shouldRetryResult); - }); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicy.java deleted file mode 100644 index a4297517e1a3..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicy.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WebExceptionUtility; -import org.apache.commons.collections4.list.UnmodifiableList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -import java.net.URL; -import java.time.Duration; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * Client policy is combination of endpoint change retry + throttling retry. - */ -public class ClientRetryPolicy implements IDocumentClientRetryPolicy { - - private final static Logger logger = LoggerFactory.getLogger(ClientRetryPolicy.class); - - final static int RetryIntervalInMS = 1000; //Once we detect failover wait for 1 second before retrying request. - final static int MaxRetryCount = 120; - - private final IDocumentClientRetryPolicy throttlingRetry; - private final ConnectionPoolExhaustedRetry rxNettyConnectionPoolExhaustedRetry; - private final GlobalEndpointManager globalEndpointManager; - private final boolean enableEndpointDiscovery; - private int failoverRetryCount; - - private int sessionTokenRetryCount; - private boolean isReadRequest; - private boolean canUseMultipleWriteLocations; - private URL locationEndpoint; - private RetryContext retryContext; - private ClientSideRequestStatistics clientSideRequestStatistics; - - public ClientRetryPolicy(GlobalEndpointManager globalEndpointManager, - boolean enableEndpointDiscovery, - RetryOptions retryOptions) { - - this.throttlingRetry = new ResourceThrottleRetryPolicy( - retryOptions.getMaxRetryAttemptsOnThrottledRequests(), - retryOptions.getMaxRetryWaitTimeInSeconds()); - this.rxNettyConnectionPoolExhaustedRetry = new ConnectionPoolExhaustedRetry(); - this.globalEndpointManager = globalEndpointManager; - this.failoverRetryCount = 0; - this.enableEndpointDiscovery = enableEndpointDiscovery; - this.sessionTokenRetryCount = 0; - this.canUseMultipleWriteLocations = false; - this.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - - @Override - public Single shouldRetry(Exception e) { - if (this.locationEndpoint == null) { - // on before request is not invoked because Document Service Request creation failed. - logger.error("locationEndpoint is null because ClientRetryPolicy::onBeforeRequest(.) is not invoked, " + - "probably request creation failed due to invalid options, serialization setting, etc."); - return Single.just(ShouldRetryResult.error(e)); - } - - if (ConnectionPoolExhaustedRetry.isConnectionPoolExhaustedException(e)) { - return rxNettyConnectionPoolExhaustedRetry.shouldRetry(e); - } - - this.retryContext = null; - // Received 403.3 on write region, initiate the endpoint re-discovery - DocumentClientException clientException = Utils.as(e, DocumentClientException.class); - if (clientException != null && clientException.getClientSideRequestStatistics() != null) { - this.clientSideRequestStatistics = clientException.getClientSideRequestStatistics(); - } - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.FORBIDDEN) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.FORBIDDEN_WRITEFORBIDDEN)) - { - logger.warn("Endpoint not writable. Will refresh cache and retry. {}", e.toString()); - return this.shouldRetryOnEndpointFailureAsync(false); - } - - // Regional endpoint is not available yet for reads (e.g. add/ online of region is in progress) - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.FORBIDDEN) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.DATABASE_ACCOUNT_NOTFOUND) && - this.isReadRequest) - { - logger.warn("Endpoint not available for reads. Will refresh cache and retry. {}", e.toString()); - return this.shouldRetryOnEndpointFailureAsync(true); - } - - // Received Connection error (HttpRequestException), initiate the endpoint rediscovery - if (WebExceptionUtility.isNetworkFailure(e)) { - logger.warn("Endpoint not reachable. Will refresh cache and retry. {}" , e.toString()); - return this.shouldRetryOnEndpointFailureAsync(this.isReadRequest); - } - - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.NOTFOUND) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)) { - return Single.just(this.shouldRetryOnSessionNotAvailable()); - } - - return this.throttlingRetry.shouldRetry(e); - } - - private ShouldRetryResult shouldRetryOnSessionNotAvailable() { - this.sessionTokenRetryCount++; - - if (!this.enableEndpointDiscovery) { - // if endpoint discovery is disabled, the request cannot be retried anywhere else - return ShouldRetryResult.noRetry(); - } else { - if (this.canUseMultipleWriteLocations) { - UnmodifiableList endpoints = this.isReadRequest ? this.globalEndpointManager.getReadEndpoints() : this.globalEndpointManager.getWriteEndpoints(); - - if (this.sessionTokenRetryCount > endpoints.size()) { - // When use multiple write locations is true and the request has been tried - // on all locations, then don't retry the request - return ShouldRetryResult.noRetry(); - } else { - this.retryContext = new RetryContext(this.sessionTokenRetryCount - 1, this.sessionTokenRetryCount > 1); - return ShouldRetryResult.retryAfter(Duration.ZERO); - } - } else { - if (this.sessionTokenRetryCount > 1) { - // When cannot use multiple write locations, then don't retry the request if - // we have already tried this request on the write location - return ShouldRetryResult.noRetry(); - } else { - this.retryContext = new RetryContext(this.sessionTokenRetryCount - 1, false); - return ShouldRetryResult.retryAfter(Duration.ZERO); - } - } - } - } - - private Single shouldRetryOnEndpointFailureAsync(boolean isReadRequest) { - if (!this.enableEndpointDiscovery || this.failoverRetryCount > MaxRetryCount) { - logger.warn("ShouldRetryOnEndpointFailureAsync() Not retrying. Retry count = {}", this.failoverRetryCount); - return Single.just(ShouldRetryResult.noRetry()); - } - - this.failoverRetryCount++; - - // Mark the current read endpoint as unavailable - if (this.isReadRequest) { - logger.warn("marking the endpoint {} as unavailable for read",this.locationEndpoint); - this.globalEndpointManager.markEndpointUnavailableForRead(this.locationEndpoint); - } else { - logger.warn("marking the endpoint {} as unavailable for write",this.locationEndpoint); - this.globalEndpointManager.markEndpointUnavailableForWrite(this.locationEndpoint); - } - - // Some requests may be in progress when the endpoint manager and client are closed. - // In that case, the request won't succeed since the http client is closed. - // Therefore just skip the retry here to avoid the delay because retrying won't go through in the end. - - Duration retryDelay = Duration.ZERO; - if (!this.isReadRequest) { - logger.debug("Failover happening. retryCount {}", this.failoverRetryCount); - if (this.failoverRetryCount > 1) { - //if retried both endpoints, follow regular retry interval. - retryDelay = Duration.ofMillis(ClientRetryPolicy.RetryIntervalInMS); - } - } else { - retryDelay = Duration.ofMillis(ClientRetryPolicy.RetryIntervalInMS); - } - this.retryContext = new RetryContext(this.failoverRetryCount, false); - return this.globalEndpointManager.refreshLocationAsync(null) - .andThen(Single.just(ShouldRetryResult.retryAfter(retryDelay))); - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - this.isReadRequest = request.isReadOnlyRequest(); - this.canUseMultipleWriteLocations = this.globalEndpointManager.CanUseMultipleWriteLocations(request); - if (request.requestContext != null) { - request.requestContext.clientSideRequestStatistics = this.clientSideRequestStatistics; - } - - // clear previous location-based routing directive - if (request.requestContext != null) { - request.requestContext.ClearRouteToLocation(); - } - if (this.retryContext != null) { - // set location-based routing directive based on request retry context - request.requestContext.RouteToLocation(this.retryContext.retryCount, this.retryContext.retryRequestOnPreferredLocations); - } - - // Resolve the endpoint for the request and pin the resolution to the resolved endpoint - // This enables marking the endpoint unavailability on endpoint failover/unreachability - this.locationEndpoint = this.globalEndpointManager.resolveServiceEndpoint(request); - if (request.requestContext != null) { - request.requestContext.RouteToLocation(this.locationEndpoint); - } - } - private class RetryContext { - - public int retryCount; - public boolean retryRequestOnPreferredLocations; - - public RetryContext(int retryCount, - boolean retryRequestOnPreferredLocations) { - this.retryCount = retryCount; - this.retryRequestOnPreferredLocations = retryRequestOnPreferredLocations; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetry.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetry.java deleted file mode 100644 index 5f2e166e6ddb..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetry.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import io.reactivex.netty.client.PoolExhaustedException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -import java.time.Duration; - -// rxnetty in servicing a new request throws PoolExhaustedException -// if all connections are in used and max connection pool size is configured. -class ConnectionPoolExhaustedRetry implements IDocumentClientRetryPolicy { - private static final Logger logger = LoggerFactory.getLogger(ConnectionPoolExhaustedRetry.class); - static final Duration RETRY_WAIT_TIME = Duration.ofMillis(10); - static final int MAX_RETRY_COUNT = 10; - - private int retryCount = 0; - - @Override - public Single shouldRetry(Exception e) { - boolean isConnectionPoolExhaustedException = isConnectionPoolExhaustedException(e); - assert isConnectionPoolExhaustedException; - if (!isConnectionPoolExhaustedException) { - logger.error("Fatal error invalid retry path for {}", e.getMessage(), e); - return Single.just(ShouldRetryResult.error(e)); - } - - if (++retryCount <= MAX_RETRY_COUNT) { - logger.warn("PoolExhaustedException failure indicates" + - " the load on the SDK is higher than what current connection pool size can support" + - " either increase the connection pool size for the configured connection mode," + - " or distribute the load on more machines. retry count {}", retryCount); - return Single.just(ShouldRetryResult.retryAfter(RETRY_WAIT_TIME)); - } else { - logger.error("PoolExhaustedException failure indicates" + - " the load on the SDK is higher than what current connection pool size can support" + - " either increase the connection pool size for the configured connection mode," + - " or distribute the load on more machines. All retries exhausted!"); - return Single.just(ShouldRetryResult.error(e)); - } - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - // no op - } - - static boolean isConnectionPoolExhaustedException(Exception ex) { - while (ex != null) { - if (ex instanceof PoolExhaustedException) { - return true; - } - - Throwable t = ex.getCause(); - if (!(t instanceof Exception)) { - break; - } - - ex = (Exception) t; - } - - return false; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/GlobalEndpointManager.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/GlobalEndpointManager.java deleted file mode 100644 index 6e304f39b7a9..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/GlobalEndpointManager.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.DatabaseAccountManagerInternal; -import com.microsoft.azure.cosmosdb.internal.routing.LocationCache; -import com.microsoft.azure.cosmosdb.rx.internal.routing.LocationHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Completable; -import rx.Observable; -import rx.Scheduler; -import rx.Single; -import rx.functions.Func1; -import rx.schedulers.Schedulers; -import org.apache.commons.collections4.list.UnmodifiableList; - - -import java.net.URISyntaxException; -import java.net.URL; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * Endpoint region cache manager implementation. Supports cross region address routing based on - * availability and preference list. - */ -public class GlobalEndpointManager implements AutoCloseable { - private static final Logger logger = LoggerFactory.getLogger(GlobalEndpointManager.class); - - private final int backgroundRefreshLocationTimeIntervalInMS; - private final LocationCache locationCache; - private final URL defaultEndpoint; - private final ConnectionPolicy connectionPolicy; - private final DatabaseAccountManagerInternal owner; - private final AtomicBoolean isRefreshing; - private final ExecutorService executor = Executors.newSingleThreadExecutor(); - private final Scheduler scheduler = Schedulers.from(executor); - private volatile boolean isClosed; - - public GlobalEndpointManager(DatabaseAccountManagerInternal owner, ConnectionPolicy connectionPolicy, Configs configs) { - this.backgroundRefreshLocationTimeIntervalInMS = configs.getUnavailableLocationsExpirationTimeInSeconds() * 1000; - try { - this.locationCache = new LocationCache( - new ArrayList<>(connectionPolicy.getPreferredLocations() != null ? - connectionPolicy.getPreferredLocations(): - Collections.emptyList() - ), - owner.getServiceEndpoint().toURL(), - connectionPolicy.getEnableEndpointDiscovery(), - BridgeInternal.getUseMultipleWriteLocations(connectionPolicy), - configs); - - this.owner = owner; - this.defaultEndpoint = owner.getServiceEndpoint().toURL(); - this.connectionPolicy = connectionPolicy; - - this.isRefreshing = new AtomicBoolean(false); - this.isClosed = false; - } catch (Exception e) { - throw new IllegalArgumentException(e); - } - } - - public void init() { - // TODO: add support for openAsync - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/332589 - startRefreshLocationTimerAsync(true).toCompletable().await(); - } - - public UnmodifiableList getReadEndpoints() { - // readonly - return this.locationCache.getReadEndpoints(); - } - - public UnmodifiableList getWriteEndpoints() { - //readonly - return this.locationCache.getWriteEndpoints(); - } - - public static Single getDatabaseAccountFromAnyLocationsAsync( - URL defaultEndpoint, List locations, Func1> getDatabaseAccountFn) { - - return getDatabaseAccountFn.call(defaultEndpoint).onErrorResumeNext( - e -> { - logger.error("Fail to reach global gateway [{}], [{}]", defaultEndpoint, e.getMessage()); - if (locations.isEmpty()) { - return Single.error(e); - } - - Observable> obs = Observable.range(0, locations.size()) - .map(index -> getDatabaseAccountFn.call(LocationHelper.getLocationEndpoint(defaultEndpoint, locations.get(index))).toObservable()); - - // iterate and get the database account from the first non failure, otherwise get the last error. - Observable res = Observable.concatDelayError(obs).first().single(); - return res.toSingle().doOnError( - innerE -> { - logger.error("Fail to reach location any of locations", String.join(",", locations), innerE.getMessage()); - }); - }); - } - - public URL resolveServiceEndpoint(RxDocumentServiceRequest request) { - return this.locationCache.resolveServiceEndpoint(request); - } - - public void markEndpointUnavailableForRead(URL endpoint) { - logger.debug("Marking endpoint {} unavailable for read",endpoint); - this.locationCache.markEndpointUnavailableForRead(endpoint);; - } - - public void markEndpointUnavailableForWrite(URL endpoint) { - logger.debug("Marking endpoint {} unavailable for Write",endpoint); - this.locationCache.markEndpointUnavailableForWrite(endpoint); - } - - public boolean CanUseMultipleWriteLocations(RxDocumentServiceRequest request) { - return this.locationCache.canUseMultipleWriteLocations(request); - } - - public void close() { - this.isClosed = true; - this.executor.shutdown(); - logger.debug("GlobalEndpointManager closed."); - } - - public Completable refreshLocationAsync(DatabaseAccount databaseAccount) { - return Completable.defer(() -> { - logger.debug("refreshLocationAsync() invoked"); - if (!isRefreshing.compareAndSet(false, true)) { - logger.debug("in the middle of another refresh. Not invoking a new refresh."); - return Completable.complete(); - } - - logger.debug("will refresh"); - return this.refreshLocationPrivateAsync(databaseAccount).doOnError(e -> this.isRefreshing.set(false)); - }); - } - - private Completable refreshLocationPrivateAsync(DatabaseAccount databaseAccount) { - return Completable.defer(() -> { - logger.debug("refreshLocationPrivateAsync() refreshing locations"); - - if (databaseAccount != null) { - this.locationCache.onDatabaseAccountRead(databaseAccount); - } - - Utils.ValueHolder canRefreshInBackground = new Utils.ValueHolder(); - if (this.locationCache.shouldRefreshEndpoints(canRefreshInBackground)) { - logger.debug("shouldRefreshEndpoints: true"); - - if (databaseAccount == null && !canRefreshInBackground.v) { - logger.debug("shouldRefreshEndpoints: can't be done in background"); - - Single databaseAccountObs = getDatabaseAccountFromAnyLocationsAsync( - this.defaultEndpoint, - new ArrayList<>(this.connectionPolicy.getPreferredLocations()), - url -> this.getDatabaseAccountAsync(url)); - - return databaseAccountObs.map(dbAccount -> { - this.locationCache.onDatabaseAccountRead(dbAccount); - return dbAccount; - }).flatMapCompletable(dbAccount -> { - // trigger a startRefreshLocationTimerAsync don't wait on it. - this.startRefreshLocationTimerAsync(); - return Completable.complete(); - }); - } - - // trigger a startRefreshLocationTimerAsync don't wait on it. - this.startRefreshLocationTimerAsync(); - - return Completable.complete(); - } else { - logger.debug("shouldRefreshEndpoints: false, nothing to do."); - this.isRefreshing.set(false); - return Completable.complete(); - } - }); - } - - private void startRefreshLocationTimerAsync() { - startRefreshLocationTimerAsync(false).subscribe(); - } - - private Observable startRefreshLocationTimerAsync(boolean initialization) { - - if (this.isClosed) { - logger.debug("startRefreshLocationTimerAsync: nothing to do, it is closed"); - // if client is already closed, nothing to be done, just return. - return Observable.empty(); - } - - logger.debug("registering a refresh in [{}] ms", this.backgroundRefreshLocationTimeIntervalInMS); - LocalDateTime now = LocalDateTime.now(); - - int delayInMillis = initialization ? 0: this.backgroundRefreshLocationTimeIntervalInMS; - - return Observable.timer(delayInMillis, TimeUnit.MILLISECONDS) - .toSingle().flatMapCompletable( - t -> { - if (this.isClosed) { - logger.warn("client already closed"); - // if client is already closed, nothing to be done, just return. - return Completable.complete(); - } - - logger.debug("startRefreshLocationTimerAsync() - Invoking refresh, I was registered on [{}]", now); - Single databaseAccountObs = GlobalEndpointManager.getDatabaseAccountFromAnyLocationsAsync(this.defaultEndpoint, new ArrayList<>(this.connectionPolicy.getPreferredLocations()), - url -> this.getDatabaseAccountAsync(url)).toObservable().toSingle(); - - return databaseAccountObs.flatMapCompletable(dbAccount -> { - logger.debug("db account retrieved"); - return this.refreshLocationPrivateAsync(dbAccount); - }); - }).onErrorResumeNext(ex -> { - logger.error("startRefreshLocationTimerAsync() - Unable to refresh database account from any location. Exception: {}", ex.toString(), ex); - - this.startRefreshLocationTimerAsync(); - return Completable.complete(); - }).toObservable().subscribeOn(scheduler); - } - - private Single getDatabaseAccountAsync(URL serviceEndpoint) { - try { - return this.owner.getDatabaseAccountFromEndpoint(serviceEndpoint.toURI()) - .doOnNext(i -> logger.debug("account retrieved: {}", i)).toSingle(); - } catch (URISyntaxException e) { - return Single.error(e); - } - } - - public boolean isClosed() { - return this.isClosed; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IAuthorizationTokenProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IAuthorizationTokenProvider.java deleted file mode 100644 index d67b23f6bbe1..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IAuthorizationTokenProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.util.Map; - -import com.microsoft.azure.cosmosdb.internal.ResourceType; - -public interface IAuthorizationTokenProvider { - String getUserAuthorizationToken(String resourceAddress, - ResourceType resourceType, - String get, - Map headers, - AuthorizationTokenType primarymasterkey, - Map properties); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ICollectionRoutingMapCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ICollectionRoutingMapCache.java deleted file mode 100644 index bd34d1b82d97..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ICollectionRoutingMapCache.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; - -import rx.Single; - -import java.util.Map; - -// TODO: add documentation -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - **/ -public interface ICollectionRoutingMapCache { - default Single tryLookupAsync( - String collectionRid, - CollectionRoutingMap previousValue, - Map properties) { - return tryLookupAsync(collectionRid, previousValue, false, properties); - } - - Single tryLookupAsync( - String collectionRid, - CollectionRoutingMap previousValue, - boolean forceRefreshCollectionRoutingMap, - Map properties); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IDocumentClientRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IDocumentClientRetryPolicy.java deleted file mode 100644 index 7f78ad446cf5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IDocumentClientRetryPolicy.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IDocumentClientRetryPolicy extends IRetryPolicy { - - // TODO: this is just a place holder for now. As .Net has this method. - // I have to spend more time figure out what's the right pattern for this (if method needed) - - /// - /// Method that is called before a request is sent to allow the retry policy implementation - /// to modify the state of the request. - /// - /// The request being sent to the service. - /// - /// Currently only read operations will invoke this method. There is no scenario for write - /// operations to modify requests before retrying. - /// - - // TODO: I need to investigate what's the right contract here and/or if/how this is useful - void onBeforeSendRequest(RxDocumentServiceRequest request); - - - class NoRetry implements IDocumentClientRetryPolicy { - - private static NoRetry instance = new NoRetry(); - - private NoRetry() {} - - public static NoRetry getInstance() { - return instance; - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - // no op - } - - @Override - public Single shouldRetry(Exception e) { - return Single.just(ShouldRetryResult.error(e)); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicy.java deleted file mode 100644 index 066e4f39509b..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicy.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; - -import com.microsoft.azure.cosmosdb.internal.Quadruple; - -import rx.Single; - -// TODO update documentation -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IRetryPolicy { - // this capture all the retry logic - // TODO: design decision should this return a single or an observable? - - /// - /// Method that is called to determine from the policy that needs to retry on the exception - /// - /// Exception during the callback method invocation - /// - /// If the retry needs to be attempted or not - Single shouldRetry(Exception e); - - - class ShouldRetryResult { - /// - /// How long to wait before next retry. 0 indicates retry immediately. - /// - public final Duration backOffTime; - public final Exception exception; - public boolean shouldRetry; - public final Quadruple policyArg; - - private ShouldRetryResult(Duration dur, Exception e, boolean shouldRetry, - Quadruple policyArg) { - this.backOffTime = dur; - this.exception = e; - this.shouldRetry = shouldRetry; - this.policyArg = policyArg; - } - - public static ShouldRetryResult retryAfter(Duration dur) { - Utils.checkNotNullOrThrow(dur, "duration", "cannot be null"); - return new ShouldRetryResult(dur, null, true, null); - } - - public static ShouldRetryResult retryAfter(Duration dur, - Quadruple policyArg) { - Utils.checkNotNullOrThrow(dur, "duration", "cannot be null"); - return new ShouldRetryResult(dur, null, true, policyArg); - } - - public static ShouldRetryResult error(Exception e) { - Utils.checkNotNullOrThrow(e, "exception", "cannot be null"); - return new ShouldRetryResult(null, e, false, null); - } - - public static ShouldRetryResult noRetry() { - return new ShouldRetryResult(null, null, false, null); - } - - public void throwIfDoneTrying(Exception capturedException) throws Exception { - if (this.shouldRetry) { - return; - } - - if (this.exception == null) { - throw capturedException; - } else { - throw this.exception; - } - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicyFactory.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicyFactory.java deleted file mode 100644 index 3c36fd5fa0c6..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicyFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IRetryPolicyFactory { - IDocumentClientRetryPolicy getRequestPolicy(); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRoutingMapProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRoutingMapProvider.java deleted file mode 100644 index 34f270b493fc..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRoutingMapProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.util.List; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.routing.Range; - -import rx.Single; - -//TODO: update documentation -//TODO: add two overload methods for forceRefresh = false -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - **/ -public interface IRoutingMapProvider { - /// - /// Returns list of effective partition key ranges for a collection. - /// - /// Collection for which to retrieve routing map. - /// This method will return all ranges which overlap this range. - /// Whether forcefully refreshing the routing map is necessary - /// List of effective partition key ranges for a collection or null if collection doesn't exist. - Single> tryGetOverlappingRangesAsync(String collectionResourceId, Range range, - boolean forceRefresh /* = false */, Map properties); - - Single tryGetPartitionKeyRangeByIdAsync(String collectionResourceId, String partitionKeyRangeId, - boolean forceRefresh /* = false */, Map properties); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionException.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionException.java deleted file mode 100644 index 2710eaf0cce5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionException.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class InvalidPartitionException extends DocumentClientException { - - private static final long serialVersionUID = 1L; - - public InvalidPartitionException() { - this(RMResources.Gone); - } - - public InvalidPartitionException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.GONE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public InvalidPartitionException(String msg) { - super(HttpConstants.StatusCodes.GONE, msg); - setSubStatus(); - } - - public InvalidPartitionException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.GONE, resourceAddress); - setSubStatus(); - } - - public InvalidPartitionException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public InvalidPartitionException(Exception innerException) { - this(RMResources.Gone, innerException, null, null); - } - - public InvalidPartitionException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Gone, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.GONE, - requestUri); - - setSubStatus(); - } - - private void setSubStatus() { - this.getResponseHeaders().put( - WFConstants.BackendHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE)); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionExceptionRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionExceptionRetryPolicy.java deleted file mode 100644 index cdd7540ddb08..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionExceptionRetryPolicy.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; - -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class InvalidPartitionExceptionRetryPolicy implements IDocumentClientRetryPolicy { - - private final RxCollectionCache clientCollectionCache; - private final IDocumentClientRetryPolicy nextPolicy; - private final String collectionLink; - private final FeedOptions feedOptions; - - private volatile boolean retried = false; - - public InvalidPartitionExceptionRetryPolicy(RxCollectionCache collectionCache, - IDocumentClientRetryPolicy nextPolicy, - String resourceFullName, - FeedOptions feedOptions) { - - this.clientCollectionCache = collectionCache; - this.nextPolicy = nextPolicy; - - // TODO the resource address should be inferred from exception - this.collectionLink = com.microsoft.azure.cosmosdb.internal.Utils.getCollectionName(resourceFullName); - this.feedOptions = feedOptions; - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - this.nextPolicy.onBeforeSendRequest(request); - } - - @Override - public Single shouldRetry(Exception e) { - DocumentClientException clientException = Utils.as(e, DocumentClientException.class); - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.GONE) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE)) { - if (!this.retried) { - // TODO: resource address should be accessible from the exception - //this.clientCollectionCache.Refresh(clientException.ResourceAddress); - // TODO: this is blocking. is that fine? - if(this.feedOptions != null) { - this.clientCollectionCache.refresh(collectionLink,this.feedOptions.getProperties()); - } else { - this.clientCollectionCache.refresh(collectionLink,null); - } - - this.retried = true; - return Single.just(ShouldRetryResult.retryAfter(Duration.ZERO)); - } else { - return Single.just(ShouldRetryResult.error(e)); - } - } - - return this.nextPolicy.shouldRetry(e); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/NotFoundException.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/NotFoundException.java deleted file mode 100644 index 3e949875c4d2..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/NotFoundException.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class NotFoundException extends DocumentClientException { - private static final long serialVersionUID = 1L; - - public NotFoundException() { - this(RMResources.NotFound); - } - - public NotFoundException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.NOTFOUND, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public NotFoundException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public NotFoundException(String message, Map headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public NotFoundException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public NotFoundException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public NotFoundException(Exception innerException) { - this(RMResources.NotFound, innerException, (Map) null, null); - } - - public NotFoundException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - this(message, innerException, HttpUtils.asMap(headers), requestUri); - } - - public NotFoundException(String message, - Exception innerException, - Map headers, - String requestUri) { - super(String.format("%s: %s", RMResources.NotFound, message), - innerException, - headers, - HttpConstants.StatusCodes.NOTFOUND, - requestUri); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ObservableHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ObservableHelper.java deleted file mode 100644 index 80bf892dedcd..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ObservableHelper.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import rx.Observable; -import rx.Single; -import rx.functions.Func0; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - **/ -public class ObservableHelper { - - static public Single inlineIfPossible(Func0> function, IRetryPolicy retryPolicy) { - - if (retryPolicy == null) { - // shortcut - return function.call(); - } else { - return BackoffRetryUtility.executeRetry(function, retryPolicy); - } - } - - static public Observable inlineIfPossibleAsObs(Func0> function, IRetryPolicy retryPolicy) { - - if (retryPolicy == null) { - // shortcut - return Observable.defer(() -> { - return function.call(); - }); - - } else { - return BackoffRetryUtility.executeRetry(() -> function.call().toSingle(), retryPolicy).toObservable(); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionIsMigratingException.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionIsMigratingException.java deleted file mode 100644 index adf2fe3217cc..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionIsMigratingException.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class PartitionIsMigratingException extends DocumentClientException { - - private static final long serialVersionUID = 1L; - - public PartitionIsMigratingException() { - this(RMResources.Gone); - } - - public PartitionIsMigratingException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.GONE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public PartitionIsMigratingException(String msg) { - super(HttpConstants.StatusCodes.GONE, msg); - setSubStatus(); - } - - public PartitionIsMigratingException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.GONE, resourceAddress); - setSubStatus(); - } - - public PartitionIsMigratingException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public PartitionIsMigratingException(Exception innerException) { - this(RMResources.Gone, innerException, null, null); - } - - public PartitionIsMigratingException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Gone, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.GONE, - requestUri); - - setSubStatus(); - } - - private void setSubStatus() { - this.getResponseHeaders().put( - WFConstants.BackendHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.COMPLETING_PARTITION_MIGRATION)); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyMismatchRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyMismatchRetryPolicy.java deleted file mode 100644 index 45dc11cc0d13..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyMismatchRetryPolicy.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; -import java.util.concurrent.atomic.AtomicInteger; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxClientCollectionCache; - -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * A RetryPolicy implementation that ensures the PartitionKeyDefinitionMap is up-to-date. - * Entries in the PartitionKeyDefinitionMap can become stale if a collection is deleted - * and then recreated with the same name but a different partition key definition, if - * the request is made using name-based links. - * - * TODO: verify with Sergii, other than collection deleted and recreated with the same name - * is there any other scenario which this should be used? - * - */ -public class PartitionKeyMismatchRetryPolicy implements IDocumentClientRetryPolicy { - private RxClientCollectionCache clientCollectionCache; - private IDocumentClientRetryPolicy nextRetryPolicy; - private AtomicInteger retriesAttempted = new AtomicInteger(0); - private String collectionLink; - private RequestOptions options; - private final static int MaxRetries = 1; - - - public PartitionKeyMismatchRetryPolicy( - RxClientCollectionCache clientCollectionCache, - IDocumentClientRetryPolicy nextRetryPolicy, - String resourceFullName, - RequestOptions requestOptions) { - this.clientCollectionCache = clientCollectionCache; - this.nextRetryPolicy = nextRetryPolicy; - - // TODO: this should be retrievable from document client exception. - collectionLink = com.microsoft.azure.cosmosdb.internal.Utils.getCollectionName(resourceFullName); - this.options = options; - } - - - /// - /// Should the caller retry the operation. - /// - /// Exception that occured when the operation was tried - /// - /// True indicates caller should retry, False otherwise - public Single shouldRetry(Exception exception) { - DocumentClientException clientException = Utils.as(exception, DocumentClientException.class) ; - - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.BADREQUEST) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.PARTITION_KEY_MISMATCH) - && this.retriesAttempted.get() < MaxRetries) { - //Debug.Assert(clientException.ResourceAddress != null); - - // TODO: - //this.clientCollectionCache.refresh(clientException.ResourceAddress); - if (this.options != null) { - this.clientCollectionCache.refresh(collectionLink, this.options.getProperties()); - } else { - this.clientCollectionCache.refresh(collectionLink, null); - } - - this.retriesAttempted.incrementAndGet(); - - return Single.just(ShouldRetryResult.retryAfter(Duration.ZERO)); - } - - return this.nextRetryPolicy.shouldRetry(exception); - } - - - /* (non-Javadoc) - * @see com.microsoft.azure.cosmosdb.rx.internal.query.IDocumentClientRetryPolicy#onBeforeSendRequest(rx.Observable) - */ - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - // TODO Auto-generated method stub - this.nextRetryPolicy.onBeforeSendRequest(request); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeGoneRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeGoneRetryPolicy.java deleted file mode 100644 index 3a2c60a5de24..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeGoneRetryPolicy.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache; - -import rx.Observable; -import rx.Single; - -// TODO: this need testing -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class PartitionKeyRangeGoneRetryPolicy implements IDocumentClientRetryPolicy { - - private final RxCollectionCache collectionCache; - private final IDocumentClientRetryPolicy nextRetryPolicy; - private final IPartitionKeyRangeCache partitionKeyRangeCache; - private final String collectionLink; - private final FeedOptions feedOptions; - private volatile boolean retried; - - public PartitionKeyRangeGoneRetryPolicy( - RxCollectionCache collectionCache, - IPartitionKeyRangeCache partitionKeyRangeCache, - String collectionLink, - IDocumentClientRetryPolicy nextRetryPolicy, - FeedOptions feedOptions) { - this.collectionCache = collectionCache; - this.partitionKeyRangeCache = partitionKeyRangeCache; - this.collectionLink = collectionLink; - this.nextRetryPolicy = nextRetryPolicy; - this.feedOptions = feedOptions; - } - - /// - /// Should the caller retry the operation. - /// - /// Exception that occured when the operation was tried - /// - /// True indicates caller should retry, False otherwise - public Single shouldRetry(Exception exception) { - DocumentClientException clientException = Utils.as(exception, DocumentClientException.class); - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.GONE) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE)) { - - if (this.retried){ - return Single.just(ShouldRetryResult.error(clientException)); - } - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - this.collectionLink, - null - // AuthorizationTokenType.PrimaryMasterKey) - ); - if (this.feedOptions != null) { - request.properties = this.feedOptions.getProperties(); - } - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - - Single retryTimeObservable = collectionObs.flatMap(collection -> { - - Single routingMapObs = this.partitionKeyRangeCache.tryLookupAsync(collection.getResourceId(), null, request.properties); - - Single refreshedRoutingMapObs = routingMapObs.flatMap(routingMap -> { - if (routingMap != null) { - // Force refresh. - return this.partitionKeyRangeCache.tryLookupAsync( - collection.getResourceId(), - routingMap, - request.properties); - } else { - return Observable.just((CollectionRoutingMap) null).toSingle(); - } - }); - - return refreshedRoutingMapObs.flatMap(rm -> { - this.retried = true; - return Single.just(ShouldRetryResult.retryAfter(Duration.ZERO)); - }); - - }); - return retryTimeObservable; - - } else { - return this.nextRetryPolicy.shouldRetry(exception); - } - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - this.nextRetryPolicy.onBeforeSendRequest(request); - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeIsSplittingException.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeIsSplittingException.java deleted file mode 100644 index c3a564fa083f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeIsSplittingException.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class PartitionKeyRangeIsSplittingException extends DocumentClientException { - - private static final long serialVersionUID = 1L; - - public PartitionKeyRangeIsSplittingException() { - this(RMResources.Gone); - } - - public PartitionKeyRangeIsSplittingException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.GONE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public PartitionKeyRangeIsSplittingException(String msg) { - super(HttpConstants.StatusCodes.GONE, msg); - setSubStatus(); - } - - public PartitionKeyRangeIsSplittingException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.GONE, resourceAddress); - setSubStatus(); - } - - public PartitionKeyRangeIsSplittingException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public PartitionKeyRangeIsSplittingException(Exception innerException) { - this(RMResources.Gone, innerException, null, null); - } - - public PartitionKeyRangeIsSplittingException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Gone, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.GONE, - requestUri); - - setSubStatus(); - } - - private void setSubStatus() { - this.getResponseHeaders().put( - WFConstants.BackendHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.COMPLETING_SPLIT)); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicy.java deleted file mode 100644 index 613bd70b07d5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicy.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxClientCollectionCache; - -import org.apache.commons.lang3.StringUtils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import rx.Single; - -import java.time.Duration; - -public class RenameCollectionAwareClientRetryPolicy implements IDocumentClientRetryPolicy { - - private final static Logger logger = LoggerFactory.getLogger(RenameCollectionAwareClientRetryPolicy.class); - - private final IDocumentClientRetryPolicy retryPolicy; - private final ISessionContainer sessionContainer; - private final RxClientCollectionCache collectionCache; - private RxDocumentServiceRequest request; - private boolean hasTriggered = false; - - public RenameCollectionAwareClientRetryPolicy(ISessionContainer sessionContainer, RxClientCollectionCache collectionCache, IDocumentClientRetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - this.sessionContainer = sessionContainer; - this.collectionCache = collectionCache; - this.request = null; - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - this.request = request; - this.retryPolicy.onBeforeSendRequest(request); - } - - @Override - public Single shouldRetry(Exception e) { - return this.retryPolicy.shouldRetry(e).flatMap(shouldRetryResult -> { - if (!shouldRetryResult.shouldRetry && !this.hasTriggered) { - DocumentClientException clientException = Utils.as(e, DocumentClientException.class); - - if (this.request == null) { - // someone didn't call OnBeforeSendRequest - nothing we can do - logger.error("onBeforeSendRequest is not invoked, encountered failure due to request being null", e); - return Single.just(ShouldRetryResult.error(e)); - } - - if (clientException != null && this.request.getIsNameBased() && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.NOTFOUND) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)) { - // Clear the session token, because the collection name might be reused. - logger.warn("Clear the token for named base request {}", request.getResourceAddress()); - - this.sessionContainer.clearTokenByCollectionFullName(request.getResourceAddress()); - - this.hasTriggered = true; - - String oldCollectionRid = request.requestContext.resolvedCollectionRid; - - request.forceNameCacheRefresh = true; - request.requestContext.resolvedCollectionRid = null; - - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - - return collectionObs.flatMap(collectionInfo -> { - if (collectionInfo == null) { - logger.warn("Can't recover from session unavailable exception because resolving collection name {} returned null", request.getResourceAddress()); - } else if (!StringUtils.isEmpty(oldCollectionRid) && !StringUtils.isEmpty(collectionInfo.getResourceId())) { - return Single.just(ShouldRetryResult.retryAfter(Duration.ZERO)); - } - return Single.just(shouldRetryResult); - }).onErrorResumeNext(throwable -> { - // When resolveCollectionAsync throws an exception ignore it because it's an attempt to recover an existing - // error. When the recovery fails we return ShouldRetryResult.noRetry and propagate the original exception to the client - - logger.warn("Can't recover from session unavailable exception because resolving collection name {} failed with {}", request.getResourceAddress(), throwable.getMessage()); - if (throwable instanceof Exception) { - return Single.just(ShouldRetryResult.error((Exception) throwable)); - } - return Single.error(throwable); - }); - } - } - return Single.just(shouldRetryResult); - }); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ReplicatedResourceClientUtils.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ReplicatedResourceClientUtils.java deleted file mode 100644 index d1f4429cbe01..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ReplicatedResourceClientUtils.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class ReplicatedResourceClientUtils { - - public static boolean isReadingFromMaster(ResourceType resourceType, OperationType operationType) { - if (resourceType == ResourceType.Offer || - resourceType == ResourceType.Database || - resourceType == ResourceType.User || - resourceType == ResourceType.UserDefinedType || - resourceType == ResourceType.Permission || - resourceType == ResourceType.Topology || - resourceType == ResourceType.DatabaseAccount || - (resourceType == ResourceType.PartitionKeyRange && operationType != OperationType.GetSplitPoint && operationType != OperationType.AbortSplit) || - (resourceType == ResourceType.DocumentCollection && (operationType == OperationType.ReadFeed || operationType == OperationType.Query || operationType == OperationType.SqlQuery))) - { - return true; - } - - return false; - } - - public static boolean isMasterResource(ResourceType resourceType) { - if (resourceType == ResourceType.Offer || - resourceType == ResourceType.Database || - resourceType == ResourceType.User || - resourceType == ResourceType.UserDefinedType || - resourceType == ResourceType.Permission || - resourceType == ResourceType.Topology || - resourceType == ResourceType.DatabaseAccount || - resourceType == ResourceType.PartitionKeyRange || - resourceType == ResourceType.DocumentCollection) { - return true; - } - - return false; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResetSessionTokenRetryPolicyFactory.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResetSessionTokenRetryPolicyFactory.java deleted file mode 100644 index 1d6e888c61f5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResetSessionTokenRetryPolicyFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxClientCollectionCache; - -public class ResetSessionTokenRetryPolicyFactory implements IRetryPolicyFactory { - - private final IRetryPolicyFactory retryPolicy; - private final ISessionContainer sessionContainer; - private final RxClientCollectionCache collectionCache; - - public ResetSessionTokenRetryPolicyFactory(ISessionContainer sessionContainer, RxClientCollectionCache collectionCache, IRetryPolicyFactory retryPolicy) { - this.retryPolicy = retryPolicy; - this.sessionContainer = sessionContainer; - this.collectionCache = collectionCache; - } - - @Override - public IDocumentClientRetryPolicy getRequestPolicy() { - return new RenameCollectionAwareClientRetryPolicy(this.sessionContainer, this.collectionCache, retryPolicy.getRequestPolicy()); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResourceThrottleRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResourceThrottleRetryPolicy.java deleted file mode 100644 index 8aeb8e037dfb..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResourceThrottleRetryPolicy.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class ResourceThrottleRetryPolicy implements IDocumentClientRetryPolicy{ - - private final static Logger logger = LoggerFactory.getLogger(ResourceThrottleRetryPolicy.class); - - private final static int DefaultMaxWaitTimeInSeconds = 60; - private final static int DefaultRetryInSeconds = 5; - private final int backoffDelayFactor; - private final int maxAttemptCount; - private final Duration maxWaitTime; - - // TODO: is this thread safe? - // should we make this atomic int? - private int currentAttemptCount; - private Duration cumulativeRetryDelay; - - public ResourceThrottleRetryPolicy(int maxAttemptCount, int maxWaitTimeInSeconds) { - this(maxAttemptCount, maxWaitTimeInSeconds, 1); - } - - public ResourceThrottleRetryPolicy(int maxAttemptCount) { - this(maxAttemptCount, DefaultMaxWaitTimeInSeconds, 1); - } - - public ResourceThrottleRetryPolicy(int maxAttemptCount, int maxWaitTimeInSeconds, int backoffDelayFactor) { - Utils.checkStateOrThrow(maxWaitTimeInSeconds < Integer.MAX_VALUE / 1000, "maxWaitTimeInSeconds", "maxWaitTimeInSeconds must be less than " + Integer.MAX_VALUE / 1000); - - this.maxAttemptCount = maxAttemptCount; - this.backoffDelayFactor = backoffDelayFactor; - this.maxWaitTime = Duration.ofSeconds(maxWaitTimeInSeconds); - this.currentAttemptCount = 0; - this.cumulativeRetryDelay = Duration.ZERO; - } - - @Override - public Single shouldRetry(Exception exception) { - Duration retryDelay = Duration.ZERO; - - if (this.currentAttemptCount < this.maxAttemptCount && - (retryDelay = checkIfRetryNeeded(exception)) != null) { - this.currentAttemptCount++; - logger.warn( - "Operation will be retried after {} milliseconds. Current attempt {}, Cumulative delay {}", - retryDelay.toMillis(), - this.currentAttemptCount, - this.cumulativeRetryDelay, - exception); - return Single.just(ShouldRetryResult.retryAfter(retryDelay)); - } else { - logger.debug( - "Operation will NOT be retried. Current attempt {}", - this.currentAttemptCount, - exception); - return Single.just(ShouldRetryResult.noRetry()); - } - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - // no op - } - - // if retry not needed reaturns null - /// - /// Returns True if the given exception is retriable - /// - /// Exception to examine - /// retryDelay - /// True if the exception is retriable; False otherwise - private Duration checkIfRetryNeeded(Exception exception) { - Duration retryDelay = Duration.ZERO; - - DocumentClientException dce = Utils.as(exception, DocumentClientException.class); - - if (dce != null){ - - if (Exceptions.isStatusCode(dce, HttpConstants.StatusCodes.TOO_MANY_REQUESTS)) { - retryDelay = Duration.ofMillis(dce.getRetryAfterInMilliseconds()); - if (this.backoffDelayFactor > 1) { - retryDelay = Duration.ofNanos(retryDelay.toNanos() * this.backoffDelayFactor); - } - - if (retryDelay.toMillis() < this.maxWaitTime.toMillis() && - this.maxWaitTime.toMillis() >= (this.cumulativeRetryDelay = retryDelay.plus(this.cumulativeRetryDelay)).toMillis()) - { - if (retryDelay == Duration.ZERO){ - // we should never reach here as BE should turn non-zero of retryDelay - logger.trace("Received retryDelay of 0 with Http 429", exception); - retryDelay = Duration.ofSeconds(DefaultRetryInSeconds); - } - - return retryDelay; - } - } - } - // if retry not needed returns null - return null; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryPolicy.java deleted file mode 100644 index 9ac61a56f331..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryPolicy.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.RetryOptions; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * Represents the retry policy configuration associated with a DocumentClient instance. - */ -public class RetryPolicy implements IRetryPolicyFactory { - private final GlobalEndpointManager globalEndpointManager; - private final boolean enableEndpointDiscovery; - private final RetryOptions retryOptions; - - public RetryPolicy(GlobalEndpointManager globalEndpointManager, ConnectionPolicy connectionPolicy) { - this.enableEndpointDiscovery = connectionPolicy.getEnableEndpointDiscovery(); - this.globalEndpointManager = globalEndpointManager; - this.retryOptions = connectionPolicy.getRetryOptions(); - } - - @Override - public IDocumentClientRetryPolicy getRequestPolicy() { - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(this.globalEndpointManager, - this.enableEndpointDiscovery, this.retryOptions); - - return clientRetryPolicy; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtils.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtils.java deleted file mode 100644 index 7432a3ebdef6..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtils.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.lang3.time.StopWatch; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.internal.Quadruple; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy.ShouldRetryResult; - -import rx.Observable; -import rx.Single; -import rx.functions.Func1; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class RetryUtils { - private final static Logger logger = LoggerFactory.getLogger(BackoffRetryUtility.class); - - public static Func1, Observable> toRetryWhenFunc(IRetryPolicy policy) { - return new Func1, Observable>() { - - @Override - public Observable call(Observable throwableObs) { - return throwableObs.flatMap( t -> { - Exception e = Utils.as(t, Exception.class); - if (e == null) { - return Observable.error(t); - } - - return policy.shouldRetry(e).toObservable().flatMap(s -> { - - if (s.backOffTime != null) { - return Observable.timer(s.backOffTime.toMillis(), TimeUnit.MILLISECONDS); - } else if (s.exception != null) { - return Observable.error(s.exception); - } else { - // NoRetry return original failure - return Observable.error(t); - } - }); - }); - } - }; - } - - /** - * This method will be called after getting error on callbackMethod , and then keep trying between - * callbackMethod and inBackoffAlternateCallbackMethod until success or as stated in - * retry policy. - * @param callbackMethod The callbackMethod - * @param policy Retry policy - * @param inBackoffAlternateCallbackMethod The inBackoffAlternateCallbackMethod - * @param minBackoffForInBackoffCallback Minimum backoff for InBackoffCallbackMethod - * @return - */ - static Func1> toRetryWithAlternateFunc( - Func1, Single> callbackMethod, IRetryPolicy policy, - Func1, Single> inBackoffAlternateCallbackMethod, - Duration minBackoffForInBackoffCallback) { - return new Func1>() { - - @Override - public Single call(Throwable t) { - Exception e = Utils.as(t, Exception.class); - if (e == null) { - return Single.error(t); - } - - return policy.shouldRetry(e).flatMap(shouldRetryResult -> { - if (!shouldRetryResult.shouldRetry) { - if(shouldRetryResult.exception == null) { - return Single.error(e); - } else { - return Single.error(shouldRetryResult.exception); - } - } - - if (inBackoffAlternateCallbackMethod != null - && shouldRetryResult.backOffTime.compareTo(minBackoffForInBackoffCallback) > 0) { - StopWatch stopwatch = new StopWatch(); - startStopWatch(stopwatch); - return inBackoffAlternateCallbackMethod.call(shouldRetryResult.policyArg) - .onErrorResumeNext(recurrsiveWithAlternateFunc(callbackMethod, policy, - inBackoffAlternateCallbackMethod, shouldRetryResult, stopwatch, - minBackoffForInBackoffCallback)); - } else { - return recurrsiveFunc(callbackMethod, policy, inBackoffAlternateCallbackMethod, - shouldRetryResult, minBackoffForInBackoffCallback) - .delaySubscription(Observable.timer(shouldRetryResult.backOffTime.toMillis(), - TimeUnit.MILLISECONDS)); - } - }); - } - }; - - } - - private static Single recurrsiveFunc( - Func1, Single> callbackMethod, IRetryPolicy policy, - Func1, Single> inBackoffAlternateCallbackMethod, - ShouldRetryResult shouldRetryResult, Duration minBackoffForInBackoffCallback) { - return callbackMethod.call(shouldRetryResult.policyArg).onErrorResumeNext(toRetryWithAlternateFunc( - callbackMethod, policy, inBackoffAlternateCallbackMethod, minBackoffForInBackoffCallback)); - - } - - private static Func1> recurrsiveWithAlternateFunc( - Func1, Single> callbackMethod, IRetryPolicy policy, - Func1, Single> inBackoffAlternateCallbackMethod, - ShouldRetryResult shouldRetryResult, StopWatch stopwatch, Duration minBackoffForInBackoffCallback) { - return new Func1>() { - - @Override - public Single call(Throwable t) { - - Exception e = Utils.as(t, Exception.class); - if (e == null) { - return Single.error(t); - } - - stopStopWatch(stopwatch); - logger.info("Failed inBackoffAlternateCallback with {}, proceeding with retry. Time taken: {}ms", - e.toString(), stopwatch.getTime()); - Duration backoffTime = shouldRetryResult.backOffTime.toMillis() > stopwatch.getTime() - ? Duration.ofMillis(shouldRetryResult.backOffTime.toMillis() - stopwatch.getTime()) - : Duration.ZERO; - return recurrsiveFunc(callbackMethod, policy, inBackoffAlternateCallbackMethod, shouldRetryResult, - minBackoffForInBackoffCallback) - .delaySubscription(Observable.timer(backoffTime.toMillis(), TimeUnit.MILLISECONDS)); - } - - }; - } - - private static void stopStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.stop(); - } - } - - private static void startStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.start(); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModel.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModel.java deleted file mode 100644 index 7de0b323f9d9..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModel.java +++ /dev/null @@ -1,555 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.RuntimeConstants; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.handler.codec.http.HttpMethod; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; -import rx.functions.Func0; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * Used internally to provide functionality to communicate and process response from Gateway in the Azure Cosmos DB database service. - */ -class RxGatewayStoreModel implements RxStoreModel { - - private final static int INITIAL_RESPONSE_BUFFER_SIZE = 1024; - private final Logger logger = LoggerFactory.getLogger(RxGatewayStoreModel.class); - private final Map defaultHeaders; - private final CompositeHttpClient httpClient; - private final QueryCompatibilityMode queryCompatibilityMode; - private final GlobalEndpointManager globalEndpointManager; - private ConsistencyLevel defaultConsistencyLevel; - private ISessionContainer sessionContainer; - - public RxGatewayStoreModel( - ISessionContainer sessionContainer, - ConsistencyLevel defaultConsistencyLevel, - QueryCompatibilityMode queryCompatibilityMode, - UserAgentContainer userAgentContainer, - GlobalEndpointManager globalEndpointManager, - CompositeHttpClient httpClient) { - this.defaultHeaders = new HashMap<>(); - this.defaultHeaders.put(HttpConstants.HttpHeaders.CACHE_CONTROL, - "no-cache"); - this.defaultHeaders.put(HttpConstants.HttpHeaders.VERSION, - HttpConstants.Versions.CURRENT_VERSION); - - if (userAgentContainer == null) { - userAgentContainer = new UserAgentContainer(); - } - - this.defaultHeaders.put(HttpConstants.HttpHeaders.USER_AGENT, userAgentContainer.getUserAgent()); - - if (defaultConsistencyLevel != null) { - this.defaultHeaders.put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, - defaultConsistencyLevel.toString()); - } - - this.defaultConsistencyLevel = defaultConsistencyLevel; - this.globalEndpointManager = globalEndpointManager; - this.queryCompatibilityMode = queryCompatibilityMode; - - this.httpClient = httpClient; - this.sessionContainer = sessionContainer; - } - - private Observable doCreate(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.POST); - } - - private Observable upsert(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.POST); - } - - private Observable read(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.GET); - } - - private Observable replace(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.PUT); - } - - private Observable delete(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.DELETE); - } - - private Observable execute(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.POST); - } - - private Observable readFeed(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.GET); - } - - private Observable query(RxDocumentServiceRequest request) { - request.getHeaders().put(HttpConstants.HttpHeaders.IS_QUERY, "true"); - - switch (this.queryCompatibilityMode) { - case SqlQuery: - request.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, - RuntimeConstants.MediaTypes.SQL); - break; - case Default: - case Query: - default: - request.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, - RuntimeConstants.MediaTypes.QUERY_JSON); - break; - } - return this.performRequest(request, HttpMethod.POST); - } - - /** - * Given the request it creates an observable which upon subscription issues HTTP call and emits one RxDocumentServiceResponse. - * - * @param request - * @param method - * @return Observable - */ - public Observable performRequest(RxDocumentServiceRequest request, HttpMethod method) { - - try { - URI uri = getUri(request); - HttpClientRequest httpRequest = HttpClientRequest.create(method, uri.toString()); - - this.fillHttpRequestBaseWithHeaders(request.getHeaders(), httpRequest); - - if (request.getContentObservable() != null) { - - // TODO validate this - // convert byte[] to ByteBuf - // why not use Observable directly? - Observable byteBufObservable = request.getContentObservable() - .map(bytes -> Unpooled.wrappedBuffer(bytes)); - - httpRequest.withContentSource(byteBufObservable); - } else if (request.getContent() != null){ - httpRequest.withContent(request.getContent()); - } - - RxClient.ServerInfo serverInfo = new RxClient.ServerInfo(uri.getHost(), uri.getPort()); - - Observable> clientResponseObservable = this.httpClient.submit(serverInfo, httpRequest); - - return toDocumentServiceResponse(clientResponseObservable, request); - - } catch (Exception e) { - return Observable.error(e); - } - } - - private void fillHttpRequestBaseWithHeaders(Map headers, HttpClientRequest req) { - // Add default headers. - for (Entry entry : this.defaultHeaders.entrySet()) { - if (!headers.containsKey(entry.getKey())) { - // populate default header only if there is no overwrite by the request header - req.withHeader(entry.getKey(), entry.getValue()); - } - } - - // Add override headers. - if (headers != null) { - for (Entry entry : headers.entrySet()) { - if (entry.getValue() == null) { - // netty doesn't allow setting null value in header - req.withHeader(entry.getKey(), ""); - } else { - req.withHeader(entry.getKey(), entry.getValue()); - } - } - } - } - - private URI getUri(RxDocumentServiceRequest request) throws URISyntaxException { - URI rootUri = request.getEndpointOverride(); - if (rootUri == null) { - if (request.getIsMedia()) { - // For media read request, always use the write endpoint. - rootUri = this.globalEndpointManager.getWriteEndpoints().get(0).toURI(); - } else { - rootUri = this.globalEndpointManager.resolveServiceEndpoint(request).toURI(); - } - } - - String path = PathsHelper.generatePath(request.getResourceType(), request, request.isFeed); - if(request.getResourceType().equals(ResourceType.DatabaseAccount)) { - path = StringUtils.EMPTY; - } - - URI uri = new URI("https", - null, - rootUri.getHost(), - rootUri.getPort(), - ensureSlashPrefixed(path), - null, // Query string not used. - null); - - return uri; - } - - private String ensureSlashPrefixed(String path) { - if (path == null) { - return path; - } - - if (path.startsWith("/")) { - return path; - } - - return "/" + path; - } - - private Observable toInputStream(Observable contentObservable) { - // TODO: this is a naive approach for converting to InputStream - // this first reads and buffers everything in memory and then translate that to an input stream - // this means - // 1) there is some performance implication - // 2) this may result in OutOfMemoryException if used for reading huge content, e.g., a media - // - // see this: https://github.com/ReactiveX/RxNetty/issues/391 for some similar discussion on how to - // convert to an input stream - return contentObservable - .reduce( - new ByteArrayOutputStream(), - (out, bb) -> { - try { - bb.readBytes(out, bb.readableBytes()); - return out; - } - catch (IOException e) { - throw new RuntimeException(e); - } - }) - .map(out -> { - return new ByteArrayInputStream(out.toByteArray()); - }); - } - - private Observable toString(Observable contentObservable) { - return contentObservable - .reduce( - new ByteArrayOutputStream(INITIAL_RESPONSE_BUFFER_SIZE), - (out, bb) -> { - try { - bb.readBytes(out, bb.readableBytes()); - return out; - } - catch (IOException e) { - throw new RuntimeException(e); - } - }) - .map(out -> { - return new String(out.toByteArray(), StandardCharsets.UTF_8); - }); - } - - /** - * Transforms the rxNetty's client response Observable to RxDocumentServiceResponse Observable. - * - * - * Once the customer code subscribes to the observable returned by the CRUD APIs, - * the subscription goes up till it reaches the source rxNetty's observable, and at that point the HTTP invocation will be made. - * - * @param clientResponseObservable - * @param request - * @return {@link Observable} - */ - private Observable toDocumentServiceResponse(Observable> clientResponseObservable, - RxDocumentServiceRequest request) { - - if (request.getIsMedia()) { - return clientResponseObservable.flatMap(clientResponse -> { - - // header key/value pairs - HttpResponseHeaders httpResponseHeaders = clientResponse.getHeaders(); - HttpResponseStatus httpResponseStatus = clientResponse.getStatus(); - - Observable inputStreamObservable; - - if (request.getOperationType() == OperationType.Delete) { - // for delete we don't expect any body - inputStreamObservable = Observable.just(null); - } else { - // transforms the observable to Observable - inputStreamObservable = toInputStream(clientResponse.getContent()); - } - - Observable storeResponseObservable = inputStreamObservable - .flatMap(contentInputStream -> { - try { - // If there is any error in the header response this throws exception - // TODO: potential performance improvement: return Observable.error(exception) on failure instead of throwing Exception - validateOrThrow(request, httpResponseStatus, httpResponseHeaders, null, contentInputStream); - - // transforms to Observable - StoreResponse rsp = new StoreResponse(httpResponseStatus.code(), HttpUtils.unescape(httpResponseHeaders.entries()), contentInputStream); - return Observable.just(rsp); - } catch (Exception e) { - return Observable.error(e); - } - }); - - return storeResponseObservable; - - }).map(storeResponse -> new RxDocumentServiceResponse(storeResponse)); - - } else { - return clientResponseObservable.flatMap(clientResponse -> { - - // header key/value pairs - HttpResponseHeaders httpResponseHeaders = clientResponse.getHeaders(); - HttpResponseStatus httpResponseStatus = clientResponse.getStatus(); - - Observable contentObservable; - - if (request.getOperationType() == OperationType.Delete) { - // for delete we don't expect any body - contentObservable = Observable.just(null); - } else { - // transforms the observable to Observable - contentObservable = toString(clientResponse.getContent()); - } - - Observable storeResponseObservable = contentObservable - .flatMap(content -> { - try { - // If there is any error in the header response this throws exception - // TODO: potential performance improvement: return Observable.error(exception) on failure instead of throwing Exception - validateOrThrow(request, httpResponseStatus, httpResponseHeaders, content, null); - - // transforms to Observable - StoreResponse rsp = new StoreResponse(httpResponseStatus.code(), HttpUtils.unescape(httpResponseHeaders.entries()), content); - return Observable.just(rsp); - } catch (Exception e) { - return Observable.error(e); - } - }); - - return storeResponseObservable; - - }).map(storeResponse -> new RxDocumentServiceResponse(storeResponse)) - .onErrorResumeNext(throwable -> { - if (!(throwable instanceof Exception)) { - // fatal error - logger.error("Unexpected failure {}", throwable.getMessage(), throwable); - return Observable.error(throwable); - } - - Exception exception = (Exception) throwable; - if (!(exception instanceof DocumentClientException)) { - // wrap in DocumentClientException - logger.error("Network failure", exception); - DocumentClientException dce = new DocumentClientException(0, exception); - BridgeInternal.setRequestHeaders(dce, request.getHeaders()); - return Observable.error(dce); - } - - return Observable.error(exception); - }); - } - } - - private void validateOrThrow(RxDocumentServiceRequest request, HttpResponseStatus status, HttpResponseHeaders headers, String body, - InputStream inputStream) throws DocumentClientException { - - int statusCode = status.code(); - - if (statusCode >= HttpConstants.StatusCodes.MINIMUM_STATUSCODE_AS_ERROR_GATEWAY) { - if (body == null && inputStream != null) { - try { - body = IOUtils.toString(inputStream, StandardCharsets.UTF_8); - } catch (IOException e) { - logger.error("Failed to get content from the http response", e); - DocumentClientException dce = new DocumentClientException(0, e); - BridgeInternal.setRequestHeaders(dce, request.getHeaders()); - throw dce; - } finally { - IOUtils.closeQuietly(inputStream); - } - } - - String statusCodeString = status.reasonPhrase() != null - ? status.reasonPhrase().replace(" ", "") - : ""; - Error error = null; - error = (body != null) ? new Error(body) : new Error(); - error = new Error(statusCodeString, - String.format("%s, StatusCode: %s", error.getMessage(), statusCodeString), - error.getPartitionedQueryExecutionInfo()); - - DocumentClientException dce = new DocumentClientException(statusCode, error, HttpUtils.asMap(headers)); - BridgeInternal.setRequestHeaders(dce, request.getHeaders()); - throw dce; - } - } - - private Observable invokeAsyncInternal(RxDocumentServiceRequest request) { - switch (request.getOperationType()) { - case Create: - return this.doCreate(request); - case Upsert: - return this.upsert(request); - case Delete: - return this.delete(request); - case ExecuteJavaScript: - return this.execute(request); - case Read: - return this.read(request); - case ReadFeed: - return this.readFeed(request); - case Replace: - return this.replace(request); - case SqlQuery: - case Query: - return this.query(request); - default: - throw new IllegalStateException("Unknown operation type " + request.getOperationType()); - } - } - - private Observable invokeAsync(RxDocumentServiceRequest request) { - Func0> funcDelegate = () -> invokeAsyncInternal(request).toSingle(); - return BackoffRetryUtility.executeRetry(funcDelegate, new WebExceptionRetryPolicy()).toObservable(); - } - - @Override - public Observable processMessage(RxDocumentServiceRequest request) { - this.applySessionToken(request); - - Observable responseObs = invokeAsync(request); - - return responseObs.onErrorResumeNext( - e -> { - DocumentClientException dce = Utils.as(e, DocumentClientException.class); - - if (dce == null) { - logger.error("unexpected failure {}", e.getMessage(), e); - return Observable.error(e); - } - - if ((!ReplicatedResourceClientUtils.isMasterResource(request.getResourceType())) && - (dce.getStatusCode() == HttpConstants.StatusCodes.PRECONDITION_FAILED || - dce.getStatusCode() == HttpConstants.StatusCodes.CONFLICT || - ( - dce.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND && - !Exceptions.isSubStatusCode(dce, - HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)))) { - this.captureSessionToken(request, dce.getResponseHeaders()); - } - - return Observable.error(dce); - } - ).map(response -> - { - this.captureSessionToken(request, response.getResponseHeaders()); - return response; - } - ); - } - - private void captureSessionToken(RxDocumentServiceRequest request, Map responseHeaders) { - if (request.getResourceType() == ResourceType.DocumentCollection && request.getOperationType() == OperationType.Delete) { - String resourceId; - if (request.getIsNameBased()) { - resourceId = responseHeaders.get(HttpConstants.HttpHeaders.OWNER_ID); - } else { - resourceId = request.getResourceId(); - } - this.sessionContainer.clearTokenByResourceId(resourceId); - } else { - this.sessionContainer.setSessionToken(request, responseHeaders); - } - } - - private void applySessionToken(RxDocumentServiceRequest request) { - Map headers = request.getHeaders(); - - if (headers != null && - !Strings.isNullOrEmpty(request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN))) { - if (ReplicatedResourceClientUtils.isMasterResource(request.getResourceType())) { - request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - return; //User is explicitly controlling the session. - } - - String requestConsistencyLevel = headers.get(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL); - - boolean sessionConsistency = - this.defaultConsistencyLevel == ConsistencyLevel.Session || - (!Strings.isNullOrEmpty(requestConsistencyLevel) - && Strings.areEqual(requestConsistencyLevel, ConsistencyLevel.Session.name())); - - if (!sessionConsistency || ReplicatedResourceClientUtils.isMasterResource(request.getResourceType())) { - return; // Only apply the session token in case of session consistency and when resource is not a master resource - } - - //Apply the ambient session. - String sessionToken = this.sessionContainer.resolveGlobalSessionToken(request); - - if (!Strings.isNullOrEmpty(sessionToken)) { - headers.put(HttpConstants.HttpHeaders.SESSION_TOKEN, sessionToken); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxStoreModel.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxStoreModel.java deleted file mode 100644 index ca5184c221ed..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxStoreModel.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import rx.Observable; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface RxStoreModel { - - /** - * Given the request, it returns an Observable of the response. - * - * The Observable upon subscription will execute the request and upon successful execution request returns a single {@link RxDocumentServiceResponse}. - * If the execution of the request fails it returns an error. - * - * @param request - * @return - */ - Observable processMessage(RxDocumentServiceRequest request); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/WebExceptionRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/WebExceptionRetryPolicy.java deleted file mode 100644 index 48f61b07ef9e..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/WebExceptionRetryPolicy.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WebExceptionUtility; -import org.apache.commons.lang3.time.StopWatch; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -public class WebExceptionRetryPolicy implements IRetryPolicy { - private final static Logger logger = LoggerFactory.getLogger(WebExceptionRetryPolicy.class); - - // total wait time in seconds to retry. should be max of primary reconfigrations/replication wait duration etc - private final static int waitTimeInSeconds = 30; - private final static int initialBackoffSeconds = 1; - private final static int backoffMultiplier = 2; - - private StopWatch durationTimer = new StopWatch(); - private int attemptCount = 1; - // Don't penalise first retry with delay. - private int currentBackoffSeconds = WebExceptionRetryPolicy.initialBackoffSeconds; - - public WebExceptionRetryPolicy() { - durationTimer.start(); - } - - - @Override - public Single shouldRetry(Exception exception) { - Duration backoffTime = Duration.ofSeconds(0); - - if (!WebExceptionUtility.isWebExceptionRetriable(exception)) { - // Have caller propagate original exception. - this.durationTimer.stop(); - return Single.just(ShouldRetryResult.noRetry()); - } - - // Don't penalise first retry with delay. - if (attemptCount++ > 1) { - int remainingSeconds = WebExceptionRetryPolicy.waitTimeInSeconds - Math.toIntExact(this.durationTimer.getTime(TimeUnit.SECONDS)); - if (remainingSeconds <= 0) { - this.durationTimer.stop(); - return Single.just(ShouldRetryResult.noRetry()); - } - - backoffTime = Duration.ofSeconds(Math.min(this.currentBackoffSeconds, remainingSeconds)); - this.currentBackoffSeconds *= WebExceptionRetryPolicy.backoffMultiplier; - } - - logger.warn("Received retriable web exception, will retry", exception); - - return Single.just(ShouldRetryResult.retryAfter(backoffTime)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCache.java deleted file mode 100644 index 58ad25c7bd9d..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCache.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import java.util.concurrent.ConcurrentHashMap; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import rx.Observable; -import rx.Single; -import rx.functions.Func0; - -public class AsyncCache { - - private final Logger logger = LoggerFactory.getLogger(AsyncCache.class); - private final ConcurrentHashMap> values = new ConcurrentHashMap<>(); - - private final IEqualityComparer equalityComparer; - - public AsyncCache(IEqualityComparer equalityComparer) { - this.equalityComparer = equalityComparer; - } - - public AsyncCache() { - this(new IEqualityComparer() { - @Override - public boolean areEqual(TValue value1, TValue value2) { - if (value1 == value2) - return true; - if (value1 == null || value2 == null) - return false; - return value1.equals(value2); - } - }); - } - - public void set(TKey key, TValue value) { - logger.debug("set cache[{}]={}", key, value); - values.put(key, new AsyncLazy<>(value)); - } - - /** - * Gets value corresponding to key - * - *

- * If another initialization function is already running, new initialization function will not be started. - * The result will be result of currently running initialization function. - *

- * - *

- * If previous initialization function is successfully completed - value returned by it will be returned unless - * it is equal to obsoleteValue, in which case new initialization function will be started. - *

- *

- * If previous initialization function failed - new one will be launched. - *

- * - * @param key Key for which to get a value. - * @param obsoleteValue Value which is obsolete and needs to be refreshed. - * @param singleValueInitFunc Initialization function. - * @return Cached value or value returned by initialization function. - */ - public Single getAsync( - TKey key, - TValue obsoleteValue, - Func0> singleValueInitFunc) { - - AsyncLazy initialLazyValue = values.get(key); - if (initialLazyValue != null) { - - logger.debug("cache[{}] exists", key); - return initialLazyValue.single().toObservable().flatMap(vaule -> { - - if (!equalityComparer.areEqual(vaule, obsoleteValue)) { - logger.debug("Returning cache[{}] as it is different from obsoleteValue", key); - return Observable.just(vaule); - } - - logger.debug("cache[{}] result value is obsolete ({}), computing new value", key, obsoleteValue); - AsyncLazy asyncLazy = new AsyncLazy<>(singleValueInitFunc); - AsyncLazy actualValue = values.merge(key, asyncLazy, - (lazyValue1, lazyValu2) -> lazyValue1 == initialLazyValue ? lazyValu2 : lazyValue1); - return actualValue.single().toObservable(); - - }, err -> { - - logger.debug("cache[{}] resulted in error {}, computing new value", key, err); - AsyncLazy asyncLazy = new AsyncLazy<>(singleValueInitFunc); - AsyncLazy resultAsyncLazy = values.merge(key, asyncLazy, - (lazyValue1, lazyValu2) -> lazyValue1 == initialLazyValue ? lazyValu2 : lazyValue1); - return resultAsyncLazy.single().toObservable(); - - }, () -> Observable.empty()).toSingle(); - } - - logger.debug("cache[{}] doesn't exist, computing new value", key); - AsyncLazy asyncLazy = new AsyncLazy<>(singleValueInitFunc); - AsyncLazy resultAsyncLazy = values.merge(key, asyncLazy, - (lazyValue1, lazyValu2) -> lazyValue1 == initialLazyValue ? lazyValu2 : lazyValue1); - return resultAsyncLazy.single(); - } - - public void remove(TKey key) { - values.remove(key); - } - - /** - * Remove value from cache and return it if present - * @param key - * @return Value if present, default value if not present - */ - public Single removeAsync(TKey key) { - AsyncLazy lazy = values.remove(key); - return lazy.single(); - // TODO: .Net returns default value on failure of single why? - } - - public void clear() { - this.values.clear(); - } - - /** - * Forces refresh of the cached item if it is not being refreshed at the moment. - * @param key - * @param singleValueInitFunc - */ - public void refresh( - TKey key, - Func0> singleValueInitFunc) { - logger.debug("refreshing cache[{}]", key); - AsyncLazy initialLazyValue = values.get(key); - if (initialLazyValue != null && (initialLazyValue.isSucceeded() || initialLazyValue.isFaulted())) { - AsyncLazy newLazyValue = new AsyncLazy<>(singleValueInitFunc); - - // Update the new task in the cache, - values.merge(key, newLazyValue, - (lazyValue1, lazyValu2) -> lazyValue1 == initialLazyValue ? lazyValu2 : lazyValue1); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncLazy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncLazy.java deleted file mode 100644 index 79a2c377b7a1..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncLazy.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import rx.Single; -import rx.functions.Func0; - -class AsyncLazy { - - private final static Logger logger = LoggerFactory.getLogger(AsyncLazy.class); - - private final Single single; - - private volatile boolean succeeded; - private volatile boolean failed; - - public AsyncLazy(Func0> func) { - this(Single.defer(() -> { - logger.debug("using Func0> {}", func); - return func.call(); - })); - } - - public AsyncLazy(TValue value) { - this.single = Single.just(value); - this.succeeded = true; - this.failed = false; - } - - private AsyncLazy(Single single) { - logger.debug("constructor"); - this.single = single - .doOnSuccess(v -> this.succeeded = true) - .doOnError(e -> this.failed = true) - .cache(); - } - - public Single single() { - return single; - } - - public boolean isSucceeded() { - return succeeded; - } - - public boolean isFaulted() { - return failed; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IEqualityComparer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IEqualityComparer.java deleted file mode 100644 index a9cd210edb5f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IEqualityComparer.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -interface IEqualityComparer { - boolean areEqual(TValue v1, TValue v2); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IPartitionKeyRangeCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IPartitionKeyRangeCache.java deleted file mode 100644 index 1d92cf412dba..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IPartitionKeyRangeCache.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2017 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import java.util.List; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.ICollectionRoutingMapCache; -import com.microsoft.azure.cosmosdb.rx.internal.IRoutingMapProvider; - -import rx.Single; - -/** - * - */ -public interface IPartitionKeyRangeCache extends IRoutingMapProvider, ICollectionRoutingMapCache { - - Single tryLookupAsync(String collectionRid, CollectionRoutingMap previousValue, Map properties); - - Single> tryGetOverlappingRangesAsync(String collectionRid, Range range, boolean forceRefresh, - Map properties); - - Single tryGetPartitionKeyRangeByIdAsync(String collectionResourceId, String partitionKeyRangeId, boolean forceRefresh, - Map properties); - - Single tryGetRangeByPartitionKeyRangeId(String collectionRid, String partitionKeyRangeId, Map properties); - -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxClientCollectionCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxClientCollectionCache.java deleted file mode 100644 index 64fecf3166ef..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxClientCollectionCache.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.HashMap; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.AuthorizationTokenType; -import com.microsoft.azure.cosmosdb.rx.internal.ClearingSessionContainerClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicyFactory; -import com.microsoft.azure.cosmosdb.rx.internal.ObservableHelper; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.RxStoreModel; - -import rx.Observable; -import rx.Single; - -/** - * Caches collection information. - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class RxClientCollectionCache extends RxCollectionCache { - - private RxStoreModel storeModel; - private final IAuthorizationTokenProvider tokenProvider; - private final IRetryPolicyFactory retryPolicy; - private final ISessionContainer sessionContainer; - - public RxClientCollectionCache(ISessionContainer sessionContainer, - RxStoreModel storeModel, - IAuthorizationTokenProvider tokenProvider, - IRetryPolicyFactory retryPolicy) { - this.storeModel = storeModel; - this.tokenProvider = tokenProvider; - this.retryPolicy = retryPolicy; - this.sessionContainer = sessionContainer; - } - - protected Single getByRidAsync(String collectionRid, Map properties) { - IDocumentClientRetryPolicy retryPolicyInstance = new ClearingSessionContainerClientRetryPolicy(this.sessionContainer, this.retryPolicy.getRequestPolicy()); - return ObservableHelper.inlineIfPossible( - () -> this.readCollectionAsync(PathsHelper.generatePath(ResourceType.DocumentCollection, collectionRid, false), retryPolicyInstance, properties) - , retryPolicyInstance); - } - - protected Single getByNameAsync(String resourceAddress, Map properties) { - IDocumentClientRetryPolicy retryPolicyInstance = new ClearingSessionContainerClientRetryPolicy(this.sessionContainer, this.retryPolicy.getRequestPolicy()); - return ObservableHelper.inlineIfPossible( - () -> this.readCollectionAsync(resourceAddress, retryPolicyInstance, properties), - retryPolicyInstance); - } - - private Single readCollectionAsync(String collectionLink, IDocumentClientRetryPolicy retryPolicyInstance, Map properties) { - - String path = Utils.joinPath(collectionLink, null); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - path, - new HashMap()); - - request.getHeaders().put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - - String resourceName = request.getResourceAddress(); - String authorizationToken = tokenProvider.getUserAuthorizationToken( - resourceName, - request.getResourceType(), - HttpConstants.HttpMethods.GET, - request.getHeaders(), - AuthorizationTokenType.PrimaryMasterKey, - properties); - - try { - authorizationToken = URLEncoder.encode(authorizationToken, "UTF-8"); - } catch (UnsupportedEncodingException e) { - return Single.error(new IllegalStateException("Failed to encode authtoken.", e)); - } - request.getHeaders().put(HttpConstants.HttpHeaders.AUTHORIZATION, authorizationToken); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - Observable responseObs = this.storeModel.processMessage(request); - return responseObs.map(response -> BridgeInternal.toResourceResponse(response, DocumentCollection.class) - .getResource()).toSingle(); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxCollectionCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxCollectionCache.java deleted file mode 100644 index e634593434ae..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxCollectionCache.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Completable; -import rx.Single; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public abstract class RxCollectionCache { - - private final AsyncCache collectionInfoByNameCache; - private final AsyncCache collectionInfoByIdCache; - - protected RxCollectionCache() { - this.collectionInfoByNameCache = new AsyncCache(new CollectionRidComparer()); - this.collectionInfoByIdCache = new AsyncCache(new CollectionRidComparer()); - } - - /** - * Resolves a request to a collection in a sticky manner. - * Unless request.ForceNameCacheRefresh is equal to true, it will return the same collection. - * @param request Request to resolve. - * @return an instance of Single<DocumentCollection> - */ - public Single resolveCollectionAsync( - RxDocumentServiceRequest request) { - Completable init = null; - if (request.getIsNameBased()) { - if (request.isForceNameCacheRefresh()) { - Completable completable = this.refreshAsync(request); - init = completable.andThen(Completable.fromAction(() -> request.setForceNameCacheRefresh(false))); - } - - Single collectionInfoObs = this.resolveByPartitionKeyRangeIdentityAsync( - request.getPartitionKeyRangeIdentity(), request.properties); - - if (init != null) { - collectionInfoObs = init.andThen(collectionInfoObs); - } - - return collectionInfoObs.flatMap(collectionInfo -> { - if (collectionInfo != null) { - return Single.just(collectionInfo); - } - - if (request.requestContext.resolvedCollectionRid == null) { - - Single collectionInfoRes = this.resolveByNameAsync(request.getResourceAddress(), request.properties); - - return collectionInfoRes.flatMap(collection -> { - // TODO: how to async log this? - // logger.debug( - // "Mapped resourceName {} to resourceId {}.", - // request.getResourceAddress(), - // collectionInfo.getResourceId()); - - request.setResourceId(collection.getResourceId()); - request.requestContext.resolvedCollectionRid = collection.getResourceId(); - return Single.just(collection); - - }); - } else { - return this.resolveByRidAsync(request.requestContext.resolvedCollectionRid, request.properties); - } - }); - } else { - return resolveByPartitionKeyRangeIdentityAsync(request.getPartitionKeyRangeIdentity(),request.properties) - .flatMap(collection -> { - - if (collection != null) { - return Single.just(collection); - } - - return this.resolveByRidAsync(request.getResourceAddress(), request.properties); - }); - } - } - - /** - * This method is only used in retry policy as it doesn't have request handy. - * @param resourceAddress - */ - public void refresh(String resourceAddress, Map properties) { - if (PathsHelper.isNameBased(resourceAddress)) { - String resourceFullName = PathsHelper.getCollectionPath(resourceAddress); - - this.collectionInfoByNameCache.refresh( - resourceFullName, - () -> { - Single collectionObs = this.getByNameAsync(resourceFullName, properties); - return collectionObs.doOnSuccess(collection -> { - this.collectionInfoByIdCache.set(collection.getResourceId(), collection); - }); - }); - } - } - - protected abstract Single getByRidAsync(String collectionRid, Map properties); - - protected abstract Single getByNameAsync(String resourceAddress, Map properties); - - private Single resolveByPartitionKeyRangeIdentityAsync(PartitionKeyRangeIdentity partitionKeyRangeIdentity, Map properties) { - // if request is targeted at specific partition using x-ms-documentd-partitionkeyrangeid header, - // which contains value ",", then resolve to collection rid in this header. - if (partitionKeyRangeIdentity != null && partitionKeyRangeIdentity.getCollectionRid() != null) { - return this.resolveByRidAsync(partitionKeyRangeIdentity.getCollectionRid(), properties) - .onErrorResumeNext(e -> { - if (e instanceof NotFoundException) { - // This is signal to the upper logic either to refresh - // collection cache and retry. - return Single.error(new InvalidPartitionException(RMResources.InvalidDocumentCollection)); - } - return Single.error(e); - - }); - } - return Single.just(null); - } - - private Single resolveByRidAsync( - String resourceId, Map properties) { - - ResourceId resourceIdParsed = ResourceId.parse(resourceId); - String collectionResourceId = resourceIdParsed.getDocumentCollectionId().toString(); - - return this.collectionInfoByIdCache.getAsync( - collectionResourceId, - null, - () -> this.getByRidAsync(collectionResourceId, properties)); - } - - private Single resolveByNameAsync( - String resourceAddress, Map properties) { - - String resourceFullName = PathsHelper.getCollectionPath(resourceAddress); - - return this.collectionInfoByNameCache.getAsync( - resourceFullName, - null, - () -> { - Single collectionObs = this.getByNameAsync(resourceFullName, properties); - return collectionObs.doOnSuccess(collection -> { - this.collectionInfoByIdCache.set(collection.getResourceId(), collection); - }); - }); - } - - private Completable refreshAsync(RxDocumentServiceRequest request) { - // TODO System.Diagnostics.Debug.Assert(request.IsNameBased); - - String resourceFullName = PathsHelper.getCollectionPath(request.getResourceAddress()); - Completable completable = null; - - if (request.requestContext.resolvedCollectionRid != null) { - // Here we will issue backend call only if cache wasn't already refreshed (if whatever is there corresponds to previously resolved collection rid). - DocumentCollection obsoleteValue = new DocumentCollection(); - obsoleteValue.setResourceId(request.requestContext.resolvedCollectionRid); - - completable = this.collectionInfoByNameCache.getAsync( - resourceFullName, - obsoleteValue, - () -> { - Single collectionObs = this.getByNameAsync(resourceFullName, request.properties); - return collectionObs.doOnSuccess(collection -> { - this.collectionInfoByIdCache.set(collection.getResourceId(), collection); - }); - }).toCompletable(); - } else { - // In case of ForceRefresh directive coming from client, there will be no ResolvedCollectionRid, so we - // need to refresh unconditionally. - completable = Completable.fromAction(() -> this.refresh(request.getResourceAddress(), request.properties)); - } - - return completable.doOnCompleted(() -> request.requestContext.resolvedCollectionRid = null); - } - - private class CollectionRidComparer implements IEqualityComparer { - public boolean areEqual(DocumentCollection left, DocumentCollection right) { - if (left == null && right == null) { - return true; - } - - if ((left == null) ^ (right == null)) { - return false; - } - - return StringUtils.equals(left.getResourceId(), right.getResourceId()); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/AggregateDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/AggregateDocumentQueryExecutionContext.java deleted file mode 100644 index 8305732d9ff8..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/AggregateDocumentQueryExecutionContext.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.function.Function; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.AggregateOperator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.Aggregator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.AverageAggregator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.CountAggregator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.MaxAggregator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.MinAggregator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.SumAggregator; -import com.microsoft.azure.cosmosdb.QueryMetrics; - -import rx.Observable; - -public class AggregateDocumentQueryExecutionContext implements IDocumentQueryExecutionComponent{ - - private IDocumentQueryExecutionComponent component; - private Aggregator aggregator; - private ConcurrentMap queryMetricsMap = new ConcurrentHashMap<>(); - - //QueryInfo class used in PipelinedDocumentQueryExecutionContext returns a Collection of AggregateOperators - //while Multiple aggregates are allowed in queries targeted at a single partition, only a single aggregate is allowed in x-partition queries (currently) - public AggregateDocumentQueryExecutionContext (IDocumentQueryExecutionComponent component, Collection aggregateOperators) { - - this.component = component; - AggregateOperator aggregateOperator = aggregateOperators.iterator().next(); - - switch (aggregateOperator) { - case Average: - this.aggregator = new AverageAggregator(); - break; - case Count: - this.aggregator = new CountAggregator(); - break; - case Max: - this.aggregator = new MaxAggregator(); - break; - case Min: - this.aggregator = new MinAggregator(); - break; - case Sum: - this.aggregator = new SumAggregator(); - break; - default: - throw new IllegalStateException("Unexpected value: " + aggregateOperator.toString()); - } - } - - @SuppressWarnings("unchecked") - @Override - public Observable> drainAsync(int maxPageSize) { - - return this.component.drainAsync(maxPageSize) - .toList() - .map( superList -> { - - double requestCharge = 0; - List aggregateResults = new ArrayList(); - HashMap headers = new HashMap(); - - for(FeedResponse page : superList) { - - if (page.getResults().size() == 0) { - headers.put(HttpConstants.HttpHeaders.REQUEST_CHARGE, Double.toString(requestCharge)); - FeedResponse frp = BridgeInternal.createFeedResponse(aggregateResults, headers); - return (FeedResponse) frp; - } - - Document doc = ((Document)page.getResults().get(0)); - requestCharge += page.getRequestCharge(); - QueryItem values = new QueryItem(doc.toJson()); - this.aggregator.aggregate(values.getItem()); - for(String key : page.getQueryMetrics().keySet()) { - if (queryMetricsMap.containsKey(key)) { - QueryMetrics qm = page.getQueryMetrics().get(key); - queryMetricsMap.get(key).add(qm); - } else { - queryMetricsMap.put(key, page.getQueryMetrics().get(key)); - } - } - } - - if (this.aggregator.getResult() == null || !this.aggregator.getResult().equals(Undefined.Value())) { - Document aggregateDocument = new Document(); - aggregateDocument.set(Constants.Properties.AGGREGATE, this.aggregator.getResult()); - aggregateResults.add(aggregateDocument); - } - - headers.put(HttpConstants.HttpHeaders.REQUEST_CHARGE, Double.toString(requestCharge)); - FeedResponse frp = BridgeInternal.createFeedResponse(aggregateResults, headers); - if(!queryMetricsMap.isEmpty()) { - for(String key: queryMetricsMap.keySet()) { - BridgeInternal.putQueryMetricsIntoMap(frp, key, queryMetricsMap.get(key)); - } - } - return (FeedResponse) frp; - }); - } - - public static Observable> createAsync( - Function>> createSourceComponentFunction, - Collection aggregates, - String continuationToken) { - - return createSourceComponentFunction - .apply(continuationToken) - .map( component -> { return new AggregateDocumentQueryExecutionContext(component, aggregates);}); - } - - public IDocumentQueryExecutionComponent getComponent() { - return this.component; - } - -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/CompositeContinuationToken.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/CompositeContinuationToken.java deleted file mode 100644 index 050c24b23ab6..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/CompositeContinuationToken.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public final class CompositeContinuationToken extends JsonSerializable { - private static final String TokenPropertyName = "token"; - private static final String RangePropertyName = "range"; - private static final Logger logger = LoggerFactory.getLogger(CompositeContinuationToken.class); - - public CompositeContinuationToken(String token, Range range) { - // token is allowed to be null - if (range == null) { - throw new IllegalArgumentException("range must not be null."); - } - - this.setToken(token); - this.setRange(range); - } - - private CompositeContinuationToken(String serializedCompositeContinuationToken) { - super(serializedCompositeContinuationToken); - } - - public static boolean tryParse(String serializedCompositeContinuationToken, - ValueHolder outCompositeContinuationToken) { - boolean parsed; - try { - CompositeContinuationToken compositeContinuationToken = new CompositeContinuationToken( - serializedCompositeContinuationToken); - compositeContinuationToken.getToken(); - - Range range = compositeContinuationToken.getRange(); - if (range == null) { - throw new IllegalArgumentException("range must not be null."); - } - - range.getMax(); - range.getMin(); - range.isEmpty(); - range.isMaxInclusive(); - range.isMinInclusive(); - range.isSingleValue(); - - outCompositeContinuationToken.v = compositeContinuationToken; - parsed = true; - } catch (Exception ex) { - logger.debug( - "Received exception {} when trying to parse: {}", - ex.getMessage(), - serializedCompositeContinuationToken); - parsed = false; - outCompositeContinuationToken.v = null; - } - - return parsed; - } - - /** - * @return the token - */ - public String getToken() { - return super.getString(TokenPropertyName); - } - - /** - * @return the range - */ - public Range getRange() { - return new Range(super.getString(RangePropertyName)); - } - - /** - * @param token - * the token to set - */ - private void setToken(String token) { - super.set(TokenPropertyName, token); - } - - /** - * @param range - * the range to set - */ - private void setRange(Range range) { - /* TODO: Don't stringify the range */ - super.set(RangePropertyName, range.toString()); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DefaultDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DefaultDocumentQueryExecutionContext.java deleted file mode 100644 index b29ab978a577..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DefaultDocumentQueryExecutionContext.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.BackoffRetryUtility; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionExceptionRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeGoneRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache; -import com.microsoft.azure.cosmosdb.internal.query.metrics.ClientSideMetrics; -import com.microsoft.azure.cosmosdb.internal.query.metrics.FetchExecutionRangeAccumulator; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.internal.query.metrics.SchedulingStopwatch; -import com.microsoft.azure.cosmosdb.internal.query.metrics.SchedulingTimeSpan; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import rx.Observable; -import rx.Single; -import rx.functions.Func1; -import rx.functions.Func2; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class DefaultDocumentQueryExecutionContext extends DocumentQueryExecutionContextBase { - - private boolean isContinuationExpected; - private volatile int retries = -1; - - private final SchedulingStopwatch fetchSchedulingMetrics; - private final FetchExecutionRangeAccumulator fetchExecutionRangeAccumulator; - private static final String DEFAULT_PARTITION_KEY_RANGE_ID = "0"; - - public DefaultDocumentQueryExecutionContext(IDocumentQueryClient client, ResourceType resourceTypeEnum, - Class resourceType, SqlQuerySpec query, FeedOptions feedOptions, String resourceLink, - UUID correlatedActivityId, boolean isContinuationExpected) { - - super(client, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - false, - correlatedActivityId); - - this.isContinuationExpected = isContinuationExpected; - this.fetchSchedulingMetrics = new SchedulingStopwatch(); - this.fetchSchedulingMetrics.ready(); - this.fetchExecutionRangeAccumulator = new FetchExecutionRangeAccumulator(DEFAULT_PARTITION_KEY_RANGE_ID); - } - - protected PartitionKeyInternal getPartitionKeyInternal() { - return this.feedOptions.getPartitionKey() == null ? null : feedOptions.getPartitionKey().getInternalPartitionKey(); - } - - @Override - public Observable> executeAsync() { - - if (feedOptions == null) { - feedOptions = new FeedOptions(); - } - - FeedOptions newFeedOptions = new FeedOptions(feedOptions); - - // We can not go to backend with the composite continuation token, - // but we still need the gateway for the query plan. - // The workaround is to try and parse the continuation token as a composite continuation token. - // If it is, then we send the query to the gateway with max degree of parallelism to force getting back the query plan - - String originalContinuation = newFeedOptions.getRequestContinuation(); - - if (isClientSideContinuationToken(originalContinuation)) { - // At this point we know we want back a query plan - newFeedOptions.setRequestContinuation(null); - newFeedOptions.setMaxDegreeOfParallelism(Integer.MAX_VALUE); - } - - int maxPageSize = newFeedOptions.getMaxItemCount() != null ? newFeedOptions.getMaxItemCount() : Constants.Properties.DEFAULT_MAX_PAGE_SIZE; - - Func2 createRequestFunc = (continuationToken, pageSize) -> this.createRequestAsync(continuationToken, pageSize); - - // TODO: clean up if we want to use single vs observable. - Func1>> executeFunc = executeInternalAsyncFunc(); - - return Paginator - .getPaginatedQueryResultAsObservable(newFeedOptions, createRequestFunc, executeFunc, resourceType, maxPageSize); - } - - public Single> getTargetPartitionKeyRanges(String resourceId, List> queryRanges) { - // TODO: FIXME this needs to be revisited - - Range r = new Range<>("", "FF", true, false); - return client.getPartitionKeyRangeCache().tryGetOverlappingRangesAsync(resourceId, r, false, null); - } - - protected Func1>> executeInternalAsyncFunc() { - RxCollectionCache collectionCache = this.client.getCollectionCache(); - IPartitionKeyRangeCache partitionKeyRangeCache = this.client.getPartitionKeyRangeCache(); - IDocumentClientRetryPolicy retryPolicyInstance = this.client.getResetSessionTokenRetryPolicy().getRequestPolicy(); - - retryPolicyInstance = new InvalidPartitionExceptionRetryPolicy(collectionCache, retryPolicyInstance, resourceLink, feedOptions); - if (super.resourceTypeEnum.isPartitioned()) { - retryPolicyInstance = new PartitionKeyRangeGoneRetryPolicy( - collectionCache, - partitionKeyRangeCache, - PathsHelper.getCollectionPath(super.resourceLink), - retryPolicyInstance, - feedOptions); - } - - final IDocumentClientRetryPolicy finalRetryPolicyInstance = retryPolicyInstance; - - Func1>> executeFunc = req -> { - finalRetryPolicyInstance.onBeforeSendRequest(req); - this.fetchExecutionRangeAccumulator.beginFetchRange(); - this.fetchSchedulingMetrics.start(); - return BackoffRetryUtility.executeRetry(() -> { - ++this.retries; - return executeRequestAsync(req); - }, finalRetryPolicyInstance).toObservable() - .map(tFeedResponse -> { - this.fetchSchedulingMetrics.stop(); - this.fetchExecutionRangeAccumulator.endFetchRange(tFeedResponse.getActivityId(), - tFeedResponse.getResults().size(), - this.retries); - ImmutablePair schedulingTimeSpanMap = - new ImmutablePair<>(DEFAULT_PARTITION_KEY_RANGE_ID, this.fetchSchedulingMetrics.getElapsedTime()); - if (!StringUtils.isEmpty(tFeedResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.QUERY_METRICS))) { - QueryMetrics qm = - BridgeInternal.createQueryMetricsFromDelimitedStringAndClientSideMetrics(tFeedResponse.getResponseHeaders() - .get(HttpConstants.HttpHeaders.QUERY_METRICS), - new ClientSideMetrics(this.retries, - tFeedResponse.getRequestCharge(), - this.fetchExecutionRangeAccumulator.getExecutionRanges(), - Arrays.asList(schedulingTimeSpanMap)), - tFeedResponse.getActivityId()); - BridgeInternal.putQueryMetricsIntoMap(tFeedResponse, DEFAULT_PARTITION_KEY_RANGE_ID, qm); - } - return tFeedResponse; - }); - }; - - return executeFunc; - } - - private Single> executeOnceAsync(IDocumentClientRetryPolicy retryPolicyInstance, String continuationToken) { - // Don't reuse request, as the rest of client SDK doesn't reuse requests between retries. - // The code leaves some temporary garbage in request (in RequestContext etc.), - // which shold be erased during retries. - - RxDocumentServiceRequest request = this.createRequestAsync(continuationToken, this.feedOptions.getMaxItemCount()); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - if (!Strings.isNullOrEmpty(request.getHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY)) - || !request.getResourceType().isPartitioned()) { - return this.executeRequestAsync(request); - } - - - // TODO: remove this as partition key range id is not relevant - // TODO; has to be rx async - //CollectionCache collectionCache = this.client.getCollectionCache(); - - // TODO: has to be rx async - //DocumentCollection collection = - // collectionCache.resolveCollection(request); - - // TODO: this code is not relevant because partition key range id should not be exposed - // if (!Strings.isNullOrEmpty(super.getPartitionKeyId())) - // { - // request.RouteTo(new PartitionKeyRangeIdentity(collection.ResourceId, base.PartitionKeyRangeId)); - // return await this.ExecuteRequestAsync(request); - // } - - request.UseGatewayMode = true; - return this.executeRequestAsync(request); - } - - public RxDocumentServiceRequest createRequestAsync(String continuationToken, Integer maxPageSize) { - - // TODO this should be async - Map requestHeaders = this.createCommonHeadersAsync( - this.getFeedOptions(continuationToken, maxPageSize)); - - // TODO: add support for simple continuation for single partition query - //requestHeaders.put(keyHttpConstants.HttpHeaders.IsContinuationExpected, isContinuationExpected.ToString()) - - RxDocumentServiceRequest request = this.createDocumentServiceRequest( - requestHeaders, - this.query, - this.getPartitionKeyInternal()); - - if (!StringUtils.isEmpty(feedOptions.getPartitionKeyRangeIdInternal())) { - request.routeTo(new PartitionKeyRangeIdentity(feedOptions.getPartitionKeyRangeIdInternal())); - } - - return request; - } - - private static boolean isClientSideContinuationToken(String continuationToken) { - if (continuationToken != null) { - ValueHolder outCompositeContinuationToken = new ValueHolder(); - if (CompositeContinuationToken.tryParse(continuationToken, outCompositeContinuationToken)) { - return true; - } - - ValueHolder outOrderByContinuationToken = new ValueHolder(); - if (OrderByContinuationToken.tryParse(continuationToken, outOrderByContinuationToken)) { - return true; - } - - ValueHolder outTakeContinuationToken = new ValueHolder(); - if (TakeContinuationToken.tryParse(continuationToken, outTakeContinuationToken)) { - return true; - } - } - - return false; - } -} - diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducer.java deleted file mode 100644 index 37303c96ad40..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducer.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.ObservableHelper; -import com.microsoft.azure.cosmosdb.internal.query.metrics.ClientSideMetrics; -import com.microsoft.azure.cosmosdb.internal.query.metrics.FetchExecutionRangeAccumulator; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.QueryMetricsConstants; -import com.microsoft.azure.cosmosdb.internal.query.metrics.SchedulingStopwatch; -import com.microsoft.azure.cosmosdb.internal.query.metrics.SchedulingTimeSpan; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import rx.Observable; -import rx.Single; -import rx.functions.Func0; -import rx.functions.Func1; -import rx.functions.Func2; -import rx.functions.Func3; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -class DocumentProducer { - private static final Logger logger = LoggerFactory.getLogger(DocumentProducer.class); - private int retries; - - class DocumentProducerFeedResponse { - FeedResponse pageResult; - PartitionKeyRange sourcePartitionKeyRange; - - DocumentProducerFeedResponse(FeedResponse pageResult) { - this.pageResult = pageResult; - this.sourcePartitionKeyRange = DocumentProducer.this.targetRange; - populatePartitionedQueryMetrics(); - } - - DocumentProducerFeedResponse(FeedResponse pageResult, PartitionKeyRange pkr) { - this.pageResult = pageResult; - this.sourcePartitionKeyRange = pkr; - populatePartitionedQueryMetrics(); - } - - void populatePartitionedQueryMetrics() { - String queryMetricsDelimitedString = pageResult.getResponseHeaders().get(HttpConstants.HttpHeaders.QUERY_METRICS); - if (!StringUtils.isEmpty(queryMetricsDelimitedString)) { - queryMetricsDelimitedString += String.format(";%s=%.2f", QueryMetricsConstants.RequestCharge, pageResult.getRequestCharge()); - ImmutablePair schedulingTimeSpanMap = - new ImmutablePair<>(targetRange.getId(), fetchSchedulingMetrics.getElapsedTime()); - - QueryMetrics qm =BridgeInternal.createQueryMetricsFromDelimitedStringAndClientSideMetrics(queryMetricsDelimitedString, - new ClientSideMetrics(retries, - pageResult.getRequestCharge(), - fetchExecutionRangeAccumulator.getExecutionRanges(), - Arrays.asList(schedulingTimeSpanMap) - ), pageResult.getActivityId()); - BridgeInternal.putQueryMetricsIntoMap(pageResult, targetRange.getId(), qm); - } - } - } - - protected final IDocumentQueryClient client; - protected final String collectionRid; - protected final FeedOptions feedOptions; - protected final Class resourceType; - protected final PartitionKeyRange targetRange; - protected final String collectionLink; - protected final Func3 createRequestFunc; - protected final Func1>> executeRequestFuncWithRetries; - protected final Func0 createRetryPolicyFunc; - protected final int pageSize; - protected final UUID correlatedActivityId; - public int top; - private volatile String lastResponseContinuationToken; - private final SchedulingStopwatch fetchSchedulingMetrics; - private SchedulingStopwatch moveNextSchedulingMetrics; - private final FetchExecutionRangeAccumulator fetchExecutionRangeAccumulator; - - public DocumentProducer( - IDocumentQueryClient client, - String collectionResourceId, - FeedOptions feedOptions, - Func3 createRequestFunc, - Func1>> executeRequestFunc, - PartitionKeyRange targetRange, - String collectionLink, - Func0 createRetryPolicyFunc, - Class resourceType , - UUID correlatedActivityId, - int initialPageSize, // = -1, - String initialContinuationToken, - int top) { - - this.client = client; - this.collectionRid = collectionResourceId; - - this.createRequestFunc = createRequestFunc; - - this.fetchSchedulingMetrics = new SchedulingStopwatch(); - this.fetchSchedulingMetrics.ready(); - this.fetchExecutionRangeAccumulator = new FetchExecutionRangeAccumulator(targetRange.getId()); - - this.executeRequestFuncWithRetries = request -> { - retries = -1; - this.fetchSchedulingMetrics.start(); - this.fetchExecutionRangeAccumulator.beginFetchRange(); - IDocumentClientRetryPolicy retryPolicy = null; - if (createRetryPolicyFunc != null) { - retryPolicy = createRetryPolicyFunc.call(); - retryPolicy.onBeforeSendRequest(request); - } - return ObservableHelper.inlineIfPossibleAsObs( - () -> { - ++retries; - return executeRequestFunc.call(request); - }, retryPolicy); - }; - - this.correlatedActivityId = correlatedActivityId; - - this.feedOptions = feedOptions != null ? feedOptions : new FeedOptions(); - this.feedOptions.setRequestContinuation(initialContinuationToken); - this.lastResponseContinuationToken = initialContinuationToken; - this.resourceType = resourceType; - this.targetRange = targetRange; - this.collectionLink = collectionLink; - this.createRetryPolicyFunc = createRetryPolicyFunc; - this.pageSize = initialPageSize; - this.top = top; - } - - public Observable produceAsync() { - Func2 sourcePartitionCreateRequestFunc = - (token, maxItemCount) -> createRequestFunc.call(targetRange, token, maxItemCount); - Observable> obs = Paginator - .getPaginatedQueryResultAsObservable( - feedOptions, - sourcePartitionCreateRequestFunc, - executeRequestFuncWithRetries, - resourceType, - top, - pageSize) - .map(rsp -> { - lastResponseContinuationToken = rsp.getResponseContinuation(); - this.fetchExecutionRangeAccumulator.endFetchRange(rsp.getActivityId(), - rsp.getResults().size(), - this.retries); - this.fetchSchedulingMetrics.stop(); - return rsp;}); - - return splitProof(obs.map(page -> new DocumentProducerFeedResponse(page))); - } - - private Observable splitProof(Observable sourceFeedResponseObservable) { - return sourceFeedResponseObservable.onErrorResumeNext( t -> { - DocumentClientException dce = Utils.as(t, DocumentClientException.class); - if (dce == null || !isSplit(dce)) { - logger.error("Unexpected failure", t); - return Observable.error(t); - } - - // we are dealing with Split - logger.info("DocumentProducer handling a partition split in [{}], detail:[{}]", targetRange, dce); - Single> replacementRangesObs = getReplacementRanges(targetRange.toRange()); - - // Since new DocumentProducers are instantiated for the new replacement ranges, if for the new - // replacement partitions split happens the corresponding DocumentProducer can recursively handle splits. - // so this is resilient to split on splits. - Observable> replacementProducers = replacementRangesObs.toObservable().flatMap( - partitionKeyRanges -> { - if (logger.isDebugEnabled()) { - logger.info("Cross Partition Query Execution detected partition [{}] split into [{}] partitions," - + " last continuation token is [{}].", - targetRange.toJson(), - String.join(", ", partitionKeyRanges.stream() - .map(pkr -> pkr.toJson()).collect(Collectors.toList())), - lastResponseContinuationToken); - } - return Observable.from(createReplacingDocumentProducersOnSplit(partitionKeyRanges)); - }); - - return produceOnSplit(replacementProducers); - }); - } - - protected Observable produceOnSplit(Observable> replacingDocumentProducers) { - return replacingDocumentProducers.flatMap(dp -> dp.produceAsync(), 1); - } - - private List> createReplacingDocumentProducersOnSplit(List partitionKeyRanges) { - - List> replacingDocumentProducers = new ArrayList<>(partitionKeyRanges.size()); - for(PartitionKeyRange pkr: partitionKeyRanges) { - replacingDocumentProducers.add(createChildDocumentProducerOnSplit(pkr, lastResponseContinuationToken)); - } - return replacingDocumentProducers; - } - - protected DocumentProducer createChildDocumentProducerOnSplit( - PartitionKeyRange targetRange, - String initialContinuationToken) { - - return new DocumentProducer( - client, - collectionRid, - feedOptions, - createRequestFunc, - executeRequestFuncWithRetries, - targetRange, - collectionLink, - null, - resourceType , - correlatedActivityId, - pageSize, - initialContinuationToken, - top); - } - - private Single> getReplacementRanges(Range range) { - return client.getPartitionKeyRangeCache().tryGetOverlappingRangesAsync(collectionRid, range, true, feedOptions.getProperties()); - } - - private boolean isSplit(DocumentClientException e) { - return Exceptions.isPartitionSplit(e); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextBase.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextBase.java deleted file mode 100644 index 3692ee46e0f1..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextBase.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.RuntimeConstants.MediaTypes; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.ReplicatedResourceClientUtils; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import rx.Observable; -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public abstract class DocumentQueryExecutionContextBase -implements IDocumentQueryExecutionContext { - - protected ResourceType resourceTypeEnum; - protected String resourceLink; - protected IDocumentQueryClient client; - protected Class resourceType; - protected FeedOptions feedOptions; - protected SqlQuerySpec query; - protected UUID correlatedActivityId; - protected boolean shouldExecuteQueryRequest; - - protected DocumentQueryExecutionContextBase(IDocumentQueryClient client, ResourceType resourceTypeEnum, - Class resourceType, SqlQuerySpec query, FeedOptions feedOptions, String resourceLink, - boolean getLazyFeedResponse, UUID correlatedActivityId) { - - // TODO: validate args are not null: client and feedOption should not be null - this.client = client; - this.resourceTypeEnum = resourceTypeEnum; - this.resourceType = resourceType; - this.query = query; - this.shouldExecuteQueryRequest = (query != null); - this.feedOptions = feedOptions; - this.resourceLink = resourceLink; - // this.getLazyFeedResponse = getLazyFeedResponse; - this.correlatedActivityId = correlatedActivityId; - } - - @Override - abstract public Observable> executeAsync(); - - public String getPartitionKeyId() { - // TODO Auto-generated method stub - return this.feedOptions.getPartitionKeyRangeIdInternal(); - } - - public RxDocumentServiceRequest createDocumentServiceRequest(Map requestHeaders, - SqlQuerySpec querySpec, - PartitionKeyInternal partitionKey) { - - RxDocumentServiceRequest request = querySpec != null - ? this.createQueryDocumentServiceRequest(requestHeaders, querySpec) - : this.createReadFeedDocumentServiceRequest(requestHeaders); - - this.populatePartitionKeyInfo(request, partitionKey); - - return request; - } - - protected RxDocumentServiceRequest createDocumentServiceRequest(Map requestHeaders, - SqlQuerySpec querySpec, - PartitionKeyRange targetRange, - String collectionRid) { - RxDocumentServiceRequest request = querySpec != null - ? this.createQueryDocumentServiceRequest(requestHeaders, querySpec) - : this.createReadFeedDocumentServiceRequest(requestHeaders); - - this.populatePartitionKeyRangeInfo(request, targetRange, collectionRid); - - return request; - } - - public Single> executeRequestAsync(RxDocumentServiceRequest request) { - return (this.shouldExecuteQueryRequest ? this.executeQueryRequestAsync(request) - : this.executeReadFeedRequestAsync(request)); - } - - public Single> executeQueryRequestAsync(RxDocumentServiceRequest request) { - return this.getFeedResponse(this.executeQueryRequestInternalAsync(request)); - } - - public Single> executeReadFeedRequestAsync(RxDocumentServiceRequest request) { - return this.getFeedResponse(this.client.readFeedAsync(request)); - } - - protected Single> getFeedResponse(Single response) { - return response.map(resp -> BridgeInternal.toFeedResponsePage(resp, resourceType)); - } - - public FeedOptions getFeedOptions(String continuationToken, Integer maxPageSize) { - FeedOptions options = new FeedOptions(this.feedOptions); - options.setRequestContinuation(continuationToken); - options.setMaxItemCount(maxPageSize); - return options; - } - - private Single executeQueryRequestInternalAsync(RxDocumentServiceRequest request) { - return this.client.executeQueryAsync(request); - } - - public Map createCommonHeadersAsync(FeedOptions feedOptions) { - Map requestHeaders = new HashMap<>(); - - ConsistencyLevel defaultConsistencyLevel = this.client.getDefaultConsistencyLevelAsync(); - ConsistencyLevel desiredConsistencyLevel = this.client.getDesiredConsistencyLevelAsync(); - if (!Strings.isNullOrEmpty(feedOptions.getSessionToken()) - && !ReplicatedResourceClientUtils.isReadingFromMaster(this.resourceTypeEnum, OperationType.ReadFeed)) { - if (defaultConsistencyLevel == ConsistencyLevel.Session - || (desiredConsistencyLevel == ConsistencyLevel.Session)) { - // Query across partitions is not supported today. Master resources (for e.g., - // database) - // can span across partitions, whereas server resources (viz: collection, - // document and attachment) - // don't span across partitions. Hence, session token returned by one partition - // should not be used - // when quering resources from another partition. - // Since master resources can span across partitions, don't send session token - // to the backend. - // As master resources are sync replicated, we should always get consistent - // query result for master resources, - // irrespective of the chosen replica. - // For server resources, which don't span partitions, specify the session token - // for correct replica to be chosen for servicing the query result. - requestHeaders.put(HttpConstants.HttpHeaders.SESSION_TOKEN, feedOptions.getSessionToken()); - } - } - - requestHeaders.put(HttpConstants.HttpHeaders.CONTINUATION, feedOptions.getRequestContinuation()); - requestHeaders.put(HttpConstants.HttpHeaders.IS_QUERY, Strings.toString(true)); - - // Flow the pageSize only when we are not doing client eval - if (feedOptions.getMaxItemCount() != null && feedOptions.getMaxItemCount() > 0) { - requestHeaders.put(HttpConstants.HttpHeaders.PAGE_SIZE, Strings.toString(feedOptions.getMaxItemCount())); - } - - if (feedOptions.getEnableCrossPartitionQuery() != null) { - - requestHeaders.put(HttpConstants.HttpHeaders.ENABLE_CROSS_PARTITION_QUERY, - Strings.toString(feedOptions.getEnableCrossPartitionQuery())); - } - - if (feedOptions.getMaxDegreeOfParallelism() != 0) { - requestHeaders.put(HttpConstants.HttpHeaders.PARALLELIZE_CROSS_PARTITION_QUERY, Strings.toString(true)); - } - - if (this.feedOptions.getEnableCrossPartitionQuery() != null) { - requestHeaders.put(HttpConstants.HttpHeaders.ENABLE_SCAN_IN_QUERY, - Strings.toString(this.feedOptions.getEnableCrossPartitionQuery())); - } - - if (this.feedOptions.getResponseContinuationTokenLimitInKb() > 0) { - requestHeaders.put(HttpConstants.HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB, - Strings.toString(feedOptions.getResponseContinuationTokenLimitInKb())); - } - - if (desiredConsistencyLevel != null) { - requestHeaders.put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, desiredConsistencyLevel.name()); - } - - if(feedOptions.getPopulateQueryMetrics()){ - requestHeaders.put(HttpConstants.HttpHeaders.POPULATE_QUERY_METRICS, String.valueOf(feedOptions.getPopulateQueryMetrics())); - } - - return requestHeaders; - } - - private void populatePartitionKeyInfo(RxDocumentServiceRequest request, PartitionKeyInternal partitionKey) { - if (request == null) { - throw new NullPointerException("request"); - } - - if (this.resourceTypeEnum.isPartitioned()) { - if (partitionKey != null) { - request.getHeaders().put(HttpConstants.HttpHeaders.PARTITION_KEY, partitionKey.toJson()); - } - } - } - - public void populatePartitionKeyRangeInfo(RxDocumentServiceRequest request, PartitionKeyRange range, - String collectionRid) { - if (request == null) { - throw new NullPointerException("request"); - } - - if (range == null) { - throw new NullPointerException("range"); - } - - if (this.resourceTypeEnum.isPartitioned()) { - request.routeTo(new PartitionKeyRangeIdentity(collectionRid, range.getId())); - } - } - - private RxDocumentServiceRequest createQueryDocumentServiceRequest(Map requestHeaders, - SqlQuerySpec querySpec) { - RxDocumentServiceRequest executeQueryRequest; - - String queryText; - switch (this.client.getQueryCompatibilityMode()) { - case SqlQuery: - SqlParameterCollection params = querySpec.getParameters(); - Utils.checkStateOrThrow(params != null && params.size() > 0, "query.parameters", - "Unsupported argument in query compatibility mode '%s'", - this.client.getQueryCompatibilityMode().toString()); - - executeQueryRequest = RxDocumentServiceRequest.create(OperationType.SqlQuery, this.resourceTypeEnum, - this.resourceLink, - // AuthorizationTokenType.PrimaryMasterKey, - requestHeaders); - - executeQueryRequest.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, MediaTypes.JSON); - queryText = querySpec.getQueryText(); - break; - - case Default: - case Query: - default: - executeQueryRequest = RxDocumentServiceRequest.create(OperationType.Query, this.resourceTypeEnum, - this.resourceLink, - // AuthorizationTokenType.PrimaryMasterKey, - requestHeaders); - - executeQueryRequest.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, MediaTypes.QUERY_JSON); - queryText = querySpec.toJson(); - break; - } - - try { - executeQueryRequest.setContentBytes(queryText.getBytes("UTF-8")); - } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block - // TODO: exception should be handled differently - e.printStackTrace(); - } - - return executeQueryRequest; - } - - private RxDocumentServiceRequest createReadFeedDocumentServiceRequest(Map requestHeaders) { - if (this.resourceTypeEnum == ResourceType.Database || this.resourceTypeEnum == ResourceType.Offer) { - return RxDocumentServiceRequest.create(OperationType.ReadFeed, null, this.resourceTypeEnum, - // TODO: we may want to add a constructor to RxDocumentRequest supporting authorization type similar to .net - // AuthorizationTokenType.PrimaryMasterKey, - requestHeaders); - } else { - return RxDocumentServiceRequest.create(OperationType.ReadFeed, this.resourceTypeEnum, this.resourceLink, - // TODO: we may want to add a constructor to RxDocumentRequest supporting authorization type similar to .net - // AuthorizationTokenType.PrimaryMasterKey, - requestHeaders); - } - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextFactory.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextFactory.java deleted file mode 100644 index 4b4b2891dfe5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextFactory.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.List; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.query.PartitionedQueryExecutionInfo; -import com.microsoft.azure.cosmosdb.internal.query.QueryInfo; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; - -import rx.Observable; -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class DocumentQueryExecutionContextFactory { - - private final static int PageSizeFactorForTop = 5; - - private static Single resolveCollection(IDocumentQueryClient client, SqlQuerySpec query, - ResourceType resourceTypeEnum, String resourceLink) { - - RxCollectionCache collectionCache = client.getCollectionCache(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create( - OperationType.Query, - resourceTypeEnum, - resourceLink, null - // TODO AuthorizationTokenType.Invalid) - ); //this request doesnt actually go to server - return collectionCache.resolveCollectionAsync(request); - } - - public static Observable> createDocumentQueryExecutionContextAsync( - IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - boolean isContinuationExpected, - UUID correlatedActivityId) { - - // return proxy - Observable collectionObs = Observable.just(null); - - if (resourceTypeEnum.isCollectionChild()) { - collectionObs = resolveCollection(client, query, resourceTypeEnum, resourceLink).toObservable(); - } - - // We create a ProxyDocumentQueryExecutionContext that will be initialized with DefaultDocumentQueryExecutionContext - // which will be used to send the query to Gateway and on getting 400(bad request) with 1004(cross parition query not servable), we initialize it with - // PipelinedDocumentQueryExecutionContext by providing the partition query execution info that's needed(which we get from the exception returned from Gateway). - - Observable> proxyQueryExecutionContext = - collectionObs.flatMap(collection -> - ProxyDocumentQueryExecutionContext.createAsync( - client, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - collection, - isContinuationExpected, - correlatedActivityId)); - - return proxyQueryExecutionContext; - } - - public static Observable> createSpecializedDocumentQueryExecutionContextAsync( - IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - boolean isContinuationExpected, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, - List targetRanges, - String collectionRid, - UUID correlatedActivityId) { - - int initialPageSize = Utils.getValueOrDefault(feedOptions.getMaxItemCount(), ParallelQueryConfig.ClientInternalPageSize); - - BadRequestException validationError = Utils.checkRequestOrReturnException - (initialPageSize > 0, "MaxItemCount", "Invalid MaxItemCount %s", initialPageSize); - if (validationError != null) { - return Observable.error(validationError); - } - - QueryInfo queryInfo = partitionedQueryExecutionInfo.getQueryInfo(); - - boolean getLazyFeedResponse = queryInfo.hasTop(); - - // We need to compute the optimal initial page size for order-by queries - if (queryInfo.hasOrderBy()) { - int top; - if (queryInfo.hasTop() && (top = partitionedQueryExecutionInfo.getQueryInfo().getTop()) > 0) { - int pageSizeWithTop = Math.min( - (int)Math.ceil(top / (double)targetRanges.size()) * PageSizeFactorForTop, - top); - - if (initialPageSize > 0) { - initialPageSize = Math.min(pageSizeWithTop, initialPageSize); - } - else { - initialPageSize = pageSizeWithTop; - } - } - // TODO: do not support continuation in string format right now - // else if (isContinuationExpected) - // { - // if (initialPageSize < 0) - // { - // initialPageSize = (int)Math.Max(feedOptions.MaxBufferedItemCount, ParallelQueryConfig.GetConfig().DefaultMaximumBufferSize); - // } - // - // initialPageSize = Math.Min( - // (int)Math.Ceiling(initialPageSize / (double)targetRanges.Count) * PageSizeFactorForTop, - // initialPageSize); - // } - } - - return PipelinedDocumentQueryExecutionContext.createAsync( - client, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - collectionRid, - partitionedQueryExecutionInfo, - targetRanges, - initialPageSize, - isContinuationExpected, - getLazyFeedResponse, - correlatedActivityId); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Fetcher.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Fetcher.java deleted file mode 100644 index 07f5e6daad9f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Fetcher.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.FeedOptionsBase; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Observable; -import rx.functions.Func1; -import rx.functions.Func2; - -class Fetcher { - private final static Logger logger = LoggerFactory.getLogger(Fetcher.class); - - private final Func2 createRequestFunc; - private final Func1>> executeFunc; - private final boolean isChangeFeed; - - private volatile boolean shouldFetchMore; - private volatile int maxItemCount; - private volatile int top; - private volatile String continuationToken; - - public Fetcher(Func2 createRequestFunc, - Func1>> executeFunc, - FeedOptionsBase options, - boolean isChangeFeed, - int top, - int maxItemCount) { - - this.createRequestFunc = createRequestFunc; - this.executeFunc = executeFunc; - this.isChangeFeed = isChangeFeed; - - this.continuationToken = options.getRequestContinuation(); - this.top = top; - if (top == -1) { - this.maxItemCount = maxItemCount; - } else { - // it is a top query, we should not retrieve more than requested top. - this.maxItemCount = Math.min(maxItemCount, top); - } - this.shouldFetchMore = true; - } - - public boolean shouldFetchMore() { - return shouldFetchMore; - } - - public Observable> nextPage() { - RxDocumentServiceRequest request = createRequest(); - return nextPage(request); - } - - private void updateState(FeedResponse response) { - continuationToken = response.getResponseContinuation(); - if (top != -1) { - top -= response.getResults().size(); - if (top < 0) { - // this shouldn't happen - // this means backend retrieved more items than requested - logger.warn("Azure Cosmos DB BackEnd Service returned more than requested {} items", maxItemCount); - top = 0; - } - maxItemCount = Math.min(maxItemCount, top); - } - - shouldFetchMore = shouldFetchMore && - // if token is null or top == 0 then done - (!StringUtils.isEmpty(continuationToken) && (top != 0)) && - // if change feed query and no changes then done - (!isChangeFeed || !BridgeInternal.noChanges(response)); - - logger.debug("Fetcher state updated: " + - "isChangeFeed = {}, continuation token = {}, max item count = {}, should fetch more = {}", - isChangeFeed, continuationToken, maxItemCount, shouldFetchMore); - } - - private RxDocumentServiceRequest createRequest() { - if (!shouldFetchMore) { - // this should never happen - logger.error("invalid state, trying to fetch more after completion"); - throw new IllegalStateException("Invalid state, trying to fetch more after completion"); - } - - return createRequestFunc.call(continuationToken, maxItemCount); - } - - private Observable> nextPage(RxDocumentServiceRequest request) { - return executeFunc.call(request).map(rsp -> { - updateState(rsp); - return rsp; - }); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryClient.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryClient.java deleted file mode 100644 index 3ac016471730..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryClient.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicyFactory; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache; - -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IDocumentQueryClient { - - /** - * TODO: this should be async returning observable - * @return - */ - RxCollectionCache getCollectionCache(); - - /** - * TODO: this should be async returning observable - * @return - */ - IPartitionKeyRangeCache getPartitionKeyRangeCache(); - - /** - * @return - */ - IRetryPolicyFactory getResetSessionTokenRetryPolicy(); - - /** - * TODO: this should be async returning observable - * @return - */ - ConsistencyLevel getDefaultConsistencyLevelAsync(); - - /** - * TODO: this should be async returning observable - * @return - */ - ConsistencyLevel getDesiredConsistencyLevelAsync(); - - Single executeQueryAsync(RxDocumentServiceRequest request); - - QueryCompatibilityMode getQueryCompatibilityMode(); - - /// - /// A client query compatibility mode when making query request. - /// Can be used to force a specific query request format. - /// - enum QueryCompatibilityMode { - /// - /// Default (latest) query format. - /// - Default, - - /// - /// Query (application/query+json). - /// Default. - /// - Query, - - /// - /// SqlQuery (application/sql). - /// - SqlQuery - } - - Single readFeedAsync(RxDocumentServiceRequest request); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionComponent.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionComponent.java deleted file mode 100644 index b1a260e54911..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionComponent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; - -import rx.Observable; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IDocumentQueryExecutionComponent { - - Observable> drainAsync(int maxPageSize); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionContext.java deleted file mode 100644 index bb2cd7f1787a..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionContext.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; - -import rx.Observable; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IDocumentQueryExecutionContext { - - Observable> executeAsync(); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByContinuationToken.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByContinuationToken.java deleted file mode 100644 index 79b04551db6b..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByContinuationToken.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public final class OrderByContinuationToken extends JsonSerializable { - private static final String CompositeContinuationTokenPropertyName = "compositeToken"; - private static final String OrderByItemsPropetryName = "orderByItems"; - private static final String RidPropertyName = "rid"; - private static final String InclusivePropertyName = "inclusive"; - private static final Logger logger = LoggerFactory.getLogger(OrderByContinuationToken.class); - - public OrderByContinuationToken(CompositeContinuationToken compositeContinuationToken, QueryItem[] orderByItems, - String rid, boolean inclusive) { - if (compositeContinuationToken == null) { - throw new IllegalArgumentException("CompositeContinuationToken must not be null."); - } - - if (orderByItems == null) { - throw new IllegalArgumentException("orderByItems must not be null."); - } - - if (orderByItems.length == 0) { - throw new IllegalArgumentException("orderByItems must not be empty."); - } - - if (rid == null) { - throw new IllegalArgumentException("rid must not be null."); - } - - this.setCompositeContinuationToken(compositeContinuationToken); - this.setOrderByItems(orderByItems); - this.setRid(rid); - this.setInclusive(inclusive); - } - - private OrderByContinuationToken(String serializedOrderByContinuationToken) { - super(serializedOrderByContinuationToken); - } - - public static boolean tryParse(String serializedOrderByContinuationToken, - ValueHolder outOrderByContinuationToken) { - boolean parsed; - try { - OrderByContinuationToken orderByContinuationToken = new OrderByContinuationToken( - serializedOrderByContinuationToken); - CompositeContinuationToken compositeContinuationToken = orderByContinuationToken - .getCompositeContinuationToken(); - if (compositeContinuationToken == null) { - throw new IllegalArgumentException("compositeContinuationToken must not be null."); - } - - orderByContinuationToken.getOrderByItems(); - orderByContinuationToken.getRid(); - orderByContinuationToken.getInclusive(); - - outOrderByContinuationToken.v = orderByContinuationToken; - parsed = true; - } catch (Exception ex) { - logger.debug( - "Received exception {} when trying to parse: {}", - ex.getMessage(), - serializedOrderByContinuationToken); - parsed = false; - outOrderByContinuationToken.v = null; - } - - return parsed; - } - - public CompositeContinuationToken getCompositeContinuationToken() { - ValueHolder outCompositeContinuationToken = new ValueHolder(); - boolean succeeded = CompositeContinuationToken.tryParse(super.getString(CompositeContinuationTokenPropertyName), - outCompositeContinuationToken); - if (!succeeded) { - throw new IllegalArgumentException("Continuation Token was not able to be parsed"); - } - - return outCompositeContinuationToken.v; - } - - public QueryItem[] getOrderByItems() { - List queryItems = new ArrayList(); - ArrayNode arrayNode = (ArrayNode) super.get(OrderByItemsPropetryName); - for (JsonNode jsonNode : arrayNode) { - QueryItem queryItem = new QueryItem(jsonNode.toString()); - queryItems.add(queryItem); - } - - QueryItem[] queryItemsArray = new QueryItem[queryItems.size()]; - - return queryItems.toArray(queryItemsArray); - } - - public String getRid() { - return super.getString(RidPropertyName); - } - - public boolean getInclusive() { - return super.getBoolean(InclusivePropertyName); - } - - private void setCompositeContinuationToken(CompositeContinuationToken compositeContinuationToken) { - super.set(CompositeContinuationTokenPropertyName, compositeContinuationToken.toJson()); - } - - private void setOrderByItems(QueryItem[] orderByItems) { - super.set(OrderByItemsPropetryName, orderByItems); - } - - private void setRid(String rid) { - super.set(RidPropertyName, rid); - } - - private void setInclusive(boolean inclusive) { - super.set(InclusivePropertyName, inclusive); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentProducer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentProducer.java deleted file mode 100644 index 8d36a6ce8f68..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentProducer.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderByRowResult; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderbyRowComparer; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import com.microsoft.azure.cosmosdb.QueryMetrics; -import rx.Observable; -import rx.functions.Func0; -import rx.functions.Func1; -import rx.functions.Func3; - -class OrderByDocumentProducer extends DocumentProducer { - private final OrderbyRowComparer consumeComparer; - private final Map targetRangeToOrderByContinuationTokenMap; - - OrderByDocumentProducer( - OrderbyRowComparer consumeComparer, - IDocumentQueryClient client, - String collectionResourceId, - FeedOptions feedOptions, - Func3 createRequestFunc, - Func1>> executeRequestFunc, - PartitionKeyRange targetRange, - String collectionLink, - Func0 createRetryPolicyFunc, - Class resourceType, - UUID correlatedActivityId, - int initialPageSize, - String initialContinuationToken, - int top, - Map targetRangeToOrderByContinuationTokenMap) { - super(client, collectionResourceId, feedOptions, createRequestFunc, executeRequestFunc, targetRange, collectionLink, - createRetryPolicyFunc, resourceType, correlatedActivityId, initialPageSize, initialContinuationToken, top); - this.consumeComparer = consumeComparer; - this.targetRangeToOrderByContinuationTokenMap = targetRangeToOrderByContinuationTokenMap; - } - - protected Observable produceOnSplit(Observable> replacementProducers) { - Observable res = replacementProducers.toList().single().flatMap(documentProducers -> { - RequestChargeTracker tracker = new RequestChargeTracker(); - Map queryMetricsMap = new HashMap<>(); - return OrderByUtils.orderedMerge(resourceType, consumeComparer, tracker, documentProducers, queryMetricsMap, - targetRangeToOrderByContinuationTokenMap) - .map(orderByQueryResult -> resultPageFrom(tracker, orderByQueryResult)); - }); - - return res; - } - - @SuppressWarnings("unchecked") - private DocumentProducerFeedResponse resultPageFrom(RequestChargeTracker tracker, OrderByRowResult row) { - double requestCharge = tracker.getAndResetCharge(); - Map headers = Utils.immutableMapOf(HttpConstants.HttpHeaders.REQUEST_CHARGE, String.valueOf(requestCharge)); - FeedResponse fr = BridgeInternal.createFeedResponse(Collections.singletonList((T) row), headers); - return new DocumentProducerFeedResponse(fr, row.getSourcePartitionKeyRange()); - } - - protected DocumentProducer createChildDocumentProducerOnSplit( - PartitionKeyRange targetRange, - String initialContinuationToken) { - - return new OrderByDocumentProducer<>( - consumeComparer, - client, - collectionRid, - feedOptions, - createRequestFunc, - executeRequestFuncWithRetries, - targetRange, - collectionLink, - createRetryPolicyFunc, - resourceType , - correlatedActivityId, - pageSize, - initialContinuationToken, - top, - this.targetRangeToOrderByContinuationTokenMap); - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentQueryExecutionContext.java deleted file mode 100644 index 64edee55c03c..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentQueryExecutionContext.java +++ /dev/null @@ -1,654 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.function.Function; - -import org.apache.commons.lang3.NotImplementedException; -import org.apache.commons.lang3.tuple.ImmutablePair; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.query.PartitionedQueryExecutionInfo; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.query.SortOrder; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderByRowResult; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderbyRowComparer; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import rx.Observable; -import rx.Observable.Transformer; -import rx.functions.Func0; -import rx.functions.Func1; -import rx.functions.Func3; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class OrderByDocumentQueryExecutionContext - extends ParallelDocumentQueryExecutionContextBase { - private final String FormatPlaceHolder = "{documentdb-formattableorderbyquery-filter}"; - private final String True = "true"; - private final String collectionRid; - private final OrderbyRowComparer consumeComparer; - private final RequestChargeTracker tracker; - private final ConcurrentMap queryMetricMap; - private Observable> orderByObservable; - private final Map targetRangeToOrderByContinuationTokenMap; - - private OrderByDocumentQueryExecutionContext( - IDocumentQueryClient client, - List partitionKeyRanges, - ResourceType resourceTypeEnum, - Class klass, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - String rewrittenQuery, - boolean isContinuationExpected, - boolean getLazyFeedResponse, - OrderbyRowComparer consumeComparer, - String collectionRid, - UUID correlatedActivityId) { - super(client, partitionKeyRanges, resourceTypeEnum, klass, query, feedOptions, resourceLink, rewrittenQuery, - isContinuationExpected, getLazyFeedResponse, correlatedActivityId); - this.collectionRid = collectionRid; - this.consumeComparer = consumeComparer; - this.tracker = new RequestChargeTracker(); - this.queryMetricMap = new ConcurrentHashMap<>(); - targetRangeToOrderByContinuationTokenMap = new HashMap<>(); - } - - public static Observable> createAsync( - IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec expression, - FeedOptions feedOptions, - String resourceLink, - String collectionRid, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, - List partitionKeyRanges, - int initialPageSize, - boolean isContinuationExpected, - boolean getLazyFeedResponse, - UUID correlatedActivityId) { - - OrderByDocumentQueryExecutionContext context = new OrderByDocumentQueryExecutionContext(client, - partitionKeyRanges, - resourceTypeEnum, - resourceType, - expression, - feedOptions, - resourceLink, - partitionedQueryExecutionInfo.getQueryInfo().getRewrittenQuery(), - isContinuationExpected, - getLazyFeedResponse, - new OrderbyRowComparer(partitionedQueryExecutionInfo.getQueryInfo().getOrderBy()), - collectionRid, - correlatedActivityId); - - try { - context.initialize(partitionKeyRanges, - partitionedQueryExecutionInfo.getQueryInfo().getOrderBy(), - partitionedQueryExecutionInfo.getQueryInfo().getOrderByExpressions(), - initialPageSize, - feedOptions.getRequestContinuation()); - - return Observable.just(context); - } catch (DocumentClientException dce) { - return Observable.error(dce); - } - } - - private void initialize( - List partitionKeyRanges, - List sortOrders, - Collection orderByExpressions, - int initialPageSize, - String continuationToken) throws DocumentClientException { - if (continuationToken == null) { - // First iteration so use null continuation tokens and "true" filters - Map partitionKeyRangeToContinuationToken = new HashMap(); - for (PartitionKeyRange partitionKeyRange : partitionKeyRanges) { - partitionKeyRangeToContinuationToken.put(partitionKeyRange, - null); - } - - super.initialize(collectionRid, - partitionKeyRangeToContinuationToken, - initialPageSize, - new SqlQuerySpec(querySpec.getQueryText().replace(FormatPlaceHolder, - True), - querySpec.getParameters())); - } else { - // Check to see if order by continuation token is a valid JSON. - OrderByContinuationToken orderByContinuationToken; - ValueHolder outOrderByContinuationToken = new ValueHolder(); - if (!OrderByContinuationToken.tryParse(continuationToken, - outOrderByContinuationToken)) { - String message = String.format("Invalid JSON in continuation token %s for OrderBy~Context", - continuationToken); - throw new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, - message); - } - - orderByContinuationToken = outOrderByContinuationToken.v; - - CompositeContinuationToken compositeContinuationToken = orderByContinuationToken - .getCompositeContinuationToken(); - // Check to see if the ranges inside are valid - if (compositeContinuationToken.getRange().isEmpty()) { - String message = String.format("Invalid Range in the continuation token %s for OrderBy~Context.", - continuationToken); - throw new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, - message); - } - - // At this point the token is valid. - ImmutablePair targetIndexAndFilters = this.GetFiltersForPartitions( - orderByContinuationToken, - partitionKeyRanges, - sortOrders, - orderByExpressions); - - int targetIndex = targetIndexAndFilters.left; - targetRangeToOrderByContinuationTokenMap.put(String.valueOf(targetIndex), orderByContinuationToken); - FormattedFilterInfo formattedFilterInfo = targetIndexAndFilters.right; - - // Left - String filterForRangesLeftOfTheTargetRange = formattedFilterInfo.getFilterForRangesLeftOfTheTargetRange(); - this.initializeRangeWithContinuationTokenAndFilter(partitionKeyRanges, - /* startInclusive */ 0, - /* endExclusive */ targetIndex, - /* continuationToken */ null, - filterForRangesLeftOfTheTargetRange, - initialPageSize); - - // Target - String filterForTargetRange = formattedFilterInfo.getFilterForTargetRange(); - this.initializeRangeWithContinuationTokenAndFilter(partitionKeyRanges, - /* startInclusive */ targetIndex, - /* endExclusive */ targetIndex + 1, - null, - filterForTargetRange, - initialPageSize); - - // Right - String filterForRangesRightOfTheTargetRange = formattedFilterInfo.getFilterForRangesRightOfTheTargetRange(); - this.initializeRangeWithContinuationTokenAndFilter(partitionKeyRanges, - /* startInclusive */ targetIndex + 1, - /* endExclusive */ partitionKeyRanges.size(), - /* continuationToken */ null, - filterForRangesRightOfTheTargetRange, - initialPageSize); - } - - orderByObservable = OrderByUtils.orderedMerge(resourceType, - consumeComparer, - tracker, - documentProducers, - queryMetricMap, - targetRangeToOrderByContinuationTokenMap); - } - - private void initializeRangeWithContinuationTokenAndFilter( - List partitionKeyRanges, - int startInclusive, - int endExclusive, - String continuationToken, - String filter, - int initialPageSize) { - Map partitionKeyRangeToContinuationToken = new HashMap(); - for (int i = startInclusive; i < endExclusive; i++) { - PartitionKeyRange partitionKeyRange = partitionKeyRanges.get(i); - partitionKeyRangeToContinuationToken.put(partitionKeyRange, - continuationToken); - } - - super.initialize(collectionRid, - partitionKeyRangeToContinuationToken, - initialPageSize, - new SqlQuerySpec(querySpec.getQueryText().replace(FormatPlaceHolder, - filter), - querySpec.getParameters())); - } - - private ImmutablePair GetFiltersForPartitions( - OrderByContinuationToken orderByContinuationToken, - List partitionKeyRanges, - List sortOrders, - Collection orderByExpressions) throws DocumentClientException { - // Find the partition key range we left off on - int startIndex = this.FindTargetRangeAndExtractContinuationTokens(partitionKeyRanges, - orderByContinuationToken.getCompositeContinuationToken().getRange()); - - // Get the filters. - FormattedFilterInfo formattedFilterInfo = this.GetFormattedFilters(orderByExpressions, - orderByContinuationToken.getOrderByItems(), - sortOrders, - orderByContinuationToken.getInclusive()); - - return new ImmutablePair(startIndex, - formattedFilterInfo); - } - - private OrderByDocumentQueryExecutionContext.FormattedFilterInfo GetFormattedFilters( - Collection orderByExpressionCollection, - QueryItem[] orderByItems, - Collection sortOrderCollection, - boolean inclusive) { - // Convert to arrays - SortOrder[] sortOrders = new SortOrder[sortOrderCollection.size()]; - sortOrderCollection.toArray(sortOrders); - - String[] expressions = new String[orderByExpressionCollection.size()]; - orderByExpressionCollection.toArray(expressions); - - // Validate the inputs - if (expressions.length != sortOrders.length) { - throw new IllegalArgumentException("expressions.size() != sortOrders.size()"); - } - - if (expressions.length != orderByItems.length) { - throw new IllegalArgumentException("expressions.size() != orderByItems.length"); - } - - // When we run cross partition queries, - // we only serialize the continuation token for the partition that we left off - // on. - // The only problem is that when we resume the order by query, - // we don't have continuation tokens for all other partitions. - // The saving grace is that the data has a composite sort order(query sort - // order, partition key range id) - // so we can generate range filters which in turn the backend will turn into rid - // based continuation tokens, - // which is enough to get the streams of data flowing from all partitions. - // The details of how this is done is described below: - - int numOrderByItems = expressions.length; - boolean isSingleOrderBy = numOrderByItems == 1; - StringBuilder left = new StringBuilder(); - StringBuilder target = new StringBuilder(); - StringBuilder right = new StringBuilder(); - - if (isSingleOrderBy) { - // For a single order by query we resume the continuations in this manner - // Suppose the query is SELECT* FROM c ORDER BY c.string ASC - // And we left off on partition N with the value "B" - // Then - // All the partitions to the left will have finished reading "B" - // Partition N is still reading "B" - // All the partitions to the right have let to read a "B - // Therefore the filters should be - // > "B" , >= "B", and >= "B" respectively - // Repeat the same logic for DESC and you will get - // < "B", <= "B", and <= "B" respectively - // The general rule becomes - // For ASC - // > for partitions to the left - // >= for the partition we left off on - // >= for the partitions to the right - // For DESC - // < for partitions to the left - // <= for the partition we left off on - // <= for the partitions to the right - String expression = expressions[0]; - SortOrder sortOrder = sortOrders[0]; - QueryItem orderByItem = orderByItems[0]; - Object rawItem = orderByItem.getItem(); - String orderByItemToString; - if (rawItem instanceof String) { - orderByItemToString = "\"" + rawItem.toString().replaceAll("\"", - "\\\"") + "\""; - } else { - orderByItemToString = rawItem.toString(); - } - - left.append(String.format("%s %s %s", - expression, - (sortOrder == SortOrder.Descending ? "<" : ">"), - orderByItemToString)); - - if (inclusive) { - target.append(String.format("%s %s %s", - expression, - (sortOrder == SortOrder.Descending ? "<=" : ">="), - orderByItemToString)); - } else { - target.append(String.format("%s %s %s", - expression, - (sortOrder == SortOrder.Descending ? "<" : ">"), - orderByItemToString)); - } - - right.append(String.format("%s %s %s", - expression, - (sortOrder == SortOrder.Descending ? "<=" : ">="), - orderByItemToString)); - } else { - // This code path needs to be implemented, but it's error prone and needs - // testing. - // You can port the implementation from the .net SDK and it should work if - // ported right. - throw new NotImplementedException( - "Resuming a multi order by query from a continuation token is not supported yet."); - } - - return new FormattedFilterInfo(left.toString(), - target.toString(), - right.toString()); - } - - protected OrderByDocumentProducer createDocumentProducer( - String collectionRid, - PartitionKeyRange targetRange, - String continuationToken, - int initialPageSize, - FeedOptions feedOptions, - SqlQuerySpec querySpecForInit, - Map commonRequestHeaders, - Func3 createRequestFunc, - Func1>> executeFunc, - Func0 createRetryPolicyFunc) { - return new OrderByDocumentProducer(consumeComparer, - client, - collectionRid, - feedOptions, - createRequestFunc, - executeFunc, - targetRange, - collectionRid, - () -> client.getResetSessionTokenRetryPolicy().getRequestPolicy(), - resourceType, - correlatedActivityId, - initialPageSize, - continuationToken, - top, - this.targetRangeToOrderByContinuationTokenMap); - } - - private static class ItemToPageTransformer - implements Transformer, FeedResponse> { - private final static int DEFAULT_PAGE_SIZE = 100; - private final RequestChargeTracker tracker; - private final int maxPageSize; - private final ConcurrentMap queryMetricMap; - private final Function, String> orderByContinuationTokenCallback; - private volatile FeedResponse> previousPage; - - public ItemToPageTransformer( - RequestChargeTracker tracker, - int maxPageSize, - ConcurrentMap queryMetricsMap, - Function, String> orderByContinuationTokenCallback) { - this.tracker = tracker; - this.maxPageSize = maxPageSize > 0 ? maxPageSize : DEFAULT_PAGE_SIZE; - this.queryMetricMap = queryMetricsMap; - this.orderByContinuationTokenCallback = orderByContinuationTokenCallback; - this.previousPage = null; - } - - private static Map headerResponse( - double requestCharge) { - return Utils.immutableMapOf(HttpConstants.HttpHeaders.REQUEST_CHARGE, - String.valueOf(requestCharge)); - } - - private FeedResponse> addOrderByContinuationToken( - FeedResponse> page, - String orderByContinuationToken) { - Map headers = new HashMap<>(page.getResponseHeaders()); - headers.put(HttpConstants.HttpHeaders.CONTINUATION, - orderByContinuationToken); - return BridgeInternal.createFeedResponseWithQueryMetrics(page.getResults(), - headers, - page.getQueryMetrics()); - } - - @Override - public Observable> call( - Observable> source) { - return source - // .windows: creates an observable of observable where inner observable - // emits max maxPageSize elements - .window(maxPageSize).map(o -> o.toList()) - // flattens the observable>>> to - // Observable>> - .flatMap(resultListObs -> resultListObs, - 1) - // translates Observable>> to - // Observable>>> - .map(orderByRowResults -> { - // construct a page from result with request charge - FeedResponse> feedResponse = BridgeInternal.createFeedResponse( - orderByRowResults, - headerResponse(tracker.getAndResetCharge())); - if (!queryMetricMap.isEmpty()) { - for (String key : queryMetricMap.keySet()) { - BridgeInternal.putQueryMetricsIntoMap(feedResponse, - key, - queryMetricMap.get(key)); - } - } - return feedResponse; - }) - // Emit an empty page so the downstream observables know when there are no more - // results. - .concatWith(Observable.defer(() -> { - return Observable.just(BridgeInternal.createFeedResponse(Utils.immutableListOf(), - null)); - })) - // Create pairs from the stream to allow the observables downstream to "peek" - // 1, 2, 3, null -> (null, 1), (1, 2), (2, 3), (3, null) - .map(orderByRowResults -> { - ImmutablePair>, FeedResponse>> previousCurrent = new ImmutablePair>, FeedResponse>>( - this.previousPage, - orderByRowResults); - this.previousPage = orderByRowResults; - return previousCurrent; - }) - // remove the (null, 1) - .skip(1) - // Add the continuation token based on the current and next page. - .map(currentNext -> { - FeedResponse> current = currentNext.left; - FeedResponse> next = currentNext.right; - - FeedResponse> page; - if (next.getResults().size() == 0) { - // No more pages no send current page with null continuation token - page = current; - page = this.addOrderByContinuationToken(page, - null); - } else { - // Give the first page but use the first value in the next page to generate the - // continuation token - page = current; - List> results = next.getResults(); - OrderByRowResult firstElementInNextPage = results.get(0); - String orderByContinuationToken = this.orderByContinuationTokenCallback - .apply(firstElementInNextPage); - page = this.addOrderByContinuationToken(page, - orderByContinuationToken); - } - - return page; - }).map(feedOfOrderByRowResults -> { - // FeedResponse> to FeedResponse - List unwrappedResults = new ArrayList(); - for (OrderByRowResult orderByRowResult : feedOfOrderByRowResults.getResults()) { - unwrappedResults.add(orderByRowResult.getPayload()); - } - - return BridgeInternal.createFeedResponseWithQueryMetrics(unwrappedResults, - feedOfOrderByRowResults.getResponseHeaders(), - feedOfOrderByRowResults.getQueryMetrics()); - }).switchIfEmpty(Observable.defer(() -> { - // create an empty page if there is no result - return Observable.just(BridgeInternal.createFeedResponse(Utils.immutableListOf(), - headerResponse(tracker.getAndResetCharge()))); - })); - } - } - - @Override - public Observable> drainAsync( - int maxPageSize) { - //// In order to maintain the continuation token for the user we must drain with - //// a few constraints - //// 1) We always drain from the partition, which has the highest priority item - //// first - //// 2) If multiple partitions have the same priority item then we drain from - //// the left most first - //// otherwise we would need to keep track of how many of each item we drained - //// from each partition - //// (just like parallel queries). - //// Visually that look the following case where we have three partitions that - //// are numbered and store letters. - //// For teaching purposes I have made each item a tuple of the following form: - //// - //// So that duplicates across partitions are distinct, but duplicates within - //// partitions are indistinguishable. - //// |-------| |-------| |-------| - //// | | | | | | - //// | | | | | | - //// | | | | | | - //// | | | | | | - //// | | | | | | - //// | | | | | | - //// | | | | | | - //// |-------| |-------| |-------| - //// Now the correct drain order in this case is: - //// ,,,,,,,,,,, - //// ,,,,,,,,, - //// In more mathematical terms - //// 1) always comes before where x < z - //// 2) always come before where j < k - return this.orderByObservable.compose(new ItemToPageTransformer(tracker, - maxPageSize, - this.queryMetricMap, - ( - orderByRowResult) -> { - return this.getContinuationToken(orderByRowResult); - })); - } - - @Override - public Observable> executeAsync() { - return drainAsync(feedOptions.getMaxItemCount()); - } - - private String getContinuationToken( - OrderByRowResult orderByRowResult) { - // rid - String rid = orderByRowResult.getResourceId(); - - // CompositeContinuationToken - String backendContinuationToken = orderByRowResult.getSourceBackendContinuationToken(); - Range range = orderByRowResult.getSourcePartitionKeyRange().toRange(); - - boolean inclusive = true; - CompositeContinuationToken compositeContinuationToken = new CompositeContinuationToken(backendContinuationToken, - range); - - // OrderByItems - QueryItem[] orderByItems = new QueryItem[orderByRowResult.getOrderByItems().size()]; - orderByRowResult.getOrderByItems().toArray(orderByItems); - - return new OrderByContinuationToken(compositeContinuationToken, - orderByItems, - rid, - inclusive).toJson(); - } - - private final class FormattedFilterInfo { - private final String filterForRangesLeftOfTheTargetRange; - private final String filterForTargetRange; - private final String filterForRangesRightOfTheTargetRange; - - public FormattedFilterInfo( - String filterForRangesLeftOfTheTargetRange, - String filterForTargetRange, - String filterForRangesRightOfTheTargetRange) { - if (filterForRangesLeftOfTheTargetRange == null) { - throw new IllegalArgumentException("filterForRangesLeftOfTheTargetRange must not be null."); - } - - if (filterForTargetRange == null) { - throw new IllegalArgumentException("filterForTargetRange must not be null."); - } - - if (filterForRangesRightOfTheTargetRange == null) { - throw new IllegalArgumentException("filterForRangesRightOfTheTargetRange must not be null."); - } - - this.filterForRangesLeftOfTheTargetRange = filterForRangesLeftOfTheTargetRange; - this.filterForTargetRange = filterForTargetRange; - this.filterForRangesRightOfTheTargetRange = filterForRangesRightOfTheTargetRange; - } - - /** - * @return the filterForRangesLeftOfTheTargetRange - */ - public String getFilterForRangesLeftOfTheTargetRange() { - return filterForRangesLeftOfTheTargetRange; - } - - /** - * @return the filterForTargetRange - */ - public String getFilterForTargetRange() { - return filterForTargetRange; - } - - /** - * @return the filterForRangesRightOfTheTargetRange - */ - public String getFilterForRangesRightOfTheTargetRange() { - return filterForRangesRightOfTheTargetRange; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByUtils.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByUtils.java deleted file mode 100644 index e7eb77377b7f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByUtils.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.github.davidmoten.rx.Transformers; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.internal.query.ItemComparator; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.query.SortOrder; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderByRowResult; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderbyRowComparer; -import com.microsoft.azure.cosmosdb.QueryMetrics; - -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import org.apache.commons.lang3.tuple.Pair; -import rx.Observable; -import rx.Observable.Transformer; - -class OrderByUtils { - - public static Observable> orderedMerge(Class klass, - OrderbyRowComparer consumeComparer, - RequestChargeTracker tracker, - List> documentProducers, - Map queryMetricsMap, - Map targetRangeToOrderByContinuationTokenMap) { - return toOrderByQueryResultObservable(klass, documentProducers.get(0), tracker, queryMetricsMap, targetRangeToOrderByContinuationTokenMap, consumeComparer.getSortOrders()) - .compose( - Transformers.orderedMergeWith( - documentProducers.subList(1, documentProducers.size()) - .stream() - .map(producer -> toOrderByQueryResultObservable(klass, producer, tracker, queryMetricsMap, targetRangeToOrderByContinuationTokenMap, consumeComparer.getSortOrders())) - .collect(Collectors.toList()), consumeComparer, false, 1)); - } - - private static Observable> toOrderByQueryResultObservable(Class klass, - DocumentProducer producer, - RequestChargeTracker tracker, - Map queryMetricsMap, - Map targetRangeToOrderByContinuationTokenMap, - List sortOrders) { - return producer - .produceAsync() - .compose(new OrderByUtils.PageToItemTransformer(klass, tracker, queryMetricsMap, targetRangeToOrderByContinuationTokenMap, sortOrders)); - } - - private static class PageToItemTransformer implements Transformer.DocumentProducerFeedResponse, OrderByRowResult> { - private final RequestChargeTracker tracker; - private final Class klass; - private final Map queryMetricsMap; - private final Map targetRangeToOrderByContinuationTokenMap; - private final List sortOrders; - - public PageToItemTransformer(Class klass, RequestChargeTracker tracker, Map queryMetricsMap, - Map targetRangeToOrderByContinuationTokenMap, List sortOrders) { - this.klass = klass; - this.tracker = tracker; - this.queryMetricsMap = queryMetricsMap; - this.targetRangeToOrderByContinuationTokenMap = targetRangeToOrderByContinuationTokenMap; - this.sortOrders = sortOrders; - } - - @Override - public Observable> call(Observable.DocumentProducerFeedResponse> source) { - return source.flatMap(documentProducerFeedResponse -> { - for (String key : documentProducerFeedResponse.pageResult.getQueryMetrics().keySet()) { - if (queryMetricsMap.containsKey(key)) { - QueryMetrics qm = documentProducerFeedResponse.pageResult.getQueryMetrics().get(key); - queryMetricsMap.get(key).add(qm); - } else { - queryMetricsMap.put(key, documentProducerFeedResponse.pageResult.getQueryMetrics().get(key)); - } - } - List results = documentProducerFeedResponse.pageResult.getResults(); - OrderByContinuationToken orderByContinuationToken = targetRangeToOrderByContinuationTokenMap.get(documentProducerFeedResponse.sourcePartitionKeyRange.getId()); - if (orderByContinuationToken != null) { - Pair booleanResourceIdPair = ResourceId.tryParse(orderByContinuationToken.getRid()); - if (!booleanResourceIdPair.getLeft()) { - return Observable.error(new BadRequestException(String.format("Invalid Rid in the continuation token %s for OrderBy~Context.", - orderByContinuationToken.getCompositeContinuationToken().getToken()))); - } - ResourceId continuationTokenRid = booleanResourceIdPair.getRight(); - results = results.stream() - .filter(tOrderByRowResult -> { - // When we resume a query on a partition there is a possibility that we only read a partial page from the backend - // meaning that will we repeat some documents if we didn't do anything about it. - // The solution is to filter all the documents that come before in the sort order, since we have already emitted them to the client. - // The key is to seek until we get an order by value that matches the order by value we left off on. - // Once we do that we need to seek to the correct _rid within the term, - // since there might be many documents with the same order by value we left off on. - List queryItems = new ArrayList(); - ArrayNode arrayNode = (ArrayNode) tOrderByRowResult.get("orderByItems"); - for (JsonNode jsonNode : arrayNode) { - QueryItem queryItem = new QueryItem(jsonNode.toString()); - queryItems.add(queryItem); - } - - // Check if its the same orderby item from the token - long cmp = 0; - for (int i = 0; i < sortOrders.size(); i++) { - cmp = ItemComparator.getInstance().compare(orderByContinuationToken.getOrderByItems()[i].getItem(), - queryItems.get(i).getItem()); - if (cmp != 0) { - cmp = sortOrders.get(i).equals(SortOrder.Descending) ? -cmp : cmp; - break; - } - } - - if (cmp == 0) { - // Once the item matches the order by items from the continuation tokens - // We still need to remove all the documents that have a lower rid in the rid sort order. - // If there is a tie in the sort order the documents should be in _rid order in the same direction as the first order by field. - // So if it's ORDER BY c.age ASC, c.name DESC the _rids are ASC - // If ti's ORDER BY c.age DESC, c.name DESC the _rids are DESC - cmp = (continuationTokenRid.getDocument() - ResourceId.tryParse(tOrderByRowResult.getResourceId()).getRight().getDocument()); - - if (sortOrders.iterator().next().equals(SortOrder.Descending)) { - cmp = -cmp; - } - return (cmp <= 0); - } - return true; - - }) - .collect(Collectors.toList()); - - } - - tracker.addCharge(documentProducerFeedResponse.pageResult.getRequestCharge()); - Observable x = Observable.from(results); - - return x.map(r -> new OrderByRowResult( - klass, - r.toJson(), - documentProducerFeedResponse.sourcePartitionKeyRange, - documentProducerFeedResponse.pageResult.getResponseContinuation())); - }, 1); - } - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Paginator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Paginator.java deleted file mode 100644 index 45ec5692e769..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Paginator.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptionsBase; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Observer; -import rx.functions.Func1; -import rx.functions.Func2; -import rx.observables.AsyncOnSubscribe; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class Paginator { - - private final static Logger logger = LoggerFactory.getLogger(Paginator.class); - - public static Observable> getPaginatedChangeFeedQueryResultAsObservable( - ChangeFeedOptions feedOptions, Func2 createRequestFunc, - Func1>> executeFunc, Class resourceType, - int maxPageSize) { - return getPaginatedQueryResultAsObservable(feedOptions, createRequestFunc, executeFunc, resourceType, - -1, maxPageSize, true); - } - - public static Observable> getPaginatedQueryResultAsObservable( - FeedOptions feedOptions, - Func2 createRequestFunc, - Func1>> executeFunc, Class resourceType, - int maxPageSize) { - return getPaginatedQueryResultAsObservable(feedOptions, createRequestFunc, executeFunc, resourceType, - -1, maxPageSize); - } - - public static Observable> getPaginatedQueryResultAsObservable( - FeedOptions options, - Func2 createRequestFunc, - Func1>> executeFunc, Class resourceType, - int top, int maxPageSize) { - return getPaginatedQueryResultAsObservable(options, createRequestFunc, executeFunc, resourceType, - top, maxPageSize, false); - } - - private static Observable> getPaginatedQueryResultAsObservable( - FeedOptionsBase options, - Func2 createRequestFunc, - Func1>> executeFunc, Class resourceType, - int top, int maxPageSize, boolean isChangeFeed) { - - Observable> obs = Observable.defer(() -> { - return Observable.create(new AsyncOnSubscribe>() { - @Override - protected Fetcher generateState() { - return new Fetcher(createRequestFunc, executeFunc, options, isChangeFeed, top, maxPageSize); - } - - @Override - protected Fetcher next(Fetcher fetcher, long requested, Observer>> observer) { - assert requested == 1 : "requested amount expected to be 1"; // as there is a rebatchRequests(1) - - if (fetcher.shouldFetchMore()) { - Observable> respObs = fetcher.nextPage(); - observer.onNext(respObs); - } else { - logger.debug("No more results"); - observer.onCompleted(); - } - - return fetcher; - } - }).rebatchRequests(1); - }); - - return obs; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContext.java deleted file mode 100644 index f7fe88c34454..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContext.java +++ /dev/null @@ -1,369 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.tuple.ImmutablePair; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.query.PartitionedQueryExecutionInfo; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import rx.Observable; -import rx.Observable.Transformer; -import rx.functions.Func0; -import rx.functions.Func1; -import rx.functions.Func3; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class ParallelDocumentQueryExecutionContext - extends ParallelDocumentQueryExecutionContextBase { - - private ParallelDocumentQueryExecutionContext( - IDocumentQueryClient client, - List partitionKeyRanges, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - String rewrittenQuery, - String collectionRid, - boolean isContinuationExpected, - boolean getLazyFeedResponse, - UUID correlatedActivityId) { - super(client, partitionKeyRanges, resourceTypeEnum, resourceType, query, feedOptions, resourceLink, - rewrittenQuery, isContinuationExpected, getLazyFeedResponse, correlatedActivityId); - } - - public static Observable> createAsync( - IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - String collectionRid, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, - List targetRanges, - int initialPageSize, - boolean isContinuationExpected, - boolean getLazyFeedResponse, - UUID correlatedActivityId) { - - ParallelDocumentQueryExecutionContext context = new ParallelDocumentQueryExecutionContext(client, - targetRanges, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - partitionedQueryExecutionInfo.getQueryInfo().getRewrittenQuery(), - collectionRid, - isContinuationExpected, - getLazyFeedResponse, - correlatedActivityId); - - try { - context.initialize(collectionRid, - targetRanges, - initialPageSize, - feedOptions.getRequestContinuation()); - return Observable.just(context); - } catch (DocumentClientException dce) { - return Observable.error(dce); - } - } - - private void initialize( - String collectionRid, - List targetRanges, - int initialPageSize, - String continuationToken) throws DocumentClientException { - // Generate the corresponding continuation token map. - Map partitionKeyRangeToContinuationTokenMap = new HashMap(); - if (continuationToken == null) { - // If the user does not give a continuation token, - // then just start the query from the first partition. - for (PartitionKeyRange targetRange : targetRanges) { - partitionKeyRangeToContinuationTokenMap.put(targetRange, - null); - } - } else { - // Figure out which partitions to resume from: - - // If a continuation token is given then we need to figure out partition key - // range it maps to - // in order to filter the partition key ranges. - // For example if suppliedCompositeContinuationToken.Range.Min == - // partition3.Range.Min, - // then we know that partitions 0, 1, 2 are fully drained. - - // Check to see if composite continuation token is a valid JSON. - ValueHolder outCompositeContinuationToken = new ValueHolder(); - if (!CompositeContinuationToken.tryParse(continuationToken, - outCompositeContinuationToken)) { - String message = String.format("Invalid JSON in continuation token %s for Parallel~Context", - continuationToken); - throw new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, - message); - } - - CompositeContinuationToken compositeContinuationToken = outCompositeContinuationToken.v; - - // Get the right hand side of the query ranges: - List filteredPartitionKeyRanges = this.getPartitionKeyRangesForContinuation( - compositeContinuationToken, - targetRanges); - - // The first partition is the one we left off on and have a backend continuation - // token for. - partitionKeyRangeToContinuationTokenMap.put(filteredPartitionKeyRanges.get(0), - compositeContinuationToken.getToken()); - - // The remaining partitions we have yet to touch / have null continuation tokens - for (int i = 1; i < filteredPartitionKeyRanges.size(); i++) { - partitionKeyRangeToContinuationTokenMap.put(filteredPartitionKeyRanges.get(i), - null); - } - } - - super.initialize(collectionRid, - partitionKeyRangeToContinuationTokenMap, - initialPageSize, - this.querySpec); - } - - private List getPartitionKeyRangesForContinuation( - CompositeContinuationToken compositeContinuationToken, - List partitionKeyRanges) throws DocumentClientException { - // Find the partition key range we left off on - int startIndex = this.FindTargetRangeAndExtractContinuationTokens(partitionKeyRanges, - compositeContinuationToken.getRange()); - - List rightHandSideRanges = new ArrayList(); - for (int i = startIndex; i < partitionKeyRanges.size(); i++) { - rightHandSideRanges.add(partitionKeyRanges.get(i)); - } - - return rightHandSideRanges; - } - - private static class EmptyPagesFilterTransformer - implements Transformer.DocumentProducerFeedResponse, FeedResponse> { - private final RequestChargeTracker tracker; - private DocumentProducer.DocumentProducerFeedResponse previousPage; - - public EmptyPagesFilterTransformer( - RequestChargeTracker tracker) { - - if (tracker == null) { - throw new IllegalArgumentException("Request Charge Tracker must not be null."); - } - - this.tracker = tracker; - this.previousPage = null; - } - - private DocumentProducer.DocumentProducerFeedResponse plusCharge( - DocumentProducer.DocumentProducerFeedResponse documentProducerFeedResponse, - double charge) { - FeedResponse page = documentProducerFeedResponse.pageResult; - Map headers = new HashMap<>(page.getResponseHeaders()); - double pageCharge = page.getRequestCharge(); - pageCharge += charge; - headers.put(HttpConstants.HttpHeaders.REQUEST_CHARGE, - String.valueOf(pageCharge)); - FeedResponse newPage = BridgeInternal.createFeedResponseWithQueryMetrics(page.getResults(), - headers, - page.getQueryMetrics()); - documentProducerFeedResponse.pageResult = newPage; - return documentProducerFeedResponse; - } - - private DocumentProducer.DocumentProducerFeedResponse addCompositeContinuationToken( - DocumentProducer.DocumentProducerFeedResponse documentProducerFeedResponse, - String compositeContinuationToken) { - FeedResponse page = documentProducerFeedResponse.pageResult; - Map headers = new HashMap<>(page.getResponseHeaders()); - headers.put(HttpConstants.HttpHeaders.CONTINUATION, - compositeContinuationToken); - FeedResponse newPage = BridgeInternal.createFeedResponseWithQueryMetrics(page.getResults(), - headers, - page.getQueryMetrics()); - documentProducerFeedResponse.pageResult = newPage; - return documentProducerFeedResponse; - } - - private static Map headerResponse( - double requestCharge) { - return Utils.immutableMapOf(HttpConstants.HttpHeaders.REQUEST_CHARGE, - String.valueOf(requestCharge)); - } - - @Override - public Observable> call( - Observable.DocumentProducerFeedResponse> source) { - return source.filter(documentProducerFeedResponse -> { - if (documentProducerFeedResponse.pageResult.getResults().isEmpty()) { - // filter empty pages and accumulate charge - tracker.addCharge(documentProducerFeedResponse.pageResult.getRequestCharge()); - return false; - } - return true; - }).map(documentProducerFeedResponse -> { - // Add the request charge - double charge = tracker.getAndResetCharge(); - if (charge > 0) { - return plusCharge(documentProducerFeedResponse, - charge); - } else { - return documentProducerFeedResponse; - } - }).concatWith(Observable.defer(() -> { - // Emit an empty page so the downstream observables know when there are no more - // results. - return Observable.just(null); - })).map(documentProducerFeedResponse -> { - // Create pairs from the stream to allow the observables downstream to "peek" - // 1, 2, 3, null -> (null, 1), (1, 2), (2, 3), (3, null) - ImmutablePair.DocumentProducerFeedResponse, DocumentProducer.DocumentProducerFeedResponse> previousCurrent = new ImmutablePair.DocumentProducerFeedResponse, DocumentProducer.DocumentProducerFeedResponse>( - this.previousPage, - documentProducerFeedResponse); - this.previousPage = documentProducerFeedResponse; - return previousCurrent; - }).skip(1).map(currentNext -> { - // remove the (null, 1) - // Add the continuation token based on the current and next page. - DocumentProducer.DocumentProducerFeedResponse current = currentNext.left; - DocumentProducer.DocumentProducerFeedResponse next = currentNext.right; - - String compositeContinuationToken; - String backendContinuationToken = current.pageResult.getResponseContinuation(); - if (backendContinuationToken == null) { - // We just finished reading the last document from a partition - if (next == null) { - // It was the last partition and we are done - compositeContinuationToken = null; - } else { - // It wasn't the last partition, so we need to give the next range, but with a - // null continuation - CompositeContinuationToken compositeContinuationTokenDom = new CompositeContinuationToken(null, - next.sourcePartitionKeyRange.toRange()); - compositeContinuationToken = compositeContinuationTokenDom.toJson(); - } - } else { - // We are in the middle of reading a partition, - // so give back this partition with a backend continuation token - CompositeContinuationToken compositeContinuationTokenDom = new CompositeContinuationToken( - backendContinuationToken, - current.sourcePartitionKeyRange.toRange()); - compositeContinuationToken = compositeContinuationTokenDom.toJson(); - } - - DocumentProducer.DocumentProducerFeedResponse page; - page = current; - page = this.addCompositeContinuationToken(page, - compositeContinuationToken); - - return page; - }).map(documentProducerFeedResponse -> { - // Unwrap the documentProducerFeedResponse and get back the feedResponse - return documentProducerFeedResponse.pageResult; - }).switchIfEmpty(Observable.defer(() -> { - // create an empty page if there is no result - return Observable.just(BridgeInternal.createFeedResponse(Utils.immutableListOf(), - headerResponse(tracker.getAndResetCharge()))); - })); - } - } - - @Override - public Observable> drainAsync( - int maxPageSize) { - List.DocumentProducerFeedResponse>> obs = this.documentProducers - // Get the stream. - .stream() - // Start from the left most partition first. - .sorted(( - dp1, - dp2) -> dp1.targetRange.getMinInclusive().compareTo(dp2.targetRange.getMinInclusive())) - // For each partition get it's stream of results. - .map(dp -> dp.produceAsync()) - // Merge results from all partitions. - .collect(Collectors.toList()); - return Observable.concat(obs).compose(new EmptyPagesFilterTransformer<>(new RequestChargeTracker())); - } - - @Override - public Observable> executeAsync() { - return this.drainAsync(feedOptions.getMaxItemCount()); - } - - protected DocumentProducer createDocumentProducer( - String collectionRid, - PartitionKeyRange targetRange, - String initialContinuationToken, - int initialPageSize, - FeedOptions feedOptions, - SqlQuerySpec querySpecForInit, - Map commonRequestHeaders, - Func3 createRequestFunc, - Func1>> executeFunc, - Func0 createRetryPolicyFunc) { - return new DocumentProducer(client, - collectionRid, - feedOptions, - createRequestFunc, - executeFunc, - targetRange, - collectionRid, - () -> client.getResetSessionTokenRetryPolicy().getRequestPolicy(), - resourceType, - correlatedActivityId, - initialPageSize, - initialContinuationToken, - top); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContextBase.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContextBase.java deleted file mode 100644 index 8ed4f7138b24..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContextBase.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import rx.Observable; -import rx.functions.Func0; -import rx.functions.Func1; -import rx.functions.Func3; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public abstract class ParallelDocumentQueryExecutionContextBase - extends DocumentQueryExecutionContextBase implements IDocumentQueryExecutionComponent { - - protected final List> documentProducers; - protected final List partitionKeyRanges; - protected final SqlQuerySpec querySpec; - protected int pageSize; - protected int top = -1; - - protected ParallelDocumentQueryExecutionContextBase(IDocumentQueryClient client, - List partitionKeyRanges, ResourceType resourceTypeEnum, Class resourceType, - SqlQuerySpec query, FeedOptions feedOptions, String resourceLink, String rewrittenQuery, - boolean isContinuationExpected, boolean getLazyFeedResponse, UUID correlatedActivityId) { - super(client, resourceTypeEnum, resourceType, query, feedOptions, resourceLink, getLazyFeedResponse, - correlatedActivityId); - - documentProducers = new ArrayList<>(); - - this.partitionKeyRanges = partitionKeyRanges; - - if (!Strings.isNullOrEmpty(rewrittenQuery)) { - this.querySpec = new SqlQuerySpec(rewrittenQuery, super.query.getParameters()); - } else { - this.querySpec = super.query; - } - } - - protected void initialize(String collectionRid, - Map partitionKeyRangeToContinuationTokenMap, int initialPageSize, - SqlQuerySpec querySpecForInit) { - this.pageSize = initialPageSize; - Map commonRequestHeaders = createCommonHeadersAsync(this.getFeedOptions(null, null)); - - for (PartitionKeyRange targetRange : partitionKeyRangeToContinuationTokenMap.keySet()) { - Func3 createRequestFunc = (partitionKeyRange, - continuationToken, pageSize) -> { - Map headers = new HashMap<>(commonRequestHeaders); - headers.put(HttpConstants.HttpHeaders.CONTINUATION, continuationToken); - headers.put(HttpConstants.HttpHeaders.PAGE_SIZE, Strings.toString(pageSize)); - return this.createDocumentServiceRequest(headers, querySpecForInit, partitionKeyRange, collectionRid); - }; - - Func1>> executeFunc = (request) -> { - return this.executeRequestAsync(request).toObservable(); - }; - - DocumentProducer dp = createDocumentProducer(collectionRid, targetRange, - partitionKeyRangeToContinuationTokenMap.get(targetRange), initialPageSize, feedOptions, - querySpecForInit, commonRequestHeaders, createRequestFunc, executeFunc, - () -> client.getResetSessionTokenRetryPolicy().getRequestPolicy()); - - documentProducers.add(dp); - } - } - - protected int FindTargetRangeAndExtractContinuationTokens( - List partitionKeyRanges, Range range) throws DocumentClientException { - if (partitionKeyRanges == null) { - throw new IllegalArgumentException("partitionKeyRanges can not be null."); - } - - if (partitionKeyRanges.size() < 1) { - throw new IllegalArgumentException("partitionKeyRanges must have atleast one element."); - } - - for (PartitionKeyRange partitionKeyRange : partitionKeyRanges) { - if (partitionKeyRange == null) { - throw new IllegalArgumentException("partitionKeyRanges can not have null elements."); - } - } - - // Find the minimum index. - PartitionKeyRange needle = new PartitionKeyRange(/* id */ null, range.getMin(), range.getMax()); - int minIndex; - for (minIndex = 0; minIndex < partitionKeyRanges.size(); minIndex++) { - if (needle.getMinInclusive().equals(partitionKeyRanges.get(minIndex).getMinInclusive())) { - break; - } - } - - if (minIndex == partitionKeyRanges.size()) { - throw new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, - String.format("Could not find partition key range for continuation token: {0}", needle)); - } - - return minIndex; - } - - abstract protected DocumentProducer createDocumentProducer(String collectionRid, PartitionKeyRange targetRange, - String initialContinuationToken, int initialPageSize, FeedOptions feedOptions, SqlQuerySpec querySpecForInit, - Map commonRequestHeaders, - Func3 createRequestFunc, - Func1>> executeFunc, - Func0 createRetryPolicyFunc); - - @Override - abstract public Observable> drainAsync(int maxPageSize); - - public void setTop(int newTop) { - this.top = newTop; - - for (DocumentProducer producer : this.documentProducers) { - producer.top = newTop; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelQueryConfig.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelQueryConfig.java deleted file mode 100644 index 608c8c22c7a9..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelQueryConfig.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class ParallelQueryConfig { - - public static final int ClientInternalPageSize = 100; - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/PipelinedDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/PipelinedDocumentQueryExecutionContext.java deleted file mode 100644 index ef0a0d3a88e5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/PipelinedDocumentQueryExecutionContext.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.List; -import java.util.UUID; -import java.util.function.Function; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.query.PartitionedQueryExecutionInfo; -import com.microsoft.azure.cosmosdb.internal.query.QueryInfo; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import rx.Observable; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class PipelinedDocumentQueryExecutionContext implements IDocumentQueryExecutionContext { - - private IDocumentQueryExecutionComponent component; - private int actualPageSize; - private UUID correlatedActivityId; - - private PipelinedDocumentQueryExecutionContext(IDocumentQueryExecutionComponent component, int actualPageSize, - UUID correlatedActivityId) { - this.component = component; - this.actualPageSize = actualPageSize; - this.correlatedActivityId = correlatedActivityId; - - // this.executeNextSchedulingMetrics = new SchedulingStopwatch(); - // this.executeNextSchedulingMetrics.Ready(); - - // DefaultTrace.TraceVerbose(string.Format( - // CultureInfo.InvariantCulture, - // "{0} Pipelined~Context, actual page size: {1}", - // DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture), - // this.actualPageSize)); - } - - public static Observable> createAsync( - IDocumentQueryClient client, ResourceType resourceTypeEnum, Class resourceType, SqlQuerySpec expression, - FeedOptions feedOptions, String resourceLink, String collectionRid, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, List targetRanges, - int initialPageSize, boolean isContinuationExpected, boolean getLazyFeedResponse, - UUID correlatedActivityId) { - // Use nested callback pattern to unwrap the continuation token at each level. - Function>> createBaseComponentFunction; - - QueryInfo queryInfo = partitionedQueryExecutionInfo.getQueryInfo(); - - if (queryInfo.hasOrderBy()) { - createBaseComponentFunction = (continuationToken) -> { - FeedOptions orderByFeedOptions = new FeedOptions(feedOptions); - orderByFeedOptions.setRequestContinuation(continuationToken); - return OrderByDocumentQueryExecutionContext.createAsync(client, resourceTypeEnum, resourceType, - expression, orderByFeedOptions, resourceLink, collectionRid, partitionedQueryExecutionInfo, - targetRanges, initialPageSize, isContinuationExpected, getLazyFeedResponse, - correlatedActivityId); - }; - } else { - createBaseComponentFunction = (continuationToken) -> { - FeedOptions parallelFeedOptions = new FeedOptions(feedOptions); - parallelFeedOptions.setRequestContinuation(continuationToken); - return ParallelDocumentQueryExecutionContext.createAsync(client, resourceTypeEnum, resourceType, - expression, parallelFeedOptions, resourceLink, collectionRid, partitionedQueryExecutionInfo, - targetRanges, initialPageSize, isContinuationExpected, getLazyFeedResponse, - correlatedActivityId); - }; - } - - Function>> createAggregateComponentFunction; - if (queryInfo.hasAggregates()) { - createAggregateComponentFunction = (continuationToken) -> { - return AggregateDocumentQueryExecutionContext.createAsync(createBaseComponentFunction, - queryInfo.getAggregates(), continuationToken); - }; - } else { - createAggregateComponentFunction = createBaseComponentFunction; - } - - Function>> createTopComponentFunction; - if (queryInfo.hasTop()) { - createTopComponentFunction = (continuationToken) -> { - return TopDocumentQueryExecutionContext.createAsync(createAggregateComponentFunction, - queryInfo.getTop(), continuationToken); - }; - } else { - createTopComponentFunction = createAggregateComponentFunction; - } - - int actualPageSize = Utils.getValueOrDefault(feedOptions.getMaxItemCount(), - ParallelQueryConfig.ClientInternalPageSize); - - if (actualPageSize == -1) { - actualPageSize = Integer.MAX_VALUE; - } - - int pageSize = Math.min(actualPageSize, Utils.getValueOrDefault(queryInfo.getTop(), (actualPageSize))); - return createTopComponentFunction.apply(feedOptions.getRequestContinuation()) - .map(c -> new PipelinedDocumentQueryExecutionContext<>(c, pageSize, correlatedActivityId)); - } - - @Override - public Observable> executeAsync() { - // TODO Auto-generated method stub - - // TODO add more code here - return this.component.drainAsync(actualPageSize); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ProxyDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ProxyDocumentQueryExecutionContext.java deleted file mode 100644 index 607b84152147..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ProxyDocumentQueryExecutionContext.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.lang.invoke.MethodHandles; -import java.util.List; -import java.util.UUID; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.query.PartitionedQueryExecutionInfo; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import rx.Observable; -import rx.Single; -import rx.functions.Func1; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * This class is used as a proxy to wrap the - * DefaultDocumentQueryExecutionContext which is needed for sending the query to - * Gateway first and then uses PipelinedDocumentQueryExecutionContext after it - * gets the necessary info. - */ -public class ProxyDocumentQueryExecutionContext implements IDocumentQueryExecutionContext { - - private IDocumentQueryExecutionContext innerExecutionContext; - private IDocumentQueryClient client; - private ResourceType resourceTypeEnum; - private Class resourceType; - private FeedOptions feedOptions; - private SqlQuerySpec query; - private String resourceLink; - private DocumentCollection collection; - private UUID correlatedActivityId; - private boolean isContinuationExpected; - private final static Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - public ProxyDocumentQueryExecutionContext( - IDocumentQueryExecutionContext innerExecutionContext, - IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - DocumentCollection collection, - boolean isContinuationExpected, - UUID correlatedActivityId) { - this.innerExecutionContext = innerExecutionContext; - - this.client = client; - this.resourceTypeEnum = resourceTypeEnum; - this.resourceType = resourceType; - this.query = query; - this.feedOptions = feedOptions; - this.resourceLink = resourceLink; - - this.collection = collection; - this.isContinuationExpected = isContinuationExpected; - this.correlatedActivityId = correlatedActivityId; - } - - @Override - public Observable> executeAsync() { - - Func1>> func = t -> { - - logger.debug("Received non result message from gateway", t); - if (!(t instanceof Exception)) { - logger.error("Unexpected failure", t); - return Observable.error(t); - } - - if (!isCrossPartitionQuery((Exception) t)) { - // If this is not a cross partition query then propagate error - logger.debug("Failure from gateway", t); - return Observable.error(t); - } - - logger.debug("Setting up query pipeline using the query plan received form gateway"); - - // cross partition query construct pipeline - - DocumentClientException dce = (DocumentClientException) t; - - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo = new - PartitionedQueryExecutionInfo(dce.getError().getPartitionedQueryExecutionInfo()); - - logger.debug("Query Plan from gateway {}", partitionedQueryExecutionInfo); - - DefaultDocumentQueryExecutionContext queryExecutionContext = - (DefaultDocumentQueryExecutionContext) this.innerExecutionContext; - - Single> partitionKeyRanges = queryExecutionContext.getTargetPartitionKeyRanges(collection.getResourceId(), - partitionedQueryExecutionInfo.getQueryRanges()); - - Observable> exContext = partitionKeyRanges.toObservable() - .flatMap(pkranges -> { - return DocumentQueryExecutionContextFactory.createSpecializedDocumentQueryExecutionContextAsync( - this.client, - this.resourceTypeEnum, - this.resourceType, - this.query, - this.feedOptions, - this.resourceLink, - isContinuationExpected, - partitionedQueryExecutionInfo, - pkranges, - this.collection.getResourceId(), - this.correlatedActivityId); - }); - - return exContext.flatMap(context -> context.executeAsync()); - }; - - return this.innerExecutionContext.executeAsync().onErrorResumeNext(func); - } - - private boolean isCrossPartitionQuery(Exception exception) { - - DocumentClientException clientException = Utils.as(exception, DocumentClientException.class); - - if (clientException == null) { - return false; - } - - return (Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.BADREQUEST) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.CROSS_PARTITION_QUERY_NOT_SERVABLE)); - } - - public static Observable> createAsync(IDocumentQueryClient client, - ResourceType resourceTypeEnum, Class resourceType, SqlQuerySpec query, FeedOptions feedOptions, - String resourceLink, DocumentCollection collection, boolean isContinuationExpected, - UUID correlatedActivityId) { - - IDocumentQueryExecutionContext innerExecutionContext = - new DefaultDocumentQueryExecutionContext( - client, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - correlatedActivityId, - isContinuationExpected); - - return Observable.just(new ProxyDocumentQueryExecutionContext(innerExecutionContext, client, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - collection, - isContinuationExpected, - correlatedActivityId)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TakeContinuationToken.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TakeContinuationToken.java deleted file mode 100644 index e8a60c2967cd..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TakeContinuationToken.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public final class TakeContinuationToken extends JsonSerializable { - private static final String LimitPropertyName = "limit"; - private static final String SourceTokenPropetryName = "sourceToken"; - private static final Logger logger = LoggerFactory.getLogger(TakeContinuationToken.class); - - public TakeContinuationToken(int takeCount, String sourceToken) { - if (takeCount < 0) { - throw new IllegalArgumentException("takeCount must be a non negative number."); - } - - // sourceToken is allowed to be null. - this.setTakeCount(takeCount); - this.setSourceToken(sourceToken); - } - - private TakeContinuationToken(String serializedTakeContinuationToken) { - super(serializedTakeContinuationToken); - } - - public static boolean tryParse(String serializedTakeContinuationToken, - ValueHolder outTakeContinuationToken) { - boolean parsed; - try { - TakeContinuationToken takeContinuationToken = new TakeContinuationToken(serializedTakeContinuationToken); - takeContinuationToken.getSourceToken(); - takeContinuationToken.getTakeCount(); - outTakeContinuationToken.v = takeContinuationToken; - parsed = true; - } catch (Exception ex) { - logger.debug( - "Received exception {} when trying to parse: {}", - ex.getMessage(), - serializedTakeContinuationToken); - parsed = false; - outTakeContinuationToken.v = null; - } - - return parsed; - } - - public int getTakeCount() { - return super.getInt(LimitPropertyName); - } - - public String getSourceToken() { - return super.getString(SourceTokenPropetryName); - } - - private void setTakeCount(int takeCount) { - super.set(LimitPropertyName, takeCount); - } - - private void setSourceToken(String sourceToken) { - super.set(SourceTokenPropetryName, sourceToken); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TopDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TopDocumentQueryExecutionContext.java deleted file mode 100644 index afa80ca43d3c..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TopDocumentQueryExecutionContext.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import rx.Observable; -import rx.functions.Func1; - -public class TopDocumentQueryExecutionContext implements IDocumentQueryExecutionComponent { - - private final IDocumentQueryExecutionComponent component; - private final int top; - - public TopDocumentQueryExecutionContext(IDocumentQueryExecutionComponent component, int top) { - this.component = component; - this.top = top; - } - - public static Observable> createAsync( - Function>> createSourceComponentFunction, - int topCount, String topContinuationToken) { - TakeContinuationToken takeContinuationToken; - - if (topContinuationToken == null) { - takeContinuationToken = new TakeContinuationToken(topCount, null); - } else { - ValueHolder outTakeContinuationToken = new ValueHolder(); - if (!TakeContinuationToken.tryParse(topContinuationToken, outTakeContinuationToken)) { - String message = String.format("Invalid JSON in continuation token %s for Top~Context", - topContinuationToken); - DocumentClientException dce = new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, - message); - return Observable.error(dce); - } - - takeContinuationToken = outTakeContinuationToken.v; - } - - if (takeContinuationToken.getTakeCount() > topCount) { - String message = String.format( - "top count in continuation token: %d can not be greater than the top count in the query: %d.", - takeContinuationToken.getTakeCount(), topCount); - DocumentClientException dce = new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, message); - return Observable.error(dce); - } - - return createSourceComponentFunction.apply(takeContinuationToken.getSourceToken()).map(component -> { - return new TopDocumentQueryExecutionContext(component, takeContinuationToken.getTakeCount()); - }); - } - - @Override - public Observable> drainAsync(int maxPageSize) { - ParallelDocumentQueryExecutionContextBase context; - - if (this.component instanceof AggregateDocumentQueryExecutionContext) { - context = (ParallelDocumentQueryExecutionContextBase) ((AggregateDocumentQueryExecutionContext) this.component) - .getComponent(); - } else { - context = (ParallelDocumentQueryExecutionContextBase) this.component; - } - - context.setTop(this.top); - - return this.component.drainAsync(maxPageSize).takeUntil(new Func1, Boolean>() { - - private volatile int fetchedItems = 0; - - @Override - public Boolean call(FeedResponse frp) { - - fetchedItems += frp.getResults().size(); - - // take until we have at least top many elements fetched - return fetchedItems >= top; - } - }).map(new Func1, FeedResponse>() { - - private volatile int collectedItems = 0; - private volatile boolean lastPage = false; - - @Override - public FeedResponse call(FeedResponse t) { - - if (collectedItems + t.getResults().size() <= top) { - collectedItems += t.getResults().size(); - - Map headers = new HashMap<>(t.getResponseHeaders()); - if (top != collectedItems) { - // Add Take Continuation Token - String sourceContinuationToken = t.getResponseContinuation(); - TakeContinuationToken takeContinuationToken = new TakeContinuationToken(top - collectedItems, - sourceContinuationToken); - headers.put(HttpConstants.HttpHeaders.CONTINUATION, takeContinuationToken.toJson()); - } else { - // Null out the continuation token - headers.put(HttpConstants.HttpHeaders.CONTINUATION, null); - } - - return BridgeInternal.createFeedResponseWithQueryMetrics(t.getResults(), headers, - t.getQueryMetrics()); - } else { - assert lastPage == false; - lastPage = true; - int lastPageSize = top - collectedItems; - collectedItems += lastPageSize; - - // Null out the continuation token - Map headers = new HashMap<>(t.getResponseHeaders()); - headers.put(HttpConstants.HttpHeaders.CONTINUATION, null); - - return BridgeInternal.createFeedResponseWithQueryMetrics(t.getResults().subList(0, lastPageSize), - headers, t.getQueryMetrics()); - } - } - }); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/routing/LocationHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/routing/LocationHelper.java deleted file mode 100644 index 9cc5fd08442f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/routing/LocationHelper.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.routing; - -import org.apache.commons.lang3.StringUtils; - -import java.net.URL; - -public class LocationHelper { - /** - * For example, for https://contoso.documents.azure.com:443/ and "West US", this will return https://contoso-westus.documents.azure.com:443/ - * NOTE: This ONLY called by client first boot when the input endpoint is not available. - * - * @param serviceEndpoint - * @param location - * @return - */ - public static URL getLocationEndpoint(URL serviceEndpoint, String location) { - - // Split the host into 2 parts seperated by '.' - // For example, "contoso.documents.azure.com" is separated into "contoso" and "documents.azure.com" - // If the host doesn't contains '.', this will return the host as is, as the only element - String[] hostParts = StringUtils.split(serviceEndpoint.getHost(), ".", 2); - - String host; - if (hostParts.length != 0) { - // hostParts[0] will be the global account name - hostParts[0] = hostParts[0] + "-" + dataCenterToUriPostfix(location); - - // if hostParts has only one element, '.' is not included in the returned string - host = String.join(".", hostParts); - } else { - host = serviceEndpoint.getHost(); - } - - try { - return new URL(serviceEndpoint.getProtocol(), host, serviceEndpoint.getPort(), serviceEndpoint.getFile()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private static String dataCenterToUriPostfix(String dataCenter) { - return dataCenter.replace(" ", ""); - } -} - diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/GatewayTestUtils.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/GatewayTestUtils.java deleted file mode 100644 index 8292a4c0f399..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/GatewayTestUtils.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.List; - -public class GatewayTestUtils { - - public static PartitionKeyRange setParent(PartitionKeyRange pkr, List parents) { - pkr.setParents(parents); - return pkr; - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/LocationHelperTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/LocationHelperTest.java deleted file mode 100644 index 5bc606e29c25..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/LocationHelperTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.rx.internal.routing.LocationHelper; -import org.testng.annotations.Test; - -import java.net.URI; -import java.net.URL; - -import static org.assertj.core.api.Assertions.assertThat; - -public class LocationHelperTest { - @Test(groups = "unit") - public void getLocationEndpoint() throws Exception { - URL globalServiceEndpoint = URI.create("https://account-name.documents.azure.com:443").toURL(); - URL expectedRegionServiceEndpoint = URI.create("https://account-name-east-us.documents.azure.com:443").toURL(); - assertThat(LocationHelper.getLocationEndpoint(globalServiceEndpoint, "east-us")) - .isEqualTo(expectedRegionServiceEndpoint); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionContainerTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionContainerTest.java deleted file mode 100644 index a66625dbf890..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionContainerTest.java +++ /dev/null @@ -1,644 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.GatewayTestUtils; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.reflect.FieldUtils; -import org.mockito.Mockito; -import org.mockito.internal.util.collections.Sets; -import org.testng.annotations.Test; - -import java.util.HashMap; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link SessionContainer} - */ -public class SessionContainerTest { - - private final static Random random = new Random(); - - @Test(groups = "unit") - public void sessionContainer() throws Exception { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - - int numCollections = 2; - int numPartitionKeyRangeIds = 5; - - for (int i = 0; i < numCollections; i++) { - String collectionResourceId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId() + i).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls/collName_" + i; - - for (int j = 0; j < numPartitionKeyRangeIds; j++) { - - String partitionKeyRangeId = "range_" + j; - String lsn = "1#" + j + "#4=90#5=2"; - - sessionContainer.setSessionToken( - collectionResourceId, - collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":" + lsn)); - } - } - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ReadFeed, ResourceType.DocumentCollection, - "dbs/db1/colls/collName_1", IOUtils.toInputStream("content1", "UTF-8"), new HashMap<>()); - - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_1"); - assertThat(sessionToken.getLSN()).isEqualTo(1); - - DocumentServiceRequestContext dsrContext = new DocumentServiceRequestContext(); - PartitionKeyRange resolvedPKRange = new PartitionKeyRange(); - resolvedPKRange.setId("range_" + (numPartitionKeyRangeIds + 10)); - GatewayTestUtils.setParent(resolvedPKRange, ImmutableList.of("range_2", "range_x")); - dsrContext.resolvedPartitionKeyRange = resolvedPKRange; - request.requestContext = dsrContext; - - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, resolvedPKRange.getId()); - assertThat(sessionToken.getLSN()).isEqualTo(2); - } - - @Test(groups = "unit") - public void setSessionToken_NoSessionTokenForPartitionKeyRangeId() throws Exception { - String collectionRid = "uf4PAK6T-Cw="; - long collectionRidAsLong = ResourceId.parse(collectionRid).getUniqueDocumentCollectionId(); - String partitionKeyRangeId = "test_range_id"; - String sessionToken = "1#100#1=20#2=5#3=30"; - String collectionName = "dbs/db1/colls/collName_1"; - - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - - RxDocumentServiceRequest request1 = RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionName + "/docs", IOUtils.toInputStream("content1", "UTF-8"), new HashMap<>()); - - Map respHeaders = new HashMap<>(); - RxDocumentServiceResponse resp = Mockito.mock(RxDocumentServiceResponse.class); - Mockito.doReturn(respHeaders).when(resp).getResponseHeaders(); - respHeaders.put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":" + sessionToken); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_FULL_NAME, collectionName); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_ID, collectionRid); - sessionContainer.setSessionToken(request1, resp.getResponseHeaders()); - - ConcurrentHashMap collectionNameToCollectionResourceId = (ConcurrentHashMap) FieldUtils.readField(sessionContainer, "collectionNameToCollectionResourceId", true); - ConcurrentHashMap> collectionResourceIdToSessionTokens = (ConcurrentHashMap>) FieldUtils.readField(sessionContainer, "collectionResourceIdToSessionTokens", true); - assertThat(collectionNameToCollectionResourceId).hasSize(1); - assertThat(collectionResourceIdToSessionTokens).hasSize(1); - assertThat(collectionNameToCollectionResourceId.get(collectionName)).isEqualTo(collectionRidAsLong); - assertThat(collectionResourceIdToSessionTokens.get(collectionRidAsLong)).isNotNull(); - assertThat(collectionResourceIdToSessionTokens.get(collectionRidAsLong)).hasSize(1); - assertThat(collectionResourceIdToSessionTokens.get(collectionRidAsLong).get(partitionKeyRangeId).convertToString()).isEqualTo(sessionToken); - - RxDocumentServiceRequest request2 = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document, - collectionName + "/docs", IOUtils.toInputStream("", "UTF-8"), new HashMap<>()); - - ISessionToken resolvedSessionToken = sessionContainer.resolvePartitionLocalSessionToken(request2, partitionKeyRangeId); - assertThat(resolvedSessionToken.convertToString()).isEqualTo(sessionToken); - } - - @Test(groups = "unit") - public void setSessionToken_MergeOldWithNew() throws Exception { - String collectionRid = "uf4PAK6T-Cw="; - String collectionName = "dbs/db1/colls/collName_1"; - String initialSessionToken = "1#100#1=20#2=5#3=30"; - String newSessionTokenInServerResponse = "1#100#1=31#2=5#3=21"; - String partitionKeyRangeId = "test_range_id"; - String expectedMergedSessionToken = "1#100#1=31#2=5#3=30"; - - Map respHeaders = new HashMap<>(); - - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - - RxDocumentServiceRequest request1 = RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionName + "/docs", IOUtils.toInputStream("content1", "UTF-8"), new HashMap<>()); - - RxDocumentServiceResponse resp = Mockito.mock(RxDocumentServiceResponse.class); - Mockito.doReturn(respHeaders).when(resp).getResponseHeaders(); - respHeaders.put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":" + initialSessionToken); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_FULL_NAME, collectionName); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_ID, collectionRid); - sessionContainer.setSessionToken(request1, resp.getResponseHeaders()); - - resp = Mockito.mock(RxDocumentServiceResponse.class); - Mockito.doReturn(respHeaders).when(resp).getResponseHeaders(); - respHeaders.put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":" + newSessionTokenInServerResponse); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_FULL_NAME, collectionName); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_ID, collectionRid); - sessionContainer.setSessionToken(request1, resp.getResponseHeaders()); - - RxDocumentServiceRequest request2 = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document, - collectionName + "/docs", IOUtils.toInputStream("", "UTF-8"), new HashMap<>()); - - ISessionToken resolvedSessionToken = sessionContainer.resolvePartitionLocalSessionToken(request2, partitionKeyRangeId); - assertThat(resolvedSessionToken.convertToString()).isEqualTo(expectedMergedSessionToken); - } - - - @Test(groups = "unit") - public void resolveGlobalSessionTokenReturnsEmptyStringOnEmptyCache() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document, - "dbs/db1/colls/collName/docs/doc1", new HashMap<>()); - assertThat(StringUtils.EMPTY).isEqualTo(sessionContainer.resolveGlobalSessionToken(request)); - } - - @Test(groups = "unit") - public void resolveGlobalSessionTokenReturnsEmptyStringOnCacheMiss() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String partitionKeyRangeId = "range_0"; - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String initialSessionToken = "1#100#1=20#2=5#3=30"; - sessionContainer.setSessionToken(documentCollectionId, "dbs/db1/colls1/collName", - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":" + initialSessionToken)); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document, - "dbs/db1/colls1/collName2/docs/doc1", new HashMap<>()); - assertThat(StringUtils.EMPTY).isEqualTo(sessionContainer.resolveGlobalSessionToken(request)); - } - - @Test(groups = "unit") - public void resolveGlobalSessionTokenReturnsTokenMapUsingName() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - String sessionToken = sessionContainer.resolveGlobalSessionToken(request); - Set tokens = Sets.newSet(sessionToken.split(",")); - - assertThat(tokens.size()).isEqualTo(2); - assertThat(tokens.contains("range_0:1#100#1=20#2=5#3=30")).isTrue(); - assertThat(tokens.contains("range_1:1#101#1=20#2=5#3=30")).isTrue(); - } - - @Test(groups = "unit") - public void resolveGlobalSessionTokenReturnsTokenMapUsingResourceId() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - String sessionToken = sessionContainer.resolveGlobalSessionToken(request); - - Set tokens = Sets.newSet(sessionToken.split(",")); - assertThat(tokens.size()).isEqualTo(2); - assertThat(tokens.contains("range_0:1#100#1=20#2=5#3=30")).isTrue(); - assertThat(tokens.contains("range_1:1#101#1=20#2=5#3=30")).isTrue(); - } - - - @Test(groups = "unit") - public void resolveLocalSessionTokenReturnsTokenMapUsingName() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_1"); - assertThat(sessionToken.getLSN()).isEqualTo(101); - } - - @Test(groups = "unit") - public void resolveLocalSessionTokenReturnsTokenMapUsingResourceId() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_1"); - assertThat(sessionToken.getLSN()).isEqualTo(101); - } - - @Test(groups = "unit") - public void resolveLocalSessionTokenReturnsNullOnPartitionMiss() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - request.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_2"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void resolveLocalSessionTokenReturnsNullOnCollectionMiss() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - int randomCollectionId = getRandomCollectionId(); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), randomCollectionId).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceId.newDocumentCollectionId(getRandomDbId(), randomCollectionId - 1).getDocumentCollectionId().toString(), - ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - request.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_1"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void resolvePartitionLocalSessionTokenReturnsTokenOnParentMatch() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - request.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - GatewayTestUtils.setParent(request.requestContext.resolvedPartitionKeyRange, ImmutableList.of("range_1")); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_2"); - assertThat(sessionToken.getLSN()).isEqualTo(101); - } - - @Test(groups = "unit") - public void clearTokenByCollectionFullNameRemovesToken() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - - // Test resourceId based - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - // Test names based - request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - sessionContainer.clearTokenByCollectionFullName(collectionFullName); - - // Test resourceId based - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - - // Test names based - request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void clearTokenByResourceIdRemovesToken() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - - // Test resourceId based - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - // Test names based - request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - sessionContainer.clearTokenByResourceId(documentCollectionId); - - // Test resourceId based - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - - // Test names based - request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void clearTokenKeepsUnmatchedCollection() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - int randomCollectionId = getRandomCollectionId(); - String documentCollectionId1 = ResourceId.newDocumentCollectionId(getRandomDbId(), randomCollectionId).getDocumentCollectionId().toString(); - String collectionFullName1 = "dbs/db1/colls1/collName1"; - - sessionContainer.setSessionToken(documentCollectionId1, collectionFullName1, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - - // Test resourceId based - RxDocumentServiceRequest request1 = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId1, ResourceType.Document, new HashMap<>()); - String documentCollectionId2 = ResourceId.newDocumentCollectionId(getRandomDbId(), randomCollectionId - 1).getDocumentCollectionId().toString(); - String collectionFullName2 = "dbs/db1/colls1/collName2"; - - // Test resourceId based - RxDocumentServiceRequest request2 = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId2, ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId2, collectionFullName2, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request1, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request2, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - sessionContainer.clearTokenByResourceId(documentCollectionId2); - - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request1, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request2, "range_0"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void setSessionTokenDoesntFailOnEmptySessionTokenHeader() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - sessionContainer.setSessionToken(null, new HashMap<>()); - } - - @Test(groups = "unit") - public void setSessionTokenSetsTokenWhenRequestIsntNameBased() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - - assertThat(request.getIsNameBased()).isFalse(); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1")); - request = RxDocumentServiceRequest.create(OperationType.Read, documentCollectionId, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - request = RxDocumentServiceRequest.createFromName(OperationType.Read, collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - } - - @Test(groups = "unit") - public void setSessionTokenGivesPriorityToOwnerFullNameOverResourceAddress() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName1 = "dbs/db1/colls1/collName1"; - String collectionFullName2 = "dbs/db1/colls1/collName2"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName1 + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1", - HttpConstants.HttpHeaders.OWNER_FULL_NAME, collectionFullName2)); - - request = RxDocumentServiceRequest.createFromName(OperationType.Read, collectionFullName1 + "/docs/doc1", ResourceType.Document); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - - request = RxDocumentServiceRequest.createFromName(OperationType.Read, collectionFullName2 + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - } - - @Test(groups = "unit") - public void setSessionTokenIgnoresOwnerIdWhenRequestIsntNameBased() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - int randomCollectionId = getRandomCollectionId(); - int randomDbId = getRandomDbId(); - String documentCollectionId1 = ResourceId.newDocumentCollectionId(randomDbId, randomCollectionId).getDocumentCollectionId().toString(); - String documentCollectionId2 = ResourceId.newDocumentCollectionId(randomDbId, randomCollectionId - 1).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName1"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId1); - assertThat(request.getIsNameBased()).isFalse(); - - sessionContainer.setSessionToken(request, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1", - HttpConstants.HttpHeaders.OWNER_ID, documentCollectionId2)); - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId1, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId2, ResourceType.Document, new HashMap<>()); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void setSessionTokenGivesPriorityToOwnerIdOverResourceIdWhenRequestIsNameBased() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - int randomCollectionId = getRandomCollectionId(); - int randomDbId = getRandomDbId(); - String documentCollectionId1 = ResourceId.newDocumentCollectionId(randomDbId, randomCollectionId).getDocumentCollectionId().toString(); - String documentCollectionId2 = ResourceId.newDocumentCollectionId(randomDbId, randomCollectionId - 1).getDocumentCollectionId().toString(); - - String collectionFullName = "dbs/db1/colls1/collName1"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - request.setResourceId(documentCollectionId1); - assertThat(request.getIsNameBased()).isTrue(); - - sessionContainer.setSessionToken(request, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1", - HttpConstants.HttpHeaders.OWNER_ID, documentCollectionId2)); - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId1, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId2, ResourceType.Document, new HashMap<>()); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - } - - @Test(groups = "unit") - public void setSessionTokenDoesntWorkForMasterQueries() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ReadFeed, - collectionFullName + "/docs/doc1", ResourceType.DocumentCollection, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1")); - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - - request = RxDocumentServiceRequest.createFromName(OperationType.Read, collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void setSessionTokenDoesntOverwriteHigherLSN() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#105#4=90#5=1")); - - - request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1")); - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(105); - } - - @Test(groups = "unit") - public void setSessionTokenOverwriteLowerLSN() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1")); - - - request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#105#4=90#5=1")); - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(105); - } - - @Test(groups = "unit") - public void setSessionTokenDoesNothingOnEmptySessionTokenHeader() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName + "/docs/doc1", - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1")); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - String sessionToken = sessionContainer.resolveGlobalSessionToken(request); - Set tokens = Sets.newSet(sessionToken.split(",")); - assertThat(tokens.size()).isEqualTo(1); - assertThat(tokens.contains("range_0:1#100#4=90#5=1")).isTrue(); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, new HashMap<>()); - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - sessionToken = sessionContainer.resolveGlobalSessionToken(request); - tokens = Sets.newSet(sessionToken.split(",")); - assertThat(tokens.size()).isEqualTo(1); - assertThat(tokens.contains("range_0:1#100#4=90#5=1")).isTrue(); - } - - private static int getRandomCollectionId() { - return random.nextInt(Integer.MAX_VALUE / 2) - (Integer.MAX_VALUE / 2); - } - - private static int getRandomDbId() { - return random.nextInt(Integer.MAX_VALUE / 2); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionTokenTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionTokenTest.java deleted file mode 100644 index 15b46fdf006d..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionTokenTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import org.testng.annotations.Test; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -public class SessionTokenTest { - - @Test(groups = "unit") - public void validateSuccessfulSessionTokenParsing() { - // valid session token - String sessionToken = "1#100#1=20#2=5#3=30"; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isTrue(); - } - - @Test(groups = "unit") - public void validateSessionTokenParsingWithInvalidVersion() { - String sessionToken = "foo#100#1=20#2=5#3=30"; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isFalse(); - } - - @Test(groups = "unit") - public void validateSessionTokenParsingWithInvalidGlobalLsn() { - String sessionToken = "1#foo#1=20#2=5#3=30"; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isFalse(); - } - - @Test(groups = "unit") - public void validateSessionTokenParsingWithInvalidRegionProgress() { - String sessionToken = "1#100#1=20#2=x#3=30"; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isFalse(); - - } - - @Test(groups = "unit") - public void validateSessionTokenParsingWithInvalidFormat() { - String sessionToken = "1;100#1=20#2=40"; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isFalse(); - } - - @Test(groups = "unit") - public void validateSessionTokenParsingFromEmptyString() { - String sessionToken = ""; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isFalse(); - } - - @Test(groups = "unit") - public void validateSessionTokenComparison() throws Exception { - // valid session token - ValueHolder sessionToken1 = new ValueHolder<>(null); - ValueHolder sessionToken2 = new ValueHolder<>(null); - ValueHolder sessionTokenMerged = new ValueHolder<>(null); - - assertThat(VectorSessionToken.tryCreate("1#100#1=20#2=5#3=30", sessionToken1)).isTrue(); - assertThat(VectorSessionToken.tryCreate("2#105#4=10#2=5#3=30", sessionToken2)).isTrue(); - - assertThat(sessionToken1.v).isNotEqualTo(sessionToken2.v); - assertThat(sessionToken2.v).isNotEqualTo(sessionToken1.v); - - assertThat(sessionToken1.v.isValid(sessionToken2.v)).isTrue(); - assertThat(sessionToken2.v.isValid(sessionToken1.v)).isFalse(); - - - assertThat(VectorSessionToken.tryCreate("2#105#2=5#3=30#4=10", sessionTokenMerged)).isTrue(); - assertThat(sessionTokenMerged.v).isEqualTo(sessionToken1.v.merge(sessionToken2.v)); - - assertThat(VectorSessionToken.tryCreate("1#100#1=20#2=5#3=30", sessionToken1)).isTrue(); - assertThat(VectorSessionToken.tryCreate("1#100#1=10#2=8#3=30", sessionToken2)).isTrue(); - - assertThat(sessionToken1.v.equals(sessionToken2.v)).isFalse(); - assertThat(sessionToken2.v.equals(sessionToken1.v)).isFalse(); - assertThat(sessionToken1.v.isValid(sessionToken2.v)).isFalse(); - assertThat(sessionToken2.v.isValid(sessionToken1.v)).isFalse(); - - assertThat(VectorSessionToken.tryCreate("1#100#1=20#2=8#3=30", sessionTokenMerged)).isTrue(); - assertThat(sessionTokenMerged.v.equals(sessionToken1.v.merge(sessionToken2.v))).isTrue(); - - assertThat(VectorSessionToken.tryCreate("1#100#1=20#2=5#3=30", sessionToken1)).isTrue(); - assertThat(VectorSessionToken.tryCreate("1#102#1=100#2=8#3=30", sessionToken2)).isTrue(); - - assertThat(sessionToken1.v.equals(sessionToken2.v)).isFalse(); - assertThat(sessionToken2.v.equals(sessionToken1.v)).isFalse(); - assertThat(sessionToken1.v.isValid(sessionToken2.v)).isTrue(); - assertThat(sessionToken2.v.isValid(sessionToken1.v)).isFalse(); - - assertThat(VectorSessionToken.tryCreate("1#102#2=8#3=30#1=100", sessionTokenMerged)).isTrue(); - - assertThat(sessionTokenMerged.v.equals(sessionToken1.v.merge(sessionToken2.v))).isTrue(); - - assertThat(VectorSessionToken.tryCreate("1#101#1=20#2=5#3=30", sessionToken1)).isTrue(); - assertThat(VectorSessionToken.tryCreate("1#100#1=20#2=5#3=30#4=40", sessionToken2)).isTrue(); - - - try { - sessionToken1.v.merge(sessionToken2.v); - fail("Region progress can not be different when version is same"); - } catch (InternalServerErrorException e) { - } - - try { - sessionToken2.v.isValid(sessionToken1.v); - fail("Region progress can not be different when version is same"); - } catch (InternalServerErrorException e) { - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMapTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMapTest.java deleted file mode 100644 index 6ae8eedd6a6f..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMapTest.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; - -import com.google.common.collect.ImmutableList; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; - -public class InMemoryCollectionRoutingMapTest { - - static class ServerIdentityImp implements IServerIdentity { - private int value; - public ServerIdentityImp(int value) { - this.value = value; - } - - static ServerIdentityImp of(int value) { - return new ServerIdentityImp(value); - } - } - - @Test(groups = { "unit" }) - public void collectionRoutingMap() { - InMemoryCollectionRoutingMap routingMap = InMemoryCollectionRoutingMap - .tryCreateCompleteRoutingMap(Arrays.asList( - new ImmutablePair<>( - new PartitionKeyRange("2", "0000000050", "0000000070"), ServerIdentityImp.of(2)), - new ImmutablePair<>(new PartitionKeyRange("0", "", "0000000030"), - ServerIdentityImp.of(0)), - new ImmutablePair<>( - new PartitionKeyRange("1", "0000000030", "0000000050"), ServerIdentityImp.of(1)), - new ImmutablePair<>(new PartitionKeyRange("3", "0000000070", "FF"), - ServerIdentityImp.of(3))), - StringUtils.EMPTY); - - assertThat("0").isEqualTo(routingMap.getOrderedPartitionKeyRanges().get(0).getId()); - assertThat("1").isEqualTo(routingMap.getOrderedPartitionKeyRanges().get(1).getId()); - assertThat("2").isEqualTo(routingMap.getOrderedPartitionKeyRanges().get(2).getId()); - assertThat("3").isEqualTo(routingMap.getOrderedPartitionKeyRanges().get(3).getId()); - - - assertThat("0").isEqualTo(routingMap.getRangeByEffectivePartitionKey("").getId()); - assertThat("0").isEqualTo(routingMap.getRangeByEffectivePartitionKey("0000000000").getId()); - assertThat("1").isEqualTo(routingMap.getRangeByEffectivePartitionKey("0000000030").getId()); - assertThat("1").isEqualTo(routingMap.getRangeByEffectivePartitionKey("0000000031").getId()); - assertThat("3").isEqualTo(routingMap.getRangeByEffectivePartitionKey("0000000071").getId()); - - assertThat("0").isEqualTo(routingMap.getRangeByPartitionKeyRangeId("0").getId()); - assertThat("1").isEqualTo(routingMap.getRangeByPartitionKeyRangeId("1").getId()); - - assertThat(4).isEqualTo( - routingMap - .getOverlappingRanges(Collections.singletonList(new Range(PartitionKeyRange.MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY, - PartitionKeyRange.MAXIMUM_EXCLUSIVE_EFFECTIVE_PARTITION_KEY, true, false))) - .size()); - assertThat(0).isEqualTo( - routingMap - .getOverlappingRanges(Collections.singletonList(new Range(PartitionKeyRange.MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY, - PartitionKeyRange.MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY, false, false))) - .size()); - - Collection partitionKeyRanges = routingMap - .getOverlappingRanges(Collections.singletonList(new Range("0000000040", "0000000040", true, true))); - - assertThat(1).isEqualTo(partitionKeyRanges.size()); - Iterator iterator = partitionKeyRanges.iterator(); - assertThat("1").isEqualTo(iterator.next().getId()); - - Collection partitionKeyRanges1 = routingMap - .getOverlappingRanges(Arrays.asList(new Range("0000000040", "0000000045", true, true), - new Range("0000000045", "0000000046", true, true), - new Range("0000000046", "0000000050", true, true))); - - assertThat(2).isEqualTo(partitionKeyRanges1.size()); - Iterator iterator1 = partitionKeyRanges1.iterator(); - assertThat("1").isEqualTo(iterator1.next().getId()); - assertThat("2").isEqualTo(iterator1.next().getId()); - } - - @Test(groups = { "unit" }, expectedExceptions = IllegalStateException.class) - public void invalidRoutingMap() { - InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(Arrays.asList( - new ImmutablePair<>(new PartitionKeyRange("1", "0000000020", "0000000030"), - ServerIdentityImp.of(2)), - new ImmutablePair<>(new PartitionKeyRange("2", "0000000025", "0000000035"), - ServerIdentityImp.of(2))), - StringUtils.EMPTY); - } - - @Test(groups = { "unit" }) - public void incompleteRoutingMap() { - InMemoryCollectionRoutingMap routingMap = InMemoryCollectionRoutingMap - .tryCreateCompleteRoutingMap(Arrays.asList( - new ImmutablePair<>(new PartitionKeyRange("2", "", "0000000030"), - ServerIdentityImp.of(2)), - new ImmutablePair<>(new PartitionKeyRange("3", "0000000031", "FF"), - ServerIdentityImp.of(2))), - StringUtils.EMPTY); - - assertThat(routingMap).isNull(); - - routingMap = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(Arrays.asList( - new ImmutablePair<>(new PartitionKeyRange("2", "", "0000000030"), ServerIdentityImp.of(2)), - new ImmutablePair<>(new PartitionKeyRange("3", "0000000030", "FF"), ServerIdentityImp.of(2))), - StringUtils.EMPTY); - - assertThat(routingMap).isNotNull(); - } - - @Test(groups = {"unit"}) - public void goneRanges() { - CollectionRoutingMap routingMap = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap( - ImmutableList.of( - new ImmutablePair(new PartitionKeyRange("2", "", "0000000030", ImmutableList.of("1", "0")), null), - new ImmutablePair(new PartitionKeyRange("3", "0000000030", "0000000032", ImmutableList.of("5")), null), - new ImmutablePair(new PartitionKeyRange("4", "0000000032", "FF"), null)), - StringUtils.EMPTY); - - assertThat(routingMap.IsGone("1")).isTrue(); - assertThat(routingMap.IsGone("0")).isTrue(); - assertThat(routingMap.IsGone("5")).isTrue(); - - assertThat(routingMap.IsGone("2")).isFalse(); - assertThat(routingMap.IsGone("3")).isFalse(); - assertThat(routingMap.IsGone("4")).isFalse(); - assertThat(routingMap.IsGone("100")).isFalse(); - } - - @Test(groups = {"unit"}) - public void tryCombineRanges() { - CollectionRoutingMap routingMap = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap( - ImmutableList.of( - new ImmutablePair( - new PartitionKeyRange( - "2", - "0000000050", - "0000000070"), - null), - - new ImmutablePair( - new PartitionKeyRange( - "0", - "", - "0000000030"), - null), - - new ImmutablePair( - new PartitionKeyRange( - "1", - "0000000030", - "0000000050"), - null), - - new ImmutablePair( - new PartitionKeyRange( - "3", - "0000000070", - "FF"), - null) - ), StringUtils.EMPTY); - - CollectionRoutingMap newRoutingMap = routingMap.tryCombine( - ImmutableList.of( - new ImmutablePair( - new PartitionKeyRange( - "4", - "", - "0000000010", - ImmutableList.of("0") - ), - null), - - new ImmutablePair( - new PartitionKeyRange( - "5", - "0000000010", - "0000000030", - ImmutableList.of("0") - ), - null) - )); - - assertThat(newRoutingMap).isNotNull(); - - newRoutingMap = routingMap.tryCombine( - ImmutableList.of( - new ImmutablePair( - new PartitionKeyRange( - "6", - "", - "0000000005", - ImmutableList.of("0", "4") - ), - null), - - new ImmutablePair( - new PartitionKeyRange( - "7", - "0000000005", - "0000000010", - ImmutableList.of("0", "4") - ), - null), - - new ImmutablePair( - new PartitionKeyRange( - "8", - "0000000010", - "0000000015", - ImmutableList.of("0", "5") - ), - null), - - new ImmutablePair( - new PartitionKeyRange( - "9", - "0000000015", - "0000000030", - ImmutableList.of("0", "5") - ), - null) - )); - - assertThat(newRoutingMap).isNotNull(); - - newRoutingMap = routingMap.tryCombine( - ImmutableList.of( - new ImmutablePair( - new PartitionKeyRange( - "10", - "", - "0000000002", - ImmutableList.of("0", "4", "6") - ), - null) - )); - - assertThat(newRoutingMap).isNull(); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCacheTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCacheTest.java deleted file mode 100644 index bb2d519a7fd7..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCacheTest.java +++ /dev/null @@ -1,444 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.BridgeUtils; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.DatabaseAccountLocation; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.GlobalEndpointManager; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.DatabaseAccountManagerInternal; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.collections4.list.UnmodifiableList; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Completable; -import rx.Observable; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; - -import static com.microsoft.azure.cosmosdb.BridgeUtils.createDatabaseAccountLocation; -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link LocationCache} - */ -public class LocationCacheTest { - private final static URL DefaultEndpoint = createUrl("https://default.documents.azure.com"); - private final static URL Location1Endpoint = createUrl("https://location1.documents.azure.com"); - private final static URL Location2Endpoint = createUrl("https://location2.documents.azure.com"); - private final static URL Location3Endpoint = createUrl("https://location3.documents.azure.com"); - private final static URL Location4Endpoint = createUrl("https://location4.documents.azure.com"); - - private static HashMap EndpointByLocation = new HashMap<>(); - - static { - EndpointByLocation.put("location1", LocationCacheTest.Location1Endpoint); - EndpointByLocation.put("location2", LocationCacheTest.Location2Endpoint); - EndpointByLocation.put("location3", LocationCacheTest.Location3Endpoint); - EndpointByLocation.put("location4", LocationCacheTest.Location4Endpoint); - } - - private final Configs configs = new Configs() { - @Override - public int getUnavailableLocationsExpirationTimeInSeconds() { - return 3; - } - }; - - private UnmodifiableList preferredLocations; - private DatabaseAccount databaseAccount; - private LocationCache cache; - private GlobalEndpointManager endpointManager; - private DatabaseAccountManagerInternalMock mockedClient; - - @DataProvider(name = "paramsProvider") - public Object[][] paramsProvider() { - // provides all possible combinations for - // useMultipleWriteEndpoints, endpointDiscoveryEnabled, isPreferredListEmpty - List list = new ArrayList<>(); - for (int i = 0; i < 8; i++) { - boolean useMultipleWriteEndpoints = (i & 1) > 0; - boolean endpointDiscoveryEnabled = (i & 2) > 0; - boolean isPreferredListEmpty = (i & 4) > 0; - list.add(new Object[]{useMultipleWriteEndpoints, endpointDiscoveryEnabled, isPreferredListEmpty}); - } - - return list.toArray(new Object[][]{}); - } - - @Test(groups = "long", dataProvider = "paramsProvider") - public void validateAsync(boolean useMultipleWriteEndpoints, - boolean endpointDiscoveryEnabled, - boolean isPreferredListEmpty) throws Exception { - validateLocationCacheAsync(useMultipleWriteEndpoints, - endpointDiscoveryEnabled, - isPreferredListEmpty); - } - - @Test(groups = "long") - public void validateWriteEndpointOrderWithClientSideDisableMultipleWriteLocation() throws Exception { - this.initialize(false, true, false); - assertThat(this.cache.getWriteEndpoints().get(0)).isEqualTo(LocationCacheTest.Location1Endpoint); - assertThat(this.cache.getWriteEndpoints().get(1)).isEqualTo(LocationCacheTest.Location2Endpoint); - assertThat(this.cache.getWriteEndpoints().get(2)).isEqualTo(LocationCacheTest.Location3Endpoint); - } - - private static DatabaseAccount createDatabaseAccount(boolean useMultipleWriteLocations) { - DatabaseAccount databaseAccount = BridgeUtils.createDatabaseAccount( - // read endpoints - ImmutableList.of( - createDatabaseAccountLocation("location1", LocationCacheTest.Location1Endpoint.toString()), - createDatabaseAccountLocation("location2", LocationCacheTest.Location2Endpoint.toString()), - createDatabaseAccountLocation("location4", LocationCacheTest.Location4Endpoint.toString())), - - // write endpoints - ImmutableList.of( - createDatabaseAccountLocation("location1", LocationCacheTest.Location1Endpoint.toString()), - createDatabaseAccountLocation("location2", LocationCacheTest.Location2Endpoint.toString()), - createDatabaseAccountLocation("location3", LocationCacheTest.Location3Endpoint.toString())), - // if the account supports multi master multi muster - useMultipleWriteLocations); - - return databaseAccount; - } - - private void initialize( - boolean useMultipleWriteLocations, - boolean enableEndpointDiscovery, - boolean isPreferredLocationsListEmpty) throws Exception { - - this.mockedClient = new DatabaseAccountManagerInternalMock(); - this.databaseAccount = LocationCacheTest.createDatabaseAccount(useMultipleWriteLocations); - - this.preferredLocations = isPreferredLocationsListEmpty ? - new UnmodifiableList<>(Collections.emptyList()) : - new UnmodifiableList<>(ImmutableList.of("location1", "location2", "location3")); - - this.cache = new LocationCache( - this.preferredLocations, - LocationCacheTest.DefaultEndpoint, - enableEndpointDiscovery, - useMultipleWriteLocations, - configs); - - this.cache.onDatabaseAccountRead(this.databaseAccount); - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setEnableEndpointDiscovery(enableEndpointDiscovery); - BridgeInternal.setUseMultipleWriteLocations(connectionPolicy, useMultipleWriteLocations); - connectionPolicy.setPreferredLocations(this.preferredLocations); - - this.endpointManager = new GlobalEndpointManager(mockedClient, connectionPolicy, configs); - } - - class DatabaseAccountManagerInternalMock implements DatabaseAccountManagerInternal { - private final AtomicInteger counter = new AtomicInteger(0); - - private void reset() { - counter.set(0); - } - - private int getInvocationCounter() { - return counter.get(); - } - - @Override - public Observable getDatabaseAccountFromEndpoint(URI endpoint) { - return Observable.just(LocationCacheTest.this.databaseAccount); - } - - @Override - public ConnectionPolicy getConnectionPolicy() { - throw new RuntimeException("not supported"); - } - - @Override - public URI getServiceEndpoint() { - try { - return LocationCacheTest.DefaultEndpoint.toURI(); - } catch (Exception e) { - throw new RuntimeException(); - } - } - } - - private static Stream toStream(Iterable iterable) { - return StreamSupport.stream(iterable.spliterator(), false); - } - - private void validateLocationCacheAsync( - boolean useMultipleWriteLocations, - boolean endpointDiscoveryEnabled, - boolean isPreferredListEmpty) throws Exception { - for (int writeLocationIndex = 0; writeLocationIndex < 3; writeLocationIndex++) { - for (int readLocationIndex = 0; readLocationIndex < 2; readLocationIndex++) { - this.initialize( - useMultipleWriteLocations, - endpointDiscoveryEnabled, - isPreferredListEmpty); - - UnmodifiableList currentWriteEndpoints = this.cache.getWriteEndpoints(); - UnmodifiableList currentReadEndpoints = this.cache.getReadEndpoints(); - for (int i = 0; i < readLocationIndex; i++) { - this.cache.markEndpointUnavailableForRead(createUrl(Iterables.get(this.databaseAccount.getReadableLocations(), i).getEndpoint())); - this.endpointManager.markEndpointUnavailableForRead(createUrl(Iterables.get(this.databaseAccount.getReadableLocations(), i).getEndpoint()));; - } - for (int i = 0; i < writeLocationIndex; i++) { - this.cache.markEndpointUnavailableForWrite(createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), i).getEndpoint())); - this.endpointManager.markEndpointUnavailableForWrite(createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), i).getEndpoint())); - } - - Map writeEndpointByLocation = toStream(this.databaseAccount.getWritableLocations()) - .collect(Collectors.toMap(i -> i.getName(), i -> createUrl(i.getEndpoint()))); - - Map readEndpointByLocation = toStream(this.databaseAccount.getReadableLocations()) - .collect(Collectors.toMap(i -> i.getName(), i -> createUrl(i.getEndpoint()))); - - URL[] preferredAvailableWriteEndpoints = toStream(this.preferredLocations).skip(writeLocationIndex) - .filter(location -> writeEndpointByLocation.containsKey(location)) - .map(location -> writeEndpointByLocation.get(location)) - .collect(Collectors.toList()).toArray(new URL[0]); - - URL[] preferredAvailableReadEndpoints = toStream(this.preferredLocations).skip(readLocationIndex) - .filter(location -> readEndpointByLocation.containsKey(location)) - .map(location -> readEndpointByLocation.get(location)) - .collect(Collectors.toList()).toArray(new URL[0]); - - this.validateEndpointRefresh( - useMultipleWriteLocations, - endpointDiscoveryEnabled, - preferredAvailableWriteEndpoints, - preferredAvailableReadEndpoints, - writeLocationIndex > 0); - - this.validateGlobalEndpointLocationCacheRefreshAsync(); - - this.validateRequestEndpointResolution( - useMultipleWriteLocations, - endpointDiscoveryEnabled, - preferredAvailableWriteEndpoints, - preferredAvailableReadEndpoints); - - // wait for TTL on unavailability info - - TimeUnit.SECONDS.sleep(configs.getUnavailableLocationsExpirationTimeInSeconds() + 1); - - assertThat(currentWriteEndpoints.toArray()).containsExactly(this.cache.getWriteEndpoints().toArray()); - assertThat(currentReadEndpoints.toArray()).containsExactly(this.cache.getReadEndpoints().toArray()); - } - } - } - - private void validateEndpointRefresh( - boolean useMultipleWriteLocations, - boolean endpointDiscoveryEnabled, - URL[] preferredAvailableWriteEndpoints, - URL[] preferredAvailableReadEndpoints, - boolean isFirstWriteEndpointUnavailable) { - - Utils.ValueHolder canRefreshInBackgroundHolder = new Utils.ValueHolder<>(); - canRefreshInBackgroundHolder.v = false; - - boolean shouldRefreshEndpoints = this.cache.shouldRefreshEndpoints(canRefreshInBackgroundHolder); - - boolean isMostPreferredLocationUnavailableForRead = false; - boolean isMostPreferredLocationUnavailableForWrite = useMultipleWriteLocations ? - false : isFirstWriteEndpointUnavailable; - if (this.preferredLocations.size() > 0) { - String mostPreferredReadLocationName = this.preferredLocations.stream() - .filter(location -> toStream(databaseAccount.getReadableLocations()) - .anyMatch(readLocation -> readLocation.getName().equals(location))) - .findFirst().orElse(null); - - URL mostPreferredReadEndpoint = LocationCacheTest.EndpointByLocation.get(mostPreferredReadLocationName); - isMostPreferredLocationUnavailableForRead = preferredAvailableReadEndpoints.length == 0 ? - true : (!areEqual(preferredAvailableReadEndpoints[0], mostPreferredReadEndpoint)); - - String mostPreferredWriteLocationName = this.preferredLocations.stream() - .filter(location -> toStream(databaseAccount.getWritableLocations()) - .anyMatch(writeLocation -> writeLocation.getName().equals(location))) - .findFirst().orElse(null); - - URL mostPreferredWriteEndpoint = LocationCacheTest.EndpointByLocation.get(mostPreferredWriteLocationName); - - if (useMultipleWriteLocations) { - isMostPreferredLocationUnavailableForWrite = preferredAvailableWriteEndpoints.length == 0 ? - true : (!areEqual(preferredAvailableWriteEndpoints[0], mostPreferredWriteEndpoint)); - } - } - - if (!endpointDiscoveryEnabled) { - assertThat(shouldRefreshEndpoints).isFalse(); - } else { - assertThat(shouldRefreshEndpoints).isEqualTo( - isMostPreferredLocationUnavailableForRead || isMostPreferredLocationUnavailableForWrite); - } - - if (shouldRefreshEndpoints) { - assertThat(canRefreshInBackgroundHolder.v).isTrue(); - } - } - - private boolean areEqual(URL url1, URL url2) { - return url1.equals(url2); - } - - private void validateGlobalEndpointLocationCacheRefreshAsync() throws Exception { - - mockedClient.reset(); - List list = IntStream.range(0, 10) - .mapToObj(index -> this.endpointManager.refreshLocationAsync(null)) - .collect(Collectors.toList()); - - Completable.merge(list).await(); - - assertThat(mockedClient.getInvocationCounter()).isLessThanOrEqualTo(1); - mockedClient.reset(); - - IntStream.range(0, 10) - .mapToObj(index -> this.endpointManager.refreshLocationAsync(null)) - .collect(Collectors.toList()); - for (Completable completable : list) { - completable.await(); - } - - assertThat(mockedClient.getInvocationCounter()).isLessThanOrEqualTo(1); - } - - private void validateRequestEndpointResolution( - boolean useMultipleWriteLocations, - boolean endpointDiscoveryEnabled, - URL[] availableWriteEndpoints, - URL[] availableReadEndpoints) throws MalformedURLException { - URL firstAvailableWriteEndpoint; - URL secondAvailableWriteEndpoint; - - if (!endpointDiscoveryEnabled) { - firstAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; - secondAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; - } else if (!useMultipleWriteLocations) { - firstAvailableWriteEndpoint = createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 0).getEndpoint()); - secondAvailableWriteEndpoint = createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 1).getEndpoint()); - } else if (availableWriteEndpoints.length > 1) { - firstAvailableWriteEndpoint = availableWriteEndpoints[0]; - secondAvailableWriteEndpoint = availableWriteEndpoints[1]; - } else if (availableWriteEndpoints.length > 0) { - firstAvailableWriteEndpoint = availableWriteEndpoints[0]; - Iterator writeLocationsIterator = databaseAccount.getWritableLocations().iterator(); - String writeEndpoint = writeLocationsIterator.next().getEndpoint(); - secondAvailableWriteEndpoint = writeEndpoint != firstAvailableWriteEndpoint.toString() - ? new URL(writeEndpoint) - : new URL(writeLocationsIterator.next().getEndpoint()); - } else { - firstAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; - secondAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; - } - - URL firstAvailableReadEndpoint; - - if (!endpointDiscoveryEnabled) { - firstAvailableReadEndpoint = LocationCacheTest.DefaultEndpoint; - } else if (this.preferredLocations.size() == 0) { - firstAvailableReadEndpoint = firstAvailableWriteEndpoint; - } else if (availableReadEndpoints.length > 0) { - firstAvailableReadEndpoint = availableReadEndpoints[0]; - } else { - firstAvailableReadEndpoint = LocationCacheTest.EndpointByLocation.get(this.preferredLocations.get(0)); - } - - URL firstWriteEnpoint = !endpointDiscoveryEnabled ? - LocationCacheTest.DefaultEndpoint : - createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 0).getEndpoint()); - - URL secondWriteEnpoint = !endpointDiscoveryEnabled ? - LocationCacheTest.DefaultEndpoint : - createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 1).getEndpoint()); - - // If current write endpoint is unavailable, write endpoints order doesn't change - // All write requests flip-flop between current write and alternate write endpoint - UnmodifiableList writeEndpoints = this.cache.getWriteEndpoints(); - - assertThat(firstAvailableWriteEndpoint).isEqualTo(writeEndpoints.get(0)); - assertThat(secondAvailableWriteEndpoint).isEqualTo(this.resolveEndpointForWriteRequest(ResourceType.Document, true)); - assertThat(firstAvailableWriteEndpoint).isEqualTo(this.resolveEndpointForWriteRequest(ResourceType.Document, false)); - - // Writes to other resource types should be directed to first/second write endpoint - assertThat(firstWriteEnpoint).isEqualTo(this.resolveEndpointForWriteRequest(ResourceType.Database, false)); - assertThat(secondWriteEnpoint).isEqualTo(this.resolveEndpointForWriteRequest(ResourceType.Database, true)); - - // Reads should be directed to available read endpoints regardless of resource type - assertThat(firstAvailableReadEndpoint).isEqualTo(this.resolveEndpointForReadRequest(true)); - assertThat(firstAvailableReadEndpoint).isEqualTo(this.resolveEndpointForReadRequest(false)); - } - - private URL resolveEndpointForReadRequest(boolean masterResourceType) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - masterResourceType ? ResourceType.Database : ResourceType.Document); - return this.cache.resolveServiceEndpoint(request); - } - - private URL resolveEndpointForWriteRequest(ResourceType resourceType, boolean useAlternateWriteEndpoint) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Create, resourceType); - request.requestContext.RouteToLocation(useAlternateWriteEndpoint ? 1 : 0, resourceType.isCollectionChild()); - return this.cache.resolveServiceEndpoint(request); - } - - private RxDocumentServiceRequest CreateRequest(boolean isReadRequest, boolean isMasterResourceType) - { - if (isReadRequest) { - return RxDocumentServiceRequest.create(OperationType.Read, isMasterResourceType ? ResourceType.Database : ResourceType.Document); - } else { - return RxDocumentServiceRequest.create(OperationType.Create, isMasterResourceType ? ResourceType.Database : ResourceType.Document); - } - } - private static URL createUrl(String url) { - try { - return new URL(url); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(e); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelperTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelperTest.java deleted file mode 100644 index c0b105b5b6bb..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelperTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; - -public class RoutingMapProviderHelperTest { - private static final MockRoutingMapProvider ROUTING_MAP_PROVIDER = new MockRoutingMapProvider( - Arrays.asList(new PartitionKeyRange("0", "", "000A"), new PartitionKeyRange("1", "000A", "000D"), - new PartitionKeyRange("2", "000D", "0012"), new PartitionKeyRange("3", "0012", "0015"), - new PartitionKeyRange("4", "0015", "0020"), new PartitionKeyRange("5", "0020", "0040"), - new PartitionKeyRange("6", "0040", "FF"))); - - private static class MockRoutingMapProvider implements RoutingMapProvider { - private final CollectionRoutingMap routingMap; - - public MockRoutingMapProvider(Collection ranges) { - List> pairs = new ArrayList<>( - ranges.size()); - for (PartitionKeyRange range : ranges) { - pairs.add(new ImmutablePair<>(range, null)); - } - - this.routingMap = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(pairs, StringUtils.EMPTY); - } - - @Override - public Collection getOverlappingRanges(String collectionIdOrNameBasedLink, - Range range, boolean forceRefresh) { - return this.routingMap.getOverlappingRanges(range); - } - - @Override - public PartitionKeyRange tryGetRangeByEffectivePartitionKey(String collectionRid, String effectivePartitionKey) { - return null; - } - - @Override - public PartitionKeyRange getPartitionKeyRangeById(String collectionLink, String partitionKeyRangeId, boolean forceRefresh) { - return null; - } - } - - @Test(groups = { "unit" }, expectedExceptions = IllegalArgumentException.class) - public void nonSortedRanges() { - RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Arrays.asList(new Range("0B", "0B", true, true), new Range("0A", "0A", true, true))); - } - - @Test(groups = { "unit" }, expectedExceptions = IllegalArgumentException.class) - public void overlappingRanges1() { - RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Arrays.asList(new Range("0A", "0D", true, true), new Range("0B", "0E", true, true))); - } - - @Test(groups = { "unit" }, expectedExceptions = IllegalArgumentException.class) - public void overlappingRanges2() { - RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Arrays.asList(new Range("0A", "0D", true, true), new Range("0D", "0E", true, true))); - } - - @Test(groups = { "unit" }) - public void getOverlappingRanges() { - Collection ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, - "dbs/db1/colls/coll1", - Arrays.asList(new Range("000B", "000E", true, false), - new Range("000E", "000F", true, false), new Range("000F", "0010", true, true), - new Range("0015", "0015", true, true))); - - Function func = new Function() { - @Override - public String apply(PartitionKeyRange range) { - return range.getId(); - } - }; - - assertThat("1,2,4").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - - // query for minimal point - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Collections.singletonList(new Range("", "", true, true))); - - assertThat("0").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - - // query for empty range - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Collections.singletonList(new Range("", "", true, false))); - - assertThat(0).isEqualTo(ranges.size()); - - // entire range - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Collections.singletonList(new Range("", "FF", true, false))); - - assertThat("0,1,2,3,4,5,6").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - - // matching range - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Collections.singletonList(new Range("0012", "0015", true, false))); - - assertThat("3").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - - // matching range with empty ranges - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Arrays.asList(new Range("", "", true, false), new Range("0012", "0015", true, false))); - - assertThat("3").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - - // matching range and a little bit more. - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Collections.singletonList(new Range("0012", "0015", false, true))); - - assertThat("3,4").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicyTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicyTest.java deleted file mode 100644 index b6c6157fb9af..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicyTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import io.netty.handler.timeout.ReadTimeoutException; -import org.mockito.Mockito; -import org.testng.annotations.Test; -import rx.Completable; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.net.URL; -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -public class ClientRetryPolicyTest { - private final static int TIMEOUT = 10000; - - @Test(groups = "unit") - public void networkFailureOnRead() throws Exception { - RetryOptions retryOptions = new RetryOptions(); - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(new URL("http://localhost")).when(endpointManager).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(endpointManager, true, retryOptions); - - Exception exception = ReadTimeoutException.INSTANCE; - - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - clientRetryPolicy.onBeforeSendRequest(dsr); - - for (int i = 0; i < 10; i++) { - Single shouldRetry = clientRetryPolicy.shouldRetry(exception); - - validateSuccess(shouldRetry, ShouldRetryValidator.builder() - .nullException() - .shouldRetry(true) - .backOfTime(Duration.ofMillis(ClientRetryPolicy.RetryIntervalInMS)) - .build()); - - Mockito.verify(endpointManager, Mockito.times(i + 1)).markEndpointUnavailableForRead(Mockito.any()); - Mockito.verify(endpointManager, Mockito.times(0)).markEndpointUnavailableForWrite(Mockito.any()); - } - } - - @Test(groups = "unit") - public void networkFailureOnWrite() throws Exception { - RetryOptions retryOptions = new RetryOptions(); - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(new URL("http://localhost")).when(endpointManager).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(endpointManager, true, retryOptions); - - Exception exception = ReadTimeoutException.INSTANCE; - - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - clientRetryPolicy.onBeforeSendRequest(dsr); - for (int i = 0; i < 10; i++) { - Single shouldRetry = clientRetryPolicy.shouldRetry(exception); - validateSuccess(shouldRetry, ShouldRetryValidator.builder() - .nullException() - .shouldRetry(true) - .backOfTime(i > 0 ? Duration.ofMillis(ClientRetryPolicy.RetryIntervalInMS) : Duration.ZERO) - .build()); - - Mockito.verify(endpointManager, Mockito.times(0)).markEndpointUnavailableForRead(Mockito.any()); - Mockito.verify(endpointManager, Mockito.times(i + 1)).markEndpointUnavailableForWrite(Mockito.any()); - } - } - - @Test(groups = "unit") - public void onBeforeSendRequestNotInvoked() { - RetryOptions retryOptions = new RetryOptions(); - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(endpointManager, true, retryOptions); - - Exception exception = ReadTimeoutException.INSTANCE; - - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - Single shouldRetry = clientRetryPolicy.shouldRetry(exception); - validateSuccess(shouldRetry, ShouldRetryValidator.builder() - .withException(exception) - .shouldRetry(false) - .build()); - - Mockito.verifyZeroInteractions(endpointManager); - } - - public static void validateSuccess(Single single, - ShouldRetryValidator validator) { - - validateSuccess(single, validator, TIMEOUT); - } - - public static void validateSuccess(Single single, - ShouldRetryValidator validator, - long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertCompleted(); - testSubscriber.assertNoErrors(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConfigsTests.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConfigsTests.java deleted file mode 100644 index 5ff8c28e33b0..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConfigsTests.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.annotations.Test; - -public class ConfigsTests { - - @Test(groups = { "unit" }) - public void maxHttpHeaderSize() { - Configs config = new Configs(); - assertThat(config.getMaxHttpHeaderSize()).isEqualTo(32 * 1024); - } - - @Test(groups = { "unit" }) - public void maxHttpBodyLength() { - Configs config = new Configs(); - assertThat(config.getMaxHttpBodyLength()).isEqualTo(6 * 1024 * 1024); - } - - @Test(groups = { "unit" }) - public void getProtocol() { - Configs config = new Configs(); - assertThat(config.getProtocol()).isEqualTo(Protocol.valueOf(System.getProperty("COSMOS.PROTOCOL", "Https"))); - } - - @Test(groups = { "unit" }) - public void getDirectHttpsMaxConnectionLimit() { - Configs config = new Configs(); - assertThat(config.getDirectHttpsMaxConnectionLimit()).isEqualTo(Runtime.getRuntime().availableProcessors() * 500); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicyTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicyTest.java deleted file mode 100644 index bfb362d7b93c..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicyTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxClientCollectionCache; -import io.netty.handler.timeout.ReadTimeoutException; -import org.mockito.Mockito; -import org.testng.annotations.Test; -import rx.Completable; -import rx.Single; - -import static com.microsoft.azure.cosmosdb.rx.internal.ClientRetryPolicyTest.validateSuccess; -import static org.assertj.core.api.Assertions.assertThat; - -public class RenameCollectionAwareClientRetryPolicyTest { - - private final static int TIMEOUT = 10000; - - @Test(groups = "unit", timeOut = TIMEOUT) - public void onBeforeSendRequestNotInvoked() { - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - - IRetryPolicyFactory retryPolicyFactory = new RetryPolicy(endpointManager, ConnectionPolicy.GetDefault()); - RxClientCollectionCache rxClientCollectionCache = Mockito.mock(RxClientCollectionCache.class); - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - RenameCollectionAwareClientRetryPolicy renameCollectionAwareClientRetryPolicy = new RenameCollectionAwareClientRetryPolicy(sessionContainer - , rxClientCollectionCache - , retryPolicyFactory.getRequestPolicy()); - - Exception exception = ReadTimeoutException.INSTANCE; - - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - Single shouldRetry = renameCollectionAwareClientRetryPolicy.shouldRetry(exception); - validateSuccess(shouldRetry, ShouldRetryValidator.builder() - .withException(exception) - .shouldRetry(false) - .build()); - - Mockito.verifyZeroInteractions(endpointManager); - } - - @Test(groups = "unit", timeOut = TIMEOUT) - public void shouldRetryWithNotFoundStatusCode() { - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - IRetryPolicyFactory retryPolicyFactory = new RetryPolicy(endpointManager, ConnectionPolicy.GetDefault()); - RxClientCollectionCache rxClientCollectionCache = Mockito.mock(RxClientCollectionCache.class); - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - RenameCollectionAwareClientRetryPolicy renameCollectionAwareClientRetryPolicy = new RenameCollectionAwareClientRetryPolicy(sessionContainer - , rxClientCollectionCache - , retryPolicyFactory.getRequestPolicy()); - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - renameCollectionAwareClientRetryPolicy.onBeforeSendRequest(request); - - NotFoundException notFoundException = new NotFoundException(); - - Single singleShouldRetry = renameCollectionAwareClientRetryPolicy - .shouldRetry(notFoundException); - validateSuccess(singleShouldRetry, ShouldRetryValidator.builder() - .withException(notFoundException) - .shouldRetry(false) - .build()); - } - - @Test(groups = "unit", timeOut = TIMEOUT) - public void shouldRetryWithNotFoundStatusCodeAndReadSessionNotAvailableSubStatusCode() { - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - IRetryPolicyFactory retryPolicyFactory = new RetryPolicy(endpointManager, ConnectionPolicy.GetDefault()); - RxClientCollectionCache rxClientCollectionCache = Mockito.mock(RxClientCollectionCache.class); - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - RenameCollectionAwareClientRetryPolicy renameCollectionAwareClientRetryPolicy = new RenameCollectionAwareClientRetryPolicy(sessionContainer - , rxClientCollectionCache - , retryPolicyFactory.getRequestPolicy()); - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - request.requestContext.resolvedCollectionRid = "rid_0"; - renameCollectionAwareClientRetryPolicy.onBeforeSendRequest(request); - - NotFoundException notFoundException = new NotFoundException(); - notFoundException.getResponseHeaders().put(WFConstants.BackendHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)); - - DocumentCollection documentCollection = new DocumentCollection(); - documentCollection.setResourceId("rid_1"); - - Mockito.when(rxClientCollectionCache.resolveCollectionAsync(request)).thenReturn(Single.just(documentCollection)); - - Single singleShouldRetry = renameCollectionAwareClientRetryPolicy - .shouldRetry(notFoundException); - validateSuccess(singleShouldRetry, ShouldRetryValidator.builder() - .nullException() - .shouldRetry(true) - .build()); - } - - /** - * No retry on bad request exception - */ - @Test(groups = "unit", timeOut = TIMEOUT) - public void shouldRetryWithGenericException() { - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - IRetryPolicyFactory retryPolicyFactory = new RetryPolicy(endpointManager, ConnectionPolicy.GetDefault()); - RxClientCollectionCache rxClientCollectionCache = Mockito.mock(RxClientCollectionCache.class); - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - RenameCollectionAwareClientRetryPolicy renameCollectionAwareClientRetryPolicy = new RenameCollectionAwareClientRetryPolicy(sessionContainer - , rxClientCollectionCache - , retryPolicyFactory.getRequestPolicy()); - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - renameCollectionAwareClientRetryPolicy.onBeforeSendRequest(request); - - Single singleShouldRetry = renameCollectionAwareClientRetryPolicy - .shouldRetry(new BadRequestException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isFalse(); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModelTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModelTest.java deleted file mode 100644 index e4a550513010..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModelTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import io.netty.buffer.ByteBuf; -import io.netty.handler.timeout.ReadTimeoutException; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import org.mockito.Mockito; -import org.testng.annotations.Test; -import rx.Observable; -import rx.observers.TestSubscriber; - -import java.net.URL; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; - -public class RxGatewayStoreModelTest { - private final static int TIMEOUT = 10000; - - @Test(groups = "unit") - public void readTimeout() throws Exception { - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - QueryCompatibilityMode queryCompatibilityMode = QueryCompatibilityMode.Default; - UserAgentContainer userAgentContainer = new UserAgentContainer(); - GlobalEndpointManager globalEndpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(new URL("https://localhost")) - .when(globalEndpointManager).resolveServiceEndpoint(Mockito.any()); - CompositeHttpClient httpClient = Mockito.mock(CompositeHttpClient.class); - Mockito.doReturn(Observable.error(ReadTimeoutException.INSTANCE)) - .when(httpClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class)); - - RxGatewayStoreModel storeModel = new RxGatewayStoreModel( - sessionContainer, - ConsistencyLevel.Session, - queryCompatibilityMode, - userAgentContainer, - globalEndpointManager, - httpClient); - - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put("key", "value"); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - Observable resp = storeModel.processMessage(dsr); - validateFailure(resp, FailureValidator.builder() - .instanceOf(DocumentClientException.class) - .causeInstanceOf(ReadTimeoutException.class) - .documentClientExceptionHeaderRequestContainsEntry("key", "value") - .statusCode(0).build()); - } - - public void validateFailure(Observable observable, - FailureValidator validator) { - validateFailure(observable, validator, TIMEOUT); - } - - public static void validateFailure(Observable observable, - FailureValidator validator, - long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ShouldRetryValidator.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ShouldRetryValidator.java deleted file mode 100644 index 1701c371dbf2..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ShouldRetryValidator.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.rx.FailureValidator; - -import java.time.Duration; -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This is a helper class for validating a partition address for tests. - */ -public interface ShouldRetryValidator { - - void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult); - - static Builder builder() { - return new Builder(); - } - - class Builder { - private List validators = new ArrayList<>(); - - public ShouldRetryValidator build() { - return new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - for (ShouldRetryValidator validator : validators) { - validator.validate(shouldRetryResult); - } - } - }; - } - - public Builder nullException() { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.exception).isNull(); - } - }); - return this; - } - - public Builder hasException() { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.exception).isNotNull(); - } - }); - return this; - } - - public Builder exceptionOfType(Class klass) { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.exception).isNotNull(); - assertThat(shouldRetryResult.exception).isInstanceOf(klass); - } - }); - return this; - } - - public Builder withException(FailureValidator failureValidator) { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.exception).isNotNull(); - failureValidator.validate(shouldRetryResult.exception); - } - }); - return this; - } - - public Builder withException(Exception exception) { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.exception).isNotNull(); - assertThat(shouldRetryResult.exception).isEqualTo(exception); - } - }); - return this; - } - - public Builder shouldRetry(boolean value) { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.shouldRetry).isEqualTo(value); - } - }); - return this; - } - - - public Builder backOfTime(Duration backOfTime) { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.backOffTime).isEqualTo(backOfTime); - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCacheTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCacheTest.java deleted file mode 100644 index b6992f3b97b7..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCacheTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -import org.testng.annotations.Test; - -import rx.Observable; -import rx.Single; -import rx.functions.Func1; - -public class AsyncCacheTest { - - private static final int TIMEOUT = 2000; - - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void getAsync() { - AtomicInteger numberOfCacheRefreshes = new AtomicInteger(0); - final Func1> refreshFunc = key -> { - numberOfCacheRefreshes.incrementAndGet(); - return Single.just(key*2); - }; - - AsyncCache cache = new AsyncCache<>(); - - List> tasks = new ArrayList<>(); - for (int i = 0; i < 10; i++) { - for (int j = 0; j < 10; j++) { - int key = j; - tasks.add(cache.getAsync(key, -1, () -> refreshFunc.call(key))); - } - } - - Observable o = Observable.merge(tasks.stream().map(s -> s.toObservable()).collect(Collectors.toList())); - o.toList().toSingle().toBlocking().value(); - - assertThat(numberOfCacheRefreshes.get()).isEqualTo(10); - assertThat(cache.getAsync(2, -1, () -> refreshFunc.call(2)).toBlocking().value()).isEqualTo(4); - - Func1> refreshFunc1 = key -> { - numberOfCacheRefreshes.incrementAndGet(); - return Single.just(key * 2 + 1); - }; - - List> tasks1 = new ArrayList<>(); - for (int i = 0; i < 10; i++) { - for (int j = 0; j < 10; j++) { - int key = j; - tasks1.add(cache.getAsync(key, key * 2, () -> refreshFunc1.call(key))); - } - - for (int j = 0; j < 10; j++) { - int key = j; - tasks1.add(cache.getAsync(key, key * 2 , () -> refreshFunc1.call(key))); - } - } - - Observable o1 = Observable.merge(tasks1.stream().map(s -> s.toObservable()).collect(Collectors.toList())); - o1.toList().toSingle().toBlocking().value(); - - assertThat(numberOfCacheRefreshes.get()).isEqualTo(20); - assertThat(cache.getAsync(2, -1, () -> refreshFunc.call(2)).toBlocking().value()).isEqualTo(5); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/resources/log4j.properties b/cosmosdb/data-plane/gateway/src/test/resources/log4j.properties deleted file mode 100644 index 1f3287c67a55..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/resources/log4j.properties +++ /dev/null @@ -1,15 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# Set HTTP components' logger to INFO - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/pom.xml b/cosmosdb/data-plane/pom.xml deleted file mode 100644 index e9d43250857f..000000000000 --- a/cosmosdb/data-plane/pom.xml +++ /dev/null @@ -1,370 +0,0 @@ - - - 4.0.0 - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - pom - Azure Cosmos DB SQL API - Java Async SDK (with Reactive Extension RX support) for Azure Cosmos DB SQL API - https://docs.microsoft.com/en-us/azure/cosmos-db - - commons - gateway - examples - benchmark - commons-test-utils - sdk - direct-impl - - - UTF-8 - UTF-8 - 2.5 - 3.8.1 - 1.6 - 1.6 - 27.0.1-jre - 2.9.9 - 3.1.4 - 1.7.6 - 1.2.17 - 4.0.5 - 1.10.19 - 4.1.32.Final - 0.4.20 - 1.3.8 - 0.8.0.17 - 1.1.1 - 6.14.3 - 3.11.1 - 1.10.19 - 27.0.1-jre - 1.6 - unit - 2.4.5 - - - - - - unit - - default - unit - - - true - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - - - - - - fast - - simple - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - long - - long - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - direct - - direct - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - multi-master - - multi-master - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - examples - - - samples,examples - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - integration-test - verify - - - - - - - - - - emulator - - emulator - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - non-emulator - - non-emulator - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.0 - - unit - - %regex[.*] - - - - surefire.testng.verbose - 2 - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.22.0 - - - %regex[.*] - - - - surefire.testng.verbose - 2 - - - ${test.groups} - - - - - integration-test - verify - - - - - - - - - maven-javadoc-plugin - 3.0.1 - true - - true - false - ${javadoc.opts} - - **/internal/**/*.java - - - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.0 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - - com.microsoft.azure - azure-cosmosdb - ${project.parent.version} - - - com.microsoft.azure - azure-cosmosdb-commons - ${project.parent.version} - - - com.microsoft.azure - azure-cosmosdb-gateway - ${project.parent.version} - - - com.microsoft.azure - azure-cosmosdb-direct - ${cosmosdb-sdk-direct-impl.version} - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - ${project.parent.version} - - - - - - org.testng - testng - ${testng.version} - test - - - - - MIT License - http://www.opensource.org/licenses/mit-license.php - - - - scm:git:https://github.com/Azure/azure-cosmosdb-java.git - scm:git:https://github.com/Azure/azure-cosmosdb-java.git - https://github.com/Azure/azure-cosmosdb-java.git - - - - Azure Cosmos DB Developer Platform Devs - docdbdevplatdevs@microsoft.com - Microsoft - http://www.microsoft.com/ - - - diff --git a/cosmosdb/data-plane/sdk/pom.xml b/cosmosdb/data-plane/sdk/pom.xml deleted file mode 100644 index fbd7f035378b..000000000000 --- a/cosmosdb/data-plane/sdk/pom.xml +++ /dev/null @@ -1,267 +0,0 @@ - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - azure-cosmosdb - Async SDK for SQL API of Azure Cosmos DB Service - Java Async SDK (with Reactive Extension rx support) for Azure Cosmos DB SQL API - jar - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - - - - - fast - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - src/test/resources/fast-testng.xml - - - - - - - - - long - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - src/test/resources/long-testng.xml - - - - - - - - - emulator - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - src/test/resources/emulator-testng.xml - - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.19.1 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - com.microsoft.azure - azure-cosmosdb-commons - - - com.microsoft.azure - azure-cosmosdb-gateway - - - com.microsoft.azure - azure-cosmosdb-direct - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - test - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind.version} - - - com.fasterxml.uuid - java-uuid-generator - ${java-uuid-generator.version} - - - commons-io - commons-io - ${commons-io.version} - - - com.github.davidmoten - rxjava-extras - ${rxjava-extras.version} - - - io.reactivex - rxjava - ${rxjava.version} - - - io.reactivex - rxjava-string - ${rxjava-string.version} - - - io.reactivex - rxnetty - ${rxnetty.version} - - - io.netty - netty-transport-native-epoll - - - - - io.netty - netty-codec-http - ${netty.version} - - - io.netty - netty-handler - ${netty.version} - - - io.netty - netty-transport - ${netty.version} - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - - org.testng - testng - ${testng.version} - test - - - org.assertj - assertj-core - ${assertj.version} - test - - - org.mockito - mockito-all - ${mockito.version} - test - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - test - - - log4j - log4j - ${log4j.version} - test - - - com.google.guava - guava - ${guava.version} - test - - - diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/AsyncDocumentClient.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/AsyncDocumentClient.java deleted file mode 100644 index 513baf9a1b7c..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/AsyncDocumentClient.java +++ /dev/null @@ -1,1519 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.List; - -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.MediaOptions; -import com.microsoft.azure.cosmosdb.MediaResponse; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.StoredProcedureResponse; -import com.microsoft.azure.cosmosdb.TokenResolver; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl; - -import rx.Observable; - -/** - * Provides a client-side logical representation of the Azure Cosmos DB - * database service. This async client is used to configure and execute requests - * against the service. - * - *

- * {@link AsyncDocumentClient} async APIs return rxJava's {@code - * Observable}, and so you can use rxJava {@link Observable} functionality. - * The async {@link Observable} based APIs perform the requested operation only after - * subscription. - * - *

- * The service client encapsulates the endpoint and credentials used to access - * the Cosmos DB service. - *

- * To instantiate you can use the {@link Builder} - *

- * {@code
- * ConnectionPolicy connectionPolicy = new ConnectionPolicy();
- * connectionPolicy.setConnectionMode(ConnectionMode.Direct);
- * AsyncDocumentClient client = new AsyncDocumentClient.Builder()
- *         .withServiceEndpoint(serviceEndpoint)
- *         .withMasterKeyOrResourceToken(masterKey)
- *         .withConnectionPolicy(connectionPolicy)
- *         .withConsistencyLevel(ConsistencyLevel.Session)
- *         .build();
- * }
- * 
- */ -public interface AsyncDocumentClient { - - /** - * Helper class to build {@link AsyncDocumentClient} instances - * as logical representation of the Azure Cosmos DB database service. - * - *
-     * {@code
-     * ConnectionPolicy connectionPolicy = new ConnectionPolicy();
-     * connectionPolicy.setConnectionMode(ConnectionMode.Direct);
-     * AsyncDocumentClient client = new AsyncDocumentClient.Builder()
-     *         .withServiceEndpoint(serviceEndpoint)
-     *         .withMasterKeyOrResourceToken(masterKey)
-     *         .withConnectionPolicy(connectionPolicy)
-     *         .withConsistencyLevel(ConsistencyLevel.Session)
-     *         .build();
-     * }
-     * 
- */ - class Builder { - - Configs configs = new Configs(); - ConnectionPolicy connectionPolicy; - ConsistencyLevel desiredConsistencyLevel; - List permissionFeed; - String masterKeyOrResourceToken; - URI serviceEndpoint; - TokenResolver tokenResolver; - - public Builder withServiceEndpoint(String serviceEndpoint) { - try { - this.serviceEndpoint = new URI(serviceEndpoint); - } catch (URISyntaxException e) { - throw new IllegalArgumentException(e.getMessage()); - } - return this; - } - - /** - * New method withMasterKeyOrResourceToken will take either master key or resource token - * and perform authentication for accessing resource. - * - * @param masterKeyOrResourceToken MasterKey or resourceToken for authentication. - * @return current Builder. - * @deprecated use {@link #withMasterKeyOrResourceToken(String)} instead. - */ - @Deprecated - public Builder withMasterKey(String masterKeyOrResourceToken) { - this.masterKeyOrResourceToken = masterKeyOrResourceToken; - return this; - } - - /** - * This method will accept the master key , additionally it can also consume - * resource token too for authentication. - * - * @param masterKeyOrResourceToken MasterKey or resourceToken for authentication. - * @return current Builder. - */ - public Builder withMasterKeyOrResourceToken(String masterKeyOrResourceToken) { - this.masterKeyOrResourceToken = masterKeyOrResourceToken; - return this; - } - - /** - * This method will accept the permission list , which contains the - * resource tokens needed to access resources. - * - * @param permissionFeed Permission list for authentication. - * @return current Builder. - */ - public Builder withPermissionFeed(List permissionFeed) { - this.permissionFeed = permissionFeed; - return this; - } - - public Builder withConsistencyLevel(ConsistencyLevel desiredConsistencyLevel) { - this.desiredConsistencyLevel = desiredConsistencyLevel; - return this; - } - - public Builder withConfigs(Configs configs) { - this.configs = configs; - return this; - } - - public Builder withConnectionPolicy(ConnectionPolicy connectionPolicy) { - this.connectionPolicy = connectionPolicy; - return this; - } - - /** - * This method will accept tokenResolver which is rx function, it takes arguments
- * T1 requestVerb(String),
- * T2 resourceIdOrFullName(String),
- * T3 resourceType(com.microsoft.azure.cosmosdb.internal.ResourceType),
- * T4 request headers(Map)
- *
- * and return
- * R authenticationToken(String)
- * - * @param tokenResolver tokenResolver function for authentication. - * @return current Builder. - */ - /*public Builder withTokenResolver(Func4, String> tokenResolver) { - this.tokenResolver = tokenResolver; - return this; - }*/ - - /** - * This method will accept functional interface TokenResolver which helps in generation authorization - * token per request. AsyncDocumentClient can be successfully initialized with this API without passing any MasterKey, ResourceToken or PermissionFeed. - * @param tokenResolver The tokenResolver - * @return current Builder. - */ - public Builder withTokenResolver(TokenResolver tokenResolver) { - this.tokenResolver = tokenResolver; - return this; - } - - private void ifThrowIllegalArgException(boolean value, String error) { - if (value) { - throw new IllegalArgumentException(error); - } - } - - public AsyncDocumentClient build() { - - ifThrowIllegalArgException(this.serviceEndpoint == null, "cannot build client without service endpoint"); - ifThrowIllegalArgException( - this.masterKeyOrResourceToken == null && (permissionFeed == null || permissionFeed.isEmpty()) && this.tokenResolver == null, - "cannot build client without any one of masterKey, resource token, permissionFeed and tokenResolver"); - - RxDocumentClientImpl client = new RxDocumentClientImpl(serviceEndpoint, - masterKeyOrResourceToken, - permissionFeed, - connectionPolicy, - desiredConsistencyLevel, - configs, - tokenResolver); - client.init(); - return client; - } - - public Configs getConfigs() { - return configs; - } - - public void setConfigs(Configs configs) { - this.configs = configs; - } - - public ConnectionPolicy getConnectionPolicy() { - return connectionPolicy; - } - - public void setConnectionPolicy(ConnectionPolicy connectionPolicy) { - this.connectionPolicy = connectionPolicy; - } - - public ConsistencyLevel getDesiredConsistencyLevel() { - return desiredConsistencyLevel; - } - - public void setDesiredConsistencyLevel(ConsistencyLevel desiredConsistencyLevel) { - this.desiredConsistencyLevel = desiredConsistencyLevel; - } - - public List getPermissionFeed() { - return permissionFeed; - } - - public void setPermissionFeed(List permissionFeed) { - this.permissionFeed = permissionFeed; - } - - public String getMasterKeyOrResourceToken() { - return masterKeyOrResourceToken; - } - - public void setMasterKeyOrResourceToken(String masterKeyOrResourceToken) { - this.masterKeyOrResourceToken = masterKeyOrResourceToken; - } - - public URI getServiceEndpoint() { - return serviceEndpoint; - } - - public void setServiceEndpoint(URI serviceEndpoint) { - this.serviceEndpoint = serviceEndpoint; - } - - public TokenResolver getTokenResolver() { - return tokenResolver; - } - - public void setTokenResolver(TokenResolver tokenResolver) { - this.tokenResolver = tokenResolver; - } - } - - /** - * Gets the default service endpoint as passed in by the user during construction. - * - * @return the service endpoint URI - */ - URI getServiceEndpoint(); - - /** - * Gets the current write endpoint chosen based on availability and preference. - * - * @return the write endpoint URI - */ - URI getWriteEndpoint(); - - /** - * Gets the current read endpoint chosen based on availability and preference. - * - * @return the read endpoint URI - */ - URI getReadEndpoint(); - - /** - * Gets the connection policy - * - * @return the connection policy - */ - ConnectionPolicy getConnectionPolicy(); - - /** - * Creates a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created database. - * In case of failure the {@link Observable} will error. - * - * @param database the database. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created database or an error. - */ - Observable> createDatabase(Database database, RequestOptions options); - - /** - * Deletes a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the deleted database. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the deleted database or an error. - */ - Observable> deleteDatabase(String databaseLink, RequestOptions options); - - /** - * Reads a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read database. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read database or an error. - */ - Observable> readDatabase(String databaseLink, RequestOptions options); - - /** - * Reads all databases. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the read databases. - * In case of failure the {@link Observable} will error. - * - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of read databases or an error. - */ - Observable> readDatabases(FeedOptions options); - - /** - * Query for databases. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the read databases. - * In case of failure the {@link Observable} will error. - * - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of read databases or an error. - */ - Observable> queryDatabases(String query, FeedOptions options); - - /** - * Query for databases. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the obtained databases. - * In case of failure the {@link Observable} will error. - * - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained databases or an error. - */ - Observable> queryDatabases(SqlQuerySpec querySpec, FeedOptions options); - - /** - * Creates a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created collection. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param collection the collection. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created collection or an error. - */ - Observable> createCollection(String databaseLink, DocumentCollection collection, - RequestOptions options); - - /** - * Replaces a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced document collection. - * In case of failure the {@link Observable} will error. - * - * @param collection the document collection to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced document collection or an error. - */ - Observable> replaceCollection(DocumentCollection collection, RequestOptions options); - - /** - * Deletes a document collection by the collection link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted database. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted database or an error. - */ - Observable> deleteCollection(String collectionLink, RequestOptions options); - - /** - * Reads a document collection by the collection link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read collection. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read collection or an error. - */ - Observable> readCollection(String collectionLink, RequestOptions options); - - /** - * Reads all document collections in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the read collections. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param options the fee options. - * @return an {@link Observable} containing one or several feed response pages of the read collections or an error. - */ - Observable> readCollections(String databaseLink, FeedOptions options); - - /** - * Query for document collections in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the obtained collections. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained collections or an error. - */ - Observable> queryCollections(String databaseLink, String query, FeedOptions options); - - /** - * Query for document collections in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the obtained collections. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained collections or an error. - */ - Observable> queryCollections(String databaseLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Creates a document. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created document. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param document the document represented as a POJO or Document object. - * @param options the request options. - * @param disableAutomaticIdGeneration the flag for disabling automatic id generation. - * @return an {@link Observable} containing the single resource response with the created document or an error. - */ - Observable> createDocument(String collectionLink, Object document, RequestOptions options, - boolean disableAutomaticIdGeneration); - - /** - * Upserts a document. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted document. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param document the document represented as a POJO or Document object to upsert. - * @param options the request options. - * @param disableAutomaticIdGeneration the flag for disabling automatic id generation. - * @return an {@link Observable} containing the single resource response with the upserted document or an error. - */ - Observable> upsertDocument(String collectionLink, Object document, RequestOptions options, - boolean disableAutomaticIdGeneration); - - /** - * Replaces a document using a POJO object. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced document. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param document the document represented as a POJO or Document object. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced document or an error. - */ - Observable> replaceDocument(String documentLink, Object document, RequestOptions options); - - /** - * Replaces a document with the passed in document. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced document. - * In case of failure the {@link Observable} will error. - * - * @param document the document to replace (containing the document id). - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced document or an error. - */ - Observable> replaceDocument(Document document, RequestOptions options); - - /** - * Deletes a document by the document link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted document. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted document or an error. - */ - Observable> deleteDocument(String documentLink, RequestOptions options); - - /** - * Reads a document by the document link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read document. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read document or an error. - */ - Observable> readDocument(String documentLink, RequestOptions options); - - /** - * Reads all documents in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the read documents. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read documents or an error. - */ - Observable> readDocuments(String collectionLink, FeedOptions options); - - - /** - * Query for documents in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the obtained documents. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained document or an error. - */ - Observable> queryDocuments(String collectionLink, String query, FeedOptions options); - - /** - * Query for documents in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the obtained documents. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained documents or an error. - */ - Observable> queryDocuments(String collectionLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Query for documents change feed in a document collection. - * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained documents. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param changeFeedOptions the change feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained documents or an error. - */ - Observable> queryDocumentChangeFeed(String collectionLink, - ChangeFeedOptions changeFeedOptions); - - /** - * Reads all partition key ranges in a document collection. - * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained partition key ranges. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained partition key ranges or an error. - */ - Observable> readPartitionKeyRanges(String collectionLink, FeedOptions options); - - /** - * Creates a stored procedure. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created stored procedure. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param storedProcedure the stored procedure to create. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created stored procedure or an error. - */ - Observable> createStoredProcedure(String collectionLink, StoredProcedure storedProcedure, - RequestOptions options); - - /** - * Upserts a stored procedure. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted stored procedure. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param storedProcedure the stored procedure to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted stored procedure or an error. - */ - Observable> upsertStoredProcedure(String collectionLink, StoredProcedure storedProcedure, - RequestOptions options); - - /** - * Replaces a stored procedure. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced stored procedure. - * In case of failure the {@link Observable} will error. - * - * @param storedProcedure the stored procedure to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced stored procedure or an error. - */ - Observable> replaceStoredProcedure(StoredProcedure storedProcedure, RequestOptions options); - - /** - * Deletes a stored procedure by the stored procedure link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted stored procedure. - * In case of failure the {@link Observable} will error. - * - * @param storedProcedureLink the stored procedure link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted stored procedure or an error. - */ - Observable> deleteStoredProcedure(String storedProcedureLink, RequestOptions options); - - /** - * Read a stored procedure by the stored procedure link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read stored procedure. - * In case of failure the {@link Observable} will error. - * - * @param storedProcedureLink the stored procedure link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read stored procedure or an error. - */ - Observable> readStoredProcedure(String storedProcedureLink, RequestOptions options); - - /** - * Reads all stored procedures in a document collection link. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read stored procedures. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read stored procedures or an error. - */ - Observable> readStoredProcedures(String collectionLink, FeedOptions options); - - /** - * Query for stored procedures in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained stored procedures. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained stored procedures or an error. - */ - Observable> queryStoredProcedures(String collectionLink, String query, FeedOptions options); - - /** - * Query for stored procedures in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained stored procedures. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained stored procedures or an error. - */ - Observable> queryStoredProcedures(String collectionLink, SqlQuerySpec querySpec, - FeedOptions options); - - /** - * Executes a stored procedure by the stored procedure link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the stored procedure response. - * In case of failure the {@link Observable} will error. - * - * @param storedProcedureLink the stored procedure link. - * @param procedureParams the array of procedure parameter values. - * @return an {@link Observable} containing the single resource response with the stored procedure response or an error. - */ - Observable executeStoredProcedure(String storedProcedureLink, Object[] procedureParams); - - /** - * Executes a stored procedure by the stored procedure link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the stored procedure response. - * In case of failure the {@link Observable} will error. - * - * @param storedProcedureLink the stored procedure link. - * @param options the request options. - * @param procedureParams the array of procedure parameter values. - * @return an {@link Observable} containing the single resource response with the stored procedure response or an error. - */ - Observable executeStoredProcedure(String storedProcedureLink, RequestOptions options, - Object[] procedureParams); - - /** - * Creates a trigger. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created trigger. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param trigger the trigger. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created trigger or an error. - */ - Observable> createTrigger(String collectionLink, Trigger trigger, RequestOptions options); - - /** - * Upserts a trigger. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted trigger. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param trigger the trigger to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted trigger or an error. - */ - Observable> upsertTrigger(String collectionLink, Trigger trigger, RequestOptions options); - - /** - * Replaces a trigger. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced trigger. - * In case of failure the {@link Observable} will error. - * - * @param trigger the trigger to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced trigger or an error. - */ - Observable> replaceTrigger(Trigger trigger, RequestOptions options); - - /** - * Deletes a trigger. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted trigger. - * In case of failure the {@link Observable} will error. - * - * @param triggerLink the trigger link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted trigger or an error. - */ - Observable> deleteTrigger(String triggerLink, RequestOptions options); - - /** - * Reads a trigger by the trigger link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the read trigger. - * In case of failure the {@link Observable} will error. - * - * @param triggerLink the trigger link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the read trigger or an error. - */ - Observable> readTrigger(String triggerLink, RequestOptions options); - - /** - * Reads all triggers in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read triggers. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read triggers or an error. - */ - Observable> readTriggers(String collectionLink, FeedOptions options); - - /** - * Query for triggers. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained triggers. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained triggers or an error. - */ - Observable> queryTriggers(String collectionLink, String query, FeedOptions options); - - /** - * Query for triggers. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained triggers. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained triggers or an error. - */ - Observable> queryTriggers(String collectionLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Creates a user defined function. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created user defined function. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param udf the user defined function. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created user defined function or an error. - */ - Observable> createUserDefinedFunction(String collectionLink, UserDefinedFunction udf, - RequestOptions options); - - /** - * Upserts a user defined function. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted user defined function. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param udf the user defined function to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted user defined function or an error. - */ - Observable> upsertUserDefinedFunction(String collectionLink, UserDefinedFunction udf, - RequestOptions options); - - /** - * Replaces a user defined function. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced user defined function. - * In case of failure the {@link Observable} will error. - * - * @param udf the user defined function. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced user defined function or an error. - */ - Observable> replaceUserDefinedFunction(UserDefinedFunction udf, RequestOptions options); - - /** - * Deletes a user defined function. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted user defined function. - * In case of failure the {@link Observable} will error. - * - * @param udfLink the user defined function link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted user defined function or an error. - */ - Observable> deleteUserDefinedFunction(String udfLink, RequestOptions options); - - /** - * Read a user defined function. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the read user defined function. - * In case of failure the {@link Observable} will error. - * - * @param udfLink the user defined function link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the read user defined function or an error. - */ - Observable> readUserDefinedFunction(String udfLink, RequestOptions options); - - /** - * Reads all user defined functions in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read user defined functions. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read user defined functions or an error. - */ - Observable> readUserDefinedFunctions(String collectionLink, FeedOptions options); - - /** - * Query for user defined functions. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained user defined functions. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained user defined functions or an error. - */ - Observable> queryUserDefinedFunctions(String collectionLink, String query, - FeedOptions options); - - /** - * Query for user defined functions. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained user defined functions. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained user defined functions or an error. - */ - Observable> queryUserDefinedFunctions(String collectionLink, SqlQuerySpec querySpec, - FeedOptions options); - - /** - * Creates an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created attachment. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param attachment the attachment to create. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created attachment or an error. - */ - Observable> createAttachment(String documentLink, Attachment attachment, RequestOptions options); - - /** - * Upserts an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted attachment. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param attachment the attachment to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted attachment or an error. - */ - Observable> upsertAttachment(String documentLink, Attachment attachment, RequestOptions options); - - /** - * Replaces an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced attachment. - * In case of failure the {@link Observable} will error. - * - * @param attachment the attachment to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced attachment or an error. - */ - Observable> replaceAttachment(Attachment attachment, RequestOptions options); - - /** - * Deletes an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted attachment. - * In case of failure the {@link Observable} will error. - * - * @param attachmentLink the attachment link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted attachment or an error. - */ - Observable> deleteAttachment(String attachmentLink, RequestOptions options); - - /** - * Reads an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read attachment. - * In case of failure the {@link Observable} will error. - * - * @param attachmentLink the attachment link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read attachment or an error. - */ - Observable> readAttachment(String attachmentLink, RequestOptions options); - - /** - * Reads all attachments in a document. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read attachments. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read attachments or an error. - */ - Observable> readAttachments(String documentLink, FeedOptions options); - - - /** - * Reads a media by the media link. - * - * @param mediaLink the media link. - * @return the media response. - */ - Observable readMedia(String mediaLink); - - /** - * Updates a media by the media link. - * - * @param mediaLink the media link. - * @param mediaStream the media stream to upload. - * @param options the media options. - * @return the media response. - */ - Observable updateMedia(String mediaLink, InputStream mediaStream, MediaOptions options); - - /** - * Query for attachments. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained attachments. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained attachments or an error. - */ - Observable> queryAttachments(String documentLink, String query, FeedOptions options); - - /** - * Query for attachments. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained attachments. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained attachments or an error. - */ - Observable> queryAttachments(String documentLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Creates an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created attachment. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param mediaStream the media stream for creating the attachment. - * @param options the media options. - * @param requestOptions the request options - * @return an {@link Observable} containing the single resource response with the created attachment or an error. - */ - Observable> createAttachment(String documentLink, InputStream mediaStream, MediaOptions options, RequestOptions requestOptions); - - /** - * Upserts an attachment to the media stream - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted attachment. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param mediaStream the media stream for upserting the attachment. - * @param options the media options. - * @param requestOptions the request options - * @return an {@link Observable} containing the single resource response with the upserted attachment or an error. - */ - Observable> upsertAttachment(String documentLink, InputStream mediaStream, MediaOptions options, RequestOptions requestOptions); - - /** - * Reads a conflict. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read conflict. - * In case of failure the {@link Observable} will error. - * - * @param conflictLink the conflict link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read conflict or an error. - */ - Observable> readConflict(String conflictLink, RequestOptions options); - - /** - * Reads all conflicts in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read conflicts. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read conflicts or an error. - */ - Observable> readConflicts(String collectionLink, FeedOptions options); - - /** - * Query for conflicts. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained conflicts. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained conflicts or an error. - */ - Observable> queryConflicts(String collectionLink, String query, FeedOptions options); - - /** - * Query for conflicts. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained conflicts. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained conflicts or an error. - */ - Observable> queryConflicts(String collectionLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Deletes a conflict. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted conflict. - * In case of failure the {@link Observable} will error. - * - * @param conflictLink the conflict link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted conflict or an error. - */ - Observable> deleteConflict(String conflictLink, RequestOptions options); - - /** - * Creates a user. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created user. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param user the user to create. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created user or an error. - */ - Observable> createUser(String databaseLink, User user, RequestOptions options); - - /** - * Upserts a user. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted user. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param user the user to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted user or an error. - */ - Observable> upsertUser(String databaseLink, User user, RequestOptions options); - - /** - * Replaces a user. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced user. - * In case of failure the {@link Observable} will error. - * - * @param user the user to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced user or an error. - */ - Observable> replaceUser(User user, RequestOptions options); - - /** - * Deletes a user. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted user. - * In case of failure the {@link Observable} will error. - * - * @param userLink the user link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted user or an error. - */ - Observable> deleteUser(String userLink, RequestOptions options); - - /** - * Reads a user. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read user. - * In case of failure the {@link Observable} will error. - * - * @param userLink the user link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read user or an error. - */ - Observable> readUser(String userLink, RequestOptions options); - - /** - * Reads all users in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read users. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read users or an error. - */ - Observable> readUsers(String databaseLink, FeedOptions options); - - /** - * Query for users. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained users. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained users or an error. - */ - Observable> queryUsers(String databaseLink, String query, FeedOptions options); - - /** - * Query for users. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained users. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained users or an error. - */ - Observable> queryUsers(String databaseLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Creates a permission. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created permission. - * In case of failure the {@link Observable} will error. - * - * @param userLink the user link. - * @param permission the permission to create. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created permission or an error. - */ - Observable> createPermission(String userLink, Permission permission, RequestOptions options); - - /** - * Upserts a permission. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted permission. - * In case of failure the {@link Observable} will error. - * - * @param userLink the user link. - * @param permission the permission to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted permission or an error. - */ - Observable> upsertPermission(String userLink, Permission permission, RequestOptions options); - - /** - * Replaces a permission. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced permission. - * In case of failure the {@link Observable} will error. - * - * @param permission the permission to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced permission or an error. - */ - Observable> replacePermission(Permission permission, RequestOptions options); - - /** - * Deletes a permission. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted permission. - * In case of failure the {@link Observable} will error. - * - * @param permissionLink the permission link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted permission or an error. - */ - Observable> deletePermission(String permissionLink, RequestOptions options); - - /** - * Reads a permission. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read permission. - * In case of failure the {@link Observable} will error. - * - * @param permissionLink the permission link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read permission or an error. - */ - Observable> readPermission(String permissionLink, RequestOptions options); - - /** - * Reads all permissions. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read permissions. - * In case of failure the {@link Observable} will error. - * - * @param permissionLink the permission link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read permissions or an error. - */ - Observable> readPermissions(String permissionLink, FeedOptions options); - - /** - * Query for permissions. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained permissions. - * In case of failure the {@link Observable} will error. - * - * @param permissionLink the permission link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained permissions or an error. - */ - Observable> queryPermissions(String permissionLink, String query, FeedOptions options); - - /** - * Query for permissions. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained permissions. - * In case of failure the {@link Observable} will error. - * - * @param permissionLink the permission link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained permissions or an error. - */ - Observable> queryPermissions(String permissionLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Replaces an offer. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced offer. - * In case of failure the {@link Observable} will error. - * - * @param offer the offer to use. - * @return an {@link Observable} containing the single resource response with the replaced offer or an error. - */ - Observable> replaceOffer(Offer offer); - - /** - * Reads an offer. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read offer. - * In case of failure the {@link Observable} will error. - * - * @param offerLink the offer link. - * @return an {@link Observable} containing the single resource response with the read offer or an error. - */ - Observable> readOffer(String offerLink); - - /** - * Reads offers. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read offers. - * In case of failure the {@link Observable} will error. - * - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read offers or an error. - */ - Observable> readOffers(FeedOptions options); - - /** - * Query for offers in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of obtained obtained offers. - * In case of failure the {@link Observable} will error. - * - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained offers or an error. - */ - Observable> queryOffers(String query, FeedOptions options); - - /** - * Query for offers in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of obtained obtained offers. - * In case of failure the {@link Observable} will error. - * - * @param querySpec the query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained offers or an error. - */ - Observable> queryOffers(SqlQuerySpec querySpec, FeedOptions options); - - /** - * Gets database account information. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the database account. - * In case of failure the {@link Observable} will error. - * - * @return an {@link Observable} containing the single resource response with the database account or an error. - */ - Observable getDatabaseAccount(); - - /** - * Close this {@link AsyncDocumentClient} instance and cleans up the resources. - */ - void close(); - -} diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ChangeFeedQueryImpl.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ChangeFeedQueryImpl.java deleted file mode 100644 index 4b988cd84bc7..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ChangeFeedQueryImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.util.HashMap; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.Paths; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.query.Paginator; - -import rx.Observable; -import rx.Single; -import rx.functions.Func1; -import rx.functions.Func2; - -class ChangeFeedQueryImpl { - - private static final String IfNonMatchAllHeaderValue = "*"; - private final RxDocumentClientImpl client; - private final ResourceType resourceType; - private final Class klass; - private final String documentsLink; - private final ChangeFeedOptions options; - - public ChangeFeedQueryImpl(RxDocumentClientImpl client, - ResourceType resourceType, - Class klass, - String collectionLink, - ChangeFeedOptions changeFeedOptions) { - - this.client = client; - this.resourceType = resourceType; - this.klass = klass; - this.documentsLink = Utils.joinPath(collectionLink, Paths.DOCUMENTS_PATH_SEGMENT); - changeFeedOptions = changeFeedOptions != null ? changeFeedOptions: new ChangeFeedOptions(); - - - if (resourceType.isPartitioned() && changeFeedOptions.getPartitionKeyRangeId() == null && changeFeedOptions.getPartitionKey() == null) { - throw new IllegalArgumentException(RMResources.PartitionKeyRangeIdOrPartitionKeyMustBeSpecified); - } - - if (changeFeedOptions.getPartitionKey() != null && - !Strings.isNullOrEmpty(changeFeedOptions.getPartitionKeyRangeId())) { - - throw new IllegalArgumentException(String.format( - RMResources.PartitionKeyAndParitionKeyRangeIdBothSpecified - , "feedOptions")); - } - - String initialNextIfNoneMatch = null; - - boolean canUseStartFromBeginning = true; - if (changeFeedOptions.getRequestContinuation() != null) { - initialNextIfNoneMatch = changeFeedOptions.getRequestContinuation(); - canUseStartFromBeginning = false; - } - - if(changeFeedOptions.getStartDateTime() != null){ - canUseStartFromBeginning = false; - } - - if (canUseStartFromBeginning && !changeFeedOptions.isStartFromBeginning()) { - initialNextIfNoneMatch = IfNonMatchAllHeaderValue; - } - - this.options = getChangeFeedOptions(changeFeedOptions, initialNextIfNoneMatch); - } - - private RxDocumentServiceRequest createDocumentServiceRequest(String continuationToken, int pageSize) { - Map headers = new HashMap<>(); - - if (options.getMaxItemCount() != null) { - headers.put(HttpConstants.HttpHeaders.PAGE_SIZE, String.valueOf(options.getMaxItemCount())); - } - - // On REST level, change feed is using IfNoneMatch/ETag instead of continuation. - if(continuationToken != null) { - headers.put(HttpConstants.HttpHeaders.IF_NONE_MATCH, continuationToken); - } - - headers.put(HttpConstants.HttpHeaders.A_IM, HttpConstants.A_IMHeaderValues.INCREMENTAL_FEED); - - if (options.getPartitionKey() != null) { - PartitionKeyInternal partitionKey = options.getPartitionKey().getInternalPartitionKey(); - headers.put(HttpConstants.HttpHeaders.PARTITION_KEY, partitionKey.toJson()); - } - - if(options.getStartDateTime() != null){ - String dateTimeInHttpFormat = Utils.zonedDateTimeAsUTCRFC1123(options.getStartDateTime()); - headers.put(HttpConstants.HttpHeaders.IF_MODIFIED_SINCE, dateTimeInHttpFormat); - } - - RxDocumentServiceRequest req = RxDocumentServiceRequest.create( - OperationType.ReadFeed, - resourceType, - documentsLink, - headers, - options); - - if (options.getPartitionKeyRangeId() != null) { - req.routeTo(new PartitionKeyRangeIdentity(this.options.getPartitionKeyRangeId())); - } - - return req; - } - - private ChangeFeedOptions getChangeFeedOptions(ChangeFeedOptions options, String continuationToken) { - ChangeFeedOptions newOps = new ChangeFeedOptions(options); - newOps.setRequestContinuation(continuationToken); - return newOps; - } - - public Observable> executeAsync() { - - Func2 createRequestFunc = (continuationToken, pageSize) -> this.createDocumentServiceRequest(continuationToken, pageSize); - - // TODO: clean up if we want to use single vs observable. - Func1>> executeFunc = request -> this.executeRequestAsync(request).toObservable(); - - return Paginator.getPaginatedChangeFeedQueryResultAsObservable(options, createRequestFunc, executeFunc, klass, options.getMaxItemCount() != null ? options.getMaxItemCount(): -1); - } - - private Single> executeRequestAsync(RxDocumentServiceRequest request) { - return client.readFeed(request).toSingle() - .map( rsp -> BridgeInternal.toChaneFeedResponsePage(rsp, klass)); - } -} diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientImpl.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientImpl.java deleted file mode 100644 index c64b74f03646..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientImpl.java +++ /dev/null @@ -1,3175 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.AccessConditionType; -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.CosmosResourceType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.DatabaseAccountManagerInternal; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptionsBase; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.MediaOptions; -import com.microsoft.azure.cosmosdb.MediaReadMode; -import com.microsoft.azure.cosmosdb.MediaResponse; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.StoredProcedureResponse; -import com.microsoft.azure.cosmosdb.TokenResolver; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.internal.BaseAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.LifeCycleUtils; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathInfo; -import com.microsoft.azure.cosmosdb.internal.PathParser; -import com.microsoft.azure.cosmosdb.internal.Paths; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.ResourceTokenAuthorizationHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.RuntimeConstants; -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GatewayServiceConfigurationReader; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ServerStoreModel; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreClient; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreClientFactory; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyAndResourceTokenPair; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxClientCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxPartitionKeyRangeCache; -import com.microsoft.azure.cosmosdb.rx.internal.directconnectivity.GlobalAddressResolver; -import com.microsoft.azure.cosmosdb.rx.internal.query.DocumentQueryExecutionContextFactory; -import com.microsoft.azure.cosmosdb.rx.internal.query.IDocumentQueryClient; -import com.microsoft.azure.cosmosdb.rx.internal.query.IDocumentQueryExecutionContext; -import com.microsoft.azure.cosmosdb.rx.internal.query.Paginator; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClientBuilder; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; -import rx.functions.Func1; -import rx.functions.Func2; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static com.microsoft.azure.cosmosdb.BridgeInternal.documentFromObject; -import static com.microsoft.azure.cosmosdb.BridgeInternal.getAltLink; -import static com.microsoft.azure.cosmosdb.BridgeInternal.toDatabaseAccount; -import static com.microsoft.azure.cosmosdb.BridgeInternal.toFeedResponsePage; -import static com.microsoft.azure.cosmosdb.BridgeInternal.toResourceResponse; -import static com.microsoft.azure.cosmosdb.BridgeInternal.toStoredProcedureResponse; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorizationTokenProvider { - private final static ObjectMapper mapper = Utils.getSimpleObjectMapper(); - private final Logger logger = LoggerFactory.getLogger(RxDocumentClientImpl.class); - private final String masterKeyOrResourceToken; - private final URI serviceEndpoint; - private final ConnectionPolicy connectionPolicy; - private final ConsistencyLevel consistencyLevel; - private final BaseAuthorizationTokenProvider authorizationTokenProvider; - private final UserAgentContainer userAgentContainer; - private final boolean hasAuthKeyResourceToken; - private final Configs configs; - private TokenResolver tokenResolver; - private SessionContainer sessionContainer; - private String firstResourceTokenFromPermissionFeed = StringUtils.EMPTY; - private RxClientCollectionCache collectionCache; - private RxStoreModel gatewayProxy; - private RxStoreModel storeModel; - private GlobalAddressResolver addressResolver; - private RxPartitionKeyRangeCache partitionKeyRangeCache; - private Map> resourceTokensMap; - - // RetryPolicy retries a request when it encounters session unavailable (see ClientRetryPolicy). - // Once it exhausts all write regions it clears the session container, then it uses RxClientCollectionCache - // to resolves the request's collection name. If it differs from the session container's resource id it - // explains the session unavailable exception: somebody removed and recreated the collection. In this - // case we retry once again (with empty session token) otherwise we return the error to the client - // (see RenameCollectionAwareClientRetryPolicy) - private IRetryPolicyFactory resetSessionTokenRetryPolicy; - /** - * Compatibility mode: Allows to specify compatibility mode used by client when - * making query requests. Should be removed when application/sql is no longer - * supported. - */ - private final QueryCompatibilityMode queryCompatibilityMode = QueryCompatibilityMode.Default; - private final CompositeHttpClient rxClient; - private final GlobalEndpointManager globalEndpointManager; - private final RetryPolicy retryPolicy; - private volatile boolean useMultipleWriteLocations; - - // creator of TransportClient is responsible for disposing it. - private StoreClientFactory storeClientFactory; - - private GatewayServiceConfigurationReader gatewayConfigurationReader; - - public RxDocumentClientImpl(URI serviceEndpoint, - String masterKeyOrResourceToken, - List permissionFeed, - ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, - Configs configs, - TokenResolver tokenResolver) { - this(serviceEndpoint, masterKeyOrResourceToken, permissionFeed, connectionPolicy, consistencyLevel, configs); - this.tokenResolver = tokenResolver; - } - - public RxDocumentClientImpl(URI serviceEndpoint, - String masterKeyOrResourceToken, - List permissionFeed, - ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, - Configs configs) { - this(serviceEndpoint, masterKeyOrResourceToken, connectionPolicy, consistencyLevel, configs); - if (permissionFeed != null && permissionFeed.size() > 0) { - this.resourceTokensMap = new HashMap<>(); - for (Permission permission : permissionFeed) { - String[] segments = StringUtils.split(permission.getResourceLink(), - Constants.Properties.PATH_SEPARATOR.charAt(0)); - - if (segments.length <= 0) { - throw new IllegalArgumentException("resourceLink"); - } - - List partitionKeyAndResourceTokenPairs = null; - PathInfo pathInfo = new PathInfo(false, StringUtils.EMPTY, StringUtils.EMPTY, false); - if (!PathsHelper.tryParsePathSegments(permission.getResourceLink(), pathInfo, null)) { - throw new IllegalArgumentException(permission.getResourceLink()); - } - - partitionKeyAndResourceTokenPairs = resourceTokensMap.get(pathInfo.resourceIdOrFullName); - if (partitionKeyAndResourceTokenPairs == null) { - partitionKeyAndResourceTokenPairs = new ArrayList<>(); - this.resourceTokensMap.put(pathInfo.resourceIdOrFullName, partitionKeyAndResourceTokenPairs); - } - - PartitionKey partitionKey = permission.getResourcePartitionKey(); - partitionKeyAndResourceTokenPairs.add(new PartitionKeyAndResourceTokenPair( - partitionKey != null ? partitionKey.getInternalPartitionKey() : PartitionKeyInternal.Empty, - permission.getToken())); - logger.debug("Initializing resource token map , with map key [{}] , partition key [{}] and resource token", - pathInfo.resourceIdOrFullName, partitionKey != null ? partitionKey.toString() : null, permission.getToken()); - - } - - if(this.resourceTokensMap.isEmpty()) { - throw new IllegalArgumentException("permissionFeed"); - } - - String firstToken = permissionFeed.get(0).getToken(); - if(ResourceTokenAuthorizationHelper.isResourceToken(firstToken)) { - this.firstResourceTokenFromPermissionFeed = firstToken; - } - } - } - - public RxDocumentClientImpl(URI serviceEndpoint, String masterKeyOrResourceToken, ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, Configs configs) { - - logger.info("Initializing DocumentClient with serviceEndpoint [{}], connectionPolicy [{}], " - + "consistencyLevel [{}], protocol [{}]", serviceEndpoint, connectionPolicy, - consistencyLevel, configs.getProtocol()); - - this.configs = configs; - this.masterKeyOrResourceToken = masterKeyOrResourceToken; - this.serviceEndpoint = serviceEndpoint; - - if (masterKeyOrResourceToken != null && ResourceTokenAuthorizationHelper.isResourceToken(masterKeyOrResourceToken)) { - this.authorizationTokenProvider = null; - hasAuthKeyResourceToken = true; - } else if(masterKeyOrResourceToken != null && !ResourceTokenAuthorizationHelper.isResourceToken(masterKeyOrResourceToken)){ - hasAuthKeyResourceToken = false; - this.authorizationTokenProvider = new BaseAuthorizationTokenProvider(this.masterKeyOrResourceToken); - } else { - hasAuthKeyResourceToken = false; - this.authorizationTokenProvider = null; - } - - if (connectionPolicy != null) { - this.connectionPolicy = connectionPolicy; - } else { - this.connectionPolicy = new ConnectionPolicy(); - } - - this.sessionContainer = new SessionContainer(this.serviceEndpoint.getHost()); - this.consistencyLevel = consistencyLevel; - - this.userAgentContainer = new UserAgentContainer(); - - String userAgentSuffix = this.connectionPolicy.getUserAgentSuffix(); - if (userAgentSuffix != null && userAgentSuffix.length() > 0) { - userAgentContainer.setSuffix(userAgentSuffix); - } - - this.rxClient = httpClientBuilder().build(); - this.globalEndpointManager = new GlobalEndpointManager(asDatabaseAccountManagerInternal(), this.connectionPolicy, /**/configs); - this.retryPolicy = new RetryPolicy(this.globalEndpointManager, this.connectionPolicy); - this.resetSessionTokenRetryPolicy = retryPolicy; - } - - private void initializeGatewayConfigurationReader() { - String resourceToken; - if(this.tokenResolver != null) { - resourceToken = this.tokenResolver.getAuthorizationToken("GET", "", CosmosResourceType.System, null); - } else if(!this.hasAuthKeyResourceToken && this.authorizationTokenProvider == null) { - resourceToken = this.firstResourceTokenFromPermissionFeed; - } else { - assert this.masterKeyOrResourceToken != null; - resourceToken = this.masterKeyOrResourceToken; - } - - this.gatewayConfigurationReader = new GatewayServiceConfigurationReader(this.serviceEndpoint, - this.hasAuthKeyResourceToken, - resourceToken, - this.connectionPolicy, - this.authorizationTokenProvider, - this.rxClient); - - DatabaseAccount databaseAccount = this.gatewayConfigurationReader.initializeReaderAsync().toBlocking().value(); - this.useMultipleWriteLocations = this.connectionPolicy.isUsingMultipleWriteLocations() && BridgeInternal.isEnableMultipleWriteLocations(databaseAccount); - - // TODO: add support for openAsync - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/332589 - this.globalEndpointManager.refreshLocationAsync(databaseAccount).await(); - } - - public void init() { - - // TODO: add support for openAsync - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/332589 - this.gatewayProxy = createRxGatewayProxy(this.sessionContainer, - this.consistencyLevel, - this.queryCompatibilityMode, - this.userAgentContainer, - this.globalEndpointManager, - this.rxClient); - this.globalEndpointManager.init(); - this.initializeGatewayConfigurationReader(); - - this.collectionCache = new RxClientCollectionCache(this.sessionContainer, this.gatewayProxy, this, this.retryPolicy); - this.resetSessionTokenRetryPolicy = new ResetSessionTokenRetryPolicyFactory(this.sessionContainer, this.collectionCache, this.retryPolicy); - - this.partitionKeyRangeCache = new RxPartitionKeyRangeCache(RxDocumentClientImpl.this, - collectionCache); - - if (this.connectionPolicy.getConnectionMode() == ConnectionMode.Gateway) { - this.storeModel = this.gatewayProxy; - } else { - this.initializeDirectConnectivity(); - } - } - - private void initializeDirectConnectivity() { - - this.storeClientFactory = new StoreClientFactory( - this.configs, - this.connectionPolicy.getRequestTimeoutInMillis() / 1000, - // this.maxConcurrentConnectionOpenRequests, - 0, - this.userAgentContainer - ); - - this.addressResolver = new GlobalAddressResolver( - this.rxClient, - this.globalEndpointManager, - this.configs.getProtocol(), - this, - this.collectionCache, - this.partitionKeyRangeCache, - userAgentContainer, - // TODO: Gateway Configuration Reader - // this.gatewayConfigurationReader, - null, - this.connectionPolicy); - - this.createStoreModel(true); - } - - DatabaseAccountManagerInternal asDatabaseAccountManagerInternal() { - return new DatabaseAccountManagerInternal() { - - @Override - public URI getServiceEndpoint() { - return RxDocumentClientImpl.this.getServiceEndpoint(); - } - - @Override - public Observable getDatabaseAccountFromEndpoint(URI endpoint) { - logger.info("Getting database account endpoint from {}", endpoint); - return RxDocumentClientImpl.this.getDatabaseAccountFromEndpoint(endpoint); - } - - @Override - public ConnectionPolicy getConnectionPolicy() { - return RxDocumentClientImpl.this.getConnectionPolicy(); - } - }; - } - - RxGatewayStoreModel createRxGatewayProxy(ISessionContainer sessionContainer, - ConsistencyLevel consistencyLevel, - QueryCompatibilityMode queryCompatibilityMode, - UserAgentContainer userAgentContainer, - GlobalEndpointManager globalEndpointManager, - CompositeHttpClient rxClient) { - return new RxGatewayStoreModel(sessionContainer, - consistencyLevel, - queryCompatibilityMode, - userAgentContainer, - globalEndpointManager, - rxClient); - } - - private CompositeHttpClientBuilder httpClientBuilder() { - - HttpClientFactory factory = new HttpClientFactory(this.configs) - .withMaxIdleConnectionTimeoutInMillis(this.connectionPolicy.getIdleConnectionTimeoutInMillis()) - .withPoolSize(this.connectionPolicy.getMaxPoolSize()) - .withHttpProxy(this.connectionPolicy.getProxy()) - .withRequestTimeoutInMillis(this.connectionPolicy.getRequestTimeoutInMillis()); - - return factory.toHttpClientBuilder(); - } - - private void createStoreModel(boolean subscribeRntbdStatus) { - // EnableReadRequestsFallback, if not explicitly set on the connection policy, - // is false if the account's consistency is bounded staleness, - // and true otherwise. - - StoreClient storeClient = this.storeClientFactory.createStoreClient( - this.addressResolver, - this.sessionContainer, - this.gatewayConfigurationReader, - this, - false - ); - - this.storeModel = new ServerStoreModel(storeClient); - } - - - @Override - public URI getServiceEndpoint() { - return this.serviceEndpoint; - } - - @Override - public URI getWriteEndpoint() { - return globalEndpointManager.getWriteEndpoints().stream().findFirst().map(loc -> { - try { - return loc.toURI(); - } catch (URISyntaxException e) { - throw new IllegalStateException(e); - } - }).orElse(null); - } - - @Override - public URI getReadEndpoint() { - return globalEndpointManager.getReadEndpoints().stream().findFirst().map(loc -> { - try { - return loc.toURI(); - } catch (URISyntaxException e) { - throw new IllegalStateException(e); - } - }).orElse(null); - } - - @Override - public ConnectionPolicy getConnectionPolicy() { - return this.connectionPolicy; - } - - @Override - public Observable> createDatabase(Database database, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createDatabaseInternal(database, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createDatabaseInternal(Database database, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - - if (database == null) { - throw new IllegalArgumentException("Database"); - } - - logger.debug("Creating a Database. id: [{}]", database.getId()); - validateResource(database); - - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Create, - ResourceType.Database, Paths.DATABASES_ROOT, database, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.create(request).map(response -> toResourceResponse(response, Database.class)); - } catch (Exception e) { - logger.debug("Failure in creating a database. due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteDatabase(String databaseLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteDatabaseInternal(databaseLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteDatabaseInternal(String databaseLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - - logger.debug("Deleting a Database. databaseLink: [{}]", databaseLink); - String path = Utils.joinPath(databaseLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Database, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, Database.class)); - } catch (Exception e) { - logger.debug("Failure in deleting a database. due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readDatabase(String databaseLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readDatabaseInternal(databaseLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readDatabaseInternal(String databaseLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - - logger.debug("Reading a Database. databaseLink: [{}]", databaseLink); - String path = Utils.joinPath(databaseLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Database, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(response -> toResourceResponse(response, Database.class)); - } catch (Exception e) { - logger.debug("Failure in reading a database. due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readDatabases(FeedOptions options) { - return readFeed(options, ResourceType.Database, Database.class, Paths.DATABASES_ROOT); - } - - private String parentResourceLinkToQueryLink(String parentResouceLink, ResourceType resourceTypeEnum) { - switch (resourceTypeEnum) { - case Database: - return Paths.DATABASES_ROOT; - - case DocumentCollection: - return Utils.joinPath(parentResouceLink, Paths.COLLECTIONS_PATH_SEGMENT); - - case Document: - return Utils.joinPath(parentResouceLink, Paths.DOCUMENTS_PATH_SEGMENT); - - case Offer: - return Paths.OFFERS_ROOT; - - case User: - return Utils.joinPath(parentResouceLink, Paths.USERS_PATH_SEGMENT); - - case Permission: - return Utils.joinPath(parentResouceLink, Paths.PERMISSIONS_PATH_SEGMENT); - - case Attachment: - return Utils.joinPath(parentResouceLink, Paths.ATTACHMENTS_PATH_SEGMENT); - - case StoredProcedure: - return Utils.joinPath(parentResouceLink, Paths.STORED_PROCEDURES_PATH_SEGMENT); - - case Trigger: - return Utils.joinPath(parentResouceLink, Paths.TRIGGERS_PATH_SEGMENT); - - case UserDefinedFunction: - return Utils.joinPath(parentResouceLink, Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT); - - default: - throw new IllegalArgumentException("resource type not supported"); - } - } - - private Observable> createQuery( - String parentResourceLink, - SqlQuerySpec sqlQuery, - FeedOptions options, - Class klass, - ResourceType resourceTypeEnum) { - - String queryResourceLink = parentResourceLinkToQueryLink(parentResourceLink, resourceTypeEnum); - - UUID activityId = Utils.randomUUID(); - IDocumentQueryClient queryClient = DocumentQueryClientImpl(RxDocumentClientImpl.this); - Observable> executionContext = - DocumentQueryExecutionContextFactory.createDocumentQueryExecutionContextAsync(queryClient, resourceTypeEnum, klass, sqlQuery , options, queryResourceLink, false, activityId); - return executionContext.single().flatMap(ex -> { - return ex.executeAsync(); - }); - } - - - @Override - public Observable> queryDatabases(String query, FeedOptions options) { - return queryDatabases(new SqlQuerySpec(query), options); - } - - - @Override - public Observable> queryDatabases(SqlQuerySpec querySpec, FeedOptions options) { - return createQuery(Paths.DATABASES_ROOT, querySpec, options, Database.class, ResourceType.Database); - } - - @Override - public Observable> createCollection(String databaseLink, - DocumentCollection collection, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> this.createCollectionInternal(databaseLink, collection, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createCollectionInternal(String databaseLink, - DocumentCollection collection, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - if (collection == null) { - throw new IllegalArgumentException("collection"); - } - - logger.debug("Creating a Collection. databaseLink: [{}], Collection id: [{}]", databaseLink, - collection.getId()); - validateResource(collection); - - String path = Utils.joinPath(databaseLink, Paths.COLLECTIONS_PATH_SEGMENT); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Create, - ResourceType.DocumentCollection, path, collection, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.create(request).map(response -> toResourceResponse(response, DocumentCollection.class)) - .doOnNext(resourceResponse -> { - // set the session token - this.sessionContainer.setSessionToken(resourceResponse.getResource().getResourceId(), - getAltLink(resourceResponse.getResource()), - resourceResponse.getResponseHeaders()); - }); - } catch (Exception e) { - logger.debug("Failure in creating a collection. due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> replaceCollection(DocumentCollection collection, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceCollectionInternal(collection, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replaceCollectionInternal(DocumentCollection collection, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (collection == null) { - throw new IllegalArgumentException("collection"); - } - - logger.debug("Replacing a Collection. id: [{}]", collection.getId()); - validateResource(collection); - - String path = Utils.joinPath(collection.getSelfLink(), null); - Map requestHeaders = this.getRequestHeaders(options); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.DocumentCollection, path, collection, requestHeaders, options); - - // TODO: .Net has some logic for updating session token which we don't - // have here - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, DocumentCollection.class)) - .doOnNext(resourceResponse -> { - if (resourceResponse.getResource() != null) { - // set the session token - this.sessionContainer.setSessionToken(resourceResponse.getResource().getResourceId(), - getAltLink(resourceResponse.getResource()), - resourceResponse.getResponseHeaders()); - } - }); - - } catch (Exception e) { - logger.debug("Failure in replacing a collection. due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteCollection(String collectionLink, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteCollectionInternal(collectionLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteCollectionInternal(String collectionLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - logger.debug("Deleting a Collection. collectionLink: [{}]", collectionLink); - String path = Utils.joinPath(collectionLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.DocumentCollection, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, DocumentCollection.class)); - - } catch (Exception e) { - logger.debug("Failure in deleting a collection, due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - private Observable delete(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.DELETE); - return getStoreProxy(request).processMessage(request); - } - - private Observable read(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.GET); - return getStoreProxy(request).processMessage(request); - } - - Observable readFeed(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.GET); - return gatewayProxy.processMessage(request); - } - - private Observable query(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.POST); - return this.getStoreProxy(request).processMessage(request) - .map(response -> { - this.captureSessionToken(request, response); - return response; - } - ); - } - - @Override - public Observable> readCollection(String collectionLink, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readCollectionInternal(collectionLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readCollectionInternal(String collectionLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - logger.debug("Reading a Collection. collectionLink: [{}]", collectionLink); - String path = Utils.joinPath(collectionLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.DocumentCollection, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(response -> toResourceResponse(response, DocumentCollection.class)); - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in reading a collection, due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readCollections(String databaseLink, FeedOptions options) { - - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - - return readFeed(options, ResourceType.DocumentCollection, DocumentCollection.class, - Utils.joinPath(databaseLink, Paths.COLLECTIONS_PATH_SEGMENT)); - } - - @Override - public Observable> queryCollections(String databaseLink, String query, - FeedOptions options) { - return createQuery(databaseLink, new SqlQuerySpec(query), options, DocumentCollection.class, ResourceType.DocumentCollection); - } - - @Override - public Observable> queryCollections(String databaseLink, - SqlQuerySpec querySpec, FeedOptions options) { - return createQuery(databaseLink, querySpec, options, DocumentCollection.class, ResourceType.DocumentCollection); - } - - private static String serializeProcedureParams(Object[] objectArray) { - String[] stringArray = new String[objectArray.length]; - - for (int i = 0; i < objectArray.length; ++i) { - Object object = objectArray[i]; - if (object instanceof JsonSerializable) { - stringArray[i] = ((JsonSerializable) object).toJson(); - } else { - - // POJO, ObjectNode, number, String or Boolean - try { - stringArray[i] = mapper.writeValueAsString(object); - } catch (IOException e) { - throw new IllegalArgumentException("Can't serialize the object into the json string", e); - } - } - } - - return String.format("[%s]", StringUtils.join(stringArray, ",")); - } - - private static void validateResource(Resource resource) { - if (!StringUtils.isEmpty(resource.getId())) { - if (resource.getId().indexOf('/') != -1 || resource.getId().indexOf('\\') != -1 || - resource.getId().indexOf('?') != -1 || resource.getId().indexOf('#') != -1) { - throw new IllegalArgumentException("Id contains illegal chars."); - } - - if (resource.getId().endsWith(" ")) { - throw new IllegalArgumentException("Id ends with a space."); - } - } - } - - private Map getRequestHeaders(RequestOptions options) { - Map headers = new HashMap<>(); - - if (this.useMultipleWriteLocations) { - headers.put(HttpConstants.HttpHeaders.ALLOW_TENTATIVE_WRITES, Boolean.TRUE.toString()); - } - - if (consistencyLevel != null) { - headers.put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, consistencyLevel.name()); - } - - if (options == null) { - return headers; - } - - Map customOptions = options.getHeaders(); - if (customOptions != null) { - headers.putAll(customOptions); - } - - if (options.getAccessCondition() != null) { - if (options.getAccessCondition().getType() == AccessConditionType.IfMatch) { - headers.put(HttpConstants.HttpHeaders.IF_MATCH, options.getAccessCondition().getCondition()); - } else { - headers.put(HttpConstants.HttpHeaders.IF_NONE_MATCH, options.getAccessCondition().getCondition()); - } - } - - if (options.getConsistencyLevel() != null) { - headers.put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, options.getConsistencyLevel().name()); - } - - if (options.getIndexingDirective() != null) { - headers.put(HttpConstants.HttpHeaders.INDEXING_DIRECTIVE, options.getIndexingDirective().name()); - } - - if (options.getPostTriggerInclude() != null && options.getPostTriggerInclude().size() > 0) { - String postTriggerInclude = StringUtils.join(options.getPostTriggerInclude(), ","); - headers.put(HttpConstants.HttpHeaders.POST_TRIGGER_INCLUDE, postTriggerInclude); - } - - if (options.getPreTriggerInclude() != null && options.getPreTriggerInclude().size() > 0) { - String preTriggerInclude = StringUtils.join(options.getPreTriggerInclude(), ","); - headers.put(HttpConstants.HttpHeaders.PRE_TRIGGER_INCLUDE, preTriggerInclude); - } - - if (!Strings.isNullOrEmpty(options.getSessionToken())) { - headers.put(HttpConstants.HttpHeaders.SESSION_TOKEN, options.getSessionToken()); - } - - if (options.getResourceTokenExpirySeconds() != null) { - headers.put(HttpConstants.HttpHeaders.RESOURCE_TOKEN_EXPIRY, - String.valueOf(options.getResourceTokenExpirySeconds())); - } - - if (options.getOfferThroughput() != null && options.getOfferThroughput() >= 0) { - headers.put(HttpConstants.HttpHeaders.OFFER_THROUGHPUT, options.getOfferThroughput().toString()); - } else if (options.getOfferType() != null) { - headers.put(HttpConstants.HttpHeaders.OFFER_TYPE, options.getOfferType()); - } - - if (options.getPartitionKey() != null) { - headers.put(HttpConstants.HttpHeaders.PARTITION_KEY, options.getPartitionKey().toString()); - } - - if (options.isPopulateQuotaInfo()) { - headers.put(HttpConstants.HttpHeaders.POPULATE_QUOTA_INFO, String.valueOf(true)); - } - - if (options.isScriptLoggingEnabled()) { - headers.put(HttpConstants.HttpHeaders.SCRIPT_ENABLE_LOGGING, String.valueOf(true)); - } - - return headers; - } - - private Map getFeedHeaders(FeedOptionsBase options) { - return BridgeInternal.getFeedHeaders(options); - } - - private Map getMediaHeaders(MediaOptions options) { - Map requestHeaders = new HashMap<>(); - - if (options == null || StringUtils.isEmpty(options.getContentType())) { - requestHeaders.put(HttpConstants.HttpHeaders.CONTENT_TYPE, RuntimeConstants.MediaTypes.OCTET_STREAM); - } - - if (options != null) { - if (!StringUtils.isEmpty(options.getContentType())) { - requestHeaders.put(HttpConstants.HttpHeaders.CONTENT_TYPE, options.getContentType()); - } - - if (!StringUtils.isEmpty(options.getSlug())) { - requestHeaders.put(HttpConstants.HttpHeaders.SLUG, options.getSlug()); - } - } - return requestHeaders; - } - - private Single addPartitionKeyInformation(RxDocumentServiceRequest request, Document document, - RequestOptions options) { - - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - return collectionObs - .map(collection -> { - addPartitionKeyInformation(request, document, options, collection); - return request; - }); - } - - private Single addPartitionKeyInformation(RxDocumentServiceRequest request, Document document, RequestOptions options, - Single collectionObs) { - - return collectionObs.map(collection -> { - addPartitionKeyInformation(request, document, options, collection); - return request; - }); - } - - private void addPartitionKeyInformation(RxDocumentServiceRequest request, Document document, RequestOptions options, - DocumentCollection collection) { - PartitionKeyDefinition partitionKeyDefinition = collection.getPartitionKey(); - - PartitionKeyInternal partitionKeyInternal = null; - if (options != null && options.getPartitionKey() != null) { - partitionKeyInternal = options.getPartitionKey().getInternalPartitionKey(); - } else if (partitionKeyDefinition == null || partitionKeyDefinition.getPaths().size() == 0) { - // For backward compatibility, if collection doesn't have partition key defined, we assume all documents - // have empty value for it and user doesn't need to specify it explicitly. - partitionKeyInternal = PartitionKeyInternal.getEmpty(); - } else if (document != null) { - partitionKeyInternal = extractPartitionKeyValueFromDocument(document, partitionKeyDefinition); - } else { - throw new UnsupportedOperationException("PartitionKey value must be supplied for this operation."); - } - - request.getHeaders().put(HttpConstants.HttpHeaders.PARTITION_KEY, escapeNonAscii(partitionKeyInternal.toJson())); - } - - private static String escapeNonAscii(String partitionKeyJson) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < partitionKeyJson.length(); i++) { - int val = partitionKeyJson.charAt(i); - if (val > 127) { - sb.append("\\u").append(String.format("%04X", val)); - } else { - sb.append(partitionKeyJson.charAt(i)); - } - } - return sb.toString(); - } - - private static PartitionKeyInternal extractPartitionKeyValueFromDocument( - Document document, - PartitionKeyDefinition partitionKeyDefinition) { - if (partitionKeyDefinition != null) { - String path = partitionKeyDefinition.getPaths().iterator().next(); - List parts = PathParser.getPathParts(path); - if (parts.size() >= 1) { - Object value = document.getObjectByPath(parts); - if (value == null || value.getClass() == ObjectNode.class) { - value = Undefined.Value(); - } - - return PartitionKeyInternal.fromObjectArray(Collections.singletonList(value), false); - } - } - - return null; - } - - private Single getCreateDocumentRequest(String documentCollectionLink, Object document, - RequestOptions options, boolean disableAutomaticIdGeneration, OperationType operationType) { - - if (StringUtils.isEmpty(documentCollectionLink)) { - throw new IllegalArgumentException("documentCollectionLink"); - } - if (document == null) { - throw new IllegalArgumentException("document"); - } - - Document typedDocument = documentFromObject(document, mapper); - - RxDocumentClientImpl.validateResource(typedDocument); - - if (typedDocument.getId() == null && !disableAutomaticIdGeneration) { - // We are supposed to use GUID. Basically UUID is the same as GUID - // when represented as a string. - typedDocument.setId(UUID.randomUUID().toString()); - } - String path = Utils.joinPath(documentCollectionLink, Paths.DOCUMENTS_PATH_SEGMENT); - Map requestHeaders = this.getRequestHeaders(options); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.Document, path, - typedDocument, requestHeaders, options); - - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - return addPartitionKeyInformation(request, typedDocument, options, collectionObs); - } - - private void populateHeaders(RxDocumentServiceRequest request, String httpMethod) { - if (this.masterKeyOrResourceToken != null) { - request.getHeaders().put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - } - - if (this.masterKeyOrResourceToken != null || this.resourceTokensMap != null || this.tokenResolver != null) { - String resourceName = request.getResourceAddress(); - - String authorization = this.getUserAuthorizationToken( - resourceName, request.getResourceType(), httpMethod, request.getHeaders(), - AuthorizationTokenType.PrimaryMasterKey, request.properties); - try { - authorization = URLEncoder.encode(authorization, "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new IllegalStateException("Failed to encode authtoken.", e); - } - request.getHeaders().put(HttpConstants.HttpHeaders.AUTHORIZATION, authorization); - } - - if ((HttpConstants.HttpMethods.POST.equals(httpMethod) || HttpConstants.HttpMethods.PUT.equals(httpMethod)) - && !request.getHeaders().containsKey(HttpConstants.HttpHeaders.CONTENT_TYPE)) { - request.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, RuntimeConstants.MediaTypes.JSON); - } - - if (!request.getHeaders().containsKey(HttpConstants.HttpHeaders.ACCEPT)) { - request.getHeaders().put(HttpConstants.HttpHeaders.ACCEPT, RuntimeConstants.MediaTypes.JSON); - } - } - - @Override - public String getUserAuthorizationToken(String resourceName, - ResourceType resourceType, - String requestVerb, - Map headers, - AuthorizationTokenType tokenType, - Map properties) { - - if (this.tokenResolver != null) { - return this.tokenResolver.getAuthorizationToken(requestVerb, resourceName, this.resolveCosmosResourceType(resourceType), - properties != null ? Collections.unmodifiableMap(properties) : null); - } else if (masterKeyOrResourceToken != null && !hasAuthKeyResourceToken) { - return this.authorizationTokenProvider.generateKeyAuthorizationSignature(requestVerb, resourceName, - resourceType, headers); - } else if (masterKeyOrResourceToken != null && hasAuthKeyResourceToken && resourceTokensMap == null) { - return masterKeyOrResourceToken; - } else { - assert resourceTokensMap != null; - if(resourceType.equals(ResourceType.DatabaseAccount)) { - return this.firstResourceTokenFromPermissionFeed; - } - return ResourceTokenAuthorizationHelper.getAuthorizationTokenUsingResourceTokens(resourceTokensMap, requestVerb, resourceName, headers); - } - } - - private CosmosResourceType resolveCosmosResourceType(ResourceType resourceType) { - try { - return CosmosResourceType.valueOf(resourceType.name()); - } catch (IllegalArgumentException e) { - return CosmosResourceType.System; - } - } - - void captureSessionToken(RxDocumentServiceRequest request, RxDocumentServiceResponse response) { - this.sessionContainer.setSessionToken(request, response.getResponseHeaders()); - } - - private Observable create(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.POST); - RxStoreModel storeProxy = this.getStoreProxy(request); - return storeProxy.processMessage(request); - } - - private Observable upsert(RxDocumentServiceRequest request) { - - populateHeaders(request, HttpConstants.HttpMethods.POST); - Map headers = request.getHeaders(); - // headers can never be null, since it will be initialized even when no - // request options are specified, - // hence using assertion here instead of exception, being in the private - // method - assert (headers != null); - headers.put(HttpConstants.HttpHeaders.IS_UPSERT, "true"); - - return getStoreProxy(request).processMessage(request) - .map(response -> { - this.captureSessionToken(request, response); - return response; - } - ); - } - - private Observable replace(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.PUT); - return getStoreProxy(request).processMessage(request); - } - - @Override - public Observable> createDocument(String collectionLink, Object document, - RequestOptions options, boolean disableAutomaticIdGeneration) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - if (options == null || options.getPartitionKey() == null) { - requestRetryPolicy = new PartitionKeyMismatchRetryPolicy(collectionCache, requestRetryPolicy, collectionLink, options); - } - - IDocumentClientRetryPolicy finalRetryPolicyInstance = requestRetryPolicy; - return ObservableHelper.inlineIfPossibleAsObs(() -> createDocumentInternal(collectionLink, document, options, disableAutomaticIdGeneration, finalRetryPolicyInstance), requestRetryPolicy); - } - - private Observable> createDocumentInternal(String collectionLink, Object document, - RequestOptions options, final boolean disableAutomaticIdGeneration, IDocumentClientRetryPolicy requestRetryPolicy) { - - try { - logger.debug("Creating a Document. collectionLink: [{}]", collectionLink); - - Single requestObs = getCreateDocumentRequest(collectionLink, document, - options, disableAutomaticIdGeneration, OperationType.Create); - - Observable responseObservable = requestObs - .toObservable() - .flatMap(req -> { - if (requestRetryPolicy != null) { - requestRetryPolicy.onBeforeSendRequest(req); - } - - return create(req); - }); - - Observable> createObservable = - responseObservable - .map(serviceResponse -> { - return toResourceResponse(serviceResponse, Document.class); - }); - - return createObservable; - - } catch (Exception e) { - logger.debug("Failure in creating a document due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertDocument(String collectionLink, Object document, - RequestOptions options, boolean disableAutomaticIdGeneration) { - - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - if (options == null || options.getPartitionKey() == null) { - requestRetryPolicy = new PartitionKeyMismatchRetryPolicy(collectionCache, requestRetryPolicy, collectionLink, options); - } - IDocumentClientRetryPolicy finalRetryPolicyInstance = requestRetryPolicy; - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertDocumentInternal(collectionLink, document, options, disableAutomaticIdGeneration, finalRetryPolicyInstance), requestRetryPolicy); - } - - private Observable> upsertDocumentInternal(String collectionLink, Object document, - RequestOptions options, boolean disableAutomaticIdGeneration, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - logger.debug("Upserting a Document. collectionLink: [{}]", collectionLink); - - Observable reqObs = getCreateDocumentRequest(collectionLink, document, - options, disableAutomaticIdGeneration, OperationType.Upsert).toObservable(); - - Observable responseObservable = reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return upsert(req);}); - return responseObservable - .map(serviceResponse -> toResourceResponse(serviceResponse, Document.class)); - - } catch (Exception e) { - logger.debug("Failure in upserting a document due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> replaceDocument(String documentLink, Object document, - RequestOptions options) { - - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - if (options == null || options.getPartitionKey() == null) { - String collectionLink = Utils.getCollectionName(documentLink); - requestRetryPolicy = new PartitionKeyMismatchRetryPolicy(collectionCache, requestRetryPolicy, collectionLink, options); - } - IDocumentClientRetryPolicy finalRequestRetryPolicy = requestRetryPolicy; - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceDocumentInternal(documentLink, document, options, finalRequestRetryPolicy), requestRetryPolicy); - } - - private Observable> replaceDocumentInternal(String documentLink, Object document, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - - if (document == null) { - throw new IllegalArgumentException("document"); - } - - Document typedDocument = documentFromObject(document, mapper); - - return this.replaceDocumentInternal(documentLink, typedDocument, options, retryPolicyInstance); - - } catch (Exception e) { - logger.debug("Failure in replacing a document due to [{}]", e.getMessage()); - return Observable.error(e); - } - } - - @Override - public Observable> replaceDocument(Document document, RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - if (options == null || options.getPartitionKey() == null) { - String collectionLink = document.getSelfLink(); - requestRetryPolicy = new PartitionKeyMismatchRetryPolicy(collectionCache, requestRetryPolicy, collectionLink, options); - } - IDocumentClientRetryPolicy finalRequestRetryPolicy = requestRetryPolicy; - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceDocumentInternal(document, options, finalRequestRetryPolicy), requestRetryPolicy); - } - - private Observable> replaceDocumentInternal(Document document, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (document == null) { - throw new IllegalArgumentException("document"); - } - - return this.replaceDocumentInternal(document.getSelfLink(), document, options, retryPolicyInstance); - - } catch (Exception e) { - logger.debug("Failure in replacing a database due to [{}]", e.getMessage()); - return Observable.error(e); - } - } - - private Observable> replaceDocumentInternal(String documentLink, Document document, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - if (document == null) { - throw new IllegalArgumentException("document"); - } - - logger.debug("Replacing a Document. documentLink: [{}]", documentLink); - final String path = Utils.joinPath(documentLink, null); - final Map requestHeaders = getRequestHeaders(options); - final RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.Document, path, document, requestHeaders, options); - - validateResource(document); - - Single collectionObs = collectionCache.resolveCollectionAsync(request); - Single requestObs = addPartitionKeyInformation(request, document, options, collectionObs); - - return requestObs.toObservable().flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return replace(request) - .map(resp -> toResourceResponse(resp, Document.class));} ); - } - - @Override - public Observable> deleteDocument(String documentLink, RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteDocumentInternal(documentLink, options, requestRetryPolicy), requestRetryPolicy); - } - - private Observable> deleteDocumentInternal(String documentLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - - logger.debug("Deleting a Document. documentLink: [{}]", documentLink); - String path = Utils.joinPath(documentLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Document, path, requestHeaders, options); - - Single collectionObs = collectionCache.resolveCollectionAsync(request); - - Single requestObs = addPartitionKeyInformation(request, null, options, collectionObs); - - return requestObs.toObservable().flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - return this.delete(req) - .map(serviceResponse -> toResourceResponse(serviceResponse, Document.class));}); - - } catch (Exception e) { - logger.debug("Failure in deleting a document due to [{}]", e.getMessage()); - return Observable.error(e); - } - } - - @Override - public Observable> readDocument(String documentLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readDocumentInternal(documentLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readDocumentInternal(String documentLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - - logger.debug("Reading a Document. documentLink: [{}]", documentLink); - String path = Utils.joinPath(documentLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Document, path, requestHeaders, options); - - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - - Single requestObs = addPartitionKeyInformation(request, null, options, collectionObs); - - return requestObs.toObservable().flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(serviceResponse -> toResourceResponse(serviceResponse, Document.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in reading a document due to [{}]", e.getMessage()); - return Observable.error(e); - } - } - - @Override - public Observable> readDocuments(String collectionLink, FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return queryDocuments(collectionLink, "SELECT * FROM r", options); - } - - @Override - public Observable> queryDocuments(String collectionLink, String query, - FeedOptions options) { - return queryDocuments(collectionLink, new SqlQuerySpec(query), options); - } - - private IDocumentQueryClient DocumentQueryClientImpl(RxDocumentClientImpl rxDocumentClientImpl) { - - return new IDocumentQueryClient () { - - @Override - public RxCollectionCache getCollectionCache() { - return RxDocumentClientImpl.this.collectionCache; - } - - @Override - public RxPartitionKeyRangeCache getPartitionKeyRangeCache() { - return RxDocumentClientImpl.this.partitionKeyRangeCache; - } - - @Override - public IRetryPolicyFactory getResetSessionTokenRetryPolicy() { - return RxDocumentClientImpl.this.resetSessionTokenRetryPolicy; - } - - @Override - public ConsistencyLevel getDefaultConsistencyLevelAsync() { - return RxDocumentClientImpl.this.gatewayConfigurationReader.getDefaultConsistencyLevel(); - } - - @Override - public ConsistencyLevel getDesiredConsistencyLevelAsync() { - // TODO Auto-generated method stub - return RxDocumentClientImpl.this.consistencyLevel; - } - - @Override - public Single executeQueryAsync(RxDocumentServiceRequest request) { - return RxDocumentClientImpl.this.query(request).toSingle(); - } - - @Override - public QueryCompatibilityMode getQueryCompatibilityMode() { - // TODO Auto-generated method stub - return QueryCompatibilityMode.Default; - } - - @Override - public Single readFeedAsync(RxDocumentServiceRequest request) { - // TODO Auto-generated method stub - return null; - } - }; - } - - @Override - public Observable> queryDocuments(String collectionLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(collectionLink, querySpec, options, Document.class, ResourceType.Document); - } - - @Override - public Observable> queryDocumentChangeFeed(final String collectionLink, - final ChangeFeedOptions changeFeedOptions) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - ChangeFeedQueryImpl changeFeedQueryImpl = new ChangeFeedQueryImpl(this, ResourceType.Document, - Document.class, collectionLink, changeFeedOptions); - - return changeFeedQueryImpl.executeAsync(); - } - - @Override - public Observable> readPartitionKeyRanges(final String collectionLink, - FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return readFeed(options, ResourceType.PartitionKeyRange, PartitionKeyRange.class, - Utils.joinPath(collectionLink, Paths.PARTITION_KEY_RANGES_PATH_SEGMENT)); - } - - private RxDocumentServiceRequest getStoredProcedureRequest(String collectionLink, StoredProcedure storedProcedure, - RequestOptions options, OperationType operationType) { - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - if (storedProcedure == null) { - throw new IllegalArgumentException("storedProcedure"); - } - - validateResource(storedProcedure); - - String path = Utils.joinPath(collectionLink, Paths.STORED_PROCEDURES_PATH_SEGMENT); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.StoredProcedure, - path, storedProcedure, requestHeaders, options); - - return request; - } - - private RxDocumentServiceRequest getUserDefinedFunctionRequest(String collectionLink, UserDefinedFunction udf, - RequestOptions options, OperationType operationType) { - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - if (udf == null) { - throw new IllegalArgumentException("udf"); - } - - validateResource(udf); - - String path = Utils.joinPath(collectionLink, Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, - ResourceType.UserDefinedFunction, path, udf, requestHeaders, options); - - return request; - } - - @Override - public Observable> createStoredProcedure(String collectionLink, - StoredProcedure storedProcedure, RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createStoredProcedureInternal(collectionLink, storedProcedure, options, requestRetryPolicy), requestRetryPolicy); - } - - private Observable> createStoredProcedureInternal(String collectionLink, - StoredProcedure storedProcedure, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - - logger.debug("Creating a StoredProcedure. collectionLink: [{}], storedProcedure id [{}]", - collectionLink, storedProcedure.getId()); - RxDocumentServiceRequest request = getStoredProcedureRequest(collectionLink, storedProcedure, options, - OperationType.Create); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.create(request).map(response -> toResourceResponse(response, StoredProcedure.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in creating a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertStoredProcedure(String collectionLink, - StoredProcedure storedProcedure, RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertStoredProcedureInternal(collectionLink, storedProcedure, options, requestRetryPolicy), requestRetryPolicy); - } - - private Observable> upsertStoredProcedureInternal(String collectionLink, - StoredProcedure storedProcedure, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - - logger.debug("Upserting a StoredProcedure. collectionLink: [{}], storedProcedure id [{}]", - collectionLink, storedProcedure.getId()); - RxDocumentServiceRequest request = getStoredProcedureRequest(collectionLink, storedProcedure, options, - OperationType.Upsert); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.upsert(request).map(response -> toResourceResponse(response, StoredProcedure.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in upserting a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> replaceStoredProcedure(StoredProcedure storedProcedure, - RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceStoredProcedureInternal(storedProcedure, options, requestRetryPolicy), requestRetryPolicy); - } - - private Observable> replaceStoredProcedureInternal(StoredProcedure storedProcedure, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - - if (storedProcedure == null) { - throw new IllegalArgumentException("storedProcedure"); - } - logger.debug("Replacing a StoredProcedure. storedProcedure id [{}]", storedProcedure.getId()); - - RxDocumentClientImpl.validateResource(storedProcedure); - - String path = Utils.joinPath(storedProcedure.getSelfLink(), null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.StoredProcedure, path, storedProcedure, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, StoredProcedure.class)); - - } catch (Exception e) { - logger.debug("Failure in replacing a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteStoredProcedure(String storedProcedureLink, - RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteStoredProcedureInternal(storedProcedureLink, options, requestRetryPolicy), requestRetryPolicy); - } - - private Observable> deleteStoredProcedureInternal(String storedProcedureLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - - if (StringUtils.isEmpty(storedProcedureLink)) { - throw new IllegalArgumentException("storedProcedureLink"); - } - - logger.debug("Deleting a StoredProcedure. storedProcedureLink [{}]", storedProcedureLink); - String path = Utils.joinPath(storedProcedureLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.StoredProcedure, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, StoredProcedure.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in deleting a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readStoredProcedure(String storedProcedureLink, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readStoredProcedureInternal(storedProcedureLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readStoredProcedureInternal(String storedProcedureLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - - if (StringUtils.isEmpty(storedProcedureLink)) { - throw new IllegalArgumentException("storedProcedureLink"); - } - - logger.debug("Reading a StoredProcedure. storedProcedureLink [{}]", storedProcedureLink); - String path = Utils.joinPath(storedProcedureLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.StoredProcedure, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.read(request).map(response -> toResourceResponse(response, StoredProcedure.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in reading a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readStoredProcedures(String collectionLink, - FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return readFeed(options, ResourceType.StoredProcedure, StoredProcedure.class, - Utils.joinPath(collectionLink, Paths.STORED_PROCEDURES_PATH_SEGMENT)); - } - - @Override - public Observable> queryStoredProcedures(String collectionLink, String query, - FeedOptions options) { - return queryStoredProcedures(collectionLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryStoredProcedures(String collectionLink, - SqlQuerySpec querySpec, FeedOptions options) { - return createQuery(collectionLink, querySpec, options, StoredProcedure.class, ResourceType.StoredProcedure); - } - - @Override - public Observable executeStoredProcedure(String storedProcedureLink, - Object[] procedureParams) { - return this.executeStoredProcedure(storedProcedureLink, null, procedureParams); - } - - @Override - public Observable executeStoredProcedure(String storedProcedureLink, - RequestOptions options, Object[] procedureParams) { - return ObservableHelper.inlineIfPossibleAsObs(() -> executeStoredProcedureInternal(storedProcedureLink, options, procedureParams), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable executeStoredProcedureInternal(String storedProcedureLink, - RequestOptions options, Object[] procedureParams) { - - try { - logger.debug("Executing a StoredProcedure. storedProcedureLink [{}]", storedProcedureLink); - String path = Utils.joinPath(storedProcedureLink, null); - - Map requestHeaders = getRequestHeaders(options); - requestHeaders.put(HttpConstants.HttpHeaders.ACCEPT, RuntimeConstants.MediaTypes.JSON); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ExecuteJavaScript, - ResourceType.StoredProcedure, path, - procedureParams != null ? RxDocumentClientImpl.serializeProcedureParams(procedureParams) : "", - requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - return reqObs.flatMap(req -> create(request) - .map(response -> { - this.captureSessionToken(request, response); - return toStoredProcedureResponse(response); - })); - - } catch (Exception e) { - logger.debug("Failure in executing a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> createTrigger(String collectionLink, Trigger trigger, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createTriggerInternal(collectionLink, trigger, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createTriggerInternal(String collectionLink, Trigger trigger, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - - logger.debug("Creating a Trigger. collectionLink [{}], trigger id [{}]", collectionLink, - trigger.getId()); - RxDocumentServiceRequest request = getTriggerRequest(collectionLink, trigger, options, - OperationType.Create); - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.create(request).map(response -> toResourceResponse(response, Trigger.class)); - - } catch (Exception e) { - logger.debug("Failure in creating a Trigger due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertTrigger(String collectionLink, Trigger trigger, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertTriggerInternal(collectionLink, trigger, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertTriggerInternal(String collectionLink, Trigger trigger, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - - logger.debug("Upserting a Trigger. collectionLink [{}], trigger id [{}]", collectionLink, - trigger.getId()); - RxDocumentServiceRequest request = getTriggerRequest(collectionLink, trigger, options, - OperationType.Upsert); - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.upsert(request).map(response -> toResourceResponse(response, Trigger.class)); - - } catch (Exception e) { - logger.debug("Failure in upserting a Trigger due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - private RxDocumentServiceRequest getTriggerRequest(String collectionLink, Trigger trigger, RequestOptions options, - OperationType operationType) { - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - if (trigger == null) { - throw new IllegalArgumentException("trigger"); - } - - RxDocumentClientImpl.validateResource(trigger); - - String path = Utils.joinPath(collectionLink, Paths.TRIGGERS_PATH_SEGMENT); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.Trigger, path, - trigger, requestHeaders, options); - - return request; - } - - @Override - public Observable> replaceTrigger(Trigger trigger, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceTriggerInternal(trigger, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replaceTriggerInternal(Trigger trigger, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (trigger == null) { - throw new IllegalArgumentException("trigger"); - } - - logger.debug("Replacing a Trigger. trigger id [{}]", trigger.getId()); - RxDocumentClientImpl.validateResource(trigger); - - String path = Utils.joinPath(trigger.getSelfLink(), null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.Trigger, path, trigger, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, Trigger.class)); - - } catch (Exception e) { - logger.debug("Failure in replacing a Trigger due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteTrigger(String triggerLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteTriggerInternal(triggerLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteTriggerInternal(String triggerLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(triggerLink)) { - throw new IllegalArgumentException("triggerLink"); - } - - logger.debug("Deleting a Trigger. triggerLink [{}]", triggerLink); - String path = Utils.joinPath(triggerLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Trigger, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, Trigger.class)); - - } catch (Exception e) { - logger.debug("Failure in deleting a Trigger due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readTrigger(String triggerLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readTriggerInternal(triggerLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readTriggerInternal(String triggerLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(triggerLink)) { - throw new IllegalArgumentException("triggerLink"); - } - - logger.debug("Reading a Trigger. triggerLink [{}]", triggerLink); - String path = Utils.joinPath(triggerLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Trigger, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.read(request).map(response -> toResourceResponse(response, Trigger.class)); - - } catch (Exception e) { - logger.debug("Failure in reading a Trigger due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readTriggers(String collectionLink, FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return readFeed(options, ResourceType.Trigger, Trigger.class, - Utils.joinPath(collectionLink, Paths.TRIGGERS_PATH_SEGMENT)); - } - - @Override - public Observable> queryTriggers(String collectionLink, String query, - FeedOptions options) { - return queryTriggers(collectionLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryTriggers(String collectionLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(collectionLink, querySpec, options, Trigger.class, ResourceType.Trigger); - } - - @Override - public Observable> createUserDefinedFunction(String collectionLink, - UserDefinedFunction udf, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createUserDefinedFunctionInternal(collectionLink, udf, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createUserDefinedFunctionInternal(String collectionLink, - UserDefinedFunction udf, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - logger.debug("Creating a UserDefinedFunction. collectionLink [{}], udf id [{}]", collectionLink, - udf.getId()); - RxDocumentServiceRequest request = getUserDefinedFunctionRequest(collectionLink, udf, options, - OperationType.Create); - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.create(request).map(response -> toResourceResponse(response, UserDefinedFunction.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in creating a UserDefinedFunction due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertUserDefinedFunction(String collectionLink, - UserDefinedFunction udf, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertUserDefinedFunctionInternal(collectionLink, udf, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertUserDefinedFunctionInternal(String collectionLink, - UserDefinedFunction udf, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - logger.debug("Upserting a UserDefinedFunction. collectionLink [{}], udf id [{}]", collectionLink, - udf.getId()); - RxDocumentServiceRequest request = getUserDefinedFunctionRequest(collectionLink, udf, options, - OperationType.Upsert); - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.upsert(request).map(response -> toResourceResponse(response, UserDefinedFunction.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in upserting a UserDefinedFunction due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> replaceUserDefinedFunction(UserDefinedFunction udf, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceUserDefinedFunctionInternal(udf, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replaceUserDefinedFunctionInternal(UserDefinedFunction udf, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - if (udf == null) { - throw new IllegalArgumentException("udf"); - } - - logger.debug("Replacing a UserDefinedFunction. udf id [{}]", udf.getId()); - validateResource(udf); - - String path = Utils.joinPath(udf.getSelfLink(), null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.UserDefinedFunction, path, udf, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, UserDefinedFunction.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in replacing a UserDefinedFunction due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteUserDefinedFunction(String udfLink, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteUserDefinedFunctionInternal(udfLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteUserDefinedFunctionInternal(String udfLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - if (StringUtils.isEmpty(udfLink)) { - throw new IllegalArgumentException("udfLink"); - } - - logger.debug("Deleting a UserDefinedFunction. udfLink [{}]", udfLink); - String path = Utils.joinPath(udfLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.UserDefinedFunction, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, UserDefinedFunction.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in deleting a UserDefinedFunction due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readUserDefinedFunction(String udfLink, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readUserDefinedFunctionInternal(udfLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readUserDefinedFunctionInternal(String udfLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - if (StringUtils.isEmpty(udfLink)) { - throw new IllegalArgumentException("udfLink"); - } - - logger.debug("Reading a UserDefinedFunction. udfLink [{}]", udfLink); - String path = Utils.joinPath(udfLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.UserDefinedFunction, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.read(request).map(response -> toResourceResponse(response, UserDefinedFunction.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in reading a UserDefinedFunction due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readUserDefinedFunctions(String collectionLink, - FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return readFeed(options, ResourceType.UserDefinedFunction, UserDefinedFunction.class, - Utils.joinPath(collectionLink, Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT)); - } - - @Override - public Observable> queryUserDefinedFunctions(String collectionLink, - String query, FeedOptions options) { - return queryUserDefinedFunctions(collectionLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryUserDefinedFunctions(String collectionLink, - SqlQuerySpec querySpec, FeedOptions options) { - return createQuery(collectionLink, querySpec, options, UserDefinedFunction.class, ResourceType.UserDefinedFunction); - } - - - @Override - public Observable> createAttachment(String documentLink, Attachment attachment, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createAttachmentInternal(documentLink, attachment, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createAttachmentInternal(String documentLink, Attachment attachment, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - logger.debug("Creating a Attachment. documentLink [{}], attachment id [{}]", documentLink, - attachment.getId()); - Observable reqObs = getAttachmentRequest(documentLink, attachment, options, - OperationType.Create).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return create(req).map(response -> toResourceResponse(response, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in creating a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - - @Override - public Observable> upsertAttachment(String documentLink, Attachment attachment, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.retryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertAttachmentInternal(documentLink, attachment, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertAttachmentInternal(String documentLink, Attachment attachment, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - logger.debug("Upserting a Attachment. documentLink [{}], attachment id [{}]", documentLink, - attachment.getId()); - Observable reqObs = getAttachmentRequest(documentLink, attachment, options, - OperationType.Upsert).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return upsert(req).map(response -> toResourceResponse(response, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in upserting a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> replaceAttachment(Attachment attachment, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceAttachmentInternal(attachment, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replaceAttachmentInternal(Attachment attachment, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (attachment == null) { - throw new IllegalArgumentException("attachment"); - } - - logger.debug("Replacing a Attachment. attachment id [{}]", attachment.getId()); - RxDocumentClientImpl.validateResource(attachment); - - String path = Utils.joinPath(attachment.getSelfLink(), null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.Attachment, path, attachment, requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return replace(request).map(response -> toResourceResponse(response, Attachment.class)); - }); - } catch (Exception e) { - logger.debug("Failure in replacing a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteAttachment(String attachmentLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteAttachmentInternal(attachmentLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteAttachmentInternal(String attachmentLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(attachmentLink)) { - throw new IllegalArgumentException("attachmentLink"); - } - - logger.debug("Deleting a Attachment. attachmentLink [{}]", attachmentLink); - String path = Utils.joinPath(attachmentLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Attachment, path, requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return delete(req).map(resp -> toResourceResponse(resp, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in deleting a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readAttachment(String attachmentLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readAttachmentInternal(attachmentLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readAttachmentInternal(String attachmentLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(attachmentLink)) { - throw new IllegalArgumentException("attachmentLink"); - } - - logger.debug("Reading a Attachment. attachmentLink [{}]", attachmentLink); - String path = Utils.joinPath(attachmentLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Attachment, path, requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - - return reqObs.flatMap(req -> { - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return read(request).map(response -> toResourceResponse(response, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in reading a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readAttachments(String documentLink, FeedOptions options) { - - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - - return readFeedCollectionChild(options, ResourceType.Attachment, Attachment.class, - Utils.joinPath(documentLink, Paths.ATTACHMENTS_PATH_SEGMENT)); - } - - @Override - public Observable readMedia(String mediaLink) { - if (StringUtils.isEmpty(mediaLink)) { - throw new IllegalArgumentException("mediaLink"); - } - - String targetPath = Utils.joinPath(mediaLink, null); - return ObservableHelper.inlineIfPossibleAsObs(() -> readMediaInternal(targetPath), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable readMediaInternal(String mediaLink) { - logger.debug("Reading a Media. mediaLink [{}]", mediaLink); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Media, mediaLink, (Map) null, null); - request.setIsMedia(true); - // Media is strong consistent always -> no need of session handling - populateHeaders(request, HttpConstants.HttpMethods.GET); - return gatewayProxy.processMessage(request).map(response -> - BridgeInternal.toMediaResponse(response, this.connectionPolicy.getMediaReadMode() == MediaReadMode.Buffered)); - } - - @Override - public Observable updateMedia(String mediaLink, InputStream mediaStream, MediaOptions options) { - if (StringUtils.isEmpty(mediaLink)) { - throw new IllegalArgumentException("mediaLink"); - } - if (mediaStream == null) { - throw new IllegalArgumentException("mediaStream"); - } - - String targetPath = Utils.joinPath(mediaLink, null); - return ObservableHelper.inlineIfPossibleAsObs(() -> updateMediaInternal(targetPath, mediaStream, options), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable updateMediaInternal(String mediaLink, InputStream mediaStream, MediaOptions options) { - logger.debug("Updating a Media. mediaLink [{}]", mediaLink); - Map requestHeaders = this.getMediaHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, ResourceType.Media, - mediaLink, - mediaStream, - requestHeaders); - request.setIsMedia(true); - - // Media is strong consistent always -> need of session handling - populateHeaders(request, HttpConstants.HttpMethods.PUT); - return gatewayProxy.processMessage(request).map(response -> - BridgeInternal.toMediaResponse(response, this.connectionPolicy.getMediaReadMode() == MediaReadMode.Buffered)); - } - - @Override - public Observable> queryAttachments(String documentLink, String query, - FeedOptions options) { - return queryAttachments(documentLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryAttachments(String documentLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(documentLink, querySpec, options, Attachment.class, ResourceType.Attachment); - } - - private Single getAttachmentRequest(String documentLink, Attachment attachment, - RequestOptions options, OperationType operationType) { - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - if (attachment == null) { - throw new IllegalArgumentException("attachment"); - } - - RxDocumentClientImpl.validateResource(attachment); - - String path = Utils.joinPath(documentLink, Paths.ATTACHMENTS_PATH_SEGMENT); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.Attachment, path, - attachment, requestHeaders, options); - - return addPartitionKeyInformation(request, null, options); - } - - @Override - public Observable> createAttachment(String documentLink, InputStream mediaStream, - MediaOptions options, RequestOptions requestOptions) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createAttachmentInternal(documentLink, mediaStream, options, requestOptions, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createAttachmentInternal(String documentLink, InputStream mediaStream, - MediaOptions options, RequestOptions requestOptions, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - logger.debug("Creating a Attachment. attachmentLink [{}]", documentLink); - Observable reqObs = getAttachmentRequest(documentLink, mediaStream, options, - requestOptions, OperationType.Create).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return create(req).map(response -> toResourceResponse(response, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in creating a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertAttachment(String documentLink, InputStream mediaStream, - MediaOptions options, RequestOptions requestOptions) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertAttachmentInternal(documentLink, mediaStream, options, requestOptions, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertAttachmentInternal(String documentLink, InputStream mediaStream, - MediaOptions options, RequestOptions requestOptions, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - logger.debug("Upserting a Attachment. attachmentLink [{}]", documentLink); - Observable reqObs = getAttachmentRequest(documentLink, mediaStream, options, - requestOptions, OperationType.Upsert).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return upsert(req).map(response -> toResourceResponse(response, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in upserting a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - private Single getAttachmentRequest(String documentLink, InputStream mediaStream, - MediaOptions options, RequestOptions requestOptions, OperationType operationType) { - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - if (mediaStream == null) { - throw new IllegalArgumentException("mediaStream"); - } - String path = Utils.joinPath(documentLink, Paths.ATTACHMENTS_PATH_SEGMENT); - Map requestHeaders = this.getMediaHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.Attachment, path, - mediaStream, requestHeaders); - request.setIsMedia(true); - return addPartitionKeyInformation(request, null, requestOptions); - } - - @Override - public Observable> readConflict(String conflictLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readConflictInternal(conflictLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readConflictInternal(String conflictLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(conflictLink)) { - throw new IllegalArgumentException("conflictLink"); - } - - logger.debug("Reading a Conflict. conflictLink [{}]", conflictLink); - String path = Utils.joinPath(conflictLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Conflict, path, requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(response -> toResourceResponse(response, Conflict.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in reading a Conflict due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readConflicts(String collectionLink, FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return readFeed(options, ResourceType.Conflict, Conflict.class, - Utils.joinPath(collectionLink, Paths.CONFLICTS_PATH_SEGMENT)); - } - - @Override - public Observable> queryConflicts(String collectionLink, String query, - FeedOptions options) { - return queryConflicts(collectionLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryConflicts(String collectionLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(collectionLink, querySpec, options, Conflict.class, ResourceType.Conflict); - } - - @Override - public Observable> deleteConflict(String conflictLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteConflictInternal(conflictLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteConflictInternal(String conflictLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(conflictLink)) { - throw new IllegalArgumentException("conflictLink"); - } - - logger.debug("Deleting a Conflict. conflictLink [{}]", conflictLink); - String path = Utils.joinPath(conflictLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Conflict, path, requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, Conflict.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in deleting a Conflict due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> createUser(String databaseLink, User user, RequestOptions options) { - return ObservableHelper.inlineIfPossibleAsObs(() -> createUserInternal(databaseLink, user, options), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable> createUserInternal(String databaseLink, User user, RequestOptions options) { - try { - logger.debug("Creating a User. databaseLink [{}], user id [{}]", databaseLink, user.getId()); - RxDocumentServiceRequest request = getUserRequest(databaseLink, user, options, OperationType.Create); - return this.create(request).map(response -> toResourceResponse(response, User.class)); - - } catch (Exception e) { - logger.debug("Failure in creating a User due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertUser(String databaseLink, User user, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertUserInternal(databaseLink, user, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertUserInternal(String databaseLink, User user, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - logger.debug("Upserting a User. databaseLink [{}], user id [{}]", databaseLink, user.getId()); - RxDocumentServiceRequest request = getUserRequest(databaseLink, user, options, OperationType.Upsert); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.upsert(request).map(response -> toResourceResponse(response, User.class)); - - } catch (Exception e) { - logger.debug("Failure in upserting a User due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - private RxDocumentServiceRequest getUserRequest(String databaseLink, User user, RequestOptions options, - OperationType operationType) { - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - if (user == null) { - throw new IllegalArgumentException("user"); - } - - RxDocumentClientImpl.validateResource(user); - - String path = Utils.joinPath(databaseLink, Paths.USERS_PATH_SEGMENT); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.User, path, user, - requestHeaders, options); - - return request; - } - - @Override - public Observable> replaceUser(User user, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceUserInternal(user, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replaceUserInternal(User user, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (user == null) { - throw new IllegalArgumentException("user"); - } - logger.debug("Replacing a User. user id [{}]", user.getId()); - RxDocumentClientImpl.validateResource(user); - - String path = Utils.joinPath(user.getSelfLink(), null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.User, path, user, requestHeaders, options); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, User.class)); - - } catch (Exception e) { - logger.debug("Failure in replacing a User due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - - public Observable> deleteUser(String userLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteUserInternal(userLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteUserInternal(String userLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(userLink)) { - throw new IllegalArgumentException("userLink"); - } - logger.debug("Deleting a User. userLink [{}]", userLink); - String path = Utils.joinPath(userLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.User, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, User.class)); - - } catch (Exception e) { - logger.debug("Failure in deleting a User due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - @Override - public Observable> readUser(String userLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readUserInternal(userLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readUserInternal(String userLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(userLink)) { - throw new IllegalArgumentException("userLink"); - } - logger.debug("Reading a User. userLink [{}]", userLink); - String path = Utils.joinPath(userLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.User, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(response -> toResourceResponse(response, User.class)); - - } catch (Exception e) { - logger.debug("Failure in reading a User due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readUsers(String databaseLink, FeedOptions options) { - - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - - return readFeed(options, ResourceType.User, User.class, - Utils.joinPath(databaseLink, Paths.USERS_PATH_SEGMENT)); - } - - @Override - public Observable> queryUsers(String databaseLink, String query, FeedOptions options) { - return queryUsers(databaseLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryUsers(String databaseLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(databaseLink, querySpec, options, User.class, ResourceType.User); - } - - @Override - public Observable> createPermission(String userLink, Permission permission, - RequestOptions options) { - return ObservableHelper.inlineIfPossibleAsObs(() -> createPermissionInternal(userLink, permission, options), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable> createPermissionInternal(String userLink, Permission permission, - RequestOptions options) { - - try { - logger.debug("Creating a Permission. userLink [{}], permission id [{}]", userLink, permission.getId()); - RxDocumentServiceRequest request = getPermissionRequest(userLink, permission, options, - OperationType.Create); - return this.create(request).map(response -> toResourceResponse(response, Permission.class)); - - } catch (Exception e) { - logger.debug("Failure in creating a Permission due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertPermission(String userLink, Permission permission, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertPermissionInternal(userLink, permission, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertPermissionInternal(String userLink, Permission permission, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - logger.debug("Upserting a Permission. userLink [{}], permission id [{}]", userLink, permission.getId()); - RxDocumentServiceRequest request = getPermissionRequest(userLink, permission, options, - OperationType.Upsert); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.upsert(request).map(response -> toResourceResponse(response, Permission.class)); - - } catch (Exception e) { - logger.debug("Failure in upserting a Permission due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - private RxDocumentServiceRequest getPermissionRequest(String userLink, Permission permission, - RequestOptions options, OperationType operationType) { - if (StringUtils.isEmpty(userLink)) { - throw new IllegalArgumentException("userLink"); - } - if (permission == null) { - throw new IllegalArgumentException("permission"); - } - - RxDocumentClientImpl.validateResource(permission); - - String path = Utils.joinPath(userLink, Paths.PERMISSIONS_PATH_SEGMENT); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.Permission, path, - permission, requestHeaders, options); - - return request; - } - - @Override - public Observable> replacePermission(Permission permission, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replacePermissionInternal(permission, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replacePermissionInternal(Permission permission, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (permission == null) { - throw new IllegalArgumentException("permission"); - } - logger.debug("Replacing a Permission. permission id [{}]", permission.getId()); - RxDocumentClientImpl.validateResource(permission); - - String path = Utils.joinPath(permission.getSelfLink(), null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.Permission, path, permission, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, Permission.class)); - - } catch (Exception e) { - logger.debug("Failure in replacing a Permission due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deletePermission(String permissionLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deletePermissionInternal(permissionLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deletePermissionInternal(String permissionLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(permissionLink)) { - throw new IllegalArgumentException("permissionLink"); - } - logger.debug("Deleting a Permission. permissionLink [{}]", permissionLink); - String path = Utils.joinPath(permissionLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Permission, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, Permission.class)); - - } catch (Exception e) { - logger.debug("Failure in deleting a Permission due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readPermission(String permissionLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readPermissionInternal(permissionLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readPermissionInternal(String permissionLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance ) { - try { - if (StringUtils.isEmpty(permissionLink)) { - throw new IllegalArgumentException("permissionLink"); - } - logger.debug("Reading a Permission. permissionLink [{}]", permissionLink); - String path = Utils.joinPath(permissionLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Permission, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(response -> toResourceResponse(response, Permission.class)); - - } catch (Exception e) { - logger.debug("Failure in reading a Permission due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readPermissions(String userLink, FeedOptions options) { - - if (StringUtils.isEmpty(userLink)) { - throw new IllegalArgumentException("userLink"); - } - - return readFeed(options, ResourceType.Permission, Permission.class, - Utils.joinPath(userLink, Paths.PERMISSIONS_PATH_SEGMENT)); - } - - @Override - public Observable> queryPermissions(String userLink, String query, - FeedOptions options) { - return queryPermissions(userLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryPermissions(String userLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(userLink, querySpec, options, Permission.class, ResourceType.Permission); - } - - @Override - public Observable> replaceOffer(Offer offer) { - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceOfferInternal(offer), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable> replaceOfferInternal(Offer offer) { - try { - if (offer == null) { - throw new IllegalArgumentException("offer"); - } - logger.debug("Replacing an Offer. offer id [{}]", offer.getId()); - RxDocumentClientImpl.validateResource(offer); - - String path = Utils.joinPath(offer.getSelfLink(), null); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.Offer, path, offer, null, null); - return this.replace(request).map(response -> toResourceResponse(response, Offer.class)); - - } catch (Exception e) { - logger.debug("Failure in replacing an Offer due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readOffer(String offerLink) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readOfferInternal(offerLink, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readOfferInternal(String offerLink, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(offerLink)) { - throw new IllegalArgumentException("offerLink"); - } - logger.debug("Reading an Offer. offerLink [{}]", offerLink); - String path = Utils.joinPath(offerLink, null); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Offer, path, (HashMap)null, null); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.read(request).map(response -> toResourceResponse(response, Offer.class)); - - } catch (Exception e) { - logger.debug("Failure in reading an Offer due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readOffers(FeedOptions options) { - return readFeed(options, ResourceType.Offer, Offer.class, - Utils.joinPath(Paths.OFFERS_PATH_SEGMENT, null)); - } - - private Observable> readFeedCollectionChild(FeedOptions options, ResourceType resourceType, - Class klass, String resourceLink) { - if (options == null) { - options = new FeedOptions(); - } - - int maxPageSize = options.getMaxItemCount() != null ? options.getMaxItemCount() : -1; - - final FeedOptions finalFeedOptions = options; - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(options.getPartitionKey()); - Func2 createRequestFunc = (continuationToken, pageSize) -> { - Map requestHeaders = new HashMap<>(); - if (continuationToken != null) { - requestHeaders.put(HttpConstants.HttpHeaders.CONTINUATION, continuationToken); - } - requestHeaders.put(HttpConstants.HttpHeaders.PAGE_SIZE, Integer.toString(pageSize)); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ReadFeed, - resourceType, resourceLink, requestHeaders, finalFeedOptions); - return request; - }; - - Func1>> executeFunc = request -> { - return ObservableHelper.inlineIfPossibleAsObs(() -> { - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - Single requestObs = this.addPartitionKeyInformation(request, null, requestOptions, collectionObs); - - return requestObs.toObservable().flatMap(req -> this.readFeed(req) - .map(response -> toFeedResponsePage(response, klass))); - }, this.resetSessionTokenRetryPolicy.getRequestPolicy()); - }; - - return Paginator.getPaginatedQueryResultAsObservable(options, createRequestFunc, executeFunc, klass, maxPageSize); - } - - private Observable> readFeed(FeedOptions options, ResourceType resourceType, Class klass, String resourceLink) { - if (options == null) { - options = new FeedOptions(); - } - - int maxPageSize = options.getMaxItemCount() != null ? options.getMaxItemCount() : -1; - final FeedOptions finalFeedOptions = options; - Func2 createRequestFunc = (continuationToken, pageSize) -> { - Map requestHeaders = new HashMap<>(); - if (continuationToken != null) { - requestHeaders.put(HttpConstants.HttpHeaders.CONTINUATION, continuationToken); - } - requestHeaders.put(HttpConstants.HttpHeaders.PAGE_SIZE, Integer.toString(pageSize)); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ReadFeed, - resourceType, resourceLink, requestHeaders, finalFeedOptions); - return request; - }; - - Func1>> executeFunc = request -> { - return ObservableHelper.inlineIfPossibleAsObs(() -> readFeed(request).map(response -> toFeedResponsePage(response, klass)), - this.resetSessionTokenRetryPolicy.getRequestPolicy()); - }; - - return Paginator.getPaginatedQueryResultAsObservable(options, createRequestFunc, executeFunc, klass, maxPageSize); - } - - @Override - public Observable> queryOffers(String query, FeedOptions options) { - return queryOffers(new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryOffers(SqlQuerySpec querySpec, FeedOptions options) { - return createQuery(null, querySpec, options, Offer.class, ResourceType.Offer); - } - - @Override - public Observable getDatabaseAccount() { - return ObservableHelper.inlineIfPossibleAsObs(() -> getDatabaseAccountInternal(), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable getDatabaseAccountInternal() { - try { - logger.debug("Getting Database Account"); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.DatabaseAccount, "", // path - (HashMap) null, - null); - return this.read(request).map(response -> toDatabaseAccount(response)); - - } catch (Exception e) { - logger.debug("Failure in getting Database Account due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - public Object getSession() { - return this.sessionContainer; - } - - public void setSession(Object sessionContainer) { - this.sessionContainer = (SessionContainer) sessionContainer; - } - - public RxPartitionKeyRangeCache getPartitionKeyRangeCache() { - return partitionKeyRangeCache; - } - - public Observable getDatabaseAccountFromEndpoint(URI endpoint) { - return Observable.defer(() -> { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.DatabaseAccount, "", (HashMap) null, (Object) null); - this.populateHeaders(request, HttpConstants.HttpMethods.GET); - - request.setEndpointOverride(endpoint); - return this.gatewayProxy.processMessage(request).doOnError(e -> { - String message = String.format("Failed to retrieve database account information. %s", - e.getCause() != null - ? e.getCause().toString() - : e.toString()); - logger.warn(message); - }).map(rsp -> rsp.getResource(DatabaseAccount.class)) - .doOnNext(databaseAccount -> { - this.useMultipleWriteLocations = this.connectionPolicy.isUsingMultipleWriteLocations() - && BridgeInternal.isEnableMultipleWriteLocations(databaseAccount); - }); - }); - } - - /** - * Certain requests must be routed through gateway even when the client connectivity mode is direct. - * - * @param request - * @return RxStoreModel - */ - private RxStoreModel getStoreProxy(RxDocumentServiceRequest request) { - // If a request is configured to always use Gateway mode(in some cases when targeting .NET Core) - // we return the Gateway store model - if (request.UseGatewayMode) { - return this.gatewayProxy; - } - - ResourceType resourceType = request.getResourceType(); - OperationType operationType = request.getOperationType(); - - if (resourceType == ResourceType.Offer || - resourceType.isScript() && operationType != OperationType.ExecuteJavaScript || - resourceType == ResourceType.PartitionKeyRange) { - return this.gatewayProxy; - } - - if (operationType == OperationType.Create - || operationType == OperationType.Upsert) { - if (resourceType == ResourceType.Database || - resourceType == ResourceType.User || - resourceType == ResourceType.DocumentCollection || - resourceType == ResourceType.Permission) { - return this.gatewayProxy; - } else { - return this.storeModel; - } - } else if (operationType == OperationType.Delete) { - if (resourceType == ResourceType.Database || - resourceType == ResourceType.User || - resourceType == ResourceType.DocumentCollection) { - return this.gatewayProxy; - } else { - return this.storeModel; - } - } else if (operationType == OperationType.Replace) { - if (resourceType == ResourceType.DocumentCollection) { - return this.gatewayProxy; - } else { - return this.storeModel; - } - } else if (operationType == OperationType.Read) { - if (resourceType == ResourceType.DocumentCollection) { - return this.gatewayProxy; - } else { - return this.storeModel; - } - } else { - if ((request.getOperationType() == OperationType.Query || request.getOperationType() == OperationType.SqlQuery) && - Utils.isCollectionChild(request.getResourceType())) { - if (request.getPartitionKeyRangeIdentity() == null) { - return this.gatewayProxy; - } - } - - return this.storeModel; - } - } - - @Override - public void close() { - logger.info("Shutting down ..."); - LifeCycleUtils.closeQuietly(this.globalEndpointManager); - LifeCycleUtils.closeQuietly(this.storeClientFactory); - - try { - this.rxClient.shutdown(); - } catch (Exception e) { - logger.warn("Failure in shutting down rxClient", e); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxPartitionKeyRangeCache.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxPartitionKeyRangeCache.java deleted file mode 100644 index 1636b7ccd29f..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxPartitionKeyRangeCache.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.internal.routing.IServerIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.InMemoryCollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import rx.Observable; -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - **/ -public class RxPartitionKeyRangeCache implements IPartitionKeyRangeCache { - private final Logger logger = LoggerFactory.getLogger(RxPartitionKeyRangeCache.class); - - private final AsyncCache routingMapCache; - private final AsyncDocumentClient client; - private final RxCollectionCache collectionCache; - - public RxPartitionKeyRangeCache(AsyncDocumentClient client, RxCollectionCache collectionCache) { - this.routingMapCache = new AsyncCache<>(); - this.client = client; - this.collectionCache = collectionCache; - } - - /* (non-Javadoc) - * @see com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache#tryLookupAsync(java.lang.String, com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap) - */ - @Override - public Single tryLookupAsync(String collectionRid, CollectionRoutingMap previousValue, Map properties) { - return routingMapCache.getAsync( - collectionRid, - previousValue, - () -> getRoutingMapForCollectionAsync(collectionRid, previousValue, properties)) - .onErrorResumeNext(err -> { - logger.debug("tryLookupAsync on collectionRid {} encountered failure", collectionRid, err); - DocumentClientException dce = Utils.as(err, DocumentClientException.class); - if (dce != null && Exceptions.isStatusCode(dce, HttpConstants.StatusCodes.NOTFOUND)) { - return Single.just(null); - } - - return Single.error(err); - }); - } - - @Override - public Single tryLookupAsync(String collectionRid, CollectionRoutingMap previousValue, boolean forceRefreshCollectionRoutingMap, - Map properties) { - return tryLookupAsync(collectionRid, previousValue, properties); - } - - /* (non-Javadoc) - * @see com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache#tryGetOverlappingRangesAsync(java.lang.String, com.microsoft.azure.cosmosdb.internal.routing.Range, boolean) - */ - @Override - public Single> tryGetOverlappingRangesAsync(String collectionRid, Range range, boolean forceRefresh, - Map properties) { - - Single routingMapObs = tryLookupAsync(collectionRid, null, properties); - - return routingMapObs.flatMap(routingMap -> { - if (forceRefresh && routingMap != null) { - logger.debug("tryGetOverlappingRangesAsync with forceRefresh on collectionRid {}", collectionRid); - return tryLookupAsync(collectionRid, routingMap, properties); - } - - return Single.just(routingMap); - - }).map(routingMap -> { - if (routingMap != null) { - // TODO: the routingMap.getOverlappingRanges(range) returns Collection - // maybe we should consider changing to ArrayList to avoid conversion - return new ArrayList<>(routingMap.getOverlappingRanges(range)); - } else { - logger.debug("Routing Map Null for collection: {} for range: {}, forceRefresh:{}", collectionRid, range.toString(), forceRefresh); - return null; - } - }); - } - - /* (non-Javadoc) - * @see com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache#tryGetPartitionKeyRangeByIdAsync(java.lang.String, java.lang.String, boolean) - */ - @Override - public Single tryGetPartitionKeyRangeByIdAsync(String collectionResourceId, String partitionKeyRangeId, - boolean forceRefresh, Map properties) { - - Single routingMapObs = tryLookupAsync(collectionResourceId, null, properties); - - return routingMapObs.flatMap(routingMap -> { - if (forceRefresh && routingMap != null) { - return tryLookupAsync(collectionResourceId, routingMap, properties); - } - - return Single.just(routingMap); - - }).map(routingMap -> { - if (routingMap != null) { - return routingMap.getRangeByPartitionKeyRangeId(partitionKeyRangeId); - } else { - logger.debug("Routing Map Null for collection: {}, PartitionKeyRangeId: {}, forceRefresh:{}", collectionResourceId, partitionKeyRangeId, forceRefresh); - return null; - } - }); - } - - /* (non-Javadoc) - * @see com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache#tryGetRangeByPartitionKeyRangeId(java.lang.String, java.lang.String) - */ - @Override - public Single tryGetRangeByPartitionKeyRangeId(String collectionRid, String partitionKeyRangeId, Map properties) { - Single routingMapObs = routingMapCache.getAsync( - collectionRid, - null, - () -> getRoutingMapForCollectionAsync(collectionRid, null, properties)); - - return routingMapObs.map(routingMap -> routingMap.getRangeByPartitionKeyRangeId(partitionKeyRangeId)) - .onErrorResumeNext(err -> { - DocumentClientException dce = Utils.as(err, DocumentClientException.class); - logger.debug("tryGetRangeByPartitionKeyRangeId on collectionRid {} and partitionKeyRangeId {} encountered failure", - collectionRid, partitionKeyRangeId, err); - - if (dce != null && Exceptions.isStatusCode(dce, HttpConstants.StatusCodes.NOTFOUND)) { - return Single.just(null); - } - - return Single.error(dce); - }); - } - - private Single getRoutingMapForCollectionAsync( - String collectionRid, - CollectionRoutingMap previousRoutingMap, - Map properties) { - - // TODO: NOTE: main java code doesn't do anything in regard to the previous routing map - // .Net code instead of using DocumentClient controls sending request and receiving requests here - - // here we stick to what main java sdk does, investigate later. - - Single> rangesObs = getPartitionKeyRange(collectionRid, false, properties); - - return rangesObs.flatMap(ranges -> { - - List> rangesTuples = - ranges.stream().map(range -> new ImmutablePair<>(range, (IServerIdentity) null)).collect(Collectors.toList()); - - - CollectionRoutingMap routingMap; - if (previousRoutingMap == null) - { - // Splits could have happened during change feed query and we might have a mix of gone and new ranges. - Set goneRanges = new HashSet<>(ranges.stream().flatMap(range -> CollectionUtils.emptyIfNull(range.getParents()).stream()).collect(Collectors.toSet())); - - routingMap = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap( - rangesTuples.stream().filter(tuple -> !goneRanges.contains(tuple.left.getId())).collect(Collectors.toList()), - collectionRid); - } - else - { - routingMap = previousRoutingMap.tryCombine(rangesTuples); - } - - if (routingMap == null) - { - // Range information either doesn't exist or is not complete. - return Single.error(new NotFoundException(String.format("GetRoutingMapForCollectionAsync(collectionRid: {%s}), Range information either doesn't exist or is not complete.", collectionRid))); - } - - return Single.just(routingMap); - }); - } - - private Single> getPartitionKeyRange(String collectionRid, boolean forceRefresh, Map properties) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create( - OperationType.ReadFeed, - collectionRid, - ResourceType.PartitionKeyRange, - null - ); //this request doesn't actually go to server - - request.requestContext.resolvedCollectionRid = collectionRid; - Single collectionObs = collectionCache.resolveCollectionAsync(request); - - return collectionObs.flatMap(coll -> { - - FeedOptions feedOptions = new FeedOptions(); - if (properties != null) { - feedOptions.setProperties(properties); - } - Observable> rs = client.readPartitionKeyRanges(coll.getSelfLink(), feedOptions) - // maxConcurrent = 1 to makes it in the right order - .flatMap(p -> Observable.from(p.getResults()), 1).toList(); - return rs.toSingle(); - }); - } -} - diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolver.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolver.java deleted file mode 100644 index 2299c4a04d31..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolver.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.directconnectivity; - - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.AddressInformation; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.AddressResolver; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GatewayAddressCache; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GatewayServiceConfigurationReader; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.IAddressResolver; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.GlobalEndpointManager; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxPartitionKeyRangeCache; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import rx.Completable; -import rx.Single; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -public class GlobalAddressResolver implements IAddressResolver { - private final static int MaxBackupReadRegions = 3; - private final GlobalEndpointManager endpointManager; - private final Protocol protocol; - private final IAuthorizationTokenProvider tokenProvider; - private final UserAgentContainer userAgentContainer; - private final RxCollectionCache collectionCache; - private final RxPartitionKeyRangeCache routingMapProvider; - private final int maxEndpoints; - private final GatewayServiceConfigurationReader serviceConfigReader; - final Map addressCacheByEndpoint; - - private GatewayAddressCache gatewayAddressCache; - private AddressResolver addressResolver; - private CompositeHttpClient httpClient; - - public GlobalAddressResolver( - CompositeHttpClient httpClient, - GlobalEndpointManager endpointManager, - Protocol protocol, - IAuthorizationTokenProvider tokenProvider, - RxCollectionCache collectionCache, - RxPartitionKeyRangeCache routingMapProvider, - UserAgentContainer userAgentContainer, - GatewayServiceConfigurationReader serviceConfigReader, - ConnectionPolicy connectionPolicy) { - - this.httpClient = httpClient; - this.endpointManager = endpointManager; - this.protocol = protocol; - this.tokenProvider = tokenProvider; - this.userAgentContainer = userAgentContainer; - this.collectionCache = collectionCache; - this.routingMapProvider = routingMapProvider; - this.serviceConfigReader = serviceConfigReader; - - int maxBackupReadEndpoints = (connectionPolicy.isEnableReadRequestsFallback() == null || connectionPolicy.isEnableReadRequestsFallback()) ? GlobalAddressResolver.MaxBackupReadRegions : 0; - this.maxEndpoints = maxBackupReadEndpoints + 2; // for write and alternate write endpoint (during failover) - this.addressCacheByEndpoint = new ConcurrentHashMap<>(); - - for (URL endpoint : endpointManager.getWriteEndpoints()) { - this.getOrAddEndpoint(endpoint); - } - for (URL endpoint : endpointManager.getReadEndpoints()) { - this.getOrAddEndpoint(endpoint); - } - } - - Completable openAsync(DocumentCollection collection) { - Single routingMap = this.routingMapProvider.tryLookupAsync(collection.getId(), null, null); - return routingMap.flatMapCompletable(collectionRoutingMap -> { - if (collectionRoutingMap == null) { - return Completable.complete(); - } - - List ranges = ((List)collectionRoutingMap.getOrderedPartitionKeyRanges()).stream().map(range -> - new PartitionKeyRangeIdentity(collection.getResourceId(), range.getId())).collect(Collectors.toList()); - List tasks = new ArrayList<>(); - for (EndpointCache endpointCache : this.addressCacheByEndpoint.values()) { - tasks.add(endpointCache.addressCache.openAsync(collection, ranges)); - } - return Completable.mergeDelayError(tasks); - }); - } - - @Override - public Single resolveAsync(RxDocumentServiceRequest request, boolean forceRefresh) { - IAddressResolver resolver = this.getAddressResolver(request); - return resolver.resolveAsync(request, forceRefresh); - } - - public void dispose() { - for (EndpointCache endpointCache : this.addressCacheByEndpoint.values()) { - endpointCache.addressCache.dispose(); - } - } - - private IAddressResolver getAddressResolver(RxDocumentServiceRequest rxDocumentServiceRequest) { - URL endpoint = this.endpointManager.resolveServiceEndpoint(rxDocumentServiceRequest); - return this.getOrAddEndpoint(endpoint).addressResolver; - } - - private EndpointCache getOrAddEndpoint(URL endpoint) { - EndpointCache endpointCache = this.addressCacheByEndpoint.computeIfAbsent(endpoint , key -> { - GatewayAddressCache gatewayAddressCache = new GatewayAddressCache(endpoint, protocol, this.tokenProvider, this.userAgentContainer, this.httpClient); - AddressResolver addressResolver = new AddressResolver(); - addressResolver.initializeCaches(this.collectionCache, this.routingMapProvider, gatewayAddressCache); - EndpointCache cache = new EndpointCache(); - cache.addressCache = gatewayAddressCache; - cache.addressResolver = addressResolver; - return cache; - }); - - if (this.addressCacheByEndpoint.size() > this.maxEndpoints) { - List allEndpoints = new ArrayList(this.endpointManager.getWriteEndpoints()); - allEndpoints.addAll(this.endpointManager.getReadEndpoints()); - Collections.reverse(allEndpoints); - Queue endpoints = new LinkedList<>(allEndpoints); - while (this.addressCacheByEndpoint.size() > this.maxEndpoints) { - if (endpoints.size() > 0) { - URL dequeueEnpoint = ((LinkedList) endpoints).pop(); - if (this.addressCacheByEndpoint.get(dequeueEnpoint) != null) { - this.addressCacheByEndpoint.remove(dequeueEnpoint); - } - } else { - break; - } - } - } - return endpointCache; - } - - static class EndpointCache { - GatewayAddressCache addressCache; - AddressResolver addressResolver; - } -} diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/package-info.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/package-info.java deleted file mode 100644 index 2a008122642e..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/package-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -/** - * This package provides Rx interfaces for interacting with Azure Cosmos DB. - */ -package com.microsoft.azure.cosmosdb.rx; \ No newline at end of file diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressValidator.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressValidator.java deleted file mode 100644 index bb19bcfbe40b..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressValidator.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import org.assertj.core.api.Condition; - -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This is a helper class for validating a partition address for tests. - */ -public interface AddressValidator { - - void validate(Address address); - - class Builder { - private List validators = new ArrayList<>(); - - public AddressValidator build() { - return new AddressValidator() { - - @Override - public void validate(Address address) { - for (AddressValidator validator : validators) { - validator.validate(address); - } - } - }; - } - - public Builder withId(final String resourceId) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.getId()).as("check Resource Id").isEqualTo(resourceId); - } - }); - return this; - } - - - - public Builder withProperty(String propertyName, Condition validatingCondition) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.get(propertyName)).is(validatingCondition); - - } - }); - return this; - } - - public Builder withProperty(String propertyName, Object value) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.get(propertyName)).isEqualTo(value); - - } - }); - return this; - } - - public Builder isPrimary(boolean isPrimary) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.IsPrimary()).isTrue(); - } - }); - return this; - } - - public Builder httpsProtocol() { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.getProtocolScheme()).isEqualTo("https"); - } - }); - return this; - } - - public Builder protocol(Protocol protocol) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - if (protocol == Protocol.Https) { - assertThat(address.getProtocolScheme()).isEqualTo("https"); - } else if (protocol == Protocol.Tcp){ - assertThat(address.getProtocolScheme()).isEqualTo("rntbd"); - } - } - }); - return this; - } - - public Builder withRid(String rid) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.getResourceId()).isEqualTo(rid); - } - }); - return this; - } - - public Builder withPartitionKeyRangeId(String partitionKeyRangeId) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.getParitionKeyRangeId()).isEqualTo(partitionKeyRangeId); - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelperTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelperTest.java deleted file mode 100644 index 57f6a4f79d0e..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelperTest.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import java.util.Map; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Fail.fail; - -public class BarrierRequestHelperTest { - @Test(groups = "direct") - public void barrierBasic() { - IAuthorizationTokenProvider authTokenProvider = getIAuthorizationTokenProvider(); - - for (ResourceType resourceType : ResourceType.values()) { - - for (OperationType operationType : OperationType.values()) { - Document randomResource = new Document(); - randomResource.setId(UUID.randomUUID().toString()); - RxDocumentServiceRequest request = - RxDocumentServiceRequest.create(operationType, resourceType, "/dbs/7mVFAA==/colls/7mVFAP1jpeU=", randomResource, (Map) null); - - BarrierRequestHelper.createAsync(request, authTokenProvider, 10l, 10l).toCompletable().await(); - request = - RxDocumentServiceRequest.create(operationType, resourceType, "/dbs/7mVFAA==", randomResource, null); - - request.setResourceId("3"); - try { - BarrierRequestHelper.createAsync(request, authTokenProvider, 10l, 10l).toCompletable().await(); - } catch (Exception e) { - if (!BarrierRequestHelper.isCollectionHeadBarrierRequest(resourceType, operationType)) { - fail("Should not fail for non-collection head combinations"); - } - } - } - } - } - - @Test(groups = "direct") - public void barrierDBFeed() { - IAuthorizationTokenProvider authTokenProvider = getIAuthorizationTokenProvider(); - - ResourceType resourceType = ResourceType.DocumentCollection; - OperationType operationType = OperationType.Query; - - Document randomResource = new Document(); - randomResource.setId(UUID.randomUUID().toString()); - RxDocumentServiceRequest request = - RxDocumentServiceRequest.create(operationType, resourceType, "/dbs/7mVFAA==/colls/7mVFAP1jpeU=", randomResource, (Map) null); - - RxDocumentServiceRequest barrierRequest = BarrierRequestHelper.createAsync(request, authTokenProvider, 11l, 10l).toBlocking().value(); - - assertThat(barrierRequest.getOperationType()).isEqualTo(OperationType.HeadFeed); - assertThat(barrierRequest.getResourceType()).isEqualTo(ResourceType.Database); - - - assertThat(getTargetGlobalLsn(barrierRequest)).isEqualTo(10l); - assertThat(getTargetLsn(barrierRequest)).isEqualTo(11l); - } - - @Test(groups = "direct") - public void barrierDocumentQueryNameBasedRequest() { - IAuthorizationTokenProvider authTokenProvider = getIAuthorizationTokenProvider(); - - ResourceType resourceType = ResourceType.Document; - OperationType operationType = OperationType.Query; - - Document randomResource = new Document(); - randomResource.setId(UUID.randomUUID().toString()); - RxDocumentServiceRequest request = - RxDocumentServiceRequest.create(operationType, resourceType, "/dbs/dbname/colls/collname", randomResource, (Map) null); - - RxDocumentServiceRequest barrierRequest = BarrierRequestHelper.createAsync(request, authTokenProvider, 11l, 10l).toBlocking().value(); - - assertThat(barrierRequest.getOperationType()).isEqualTo(OperationType.Head); - assertThat(barrierRequest.getResourceType()).isEqualTo(ResourceType.DocumentCollection); - assertThat(barrierRequest.getResourceAddress()).isEqualTo("dbs/dbname/colls/collname"); - - assertThat(getTargetGlobalLsn(barrierRequest)).isEqualTo(10l); - assertThat(getTargetLsn(barrierRequest)).isEqualTo(11l); - } - - @Test(groups = "direct") - public void barrierDocumentReadNameBasedRequest() { - IAuthorizationTokenProvider authTokenProvider = getIAuthorizationTokenProvider(); - - ResourceType resourceType = ResourceType.Document; - OperationType operationType = OperationType.Read; - - Document randomResource = new Document(); - randomResource.setId(UUID.randomUUID().toString()); - RxDocumentServiceRequest request = - RxDocumentServiceRequest.create(operationType, resourceType, "/dbs/dbname/colls/collname", randomResource, (Map) null); - - RxDocumentServiceRequest barrierRequest = BarrierRequestHelper.createAsync(request, authTokenProvider, 11l, 10l).toBlocking().value(); - - assertThat(barrierRequest.getOperationType()).isEqualTo(OperationType.Head); - assertThat(barrierRequest.getResourceType()).isEqualTo(ResourceType.DocumentCollection); - assertThat(barrierRequest.getResourceAddress()).isEqualTo("dbs/dbname/colls/collname"); - - assertThat(getTargetGlobalLsn(barrierRequest)).isEqualTo(10l); - assertThat(getTargetLsn(barrierRequest)).isEqualTo(11l); - assertThat(barrierRequest.getIsNameBased()).isEqualTo(true); - - } - - @Test(groups = "direct") - public void barrierDocumentReadRidBasedRequest() { - IAuthorizationTokenProvider authTokenProvider = getIAuthorizationTokenProvider(); - - ResourceType resourceType = ResourceType.Document; - OperationType operationType = OperationType.Read; - - Document randomResource = new Document(); - randomResource.setId(UUID.randomUUID().toString()); - RxDocumentServiceRequest request = - RxDocumentServiceRequest.create(operationType, "7mVFAA==", resourceType, (Map) null); - - RxDocumentServiceRequest barrierRequest = BarrierRequestHelper.createAsync(request, authTokenProvider, 11l, 10l).toBlocking().value(); - - assertThat(barrierRequest.getOperationType()).isEqualTo(OperationType.Head); - assertThat(barrierRequest.getResourceType()).isEqualTo(ResourceType.DocumentCollection); - assertThat(barrierRequest.getResourceAddress()).isEqualTo("7mVFAA=="); - - assertThat(getTargetGlobalLsn(barrierRequest)).isEqualTo(10l); - assertThat(getTargetLsn(barrierRequest)).isEqualTo(11l); - assertThat(barrierRequest.getIsNameBased()).isEqualTo(false); - } - - @DataProvider(name = "isCollectionHeadBarrierRequestArgProvider") - public Object[][] isCollectionHeadBarrierRequestArgProvider() { - return new Object[][]{ - // resourceType, operationType, isCollectionHeadBarrierRequest - - {ResourceType.Attachment, null, true}, - {ResourceType.Document, null, true}, - {ResourceType.Conflict, null, true}, - {ResourceType.StoredProcedure, null, true}, - {ResourceType.Attachment, null, true}, - {ResourceType.Trigger, null, true}, - - {ResourceType.DocumentCollection, OperationType.ReadFeed, false}, - {ResourceType.DocumentCollection, OperationType.Query, false}, - {ResourceType.DocumentCollection, OperationType.SqlQuery, false}, - - {ResourceType.DocumentCollection, OperationType.Create, true}, - {ResourceType.DocumentCollection, OperationType.Read, true}, - {ResourceType.DocumentCollection, OperationType.Replace, true}, - {ResourceType.DocumentCollection, OperationType.ExecuteJavaScript, true}, - - {ResourceType.PartitionKeyRange, null, false}, - }; - } - - @Test(groups = "direct", dataProvider = "isCollectionHeadBarrierRequestArgProvider") - public void isCollectionHeadBarrierRequest(ResourceType resourceType, - OperationType operationType, - boolean expectedResult) { - if (operationType != null) { - boolean actual = BarrierRequestHelper.isCollectionHeadBarrierRequest(resourceType, operationType); - assertThat(actual).isEqualTo(expectedResult); - } else { - for (OperationType type : OperationType.values()) { - boolean actual = BarrierRequestHelper.isCollectionHeadBarrierRequest(resourceType, type); - assertThat(actual).isEqualTo(expectedResult); - } - } - } - - private IAuthorizationTokenProvider getIAuthorizationTokenProvider() { - return (RxDocumentClientImpl) - new AsyncDocumentClient.Builder() - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withServiceEndpoint(TestConfigurations.HOST) - .build(); - } - - private String getHeaderValue(RxDocumentServiceRequest req, String name) { - return req.getHeaders().get(name); - } - - private String getPartitionKey(RxDocumentServiceRequest req) { - return getHeaderValue(req, HttpConstants.HttpHeaders.PARTITION_KEY); - } - - private String getCollectionRid(RxDocumentServiceRequest req) { - return getHeaderValue(req, WFConstants.BackendHeaders.COLLECTION_RID); - } - - private PartitionKeyRangeIdentity getPartitionKeyRangeIdentity(RxDocumentServiceRequest req) { - return req.getPartitionKeyRangeIdentity(); - } - - private Long getTargetLsn(RxDocumentServiceRequest req) { - return Long.parseLong(getHeaderValue(req, HttpConstants.HttpHeaders.TARGET_LSN)); - } - - private Long getTargetGlobalLsn(RxDocumentServiceRequest req) { - return Long.parseLong(getHeaderValue(req, HttpConstants.HttpHeaders.TARGET_GLOBAL_COMMITTED_LSN)); - } -} - diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCacheTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCacheTest.java deleted file mode 100644 index 54d581f42615..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCacheTest.java +++ /dev/null @@ -1,880 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.microsoft.azure.cosmosdb.ConfigsBuilder; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.HttpClientFactory; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.net.URL; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -public class GatewayAddressCacheTest extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public GatewayAddressCacheTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @DataProvider(name = "targetPartitionsKeyRangeListAndCollectionLinkParams") - public Object[][] partitionsKeyRangeListAndCollectionLinkParams() { - return new Object[][] { - // target partition key range ids, collection link - { ImmutableList.of("0"), getNameBasedCollectionLink(), Protocol.Tcp }, - { ImmutableList.of("0"), getNameBasedCollectionLink(), Protocol.Https }, - - { ImmutableList.of("1"), getNameBasedCollectionLink(), Protocol.Https }, - { ImmutableList.of("1"), getCollectionSelfLink(), Protocol.Https }, - { ImmutableList.of("3"), getNameBasedCollectionLink(), Protocol.Https }, - - { ImmutableList.of("0", "1"), getNameBasedCollectionLink(), Protocol.Https }, - { ImmutableList.of("1", "3"), getNameBasedCollectionLink(), Protocol.Https }, - }; - } - - @DataProvider(name = "protocolProvider") - public Object[][] protocolProvider() { - return new Object[][]{ - { Protocol.Https }, - { Protocol.Tcp }, - }; - } - - @Test(groups = { "direct" }, dataProvider = "targetPartitionsKeyRangeListAndCollectionLinkParams", timeOut = TIMEOUT) - public void getServerAddressesViaGateway(List partitionKeyRangeIds, - String collectionLink, - Protocol protocol) throws Exception { - Configs configs = ConfigsBuilder.instance().withProtocol(protocol).build(); - // ask gateway for the addresses - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - protocol, - authorizationTokenProvider, - null, - getCompositeHttpClient(configs)); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionLink + "/docs/", - getDocumentDefinition(), new HashMap<>()); - - Single> addresses = cache.getServerAddressesViaGatewayAsync( - req, createdCollection.getResourceId(), partitionKeyRangeIds, false); - - PartitionReplicasAddressesValidator validator = new PartitionReplicasAddressesValidator.Builder() - .withProtocol(protocol) - .replicasOfPartitions(partitionKeyRangeIds) - .build(); - - validateSuccess(addresses, validator, TIMEOUT); - } - - @Test(groups = { "direct" }, dataProvider = "protocolProvider", timeOut = TIMEOUT) - public void getMasterAddressesViaGatewayAsync(Protocol protocol) throws Exception { - Configs configs = ConfigsBuilder.instance().withProtocol(protocol).build(); - // ask gateway for the addresses - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - protocol, - authorizationTokenProvider, - null, - getCompositeHttpClient(configs)); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - Single> addresses = cache.getMasterAddressesViaGatewayAsync(req, ResourceType.Database, - null, "/dbs/", false, false, null); - - PartitionReplicasAddressesValidator validator = new PartitionReplicasAddressesValidator.Builder() - .withProtocol(protocol) - .replicasOfSamePartition() - .build(); - - validateSuccess(addresses, validator, TIMEOUT); - } - - @DataProvider(name = "targetPartitionsKeyRangeAndCollectionLinkParams") - public Object[][] partitionsKeyRangeAndCollectionLinkParams() { - return new Object[][] { - // target partition key range ids, collection link, protocol - { "0", getNameBasedCollectionLink(), Protocol.Tcp }, - { "0", getNameBasedCollectionLink(), Protocol.Https }, - - { "1", getNameBasedCollectionLink(), Protocol.Https} , - { "1", getCollectionSelfLink(), Protocol.Https }, - { "3", getNameBasedCollectionLink(), Protocol.Https }, - }; - } - - @Test(groups = { "direct" }, dataProvider = "targetPartitionsKeyRangeAndCollectionLinkParams", timeOut = TIMEOUT) - public void tryGetAddresses_ForDataPartitions(String partitionKeyRangeId, String collectionLink, Protocol protocol) throws Exception { - Configs configs = ConfigsBuilder.instance().withProtocol(protocol).build(); - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - protocol, - authorizationTokenProvider, - null, - getCompositeHttpClient(configs)); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionLink, - new Database(), new HashMap<>()); - - String collectionRid = createdCollection.getResourceId(); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity(collectionRid, partitionKeyRangeId); - boolean forceRefreshPartitionAddresses = false; - Single addressesInfosFromCacheObs = cache.tryGetAddresses(req, partitionKeyRangeIdentity, forceRefreshPartitionAddresses); - - ArrayList addressInfosFromCache = Lists.newArrayList(getSuccessResult(addressesInfosFromCacheObs, TIMEOUT)); - - Single> masterAddressFromGatewayObs = cache.getServerAddressesViaGatewayAsync(req, - collectionRid, ImmutableList.of(partitionKeyRangeId), false); - List
expectedAddresses = getSuccessResult(masterAddressFromGatewayObs, TIMEOUT); - - assertSameAs(addressInfosFromCache, expectedAddresses); - } - - @DataProvider(name = "openAsyncTargetAndTargetPartitionsKeyRangeAndCollectionLinkParams") - public Object[][] openAsyncTargetAndPartitionsKeyRangeTargetAndCollectionLinkParams() { - return new Object[][] { - // openAsync target partition key range ids, target partition key range id, collection link - { ImmutableList.of("0", "1"), "0", getNameBasedCollectionLink() }, - { ImmutableList.of("0", "1"), "1", getNameBasedCollectionLink() }, - { ImmutableList.of("0", "1"), "1", getCollectionSelfLink() }, - }; - } - - @Test(groups = { "direct" }, - dataProvider = "openAsyncTargetAndTargetPartitionsKeyRangeAndCollectionLinkParams", - timeOut = TIMEOUT) - public void tryGetAddresses_ForDataPartitions_AddressCachedByOpenAsync_NoHttpRequest( - List allPartitionKeyRangeIds, - String partitionKeyRangeId, String collectionLink) throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper httpClientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - httpClientWrapper.getSpyHttpClient()); - - String collectionRid = createdCollection.getResourceId(); - - List pkriList = allPartitionKeyRangeIds.stream().map( - pkri -> new PartitionKeyRangeIdentity(collectionRid, pkri)).collect(Collectors.toList()); - - cache.openAsync(createdCollection, pkriList).await(); - - assertThat(httpClientWrapper.capturedRequest).asList().hasSize(1); - httpClientWrapper.capturedRequest.clear(); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionLink, - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity(collectionRid, partitionKeyRangeId); - boolean forceRefreshPartitionAddresses = false; - Single addressesInfosFromCacheObs = cache.tryGetAddresses(req, partitionKeyRangeIdentity, forceRefreshPartitionAddresses); - ArrayList addressInfosFromCache = Lists.newArrayList(getSuccessResult(addressesInfosFromCacheObs, TIMEOUT)); - - // no new request is made - assertThat(httpClientWrapper.capturedRequest) - .describedAs("no http request: addresses already cached by openAsync") - .asList().hasSize(0); - - Single> masterAddressFromGatewayObs = cache.getServerAddressesViaGatewayAsync(req, - collectionRid, ImmutableList.of(partitionKeyRangeId), false); - List
expectedAddresses = getSuccessResult(masterAddressFromGatewayObs, TIMEOUT); - - assertThat(httpClientWrapper.capturedRequest) - .describedAs("getServerAddressesViaGatewayAsync will read addresses from gateway") - .asList().hasSize(1); - - assertSameAs(addressInfosFromCache, expectedAddresses); - } - - @Test(groups = { "direct" }, - dataProvider = "openAsyncTargetAndTargetPartitionsKeyRangeAndCollectionLinkParams", - timeOut = TIMEOUT) - public void tryGetAddresses_ForDataPartitions_ForceRefresh( - List allPartitionKeyRangeIds, - String partitionKeyRangeId, - String collectionLink) throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper httpClientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - httpClientWrapper.getSpyHttpClient()); - - String collectionRid = createdCollection.getResourceId(); - - List pkriList = allPartitionKeyRangeIds.stream().map( - pkri -> new PartitionKeyRangeIdentity(collectionRid, pkri)).collect(Collectors.toList()); - - cache.openAsync(createdCollection, pkriList).await(); - - assertThat(httpClientWrapper.capturedRequest).asList().hasSize(1); - httpClientWrapper.capturedRequest.clear(); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionLink, - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity(collectionRid, partitionKeyRangeId); - Single addressesInfosFromCacheObs = cache.tryGetAddresses(req, partitionKeyRangeIdentity, true); - ArrayList addressInfosFromCache = Lists.newArrayList(getSuccessResult(addressesInfosFromCacheObs, TIMEOUT)); - - // no new request is made - assertThat(httpClientWrapper.capturedRequest) - .describedAs("force refresh fetched from gateway") - .asList().hasSize(1); - - Single> masterAddressFromGatewayObs = cache.getServerAddressesViaGatewayAsync(req, - collectionRid, ImmutableList.of(partitionKeyRangeId), false); - List
expectedAddresses = getSuccessResult(masterAddressFromGatewayObs, TIMEOUT); - - assertThat(httpClientWrapper.capturedRequest) - .describedAs("getServerAddressesViaGatewayAsync will read addresses from gateway") - .asList().hasSize(2); - - assertSameAs(addressInfosFromCache, expectedAddresses); - } - - @Test(groups = { "direct" }, - dataProvider = "openAsyncTargetAndTargetPartitionsKeyRangeAndCollectionLinkParams", - timeOut = TIMEOUT) - public void tryGetAddresses_ForDataPartitions_Suboptimal_Refresh( - List allPartitionKeyRangeIds, - String partitionKeyRangeId, - String collectionLink) throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper httpClientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - int suboptimalRefreshTime = 2; - - GatewayAddressCache origCache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - httpClientWrapper.getSpyHttpClient(), - suboptimalRefreshTime); - - String collectionRid = createdCollection.getResourceId(); - - List pkriList = allPartitionKeyRangeIds.stream().map( - pkri -> new PartitionKeyRangeIdentity(collectionRid, pkri)).collect(Collectors.toList()); - - origCache.openAsync(createdCollection, pkriList).await(); - - assertThat(httpClientWrapper.capturedRequest).asList().hasSize(1); - httpClientWrapper.capturedRequest.clear(); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionLink, - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity(collectionRid, partitionKeyRangeId); - Single addressesInfosFromCacheObs = origCache.tryGetAddresses(req, partitionKeyRangeIdentity, true); - ArrayList addressInfosFromCache = Lists.newArrayList(getSuccessResult(addressesInfosFromCacheObs, TIMEOUT)); - - // no new request is made - assertThat(httpClientWrapper.capturedRequest) - .describedAs("force refresh fetched from gateway") - .asList().hasSize(1); - - GatewayAddressCache spyCache = Mockito.spy(origCache); - - final AtomicInteger fetchCounter = new AtomicInteger(0); - Mockito.doAnswer(new Answer() { - @Override - public Single> answer(InvocationOnMock invocationOnMock) throws Throwable { - - RxDocumentServiceRequest req = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - String collectionRid = invocationOnMock.getArgumentAt(1, String.class); - List partitionKeyRangeIds = invocationOnMock.getArgumentAt(2, List.class); - boolean forceRefresh = invocationOnMock.getArgumentAt(3, Boolean.class); - - int cnt = fetchCounter.getAndIncrement(); - - if (cnt == 0) { - Single> res = origCache.getServerAddressesViaGatewayAsync(req, - collectionRid, - partitionKeyRangeIds, - forceRefresh); - - // remove one replica - return res.map(list -> removeOneReplica(list)); - } - - return origCache.getServerAddressesViaGatewayAsync(req, - collectionRid, - partitionKeyRangeIds, - forceRefresh); - } - }).when(spyCache).getServerAddressesViaGatewayAsync(Matchers.any(RxDocumentServiceRequest.class), Matchers.anyString(), - Matchers.anyList(), Matchers.anyBoolean()); - - httpClientWrapper.capturedRequest.clear(); - - // force refresh to replace existing with sub-optimal addresses - addressesInfosFromCacheObs = spyCache.tryGetAddresses(req, partitionKeyRangeIdentity, true); - AddressInformation[] suboptimalAddresses = getSuccessResult(addressesInfosFromCacheObs, TIMEOUT); - assertThat(httpClientWrapper.capturedRequest) - .describedAs("getServerAddressesViaGatewayAsync will read addresses from gateway") - .asList().hasSize(1); - httpClientWrapper.capturedRequest.clear(); - assertThat(suboptimalAddresses).hasSize(ServiceConfig.SystemReplicationPolicy.MaxReplicaSetSize - 1); - assertThat(fetchCounter.get()).isEqualTo(1); - - // no refresh, use cache - addressesInfosFromCacheObs = spyCache.tryGetAddresses(req, partitionKeyRangeIdentity, false); - suboptimalAddresses = getSuccessResult(addressesInfosFromCacheObs, TIMEOUT); - assertThat(httpClientWrapper.capturedRequest) - .describedAs("getServerAddressesViaGatewayAsync will read addresses from gateway") - .asList().hasSize(0); - assertThat(suboptimalAddresses).hasSize(ServiceConfig.SystemReplicationPolicy.MaxReplicaSetSize - 1); - assertThat(fetchCounter.get()).isEqualTo(1); - - // wait for refresh time - TimeUnit.SECONDS.sleep(suboptimalRefreshTime + 1); - - addressesInfosFromCacheObs = spyCache.tryGetAddresses(req, partitionKeyRangeIdentity, false); - AddressInformation[] addresses = getSuccessResult(addressesInfosFromCacheObs, TIMEOUT); - assertThat(addresses).hasSize(ServiceConfig.SystemReplicationPolicy.MaxReplicaSetSize); - assertThat(httpClientWrapper.capturedRequest) - .describedAs("getServerAddressesViaGatewayAsync will read addresses from gateway") - .asList().hasSize(1); - assertThat(fetchCounter.get()).isEqualTo(2); - } - - @Test(groups = { "direct" }, dataProvider = "protocolProvider",timeOut = TIMEOUT) - public void tryGetAddresses_ForMasterPartition(Protocol protocol) throws Exception { - Configs configs = ConfigsBuilder.instance().withProtocol(protocol).build(); - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - protocol, - authorizationTokenProvider, - null, - getCompositeHttpClient(configs)); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity("M"); - boolean forceRefreshPartitionAddresses = false; - Single addressesInfosFromCacheObs = cache.tryGetAddresses(req, partitionKeyRangeIdentity, forceRefreshPartitionAddresses); - - ArrayList addressInfosFromCache = Lists.newArrayList(getSuccessResult(addressesInfosFromCacheObs, TIMEOUT)); - - Single> masterAddressFromGatewayObs = cache.getMasterAddressesViaGatewayAsync(req, ResourceType.Database, - null, "/dbs/", false, false, null); - List
expectedAddresses = getSuccessResult(masterAddressFromGatewayObs, TIMEOUT); - - assertSameAs(addressInfosFromCache, expectedAddresses); - } - - @DataProvider(name = "refreshTime") - public Object[][] refreshTime() { - return new Object[][] { - // refresh time, wait before doing tryGetAddresses - { 60, 1 }, - { 1, 2 }, - }; - } - - @Test(groups = { "direct" }, timeOut = TIMEOUT, dataProvider = "refreshTime") - public void tryGetAddresses_ForMasterPartition_MasterPartitionAddressAlreadyCached_NoNewHttpRequest( - int suboptimalPartitionForceRefreshIntervalInSeconds, - int waitTimeInBetweenAttemptsInSeconds - ) throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper clientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - clientWrapper.getSpyHttpClient(), - suboptimalPartitionForceRefreshIntervalInSeconds); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity("M"); - boolean forceRefreshPartitionAddresses = false; - - // request master partition info to ensure it is cached. - AddressInformation[] expectedAddresses = cache.tryGetAddresses(req, - partitionKeyRangeIdentity, - forceRefreshPartitionAddresses) - .toBlocking().value(); - - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - clientWrapper.capturedRequest.clear(); - - - TimeUnit.SECONDS.sleep(waitTimeInBetweenAttemptsInSeconds); - - Single addressesObs = cache.tryGetAddresses(req, - partitionKeyRangeIdentity, - forceRefreshPartitionAddresses); - - AddressInformation[] actualAddresses = getSuccessResult(addressesObs, TIMEOUT); - - assertExactlyEqual(actualAddresses, expectedAddresses); - - // the cache address is used. no new http request is sent - assertThat(clientWrapper.capturedRequest).asList().hasSize(0); - } - - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void tryGetAddresses_ForMasterPartition_ForceRefresh() throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper clientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - clientWrapper.getSpyHttpClient()); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity("M"); - - // request master partition info to ensure it is cached. - AddressInformation[] expectedAddresses = cache.tryGetAddresses(req, - partitionKeyRangeIdentity, - false) - .toBlocking().value(); - - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - clientWrapper.capturedRequest.clear(); - - Single addressesObs = cache.tryGetAddresses(req, - partitionKeyRangeIdentity, - true); - - AddressInformation[] actualAddresses = getSuccessResult(addressesObs, TIMEOUT); - - assertExactlyEqual(actualAddresses, expectedAddresses); - - // the cache address is used. no new http request is sent - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - } - - private static List
removeOneReplica(List
addresses) { - addresses.remove(0); - return addresses; - } - - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void tryGetAddresses_SuboptimalMasterPartition_NotStaleEnough_NoRefresh() throws Exception { - Configs configs = new Configs(); - Instant start = Instant.now(); - HttpClientUnderTestWrapper clientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - int refreshPeriodInSeconds = 10; - - GatewayAddressCache origCache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - clientWrapper.getSpyHttpClient(), refreshPeriodInSeconds); - - GatewayAddressCache spyCache = Mockito.spy(origCache); - - final AtomicInteger getMasterAddressesViaGatewayAsyncInvocation = new AtomicInteger(0); - Mockito.doAnswer(new Answer() { - @Override - public Single> answer(InvocationOnMock invocationOnMock) throws Throwable { - - RxDocumentServiceRequest request = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - ResourceType resourceType = invocationOnMock.getArgumentAt(1, ResourceType.class); - String resourceAddress = invocationOnMock.getArgumentAt(2, String.class); - String entryUrl = invocationOnMock.getArgumentAt(3, String.class); - boolean forceRefresh = invocationOnMock.getArgumentAt(4, Boolean.class); - boolean useMasterCollectionResolver = invocationOnMock.getArgumentAt(5, Boolean.class); - - int cnt = getMasterAddressesViaGatewayAsyncInvocation.getAndIncrement(); - - if (cnt == 0) { - Single> res = origCache.getMasterAddressesViaGatewayAsync( - request, - resourceType, - resourceAddress, - entryUrl, - forceRefresh, - useMasterCollectionResolver, - null); - - // remove one replica - return res.map(list -> removeOneReplica(list)); - } - - return origCache.getMasterAddressesViaGatewayAsync( - request, - resourceType, - resourceAddress, - entryUrl, - forceRefresh, - useMasterCollectionResolver, - null); - } - }).when(spyCache).getMasterAddressesViaGatewayAsync(Matchers.any(RxDocumentServiceRequest.class), Matchers.any(ResourceType.class), Matchers.anyString(), - Matchers.anyString(), Matchers.anyBoolean(), Matchers.anyBoolean(), Matchers.anyMap()); - - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity("M"); - - // request master partition info to ensure it is cached. - AddressInformation[] expectedAddresses = spyCache.tryGetAddresses(req, - partitionKeyRangeIdentity, - false) - .toBlocking().value(); - - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - clientWrapper.capturedRequest.clear(); - - Single addressesObs = spyCache.tryGetAddresses(req, - partitionKeyRangeIdentity, - false); - - AddressInformation[] actualAddresses = getSuccessResult(addressesObs, TIMEOUT); - - assertExactlyEqual(actualAddresses, expectedAddresses); - - // the cache address is used. no new http request is sent - assertThat(clientWrapper.capturedRequest).asList().hasSize(0); - - Instant end = Instant.now(); - assertThat(end.minusSeconds(refreshPeriodInSeconds)).isBefore(start); - } - - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void tryGetAddresses_SuboptimalMasterPartition_Stale_DoRefresh() throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper clientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - int refreshPeriodInSeconds = 1; - - GatewayAddressCache origCache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - clientWrapper.getSpyHttpClient(), refreshPeriodInSeconds); - - GatewayAddressCache spyCache = Mockito.spy(origCache); - - final AtomicInteger getMasterAddressesViaGatewayAsyncInvocation = new AtomicInteger(0); - Mockito.doAnswer(new Answer() { - @Override - public Single> answer(InvocationOnMock invocationOnMock) throws Throwable { - - System.out.print("fetch"); - - RxDocumentServiceRequest request = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - ResourceType resourceType = invocationOnMock.getArgumentAt(1, ResourceType.class); - String resourceAddress = invocationOnMock.getArgumentAt(2, String.class); - String entryUrl = invocationOnMock.getArgumentAt(3, String.class); - boolean forceRefresh = invocationOnMock.getArgumentAt(4, Boolean.class); - boolean useMasterCollectionResolver = invocationOnMock.getArgumentAt(5, Boolean.class); - - int cnt = getMasterAddressesViaGatewayAsyncInvocation.getAndIncrement(); - - if (cnt == 0) { - Single> res = origCache.getMasterAddressesViaGatewayAsync( - request, - resourceType, - resourceAddress, - entryUrl, - forceRefresh, - useMasterCollectionResolver, - null); - - // remove one replica - return res.map(list -> removeOneReplica(list)); - } - - return origCache.getMasterAddressesViaGatewayAsync( - request, - resourceType, - resourceAddress, - entryUrl, - forceRefresh, - useMasterCollectionResolver, - null); - } - }).when(spyCache).getMasterAddressesViaGatewayAsync(Matchers.any(RxDocumentServiceRequest.class), Matchers.any(ResourceType.class), Matchers.anyString(), - Matchers.anyString(), Matchers.anyBoolean(), Matchers.anyBoolean(), Matchers.anyMap()); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity("M"); - - // request master partition info to ensure it is cached. - AddressInformation[] subOptimalAddresses = spyCache.tryGetAddresses(req, - partitionKeyRangeIdentity, - false) - .toBlocking().value(); - - assertThat(getMasterAddressesViaGatewayAsyncInvocation.get()).isEqualTo(1); - assertThat(subOptimalAddresses).hasSize(ServiceConfig.SystemReplicationPolicy.MaxReplicaSetSize - 1); - - Instant start = Instant.now(); - TimeUnit.SECONDS.sleep(refreshPeriodInSeconds + 1); - Instant end = Instant.now(); - assertThat(end.minusSeconds(refreshPeriodInSeconds)).isAfter(start); - - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - clientWrapper.capturedRequest.clear(); - - Single addressesObs = spyCache.tryGetAddresses(req, - partitionKeyRangeIdentity, - false); - - - AddressInformation[] actualAddresses = getSuccessResult(addressesObs, TIMEOUT); - // the cache address is used. no new http request is sent - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - assertThat(getMasterAddressesViaGatewayAsyncInvocation.get()).isEqualTo(2); - assertThat(actualAddresses).hasSize(ServiceConfig.SystemReplicationPolicy.MaxReplicaSetSize); - - List
fetchedAddresses = origCache.getMasterAddressesViaGatewayAsync(req, ResourceType.Database, - null, "/dbs/", false, false, null).toBlocking().value(); - - assertSameAs(ImmutableList.copyOf(actualAddresses), fetchedAddresses); - } - - public static void assertSameAs(List actual, List
expected) { - assertThat(actual).asList().hasSize(expected.size()); - for(int i = 0; i < expected.size(); i++) { - assertEqual(actual.get(i), expected.get(i)); - } - } - - private static void assertEqual(AddressInformation actual, Address expected) { - assertThat(actual.getPhysicalUri()).isEqualTo(expected.getPhyicalUri()); - assertThat(actual.getProtocolScheme()).isEqualTo(expected.getProtocolScheme().toLowerCase()); - assertThat(actual.isPrimary()).isEqualTo(expected.IsPrimary()); - } - - private static void assertEqual(AddressInformation actual, AddressInformation expected) { - assertThat(actual.getPhysicalUri()).isEqualTo(expected.getPhysicalUri()); - assertThat(actual.getProtocolName()).isEqualTo(expected.getProtocolName()); - assertThat(actual.isPrimary()).isEqualTo(expected.isPrimary()); - assertThat(actual.isPublic()).isEqualTo(expected.isPublic()); - } - - public static void assertExactlyEqual(AddressInformation[] actual, AddressInformation[] expected) { - assertExactlyEqual(Arrays.asList(actual), Arrays.asList(expected)); - } - - public static void assertExactlyEqual(List actual, List expected) { - assertThat(actual).asList().hasSize(expected.size()); - for(int i = 0; i < expected.size(); i++) { - assertEqual(actual.get(i), expected.get(i)); - } - } - - public static T getSuccessResult(Single observable, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - return testSubscriber.getOnNextEvents().get(0); - } - - public static void validateSuccess(Single> observable, - PartitionReplicasAddressesValidator validator, long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - @BeforeClass(groups = { "direct" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(30000); - createdCollection = createCollection(client, createdDatabase.getId(), getCollectionDefinition(), options); - } - - @AfterClass(groups = { "direct" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteCollection(client, createdCollection); - safeClose(client); - } - - static protected DocumentCollection getCollectionDefinition() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId("mycol"); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - private CompositeHttpClient getCompositeHttpClient(Configs configs) { - CompositeHttpClient httpClient = new HttpClientFactory(configs) - .toHttpClientBuilder().build(); - return httpClient; - } - - private HttpClientUnderTestWrapper getHttpClientUnderTestWrapper(Configs configs) { - CompositeHttpClient origHttpClient = getCompositeHttpClient(configs); - return new HttpClientUnderTestWrapper(origHttpClient); - } - - public String getNameBasedCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } - - public String getCollectionSelfLink() { - return createdCollection.getSelfLink(); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java deleted file mode 100644 index 691139545995..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.net.URI; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.io.IOUtils; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.internal.BaseAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import com.microsoft.azure.cosmosdb.rx.internal.SpyClientUnderTestFactory; -import com.microsoft.azure.cosmosdb.rx.internal.SpyClientUnderTestFactory.ClientUnderTest; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.ByteBufUtil; -import io.netty.handler.codec.http.DefaultHttpHeaders; -import io.netty.handler.codec.http.DefaultHttpResponse; -import io.netty.handler.codec.http.HttpHeaders; -import io.netty.handler.codec.http.HttpResponse; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.handler.codec.http.HttpVersion; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import rx.Observable; -import rx.Single; -import rx.observers.TestSubscriber; - -public class GatewayServiceConfigurationReaderTest extends TestSuiteBase { - - private static final int TIMEOUT = 8000; - private CompositeHttpClient mockHttpClient; - private CompositeHttpClient httpClient; - private BaseAuthorizationTokenProvider baseAuthorizationTokenProvider; - private ConnectionPolicy connectionPolicy; - private GatewayServiceConfigurationReader mockGatewayServiceConfigurationReader; - private GatewayServiceConfigurationReader gatewayServiceConfigurationReader; - private AsyncDocumentClient client; - private String databaseAccountJson; - private DatabaseAccount expectedDatabaseAccount; - - @Factory(dataProvider = "clientBuilders") - public GatewayServiceConfigurationReaderTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @BeforeClass(groups = "simple") - public void setup() throws Exception { - client = clientBuilder.build(); - mockHttpClient = (CompositeHttpClient) Mockito.mock(CompositeHttpClient.class); - - ClientUnderTest clientUnderTest = SpyClientUnderTestFactory.createClientUnderTest(this.clientBuilder); - httpClient = clientUnderTest.getSpyHttpClient(); - baseAuthorizationTokenProvider = new BaseAuthorizationTokenProvider(TestConfigurations.MASTER_KEY); - connectionPolicy = ConnectionPolicy.GetDefault(); - mockGatewayServiceConfigurationReader = new GatewayServiceConfigurationReader(new URI(TestConfigurations.HOST), - false, TestConfigurations.MASTER_KEY, connectionPolicy, baseAuthorizationTokenProvider, mockHttpClient); - - gatewayServiceConfigurationReader = new GatewayServiceConfigurationReader(new URI(TestConfigurations.HOST), - false, - TestConfigurations.MASTER_KEY, - connectionPolicy, - baseAuthorizationTokenProvider, - httpClient); - databaseAccountJson = IOUtils - .toString(getClass().getClassLoader().getResourceAsStream("databaseAccount.json"), "UTF-8"); - expectedDatabaseAccount = new DatabaseAccount(databaseAccountJson); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @Test(groups = "simple") - public void mockInitializeReaderAsync() throws Exception { - - HttpClientResponse mockedResponse = getMockResponse(databaseAccountJson); - - Mockito.when(mockHttpClient.submit(Matchers.any(RxClient.ServerInfo.class), Matchers.any())) - .thenReturn(Observable.just(mockedResponse)); - - Single databaseAccount = mockGatewayServiceConfigurationReader.initializeReaderAsync(); - validateSuccess(databaseAccount, expectedDatabaseAccount); - } - - @Test(groups = "simple") - public void mockInitializeReaderAsyncWithResourceToken() throws Exception { - mockGatewayServiceConfigurationReader = new GatewayServiceConfigurationReader(new URI(TestConfigurations.HOST), - true, "SampleResourceToken", connectionPolicy, baseAuthorizationTokenProvider, mockHttpClient); - - HttpClientResponse mockedResponse = getMockResponse(databaseAccountJson); - - Mockito.when(mockHttpClient.submit(Matchers.any(RxClient.ServerInfo.class), Matchers.any())) - .thenReturn(Observable.just(mockedResponse)); - - Single databaseAccount = mockGatewayServiceConfigurationReader.initializeReaderAsync(); - validateSuccess(databaseAccount, expectedDatabaseAccount); - } - - @Test(groups = "simple") - public void initializeReaderAsync() { - Single databaseAccount = gatewayServiceConfigurationReader.initializeReaderAsync(); - validateSuccess(databaseAccount); - } - - public static void validateSuccess(Single observable) { - TestSubscriber testSubscriber = new TestSubscriber(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - assertThat(BridgeInternal.getQueryEngineConfiuration(testSubscriber.getOnNextEvents().get(0)).size() > 0).isTrue(); - assertThat(BridgeInternal.getReplicationPolicy(testSubscriber.getOnNextEvents().get(0))).isNotNull(); - assertThat(BridgeInternal.getSystemReplicationPolicy(testSubscriber.getOnNextEvents().get(0))).isNotNull(); - } - - public static void validateSuccess(Single observable, DatabaseAccount expectedDatabaseAccount) - throws InterruptedException { - TestSubscriber testSubscriber = new TestSubscriber(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - assertThat(testSubscriber.getOnNextEvents().get(0).getId()).isEqualTo(expectedDatabaseAccount.getId()); - assertThat(testSubscriber.getOnNextEvents().get(0).getAddressesLink()) - .isEqualTo(expectedDatabaseAccount.getAddressesLink()); - assertThat(testSubscriber.getOnNextEvents().get(0).getWritableLocations().iterator().next().getEndpoint()) - .isEqualTo(expectedDatabaseAccount.getWritableLocations().iterator().next().getEndpoint()); - assertThat(BridgeInternal.getSystemReplicationPolicy(testSubscriber.getOnNextEvents().get(0)).getMaxReplicaSetSize()) - .isEqualTo(BridgeInternal.getSystemReplicationPolicy(expectedDatabaseAccount).getMaxReplicaSetSize()); - assertThat(BridgeInternal.getSystemReplicationPolicy(testSubscriber.getOnNextEvents().get(0)).getMaxReplicaSetSize()) - .isEqualTo(BridgeInternal.getSystemReplicationPolicy(expectedDatabaseAccount).getMaxReplicaSetSize()); - assertThat(BridgeInternal.getQueryEngineConfiuration(testSubscriber.getOnNextEvents().get(0))) - .isEqualTo(BridgeInternal.getQueryEngineConfiuration(expectedDatabaseAccount)); - } - - private HttpClientResponse getMockResponse(String databaseAccountJson) { - HttpClientResponse resp = Mockito.mock(HttpClientResponse.class); - Mockito.doReturn(HttpResponseStatus.valueOf(200)).when(resp).getStatus(); - Mockito.doReturn(Observable.just(ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, databaseAccountJson))) - .when(resp).getContent(); - - HttpHeaders httpHeaders = new DefaultHttpHeaders(); - DefaultHttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, - HttpResponseStatus.valueOf(200), httpHeaders); - - try { - Constructor constructor = HttpResponseHeaders.class - .getDeclaredConstructor(HttpResponse.class); - constructor.setAccessible(true); - HttpResponseHeaders httpResponseHeaders = constructor.newInstance(httpResponse); - Mockito.doReturn(httpResponseHeaders).when(resp).getHeaders(); - - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - return resp; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionReplicasAddressesValidator.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionReplicasAddressesValidator.java deleted file mode 100644 index fbd37eb5da7d..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionReplicasAddressesValidator.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This is a helper class for validating partition replicas' addresses for tests. - */ -public interface PartitionReplicasAddressesValidator { - - int MAX_REPLICA_SIZE = 4; - - void validate(Collection
addresses); - - class Builder { - private List validators = new ArrayList<>(); - - public PartitionReplicasAddressesValidator build() { - return new PartitionReplicasAddressesValidator() { - - public void validate(Collection
addresses) { - for (PartitionReplicasAddressesValidator validator : validators) { - validator.validate(addresses); - } - } - }; - } - - public Builder size(final int expectedCount) { - - validators.add(new PartitionReplicasAddressesValidator() { - @Override - public void validate(Collection
addresses) { - assertThat(addresses).hasSize(expectedCount); - } - }); - return this; - } - - public Builder forEach(AddressValidator validator) { - - validators.add(new PartitionReplicasAddressesValidator() { - @Override - public void validate(Collection
addresses) { - - for (Address address : addresses) { - validator.validate(address); - } - - } - }); - return this; - } - - public Builder httpsProtocol() { - this.forEach(new AddressValidator.Builder().httpsProtocol().build()); - return this; - } - - public Builder withProtocol(Protocol protocol) { - this.forEach(new AddressValidator.Builder().protocol(protocol).build()); - return this; - } - - public Builder replicasOfPartition(String partitionKeyRangeId) { - validators.add(new PartitionReplicasAddressesValidator() { - @Override - public void validate(Collection
addresses) { - - // if running against prod due to upgrade etc, we may have occasionally 3 or 4 replicas. - assertThat(addresses).size().isGreaterThanOrEqualTo(MAX_REPLICA_SIZE - 1).isLessThanOrEqualTo(MAX_REPLICA_SIZE); - assertThat(addresses.stream().filter(a -> a.IsPrimary()).count()).isEqualTo(1); - - Address a = addresses.iterator().next(); - - AddressValidator validator = new AddressValidator.Builder() - .withPartitionKeyRangeId(partitionKeyRangeId) - .withRid(a.getResourceId()) - .build(); - - for (Address address : addresses) { - validator.validate(address); - } - } - }); - return this; - } - - public Builder replicasOfSamePartition() { - validators.add(new PartitionReplicasAddressesValidator() { - @Override - public void validate(Collection
addresses) { - - // if running against prod due to upgrade etc, we may have occasionally 3 or 4 replicas. - assertThat(addresses).size().isGreaterThanOrEqualTo(MAX_REPLICA_SIZE - 1).isLessThanOrEqualTo(MAX_REPLICA_SIZE); - assertThat(addresses.stream().filter(a -> a.IsPrimary()).count()).isEqualTo(1); - - Address a = addresses.iterator().next(); - - AddressValidator validator = new AddressValidator.Builder() - .withPartitionKeyRangeId(a.getParitionKeyRangeId()) - .withRid(a.getResourceId()) - .build(); - - for (Address address : addresses) { - validator.validate(address); - } - } - }); - return this; - } - - public Builder replicasOfPartitions(Collection partitionKeyRangeIds) { - validators.add(new PartitionReplicasAddressesValidator() { - @Override - public void validate(Collection
addresses) { - - for (String pki : partitionKeyRangeIds) { - List
partitionReplicas = addresses.stream() - .filter(a -> pki.equals(a.getParitionKeyRangeId())) - .collect(Collectors.toList()); - - PartitionReplicasAddressesValidator v = new Builder().replicasOfPartition(pki).build(); - v.validate(partitionReplicas); - } - } - }); - return this; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AggregateQueryTests.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AggregateQueryTests.java deleted file mode 100644 index 3a0fb11fb207..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AggregateQueryTests.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class AggregateQueryTests extends TestSuiteBase { - - public static class QueryConfig { - String testName; - String query; - Object expected; - - public QueryConfig (String testName, String query, Object expected) { - this.testName = testName; - this.query = query; - this.expected = expected; - } - } - - public static class AggregateConfig { - String operator; - Object expected; - String condition; - - public AggregateConfig(String operator, Object expected, String condition) { - this.operator = operator; - this.expected = expected; - this.condition = condition; - } - } - - private Database createdDatabase; - private DocumentCollection createdCollection; - private ArrayList docs = new ArrayList(); - private ArrayList queryConfigs = new ArrayList(); - - private String partitionKey = "mypk"; - private String uniquePartitionKey = "uniquePartitionKey"; - private String field = "field"; - private int sum; - private int numberOfDocuments = 800; - private int numberOfDocumentsWithNumericId; - private int numberOfDocsWithSamePartitionKey = 400; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public AggregateQueryTests(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Links: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - // Notes: - // I've seen this test time out in my development environment. I test against a debug instance of the public - // emulator and so what I'm seeing could be the result of a public emulator performance issue. Of course, it - // might also be the result of a Tcp protocol performance problem. - - @Test(groups = { "simple" }, timeOut = 2 * TIMEOUT, dataProvider = "queryMetricsArgProvider") - public void queryDocumentsWithAggregates(boolean qmEnabled) throws Exception { - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setPopulateQueryMetrics(qmEnabled); - options.setMaxDegreeOfParallelism(2); - - for (QueryConfig queryConfig : queryConfigs) { - - Observable> queryObservable = client - .queryDocuments(createdCollection.getSelfLink(), queryConfig.query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .withAggregateValue(queryConfig.expected) - .numberOfPages(1) - .hasValidQueryMetrics(qmEnabled) - .build(); - - try { - validateQuerySuccess(queryObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - } - - public void bulkInsert(AsyncDocumentClient client) { - generateTestData(); - - ArrayList>> result = new ArrayList>>(); - for (int i = 0; i < docs.size(); i++) { - result.add(client.createDocument("dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(), docs.get(i), null, false)); - } - - Observable.merge(result, 100).toList().toBlocking().single(); - } - - public void generateTestData() { - - Object[] values = new Object[]{null, false, true, "abc", "cdfg", "opqrs", "ttttttt", "xyz", "oo", "ppp"}; - for (int i = 0; i < values.length; i++) { - Document d = new Document(); - d.set(partitionKey, values[i]); - docs.add(d); - } - - for (int i = 0; i < numberOfDocsWithSamePartitionKey; i++) { - Document d = new Document(); - d.set(partitionKey, uniquePartitionKey); - d.set("resourceId", Integer.toString(i)); - d.set(field, i + 1); - docs.add(d); - } - - numberOfDocumentsWithNumericId = numberOfDocuments - values.length - numberOfDocsWithSamePartitionKey; - for (int i = 0; i < numberOfDocumentsWithNumericId; i++) { - Document d = new Document(); - d.set(partitionKey, i + 1); - docs.add(d); - } - - sum = (int) (numberOfDocumentsWithNumericId * (numberOfDocumentsWithNumericId + 1) / 2.0); - - } - - public void generateTestConfigs() { - - String aggregateQueryFormat = "SELECT VALUE %s(r.%s) FROM r WHERE %s"; - AggregateConfig[] aggregateConfigs = new AggregateConfig[] { - new AggregateConfig("AVG", sum / numberOfDocumentsWithNumericId, String.format("IS_NUMBER(r.%s)", partitionKey)), - new AggregateConfig("AVG", null, "true"), - new AggregateConfig("COUNT", numberOfDocuments, "true"), - new AggregateConfig("MAX","xyz","true"), - new AggregateConfig("MIN", null, "true"), - new AggregateConfig("SUM", sum, String.format("IS_NUMBER(r.%s)", partitionKey)), - new AggregateConfig("SUM", null, "true") - }; - - for (AggregateConfig config: aggregateConfigs) { - String query = String.format(aggregateQueryFormat, config.operator, partitionKey, config.condition); - String testName = String.format("%s %s", config.operator, config.condition); - queryConfigs.add(new QueryConfig(testName, query, config.expected)); - } - - String aggregateSinglePartitionQueryFormat = "SELECT VALUE %s(r.%s) FROM r WHERE r.%s = '%s'"; - String aggregateSinglePartitionQueryFormatSelect = "SELECT %s(r.%s) FROM r WHERE r.%s = '%s'"; - double samePartitionSum = numberOfDocsWithSamePartitionKey * (numberOfDocsWithSamePartitionKey + 1) / 2.0; - - AggregateConfig[] aggregateSinglePartitionConfigs = new AggregateConfig[] { - new AggregateConfig("AVG", samePartitionSum / numberOfDocsWithSamePartitionKey, null), - new AggregateConfig("COUNT", numberOfDocsWithSamePartitionKey, null), - new AggregateConfig("MAX", numberOfDocsWithSamePartitionKey, null), - new AggregateConfig("MIN", 1, null), - new AggregateConfig("SUM", samePartitionSum, null) - }; - - for (AggregateConfig config: aggregateSinglePartitionConfigs) { - String query = String.format(aggregateSinglePartitionQueryFormat, config.operator, field, partitionKey, uniquePartitionKey); - String testName = String.format("%s SinglePartition %s", config.operator, "SELECT VALUE"); - queryConfigs.add(new QueryConfig(testName, query, config.expected)); - - query = String.format(aggregateSinglePartitionQueryFormatSelect, config.operator, field, partitionKey, uniquePartitionKey); - testName = String.format("%s SinglePartition %s", config.operator, "SELECT"); - queryConfigs.add(new QueryConfig(testName, query, new Document("{'$1':" + removeTrailingZerosIfInteger(config.expected) + "}"))); - } - } - - private Object removeTrailingZerosIfInteger(Object obj) { - if (obj instanceof Number) { - Number num = (Number) obj; - if (num.doubleValue() == num.intValue()) { - return num.intValue(); - } - } - return obj; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION); - - bulkInsert(client); - generateTestConfigs(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentCrudTest.java deleted file mode 100644 index a229e251a2a5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentCrudTest.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class AttachmentCrudTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private Document createdDocument; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirectHttps") // Direct TCP mode does not support attachments - public AttachmentCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createAttachment() throws Exception { - // create an Attachment - String uuid = UUID.randomUUID().toString(); - Attachment attachment = getAttachmentDefinition(uuid, "application/text"); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getId())); - Observable> createObservable = client.createAttachment(getDocumentLink(), attachment, options); - - // validate attachment creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(attachment.getId()) - .withContentType("application/text") - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readAttachment() throws Exception { - // create an Attachment - String uuid = UUID.randomUUID().toString(); - Attachment attachment = getAttachmentDefinition(uuid, "application/text"); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getId())); - Attachment readBackAttachment = client.createAttachment(getDocumentLink(), attachment, options).toBlocking().single().getResource(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - // read attachment - Observable> readObservable = client.readAttachment(readBackAttachment.getSelfLink(), options); - - // validate attachment read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(attachment.getId()) - .withContentType("application/text") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void deleteAttachment() throws Exception { - // create an Attachment - String uuid = UUID.randomUUID().toString(); - Attachment attachment = getAttachmentDefinition(uuid, "application/text"); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getId())); - Attachment readBackAttachment = client.createAttachment(getDocumentLink(), attachment, options).toBlocking().single().getResource(); - - // delete attachment - Observable> deleteObservable = client.deleteAttachment(readBackAttachment.getSelfLink(), options); - - // validate attachment delete - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void upsertAttachment() throws Exception { - // create an Attachment - String uuid = UUID.randomUUID().toString(); - Attachment attachment = getAttachmentDefinition(uuid, "application/text"); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getId())); - Attachment readBackAttachment = client.upsertAttachment(getDocumentLink(), attachment, options).toBlocking().single().getResource(); - - // read attachment - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readAttachment(readBackAttachment.getSelfLink(), options); - - // validate attachment read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(attachment.getId()) - .withContentType("application/text") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - - //update attachment - readBackAttachment.setContentType("application/json"); - - Observable> updateObservable = client.upsertAttachment(getDocumentLink(), readBackAttachment, options); - - // validate attachment update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackAttachment.getId()) - .withContentType("application/json") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void replaceAttachment() throws Exception { - // create an Attachment - String uuid = UUID.randomUUID().toString(); - Attachment attachment = getAttachmentDefinition(uuid, "application/text"); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getId())); - Attachment readBackAttachment = client.createAttachment(getDocumentLink(), attachment, options).toBlocking().single().getResource(); - - - // read attachment - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readAttachment(readBackAttachment.getSelfLink(), options); - - // validate attachment read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(attachment.getId()) - .withContentType("application/text") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - - //update attachment - readBackAttachment.setContentType("application/json"); - - Observable> updateObservable = client.replaceAttachment(readBackAttachment, options); - - // validate attachment update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackAttachment.getId()) - .withContentType("application/json") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - createdDocument = createDocument(client, createdDatabase.getId(), createdCollection.getId(), getDocumentDefinition()); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getDocumentLink() { - return createdDocument.getSelfLink(); - } - - private static Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - private static Attachment getAttachmentDefinition(String uuid, String type) { - return new Attachment(String.format( - "{" + - " 'id': '%s'," + - " 'media': 'http://xstore.'," + - " 'MediaType': 'Book'," + - " 'Author': 'My Book Author'," + - " 'Title': 'My Book Title'," + - " 'contentType': '%s'" + - "}", uuid, type)); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentQueryTest.java deleted file mode 100644 index 1a353241e4b9..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentQueryTest.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class AttachmentQueryTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdAttachments = new ArrayList<>(); - - private Document createdDocument; - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - public String getDocumentLink() { - return createdDocument.getSelfLink(); - } - - @Factory(dataProvider = "clientBuilders") - public AttachmentQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithFilter() throws Exception { - - String filterId = createdAttachments.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - Observable> queryObservable = client - .queryAttachments(getDocumentLink(), query, options); - - List expectedDocs = createdAttachments.stream().filter(sp -> filterId.equals(sp.getId()) ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void query_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - Observable> queryObservable = client - .queryAttachments(getDocumentLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAll() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryAttachments(getDocumentLink(), query, options); - - List expectedDocs = createdAttachments; - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(expectedDocs - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - public Attachment createAttachment(AsyncDocumentClient client) { - Attachment attachment = getAttachmentDefinition(); - return client.createAttachment(getDocumentLink(), attachment, null).toBlocking().single().getResource(); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - Document docDef = new Document(); - docDef.setId(UUID.randomUUID().toString()); - - createdDocument = createDocument(client, createdDatabase.getId(), createdCollection.getId(), docDef); - - for(int i = 0; i < 5; i++) { - createdAttachments.add(createAttachment(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - private static Attachment getAttachmentDefinition() { - return new Attachment(String.format( - "{" + - " 'id': '%s'," + - " 'media': 'http://xstore.'," + - " 'MediaType': 'Book'," + - " 'Author': 'My Book Author'," + - " 'Title': 'My Book Title'," + - " 'contentType': '%s'" + - "}", UUID.randomUUID().toString(), "application/text")); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureCrossPartitionTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureCrossPartitionTest.java deleted file mode 100644 index 2a40e985d409..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureCrossPartitionTest.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientUnderTest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; -import rx.internal.util.RxRingBuffer; -import rx.observers.TestSubscriber; -import rx.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; - -public class BackPressureCrossPartitionTest extends TestSuiteBase { - private final Logger log = LoggerFactory.getLogger(BackPressureCrossPartitionTest.class); - - private static final int TIMEOUT = 1800000; - private static final int SETUP_TIMEOUT = 60000; - - private int numberOfDocs = 4000; - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments; - - private RxDocumentClientUnderTest client; - private int numberOfPartitions; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - static protected DocumentCollection getCollectionDefinition() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - collectionDefinition.setIndexingPolicy(indexingPolicy); - - return collectionDefinition; - } - - @Factory(dataProvider = "simpleClientBuildersWithDirectHttps") - public BackPressureCrossPartitionTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - private void warmUp() { - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - // ensure collection is cached - client.queryDocuments(getCollectionLink(), "SELECT * FROM r", options).first().toBlocking().single(); - } - - @DataProvider(name = "queryProvider") - public Object[][] queryProvider() { - return new Object[][] { - // query, maxItemCount, max expected back pressure buffered, total number of expected query results - { "SELECT * FROM r", 1, 2 * RxRingBuffer.SIZE, numberOfDocs}, - { "SELECT * FROM r", 100, 2 * RxRingBuffer.SIZE, numberOfDocs}, - { "SELECT * FROM r ORDER BY r.prop", 100, 2 * RxRingBuffer.SIZE + 3 * numberOfPartitions, numberOfDocs}, - { "SELECT TOP 1000 * FROM r", 1, 2 * RxRingBuffer.SIZE, 1000}, - { "SELECT TOP 1000 * FROM r", 100, 2 * RxRingBuffer.SIZE, 1000}, - { "SELECT TOP 1000 * FROM r ORDER BY r.prop", 100, 2 * RxRingBuffer.SIZE + 3 * numberOfPartitions , 1000}, - }; - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Links: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @Test(groups = { "long" }, dataProvider = "queryProvider", timeOut = 2 * TIMEOUT) - public void query(String query, int maxItemCount, int maxExpectedBufferedCountForBackPressure, int expectedNumberOfResults) throws Exception { - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(maxItemCount); - options.setMaxDegreeOfParallelism(2); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - client.httpRequests.clear(); - - log.info("instantiating subscriber ..."); - TestSubscriber> subscriber = new TestSubscriber<>(1); - queryObservable.observeOn(Schedulers.io(), 1).subscribe(subscriber); - int sleepTimeInMillis = 40000; - int i = 0; - - // use a test subscriber and request for more result and sleep in between - try { - while(subscriber.getCompletions() == 0 && subscriber.getOnErrorEvents().isEmpty()) { - log.debug("loop " + i); - - TimeUnit.MILLISECONDS.sleep(sleepTimeInMillis); - sleepTimeInMillis /= 2; - - if (sleepTimeInMillis > 4000) { - // validate that only one item is returned to subscriber in each iteration - assertThat(subscriber.getValueCount() - i).isEqualTo(1); - } - - log.debug("subscriber.getValueCount(): " + subscriber.getValueCount()); - log.debug("client.httpRequests.size(): " + client.httpRequests.size()); - // validate that the difference between the number of requests to backend - // and the number of returned results is always less than a fixed threshold - - assertThat(client.httpRequests.size() - subscriber.getValueCount()) - .isLessThanOrEqualTo(maxExpectedBufferedCountForBackPressure); - - log.debug("requesting more"); - subscriber.requestMore(1); - i++; - } - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - try { - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - assertThat(subscriber.getOnNextEvents().stream().mapToInt(p -> p.getResults().size()).sum()).isEqualTo(expectedNumberOfResults); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(20000); - createdDatabase = SHARED_DATABASE; - createdCollection = createCollection(createdDatabase.getId(), getCollectionDefinition(), options); - - client = new ClientUnderTestBuilder(clientBuilder).build(); - - ArrayList docDefList = new ArrayList<>(); - for(int i = 0; i < numberOfDocs; i++) { - docDefList.add(getDocumentDefinition(i)); - } - - Observable> documentBulkInsertObs = bulkInsert( - client, - getCollectionLink(), - docDefList, - 1000); - - createdDocuments = documentBulkInsertObs.map(ResourceResponse::getResource).toList().toBlocking().single(); - - numberOfPartitions = client.readPartitionKeyRanges(getCollectionLink(), null) - .flatMap(p -> Observable.from(p.getResults())).toList().toBlocking().single().size(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - warmUp(); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Links: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @AfterClass(groups = { "long" }, timeOut = 2 * SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteCollection(client, createdCollection); - safeClose(client); - } - - private static Document getDocumentDefinition(int cnt) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"prop\" : %d, " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, cnt, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureTest.java deleted file mode 100644 index c22fc3a4da06..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureTest.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientUnderTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; -import rx.internal.util.RxRingBuffer; -import rx.observers.TestSubscriber; -import rx.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; - -public class BackPressureTest extends TestSuiteBase { - - private static final int TIMEOUT = 200000; - private static final int SETUP_TIMEOUT = 60000; - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments; - - private RxDocumentClientUnderTest client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - private static DocumentCollection getSinglePartitionCollectionDefinition() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - return collectionDefinition; - } - - @Factory(dataProvider = "simpleClientBuildersWithDirectHttps") - public BackPressureTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void readFeed() throws Exception { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(1); - Observable> queryObservable = client - .readDocuments(getCollectionLink(), options); - - client.httpRequests.clear(); - - TestSubscriber subscriber = new TestSubscriber(1); - queryObservable.observeOn(Schedulers.io(), 1).subscribe(subscriber); - int sleepTimeInMillis = 10000; // 10 seconds - - int i = 0; - // use a test subscriber and request for more result and sleep in between - while (subscriber.getCompletions() == 0 && subscriber.getOnErrorEvents().isEmpty()) { - TimeUnit.MILLISECONDS.sleep(sleepTimeInMillis); - sleepTimeInMillis /= 2; - - if (sleepTimeInMillis > 1000) { - // validate that only one item is returned to subscriber in each iteration - assertThat(subscriber.getValueCount() - i).isEqualTo(1); - } - // validate that only one item is returned to subscriber in each iteration - // validate that the difference between the number of requests to backend - // and the number of returned results is always less than a fixed threshold - assertThat(client.httpRequests.size() - subscriber.getOnNextEvents().size()) - .isLessThanOrEqualTo(RxRingBuffer.SIZE); - - subscriber.requestMore(1); - i++; - } - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - assertThat(subscriber.getOnNextEvents()).hasSize(createdDocuments.size()); - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void query() throws Exception { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(1); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), "SELECT * from r", options); - - client.httpRequests.clear(); - - TestSubscriber subscriber = new TestSubscriber(1); - queryObservable.observeOn(Schedulers.io(), 1).subscribe(subscriber); - int sleepTimeInMillis = 10000; - - int i = 0; - // use a test subscriber and request for more result and sleep in between - while(subscriber.getCompletions() == 0 && subscriber.getOnErrorEvents().isEmpty()) { - TimeUnit.MILLISECONDS.sleep(sleepTimeInMillis); - sleepTimeInMillis /= 2; - - if (sleepTimeInMillis > 1000) { - // validate that only one item is returned to subscriber in each iteration - assertThat(subscriber.getValueCount() - i).isEqualTo(1); - } - // validate that the difference between the number of requests to backend - // and the number of returned results is always less than a fixed threshold - assertThat(client.httpRequests.size() - subscriber.getValueCount()) - .isLessThanOrEqualTo(RxRingBuffer.SIZE); - - subscriber.requestMore(1); - i++; - } - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - - assertThat(subscriber.getOnNextEvents()).hasSize(createdDocuments.size()); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // NOTE: This method requires multiple SHUTDOWN_TIMEOUT intervals - // SEE: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @BeforeClass(groups = { "long" }, timeOut = 2 * SETUP_TIMEOUT) - public void beforeClass() throws Exception { - - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(1000); - createdDatabase = SHARED_DATABASE; - createdCollection = createCollection(createdDatabase.getId(), getSinglePartitionCollectionDefinition(), options); - - client = new ClientUnderTestBuilder(clientBuilder).build(); - - // increase throughput to max for a single partition collection to avoid throttling - // for bulk insert and later queries. - Offer offer = client.queryOffers( - String.format("SELECT * FROM r WHERE r.offerResourceId = '%s'", - createdCollection.getResourceId()) - , null).first().map(FeedResponse::getResults).toBlocking().single().get(0); - offer.setThroughput(6000); - offer = client.replaceOffer(offer).toBlocking().single().getResource(); - assertThat(offer.getThroughput()).isEqualTo(6000); - - ArrayList docDefList = new ArrayList<>(); - for(int i = 0; i < 1000; i++) { - docDefList.add(getDocumentDefinition(i)); - } - - Observable> documentBulkInsertObs = bulkInsert( - client, - getCollectionLink(), - docDefList, - 200); - - createdDocuments = documentBulkInsertObs.map(ResourceResponse::getResource).toList().toBlocking().single(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - warmUp(); - } - - private void warmUp() { - // ensure collection is cached - client.queryDocuments(getCollectionLink(), "SELECT * from r", null).first().toBlocking().single(); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // NOTE: This method requires multiple SHUTDOWN_TIMEOUT intervals - // SEE: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @AfterClass(groups = { "long" }, timeOut = 2 * SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteCollection(client, createdCollection); - safeClose(client); - } - - private static Document getDocumentDefinition(int cnt) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"prop\" : %d, " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, cnt, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ChangeFeedTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ChangeFeedTest.java deleted file mode 100644 index b2446f333019..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ChangeFeedTest.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.time.ZonedDateTime; -import java.util.List; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Multimap; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class ChangeFeedTest extends TestSuiteBase { - - private static final int SETUP_TIMEOUT = 40000; - private static final int TIMEOUT = 30000; - private static final String PartitionKeyFieldName = "mypk"; - private Database createdDatabase; - private DocumentCollection createdCollection; - private Multimap partitionKeyToDocuments = ArrayListMultimap.create(); - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - static protected DocumentCollection getCollectionDefinition() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/" + PartitionKeyFieldName); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - public ChangeFeedTest() { - clientBuilder = createGatewayRxDocumentClient(); - subscriberValidationTimeout = TIMEOUT; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void changeFeed_fromBeginning() throws Exception { - String partitionKey = partitionKeyToDocuments.keySet().iterator().next(); - Collection expectedDocuments = partitionKeyToDocuments.get(partitionKey); - - ChangeFeedOptions changeFeedOption = new ChangeFeedOptions(); - changeFeedOption.setMaxItemCount(3); - changeFeedOption.setPartitionKey(new PartitionKey(partitionKey)); - changeFeedOption.setStartFromBeginning(true); - - List> changeFeedResultList = client.queryDocumentChangeFeed(getCollectionLink(), changeFeedOption) - .toList().toBlocking().single(); - - int count = 0; - for(int i = 0; i < changeFeedResultList.size(); i++) { - FeedResponse changeFeedPage = changeFeedResultList.get(i); - assertThat(changeFeedPage.getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - - count += changeFeedPage.getResults().size(); - assertThat(changeFeedPage.getResults().size()) - .as("change feed should contain all the previously created documents") - .isLessThanOrEqualTo(changeFeedOption.getMaxItemCount()); - } - assertThat(count).as("the number of changes").isEqualTo(expectedDocuments.size()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void changesFromPartitionKeyRangeId_FromBeginning() throws Exception { - List partitionKeyRangeIds = client.readPartitionKeyRanges(getCollectionLink(), null) - .flatMap(p -> Observable.from(p.getResults()), 1) - .map(pkr -> pkr.getId()) - .toList() - .toBlocking() - .single(); - - assertThat(partitionKeyRangeIds.size()).isGreaterThan(1); - - String pkRangeId = partitionKeyRangeIds.get(0); - - ChangeFeedOptions changeFeedOption = new ChangeFeedOptions(); - changeFeedOption.setMaxItemCount(3); - changeFeedOption.setPartitionKeyRangeId(pkRangeId); - changeFeedOption.setStartFromBeginning(true); - List> changeFeedResultList = client.queryDocumentChangeFeed(getCollectionLink(), changeFeedOption) - .toList().toBlocking().single(); - - int count = 0; - for(int i = 0; i < changeFeedResultList.size(); i++) { - FeedResponse changeFeedPage = changeFeedResultList.get(i); - assertThat(changeFeedPage.getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - - count += changeFeedPage.getResults().size(); - assertThat(changeFeedPage.getResults().size()) - .as("change feed should contain all the previously created documents") - .isLessThanOrEqualTo(changeFeedOption.getMaxItemCount()); - - assertThat(changeFeedPage.getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - assertThat(changeFeedPage.getResponseContinuation()).as("Response continuation should not be empty").isNotEmpty(); - } - assertThat(changeFeedResultList.size()).as("has at least one page").isGreaterThanOrEqualTo(1); - assertThat(count).as("the number of changes").isGreaterThan(0); - assertThat(count).as("the number of changes").isLessThan(partitionKeyToDocuments.size()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void changeFeed_fromNow() throws Exception { - // Read change feed from current. - ChangeFeedOptions changeFeedOption = new ChangeFeedOptions(); - String partitionKey = partitionKeyToDocuments.keySet().iterator().next(); - changeFeedOption.setPartitionKey(new PartitionKey(partitionKey)); - - List> changeFeedResultsList = client.queryDocumentChangeFeed(getCollectionLink(), changeFeedOption) - .toList() - .toBlocking().single(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder().totalSize(0).build(); - validator.validate(changeFeedResultsList); - assertThat(changeFeedResultsList.get(changeFeedResultsList.size() -1 ). - getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void changeFeed_fromStartDate() throws Exception { - - //setStartDateTime is not currently supported in multimaster mode. So skipping the test - if(BridgeInternal.isEnableMultipleWriteLocations(client.getDatabaseAccount().toBlocking().single())){ - throw new SkipException("StartTime/IfModifiedSince is not currently supported when EnableMultipleWriteLocations is set"); - } - - // Read change feed from current. - ChangeFeedOptions changeFeedOption = new ChangeFeedOptions(); - String partitionKey = partitionKeyToDocuments.keySet().iterator().next(); - - changeFeedOption.setPartitionKey(new PartitionKey(partitionKey)); - ZonedDateTime befTime = ZonedDateTime.now(); - // Waiting for at-least a second to ensure that new document is created after we took the time stamp - waitAtleastASecond(befTime); - - ZonedDateTime dateTimeBeforeCreatingDoc = ZonedDateTime.now(); - changeFeedOption.setStartDateTime(dateTimeBeforeCreatingDoc); - - // Waiting for at-least a second to ensure that new document is created after we took the time stamp - waitAtleastASecond(dateTimeBeforeCreatingDoc); - client.createDocument(getCollectionLink(), getDocumentDefinition(partitionKey), null, true).toBlocking().single().getResource(); - - List> changeFeedResultList = client.queryDocumentChangeFeed(getCollectionLink(), - changeFeedOption).toList() - .toBlocking().single(); - - int count = 0; - for(int i = 0; i < changeFeedResultList.size(); i++) { - FeedResponse changeFeedPage = changeFeedResultList.get(i); - count += changeFeedPage.getResults().size(); - assertThat(changeFeedPage.getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - } - assertThat(count).as("Change feed should have one newly created document").isEqualTo(1); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void changesFromPartitionKey_AfterInsertingNewDocuments() throws Exception { - ChangeFeedOptions changeFeedOption = new ChangeFeedOptions(); - changeFeedOption.setMaxItemCount(3); - String partitionKey = partitionKeyToDocuments.keySet().iterator().next(); - changeFeedOption.setPartitionKey(new PartitionKey(partitionKey)); - - List> changeFeedResultsList = client.queryDocumentChangeFeed(getCollectionLink(), changeFeedOption) - .toList().toBlocking().single(); - - assertThat(changeFeedResultsList).as("only one page").hasSize(1); - assertThat(changeFeedResultsList.get(0).getResults()).as("no recent changes").isEmpty(); - - String changeFeedContinuation = changeFeedResultsList.get(changeFeedResultsList.size()-1).getResponseContinuation(); - assertThat(changeFeedContinuation).as("continuation token is not null").isNotNull(); - assertThat(changeFeedContinuation).as("continuation token is not empty").isNotEmpty(); - - // create some documents - client.createDocument(getCollectionLink(), getDocumentDefinition(partitionKey), null, true).toBlocking().single(); - client.createDocument(getCollectionLink(), getDocumentDefinition(partitionKey), null, true).toBlocking().single(); - - // Read change feed from continuation - changeFeedOption.setRequestContinuation(changeFeedContinuation); - - - FeedResponse changeFeedResults2 = client.queryDocumentChangeFeed(getCollectionLink(), changeFeedOption) - .toBlocking().first(); - - assertThat(changeFeedResults2.getResults()).as("change feed should contain newly inserted docs.").hasSize(2); - assertThat(changeFeedResults2.getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - } - - public void createDocument(AsyncDocumentClient client, String partitionKey) { - Document docDefinition = getDocumentDefinition(partitionKey); - - Document createdDocument = client - .createDocument(getCollectionLink(), docDefinition, null, false).toBlocking().single().getResource(); - partitionKeyToDocuments.put(partitionKey, createdDocument); - } - - public List bulkInsert(AsyncDocumentClient client, List docs) { - ArrayList>> result = new ArrayList>>(); - for (int i = 0; i < docs.size(); i++) { - result.add(client.createDocument("dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(), docs.get(i), null, false)); - } - - return Observable.merge(result, 100).map(r -> r.getResource()).toList().toBlocking().single(); - } - - @AfterMethod(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void removeCollection() { - if (createdCollection != null) { - deleteCollection(client, getCollectionLink()); - } - } - - @BeforeMethod(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void populateDocuments(Method method) { - super.beforeMethod(method); - partitionKeyToDocuments.clear(); - - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10100); - createdCollection = createCollection(client, createdDatabase.getId(), getCollectionDefinition(), options); - - List docs = new ArrayList<>(); - - for (int i = 0; i < 200; i++) { - String partitionKey = UUID.randomUUID().toString(); - for(int j = 0; j < 7; j++) { - docs.add(getDocumentDefinition(partitionKey)); - } - } - - List insertedDocs = bulkInsert(client, docs); - for(Document doc: insertedDocs) { - partitionKeyToDocuments.put(doc.getString(PartitionKeyFieldName), doc); - } - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - // set up the client - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Document getDocumentDefinition(String partitionKey) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(); - doc.setId(uuid); - doc.set("mypk", partitionKey); - doc.set("prop", uuid); - return doc; - } - - private static void waitAtleastASecond(ZonedDateTime befTime) throws InterruptedException { - while (befTime.plusSeconds(1).isAfter(ZonedDateTime.now())) { - Thread.sleep(100); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ClientUnderTestBuilder.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ClientUnderTestBuilder.java deleted file mode 100644 index 914014c2bb2c..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ClientUnderTestBuilder.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientUnderTest; - -public class ClientUnderTestBuilder extends Builder { - - public ClientUnderTestBuilder(Builder builder) { - this.configs = builder.configs; - this.connectionPolicy = builder.connectionPolicy; - this.desiredConsistencyLevel = builder.desiredConsistencyLevel; - this.masterKeyOrResourceToken = builder.masterKeyOrResourceToken; - this.serviceEndpoint = builder.serviceEndpoint; - } - - @Override - public RxDocumentClientUnderTest build() { - return new RxDocumentClientUnderTest( - this.serviceEndpoint, - this.masterKeyOrResourceToken, - this.connectionPolicy, - this.desiredConsistencyLevel, - this.configs); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionCrudTest.java deleted file mode 100644 index 3aa4b54519cf..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionCrudTest.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.CompositePathSortOrder; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.IndexingMode; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.SpatialSpec; -import com.microsoft.azure.cosmosdb.SpatialType; - -import rx.Observable; - -public class CollectionCrudTest extends TestSuiteBase { - private static final int TIMEOUT = 30000; - private static final int SETUP_TIMEOUT = 20000; - private static final int SHUTDOWN_TIMEOUT = 20000; - private final String databaseId = DatabaseForTest.generateId(); - - private AsyncDocumentClient client; - private Database database; - - @Factory(dataProvider = "clientBuildersWithDirect") - public CollectionCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - this.subscriberValidationTimeout = TIMEOUT; - } - - @DataProvider(name = "collectionCrudArgProvider") - public Object[][] collectionCrudArgProvider() { - return new Object[][] { - // collection name, is name base - {UUID.randomUUID().toString(), false } , - {UUID.randomUUID().toString(), true } , - - // with special characters in the name. - {"+ -_,:.|~" + UUID.randomUUID().toString() + " +-_,:.|~", true } , - }; - } - - private DocumentCollection getCollectionDefinition(String collectionName) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(collectionName); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void createCollection(String collectionName, boolean isNameBased) { - DocumentCollection collectionDefinition = getCollectionDefinition(collectionName); - - Observable> createObservable = client - .createCollection(getDatabaseLink(database, isNameBased), collectionDefinition, null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(collectionDefinition.getId()).build(); - - validateSuccess(createObservable, validator); - safeDeleteAllCollections(client, database); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void createCollectionWithCompositeIndexAndSpatialSpec() { - DocumentCollection collection = new DocumentCollection(); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - CompositePath compositePath1 = new CompositePath(); - compositePath1.setPath("/path1"); - compositePath1.setOrder(CompositePathSortOrder.Ascending); - CompositePath compositePath2 = new CompositePath(); - compositePath2.setPath("/path2"); - compositePath2.setOrder(CompositePathSortOrder.Descending); - CompositePath compositePath3 = new CompositePath(); - compositePath3.setPath("/path3"); - CompositePath compositePath4 = new CompositePath(); - compositePath4.setPath("/path4"); - compositePath4.setOrder(CompositePathSortOrder.Ascending); - CompositePath compositePath5 = new CompositePath(); - compositePath5.setPath("/path5"); - compositePath5.setOrder(CompositePathSortOrder.Descending); - CompositePath compositePath6 = new CompositePath(); - compositePath6.setPath("/path6"); - - ArrayList compositeIndex1 = new ArrayList(); - compositeIndex1.add(compositePath1); - compositeIndex1.add(compositePath2); - compositeIndex1.add(compositePath3); - - ArrayList compositeIndex2 = new ArrayList(); - compositeIndex2.add(compositePath4); - compositeIndex2.add(compositePath5); - compositeIndex2.add(compositePath6); - - Collection> compositeIndexes = new ArrayList>(); - compositeIndexes.add(compositeIndex1); - compositeIndexes.add(compositeIndex2); - indexingPolicy.setCompositeIndexes(compositeIndexes); - - SpatialType[] spatialTypes = new SpatialType[] { - SpatialType.Point, - SpatialType.LineString, - SpatialType.Polygon, - SpatialType.MultiPolygon - }; - Collection spatialIndexes = new ArrayList(); - for (int index = 0; index < 2; index++) { - Collection collectionOfSpatialTypes = new ArrayList(); - - SpatialSpec spec = new SpatialSpec(); - spec.setPath("/path" + index + "/*"); - - for (int i = index; i < index + 3; i++) { - collectionOfSpatialTypes.add(spatialTypes[i]); - } - spec.setSpatialTypes(collectionOfSpatialTypes); - spatialIndexes.add(spec); - } - - indexingPolicy.setSpatialIndexes(spatialIndexes); - - collection.setId(UUID.randomUUID().toString()); - collection.setIndexingPolicy(indexingPolicy); - - Observable> createObservable = client - .createCollection(database.getSelfLink(), collection, null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(collection.getId()) - .withCompositeIndexes(compositeIndexes) - .withSpatialIndexes(spatialIndexes) - .build(); - - validateSuccess(createObservable, validator); - safeDeleteAllCollections(client, database); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void readCollection(String collectionName, boolean isNameBased) { - DocumentCollection collectionDefinition = getCollectionDefinition(collectionName); - - Observable> createObservable = client.createCollection(getDatabaseLink(database, isNameBased), collectionDefinition, - null); - DocumentCollection collection = createObservable.toBlocking().single().getResource(); - - Observable> readObservable = client.readCollection(getCollectionLink(database, collection, isNameBased), null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(collection.getId()).build(); - validateSuccess(readObservable, validator); - safeDeleteAllCollections(client, database); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void readCollection_NameBase(String collectionName, boolean isNameBased) { - DocumentCollection collectionDefinition = getCollectionDefinition(collectionName); - - Observable> createObservable = client.createCollection(getDatabaseLink(database, isNameBased), collectionDefinition, - null); - DocumentCollection collection = createObservable.toBlocking().single().getResource(); - - Observable> readObservable = client.readCollection( - getCollectionLink(database, collection, isNameBased), null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(collection.getId()).build(); - validateSuccess(readObservable, validator); - safeDeleteAllCollections(client, database); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void readCollection_DoesntExist(String collectionName, boolean isNameBased) throws Exception { - - Observable> readObservable = client - .readCollection(Utils.getCollectionNameLink(database.getId(), "I don't exist"), null); - - FailureValidator validator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void deleteCollection(String collectionName, boolean isNameBased) { - DocumentCollection collectionDefinition = getCollectionDefinition(collectionName); - - Observable> createObservable = client.createCollection(getDatabaseLink(database, isNameBased), collectionDefinition, null); - DocumentCollection collection = createObservable.toBlocking().single().getResource(); - - Observable> deleteObservable = client.deleteCollection(getCollectionLink(database, collection, isNameBased), - null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(deleteObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void replaceCollection(String collectionName, boolean isNameBased) { - // create a collection - DocumentCollection collectionDefinition = getCollectionDefinition(collectionName); - Observable> createObservable = client.createCollection(getDatabaseLink(database, isNameBased), collectionDefinition, null); - DocumentCollection collection = createObservable.toBlocking().single().getResource(); - // sanity check - assertThat(collection.getIndexingPolicy().getIndexingMode()).isEqualTo(IndexingMode.Consistent); - - // replace indexing mode - IndexingPolicy indexingMode = new IndexingPolicy(); - indexingMode.setIndexingMode(IndexingMode.Lazy); - collection.setIndexingPolicy(indexingMode); - Observable> readObservable = client.replaceCollection(collection, null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .indexingMode(IndexingMode.Lazy).build(); - validateSuccess(readObservable, validator); - safeDeleteAllCollections(client, database); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void sessionTokenConsistencyCollectionDeleteCreateSameName() { - AsyncDocumentClient client1 = clientBuilder.build(); - AsyncDocumentClient client2 = clientBuilder.build(); - - String dbId = "db"; - String collectionId = "coll"; - try { - Database databaseDefinition = new Database(); - databaseDefinition.setId(dbId); - createDatabase(client1, dbId); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(collectionId); - DocumentCollection collection = createCollection(client1, dbId, collectionDefinition); - - Document document = new Document(); - document.setId("doc"); - document.set("name", "New Document"); - createDocument(client1, dbId, collectionId, document); - ResourceResponse readDocumentResponse = client1.readDocument(Utils.getDocumentNameLink(dbId, collectionId, document.getId()), null).toBlocking().single(); - logger.info("Client 1 Read Document Client Side Request Statistics {}", readDocumentResponse.getRequestDiagnosticsString()); - logger.info("Client 1 Read Document Latency {}", readDocumentResponse.getRequestLatency()); - - document.set("name", "New Updated Document"); - ResourceResponse upsertDocumentResponse = client1.upsertDocument(collection.getSelfLink(), document, null, - true).toBlocking().single(); - logger.info("Client 1 Upsert Document Client Side Request Statistics {}", upsertDocumentResponse.getRequestDiagnosticsString()); - logger.info("Client 1 Upsert Document Latency {}", upsertDocumentResponse.getRequestLatency()); - - // Delete the existing collection - deleteCollection(client2, Utils.getCollectionNameLink(dbId, collectionId)); - // Recreate the collection with the same name but with different client - createCollection(client2, dbId, collectionDefinition); - - Document newDocument = new Document(); - newDocument.setId("doc"); - newDocument.set("name", "New Created Document"); - createDocument(client2, dbId, collectionId, newDocument); - - readDocumentResponse = client1.readDocument(Utils.getDocumentNameLink(dbId, collectionId, newDocument.getId()), null).toBlocking().single(); - logger.info("Client 2 Read Document Client Side Request Statistics {}", readDocumentResponse.getRequestDiagnosticsString()); - logger.info("Client 2 Read Document Latency {}", readDocumentResponse.getRequestLatency()); - - Document readDocument = readDocumentResponse.getResource(); - - assertThat(readDocument.getId().equals(newDocument.getId())).isTrue(); - assertThat(readDocument.get("name").equals(newDocument.get("name"))).isTrue(); - } finally { - safeDeleteDatabase(client1, dbId); - safeClose(client1); - safeClose(client2); - } - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - database = createDatabase(client, databaseId); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } - - private static String getDatabaseLink(Database db, boolean isNameLink) { - return isNameLink ? "dbs/" + db.getId() : db.getSelfLink(); - } - - private static String getCollectionLink(Database db, DocumentCollection documentCollection, boolean isNameLink) { - return isNameLink ? "dbs/" + db.getId() + "/colls/" + documentCollection.getId() : documentCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionQueryTest.java deleted file mode 100644 index 0a4500c9d6a7..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionQueryTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class CollectionQueryTest extends TestSuiteBase { - private final static int TIMEOUT = 30000; - private final String databaseId = DatabaseForTest.generateId(); - private List createdCollections = new ArrayList<>(); - private AsyncDocumentClient client; - - private String getDatabaseLink() { - return Utils.getDatabaseNameLink(databaseId); - } - - @Factory(dataProvider = "clientBuilders") - public CollectionQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - this.subscriberValidationTimeout = TIMEOUT; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryCollectionsWithFilter() throws Exception { - - String filterCollectionId = createdCollections.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterCollectionId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - Observable> queryObservable = client.queryCollections(getDatabaseLink(), query, options); - - List expectedCollections = createdCollections.stream() - .filter(c -> StringUtils.equals(filterCollectionId, c.getId()) ).collect(Collectors.toList()); - - assertThat(expectedCollections).isNotEmpty(); - - int expectedPageSize = (expectedCollections.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedCollections.size()) - .exactlyContainsInAnyOrder(expectedCollections.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAllCollections() throws Exception { - - String query = "SELECT * from c"; - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - String databaseLink = Utils.getDatabaseNameLink(databaseId); - Observable> queryObservable = client.queryCollections(databaseLink, query, options); - - List expectedCollections = createdCollections; - - assertThat(expectedCollections).isNotEmpty(); - - int expectedPageSize = (expectedCollections.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedCollections.size()) - .exactlyContainsInAnyOrder(expectedCollections.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryCollections_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client.queryCollections(getDatabaseLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createDatabase(client, databaseId); - - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - createdCollections.add(createCollection(client, databaseId, collection)); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DCDocumentCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DCDocumentCrudTest.java deleted file mode 100644 index fc8b79637e95..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DCDocumentCrudTest.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.StoredProcedureResponse; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.SpyClientUnderTestFactory; -import org.mockito.stubbing.Answer; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.spy; - -/** - * The purpose of the tests in this class is to ensure the request are routed through direct connectivity stack. - * The tests in other test classes validate the actual behaviour and different scenarios. - */ -public class DCDocumentCrudTest extends TestSuiteBase { - private final static int QUERY_TIMEOUT = 30000; - private final static String PARTITION_KEY_FIELD_NAME = "mypk"; - - private static Database createdDatabase; - private static DocumentCollection createdCollection; - - private SpyClientUnderTestFactory.ClientWithGatewaySpy client; - - @DataProvider - public static Object[][] directClientBuilder() { - return new Object[][] { { createDCBuilder(Protocol.Https) }, { createDCBuilder(Protocol.Tcp) } }; - } - - static Builder createDCBuilder(Protocol protocol) { - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - - Configs configs = spy(new Configs()); - doAnswer((Answer) invocation -> protocol).when(configs).getProtocol(); - - return new Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConfigs(configs) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY); - } - - @Factory(dataProvider = "directClientBuilder") - public DCDocumentCrudTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void executeStoredProc() { - StoredProcedure storedProcedure = new StoredProcedure(); - storedProcedure.setId(UUID.randomUUID().toString()); - storedProcedure.setBody("function() {var x = 10;}"); - - Observable> createObservable = client - .createStoredProcedure(getCollectionLink(), storedProcedure, null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(storedProcedure.getId()) - .build(); - - validateSuccess(createObservable, validator, TIMEOUT); - - // creating a stored proc will go through gateway so clearing captured requests - - client.getCapturedRequests().clear(); - - // execute the created storedProc and ensure it goes through direct connectivity stack - String storedProcLink = "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/sprocs/" + storedProcedure.getId(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey("dummy")); - StoredProcedureResponse storedProcedureResponse = client - .executeStoredProcedure(storedProcLink, options, null).toBlocking().single(); - - assertThat(storedProcedureResponse.getStatusCode()).isEqualTo(200); - - // validate the request routed through direct stack - validateNoStoredProcExecutionOperationThroughGateway(); - } - - /** - * Tests document creation through direct mode - */ - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void create() { - final Document docDefinition = getDocumentDefinition(); - - Observable> createObservable = client.createDocument( - this.getCollectionLink(), docDefinition, null, false); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - - validateSuccess(createObservable, validator, TIMEOUT); - validateNoDocumentOperationThroughGateway(); - } - - /** - * Tests document read through direct https. - * @throws Exception - */ - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void read() throws Exception { - Document docDefinition = this.getDocumentDefinition(); - Document document = client.createDocument(getCollectionLink(), docDefinition, null, false).toBlocking().single().getResource(); - - // give times to replicas to catch up after a write - waitIfNeededForReplicasToCatchUp(clientBuilder); - - String pkValue = document.getString(PARTITION_KEY_FIELD_NAME); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(pkValue)); - - String docLink = - String.format("dbs/%s/colls/%s/docs/%s", createdDatabase.getId(), createdCollection.getId(), document.getId()); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - - validateSuccess(client.readDocument(docLink, options), validator, TIMEOUT); - - validateNoDocumentOperationThroughGateway(); - } - - /** - * Tests document upsert through direct https. - * @throws Exception - */ - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void upsert() throws Exception { - - final Document docDefinition = getDocumentDefinition(); - - final Document document = client.createDocument(getCollectionLink(), docDefinition, null, false) - .toBlocking() - .single() - .getResource(); - - // give times to replicas to catch up after a write - waitIfNeededForReplicasToCatchUp(clientBuilder); - - String pkValue = document.getString(PARTITION_KEY_FIELD_NAME); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(pkValue)); - - String propName = "newProp"; - String propValue = "hello"; - document.set(propName, propValue); - - ResourceResponseValidator validator = ResourceResponseValidator.builder() - .withProperty(propName, propValue) - .build(); - validateSuccess(client.upsertDocument(getCollectionLink(), document, options, false), validator, TIMEOUT); - - validateNoDocumentOperationThroughGateway(); - } - - @Test(groups = { "direct" }, timeOut = QUERY_TIMEOUT) - public void crossPartitionQuery() { - - truncateCollection(createdCollection); - waitIfNeededForReplicasToCatchUp(clientBuilder); - - client.getCapturedRequests().clear(); - - int cnt = 1000; - List documentList = new ArrayList<>(); - for(int i = 0; i < cnt; i++) { - Document docDefinition = getDocumentDefinition(); - documentList.add(docDefinition); - } - - documentList = bulkInsert(client, getCollectionLink(), documentList).map(ResourceResponse::getResource).toList().toBlocking().single(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxDegreeOfParallelism(-1); - options.setMaxItemCount(100); - Observable> results = client.queryDocuments(getCollectionLink(), "SELECT * FROM r", options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(documentList.size()) - .exactlyContainsInAnyOrder(documentList.stream().map(Document::getResourceId).collect(Collectors.toList())).build(); - - try { - validateQuerySuccess(results, validator, QUERY_TIMEOUT); - validateNoDocumentQueryOperationThroughGateway(); - // validates only the first query for fetching query plan goes to gateway. - assertThat(client.getCapturedRequests().stream().filter(r -> r.getResourceType() == ResourceType.Document)).hasSize(1); - } catch (Throwable error) { - if (clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - } - } - - private void validateNoStoredProcExecutionOperationThroughGateway() { - // this validates that Document related requests don't go through gateway - DocumentServiceRequestValidator validateResourceTypesSentToGateway = DocumentServiceRequestValidator.builder() - .resourceTypeIn(ResourceType.DatabaseAccount, - ResourceType.Database, - ResourceType.DocumentCollection, - ResourceType.PartitionKeyRange) - .build(); - - // validate that all gateway captured requests are non document resources - for(RxDocumentServiceRequest request: client.getCapturedRequests()) { - validateResourceTypesSentToGateway.validate(request); - } - } - - private void validateNoDocumentOperationThroughGateway() { - // this validates that Document related requests don't go through gateway - DocumentServiceRequestValidator validateResourceTypesSentToGateway = DocumentServiceRequestValidator.builder() - .resourceTypeIn(ResourceType.DatabaseAccount, - ResourceType.Database, - ResourceType.DocumentCollection, - ResourceType.PartitionKeyRange) - .build(); - - // validate that all gateway captured requests are non document resources - for(RxDocumentServiceRequest request: client.getCapturedRequests()) { - validateResourceTypesSentToGateway.validate(request); - } - } - - private void validateNoDocumentQueryOperationThroughGateway() { - // this validates that Document related requests don't go through gateway - DocumentServiceRequestValidator validateResourceTypesSentToGateway = DocumentServiceRequestValidator.builder() - .resourceTypeIn(ResourceType.DatabaseAccount, - ResourceType.Database, - ResourceType.DocumentCollection, - ResourceType.PartitionKeyRange) - .build(); - - // validate that all gateway captured requests are non document resources - for(RxDocumentServiceRequest request: client.getCapturedRequests()) { - if (request.getOperationType() == OperationType.Query) { - assertThat(request.getPartitionKeyRangeIdentity()).isNull(); - } else { - validateResourceTypesSentToGateway.validate(request); - } - } - } - - @BeforeClass(groups = { "direct" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10100); - createdDatabase = SHARED_DATABASE; - createdCollection = createCollection(createdDatabase.getId(), getCollectionDefinition(), options); - client = SpyClientUnderTestFactory.createClientWithGatewaySpy(clientBuilder); - - assertThat(client.getCapturedRequests()).isNotEmpty(); - } - - @AfterClass(groups = { "direct" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeMethod(groups = { "direct" }) - public void beforeMethod(Method method) { - super.beforeMethod(method); - client.getCapturedRequests().clear(); - } - - private String getCollectionLink() { - return String.format("/dbs/%s/colls/%s", createdDatabase.getId(), createdCollection.getId()); - } - - private Document getDocumentDefinition() { - Document doc = new Document(); - doc.setId(UUID.randomUUID().toString()); - doc.set(PARTITION_KEY_FIELD_NAME, UUID.randomUUID().toString()); - doc.set("name", "Hafez"); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseCrudTest.java deleted file mode 100644 index 3df99491e5b2..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseCrudTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -import java.util.ArrayList; -import java.util.List; - -public class DatabaseCrudTest extends TestSuiteBase { - private final String preExistingDatabaseId = DatabaseForTest.generateId(); - private final List databases = new ArrayList<>(); - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public DatabaseCrudTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void createDatabase() throws Exception { - Database databaseDefinition = new Database(); - databaseDefinition.setId(DatabaseForTest.generateId()); - databases.add(databaseDefinition.getId()); - - // create the database - Observable> createObservable = client.createDatabase(databaseDefinition, null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(databaseDefinition.getId()).build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void createDatabase_AlreadyExists() throws Exception { - Database databaseDefinition = new Database(); - databaseDefinition.setId(DatabaseForTest.generateId()); - databases.add(databaseDefinition.getId()); - - client.createDatabase(databaseDefinition, null).toBlocking().single(); - - // attempt to create the database - Observable> createObservable = client.createDatabase(databaseDefinition, null); - - // validate - FailureValidator validator = new FailureValidator.Builder().resourceAlreadyExists().build(); - validateFailure(createObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void readDatabase() throws Exception { - // read database - Observable> readObservable = client - .readDatabase(Utils.getDatabaseNameLink(preExistingDatabaseId), null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(preExistingDatabaseId).build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void readDatabase_DoesntExist() throws Exception { - // read database - Observable> readObservable = client - .readDatabase(Utils.getDatabaseNameLink("I don't exist"), null); - - // validate - FailureValidator validator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, validator); - } - - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void deleteDatabase() throws Exception { - // create the database - Database databaseDefinition = new Database(); - databaseDefinition.setId(DatabaseForTest.generateId()); - databases.add(databaseDefinition.getId()); - client.createDatabase(databaseDefinition, null).toCompletable().await(); - - // delete the database - Observable> deleteObservable = client - .deleteDatabase(Utils.getDatabaseNameLink(databaseDefinition.getId()), null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(deleteObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void deleteDatabase_DoesntExist() throws Exception { - // delete the database - Observable> deleteObservable = client - .deleteDatabase(Utils.getDatabaseNameLink("I don't exist"), null); - - // validate - FailureValidator validator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(deleteObservable, validator); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createDatabase(client, preExistingDatabaseId); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, preExistingDatabaseId); - for(String dbId: databases) { - safeDeleteDatabase(client, dbId); - } - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseQueryTest.java deleted file mode 100644 index 832e8fe62ea8..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseQueryTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class DatabaseQueryTest extends TestSuiteBase { - - public final String databaseId1 = DatabaseForTest.generateId(); - public final String databaseId2 = DatabaseForTest.generateId(); - - private List createdDatabases = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public DatabaseQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDatabaseWithFilter() throws Exception { - String query = String.format("SELECT * from c where c.id = '%s'", databaseId1); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - Observable> queryObservable = client.queryDatabases(query, options); - - List expectedDatabases = createdDatabases.stream() - .filter(d -> StringUtils.equals(databaseId1, d.getId()) ).collect(Collectors.toList()); - - assertThat(expectedDatabases).isNotEmpty(); - - int expectedPageSize = (expectedDatabases.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDatabases.size()) - .exactlyContainsInAnyOrder(expectedDatabases.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAllDatabase() throws Exception { - - String query = String.format("SELECT * from c where c.id in ('%s', '%s')", - databaseId1, - databaseId2); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - Observable> queryObservable = client.queryDatabases(query, options); - - List expectedDatabases = createdDatabases; - - assertThat(expectedDatabases).isNotEmpty(); - - int expectedPageSize = (expectedDatabases.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDatabases.size()) - .exactlyContainsInAnyOrder(expectedDatabases.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDatabases_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client.queryDatabases(query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - - Database d1 = new Database(); - d1.setId(databaseId1); - createdDatabases.add(createDatabase(client, d1)); - - Database d2 = new Database(); - d2.setId(databaseId2); - createdDatabases.add(createDatabase(client, d2)); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId1); - safeDeleteDatabase(client, databaseId2); - - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentClientResourceLeakTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentClientResourceLeakTest.java deleted file mode 100644 index e3a1df72d70a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentClientResourceLeakTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import org.testng.SkipException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import static org.apache.commons.io.FileUtils.ONE_MB; -import static org.assertj.core.api.Assertions.assertThat; - -public class DocumentClientResourceLeakTest extends TestSuiteBase { - private static final int TIMEOUT = 240000; - private static final int MAX_NUMBER = 1000; - private Builder clientBuilder; - private AsyncDocumentClient client; - - private Database createdDatabase; - private DocumentCollection createdCollection; - - @Factory(dataProvider = "simpleClientBuildersWithDirect") - public DocumentClientResourceLeakTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = {"emulator"}, timeOut = TIMEOUT) - public void resourceLeak() throws Exception { - //TODO FIXME DANOBLE this test doesn't pass on RNTBD - if (clientBuilder.configs.getProtocol() == Protocol.Tcp) { - throw new SkipException("RNTBD"); - } - System.gc(); - TimeUnit.SECONDS.sleep(10); - long usedMemoryInBytesBefore = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()); - - - for (int i = 0; i < MAX_NUMBER; i++) { - logger.info("client {}", i); - client = clientBuilder.build(); - try { - logger.info("creating doc..."); - createDocument(client, createdDatabase.getId(), createdCollection.getId(), getDocumentDefinition()); - } finally { - logger.info("closing client..."); - client.close(); - } - } - System.gc(); - TimeUnit.SECONDS.sleep(10); - long usedMemoryInBytesAfter = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()); - - assertThat(usedMemoryInBytesAfter - usedMemoryInBytesBefore).isLessThan(200 * ONE_MB); - } - - @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentCrudTest.java deleted file mode 100644 index 2c13e78df1ef..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentCrudTest.java +++ /dev/null @@ -1,435 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.apache.commons.lang3.StringUtils; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.Date; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import static org.apache.commons.io.FileUtils.ONE_MB; -import static org.assertj.core.api.Assertions.assertThat; - -public class DocumentCrudTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public DocumentCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @DataProvider(name = "documentCrudArgProvider") - public Object[][] documentCrudArgProvider() { - return new Object[][] { - // collection name, is name base - {UUID.randomUUID().toString(), false } , - {UUID.randomUUID().toString(), true } , - - // with special characters in the name. - {"+ -_,:.|~" + UUID.randomUUID().toString() + " +-_,:.|~", true } , - }; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void createDocument(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Observable> createObservable = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void createLargeDocument(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - //Keep size as ~ 1.5MB to account for size of other props - int size = (int) (ONE_MB * 1.5); - docDefinition.set("largeString", StringUtils.repeat("x", size)); - - Observable> createObservable = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void createDocumentWithVeryLargePartitionKey(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - StringBuilder sb = new StringBuilder(); - for(int i = 0; i < 100; i++) { - sb.append(i).append("x"); - } - docDefinition.set("mypk", sb.toString()); - - Observable> createObservable = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .withProperty("mypk", sb.toString()) - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void readDocumentWithVeryLargePartitionKey(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - StringBuilder sb = new StringBuilder(); - for(int i = 0; i < 100; i++) { - sb.append(i).append("x"); - } - docDefinition.set("mypk", sb.toString()); - - Document createdDocument = TestSuiteBase.createDocument(client, createdDatabase.getId(), createdCollection.getId(), docDefinition); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(sb.toString())); - Observable> readObservable = client.readDocument(getDocumentLink(createdDocument, isNameBased), options); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .withProperty("mypk", sb.toString()) - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void createDocument_AlreadyExists(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - client.createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - Observable> createObservable = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false); - - FailureValidator validator = new FailureValidator.Builder().resourceAlreadyExists().build(); - validateFailure(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void createDocumentTimeout(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Observable> createObservable = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false) - .timeout(1, TimeUnit.MILLISECONDS); - - FailureValidator validator = new FailureValidator.Builder().instanceOf(TimeoutException.class).build(); - - validateFailure(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void readDocument(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(document.get("mypk"))); - Observable> readObservable = client.readDocument(getDocumentLink(document, isNameBased), options); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(document.getId()) - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void timestamp(String documentId, boolean isNameBased) throws Exception { - Date before = new Date(); - Document docDefinition = getDocumentDefinition(documentId); - Thread.sleep(1000); - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(document.get("mypk"))); - Observable> readObservable = client.readDocument(getDocumentLink(document, isNameBased), options); - Document readDocument = readObservable.toBlocking().single().getResource(); - Thread.sleep(1000); - Date after = new Date(); - - assertThat(readDocument.getTimestamp()).isAfterOrEqualsTo(before); - assertThat(readDocument.getTimestamp()).isBeforeOrEqualsTo(after); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void readDocument_DoesntExist(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(document.get("mypk"))); - client.deleteDocument(getDocumentLink(document, isNameBased), options).toBlocking().first(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - options.setPartitionKey(new PartitionKey("looloo")); - Observable> readObservable = client.readDocument(getDocumentLink(document, isNameBased), options); - - FailureValidator validator = new FailureValidator.Builder().instanceOf(DocumentClientException.class) - .statusCode(404).build(); - validateFailure(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void deleteDocument(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(document.get("mypk"))); - Observable> deleteObservable = client.deleteDocument(getDocumentLink(document, isNameBased), options); - - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(deleteObservable, validator); - - // attempt to read document which was deleted - waitIfNeededForReplicasToCatchUp(clientBuilder); - - Observable> readObservable = client.readDocument(getDocumentLink(document, isNameBased), options); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, notFoundValidator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void deleteDocument_undefinedPK(String documentId, boolean isNameBased) { - Document docDefinition = new Document(); - docDefinition.setId(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(Undefined.Value())); - Observable> deleteObservable = client.deleteDocument(getDocumentLink(document, isNameBased), options); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(deleteObservable, validator); - - // attempt to read document which was deleted - waitIfNeededForReplicasToCatchUp(clientBuilder); - - Observable> readObservable = client.readDocument(getDocumentLink(document, isNameBased), options); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, notFoundValidator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void deleteDocument_DoesntExist(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(document.get("mypk"))); - client.deleteDocument(getDocumentLink(document, isNameBased), options).toBlocking().single(); - - // delete again - Observable> deleteObservable = client.deleteDocument(getDocumentLink(document, isNameBased), options); - - FailureValidator validator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(deleteObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void replaceDocument(String documentId, boolean isNameBased) { - // create a document - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - String newPropValue = UUID.randomUUID().toString(); - document.set("newProp", newPropValue); - - // replace document - Observable> readObservable = client.replaceDocument(document, null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withProperty("newProp", newPropValue).build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void replaceDocument_UsingDocumentLink(String documentId, boolean isNameBased) { - // create a document - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - String newPropValue = UUID.randomUUID().toString(); - document.set("newProp", newPropValue); - - // replace document - Observable> readObservable = client.replaceDocument(getDocumentLink(document, isNameBased), document, null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withProperty("newProp", newPropValue).build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void upsertDocument_CreateDocument(String documentId, boolean isNameBased) { - // create a document - Document docDefinition = getDocumentDefinition(documentId); - - - // replace document - Observable> upsertObservable = client.upsertDocument(getCollectionLink(isNameBased), - docDefinition, null, false); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()).build(); - try { - validateSuccess(upsertObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void upsertDocument_ReplaceDocument(String documentId, boolean isNameBased) { - // create a document - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - String newPropValue = UUID.randomUUID().toString(); - document.set("newProp", newPropValue); - - // replace document - Observable> readObservable = client.upsertDocument - (getCollectionLink(isNameBased), document, null, true); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withProperty("newProp", newPropValue).build(); - try { - validateSuccess(readObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeMethod(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeMethod() { - safeClose(client); - client = clientBuilder.build(); - } - - private String getCollectionLink(boolean isNameBased) { - return isNameBased ? "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() : createdCollection.getSelfLink(); - } - - private String getDocumentLink(Document doc, boolean isNameBased) { - return isNameBased ? "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/docs/" + doc.getId() : - "dbs/" + createdDatabase.getResourceId() + "/colls/" + createdCollection.getResourceId() + "/docs/" + doc.getResourceId(); - } - - private Document getDocumentDefinition(String documentId) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , documentId, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/LogLevelTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/LogLevelTest.java deleted file mode 100644 index c2ace6ab6596..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/LogLevelTest.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx; - -import java.io.StringWriter; -import java.lang.reflect.Method; -import java.util.UUID; - -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.WriterAppender; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -import static org.assertj.core.api.Assertions.assertThat; - -public class LogLevelTest extends TestSuiteBase { - public final static String COSMOS_DB_LOGGING_CATEGORY = "com.microsoft.azure.cosmosdb"; - public final static String NETWORK_LOGGING_CATEGORY = "com.microsoft.azure.cosmosdb.netty-network"; - public final static String LOG_PATTERN_1 = "HTTP/1.1 200 Ok."; - public final static String LOG_PATTERN_2 = "| 0 1 2 3 4 5 6 7 8 9 a b c d e f |"; - public final static String LOG_PATTERN_3 = "USER_EVENT: SslHandshakeCompletionEvent(SUCCESS)"; - public final static String LOG_PATTERN_4 = "CONNECT: "; - - private static Database createdDatabase; - private static DocumentCollection createdCollection; - - public LogLevelTest() { - this.clientBuilder = createGatewayRxDocumentClient(); - } - - @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - /** - * This test will try to create document with netty wire DEBUG logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithDebugLevel() throws Exception { - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).setLevel(Level.DEBUG); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).isEmpty(); - - } finally { - safeClose(client); - } - } - - /** - * This test will try to create document with netty wire WARN logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithWarningLevel() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).setLevel(Level.WARN); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).isEmpty(); - } finally { - safeClose(client); - } - } - - /** - * This test will try to create document with netty wire TRACE logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithTraceLevel() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).setLevel(Level.TRACE); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_1); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_2); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_3); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_4); - - } finally { - safeClose(client); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithTraceLevelAtRoot() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(COSMOS_DB_LOGGING_CATEGORY).setLevel(Level.TRACE); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_1); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_2); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_3); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_4); - } finally { - safeClose(client); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithDebugLevelAtRoot() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(COSMOS_DB_LOGGING_CATEGORY).setLevel(Level.DEBUG); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).isEmpty(); - } finally { - safeClose(client); - } - } - - /** - * This test will try to create document with netty wire ERROR logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithErrorClient() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).setLevel(Level.ERROR); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).isEmpty(); - } finally { - safeClose(client); - } - } - - /** - * This test will try to create document with netty wire INFO logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithInfoLevel() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).setLevel(Level.INFO); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).isEmpty(); - } finally { - safeClose(client); - } - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - @BeforeMethod(groups = { "simple"}) - public void beforeMethod(Method method) { - super.beforeMethod(method); - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - @AfterMethod(groups = { "simple" }) - public void afterMethod() { - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT) - public void afterClass() { - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiMasterConflictResolutionTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiMasterConflictResolutionTest.java deleted file mode 100644 index 05ce9cee9b9f..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiMasterConflictResolutionTest.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.BridgeUtils; -import com.microsoft.azure.cosmosdb.ConflictResolutionMode; -import com.microsoft.azure.cosmosdb.ConflictResolutionPolicy; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import javax.net.ssl.SSLException; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -// assumes multi master is enabled in endpoint -public class MultiMasterConflictResolutionTest extends TestSuiteBase { - private static final int TIMEOUT = 40000; - - private final String databaseId = DatabaseForTest.generateId(); - - private AsyncDocumentClient client; - private Database database; - - @Factory(dataProvider = "clientBuilders") - public MultiMasterConflictResolutionTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = "multi-master", timeOut = TIMEOUT) - public void conflictResolutionPolicyCRUD() { - - // default last writer wins, path _ts - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - collection = getResource(client.createCollection(getDatabaseLink(database), collection, null)); - - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionMode()).isEqualTo(ConflictResolutionMode.LastWriterWins); - - // LWW without path specified, should default to _ts - collection.setConflictResolutionPolicy(ConflictResolutionPolicy.createLastWriterWinsPolicy()); - collection = getResource(client.replaceCollection(collection, null)); - - - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionMode()).isEqualTo(ConflictResolutionMode.LastWriterWins); - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionPath()).isEqualTo("/_ts"); - - // Tests the following scenarios - // 1. LWW with valid path - // 2. LWW with null path, should default to _ts - // 3. LWW with empty path, should default to _ts - testConflictResolutionPolicyRequiringPath(ConflictResolutionMode.LastWriterWins, - new String[] { "/a", null, "" }, new String[] { "/a", "/_ts", "/_ts" }); - - // LWW invalid path - collection.setConflictResolutionPolicy(ConflictResolutionPolicy.createLastWriterWinsPolicy("/a/b")); - - try { - collection = getResource(client.replaceCollection(collection, null)); - fail("Expected exception on invalid path."); - } catch (Exception e) { - - // when (e.StatusCode == HttpStatusCode.BadRequest) - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(e.getCause(), DocumentClientException.class); - if (dce != null && dce.getStatusCode() == 400) { - assertThat(dce.getMessage()).contains("Invalid path '\\/a\\/b' for last writer wins conflict resolution"); - } else { - throw e; - } - } - - // LWW invalid path - - collection.setConflictResolutionPolicy(ConflictResolutionPolicy.createLastWriterWinsPolicy("someText")); - - try { - collection = getResource(client.replaceCollection(collection, null)); - fail("Expected exception on invalid path."); - } catch (Exception e) { - // when (e.StatusCode == HttpStatusCode.BadRequest) - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(e.getCause(), DocumentClientException.class); - if (dce != null && dce.getStatusCode() == 400) { - assertThat(dce.getMessage()).contains("Invalid path 'someText' for last writer wins conflict resolution"); - } else { - throw e; - } - } - - // Tests the following scenarios - // 1. Custom with valid sprocLink - // 2. Custom with null sprocLink, should default to empty string - // 3. Custom with empty sprocLink, should default to empty string - testConflictResolutionPolicyRequiringPath(ConflictResolutionMode.Custom, - new String[] { "randomSprocName", null, "" }, new String[] { "randomSprocName", "", "" }); - } - - private void testConflictResolutionPolicyRequiringPath(ConflictResolutionMode conflictResolutionMode, - String[] paths, String[] expectedPaths) { - for (int i = 0; i < paths.length; i++) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - - if (conflictResolutionMode == ConflictResolutionMode.LastWriterWins) { - collection.setConflictResolutionPolicy(ConflictResolutionPolicy.createLastWriterWinsPolicy(paths[i])); - } else { - collection.setConflictResolutionPolicy(ConflictResolutionPolicy.createCustomPolicy(paths[i])); - } - collection = getResource(client.createCollection("dbs/" + database.getId(), collection, null)); - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionMode()).isEqualTo(conflictResolutionMode); - - if (conflictResolutionMode == ConflictResolutionMode.LastWriterWins) { - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionPath()).isEqualTo(expectedPaths[i]); - } else { - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionProcedure()).isEqualTo(expectedPaths[i]); - } - } - } - - @Test(groups = "multi-master", timeOut = TIMEOUT) - public void invalidConflictResolutionPolicy_LastWriterWinsWithStoredProc() throws Exception { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - - // LWW without path specified, should default to _ts - ConflictResolutionPolicy policy = BridgeUtils.createConflictResolutionPolicy(); - BridgeUtils.setMode(policy, ConflictResolutionMode.LastWriterWins); - BridgeUtils.setStoredProc(policy,"randomSprocName"); - collection.setConflictResolutionPolicy(policy); - - Observable> createObservable = client.createCollection( - getDatabaseLink(database), - collection, - null); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .errorMessageContains("LastWriterWins conflict resolution mode should not have conflict resolution procedure set.") - .build(); - validateFailure(createObservable, validator); - } - - @Test(groups = "multi-master", timeOut = TIMEOUT) - public void invalidConflictResolutionPolicy_CustomWithPath() throws Exception { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - - // LWW without path specified, should default to _ts - ConflictResolutionPolicy policy = BridgeUtils.createConflictResolutionPolicy(); - BridgeUtils.setMode(policy, ConflictResolutionMode.Custom); - BridgeUtils.setPath(policy,"/mypath"); - collection.setConflictResolutionPolicy(policy); - - Observable> createObservable = client.createCollection( - getDatabaseLink(database), - collection, - null); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .errorMessageContains("Custom conflict resolution mode should not have conflict resolution path set.") - .build(); - validateFailure(createObservable, validator); - } - - @BeforeClass(groups = {"multi-master"}, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - // set up the client - - client = clientBuilder.build(); - database = createDatabase(client, databaseId); - } - - private T getResource(Observable> obs) { - return obs.toBlocking().single().getResource(); - } - - @AfterClass(groups = {"multi-master"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, database); - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiOrderByQueryTests.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiOrderByQueryTests.java deleted file mode 100644 index 9734948d38e3..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiOrderByQueryTests.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.Random; -import java.util.UUID; - -import org.apache.commons.collections4.ComparatorUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.CompositePathSortOrder; -import com.microsoft.azure.cosmosdb.Document; - -public class MultiOrderByQueryTests extends TestSuiteBase { - - private static final int TIMEOUT = 35000; - private static final String NUMBER_FIELD = "numberField"; - private static final String STRING_FIELD = "stringField"; - private static final String NUMBER_FIELD_2 = "numberField2"; - private static final String STRING_FIELD_2 = "stringField2"; - private static final String BOOL_FIELD = "boolField"; - private static final String NULL_FIELD = "nullField"; - private static final String OBJECT_FIELD = "objectField"; - private static final String ARRAY_FIELD = "arrayField"; - private static final String SHORT_STRING_FIELD = "shortStringField"; - private static final String MEDIUM_STRING_FIELD = "mediumStringField"; - private static final String LONG_STRING_FIELD = "longStringField"; - private static final String PARTITION_KEY = "pk"; - private ArrayList documents = new ArrayList(); - private DocumentCollection documentCollection; - private Builder clientBuilder; - private AsyncDocumentClient client; - - class CustomComparator implements Comparator { - String path; - CompositePathSortOrder order; - boolean isNumericPath = false; - boolean isStringPath = false; - boolean isBooleanPath = false; - boolean isNullPath = false; - - public CustomComparator(String path, CompositePathSortOrder order) { - this.path = path; - this.order = order; - if (this.path.contains("number")) { - isNumericPath = true; - } else if (this.path.toLowerCase().contains("string")) { - isStringPath = true; - } else if (this.path.contains("bool")) { - isBooleanPath = true; - } else if (this.path.contains("null")) { - isNullPath = true; - } - } - - @Override - public int compare(Document doc1, Document doc2) { - boolean isAsc = order == CompositePathSortOrder.Ascending; - if (isNumericPath) { - if (doc1.getInt(path) < doc2.getInt(path)) - return isAsc ? -1 : 1; - else if (doc1.getInt(path) > doc2.getInt(path)) - return isAsc ? 1 : -1; - else - return 0; - } else if (isStringPath) { - if (!isAsc) { - Document temp = doc1; - doc1 = doc2; - doc2 = temp; - } - return doc1.getString(path).compareTo(doc2.getString(path)); - } else if (isBooleanPath) { - if (doc1.getBoolean(path) == false && doc2.getBoolean(path) == true) - return isAsc ? -1 : 1; - else if (doc1.getBoolean(path) == true && doc2.getBoolean(path) == false) - return isAsc ? 1 : -1; - else - return 0; - } else if (isNullPath) { - // all nulls are equal - return 0; - } else { - throw new IllegalStateException("data type not handled by comparator!"); - } - } - } - - @Factory(dataProvider = "clientBuilders") - public MultiOrderByQueryTests(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - documentCollection = SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES; - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES); - - int numberOfDocuments = 4; - - Random random = new Random(); - for (int i = 0; i < numberOfDocuments; ++i) { - Document multiOrderByDocument = generateMultiOrderByDocument(); - String multiOrderByDocumentString = multiOrderByDocument.toJson(); - int numberOfDuplicates = 5; - - for (int j = 0; j < numberOfDuplicates; j++) { - // Add the document itself for exact duplicates - Document initialDocument = new Document(multiOrderByDocumentString); - initialDocument.setId(UUID.randomUUID().toString()); - this.documents.add(initialDocument); - - // Permute all the fields so that there are duplicates with tie breaks - Document numberClone = new Document(multiOrderByDocumentString); - numberClone.set(NUMBER_FIELD, random.nextInt(5)); - numberClone.setId(UUID.randomUUID().toString()); - this.documents.add(numberClone); - - Document stringClone = new Document(multiOrderByDocumentString); - stringClone.set(STRING_FIELD, Integer.toString(random.nextInt(5))); - stringClone.setId(UUID.randomUUID().toString()); - this.documents.add(stringClone); - - Document boolClone = new Document(multiOrderByDocumentString); - boolClone.set(BOOL_FIELD, random.nextInt(2) % 2 == 0); - boolClone.setId(UUID.randomUUID().toString()); - this.documents.add(boolClone); - - // Also fuzz what partition it goes to - Document partitionClone = new Document(multiOrderByDocumentString); - partitionClone.set(PARTITION_KEY, random.nextInt(5)); - partitionClone.setId(UUID.randomUUID().toString()); - this.documents.add(partitionClone); - } - } - - bulkInsertBlocking(client, documentCollection.getSelfLink(), documents); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - private Document generateMultiOrderByDocument() { - Random random = new Random(); - Document document = new Document(); - document.setId(UUID.randomUUID().toString()); - document.set(NUMBER_FIELD, random.nextInt(5)); - document.set(NUMBER_FIELD_2, random.nextInt(5)); - document.set(BOOL_FIELD, (random.nextInt() % 2) == 0); - document.set(STRING_FIELD, Integer.toString(random.nextInt(5))); - document.set(STRING_FIELD_2, Integer.toString(random.nextInt(5))); - document.set(NULL_FIELD, null); - document.set(OBJECT_FIELD, ""); - document.set(ARRAY_FIELD, (new ObjectMapper()).createArrayNode()); - document.set(SHORT_STRING_FIELD, "a" + random.nextInt(100)); - document.set(MEDIUM_STRING_FIELD, "a" + random.nextInt(128) + 100); - document.set(LONG_STRING_FIELD, "a" + random.nextInt(255) + 128); - document.set(PARTITION_KEY, random.nextInt(5)); - return document; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocumentsWithMultiOrder() throws DocumentClientException, InterruptedException { - FeedOptions feedOptions = new FeedOptions(); - feedOptions.setEnableCrossPartitionQuery(true); - - boolean[] booleanValues = new boolean[] {true, false}; - Iterator> compositeIndexesIterator = documentCollection.getIndexingPolicy().getCompositeIndexes().iterator(); - while (compositeIndexesIterator.hasNext()) { - ArrayList compositeIndex = compositeIndexesIterator.next(); - // for every order - for (boolean invert : booleanValues) { - // for normal and inverted order - for (boolean hasTop : booleanValues) { - // with and without top - for (boolean hasFilter : booleanValues) { - // with and without filter - // Generate a multi order by from that index - List orderByItems = new ArrayList(); - List selectItems = new ArrayList(); - boolean isDesc; - Iterator compositeIndexiterator = compositeIndex.iterator(); - while (compositeIndexiterator.hasNext()) { - CompositePath compositePath = compositeIndexiterator.next(); - isDesc = compositePath.getOrder() == CompositePathSortOrder.Descending ? true : false; - if (invert) { - isDesc = !isDesc; - } - - String isDescString = isDesc ? "DESC" : "ASC"; - String compositePathName = compositePath.getPath().replaceAll("/", ""); - String orderByItemsString = "root." + compositePathName + " " + isDescString; - String selectItemsString = "root." + compositePathName; - orderByItems.add(orderByItemsString); - selectItems.add(selectItemsString); - } - - int topCount = 10; - StringBuilder selectItemStringBuilder = new StringBuilder(); - for (String selectItem: selectItems) { - selectItemStringBuilder.append(selectItem); - selectItemStringBuilder.append(","); - } - selectItemStringBuilder.deleteCharAt(selectItemStringBuilder.length() - 1); - StringBuilder orderByItemStringBuilder = new StringBuilder(); - for (String orderByItem : orderByItems) { - orderByItemStringBuilder.append(orderByItem); - orderByItemStringBuilder.append(","); - } - orderByItemStringBuilder.deleteCharAt(orderByItemStringBuilder.length() - 1); - - String topString = hasTop ? "TOP " + topCount : ""; - String whereString = hasFilter ? "WHERE root." + NUMBER_FIELD + " % 2 = 0" : ""; - String query = "SELECT " + topString + " [" + selectItemStringBuilder.toString() + "] " + - "FROM root " + whereString + " " + - "ORDER BY " + orderByItemStringBuilder.toString(); - - ArrayList expectedOrderedList = top(sort(filter(this.documents, hasFilter), compositeIndex, invert), hasTop, topCount) ; - - Observable> queryObservable = client - .queryDocuments(documentCollection.getSelfLink(), query, feedOptions); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .withOrderedResults(expectedOrderedList, compositeIndex) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - } - } - } - - // Create document with numberField not set. - // This query would then be invalid. - Document documentWithEmptyField = generateMultiOrderByDocument(); - documentWithEmptyField.remove(NUMBER_FIELD); - client.createDocument(documentCollection.getSelfLink(), documentWithEmptyField, null, false).toBlocking().single(); - String query = "SELECT [root." + NUMBER_FIELD + ",root." + STRING_FIELD + "] FROM root ORDER BY root." + NUMBER_FIELD + " ASC ,root." + STRING_FIELD + " DESC"; - Observable> queryObservable = client - .queryDocuments(documentCollection.getSelfLink(), query, feedOptions); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(UnsupportedOperationException.class) - .build(); - - validateQueryFailure(queryObservable, validator); - } - - private ArrayList top(ArrayList documents, boolean hasTop, int topCount) { - ArrayList result = new ArrayList(); - int counter = 0; - if (hasTop) { - while (counter < topCount && counter < documents.size()) { - result.add(documents.get(counter)); - counter++; - } - } else { - result.addAll(documents); - } - return result; - } - - private ArrayList sort(ArrayList documents, ArrayList compositeIndex, - boolean invert) { - Collection> comparators = new ArrayList>(); - Iterator compositeIndexIterator = compositeIndex.iterator(); - while (compositeIndexIterator.hasNext()) { - CompositePath compositePath = compositeIndexIterator.next(); - CompositePathSortOrder order = compositePath.getOrder(); - if (invert) { - if (order == CompositePathSortOrder.Descending) { - order = CompositePathSortOrder.Ascending; - } else { - order = CompositePathSortOrder.Descending; - } - } - String path = compositePath.getPath().replace("/", ""); - comparators.add(new CustomComparator(path, order)); - } - Collections.sort(documents, ComparatorUtils.chainedComparator(comparators)); - return documents; - } - - private ArrayList filter(ArrayList documents, boolean hasFilter) { - ArrayList result = new ArrayList(); - if (hasFilter) { - for (Document document : documents) { - if (document.getInt(NUMBER_FIELD) % 2 == 0) { - result.add(document); - } - } - } else { - result.addAll(documents); - } - return result; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferQueryTest.java deleted file mode 100644 index 5554c8c1ee7a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferQueryTest.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.assertj.core.util.Strings; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class OfferQueryTest extends TestSuiteBase { - - public final static int SETUP_TIMEOUT = 40000; - public final String databaseId = DatabaseForTest.generateId(); - - private List createdCollections = new ArrayList<>(); - - private AsyncDocumentClient client; - - private String getDatabaseLink() { - return Utils.getDatabaseNameLink(databaseId); - } - - @Factory(dataProvider = "clientBuilders") - public OfferQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void queryOffersWithFilter() throws Exception { - String collectionResourceId = createdCollections.get(0).getResourceId(); - String query = String.format("SELECT * from c where c.offerResourceId = '%s'", collectionResourceId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - Observable> queryObservable = client.queryOffers(query, null); - - List allOffers = client.readOffers(null).flatMap(f -> Observable.from(f.getResults())).toList().toBlocking().single(); - List expectedOffers = allOffers.stream().filter(o -> collectionResourceId.equals(o.getString("offerResourceId"))).collect(Collectors.toList()); - - assertThat(expectedOffers).isNotEmpty(); - - int expectedPageSize = (expectedOffers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedOffers.size()) - .exactlyContainsInAnyOrder(expectedOffers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT * 100) - public void queryOffersFilterMorePages() throws Exception { - - List collectionResourceIds = createdCollections.stream().map(c -> c.getResourceId()).collect(Collectors.toList()); - String query = String.format("SELECT * from c where c.offerResourceId in (%s)", - Strings.join(collectionResourceIds.stream().map(s -> "'" + s + "'").collect(Collectors.toList())).with(",")); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(1); - Observable> queryObservable = client.queryOffers(query, options); - - List expectedOffers = client.readOffers(null).flatMap(f -> Observable.from(f.getResults())).toList().toBlocking().single() - .stream().filter(o -> collectionResourceIds.contains(o.getOfferResourceId())) - .collect(Collectors.toList()); - - assertThat(expectedOffers).hasSize(createdCollections.size()); - - int expectedPageSize = (expectedOffers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedOffers.size()) - .exactlyContainsInAnyOrder(expectedOffers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void queryCollections_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - Observable> queryObservable = client.queryCollections(getDatabaseLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - - Database d1 = new Database(); - d1.setId(databaseId); - createDatabase(client, d1); - - for(int i = 0; i < 3; i++) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - createdCollections.add(createCollection(client, databaseId, collection)); - } - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferReadReplaceTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferReadReplaceTest.java deleted file mode 100644 index 6a5d9e9fdfd0..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferReadReplaceTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.List; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.ResourceResponse; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class OfferReadReplaceTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public OfferReadReplaceTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void readAndReplaceOffer() { - - client.readOffers(null).toBlocking().subscribe((offersFeed) -> { - try { - int i; - List offers = offersFeed.getResults(); - for (i = 0; i < offers.size(); i++) { - if (offers.get(i).getOfferResourceId().equals(createdCollection.getResourceId())) { - break; - } - } - - Offer rOffer = client.readOffer(offers.get(i).getSelfLink()).toBlocking().single().getResource(); - int oldThroughput = rOffer.getThroughput(); - - Observable> readObservable = client.readOffer(offers.get(i).getSelfLink()); - - // validate offer read - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withOfferThroughput(oldThroughput) - .notNullEtag() - .build(); - - validateSuccess(readObservable, validatorForRead); - - // update offer - int newThroughput = oldThroughput + 100; - offers.get(i).setThroughput(newThroughput); - Observable> replaceObservable = client.replaceOffer(offers.get(i)); - - // validate offer replace - ResourceResponseValidator validatorForReplace = new ResourceResponseValidator.Builder() - .withOfferThroughput(newThroughput) - .notNullEtag() - .build(); - - validateSuccess(replaceObservable, validatorForReplace); - - } catch (Exception e) { - e.printStackTrace(); - } - - }); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = createDatabase(client, databaseId); - createdCollection = createCollection(client, createdDatabase.getId(), - getCollectionDefinition()); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase); - safeClose(client); - } - -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OrderbyDocumentQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OrderbyDocumentQueryTest.java deleted file mode 100644 index cca649efba67..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OrderbyDocumentQueryTest.java +++ /dev/null @@ -1,589 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.core.JsonProcessingException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import com.microsoft.azure.cosmosdb.rx.internal.query.CompositeContinuationToken; -import com.microsoft.azure.cosmosdb.rx.internal.query.OrderByContinuationToken; - -import rx.Observable; -import rx.observers.TestSubscriber; - -public class OrderbyDocumentQueryTest extends TestSuiteBase { - private final double minQueryRequestChargePerPartition = 2.0; - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments = new ArrayList<>(); - - private AsyncDocumentClient client; - - private int numberOfPartitions; - - @Factory(dataProvider = "clientBuildersWithDirect") - public OrderbyDocumentQueryTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "queryMetricsArgProvider") - public void queryDocumentsValidateContent(boolean qmEnabled) throws Exception { - Document expectedDocument = createdDocuments.get(0); - - String query = String.format("SELECT * from root r where r.propStr = '%s'" - + " ORDER BY r.propInt" - , expectedDocument.getString("propStr")); - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setPopulateQueryMetrics(qmEnabled); - - Observable> queryObservable = client.queryDocuments(getCollectionLink(), query, options); - - List expectedResourceIds = new ArrayList<>(); - expectedResourceIds.add(expectedDocument.getResourceId()); - - Map> resourceIDToValidator = new HashMap<>(); - - resourceIDToValidator.put(expectedDocument.getResourceId(), - new ResourceValidator.Builder().areEqual(expectedDocument).build()); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .numberOfPages(1) - .containsExactly(expectedResourceIds) - .validateAllResources(resourceIDToValidator) - .totalRequestChargeIsAtLeast(numberOfPartitions * minQueryRequestChargePerPartition) - .allPagesSatisfy(new FeedResponseValidator.Builder().hasRequestChargeHeader().build()) - .hasValidQueryMetrics(qmEnabled) - .build(); - - try { - validateQuerySuccess(queryObservable, validator); - } catch (Throwable error) { - // TODO: DANOBLE: report this detailed information in all failures produced by TestSuiteBase classes - // work item: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/370015 - String message = String.format("%s %s mode with %s consistency test failure", - this.clientBuilder.connectionPolicy.getConnectionMode(), - this.clientBuilder.configs.getProtocol(), - this.clientBuilder.desiredConsistencyLevel); - throw new AssertionError(message, error); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocuments_NoResults() throws Exception { - String query = "SELECT * from root r where r.id = '2' ORDER BY r.propInt"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .totalRequestChargeIsAtLeast(numberOfPartitions * minQueryRequestChargePerPartition) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .hasRequestChargeHeader().build()) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - @DataProvider(name = "sortOrder") - public Object[][] sortOrder() { - return new Object[][] { { "ASC" }, {"DESC"} }; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "sortOrder") - public void queryOrderBy(String sortOrder) throws Exception { - String query = String.format("SELECT * FROM r ORDER BY r.propInt %s", sortOrder); - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - int pageSize = 3; - options.setMaxItemCount(pageSize); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - Comparator validatorComparator = Comparator.nullsFirst(Comparator.naturalOrder()); - - List expectedResourceIds = sortDocumentsAndCollectResourceIds("propInt", d -> d.getInt("propInt"), validatorComparator); - if ("DESC".equals(sortOrder)) { - Collections.reverse(expectedResourceIds); - } - - int expectedPageSize = expectedNumberOfPages(expectedResourceIds.size(), pageSize); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedResourceIds) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .hasRequestChargeHeader().build()) - .totalRequestChargeIsAtLeast(numberOfPartitions * minQueryRequestChargePerPartition) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryOrderByInt() throws Exception { - String query = "SELECT * FROM r ORDER BY r.propInt"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - int pageSize = 3; - options.setMaxItemCount(pageSize); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - Comparator validatorComparator = Comparator.nullsFirst(Comparator.naturalOrder()); - List expectedResourceIds = sortDocumentsAndCollectResourceIds("propInt", d -> d.getInt("propInt"), validatorComparator); - int expectedPageSize = expectedNumberOfPages(expectedResourceIds.size(), pageSize); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedResourceIds) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .hasRequestChargeHeader().build()) - .totalRequestChargeIsAtLeast(numberOfPartitions * minQueryRequestChargePerPartition) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryOrderByString() throws Exception { - String query = "SELECT * FROM r ORDER BY r.propStr"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - int pageSize = 3; - options.setMaxItemCount(pageSize); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - Comparator validatorComparator = Comparator.nullsFirst(Comparator.naturalOrder()); - List expectedResourceIds = sortDocumentsAndCollectResourceIds("propStr", d -> d.getString("propStr"), validatorComparator); - int expectedPageSize = expectedNumberOfPages(expectedResourceIds.size(), pageSize); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedResourceIds) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .hasRequestChargeHeader().build()) - .totalRequestChargeIsAtLeast(numberOfPartitions * minQueryRequestChargePerPartition) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - @DataProvider(name = "topValue") - public Object[][] topValueParameter() { - return new Object[][] { { 0 }, { 1 }, { 5 }, { createdDocuments.size() - 1 }, { createdDocuments.size() }, - { createdDocuments.size() + 1 }, { 2 * createdDocuments.size() } }; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "topValue") - public void queryOrderWithTop(int topValue) throws Exception { - String query = String.format("SELECT TOP %d * FROM r ORDER BY r.propInt", topValue); - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - int pageSize = 3; - options.setMaxItemCount(pageSize); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - Comparator validatorComparator = Comparator.nullsFirst(Comparator.naturalOrder()); - - List expectedResourceIds = - sortDocumentsAndCollectResourceIds("propInt", d -> d.getInt("propInt"), validatorComparator) - .stream().limit(topValue).collect(Collectors.toList()); - - int expectedPageSize = expectedNumberOfPages(expectedResourceIds.size(), pageSize); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedResourceIds) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .hasRequestChargeHeader().build()) - .totalRequestChargeIsAtLeast(numberOfPartitions * (topValue > 0 ? minQueryRequestChargePerPartition : 1)) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - private List sortDocumentsAndCollectResourceIds(String propName, Function extractProp, Comparator comparer) { - return createdDocuments.stream() - .filter(d -> d.getHashMap().containsKey(propName)) // removes undefined - .sorted((d1, d2) -> comparer.compare(extractProp.apply(d1), extractProp.apply(d2))) - .map(d -> d.getResourceId()).collect(Collectors.toList()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void crossPartitionQueryNotEnabled() throws Exception { - String query = "SELECT * FROM r ORDER BY r.propInt"; - FeedOptions options = new FeedOptions(); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .build(); - validateQueryFailure(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryScopedToSinglePartition_StartWithContinuationToken() throws Exception { - String query = "SELECT * FROM r ORDER BY r.propScopedPartitionInt ASC"; - FeedOptions options = new FeedOptions(); - options.setPartitionKey(new PartitionKey("duplicateParitionKeyValue")); - options.setMaxItemCount(3); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - - TestSubscriber> subscriber = new TestSubscriber<>(); - queryObservable.first().subscribe(subscriber); - - subscriber.awaitTerminalEvent(); - subscriber.assertCompleted(); - subscriber.assertNoErrors(); - assertThat(subscriber.getValueCount()).isEqualTo(1); - FeedResponse page = subscriber.getOnNextEvents().get(0); - assertThat(page.getResults()).hasSize(3); - - assertThat(page.getResponseContinuation()).isNotEmpty(); - - - options.setRequestContinuation(page.getResponseContinuation()); - queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - - List expectedDocs = createdDocuments.stream() - .filter(d -> (StringUtils.equals("duplicateParitionKeyValue", d.getString("mypk")))) - .filter(d -> (d.getInt("propScopedPartitionInt") > 2)).collect(Collectors.toList()); - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - assertThat(expectedDocs).hasSize(10 - 3); - - FeedResponseListValidator validator = null; - - validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedDocs.stream() - .sorted((e1, e2) -> Integer.compare(e1.getInt("propScopedPartitionInt"), e2.getInt("propScopedPartitionInt"))) - .map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void orderByContinuationTokenRoundTrip() throws Exception { - { - // Positive - OrderByContinuationToken orderByContinuationToken = new OrderByContinuationToken( - new CompositeContinuationToken( - "asdf", - new Range("A", "D", false, true)), - new QueryItem[] {new QueryItem("{\"item\" : 42}")}, - "rid", - false); - String serialized = orderByContinuationToken.toString(); - ValueHolder outOrderByContinuationToken = new ValueHolder(); - - assertThat(OrderByContinuationToken.tryParse(serialized, outOrderByContinuationToken)).isTrue(); - OrderByContinuationToken deserialized = outOrderByContinuationToken.v; - CompositeContinuationToken compositeContinuationToken = deserialized.getCompositeContinuationToken(); - String token = compositeContinuationToken.getToken(); - Range range = compositeContinuationToken.getRange(); - assertThat(token).isEqualTo("asdf"); - assertThat(range.getMin()).isEqualTo("A"); - assertThat(range.getMax()).isEqualTo("D"); - assertThat(range.isMinInclusive()).isEqualTo(false); - assertThat(range.isMaxInclusive()).isEqualTo(true); - - QueryItem[] orderByItems = deserialized.getOrderByItems(); - assertThat(orderByItems).isNotNull(); - assertThat(orderByItems.length).isEqualTo(1); - assertThat(orderByItems[0].getItem()).isEqualTo(42); - - String rid = deserialized.getRid(); - assertThat(rid).isEqualTo("rid"); - - boolean inclusive = deserialized.getInclusive(); - assertThat(inclusive).isEqualTo(false); - } - - { - // Negative - ValueHolder outOrderByContinuationToken = new ValueHolder(); - assertThat(OrderByContinuationToken.tryParse("{\"property\" : \"Not a valid Order By Token\"}", outOrderByContinuationToken)).isFalse(); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT * 10, dataProvider = "sortOrder") - public void queryDocumentsWithOrderByContinuationTokensInteger(String sortOrder) throws Exception { - // Get Actual - String query = String.format("SELECT * FROM c ORDER BY c.propInt %s", sortOrder); - - // Get Expected - Comparator order = sortOrder.equals("ASC")?Comparator.naturalOrder():Comparator.reverseOrder(); - Comparator validatorComparator = Comparator.nullsFirst(order); - - List expectedResourceIds = sortDocumentsAndCollectResourceIds("propInt", d -> d.getInt("propInt"), validatorComparator); - this.queryWithContinuationTokensAndPageSizes(query, new int[] { 1, 5, 10, 100}, expectedResourceIds); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT * 10, dataProvider = "sortOrder") - public void queryDocumentsWithOrderByContinuationTokensString(String sortOrder) throws Exception { - // Get Actual - String query = String.format("SELECT * FROM c ORDER BY c.id %s", sortOrder); - - // Get Expected - Comparator order = sortOrder.equals("ASC")?Comparator.naturalOrder():Comparator.reverseOrder(); - Comparator validatorComparator = Comparator.nullsFirst(order); - - List expectedResourceIds = sortDocumentsAndCollectResourceIds("id", d -> d.getString("id"), validatorComparator); - this.queryWithContinuationTokensAndPageSizes(query, new int[] { 1, 5, 10, 100 }, expectedResourceIds); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT * 10, dataProvider = "sortOrder") - public void queryDocumentsWithInvalidOrderByContinuationTokensString(String sortOrder) throws Exception { - // Get Actual - String query = String.format("SELECT * FROM c ORDER BY c.id %s", sortOrder); - - // Get Expected - Comparator validatorComparator; - if(sortOrder.equals("ASC")) { - validatorComparator = Comparator.nullsFirst(Comparator.naturalOrder()); - }else{ - validatorComparator = Comparator.nullsFirst(Comparator.reverseOrder()); - } - List expectedResourceIds = sortDocumentsAndCollectResourceIds("id", d -> d.getString("id"), validatorComparator); - this.assertInvalidContinuationToken(query, new int[] { 1, 5, 10, 100 }, expectedResourceIds); - } - - public Document createDocument(AsyncDocumentClient client, Map keyValueProps) - throws DocumentClientException { - Document docDefinition = getDocumentDefinition(keyValueProps); - return client.createDocument(getCollectionLink(), docDefinition, null, false) - .toBlocking().single() - .getResource(); - } - - public List bulkInsert(AsyncDocumentClient client, List> keyValuePropsList) { - - ArrayList>> result = new ArrayList>>(); - - for(Map keyValueProps: keyValuePropsList) { - Document docDefinition = getDocumentDefinition(keyValueProps); - Observable> obs = client.createDocument(getCollectionLink(), docDefinition, null, false); - result.add(obs); - } - - return Observable.merge(result, 100). - map(resp -> resp.getResource()) - .toList().toBlocking().single(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION); - - List> keyValuePropsList = new ArrayList<>(); - Map props; - - for(int i = 0; i < 30; i++) { - props = new HashMap<>(); - props.put("propInt", i); - props.put("propStr", String.valueOf(i)); - keyValuePropsList.add(props); - } - - //undefined values - props = new HashMap<>(); - keyValuePropsList.add(props); - - createdDocuments = bulkInsert(client, keyValuePropsList); - - for(int i = 0; i < 10; i++) { - Map p = new HashMap<>(); - p.put("propScopedPartitionInt", i); - Document doc = getDocumentDefinition("duplicateParitionKeyValue", UUID.randomUUID().toString(), p); - createdDocuments.add(client.createDocument(getCollectionLink(), doc, null, false).toBlocking().single().getResource()); - - } - numberOfPartitions = client - .readPartitionKeyRanges(getCollectionLink(), null) - .flatMap(p -> Observable.from(p.getResults())).toList().toBlocking().single().size(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private void assertInvalidContinuationToken(String query, int[] pageSize, List expectedIds) { - String requestContinuation = null; - do { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(1); - options.setEnableCrossPartitionQuery(true); - options.setMaxDegreeOfParallelism(2); - OrderByContinuationToken orderByContinuationToken = new OrderByContinuationToken( - new CompositeContinuationToken( - "asdf", - new Range("A", "D", false, true)), - new QueryItem[] {new QueryItem("{\"item\" : 42}")}, - "rid", - false); - options.setRequestContinuation(orderByContinuationToken.toString()); - Observable> queryObservable = client.queryDocuments(getCollectionLink(), query, - options); - - Observable> firstPageObservable = queryObservable.first(); - TestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - firstPageObservable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertError(DocumentClientException.class); - } while (requestContinuation != null); - } - - private void queryWithContinuationTokensAndPageSizes(String query, int[] pageSizes, List expectedIds) { - for (int pageSize : pageSizes) { - List receivedDocuments = this.queryWithContinuationTokens(query, pageSize); - List actualIds = new ArrayList(); - for (Document document : receivedDocuments) { - actualIds.add(document.getResourceId()); - } - - assertThat(actualIds).containsExactlyElementsOf(expectedIds); - } - } - - private List queryWithContinuationTokens(String query, int pageSize) { - String requestContinuation = null; - List continuationTokens = new ArrayList(); - List receivedDocuments = new ArrayList(); - do { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(pageSize); - options.setEnableCrossPartitionQuery(true); - options.setMaxDegreeOfParallelism(2); - options.setRequestContinuation(requestContinuation); - Observable> queryObservable = client.queryDocuments(getCollectionLink(), query, - options); - - Observable> firstPageObservable = queryObservable.first(); - TestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - firstPageObservable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - - FeedResponse firstPage = testSubscriber.getOnNextEvents().get(0); - requestContinuation = firstPage.getResponseContinuation(); - receivedDocuments.addAll(firstPage.getResults()); - continuationTokens.add(requestContinuation); - } while (requestContinuation != null); - - return receivedDocuments; - } - - private static Document getDocumentDefinition(String partitionKey, String id, Map keyValuePair) { - StringBuilder sb = new StringBuilder(); - sb.append("{\n"); - - for(String key: keyValuePair.keySet()) { - Object val = keyValuePair.get(key); - sb.append(" "); - sb.append("\"").append(key).append("\"").append(" :" ); - if (val == null) { - sb.append("null"); - } else { - sb.append(toJson(val)); - } - sb.append(",\n"); - } - - sb.append(String.format(" \"id\": \"%s\",\n", id)); - sb.append(String.format(" \"mypk\": \"%s\"\n", partitionKey)); - sb.append("}"); - - return new Document(sb.toString()); - } - - private static Document getDocumentDefinition(Map keyValuePair) { - String uuid = UUID.randomUUID().toString(); - return getDocumentDefinition(uuid, uuid, keyValuePair); - } - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - private static String toJson(Object object){ - try { - return com.microsoft.azure.cosmosdb.internal.Utils.getSimpleObjectMapper().writeValueAsString(object); - } catch (JsonProcessingException e) { - throw new IllegalStateException(e); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ParallelDocumentQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ParallelDocumentQueryTest.java deleted file mode 100644 index 14aacf69af53..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ParallelDocumentQueryTest.java +++ /dev/null @@ -1,438 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; - -import org.testng.SkipException; -import org.testng.annotations.DataProvider; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import com.microsoft.azure.cosmosdb.rx.internal.query.CompositeContinuationToken; - -import rx.Observable; -import rx.observers.TestSubscriber; - -import java.util.Map; - -public class ParallelDocumentQueryTest extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments; - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public ParallelDocumentQueryTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @DataProvider(name = "queryMetricsArgProvider") - public Object[][] queryMetricsArgProvider() { - return new Object[][]{ - {true}, - {false}, - }; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "queryMetricsArgProvider") - public void queryDocuments(boolean qmEnabled) { - String query = "SELECT * from c where c.prop = 99"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - options.setEnableCrossPartitionQuery(true); - options.setPopulateQueryMetrics(qmEnabled); - options.setMaxDegreeOfParallelism(2); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - List expectedDocs = createdDocuments.stream().filter(d -> 99 == d.getInt("prop") ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .hasValidQueryMetrics(qmEnabled) - .build(); - - try { - validateQuerySuccess(queryObservable, validator, TIMEOUT); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format(String.format("Direct TCP test failure: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel)); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryMetricEquality() throws Exception { - String query = "SELECT * from c where c.prop = 99"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - options.setEnableCrossPartitionQuery(true); - options.setPopulateQueryMetrics(true); - options.setMaxDegreeOfParallelism(0); - - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - List> resultList1 = queryObservable.toList().toBlocking().single(); - - options.setMaxDegreeOfParallelism(4); - Observable> threadedQueryObs = client.queryDocuments(getCollectionLink(), query, - options); - List> resultList2 = threadedQueryObs.toList().toBlocking().single(); - - assertThat(resultList1.size()).isEqualTo(resultList2.size()); - for(int i = 0; i < resultList1.size(); i++){ - compareQueryMetrics(resultList1.get(i).getQueryMetrics(), resultList2.get(i).getQueryMetrics()); - } - } - - private void compareQueryMetrics(Map qm1, Map qm2) { - assertThat(qm1.keySet().size()).isEqualTo(qm2.keySet().size()); - QueryMetrics queryMetrics1 = BridgeInternal.createQueryMetricsFromCollection(qm1.values()); - QueryMetrics queryMetrics2 = BridgeInternal.createQueryMetricsFromCollection(qm2.values()); - assertThat(queryMetrics1.getRetrievedDocumentSize()).isEqualTo(queryMetrics2.getRetrievedDocumentSize()); - assertThat(queryMetrics1.getRetrievedDocumentCount()).isEqualTo(queryMetrics2.getRetrievedDocumentCount()); - assertThat(queryMetrics1.getIndexHitDocumentCount()).isEqualTo(queryMetrics2.getIndexHitDocumentCount()); - assertThat(queryMetrics1.getOutputDocumentCount()).isEqualTo(queryMetrics2.getOutputDocumentCount()); - assertThat(queryMetrics1.getOutputDocumentSize()).isEqualTo(queryMetrics2.getOutputDocumentSize()); - assertThat(BridgeInternal.getClientSideMetrics(queryMetrics1).getRequestCharge()) - .isEqualTo(BridgeInternal.getClientSideMetrics(queryMetrics1).getRequestCharge()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocuments_NoResults() { - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPagesIsGreaterThanOrEqualTo(1) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .pageSizeIsLessThanOrEqualTo(0) - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // See: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @Test(groups = { "simple" }, timeOut = 2 * TIMEOUT) - public void queryDocumentsWithPageSize() { - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - int pageSize = 3; - options.setMaxItemCount(pageSize); - options.setMaxDegreeOfParallelism(-1); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - List expectedDocs = createdDocuments; - assertThat(expectedDocs).isNotEmpty(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(expectedDocs - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPagesIsGreaterThanOrEqualTo((expectedDocs.size() + 1) / 3) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0) - .pageSizeIsLessThanOrEqualTo(pageSize) - .build()) - .build(); - try { - validateQuerySuccess(queryObservable, validator, 2 * subscriberValidationTimeout); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySyntax() { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void crossPartitionQueryNotEnabled() { - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .build(); - validateQueryFailure(queryObservable, validator); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @Test(groups = { "simple" }, timeOut = 2 * TIMEOUT) - public void partitionKeyRangeId() { - int sum = 0; - try { - for (String partitionKeyRangeId : client.readPartitionKeyRanges(getCollectionLink(), null) - .flatMap(p -> Observable.from(p.getResults())) - .map(pkr -> pkr.getId()).toList().toBlocking().single()) { - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setPartitionKeyRangeIdInternal(partitionKeyRangeId); - int queryResultCount = client - .queryDocuments(getCollectionLink(), query, options) - .flatMap(p -> Observable.from(p.getResults())) - .toList().toBlocking().single().size(); - - sum += queryResultCount; - } - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - assertThat(sum).isEqualTo(createdDocuments.size()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void compositeContinuationTokenRoundTrip() throws Exception { - { - // Positive - CompositeContinuationToken compositeContinuationToken = new CompositeContinuationToken("asdf", - new Range("A", "D", false, true)); - String serialized = compositeContinuationToken.toString(); - ValueHolder outCompositeContinuationToken = new ValueHolder(); - boolean succeeed = CompositeContinuationToken.tryParse(serialized, outCompositeContinuationToken); - assertThat(succeeed).isTrue(); - CompositeContinuationToken deserialized = outCompositeContinuationToken.v; - String token = deserialized.getToken(); - Range range = deserialized.getRange(); - assertThat(token).isEqualTo("asdf"); - assertThat(range.getMin()).isEqualTo("A"); - assertThat(range.getMax()).isEqualTo("D"); - assertThat(range.isMinInclusive()).isEqualTo(false); - assertThat(range.isMaxInclusive()).isEqualTo(true); - } - - { - // Negative - ValueHolder outCompositeContinuationToken = new ValueHolder(); - boolean succeeed = CompositeContinuationToken.tryParse("{\"property\" : \"not a valid composite continuation token\"}", outCompositeContinuationToken); - assertThat(succeeed).isFalse(); - } - - { - // Negative - Gateway composite continuation token - ValueHolder outCompositeContinuationToken = new ValueHolder(); - boolean succeeed = CompositeContinuationToken.tryParse("{\"token\":\"-RID:tZFQAImzNLQLAAAAAAAAAA==#RT:1#TRC:10\",\"range\":{\"min\":\"\",\"max\":\"FF\"}}", outCompositeContinuationToken); - assertThat(succeeed).isFalse(); - } - } - - // TODO: This test has been timing out on build, related work item - https://msdata.visualstudio.com/CosmosDB/_workitems/edit/402438/ - @Test(groups = { "non-emulator" }, timeOut = TIMEOUT * 10) - public void queryDocumentsWithCompositeContinuationTokens() throws Exception { - String query = "SELECT * FROM c"; - - // Get Expected - List expectedDocs = createdDocuments - .stream() - .collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - this.queryWithContinuationTokensAndPageSizes(query, new int[] {1, 10, 100}, expectedDocs); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - // Notes: - // When I've watch this method execute in the debugger and seen that the code sometimes pauses for quite a while in - // the middle of the second group of 21 documents. I test against a debug instance of the public emulator and so - // what I'm seeing could be the result of a public emulator performance issue. Of course, it might also be the - // result of a Tcp protocol performance problem. - - @BeforeClass(groups = { "simple", "non-emulator" }, timeOut = 2 * SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION); - List docDefList = new ArrayList<>(); - for(int i = 0; i < 13; i++) { - docDefList.add(getDocumentDefinition(i)); - } - - for(int i = 0; i < 21; i++) { - docDefList.add(getDocumentDefinition(99)); - } - - createdDocuments = bulkInsertBlocking(client, getCollectionLink(), docDefList); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple", "non-emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Document getDocumentDefinition(int cnt) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"prop\" : %d, " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, cnt, uuid)); - return doc; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, enabled = false) - public void invalidQuerySytax() throws Exception { - - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client.queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder().instanceOf(DocumentClientException.class) - .statusCode(400).notNullActivityId().build(); - validateQueryFailure(queryObservable, validator); - } - - public Document createDocument(AsyncDocumentClient client, int cnt) throws DocumentClientException { - - Document docDefinition = getDocumentDefinition(cnt); - - return client.createDocument(getCollectionLink(), docDefinition, null, false).toBlocking().single() - .getResource(); - } - - private void queryWithContinuationTokensAndPageSizes(String query, int[] pageSizes, List expectedDocs) { - for (int pageSize : pageSizes) { - List receivedDocuments = this.queryWithContinuationTokens(query, pageSize); - List actualIds = new ArrayList(); - for (Document document : receivedDocuments) { - actualIds.add(document.getResourceId()); - } - - List expectedIds = new ArrayList(); - for (Document document : expectedDocs) { - expectedIds.add(document.getResourceId()); - } - - assertThat(actualIds).containsOnlyElementsOf(expectedIds); - } - } - - private List queryWithContinuationTokens(String query, int pageSize) { - String requestContinuation = null; - List continuationTokens = new ArrayList(); - List receivedDocuments = new ArrayList(); - do { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(pageSize); - options.setEnableCrossPartitionQuery(true); - options.setMaxDegreeOfParallelism(2); - options.setRequestContinuation(requestContinuation); - Observable> queryObservable = client.queryDocuments(getCollectionLink(), query, - options); - - Observable> firstPageObservable = queryObservable.first(); - TestSubscriber> testSubscriber = new TestSubscriber<>(); - firstPageObservable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - - FeedResponse firstPage = testSubscriber.getOnNextEvents().get(0); - requestContinuation = firstPage.getResponseContinuation(); - receivedDocuments.addAll(firstPage.getResults()); - continuationTokens.add(requestContinuation); - } while (requestContinuation != null); - - return receivedDocuments; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionCrudTest.java deleted file mode 100644 index 45c5132499c7..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionCrudTest.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.Document; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class PermissionCrudTest extends TestSuiteBase { - - private Database createdDatabase; - private User createdUser; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public PermissionCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createPermission() throws Exception { - - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - //create permission - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc="); - - - Observable> createObservable = client.createPermission(getUserLink(), permission, null); - - // validate permission creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(permission.getId()) - .withPermissionMode(PermissionMode.Read) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readPermission() throws Exception { - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - // create permission - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc="); - Permission readBackPermission = client.createPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - - // read Permission - Observable> readObservable = client.readPermission(readBackPermission.getSelfLink(), null); - - // validate permission read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(permission.getId()) - .withPermissionMode(PermissionMode.Read) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void deletePermission() throws Exception { - - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - // create permission - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc="); - Permission readBackPermission = client.createPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - - // delete - Observable> deleteObservable = client.deletePermission(readBackPermission.getSelfLink(), null); - - // validate delete permission - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - // attempt to read the permission which was deleted - Observable> readObservable = client.readPermission(readBackPermission.getSelfLink(), null); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, notFoundValidator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void upsertPermission() throws Exception { - - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - // create permission - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc="); - Permission readBackPermission = client.upsertPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - - // read Permission - Observable> readObservable = client.readPermission(readBackPermission.getSelfLink(), null); - - // validate permission creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackPermission.getId()) - .withPermissionMode(PermissionMode.Read) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update permission - readBackPermission.setPermissionMode(PermissionMode.All); - - Observable> updateObservable = client.upsertPermission(getUserLink(), readBackPermission, null); - - // validate permission update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackPermission.getId()) - .withPermissionMode(PermissionMode.All) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void replacePermission() throws Exception { - - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - // create permission - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc="); - Permission readBackPermission = client.createPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - - // read Permission - Observable> readObservable = client.readPermission(readBackPermission.getSelfLink(), null); - - // validate permission creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackPermission.getId()) - .withPermissionMode(PermissionMode.Read) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update permission - readBackPermission.setPermissionMode(PermissionMode.All); - - Observable> updateObservable = client.replacePermission(readBackPermission, null); - - // validate permission replace - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackPermission.getId()) - .withPermissionMode(PermissionMode.All) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - return user; - } - - private String getUserLink() { - return createdUser.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionQueryTest.java deleted file mode 100644 index f53e7da02ede..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionQueryTest.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.User; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class PermissionQueryTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private User createdUser; - private List createdPermissions = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public PermissionQueryTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithFilter() throws Exception { - - String filterId = createdPermissions.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryPermissions(getUserLink(), query, options); - - List expectedDocs = createdPermissions.stream().filter(sp -> filterId.equals(sp.getId()) ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator, TIMEOUT); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void query_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryPermissions(getUserLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAll() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(3); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryPermissions(getUserLink(), query, options); - - int expectedPageSize = (createdPermissions.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(createdPermissions - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryPermissions(getUserLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - Database d = new Database(); - d.setId(databaseId); - createdDatabase = createDatabase(client, d); - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - for(int i = 0; i < 5; i++) { - createdPermissions.add(createPermissions(client, i)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase); - safeClose(client); - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - return user; - } - - public Permission createPermissions(AsyncDocumentClient client, int index) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgT" + Integer.toString(index) + "="); - - return client.createPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - } - - private String getUserLink() { - return "dbs/" + getDatabaseId() + "/users/" + getUserId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } - - private String getUserId() { - return createdUser.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ProxyHostTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ProxyHostTest.java deleted file mode 100644 index f982df926d24..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ProxyHostTest.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.io.StringWriter; -import java.lang.reflect.Method; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.WriterAppender; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.rx.proxy.HttpProxyServer; - -import io.netty.handler.logging.LogLevel; -import io.netty.handler.logging.LoggingHandler; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This class help to test proxy host feature scenarios where user can provide proxy - * host server during AsyncDocumentClient initialization and all its request will - * go through that particular host. - * - */ -public class ProxyHostTest extends TestSuiteBase { - - private static Database createdDatabase; - private static DocumentCollection createdCollection; - - private AsyncDocumentClient client; - private final String PROXY_HOST = "localhost"; - private final int PROXY_PORT = 8080; - private HttpProxyServer httpProxyServer; - - public ProxyHostTest() { - this.clientBuilder = createGatewayRxDocumentClient(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION; - httpProxyServer = new HttpProxyServer(); - httpProxyServer.start(); - // wait for proxy server to be ready - TimeUnit.SECONDS.sleep(1); - } - - /** - * This test will try to create document via http proxy server and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithValidHttpProxy() throws Exception { - AsyncDocumentClient clientWithRightProxy = null; - try { - ConnectionPolicy connectionPolicy =new ConnectionPolicy(); - connectionPolicy.setProxy(PROXY_HOST, PROXY_PORT); - clientWithRightProxy = new Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = clientWithRightProxy - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - } finally { - safeClose(clientWithRightProxy); - } - } - - /** - * This test will try to create document via http proxy server with netty wire logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithValidHttpProxyWithNettyWireLogging() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(LogLevelTest.NETWORK_LOGGING_CATEGORY).setLevel(Level.TRACE); - AsyncDocumentClient clientWithRightProxy = null; - try { - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(LogLevelTest.NETWORK_LOGGING_CATEGORY).addAppender(appender); - - ConnectionPolicy connectionPolicy =new ConnectionPolicy(); - connectionPolicy.setProxy(PROXY_HOST, PROXY_PORT); - clientWithRightProxy = new Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = clientWithRightProxy - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).contains(LogLevelTest.LOG_PATTERN_1); - assertThat(consoleWriter.toString()).contains(LogLevelTest.LOG_PATTERN_2); - assertThat(consoleWriter.toString()).contains(LogLevelTest.LOG_PATTERN_3); - } finally { - safeClose(clientWithRightProxy); - } - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() throws Exception { - safeClose(client); - httpProxyServer.shutDown(); - // wait for proxy server to be shutdown - TimeUnit.SECONDS.sleep(1); - - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - @BeforeMethod(groups = { "simple"}) - public void beforeMethod() { - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - @AfterMethod(groups = { "simple" }) - public void afterMethod(Method method) { - super.beforeMethod(method); - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedAttachmentsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedAttachmentsTest.java deleted file mode 100644 index bf61c7d7414a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedAttachmentsTest.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.io.IOUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.MediaOptions; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; - -import rx.Observable; -import rx.observers.TestSubscriber; - -import javax.net.ssl.SSLException; - -public class ReadFeedAttachmentsTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private Document createdDocument; - - private AsyncDocumentClient client; - - private PartitionKey pk; - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedAttachmentsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = 30000000) - public void readExternalAttachments() throws Exception { - createdDocument = createDocument(client, createdDatabase.getId(), - createdCollection.getId(), getDocumentDefinition()); - - List createdAttachments = new ArrayList<>(); - for(int i = 0; i < 5; i++) { - createdAttachments.add(createAttachments(client)); - } - waitIfNeededForReplicasToCatchUp(clientBuilder); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - options.setPartitionKey(pk); - - Observable> feedObservable = client.readAttachments(getDocumentLink(), options); - - int expectedPageSize = (createdAttachments.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .totalSize(createdAttachments.size()) - .exactlyContainsInAnyOrder(createdAttachments - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - //@Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readAndUpdateEmbededAttachments() throws Exception { - createdDocument = createDocument(client, createdDatabase.getId(), - createdCollection.getId(), getDocumentDefinition()); - - FeedOptions feedOptions = new FeedOptions(); - feedOptions.setMaxItemCount(1); - feedOptions.setPartitionKey(pk); - String documentLink = "dbs/" + getDatabaseId() + "/colls/" + getCollectionId() + "/docs/" + getDocumentId(); - - MediaOptions options = new MediaOptions(); - options.setContentType("application/octet-stream"); - - RequestOptions reqOptions = new RequestOptions(); - reqOptions.setPartitionKey(pk); - - - try(InputStream ipStream = getMedia1Stream()) { - TestSubscriber> subscriber = new TestSubscriber<>(); - client.createAttachment(documentLink, ipStream, options, reqOptions) - .toBlocking() - .subscribe(subscriber); - subscriber.assertNoErrors(); - } - - try(InputStream ipStream = getMedia1Stream()) { - validateReadEmbededAttachment(documentLink, ipStream, feedOptions); - } - - validateUpdateEmbededAttachment(documentLink, options, feedOptions); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private void validateUpdateEmbededAttachment(String documentLink, MediaOptions mediaOptions, FeedOptions feedOptions) throws Exception { - String mediaLink = client.readAttachments(documentLink, feedOptions) - .map( response -> response.getResults().iterator().next().getMediaLink()) - .toBlocking() - .first(); - - try (InputStream ipStream = getMedia2Stream()) { - client.updateMedia(mediaLink, ipStream, mediaOptions) - .toBlocking().first(); - } - - try (InputStream ipStream = getMedia2Stream()) { - validateReadEmbededAttachment(documentLink, ipStream, feedOptions); - } - } - - private void validateReadEmbededAttachment(String documentLink, InputStream ipStream, FeedOptions feedOptions) { - TestSubscriber subscriber = new TestSubscriber<>(); - client.readAttachments(documentLink, feedOptions) - .map( response -> response.getResults().iterator().next().getMediaLink()) - .flatMap(mediaLink -> client.readMedia(mediaLink)) - .map(mediaResponse -> { - - try(InputStream responseMediaStream = mediaResponse.getMedia()) { - return IOUtils.contentEquals(ipStream, responseMediaStream); - } catch (IOException e) { - return false; - } - }) - .filter(x -> x) // Filter only right extractions back - .toBlocking() - .subscribe(subscriber); - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - subscriber.assertValueCount(1); - } - - private InputStream getMedia1Stream() - { - return this.getClass().getResourceAsStream("/cosmosdb-1.png"); - } - - private InputStream getMedia2Stream() - { - return this.getClass().getResourceAsStream("/Microsoft.jpg"); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } - - private String getDocumentId() { - return createdDocument.getId(); - } - - public Attachment createAttachments(AsyncDocumentClient client) { - Attachment attachment = getAttachmentDefinition(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(pk); - return client.createAttachment(getDocumentLink(), attachment, options).toBlocking().single().getResource(); - } - - public String getDocumentLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId() + "/docs/" + getDocumentId(); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - pk = new PartitionKey(uuid); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - private static Attachment getAttachmentDefinition() { - String uuid = UUID.randomUUID().toString(); - String type = "application/text"; - return new Attachment(String.format( - "{" + - " 'id': '%s'," + - " 'media': 'http://xstore.'," + - " 'MediaType': 'Book'," + - " 'Author': 'My Book Author'," + - " 'Title': 'My Book Title'," + - " 'contentType': '%s'" + - "}", uuid, type)); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedCollectionsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedCollectionsTest.java deleted file mode 100644 index fb3c735ea867..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedCollectionsTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedCollectionsTest extends TestSuiteBase { - - protected static final int FEED_TIMEOUT = 60000; - protected static final int SETUP_TIMEOUT = 60000; - protected static final int SHUTDOWN_TIMEOUT = 20000; - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private List createdCollections = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public ReadFeedCollectionsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readCollections() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readCollections(getDatabaseLink(), options); - - int expectedPageSize = (createdCollections.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(createdCollections.size()) - .exactlyContainsInAnyOrder(createdCollections.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = createDatabase(client, databaseId); - - for(int i = 0; i < 3; i++) { - createdCollections.add(createCollections(client)); - } - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase); - safeClose(client); - } - - public DocumentCollection createCollections(AsyncDocumentClient client) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - return client.createCollection(getDatabaseLink(), collection, null).toBlocking().single().getResource(); - } - - private String getDatabaseLink() { - return "dbs/" + createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDatabasesTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDatabasesTest.java deleted file mode 100644 index 823118868ec5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDatabasesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedDatabasesTest extends TestSuiteBase { - - private List createdDatabases = new ArrayList<>(); - private List allDatabases = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public ReadFeedDatabasesTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readDatabases() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readDatabases(options); - - int expectedPageSize = (allDatabases.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(allDatabases.size()) - .exactlyContainsInAnyOrder(allDatabases.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws URISyntaxException { - client = clientBuilder.build(); - allDatabases = client.readDatabases(null) - .map(frp -> frp.getResults()) - .toList() - .map(list -> list.stream().flatMap(x -> x.stream()).collect(Collectors.toList())) - .toBlocking() - .single(); - for(int i = 0; i < 5; i++) { - createdDatabases.add(createDatabase(client)); - } - allDatabases.addAll(createdDatabases); - } - - public Database createDatabase(AsyncDocumentClient client) { - Database db = new Database(); - db.setId(UUID.randomUUID().toString()); - return client.createDatabase(db, null).toBlocking().single().getResource(); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - for (int i = 0; i < 5; i ++) { - safeDeleteDatabase(client, createdDatabases.get(i).getId()); - } - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDocumentsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDocumentsTest.java deleted file mode 100644 index fd59b372ffe6..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDocumentsTest.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -public class ReadFeedDocumentsTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedDocumentsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readDocuments() { - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readDocuments(getCollectionLink(), options); - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(createdDocuments.size()) - .numberOfPagesIsGreaterThanOrEqualTo(1) - .exactlyContainsInAnyOrder(createdDocuments.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0) - .pageSizeIsLessThanOrEqualTo(options.getMaxItemCount()) - .build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readDocuments_withoutEnableCrossPartitionQuery() { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readDocuments(getCollectionLink(), options); - FailureValidator validator = FailureValidator.builder().instanceOf(DocumentClientException.class) - .statusCode(400) - .errorMessageContains("Cross partition query is required but disabled." + - " Please set x-ms-documentdb-query-enablecrosspartition to true," + - " specify x-ms-documentdb-partitionkey," + - " or revise your query to avoid this exception.") - .build(); - validateQueryFailure(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT, alwaysRun = true) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION); - List docDefList = new ArrayList<>(); - - for(int i = 0; i < 100; i++) { - docDefList.add(getDocumentDefinition()); - } - - createdDocuments = bulkInsertBlocking(client, getCollectionLink(), docDefList); - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - public String getCollectionLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId(); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedExceptionHandlingTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedExceptionHandlingTest.java deleted file mode 100644 index 044d2a6e9910..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedExceptionHandlingTest.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.concurrent.CountDownLatch; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import org.mockito.Mockito; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.BridgeUtils; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedResponse; - -import rx.Observable; -import rx.Subscriber; - - -public class ReadFeedExceptionHandlingTest extends TestSuiteBase { - - public class ExceptionSubscriber extends Subscriber> { - - public int onNextCount; - CountDownLatch latch = new CountDownLatch(1); - public ExceptionSubscriber() { - onNextCount = 0; - } - - @Override - public void onCompleted() { - latch.countDown(); - } - - @Override - public void onError(Throwable e) { - DocumentClientException exception = (DocumentClientException) e; - assertThat(exception).isNotNull(); - assertThat(exception.getStatusCode()).isEqualTo(0); - latch.countDown(); - } - - @Override - public void onNext(FeedResponse page) { - assertThat(page.getResults().size()).isEqualTo(2); - onNextCount ++; - } - } - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedExceptionHandlingTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readFeedException() throws Exception { - - ArrayList dbs = new ArrayList(); - dbs.add(new Database()); - dbs.add(new Database()); - - ArrayList> frps = new ArrayList>(); - frps.add(BridgeInternal.createFeedResponse(dbs, null)); - frps.add(BridgeInternal.createFeedResponse(dbs, null)); - - Observable> response = Observable.from(frps) - .concatWith(Observable.error(new DocumentClientException(0))) - .concatWith(Observable.from(frps)); - - final AsyncDocumentClient mockClient = Mockito.spy(client); - Mockito.when(mockClient.readDatabases(null)).thenReturn(response); - ExceptionSubscriber subscriber = new ExceptionSubscriber(); - mockClient.readDatabases(null).subscribe(subscriber); - subscriber.latch.await(); - assertThat(subscriber.onNextCount).isEqualTo(2); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(this.client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedOffersTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedOffersTest.java deleted file mode 100644 index 7b7e46d9dd01..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedOffersTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Offer; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedOffersTest extends TestSuiteBase { - - protected static final int FEED_TIMEOUT = 60000; - protected static final int SETUP_TIMEOUT = 60000; - protected static final int SHUTDOWN_TIMEOUT = 20000; - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private List allOffers = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public ReadFeedOffersTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = FEED_TIMEOUT) - public void readOffers() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readOffers(options); - - int expectedPageSize = (allOffers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(allOffers.size()) - .exactlyContainsInAnyOrder(allOffers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = createDatabase(client, databaseId); - - for(int i = 0; i < 3; i++) { - createCollections(client); - } - - allOffers = client.readOffers(null) - .map(frp -> frp.getResults()) - .toList() - .map(list -> list.stream().flatMap(x -> x.stream()).collect(Collectors.toList())) - .toBlocking() - .single(); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase); - safeClose(client); - } - - public DocumentCollection createCollections(AsyncDocumentClient client) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - return client.createCollection(getDatabaseLink(), collection, null).toBlocking().single().getResource(); - } - - private String getDatabaseLink() { - return "dbs/" + createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPermissionsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPermissionsTest.java deleted file mode 100644 index 6959a305bd5c..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPermissionsTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.User; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedPermissionsTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private User createdUser; - private List createdPermissions = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public ReadFeedPermissionsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readPermissions() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readPermissions(getUserLink(), options); - - int expectedPageSize = (createdPermissions.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(createdPermissions.size()) - .numberOfPages(expectedPageSize) - .exactlyContainsInAnyOrder(createdPermissions.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - Database d = new Database(); - d.setId(databaseId); - createdDatabase = createDatabase(client, d); - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - for(int i = 0; i < 5; i++) { - createdPermissions.add(createPermissions(client, i)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - return user; - } - - public Permission createPermissions(AsyncDocumentClient client, int index) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgT" + Integer.toString(index) + "="); - return client.createPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - } - - private String getUserLink() { - return "dbs/" + getDatabaseId() + "/users/" + getUserId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } - - private String getUserId() { - return createdUser.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPkrTests.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPkrTests.java deleted file mode 100644 index 6fbd5e74ad5a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPkrTests.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import javax.net.ssl.SSLException; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; - -import rx.Observable; - -public class ReadFeedPkrTests extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedPkrTests(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = FEED_TIMEOUT) - public void readPartitionKeyRanges() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readPartitionKeyRanges(getCollectionLink(), options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(1) - .numberOfPages(1) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - createdCollection = createCollection(createdDatabase.getId(), - getCollectionDefinition(), - null); - client = clientBuilder.build(); - } - - @AfterClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteCollection(client, createdCollection); - safeClose(client); - } - - private String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedStoredProceduresTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedStoredProceduresTest.java deleted file mode 100644 index 0f7d2aa156ea..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedStoredProceduresTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedStoredProceduresTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdStoredProcedures = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedStoredProceduresTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readStoredProcedures() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readStoredProcedures(getCollectionLink(), options); - - int expectedPageSize = (createdStoredProcedures.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .totalSize(createdStoredProcedures.size()) - .exactlyContainsInAnyOrder(createdStoredProcedures - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdStoredProcedures.add(createStoredProcedures(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - public StoredProcedure createStoredProcedures(AsyncDocumentClient client) { - StoredProcedure sproc = new StoredProcedure(); - sproc.setId(UUID.randomUUID().toString()); - sproc.setBody("function() {var x = 10;}"); - return client.createStoredProcedure(getCollectionLink(), sproc, null).toBlocking().single().getResource(); - } - - private String getCollectionLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId(); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedTriggersTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedTriggersTest.java deleted file mode 100644 index 2b2c40780718..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedTriggersTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.TriggerOperation; -import com.microsoft.azure.cosmosdb.TriggerType; - -import rx.Observable; - -public class ReadFeedTriggersTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdTriggers = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedTriggersTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readTriggers() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readTriggers(getCollectionLink(), options); - - int expectedPageSize = (createdTriggers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .totalSize(createdTriggers.size()) - .exactlyContainsInAnyOrder(createdTriggers - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - - this.client = clientBuilder.build(); - this.createdDatabase = SHARED_DATABASE; - this.createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - this.truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - this.createdTriggers.add(this.createTriggers(client)); - } - - this.waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - public Trigger createTriggers(AsyncDocumentClient client) { - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - return client.createTrigger(getCollectionLink(), trigger, null).toBlocking().single().getResource(); - } - - private String getCollectionLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId(); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUdfsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUdfsTest.java deleted file mode 100644 index 4bd2ccbbbfde..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUdfsTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedUdfsTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdUserDefinedFunctions = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedUdfsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readUserDefinedFunctions() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readUserDefinedFunctions(getCollectionLink(), options); - - int expectedPageSize = (createdUserDefinedFunctions.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .totalSize(createdUserDefinedFunctions.size()) - .exactlyContainsInAnyOrder(createdUserDefinedFunctions - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdUserDefinedFunctions.add(createUserDefinedFunctions(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - public UserDefinedFunction createUserDefinedFunctions(AsyncDocumentClient client) { - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - return client.createUserDefinedFunction(getCollectionLink(), udf, null).toBlocking().single().getResource(); - } - - private String getCollectionLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId(); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUsersTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUsersTest.java deleted file mode 100644 index 68186ec977d5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUsersTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.User; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedUsersTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - private Database createdDatabase; - - private AsyncDocumentClient client; - private List createdUsers = new ArrayList<>(); - - @Factory(dataProvider = "clientBuilders") - public ReadFeedUsersTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readUsers() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readUsers(getDatabaseLink(), options); - - int expectedPageSize = (createdUsers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(createdUsers.size()) - .exactlyContainsInAnyOrder(createdUsers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - Database d = new Database(); - d.setId(databaseId); - createdDatabase = createDatabase(client, d); - - for(int i = 0; i < 5; i++) { - createdUsers.add(createUsers(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase.getId()); - safeClose(client); - } - - public User createUsers(AsyncDocumentClient client) { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - return client.createUser(getDatabaseLink(), user, null).toBlocking().single().getResource(); - } - - private String getDatabaseLink() { - return "dbs/" + createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ResourceTokenTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ResourceTokenTest.java deleted file mode 100644 index c5587f7b7482..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ResourceTokenTest.java +++ /dev/null @@ -1,547 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.apache.commons.lang3.StringUtils; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; - -import rx.Observable; - -/** - * This class try to test different scenario related to fetching various - * resources from resource token directly or via permission feed . - * - */ -public class ResourceTokenTest extends TestSuiteBase { - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private DocumentCollection createdCollection; - private DocumentCollection createdCollectionWithPartitionKey; - private Document createdDocument; - private Document createdDocumentWithPartitionKey; - private Document createdDocumentWithPartitionKey2; - private User createdUser; - private Permission createdCollPermission; - private Permission createdCollPermissionWithName; - private Permission createdDocPermission; - private Permission createdDocPermissionWithName; - private Permission createdDocPermissionWithPartitionKey; - private Permission createdDocPermissionWithPartitionKeyWithName; - private Permission createdDocPermissionWithPartitionKey2; - private Permission createdDocPermissionWithPartitionKey2WithName; - private Permission createdColPermissionWithPartitionKey; - private Permission createdColPermissionWithPartitionKeyWithName; - private Permission createdColPermissionWithPartitionKey2; - private Permission createdColPermissionWithPartitionKey2WithName; - - private AsyncDocumentClient client; - - // All static string used in below test cases - private final static String DOCUMENT_DEFINITION = "{ 'id': 'doc%d', 'counter': '%d'}"; - private final static String DOCUMENT_DEFINITION_WITH_PERMISSION_KEY = "{ " + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" + "}"; - private final static String PARTITION_KEY_PATH = "/mypk"; - - private static final String PARTITION_KEY_VALUE = "1"; - private static final String PARTITION_KEY_VALUE_2 = "2"; - private static final String PERMISSION_DEFINITION = "{" + " 'id': 'PermissionForDocWithPartitionKey'," - + " 'permissionMode': 'read'," + " 'resource': '%s'," + " 'resourcePartitionKey': ['%s']" + "}"; - private static final String COLLECTION_PERMISSION_DEFINITION = "{" + " 'id': 'PermissionForColWithPartitionKey'," - + " 'permissionMode': 'read'," + " 'resource': '%s'," + " 'resourcePartitionKey': ['%s']" + "}"; - private static final String USER_NAME = "TestUser"; - private static final String PERMISSION_FOR_COLL = "PermissionForColl"; - private static final String PERMISSION_FOR_COLL_WITH_NAME = "PermissionForCollWithName"; - private static final String PERMISSION_FOR_DOC = "PermissionForDoc"; - private static final String PERMISSION_FOR_DOC_WITH_NAME = "PermissionForDocWithName"; - - @Factory(dataProvider = "clientBuilders") - public ResourceTokenTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - Database d = new Database(); - d.setId(databaseId); - createdDatabase = createDatabase(client, d); - // Create collection - createdCollection = createCollection(client, createdDatabase.getId(), getCollectionDefinition()); - // Create document - createdDocument = createDocument(client, createdDatabase.getId(),createdCollection.getId(), getDocument()); - // Create collection with partition key - createdCollectionWithPartitionKey = createCollection(client, createdDatabase.getId(), getCollectionDefinitionWithPartitionKey()); - // Create document with partition key - createdDocumentWithPartitionKey = createDocument(client, createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), - getDocumentDefinitionWithPartitionKey()); - // Create second document with partition key - createdDocumentWithPartitionKey2 = createDocument(client, createdDatabase.getId(),createdCollectionWithPartitionKey.getId(), - getDocumentDefinitionWithPartitionKey2()); - // Create user - createdUser = createUser(client, createdDatabase.getId(), getUserDefinition()); - // Create permission for collection - createdCollPermission = client.createPermission(getUserLink(), getCollPermission(), null).toBlocking().single() - .getResource(); - createdCollPermissionWithName = client.createPermission(getUserLink(), getCollPermissionWithName(), null).toBlocking().single() - .getResource(); - // Create permission for document - createdDocPermission = client.createPermission(getUserLink(), getDocPermission(), null).toBlocking().single() - .getResource(); - createdDocPermissionWithName = client.createPermission(getUserLink(), getDocPermissionWithName(), null).toBlocking().single() - .getResource(); - // Create permission for document with partition key - createdDocPermissionWithPartitionKey = client - .createPermission(getUserLink(), getDocPermissionWithPartitionKey(), null).toBlocking().single() - .getResource(); - createdDocPermissionWithPartitionKeyWithName = client - .createPermission(getUserLink(), getDocPermissionWithPartitionKeyWithName(), null).toBlocking().single() - .getResource(); - // Create permission for document with partition key 2 - createdDocPermissionWithPartitionKey2 = client - .createPermission(getUserLink(), getDocPermissionWithPartitionKey2(), null).toBlocking().single() - .getResource(); - createdDocPermissionWithPartitionKey2WithName = client - .createPermission(getUserLink(), getDocPermissionWithPartitionKey2WithName(), null).toBlocking().single() - .getResource(); - // Create permission for collection with partition key - createdColPermissionWithPartitionKey = client - .createPermission(getUserLink(), getColPermissionWithPartitionKey(), null).toBlocking().single() - .getResource(); - createdColPermissionWithPartitionKeyWithName = client - .createPermission(getUserLink(), getColPermissionWithPartitionKeyWithName(), null).toBlocking().single() - .getResource(); - // Create permission for collection with partition key - createdColPermissionWithPartitionKey2 = client - .createPermission(getUserLink(), getColPermissionWithPartitionKey2(), null).toBlocking().single() - .getResource(); - createdColPermissionWithPartitionKey2WithName = client - .createPermission(getUserLink(), getColPermissionWithPartitionKey2WithName(), null).toBlocking().single() - .getResource(); - } - - @DataProvider(name = "collectionAndPermissionData") - public Object[][] collectionAndPermissionData() { - return new Object[][]{ - //This test will try to read collection from its own permission and validate it, both with request Id and name. - {createdCollection.getSelfLink(), createdCollPermission}, - {Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()), createdDocPermissionWithName}, - }; - } - - @DataProvider(name = "documentAndPermissionData") - public Object[][] documentAndPermissionData() { - return new Object[][]{ - //These tests will try to read document from its own permission and validate it, both with request Id and name. - {createdDocument.getSelfLink(), createdDocPermission, createdDocument.getId(), null}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollection.getId(), createdDocument.getId()), createdDocPermissionWithName, createdDocument.getId(), null}, - - //These tests will try to read document from its permission having partition key 1 and validate it, both with request Id and name. - {createdDocumentWithPartitionKey.getSelfLink(), createdDocPermissionWithPartitionKey, createdDocumentWithPartitionKey.getId(), PARTITION_KEY_VALUE}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey.getId()), createdDocPermissionWithPartitionKeyWithName - , createdDocumentWithPartitionKey.getId(), PARTITION_KEY_VALUE}, - - //These tests will try to read document from its permission having partition key 2 and validate it, both with request Id and name. - {createdDocumentWithPartitionKey2.getSelfLink(), createdDocPermissionWithPartitionKey2, createdDocumentWithPartitionKey2.getId(), PARTITION_KEY_VALUE_2}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey2.getId()), - createdDocPermissionWithPartitionKey2WithName, createdDocumentWithPartitionKey2.getId(), PARTITION_KEY_VALUE_2}, - - // These tests will try to read document from its parent collection permission and validate it, both with request Id and name. - {createdDocument.getSelfLink(), createdCollPermission, createdDocument.getId(), null}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollection.getId(), createdDocument.getId()), createdCollPermissionWithName, createdDocument.getId(), null}, - - //This test will try to read document from collection permission having partition key 1 and validate it, both with request Id and name. - {createdDocumentWithPartitionKey.getSelfLink(), createdColPermissionWithPartitionKey, createdDocumentWithPartitionKey.getId(), PARTITION_KEY_VALUE}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey.getId()), createdColPermissionWithPartitionKeyWithName, createdDocumentWithPartitionKey.getId(), PARTITION_KEY_VALUE}, - - //This test will try to read document from collection permission having partition key 2 and validate it, both with request Id and name. - {createdDocumentWithPartitionKey2.getSelfLink(), createdColPermissionWithPartitionKey2, createdDocumentWithPartitionKey2.getId(), PARTITION_KEY_VALUE_2}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey2.getId()), createdColPermissionWithPartitionKey2WithName, createdDocumentWithPartitionKey2.getId(), PARTITION_KEY_VALUE_2} - - }; - } - - @DataProvider(name = "documentAndPermissionDataForResourceNotFound") - public Object[][] documentAndPermissionDataForResourceNotFound() { - return new Object[][]{ - //This test will try to read document from its resource token directly and validate it. - {createdDocumentWithPartitionKey2.getSelfLink(), createdColPermissionWithPartitionKey, PARTITION_KEY_VALUE}, - //This test will try to read document from its parent collection resource token directly and validate it. - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey2.getId()), - createdColPermissionWithPartitionKeyWithName, PARTITION_KEY_VALUE} - }; - } - - @DataProvider(name = "documentAndMultipleCollPermissionData") - public Object[][] documentAndMultipleCollPermissionData() { - return new Object[][]{ - //These tests will try to read document from partition 1 with two collection permissions having different partition keys and validate it, both with request Id and name. - {createdDocumentWithPartitionKey.getSelfLink(), createdColPermissionWithPartitionKey, createdColPermissionWithPartitionKey2, createdDocumentWithPartitionKey.getId(), - PARTITION_KEY_VALUE}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey.getId()), createdColPermissionWithPartitionKeyWithName - , createdColPermissionWithPartitionKey2WithName, createdDocumentWithPartitionKey.getId(), PARTITION_KEY_VALUE}, - - //These tests will try to read document from partition 1 with two collection permissions having different partition keys and validate it, both with request Id and name. - {createdDocumentWithPartitionKey2.getSelfLink(), createdColPermissionWithPartitionKey, createdColPermissionWithPartitionKey2, createdDocumentWithPartitionKey2.getId(), - PARTITION_KEY_VALUE_2}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey2.getId()), createdColPermissionWithPartitionKeyWithName - , createdColPermissionWithPartitionKey2WithName, createdDocumentWithPartitionKey2.getId(), PARTITION_KEY_VALUE_2} - }; - } - - @DataProvider(name = "resourceToken") - public Object[][] resourceToken() { - return new Object[][]{ - //This test will try to read document from its resource token directly and validate it. - {createdDocPermission.getToken()}, - //This test will try to read document from its parent collection resource token directly and validate it. - {createdCollPermission.getToken()} - }; - } - - /** - * This test will try to read collection from permission and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, dataProvider = "collectionAndPermissionData", timeOut = TIMEOUT) - public void readCollectionFromPermissionFeed(String collectionUrl, Permission permission) throws Exception { - AsyncDocumentClient asyncClientResourceToken = null ; - try { - List permissionFeed = new ArrayList<>(); - permissionFeed.add(permission); - asyncClientResourceToken = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withPermissionFeed(permissionFeed).withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - Observable> readObservable = asyncClientResourceToken - .readCollection(collectionUrl, null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(createdCollection.getId()).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - /** - * This test will try to read document from permission and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, dataProvider = "documentAndPermissionData", timeOut = TIMEOUT) - public void readDocumentFromPermissionFeed(String documentUrl, Permission permission, String documentId, String partitionKey) throws Exception { - AsyncDocumentClient asyncClientResourceToken = null; - try { - List permissionFeed = new ArrayList<>(); - permissionFeed.add(permission); - asyncClientResourceToken = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withPermissionFeed(permissionFeed).withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - RequestOptions options = null; - if(StringUtils.isNotEmpty(partitionKey)) { - options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(partitionKey)); - } - Observable> readObservable = asyncClientResourceToken - .readDocument(documentUrl, options); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(documentId).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - /** - * This test will try to read document from resource token directly and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, dataProvider = "resourceToken", timeOut = TIMEOUT) - public void readDocumentFromResouceToken(String resourceToken) throws Exception { - AsyncDocumentClient asyncClientResourceToken = null; - try { - asyncClientResourceToken = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(resourceToken) - .withConnectionPolicy(ConnectionPolicy.GetDefault()).withConsistencyLevel(ConsistencyLevel.Session) - .build(); - Observable> readObservable = asyncClientResourceToken - .readDocument(createdDocument.getSelfLink(), null); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(createdDocument.getId()).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - /** - * This test will try to read document from multiple collection permissions having different keys and validate it. - * - * @throws Exception - */ - @Test(groups = {"simple"}, dataProvider = "documentAndMultipleCollPermissionData", timeOut = TIMEOUT) - public void readDocumentOfParKeyFromTwoCollPermissionWithDiffPartitionKeys(String documentUrl, Permission collPermission1, Permission collPermission2, String documentId, String partitionKey) throws Exception { - AsyncDocumentClient asyncClientResourceToken = null; - try { - List permissionFeed = new ArrayList<>(); - permissionFeed.add(collPermission1); - permissionFeed.add(collPermission2); - asyncClientResourceToken = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withPermissionFeed(permissionFeed).withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(partitionKey)); - Observable> readObservable = asyncClientResourceToken - .readDocument(documentUrl, options); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(documentId).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - /** - * This test will try to read document with wrong collection permission hence - * expecting resource not found failure. - * - * @throws Exception - */ - @Test(groups = { "simple" },dataProvider = "documentAndPermissionDataForResourceNotFound", timeOut = TIMEOUT) - public void readDocumentFromCollPermissionWithDiffPartitionKey_ResourceNotFound(String documentUrl, Permission permission, String partitionKey) throws Exception { - AsyncDocumentClient asyncClientResourceToken = null; - try { - List permissionFeed = new ArrayList<>(); - permissionFeed.add(permission); - asyncClientResourceToken = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withPermissionFeed(permissionFeed).withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(partitionKey)); - Observable> readObservable = asyncClientResourceToken - .readDocument(documentUrl, options); - FailureValidator validator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - /** - * This test will try to read document with collection permissions and passing wrong partitionkey - * in request options hence expecting exception. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readDocumentFromCollPermissionWithDiffPartitionKey_WithException() throws Exception { - AsyncDocumentClient asyncClientResourceToken = null; - try { - List permissionFeed = new ArrayList<>(); - permissionFeed.add(createdColPermissionWithPartitionKey); - asyncClientResourceToken = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session) - .withPermissionFeed(permissionFeed) - .build(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(PARTITION_KEY_VALUE_2)); - Observable> readObservable = asyncClientResourceToken - .readDocument(createdDocumentWithPartitionKey.getSelfLink(), options); - FailureValidator validator = new FailureValidator.Builder().resourceTokenNotFound().build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(USER_NAME); - return user; - } - - private static Document getDocument() { - Document doc = new Document(String.format(DOCUMENT_DEFINITION, 1, 1)); - return doc; - } - - private Permission getCollPermission() { - Permission permission = new Permission(); - permission.setId(PERMISSION_FOR_COLL); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink(createdCollection.getSelfLink()); - return permission; - } - - private Permission getCollPermissionWithName() { - Permission permission = new Permission(); - permission.setId(PERMISSION_FOR_COLL_WITH_NAME); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink(Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId())); - return permission; - } - - private Permission getDocPermission() { - Permission permission = new Permission(); - permission.setId(PERMISSION_FOR_DOC); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink(createdDocument.getSelfLink()); - return permission; - } - private Permission getDocPermissionWithName() { - Permission permission = new Permission(); - permission.setId(PERMISSION_FOR_DOC_WITH_NAME); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink(Utils.getDocumentNameLink(createdDatabase.getId(),createdCollection.getId(),createdDocument.getId())); - return permission; - } - - private Permission getDocPermissionWithPartitionKey() { - String permissionStr = String.format(PERMISSION_DEFINITION, createdDocumentWithPartitionKey.getSelfLink(), - PARTITION_KEY_VALUE); - Permission permission = new Permission(permissionStr); - return permission; - } - - private Permission getDocPermissionWithPartitionKeyWithName() { - String permissionStr = String.format(PERMISSION_DEFINITION, Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey.getId()), - PARTITION_KEY_VALUE); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForDocWithPartitionKeyWithName"); - return permission; - } - - private Permission getDocPermissionWithPartitionKey2() { - String permissionStr = String.format(PERMISSION_DEFINITION, createdDocumentWithPartitionKey2.getSelfLink(), - PARTITION_KEY_VALUE_2); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForDocWithPartitionKey2"); - return permission; - } - - private Permission getDocPermissionWithPartitionKey2WithName() { - String permissionStr = String.format(PERMISSION_DEFINITION, Utils.getDocumentNameLink(createdDatabase.getId(),createdCollectionWithPartitionKey.getId(),createdDocumentWithPartitionKey2.getId()), - PARTITION_KEY_VALUE_2); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForDocWithPartitionKey2WithName"); - return permission; - } - - private Permission getColPermissionWithPartitionKey() { - String permissionStr = String.format(COLLECTION_PERMISSION_DEFINITION, createdCollectionWithPartitionKey.getSelfLink(), - PARTITION_KEY_VALUE); - Permission permission = new Permission(permissionStr); - return permission; - } - - private Permission getColPermissionWithPartitionKeyWithName() { - String permissionStr = String.format(COLLECTION_PERMISSION_DEFINITION, Utils.getCollectionNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId()), - PARTITION_KEY_VALUE); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForColWithPartitionKeyWithName"); - return permission; - } - - private Permission getColPermissionWithPartitionKey2() { - String permissionStr = String.format(COLLECTION_PERMISSION_DEFINITION, createdCollectionWithPartitionKey.getSelfLink(), - PARTITION_KEY_VALUE_2); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForColWithPartitionKey2"); - return permission; - } - - private Permission getColPermissionWithPartitionKey2WithName() { - String permissionStr = String.format(COLLECTION_PERMISSION_DEFINITION, Utils.getCollectionNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId()), - PARTITION_KEY_VALUE_2); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForColWithPartitionKey2WithName"); - return permission; - } - - private String getUserLink() { - return createdUser.getSelfLink(); - } - - static protected DocumentCollection getCollectionDefinition() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - return collectionDefinition; - } - - private Document getDocumentDefinitionWithPartitionKey() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format(DOCUMENT_DEFINITION_WITH_PERMISSION_KEY, uuid, PARTITION_KEY_VALUE)); - return doc; - } - private Document getDocumentDefinitionWithPartitionKey2() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format(DOCUMENT_DEFINITION_WITH_PERMISSION_KEY, uuid, PARTITION_KEY_VALUE_2)); - return doc; - } - - private DocumentCollection getCollectionDefinitionWithPartitionKey() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add(PARTITION_KEY_PATH); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SimpleSerializationTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SimpleSerializationTest.java deleted file mode 100644 index 338f5b7004c7..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SimpleSerializationTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import org.apache.commons.lang3.NotImplementedException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.io.IOException; -import java.time.Instant; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; - -public class SimpleSerializationTest extends TestSuiteBase { - - private DocumentCollection createdCollection; - private AsyncDocumentClient client; - - private static class TestObject { - public static class BadSerializer extends JsonSerializer { - @Override - public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) { - throw new NotImplementedException("bad"); - } - } - - @JsonProperty("mypk") - private String mypk; - - @JsonProperty("id") - private String id; - - @JsonProperty("prop") - @JsonSerialize(using = BadSerializer.class) - private String prop; - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public SimpleSerializationTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = {"simple"}, timeOut = TIMEOUT) - public void createDocument() { - TestObject testObject = new TestObject(); - testObject.id = UUID.randomUUID().toString(); - testObject.mypk = UUID.randomUUID().toString(); - testObject.prop = UUID.randomUUID().toString(); - - Observable> createObservable = client - .createDocument(getCollectionLink(), testObject, null, false); - - FailureValidator failureValidator = FailureValidator.builder().instanceOf(IllegalArgumentException.class) - .causeOfCauseInstanceOf(NotImplementedException.class) - .errorMessageContains("Can't serialize the object into the json string").build(); - - validateFailure(createObservable, failureValidator); - } - - @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - client = clientBuilder.build(); - } - - @AfterClass(groups = {"simple"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionDocumentQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionDocumentQueryTest.java deleted file mode 100644 index fdca1855021f..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionDocumentQueryTest.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.SqlParameter; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; -import rx.observers.TestSubscriber; - - -public class SinglePartitionDocumentQueryTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments = new ArrayList<>(); - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public SinglePartitionDocumentQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "queryMetricsArgProvider") - public void queryDocuments(boolean queryMetricsEnabled) throws Exception { - - String query = "SELECT * from c where c.prop = 99"; - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - options.setPopulateQueryMetrics(queryMetricsEnabled); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - List expectedDocs = createdDocuments.stream().filter(d -> 99 == d.getInt("prop") ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .hasValidQueryMetrics(queryMetricsEnabled) - .build(); - - try { - validateQuerySuccess(queryObservable, validator, 10000); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocuments_ParameterizedQueryWithInClause() throws Exception { - String query = "SELECT * from c where c.prop IN (@param1, @param2)"; - SqlParameterCollection params = new SqlParameterCollection(new SqlParameter("@param1", 3), new SqlParameter("@param2", 4)); - SqlQuerySpec sqs = new SqlQuerySpec(query, params); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), sqs, options); - - List expectedDocs = createdDocuments.stream().filter(d -> (3 == d.getInt("prop") || 4 == d.getInt("prop"))).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator, 10000); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocuments_ParameterizedQuery() throws Exception { - String query = "SELECT * from c where c.prop = @param"; - SqlParameterCollection params = new SqlParameterCollection(new SqlParameter("@param", 3)); - SqlQuerySpec sqs = new SqlQuerySpec(query, params); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), sqs, options); - - List expectedDocs = createdDocuments.stream().filter(d -> 3 == d.getInt("prop")).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator, 10000); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocuments_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocumentsWithPageSize() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(3); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - List expectedDocs = createdDocuments; - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(createdDocuments - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryOrderBy() throws Exception { - - String query = "SELECT * FROM r ORDER BY r.prop ASC"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(3); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - List expectedDocs = createdDocuments; - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(createdDocuments.stream() - .sorted((e1, e2) -> Integer.compare(e1.getInt("prop"), e2.getInt("prop"))) - .map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT * 1000) - public void continuationToken() throws Exception { - String query = "SELECT * FROM r ORDER BY r.prop ASC"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(3); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - - TestSubscriber> subscriber = new TestSubscriber<>(); - queryObservable.first().subscribe(subscriber); - - subscriber.awaitTerminalEvent(); - subscriber.assertCompleted(); - subscriber.assertNoErrors(); - assertThat(subscriber.getValueCount()).isEqualTo(1); - FeedResponse page = subscriber.getOnNextEvents().get(0); - assertThat(page.getResults()).hasSize(3); - - assertThat(page.getResponseContinuation()).isNotEmpty(); - - - options.setRequestContinuation(page.getResponseContinuation()); - queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - - List expectedDocs = createdDocuments.stream().filter(d -> (d.getInt("prop") > 2)).collect(Collectors.toList()); - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - assertThat(expectedDocs).hasSize(createdDocuments.size() -3); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedDocs.stream() - .sorted((e1, e2) -> Integer.compare(e1.getInt("prop"), e2.getInt("prop"))) - .map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - public Document createDocument(AsyncDocumentClient client, int cnt) { - Document docDefinition = getDocumentDefinition(cnt); - return client.createDocument(getCollectionLink(), docDefinition, null, false).toBlocking().single().getResource(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdDocuments.add(createDocument(client, i)); - } - - for(int i = 0; i < 8; i++) { - createdDocuments.add(createDocument(client, 99)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Document getDocumentDefinition(int cnt) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"prop\" : %d, " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, cnt, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionReadFeedDocumentsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionReadFeedDocumentsTest.java deleted file mode 100644 index 6ea1db1f0c3b..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionReadFeedDocumentsTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -public class SinglePartitionReadFeedDocumentsTest extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public SinglePartitionReadFeedDocumentsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readDocuments() { - final FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - final Observable> feedObservable = client.readDocuments(getCollectionLink(), options); - final int expectedPageSize = (createdDocuments.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(createdDocuments.size()) - .numberOfPages(expectedPageSize) - .exactlyContainsInAnyOrder(createdDocuments.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - List docDefList = new ArrayList<>(); - - for(int i = 0; i < 5; i++) { - docDefList.add(getDocumentDefinition()); - } - - createdDocuments = bulkInsertBlocking(client, getCollectionLink(), docDefList); - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - public String getCollectionLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId(); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SpyClientBuilder.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SpyClientBuilder.java deleted file mode 100644 index 7e575659681e..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SpyClientBuilder.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.rx.internal.SpyClientUnderTestFactory; - -public class SpyClientBuilder extends AsyncDocumentClient.Builder { - - public SpyClientBuilder(AsyncDocumentClient.Builder builder) { - super(); - super.configs = builder.configs; - super.connectionPolicy = builder.connectionPolicy; - super.desiredConsistencyLevel = builder.desiredConsistencyLevel; - super.masterKeyOrResourceToken = builder.masterKeyOrResourceToken; - super.serviceEndpoint = builder.serviceEndpoint; - } - - public SpyClientUnderTestFactory.ClientUnderTest build() { - return SpyClientUnderTestFactory.createClientUnderTest( - serviceEndpoint, - masterKeyOrResourceToken, - connectionPolicy, - desiredConsistencyLevel, - configs); - } - - public SpyClientUnderTestFactory.ClientWithGatewaySpy buildWithGatewaySpy() { - return SpyClientUnderTestFactory.createClientWithGatewaySpy( - serviceEndpoint, - masterKeyOrResourceToken, - connectionPolicy, - desiredConsistencyLevel, - configs); - } - - public SpyClientUnderTestFactory.DirectHttpsClientUnderTest buildWithDirectHttps() { - return SpyClientUnderTestFactory.createDirectHttpsClientUnderTest( - serviceEndpoint, - masterKeyOrResourceToken, - connectionPolicy, - desiredConsistencyLevel); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureCrudTest.java deleted file mode 100644 index e963d5322d5a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureCrudTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; - -import rx.Observable; - - -public class StoredProcedureCrudTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public StoredProcedureCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createStoredProcedure() throws Exception { - - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - - Observable> createObservable = client.createStoredProcedure(getCollectionLink(), storedProcedureDef, null); - - // validate stored procedure creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(storedProcedureDef.getId()) - .withStoredProcedureBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readStoredProcedure() throws Exception { - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - StoredProcedure storedProcedure = client.createStoredProcedure(getCollectionLink(), storedProcedureDef, null).toBlocking().single().getResource(); - - // read stored procedure - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readStoredProcedure(storedProcedure.getSelfLink(), null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(storedProcedureDef.getId()) - .withStoredProcedureBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void deleteStoredProcedure() throws Exception { - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - StoredProcedure storedProcedure = client.createStoredProcedure(getCollectionLink(), storedProcedureDef, null).toBlocking().single().getResource(); - - // delete - Observable> deleteObservable = client.deleteStoredProcedure(storedProcedure.getSelfLink(), null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - - // attempt to read stored procedure which was deleted - waitIfNeededForReplicasToCatchUp(clientBuilder); - - Observable> readObservable = client.readStoredProcedure(storedProcedure.getSelfLink(), null); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, notFoundValidator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureQueryTest.java deleted file mode 100644 index c10eb81aaf6e..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureQueryTest.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - - -public class StoredProcedureQueryTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdStoredProcs = new ArrayList<>(); - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public StoredProcedureQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithFilter() throws Exception { - - String filterId = createdStoredProcs.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryStoredProcedures(getCollectionLink(), query, options); - - List expectedDocs = createdStoredProcs.stream().filter(sp -> filterId.equals(sp.getId()) ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator, 10000); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void query_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryStoredProcedures(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAll() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(3); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryStoredProcedures(getCollectionLink(), query, options); - - List expectedDocs = createdStoredProcs; - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(expectedDocs - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryStoredProcedures(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - public StoredProcedure createStoredProc(AsyncDocumentClient client) { - StoredProcedure storedProcedure = getStoredProcedureDef(); - return client.createStoredProcedure(getCollectionLink(), storedProcedure, null).toBlocking().single().getResource(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdStoredProcs.add(createStoredProc(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static StoredProcedure getStoredProcedureDef() { - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - return storedProcedureDef; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureUpsertReplaceTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureUpsertReplaceTest.java deleted file mode 100644 index 62870762d1b3..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureUpsertReplaceTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - - -public class StoredProcedureUpsertReplaceTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public StoredProcedureUpsertReplaceTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void upsertStoredProcedure() throws Exception { - - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - StoredProcedure readBackSp = client.upsertStoredProcedure(getCollectionLink(), storedProcedureDef, null).toBlocking().single().getResource(); - - //read back stored procedure - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readStoredProcedure(readBackSp.getSelfLink(), null); - - // validate stored procedure creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackSp.getId()) - .withStoredProcedureBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update stored procedure - readBackSp.setBody("function() {var x = 11;}"); - - Observable> updateObservable = client.upsertStoredProcedure(getCollectionLink(), readBackSp, null); - - // validate stored procedure update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackSp.getId()) - .withStoredProcedureBody("function() {var x = 11;}") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void replaceStoredProcedure() throws Exception { - - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - StoredProcedure readBackSp = client.createStoredProcedure(getCollectionLink(), storedProcedureDef, null).toBlocking().single().getResource(); - - // read stored procedure to validate creation - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readStoredProcedure(readBackSp.getSelfLink(), null); - - // validate stored procedure creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackSp.getId()) - .withStoredProcedureBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update stored procedure - readBackSp.setBody("function() {var x = 11;}"); - - Observable> replaceObservable = client.replaceStoredProcedure(readBackSp, null); - - //validate stored procedure replace - ResourceResponseValidator validatorForReplace = new ResourceResponseValidator.Builder() - .withId(readBackSp.getId()) - .withStoredProcedureBody("function() {var x = 11;}") - .notNullEtag() - .build(); - validateSuccess(replaceObservable, validatorForReplace); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void executeStoredProcedure() throws Exception { - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure( - "{" + - " 'id': '" +UUID.randomUUID().toString() + "'," + - " 'body':" + - " 'function () {" + - " for (var i = 0; i < 10; i++) {" + - " getContext().getResponse().appendValue(\"Body\", i);" + - " }" + - " }'" + - "}"); - - StoredProcedure storedProcedure = null; - - try { - storedProcedure = client.createStoredProcedure(getCollectionLink(), storedProcedureDef, null).toBlocking().single().getResource(); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - String result = null; - - try { - result = client.executeStoredProcedure(storedProcedure.getSelfLink(), null).toBlocking().single().getResponseAsString(); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - assertThat(result).isEqualTo("\"0123456789\""); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TestSuiteBase.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TestSuiteBase.java deleted file mode 100644 index d77fd497ccd4..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TestSuiteBase.java +++ /dev/null @@ -1,1010 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.spy; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.PathParser; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import org.apache.commons.lang3.StringUtils; -import org.mockito.stubbing.Answer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.AfterSuite; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.DataProvider; - -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.CompositePathSortOrder; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import org.testng.annotations.Test; -import rx.Observable; -import rx.observers.TestSubscriber; - -public class TestSuiteBase { - private static final int DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL = 500; - private static final ObjectMapper objectMapper = new ObjectMapper(); - protected static Logger logger = LoggerFactory.getLogger(TestSuiteBase.class.getSimpleName()); - protected static final int TIMEOUT = 8000; - protected static final int FEED_TIMEOUT = 12000; - protected static final int SETUP_TIMEOUT = 30000; - protected static final int SHUTDOWN_TIMEOUT = 12000; - - protected static final int SUITE_SETUP_TIMEOUT = 120000; - protected static final int SUITE_SHUTDOWN_TIMEOUT = 60000; - - protected static final int WAIT_REPLICA_CATCH_UP_IN_MILLIS = 4000; - - protected int subscriberValidationTimeout = TIMEOUT; - - protected static ConsistencyLevel accountConsistency; - - protected Builder clientBuilder; - - protected static Database SHARED_DATABASE; - protected static DocumentCollection SHARED_MULTI_PARTITION_COLLECTION; - protected static DocumentCollection SHARED_SINGLE_PARTITION_COLLECTION; - protected static DocumentCollection SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - protected static DocumentCollection SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES; - - - protected TestSuiteBase() { - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - objectMapper.configure(JsonParser.Feature.ALLOW_TRAILING_COMMA, true); - objectMapper.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); - logger.debug("Initializing {} ...", this.getClass().getSimpleName()); - } - - @BeforeMethod(groups = { "simple", "long", "direct", "multi-master", "emulator", "non-emulator" }) - public void beforeMethod(Method method) { - if (this.clientBuilder != null) { - logger.info("Starting {}::{} using {} {} mode with {} consistency", - method.getDeclaringClass().getSimpleName(), method.getName(), - this.clientBuilder.connectionPolicy.getConnectionMode(), - this.clientBuilder.configs.getProtocol(), - this.clientBuilder.desiredConsistencyLevel); - return; - } - logger.info("Starting {}::{}", method.getDeclaringClass().getSimpleName(), method.getName()); - } - - @AfterMethod(groups = { "simple", "long", "direct", "multi-master", "emulator", "non-emulator" }) - public void afterMethod(Method m) { - Test t = m.getAnnotation(Test.class); - logger.info("Finished {}:{}.", m.getDeclaringClass().getSimpleName(), m.getName()); - } - - private static class DatabaseManagerImpl implements DatabaseForTest.DatabaseManager { - public static DatabaseManagerImpl getInstance(AsyncDocumentClient client) { - return new DatabaseManagerImpl(client); - } - - private final AsyncDocumentClient client; - - private DatabaseManagerImpl(AsyncDocumentClient client) { - this.client = client; - } - - @Override - public Observable> queryDatabases(SqlQuerySpec query) { - return client.queryDatabases(query, null); - } - - @Override - public Observable> createDatabase(Database databaseDefinition) { - return client.createDatabase(databaseDefinition, null); - } - - @Override - public Observable> deleteDatabase(String id) { - - return client.deleteDatabase("dbs/" + id, null); - } - } - - @BeforeSuite(groups = { "simple", "long", "direct", "multi-master", "emulator", "non-emulator" }, timeOut = SUITE_SETUP_TIMEOUT) - public static void beforeSuite() { - logger.info("beforeSuite Started"); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - DatabaseForTest dbForTest = DatabaseForTest.create(DatabaseManagerImpl.getInstance(houseKeepingClient)); - SHARED_DATABASE = dbForTest.createdDatabase; - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10100); - SHARED_MULTI_PARTITION_COLLECTION = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionWithRangeRangeIndex(), options); - SHARED_SINGLE_PARTITION_COLLECTION = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinition(), null); - SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionSinglePartitionWithoutPartitionKey()); - SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionMultiPartitionWithCompositeAndSpatialIndexes(), options); - } finally { - houseKeepingClient.close(); - } - } - - @AfterSuite(groups = { "simple", "long", "direct", "multi-master", "emulator", "non-emulator" }, timeOut = SUITE_SHUTDOWN_TIMEOUT) - public static void afterSuite() { - logger.info("afterSuite Started"); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - safeDeleteDatabase(houseKeepingClient, SHARED_DATABASE); - DatabaseForTest.cleanupStaleTestDatabases(DatabaseManagerImpl.getInstance(houseKeepingClient)); - } finally { - safeClose(houseKeepingClient); - } - } - - protected static void truncateCollection(DocumentCollection collection) { - logger.info("Truncating collection {} ...", collection.getId()); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - List paths = collection.getPartitionKey().getPaths(); - - FeedOptions options = new FeedOptions(); - options.setMaxDegreeOfParallelism(-1); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(100); - - logger.info("Truncating collection {} documents ...", collection.getId()); - - houseKeepingClient.queryDocuments(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(doc -> { - RequestOptions requestOptions = new RequestOptions(); - - if (paths != null && !paths.isEmpty()) { - List pkPath = PathParser.getPathParts(paths.get(0)); - Object propertyValue = doc.getObjectByPath(pkPath); - if (propertyValue == null) { - propertyValue = Undefined.Value(); - } - - requestOptions.setPartitionKey(new PartitionKey(propertyValue)); - } - - return houseKeepingClient.deleteDocument(doc.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} triggers ...", collection.getId()); - - houseKeepingClient.queryTriggers(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(trigger -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = trigger.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteTrigger(trigger.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} storedProcedures ...", collection.getId()); - - houseKeepingClient.queryStoredProcedures(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(storedProcedure -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = storedProcedure.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteStoredProcedure(storedProcedure.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} udfs ...", collection.getId()); - - houseKeepingClient.queryUserDefinedFunctions(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(udf -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = udf.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteUserDefinedFunction(udf.getSelfLink(), requestOptions); - }).toCompletable().await(); - - } finally { - houseKeepingClient.close(); - } - - logger.info("Finished truncating collection {}.", collection.getId()); - } - - protected static void waitIfNeededForReplicasToCatchUp(Builder clientBuilder) { - switch (clientBuilder.desiredConsistencyLevel) { - case Eventual: - case ConsistentPrefix: - logger.info(" additional wait in Eventual mode so the replica catch up"); - // give times to replicas to catch up after a write - try { - TimeUnit.MILLISECONDS.sleep(WAIT_REPLICA_CATCH_UP_IN_MILLIS); - } catch (Exception e) { - logger.error("unexpected failure", e); - } - - case Session: - case BoundedStaleness: - case Strong: - default: - break; - } - } - - private static DocumentCollection getCollectionDefinitionSinglePartitionWithoutPartitionKey() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - return collectionDefinition; - } - - - public static DocumentCollection createCollection(String databaseId, - DocumentCollection collection, - RequestOptions options) { - AsyncDocumentClient client = createGatewayHouseKeepingDocumentClient().build(); - try { - return client.createCollection("dbs/" + databaseId, collection, options).toBlocking().single().getResource(); - } finally { - client.close(); - } - } - - public static DocumentCollection createCollection(AsyncDocumentClient client, String databaseId, - DocumentCollection collection, RequestOptions options) { - return client.createCollection("dbs/" + databaseId, collection, options).toBlocking().single().getResource(); - } - - public static DocumentCollection createCollection(AsyncDocumentClient client, String databaseId, - DocumentCollection collection) { - return client.createCollection("dbs/" + databaseId, collection, null).toBlocking().single().getResource(); - } - - private static DocumentCollection getCollectionDefinitionMultiPartitionWithCompositeAndSpatialIndexes() { - final String NUMBER_FIELD = "numberField"; - final String STRING_FIELD = "stringField"; - final String NUMBER_FIELD_2 = "numberField2"; - final String STRING_FIELD_2 = "stringField2"; - final String BOOL_FIELD = "boolField"; - final String NULL_FIELD = "nullField"; - final String OBJECT_FIELD = "objectField"; - final String ARRAY_FIELD = "arrayField"; - final String SHORT_STRING_FIELD = "shortStringField"; - final String MEDIUM_STRING_FIELD = "mediumStringField"; - final String LONG_STRING_FIELD = "longStringField"; - final String PARTITION_KEY = "pk"; - - DocumentCollection documentCollection = new DocumentCollection(); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection> compositeIndexes = new ArrayList>(); - - //Simple - ArrayList compositeIndexSimple = new ArrayList(); - CompositePath compositePath1 = new CompositePath(); - compositePath1.setPath("/" + NUMBER_FIELD); - compositePath1.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath2 = new CompositePath(); - compositePath2.setPath("/" + STRING_FIELD); - compositePath2.setOrder(CompositePathSortOrder.Descending); - - compositeIndexSimple.add(compositePath1); - compositeIndexSimple.add(compositePath2); - - //Max Columns - ArrayList compositeIndexMaxColumns = new ArrayList(); - CompositePath compositePath3 = new CompositePath(); - compositePath3.setPath("/" + NUMBER_FIELD); - compositePath3.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath4 = new CompositePath(); - compositePath4.setPath("/" + STRING_FIELD); - compositePath4.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath5 = new CompositePath(); - compositePath5.setPath("/" + NUMBER_FIELD_2); - compositePath5.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath6 = new CompositePath(); - compositePath6.setPath("/" + STRING_FIELD_2); - compositePath6.setOrder(CompositePathSortOrder.Ascending); - - compositeIndexMaxColumns.add(compositePath3); - compositeIndexMaxColumns.add(compositePath4); - compositeIndexMaxColumns.add(compositePath5); - compositeIndexMaxColumns.add(compositePath6); - - //Primitive Values - ArrayList compositeIndexPrimitiveValues = new ArrayList(); - CompositePath compositePath7 = new CompositePath(); - compositePath7.setPath("/" + NUMBER_FIELD); - compositePath7.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath8 = new CompositePath(); - compositePath8.setPath("/" + STRING_FIELD); - compositePath8.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath9 = new CompositePath(); - compositePath9.setPath("/" + BOOL_FIELD); - compositePath9.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath10 = new CompositePath(); - compositePath10.setPath("/" + NULL_FIELD); - compositePath10.setOrder(CompositePathSortOrder.Ascending); - - compositeIndexPrimitiveValues.add(compositePath7); - compositeIndexPrimitiveValues.add(compositePath8); - compositeIndexPrimitiveValues.add(compositePath9); - compositeIndexPrimitiveValues.add(compositePath10); - - //Long Strings - ArrayList compositeIndexLongStrings = new ArrayList(); - CompositePath compositePath11 = new CompositePath(); - compositePath11.setPath("/" + STRING_FIELD); - - CompositePath compositePath12 = new CompositePath(); - compositePath12.setPath("/" + SHORT_STRING_FIELD); - - CompositePath compositePath13 = new CompositePath(); - compositePath13.setPath("/" + MEDIUM_STRING_FIELD); - - CompositePath compositePath14 = new CompositePath(); - compositePath14.setPath("/" + LONG_STRING_FIELD); - - compositeIndexLongStrings.add(compositePath11); - compositeIndexLongStrings.add(compositePath12); - compositeIndexLongStrings.add(compositePath13); - compositeIndexLongStrings.add(compositePath14); - - compositeIndexes.add(compositeIndexSimple); - compositeIndexes.add(compositeIndexMaxColumns); - compositeIndexes.add(compositeIndexPrimitiveValues); - compositeIndexes.add(compositeIndexLongStrings); - - indexingPolicy.setCompositeIndexes(compositeIndexes); - documentCollection.setIndexingPolicy(indexingPolicy); - - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - ArrayList partitionKeyPaths = new ArrayList(); - partitionKeyPaths.add("/" + PARTITION_KEY); - partitionKeyDefinition.setPaths(partitionKeyPaths); - documentCollection.setPartitionKey(partitionKeyDefinition); - - documentCollection.setId(UUID.randomUUID().toString()); - - return documentCollection; - } - - public static Document createDocument(AsyncDocumentClient client, String databaseId, String collectionId, Document document) { - return createDocument(client, databaseId, collectionId, document, null); - } - - public static Document createDocument(AsyncDocumentClient client, String databaseId, String collectionId, Document document, RequestOptions options) { - return client.createDocument(Utils.getCollectionNameLink(databaseId, collectionId), document, options, false).toBlocking().single().getResource(); - } - - public Observable> bulkInsert(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList, - int concurrencyLevel) { - ArrayList>> result = new ArrayList>>(documentDefinitionList.size()); - for (Document docDef : documentDefinitionList) { - result.add(client.createDocument(collectionLink, docDef, null, false)); - } - - return Observable.merge(result, concurrencyLevel); - } - - public Observable> bulkInsert(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList) { - return bulkInsert(client, collectionLink, documentDefinitionList, DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL); - } - - public List bulkInsertBlocking(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList) { - return bulkInsert(client, collectionLink, documentDefinitionList, DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL) - .map(ResourceResponse::getResource) - .toList() - .toBlocking() - .single(); - } - - public static ConsistencyLevel getAccountDefaultConsistencyLevel(AsyncDocumentClient client) { - return client.getDatabaseAccount().toBlocking().single().getConsistencyPolicy().getDefaultConsistencyLevel(); - } - - public static User createUser(AsyncDocumentClient client, String databaseId, User user) { - return client.createUser("dbs/" + databaseId, user, null).toBlocking().single().getResource(); - } - - public static User safeCreateUser(AsyncDocumentClient client, String databaseId, User user) { - deleteUserIfExists(client, databaseId, user.getId()); - return createUser(client, databaseId, user); - } - - private static DocumentCollection safeCreateCollection(AsyncDocumentClient client, String databaseId, DocumentCollection collection, RequestOptions options) { - deleteCollectionIfExists(client, databaseId, collection.getId()); - return createCollection(client, databaseId, collection, options); - } - - public static String getCollectionLink(DocumentCollection collection) { - return collection.getSelfLink(); - } - - static protected DocumentCollection getCollectionDefinition() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - static protected DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - public static void deleteCollectionIfExists(AsyncDocumentClient client, String databaseId, String collectionId) { - List res = client.queryCollections("dbs/" + databaseId, - String.format("SELECT * FROM root r where r.id = '%s'", collectionId), null).toBlocking().single() - .getResults(); - if (!res.isEmpty()) { - deleteCollection(client, Utils.getCollectionNameLink(databaseId, collectionId)); - } - } - - public static void deleteCollection(AsyncDocumentClient client, String collectionLink) { - client.deleteCollection(collectionLink, null).toBlocking().single(); - } - - public static void deleteDocumentIfExists(AsyncDocumentClient client, String databaseId, String collectionId, String docId) { - FeedOptions options = new FeedOptions(); - options.setPartitionKey(new PartitionKey(docId)); - List res = client - .queryDocuments(Utils.getCollectionNameLink(databaseId, collectionId), String.format("SELECT * FROM root r where r.id = '%s'", docId), options) - .toBlocking().single().getResults(); - if (!res.isEmpty()) { - deleteDocument(client, Utils.getDocumentNameLink(databaseId, collectionId, docId)); - } - } - - public static void safeDeleteDocument(AsyncDocumentClient client, String documentLink, RequestOptions options) { - if (client != null && documentLink != null) { - try { - client.deleteDocument(documentLink, options).toBlocking().single(); - } catch (Exception e) { - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(e, DocumentClientException.class); - if (dce == null || dce.getStatusCode() != 404) { - throw e; - } - } - } - } - - public static void deleteDocument(AsyncDocumentClient client, String documentLink) { - client.deleteDocument(documentLink, null).toBlocking().single(); - } - - public static void deleteUserIfExists(AsyncDocumentClient client, String databaseId, String userId) { - List res = client - .queryUsers("dbs/" + databaseId, String.format("SELECT * FROM root r where r.id = '%s'", userId), null) - .toBlocking().single().getResults(); - if (!res.isEmpty()) { - deleteUser(client, Utils.getUserNameLink(databaseId, userId)); - } - } - - public static void deleteUser(AsyncDocumentClient client, String userLink) { - client.deleteUser(userLink, null).toBlocking().single(); - } - - public static String getDatabaseLink(Database database) { - return database.getSelfLink(); - } - - static private Database safeCreateDatabase(AsyncDocumentClient client, Database database) { - safeDeleteDatabase(client, database.getId()); - return createDatabase(client, database); - } - - static protected Database createDatabase(AsyncDocumentClient client, Database database) { - Observable> databaseObservable = client.createDatabase(database, null); - return databaseObservable.toBlocking().single().getResource(); - } - - static protected Database createDatabase(AsyncDocumentClient client, String databaseId) { - Database databaseDefinition = new Database(); - databaseDefinition.setId(databaseId); - return createDatabase(client, databaseDefinition); - } - - static protected Database createDatabaseIfNotExists(AsyncDocumentClient client, String databaseId) { - return client.queryDatabases(String.format("SELECT * FROM r where r.id = '%s'", databaseId), null).flatMap(p -> Observable.from(p.getResults())).switchIfEmpty( - Observable.defer(() -> { - - Database databaseDefinition = new Database(); - databaseDefinition.setId(databaseId); - - return client.createDatabase(databaseDefinition, null).map(ResourceResponse::getResource); - }) - ).toBlocking().single(); - } - - static protected void safeDeleteDatabase(AsyncDocumentClient client, Database database) { - if (database != null) { - safeDeleteDatabase(client, database.getId()); - } - } - - static protected void safeDeleteDatabase(AsyncDocumentClient client, String databaseId) { - if (client != null) { - try { - client.deleteDatabase(Utils.getDatabaseNameLink(databaseId), null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeDeleteAllCollections(AsyncDocumentClient client, Database database) { - if (database != null) { - List collections = client.readCollections(database.getSelfLink(), null) - .flatMap(p -> Observable.from(p.getResults())) - .toList() - .toBlocking() - .single(); - - for(DocumentCollection collection: collections) { - client.deleteCollection(collection.getSelfLink(), null).toBlocking().single().getResource(); - } - } - } - - static protected void safeDeleteCollection(AsyncDocumentClient client, DocumentCollection collection) { - if (client != null && collection != null) { - try { - client.deleteCollection(collection.getSelfLink(), null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeDeleteCollection(AsyncDocumentClient client, String databaseId, String collectionId) { - if (client != null && databaseId != null && collectionId != null) { - try { - client.deleteCollection("/dbs/" + databaseId + "/colls/" + collectionId, null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeClose(AsyncDocumentClient client) { - if (client != null) { - try { - client.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public void validateSuccess(Observable> observable, - ResourceResponseValidator validator) { - validateSuccess(observable, validator, subscriberValidationTimeout); - } - - public static void validateSuccess(Observable> observable, - ResourceResponseValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public void validateFailure(Observable> observable, - FailureValidator validator) { - validateFailure(observable, validator, subscriberValidationTimeout); - } - - public static void validateFailure(Observable> observable, - FailureValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - public void validateQuerySuccess(Observable> observable, - FeedResponseListValidator validator) { - validateQuerySuccess(observable, validator, subscriberValidationTimeout); - } - - public static void validateQuerySuccess(Observable> observable, - FeedResponseListValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - validator.validate(testSubscriber.getOnNextEvents()); - } - - public void validateQueryFailure(Observable> observable, - FailureValidator validator) { - validateQueryFailure(observable, validator, subscriberValidationTimeout); - } - - public static void validateQueryFailure(Observable> observable, - FailureValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - @DataProvider - public static Object[][] clientBuilders() { - return new Object[][] { { createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null) } }; - } - - @DataProvider - public static Object[][] clientBuildersWithSessionConsistency() { - return new Object[][] { - { createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null) }, - { createDirectRxDocumentClient(ConsistencyLevel.Session, Protocol.Https, false, null) }, - { createDirectRxDocumentClient(ConsistencyLevel.Session, Protocol.Tcp, false, null) } - }; - } - - private static ConsistencyLevel parseConsistency(String consistency) { - if (consistency != null) { - for (ConsistencyLevel consistencyLevel : ConsistencyLevel.values()) { - if (consistencyLevel.name().toLowerCase().equals(consistency.toLowerCase())) { - return consistencyLevel; - } - } - } - - logger.error("Invalid configured test consistency [{}].", consistency); - throw new IllegalStateException("Invalid configured test consistency " + consistency); - } - - private static List parsePreferredLocation(String preferredLocations) { - if (StringUtils.isEmpty(preferredLocations)) { - return null; - } - - try { - return objectMapper.readValue(preferredLocations, new TypeReference>(){}); - } catch (Exception e) { - logger.error("Invalid configured test preferredLocations [{}].", preferredLocations); - throw new IllegalStateException("Invalid configured test preferredLocations " + preferredLocations); - } - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirect() { - return simpleClientBuildersWithDirect(Protocol.Https, Protocol.Tcp); - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirectHttps() { - return simpleClientBuildersWithDirect(Protocol.Https); - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirectTcp() { - return simpleClientBuildersWithDirect(Protocol.Tcp); - } - - private static Object[][] simpleClientBuildersWithDirect(Protocol... protocols) { - - accountConsistency = parseConsistency(TestConfigurations.CONSISTENCY); - logger.info("Max test consistency to use is [{}]", accountConsistency); - List testConsistencies = new ArrayList<>(); - - switch (accountConsistency) { - case Strong: - case BoundedStaleness: - case Session: - case ConsistentPrefix: - case Eventual: - testConsistencies.add(ConsistencyLevel.Eventual); - break; - default: - throw new IllegalStateException("Invalid configured test consistency " + accountConsistency); - } - - List preferredLocation = parsePreferredLocation(TestConfigurations.PREFERRED_LOCATIONS); - boolean isMultiMasterEnabled = preferredLocation != null && accountConsistency == ConsistencyLevel.Session; - - List builders = new ArrayList<>(); - builders.add(createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null)); - - for (Protocol protocol : protocols) { - testConsistencies.forEach(consistencyLevel -> builders.add(createDirectRxDocumentClient(consistencyLevel, - protocol, - isMultiMasterEnabled, - preferredLocation))); - } - - builders.forEach(b -> logger.info("Will Use ConnectionMode [{}], Consistency [{}], Protocol [{}]", - b.connectionPolicy.getConnectionMode(), - b.desiredConsistencyLevel, - b.configs.getProtocol() - )); - - return builders.stream().map(b -> new Object[]{b}).collect(Collectors.toList()).toArray(new Object[0][]); - } - - @DataProvider - public static Object[][] clientBuildersWithDirect() { - return clientBuildersWithDirectAllConsistencies(Protocol.Https, Protocol.Tcp); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectHttps() { - return clientBuildersWithDirectAllConsistencies(Protocol.Https); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectTcp() { - return clientBuildersWithDirectAllConsistencies(Protocol.Tcp); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectSession() { - return clientBuildersWithDirectSession(Protocol.Https, Protocol.Tcp); - } - - private static Object[][] clientBuildersWithDirectSession(Protocol... protocols) { - return clientBuildersWithDirect(new ArrayList(){{add(ConsistencyLevel.Session);}} , protocols); - } - - private static Object[][] clientBuildersWithDirectAllConsistencies(Protocol... protocols) { - accountConsistency = parseConsistency(TestConfigurations.CONSISTENCY); - logger.info("Max test consistency to use is [{}]", accountConsistency); - List testConsistencies = new ArrayList<>(); - - switch (accountConsistency) { - case Strong: - testConsistencies.add(ConsistencyLevel.Strong); - case BoundedStaleness: - testConsistencies.add(ConsistencyLevel.BoundedStaleness); - case Session: - testConsistencies.add(ConsistencyLevel.Session); - case ConsistentPrefix: - testConsistencies.add(ConsistencyLevel.ConsistentPrefix); - case Eventual: - testConsistencies.add(ConsistencyLevel.Eventual); - break; - default: - throw new IllegalStateException("Invalid configured test consistency " + accountConsistency); - } - return clientBuildersWithDirect(testConsistencies, protocols); - } - - private static Object[][] clientBuildersWithDirect(List testConsistencies, Protocol... protocols) { - - List preferredLocation = parsePreferredLocation(TestConfigurations.PREFERRED_LOCATIONS); - boolean isMultiMasterEnabled = preferredLocation != null && accountConsistency == ConsistencyLevel.Session; - - List builders = new ArrayList<>(); - builders.add(createGatewayRxDocumentClient(ConsistencyLevel.Session, isMultiMasterEnabled, preferredLocation)); - - for (Protocol protocol : protocols) { - testConsistencies.forEach(consistencyLevel -> builders.add(createDirectRxDocumentClient(consistencyLevel, - protocol, - isMultiMasterEnabled, - preferredLocation))); - } - - builders.forEach(b -> logger.info("Will Use ConnectionMode [{}], Consistency [{}], Protocol [{}]", - b.connectionPolicy.getConnectionMode(), - b.desiredConsistencyLevel, - b.configs.getProtocol() - )); - - return builders.stream().map(b -> new Object[]{b}).collect(Collectors.toList()).toArray(new Object[0][]); - } - - static protected Builder createGatewayHouseKeepingDocumentClient() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - RetryOptions options = new RetryOptions(); - options.setMaxRetryWaitTimeInSeconds(SUITE_SETUP_TIMEOUT); - connectionPolicy.setRetryOptions(options); - return new Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session); - } - - static protected Builder createGatewayRxDocumentClient(ConsistencyLevel consistencyLevel, boolean multiMasterEnabled, List preferredLocations) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - connectionPolicy.setUsingMultipleWriteLocations(multiMasterEnabled); - connectionPolicy.setPreferredLocations(preferredLocations); - return new Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(consistencyLevel); - } - - static protected Builder createGatewayRxDocumentClient() { - return createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null); - } - - static protected Builder createDirectRxDocumentClient(ConsistencyLevel consistencyLevel, - Protocol protocol, - boolean multiMasterEnabled, - List preferredLocations) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - - if (preferredLocations != null) { - connectionPolicy.setPreferredLocations(preferredLocations); - } - - if (multiMasterEnabled && consistencyLevel == ConsistencyLevel.Session) { - connectionPolicy.setUsingMultipleWriteLocations(true); - } - - Configs configs = spy(new Configs()); - doAnswer((Answer)invocation -> protocol).when(configs).getProtocol(); - - return new Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(consistencyLevel) - .withConfigs(configs); - } - - protected int expectedNumberOfPages(int totalExpectedResult, int maxPageSize) { - return Math.max((totalExpectedResult + maxPageSize - 1 ) / maxPageSize, 1); - } - - @DataProvider(name = "queryMetricsArgProvider") - public Object[][] queryMetricsArgProvider() { - return new Object[][]{ - {true}, - {false}, - }; - } - - public static class VerboseTestSubscriber extends TestSubscriber { - @Override - public void assertNoErrors() { - List onErrorEvents = getOnErrorEvents(); - StringBuilder errorMessageBuilder = new StringBuilder(); - if (!onErrorEvents.isEmpty()) { - for(Throwable throwable : onErrorEvents) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - throwable.printStackTrace(pw); - String sStackTrace = sw.toString(); // stack trace as a string - errorMessageBuilder.append(sStackTrace); - } - - AssertionError ae = new AssertionError(errorMessageBuilder.toString()); - throw ae; - } - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TokenResolverTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TokenResolverTest.java deleted file mode 100644 index cc9ea0fef0f8..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TokenResolverTest.java +++ /dev/null @@ -1,566 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.CosmosResourceType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.StoredProcedureResponse; -import com.microsoft.azure.cosmosdb.TokenResolver; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.Map; - -public class TokenResolverTest extends TestSuiteBase { - - private class UserClass { - public String userName; - public int userId; - - public UserClass(String userName, int userId) { - this.userName = userName; - this.userId = userId; - } - } - - private Database createdDatabase; - private DocumentCollection createdCollection; - private User userWithReadPermission; - private User userWithAllPermission; - - private Permission readPermission; - private Permission allPermission; - - private AsyncDocumentClient.Builder clientBuilder; - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public TokenResolverTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @DataProvider(name = "connectionMode") - public Object[][] connectionMode() { - return new Object[][]{ - {ConnectionMode.Gateway}, - {ConnectionMode.Direct}, - }; - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION; - - client = clientBuilder.build(); - - userWithReadPermission = createUser(client, createdDatabase.getId(), getUserDefinition()); - readPermission = client.createPermission(userWithReadPermission.getSelfLink(), getPermission(createdCollection, "ReadPermissionOnColl", PermissionMode.Read), null).toBlocking().single() - .getResource(); - - userWithAllPermission = createUser(client, createdDatabase.getId(), getUserDefinition()); - allPermission = client.createPermission(userWithAllPermission.getSelfLink(), getPermission(createdCollection, "AllPermissionOnColl", PermissionMode.All), null).toBlocking().single() - .getResource(); - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void readDocumentWithReadPermission(ConnectionMode connectionMode) { - Document docDefinition = getDocumentDefinition(); - ResourceResponse resourceResponse = client - .createDocument(BridgeInternal.getAltLink(createdCollection), docDefinition, null, false).toBlocking().first(); - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.Read); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceResponse.getResource().get("mypk"))); - HashMap properties = new HashMap(); - properties.put("UserId", "readUser"); - requestOptions.setProperties(properties); - Observable> readObservable = asyncClientWithTokenResolver.readDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(resourceResponse.getResource().getId()).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void deleteDocumentWithReadPermission(ConnectionMode connectionMode) { - Document docDefinition = getDocumentDefinition(); - ResourceResponse resourceResponse = client - .createDocument(BridgeInternal.getAltLink(createdCollection), docDefinition, null, false).toBlocking().first(); - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.Read); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceResponse.getResource().get("mypk"))); - Observable> readObservable = asyncClientWithTokenResolver.deleteDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - FailureValidator validator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.FORBIDDEN).build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void writeDocumentWithReadPermission(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.Read); - Observable> readObservable = asyncClientWithTokenResolver.createDocument(createdCollection.getSelfLink(), getDocumentDefinition(), null, true); - FailureValidator validator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.FORBIDDEN).build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void writeDocumentWithAllPermission(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.All); - Document documentDefinition = getDocumentDefinition(); - Observable> readObservable = asyncClientWithTokenResolver.createDocument(createdCollection.getSelfLink(), documentDefinition, null, true); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(documentDefinition.getId()).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void deleteDocumentWithAllPermission(ConnectionMode connectionMode) { - Document docDefinition = getDocumentDefinition(); - ResourceResponse resourceResponse = client - .createDocument(BridgeInternal.getAltLink(createdCollection), docDefinition, null, false).toBlocking().first(); - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.All); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceResponse.getResource().get("mypk"))); - Observable> readObservable = asyncClientWithTokenResolver.deleteDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void readCollectionWithReadPermission(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.Read); - Observable> readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), null); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(createdCollection.getId()).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void deleteCollectionWithReadPermission(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.Read); - Observable> readObservable = asyncClientWithTokenResolver.deleteCollection(createdCollection.getSelfLink(), null); - FailureValidator validator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.FORBIDDEN).build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void verifyingAuthTokenAPISequence(ConnectionMode connectionMode) { - Document docDefinition = getDocumentDefinition(); - ResourceResponse resourceResponse = client - .createDocument(BridgeInternal.getAltLink(createdCollection), docDefinition, null, false).toBlocking().first(); - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(connectionMode); - - //Unauthorized error with invalid token resolver, valid master key and valid permission feed, making it sure tokenResolver has higher priority than all. - List permissionFeed = new ArrayList<>(); - permissionFeed.add(readPermission); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolver(null)) //TokenResolver always generating invalid token. - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withPermissionFeed(permissionFeed) - .build(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceResponse.getResource().get("mypk"))); - Observable> readObservable = asyncClientWithTokenResolver.readDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - FailureValidator failureValidator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.UNAUTHORIZED).build(); - validateFailure(readObservable, failureValidator); - - //Success read operation with valid token resolver, invalid master key and invalid permission feed, making it sure tokenResolver has higher priority than all. - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolver(PermissionMode.Read)) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withPermissionFeed(permissionFeed) - .build(); - readObservable = asyncClientWithTokenResolver.readDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - ResourceResponseValidator sucessValidator = new ResourceResponseValidator.Builder() - .withId(resourceResponse.getResource().getId()).build(); - validateSuccess(readObservable, sucessValidator); - - - //Success read operation with valid permission feed, supporting above hypothesis. - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withPermissionFeed(permissionFeed) - .build(); - readObservable = asyncClientWithTokenResolver.readDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - validateSuccess(readObservable, sucessValidator); - - - //Success read operation with valid master key, supporting above hypothesis. - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .build(); - readObservable = asyncClientWithTokenResolver.readDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - validateSuccess(readObservable, sucessValidator); - - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = 6000000) - public void createAndExecuteSprocWithWritePermission(ConnectionMode connectionMode) throws InterruptedException { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.All); - String sprocId = "storedProcedure" + UUID.randomUUID().toString(); - StoredProcedure sproc = new StoredProcedure( - "{" + - " 'id':'" + sprocId + "'," + - " 'body':" + - " 'function() {" + - " var mytext = \"x\";" + - " var myval = 1;" + - " try {" + - " getContext().getResponse().setBody(\"Success!\");" + - " }" + - " catch(err) {" + - " getContext().getResponse().setBody(\"inline err: [\" + err.number + \"] \" + err);" + - " }" + - " }'" + - "}"); - - Observable> createObservable = asyncClientWithTokenResolver.createStoredProcedure(createdCollection.getSelfLink(), sproc, null); - ResourceResponseValidator createSucessValidator = new ResourceResponseValidator.Builder() - .withId(sprocId).build(); - validateSuccess(createObservable, createSucessValidator); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey("")); - String sprocLink = "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/sprocs/" + sprocId; - StoredProcedureResponse result = asyncClientWithTokenResolver.executeStoredProcedure(sprocLink, options, null).toBlocking().single(); - assertThat(result.getResponseAsString()).isEqualTo("\"Success!\""); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void readDocumentsWithAllPermission(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - String id1 = UUID.randomUUID().toString(); - String id2 = UUID.randomUUID().toString(); - - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.All); - Document document1 = asyncClientWithTokenResolver.createDocument(createdCollection.getSelfLink(), new Document("{'id': '" + id1 + "'}"), null, false) - .toBlocking().single().getResource(); - Document document2 = asyncClientWithTokenResolver.createDocument(createdCollection.getSelfLink(), new Document("{'id': '" + id2 + "'}"), null, false) - .toBlocking().single().getResource(); - List expectedIds = new ArrayList(); - String rid1 = document1.getResourceId(); - String rid2 = document2.getResourceId(); - expectedIds.add(rid1); - expectedIds.add(rid2); - String query = "SELECT * FROM r WHERE r._rid=\"" + rid1 + "\" or r._rid=\"" + rid2 + "\""; - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = asyncClientWithTokenResolver.queryDocuments(createdCollection.getSelfLink(), query, options); - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .numberOfPages(1) - .exactlyContainsInAnyOrder(expectedIds).build(); - validateQuerySuccess(queryObservable, validator, 10000); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void readChangeFeedWithAllPermission(ConnectionMode connectionMode) throws InterruptedException { - - //setStartDateTime is not currently supported in multimaster mode. So skipping the test - if(BridgeInternal.isEnableMultipleWriteLocations(client.getDatabaseAccount().toBlocking().single())){ - throw new SkipException("StartTime/IfModifiedSince is not currently supported when EnableMultipleWriteLocations is set"); - } - - AsyncDocumentClient asyncClientWithTokenResolver = null; - String id1 = UUID.randomUUID().toString(); - String id2 = UUID.randomUUID().toString(); - String partitionKey = createdCollection.getPartitionKey().getPaths().get(0).substring(1); - String partitionKeyValue = "pk"; - Document document1 = new Document(); - document1.setId(id1); - document1.set(partitionKey, partitionKeyValue); - Document document2 = new Document(); - document2.setId(id2); - document2.set(partitionKey, partitionKeyValue); - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.All); - ZonedDateTime befTime = ZonedDateTime.now(); - Thread.sleep(1000); - - document1 = asyncClientWithTokenResolver - .createDocument(createdCollection.getSelfLink(), document1, null, false).toBlocking().single() - .getResource(); - document2 = asyncClientWithTokenResolver - .createDocument(createdCollection.getSelfLink(), document2, null, false).toBlocking().single() - .getResource(); - List expectedIds = new ArrayList(); - String rid1 = document1.getResourceId(); - String rid2 = document2.getResourceId(); - expectedIds.add(rid1); - expectedIds.add(rid2); - - ChangeFeedOptions options = new ChangeFeedOptions(); - options.setPartitionKey(new PartitionKey(partitionKeyValue)); - options.setStartDateTime(befTime); - - Thread.sleep(1000); - Observable> queryObservable = asyncClientWithTokenResolver - .queryDocumentChangeFeed(createdCollection.getSelfLink(), options); - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .exactlyContainsInAnyOrder(expectedIds).build(); - validateQuerySuccess(queryObservable, validator, 10000); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void verifyRuntimeExceptionWhenUserModifiesProperties(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(connectionMode); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getBadTokenResolver()) - .build(); - - RequestOptions options = new RequestOptions(); - options.setProperties(new HashMap()); - Observable> readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), options); - FailureValidator validator = new FailureValidator.Builder().withRuntimeExceptionClass(UnsupportedOperationException.class).build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void verifyBlockListedUserThrows(ConnectionMode connectionMode) { - String field = "user"; - UserClass blockListedUser = new UserClass("block listed user", 0); - String errorMessage = "block listed user! access denied!"; - - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(connectionMode); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolverWithBlockList(PermissionMode.Read, field, blockListedUser, errorMessage)) - .build(); - - RequestOptions options = new RequestOptions(); - HashMap properties = new HashMap(); - properties.put(field, blockListedUser); - options.setProperties(properties); - Observable> readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), options); - FailureValidator validator = new FailureValidator.Builder().withRuntimeExceptionMessage(errorMessage).build(); - validateFailure(readObservable, validator); - - properties.put(field, new UserClass("valid user", 1)); - options.setProperties(properties); - readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), options); - ResourceResponseValidator sucessValidator = new ResourceResponseValidator.Builder() - .withId(createdCollection.getId()).build(); - validateSuccess(readObservable, sucessValidator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @AfterClass(groups = {"simple"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - client.close(); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - private AsyncDocumentClient buildClient(ConnectionMode connectionMode, PermissionMode permissionMode) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(connectionMode); - return new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolver(permissionMode)) - .build(); - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - return user; - } - - private Permission getPermission(Resource resource, String permissionId, PermissionMode permissionMode) { - Permission permission = new Permission(); - permission.setId(permissionId); - permission.setPermissionMode(permissionMode); - permission.setResourceLink(resource.getSelfLink()); - return permission; - } - - private TokenResolver getTokenResolver(PermissionMode permissionMode) { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - if (permissionMode == null) { - return "invalid"; - } else if (permissionMode.equals(PermissionMode.Read)) { - return readPermission.getToken(); - } else { - return allPermission.getToken(); - } - }; - } - - private TokenResolver getBadTokenResolver() { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - if (resourceType == CosmosResourceType.System) { - return readPermission.getToken(); - } - if (properties != null) { - properties.put("key", "value"); - } - return null; - }; - } - - private TokenResolver getTokenResolverWithBlockList(PermissionMode permissionMode, String field, UserClass blockListedUser, String errorMessage) { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - UserClass currentUser = null; - if (properties != null && properties.get(field) != null) { - currentUser = (UserClass) properties.get(field); - } - - if (resourceType == CosmosResourceType.System) { - return readPermission.getToken(); - } else if (currentUser != null && - !currentUser.userName.equals(blockListedUser.userName) && - currentUser.userId != blockListedUser.userId) { - if (permissionMode.equals(PermissionMode.Read)) { - return readPermission.getToken(); - } else { - return allPermission.getToken(); - } - } else { - throw new RuntimeException(errorMessage); - } - }; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TopQueryTests.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TopQueryTests.java deleted file mode 100644 index f2b1cbb7a163..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TopQueryTests.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import com.microsoft.azure.cosmosdb.rx.internal.query.TakeContinuationToken; - -import rx.Observable; - -public class TopQueryTests extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdCollection; - private ArrayList docs = new ArrayList(); - - private String partitionKey = "mypk"; - private int firstPk = 0; - private int secondPk = 1; - private String field = "field"; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public TopQueryTests(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "queryMetricsArgProvider") - public void queryDocumentsWithTop(boolean qmEnabled) throws Exception { - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(9); - options.setMaxDegreeOfParallelism(2); - options.setPopulateQueryMetrics(qmEnabled); - - int expectedTotalSize = 20; - int expectedNumberOfPages = 3; - int[] expectedPageLengths = new int[] { 9, 9, 2 }; - - for (int i = 0; i < 2; i++) { - Observable> queryObservable1 = client.queryDocuments(createdCollection.getSelfLink(), - "SELECT TOP 0 value AVG(c.field) from c", options); - - FeedResponseListValidator validator1 = new FeedResponseListValidator.Builder() - .totalSize(0).build(); - - try { - validateQuerySuccess(queryObservable1, validator1, TIMEOUT); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", - this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - Observable> queryObservable2 = client.queryDocuments(createdCollection.getSelfLink(), - "SELECT TOP 1 value AVG(c.field) from c", options); - - FeedResponseListValidator validator2 = new FeedResponseListValidator.Builder() - .totalSize(1).build(); - - validateQuerySuccess(queryObservable2, validator2, TIMEOUT); - - Observable> queryObservable3 = client.queryDocuments(createdCollection.getSelfLink(), - "SELECT TOP 20 * from c", options); - - FeedResponseListValidator validator3 = new FeedResponseListValidator.Builder() - .totalSize(expectedTotalSize).numberOfPages(expectedNumberOfPages).pageLengths(expectedPageLengths) - .hasValidQueryMetrics(qmEnabled).build(); - - validateQuerySuccess(queryObservable3, validator3, TIMEOUT); - - if (i == 0) { - options.setPartitionKey(new PartitionKey(firstPk)); - options.setEnableCrossPartitionQuery(false); - - expectedTotalSize = 10; - expectedNumberOfPages = 2; - expectedPageLengths = new int[] { 9, 1 }; - - } - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void topContinuationTokenRoundTrips() throws Exception { - { - // Positive - TakeContinuationToken takeContinuationToken = new TakeContinuationToken(42, "asdf"); - String serialized = takeContinuationToken.toString(); - ValueHolder outTakeContinuationToken = new ValueHolder(); - - assertThat(TakeContinuationToken.tryParse(serialized, outTakeContinuationToken)).isTrue(); - TakeContinuationToken deserialized = outTakeContinuationToken.v; - - assertThat(deserialized.getTakeCount()).isEqualTo(42); - assertThat(deserialized.getSourceToken()).isEqualTo("asdf"); - } - - { - // Negative - ValueHolder outTakeContinuationToken = new ValueHolder(); - assertThat( - TakeContinuationToken.tryParse("{\"property\": \"Not a valid token\"}", outTakeContinuationToken)) - .isFalse(); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT * 10) - public void queryDocumentsWithTopContinuationTokens() throws Exception { - String query = "SELECT TOP 8 * FROM c"; - this.queryWithContinuationTokensAndPageSizes(query, new int[] { 1, 5, 10 }, 8); - } - - private void queryWithContinuationTokensAndPageSizes(String query, int[] pageSizes, int topCount) { - for (int pageSize : pageSizes) { - List receivedDocuments = this.queryWithContinuationTokens(query, pageSize); - Set actualIds = new HashSet(); - for (Document document : receivedDocuments) { - actualIds.add(document.getResourceId()); - } - - assertThat(actualIds.size()).describedAs("total number of results").isEqualTo(topCount); - } - } - - private List queryWithContinuationTokens(String query, int pageSize) { - String requestContinuation = null; - List continuationTokens = new ArrayList(); - List receivedDocuments = new ArrayList(); - - do { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(pageSize); - options.setEnableCrossPartitionQuery(true); - options.setMaxDegreeOfParallelism(2); - options.setRequestContinuation(requestContinuation); - Observable> queryObservable = client.queryDocuments(createdCollection.getSelfLink(), - query, options); - - Observable> firstPageObservable = queryObservable.first(); - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - firstPageObservable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - - FeedResponse firstPage = testSubscriber.getOnNextEvents().get(0); - requestContinuation = firstPage.getResponseContinuation(); - receivedDocuments.addAll(firstPage.getResults()); - continuationTokens.add(requestContinuation); - } while (requestContinuation != null); - - return receivedDocuments; - } - - public void bulkInsert(AsyncDocumentClient client) { - generateTestData(); - - for (int i = 0; i < docs.size(); i++) { - createDocument(client, createdDatabase.getId(), createdCollection.getId(), docs.get(i)); - } - } - - public void generateTestData() { - - for (int i = 0; i < 10; i++) { - Document d = new Document(); - d.setId(Integer.toString(i)); - d.set(field, i); - d.set(partitionKey, firstPk); - docs.add(d); - } - - for (int i = 10; i < 20; i++) { - Document d = new Document(); - d.setId(Integer.toString(i)); - d.set(field, i); - d.set(partitionKey, secondPk); - docs.add(d); - } - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION); - - bulkInsert(client); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerCrudTest.java deleted file mode 100644 index 5a729f2ce424..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerCrudTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.TriggerOperation; -import com.microsoft.azure.cosmosdb.TriggerType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - - -public class TriggerCrudTest extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public TriggerCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createTrigger() throws Exception { - - // create a trigger - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - - Observable> createObservable = client.createTrigger(getCollectionLink(), trigger, null); - - // validate trigger creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(trigger.getId()) - .withTriggerBody("function() {var x = 10;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readTrigger() throws Exception { - // create a trigger - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - Trigger readBackTrigger = client.createTrigger(getCollectionLink(), trigger, null).toBlocking().single().getResource(); - - // read trigger - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readTrigger(readBackTrigger.getSelfLink(), null); - - // validate read trigger - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(trigger.getId()) - .withTriggerBody("function() {var x = 10;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void deleteTrigger() throws Exception { - // create a trigger - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - Trigger readBackTrigger = client.createTrigger(getCollectionLink(), trigger, null).toBlocking().single().getResource(); - - // delete trigger - Observable> deleteObservable = client.deleteTrigger(readBackTrigger.getSelfLink(), null); - - // validate delete trigger - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerQueryTest.java deleted file mode 100644 index af8ea0a1bdd4..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerQueryTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.TriggerOperation; -import com.microsoft.azure.cosmosdb.TriggerType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - - -public class TriggerQueryTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdTriggers = new ArrayList<>(); - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public TriggerQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithFilter() throws Exception { - - String filterId = createdTriggers.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryTriggers(getCollectionLink(), query, options); - - List expectedDocs = createdTriggers.stream().filter(sp -> filterId.equals(sp.getId()) ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void query_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryTriggers(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAll() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(3); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryTriggers(getCollectionLink(), query, options); - - List expectedDocs = createdTriggers; - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(expectedDocs - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryTriggers(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - public Trigger createTrigger(AsyncDocumentClient client) { - Trigger storedProcedure = getTriggerDef(); - return client.createTrigger(getCollectionLink(), storedProcedure, null).toBlocking().single().getResource(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdTriggers.add(createTrigger(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Trigger getTriggerDef() { - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - return trigger; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerUpsertReplaceTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerUpsertReplaceTest.java deleted file mode 100644 index 7ef831e458eb..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerUpsertReplaceTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.TriggerOperation; -import com.microsoft.azure.cosmosdb.TriggerType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - - -public class TriggerUpsertReplaceTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public TriggerUpsertReplaceTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void upsertTrigger() throws Exception { - - // create a trigger - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - Trigger readBackTrigger = client.upsertTrigger(getCollectionLink(), trigger, null).toBlocking().single().getResource(); - - // read trigger to validate creation - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readTrigger(readBackTrigger.getSelfLink(), null); - - // validate trigger creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackTrigger.getId()) - .withTriggerBody("function() {var x = 10;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update trigger - readBackTrigger.setBody("function() {var x = 11;}"); - - Observable> updateObservable = client.upsertTrigger(getCollectionLink(), readBackTrigger, null); - - // validate trigger update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackTrigger.getId()) - .withTriggerBody("function() {var x = 11;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void replaceTrigger() throws Exception { - - // create a trigger - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - Trigger readBackTrigger = client.createTrigger(getCollectionLink(), trigger, null).toBlocking().single().getResource(); - - // read trigger to validate creation - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readTrigger(readBackTrigger.getSelfLink(), null); - - // validate trigger creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackTrigger.getId()) - .withTriggerBody("function() {var x = 10;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update trigger - readBackTrigger.setBody("function() {var x = 11;}"); - - Observable> updateObservable = client.replaceTrigger(readBackTrigger, null); - - // validate trigger replace - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackTrigger.getId()) - .withTriggerBody("function() {var x = 11;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UniqueIndexTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UniqueIndexTest.java deleted file mode 100644 index d6bd7f40c6b2..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UniqueIndexTest.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -import java.util.Collections; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import javax.net.ssl.SSLException; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.databind.util.JSONPObject; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ExcludedPath; -import com.microsoft.azure.cosmosdb.HashIndex; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.IndexingMode; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.UniqueKey; -import com.microsoft.azure.cosmosdb.UniqueKeyPolicy; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -import rx.Observable; -import rx.observers.TestSubscriber; - -public class UniqueIndexTest extends TestSuiteBase { - protected static final int TIMEOUT = 30000; - protected static final int SETUP_TIMEOUT = 20000; - protected static final int SHUTDOWN_TIMEOUT = 20000; - - private final String databaseId = DatabaseForTest.generateId(); - private AsyncDocumentClient client; - private Database database; - - private DocumentCollection collection; - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void insertWithUniqueIndex() throws Exception { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - UniqueKeyPolicy uniqueKeyPolicy = new UniqueKeyPolicy(); - UniqueKey uniqueKey = new UniqueKey(); - uniqueKey.setPaths(ImmutableList.of("/name", "/description")); - uniqueKeyPolicy.setUniqueKeys(Collections.singleton(uniqueKey)); - collectionDefinition.setUniqueKeyPolicy(uniqueKeyPolicy); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.Consistent); - ExcludedPath excludedPath = new ExcludedPath(); - excludedPath.setPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath(); - includedPath1.setPath("/name/?"); - includedPath1.setIndexes(Collections.singletonList(new HashIndex(DataType.String, 7))); - - IncludedPath includedPath2 = new IncludedPath(); - includedPath2.setPath("/description/?"); - includedPath2.setIndexes(Collections.singletonList(new HashIndex(DataType.String, 7))); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - ObjectMapper om = new ObjectMapper(); - - JsonNode doc1 = om.readValue("{\"name\":\"Alexander Pushkin\",\"description\":\"poet\"}", JsonNode.class); - JsonNode doc2 = om.readValue("{\"name\":\"Alexander Pushkin\",\"description\":\"playwright\"}", JsonNode.class); - JsonNode doc3 = om.readValue("{\"name\":\"حافظ شیرازی\",\"description\":\"poet\"}", JsonNode.class); - - collection = client.createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single().getResource(); - - Document dd = client.createDocument(getCollectionLink(collection), doc1, null, false).toBlocking().single().getResource(); - - client.readDocument(dd.getSelfLink(), null).toBlocking().single(); - - try { - client.createDocument(getCollectionLink(collection), doc1, null, false).toBlocking().single(); - fail("Did not throw due to unique constraint (create)"); - } catch (RuntimeException e) { - assertThat(getDocumentClientException(e).getStatusCode()).isEqualTo(HttpConstants.StatusCodes.CONFLICT); - } - - client.createDocument(getCollectionLink(collection), doc2, null, false).toBlocking().single(); - client.createDocument(getCollectionLink(collection), doc3, null, false).toBlocking().single(); - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void replaceAndDeleteWithUniqueIndex() throws Exception { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - UniqueKeyPolicy uniqueKeyPolicy = new UniqueKeyPolicy(); - UniqueKey uniqueKey = new UniqueKey(); - uniqueKey.setPaths(ImmutableList.of("/name", "/description")); - uniqueKeyPolicy.setUniqueKeys(Collections.singleton(uniqueKey)); - collectionDefinition.setUniqueKeyPolicy(uniqueKeyPolicy); - - collection = client.createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single().getResource(); - - ObjectMapper om = new ObjectMapper(); - - ObjectNode doc1 = om.readValue("{\"name\":\"عمر خیّام\",\"description\":\"poet\"}", ObjectNode.class); - ObjectNode doc3 = om.readValue("{\"name\":\"Rabindranath Tagore\",\"description\":\"poet\"}", ObjectNode.class); - ObjectNode doc2 = om.readValue("{\"name\":\"عمر خیّام\",\"description\":\"mathematician\"}", ObjectNode.class); - - Document doc1Inserted = client.createDocument( - getCollectionLink(collection), doc1, null, false).toBlocking().single().getResource(); - - client.replaceDocument(doc1Inserted.getSelfLink(), doc1Inserted, null).toBlocking().single(); // Replace with same values -- OK. - - Document doc2Inserted = client.createDocument(getCollectionLink(collection), doc2, null, false).toBlocking().single().getResource(); - Document doc2Replacement = new Document(doc1Inserted.toJson()); - doc2Replacement.setId( doc2Inserted.getId()); - - try { - client.replaceDocument(doc2Inserted.getSelfLink(), doc2Replacement, null).toBlocking().single(); // Replace doc2 with values from doc1 -- Conflict. - fail("Did not throw due to unique constraint"); - } - catch (RuntimeException ex) { - assertThat(getDocumentClientException(ex).getStatusCode()).isEqualTo(HttpConstants.StatusCodes.CONFLICT); - } - - doc3.put("id", doc1Inserted.getId()); - client.replaceDocument(doc1Inserted.getSelfLink(), doc3, null).toBlocking().single(); // Replace with values from doc3 -- OK. - - client.deleteDocument(doc1Inserted.getSelfLink(), null).toBlocking().single(); - client.createDocument(getCollectionLink(collection), doc1, null, false).toBlocking().single(); - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void uniqueKeySerializationDeserialization() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - UniqueKeyPolicy uniqueKeyPolicy = new UniqueKeyPolicy(); - UniqueKey uniqueKey = new UniqueKey(); - uniqueKey.setPaths(ImmutableList.of("/name", "/description")); - uniqueKeyPolicy.setUniqueKeys(Collections.singleton(uniqueKey)); - collectionDefinition.setUniqueKeyPolicy(uniqueKeyPolicy); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.Consistent); - ExcludedPath excludedPath = new ExcludedPath(); - excludedPath.setPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath(); - includedPath1.setPath("/name/?"); - includedPath1.setIndexes(Collections.singletonList(new HashIndex(DataType.String, 7))); - - IncludedPath includedPath2 = new IncludedPath(); - includedPath2.setPath("/description/?"); - includedPath2.setIndexes(Collections.singletonList(new HashIndex(DataType.String, 7))); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - collectionDefinition.setIndexingPolicy(indexingPolicy); - - DocumentCollection createdCollection = client.createCollection(database.getSelfLink(), collectionDefinition, - null).toBlocking().single().getResource(); - - DocumentCollection collection = client.readCollection(getCollectionLink(createdCollection), null) - .toBlocking().single().getResource(); - - assertThat(collection.getUniqueKeyPolicy()).isNotNull(); - assertThat(collection.getUniqueKeyPolicy().getUniqueKeys()).isNotNull(); - assertThat(collection.getUniqueKeyPolicy().getUniqueKeys()) - .hasSameSizeAs(collectionDefinition.getUniqueKeyPolicy().getUniqueKeys()); - assertThat(collection.getUniqueKeyPolicy().getUniqueKeys() - .stream().map(ui -> ui.getPaths()).collect(Collectors.toList())) - .containsExactlyElementsOf( - ImmutableList.of(ImmutableList.of("/name", "/description"))); - } - - private DocumentClientException getDocumentClientException(RuntimeException e) { - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(e.getCause(), DocumentClientException.class); - assertThat(dce).isNotNull(); - return dce; - } - - private String getDatabaseLink() { - return database.getSelfLink(); - } - - public String getCollectionLink() { - return "dbs/" + database.getId() + "/colls/" + collection.getId(); - } - - @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - // set up the client - client = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - database = createDatabase(client, databaseId); - } - - @AfterClass(groups = { "long" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserCrudTest.java deleted file mode 100644 index ce47630b91ad..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserCrudTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.Permission; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; - -import rx.Observable; - -import javax.net.ssl.SSLException; - - -public class UserCrudTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public UserCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void createUser() throws Exception { - //create user - User user = new User(); - user.setId(UUID.randomUUID().toString()); - - Observable> createObservable = client.createUser(getDatabaseLink(), user, null); - - // validate user creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(user.getId()) - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void readUser() throws Exception { - - //create user - User user = new User(); - user.setId(UUID.randomUUID().toString()); - - User readBackUser = client.createUser(getDatabaseLink(), user, null).toBlocking().single().getResource(); - - // read user - Observable> readObservable = client.readUser(readBackUser.getSelfLink(), null); - - //validate user read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(readBackUser.getId()) - .notNullEtag() - .build(); - - validateSuccess(readObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void deleteUser() throws Exception { - //create user - User user = new User(); - user.setId(UUID.randomUUID().toString()); - - User readBackUser = client.createUser(getDatabaseLink(), user, null).toBlocking().single().getResource(); - - // delete user - Observable> deleteObservable = client.deleteUser(readBackUser.getSelfLink(), null); - - // validate user delete - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - - // attempt to read the user which was deleted - Observable> readObservable = client.readUser(readBackUser.getSelfLink(), null); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, notFoundValidator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void upsertUser() throws Exception { - - //create user - User user = new User(); - user.setId(UUID.randomUUID().toString()); - - User readBackUser = client.upsertUser(getDatabaseLink(), user, null).toBlocking().single().getResource(); - - // read user to validate creation - Observable> readObservable = client.readUser(readBackUser.getSelfLink(), null); - - //validate user read - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackUser.getId()) - .notNullEtag() - .build(); - - validateSuccess(readObservable, validatorForRead); - - client.readUsers(getDatabaseLink(), null).toBlocking().subscribe(users -> { - try { - int initialNumberOfUsers = users.getResults().size(); - //update user - readBackUser.setId(UUID.randomUUID().toString()); - - Observable> updateObservable = client.upsertUser(getDatabaseLink(), readBackUser, null); - - // validate user upsert - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackUser.getId()) - .notNullEtag() - .build(); - - validateSuccess(updateObservable, validatorForUpdate); - - //verify that new user is added due to upsert with changed id - client.readUsers(getDatabaseLink(), null).toBlocking().subscribe(newUsers ->{ - int finalNumberOfUsers = newUsers.getResults().size(); - assertThat(finalNumberOfUsers).isEqualTo(initialNumberOfUsers + 1); - }); - } catch (Exception e) { - e.printStackTrace(); - } - }); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void replaceUser() throws Exception { - - //create user - User user = new User(); - user.setId(UUID.randomUUID().toString()); - - User readBackUser = client.createUser(getDatabaseLink(), user, null).toBlocking().single().getResource(); - - // read user to validate creation - Observable> readObservable = client.readUser(readBackUser.getSelfLink(), null); - - //validate user read - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackUser.getId()) - .notNullEtag() - .build(); - - validateSuccess(readObservable, validatorForRead); - - //update user - readBackUser.setId(UUID.randomUUID().toString()); - - Observable> updateObservable = client.replaceUser(readBackUser, null); - - // validate user replace - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackUser.getId()) - .notNullEtag() - .build(); - - validateSuccess(updateObservable, validatorForUpdate); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - Database d = new Database(); - d.setId(databaseId); - createdDatabase = createDatabase(client, d); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase.getId()); - safeClose(client); - } - - private String getDatabaseLink() { - return createdDatabase.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionCrudTest.java deleted file mode 100644 index ed03ec2026b2..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionCrudTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - - -public class UserDefinedFunctionCrudTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public UserDefinedFunctionCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createUserDefinedFunction() throws Exception { - // create udf - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - - Observable> createObservable = client.createUserDefinedFunction(getCollectionLink(), udf, null); - - // validate udf creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(udf.getId()) - .withUserDefinedFunctionBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readUserDefinedFunction() throws Exception { - // create a udf - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - UserDefinedFunction readBackUdf = client.createUserDefinedFunction(getCollectionLink(), udf, null).toBlocking().single().getResource(); - - - // read udf - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readUserDefinedFunction(readBackUdf.getSelfLink(), null); - - //validate udf read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(udf.getId()) - .withUserDefinedFunctionBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void deleteUserDefinedFunction() throws Exception { - // create a udf - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - UserDefinedFunction readBackUdf = client.createUserDefinedFunction(getCollectionLink(), udf, null).toBlocking().single().getResource(); - - // delete udf - Observable> deleteObservable = client.deleteUserDefinedFunction(readBackUdf.getSelfLink(), null); - - // validate udf delete - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionQueryTest.java deleted file mode 100644 index b8ffbc79fe9f..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionQueryTest.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - - -public class UserDefinedFunctionQueryTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdUDF = new ArrayList<>(); - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public UserDefinedFunctionQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithFilter() throws Exception { - - String filterId = createdUDF.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryUserDefinedFunctions(getCollectionLink(), query, options); - - List expectedDocs = createdUDF.stream().filter(sp -> filterId.equals(sp.getId()) ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void query_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryUserDefinedFunctions(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAll() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(3); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryUserDefinedFunctions(getCollectionLink(), query, options); - - List expectedDocs = createdUDF; - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(expectedDocs - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryUserDefinedFunctions(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - public UserDefinedFunction createUserDefinedFunction(AsyncDocumentClient client) { - UserDefinedFunction storedProcedure = getUserDefinedFunctionDef(); - return client.createUserDefinedFunction(getCollectionLink(), storedProcedure, null).toBlocking().single().getResource(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdUDF.add(createUserDefinedFunction(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static UserDefinedFunction getUserDefinedFunctionDef() { - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - return udf; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionUpsertReplaceTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionUpsertReplaceTest.java deleted file mode 100644 index 5d35cf792b2b..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionUpsertReplaceTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - - -public class UserDefinedFunctionUpsertReplaceTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public UserDefinedFunctionUpsertReplaceTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void upsertUserDefinedFunction() throws Exception { - - // create a udf - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - - UserDefinedFunction readBackUdf = null; - - try { - readBackUdf = client.upsertUserDefinedFunction(getCollectionLink(), udf, null).toBlocking().single().getResource(); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - // read udf to validate creation - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readUserDefinedFunction(readBackUdf.getSelfLink(), null); - - // validate udf create - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackUdf.getId()) - .withUserDefinedFunctionBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update udf - readBackUdf.setBody("function() {var x = 11;}"); - - Observable> updateObservable = client.upsertUserDefinedFunction(getCollectionLink(), readBackUdf, null); - - // validate udf update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackUdf.getId()) - .withUserDefinedFunctionBody("function() {var x = 11;}") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void replaceUserDefinedFunction() throws Exception { - - // create a udf - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - - UserDefinedFunction readBackUdf = null; - - try { - readBackUdf = client.createUserDefinedFunction(getCollectionLink(), udf, null).toBlocking().single().getResource(); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - // read udf to validate creation - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readUserDefinedFunction(readBackUdf.getSelfLink(), null); - - // validate udf creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackUdf.getId()) - .withUserDefinedFunctionBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update udf - readBackUdf.setBody("function() {var x = 11;}"); - - Observable> replaceObservable = client.replaceUserDefinedFunction(readBackUdf, null); - - //validate udf replace - ResourceResponseValidator validatorForReplace = new ResourceResponseValidator.Builder() - .withId(readBackUdf.getId()) - .withUserDefinedFunctionBody("function() {var x = 11;}") - .notNullEtag() - .build(); - validateSuccess(replaceObservable, validatorForReplace); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - truncateCollection(createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserQueryTest.java deleted file mode 100644 index a1feb7046b18..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserQueryTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class UserQueryTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - - private List createdUsers = new ArrayList<>(); - - private AsyncDocumentClient client; - - private String getDatabaseLink() { - return Utils.getDatabaseNameLink(databaseId); - } - - @Factory(dataProvider = "clientBuilders") - public UserQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryUsersWithFilter() throws Exception { - - String filterUserId = createdUsers.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterUserId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client.queryUsers(getDatabaseLink(), query, options); - - List expectedUsers = createdUsers.stream() - .filter(c -> StringUtils.equals(filterUserId, c.getId()) ).collect(Collectors.toList()); - - assertThat(expectedUsers).isNotEmpty(); - - int expectedPageSize = (expectedUsers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedUsers.size()) - .exactlyContainsInAnyOrder(expectedUsers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAllUsers() throws Exception { - - String query = "SELECT * from c"; - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - String databaseLink = Utils.getDatabaseNameLink(databaseId); - Observable> queryObservable = client.queryUsers(databaseLink, query, options); - - List expectedUsers = createdUsers; - - assertThat(expectedUsers).isNotEmpty(); - - int expectedPageSize = (expectedUsers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedUsers.size()) - .exactlyContainsInAnyOrder(expectedUsers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryUsers_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - Observable> queryObservable = client.queryUsers(getDatabaseLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - - Database d1 = new Database(); - d1.setId(databaseId); - createDatabase(client, d1); - - for(int i = 0; i < 5; i++) { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - createdUsers.add(createUser(client, databaseId, user)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/VeryLargeDocumentQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/VeryLargeDocumentQueryTest.java deleted file mode 100644 index b196a888e376..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/VeryLargeDocumentQueryTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import org.apache.commons.lang3.StringUtils; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.UUID; - -import static org.apache.commons.io.FileUtils.ONE_MB; - -public class VeryLargeDocumentQueryTest extends TestSuiteBase { - private final static int TIMEOUT = 60000; - private final static int SETUP_TIMEOUT = 60000; - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "simpleClientBuildersWithDirect") - public VeryLargeDocumentQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void queryLargeDocuments() { - int cnt = 5; - for(int i = 0; i < cnt; i++) { - createLargeDocument(); - } - - try { - validateQuerySuccess(client.queryDocuments(getCollectionLink(), "SELECT * FROM r", null), - new FeedResponseListValidator.Builder().totalSize(cnt).build()); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - private void createLargeDocument() { - Document docDefinition = getDocumentDefinition(); - - //Keep size as ~ 1.999MB to account for size of other props - int size = (int) (ONE_MB * 1.999); - docDefinition.set("largeString", StringUtils.repeat("x", size)); - - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - - validateSuccess(createObservable, validator); - } - - @BeforeClass(groups = { "emulator" }, timeOut = 2 * SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "}" - , uuid, uuid)); - return doc; - } - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetryTest.java deleted file mode 100644 index 395a8a19d805..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetryTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.RetryOptions; -import io.reactivex.netty.client.PoolExhaustedException; -import org.mockito.Mockito; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import java.net.URL; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConnectionPoolExhaustedRetryTest { - private static final int TIMEOUT = 10000; - - @DataProvider(name = "exceptionProvider") - public Object[][] exceptionProvider() { - return new Object[][]{ - {Mockito.mock(PoolExhaustedException.class)}, - {new DocumentClientException(-1, Mockito.mock(PoolExhaustedException.class))}, - }; - } - - @Test(groups = {"unit"}, timeOut = TIMEOUT, dataProvider = "exceptionProvider") - public void retryOnConnectionPoolExhausted(Exception exception) throws Exception { - GlobalEndpointManager globalEndpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(new URL("http://localhost")).when(globalEndpointManager).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(globalEndpointManager, false, Mockito.mock(RetryOptions.class)); - - clientRetryPolicy.onBeforeSendRequest(Mockito.mock(RxDocumentServiceRequest.class)); - IRetryPolicy.ShouldRetryResult shouldRetryResult = clientRetryPolicy.shouldRetry(exception).toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.backOffTime).isGreaterThanOrEqualTo(ConnectionPoolExhaustedRetry.RETRY_WAIT_TIME); - - Mockito.verify(globalEndpointManager, Mockito.times(1)).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.verify(globalEndpointManager, Mockito.times(1)).CanUseMultipleWriteLocations(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.verifyNoMoreInteractions(globalEndpointManager); - } - - @Test(groups = {"unit"}, timeOut = TIMEOUT, dataProvider = "exceptionProvider") - public void retryOnConnectionPoolExhausted_Exhausted(Exception exception) throws Exception { - GlobalEndpointManager globalEndpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(new URL("http://localhost")).when(globalEndpointManager).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(globalEndpointManager, false, Mockito.mock(RetryOptions.class)); - - clientRetryPolicy.onBeforeSendRequest(Mockito.mock(RxDocumentServiceRequest.class)); - for (int i = 0; i < ConnectionPoolExhaustedRetry.MAX_RETRY_COUNT; i++) { - IRetryPolicy.ShouldRetryResult shouldRetryResult = clientRetryPolicy.shouldRetry(exception).toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.backOffTime).isGreaterThanOrEqualTo(ConnectionPoolExhaustedRetry.RETRY_WAIT_TIME); - } - - IRetryPolicy.ShouldRetryResult shouldRetryResult = clientRetryPolicy.shouldRetry(exception).toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isFalse(); - assertThat(shouldRetryResult.backOffTime).isNull(); - // no interaction with global endpoint manager - Mockito.verify(globalEndpointManager, Mockito.times(1)).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.verify(globalEndpointManager, Mockito.times(1)).CanUseMultipleWriteLocations(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.verifyNoMoreInteractions(globalEndpointManager); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests1.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests1.java deleted file mode 100644 index a7d110a9b8c3..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests1.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKind; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.ResourceResponseValidator; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import org.testng.SkipException; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.ArrayList; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConsistencyTests1 extends ConsistencyTestsBase { - - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateStrongConsistencyOnSyncReplication() throws Exception { - if (!TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString())) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Strong).build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Strong).build(); - User userDefinition = getUserDefinition(); - userDefinition.setId(userDefinition.getId() + "validateStrongConsistencyOnSyncReplication"); - User user = safeCreateUser(this.initClient, createdDatabase.getId(), userDefinition); - validateStrongConsistency(user); - } - - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateConsistentLSNForDirectTCPClient() { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - validateConsistentLSN(); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateConsistentLSNForDirectHttpsClient() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - validateConsistentLSN(); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateConsistentLSNAndQuorumAckedLSNForDirectTCPClient() { - //TODO Need to test with TCP protocol - //https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - validateConsistentLSNAndQuorumAckedLSN(); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateStrongDynamicQuorum() { - if (!TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString())) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - validateReadQuorum(ConsistencyLevel.Strong, ResourceType.Document, false); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateBoundedStalenessDynamicQuorumSyncReplication() { - if (!(TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString()) || TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.BoundedStaleness.toString()))) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - validateReadQuorum(ConsistencyLevel.BoundedStaleness, ResourceType.Document, true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateConsistentLSNAndQuorumAckedLSNForDirectHttpsClient() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - validateConsistentLSNAndQuorumAckedLSN(); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateStrongConsistencyOnAsyncReplicationGW() throws InterruptedException { - validateStrongConsistencyOnAsyncReplication(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateStrongConsistencyOnAsyncReplicationDirect() throws InterruptedException { - validateStrongConsistencyOnAsyncReplication(false); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionContainerAfterCollectionCreateReplace() { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //validateSessionContainerAfterCollectionCreateReplace(false, Protocol.Tcp); - validateSessionContainerAfterCollectionCreateReplace(false); - validateSessionContainerAfterCollectionCreateReplace(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateConsistentPrefixOnSyncReplication() throws InterruptedException { - if (!(TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString()) || TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.BoundedStaleness.toString()))) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.BoundedStaleness).build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.BoundedStaleness).build(); - User user = safeCreateUser(this.initClient, createdDatabase.getId(), getUserDefinition()); - boolean readLagging = validateConsistentPrefix(user); - assertThat(readLagging).isFalse(); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateConsistentPrefixOnAsyncReplication() throws InterruptedException { - if (!(TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString()) || TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.BoundedStaleness.toString()))) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.BoundedStaleness) - .build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.BoundedStaleness) - .build(); - Document documentDefinition = getDocumentDefinition(); - Document document = createDocument(this.initClient, createdDatabase.getId(), createdCollection.getId(), documentDefinition); - boolean readLagging = validateConsistentPrefix(document); - //assertThat(readLagging).isTrue(); //Will fail if batch repl is turned off - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateConsistentPrefixWithReplicaRestartWithPause() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateConsistentPrefixWithReplicaRestart() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSubstatusCodeOnNotFoundExceptionInSessionReadAsync() { - validateSubstatusCodeOnNotFoundExceptionInSessionReadAsync(false); - validateSubstatusCodeOnNotFoundExceptionInSessionReadAsync(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateBarrierStrongConsistencyForMasterResources() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - private void validateSubstatusCodeOnNotFoundExceptionInSessionReadAsync(boolean useGateway) { - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - AsyncDocumentClient client = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - DocumentCollection documentCollection = new DocumentCollection(); - documentCollection.setId(UUID.randomUUID().toString()); - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - partitionKeyDefinition.setKind(PartitionKind.Hash); - ArrayList paths = new ArrayList(); - paths.add("/id"); - partitionKeyDefinition.setPaths(paths); - documentCollection.setPartitionKey(partitionKeyDefinition); - - DocumentCollection collection = client.createCollection(createdDatabase.getSelfLink(), documentCollection, null).toBlocking().first().getResource(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey("1")); - - Document documentDefinition = new Document(); - documentDefinition.setId("1"); - Document document = client.createDocument(collection.getSelfLink(), documentDefinition, requestOptions, false).toBlocking().first().getResource(); - - Observable> deleteObservable = client.deleteDocument(document.getSelfLink(), requestOptions); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(deleteObservable, validator); - Observable> readObservable = client.readDocument(document.getSelfLink(), requestOptions); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().unknownSubStatusCode().build(); - validateFailure(readObservable, notFoundValidator); - - } finally { - safeClose(client); - } - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(USER_NAME); - return user; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests2.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests2.java deleted file mode 100644 index 0d61a14ed528..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests2.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.SessionTokenHelper; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import org.apache.commons.lang3.Range; -import org.testng.annotations.Test; -import rx.Completable; -import rx.Observable; -import rx.functions.Action1; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConsistencyTests2 extends ConsistencyTestsBase { - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateReadSessionOnAsyncReplication() throws InterruptedException { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - Document document = this.initClient.createDocument(createdCollection.getSelfLink(), getDocumentDefinition(), null, false).toBlocking().first().getResource(); - Thread.sleep(5000);//WaitForServerReplication - boolean readLagging = this.validateReadSession(document); - //assertThat(readLagging).isTrue(); //Will fail if batch repl is turned off - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateWriteSessionOnAsyncReplication() throws InterruptedException { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - Document document = this.initClient.createDocument(createdCollection.getSelfLink(), getDocumentDefinition(), null, false).toBlocking().first().getResource(); - Thread.sleep(5000);//WaitForServerReplication - boolean readLagging = this.validateWriteSession(document); - //assertThat(readLagging).isTrue(); //Will fail if batch repl is turned off - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateEventualConsistencyOnAsyncReplicationDirect() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateEventualConsistencyOnAsyncReplicationGateway() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionContainerAfterCollectionDeletion() throws Exception { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - // Verify the collection deletion will trigger the session token clean up (even for different client) - //this.ValidateSessionContainerAfterCollectionDeletion(true, Protocol.Tcp); - this.validateSessionContainerAfterCollectionDeletion(true); - this.validateSessionContainerAfterCollectionDeletion(false); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateReadDistributionForSessionReads() { - // .NET uses lock method which is eventfully using LastReadAddress only for the test case to pass, we are not implementing this in java - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenWithPreConditionFailure() throws Exception { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenWithPreConditionFailure(false, Protocol.Tcp); - this.validateSessionTokenWithPreConditionFailure(false); - this.validateSessionTokenWithPreConditionFailure(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenWithDocumentNotFound() throws Exception { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenWithDocumentNotFoundException(false, Protocol.Tcp); - this.validateSessionTokenWithDocumentNotFoundException(false); - this.validateSessionTokenWithDocumentNotFoundException(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenWithExpectedException() throws Exception { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenWithExpectedException(false, Protocol.Tcp); - this.validateSessionTokenWithExpectedException(false); - this.validateSessionTokenWithExpectedException(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenWithConflictException() { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenWithConflictException(false, Protocol.Tcp); - this.validateSessionTokenWithConflictException(false); - this.validateSessionTokenWithConflictException(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenMultiPartitionCollection() throws Exception { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenMultiPartitionCollection(false, Protocol.Tcp); - this.validateSessionTokenMultiPartitionCollection(false); - this.validateSessionTokenMultiPartitionCollection(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenFromCollectionReplaceIsServerToken() { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenFromCollectionReplaceIsServerToken(false, Protocol.Tcp); - this.validateSessionTokenFromCollectionReplaceIsServerToken(false); - this.validateSessionTokenFromCollectionReplaceIsServerToken(true); - } - - //TODO ReadFeed is broken, will enable the test case once it get fixed - //https://msdata.visualstudio.com/CosmosDB/_workitems/edit/358715 - @Test(groups = {"direct"}, enabled = false, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateNoChargeOnFailedSessionRead() throws Exception { - // Direct clients for read and write operations - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - // Client locked to replica for pause/resume - RxDocumentClientImpl readSecondaryClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - // Create collection - DocumentCollection parentResource = writeClient.createCollection(createdDatabase.getSelfLink(), getCollectionDefinition(), null).toBlocking().first().getResource(); - - // Document to lock pause/resume clients - Document documentDefinition = getDocumentDefinition(); - documentDefinition.setId("test" + documentDefinition.getId()); - ResourceResponse childResource = writeClient.createDocument(parentResource.getSelfLink(), documentDefinition, null, true).toBlocking().first(); - logger.info("Created {} child resource", childResource.getResource().getResourceId()); - - String token = childResource.getSessionToken().split(":")[0] + ":" + this.createSessionToken(SessionTokenHelper.parse(childResource.getSessionToken()), 100000000).convertToString(); - - FeedOptions feedOptions = new FeedOptions(); - feedOptions.setPartitionKey(new PartitionKey(PartitionKeyInternal.Empty.toJson())); - feedOptions.setSessionToken(token); - FailureValidator validator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.NOTFOUND).subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); - Observable> feedObservable = readSecondaryClient.readDocuments(parentResource.getSelfLink(), feedOptions); - validateQueryFailure(feedObservable, validator); - } finally { - safeClose(writeClient); - safeClose(readSecondaryClient); - } - } - - @Test(groups = {"direct"}, enabled = false, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateStrongReadOnOldDocument() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Note that we need multiple CONSISTENCY_TEST_TIMEOUT - // SEE: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @Test(groups = {"direct"}, timeOut = 2 * CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenAsync() { - // Validate that document query never fails - // with NotFoundException - List documents = new ArrayList<>(); - for (int i = 0; i < 1000; i++) { - Document documentDefinition = getDocumentDefinition(); - documentDefinition.set(UUID.randomUUID().toString(), UUID.randomUUID().toString()); - documents.add(documentDefinition); - } - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - RxDocumentClientImpl client = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - try { - Document lastDocument = client.createDocument(createdCollection.getSelfLink(), getDocumentDefinition(), null, true) - .toBlocking() - .first() - .getResource(); - - Completable task1 = ParallelAsync.forEachAsync(Range.between(0, 1000), 5, new Action1() { - @Override - public void call(Integer index) { - client.createDocument(createdCollection.getSelfLink(), documents.get(index % documents.size()), null, true).toBlocking().first(); - } - }); - - Completable task2 = ParallelAsync.forEachAsync(Range.between(0, 1000), 5, new Action1() { - @Override - public void call(Integer index) { - try { - FeedOptions feedOptions = new FeedOptions(); - feedOptions.setEnableCrossPartitionQuery(true); - FeedResponse queryResponse = client.queryDocuments(createdCollection.getSelfLink(), "SELECT * FROM c WHERE c.Id = 'foo'", feedOptions).toBlocking().first(); - String lsnHeaderValue = queryResponse.getResponseHeaders().get(WFConstants.BackendHeaders.LSN); - long lsn = Long.valueOf(lsnHeaderValue); - String sessionTokenHeaderValue = queryResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - ISessionToken sessionToken = SessionTokenHelper.parse(sessionTokenHeaderValue); - logger.info("Session Token = {}, LSN = {}", sessionToken.convertToString(), lsn); - assertThat(lsn).isEqualTo(sessionToken.getLSN()); - } catch (Exception ex) { - DocumentClientException clientException = (DocumentClientException) ex.getCause(); - if (clientException.getStatusCode() != 0) { - if (clientException.getStatusCode() == HttpConstants.StatusCodes.REQUEST_TIMEOUT) { - // ignore - } else if (clientException.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND) { - String lsnHeaderValue = clientException.getResponseHeaders().get(WFConstants.BackendHeaders.LSN); - long lsn = Long.valueOf(lsnHeaderValue); - String sessionTokenHeaderValue = clientException.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - ISessionToken sessionToken = SessionTokenHelper.parse(sessionTokenHeaderValue); - - logger.info("Session Token = {}, LSN = {}", sessionToken.convertToString(), lsn); - assertThat(lsn).isEqualTo(sessionToken.getLSN()); - } else { - throw ex; - } - } else { - throw ex; - } - } - } - }); - Completable.mergeDelayError(task1, task2).await(); - } finally { - safeClose(client); - } - } - -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTestsBase.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTestsBase.java deleted file mode 100644 index c26246436094..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTestsBase.java +++ /dev/null @@ -1,861 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.AccessCondition; -import com.microsoft.azure.cosmosdb.AccessConditionType; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKind; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.internal.SessionTokenHelper; -import com.microsoft.azure.cosmosdb.internal.VectorSessionToken; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.ResourceResponseValidator; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import org.apache.commons.collections4.map.UnmodifiableMap; -import org.apache.commons.lang3.StringUtils; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import rx.Observable; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.Date; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConsistencyTestsBase extends TestSuiteBase { - static final int CONSISTENCY_TEST_TIMEOUT = 120000; - static final String USER_NAME = "TestUser"; - RxDocumentClientImpl writeClient; - RxDocumentClientImpl readClient; - AsyncDocumentClient initClient; - Database createdDatabase; - DocumentCollection createdCollection; - - @BeforeClass(groups = {"direct"}, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - initClient = createGatewayRxDocumentClient().build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - void validateStrongConsistency(Resource resourceToWorkWith) throws Exception { - int numberOfTestIteration = 5; - Resource writeResource = resourceToWorkWith; - while (numberOfTestIteration-- > 0) //Write from a client and do point read through second client and ensure TS matches. - { - Date sourceTimestamp = writeResource.getTimestamp(); - Thread.sleep(1000); //Timestamp is in granularity of seconds. - Resource updatedResource = null; - if (resourceToWorkWith instanceof User) { - updatedResource = this.writeClient.upsertUser(createdDatabase.getSelfLink(), (User) writeResource, null).toBlocking().first().getResource(); - } else if (resourceToWorkWith instanceof Document) { - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(resourceToWorkWith.get("mypk"))); - updatedResource = this.writeClient.upsertDocument(createdCollection.getSelfLink(), (Document) writeResource, options, false).toBlocking().first().getResource(); - } - assertThat(updatedResource.getTimestamp().after(sourceTimestamp)).isTrue(); - - User readResource = this.readClient.readUser(resourceToWorkWith.getSelfLink(), null).toBlocking().first().getResource(); - assertThat(updatedResource.getTimestamp().equals(readResource.getTimestamp())); - } - } - - void validateConsistentLSN() { - Document documentDefinition = getDocumentDefinition(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(documentDefinition.get("mypk"))); - Document document = createDocument(this.writeClient, createdDatabase.getId(), createdCollection.getId(), documentDefinition); - ResourceResponse response = this.writeClient.deleteDocument(document.getSelfLink(), options).toBlocking().single(); - assertThat(response.getStatusCode()).isEqualTo(204); - - long quorumAckedLSN = Long.parseLong((String) response.getResponseHeaders().get(WFConstants.BackendHeaders.QUORUM_ACKED_LSN)); - assertThat(quorumAckedLSN > 0).isTrue(); - FailureValidator validator = new FailureValidator.Builder().statusCode(404).lsnGreaterThan(quorumAckedLSN).build(); - Observable> readObservable = this.readClient.readDocument(document.getSelfLink(), options); - validateFailure(readObservable, validator); - } - - void validateConsistentLSNAndQuorumAckedLSN() { - Document documentDefinition = getDocumentDefinition(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(documentDefinition.get("mypk"))); - Document document = createDocument(this.writeClient, createdDatabase.getId(), createdCollection.getId(), documentDefinition); - ResourceResponse response = this.writeClient.deleteDocument(document.getSelfLink(), options).toBlocking().single(); - assertThat(response.getStatusCode()).isEqualTo(204); - - long quorumAckedLSN = Long.parseLong((String) response.getResponseHeaders().get(WFConstants.BackendHeaders.QUORUM_ACKED_LSN)); - assertThat(quorumAckedLSN > 0).isTrue(); - - FailureValidator validator = new FailureValidator.Builder().statusCode(404).lsnGreaterThanEqualsTo(quorumAckedLSN).exceptionQuorumAckedLSNInNotNull().build(); - Observable> readObservable = this.readClient.deleteDocument(document.getSelfLink(), options); - validateFailure(readObservable, validator); - - } - - void validateReadQuorum(ConsistencyLevel consistencyLevel, ResourceType childResourceType, boolean isBoundedStaleness) { - //TODO this need to complete once we implement emulator container in java, and then we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - void validateStrongConsistencyOnAsyncReplication(boolean useGateway) throws InterruptedException { - if (!TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString())) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } - - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Strong).build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Strong).build(); - - Document documentDefinition = getDocumentDefinition(); - Document document = createDocument(this.writeClient, createdDatabase.getId(), createdCollection.getId(), documentDefinition); - validateStrongConsistency(document); - } - - void validateStrongConsistency(Document documentToWorkWith) throws InterruptedException { - int numberOfTestIteration = 5; - Document writeDocument = documentToWorkWith; - while (numberOfTestIteration-- > 0) { - Date sourceTimestamp = writeDocument.getTimestamp(); - Thread.sleep(1000);//Timestamp is in granularity of seconds. - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(documentToWorkWith.get("mypk"))); - Document updatedDocument = this.writeClient.replaceDocument(writeDocument, options).toBlocking().first().getResource(); - assertThat(updatedDocument.getTimestamp().after(sourceTimestamp)).isTrue(); - - Document readDocument = this.readClient.readDocument(documentToWorkWith.getSelfLink(), options).toBlocking().first().getResource(); - assertThat(updatedDocument.getTimestamp().equals(readDocument.getTimestamp())); - } - } - - void validateSessionContainerAfterCollectionCreateReplace(boolean useGateway) { - // Direct clients for read and write operations - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - try { - PartitionKeyDefinition partitionKey = new PartitionKeyDefinition(); - partitionKey.setPaths(Arrays.asList("/customerid")); - partitionKey.setKind(PartitionKind.Hash); - DocumentCollection coll = null; - { - // self link - ResourceResponse collection = writeClient.createCollection(createdDatabase.getSelfLink(), getCollectionDefinition(), null).toBlocking().first(); - String globalSessionToken1 = ((SessionContainer) writeClient.getSession()).getSessionToken(collection.getResource().getSelfLink()); - String globalSessionToken2 = ((SessionContainer) writeClient.getSession()).getSessionToken(BridgeInternal.getAltLink(collection.getResource())); - System.out.println("BridgeInternal.getAltLink(collection.getResource()) " + BridgeInternal.getAltLink(collection.getResource())); - assertThat(collection.getSessionToken()).isEqualTo(globalSessionToken1); - assertThat(collection.getSessionToken()).isEqualTo(globalSessionToken2); - - coll = collection.getResource(); - ResourceResponse collectionRead = writeClient.readCollection(coll.getSelfLink(), null).toBlocking().first(); - // timesync might bump the version, comment out the check - //assertThat(collection.getSessionToken()).isEqualTo(collectionRead.getSessionToken()); - } - { - // name link - ResourceResponse collection = writeClient.createCollection(BridgeInternal.getAltLink(createdDatabase), getCollectionDefinition(), null).toBlocking().first(); - - String globalSessionToken1 = ((SessionContainer) writeClient.getSession()).getSessionToken(collection.getResource().getSelfLink()); - String globalSessionToken2 = ((SessionContainer) writeClient.getSession()).getSessionToken(BridgeInternal.getAltLink(collection.getResource())); - assertThat(collection.getSessionToken()).isEqualTo(globalSessionToken1); - //assertThat(collection.getSessionToken()).isEqualTo(globalSessionToken2); - - ResourceResponse collectionRead = - writeClient.readCollection(BridgeInternal.getAltLink(collection.getResource()), null).toBlocking().first(); - // timesync might bump the version, comment out the check - //assertThat(collection.getSessionToken()).isEqualTo(collectionRead.getSessionToken()); - } - { - Document document2 = new Document(); - document2.setId("test" + UUID.randomUUID().toString()); - document2.set("customerid", 2); - // name link - ResourceResponse document = writeClient.createDocument(BridgeInternal.getAltLink(coll), document2, null, false).toBlocking().first(); - String globalSessionToken1 = ((SessionContainer) writeClient.getSession()).getSessionToken(coll.getSelfLink()); - String globalSessionToken2 = ((SessionContainer) writeClient.getSession()).getSessionToken(BridgeInternal.getAltLink(coll)); - - assertThat(globalSessionToken1.indexOf(document.getSessionToken())).isNotNegative(); - assertThat(globalSessionToken2.indexOf(document.getSessionToken())).isNotNegative(); - } - { - Document document2 = new Document(); - document2.setId("test" + UUID.randomUUID().toString()); - document2.set("customerid", 3); - // name link - ResourceResponse document = writeClient.createDocument(BridgeInternal.getAltLink(coll), document2, null, false).toBlocking().first(); - String globalSessionToken1 = ((SessionContainer) writeClient.getSession()).getSessionToken(coll.getSelfLink()); - String globalSessionToken2 = ((SessionContainer) writeClient.getSession()).getSessionToken(BridgeInternal.getAltLink(coll)); - - assertThat(globalSessionToken1.indexOf(document.getSessionToken())).isNotNegative(); - assertThat(globalSessionToken2.indexOf(document.getSessionToken())).isNotNegative(); - } - } finally { - safeClose(writeClient); - } - } - - boolean validateConsistentPrefix(Resource resourceToWorkWith) throws InterruptedException { - int numberOfTestIteration = 5; - Date lastReadDateTime = resourceToWorkWith.getTimestamp(); - boolean readLagging = false; - Resource writeResource = resourceToWorkWith; - - while (numberOfTestIteration-- > 0) { //Write from a client and do point read through second client and ensure TS monotonically increases. - Date sourceTimestamp = writeResource.getTimestamp(); - Thread.sleep(1000); //Timestamp is in granularity of seconds. - Resource updatedResource = null; - if (resourceToWorkWith instanceof User) { - updatedResource = this.writeClient.upsertUser(createdDatabase.getSelfLink(), (User) writeResource, null).toBlocking().first().getResource(); - } else if (resourceToWorkWith instanceof Document) { - updatedResource = this.writeClient.upsertDocument(createdCollection.getSelfLink(), (Document) writeResource, null, false).toBlocking().first().getResource(); - } - assertThat(updatedResource.getTimestamp().after(sourceTimestamp)).isTrue(); - writeResource = updatedResource; - - Resource readResource = null; - if (resourceToWorkWith instanceof User) { - readResource = this.readClient.readUser(resourceToWorkWith.getSelfLink(), null).toBlocking().first().getResource(); - } else if (resourceToWorkWith instanceof Document) { - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(resourceToWorkWith.get("mypk"))); - readResource = this.readClient.readDocument(resourceToWorkWith.getSelfLink(), options).toBlocking().first().getResource(); - } - assertThat(readResource.getTimestamp().compareTo(lastReadDateTime) >= 0).isTrue(); - lastReadDateTime = readResource.getTimestamp(); - if (readResource.getTimestamp().before(updatedResource.getTimestamp())) { - readLagging = true; - } - } - return readLagging; - } - - boolean validateReadSession(Resource resourceToWorkWith) throws InterruptedException { - int numberOfTestIteration = 5; - Date lastReadDateTime = new java.sql.Date(0); - boolean readLagging = false; - Resource writeResource = resourceToWorkWith; - - while (numberOfTestIteration-- > 0) { - Date sourceTimestamp = writeResource.getTimestamp(); - Thread.sleep(1000); - Resource updatedResource = null; - if (resourceToWorkWith instanceof Document) { - updatedResource = this.writeClient.upsertDocument(createdCollection.getSelfLink(), writeResource, null, false).toBlocking().single().getResource(); - } - assertThat(updatedResource.getTimestamp().after(sourceTimestamp)).isTrue(); - writeResource = updatedResource; - - Resource readResource = null; - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceToWorkWith.get("mypk"))); - if (resourceToWorkWith instanceof Document) { - readResource = this.readClient.readDocument(resourceToWorkWith.getSelfLink(), requestOptions).toBlocking().first().getResource(); - } - assertThat(readResource.getTimestamp().compareTo(lastReadDateTime) >= 0).isTrue(); - lastReadDateTime = readResource.getTimestamp(); - - if (readResource.getTimestamp().before(updatedResource.getTimestamp())) { - readLagging = true; - } - } - return readLagging; - } - - boolean validateWriteSession(Resource resourceToWorkWith) throws InterruptedException { - int numberOfTestIteration = 5; - Date lastReadDateTime = new java.sql.Date(0); - boolean readLagging = false; - Resource writeResource = resourceToWorkWith; - - while (numberOfTestIteration-- > 0) { - Date sourceTimestamp = writeResource.getTimestamp(); - Thread.sleep(1000); - Resource updatedResource = null; - if (resourceToWorkWith instanceof Document) { - updatedResource = this.writeClient.upsertDocument(createdCollection.getSelfLink(), writeResource, null, false).toBlocking().single().getResource(); - } - assertThat(updatedResource.getTimestamp().after(sourceTimestamp)).isTrue(); - writeResource = updatedResource; - - Resource readResource = null; - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceToWorkWith.get("mypk"))); - if (resourceToWorkWith instanceof Document) { - readResource = this.readClient.readDocument(resourceToWorkWith.getSelfLink(), requestOptions).toBlocking().first().getResource(); - } - assertThat(readResource.getTimestamp().compareTo(lastReadDateTime) >= 0).isTrue(); - lastReadDateTime = readResource.getTimestamp(); - - if (readResource.getTimestamp().before(updatedResource.getTimestamp())) { - readLagging = true; - } - - //Now perform write on session and update our session token and lastReadTS - Thread.sleep(1000); - if (resourceToWorkWith instanceof Document) { - readResource = this.writeClient.upsertDocument(createdCollection.getSelfLink(), readResource, requestOptions, false).toBlocking().first().getResource(); //Now perform write on session - } - assertThat(readResource.getTimestamp().after(lastReadDateTime)); - - this.readClient.setSession(this.writeClient.getSession()); - } - return readLagging; - } - - void validateSessionContainerAfterCollectionDeletion(boolean useGateway) throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl client1 = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - RxDocumentClientImpl client2 = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - String collectionId = UUID.randomUUID().toString(); - try { - DocumentCollection collectionDefinition = getCollectionDefinition(); - collectionDefinition.setId(collectionId); - DocumentCollection collection = createCollection(client2, createdDatabase.getId(), collectionDefinition, null); - ResourceResponseValidator successValidatorCollection = new ResourceResponseValidator.Builder() - .withId(collection.getId()) - .build(); - Observable> readObservableCollection = client2.readCollection(collection.getSelfLink(), null); - validateSuccess(readObservableCollection, successValidatorCollection); - - for (int i = 0; i < 5; i++) { - String documentId = "Generation1-" + i; - Document documentDefinition = getDocumentDefinition(); - documentDefinition.setId(documentId); - Document documentCreated = client2.createDocument(collection.getSelfLink(), documentDefinition, null, true).toBlocking().first().getResource(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(documentCreated.get("mypk"))); - client2.readDocument(BridgeInternal.getAltLink(documentCreated), requestOptions).toBlocking().first(); - client2.readDocument(documentCreated.getSelfLink(), requestOptions).toBlocking().first(); - } - - { - // just create the second for fun - DocumentCollection collection2 = createCollection(client2, createdDatabase.getId(), getCollectionDefinition(), null); - successValidatorCollection = new ResourceResponseValidator.Builder() - .withId(collection2.getId()) - .build(); - readObservableCollection = client2.readCollection(collection2.getSelfLink(), null); - validateSuccess(readObservableCollection, successValidatorCollection); - } - // verify the client2 has the same token. - { - String token1 = ((SessionContainer) client2.getSession()).getSessionToken(BridgeInternal.getAltLink(collection)); - String token2 = ((SessionContainer) client2.getSession()).getSessionToken(collection.getSelfLink()); - assertThat(token1).isEqualTo(token2); - } - - // now delete collection use different client - client1.deleteCollection(collection.getSelfLink(), null).toBlocking().first(); - - DocumentCollection collectionRandom1 = createCollection(client2, createdDatabase.getId(), getCollectionDefinition()); - DocumentCollection documentCollection = getCollectionDefinition(); - collectionDefinition.setId(collectionId); - DocumentCollection collectionSameName = createCollection(client2, createdDatabase.getId(), collectionDefinition); - String documentId1 = "Generation2-" + 0; - Document databaseDefinition2 = getDocumentDefinition(); - databaseDefinition2.setId(documentId1); - Document createdDocument = client1.createDocument(collectionSameName.getSelfLink(), databaseDefinition2, null, true).toBlocking().first().getResource(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(createdDocument.get("mypk"))); - ResourceResponseValidator successValidator = new ResourceResponseValidator.Builder() - .withId(createdDocument.getId()) - .build(); - Observable> readObservable = client1.readDocument(createdDocument.getSelfLink(), requestOptions); - validateSuccess(readObservable, successValidator); - { - String token1 = ((SessionContainer) client1.getSession()).getSessionToken(BridgeInternal.getAltLink(collectionSameName)); - String token2 = ((SessionContainer) client1.getSession()).getSessionToken(collectionSameName.getSelfLink()); - assertThat(token1).isEqualTo(token2); - } - - { - // Client2 read using name link should fail with higher LSN. - String token = ((SessionContainer) client1.getSession()).getSessionToken(collectionSameName.getSelfLink()); - // artificially bump to higher LSN - String higherLsnToken = this.getDifferentLSNToken(token, 2000); - RequestOptions requestOptions1 = new RequestOptions(); - requestOptions1.setSessionToken(higherLsnToken); - requestOptions1.setPartitionKey(new PartitionKey(createdDocument.get("mypk"))); - readObservable = client2.readDocument(BridgeInternal.getAltLink(createdDocument), requestOptions1); - FailureValidator failureValidator = new FailureValidator.Builder().subStatusCode(1002).build(); - validateFailure(readObservable, failureValidator); - } - // this will trigger client2 to clear the token - { - // verify token by altlink is gone! - String token1 = ((SessionContainer) client2.getSession()).getSessionToken(BridgeInternal.getAltLink(collectionSameName)); - String token2 = ((SessionContainer) client2.getSession()).getSessionToken(collection.getSelfLink()); - assertThat(token1).isEmpty(); - //assertThat(token2).isNotEmpty(); In java both SelfLink and AltLink token remain in sync. - } - { - // second read should succeed! - readObservable = client2.readDocument(BridgeInternal.getAltLink(createdDocument), requestOptions); - validateSuccess(readObservable, successValidator); - } - // verify deleting indeed delete the collection session token - { - Document documentTest = - client1.createDocument(BridgeInternal.getAltLink(collectionSameName), getDocumentDefinition(), null, true).toBlocking().first().getResource(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(documentTest.get("mypk"))); - successValidator = new ResourceResponseValidator.Builder() - .withId(documentTest.getId()) - .build(); - readObservable = client1.readDocument(documentTest.getSelfLink(), options); - validateSuccess(readObservable, successValidator); - - client1.deleteCollection(collectionSameName.getSelfLink(), null).toBlocking().first(); - String token1 = ((SessionContainer) client2.getSession()).getSessionToken(BridgeInternal.getAltLink(collectionSameName)); - String token2 = ((SessionContainer) client2.getSession()).getSessionToken(collectionSameName.getSelfLink()); - // currently we can't delete the token from Altlink when deleting using selflink - assertThat(token1).isNotEmpty(); - //assertThat(token2).isEmpty(); In java both SelfLink and AltLink token remain in sync. - } - } finally { - safeClose(client1); - safeClose(client2); - } - - } - - void validateSessionTokenWithPreConditionFailure(boolean useGateway) throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - RxDocumentClientImpl validationClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - // write a document, and upsert to it to update etag. - ResourceResponse documentResponse = writeClient.createDocument(BridgeInternal.getAltLink(createdCollection), getDocumentDefinition(), null, true).toBlocking().first(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(documentResponse.getResource().get("mypk"))); - ResourceResponse upsertResponse = - writeClient.upsertDocument(BridgeInternal.getAltLink(createdCollection), documentResponse.getResource(), requestOptions, true).toBlocking().first(); - - // create a conditioned read request, with first write request's etag, so the read fails with PreconditionFailure - AccessCondition ac = new AccessCondition(); - ac.setCondition(documentResponse.getResource().getETag()); - ac.setType(AccessConditionType.IfMatch); - RequestOptions requestOptions1 = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(documentResponse.getResource().get("mypk"))); - requestOptions1.setAccessCondition(ac); - Observable> preConditionFailureResponseObservable = validationClient.upsertDocument(BridgeInternal.getAltLink(createdCollection), - documentResponse.getResource(), requestOptions1, true); - FailureValidator failureValidator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.PRECONDITION_FAILED).build(); - validateFailure(preConditionFailureResponseObservable, failureValidator); - assertThat(isSessionEqual(((SessionContainer) validationClient.getSession()), (SessionContainer) writeClient.getSession())).isTrue(); - - } finally { - safeClose(writeClient); - safeClose(validationClient); - } - } - - void validateSessionTokenWithDocumentNotFoundException(boolean useGateway) throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - RxDocumentClientImpl validationClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - DocumentCollection collectionDefinition = getCollectionDefinition(); - collectionDefinition.setId("TestCollection"); - - ResourceResponse documentResponse = writeClient.createDocument(BridgeInternal.getAltLink(createdCollection), getDocumentDefinition(), null, true).toBlocking().first(); - - FailureValidator failureValidator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.NOTFOUND).build(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(documentResponse.getResource().get("mypk"))); - // try to read a non existent document in the same partition that we previously wrote to - Observable> readObservable = validationClient.readDocument(BridgeInternal.getAltLink(documentResponse.getResource()) + "dummy", requestOptions); - validateFailure(readObservable, failureValidator); - assertThat(isSessionEqual(((SessionContainer) validationClient.getSession()), (SessionContainer) writeClient.getSession())).isTrue(); - } finally { - safeClose(writeClient); - safeClose(validationClient); - } - } - - void validateSessionTokenWithExpectedException(boolean useGateway) throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - ResourceResponse documentResponse = - writeClient.createDocument(BridgeInternal.getAltLink(createdCollection), getDocumentDefinition(), null, false).toBlocking().first(); - String token = documentResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - - // artificially bump to higher LSN - String higherLsnToken = this.getDifferentLSNToken(token, 2000); - FailureValidator failureValidator = new FailureValidator.Builder().subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(documentResponse.getResource().get("mypk"))); - requestOptions.setSessionToken(higherLsnToken); - // try to read a non existent document in the same partition that we previously wrote to - Observable> readObservable = writeClient.readDocument(BridgeInternal.getAltLink(documentResponse.getResource()), - requestOptions); - validateFailure(readObservable, failureValidator); - - } finally { - safeClose(writeClient); - } - } - - void validateSessionTokenWithConflictException(boolean useGateway) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - RxDocumentClientImpl validationClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - Document documentDefinition = getDocumentDefinition(); - ResourceResponse documentResponse = - writeClient.createDocument(BridgeInternal.getAltLink(createdCollection), documentDefinition, null, true).toBlocking().first(); - - FailureValidator failureValidator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.CONFLICT).build(); - Observable> conflictDocumentResponse = validationClient.createDocument(BridgeInternal.getAltLink(createdCollection), - documentDefinition, null, - true); - validateFailure(conflictDocumentResponse, failureValidator); - } finally { - safeClose(writeClient); - safeClose(validationClient); - } - } - - void validateSessionTokenMultiPartitionCollection(boolean useGateway) throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - - Range fullRange = new Range(PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, - PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey, true, false); - - IRoutingMapProvider routingMapProvider = writeClient.getPartitionKeyRangeCache(); - // assertThat(routingMapProvider.tryGetOverlappingRangesAsync(collection.getResourceId(), fullRange, false).toBlocking().value().size()).isEqualTo(5); - - // Document to lock pause/resume clients - Document document1 = new Document(); - document1.setId("test" + UUID.randomUUID().toString()); - document1.set("mypk", 1); - ResourceResponse childResource1 = writeClient.createDocument(createdCollection.getSelfLink(), document1, null, true).toBlocking().first(); - logger.info("Created {} child resource", childResource1.getResource().getResourceId()); - assertThat(childResource1.getSessionToken()).isNotNull(); - assertThat(childResource1.getSessionToken().contains(":")).isTrue(); - String globalSessionToken1 = ((SessionContainer) writeClient.getSession()).getSessionToken(createdCollection.getSelfLink()); - assertThat(globalSessionToken1.contains(childResource1.getSessionToken())); - - // Document to lock pause/resume clients - Document document2 = new Document(); - document2.setId("test" + UUID.randomUUID().toString()); - document2.set("mypk", 2); - ResourceResponse childResource2 = writeClient.createDocument(createdCollection.getSelfLink(), document2, null, true).toBlocking().first(); - assertThat(childResource2.getSessionToken()).isNotNull(); - assertThat(childResource2.getSessionToken().contains(":")).isTrue(); - String globalSessionToken2 = ((SessionContainer) writeClient.getSession()).getSessionToken(createdCollection.getSelfLink()); - logger.info("globalsessiontoken2 {}, childtoken1 {}, childtoken2 {}", globalSessionToken2, childResource1.getSessionToken(), childResource2.getSessionToken()); - assertThat(globalSessionToken2.contains(childResource2.getSessionToken())).isTrue(); - - // this token can read childresource2 but not childresource1 - String sessionToken = - StringUtils.split(childResource1.getSessionToken(), ':')[0] + ":" + createSessionToken(SessionTokenHelper.parse(childResource1.getSessionToken()), 100000000).convertToString() + "," + childResource2.getSessionToken(); - - RequestOptions option = new RequestOptions(); - option.setSessionToken(sessionToken); - option.setPartitionKey(new PartitionKey(2)); - writeClient.readDocument(childResource2.getResource().getSelfLink(), option).toBlocking().first(); - - option = new RequestOptions(); - option.setSessionToken(StringUtils.EMPTY); - option.setPartitionKey(new PartitionKey(1)); - writeClient.readDocument(childResource1.getResource().getSelfLink(), option).toBlocking().first(); - - option = new RequestOptions(); - option.setSessionToken(sessionToken); - option.setPartitionKey(new PartitionKey(1)); - Observable> readObservable = writeClient.readDocument(childResource1.getResource().getSelfLink(), option); - FailureValidator failureValidator = - new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.NOTFOUND).subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); - validateFailure(readObservable, failureValidator); - - readObservable = writeClient.readDocument(childResource2.getResource().getSelfLink(), option); - failureValidator = - new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.NOTFOUND).subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); - validateFailure(readObservable, failureValidator); - - assertThat(((SessionContainer) writeClient.getSession()).getSessionToken(createdCollection.getSelfLink())).isEqualTo - (((SessionContainer) writeClient.getSession()).getSessionToken(BridgeInternal.getAltLink(createdCollection))); - - assertThat(((SessionContainer) writeClient.getSession()).getSessionToken("asdfasdf")).isEmpty(); - assertThat(((SessionContainer) writeClient.getSession()).getSessionToken(createdDatabase.getSelfLink())).isEmpty(); - } finally { - safeClose(writeClient); - } - } - - void validateSessionTokenFromCollectionReplaceIsServerToken(boolean useGateway) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl client1 = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - RxDocumentClientImpl client2 = null; - try { - Document doc = client1.createDocument(createdCollection.getSelfLink(), getDocumentDefinition(), null, true).toBlocking().first().getResource(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(doc.get("mypk"))); - Document doc1 = client1.readDocument(BridgeInternal.getAltLink(doc), requestOptions).toBlocking().first().getResource(); - - String token1 = ((SessionContainer) client1.getSession()).getSessionToken(createdCollection.getSelfLink()); - client2 = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - client2.replaceCollection(createdCollection, null).toBlocking().first(); - String token2 = ((SessionContainer) client2.getSession()).getSessionToken(createdCollection.getSelfLink()); - - logger.info("Token after document and after collection replace {} = {}", token1, token2); - } finally { - safeClose(client1); - safeClose(client2); - } - } - - @AfterClass(groups = {"direct"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(this.initClient); - safeClose(this.writeClient); - safeClose(this.readClient); - } - - private String getDifferentLSNToken(String token, long lsnDifferent) throws Exception { - String[] tokenParts = StringUtils.split(token, ':'); - ISessionToken sessionToken = SessionTokenHelper.parse(tokenParts[1]); - ISessionToken differentSessionToken = createSessionToken(sessionToken, sessionToken.getLSN() + lsnDifferent); - return String.format("%s:%s", tokenParts[0], differentSessionToken.convertToString()); - } - - public static ISessionToken createSessionToken(ISessionToken from, long globalLSN) throws Exception { - // Creates session token with specified GlobalLSN - if (from instanceof VectorSessionToken) { - VectorSessionToken fromSessionToken = (VectorSessionToken) from; - Field fieldVersion = VectorSessionToken.class.getDeclaredField("version"); - fieldVersion.setAccessible(true); - Long version = (Long) fieldVersion.get(fromSessionToken); - - Field fieldLocalLsnByRegion = VectorSessionToken.class.getDeclaredField("localLsnByRegion"); - fieldLocalLsnByRegion.setAccessible(true); - UnmodifiableMap localLsnByRegion = (UnmodifiableMap) fieldLocalLsnByRegion.get(fromSessionToken); - - Constructor constructor = VectorSessionToken.class.getDeclaredConstructor(long.class, long.class, UnmodifiableMap.class); - constructor.setAccessible(true); - VectorSessionToken vectorSessionToken = constructor.newInstance(version, globalLSN, localLsnByRegion); - return vectorSessionToken; - } else { - throw new IllegalArgumentException(); - } - } - - Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - private boolean isSessionEqual(SessionContainer sessionContainer1, SessionContainer sessionContainer2) throws Exception { - if (sessionContainer1 == null) { - return false; - } - - if (sessionContainer2 == null) { - return false; - } - - if (sessionContainer1 == sessionContainer2) { - return true; - } - - Field fieldCollectionResourceIdToSessionTokens1 = SessionContainer.class.getDeclaredField("collectionResourceIdToSessionTokens"); - Field fieldCollectionNameToCollectionResourceId1 = SessionContainer.class.getDeclaredField("collectionNameToCollectionResourceId"); - fieldCollectionResourceIdToSessionTokens1.setAccessible(true); - fieldCollectionNameToCollectionResourceId1.setAccessible(true); - ConcurrentHashMap> collectionResourceIdToSessionTokens1 = - (ConcurrentHashMap>) fieldCollectionResourceIdToSessionTokens1.get(sessionContainer1); - ConcurrentHashMap collectionNameToCollectionResourceId1 = (ConcurrentHashMap) fieldCollectionNameToCollectionResourceId1.get(sessionContainer1); - - - Field fieldCollectionResourceIdToSessionTokens2 = SessionContainer.class.getDeclaredField("collectionResourceIdToSessionTokens"); - Field fieldCollectionNameToCollectionResourceId2 = SessionContainer.class.getDeclaredField("collectionNameToCollectionResourceId"); - fieldCollectionResourceIdToSessionTokens2.setAccessible(true); - fieldCollectionNameToCollectionResourceId2.setAccessible(true); - ConcurrentHashMap> collectionResourceIdToSessionTokens2 = - (ConcurrentHashMap>) fieldCollectionResourceIdToSessionTokens2.get(sessionContainer2); - ConcurrentHashMap collectionNameToCollectionResourceId2 = (ConcurrentHashMap) fieldCollectionNameToCollectionResourceId2.get(sessionContainer2); - - if (collectionResourceIdToSessionTokens1.size() != collectionResourceIdToSessionTokens2.size() || - collectionNameToCollectionResourceId1.size() != collectionNameToCollectionResourceId2.size()) { - return false; - } - - // get keys, and compare entries - for (Long resourceId : collectionResourceIdToSessionTokens1.keySet()) { - if (!collectionResourceIdToSessionTokens1.get(resourceId).equals(collectionResourceIdToSessionTokens2.get(resourceId))) { - return false; - } - } - - for (String collectionName : collectionNameToCollectionResourceId1.keySet()) { - if (!collectionNameToCollectionResourceId1.get(collectionName).equals(collectionNameToCollectionResourceId2.get(collectionName))) { - return false; - } - } - - return true; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentQuerySpyWireContentTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentQuerySpyWireContentTest.java deleted file mode 100644 index 79e792a5c0cf..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentQuerySpyWireContentTest.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.SpyClientBuilder; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import com.microsoft.azure.cosmosdb.rx.Utils; - -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import rx.Observable; - -public class DocumentQuerySpyWireContentTest extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdSinglePartitionCollection; - private DocumentCollection createdMultiPartitionCollection; - - private List createdDocumentsInSinglePartitionCollection = new ArrayList<>(); - private List createdDocumentsInMultiPartitionCollection = new ArrayList<>(); - - private SpyClientUnderTestFactory.ClientUnderTest client; - - public String getSinglePartitionCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdSinglePartitionCollection.getId()); - } - - public String getMultiPartitionCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdMultiPartitionCollection.getId()); - } - - @Factory(dataProvider = "clientBuilders") - public DocumentQuerySpyWireContentTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @DataProvider(name = "responseContinuationTokenLimitParamProvider") - public static Object[][] responseContinuationTokenLimitParamProvider() { - - FeedOptions options1 = new FeedOptions(); - options1.setMaxItemCount(1); - options1.setResponseContinuationTokenLimitInKb(5); - options1.setPartitionKey(new PartitionKey("99")); - String query1 = "Select * from r"; - boolean multiPartitionCollection1 = true; - - FeedOptions options2 = new FeedOptions(); - options2.setMaxItemCount(1); - options2.setResponseContinuationTokenLimitInKb(5); - options2.setPartitionKey(new PartitionKey("99")); - String query2 = "Select * from r order by r.prop"; - boolean multiPartitionCollection2 = false; - - FeedOptions options3 = new FeedOptions(); - options3.setMaxItemCount(1); - options3.setResponseContinuationTokenLimitInKb(5); - options3.setPartitionKey(new PartitionKey("99")); - String query3 = "Select * from r"; - boolean multiPartitionCollection3 = false; - - FeedOptions options4 = new FeedOptions(); - options4.setPartitionKey(new PartitionKey("99")); - String query4 = "Select * from r order by r.prop"; - boolean multiPartitionCollection4 = false; - - return new Object[][]{ - {options1, query1, multiPartitionCollection1}, - {options2, query2, multiPartitionCollection2}, - {options3, query3, multiPartitionCollection3}, - {options4, query4, multiPartitionCollection4}, - }; - } - - @Test(dataProvider = "responseContinuationTokenLimitParamProvider", groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithContinuationTokenLimit(FeedOptions options, String query, boolean isMultiParitionCollection) throws Exception { - String collectionLink; - if (isMultiParitionCollection) { - collectionLink = getMultiPartitionCollectionLink(); - } else { - collectionLink = getSinglePartitionCollectionLink(); - } - - client.clearCapturedRequests(); - - Observable> queryObservable = client - .queryDocuments(collectionLink, query, options); - - List results = queryObservable.flatMap(p -> Observable.from(p.getResults())) - .toList().toBlocking().single(); - - assertThat(results.size()).describedAs("total results").isGreaterThanOrEqualTo(1); - - List> requests = client.getCapturedRequests(); - - for(HttpClientRequest req: requests) { - validateRequestHasContinuationTokenLimit(req, options.getResponseContinuationTokenLimitInKb()); - } - } - - private void validateRequestHasContinuationTokenLimit(HttpClientRequest request, Integer expectedValue) { - if (expectedValue != null && expectedValue > 0) { - assertThat(request.getHeaders() - .contains(HttpConstants.HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB)) - .isTrue(); - assertThat(request.getHeaders() - .get("x-ms-documentdb-responsecontinuationtokenlimitinkb")) - .isEqualTo(Integer.toString(expectedValue)); - } else { - assertThat(request.getHeaders() - .contains(HttpConstants.HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB)) - .isFalse(); - } - } - - public Document createDocument(AsyncDocumentClient client, String collectionLink, int cnt) { - - Document docDefinition = getDocumentDefinition(cnt); - return client - .createDocument(collectionLink, docDefinition, null, false).toBlocking().single().getResource(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = new SpyClientBuilder(clientBuilder).build(); - createdDatabase = SHARED_DATABASE; - createdSinglePartitionCollection = SHARED_SINGLE_PARTITION_COLLECTION; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION); - - createdMultiPartitionCollection = SHARED_MULTI_PARTITION_COLLECTION; - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION); - - for(int i = 0; i < 3; i++) { - createdDocumentsInSinglePartitionCollection.add(createDocument(client, getCollectionLink(createdSinglePartitionCollection), i)); - createdDocumentsInMultiPartitionCollection.add(createDocument(client, getCollectionLink(createdMultiPartitionCollection), i)); - } - - for(int i = 0; i < 5; i++) { - createdDocumentsInSinglePartitionCollection.add(createDocument(client, getCollectionLink(createdSinglePartitionCollection), 99)); - createdDocumentsInMultiPartitionCollection.add(createDocument(client, getCollectionLink(createdMultiPartitionCollection), 99)); - } - - // wait for catch up - TimeUnit.SECONDS.sleep(1); - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - - // do the query once to ensure the collection is cached. - client.queryDocuments(getMultiPartitionCollectionLink(), "select * from root", options) - .toCompletable().await(); - - // do the query once to ensure the collection is cached. - client.queryDocuments(getSinglePartitionCollectionLink(), "select * from root", options) - .toCompletable().await(); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Document getDocumentDefinition(int cnt) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"prop\" : %d, " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, cnt, cnt)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/NetworkFailureTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/NetworkFailureTest.java deleted file mode 100644 index 4ce4abf58452..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/NetworkFailureTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.CollectionCrudTest; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import org.mockito.Mockito; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.net.UnknownHostException; -import java.time.Instant; - -import static org.assertj.core.api.Java6Assertions.assertThat; - -public class NetworkFailureTest extends TestSuiteBase { - private static final int TIMEOUT = ClientRetryPolicy.MaxRetryCount * ClientRetryPolicy.RetryIntervalInMS + 60000; - private final DocumentCollection collectionDefinition; - - @Factory(dataProvider = "simpleClientBuildersWithDirect") - public NetworkFailureTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - this.collectionDefinition = getCollectionDefinition(); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void createCollectionWithUnreachableHost() { - SpyClientUnderTestFactory.ClientWithGatewaySpy client = null; - - try { - client = SpyClientUnderTestFactory.createClientWithGatewaySpy(clientBuilder); - - Database database = SHARED_DATABASE; - - Observable> createObservable = client - .createCollection(database.getSelfLink(), collectionDefinition, null); - - - final RxGatewayStoreModel origGatewayStoreModel = client.getOrigGatewayStoreModel(); - - Mockito.doAnswer(invocation -> { - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - - if (request.getResourceType() == ResourceType.DocumentCollection) { - return Observable.error(new UnknownHostException()); - } - - return origGatewayStoreModel.processMessage(request); - - }).when(client.getSpyGatewayStoreModel()).processMessage(Mockito.any()); - - - FailureValidator validator = new FailureValidator.Builder().instanceOf(UnknownHostException.class).build(); - Instant start = Instant.now(); - validateFailure(createObservable, validator, TIMEOUT); - Instant after = Instant.now(); - assertThat(after.toEpochMilli() - start.toEpochMilli()) - .isGreaterThanOrEqualTo(ClientRetryPolicy.MaxRetryCount * ClientRetryPolicy.RetryIntervalInMS); - - } finally { - safeClose(client); - } - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - AsyncDocumentClient client = createGatewayHouseKeepingDocumentClient().build(); - safeDeleteCollection(client, collectionDefinition); - client.close(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ParallelAsync.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ParallelAsync.java deleted file mode 100644 index 47e7987673f1..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ParallelAsync.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import org.apache.commons.lang3.Range; -import rx.Completable; -import rx.functions.Action1; - -import java.util.ArrayList; -import java.util.List; - -public class ParallelAsync { - - static Completable forEachAsync(Range range, int partition, Action1 func) { - - int partitionSize = (range.getMaximum() - range.getMinimum()) / partition; - List task = new ArrayList<>(); - int startRange = range.getMinimum(); - for (int i = 0; i < partition; i++) { - Range integerRange = Range.between(startRange, startRange + partitionSize); - task.add(Completable.defer(() -> { - for(int j = integerRange.getMinimum(); j < integerRange.getMaximum();j++) { - func.call(j); - } - return Completable.complete(); - })); - startRange = startRange + partitionSize ; - } - return Completable.mergeDelayError(task); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryCreateDocumentTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryCreateDocumentTest.java deleted file mode 100644 index 536ac8e7c38b..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryCreateDocumentTest.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.ResourceResponseValidator; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import javax.net.ssl.SSLException; -import java.lang.reflect.Method; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doAnswer; - -public class RetryCreateDocumentTest extends TestSuiteBase { - - private SpyClientUnderTestFactory.ClientWithGatewaySpy client; - - private Database database; - private DocumentCollection collection; - - @Factory(dataProvider = "clientBuilders") - public RetryCreateDocumentTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void retryDocumentCreate() throws Exception { - // create a document to ensure collection is cached - client.createDocument(collection.getSelfLink(), getDocumentDefinition(), null, false).toBlocking().single(); - - Document docDefinition = getDocumentDefinition(); - - Observable> createObservable = client - .createDocument(collection.getSelfLink(), docDefinition, null, false); - AtomicInteger count = new AtomicInteger(); - - doAnswer(new Answer< Observable>() { - @Override - public Observable answer(InvocationOnMock invocation) throws Throwable { - RxDocumentServiceRequest req = (RxDocumentServiceRequest) invocation.getArguments()[0]; - if (req.getOperationType() != OperationType.Create) { - return client.getOrigGatewayStoreModel().processMessage(req); - } - - int currentAttempt = count.getAndIncrement(); - if (currentAttempt == 0) { - Map header = ImmutableMap.of( - HttpConstants.HttpHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.PARTITION_KEY_MISMATCH)); - - return Observable.error(new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, new Error() , header)); - } else { - return client.getOrigGatewayStoreModel().processMessage(req); - } - } - }).when(client.getSpyGatewayStoreModel()).processMessage(anyObject()); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()).build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocument_noRetryOnNonRetriableFailure() throws Exception { - - AtomicInteger count = new AtomicInteger(); - doAnswer(new Answer< Observable>() { - @Override - public Observable answer(InvocationOnMock invocation) throws Throwable { - RxDocumentServiceRequest req = (RxDocumentServiceRequest) invocation.getArguments()[0]; - - if (req.getResourceType() != ResourceType.Document) { - return client.getOrigGatewayStoreModel().processMessage(req); - } - - int currentAttempt = count.getAndIncrement(); - if (currentAttempt == 0) { - return client.getOrigGatewayStoreModel().processMessage(req); - } else { - Map header = ImmutableMap.of( - HttpConstants.HttpHeaders.SUB_STATUS, - Integer.toString(2)); - - return Observable.error(new DocumentClientException(1, new Error() , header)); - } - } - }).when(client.getSpyGatewayStoreModel()).processMessage(anyObject()); - - // create a document to ensure collection is cached - client.createDocument(collection.getSelfLink(), getDocumentDefinition(), null, false) - .toBlocking() - .single(); - - Document docDefinition = getDocumentDefinition(); - - Observable> createObservable = client - .createDocument(collection.getSelfLink(), docDefinition, null, false); - - // validate - FailureValidator validator = new FailureValidator.Builder().statusCode(1).subStatusCode(2).build(); - validateFailure(createObservable, validator, TIMEOUT); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocument_failImmediatelyOnNonRetriable() throws Exception { - // create a document to ensure collection is cached - client.createDocument(collection.getSelfLink(), getDocumentDefinition(), null, false).toBlocking().single(); - AtomicInteger count = new AtomicInteger(); - - doAnswer(new Answer< Observable>() { - @Override - public Observable answer(InvocationOnMock invocation) throws Throwable { - RxDocumentServiceRequest req = (RxDocumentServiceRequest) invocation.getArguments()[0]; - if (req.getOperationType() != OperationType.Create) { - return client.getOrigGatewayStoreModel().processMessage(req); - } - int currentAttempt = count.getAndIncrement(); - if (currentAttempt == 0) { - Map header = ImmutableMap.of( - HttpConstants.HttpHeaders.SUB_STATUS, - Integer.toString(2)); - - return Observable.error(new DocumentClientException(1, new Error() , header)); - } else { - return client.getOrigGatewayStoreModel().processMessage(req); - } - } - }).when(client.getSpyGatewayStoreModel()).processMessage(anyObject()); - - Document docDefinition = getDocumentDefinition(); - - Observable> createObservable = client - .createDocument(collection.getSelfLink(), docDefinition, null, false); - // validate - - FailureValidator validator = new FailureValidator.Builder().statusCode(1).subStatusCode(2).build(); - validateFailure(createObservable.timeout(100, TimeUnit.MILLISECONDS), validator); - } - - @BeforeMethod(groups = { "simple" }) - public void beforeMethod(Method method) { - super.beforeMethod(method); - Mockito.reset(client.getSpyGatewayStoreModel()); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - // set up the client - client = SpyClientUnderTestFactory.createClientWithGatewaySpy(clientBuilder); - - database = SHARED_DATABASE; - collection = SHARED_SINGLE_PARTITION_COLLECTION; - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryThrottleTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryThrottleTest.java deleted file mode 100644 index 2f438b764604..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryThrottleTest.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doAnswer; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; - -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.ResourceResponseValidator; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; - -import rx.Observable; - -public class RetryThrottleTest extends TestSuiteBase { - private final static int TIMEOUT = 10000; - private final static int TOTAL_DOCS = 500; - private final static int LARGE_TIMEOUT = 30000; - - private SpyClientUnderTestFactory.ClientWithGatewaySpy client; - private Database database; - private DocumentCollection collection; - - @Test(groups = { "long" }, timeOut = LARGE_TIMEOUT ) - public void retryCreateDocumentsOnSpike() throws Exception { - ConnectionPolicy policy = new ConnectionPolicy(); - RetryOptions retryOptions = new RetryOptions(); - retryOptions.setMaxRetryAttemptsOnThrottledRequests(Integer.MAX_VALUE); - retryOptions.setMaxRetryWaitTimeInSeconds(LARGE_TIMEOUT); - policy.setRetryOptions(retryOptions); - - AsyncDocumentClient.Builder builder = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(policy) - .withConsistencyLevel(ConsistencyLevel.Eventual); - - client = SpyClientUnderTestFactory.createClientWithGatewaySpy(builder); - - // create a document to ensure collection is cached - client.createDocument(getCollectionLink(collection), getDocumentDefinition(), null, false).toBlocking().single(); - - List>> list = new ArrayList<>(); - for(int i = 0; i < TOTAL_DOCS; i++) { - Observable> obs = client.createDocument(getCollectionLink(collection), getDocumentDefinition(), null, false); - list.add(obs); - } - - // registers a spy to count number of invocation - AtomicInteger totalCount = new AtomicInteger(); - AtomicInteger successCount = new AtomicInteger(); - - doAnswer(new Answer< Observable>() { - @Override - public Observable answer(InvocationOnMock invocation) throws Throwable { - RxDocumentServiceRequest req = (RxDocumentServiceRequest) invocation.getArguments()[0]; - if (req.getResourceType() == ResourceType.Document && req.getOperationType() == OperationType.Create) { - // increment the counter per Document Create operations - totalCount.incrementAndGet(); - } - return client.getOrigGatewayStoreModel().processMessage(req).doOnNext(rsp -> successCount.incrementAndGet()); - } - }).when(client.getSpyGatewayStoreModel()).processMessage(anyObject()); - - List> rsps = Observable.merge(list, 100).toList().toSingle().toBlocking().value(); - System.out.println("total: " + totalCount.get()); - assertThat(rsps).hasSize(TOTAL_DOCS); - assertThat(successCount.get()).isEqualTo(TOTAL_DOCS); - System.out.println("total count is " + totalCount.get()); - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void retryDocumentCreate() throws Exception { - client = SpyClientUnderTestFactory.createClientWithGatewaySpy(createGatewayRxDocumentClient()); - - // create a document to ensure collection is cached - client.createDocument(getCollectionLink(collection), getDocumentDefinition(), null, false).toBlocking().single(); - - Document docDefinition = getDocumentDefinition(); - - Observable> createObservable = client - .createDocument(collection.getSelfLink(), docDefinition, null, false); - AtomicInteger count = new AtomicInteger(); - - doAnswer(new Answer< Observable>() { - @Override - public Observable answer(InvocationOnMock invocation) throws Throwable { - RxDocumentServiceRequest req = (RxDocumentServiceRequest) invocation.getArguments()[0]; - if (req.getOperationType() != OperationType.Create) { - return client.getOrigGatewayStoreModel().processMessage(req); - } - int currentAttempt = count.getAndIncrement(); - if (currentAttempt == 0) { - return Observable.error(new DocumentClientException(HttpConstants.StatusCodes.TOO_MANY_REQUESTS)); - } else { - return client.getOrigGatewayStoreModel().processMessage(req); - } - } - }).when(client.getSpyGatewayStoreModel()).processMessage(anyObject()); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()).build(); - validateSuccess(createObservable, validator, TIMEOUT); - } - - @AfterMethod(groups = { "long" }) - private void afterMethod() { - safeClose(client); - } - - @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - // set up the client - database = SHARED_DATABASE; - collection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - @AfterClass(groups = { "long" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientUnderTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientUnderTest.java deleted file mode 100644 index 3cf2844149a3..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientUnderTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; - -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import org.mockito.Mockito; -import org.mockito.stubbing.Answer; -import rx.Observable; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doAnswer; - -/** - * This class in conjunction with {@link com.microsoft.azure.cosmosdb.rx.ClientUnderTestBuilder} - * provides the functionality for spying the client behavior and the http requests sent. - */ -public class RxDocumentClientUnderTest extends RxDocumentClientImpl { - - public CompositeHttpClient spyHttpClient; - public CompositeHttpClient origHttpClient; - - public List> httpRequests = Collections.synchronizedList( - new ArrayList>()); - - public RxDocumentClientUnderTest(URI serviceEndpoint, - String masterKey, - ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, - Configs configs) { - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); - init(); - } - - RxGatewayStoreModel createRxGatewayProxy( - ISessionContainer sessionContainer, - ConsistencyLevel consistencyLevel, - QueryCompatibilityMode queryCompatibilityMode, - UserAgentContainer userAgentContainer, - GlobalEndpointManager globalEndpointManager, - CompositeHttpClient rxOrigClient) { - - origHttpClient = rxOrigClient; - spyHttpClient = Mockito.spy(rxOrigClient); - - doAnswer((Answer>>) invocationOnMock -> { - - RxClient.ServerInfo serverInfo = - invocationOnMock.getArgumentAt(0, RxClient.ServerInfo.class); - - HttpClientRequest request - = invocationOnMock.getArgumentAt(1, HttpClientRequest.class); - - httpRequests.add(request); - - Observable> httpRespObs = - origHttpClient.submit(serverInfo, request); - - return httpRespObs; - }).when(spyHttpClient).submit( anyObject(), - (HttpClientRequest) anyObject()); - - return super.createRxGatewayProxy(sessionContainer, - consistencyLevel, - queryCompatibilityMode, - userAgentContainer, - globalEndpointManager, - spyHttpClient); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SessionTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SessionTest.java deleted file mode 100644 index 209bc4e792df..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SessionTest.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; - -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.http.HttpMethod; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; - -import org.apache.commons.lang3.StringUtils; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Method; -import java.net.URLDecoder; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; - -public class SessionTest extends TestSuiteBase { - protected static final int TIMEOUT = 20000; - - private Database createdDatabase; - private DocumentCollection createdCollection; - private String collectionId = "+ -_,:.|~" + UUID.randomUUID().toString() + " +-_,:.|~"; - private SpyClientUnderTestFactory.SpyBaseClass> spyClient; - private AsyncDocumentClient houseKeepingClient; - private ConnectionMode connectionMode; - - @Factory(dataProvider = "clientBuildersWithDirectSession") - public SessionTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - this.subscriberValidationTimeout = TIMEOUT; - } - - @DataProvider(name = "sessionTestArgProvider") - public Object[] sessionTestArgProvider() { - return new Object[] { - // boolean indicating whether requests should be name based or not - true, - false - }; - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - - DocumentCollection collection = new DocumentCollection(); - collection.setId(collectionId); - createdCollection = createCollection(createGatewayHouseKeepingDocumentClient().build(), createdDatabase.getId(), - collection, null); - houseKeepingClient = clientBuilder.build(); - connectionMode = houseKeepingClient.getConnectionPolicy().getConnectionMode(); - - if (connectionMode == ConnectionMode.Direct) { - spyClient = SpyClientUnderTestFactory.createDirectHttpsClientUnderTest(clientBuilder); - } else { - spyClient = SpyClientUnderTestFactory.createClientUnderTest(clientBuilder); - } - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteCollection(houseKeepingClient, createdCollection); - safeClose(houseKeepingClient); - safeClose(spyClient); - - } - - @BeforeMethod(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeTest(Method method) { - super.beforeMethod(method); - spyClient.clearCapturedRequests(); - } - - private List getSessionTokensInRequests() { - return spyClient.getCapturedRequests().stream() - .map(r -> r.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN)).collect(Collectors.toList()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "sessionTestArgProvider") - public void sessionConsistency_ReadYourWrites(boolean isNameBased) { - spyClient.readCollection(getCollectionLink(isNameBased), null).toBlocking().single(); - spyClient.createDocument(getCollectionLink(isNameBased), new Document(), null, false).toBlocking().single(); - - spyClient.clearCapturedRequests(); - - for (int i = 0; i < 10; i++) { - Document documentCreated = spyClient.createDocument(getCollectionLink(isNameBased), new Document(), null, false) - .toBlocking().single().getResource(); - - // We send session tokens on Writes in Gateway mode - if (connectionMode == ConnectionMode.Gateway) { - assertThat(getSessionTokensInRequests()).hasSize(3 * i + 1); - assertThat(getSessionTokensInRequests().get(3 * i + 0)).isNotEmpty(); - } - - spyClient.readDocument(getDocumentLink(documentCreated, isNameBased), null).toBlocking().single(); - - assertThat(getSessionTokensInRequests()).hasSize(3 * i + 2); - assertThat(getSessionTokensInRequests().get(3 * i + 1)).isNotEmpty(); - - spyClient.readDocument(getDocumentLink(documentCreated, isNameBased), null).toBlocking().single(); - - assertThat(getSessionTokensInRequests()).hasSize(3 * i + 3); - assertThat(getSessionTokensInRequests().get(3 * i + 2)).isNotEmpty(); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "sessionTestArgProvider") - public void sessionTokenInDocumentRead(boolean isNameBased) throws UnsupportedEncodingException { - Document document = new Document(); - document.setId(UUID.randomUUID().toString()); - document.set("pk", "pk"); - document = spyClient.createDocument(getCollectionLink(isNameBased), document, null, false).toBlocking().single() - .getResource(); - - final String documentLink = getDocumentLink(document, isNameBased); - spyClient.readDocument(documentLink, null).toBlocking().single() - .getResource(); - - List> documentReadHttpRequests = spyClient.getCapturedRequests().stream() - .filter(r -> r.getMethod() == HttpMethod.GET) - .filter(r -> { - try { - return URLDecoder.decode(r.getUri().replaceAll("\\+", "%2b"), "UTF-8").contains( - StringUtils.removeEnd(documentLink, "/")); - } catch (UnsupportedEncodingException e) { - return false; - } - }).collect(Collectors.toList()); - - // Direct mode may make more than one call (multiple replicas) - assertThat(documentReadHttpRequests.size() >= 1).isTrue(); - assertThat(documentReadHttpRequests.get(0).getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN)).isNotEmpty(); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "sessionTestArgProvider") - public void sessionTokenRemovedForMasterResource(boolean isNameBased) throws UnsupportedEncodingException { - if (connectionMode == ConnectionMode.Direct) { - throw new SkipException("Master resource access is only through gateway"); - } - String collectionLink = getCollectionLink(isNameBased); - spyClient.readCollection(collectionLink, null).toBlocking().single(); - - List> collectionReadHttpRequests = spyClient.getCapturedRequests().stream() - .filter(r -> r.getMethod() == HttpMethod.GET) - .filter(r -> { - try { - return URLDecoder.decode(r.getUri().replaceAll("\\+", "%2b"), "UTF-8").contains( - StringUtils.removeEnd(collectionLink, "/")); - } catch (UnsupportedEncodingException e) { - return false; - } - }) - .collect(Collectors.toList()); - - assertThat(collectionReadHttpRequests).hasSize(1); - assertThat(collectionReadHttpRequests.get(0).getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN)).isNull(); - } - - private String getCollectionLink(boolean isNameBased) { - return isNameBased ? "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(): - createdCollection.getSelfLink(); - } - - private String getDocumentLink(Document doc, boolean isNameBased) { - return isNameBased ? "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/docs/" + doc.getId() : - "dbs/" + createdDatabase.getResourceId() + "/colls/" + createdCollection.getResourceId() + "/docs/" + doc.getResourceId() + "/"; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SpyClientUnderTestFactory.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SpyClientUnderTestFactory.java deleted file mode 100644 index b9082124c091..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SpyClientUnderTestFactory.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.SpyClientBuilder; -import com.microsoft.azure.cosmosdb.rx.internal.directconnectivity.ReflectionUtils; - -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.lang3.reflect.FieldUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Future; -import java.util.stream.Collectors; - -import static org.mockito.Mockito.doAnswer; - -public class SpyClientUnderTestFactory { - - public static abstract class SpyBaseClass extends RxDocumentClientImpl { - - public SpyBaseClass(URI serviceEndpoint, String masterKeyOrResourceToken, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs) { - super(serviceEndpoint, masterKeyOrResourceToken, connectionPolicy, consistencyLevel, configs); - } - - public abstract List getCapturedRequests(); - - public abstract void clearCapturedRequests(); - } - - public static class ClientWithGatewaySpy extends SpyBaseClass { - - private RxGatewayStoreModel origRxGatewayStoreModel; - private RxGatewayStoreModel spyRxGatewayStoreModel; - - private List requests; - - - ClientWithGatewaySpy(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs) { - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); - init(); - } - - @Override - public List getCapturedRequests() { - return requests; - } - - @Override - RxGatewayStoreModel createRxGatewayProxy(ISessionContainer sessionContainer, - ConsistencyLevel consistencyLevel, - QueryCompatibilityMode queryCompatibilityMode, - UserAgentContainer userAgentContainer, - GlobalEndpointManager globalEndpointManager, - CompositeHttpClient rxClient) { - this.origRxGatewayStoreModel = super.createRxGatewayProxy( - sessionContainer, - consistencyLevel, - queryCompatibilityMode, - userAgentContainer, - globalEndpointManager, - rxClient); - this.requests = Collections.synchronizedList(new ArrayList<>()); - this.spyRxGatewayStoreModel = Mockito.spy(this.origRxGatewayStoreModel); - this.initRequestCapture(); - return this.spyRxGatewayStoreModel; - } - - protected void initRequestCapture() { - doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) { - RxDocumentServiceRequest req = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - requests.add(req); - return ClientWithGatewaySpy.this.origRxGatewayStoreModel.processMessage(req); - } - }).when(ClientWithGatewaySpy.this.spyRxGatewayStoreModel).processMessage(Mockito.any(RxDocumentServiceRequest.class)); - } - - @Override - public void clearCapturedRequests() { - requests.clear(); - } - - public RxGatewayStoreModel getSpyGatewayStoreModel() { - return spyRxGatewayStoreModel; - } - - public RxGatewayStoreModel getOrigGatewayStoreModel() { - return origRxGatewayStoreModel; - } - } - - public static class ClientUnderTest extends SpyBaseClass> { - - CompositeHttpClient origHttpClient; - CompositeHttpClient spyHttpClient; - List, Future>> requestsResponsePairs = - Collections.synchronizedList(new ArrayList, Future>>()); - - ClientUnderTest(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs) { - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); - init(); - } - - public List, Future>> capturedRequestResponseHeaderPairs() { - return requestsResponsePairs; - } - - @Override - public List> getCapturedRequests() { - return requestsResponsePairs.stream().map(pair -> pair.getLeft()).collect(Collectors.toList()); - } - - void initRequestCapture(CompositeHttpClient spyClient) { - - doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - RxClient.ServerInfo serverInfo = invocationOnMock.getArgumentAt(0, RxClient.ServerInfo.class); - HttpClientRequest httpReq = invocationOnMock.getArgumentAt(1, HttpClientRequest.class); - - CompletableFuture f = new CompletableFuture<>(); - requestsResponsePairs.add(Pair.of(httpReq, f)); - - return origHttpClient.submit(serverInfo, httpReq) - .doOnNext( - res -> f.complete(res.getHeaders()) - ).doOnError( - e -> f.completeExceptionally(e) - ); - - } - }).when(spyClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class)); - } - - @Override - public void clearCapturedRequests() { - requestsResponsePairs.clear(); - } - - public ISessionContainer getSessionContainer() { - try { - return (ISessionContainer) FieldUtils.readField(this, "sessionContainer", true); - } catch (Exception e){ - throw new RuntimeException(e); - } - } - - public CompositeHttpClient getSpyHttpClient() { - return spyHttpClient; - } - } - - public static class DirectHttpsClientUnderTest extends SpyBaseClass> { - - CompositeHttpClient origHttpClient; - CompositeHttpClient spyHttpClient; - List, Future>> requestsResponsePairs = - Collections.synchronizedList(new ArrayList, Future>>()); - - DirectHttpsClientUnderTest(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel) { - // TODO: DANOBLE: ensure the configs instance instantiated here specifies Protocol.Https - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, new Configs()); - assert connectionPolicy.getConnectionMode() == ConnectionMode.Direct; - init(); - this.origHttpClient = ReflectionUtils.getDirectHttpsHttpClient(this); - this.spyHttpClient = Mockito.spy(this.origHttpClient); - ReflectionUtils.setDirectHttpsHttpClient(this, this.spyHttpClient); - this.initRequestCapture(this.spyHttpClient); - } - - public List, Future>> capturedRequestResponseHeaderPairs() { - return requestsResponsePairs; - } - - @Override - public List> getCapturedRequests() { - return requestsResponsePairs.stream().map(pair -> pair.getLeft()).collect(Collectors.toList()); - } - - void initRequestCapture(CompositeHttpClient spyClient) { - - doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - RxClient.ServerInfo serverInfo = invocationOnMock.getArgumentAt(0, RxClient.ServerInfo.class); - HttpClientRequest httpReq = invocationOnMock.getArgumentAt(1, HttpClientRequest.class); - - CompletableFuture f = new CompletableFuture<>(); - requestsResponsePairs.add(Pair.of(httpReq, f)); - - return origHttpClient.submit(serverInfo, httpReq) - .doOnNext( - res -> f.complete(res.getHeaders()) - ).doOnError( - e -> f.completeExceptionally(e) - ); - - } - }).when(spyClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class)); - } - - @Override - public void clearCapturedRequests() { - requestsResponsePairs.clear(); - } - - public ISessionContainer getSessionContainer() { - try { - return (ISessionContainer) FieldUtils.readField(this, "sessionContainer", true); - } catch (Exception e){ - throw new RuntimeException(e); - } - } - - public CompositeHttpClient getSpyHttpClient() { - return spyHttpClient; - } - } - - public static ClientWithGatewaySpy createClientWithGatewaySpy(AsyncDocumentClient.Builder builder) { - return new SpyClientBuilder(builder).buildWithGatewaySpy(); - } - - public static ClientWithGatewaySpy createClientWithGatewaySpy(URI serviceEndpoint, - String masterKey, - ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, - Configs configs) { - return new ClientWithGatewaySpy(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); - } - - public static ClientUnderTest createClientUnderTest(AsyncDocumentClient.Builder builder) { - return new SpyClientBuilder(builder).build(); - } - - public static DirectHttpsClientUnderTest createDirectHttpsClientUnderTest(AsyncDocumentClient.Builder builder) { - return new SpyClientBuilder(builder).buildWithDirectHttps(); - } - - public static ClientUnderTest createClientUnderTest(URI serviceEndpoint, - String masterKey, - ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, - Configs configs) { - return new ClientUnderTest(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs) { - - @Override - RxGatewayStoreModel createRxGatewayProxy(ISessionContainer sessionContainer, - ConsistencyLevel consistencyLevel, - QueryCompatibilityMode queryCompatibilityMode, - UserAgentContainer userAgentContainer, - GlobalEndpointManager globalEndpointManager, - CompositeHttpClient rxClient) { - - CompositeHttpClient spyClient = Mockito.spy(rxClient); - - this.origHttpClient = rxClient; - this.spyHttpClient = spyClient; - - this.initRequestCapture(spyHttpClient); - - return super.createRxGatewayProxy( - sessionContainer, - consistencyLevel, - queryCompatibilityMode, - userAgentContainer, - globalEndpointManager, - spyClient); - } - }; - } - - public static DirectHttpsClientUnderTest createDirectHttpsClientUnderTest(URI serviceEndpoint, String masterKey, - ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel) { - return new DirectHttpsClientUnderTest(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/StoreHeaderTests.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/StoreHeaderTests.java deleted file mode 100644 index ecdb689b542b..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/StoreHeaderTests.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import java.util.UUID; - -public class StoreHeaderTests extends TestSuiteBase { - - private static Database createdDatabase; - private static DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public StoreHeaderTests(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void validateStoreHeader() { - Document docDefinition1 = getDocumentDefinition(); - Document responseDoc1 = createDocument(client, createdDatabase.getId(), createdCollection.getId(), docDefinition1); - Assert.assertNotNull(responseDoc1.getSelfLink()); - Assert.assertNotNull(responseDoc1.get("_attachments")); - - Document docDefinition2 = getDocumentDefinition(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setHeader("x-ms-exclude-system-properties", "true"); - Document responseDoc2 = createDocument(client, createdDatabase.getId(), createdCollection.getId(), docDefinition2, requestOptions); - Assert.assertNull(responseDoc2.getSelfLink()); - Assert.assertNull(responseDoc2.get("_attachments")); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/TestSuiteBase.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/TestSuiteBase.java deleted file mode 100644 index fa92ee2af634..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/TestSuiteBase.java +++ /dev/null @@ -1,1012 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.CompositePathSortOrder; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.internal.PathParser; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.FeedResponseListValidator; -import com.microsoft.azure.cosmosdb.rx.ResourceResponseValidator; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import org.apache.commons.lang3.StringUtils; -import org.mockito.stubbing.Answer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.AfterSuite; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Observable; -import rx.observers.TestSubscriber; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.spy; - -public class TestSuiteBase { - private static final int DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL = 500; - private static final ObjectMapper objectMapper = new ObjectMapper(); - protected static Logger logger = LoggerFactory.getLogger(TestSuiteBase.class.getSimpleName()); - protected static final int TIMEOUT = 8000; - protected static final int FEED_TIMEOUT = 12000; - protected static final int SETUP_TIMEOUT = 30000; - protected static final int SHUTDOWN_TIMEOUT = 12000; - - protected static final int SUITE_SETUP_TIMEOUT = 120000; - protected static final int SUITE_SHUTDOWN_TIMEOUT = 60000; - - protected static final int WAIT_REPLICA_CATCH_UP_IN_MILLIS = 4000; - - protected int subscriberValidationTimeout = TIMEOUT; - - protected static ConsistencyLevel accountConsistency; - - protected Builder clientBuilder; - - protected static Database SHARED_DATABASE; - protected static DocumentCollection SHARED_MULTI_PARTITION_COLLECTION; - protected static DocumentCollection SHARED_SINGLE_PARTITION_COLLECTION; - protected static DocumentCollection SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - protected static DocumentCollection SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES; - - - protected TestSuiteBase() { - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - objectMapper.configure(JsonParser.Feature.ALLOW_TRAILING_COMMA, true); - objectMapper.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); - logger.debug("Initializing {} ...", this.getClass().getSimpleName()); - } - - @BeforeMethod(groups = { "simple", "long", "direct", "multi-master", "emulator" }) - public void beforeMethod(Method method) { - if (this.clientBuilder != null) { - logger.info("Starting {}::{} using {} {} mode with {} consistency", - method.getDeclaringClass().getSimpleName(), method.getName(), - this.clientBuilder.getConnectionPolicy().getConnectionMode(), - this.clientBuilder.getConfigs().getProtocol(), - this.clientBuilder.getDesiredConsistencyLevel()); - return; - } - logger.info("Starting {}::{}", method.getDeclaringClass().getSimpleName(), method.getName()); - } - - @AfterMethod(groups = { "simple", "long", "direct", "multi-master", "emulator" }) - public void afterMethod(Method m) { - Test t = m.getAnnotation(Test.class); - logger.info("Finished {}:{}.", m.getDeclaringClass().getSimpleName(), m.getName()); - } - - private static class DatabaseManagerImpl implements DatabaseForTest.DatabaseManager { - public static DatabaseManagerImpl getInstance(AsyncDocumentClient client) { - return new DatabaseManagerImpl(client); - } - - private final AsyncDocumentClient client; - - private DatabaseManagerImpl(AsyncDocumentClient client) { - this.client = client; - } - - @Override - public Observable> queryDatabases(SqlQuerySpec query) { - return client.queryDatabases(query, null); - } - - @Override - public Observable> createDatabase(Database databaseDefinition) { - return client.createDatabase(databaseDefinition, null); - } - - @Override - public Observable> deleteDatabase(String id) { - - return client.deleteDatabase("dbs/" + id, null); - } - } - - @BeforeSuite(groups = { "simple", "long", "direct", "multi-master", "emulator" }, timeOut = SUITE_SETUP_TIMEOUT) - public static void beforeSuite() { - logger.info("beforeSuite Started"); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - DatabaseForTest dbForTest = DatabaseForTest.create(DatabaseManagerImpl.getInstance(houseKeepingClient)); - SHARED_DATABASE = dbForTest.createdDatabase; - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10100); - SHARED_MULTI_PARTITION_COLLECTION = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionWithRangeRangeIndex(), options); - SHARED_SINGLE_PARTITION_COLLECTION = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinition(), null); - SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionSinglePartitionWithoutPartitionKey()); - SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionMultiPartitionWithCompositeAndSpatialIndexes(), options); - } finally { - houseKeepingClient.close(); - } - } - - @AfterSuite(groups = { "simple", "long", "direct", "multi-master", "emulator" }, timeOut = SUITE_SHUTDOWN_TIMEOUT) - public static void afterSuite() { - logger.info("afterSuite Started"); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - safeDeleteDatabase(houseKeepingClient, SHARED_DATABASE); - DatabaseForTest.cleanupStaleTestDatabases(DatabaseManagerImpl.getInstance(houseKeepingClient)); - } finally { - safeClose(houseKeepingClient); - } - } - - protected static void truncateCollection(DocumentCollection collection) { - logger.info("Truncating collection {} ...", collection.getId()); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - List paths = collection.getPartitionKey().getPaths(); - - FeedOptions options = new FeedOptions(); - options.setMaxDegreeOfParallelism(-1); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(100); - - logger.info("Truncating collection {} documents ...", collection.getId()); - - houseKeepingClient.queryDocuments(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(doc -> { - RequestOptions requestOptions = new RequestOptions(); - - if (paths != null && !paths.isEmpty()) { - List pkPath = PathParser.getPathParts(paths.get(0)); - Object propertyValue = doc.getObjectByPath(pkPath); - if (propertyValue == null) { - propertyValue = Undefined.Value(); - } - - requestOptions.setPartitionKey(new PartitionKey(propertyValue)); - } - - return houseKeepingClient.deleteDocument(doc.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} triggers ...", collection.getId()); - - houseKeepingClient.queryTriggers(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(trigger -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = trigger.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteTrigger(trigger.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} storedProcedures ...", collection.getId()); - - houseKeepingClient.queryStoredProcedures(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(storedProcedure -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = storedProcedure.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteStoredProcedure(storedProcedure.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} udfs ...", collection.getId()); - - houseKeepingClient.queryUserDefinedFunctions(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(udf -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = udf.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteUserDefinedFunction(udf.getSelfLink(), requestOptions); - }).toCompletable().await(); - - } finally { - houseKeepingClient.close(); - } - - logger.info("Finished truncating collection {}.", collection.getId()); - } - - protected static void waitIfNeededForReplicasToCatchUp(AsyncDocumentClient.Builder clientBuilder) { - switch (clientBuilder.getDesiredConsistencyLevel()) { - case Eventual: - case ConsistentPrefix: - logger.info(" additional wait in Eventual mode so the replica catch up"); - // give times to replicas to catch up after a write - try { - TimeUnit.MILLISECONDS.sleep(WAIT_REPLICA_CATCH_UP_IN_MILLIS); - } catch (Exception e) { - logger.error("unexpected failure", e); - } - - case Session: - case BoundedStaleness: - case Strong: - default: - break; - } - } - - private static DocumentCollection getCollectionDefinitionSinglePartitionWithoutPartitionKey() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - return collectionDefinition; - } - - - public static DocumentCollection createCollection(String databaseId, - DocumentCollection collection, - RequestOptions options) { - AsyncDocumentClient client = createGatewayHouseKeepingDocumentClient().build(); - try { - return client.createCollection("dbs/" + databaseId, collection, options).toBlocking().single().getResource(); - } finally { - client.close(); - } - } - - public static DocumentCollection createCollection(AsyncDocumentClient client, String databaseId, - DocumentCollection collection, RequestOptions options) { - return client.createCollection("dbs/" + databaseId, collection, options).toBlocking().single().getResource(); - } - - public static DocumentCollection createCollection(AsyncDocumentClient client, String databaseId, - DocumentCollection collection) { - return client.createCollection("dbs/" + databaseId, collection, null).toBlocking().single().getResource(); - } - - private static DocumentCollection getCollectionDefinitionMultiPartitionWithCompositeAndSpatialIndexes() { - final String NUMBER_FIELD = "numberField"; - final String STRING_FIELD = "stringField"; - final String NUMBER_FIELD_2 = "numberField2"; - final String STRING_FIELD_2 = "stringField2"; - final String BOOL_FIELD = "boolField"; - final String NULL_FIELD = "nullField"; - final String OBJECT_FIELD = "objectField"; - final String ARRAY_FIELD = "arrayField"; - final String SHORT_STRING_FIELD = "shortStringField"; - final String MEDIUM_STRING_FIELD = "mediumStringField"; - final String LONG_STRING_FIELD = "longStringField"; - final String PARTITION_KEY = "pk"; - - DocumentCollection documentCollection = new DocumentCollection(); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection> compositeIndexes = new ArrayList>(); - - //Simple - ArrayList compositeIndexSimple = new ArrayList(); - CompositePath compositePath1 = new CompositePath(); - compositePath1.setPath("/" + NUMBER_FIELD); - compositePath1.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath2 = new CompositePath(); - compositePath2.setPath("/" + STRING_FIELD); - compositePath2.setOrder(CompositePathSortOrder.Descending); - - compositeIndexSimple.add(compositePath1); - compositeIndexSimple.add(compositePath2); - - //Max Columns - ArrayList compositeIndexMaxColumns = new ArrayList(); - CompositePath compositePath3 = new CompositePath(); - compositePath3.setPath("/" + NUMBER_FIELD); - compositePath3.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath4 = new CompositePath(); - compositePath4.setPath("/" + STRING_FIELD); - compositePath4.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath5 = new CompositePath(); - compositePath5.setPath("/" + NUMBER_FIELD_2); - compositePath5.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath6 = new CompositePath(); - compositePath6.setPath("/" + STRING_FIELD_2); - compositePath6.setOrder(CompositePathSortOrder.Ascending); - - compositeIndexMaxColumns.add(compositePath3); - compositeIndexMaxColumns.add(compositePath4); - compositeIndexMaxColumns.add(compositePath5); - compositeIndexMaxColumns.add(compositePath6); - - //Primitive Values - ArrayList compositeIndexPrimitiveValues = new ArrayList(); - CompositePath compositePath7 = new CompositePath(); - compositePath7.setPath("/" + NUMBER_FIELD); - compositePath7.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath8 = new CompositePath(); - compositePath8.setPath("/" + STRING_FIELD); - compositePath8.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath9 = new CompositePath(); - compositePath9.setPath("/" + BOOL_FIELD); - compositePath9.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath10 = new CompositePath(); - compositePath10.setPath("/" + NULL_FIELD); - compositePath10.setOrder(CompositePathSortOrder.Ascending); - - compositeIndexPrimitiveValues.add(compositePath7); - compositeIndexPrimitiveValues.add(compositePath8); - compositeIndexPrimitiveValues.add(compositePath9); - compositeIndexPrimitiveValues.add(compositePath10); - - //Long Strings - ArrayList compositeIndexLongStrings = new ArrayList(); - CompositePath compositePath11 = new CompositePath(); - compositePath11.setPath("/" + STRING_FIELD); - - CompositePath compositePath12 = new CompositePath(); - compositePath12.setPath("/" + SHORT_STRING_FIELD); - - CompositePath compositePath13 = new CompositePath(); - compositePath13.setPath("/" + MEDIUM_STRING_FIELD); - - CompositePath compositePath14 = new CompositePath(); - compositePath14.setPath("/" + LONG_STRING_FIELD); - - compositeIndexLongStrings.add(compositePath11); - compositeIndexLongStrings.add(compositePath12); - compositeIndexLongStrings.add(compositePath13); - compositeIndexLongStrings.add(compositePath14); - - compositeIndexes.add(compositeIndexSimple); - compositeIndexes.add(compositeIndexMaxColumns); - compositeIndexes.add(compositeIndexPrimitiveValues); - compositeIndexes.add(compositeIndexLongStrings); - - indexingPolicy.setCompositeIndexes(compositeIndexes); - documentCollection.setIndexingPolicy(indexingPolicy); - - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - ArrayList partitionKeyPaths = new ArrayList(); - partitionKeyPaths.add("/" + PARTITION_KEY); - partitionKeyDefinition.setPaths(partitionKeyPaths); - documentCollection.setPartitionKey(partitionKeyDefinition); - - documentCollection.setId(UUID.randomUUID().toString()); - - return documentCollection; - } - - public static Document createDocument(AsyncDocumentClient client, String databaseId, String collectionId, Document document) { - return createDocument(client, databaseId, collectionId, document, null); - } - - public static Document createDocument(AsyncDocumentClient client, String databaseId, String collectionId, Document document, RequestOptions options) { - return client.createDocument(com.microsoft.azure.cosmosdb.rx.Utils.getCollectionNameLink(databaseId, collectionId), document, options, false).toBlocking().single().getResource(); - } - - public Observable> bulkInsert(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList, - int concurrencyLevel) { - ArrayList>> result = new ArrayList>>(documentDefinitionList.size()); - for (Document docDef : documentDefinitionList) { - result.add(client.createDocument(collectionLink, docDef, null, false)); - } - - return Observable.merge(result, concurrencyLevel); - } - - public Observable> bulkInsert(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList) { - return bulkInsert(client, collectionLink, documentDefinitionList, DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL); - } - - public List bulkInsertBlocking(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList) { - return bulkInsert(client, collectionLink, documentDefinitionList, DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL) - .map(ResourceResponse::getResource) - .toList() - .toBlocking() - .single(); - } - - public static ConsistencyLevel getAccountDefaultConsistencyLevel(AsyncDocumentClient client) { - return client.getDatabaseAccount().toBlocking().single().getConsistencyPolicy().getDefaultConsistencyLevel(); - } - - public static User createUser(AsyncDocumentClient client, String databaseId, User user) { - return client.createUser("dbs/" + databaseId, user, null).toBlocking().single().getResource(); - } - - public static User safeCreateUser(AsyncDocumentClient client, String databaseId, User user) { - deleteUserIfExists(client, databaseId, user.getId()); - return createUser(client, databaseId, user); - } - - private static DocumentCollection safeCreateCollection(AsyncDocumentClient client, String databaseId, DocumentCollection collection, RequestOptions options) { - deleteCollectionIfExists(client, databaseId, collection.getId()); - return createCollection(client, databaseId, collection, options); - } - - public static String getCollectionLink(DocumentCollection collection) { - return collection.getSelfLink(); - } - - static protected DocumentCollection getCollectionDefinition() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - static protected DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - public static void deleteCollectionIfExists(AsyncDocumentClient client, String databaseId, String collectionId) { - List res = client.queryCollections("dbs/" + databaseId, - String.format("SELECT * FROM root r where r.id = '%s'", collectionId), null).toBlocking().single() - .getResults(); - if (!res.isEmpty()) { - deleteCollection(client, com.microsoft.azure.cosmosdb.rx.Utils.getCollectionNameLink(databaseId, collectionId)); - } - } - - public static void deleteCollection(AsyncDocumentClient client, String collectionLink) { - client.deleteCollection(collectionLink, null).toBlocking().single(); - } - - public static void deleteDocumentIfExists(AsyncDocumentClient client, String databaseId, String collectionId, String docId) { - FeedOptions options = new FeedOptions(); - options.setPartitionKey(new PartitionKey(docId)); - List res = client - .queryDocuments(com.microsoft.azure.cosmosdb.rx.Utils.getCollectionNameLink(databaseId, collectionId), String.format("SELECT * FROM root r where r.id = '%s'", docId), options) - .toBlocking().single().getResults(); - if (!res.isEmpty()) { - deleteDocument(client, com.microsoft.azure.cosmosdb.rx.Utils.getDocumentNameLink(databaseId, collectionId, docId)); - } - } - - public static void safeDeleteDocument(AsyncDocumentClient client, String documentLink, RequestOptions options) { - if (client != null && documentLink != null) { - try { - client.deleteDocument(documentLink, options).toBlocking().single(); - } catch (Exception e) { - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(e, DocumentClientException.class); - if (dce == null || dce.getStatusCode() != 404) { - throw e; - } - } - } - } - - public static void deleteDocument(AsyncDocumentClient client, String documentLink) { - client.deleteDocument(documentLink, null).toBlocking().single(); - } - - public static void deleteUserIfExists(AsyncDocumentClient client, String databaseId, String userId) { - List res = client - .queryUsers("dbs/" + databaseId, String.format("SELECT * FROM root r where r.id = '%s'", userId), null) - .toBlocking().single().getResults(); - if (!res.isEmpty()) { - deleteUser(client, com.microsoft.azure.cosmosdb.rx.Utils.getUserNameLink(databaseId, userId)); - } - } - - public static void deleteUser(AsyncDocumentClient client, String userLink) { - client.deleteUser(userLink, null).toBlocking().single(); - } - - public static String getDatabaseLink(Database database) { - return database.getSelfLink(); - } - - static private Database safeCreateDatabase(AsyncDocumentClient client, Database database) { - safeDeleteDatabase(client, database.getId()); - return createDatabase(client, database); - } - - static protected Database createDatabase(AsyncDocumentClient client, Database database) { - Observable> databaseObservable = client.createDatabase(database, null); - return databaseObservable.toBlocking().single().getResource(); - } - - static protected Database createDatabase(AsyncDocumentClient client, String databaseId) { - Database databaseDefinition = new Database(); - databaseDefinition.setId(databaseId); - return createDatabase(client, databaseDefinition); - } - - static protected Database createDatabaseIfNotExists(AsyncDocumentClient client, String databaseId) { - return client.queryDatabases(String.format("SELECT * FROM r where r.id = '%s'", databaseId), null).flatMap(p -> Observable.from(p.getResults())).switchIfEmpty( - Observable.defer(() -> { - - Database databaseDefinition = new Database(); - databaseDefinition.setId(databaseId); - - return client.createDatabase(databaseDefinition, null).map(ResourceResponse::getResource); - }) - ).toBlocking().single(); - } - - static protected void safeDeleteDatabase(AsyncDocumentClient client, Database database) { - if (database != null) { - safeDeleteDatabase(client, database.getId()); - } - } - - static protected void safeDeleteDatabase(AsyncDocumentClient client, String databaseId) { - if (client != null) { - try { - client.deleteDatabase(com.microsoft.azure.cosmosdb.rx.Utils.getDatabaseNameLink(databaseId), null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeDeleteAllCollections(AsyncDocumentClient client, Database database) { - if (database != null) { - List collections = client.readCollections(database.getSelfLink(), null) - .flatMap(p -> Observable.from(p.getResults())) - .toList() - .toBlocking() - .single(); - - for(DocumentCollection collection: collections) { - client.deleteCollection(collection.getSelfLink(), null).toBlocking().single().getResource(); - } - } - } - - static protected void safeDeleteCollection(AsyncDocumentClient client, DocumentCollection collection) { - if (client != null && collection != null) { - try { - client.deleteCollection(collection.getSelfLink(), null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeDeleteCollection(AsyncDocumentClient client, String databaseId, String collectionId) { - if (client != null && databaseId != null && collectionId != null) { - try { - client.deleteCollection("/dbs/" + databaseId + "/colls/" + collectionId, null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeClose(AsyncDocumentClient client) { - if (client != null) { - try { - client.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public void validateSuccess(Observable> observable, - ResourceResponseValidator validator) { - validateSuccess(observable, validator, subscriberValidationTimeout); - } - - public static void validateSuccess(Observable> observable, - ResourceResponseValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public void validateFailure(Observable> observable, - FailureValidator validator) { - validateFailure(observable, validator, subscriberValidationTimeout); - } - - public static void validateFailure(Observable> observable, - FailureValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - public void validateQuerySuccess(Observable> observable, - FeedResponseListValidator validator) { - validateQuerySuccess(observable, validator, subscriberValidationTimeout); - } - - public static void validateQuerySuccess(Observable> observable, - FeedResponseListValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - validator.validate(testSubscriber.getOnNextEvents()); - } - - public void validateQueryFailure(Observable> observable, - FailureValidator validator) { - validateQueryFailure(observable, validator, subscriberValidationTimeout); - } - - public static void validateQueryFailure(Observable> observable, - FailureValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - @DataProvider - public static Object[][] clientBuilders() { - return new Object[][] { { createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null) } }; - } - - @DataProvider - public static Object[][] clientBuildersWithSessionConsistency() { - return new Object[][] { - { createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null) }, - { createDirectRxDocumentClient(ConsistencyLevel.Session, Protocol.Https, false, null) }, - { createDirectRxDocumentClient(ConsistencyLevel.Session, Protocol.Tcp, false, null) } - }; - } - - private static ConsistencyLevel parseConsistency(String consistency) { - if (consistency != null) { - for (ConsistencyLevel consistencyLevel : ConsistencyLevel.values()) { - if (consistencyLevel.name().toLowerCase().equals(consistency.toLowerCase())) { - return consistencyLevel; - } - } - } - - logger.error("Invalid configured test consistency [{}].", consistency); - throw new IllegalStateException("Invalid configured test consistency " + consistency); - } - - private static List parsePreferredLocation(String preferredLocations) { - if (StringUtils.isEmpty(preferredLocations)) { - return null; - } - - try { - return objectMapper.readValue(preferredLocations, new TypeReference>(){}); - } catch (Exception e) { - logger.error("Invalid configured test preferredLocations [{}].", preferredLocations); - throw new IllegalStateException("Invalid configured test preferredLocations " + preferredLocations); - } - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirect() { - return simpleClientBuildersWithDirect(Protocol.Https, Protocol.Tcp); - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirectHttps() { - return simpleClientBuildersWithDirect(Protocol.Https); - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirectTcp() { - return simpleClientBuildersWithDirect(Protocol.Tcp); - } - - private static Object[][] simpleClientBuildersWithDirect(Protocol... protocols) { - - accountConsistency = parseConsistency(TestConfigurations.CONSISTENCY); - logger.info("Max test consistency to use is [{}]", accountConsistency); - List testConsistencies = new ArrayList<>(); - - switch (accountConsistency) { - case Strong: - case BoundedStaleness: - case Session: - case ConsistentPrefix: - case Eventual: - testConsistencies.add(ConsistencyLevel.Eventual); - break; - default: - throw new IllegalStateException("Invalid configured test consistency " + accountConsistency); - } - - List preferredLocation = parsePreferredLocation(TestConfigurations.PREFERRED_LOCATIONS); - boolean isMultiMasterEnabled = preferredLocation != null && accountConsistency == ConsistencyLevel.Session; - - List builders = new ArrayList<>(); - builders.add(createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null)); - - for (Protocol protocol : protocols) { - testConsistencies.forEach(consistencyLevel -> builders.add(createDirectRxDocumentClient(consistencyLevel, - protocol, - isMultiMasterEnabled, - preferredLocation))); - } - - builders.forEach(b -> logger.info("Will Use ConnectionMode [{}], Consistency [{}], Protocol [{}]", - b.getConnectionPolicy().getConnectionMode(), - b.getDesiredConsistencyLevel(), - b.getConfigs().getProtocol() - )); - - return builders.stream().map(b -> new Object[]{b}).collect(Collectors.toList()).toArray(new Object[0][]); - } - - @DataProvider - public static Object[][] clientBuildersWithDirect() { - return clientBuildersWithDirectAllConsistencies(Protocol.Https, Protocol.Tcp); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectHttps() { - return clientBuildersWithDirectAllConsistencies(Protocol.Https); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectTcp() { - return clientBuildersWithDirectAllConsistencies(Protocol.Tcp); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectSession() { - return clientBuildersWithDirectSession(Protocol.Https, Protocol.Tcp); - } - - private static Object[][] clientBuildersWithDirectSession(Protocol... protocols) { - return clientBuildersWithDirect(new ArrayList(){{add(ConsistencyLevel.Session);}} , protocols); - } - - private static Object[][] clientBuildersWithDirectAllConsistencies(Protocol... protocols) { - accountConsistency = parseConsistency(TestConfigurations.CONSISTENCY); - logger.info("Max test consistency to use is [{}]", accountConsistency); - List testConsistencies = new ArrayList<>(); - - switch (accountConsistency) { - case Strong: - testConsistencies.add(ConsistencyLevel.Strong); - case BoundedStaleness: - testConsistencies.add(ConsistencyLevel.BoundedStaleness); - case Session: - testConsistencies.add(ConsistencyLevel.Session); - case ConsistentPrefix: - testConsistencies.add(ConsistencyLevel.ConsistentPrefix); - case Eventual: - testConsistencies.add(ConsistencyLevel.Eventual); - break; - default: - throw new IllegalStateException("Invalid configured test consistency " + accountConsistency); - } - return clientBuildersWithDirect(testConsistencies, protocols); - } - - private static Object[][] clientBuildersWithDirect(List testConsistencies, Protocol... protocols) { - - List preferredLocation = parsePreferredLocation(TestConfigurations.PREFERRED_LOCATIONS); - boolean isMultiMasterEnabled = preferredLocation != null && accountConsistency == ConsistencyLevel.Session; - - List builders = new ArrayList<>(); - builders.add(createGatewayRxDocumentClient(ConsistencyLevel.Session, isMultiMasterEnabled, preferredLocation)); - - for (Protocol protocol : protocols) { - testConsistencies.forEach(consistencyLevel -> builders.add(createDirectRxDocumentClient(consistencyLevel, - protocol, - isMultiMasterEnabled, - preferredLocation))); - } - - builders.forEach(b -> logger.info("Will Use ConnectionMode [{}], Consistency [{}], Protocol [{}]", - b.getConnectionPolicy().getConnectionMode(), - b.getDesiredConsistencyLevel(), - b.getConfigs().getProtocol() - )); - - return builders.stream().map(b -> new Object[]{b}).collect(Collectors.toList()).toArray(new Object[0][]); - } - - static protected AsyncDocumentClient.Builder createGatewayHouseKeepingDocumentClient() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - RetryOptions options = new RetryOptions(); - options.setMaxRetryWaitTimeInSeconds(SUITE_SETUP_TIMEOUT); - connectionPolicy.setRetryOptions(options); - return new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session); - } - - static protected AsyncDocumentClient.Builder createGatewayRxDocumentClient(ConsistencyLevel consistencyLevel, boolean multiMasterEnabled, List preferredLocations) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - connectionPolicy.setUsingMultipleWriteLocations(multiMasterEnabled); - connectionPolicy.setPreferredLocations(preferredLocations); - return new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(consistencyLevel); - } - - static protected AsyncDocumentClient.Builder createGatewayRxDocumentClient() { - return createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null); - } - - static protected AsyncDocumentClient.Builder createDirectRxDocumentClient(ConsistencyLevel consistencyLevel, - Protocol protocol, - boolean multiMasterEnabled, - List preferredLocations) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - - if (preferredLocations != null) { - connectionPolicy.setPreferredLocations(preferredLocations); - } - - if (multiMasterEnabled && consistencyLevel == ConsistencyLevel.Session) { - connectionPolicy.setUsingMultipleWriteLocations(true); - } - - Configs configs = spy(new Configs()); - doAnswer((Answer) invocation -> protocol).when(configs).getProtocol(); - - return new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(consistencyLevel) - .withConfigs(configs); - } - - protected int expectedNumberOfPages(int totalExpectedResult, int maxPageSize) { - return Math.max((totalExpectedResult + maxPageSize - 1 ) / maxPageSize, 1); - } - - @DataProvider(name = "queryMetricsArgProvider") - public Object[][] queryMetricsArgProvider() { - return new Object[][]{ - {true}, - {false}, - }; - } - - public static class VerboseTestSubscriber extends TestSubscriber { - @Override - public void assertNoErrors() { - List onErrorEvents = getOnErrorEvents(); - StringBuilder errorMessageBuilder = new StringBuilder(); - if (!onErrorEvents.isEmpty()) { - for(Throwable throwable : onErrorEvents) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - throwable.printStackTrace(pw); - String sStackTrace = sw.toString(); // stack trace as a string - errorMessageBuilder.append(sStackTrace); - } - - AssertionError ae = new AssertionError(errorMessageBuilder.toString()); - throw ae; - } - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolverTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolverTest.java deleted file mode 100644 index badd57df6db5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolverTest.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.directconnectivity; - - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GatewayAddressCache; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GatewayServiceConfigurationReader; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.GlobalEndpointManager; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxPartitionKeyRangeCache; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import org.apache.commons.collections4.list.UnmodifiableList; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Completable; -import rx.Single; -import rx.functions.Action0; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.assertj.core.api.Assertions.assertThat; - -public class GlobalAddressResolverTest { - - private CompositeHttpClient httpClient; - private GlobalEndpointManager endpointManager; - private IAuthorizationTokenProvider authorizationTokenProvider; - private UserAgentContainer userAgentContainer; - private RxCollectionCache collectionCache; - private GatewayServiceConfigurationReader serviceConfigReader; - private RxPartitionKeyRangeCache routingMapProvider; - private ConnectionPolicy connectionPolicy; - private URL urlforRead1; - private URL urlforRead2; - private URL urlforRead3; - - private URL urlforWrite1; - private URL urlforWrite2; - private URL urlforWrite3; - - @BeforeClass(groups = "unit") - public void setup() throws Exception { - urlforRead1 = new URL("http://testRead1.com/"); - urlforRead2 = new URL("http://testRead2.com/"); - urlforRead3 = new URL("http://testRead3.com/"); - urlforWrite1 = new URL("http://testWrite1.com/"); - urlforWrite2 = new URL("http://testWrite2.com/"); - urlforWrite3 = new URL("http://testWrite3.com/"); - - connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setEnableReadRequestsFallback(true); - httpClient = Mockito.mock(CompositeHttpClient.class); - endpointManager = Mockito.mock(GlobalEndpointManager.class); - - List readEndPointList = new ArrayList<>(); - readEndPointList.add(urlforRead1); - readEndPointList.add(urlforRead2); - readEndPointList.add(urlforRead3); - UnmodifiableList readList = new UnmodifiableList(readEndPointList); - - List writeEndPointList = new ArrayList<>(); - writeEndPointList.add(urlforWrite1); - writeEndPointList.add(urlforWrite2); - writeEndPointList.add(urlforWrite3); - UnmodifiableList writeList = new UnmodifiableList(writeEndPointList); - - Mockito.when(endpointManager.getReadEndpoints()).thenReturn(readList); - Mockito.when(endpointManager.getWriteEndpoints()).thenReturn(writeList); - - authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionCache = Mockito.mock(RxCollectionCache.class); - Mockito.when(collectionCache.resolveCollectionAsync(Matchers.any(RxDocumentServiceRequest.class))).thenReturn(Single.just(collectionDefinition)); - routingMapProvider = Mockito.mock(RxPartitionKeyRangeCache.class); - userAgentContainer = Mockito.mock(UserAgentContainer.class); - serviceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - - } - - @Test(groups = "unit") - public void resolveAsync() throws Exception { - - GlobalAddressResolver globalAddressResolver = new GlobalAddressResolver(httpClient, endpointManager, Protocol.Https, authorizationTokenProvider, collectionCache, routingMapProvider, - userAgentContainer, - serviceConfigReader, connectionPolicy); - RxDocumentServiceRequest request; - request = RxDocumentServiceRequest.createFromName( - OperationType.Read, - "dbs/db/colls/coll/docs/doc1", - ResourceType.Document); - - Set urlsBeforeResolve = globalAddressResolver.addressCacheByEndpoint.keySet(); - assertThat(urlsBeforeResolve.size()).isEqualTo(5); - assertThat(urlsBeforeResolve.contains(urlforRead3)).isFalse();//Last read will be removed from addressCacheByEndpoint after 5 endpoints - assertThat(urlsBeforeResolve.contains(urlforRead2)).isTrue(); - - URL testUrl = new URL("http://Test.com/"); - Mockito.when(endpointManager.resolveServiceEndpoint(Matchers.any(RxDocumentServiceRequest.class))).thenReturn(testUrl); - globalAddressResolver.resolveAsync(request, true); - Set urlsAfterResolve = globalAddressResolver.addressCacheByEndpoint.keySet(); - assertThat(urlsAfterResolve.size()).isEqualTo(5); - assertThat(urlsAfterResolve.contains(urlforRead2)).isFalse();//Last read will be removed from addressCacheByEndpoint after 5 endpoints - assertThat(urlsBeforeResolve.contains(testUrl)).isTrue();//New endpoint will be added in addressCacheByEndpoint - } - - @Test(groups = "unit") - public void openAsync() throws Exception { - GlobalAddressResolver globalAddressResolver = new GlobalAddressResolver(httpClient, endpointManager, Protocol.Https, authorizationTokenProvider, collectionCache, routingMapProvider, - userAgentContainer, - serviceConfigReader, connectionPolicy); - Map addressCacheByEndpoint = Mockito.spy(globalAddressResolver.addressCacheByEndpoint); - GlobalAddressResolver.EndpointCache endpointCache = new GlobalAddressResolver.EndpointCache(); - GatewayAddressCache gatewayAddressCache = Mockito.mock(GatewayAddressCache.class); - AtomicInteger numberOfTaskCompleted = new AtomicInteger(0); - endpointCache.addressCache = gatewayAddressCache; - globalAddressResolver.addressCacheByEndpoint.clear(); - globalAddressResolver.addressCacheByEndpoint.put(urlforRead1, endpointCache); - globalAddressResolver.addressCacheByEndpoint.put(urlforRead2, endpointCache); - - - DocumentCollection documentCollection = new DocumentCollection(); - documentCollection.setId("TestColl"); - documentCollection.setResourceId("IXYFAOHEBPM="); - CollectionRoutingMap collectionRoutingMap = Mockito.mock(CollectionRoutingMap.class); - PartitionKeyRange range = new PartitionKeyRange("0", PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, - PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey); - List partitionKeyRanges = new ArrayList<>(); - partitionKeyRanges.add(range); - Mockito.when(collectionRoutingMap.getOrderedPartitionKeyRanges()).thenReturn(partitionKeyRanges); - Single collectionRoutingMapSingle = Single.just(collectionRoutingMap); - Mockito.when(routingMapProvider.tryLookupAsync(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(collectionRoutingMapSingle); - - List ranges = new ArrayList<>(); - for (PartitionKeyRange partitionKeyRange : (List) collectionRoutingMap.getOrderedPartitionKeyRanges()) { - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity(documentCollection.getResourceId(), partitionKeyRange.getId()); - ranges.add(partitionKeyRangeIdentity); - } - Completable completable = Completable.fromAction(new Action0() { - @Override - public void call() { - numberOfTaskCompleted.getAndIncrement(); - } - }); - Mockito.when(gatewayAddressCache.openAsync(documentCollection, ranges)).thenReturn(completable); - - globalAddressResolver.openAsync(documentCollection).await(); - assertThat(numberOfTaskCompleted.get()).isEqualTo(2); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/ReflectionUtils.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/ReflectionUtils.java deleted file mode 100644 index 944089112f01..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/ReflectionUtils.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpTransportClient; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ServerStoreModel; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreClient; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.TransportClient; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import org.apache.commons.lang3.reflect.FieldUtils; - -/** - * - * TransportClient transportClient = ReflectionUtils.getDirectHttpsHttpClient(documentClient); - * TransportClient spyTransportClient = Mockito.spy(transportClient); - * ReflectionUtils.setTransportClient(documentClient, spyTransportClient); - * - * // use the documentClient - * // do assertion on the request and response spyTransportClient recieves using Mockito - */ -public class ReflectionUtils { - - private static void set(Object object, T newValue, String fieldName) { - try { - FieldUtils.writeField(object, fieldName, newValue, true); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } - - private static T get(Class klass, Object object, String fieldName) { - try { - return (T) FieldUtils.readField(object, fieldName, true); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } - - public static ServerStoreModel getServerStoreModel(RxDocumentClientImpl client) { - return get(ServerStoreModel.class, client, "storeModel"); - } - - public static StoreClient getStoreClient(RxDocumentClientImpl client) { - ServerStoreModel serverStoreModel = getServerStoreModel(client); - return get(StoreClient.class, serverStoreModel, "storeClient"); - } - - public static TransportClient getTransportClient(RxDocumentClientImpl client) { - StoreClient storeClient = getStoreClient(client); - return get(TransportClient.class, storeClient, "transportClient"); - } - - public static void setTransportClient(RxDocumentClientImpl client, TransportClient transportClient) { - StoreClient storeClient = getStoreClient(client); - set(storeClient, transportClient, "transportClient"); - } - - public static CompositeHttpClient getDirectHttpsHttpClient(RxDocumentClientImpl client) { - TransportClient transportClient = getTransportClient(client); - assert transportClient instanceof HttpTransportClient; - return get(CompositeHttpClient.class, transportClient, "httpClient"); - } - - public static void setDirectHttpsHttpClient(RxDocumentClientImpl client, CompositeHttpClient newHttpClient) { - TransportClient transportClient = getTransportClient(client); - assert transportClient instanceof HttpTransportClient; - set(transportClient, newHttpClient, "httpClient"); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducerTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducerTest.java deleted file mode 100644 index 479fe761b0cc..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducerTest.java +++ /dev/null @@ -1,1076 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; -import com.google.common.collect.LinkedListMultimap; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.query.SortOrder; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderByRowResult; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderbyRowComparer; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.GlobalEndpointManager; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicyFactory; -import com.microsoft.azure.cosmosdb.rx.internal.RetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxPartitionKeyRangeCache; -import org.apache.commons.lang3.RandomUtils; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Observable; -import rx.Single; -import rx.functions.Func1; -import rx.functions.Func3; -import rx.observers.TestSubscriber; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.BiFunction; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import java.util.stream.Stream; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; - -public class DocumentProducerTest { - private final static Logger logger = LoggerFactory.getLogger(DocumentProducerTest.class); - private static final long TIMEOUT = 10000; - private final static String OrderByPayloadFieldName = "payload"; - private final static String OrderByItemsFieldName = "orderByItems"; - - private final static String OrderByIntFieldName = "propInt"; - private final static String DocumentPartitionKeyRangeIdFieldName = "_pkrId"; - private final static String DocumentPartitionKeyRangeMinInclusiveFieldName = "_pkrMinInclusive"; - private final static String DocumentPartitionKeyRangeMaxExclusiveFieldName = "_pkrMaxExclusive"; - - private final String collectionRid = "myrid"; - private final String collectionLink = "/dbs/mydb/colls/mycol"; - - @DataProvider(name = "splitParamProvider") - public Object[][] splitParamProvider() { - return new Object[][] { - // initial continuation token, - // # pages from parent before split, - // # pages from left child after split, - // # pages from right child after split - { "init-cp", 10, 5, 6 }, - { null, 10, 5, 6 }, - { null, 1000, 500, 600 }, - { "init-cp", 1000, 500, 600 }, - { "init-cp", 0, 10, 12 }, - { null, 0, 10, 12 }, - { null, 0, 1, 1 }, - { null, 10, 1, 1 }, - }; - } - - private IRetryPolicyFactory mockDocumentClientIRetryPolicyFactory() { - URL url; - try { - url = new URL("http://localhost"); - } catch (Exception e) { - throw new IllegalStateException(e); - } - - GlobalEndpointManager globalEndpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(url).when(globalEndpointManager).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - doReturn(false).when(globalEndpointManager).isClosed(); - return new RetryPolicy(globalEndpointManager, ConnectionPolicy.GetDefault()); - } - - @Test(groups = { "unit" }, dataProvider = "splitParamProvider", timeOut = TIMEOUT) - public void partitionSplit(String initialContinuationToken, - int numberOfResultPagesFromParentBeforeSplit, - int numberOfResultPagesFromLeftChildAfterSplit, - int numberOfResultPagesFromRightChildAfterSplit) { - int initialPageSize = 7; - int top = -1; - - String parentPartitionId = "1"; - String leftChildPartitionId = "2"; - String rightChildPartitionId = "3"; - - List> resultFromParentPartition = mockFeedResponses(parentPartitionId, numberOfResultPagesFromParentBeforeSplit, 3, false); - List> resultFromLeftChildPartition = mockFeedResponses(leftChildPartitionId, numberOfResultPagesFromLeftChildAfterSplit, 3, true); - List> resultFromRightChildPartition = mockFeedResponses(rightChildPartitionId, numberOfResultPagesFromRightChildAfterSplit, 3, true); - - // sanity check - sanityCheckSplitValidation(parentPartitionId, leftChildPartitionId, rightChildPartitionId, - numberOfResultPagesFromParentBeforeSplit, - numberOfResultPagesFromLeftChildAfterSplit, - numberOfResultPagesFromRightChildAfterSplit, - resultFromParentPartition, resultFromLeftChildPartition, resultFromRightChildPartition); - - // setting up behaviour - RequestExecutor.PartitionAnswer answerFromParentPartition = RequestExecutor.PartitionAnswer.just(parentPartitionId, resultFromParentPartition); - RequestExecutor.PartitionAnswer splitAnswerFromParentPartition = RequestExecutor.PartitionAnswer.alwaysPartitionSplit(parentPartitionId); - - RequestExecutor.PartitionAnswer answerFromLeftChildPartition = RequestExecutor.PartitionAnswer.just(leftChildPartitionId, resultFromLeftChildPartition); - RequestExecutor.PartitionAnswer answerFromRightChildPartition = RequestExecutor.PartitionAnswer.just(rightChildPartitionId, resultFromRightChildPartition); - - RequestCreator requestCreator = RequestCreator.simpleMock(); - RequestExecutor requestExecutor = RequestExecutor. - fromPartitionAnswer(ImmutableList.of(answerFromParentPartition, splitAnswerFromParentPartition, - answerFromLeftChildPartition, answerFromRightChildPartition)); - - PartitionKeyRange parentPartitionKeyRange = mockPartitionKeyRange(parentPartitionId); - PartitionKeyRange leftChildPartitionKeyRange = mockPartitionKeyRange(leftChildPartitionId); - PartitionKeyRange rightChildPartitionKeyRange = mockPartitionKeyRange(rightChildPartitionId); - - // this returns replacement ranges upon split detection - IDocumentQueryClient queryClient = mockQueryClient(ImmutableList.of(leftChildPartitionKeyRange, rightChildPartitionKeyRange)); - - DocumentProducer documentProducer = new DocumentProducer( - queryClient, - collectionRid, - null, - requestCreator, - requestExecutor, - parentPartitionKeyRange, - collectionLink, - () -> mockDocumentClientIRetryPolicyFactory().getRequestPolicy(), - Document.class, - null, - initialPageSize, - initialContinuationToken, - top); - - TestSubscriber.DocumentProducerFeedResponse> subscriber = new TestSubscriber<>(); - - documentProducer.produceAsync().subscribe(subscriber); - subscriber.awaitTerminalEvent(); - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - - validateSplitCaptureRequests( - requestCreator.invocations, - initialContinuationToken, - parentPartitionId, - leftChildPartitionId, - rightChildPartitionId, - resultFromParentPartition, - resultFromLeftChildPartition, - resultFromRightChildPartition); - - // page size match - assertThat(requestCreator.invocations.stream().map(i -> i.maxItemCount) - .distinct().collect(Collectors.toList())).containsExactlyElementsOf(Collections.singleton(initialPageSize)); - - // expected results - validateSplitResults(subscriber.getOnNextEvents(), parentPartitionId, leftChildPartitionId, rightChildPartitionId, resultFromParentPartition, - resultFromLeftChildPartition, resultFromRightChildPartition, false); - - Mockito.verify(queryClient, times(1)).getPartitionKeyRangeCache(); - } - - @Test(groups = { "unit" }, dataProvider = "splitParamProvider", timeOut = TIMEOUT) - public void orderByPartitionSplit(String initialContinuationToken, - int numberOfResultPagesFromParentBeforeSplit, - int numberOfResultPagesFromLeftChildAfterSplit, - int numberOfResultPagesFromRightChildAfterSplit) { - int initialPageSize = 7; - int top = -1; - - String parentPartitionId = "1"; - String leftChildPartitionId = "2"; - String rightChildPartitionId = "3"; - - Integer initialPropVal = 1; - List> resultFromParentPartition = mockFeedResponses( - parentPartitionId, numberOfResultPagesFromParentBeforeSplit, 3, initialPropVal, false); - Integer highestValInParentPage = getLastValueInAsc(initialPropVal, resultFromParentPartition); - - List> resultFromLeftChildPartition = mockFeedResponses(leftChildPartitionId, - numberOfResultPagesFromLeftChildAfterSplit, 3, highestValInParentPage,true); - - List> resultFromRightChildPartition = mockFeedResponses(rightChildPartitionId, - numberOfResultPagesFromRightChildAfterSplit, 3, highestValInParentPage,true); - - // sanity check - sanityCheckSplitValidation(parentPartitionId, leftChildPartitionId, rightChildPartitionId, - numberOfResultPagesFromParentBeforeSplit, - numberOfResultPagesFromLeftChildAfterSplit, - numberOfResultPagesFromRightChildAfterSplit, - resultFromParentPartition, resultFromLeftChildPartition, resultFromRightChildPartition); - - // setting up behaviour - RequestExecutor.PartitionAnswer answerFromParentPartition = RequestExecutor.PartitionAnswer.just( - parentPartitionId, resultFromParentPartition); - RequestExecutor.PartitionAnswer splitAnswerFromParentPartition = RequestExecutor - .PartitionAnswer.alwaysPartitionSplit(parentPartitionId); - - RequestExecutor.PartitionAnswer answerFromLeftChildPartition = RequestExecutor.PartitionAnswer.just(leftChildPartitionId, resultFromLeftChildPartition); - RequestExecutor.PartitionAnswer answerFromRightChildPartition = RequestExecutor.PartitionAnswer.just(rightChildPartitionId, resultFromRightChildPartition); - - RequestCreator requestCreator = RequestCreator.simpleMock(); - RequestExecutor requestExecutor = RequestExecutor. - fromPartitionAnswer(ImmutableList.of(answerFromParentPartition, splitAnswerFromParentPartition, - answerFromLeftChildPartition, answerFromRightChildPartition)); - - PartitionKeyRange parentPartitionKeyRange = mockPartitionKeyRange(parentPartitionId); - PartitionKeyRange leftChildPartitionKeyRange = mockPartitionKeyRange(leftChildPartitionId); - PartitionKeyRange rightChildPartitionKeyRange = mockPartitionKeyRange(rightChildPartitionId); - - // this returns replacement ranges upon split detection - IDocumentQueryClient queryCl = mockQueryClient( - ImmutableList.of(leftChildPartitionKeyRange, rightChildPartitionKeyRange)); - - OrderByDocumentProducer documentProducer = new OrderByDocumentProducer<>( - new OrderbyRowComparer<>(ImmutableList.of(SortOrder.Ascending)), - queryCl, - collectionRid, - null, - requestCreator, - requestExecutor, - parentPartitionKeyRange, - collectionLink, - null, - Document.class, - null, - initialPageSize, - initialContinuationToken, - top, - /*targetRangeToOrderByContinuationTokenMap*/new HashMap<>()); - - TestSubscriber.DocumentProducerFeedResponse> subscriber = new TestSubscriber<>(); - - documentProducer.produceAsync().subscribe(subscriber); - subscriber.awaitTerminalEvent(); - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - - validateSplitCaptureRequests( - requestCreator.invocations, - initialContinuationToken, - parentPartitionId, - leftChildPartitionId, - rightChildPartitionId, - resultFromParentPartition, - resultFromLeftChildPartition, - resultFromRightChildPartition); - - // page size match - assertThat(requestCreator.invocations.stream().map(i -> i.maxItemCount) - .distinct().collect(Collectors.toList())).containsExactlyElementsOf(Collections.singleton(initialPageSize)); - - // expected results - validateSplitResults(subscriber.getOnNextEvents(), - parentPartitionId, - leftChildPartitionId, - rightChildPartitionId, - resultFromParentPartition, - resultFromLeftChildPartition, resultFromRightChildPartition, true); - - Mockito.verify(queryCl, times(1)).getPartitionKeyRangeCache(); - } - - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void simple() { - int initialPageSize = 7; - int top = -1; - - String partitionId = "1"; - - List requests = new ArrayList<>(); - for(int i = 0; i < 10; i++) { - requests.add(mockRequest(partitionId)); - } - - List> responses = mockFeedResponses(partitionId, 10, 3, true); - - RequestCreator requestCreator = RequestCreator.give(requests); - RequestExecutor requestExecutor = RequestExecutor.fromPartitionAnswer( - RequestExecutor.PartitionAnswer.just("1", responses)); - - PartitionKeyRange targetRange = mockPartitionKeyRange(partitionId); - - IDocumentQueryClient queryClient = Mockito.mock(IDocumentQueryClient.class); - String initialContinuationToken = "initial-cp"; - DocumentProducer documentProducer = new DocumentProducer<>( - queryClient, - collectionRid, - null, - requestCreator, - requestExecutor, - targetRange, - collectionLink, - () -> mockDocumentClientIRetryPolicyFactory().getRequestPolicy(), - Document.class, - null, - initialPageSize, - initialContinuationToken, - top); - - TestSubscriber subscriber = new TestSubscriber<>(); - - documentProducer.produceAsync().subscribe(subscriber); - subscriber.awaitTerminalEvent(); - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - - subscriber.assertValueCount(responses.size()); - - // requests match - assertThat(requestCreator.invocations.stream().map(i -> i.invocationResult) - .collect(Collectors.toList())).containsExactlyElementsOf(requests); - - // requested max page size match - assertThat(requestCreator.invocations.stream().map(i -> i.maxItemCount) - .distinct().collect(Collectors.toList())).containsExactlyElementsOf(Collections.singleton(7)); - - // continuation tokens - assertThat(requestCreator.invocations.get(0).continuationToken).isEqualTo(initialContinuationToken); - assertThat(requestCreator.invocations.stream().skip(1).map(i -> i.continuationToken) - .collect(Collectors.toList())).containsExactlyElementsOf( - responses.stream().limit(9).map(r -> r.getResponseContinuation()).collect(Collectors.toList())); - - // source partition - assertThat(requestCreator.invocations.stream().map(i -> i.sourcePartition).distinct() - .collect(Collectors.toList())).containsExactlyElementsOf(Collections.singletonList(targetRange)); - } - - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void retries() { - int initialPageSize = 7; - int top = -1; - - String partitionKeyRangeId = "1"; - - RequestCreator requestCreator = RequestCreator.simpleMock(); - - List> responsesBeforeThrottle = mockFeedResponses(partitionKeyRangeId, 2, 1, false); - Exception throttlingException = mockThrottlingException(10); - List> responsesAfterThrottle = mockFeedResponses(partitionKeyRangeId, 5, 1, true); - - RequestExecutor.PartitionAnswer behaviourBeforeException = RequestExecutor.PartitionAnswer.just(partitionKeyRangeId, responsesBeforeThrottle); - RequestExecutor.PartitionAnswer exceptionBehaviour = RequestExecutor.PartitionAnswer.errors(partitionKeyRangeId, Collections.singletonList(throttlingException)); - RequestExecutor.PartitionAnswer behaviourAfterException = RequestExecutor.PartitionAnswer.just(partitionKeyRangeId, responsesAfterThrottle); - - RequestExecutor requestExecutor = RequestExecutor.fromPartitionAnswer(behaviourBeforeException, exceptionBehaviour, behaviourAfterException); - - PartitionKeyRange targetRange = mockPartitionKeyRange(partitionKeyRangeId); - - IDocumentQueryClient queryClient = Mockito.mock(IDocumentQueryClient.class); - String initialContinuationToken = "initial-cp"; - DocumentProducer documentProducer = new DocumentProducer<>( - queryClient, - collectionRid, - null, - requestCreator, - requestExecutor, - targetRange, - collectionLink, - () -> mockDocumentClientIRetryPolicyFactory().getRequestPolicy(), - Document.class, - null, - initialPageSize, - initialContinuationToken, - top); - - TestSubscriber subscriber = new TestSubscriber<>(); - - documentProducer.produceAsync().subscribe(subscriber); - subscriber.awaitTerminalEvent(); - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - - subscriber.assertValueCount(responsesBeforeThrottle.size() + responsesAfterThrottle.size()); - - // requested max page size match - assertThat(requestCreator.invocations.stream().map(i -> i.maxItemCount) - .distinct().collect(Collectors.toList())).containsExactlyElementsOf(Collections.singleton(7)); - - // continuation tokens - assertThat(requestCreator.invocations.get(0).continuationToken).isEqualTo(initialContinuationToken); - - // source partition - assertThat(requestCreator.invocations.stream().map(i -> i.sourcePartition).distinct() - .collect(Collectors.toList())).containsExactlyElementsOf(Collections.singletonList(targetRange)); - - List resultContinuationToken = subscriber.getOnNextEvents() - .stream().map(r -> r.pageResult.getResponseContinuation()).collect(Collectors.toList()); - List beforeExceptionContinuationTokens = responsesBeforeThrottle.stream() - .map(r -> r.getResponseContinuation()).collect(Collectors.toList()); - List afterExceptionContinuationTokens = responsesAfterThrottle.stream() - .map(r -> r.getResponseContinuation()).collect(Collectors.toList()); - - assertThat(resultContinuationToken).containsExactlyElementsOf( - Iterables.concat(beforeExceptionContinuationTokens, afterExceptionContinuationTokens)); - - String continuationTokenOnException = Iterables.getLast(beforeExceptionContinuationTokens); - - assertThat(requestCreator.invocations.stream().map(cr -> cr.continuationToken)).containsExactlyElementsOf( - Iterables.concat( - ImmutableList.of(initialContinuationToken), - Iterables.limit(resultContinuationToken, resultContinuationToken.size()-1))); - - assertThat(requestExecutor.partitionKeyRangeIdToCapturedInvocation.get(partitionKeyRangeId) - .stream().map(cr -> cr.request.getContinuation())).containsExactlyElementsOf( - Iterables.concat( - ImmutableList.of(initialContinuationToken), - beforeExceptionContinuationTokens, - Collections.singletonList(continuationTokenOnException), - Iterables.limit(afterExceptionContinuationTokens, afterExceptionContinuationTokens.size()-1))); - } - - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void retriesExhausted() { - int initialPageSize = 7; - int top = -1; - - String partitionKeyRangeId = "1"; - - RequestCreator requestCreator = RequestCreator.simpleMock(); - - List> responsesBeforeThrottle = mockFeedResponses(partitionKeyRangeId, 1, 1, false); - Exception throttlingException = mockThrottlingException(10); - - RequestExecutor.PartitionAnswer behaviourBeforeException = RequestExecutor.PartitionAnswer.just(partitionKeyRangeId, responsesBeforeThrottle); - RequestExecutor.PartitionAnswer exceptionBehaviour = RequestExecutor.PartitionAnswer.errors(partitionKeyRangeId, Collections.nCopies(10, throttlingException)); - - RequestExecutor requestExecutor = RequestExecutor.fromPartitionAnswer(behaviourBeforeException, exceptionBehaviour); - - PartitionKeyRange targetRange = mockPartitionKeyRange(partitionKeyRangeId); - - IDocumentQueryClient queryClient = Mockito.mock(IDocumentQueryClient.class); - String initialContinuationToken = "initial-cp"; - DocumentProducer documentProducer = new DocumentProducer<>( - queryClient, - collectionRid, - null, - requestCreator, - requestExecutor, - targetRange, - collectionRid, - () -> mockDocumentClientIRetryPolicyFactory().getRequestPolicy(), - Document.class, - null, - initialPageSize, - initialContinuationToken, - top); - - TestSubscriber subscriber = new TestSubscriber<>(); - - documentProducer.produceAsync().subscribe(subscriber); - subscriber.awaitTerminalEvent(); - - subscriber.assertError(throttlingException); - subscriber.assertValueCount(responsesBeforeThrottle.size()); - } - - private DocumentClientException mockThrottlingException(long retriesAfter) { - DocumentClientException throttleException = mock(DocumentClientException.class); - doReturn(429).when(throttleException).getStatusCode(); - doReturn(retriesAfter).when(throttleException).getRetryAfterInMilliseconds(); - return throttleException; - } - - private List> mockFeedResponses(String partitionKeyRangeId, - int numberOfPages, - int numberOfDocsPerPage, - boolean completed) { - return mockFeedResponsesPartiallySorted(partitionKeyRangeId, - numberOfPages, - numberOfDocsPerPage, - false, - -1, - completed); - } - - private List> mockFeedResponses(String partitionKeyRangeId, - int numberOfPages, - int numberOfDocsPerPage, - int orderByFieldInitialVal, - boolean completed) { - return mockFeedResponsesPartiallySorted(partitionKeyRangeId, - numberOfPages, - numberOfDocsPerPage, - true, - orderByFieldInitialVal, - completed); - } - - private List> mockFeedResponsesPartiallySorted(String partitionKeyRangeId, - int numberOfPages, - int numberOfDocsPerPage, - boolean isOrderby, - int orderByFieldInitialVal, - boolean completed) { - String uuid = UUID.randomUUID().toString(); - List> responses = new ArrayList<>(); - for(int i = 0; i < numberOfPages; i++) { - FeedResponseBuilder rfb = FeedResponseBuilder.queryFeedResponseBuilder(Document.class); - List res = new ArrayList<>(); - - for(int j = 0; j < numberOfDocsPerPage; j++) { - - Document d = getDocumentDefinition(); - if (isOrderby) { - d.set(OrderByIntFieldName, orderByFieldInitialVal + RandomUtils.nextInt(0, 3)); - d.set(DocumentPartitionKeyRangeIdFieldName, partitionKeyRangeId); - PartitionKeyRange pkr = mockPartitionKeyRange(partitionKeyRangeId); - - d.set(DocumentPartitionKeyRangeMinInclusiveFieldName, pkr.getMinInclusive()); - d.set(DocumentPartitionKeyRangeMaxExclusiveFieldName, pkr.getMaxExclusive()); - - QueryItem qi = new QueryItem( - "{ \"item\": " + Integer.toString(d.getInt(OrderByIntFieldName)) + " }"); - String json = "{\"" + OrderByPayloadFieldName + "\" : " + d.toJson() + ", \"" + OrderByItemsFieldName - + "\" : [ " + qi.toJson() + " ] }"; - - OrderByRowResult row = - new OrderByRowResult<>(Document.class, json, mockPartitionKeyRange(partitionKeyRangeId), "backend continuation token"); - res.add(row); - } else { - res.add(d); - } - } - rfb.withResults(res); - - if (!(completed && i == numberOfPages - 1)) { - rfb.withContinuationToken("cp:" + uuid + ":" + i); - } - - FeedResponse resp = rfb.build(); - responses.add(resp); - } - return responses; - } - - private int getLastValueInAsc(int initialValue, List> responsesList) { - Integer value = null; - for(FeedResponse page: responsesList) { - for(Document d: page.getResults()) { - Integer tmp = d.getInt(OrderByIntFieldName); - if (tmp != null) { - value = tmp; - } - } - } - if (value != null) { - return value; - } else { - return initialValue; - } - } - - private IDocumentQueryClient mockQueryClient(List replacementRanges) { - IDocumentQueryClient client = Mockito.mock(IDocumentQueryClient.class); - RxPartitionKeyRangeCache cache = Mockito.mock(RxPartitionKeyRangeCache.class); - doReturn(cache).when(client).getPartitionKeyRangeCache(); - doReturn(Single.just(replacementRanges)).when(cache). - tryGetOverlappingRangesAsync(anyString(), any(Range.class), anyBoolean(), Matchers.anyMap()); - return client; - } - - private PartitionKeyRange mockPartitionKeyRange(String partitionKeyRangeId) { - PartitionKeyRange pkr = Mockito.mock(PartitionKeyRange.class); - doReturn(partitionKeyRangeId).when(pkr).getId(); - doReturn(partitionKeyRangeId + ":AA").when(pkr).getMinInclusive(); - doReturn(partitionKeyRangeId + ":FF").when(pkr).getMaxExclusive(); - return pkr; - } - - private RxDocumentServiceRequest mockRequest(String partitionKeyRangeId) { - RxDocumentServiceRequest req = Mockito.mock(RxDocumentServiceRequest.class); - PartitionKeyRangeIdentity pkri = new PartitionKeyRangeIdentity(partitionKeyRangeId); - doReturn(pkri).when(req).getPartitionKeyRangeIdentity(); - return req; - } - - private static void validateSplitCaptureRequests( - List capturedInvocationList, - String initialContinuationToken, - String parentPartitionId, - String leftChildPartitionId, - String rightChildPartitionId, - List> expectedResultPagesFromParentPartitionBeforeSplit, - List> expectedResultPagesFromLeftChildPartition, - List> expectedResultPagesFromRightChildPartition) { - - int numberOfResultPagesFromParentBeforeSplit = expectedResultPagesFromParentPartitionBeforeSplit.size(); - int numberOfResultPagesFromLeftChildAfterSplit = expectedResultPagesFromLeftChildPartition.size(); - int numberOfResultPagesFromRightChildAfterSplit = expectedResultPagesFromRightChildPartition.size(); - - // numberOfResultPagesFromParentBeforeSplit + 1 requests to parent partition - assertThat(capturedInvocationList.stream().limit(numberOfResultPagesFromParentBeforeSplit + 1) - .filter(i -> i.sourcePartition.getId().equals(parentPartitionId))) - .hasSize(numberOfResultPagesFromParentBeforeSplit + 1); - - assertThat(capturedInvocationList.stream().skip(numberOfResultPagesFromParentBeforeSplit + 1) - .filter(i -> i.sourcePartition.getId().equals(leftChildPartitionId))) - .hasSize(numberOfResultPagesFromLeftChildAfterSplit); - - assertThat(capturedInvocationList.stream().skip(numberOfResultPagesFromParentBeforeSplit + 1) - .filter(i -> i.sourcePartition.getId().equals(rightChildPartitionId))) - .hasSize(numberOfResultPagesFromRightChildAfterSplit); - - - BiFunction, String, Stream> - filterByPartition = (stream, partitionId) - -> stream.filter(i -> i.sourcePartition.getId().equals(partitionId)); - - Function>, Stream> extractContinuationToken = - (list) -> list.stream().map(p -> p.getResponseContinuation()); - - assertThat(filterByPartition.apply(capturedInvocationList.stream(), parentPartitionId) - .map(r -> r.continuationToken)).containsExactlyElementsOf( - toList(Stream.concat( - Stream.of(initialContinuationToken), - extractContinuationToken.apply(expectedResultPagesFromParentPartitionBeforeSplit)))); - - String expectedInitialChildContinuationTokenInheritedFromParent = - expectedResultPagesFromParentPartitionBeforeSplit.size() > 0 ? - expectedResultPagesFromParentPartitionBeforeSplit.get( - expectedResultPagesFromParentPartitionBeforeSplit.size() - 1) - .getResponseContinuation() :initialContinuationToken; - - assertThat( - filterByPartition.andThen(s -> s.map(r -> r.continuationToken)) - .apply(capturedInvocationList.stream(), leftChildPartitionId) - ).containsExactlyElementsOf( - toList( - Stream.concat( - Stream.of(expectedInitialChildContinuationTokenInheritedFromParent), - extractContinuationToken.apply(expectedResultPagesFromLeftChildPartition) - //drop last page with null cp which doesn't trigger any request - .limit(expectedResultPagesFromLeftChildPartition.size() - 1) - ) - )); - - assertThat( - filterByPartition.andThen(s -> s.map(r -> r.continuationToken)) - .apply(capturedInvocationList.stream(), rightChildPartitionId) - ).containsExactlyElementsOf( - toList( - Stream.concat( - Stream.of(expectedInitialChildContinuationTokenInheritedFromParent), - extractContinuationToken.apply(expectedResultPagesFromRightChildPartition) - //drop last page with null cp which doesn't trigger any request - .limit(expectedResultPagesFromRightChildPartition.size() - 1) - ) - )); - } - - private static void sanityCheckSplitValidation(String parentPartitionId, - String leftChildPartitionId, - String rightChildPartitionId, - int numberOfResultPagesFromParentBeforeSplit, - int numberOfResultPagesFromLeftChildAfterSplit, - int numberOfResultPagesFromRightChildAfterSplit, - List> resultFromParent, - List> resultFromLeftChild, - List> resultFromRightChild) { - // test sanity check - assertThat(resultFromParent).hasSize(numberOfResultPagesFromParentBeforeSplit); - assertThat(resultFromLeftChild).hasSize(numberOfResultPagesFromLeftChildAfterSplit); - assertThat(resultFromRightChild).hasSize(numberOfResultPagesFromRightChildAfterSplit); - - //validate expected result continuation token - assertThat(toList(resultFromParent.stream().map(p -> p.getResponseContinuation()) - .filter(cp -> Strings.isNullOrEmpty(cp)))).isEmpty(); - - assertThat(toList(resultFromLeftChild.stream().map(p -> p.getResponseContinuation()) - .limit(resultFromLeftChild.size() - 1) - .filter(cp -> Strings.isNullOrEmpty(cp)))).isEmpty(); - - assertThat(resultFromLeftChild.get(resultFromLeftChild.size() - 1).getResponseContinuation()).isNullOrEmpty(); - - assertThat(toList(resultFromRightChild.stream().map(p -> p.getResponseContinuation()) - .limit(resultFromRightChild.size() - 1) - .filter(cp -> Strings.isNullOrEmpty(cp)))).isEmpty(); - - assertThat(resultFromRightChild.get(resultFromRightChild.size() - 1).getResponseContinuation()).isNullOrEmpty(); - } - - private void validateSplitResults(List.DocumentProducerFeedResponse> actualPages, - String parentPartitionId, - String leftChildPartitionId, - String rightChildPartitionId, - List> resultFromParent, - List> resultFromLeftChild, - List> resultFromRightChild, - boolean isOrderby) { - - if (isOrderby) { - Supplier> getStreamOfActualDocuments = - () -> actualPages.stream().flatMap(p -> p.pageResult.getResults().stream()); - - Comparator comparator = new Comparator() { - @Override - public int compare(Document o1, Document o2) { - ObjectNode obj1 = (ObjectNode) o1.get(OrderByPayloadFieldName); - ObjectNode obj2 = (ObjectNode) o1.get(OrderByPayloadFieldName); - - int cmp = (obj1).get(OrderByIntFieldName).asInt() - - (obj2).get(OrderByIntFieldName).asInt(); - if (cmp != 0) { - return cmp; - } - - return obj1.get(DocumentPartitionKeyRangeMinInclusiveFieldName).asText() - .compareTo(obj2.get(DocumentPartitionKeyRangeMinInclusiveFieldName).asText()); - } - }; - - List expectedDocuments = Stream.concat(Stream.concat(resultFromParent.stream(), - resultFromLeftChild.stream()), resultFromRightChild.stream()) - .flatMap(p -> p.getResults().stream()) - .sorted(comparator) - .collect(Collectors.toList()); - - List actualDocuments = getStreamOfActualDocuments.get().map(d -> d.getId()).collect(Collectors.toList()); - assertThat(actualDocuments) - .containsExactlyElementsOf(expectedDocuments.stream().map(d -> d.getId()).collect(Collectors.toList())); - - } else { - assertThat(actualPages).hasSize(resultFromParent.size() - + resultFromLeftChild.size() - + resultFromRightChild.size()); - - BiFunction> repeater = (v, cnt) -> { - return IntStream.range(0, cnt).mapToObj(i -> v); - }; - - List expectedCapturedPartitionIds = toList(Stream.concat(Stream.concat(repeater.apply(parentPartitionId, resultFromParent.size()), - repeater.apply(leftChildPartitionId, resultFromLeftChild.size())), - repeater.apply(rightChildPartitionId, resultFromRightChild.size()))); - - - - assertThat(toList(partitionKeyRangeIds(actualPages).stream())).containsExactlyInAnyOrderElementsOf( - expectedCapturedPartitionIds); - - validateResults(feedResponses(actualPages), ImmutableList.of(resultFromParent, resultFromLeftChild, resultFromRightChild)); - } - } - - private static List repeat(T t, int cnt) { - return IntStream.range(0, cnt).mapToObj(i -> t).collect(Collectors.toList()); - } - - private static List> feedResponses(List.DocumentProducerFeedResponse> responses) { - return responses.stream().map(dpFR -> dpFR.pageResult).collect(Collectors.toList()); - } - - private static List toList(Stream stream) { - return stream.collect(Collectors.toList()); - } - - private static List partitionKeyRangeIds(List.DocumentProducerFeedResponse> responses) { - return responses.stream().map(dpFR -> dpFR.sourcePartitionKeyRange.getId()).collect(Collectors.toList()); - } - - private static void validateResults(List> captured, List>> expectedResponsesFromPartitions) { - List> expected = expectedResponsesFromPartitions - .stream().flatMap(l -> l.stream()).collect(Collectors.toList()); - assertThat(captured).hasSameSizeAs(expected); - for(int i = 0; i < expected.size(); i++) { - FeedResponse actualPage = captured.get(i); - FeedResponse expectedPage = expected.get(i); - assertEqual(actualPage, expectedPage); - } - } - - private static void assertEqual(FeedResponse actualPage, FeedResponse expectedPage) { - assertThat(actualPage.getResults()).hasSameSizeAs(actualPage.getResults()); - assertThat(actualPage.getResponseContinuation()).isEqualTo(expectedPage.getResponseContinuation()); - - for(int i = 0; i < actualPage.getResults().size(); i++) { - Document actualDoc = actualPage.getResults().get(i); - Document expectedDoc = expectedPage.getResults().get(i); - assertThat(actualDoc.getId()).isEqualTo(expectedDoc.getId()); - assertThat(actualDoc.getString("prop")).isEqualTo(expectedDoc.getString("prop")); - } - } - - static abstract class RequestExecutor implements Func1>> { - - LinkedListMultimap partitionKeyRangeIdToCapturedInvocation = - LinkedListMultimap.create(); - class CapturedInvocation { - long time = System.nanoTime(); - RxDocumentServiceRequest request; - FeedResponse invocationResult; - Exception failureResult; - - public CapturedInvocation(RxDocumentServiceRequest request, Exception ex) { - this.request = request; - this.failureResult = ex; - } - - public CapturedInvocation(RxDocumentServiceRequest request, PartitionAnswer.Response resp) { - this.request = request; - this.invocationResult = resp.invocationResult; - this.failureResult = resp.failureResult; - } - } - - private static DocumentClientException partitionKeyRangeGoneException() { - Map headers = new HashMap<>(); - headers.put(HttpConstants.HttpHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE)); - return new DocumentClientException(HttpConstants.StatusCodes.GONE, new Error(), headers); - } - - protected void capture(String partitionId, CapturedInvocation captureInvocation) { - partitionKeyRangeIdToCapturedInvocation.put(partitionId, captureInvocation); - } - - public static RequestExecutor fromPartitionAnswer(List answers) { - return new RequestExecutor() { - @Override - public Observable> call(RxDocumentServiceRequest request) { - synchronized (this) { - logger.debug("executing request: " + request + " cp is: " + request.getContinuation()); - for (PartitionAnswer a : answers) { - if (a.getPartitionKeyRangeId().equals( - request.getPartitionKeyRangeIdentity().getPartitionKeyRangeId())) { - try { - PartitionAnswer.Response resp = a.onRequest(request); - if (resp != null) { - CapturedInvocation ci = new CapturedInvocation(request, resp); - capture(a.getPartitionKeyRangeId(), ci); - return resp.toSingle().toObservable(); - } - - } catch (Exception e) { - capture(a.getPartitionKeyRangeId(), new CapturedInvocation(request, e)); - return Observable.error(e); - } - } - } - throw new RuntimeException(); - } - } - }; - } - - public static RequestExecutor fromPartitionAnswer(PartitionAnswer... answers) { - return fromPartitionAnswer(ImmutableList.copyOf(answers)); - } - - abstract static class PartitionAnswer { - class Response { - FeedResponse invocationResult; - Exception failureResult; - - public Response(FeedResponse invocationResult) { - this.invocationResult = invocationResult; - } - - public Response(Exception ex) { - this.failureResult = ex; - } - - public Single> toSingle() { - if (invocationResult != null) { - return Single.just(invocationResult); - } else { - return Single.error(failureResult); - } - } - } - - private String partitionKeyRangeId; - - private static boolean targetsPartition(RxDocumentServiceRequest req, String partitionKeyRangeId) { - return partitionKeyRangeId.equals(req.getPartitionKeyRangeIdentity().getPartitionKeyRangeId()); - } - - protected PartitionAnswer(String partitionKeyRangeId) { - this.partitionKeyRangeId = partitionKeyRangeId; - } - - public String getPartitionKeyRangeId() { - return partitionKeyRangeId; - } - - public abstract Response onRequest(final RxDocumentServiceRequest req); - - public static PartitionAnswer just(String partitionId, List> resps) { - AtomicInteger index = new AtomicInteger(); - return new PartitionAnswer(partitionId) { - @Override - public Response onRequest(RxDocumentServiceRequest request) { - if (!PartitionAnswer.targetsPartition(request, partitionId)) { - return null; - } - synchronized (this) { - if (index.get() < resps.size()) { - return new Response(resps.get(index.getAndIncrement())); - } - } - return null; - } - }; - } - - public static PartitionAnswer always(String partitionId, final Exception ex) { - return new PartitionAnswer(partitionId) { - @Override - public Response onRequest(RxDocumentServiceRequest request) { - if (!PartitionAnswer.targetsPartition(request, partitionId)) { - return null; - } - - return new Response(ex); - } - }; - } - - public static PartitionAnswer errors(String partitionId, List exs) { - AtomicInteger index = new AtomicInteger(); - return new PartitionAnswer(partitionId) { - @Override - public Response onRequest(RxDocumentServiceRequest request) { - if (!PartitionAnswer.targetsPartition(request, partitionId)) { - return null; - } - synchronized (this) { - if (index.get() < exs.size()) { - return new Response(exs.get(index.getAndIncrement())); - } - } - return null; - } - }; - } - - public static PartitionAnswer alwaysPartitionSplit(String partitionId) { - return new PartitionAnswer(partitionId) { - @Override - public Response onRequest(RxDocumentServiceRequest request) { - if (!PartitionAnswer.targetsPartition(request, partitionId)) { - return null; - } - return new Response(partitionKeyRangeGoneException()); - } - }; - } - } - } - - static abstract class RequestCreator implements - Func3 { - - public static RequestCreator give(List requests) { - AtomicInteger i = new AtomicInteger(0); - return new RequestCreator() { - - @Override - public RxDocumentServiceRequest call(PartitionKeyRange pkr, String cp, Integer ps) { - synchronized (this) { - RxDocumentServiceRequest req = requests.get(i.getAndIncrement()); - invocations.add(new CapturedInvocation(pkr, cp, ps, req)); - return req; - } - } - }; - } - - public static RequestCreator simpleMock() { - return new RequestCreator() { - @Override - public RxDocumentServiceRequest call(PartitionKeyRange pkr, String cp, Integer ps) { - synchronized (this) { - RxDocumentServiceRequest req = Mockito.mock(RxDocumentServiceRequest.class); - PartitionKeyRangeIdentity pkri = new PartitionKeyRangeIdentity(pkr.getId()); - doReturn(pkri).when(req).getPartitionKeyRangeIdentity(); - doReturn(cp).when(req).getContinuation(); - invocations.add(new CapturedInvocation(pkr, cp, ps, req)); - logger.debug("creating request: " + req + " cp is " + cp); - return req; - } - } - }; - } - - class CapturedInvocation { - PartitionKeyRange sourcePartition; - String continuationToken; - Integer maxItemCount; - RxDocumentServiceRequest invocationResult; - - public CapturedInvocation(PartitionKeyRange sourcePartition, - String continuationToken, - Integer maxItemCount, - RxDocumentServiceRequest invocationResult) { - this.sourcePartition = sourcePartition; - this.continuationToken = continuationToken; - this.maxItemCount = maxItemCount; - this.invocationResult = invocationResult; - } - } - - List invocations = Collections.synchronizedList(new ArrayList<>()); - - abstract public RxDocumentServiceRequest call(PartitionKeyRange pkr, String cp, Integer ps); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]], " - + "\"prop\": \"%s\"" - + "}" - , uuid, uuid, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FeedResponseBuilder.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FeedResponseBuilder.java deleted file mode 100644 index 60be8309a2c6..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FeedResponseBuilder.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.BridgeUtils; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class FeedResponseBuilder { - private final boolean isChangeFeed; - private final Class klass; - - private Map headers = new HashMap<>(); - private boolean noMoreChangesInChangeFeed = false; - private List results; - - private FeedResponseBuilder(Class klass, boolean isChangeFeed) { - this.klass = klass; - this.isChangeFeed = isChangeFeed; - } - - public FeedResponseBuilder withContinuationToken(String continuationToken) { - - if (isChangeFeed) { - headers.put(HttpConstants.HttpHeaders.E_TAG, continuationToken); - } else { - headers.put(HttpConstants.HttpHeaders.CONTINUATION, continuationToken); - } - return this; - } - - public FeedResponseBuilder withResults(List results) { - this.results = results; - return this; - } - - public FeedResponseBuilder withResults(T... results) { - this.results = Arrays.asList(results); - return this; - } - - public FeedResponseBuilder lastChangeFeedPage() { - this.noMoreChangesInChangeFeed = true; - return this; - } - - public FeedResponse build() { - RxDocumentServiceResponse rsp = mock(RxDocumentServiceResponse.class); - when(rsp.getResponseHeaders()).thenReturn(headers); - when(rsp.getQueryResponse(klass)).thenReturn(results); - if (isChangeFeed) { - when(rsp.getStatusCode()).thenReturn(noMoreChangesInChangeFeed? - HttpConstants.StatusCodes.NOT_MODIFIED : 200); - return BridgeInternal.toChaneFeedResponsePage(rsp, klass); - } else { - return BridgeInternal.toFeedResponsePage(rsp, klass); - } - } - - public static FeedResponseBuilder queryFeedResponseBuilder(Class klass) { - return new FeedResponseBuilder(klass, false); - } - - public static FeedResponseBuilder changeFeedResponseBuilder(Class klass) { - return new FeedResponseBuilder(klass, true); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FetcherTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FetcherTest.java deleted file mode 100644 index f81bda40d3eb..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FetcherTest.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptionsBase; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Observable; -import rx.functions.Func1; -import rx.functions.Func2; -import rx.observers.TestSubscriber; - -public class FetcherTest { - - @DataProvider(name = "queryParams") - public static Object[][] queryParamProvider() { - - FeedOptions options1 = new FeedOptions(); - options1.setMaxItemCount(100); - options1.setRequestContinuation("cp-init"); // initial continuation token - int top1 = -1; // no top - - // no continuation token - FeedOptions options2 = new FeedOptions(); - options2.setMaxItemCount(100); - int top2 = -1; // no top - - // top more than max item count - FeedOptions options3 = new FeedOptions(); - options3.setMaxItemCount(100); - int top3 = 200; - - // top less than max item count - FeedOptions options4 = new FeedOptions(); - options4.setMaxItemCount(100); - int top4 = 20; - - return new Object[][] { - { options1, top1 }, - { options2, top2 }, - { options3, top3 }, - { options4, top4 }}; - } - - @Test(groups = { "unit" }, dataProvider = "queryParams") - public void query(FeedOptions options, int top) { - - FeedResponse fp1 = FeedResponseBuilder.queryFeedResponseBuilder(Document.class) - .withContinuationToken("cp1") - .withResults(new Document(), new Document(), new Document()) - .build(); - - FeedResponse fp2 = FeedResponseBuilder.queryFeedResponseBuilder(Document.class) - .withContinuationToken(null) - .withResults(new Document()) - .build(); - - List> feedResponseList = Arrays.asList(fp1, fp2); - - AtomicInteger totalResultsReceived = new AtomicInteger(0); - - AtomicInteger requestIndex = new AtomicInteger(0); - - Func2 createRequestFunc = (token, maxItemCount) -> { - assertThat(maxItemCount).describedAs("max item count").isEqualTo( - getExpectedMaxItemCountInRequest(options, top, feedResponseList, requestIndex.get())); - assertThat(token).describedAs("continuation token").isEqualTo( - getExpectedContinuationTokenInRequest(options, feedResponseList, requestIndex.get())); - requestIndex.getAndIncrement(); - - return mock(RxDocumentServiceRequest.class); - }; - - AtomicInteger executeIndex = new AtomicInteger(0); - - Func1>> executeFunc = request -> { - FeedResponse rsp = feedResponseList.get(executeIndex.getAndIncrement()); - totalResultsReceived.addAndGet(rsp.getResults().size()); - return Observable.just(rsp); - }; - - Fetcher fetcher = - new Fetcher<>(createRequestFunc, executeFunc, options, false, top, - options.getMaxItemCount()); - - validateFetcher(fetcher, options, top, feedResponseList); - } - - private void validateFetcher(Fetcher fetcher, - FeedOptions options, - int top, - List> feedResponseList) { - - int totalNumberOfDocs = 0; - - int index = 0; - while(index < feedResponseList.size()) { - assertThat(fetcher.shouldFetchMore()).describedAs("should fetch more pages").isTrue(); - totalNumberOfDocs += validate(fetcher.nextPage()).getResults().size(); - - if ((top != -1) && (totalNumberOfDocs >= top)) { - break; - } - index++; - } - assertThat(fetcher.shouldFetchMore()).describedAs("should not fetch more pages").isFalse(); - } - - @Test(groups = { "unit" }) - public void changeFeed() { - - ChangeFeedOptions options = new ChangeFeedOptions(); - options.setMaxItemCount(100); - - boolean isChangeFeed = true; - int top = -1; - - FeedResponse fp1 = FeedResponseBuilder.changeFeedResponseBuilder(Document.class) - .withContinuationToken("cp1") - .withResults(new Document()) - .build(); - - FeedResponse fp2 = FeedResponseBuilder.changeFeedResponseBuilder(Document.class) - .withContinuationToken("cp2") - .lastChangeFeedPage() - .build(); - - List> feedResponseList = Arrays.asList(fp1, fp2); - - AtomicInteger requestIndex = new AtomicInteger(0); - - Func2 createRequestFunc = (token, maxItemCount) -> { - assertThat(maxItemCount).describedAs("max item count").isEqualTo(options.getMaxItemCount()); - assertThat(token).describedAs("continuation token").isEqualTo( - getExpectedContinuationTokenInRequest(options, feedResponseList, requestIndex.getAndIncrement())); - - return mock(RxDocumentServiceRequest.class); - }; - - AtomicInteger executeIndex = new AtomicInteger(0); - - Func1>> executeFunc = request -> { - return Observable.just(feedResponseList.get(executeIndex.getAndIncrement())); - }; - - Fetcher fetcher = - new Fetcher<>(createRequestFunc, executeFunc, options, isChangeFeed, top, - options.getMaxItemCount()); - - validateFetcher(fetcher, options, feedResponseList); - } - - private void validateFetcher(Fetcher fetcher, - ChangeFeedOptions options, - List> feedResponseList) { - - - for(FeedResponse change: feedResponseList) { - assertThat(fetcher.shouldFetchMore()).describedAs("should fetch more pages").isTrue(); - validate(fetcher.nextPage()); - } - - assertThat(fetcher.shouldFetchMore()).describedAs("should not fetch more pages").isFalse(); - } - - private FeedResponse validate(Observable> page) { - TestSubscriber> subscriber = new TestSubscriber(); - page.subscribe(subscriber); - subscriber.awaitTerminalEvent(); - subscriber.assertCompleted(); - subscriber.assertNoErrors(); - subscriber.assertValueCount(1); - return subscriber.getOnNextEvents().get(0); - } - - private String getExpectedContinuationTokenInRequest(FeedOptionsBase options, - List> feedResponseList, - int requestIndex) { - if (requestIndex == 0) { - return options.getRequestContinuation(); - } - - return feedResponseList.get(requestIndex - 1).getResponseContinuation(); - } - - private int getExpectedMaxItemCountInRequest(FeedOptionsBase options, - int top, - List> feedResponseList, - int requestIndex) { - if (top == -1) { - return options.getMaxItemCount(); - } - - int numberOfReceivedItemsSoFar = - feedResponseList.subList(0, requestIndex).stream().mapToInt(rsp -> rsp.getResults().size()).sum(); - - return Math.min(top - numberOfReceivedItemsSoFar, options.getMaxItemCount()); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyChannelInitializer.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyChannelInitializer.java deleted file mode 100644 index 7b1f613713c1..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyChannelInitializer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.proxy; - -import java.util.concurrent.atomic.AtomicLong; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; - -/** - * The channel initializer. - * - */ -public class HttpProxyChannelInitializer extends ChannelInitializer { - private final Logger logger = LoggerFactory.getLogger(HttpProxyChannelInitializer.class); - private AtomicLong taskCounter = new AtomicLong(); - private HttpProxyClientHandler httpProxyClientHandler; - - @Override - protected void initChannel(SocketChannel ch) throws Exception { - httpProxyClientHandler = new HttpProxyClientHandler("task-" + taskCounter.getAndIncrement()); - logger.info("task-" + taskCounter.getAndIncrement()); - ch.pipeline().addLast(httpProxyClientHandler); - } - -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHandler.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHandler.java deleted file mode 100644 index 4afdcc7181a5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHandler.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.proxy; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.netty.bootstrap.Bootstrap; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; - -/** - * Handle data from client. - * - */ -public class HttpProxyClientHandler extends ChannelInboundHandlerAdapter { - private final Logger logger = LoggerFactory.getLogger(HttpProxyClientHandler.class); - private final String id; - private Channel clientChannel; - private Channel remoteChannel; - private HttpProxyClientHeader header ; - public HttpProxyClientHandler(String id) { - this.id = id; - header = new HttpProxyClientHeader(); - } - - @Override - public void channelActive(ChannelHandlerContext ctx) { - clientChannel = ctx.channel(); - } - - @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) { - if (header.isComplete()) { - remoteChannel.writeAndFlush(msg); // just forward - return; - } - - ByteBuf in = (ByteBuf) msg; - header.digest(in); - - if (!header.isComplete()) { - in.release(); - return; - } - - logger.info(id + " {}", header); - clientChannel.config().setAutoRead(false); // disable AutoRead until remote connection is ready - - if (header.isHttps()) { // if https, respond 200 to create tunnel - clientChannel.writeAndFlush(Unpooled.wrappedBuffer("HTTP/1.1 200 Connection Established\r\n\r\n".getBytes())); - } - - Bootstrap b = new Bootstrap(); - b.group(clientChannel.eventLoop()) // use the same EventLoop - .channel(clientChannel.getClass()) - .handler(new HttpProxyRemoteHandler(id, clientChannel)); - ChannelFuture f = b.connect(header.getHost(), header.getPort()); - remoteChannel = f.channel(); - - f.addListener((ChannelFutureListener) future -> { - if (future.isSuccess()) { - clientChannel.config().setAutoRead(true); // connection is ready, enable AutoRead - if (!header.isHttps()) { // forward header and remaining bytes - remoteChannel.write(header.getByteBuf()); - } - - remoteChannel.writeAndFlush(in); - } else { - in.release(); - clientChannel.close(); - } - }); - } - - @Override - public void channelInactive(ChannelHandlerContext ctx) { - flushAndClose(remoteChannel); - } - - @Override - public void exceptionCaught(ChannelHandlerContext ctx, Throwable e) { - logger.error(id + " error occured", e); - flushAndClose(clientChannel); - } - - private void flushAndClose(Channel ch) { - if (ch != null && ch.isActive()) { - ch.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHeader.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHeader.java deleted file mode 100644 index 287f54151c8d..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHeader.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.proxy; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; - -/** - * The http header of client. - * - */ -public class HttpProxyClientHeader { - private String method; - private String host; - private int port; - private boolean https; - private boolean complete; - private ByteBuf byteBuf = Unpooled.buffer(); - - private final StringBuilder lineBuf = new StringBuilder(); - - public boolean isComplete() { - return complete; - } - - public String getMethod() { - return method; - } - - public void setMethod(String method) { - this.method = method; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } - - public boolean isHttps() { - return https; - } - - public void setHttps(boolean https) { - this.https = https; - } - - public ByteBuf getByteBuf() { - return byteBuf; - } - - public void setByteBuf(ByteBuf byteBuf) { - this.byteBuf = byteBuf; - } - - public StringBuilder getLineBuf() { - return lineBuf; - } - - public void setComplete(boolean complete) { - this.complete = complete; - } - - public void digest(ByteBuf in) { - while (in.isReadable()) { - if (complete) { - throw new IllegalStateException("already complete"); - } - - String line = readLine(in); - if (line == null) { - return; - } - - if (method == null) { - method = line.split(" ")[0]; // the first word is http method name - https = method.equalsIgnoreCase("CONNECT"); // method CONNECT means https - } - - if (line.startsWith("Host: ") || line.startsWith("host: ")) { - String[] arr = line.split(":"); - host = arr[1].trim(); - if (arr.length == 3) { - port = Integer.parseInt(arr[2]); - } else if (https) { - port = 443; // https - } else { - port = 80; // http - } - } - - if (line.isEmpty()) { - if (host == null || port == 0) { - throw new IllegalStateException("cannot find header \'Host\'"); - } - - byteBuf = byteBuf.asReadOnly(); - complete = true; - break; - } - } - } - - private String readLine(ByteBuf in) { - while (in.isReadable()) { - byte b = in.readByte(); - byteBuf.writeByte(b); - lineBuf.append((char) b); - int len = lineBuf.length(); - if (len >= 2 && lineBuf.substring(len - 2).equals("\r\n")) { - String line = lineBuf.substring(0, len - 2); - lineBuf.delete(0, len); - return line; - } - - } - return null; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyRemoteHandler.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyRemoteHandler.java deleted file mode 100644 index cf72b251d5fb..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyRemoteHandler.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.proxy; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.netty.buffer.Unpooled; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; - -/** - * Handle data from remote. - * - */ -public class HttpProxyRemoteHandler extends ChannelInboundHandlerAdapter { - private final Logger logger = LoggerFactory.getLogger(HttpProxyRemoteHandler.class); - private final String id; - private Channel clientChannel; - private Channel remoteChannel; - - public HttpProxyRemoteHandler(String id, Channel clientChannel) { - this.id = id; - this.clientChannel = clientChannel; - } - - @Override - public void channelActive(ChannelHandlerContext ctx) { - this.remoteChannel = ctx.channel(); - } - - @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) { - clientChannel.writeAndFlush(msg); // just forward - } - - @Override - public void channelInactive(ChannelHandlerContext ctx) { - flushAndClose(clientChannel); - } - - @Override - public void exceptionCaught(ChannelHandlerContext ctx, Throwable e) { - logger.error(id + " error occured", e); - flushAndClose(remoteChannel); - } - - private void flushAndClose(Channel ch) { - if (ch != null && ch.isActive()) { - ch.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyServer.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyServer.java deleted file mode 100644 index 49d49a86db5a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyServer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.proxy; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.netty.bootstrap.ServerBootstrap; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.nio.NioServerSocketChannel; - -/** - * A http proxy server. - * - */ -public class HttpProxyServer { - private final Logger logger = LoggerFactory.getLogger(HttpProxyServer.class); - private HttpProxyChannelInitializer httpProxyChannelInitializer; - private int port = 8080; - EventLoopGroup bossGroup; - EventLoopGroup workerGroup; - public HttpProxyServer() { - bossGroup = new NioEventLoopGroup(1); - workerGroup = new NioEventLoopGroup(); - } - - public void start() { - new Thread(() -> { - logger.info("HttpProxyServer started on port: {}", port); - httpProxyChannelInitializer = new HttpProxyChannelInitializer(); - try { - ServerBootstrap bootstrap = new ServerBootstrap(); - bootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) - .childHandler(httpProxyChannelInitializer) - .bind(port).sync().channel().closeFuture().sync(); - } catch (InterruptedException e) { - logger.error("Error occurred", e); - } - }).start(); - } - - public void shutDown() { - if(!workerGroup.isShutdown()) { - workerGroup.shutdownGracefully(); - } - - if(!bossGroup.isShutdown()) { - bossGroup.shutdownGracefully(); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/resources/Microsoft.jpg b/cosmosdb/data-plane/sdk/src/test/resources/Microsoft.jpg deleted file mode 100644 index cf6c76bba498..000000000000 Binary files a/cosmosdb/data-plane/sdk/src/test/resources/Microsoft.jpg and /dev/null differ diff --git a/cosmosdb/data-plane/sdk/src/test/resources/cosmosdb-1.png b/cosmosdb/data-plane/sdk/src/test/resources/cosmosdb-1.png deleted file mode 100644 index 60d23806107c..000000000000 Binary files a/cosmosdb/data-plane/sdk/src/test/resources/cosmosdb-1.png and /dev/null differ diff --git a/cosmosdb/data-plane/sdk/src/test/resources/databaseAccount.json b/cosmosdb/data-plane/sdk/src/test/resources/databaseAccount.json deleted file mode 100644 index b514a0dda813..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/resources/databaseAccount.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "_self": "", - "id": "localhost", - "_rid": "localhost", - "media": "//media/", - "addresses": "//addresses/", - "_dbs": "//dbs/", - "writableLocations": [ - { - "name": "South Central US", - "databaseAccountEndpoint": "https://127.0.0.1:8081/" - } - ], - "readableLocations": [ - { - "name": "South Central US", - "databaseAccountEndpoint": "https://127.0.0.1:8081/" - } - ], - "enableMultipleWriteLocations": false, - "userReplicationPolicy": { - "asyncReplication": false, - "minReplicaSetSize": 1, - "maxReplicasetSize": 4 - }, - "userConsistencyPolicy": { - "defaultConsistencyLevel": "Session" - }, - "systemReplicationPolicy": { - "minReplicaSetSize": 1, - "maxReplicasetSize": 4 - }, - "readPolicy": { - "primaryReadCoefficient": 1, - "secondaryReadCoefficient": 1 - }, - "queryEngineConfiguration": "{\"maxSqlQueryInputLength\":262144,\"maxJoinsPerSqlQuery\":5,\"maxLogicalAndPerSqlQuery\":500,\"maxLogicalOrPerSqlQuery\":500,\"maxUdfRefPerSqlQuery\":10,\"maxInExpressionItemsCount\":16000,\"queryMaxInMemorySortDocumentCount\":500,\"maxQueryRequestTimeoutFraction\":0.9,\"sqlAllowNonFiniteNumbers\":false,\"sqlAllowAggregateFunctions\":true,\"sqlAllowSubQuery\":true,\"sqlAllowScalarSubQuery\":true,\"allowNewKeywords\":true,\"sqlAllowLike\":false,\"maxSpatialQueryCells\":12,\"spatialMaxGeometryPointCount\":256,\"sqlAllowTop\":true,\"enableSpatialIndexing\":true}" -} \ No newline at end of file diff --git a/cosmosdb/data-plane/sdk/src/test/resources/emulator-testng.xml b/cosmosdb/data-plane/sdk/src/test/resources/emulator-testng.xml deleted file mode 100644 index 8af636bea2f5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/resources/emulator-testng.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - diff --git a/cosmosdb/data-plane/sdk/src/test/resources/fast-testng.xml b/cosmosdb/data-plane/sdk/src/test/resources/fast-testng.xml deleted file mode 100644 index b4d5f30b252a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/resources/fast-testng.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - diff --git a/cosmosdb/data-plane/sdk/src/test/resources/log4j.properties b/cosmosdb/data-plane/sdk/src/test/resources/log4j.properties deleted file mode 100644 index 1f3287c67a55..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/resources/log4j.properties +++ /dev/null @@ -1,15 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# Set HTTP components' logger to INFO - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/sdk/src/test/resources/long-testng.xml b/cosmosdb/data-plane/sdk/src/test/resources/long-testng.xml deleted file mode 100644 index e96812dfbe41..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/resources/long-testng.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - diff --git a/cosmosdb/resource-manager/v2015_04_08/pom.xml b/cosmosdb/resource-manager/v2015_04_08/pom.xml index 23412bcaf098..d4f42ec63e86 100644 --- a/cosmosdb/resource-manager/v2015_04_08/pom.xml +++ b/cosmosdb/resource-manager/v2015_04_08/pom.xml @@ -15,7 +15,7 @@ ../../../pom.management.xml azure-mgmt-cosmosdb - 1.0.0-beta-2 + 1.0.0-beta-3 jar Microsoft Azure SDK for CosmosDB Management This package contains Microsoft CosmosDB Management SDK. @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/ConnectorOffer.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/ConnectorOffer.java new file mode 100644 index 000000000000..0c7b491f046e --- /dev/null +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/ConnectorOffer.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2015_04_08; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ConnectorOffer. + */ +public final class ConnectorOffer extends ExpandableStringEnum { + /** Static value Small for ConnectorOffer. */ + public static final ConnectorOffer SMALL = fromString("Small"); + + /** + * Creates or finds a ConnectorOffer from its string representation. + * @param name a name to look for + * @return the corresponding ConnectorOffer + */ + @JsonCreator + public static ConnectorOffer fromString(String name) { + return fromString(name, ConnectorOffer.class); + } + + /** + * @return known ConnectorOffer values + */ + public static Collection values() { + return values(ConnectorOffer.class); + } +} diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccount.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccount.java index be9c08fbd3bb..b344cb239bad 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccount.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccount.java @@ -30,6 +30,11 @@ public interface DatabaseAccount extends HasInner, Resourc */ List capabilities(); + /** + * @return the connectorOffer value. + */ + ConnectorOffer connectorOffer(); + /** * @return the consistencyPolicy value. */ @@ -50,6 +55,11 @@ public interface DatabaseAccount extends HasInner, Resourc */ Boolean enableAutomaticFailover(); + /** + * @return the enableCassandraConnector value. + */ + Boolean enableCassandraConnector(); + /** * @return the enableMultipleWriteLocations value. */ @@ -153,6 +163,18 @@ interface WithCapabilities { WithCreate withCapabilities(List capabilities); } + /** + * The stage of the databaseaccount definition allowing to specify ConnectorOffer. + */ + interface WithConnectorOffer { + /** + * Specifies connectorOffer. + * @param connectorOffer The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' + * @return the next definition stage + */ + WithCreate withConnectorOffer(ConnectorOffer connectorOffer); + } + /** * The stage of the databaseaccount definition allowing to specify ConsistencyPolicy. */ @@ -177,6 +199,18 @@ interface WithEnableAutomaticFailover { WithCreate withEnableAutomaticFailover(Boolean enableAutomaticFailover); } + /** + * The stage of the databaseaccount definition allowing to specify EnableCassandraConnector. + */ + interface WithEnableCassandraConnector { + /** + * Specifies enableCassandraConnector. + * @param enableCassandraConnector Enables the cassandra connector on the Cosmos DB C* account + * @return the next definition stage + */ + WithCreate withEnableCassandraConnector(Boolean enableCassandraConnector); + } + /** * The stage of the databaseaccount definition allowing to specify EnableMultipleWriteLocations. */ @@ -242,7 +276,7 @@ interface WithVirtualNetworkRules { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithCapabilities, DefinitionStages.WithConsistencyPolicy, DefinitionStages.WithEnableAutomaticFailover, DefinitionStages.WithEnableMultipleWriteLocations, DefinitionStages.WithIpRangeFilter, DefinitionStages.WithIsVirtualNetworkFilterEnabled, DefinitionStages.WithKind, DefinitionStages.WithVirtualNetworkRules { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithCapabilities, DefinitionStages.WithConnectorOffer, DefinitionStages.WithConsistencyPolicy, DefinitionStages.WithEnableAutomaticFailover, DefinitionStages.WithEnableCassandraConnector, DefinitionStages.WithEnableMultipleWriteLocations, DefinitionStages.WithIpRangeFilter, DefinitionStages.WithIsVirtualNetworkFilterEnabled, DefinitionStages.WithKind, DefinitionStages.WithVirtualNetworkRules { } } /** diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccountCreateUpdateParameters.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccountCreateUpdateParameters.java index 57403672cffa..7240cfbf570b 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccountCreateUpdateParameters.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccountCreateUpdateParameters.java @@ -89,6 +89,19 @@ public class DatabaseAccountCreateUpdateParameters extends Resource { @JsonProperty(value = "properties.enableMultipleWriteLocations") private Boolean enableMultipleWriteLocations; + /** + * Enables the cassandra connector on the Cosmos DB C* account. + */ + @JsonProperty(value = "properties.enableCassandraConnector") + private Boolean enableCassandraConnector; + + /** + * The cassandra connector offer type for the Cosmos DB database C* + * account. Possible values include: 'Small'. + */ + @JsonProperty(value = "properties.connectorOffer") + private ConnectorOffer connectorOffer; + /** * Creates an instance of DatabaseAccountCreateUpdateParameters class. * @param locations an array that contains the georeplication locations enabled for the Cosmos DB account. @@ -297,4 +310,44 @@ public DatabaseAccountCreateUpdateParameters withEnableMultipleWriteLocations(Bo return this; } + /** + * Get enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @return the connectorOffer value + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @param connectorOffer the connectorOffer value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + } diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountImpl.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountImpl.java index e5a46bd84c6e..6dc8f71cb170 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountImpl.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountImpl.java @@ -15,6 +15,7 @@ import java.util.List; import com.microsoft.azure.management.cosmosdb.v2015_04_08.DatabaseAccountCreateUpdateParameters; import com.microsoft.azure.management.cosmosdb.v2015_04_08.Capability; +import com.microsoft.azure.management.cosmosdb.v2015_04_08.ConnectorOffer; import com.microsoft.azure.management.cosmosdb.v2015_04_08.ConsistencyPolicy; import com.microsoft.azure.management.cosmosdb.v2015_04_08.DatabaseAccountOfferType; import com.microsoft.azure.management.cosmosdb.v2015_04_08.FailoverPolicy; @@ -83,6 +84,11 @@ public List capabilities() { return this.inner().capabilities(); } + @Override + public ConnectorOffer connectorOffer() { + return this.inner().connectorOffer(); + } + @Override public ConsistencyPolicy consistencyPolicy() { return this.inner().consistencyPolicy(); @@ -103,6 +109,11 @@ public Boolean enableAutomaticFailover() { return this.inner().enableAutomaticFailover(); } + @Override + public Boolean enableCassandraConnector() { + return this.inner().enableCassandraConnector(); + } + @Override public Boolean enableMultipleWriteLocations() { return this.inner().enableMultipleWriteLocations(); @@ -160,6 +171,12 @@ public DatabaseAccountImpl withLocations(List locations) { return this; } + @Override + public DatabaseAccountImpl withConnectorOffer(ConnectorOffer connectorOffer) { + this.createParameter.withConnectorOffer(connectorOffer); + return this; + } + @Override public DatabaseAccountImpl withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { this.createParameter.withConsistencyPolicy(consistencyPolicy); @@ -172,6 +189,12 @@ public DatabaseAccountImpl withEnableAutomaticFailover(Boolean enableAutomaticFa return this; } + @Override + public DatabaseAccountImpl withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.createParameter.withEnableCassandraConnector(enableCassandraConnector); + return this; + } + @Override public DatabaseAccountImpl withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { this.createParameter.withEnableMultipleWriteLocations(enableMultipleWriteLocations); diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountInner.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountInner.java index ea984513227a..f7924f4c005c 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountInner.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountInner.java @@ -16,6 +16,7 @@ import com.microsoft.azure.management.cosmosdb.v2015_04_08.Location; import com.microsoft.azure.management.cosmosdb.v2015_04_08.FailoverPolicy; import com.microsoft.azure.management.cosmosdb.v2015_04_08.VirtualNetworkRule; +import com.microsoft.azure.management.cosmosdb.v2015_04_08.ConnectorOffer; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.rest.SkipParentValidation; @@ -121,6 +122,19 @@ public class DatabaseAccountInner extends Resource { @JsonProperty(value = "properties.enableMultipleWriteLocations") private Boolean enableMultipleWriteLocations; + /** + * Enables the cassandra connector on the Cosmos DB C* account. + */ + @JsonProperty(value = "properties.enableCassandraConnector") + private Boolean enableCassandraConnector; + + /** + * The cassandra connector offer type for the Cosmos DB database C* + * account. Possible values include: 'Small'. + */ + @JsonProperty(value = "properties.connectorOffer") + private ConnectorOffer connectorOffer; + /** * Get indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse'. * @@ -346,4 +360,44 @@ public DatabaseAccountInner withEnableMultipleWriteLocations(Boolean enableMulti return this; } + /** + * Get enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @return the connectorOffer value + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @param connectorOffer the connectorOffer value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + } diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java index 8cbe227be29c..463e70c4e4b1 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java @@ -9,13 +9,11 @@ package com.microsoft.azure.management.cosmosdb.v2015_04_08.implementation; import com.fasterxml.jackson.annotation.JsonProperty; -import com.microsoft.rest.serializer.JsonFlatten; /** * The access keys for the given database account. */ -@JsonFlatten -public class DatabaseAccountListKeysResultInner { +public class DatabaseAccountListKeysResultInner extends DatabaseAccountListReadOnlyKeysResultInner { /** * Base 64 encoded value of the primary read-write key. */ @@ -28,18 +26,6 @@ public class DatabaseAccountListKeysResultInner { @JsonProperty(value = "secondaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) private String secondaryMasterKey; - /** - * Base 64 encoded value of the primary read-only key. - */ - @JsonProperty(value = "properties.primaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) - private String primaryReadonlyMasterKey; - - /** - * Base 64 encoded value of the secondary read-only key. - */ - @JsonProperty(value = "properties.secondaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) - private String secondaryReadonlyMasterKey; - /** * Get base 64 encoded value of the primary read-write key. * @@ -58,22 +44,4 @@ public String secondaryMasterKey() { return this.secondaryMasterKey; } - /** - * Get base 64 encoded value of the primary read-only key. - * - * @return the primaryReadonlyMasterKey value - */ - public String primaryReadonlyMasterKey() { - return this.primaryReadonlyMasterKey; - } - - /** - * Get base 64 encoded value of the secondary read-only key. - * - * @return the secondaryReadonlyMasterKey value - */ - public String secondaryReadonlyMasterKey() { - return this.secondaryReadonlyMasterKey; - } - } diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsImpl.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsImpl.java index f9f5a9d9338d..1a7827c3b95c 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsImpl.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsImpl.java @@ -759,10 +759,14 @@ public Throughput call(ThroughputInner inner) { public Observable getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { DatabaseAccountsInner client = this.inner(); return client.getSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public SqlContainer call(SqlContainerInner inner) { - return wrapSqlContainerModel(inner); + public Observable call(SqlContainerInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SqlContainer)wrapSqlContainerModel(inner)); + } } }); } @@ -795,10 +799,14 @@ public Completable deleteSqlContainerAsync(String resourceGroupName, String acco public Observable getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { DatabaseAccountsInner client = this.inner(); return client.getMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public MongoDBCollection call(MongoDBCollectionInner inner) { - return wrapMongoDBCollectionModel(inner); + public Observable call(MongoDBCollectionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((MongoDBCollection)wrapMongoDBCollectionModel(inner)); + } } }); } @@ -951,10 +959,14 @@ public Completable deleteCassandraKeyspaceAsync(String resourceGroupName, String public Observable getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { DatabaseAccountsInner client = this.inner(); return client.getGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName) - .map(new Func1() { - @Override - public GremlinGraph call(GremlinGraphInner inner) { - return wrapGremlinGraphModel(inner); + .flatMap(new Func1>() { + @Override + public Observable call(GremlinGraphInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((GremlinGraph)wrapGremlinGraphModel(inner)); + } } }); } diff --git a/datafactory/resource-manager/v2017_09_01_preview/pom.xml b/datafactory/resource-manager/v2017_09_01_preview/pom.xml new file mode 100644 index 000000000000..859f768e0316 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.datafactory.v2017_09_01_preview + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-datafactory + 1.0.0-beta + jar + Microsoft Azure SDK for DataFactory Management + This package contains Microsoft DataFactory Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Activity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Activity.java new file mode 100644 index 000000000000..82d441390d0b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Activity.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * A pipeline activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Activity") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Execution", value = ExecutionActivity.class), + @JsonSubTypes.Type(name = "Container", value = ControlActivity.class) +}) +public class Activity { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Activity name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Activity description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Activity depends on condition. + */ + @JsonProperty(value = "dependsOn") + private List dependsOn; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the Activity object itself. + */ + public Activity withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get activity name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set activity name. + * + * @param name the name value to set + * @return the Activity object itself. + */ + public Activity withName(String name) { + this.name = name; + return this; + } + + /** + * Get activity description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set activity description. + * + * @param description the description value to set + * @return the Activity object itself. + */ + public Activity withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get activity depends on condition. + * + * @return the dependsOn value + */ + public List dependsOn() { + return this.dependsOn; + } + + /** + * Set activity depends on condition. + * + * @param dependsOn the dependsOn value to set + * @return the Activity object itself. + */ + public Activity withDependsOn(List dependsOn) { + this.dependsOn = dependsOn; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityDependency.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityDependency.java new file mode 100644 index 000000000000..8930842dbbf6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityDependency.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Activity dependency information. + */ +public class ActivityDependency { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Activity name. + */ + @JsonProperty(value = "activity", required = true) + private String activity; + + /** + * Match-Condition for the dependency. + */ + @JsonProperty(value = "dependencyConditions", required = true) + private List dependencyConditions; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ActivityDependency object itself. + */ + public ActivityDependency withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get activity name. + * + * @return the activity value + */ + public String activity() { + return this.activity; + } + + /** + * Set activity name. + * + * @param activity the activity value to set + * @return the ActivityDependency object itself. + */ + public ActivityDependency withActivity(String activity) { + this.activity = activity; + return this; + } + + /** + * Get match-Condition for the dependency. + * + * @return the dependencyConditions value + */ + public List dependencyConditions() { + return this.dependencyConditions; + } + + /** + * Set match-Condition for the dependency. + * + * @param dependencyConditions the dependencyConditions value to set + * @return the ActivityDependency object itself. + */ + public ActivityDependency withDependencyConditions(List dependencyConditions) { + this.dependencyConditions = dependencyConditions; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityPolicy.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityPolicy.java new file mode 100644 index 000000000000..18c4e9d9d911 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityPolicy.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Execution policy for an activity. + */ +public class ActivityPolicy { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Specifies the timeout for the activity to run. The default timeout is 7 + * days. Type: string (or Expression with resultType string), pattern: + * ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + */ + @JsonProperty(value = "timeout") + private Object timeout; + + /** + * Maximum ordinary retry attempts. Default is 0. Type: integer (or + * Expression with resultType integer), minimum: 0. + */ + @JsonProperty(value = "retry") + private Object retry; + + /** + * Interval between each retry attempt (in seconds). The default is 30 sec. + */ + @JsonProperty(value = "retryIntervalInSeconds") + private Integer retryIntervalInSeconds; + + /** + * When set to true, Output from activity is considered as secure and will + * not be logged to monitoring. + */ + @JsonProperty(value = "secureOutput") + private Boolean secureOutput; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ActivityPolicy object itself. + */ + public ActivityPolicy withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get specifies the timeout for the activity to run. The default timeout is 7 days. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @return the timeout value + */ + public Object timeout() { + return this.timeout; + } + + /** + * Set specifies the timeout for the activity to run. The default timeout is 7 days. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @param timeout the timeout value to set + * @return the ActivityPolicy object itself. + */ + public ActivityPolicy withTimeout(Object timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get maximum ordinary retry attempts. Default is 0. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the retry value + */ + public Object retry() { + return this.retry; + } + + /** + * Set maximum ordinary retry attempts. Default is 0. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param retry the retry value to set + * @return the ActivityPolicy object itself. + */ + public ActivityPolicy withRetry(Object retry) { + this.retry = retry; + return this; + } + + /** + * Get interval between each retry attempt (in seconds). The default is 30 sec. + * + * @return the retryIntervalInSeconds value + */ + public Integer retryIntervalInSeconds() { + return this.retryIntervalInSeconds; + } + + /** + * Set interval between each retry attempt (in seconds). The default is 30 sec. + * + * @param retryIntervalInSeconds the retryIntervalInSeconds value to set + * @return the ActivityPolicy object itself. + */ + public ActivityPolicy withRetryIntervalInSeconds(Integer retryIntervalInSeconds) { + this.retryIntervalInSeconds = retryIntervalInSeconds; + return this; + } + + /** + * Get when set to true, Output from activity is considered as secure and will not be logged to monitoring. + * + * @return the secureOutput value + */ + public Boolean secureOutput() { + return this.secureOutput; + } + + /** + * Set when set to true, Output from activity is considered as secure and will not be logged to monitoring. + * + * @param secureOutput the secureOutput value to set + * @return the ActivityPolicy object itself. + */ + public ActivityPolicy withSecureOutput(Boolean secureOutput) { + this.secureOutput = secureOutput; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityRun.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityRun.java new file mode 100644 index 000000000000..01dfd1cb0924 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityRun.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.ActivityRunInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing ActivityRun. + */ +public interface ActivityRun extends HasInner, HasManager { + /** + * @return the activityName value. + */ + String activityName(); + + /** + * @return the activityRunEnd value. + */ + DateTime activityRunEnd(); + + /** + * @return the activityRunId value. + */ + String activityRunId(); + + /** + * @return the activityRunStart value. + */ + DateTime activityRunStart(); + + /** + * @return the activityType value. + */ + String activityType(); + + /** + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * @return the durationInMs value. + */ + Integer durationInMs(); + + /** + * @return the error value. + */ + Object error(); + + /** + * @return the input value. + */ + Object input(); + + /** + * @return the linkedServiceName value. + */ + String linkedServiceName(); + + /** + * @return the output value. + */ + Object output(); + + /** + * @return the pipelineName value. + */ + String pipelineName(); + + /** + * @return the pipelineRunId value. + */ + String pipelineRunId(); + + /** + * @return the status value. + */ + String status(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityRuns.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityRuns.java new file mode 100644 index 000000000000..3e4f37dfe2e3 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ActivityRuns.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.ActivityRunsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ActivityRuns. + */ +public interface ActivityRuns extends HasInner { + /** + * List activity runs based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param startTime The start time of activity runs in ISO8601 format. + * @param endTime The end time of activity runs in ISO8601 format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByPipelineRunAsync(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonMWSLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonMWSLinkedService.java new file mode 100644 index 000000000000..9cd22093a064 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonMWSLinkedService.java @@ -0,0 +1,292 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Amazon Marketplace Web Service linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AmazonMWS") +@JsonFlatten +public class AmazonMWSLinkedService extends LinkedServiceInner { + /** + * The endpoint of the Amazon MWS server, (i.e. mws.amazonservices.com). + */ + @JsonProperty(value = "typeProperties.endpoint", required = true) + private Object endpoint; + + /** + * The Amazon Marketplace ID you want to retrieve data from. To retrieve + * data from multiple Marketplace IDs, separate them with a comma (,). + * (i.e. A2EUQ1WTGCTBG2). + */ + @JsonProperty(value = "typeProperties.marketplaceID", required = true) + private Object marketplaceID; + + /** + * The Amazon seller ID. + */ + @JsonProperty(value = "typeProperties.sellerID", required = true) + private Object sellerID; + + /** + * The Amazon MWS authentication token. + */ + @JsonProperty(value = "typeProperties.mwsAuthToken") + private SecretBase mwsAuthToken; + + /** + * The access key id used to access data. + */ + @JsonProperty(value = "typeProperties.accessKeyId", required = true) + private Object accessKeyId; + + /** + * The secret key used to access data. + */ + @JsonProperty(value = "typeProperties.secretKey") + private SecretBase secretKey; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the endpoint of the Amazon MWS server, (i.e. mws.amazonservices.com). + * + * @return the endpoint value + */ + public Object endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint of the Amazon MWS server, (i.e. mws.amazonservices.com). + * + * @param endpoint the endpoint value to set + * @return the AmazonMWSLinkedService object itself. + */ + public AmazonMWSLinkedService withEndpoint(Object endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Get the Amazon Marketplace ID you want to retrieve data from. To retrieve data from multiple Marketplace IDs, separate them with a comma (,). (i.e. A2EUQ1WTGCTBG2). + * + * @return the marketplaceID value + */ + public Object marketplaceID() { + return this.marketplaceID; + } + + /** + * Set the Amazon Marketplace ID you want to retrieve data from. To retrieve data from multiple Marketplace IDs, separate them with a comma (,). (i.e. A2EUQ1WTGCTBG2). + * + * @param marketplaceID the marketplaceID value to set + * @return the AmazonMWSLinkedService object itself. + */ + public AmazonMWSLinkedService withMarketplaceID(Object marketplaceID) { + this.marketplaceID = marketplaceID; + return this; + } + + /** + * Get the Amazon seller ID. + * + * @return the sellerID value + */ + public Object sellerID() { + return this.sellerID; + } + + /** + * Set the Amazon seller ID. + * + * @param sellerID the sellerID value to set + * @return the AmazonMWSLinkedService object itself. + */ + public AmazonMWSLinkedService withSellerID(Object sellerID) { + this.sellerID = sellerID; + return this; + } + + /** + * Get the Amazon MWS authentication token. + * + * @return the mwsAuthToken value + */ + public SecretBase mwsAuthToken() { + return this.mwsAuthToken; + } + + /** + * Set the Amazon MWS authentication token. + * + * @param mwsAuthToken the mwsAuthToken value to set + * @return the AmazonMWSLinkedService object itself. + */ + public AmazonMWSLinkedService withMwsAuthToken(SecretBase mwsAuthToken) { + this.mwsAuthToken = mwsAuthToken; + return this; + } + + /** + * Get the access key id used to access data. + * + * @return the accessKeyId value + */ + public Object accessKeyId() { + return this.accessKeyId; + } + + /** + * Set the access key id used to access data. + * + * @param accessKeyId the accessKeyId value to set + * @return the AmazonMWSLinkedService object itself. + */ + public AmazonMWSLinkedService withAccessKeyId(Object accessKeyId) { + this.accessKeyId = accessKeyId; + return this; + } + + /** + * Get the secret key used to access data. + * + * @return the secretKey value + */ + public SecretBase secretKey() { + return this.secretKey; + } + + /** + * Set the secret key used to access data. + * + * @param secretKey the secretKey value to set + * @return the AmazonMWSLinkedService object itself. + */ + public AmazonMWSLinkedService withSecretKey(SecretBase secretKey) { + this.secretKey = secretKey; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the AmazonMWSLinkedService object itself. + */ + public AmazonMWSLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the AmazonMWSLinkedService object itself. + */ + public AmazonMWSLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the AmazonMWSLinkedService object itself. + */ + public AmazonMWSLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AmazonMWSLinkedService object itself. + */ + public AmazonMWSLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonMWSObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonMWSObjectDataset.java new file mode 100644 index 000000000000..866c7965f28d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonMWSObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Amazon Marketplace Web Service dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AmazonMWSObject") +public class AmazonMWSObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonMWSSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonMWSSource.java new file mode 100644 index 000000000000..57ffe95dd36c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonMWSSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Amazon Marketplace Web Service source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AmazonMWSSource") +public class AmazonMWSSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the AmazonMWSSource object itself. + */ + public AmazonMWSSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonRedshiftLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonRedshiftLinkedService.java new file mode 100644 index 000000000000..6baeeeb015c4 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonRedshiftLinkedService.java @@ -0,0 +1,187 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for Amazon Redshift. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AmazonRedshift") +@JsonFlatten +public class AmazonRedshiftLinkedService extends LinkedServiceInner { + /** + * The name of the Amazon Redshift server. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.server", required = true) + private Object server; + + /** + * The username of the Amazon Redshift source. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * The password of the Amazon Redshift source. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The database name of the Amazon Redshift source. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.database", required = true) + private Object database; + + /** + * The TCP port number that the Amazon Redshift server uses to listen for + * client connections. The default value is 5439. Type: integer (or + * Expression with resultType integer). + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the name of the Amazon Redshift server. Type: string (or Expression with resultType string). + * + * @return the server value + */ + public Object server() { + return this.server; + } + + /** + * Set the name of the Amazon Redshift server. Type: string (or Expression with resultType string). + * + * @param server the server value to set + * @return the AmazonRedshiftLinkedService object itself. + */ + public AmazonRedshiftLinkedService withServer(Object server) { + this.server = server; + return this; + } + + /** + * Get the username of the Amazon Redshift source. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the username of the Amazon Redshift source. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the AmazonRedshiftLinkedService object itself. + */ + public AmazonRedshiftLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password of the Amazon Redshift source. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password of the Amazon Redshift source. + * + * @param password the password value to set + * @return the AmazonRedshiftLinkedService object itself. + */ + public AmazonRedshiftLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the database name of the Amazon Redshift source. Type: string (or Expression with resultType string). + * + * @return the database value + */ + public Object database() { + return this.database; + } + + /** + * Set the database name of the Amazon Redshift source. Type: string (or Expression with resultType string). + * + * @param database the database value to set + * @return the AmazonRedshiftLinkedService object itself. + */ + public AmazonRedshiftLinkedService withDatabase(Object database) { + this.database = database; + return this; + } + + /** + * Get the TCP port number that the Amazon Redshift server uses to listen for client connections. The default value is 5439. Type: integer (or Expression with resultType integer). + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port number that the Amazon Redshift server uses to listen for client connections. The default value is 5439. Type: integer (or Expression with resultType integer). + * + * @param port the port value to set + * @return the AmazonRedshiftLinkedService object itself. + */ + public AmazonRedshiftLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AmazonRedshiftLinkedService object itself. + */ + public AmazonRedshiftLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonRedshiftSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonRedshiftSource.java new file mode 100644 index 000000000000..c97321276f0b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonRedshiftSource.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity source for Amazon Redshift Source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AmazonRedshiftSource") +public class AmazonRedshiftSource extends CopySource { + /** + * Database query. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * The Amazon S3 settings needed for the interim Amazon S3 when copying + * from Amazon Redshift with unload. With this, data from Amazon Redshift + * source will be unloaded into S3 first and then copied into the targeted + * sink from the interim S3. + */ + @JsonProperty(value = "redshiftUnloadSettings") + private RedshiftUnloadSettings redshiftUnloadSettings; + + /** + * Get database query. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set database query. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the AmazonRedshiftSource object itself. + */ + public AmazonRedshiftSource withQuery(Object query) { + this.query = query; + return this; + } + + /** + * Get the Amazon S3 settings needed for the interim Amazon S3 when copying from Amazon Redshift with unload. With this, data from Amazon Redshift source will be unloaded into S3 first and then copied into the targeted sink from the interim S3. + * + * @return the redshiftUnloadSettings value + */ + public RedshiftUnloadSettings redshiftUnloadSettings() { + return this.redshiftUnloadSettings; + } + + /** + * Set the Amazon S3 settings needed for the interim Amazon S3 when copying from Amazon Redshift with unload. With this, data from Amazon Redshift source will be unloaded into S3 first and then copied into the targeted sink from the interim S3. + * + * @param redshiftUnloadSettings the redshiftUnloadSettings value to set + * @return the AmazonRedshiftSource object itself. + */ + public AmazonRedshiftSource withRedshiftUnloadSettings(RedshiftUnloadSettings redshiftUnloadSettings) { + this.redshiftUnloadSettings = redshiftUnloadSettings; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonS3Dataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonS3Dataset.java new file mode 100644 index 000000000000..3cb2044c884c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonS3Dataset.java @@ -0,0 +1,184 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * A single Amazon Simple Storage Service (S3) object or a set of S3 objects. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AmazonS3Object") +@JsonFlatten +public class AmazonS3Dataset extends DatasetInner { + /** + * The name of the Amazon S3 bucket. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.bucketName", required = true) + private Object bucketName; + + /** + * The key of the Amazon S3 object. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.key") + private Object key; + + /** + * The prefix filter for the S3 object name. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.prefix") + private Object prefix; + + /** + * The version for the S3 object. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.version") + private Object version; + + /** + * The format of files. + */ + @JsonProperty(value = "typeProperties.format") + private DatasetStorageFormat format; + + /** + * The data compression method used for the Amazon S3 object. + */ + @JsonProperty(value = "typeProperties.compression") + private DatasetCompression compression; + + /** + * Get the name of the Amazon S3 bucket. Type: string (or Expression with resultType string). + * + * @return the bucketName value + */ + public Object bucketName() { + return this.bucketName; + } + + /** + * Set the name of the Amazon S3 bucket. Type: string (or Expression with resultType string). + * + * @param bucketName the bucketName value to set + * @return the AmazonS3Dataset object itself. + */ + public AmazonS3Dataset withBucketName(Object bucketName) { + this.bucketName = bucketName; + return this; + } + + /** + * Get the key of the Amazon S3 object. Type: string (or Expression with resultType string). + * + * @return the key value + */ + public Object key() { + return this.key; + } + + /** + * Set the key of the Amazon S3 object. Type: string (or Expression with resultType string). + * + * @param key the key value to set + * @return the AmazonS3Dataset object itself. + */ + public AmazonS3Dataset withKey(Object key) { + this.key = key; + return this; + } + + /** + * Get the prefix filter for the S3 object name. Type: string (or Expression with resultType string). + * + * @return the prefix value + */ + public Object prefix() { + return this.prefix; + } + + /** + * Set the prefix filter for the S3 object name. Type: string (or Expression with resultType string). + * + * @param prefix the prefix value to set + * @return the AmazonS3Dataset object itself. + */ + public AmazonS3Dataset withPrefix(Object prefix) { + this.prefix = prefix; + return this; + } + + /** + * Get the version for the S3 object. Type: string (or Expression with resultType string). + * + * @return the version value + */ + public Object version() { + return this.version; + } + + /** + * Set the version for the S3 object. Type: string (or Expression with resultType string). + * + * @param version the version value to set + * @return the AmazonS3Dataset object itself. + */ + public AmazonS3Dataset withVersion(Object version) { + this.version = version; + return this; + } + + /** + * Get the format of files. + * + * @return the format value + */ + public DatasetStorageFormat format() { + return this.format; + } + + /** + * Set the format of files. + * + * @param format the format value to set + * @return the AmazonS3Dataset object itself. + */ + public AmazonS3Dataset withFormat(DatasetStorageFormat format) { + this.format = format; + return this; + } + + /** + * Get the data compression method used for the Amazon S3 object. + * + * @return the compression value + */ + public DatasetCompression compression() { + return this.compression; + } + + /** + * Set the data compression method used for the Amazon S3 object. + * + * @param compression the compression value to set + * @return the AmazonS3Dataset object itself. + */ + public AmazonS3Dataset withCompression(DatasetCompression compression) { + this.compression = compression; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonS3LinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonS3LinkedService.java new file mode 100644 index 000000000000..2d1b8e66f400 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AmazonS3LinkedService.java @@ -0,0 +1,107 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for Amazon S3. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AmazonS3") +@JsonFlatten +public class AmazonS3LinkedService extends LinkedServiceInner { + /** + * The access key identifier of the Amazon S3 Identity and Access + * Management (IAM) user. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.accessKeyId") + private Object accessKeyId; + + /** + * The secret access key of the Amazon S3 Identity and Access Management + * (IAM) user. + */ + @JsonProperty(value = "typeProperties.secretAccessKey") + private SecretBase secretAccessKey; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the access key identifier of the Amazon S3 Identity and Access Management (IAM) user. Type: string (or Expression with resultType string). + * + * @return the accessKeyId value + */ + public Object accessKeyId() { + return this.accessKeyId; + } + + /** + * Set the access key identifier of the Amazon S3 Identity and Access Management (IAM) user. Type: string (or Expression with resultType string). + * + * @param accessKeyId the accessKeyId value to set + * @return the AmazonS3LinkedService object itself. + */ + public AmazonS3LinkedService withAccessKeyId(Object accessKeyId) { + this.accessKeyId = accessKeyId; + return this; + } + + /** + * Get the secret access key of the Amazon S3 Identity and Access Management (IAM) user. + * + * @return the secretAccessKey value + */ + public SecretBase secretAccessKey() { + return this.secretAccessKey; + } + + /** + * Set the secret access key of the Amazon S3 Identity and Access Management (IAM) user. + * + * @param secretAccessKey the secretAccessKey value to set + * @return the AmazonS3LinkedService object itself. + */ + public AmazonS3LinkedService withSecretAccessKey(SecretBase secretAccessKey) { + this.secretAccessKey = secretAccessKey; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AmazonS3LinkedService object itself. + */ + public AmazonS3LinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AvroFormat.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AvroFormat.java new file mode 100644 index 000000000000..4141b44b2770 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AvroFormat.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The data stored in Avro format. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AvroFormat") +public class AvroFormat extends DatasetStorageFormat { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureBatchLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureBatchLinkedService.java new file mode 100644 index 000000000000..5fa1cea622bf --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureBatchLinkedService.java @@ -0,0 +1,185 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Azure Batch linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureBatch") +@JsonFlatten +public class AzureBatchLinkedService extends LinkedServiceInner { + /** + * The Azure Batch account name. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.accountName", required = true) + private Object accountName; + + /** + * The Azure Batch account access key. + */ + @JsonProperty(value = "typeProperties.accessKey") + private SecretBase accessKey; + + /** + * The Azure Batch URI. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.batchUri", required = true) + private Object batchUri; + + /** + * The Azure Batch pool name. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.poolName", required = true) + private Object poolName; + + /** + * The Azure Storage linked service reference. + */ + @JsonProperty(value = "typeProperties.linkedServiceName", required = true) + private LinkedServiceReference linkedServiceName; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the Azure Batch account name. Type: string (or Expression with resultType string). + * + * @return the accountName value + */ + public Object accountName() { + return this.accountName; + } + + /** + * Set the Azure Batch account name. Type: string (or Expression with resultType string). + * + * @param accountName the accountName value to set + * @return the AzureBatchLinkedService object itself. + */ + public AzureBatchLinkedService withAccountName(Object accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the Azure Batch account access key. + * + * @return the accessKey value + */ + public SecretBase accessKey() { + return this.accessKey; + } + + /** + * Set the Azure Batch account access key. + * + * @param accessKey the accessKey value to set + * @return the AzureBatchLinkedService object itself. + */ + public AzureBatchLinkedService withAccessKey(SecretBase accessKey) { + this.accessKey = accessKey; + return this; + } + + /** + * Get the Azure Batch URI. Type: string (or Expression with resultType string). + * + * @return the batchUri value + */ + public Object batchUri() { + return this.batchUri; + } + + /** + * Set the Azure Batch URI. Type: string (or Expression with resultType string). + * + * @param batchUri the batchUri value to set + * @return the AzureBatchLinkedService object itself. + */ + public AzureBatchLinkedService withBatchUri(Object batchUri) { + this.batchUri = batchUri; + return this; + } + + /** + * Get the Azure Batch pool name. Type: string (or Expression with resultType string). + * + * @return the poolName value + */ + public Object poolName() { + return this.poolName; + } + + /** + * Set the Azure Batch pool name. Type: string (or Expression with resultType string). + * + * @param poolName the poolName value to set + * @return the AzureBatchLinkedService object itself. + */ + public AzureBatchLinkedService withPoolName(Object poolName) { + this.poolName = poolName; + return this; + } + + /** + * Get the Azure Storage linked service reference. + * + * @return the linkedServiceName value + */ + public LinkedServiceReference linkedServiceName() { + return this.linkedServiceName; + } + + /** + * Set the Azure Storage linked service reference. + * + * @param linkedServiceName the linkedServiceName value to set + * @return the AzureBatchLinkedService object itself. + */ + public AzureBatchLinkedService withLinkedServiceName(LinkedServiceReference linkedServiceName) { + this.linkedServiceName = linkedServiceName; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzureBatchLinkedService object itself. + */ + public AzureBatchLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureBlobDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureBlobDataset.java new file mode 100644 index 000000000000..f02e493f75b3 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureBlobDataset.java @@ -0,0 +1,157 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The Azure Blob storage. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureBlob") +@JsonFlatten +public class AzureBlobDataset extends DatasetInner { + /** + * The path of the Azure Blob storage. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.folderPath") + private Object folderPath; + + /** + * The root of blob path. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.tableRootLocation") + private Object tableRootLocation; + + /** + * The name of the Azure Blob. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.fileName") + private Object fileName; + + /** + * The format of the Azure Blob storage. + */ + @JsonProperty(value = "typeProperties.format") + private DatasetStorageFormat format; + + /** + * The data compression method used for the blob storage. + */ + @JsonProperty(value = "typeProperties.compression") + private DatasetCompression compression; + + /** + * Get the path of the Azure Blob storage. Type: string (or Expression with resultType string). + * + * @return the folderPath value + */ + public Object folderPath() { + return this.folderPath; + } + + /** + * Set the path of the Azure Blob storage. Type: string (or Expression with resultType string). + * + * @param folderPath the folderPath value to set + * @return the AzureBlobDataset object itself. + */ + public AzureBlobDataset withFolderPath(Object folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get the root of blob path. Type: string (or Expression with resultType string). + * + * @return the tableRootLocation value + */ + public Object tableRootLocation() { + return this.tableRootLocation; + } + + /** + * Set the root of blob path. Type: string (or Expression with resultType string). + * + * @param tableRootLocation the tableRootLocation value to set + * @return the AzureBlobDataset object itself. + */ + public AzureBlobDataset withTableRootLocation(Object tableRootLocation) { + this.tableRootLocation = tableRootLocation; + return this; + } + + /** + * Get the name of the Azure Blob. Type: string (or Expression with resultType string). + * + * @return the fileName value + */ + public Object fileName() { + return this.fileName; + } + + /** + * Set the name of the Azure Blob. Type: string (or Expression with resultType string). + * + * @param fileName the fileName value to set + * @return the AzureBlobDataset object itself. + */ + public AzureBlobDataset withFileName(Object fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get the format of the Azure Blob storage. + * + * @return the format value + */ + public DatasetStorageFormat format() { + return this.format; + } + + /** + * Set the format of the Azure Blob storage. + * + * @param format the format value to set + * @return the AzureBlobDataset object itself. + */ + public AzureBlobDataset withFormat(DatasetStorageFormat format) { + this.format = format; + return this; + } + + /** + * Get the data compression method used for the blob storage. + * + * @return the compression value + */ + public DatasetCompression compression() { + return this.compression; + } + + /** + * Set the data compression method used for the blob storage. + * + * @param compression the compression value to set + * @return the AzureBlobDataset object itself. + */ + public AzureBlobDataset withCompression(DatasetCompression compression) { + this.compression = compression; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeAnalyticsLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeAnalyticsLinkedService.java new file mode 100644 index 000000000000..5011e48a2b50 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeAnalyticsLinkedService.java @@ -0,0 +1,242 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Azure Data Lake Analytics linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureDataLakeAnalytics") +@JsonFlatten +public class AzureDataLakeAnalyticsLinkedService extends LinkedServiceInner { + /** + * The Azure Data Lake Analytics account name. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.accountName", required = true) + private Object accountName; + + /** + * The ID of the application used to authenticate against the Azure Data + * Lake Analytics account. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.servicePrincipalId") + private Object servicePrincipalId; + + /** + * The Key of the application used to authenticate against the Azure Data + * Lake Analytics account. + */ + @JsonProperty(value = "typeProperties.servicePrincipalKey") + private SecretBase servicePrincipalKey; + + /** + * The name or ID of the tenant to which the service principal belongs. + * Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.tenant", required = true) + private Object tenant; + + /** + * Data Lake Analytics account subscription ID (if different from Data + * Factory account). Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.subscriptionId") + private Object subscriptionId; + + /** + * Data Lake Analytics account resource group name (if different from Data + * Factory account). Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.resourceGroupName") + private Object resourceGroupName; + + /** + * Azure Data Lake Analytics URI Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.dataLakeAnalyticsUri") + private Object dataLakeAnalyticsUri; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the Azure Data Lake Analytics account name. Type: string (or Expression with resultType string). + * + * @return the accountName value + */ + public Object accountName() { + return this.accountName; + } + + /** + * Set the Azure Data Lake Analytics account name. Type: string (or Expression with resultType string). + * + * @param accountName the accountName value to set + * @return the AzureDataLakeAnalyticsLinkedService object itself. + */ + public AzureDataLakeAnalyticsLinkedService withAccountName(Object accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the ID of the application used to authenticate against the Azure Data Lake Analytics account. Type: string (or Expression with resultType string). + * + * @return the servicePrincipalId value + */ + public Object servicePrincipalId() { + return this.servicePrincipalId; + } + + /** + * Set the ID of the application used to authenticate against the Azure Data Lake Analytics account. Type: string (or Expression with resultType string). + * + * @param servicePrincipalId the servicePrincipalId value to set + * @return the AzureDataLakeAnalyticsLinkedService object itself. + */ + public AzureDataLakeAnalyticsLinkedService withServicePrincipalId(Object servicePrincipalId) { + this.servicePrincipalId = servicePrincipalId; + return this; + } + + /** + * Get the Key of the application used to authenticate against the Azure Data Lake Analytics account. + * + * @return the servicePrincipalKey value + */ + public SecretBase servicePrincipalKey() { + return this.servicePrincipalKey; + } + + /** + * Set the Key of the application used to authenticate against the Azure Data Lake Analytics account. + * + * @param servicePrincipalKey the servicePrincipalKey value to set + * @return the AzureDataLakeAnalyticsLinkedService object itself. + */ + public AzureDataLakeAnalyticsLinkedService withServicePrincipalKey(SecretBase servicePrincipalKey) { + this.servicePrincipalKey = servicePrincipalKey; + return this; + } + + /** + * Get the name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @return the tenant value + */ + public Object tenant() { + return this.tenant; + } + + /** + * Set the name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @param tenant the tenant value to set + * @return the AzureDataLakeAnalyticsLinkedService object itself. + */ + public AzureDataLakeAnalyticsLinkedService withTenant(Object tenant) { + this.tenant = tenant; + return this; + } + + /** + * Get data Lake Analytics account subscription ID (if different from Data Factory account). Type: string (or Expression with resultType string). + * + * @return the subscriptionId value + */ + public Object subscriptionId() { + return this.subscriptionId; + } + + /** + * Set data Lake Analytics account subscription ID (if different from Data Factory account). Type: string (or Expression with resultType string). + * + * @param subscriptionId the subscriptionId value to set + * @return the AzureDataLakeAnalyticsLinkedService object itself. + */ + public AzureDataLakeAnalyticsLinkedService withSubscriptionId(Object subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get data Lake Analytics account resource group name (if different from Data Factory account). Type: string (or Expression with resultType string). + * + * @return the resourceGroupName value + */ + public Object resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set data Lake Analytics account resource group name (if different from Data Factory account). Type: string (or Expression with resultType string). + * + * @param resourceGroupName the resourceGroupName value to set + * @return the AzureDataLakeAnalyticsLinkedService object itself. + */ + public AzureDataLakeAnalyticsLinkedService withResourceGroupName(Object resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get azure Data Lake Analytics URI Type: string (or Expression with resultType string). + * + * @return the dataLakeAnalyticsUri value + */ + public Object dataLakeAnalyticsUri() { + return this.dataLakeAnalyticsUri; + } + + /** + * Set azure Data Lake Analytics URI Type: string (or Expression with resultType string). + * + * @param dataLakeAnalyticsUri the dataLakeAnalyticsUri value to set + * @return the AzureDataLakeAnalyticsLinkedService object itself. + */ + public AzureDataLakeAnalyticsLinkedService withDataLakeAnalyticsUri(Object dataLakeAnalyticsUri) { + this.dataLakeAnalyticsUri = dataLakeAnalyticsUri; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzureDataLakeAnalyticsLinkedService object itself. + */ + public AzureDataLakeAnalyticsLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreDataset.java new file mode 100644 index 000000000000..af8395c336b1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreDataset.java @@ -0,0 +1,131 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Azure Data Lake Store dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureDataLakeStoreFile") +@JsonFlatten +public class AzureDataLakeStoreDataset extends DatasetInner { + /** + * Path to the folder in the Azure Data Lake Store. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.folderPath", required = true) + private Object folderPath; + + /** + * The name of the file in the Azure Data Lake Store. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.fileName") + private Object fileName; + + /** + * The format of the Data Lake Store. + */ + @JsonProperty(value = "typeProperties.format") + private DatasetStorageFormat format; + + /** + * The data compression method used for the item(s) in the Azure Data Lake + * Store. + */ + @JsonProperty(value = "typeProperties.compression") + private DatasetCompression compression; + + /** + * Get path to the folder in the Azure Data Lake Store. Type: string (or Expression with resultType string). + * + * @return the folderPath value + */ + public Object folderPath() { + return this.folderPath; + } + + /** + * Set path to the folder in the Azure Data Lake Store. Type: string (or Expression with resultType string). + * + * @param folderPath the folderPath value to set + * @return the AzureDataLakeStoreDataset object itself. + */ + public AzureDataLakeStoreDataset withFolderPath(Object folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get the name of the file in the Azure Data Lake Store. Type: string (or Expression with resultType string). + * + * @return the fileName value + */ + public Object fileName() { + return this.fileName; + } + + /** + * Set the name of the file in the Azure Data Lake Store. Type: string (or Expression with resultType string). + * + * @param fileName the fileName value to set + * @return the AzureDataLakeStoreDataset object itself. + */ + public AzureDataLakeStoreDataset withFileName(Object fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get the format of the Data Lake Store. + * + * @return the format value + */ + public DatasetStorageFormat format() { + return this.format; + } + + /** + * Set the format of the Data Lake Store. + * + * @param format the format value to set + * @return the AzureDataLakeStoreDataset object itself. + */ + public AzureDataLakeStoreDataset withFormat(DatasetStorageFormat format) { + this.format = format; + return this; + } + + /** + * Get the data compression method used for the item(s) in the Azure Data Lake Store. + * + * @return the compression value + */ + public DatasetCompression compression() { + return this.compression; + } + + /** + * Set the data compression method used for the item(s) in the Azure Data Lake Store. + * + * @param compression the compression value to set + * @return the AzureDataLakeStoreDataset object itself. + */ + public AzureDataLakeStoreDataset withCompression(DatasetCompression compression) { + this.compression = compression; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreLinkedService.java new file mode 100644 index 000000000000..ee162b7d7fd1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreLinkedService.java @@ -0,0 +1,241 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Azure Data Lake Store linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureDataLakeStore") +@JsonFlatten +public class AzureDataLakeStoreLinkedService extends LinkedServiceInner { + /** + * Data Lake Store service URI. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.dataLakeStoreUri", required = true) + private Object dataLakeStoreUri; + + /** + * The ID of the application used to authenticate against the Azure Data + * Lake Store account. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.servicePrincipalId") + private Object servicePrincipalId; + + /** + * The Key of the application used to authenticate against the Azure Data + * Lake Store account. + */ + @JsonProperty(value = "typeProperties.servicePrincipalKey") + private SecretBase servicePrincipalKey; + + /** + * The name or ID of the tenant to which the service principal belongs. + * Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.tenant") + private Object tenant; + + /** + * Data Lake Store account name. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.accountName") + private Object accountName; + + /** + * Data Lake Store account subscription ID (if different from Data Factory + * account). Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.subscriptionId") + private Object subscriptionId; + + /** + * Data Lake Store account resource group name (if different from Data + * Factory account). Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.resourceGroupName") + private Object resourceGroupName; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get data Lake Store service URI. Type: string (or Expression with resultType string). + * + * @return the dataLakeStoreUri value + */ + public Object dataLakeStoreUri() { + return this.dataLakeStoreUri; + } + + /** + * Set data Lake Store service URI. Type: string (or Expression with resultType string). + * + * @param dataLakeStoreUri the dataLakeStoreUri value to set + * @return the AzureDataLakeStoreLinkedService object itself. + */ + public AzureDataLakeStoreLinkedService withDataLakeStoreUri(Object dataLakeStoreUri) { + this.dataLakeStoreUri = dataLakeStoreUri; + return this; + } + + /** + * Get the ID of the application used to authenticate against the Azure Data Lake Store account. Type: string (or Expression with resultType string). + * + * @return the servicePrincipalId value + */ + public Object servicePrincipalId() { + return this.servicePrincipalId; + } + + /** + * Set the ID of the application used to authenticate against the Azure Data Lake Store account. Type: string (or Expression with resultType string). + * + * @param servicePrincipalId the servicePrincipalId value to set + * @return the AzureDataLakeStoreLinkedService object itself. + */ + public AzureDataLakeStoreLinkedService withServicePrincipalId(Object servicePrincipalId) { + this.servicePrincipalId = servicePrincipalId; + return this; + } + + /** + * Get the Key of the application used to authenticate against the Azure Data Lake Store account. + * + * @return the servicePrincipalKey value + */ + public SecretBase servicePrincipalKey() { + return this.servicePrincipalKey; + } + + /** + * Set the Key of the application used to authenticate against the Azure Data Lake Store account. + * + * @param servicePrincipalKey the servicePrincipalKey value to set + * @return the AzureDataLakeStoreLinkedService object itself. + */ + public AzureDataLakeStoreLinkedService withServicePrincipalKey(SecretBase servicePrincipalKey) { + this.servicePrincipalKey = servicePrincipalKey; + return this; + } + + /** + * Get the name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @return the tenant value + */ + public Object tenant() { + return this.tenant; + } + + /** + * Set the name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @param tenant the tenant value to set + * @return the AzureDataLakeStoreLinkedService object itself. + */ + public AzureDataLakeStoreLinkedService withTenant(Object tenant) { + this.tenant = tenant; + return this; + } + + /** + * Get data Lake Store account name. Type: string (or Expression with resultType string). + * + * @return the accountName value + */ + public Object accountName() { + return this.accountName; + } + + /** + * Set data Lake Store account name. Type: string (or Expression with resultType string). + * + * @param accountName the accountName value to set + * @return the AzureDataLakeStoreLinkedService object itself. + */ + public AzureDataLakeStoreLinkedService withAccountName(Object accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get data Lake Store account subscription ID (if different from Data Factory account). Type: string (or Expression with resultType string). + * + * @return the subscriptionId value + */ + public Object subscriptionId() { + return this.subscriptionId; + } + + /** + * Set data Lake Store account subscription ID (if different from Data Factory account). Type: string (or Expression with resultType string). + * + * @param subscriptionId the subscriptionId value to set + * @return the AzureDataLakeStoreLinkedService object itself. + */ + public AzureDataLakeStoreLinkedService withSubscriptionId(Object subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get data Lake Store account resource group name (if different from Data Factory account). Type: string (or Expression with resultType string). + * + * @return the resourceGroupName value + */ + public Object resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set data Lake Store account resource group name (if different from Data Factory account). Type: string (or Expression with resultType string). + * + * @param resourceGroupName the resourceGroupName value to set + * @return the AzureDataLakeStoreLinkedService object itself. + */ + public AzureDataLakeStoreLinkedService withResourceGroupName(Object resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzureDataLakeStoreLinkedService object itself. + */ + public AzureDataLakeStoreLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreSink.java new file mode 100644 index 000000000000..3f591e9c2b14 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreSink.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Azure Data Lake Store sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureDataLakeStoreSink") +public class AzureDataLakeStoreSink extends CopySink { + /** + * The type of copy behavior for copy sink. + */ + @JsonProperty(value = "copyBehavior") + private Object copyBehavior; + + /** + * Get the type of copy behavior for copy sink. + * + * @return the copyBehavior value + */ + public Object copyBehavior() { + return this.copyBehavior; + } + + /** + * Set the type of copy behavior for copy sink. + * + * @param copyBehavior the copyBehavior value to set + * @return the AzureDataLakeStoreSink object itself. + */ + public AzureDataLakeStoreSink withCopyBehavior(Object copyBehavior) { + this.copyBehavior = copyBehavior; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreSource.java new file mode 100644 index 000000000000..5890d534e686 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDataLakeStoreSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Azure Data Lake source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureDataLakeStoreSource") +public class AzureDataLakeStoreSource extends CopySource { + /** + * If true, files under the folder path will be read recursively. Default + * is true. Type: boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "recursive") + private Object recursive; + + /** + * Get if true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). + * + * @return the recursive value + */ + public Object recursive() { + return this.recursive; + } + + /** + * Set if true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). + * + * @param recursive the recursive value to set + * @return the AzureDataLakeStoreSource object itself. + */ + public AzureDataLakeStoreSource withRecursive(Object recursive) { + this.recursive = recursive; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDatabricksLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDatabricksLinkedService.java new file mode 100644 index 000000000000..490f7f1bdef5 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureDatabricksLinkedService.java @@ -0,0 +1,244 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Azure Databricks linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureDatabricks") +@JsonFlatten +public class AzureDatabricksLinkedService extends LinkedServiceInner { + /** + * <REGION>.azuredatabricks.net, domain name of your Databricks + * deployment. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.domain", required = true) + private Object domain; + + /** + * Access token for databricks REST API. Refer to + * https://docs.azuredatabricks.net/api/latest/authentication.html. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.accessToken", required = true) + private SecretBase accessToken; + + /** + * The id of an existing cluster that will be used for all runs of this + * job. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.existingClusterId") + private Object existingClusterId; + + /** + * The Spark version of new cluster. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.newClusterVersion") + private Object newClusterVersion; + + /** + * Number of worker nodes that new cluster should have. A string formatted + * Int32, like '1' means numOfWorker is 1 or '1:10' means auto-scale from 1 + * as min and 10 as max. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.newClusterNumOfWorker") + private Object newClusterNumOfWorker; + + /** + * The node types of new cluster. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.newClusterNodeType") + private Object newClusterNodeType; + + /** + * a set of optional, user-specified Spark configuration key-value pairs. + */ + @JsonProperty(value = "typeProperties.newClusterSparkConf") + private Map newClusterSparkConf; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get <REGION>.azuredatabricks.net, domain name of your Databricks deployment. Type: string (or Expression with resultType string). + * + * @return the domain value + */ + public Object domain() { + return this.domain; + } + + /** + * Set <REGION>.azuredatabricks.net, domain name of your Databricks deployment. Type: string (or Expression with resultType string). + * + * @param domain the domain value to set + * @return the AzureDatabricksLinkedService object itself. + */ + public AzureDatabricksLinkedService withDomain(Object domain) { + this.domain = domain; + return this; + } + + /** + * Get access token for databricks REST API. Refer to https://docs.azuredatabricks.net/api/latest/authentication.html. Type: string (or Expression with resultType string). + * + * @return the accessToken value + */ + public SecretBase accessToken() { + return this.accessToken; + } + + /** + * Set access token for databricks REST API. Refer to https://docs.azuredatabricks.net/api/latest/authentication.html. Type: string (or Expression with resultType string). + * + * @param accessToken the accessToken value to set + * @return the AzureDatabricksLinkedService object itself. + */ + public AzureDatabricksLinkedService withAccessToken(SecretBase accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Get the id of an existing cluster that will be used for all runs of this job. Type: string (or Expression with resultType string). + * + * @return the existingClusterId value + */ + public Object existingClusterId() { + return this.existingClusterId; + } + + /** + * Set the id of an existing cluster that will be used for all runs of this job. Type: string (or Expression with resultType string). + * + * @param existingClusterId the existingClusterId value to set + * @return the AzureDatabricksLinkedService object itself. + */ + public AzureDatabricksLinkedService withExistingClusterId(Object existingClusterId) { + this.existingClusterId = existingClusterId; + return this; + } + + /** + * Get the Spark version of new cluster. Type: string (or Expression with resultType string). + * + * @return the newClusterVersion value + */ + public Object newClusterVersion() { + return this.newClusterVersion; + } + + /** + * Set the Spark version of new cluster. Type: string (or Expression with resultType string). + * + * @param newClusterVersion the newClusterVersion value to set + * @return the AzureDatabricksLinkedService object itself. + */ + public AzureDatabricksLinkedService withNewClusterVersion(Object newClusterVersion) { + this.newClusterVersion = newClusterVersion; + return this; + } + + /** + * Get number of worker nodes that new cluster should have. A string formatted Int32, like '1' means numOfWorker is 1 or '1:10' means auto-scale from 1 as min and 10 as max. Type: string (or Expression with resultType string). + * + * @return the newClusterNumOfWorker value + */ + public Object newClusterNumOfWorker() { + return this.newClusterNumOfWorker; + } + + /** + * Set number of worker nodes that new cluster should have. A string formatted Int32, like '1' means numOfWorker is 1 or '1:10' means auto-scale from 1 as min and 10 as max. Type: string (or Expression with resultType string). + * + * @param newClusterNumOfWorker the newClusterNumOfWorker value to set + * @return the AzureDatabricksLinkedService object itself. + */ + public AzureDatabricksLinkedService withNewClusterNumOfWorker(Object newClusterNumOfWorker) { + this.newClusterNumOfWorker = newClusterNumOfWorker; + return this; + } + + /** + * Get the node types of new cluster. Type: string (or Expression with resultType string). + * + * @return the newClusterNodeType value + */ + public Object newClusterNodeType() { + return this.newClusterNodeType; + } + + /** + * Set the node types of new cluster. Type: string (or Expression with resultType string). + * + * @param newClusterNodeType the newClusterNodeType value to set + * @return the AzureDatabricksLinkedService object itself. + */ + public AzureDatabricksLinkedService withNewClusterNodeType(Object newClusterNodeType) { + this.newClusterNodeType = newClusterNodeType; + return this; + } + + /** + * Get a set of optional, user-specified Spark configuration key-value pairs. + * + * @return the newClusterSparkConf value + */ + public Map newClusterSparkConf() { + return this.newClusterSparkConf; + } + + /** + * Set a set of optional, user-specified Spark configuration key-value pairs. + * + * @param newClusterSparkConf the newClusterSparkConf value to set + * @return the AzureDatabricksLinkedService object itself. + */ + public AzureDatabricksLinkedService withNewClusterSparkConf(Map newClusterSparkConf) { + this.newClusterSparkConf = newClusterSparkConf; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzureDatabricksLinkedService object itself. + */ + public AzureDatabricksLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureKeyVaultLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureKeyVaultLinkedService.java new file mode 100644 index 000000000000..0dae9d58e316 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureKeyVaultLinkedService.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Azure Key Vault linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureKeyVault") +@JsonFlatten +public class AzureKeyVaultLinkedService extends LinkedServiceInner { + /** + * The base URL of the Azure Key Vault. e.g. https://myakv.vault.azure.net + * Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.baseUrl", required = true) + private Object baseUrl; + + /** + * Get the base URL of the Azure Key Vault. e.g. https://myakv.vault.azure.net Type: string (or Expression with resultType string). + * + * @return the baseUrl value + */ + public Object baseUrl() { + return this.baseUrl; + } + + /** + * Set the base URL of the Azure Key Vault. e.g. https://myakv.vault.azure.net Type: string (or Expression with resultType string). + * + * @param baseUrl the baseUrl value to set + * @return the AzureKeyVaultLinkedService object itself. + */ + public AzureKeyVaultLinkedService withBaseUrl(Object baseUrl) { + this.baseUrl = baseUrl; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureKeyVaultSecretReference.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureKeyVaultSecretReference.java new file mode 100644 index 000000000000..9e94451faf0e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureKeyVaultSecretReference.java @@ -0,0 +1,102 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Azure Key Vault secret reference. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureKeyVaultSecret") +public class AzureKeyVaultSecretReference extends SecretBase { + /** + * The Azure Key Vault linked service reference. + */ + @JsonProperty(value = "store", required = true) + private LinkedServiceReference store; + + /** + * The name of the secret in Azure Key Vault. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "secretName", required = true) + private Object secretName; + + /** + * The version of the secret in Azure Key Vault. The default value is the + * latest version of the secret. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "secretVersion") + private Object secretVersion; + + /** + * Get the Azure Key Vault linked service reference. + * + * @return the store value + */ + public LinkedServiceReference store() { + return this.store; + } + + /** + * Set the Azure Key Vault linked service reference. + * + * @param store the store value to set + * @return the AzureKeyVaultSecretReference object itself. + */ + public AzureKeyVaultSecretReference withStore(LinkedServiceReference store) { + this.store = store; + return this; + } + + /** + * Get the name of the secret in Azure Key Vault. Type: string (or Expression with resultType string). + * + * @return the secretName value + */ + public Object secretName() { + return this.secretName; + } + + /** + * Set the name of the secret in Azure Key Vault. Type: string (or Expression with resultType string). + * + * @param secretName the secretName value to set + * @return the AzureKeyVaultSecretReference object itself. + */ + public AzureKeyVaultSecretReference withSecretName(Object secretName) { + this.secretName = secretName; + return this; + } + + /** + * Get the version of the secret in Azure Key Vault. The default value is the latest version of the secret. Type: string (or Expression with resultType string). + * + * @return the secretVersion value + */ + public Object secretVersion() { + return this.secretVersion; + } + + /** + * Set the version of the secret in Azure Key Vault. The default value is the latest version of the secret. Type: string (or Expression with resultType string). + * + * @param secretVersion the secretVersion value to set + * @return the AzureKeyVaultSecretReference object itself. + */ + public AzureKeyVaultSecretReference withSecretVersion(Object secretVersion) { + this.secretVersion = secretVersion; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLBatchExecutionActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLBatchExecutionActivity.java new file mode 100644 index 000000000000..d2fa4a99973d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLBatchExecutionActivity.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Azure ML Batch Execution activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureMLBatchExecution") +@JsonFlatten +public class AzureMLBatchExecutionActivity extends ExecutionActivity { + /** + * Key,Value pairs to be passed to the Azure ML Batch Execution Service + * endpoint. Keys must match the names of web service parameters defined in + * the published Azure ML web service. Values will be passed in the + * GlobalParameters property of the Azure ML batch execution request. + */ + @JsonProperty(value = "typeProperties.globalParameters") + private Map globalParameters; + + /** + * Key,Value pairs, mapping the names of Azure ML endpoint's Web Service + * Outputs to AzureMLWebServiceFile objects specifying the output Blob + * locations. This information will be passed in the WebServiceOutputs + * property of the Azure ML batch execution request. + */ + @JsonProperty(value = "typeProperties.webServiceOutputs") + private Map webServiceOutputs; + + /** + * Key,Value pairs, mapping the names of Azure ML endpoint's Web Service + * Inputs to AzureMLWebServiceFile objects specifying the input Blob + * locations.. This information will be passed in the WebServiceInputs + * property of the Azure ML batch execution request. + */ + @JsonProperty(value = "typeProperties.webServiceInputs") + private Map webServiceInputs; + + /** + * Get key,Value pairs to be passed to the Azure ML Batch Execution Service endpoint. Keys must match the names of web service parameters defined in the published Azure ML web service. Values will be passed in the GlobalParameters property of the Azure ML batch execution request. + * + * @return the globalParameters value + */ + public Map globalParameters() { + return this.globalParameters; + } + + /** + * Set key,Value pairs to be passed to the Azure ML Batch Execution Service endpoint. Keys must match the names of web service parameters defined in the published Azure ML web service. Values will be passed in the GlobalParameters property of the Azure ML batch execution request. + * + * @param globalParameters the globalParameters value to set + * @return the AzureMLBatchExecutionActivity object itself. + */ + public AzureMLBatchExecutionActivity withGlobalParameters(Map globalParameters) { + this.globalParameters = globalParameters; + return this; + } + + /** + * Get key,Value pairs, mapping the names of Azure ML endpoint's Web Service Outputs to AzureMLWebServiceFile objects specifying the output Blob locations. This information will be passed in the WebServiceOutputs property of the Azure ML batch execution request. + * + * @return the webServiceOutputs value + */ + public Map webServiceOutputs() { + return this.webServiceOutputs; + } + + /** + * Set key,Value pairs, mapping the names of Azure ML endpoint's Web Service Outputs to AzureMLWebServiceFile objects specifying the output Blob locations. This information will be passed in the WebServiceOutputs property of the Azure ML batch execution request. + * + * @param webServiceOutputs the webServiceOutputs value to set + * @return the AzureMLBatchExecutionActivity object itself. + */ + public AzureMLBatchExecutionActivity withWebServiceOutputs(Map webServiceOutputs) { + this.webServiceOutputs = webServiceOutputs; + return this; + } + + /** + * Get key,Value pairs, mapping the names of Azure ML endpoint's Web Service Inputs to AzureMLWebServiceFile objects specifying the input Blob locations.. This information will be passed in the WebServiceInputs property of the Azure ML batch execution request. + * + * @return the webServiceInputs value + */ + public Map webServiceInputs() { + return this.webServiceInputs; + } + + /** + * Set key,Value pairs, mapping the names of Azure ML endpoint's Web Service Inputs to AzureMLWebServiceFile objects specifying the input Blob locations.. This information will be passed in the WebServiceInputs property of the Azure ML batch execution request. + * + * @param webServiceInputs the webServiceInputs value to set + * @return the AzureMLBatchExecutionActivity object itself. + */ + public AzureMLBatchExecutionActivity withWebServiceInputs(Map webServiceInputs) { + this.webServiceInputs = webServiceInputs; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLLinkedService.java new file mode 100644 index 000000000000..4ca8a8226867 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLLinkedService.java @@ -0,0 +1,214 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Azure ML Web Service linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureML") +@JsonFlatten +public class AzureMLLinkedService extends LinkedServiceInner { + /** + * The Batch Execution REST URL for an Azure ML Web Service endpoint. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.mlEndpoint", required = true) + private Object mlEndpoint; + + /** + * The API key for accessing the Azure ML model endpoint. + */ + @JsonProperty(value = "typeProperties.apiKey", required = true) + private SecretBase apiKey; + + /** + * The Update Resource REST URL for an Azure ML Web Service endpoint. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.updateResourceEndpoint") + private Object updateResourceEndpoint; + + /** + * The ID of the service principal used to authenticate against the + * ARM-based updateResourceEndpoint of an Azure ML web service. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.servicePrincipalId") + private Object servicePrincipalId; + + /** + * The key of the service principal used to authenticate against the + * ARM-based updateResourceEndpoint of an Azure ML web service. + */ + @JsonProperty(value = "typeProperties.servicePrincipalKey") + private SecretBase servicePrincipalKey; + + /** + * The name or ID of the tenant to which the service principal belongs. + * Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.tenant") + private Object tenant; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the Batch Execution REST URL for an Azure ML Web Service endpoint. Type: string (or Expression with resultType string). + * + * @return the mlEndpoint value + */ + public Object mlEndpoint() { + return this.mlEndpoint; + } + + /** + * Set the Batch Execution REST URL for an Azure ML Web Service endpoint. Type: string (or Expression with resultType string). + * + * @param mlEndpoint the mlEndpoint value to set + * @return the AzureMLLinkedService object itself. + */ + public AzureMLLinkedService withMlEndpoint(Object mlEndpoint) { + this.mlEndpoint = mlEndpoint; + return this; + } + + /** + * Get the API key for accessing the Azure ML model endpoint. + * + * @return the apiKey value + */ + public SecretBase apiKey() { + return this.apiKey; + } + + /** + * Set the API key for accessing the Azure ML model endpoint. + * + * @param apiKey the apiKey value to set + * @return the AzureMLLinkedService object itself. + */ + public AzureMLLinkedService withApiKey(SecretBase apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Get the Update Resource REST URL for an Azure ML Web Service endpoint. Type: string (or Expression with resultType string). + * + * @return the updateResourceEndpoint value + */ + public Object updateResourceEndpoint() { + return this.updateResourceEndpoint; + } + + /** + * Set the Update Resource REST URL for an Azure ML Web Service endpoint. Type: string (or Expression with resultType string). + * + * @param updateResourceEndpoint the updateResourceEndpoint value to set + * @return the AzureMLLinkedService object itself. + */ + public AzureMLLinkedService withUpdateResourceEndpoint(Object updateResourceEndpoint) { + this.updateResourceEndpoint = updateResourceEndpoint; + return this; + } + + /** + * Get the ID of the service principal used to authenticate against the ARM-based updateResourceEndpoint of an Azure ML web service. Type: string (or Expression with resultType string). + * + * @return the servicePrincipalId value + */ + public Object servicePrincipalId() { + return this.servicePrincipalId; + } + + /** + * Set the ID of the service principal used to authenticate against the ARM-based updateResourceEndpoint of an Azure ML web service. Type: string (or Expression with resultType string). + * + * @param servicePrincipalId the servicePrincipalId value to set + * @return the AzureMLLinkedService object itself. + */ + public AzureMLLinkedService withServicePrincipalId(Object servicePrincipalId) { + this.servicePrincipalId = servicePrincipalId; + return this; + } + + /** + * Get the key of the service principal used to authenticate against the ARM-based updateResourceEndpoint of an Azure ML web service. + * + * @return the servicePrincipalKey value + */ + public SecretBase servicePrincipalKey() { + return this.servicePrincipalKey; + } + + /** + * Set the key of the service principal used to authenticate against the ARM-based updateResourceEndpoint of an Azure ML web service. + * + * @param servicePrincipalKey the servicePrincipalKey value to set + * @return the AzureMLLinkedService object itself. + */ + public AzureMLLinkedService withServicePrincipalKey(SecretBase servicePrincipalKey) { + this.servicePrincipalKey = servicePrincipalKey; + return this; + } + + /** + * Get the name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @return the tenant value + */ + public Object tenant() { + return this.tenant; + } + + /** + * Set the name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @param tenant the tenant value to set + * @return the AzureMLLinkedService object itself. + */ + public AzureMLLinkedService withTenant(Object tenant) { + this.tenant = tenant; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzureMLLinkedService object itself. + */ + public AzureMLLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLUpdateResourceActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLUpdateResourceActivity.java new file mode 100644 index 000000000000..447e9712d1db --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLUpdateResourceActivity.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Azure ML Update Resource management activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureMLUpdateResource") +@JsonFlatten +public class AzureMLUpdateResourceActivity extends ExecutionActivity { + /** + * Name of the Trained Model module in the Web Service experiment to be + * updated. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.trainedModelName", required = true) + private Object trainedModelName; + + /** + * Name of Azure Storage linked service holding the .ilearner file that + * will be uploaded by the update operation. + */ + @JsonProperty(value = "typeProperties.trainedModelLinkedServiceName", required = true) + private LinkedServiceReference trainedModelLinkedServiceName; + + /** + * The relative file path in trainedModelLinkedService to represent the + * .ilearner file that will be uploaded by the update operation. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.trainedModelFilePath", required = true) + private Object trainedModelFilePath; + + /** + * Get name of the Trained Model module in the Web Service experiment to be updated. Type: string (or Expression with resultType string). + * + * @return the trainedModelName value + */ + public Object trainedModelName() { + return this.trainedModelName; + } + + /** + * Set name of the Trained Model module in the Web Service experiment to be updated. Type: string (or Expression with resultType string). + * + * @param trainedModelName the trainedModelName value to set + * @return the AzureMLUpdateResourceActivity object itself. + */ + public AzureMLUpdateResourceActivity withTrainedModelName(Object trainedModelName) { + this.trainedModelName = trainedModelName; + return this; + } + + /** + * Get name of Azure Storage linked service holding the .ilearner file that will be uploaded by the update operation. + * + * @return the trainedModelLinkedServiceName value + */ + public LinkedServiceReference trainedModelLinkedServiceName() { + return this.trainedModelLinkedServiceName; + } + + /** + * Set name of Azure Storage linked service holding the .ilearner file that will be uploaded by the update operation. + * + * @param trainedModelLinkedServiceName the trainedModelLinkedServiceName value to set + * @return the AzureMLUpdateResourceActivity object itself. + */ + public AzureMLUpdateResourceActivity withTrainedModelLinkedServiceName(LinkedServiceReference trainedModelLinkedServiceName) { + this.trainedModelLinkedServiceName = trainedModelLinkedServiceName; + return this; + } + + /** + * Get the relative file path in trainedModelLinkedService to represent the .ilearner file that will be uploaded by the update operation. Type: string (or Expression with resultType string). + * + * @return the trainedModelFilePath value + */ + public Object trainedModelFilePath() { + return this.trainedModelFilePath; + } + + /** + * Set the relative file path in trainedModelLinkedService to represent the .ilearner file that will be uploaded by the update operation. Type: string (or Expression with resultType string). + * + * @param trainedModelFilePath the trainedModelFilePath value to set + * @return the AzureMLUpdateResourceActivity object itself. + */ + public AzureMLUpdateResourceActivity withTrainedModelFilePath(Object trainedModelFilePath) { + this.trainedModelFilePath = trainedModelFilePath; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLWebServiceFile.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLWebServiceFile.java new file mode 100644 index 000000000000..e1e5a35f5e91 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMLWebServiceFile.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Azure ML WebService Input/Output file. + */ +public class AzureMLWebServiceFile { + /** + * The relative file path, including container name, in the Azure Blob + * Storage specified by the LinkedService. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "filePath", required = true) + private Object filePath; + + /** + * Reference to an Azure Storage LinkedService, where Azure ML WebService + * Input/Output file located. + */ + @JsonProperty(value = "linkedServiceName", required = true) + private LinkedServiceReference linkedServiceName; + + /** + * Get the relative file path, including container name, in the Azure Blob Storage specified by the LinkedService. Type: string (or Expression with resultType string). + * + * @return the filePath value + */ + public Object filePath() { + return this.filePath; + } + + /** + * Set the relative file path, including container name, in the Azure Blob Storage specified by the LinkedService. Type: string (or Expression with resultType string). + * + * @param filePath the filePath value to set + * @return the AzureMLWebServiceFile object itself. + */ + public AzureMLWebServiceFile withFilePath(Object filePath) { + this.filePath = filePath; + return this; + } + + /** + * Get reference to an Azure Storage LinkedService, where Azure ML WebService Input/Output file located. + * + * @return the linkedServiceName value + */ + public LinkedServiceReference linkedServiceName() { + return this.linkedServiceName; + } + + /** + * Set reference to an Azure Storage LinkedService, where Azure ML WebService Input/Output file located. + * + * @param linkedServiceName the linkedServiceName value to set + * @return the AzureMLWebServiceFile object itself. + */ + public AzureMLWebServiceFile withLinkedServiceName(LinkedServiceReference linkedServiceName) { + this.linkedServiceName = linkedServiceName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMySqlLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMySqlLinkedService.java new file mode 100644 index 000000000000..5d8164e7e457 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMySqlLinkedService.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Azure MySQL database linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureMySql") +@JsonFlatten +public class AzureMySqlLinkedService extends LinkedServiceInner { + /** + * The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString", required = true) + private Object connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the AzureMySqlLinkedService object itself. + */ + public AzureMySqlLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzureMySqlLinkedService object itself. + */ + public AzureMySqlLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMySqlSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMySqlSource.java new file mode 100644 index 000000000000..93bfb696cd28 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMySqlSource.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Azure MySQL source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureMySqlSource") +public class AzureMySqlSource extends CopySource { + /** + * Database query. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get database query. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set database query. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the AzureMySqlSource object itself. + */ + public AzureMySqlSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMySqlTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMySqlTableDataset.java new file mode 100644 index 000000000000..0ddb55d3a276 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureMySqlTableDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The Azure MySQL database dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureMySqlTable") +@JsonFlatten +public class AzureMySqlTableDataset extends DatasetInner { + /** + * The Azure MySQL database table name. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.tableName") + private Object tableName; + + /** + * Get the Azure MySQL database table name. Type: string (or Expression with resultType string). + * + * @return the tableName value + */ + public Object tableName() { + return this.tableName; + } + + /** + * Set the Azure MySQL database table name. Type: string (or Expression with resultType string). + * + * @param tableName the tableName value to set + * @return the AzureMySqlTableDataset object itself. + */ + public AzureMySqlTableDataset withTableName(Object tableName) { + this.tableName = tableName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzurePostgreSqlLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzurePostgreSqlLinkedService.java new file mode 100644 index 000000000000..f5180f2815bc --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzurePostgreSqlLinkedService.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Azure PostgreSQL linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzurePostgreSql") +@JsonFlatten +public class AzurePostgreSqlLinkedService extends LinkedServiceInner { + /** + * An ODBC connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString") + private Object connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the AzurePostgreSqlLinkedService object itself. + */ + public AzurePostgreSqlLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzurePostgreSqlLinkedService object itself. + */ + public AzurePostgreSqlLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzurePostgreSqlSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzurePostgreSqlSource.java new file mode 100644 index 000000000000..3ff27d13695a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzurePostgreSqlSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Azure PostgreSQL source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzurePostgreSqlSource") +public class AzurePostgreSqlSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the AzurePostgreSqlSource object itself. + */ + public AzurePostgreSqlSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzurePostgreSqlTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzurePostgreSqlTableDataset.java new file mode 100644 index 000000000000..fc6a9f6748da --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzurePostgreSqlTableDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Azure PostgreSQL dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzurePostgreSqlTable") +public class AzurePostgreSqlTableDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureQueueSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureQueueSink.java new file mode 100644 index 000000000000..9068b529db6a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureQueueSink.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Azure Queue sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureQueueSink") +public class AzureQueueSink extends CopySink { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSearchIndexDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSearchIndexDataset.java new file mode 100644 index 000000000000..eea64dd01f5c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSearchIndexDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The Azure Search Index. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureSearchIndex") +@JsonFlatten +public class AzureSearchIndexDataset extends DatasetInner { + /** + * The name of the Azure Search Index. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.indexName", required = true) + private Object indexName; + + /** + * Get the name of the Azure Search Index. Type: string (or Expression with resultType string). + * + * @return the indexName value + */ + public Object indexName() { + return this.indexName; + } + + /** + * Set the name of the Azure Search Index. Type: string (or Expression with resultType string). + * + * @param indexName the indexName value to set + * @return the AzureSearchIndexDataset object itself. + */ + public AzureSearchIndexDataset withIndexName(Object indexName) { + this.indexName = indexName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSearchIndexSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSearchIndexSink.java new file mode 100644 index 000000000000..9ae8525579a5 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSearchIndexSink.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Azure Search Index sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureSearchIndexSink") +public class AzureSearchIndexSink extends CopySink { + /** + * Specify the write behavior when upserting documents into Azure Search + * Index. + */ + @JsonProperty(value = "writeBehavior") + private Object writeBehavior; + + /** + * Get specify the write behavior when upserting documents into Azure Search Index. + * + * @return the writeBehavior value + */ + public Object writeBehavior() { + return this.writeBehavior; + } + + /** + * Set specify the write behavior when upserting documents into Azure Search Index. + * + * @param writeBehavior the writeBehavior value to set + * @return the AzureSearchIndexSink object itself. + */ + public AzureSearchIndexSink withWriteBehavior(Object writeBehavior) { + this.writeBehavior = writeBehavior; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSearchLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSearchLinkedService.java new file mode 100644 index 000000000000..c464e275eaee --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSearchLinkedService.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for Windows Azure Search Service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureSearch") +@JsonFlatten +public class AzureSearchLinkedService extends LinkedServiceInner { + /** + * URL for Azure Search service. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.url", required = true) + private Object url; + + /** + * Admin Key for Azure Search service. + */ + @JsonProperty(value = "typeProperties.key") + private SecretBase key; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get uRL for Azure Search service. Type: string (or Expression with resultType string). + * + * @return the url value + */ + public Object url() { + return this.url; + } + + /** + * Set uRL for Azure Search service. Type: string (or Expression with resultType string). + * + * @param url the url value to set + * @return the AzureSearchLinkedService object itself. + */ + public AzureSearchLinkedService withUrl(Object url) { + this.url = url; + return this; + } + + /** + * Get admin Key for Azure Search service. + * + * @return the key value + */ + public SecretBase key() { + return this.key; + } + + /** + * Set admin Key for Azure Search service. + * + * @param key the key value to set + * @return the AzureSearchLinkedService object itself. + */ + public AzureSearchLinkedService withKey(SecretBase key) { + this.key = key; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzureSearchLinkedService object itself. + */ + public AzureSearchLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlDWLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlDWLinkedService.java new file mode 100644 index 000000000000..3760eec08c19 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlDWLinkedService.java @@ -0,0 +1,161 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Azure SQL Data Warehouse linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureSqlDW") +@JsonFlatten +public class AzureSqlDWLinkedService extends LinkedServiceInner { + /** + * The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString", required = true) + private Object connectionString; + + /** + * The ID of the service principal used to authenticate against Azure SQL + * Data Warehouse. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.servicePrincipalId") + private Object servicePrincipalId; + + /** + * The key of the service principal used to authenticate against Azure SQL + * Data Warehouse. + */ + @JsonProperty(value = "typeProperties.servicePrincipalKey") + private SecretBase servicePrincipalKey; + + /** + * The name or ID of the tenant to which the service principal belongs. + * Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.tenant") + private Object tenant; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the AzureSqlDWLinkedService object itself. + */ + public AzureSqlDWLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the ID of the service principal used to authenticate against Azure SQL Data Warehouse. Type: string (or Expression with resultType string). + * + * @return the servicePrincipalId value + */ + public Object servicePrincipalId() { + return this.servicePrincipalId; + } + + /** + * Set the ID of the service principal used to authenticate against Azure SQL Data Warehouse. Type: string (or Expression with resultType string). + * + * @param servicePrincipalId the servicePrincipalId value to set + * @return the AzureSqlDWLinkedService object itself. + */ + public AzureSqlDWLinkedService withServicePrincipalId(Object servicePrincipalId) { + this.servicePrincipalId = servicePrincipalId; + return this; + } + + /** + * Get the key of the service principal used to authenticate against Azure SQL Data Warehouse. + * + * @return the servicePrincipalKey value + */ + public SecretBase servicePrincipalKey() { + return this.servicePrincipalKey; + } + + /** + * Set the key of the service principal used to authenticate against Azure SQL Data Warehouse. + * + * @param servicePrincipalKey the servicePrincipalKey value to set + * @return the AzureSqlDWLinkedService object itself. + */ + public AzureSqlDWLinkedService withServicePrincipalKey(SecretBase servicePrincipalKey) { + this.servicePrincipalKey = servicePrincipalKey; + return this; + } + + /** + * Get the name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @return the tenant value + */ + public Object tenant() { + return this.tenant; + } + + /** + * Set the name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @param tenant the tenant value to set + * @return the AzureSqlDWLinkedService object itself. + */ + public AzureSqlDWLinkedService withTenant(Object tenant) { + this.tenant = tenant; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzureSqlDWLinkedService object itself. + */ + public AzureSqlDWLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlDWTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlDWTableDataset.java new file mode 100644 index 000000000000..15b048a010eb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlDWTableDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The Azure SQL Data Warehouse dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureSqlDWTable") +@JsonFlatten +public class AzureSqlDWTableDataset extends DatasetInner { + /** + * The table name of the Azure SQL Data Warehouse. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.tableName", required = true) + private Object tableName; + + /** + * Get the table name of the Azure SQL Data Warehouse. Type: string (or Expression with resultType string). + * + * @return the tableName value + */ + public Object tableName() { + return this.tableName; + } + + /** + * Set the table name of the Azure SQL Data Warehouse. Type: string (or Expression with resultType string). + * + * @param tableName the tableName value to set + * @return the AzureSqlDWTableDataset object itself. + */ + public AzureSqlDWTableDataset withTableName(Object tableName) { + this.tableName = tableName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlDatabaseLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlDatabaseLinkedService.java new file mode 100644 index 000000000000..ce76849ac373 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlDatabaseLinkedService.java @@ -0,0 +1,160 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Microsoft Azure SQL Database linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureSqlDatabase") +@JsonFlatten +public class AzureSqlDatabaseLinkedService extends LinkedServiceInner { + /** + * The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString", required = true) + private Object connectionString; + + /** + * The ID of the service principal used to authenticate against Azure SQL + * Database. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.servicePrincipalId") + private Object servicePrincipalId; + + /** + * The key of the service principal used to authenticate against Azure SQL + * Database. + */ + @JsonProperty(value = "typeProperties.servicePrincipalKey") + private SecretBase servicePrincipalKey; + + /** + * The name or ID of the tenant to which the service principal belongs. + * Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.tenant") + private Object tenant; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the AzureSqlDatabaseLinkedService object itself. + */ + public AzureSqlDatabaseLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the ID of the service principal used to authenticate against Azure SQL Database. Type: string (or Expression with resultType string). + * + * @return the servicePrincipalId value + */ + public Object servicePrincipalId() { + return this.servicePrincipalId; + } + + /** + * Set the ID of the service principal used to authenticate against Azure SQL Database. Type: string (or Expression with resultType string). + * + * @param servicePrincipalId the servicePrincipalId value to set + * @return the AzureSqlDatabaseLinkedService object itself. + */ + public AzureSqlDatabaseLinkedService withServicePrincipalId(Object servicePrincipalId) { + this.servicePrincipalId = servicePrincipalId; + return this; + } + + /** + * Get the key of the service principal used to authenticate against Azure SQL Database. + * + * @return the servicePrincipalKey value + */ + public SecretBase servicePrincipalKey() { + return this.servicePrincipalKey; + } + + /** + * Set the key of the service principal used to authenticate against Azure SQL Database. + * + * @param servicePrincipalKey the servicePrincipalKey value to set + * @return the AzureSqlDatabaseLinkedService object itself. + */ + public AzureSqlDatabaseLinkedService withServicePrincipalKey(SecretBase servicePrincipalKey) { + this.servicePrincipalKey = servicePrincipalKey; + return this; + } + + /** + * Get the name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @return the tenant value + */ + public Object tenant() { + return this.tenant; + } + + /** + * Set the name or ID of the tenant to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @param tenant the tenant value to set + * @return the AzureSqlDatabaseLinkedService object itself. + */ + public AzureSqlDatabaseLinkedService withTenant(Object tenant) { + this.tenant = tenant; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzureSqlDatabaseLinkedService object itself. + */ + public AzureSqlDatabaseLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlTableDataset.java new file mode 100644 index 000000000000..3786d8160477 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureSqlTableDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The Azure SQL Server database dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureSqlTable") +@JsonFlatten +public class AzureSqlTableDataset extends DatasetInner { + /** + * The table name of the Azure SQL database. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.tableName", required = true) + private Object tableName; + + /** + * Get the table name of the Azure SQL database. Type: string (or Expression with resultType string). + * + * @return the tableName value + */ + public Object tableName() { + return this.tableName; + } + + /** + * Set the table name of the Azure SQL database. Type: string (or Expression with resultType string). + * + * @param tableName the tableName value to set + * @return the AzureSqlTableDataset object itself. + */ + public AzureSqlTableDataset withTableName(Object tableName) { + this.tableName = tableName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureStorageLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureStorageLinkedService.java new file mode 100644 index 000000000000..28401da5afe7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureStorageLinkedService.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * The storage account linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureStorage") +@JsonFlatten +public class AzureStorageLinkedService extends LinkedServiceInner { + /** + * The connection string. It is mutually exclusive with sasUri property. + * Type: string, SecureString or AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString") + private Object connectionString; + + /** + * SAS URI of the Azure Storage resource. It is mutually exclusive with + * connectionString property. + */ + @JsonProperty(value = "typeProperties.sasUri") + private SecretBase sasUri; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the connection string. It is mutually exclusive with sasUri property. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set the connection string. It is mutually exclusive with sasUri property. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the AzureStorageLinkedService object itself. + */ + public AzureStorageLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get sAS URI of the Azure Storage resource. It is mutually exclusive with connectionString property. + * + * @return the sasUri value + */ + public SecretBase sasUri() { + return this.sasUri; + } + + /** + * Set sAS URI of the Azure Storage resource. It is mutually exclusive with connectionString property. + * + * @param sasUri the sasUri value to set + * @return the AzureStorageLinkedService object itself. + */ + public AzureStorageLinkedService withSasUri(SecretBase sasUri) { + this.sasUri = sasUri; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the AzureStorageLinkedService object itself. + */ + public AzureStorageLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureTableDataset.java new file mode 100644 index 000000000000..2acdd3474bc0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureTableDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The Azure Table storage dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureTable") +@JsonFlatten +public class AzureTableDataset extends DatasetInner { + /** + * The table name of the Azure Table storage. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.tableName", required = true) + private Object tableName; + + /** + * Get the table name of the Azure Table storage. Type: string (or Expression with resultType string). + * + * @return the tableName value + */ + public Object tableName() { + return this.tableName; + } + + /** + * Set the table name of the Azure Table storage. Type: string (or Expression with resultType string). + * + * @param tableName the tableName value to set + * @return the AzureTableDataset object itself. + */ + public AzureTableDataset withTableName(Object tableName) { + this.tableName = tableName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureTableSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureTableSink.java new file mode 100644 index 000000000000..1cb5b65e9bcb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureTableSink.java @@ -0,0 +1,129 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Azure Table sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureTableSink") +public class AzureTableSink extends CopySink { + /** + * Azure Table default partition key value. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "azureTableDefaultPartitionKeyValue") + private Object azureTableDefaultPartitionKeyValue; + + /** + * Azure Table partition key name. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "azureTablePartitionKeyName") + private Object azureTablePartitionKeyName; + + /** + * Azure Table row key name. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "azureTableRowKeyName") + private Object azureTableRowKeyName; + + /** + * Azure Table insert type. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "azureTableInsertType") + private Object azureTableInsertType; + + /** + * Get azure Table default partition key value. Type: string (or Expression with resultType string). + * + * @return the azureTableDefaultPartitionKeyValue value + */ + public Object azureTableDefaultPartitionKeyValue() { + return this.azureTableDefaultPartitionKeyValue; + } + + /** + * Set azure Table default partition key value. Type: string (or Expression with resultType string). + * + * @param azureTableDefaultPartitionKeyValue the azureTableDefaultPartitionKeyValue value to set + * @return the AzureTableSink object itself. + */ + public AzureTableSink withAzureTableDefaultPartitionKeyValue(Object azureTableDefaultPartitionKeyValue) { + this.azureTableDefaultPartitionKeyValue = azureTableDefaultPartitionKeyValue; + return this; + } + + /** + * Get azure Table partition key name. Type: string (or Expression with resultType string). + * + * @return the azureTablePartitionKeyName value + */ + public Object azureTablePartitionKeyName() { + return this.azureTablePartitionKeyName; + } + + /** + * Set azure Table partition key name. Type: string (or Expression with resultType string). + * + * @param azureTablePartitionKeyName the azureTablePartitionKeyName value to set + * @return the AzureTableSink object itself. + */ + public AzureTableSink withAzureTablePartitionKeyName(Object azureTablePartitionKeyName) { + this.azureTablePartitionKeyName = azureTablePartitionKeyName; + return this; + } + + /** + * Get azure Table row key name. Type: string (or Expression with resultType string). + * + * @return the azureTableRowKeyName value + */ + public Object azureTableRowKeyName() { + return this.azureTableRowKeyName; + } + + /** + * Set azure Table row key name. Type: string (or Expression with resultType string). + * + * @param azureTableRowKeyName the azureTableRowKeyName value to set + * @return the AzureTableSink object itself. + */ + public AzureTableSink withAzureTableRowKeyName(Object azureTableRowKeyName) { + this.azureTableRowKeyName = azureTableRowKeyName; + return this; + } + + /** + * Get azure Table insert type. Type: string (or Expression with resultType string). + * + * @return the azureTableInsertType value + */ + public Object azureTableInsertType() { + return this.azureTableInsertType; + } + + /** + * Set azure Table insert type. Type: string (or Expression with resultType string). + * + * @param azureTableInsertType the azureTableInsertType value to set + * @return the AzureTableSink object itself. + */ + public AzureTableSink withAzureTableInsertType(Object azureTableInsertType) { + this.azureTableInsertType = azureTableInsertType; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureTableSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureTableSource.java new file mode 100644 index 000000000000..0582408f5f7d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/AzureTableSource.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Azure Table source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("AzureTableSource") +public class AzureTableSource extends CopySource { + /** + * Azure Table source query. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "azureTableSourceQuery") + private Object azureTableSourceQuery; + + /** + * Azure Table source ignore table not found. Type: boolean (or Expression + * with resultType boolean). + */ + @JsonProperty(value = "azureTableSourceIgnoreTableNotFound") + private Object azureTableSourceIgnoreTableNotFound; + + /** + * Get azure Table source query. Type: string (or Expression with resultType string). + * + * @return the azureTableSourceQuery value + */ + public Object azureTableSourceQuery() { + return this.azureTableSourceQuery; + } + + /** + * Set azure Table source query. Type: string (or Expression with resultType string). + * + * @param azureTableSourceQuery the azureTableSourceQuery value to set + * @return the AzureTableSource object itself. + */ + public AzureTableSource withAzureTableSourceQuery(Object azureTableSourceQuery) { + this.azureTableSourceQuery = azureTableSourceQuery; + return this; + } + + /** + * Get azure Table source ignore table not found. Type: boolean (or Expression with resultType boolean). + * + * @return the azureTableSourceIgnoreTableNotFound value + */ + public Object azureTableSourceIgnoreTableNotFound() { + return this.azureTableSourceIgnoreTableNotFound; + } + + /** + * Set azure Table source ignore table not found. Type: boolean (or Expression with resultType boolean). + * + * @param azureTableSourceIgnoreTableNotFound the azureTableSourceIgnoreTableNotFound value to set + * @return the AzureTableSource object itself. + */ + public AzureTableSource withAzureTableSourceIgnoreTableNotFound(Object azureTableSourceIgnoreTableNotFound) { + this.azureTableSourceIgnoreTableNotFound = azureTableSourceIgnoreTableNotFound; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobEventTypes.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobEventTypes.java new file mode 100644 index 000000000000..6f130a926306 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobEventTypes.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BlobEventTypes. + */ +public final class BlobEventTypes extends ExpandableStringEnum { + /** Static value Microsoft.Storage.BlobCreated for BlobEventTypes. */ + public static final BlobEventTypes MICROSOFT_STORAGE_BLOB_CREATED = fromString("Microsoft.Storage.BlobCreated"); + + /** Static value Microsoft.Storage.BlobDeleted for BlobEventTypes. */ + public static final BlobEventTypes MICROSOFT_STORAGE_BLOB_DELETED = fromString("Microsoft.Storage.BlobDeleted"); + + /** + * Creates or finds a BlobEventTypes from its string representation. + * @param name a name to look for + * @return the corresponding BlobEventTypes + */ + @JsonCreator + public static BlobEventTypes fromString(String name) { + return fromString(name, BlobEventTypes.class); + } + + /** + * @return known BlobEventTypes values + */ + public static Collection values() { + return values(BlobEventTypes.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobEventsTrigger.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobEventsTrigger.java new file mode 100644 index 000000000000..62d3d3b31e58 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobEventsTrigger.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Trigger that runs every time a Blob event occurs. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("BlobEventsTrigger") +@JsonFlatten +public class BlobEventsTrigger extends MultiplePipelineTrigger { + /** + * The blob path must begin with the pattern provided for trigger to fire. + * For example, '/records/blobs/december/' will only fire the trigger for + * blobs in the december folder under the records container. At least one + * of these must be provided: blobPathBeginsWith, blobPathEndsWith. + */ + @JsonProperty(value = "typeProperties.blobPathBeginsWith") + private String blobPathBeginsWith; + + /** + * The blob path must end with the pattern provided for trigger to fire. + * For example, 'december/boxes.csv' will only fire the trigger for blobs + * named boxes in a december folder. At least one of these must be + * provided: blobPathBeginsWith, blobPathEndsWith. + */ + @JsonProperty(value = "typeProperties.blobPathEndsWith") + private String blobPathEndsWith; + + /** + * The type of events that cause this trigger to fire. + */ + @JsonProperty(value = "typeProperties.events", required = true) + private List events; + + /** + * The ARM resource ID of the Storage Account. + */ + @JsonProperty(value = "typeProperties.scope", required = true) + private String scope; + + /** + * Get the blob path must begin with the pattern provided for trigger to fire. For example, '/records/blobs/december/' will only fire the trigger for blobs in the december folder under the records container. At least one of these must be provided: blobPathBeginsWith, blobPathEndsWith. + * + * @return the blobPathBeginsWith value + */ + public String blobPathBeginsWith() { + return this.blobPathBeginsWith; + } + + /** + * Set the blob path must begin with the pattern provided for trigger to fire. For example, '/records/blobs/december/' will only fire the trigger for blobs in the december folder under the records container. At least one of these must be provided: blobPathBeginsWith, blobPathEndsWith. + * + * @param blobPathBeginsWith the blobPathBeginsWith value to set + * @return the BlobEventsTrigger object itself. + */ + public BlobEventsTrigger withBlobPathBeginsWith(String blobPathBeginsWith) { + this.blobPathBeginsWith = blobPathBeginsWith; + return this; + } + + /** + * Get the blob path must end with the pattern provided for trigger to fire. For example, 'december/boxes.csv' will only fire the trigger for blobs named boxes in a december folder. At least one of these must be provided: blobPathBeginsWith, blobPathEndsWith. + * + * @return the blobPathEndsWith value + */ + public String blobPathEndsWith() { + return this.blobPathEndsWith; + } + + /** + * Set the blob path must end with the pattern provided for trigger to fire. For example, 'december/boxes.csv' will only fire the trigger for blobs named boxes in a december folder. At least one of these must be provided: blobPathBeginsWith, blobPathEndsWith. + * + * @param blobPathEndsWith the blobPathEndsWith value to set + * @return the BlobEventsTrigger object itself. + */ + public BlobEventsTrigger withBlobPathEndsWith(String blobPathEndsWith) { + this.blobPathEndsWith = blobPathEndsWith; + return this; + } + + /** + * Get the type of events that cause this trigger to fire. + * + * @return the events value + */ + public List events() { + return this.events; + } + + /** + * Set the type of events that cause this trigger to fire. + * + * @param events the events value to set + * @return the BlobEventsTrigger object itself. + */ + public BlobEventsTrigger withEvents(List events) { + this.events = events; + return this; + } + + /** + * Get the ARM resource ID of the Storage Account. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set the ARM resource ID of the Storage Account. + * + * @param scope the scope value to set + * @return the BlobEventsTrigger object itself. + */ + public BlobEventsTrigger withScope(String scope) { + this.scope = scope; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobSink.java new file mode 100644 index 000000000000..4c6f3ac89df6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobSink.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Azure Blob sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("BlobSink") +public class BlobSink extends CopySink { + /** + * Blob writer overwrite files. Type: boolean (or Expression with + * resultType boolean). + */ + @JsonProperty(value = "blobWriterOverwriteFiles") + private Object blobWriterOverwriteFiles; + + /** + * Blob writer date time format. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "blobWriterDateTimeFormat") + private Object blobWriterDateTimeFormat; + + /** + * Blob writer add header. Type: boolean (or Expression with resultType + * boolean). + */ + @JsonProperty(value = "blobWriterAddHeader") + private Object blobWriterAddHeader; + + /** + * The type of copy behavior for copy sink. + */ + @JsonProperty(value = "copyBehavior") + private Object copyBehavior; + + /** + * Get blob writer overwrite files. Type: boolean (or Expression with resultType boolean). + * + * @return the blobWriterOverwriteFiles value + */ + public Object blobWriterOverwriteFiles() { + return this.blobWriterOverwriteFiles; + } + + /** + * Set blob writer overwrite files. Type: boolean (or Expression with resultType boolean). + * + * @param blobWriterOverwriteFiles the blobWriterOverwriteFiles value to set + * @return the BlobSink object itself. + */ + public BlobSink withBlobWriterOverwriteFiles(Object blobWriterOverwriteFiles) { + this.blobWriterOverwriteFiles = blobWriterOverwriteFiles; + return this; + } + + /** + * Get blob writer date time format. Type: string (or Expression with resultType string). + * + * @return the blobWriterDateTimeFormat value + */ + public Object blobWriterDateTimeFormat() { + return this.blobWriterDateTimeFormat; + } + + /** + * Set blob writer date time format. Type: string (or Expression with resultType string). + * + * @param blobWriterDateTimeFormat the blobWriterDateTimeFormat value to set + * @return the BlobSink object itself. + */ + public BlobSink withBlobWriterDateTimeFormat(Object blobWriterDateTimeFormat) { + this.blobWriterDateTimeFormat = blobWriterDateTimeFormat; + return this; + } + + /** + * Get blob writer add header. Type: boolean (or Expression with resultType boolean). + * + * @return the blobWriterAddHeader value + */ + public Object blobWriterAddHeader() { + return this.blobWriterAddHeader; + } + + /** + * Set blob writer add header. Type: boolean (or Expression with resultType boolean). + * + * @param blobWriterAddHeader the blobWriterAddHeader value to set + * @return the BlobSink object itself. + */ + public BlobSink withBlobWriterAddHeader(Object blobWriterAddHeader) { + this.blobWriterAddHeader = blobWriterAddHeader; + return this; + } + + /** + * Get the type of copy behavior for copy sink. + * + * @return the copyBehavior value + */ + public Object copyBehavior() { + return this.copyBehavior; + } + + /** + * Set the type of copy behavior for copy sink. + * + * @param copyBehavior the copyBehavior value to set + * @return the BlobSink object itself. + */ + public BlobSink withCopyBehavior(Object copyBehavior) { + this.copyBehavior = copyBehavior; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobSource.java new file mode 100644 index 000000000000..d95dd3cc3d4e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobSource.java @@ -0,0 +1,102 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Azure Blob source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("BlobSource") +public class BlobSource extends CopySource { + /** + * Treat empty as null. Type: boolean (or Expression with resultType + * boolean). + */ + @JsonProperty(value = "treatEmptyAsNull") + private Object treatEmptyAsNull; + + /** + * Number of header lines to skip from each blob. Type: integer (or + * Expression with resultType integer). + */ + @JsonProperty(value = "skipHeaderLineCount") + private Object skipHeaderLineCount; + + /** + * If true, files under the folder path will be read recursively. Default + * is true. Type: boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "recursive") + private Object recursive; + + /** + * Get treat empty as null. Type: boolean (or Expression with resultType boolean). + * + * @return the treatEmptyAsNull value + */ + public Object treatEmptyAsNull() { + return this.treatEmptyAsNull; + } + + /** + * Set treat empty as null. Type: boolean (or Expression with resultType boolean). + * + * @param treatEmptyAsNull the treatEmptyAsNull value to set + * @return the BlobSource object itself. + */ + public BlobSource withTreatEmptyAsNull(Object treatEmptyAsNull) { + this.treatEmptyAsNull = treatEmptyAsNull; + return this; + } + + /** + * Get number of header lines to skip from each blob. Type: integer (or Expression with resultType integer). + * + * @return the skipHeaderLineCount value + */ + public Object skipHeaderLineCount() { + return this.skipHeaderLineCount; + } + + /** + * Set number of header lines to skip from each blob. Type: integer (or Expression with resultType integer). + * + * @param skipHeaderLineCount the skipHeaderLineCount value to set + * @return the BlobSource object itself. + */ + public BlobSource withSkipHeaderLineCount(Object skipHeaderLineCount) { + this.skipHeaderLineCount = skipHeaderLineCount; + return this; + } + + /** + * Get if true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). + * + * @return the recursive value + */ + public Object recursive() { + return this.recursive; + } + + /** + * Set if true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). + * + * @param recursive the recursive value to set + * @return the BlobSource object itself. + */ + public BlobSource withRecursive(Object recursive) { + this.recursive = recursive; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobTrigger.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobTrigger.java new file mode 100644 index 000000000000..988f8b01a83f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/BlobTrigger.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Trigger that runs every time the selected Blob container changes. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("BlobTrigger") +@JsonFlatten +public class BlobTrigger extends MultiplePipelineTrigger { + /** + * The path of the container/folder that will trigger the pipeline. + */ + @JsonProperty(value = "typeProperties.folderPath", required = true) + private String folderPath; + + /** + * The max number of parallel files to handle when it is triggered. + */ + @JsonProperty(value = "typeProperties.maxConcurrency", required = true) + private int maxConcurrency; + + /** + * The Azure Storage linked service reference. + */ + @JsonProperty(value = "typeProperties.linkedService", required = true) + private LinkedServiceReference linkedService; + + /** + * Get the path of the container/folder that will trigger the pipeline. + * + * @return the folderPath value + */ + public String folderPath() { + return this.folderPath; + } + + /** + * Set the path of the container/folder that will trigger the pipeline. + * + * @param folderPath the folderPath value to set + * @return the BlobTrigger object itself. + */ + public BlobTrigger withFolderPath(String folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get the max number of parallel files to handle when it is triggered. + * + * @return the maxConcurrency value + */ + public int maxConcurrency() { + return this.maxConcurrency; + } + + /** + * Set the max number of parallel files to handle when it is triggered. + * + * @param maxConcurrency the maxConcurrency value to set + * @return the BlobTrigger object itself. + */ + public BlobTrigger withMaxConcurrency(int maxConcurrency) { + this.maxConcurrency = maxConcurrency; + return this; + } + + /** + * Get the Azure Storage linked service reference. + * + * @return the linkedService value + */ + public LinkedServiceReference linkedService() { + return this.linkedService; + } + + /** + * Set the Azure Storage linked service reference. + * + * @param linkedService the linkedService value to set + * @return the BlobTrigger object itself. + */ + public BlobTrigger withLinkedService(LinkedServiceReference linkedService) { + this.linkedService = linkedService; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CassandraLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CassandraLinkedService.java new file mode 100644 index 000000000000..8276eeaeff1b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CassandraLinkedService.java @@ -0,0 +1,186 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for Cassandra data source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Cassandra") +@JsonFlatten +public class CassandraLinkedService extends LinkedServiceInner { + /** + * Host name for connection. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * AuthenticationType to be used for connection. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.authenticationType") + private Object authenticationType; + + /** + * The port for the connection. Type: integer (or Expression with + * resultType integer). + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * Username for authentication. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * Password for authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get host name for connection. Type: string (or Expression with resultType string). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set host name for connection. Type: string (or Expression with resultType string). + * + * @param host the host value to set + * @return the CassandraLinkedService object itself. + */ + public CassandraLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get authenticationType to be used for connection. Type: string (or Expression with resultType string). + * + * @return the authenticationType value + */ + public Object authenticationType() { + return this.authenticationType; + } + + /** + * Set authenticationType to be used for connection. Type: string (or Expression with resultType string). + * + * @param authenticationType the authenticationType value to set + * @return the CassandraLinkedService object itself. + */ + public CassandraLinkedService withAuthenticationType(Object authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the port for the connection. Type: integer (or Expression with resultType integer). + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the port for the connection. Type: integer (or Expression with resultType integer). + * + * @param port the port value to set + * @return the CassandraLinkedService object itself. + */ + public CassandraLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get username for authentication. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set username for authentication. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the CassandraLinkedService object itself. + */ + public CassandraLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get password for authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password for authentication. + * + * @param password the password value to set + * @return the CassandraLinkedService object itself. + */ + public CassandraLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the CassandraLinkedService object itself. + */ + public CassandraLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CassandraSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CassandraSource.java new file mode 100644 index 000000000000..c7a8fa474fa2 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CassandraSource.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity source for a Cassandra database. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("CassandraSource") +public class CassandraSource extends CopySource { + /** + * Database query. Should be a SQL-92 query expression or Cassandra Query + * Language (CQL) command. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * The consistency level specifies how many Cassandra servers must respond + * to a read request before returning data to the client application. + * Cassandra checks the specified number of Cassandra servers for data to + * satisfy the read request. Must be one of + * cassandraSourceReadConsistencyLevels. The default value is 'ONE'. It is + * case-insensitive. + */ + @JsonProperty(value = "consistencyLevel") + private Object consistencyLevel; + + /** + * Get database query. Should be a SQL-92 query expression or Cassandra Query Language (CQL) command. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set database query. Should be a SQL-92 query expression or Cassandra Query Language (CQL) command. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the CassandraSource object itself. + */ + public CassandraSource withQuery(Object query) { + this.query = query; + return this; + } + + /** + * Get the consistency level specifies how many Cassandra servers must respond to a read request before returning data to the client application. Cassandra checks the specified number of Cassandra servers for data to satisfy the read request. Must be one of cassandraSourceReadConsistencyLevels. The default value is 'ONE'. It is case-insensitive. + * + * @return the consistencyLevel value + */ + public Object consistencyLevel() { + return this.consistencyLevel; + } + + /** + * Set the consistency level specifies how many Cassandra servers must respond to a read request before returning data to the client application. Cassandra checks the specified number of Cassandra servers for data to satisfy the read request. Must be one of cassandraSourceReadConsistencyLevels. The default value is 'ONE'. It is case-insensitive. + * + * @param consistencyLevel the consistencyLevel value to set + * @return the CassandraSource object itself. + */ + public CassandraSource withConsistencyLevel(Object consistencyLevel) { + this.consistencyLevel = consistencyLevel; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CassandraTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CassandraTableDataset.java new file mode 100644 index 000000000000..d1429a1d4661 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CassandraTableDataset.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The Cassandra database dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("CassandraTable") +@JsonFlatten +public class CassandraTableDataset extends DatasetInner { + /** + * The table name of the Cassandra database. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.tableName") + private Object tableName; + + /** + * The keyspace of the Cassandra database. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.keyspace") + private Object keyspace; + + /** + * Get the table name of the Cassandra database. Type: string (or Expression with resultType string). + * + * @return the tableName value + */ + public Object tableName() { + return this.tableName; + } + + /** + * Set the table name of the Cassandra database. Type: string (or Expression with resultType string). + * + * @param tableName the tableName value to set + * @return the CassandraTableDataset object itself. + */ + public CassandraTableDataset withTableName(Object tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the keyspace of the Cassandra database. Type: string (or Expression with resultType string). + * + * @return the keyspace value + */ + public Object keyspace() { + return this.keyspace; + } + + /** + * Set the keyspace of the Cassandra database. Type: string (or Expression with resultType string). + * + * @param keyspace the keyspace value to set + * @return the CassandraTableDataset object itself. + */ + public CassandraTableDataset withKeyspace(Object keyspace) { + this.keyspace = keyspace; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ConcurLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ConcurLinkedService.java new file mode 100644 index 000000000000..73318750647e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ConcurLinkedService.java @@ -0,0 +1,213 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Concur Service linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Concur") +@JsonFlatten +public class ConcurLinkedService extends LinkedServiceInner { + /** + * Application client_id supplied by Concur App Management. + */ + @JsonProperty(value = "typeProperties.clientId", required = true) + private Object clientId; + + /** + * The user name that you use to access Concur Service. + */ + @JsonProperty(value = "typeProperties.username", required = true) + private Object username; + + /** + * The password corresponding to the user name that you provided in the + * username field. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get application client_id supplied by Concur App Management. + * + * @return the clientId value + */ + public Object clientId() { + return this.clientId; + } + + /** + * Set application client_id supplied by Concur App Management. + * + * @param clientId the clientId value to set + * @return the ConcurLinkedService object itself. + */ + public ConcurLinkedService withClientId(Object clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the user name that you use to access Concur Service. + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the user name that you use to access Concur Service. + * + * @param username the username value to set + * @return the ConcurLinkedService object itself. + */ + public ConcurLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password corresponding to the user name that you provided in the username field. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password corresponding to the user name that you provided in the username field. + * + * @param password the password value to set + * @return the ConcurLinkedService object itself. + */ + public ConcurLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the ConcurLinkedService object itself. + */ + public ConcurLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the ConcurLinkedService object itself. + */ + public ConcurLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the ConcurLinkedService object itself. + */ + public ConcurLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the ConcurLinkedService object itself. + */ + public ConcurLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ConcurObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ConcurObjectDataset.java new file mode 100644 index 000000000000..f9aa1daf0b60 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ConcurObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Concur Service dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ConcurObject") +public class ConcurObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ConcurSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ConcurSource.java new file mode 100644 index 000000000000..5c6d2f3bdd21 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ConcurSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Concur Service source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ConcurSource") +public class ConcurSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the ConcurSource object itself. + */ + public ConcurSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ControlActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ControlActivity.java new file mode 100644 index 000000000000..6538f50b51ab --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ControlActivity.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Base class for all control activities like IfCondition, ForEach , Until. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Container") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Filter", value = FilterActivity.class), + @JsonSubTypes.Type(name = "Until", value = UntilActivity.class), + @JsonSubTypes.Type(name = "Wait", value = WaitActivity.class), + @JsonSubTypes.Type(name = "ForEach", value = ForEachActivity.class), + @JsonSubTypes.Type(name = "IfCondition", value = IfConditionActivity.class), + @JsonSubTypes.Type(name = "ExecutePipeline", value = ExecutePipelineActivity.class) +}) +public class ControlActivity extends Activity { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CopyActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CopyActivity.java new file mode 100644 index 000000000000..0555f3b06489 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CopyActivity.java @@ -0,0 +1,317 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Copy activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Copy") +@JsonFlatten +public class CopyActivity extends ExecutionActivity { + /** + * Copy activity source. + */ + @JsonProperty(value = "typeProperties.source", required = true) + private CopySource source; + + /** + * Copy activity sink. + */ + @JsonProperty(value = "typeProperties.sink", required = true) + private CopySink sink; + + /** + * Copy activity translator. If not specified, tabular translator is used. + */ + @JsonProperty(value = "typeProperties.translator") + private Object translator; + + /** + * Specifies whether to copy data via an interim staging. Default value is + * false. Type: boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "typeProperties.enableStaging") + private Object enableStaging; + + /** + * Specifies interim staging settings when EnableStaging is true. + */ + @JsonProperty(value = "typeProperties.stagingSettings") + private StagingSettings stagingSettings; + + /** + * Maximum number of concurrent sessions opened on the source or sink to + * avoid overloading the data store. Type: integer (or Expression with + * resultType integer), minimum: 0. + */ + @JsonProperty(value = "typeProperties.parallelCopies") + private Object parallelCopies; + + /** + * Maximum number of cloud data movement units that can be used to perform + * this data movement. Type: integer (or Expression with resultType + * integer), minimum: 0. + */ + @JsonProperty(value = "typeProperties.cloudDataMovementUnits") + private Object cloudDataMovementUnits; + + /** + * Whether to skip incompatible row. Default value is false. Type: boolean + * (or Expression with resultType boolean). + */ + @JsonProperty(value = "typeProperties.enableSkipIncompatibleRow") + private Object enableSkipIncompatibleRow; + + /** + * Redirect incompatible row settings when EnableSkipIncompatibleRow is + * true. + */ + @JsonProperty(value = "typeProperties.redirectIncompatibleRowSettings") + private RedirectIncompatibleRowSettings redirectIncompatibleRowSettings; + + /** + * List of inputs for the activity. + */ + @JsonProperty(value = "inputs") + private List inputs; + + /** + * List of outputs for the activity. + */ + @JsonProperty(value = "outputs") + private List outputs; + + /** + * Get copy activity source. + * + * @return the source value + */ + public CopySource source() { + return this.source; + } + + /** + * Set copy activity source. + * + * @param source the source value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withSource(CopySource source) { + this.source = source; + return this; + } + + /** + * Get copy activity sink. + * + * @return the sink value + */ + public CopySink sink() { + return this.sink; + } + + /** + * Set copy activity sink. + * + * @param sink the sink value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withSink(CopySink sink) { + this.sink = sink; + return this; + } + + /** + * Get copy activity translator. If not specified, tabular translator is used. + * + * @return the translator value + */ + public Object translator() { + return this.translator; + } + + /** + * Set copy activity translator. If not specified, tabular translator is used. + * + * @param translator the translator value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withTranslator(Object translator) { + this.translator = translator; + return this; + } + + /** + * Get specifies whether to copy data via an interim staging. Default value is false. Type: boolean (or Expression with resultType boolean). + * + * @return the enableStaging value + */ + public Object enableStaging() { + return this.enableStaging; + } + + /** + * Set specifies whether to copy data via an interim staging. Default value is false. Type: boolean (or Expression with resultType boolean). + * + * @param enableStaging the enableStaging value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withEnableStaging(Object enableStaging) { + this.enableStaging = enableStaging; + return this; + } + + /** + * Get specifies interim staging settings when EnableStaging is true. + * + * @return the stagingSettings value + */ + public StagingSettings stagingSettings() { + return this.stagingSettings; + } + + /** + * Set specifies interim staging settings when EnableStaging is true. + * + * @param stagingSettings the stagingSettings value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withStagingSettings(StagingSettings stagingSettings) { + this.stagingSettings = stagingSettings; + return this; + } + + /** + * Get maximum number of concurrent sessions opened on the source or sink to avoid overloading the data store. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the parallelCopies value + */ + public Object parallelCopies() { + return this.parallelCopies; + } + + /** + * Set maximum number of concurrent sessions opened on the source or sink to avoid overloading the data store. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param parallelCopies the parallelCopies value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withParallelCopies(Object parallelCopies) { + this.parallelCopies = parallelCopies; + return this; + } + + /** + * Get maximum number of cloud data movement units that can be used to perform this data movement. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the cloudDataMovementUnits value + */ + public Object cloudDataMovementUnits() { + return this.cloudDataMovementUnits; + } + + /** + * Set maximum number of cloud data movement units that can be used to perform this data movement. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param cloudDataMovementUnits the cloudDataMovementUnits value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withCloudDataMovementUnits(Object cloudDataMovementUnits) { + this.cloudDataMovementUnits = cloudDataMovementUnits; + return this; + } + + /** + * Get whether to skip incompatible row. Default value is false. Type: boolean (or Expression with resultType boolean). + * + * @return the enableSkipIncompatibleRow value + */ + public Object enableSkipIncompatibleRow() { + return this.enableSkipIncompatibleRow; + } + + /** + * Set whether to skip incompatible row. Default value is false. Type: boolean (or Expression with resultType boolean). + * + * @param enableSkipIncompatibleRow the enableSkipIncompatibleRow value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withEnableSkipIncompatibleRow(Object enableSkipIncompatibleRow) { + this.enableSkipIncompatibleRow = enableSkipIncompatibleRow; + return this; + } + + /** + * Get redirect incompatible row settings when EnableSkipIncompatibleRow is true. + * + * @return the redirectIncompatibleRowSettings value + */ + public RedirectIncompatibleRowSettings redirectIncompatibleRowSettings() { + return this.redirectIncompatibleRowSettings; + } + + /** + * Set redirect incompatible row settings when EnableSkipIncompatibleRow is true. + * + * @param redirectIncompatibleRowSettings the redirectIncompatibleRowSettings value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withRedirectIncompatibleRowSettings(RedirectIncompatibleRowSettings redirectIncompatibleRowSettings) { + this.redirectIncompatibleRowSettings = redirectIncompatibleRowSettings; + return this; + } + + /** + * Get list of inputs for the activity. + * + * @return the inputs value + */ + public List inputs() { + return this.inputs; + } + + /** + * Set list of inputs for the activity. + * + * @param inputs the inputs value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withInputs(List inputs) { + this.inputs = inputs; + return this; + } + + /** + * Get list of outputs for the activity. + * + * @return the outputs value + */ + public List outputs() { + return this.outputs; + } + + /** + * Set list of outputs for the activity. + * + * @param outputs the outputs value to set + * @return the CopyActivity object itself. + */ + public CopyActivity withOutputs(List outputs) { + this.outputs = outputs; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CopySink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CopySink.java new file mode 100644 index 000000000000..94d92848506e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CopySink.java @@ -0,0 +1,172 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * A copy activity sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("CopySink") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "SalesforceSink", value = SalesforceSink.class), + @JsonSubTypes.Type(name = "DynamicsSink", value = DynamicsSink.class), + @JsonSubTypes.Type(name = "OdbcSink", value = OdbcSink.class), + @JsonSubTypes.Type(name = "AzureSearchIndexSink", value = AzureSearchIndexSink.class), + @JsonSubTypes.Type(name = "AzureDataLakeStoreSink", value = AzureDataLakeStoreSink.class), + @JsonSubTypes.Type(name = "OracleSink", value = OracleSink.class), + @JsonSubTypes.Type(name = "SqlDWSink", value = SqlDWSink.class), + @JsonSubTypes.Type(name = "SqlSink", value = SqlSink.class), + @JsonSubTypes.Type(name = "DocumentDbCollectionSink", value = DocumentDbCollectionSink.class), + @JsonSubTypes.Type(name = "FileSystemSink", value = FileSystemSink.class), + @JsonSubTypes.Type(name = "BlobSink", value = BlobSink.class), + @JsonSubTypes.Type(name = "AzureTableSink", value = AzureTableSink.class), + @JsonSubTypes.Type(name = "AzureQueueSink", value = AzureQueueSink.class), + @JsonSubTypes.Type(name = "SapCloudForCustomerSink", value = SapCloudForCustomerSink.class) +}) +public class CopySink { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Write batch size. Type: integer (or Expression with resultType integer), + * minimum: 0. + */ + @JsonProperty(value = "writeBatchSize") + private Object writeBatchSize; + + /** + * Write batch timeout. Type: string (or Expression with resultType + * string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + */ + @JsonProperty(value = "writeBatchTimeout") + private Object writeBatchTimeout; + + /** + * Sink retry count. Type: integer (or Expression with resultType integer). + */ + @JsonProperty(value = "sinkRetryCount") + private Object sinkRetryCount; + + /** + * Sink retry wait. Type: string (or Expression with resultType string), + * pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + */ + @JsonProperty(value = "sinkRetryWait") + private Object sinkRetryWait; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the CopySink object itself. + */ + public CopySink withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get write batch size. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the writeBatchSize value + */ + public Object writeBatchSize() { + return this.writeBatchSize; + } + + /** + * Set write batch size. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param writeBatchSize the writeBatchSize value to set + * @return the CopySink object itself. + */ + public CopySink withWriteBatchSize(Object writeBatchSize) { + this.writeBatchSize = writeBatchSize; + return this; + } + + /** + * Get write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @return the writeBatchTimeout value + */ + public Object writeBatchTimeout() { + return this.writeBatchTimeout; + } + + /** + * Set write batch timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @param writeBatchTimeout the writeBatchTimeout value to set + * @return the CopySink object itself. + */ + public CopySink withWriteBatchTimeout(Object writeBatchTimeout) { + this.writeBatchTimeout = writeBatchTimeout; + return this; + } + + /** + * Get sink retry count. Type: integer (or Expression with resultType integer). + * + * @return the sinkRetryCount value + */ + public Object sinkRetryCount() { + return this.sinkRetryCount; + } + + /** + * Set sink retry count. Type: integer (or Expression with resultType integer). + * + * @param sinkRetryCount the sinkRetryCount value to set + * @return the CopySink object itself. + */ + public CopySink withSinkRetryCount(Object sinkRetryCount) { + this.sinkRetryCount = sinkRetryCount; + return this; + } + + /** + * Get sink retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @return the sinkRetryWait value + */ + public Object sinkRetryWait() { + return this.sinkRetryWait; + } + + /** + * Set sink retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @param sinkRetryWait the sinkRetryWait value to set + * @return the CopySink object itself. + */ + public CopySink withSinkRetryWait(Object sinkRetryWait) { + this.sinkRetryWait = sinkRetryWait; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CopySource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CopySource.java new file mode 100644 index 000000000000..e2975507b90a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CopySource.java @@ -0,0 +1,155 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * A copy activity source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("CopySource") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "AmazonRedshiftSource", value = AmazonRedshiftSource.class), + @JsonSubTypes.Type(name = "ResponsysSource", value = ResponsysSource.class), + @JsonSubTypes.Type(name = "SalesforceMarketingCloudSource", value = SalesforceMarketingCloudSource.class), + @JsonSubTypes.Type(name = "VerticaSource", value = VerticaSource.class), + @JsonSubTypes.Type(name = "NetezzaSource", value = NetezzaSource.class), + @JsonSubTypes.Type(name = "ZohoSource", value = ZohoSource.class), + @JsonSubTypes.Type(name = "XeroSource", value = XeroSource.class), + @JsonSubTypes.Type(name = "SquareSource", value = SquareSource.class), + @JsonSubTypes.Type(name = "SparkSource", value = SparkSource.class), + @JsonSubTypes.Type(name = "ShopifySource", value = ShopifySource.class), + @JsonSubTypes.Type(name = "ServiceNowSource", value = ServiceNowSource.class), + @JsonSubTypes.Type(name = "QuickBooksSource", value = QuickBooksSource.class), + @JsonSubTypes.Type(name = "PrestoSource", value = PrestoSource.class), + @JsonSubTypes.Type(name = "PhoenixSource", value = PhoenixSource.class), + @JsonSubTypes.Type(name = "PaypalSource", value = PaypalSource.class), + @JsonSubTypes.Type(name = "MarketoSource", value = MarketoSource.class), + @JsonSubTypes.Type(name = "MariaDBSource", value = MariaDBSource.class), + @JsonSubTypes.Type(name = "MagentoSource", value = MagentoSource.class), + @JsonSubTypes.Type(name = "JiraSource", value = JiraSource.class), + @JsonSubTypes.Type(name = "ImpalaSource", value = ImpalaSource.class), + @JsonSubTypes.Type(name = "HubspotSource", value = HubspotSource.class), + @JsonSubTypes.Type(name = "HiveSource", value = HiveSource.class), + @JsonSubTypes.Type(name = "HBaseSource", value = HBaseSource.class), + @JsonSubTypes.Type(name = "GreenplumSource", value = GreenplumSource.class), + @JsonSubTypes.Type(name = "GoogleBigQuerySource", value = GoogleBigQuerySource.class), + @JsonSubTypes.Type(name = "EloquaSource", value = EloquaSource.class), + @JsonSubTypes.Type(name = "DrillSource", value = DrillSource.class), + @JsonSubTypes.Type(name = "CouchbaseSource", value = CouchbaseSource.class), + @JsonSubTypes.Type(name = "ConcurSource", value = ConcurSource.class), + @JsonSubTypes.Type(name = "AzurePostgreSqlSource", value = AzurePostgreSqlSource.class), + @JsonSubTypes.Type(name = "AmazonMWSSource", value = AmazonMWSSource.class), + @JsonSubTypes.Type(name = "HttpSource", value = HttpSource.class), + @JsonSubTypes.Type(name = "AzureDataLakeStoreSource", value = AzureDataLakeStoreSource.class), + @JsonSubTypes.Type(name = "MongoDbSource", value = MongoDbSource.class), + @JsonSubTypes.Type(name = "CassandraSource", value = CassandraSource.class), + @JsonSubTypes.Type(name = "WebSource", value = WebSource.class), + @JsonSubTypes.Type(name = "OracleSource", value = OracleSource.class), + @JsonSubTypes.Type(name = "AzureMySqlSource", value = AzureMySqlSource.class), + @JsonSubTypes.Type(name = "HdfsSource", value = HdfsSource.class), + @JsonSubTypes.Type(name = "FileSystemSource", value = FileSystemSource.class), + @JsonSubTypes.Type(name = "SqlDWSource", value = SqlDWSource.class), + @JsonSubTypes.Type(name = "SqlSource", value = SqlSource.class), + @JsonSubTypes.Type(name = "SapEccSource", value = SapEccSource.class), + @JsonSubTypes.Type(name = "SapCloudForCustomerSource", value = SapCloudForCustomerSource.class), + @JsonSubTypes.Type(name = "SalesforceSource", value = SalesforceSource.class), + @JsonSubTypes.Type(name = "RelationalSource", value = RelationalSource.class), + @JsonSubTypes.Type(name = "DynamicsSource", value = DynamicsSource.class), + @JsonSubTypes.Type(name = "DocumentDbCollectionSource", value = DocumentDbCollectionSource.class), + @JsonSubTypes.Type(name = "BlobSource", value = BlobSource.class), + @JsonSubTypes.Type(name = "AzureTableSource", value = AzureTableSource.class) +}) +public class CopySource { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Source retry count. Type: integer (or Expression with resultType + * integer). + */ + @JsonProperty(value = "sourceRetryCount") + private Object sourceRetryCount; + + /** + * Source retry wait. Type: string (or Expression with resultType string), + * pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + */ + @JsonProperty(value = "sourceRetryWait") + private Object sourceRetryWait; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the CopySource object itself. + */ + public CopySource withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get source retry count. Type: integer (or Expression with resultType integer). + * + * @return the sourceRetryCount value + */ + public Object sourceRetryCount() { + return this.sourceRetryCount; + } + + /** + * Set source retry count. Type: integer (or Expression with resultType integer). + * + * @param sourceRetryCount the sourceRetryCount value to set + * @return the CopySource object itself. + */ + public CopySource withSourceRetryCount(Object sourceRetryCount) { + this.sourceRetryCount = sourceRetryCount; + return this; + } + + /** + * Get source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @return the sourceRetryWait value + */ + public Object sourceRetryWait() { + return this.sourceRetryWait; + } + + /** + * Set source retry wait. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @param sourceRetryWait the sourceRetryWait value to set + * @return the CopySource object itself. + */ + public CopySource withSourceRetryWait(Object sourceRetryWait) { + this.sourceRetryWait = sourceRetryWait; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CosmosDbLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CosmosDbLinkedService.java new file mode 100644 index 000000000000..e0d5e6d96f0d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CosmosDbLinkedService.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Microsoft Azure Cosmos Database (CosmosDB) linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("CosmosDb") +@JsonFlatten +public class CosmosDbLinkedService extends LinkedServiceInner { + /** + * The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString", required = true) + private Object connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the CosmosDbLinkedService object itself. + */ + public CosmosDbLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the CosmosDbLinkedService object itself. + */ + public CosmosDbLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CouchbaseLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CouchbaseLinkedService.java new file mode 100644 index 000000000000..8e7dc70cc298 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CouchbaseLinkedService.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Couchbase server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Couchbase") +@JsonFlatten +public class CouchbaseLinkedService extends LinkedServiceInner { + /** + * An ODBC connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString") + private Object connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the CouchbaseLinkedService object itself. + */ + public CouchbaseLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the CouchbaseLinkedService object itself. + */ + public CouchbaseLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CouchbaseSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CouchbaseSource.java new file mode 100644 index 000000000000..36827fe573c4 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CouchbaseSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Couchbase server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("CouchbaseSource") +public class CouchbaseSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the CouchbaseSource object itself. + */ + public CouchbaseSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CouchbaseTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CouchbaseTableDataset.java new file mode 100644 index 000000000000..c194dfe24c13 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CouchbaseTableDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Couchbase server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("CouchbaseTable") +public class CouchbaseTableDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CreateRunResponse.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CreateRunResponse.java new file mode 100644 index 000000000000..e3e457261ddb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CreateRunResponse.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.CreateRunResponseInner; + +/** + * Type representing CreateRunResponse. + */ +public interface CreateRunResponse extends HasInner, HasManager { + /** + * @return the runId value. + */ + String runId(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomActivity.java new file mode 100644 index 000000000000..8302ce27c79a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomActivity.java @@ -0,0 +1,158 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Custom activity type. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Custom") +@JsonFlatten +public class CustomActivity extends ExecutionActivity { + /** + * Command for custom activity Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.command", required = true) + private Object command; + + /** + * Resource linked service reference. + */ + @JsonProperty(value = "typeProperties.resourceLinkedService") + private LinkedServiceReference resourceLinkedService; + + /** + * Folder path for resource files Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.folderPath") + private Object folderPath; + + /** + * Reference objects. + */ + @JsonProperty(value = "typeProperties.referenceObjects") + private CustomActivityReferenceObject referenceObjects; + + /** + * User defined property bag. There is no restriction on the keys or values + * that can be used. The user specified custom activity has the full + * responsibility to consume and interpret the content defined. + */ + @JsonProperty(value = "typeProperties.extendedProperties") + private Map extendedProperties; + + /** + * Get command for custom activity Type: string (or Expression with resultType string). + * + * @return the command value + */ + public Object command() { + return this.command; + } + + /** + * Set command for custom activity Type: string (or Expression with resultType string). + * + * @param command the command value to set + * @return the CustomActivity object itself. + */ + public CustomActivity withCommand(Object command) { + this.command = command; + return this; + } + + /** + * Get resource linked service reference. + * + * @return the resourceLinkedService value + */ + public LinkedServiceReference resourceLinkedService() { + return this.resourceLinkedService; + } + + /** + * Set resource linked service reference. + * + * @param resourceLinkedService the resourceLinkedService value to set + * @return the CustomActivity object itself. + */ + public CustomActivity withResourceLinkedService(LinkedServiceReference resourceLinkedService) { + this.resourceLinkedService = resourceLinkedService; + return this; + } + + /** + * Get folder path for resource files Type: string (or Expression with resultType string). + * + * @return the folderPath value + */ + public Object folderPath() { + return this.folderPath; + } + + /** + * Set folder path for resource files Type: string (or Expression with resultType string). + * + * @param folderPath the folderPath value to set + * @return the CustomActivity object itself. + */ + public CustomActivity withFolderPath(Object folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get reference objects. + * + * @return the referenceObjects value + */ + public CustomActivityReferenceObject referenceObjects() { + return this.referenceObjects; + } + + /** + * Set reference objects. + * + * @param referenceObjects the referenceObjects value to set + * @return the CustomActivity object itself. + */ + public CustomActivity withReferenceObjects(CustomActivityReferenceObject referenceObjects) { + this.referenceObjects = referenceObjects; + return this; + } + + /** + * Get user defined property bag. There is no restriction on the keys or values that can be used. The user specified custom activity has the full responsibility to consume and interpret the content defined. + * + * @return the extendedProperties value + */ + public Map extendedProperties() { + return this.extendedProperties; + } + + /** + * Set user defined property bag. There is no restriction on the keys or values that can be used. The user specified custom activity has the full responsibility to consume and interpret the content defined. + * + * @param extendedProperties the extendedProperties value to set + * @return the CustomActivity object itself. + */ + public CustomActivity withExtendedProperties(Map extendedProperties) { + this.extendedProperties = extendedProperties; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomActivityReferenceObject.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomActivityReferenceObject.java new file mode 100644 index 000000000000..494dcbc172d2 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomActivityReferenceObject.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Reference objects for custom activity. + */ +public class CustomActivityReferenceObject { + /** + * Linked service references. + */ + @JsonProperty(value = "linkedServices") + private List linkedServices; + + /** + * Dataset references. + */ + @JsonProperty(value = "datasets") + private List datasets; + + /** + * Get linked service references. + * + * @return the linkedServices value + */ + public List linkedServices() { + return this.linkedServices; + } + + /** + * Set linked service references. + * + * @param linkedServices the linkedServices value to set + * @return the CustomActivityReferenceObject object itself. + */ + public CustomActivityReferenceObject withLinkedServices(List linkedServices) { + this.linkedServices = linkedServices; + return this; + } + + /** + * Get dataset references. + * + * @return the datasets value + */ + public List datasets() { + return this.datasets; + } + + /** + * Set dataset references. + * + * @param datasets the datasets value to set + * @return the CustomActivityReferenceObject object itself. + */ + public CustomActivityReferenceObject withDatasets(List datasets) { + this.datasets = datasets; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomDataSourceLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomDataSourceLinkedService.java new file mode 100644 index 000000000000..b8dec1c0b3b0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomDataSourceLinkedService.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Custom linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("CustomDataSource") +public class CustomDataSourceLinkedService extends LinkedServiceInner { + /** + * Custom linked service properties. + */ + @JsonProperty(value = "typeProperties", required = true) + private Object typeProperties; + + /** + * Get custom linked service properties. + * + * @return the typeProperties value + */ + public Object typeProperties() { + return this.typeProperties; + } + + /** + * Set custom linked service properties. + * + * @param typeProperties the typeProperties value to set + * @return the CustomDataSourceLinkedService object itself. + */ + public CustomDataSourceLinkedService withTypeProperties(Object typeProperties) { + this.typeProperties = typeProperties; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomDataset.java new file mode 100644 index 000000000000..5155a59ba2ab --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/CustomDataset.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The custom dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("CustomDataset") +public class CustomDataset extends DatasetInner { + /** + * Custom dataset properties. + */ + @JsonProperty(value = "typeProperties", required = true) + private Object typeProperties; + + /** + * Get custom dataset properties. + * + * @return the typeProperties value + */ + public Object typeProperties() { + return this.typeProperties; + } + + /** + * Set custom dataset properties. + * + * @param typeProperties the typeProperties value to set + * @return the CustomDataset object itself. + */ + public CustomDataset withTypeProperties(Object typeProperties) { + this.typeProperties = typeProperties; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DataLakeAnalyticsUSQLActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DataLakeAnalyticsUSQLActivity.java new file mode 100644 index 000000000000..1c182138ae11 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DataLakeAnalyticsUSQLActivity.java @@ -0,0 +1,214 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Data Lake Analytics U-SQL activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DataLakeAnalyticsU-SQL") +@JsonFlatten +public class DataLakeAnalyticsUSQLActivity extends ExecutionActivity { + /** + * Case-sensitive path to folder that contains the U-SQL script. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.scriptPath", required = true) + private Object scriptPath; + + /** + * Script linked service reference. + */ + @JsonProperty(value = "typeProperties.scriptLinkedService", required = true) + private LinkedServiceReference scriptLinkedService; + + /** + * The maximum number of nodes simultaneously used to run the job. Default + * value is 1. Type: integer (or Expression with resultType integer), + * minimum: 1. + */ + @JsonProperty(value = "typeProperties.degreeOfParallelism") + private Object degreeOfParallelism; + + /** + * Determines which jobs out of all that are queued should be selected to + * run first. The lower the number, the higher the priority. Default value + * is 1000. Type: integer (or Expression with resultType integer), minimum: + * 1. + */ + @JsonProperty(value = "typeProperties.priority") + private Object priority; + + /** + * Parameters for U-SQL job request. + */ + @JsonProperty(value = "typeProperties.parameters") + private Map parameters; + + /** + * Runtime version of the U-SQL engine to use. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.runtimeVersion") + private Object runtimeVersion; + + /** + * Compilation mode of U-SQL. Must be one of these values : Semantic, Full + * and SingleBox. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.compilationMode") + private Object compilationMode; + + /** + * Get case-sensitive path to folder that contains the U-SQL script. Type: string (or Expression with resultType string). + * + * @return the scriptPath value + */ + public Object scriptPath() { + return this.scriptPath; + } + + /** + * Set case-sensitive path to folder that contains the U-SQL script. Type: string (or Expression with resultType string). + * + * @param scriptPath the scriptPath value to set + * @return the DataLakeAnalyticsUSQLActivity object itself. + */ + public DataLakeAnalyticsUSQLActivity withScriptPath(Object scriptPath) { + this.scriptPath = scriptPath; + return this; + } + + /** + * Get script linked service reference. + * + * @return the scriptLinkedService value + */ + public LinkedServiceReference scriptLinkedService() { + return this.scriptLinkedService; + } + + /** + * Set script linked service reference. + * + * @param scriptLinkedService the scriptLinkedService value to set + * @return the DataLakeAnalyticsUSQLActivity object itself. + */ + public DataLakeAnalyticsUSQLActivity withScriptLinkedService(LinkedServiceReference scriptLinkedService) { + this.scriptLinkedService = scriptLinkedService; + return this; + } + + /** + * Get the maximum number of nodes simultaneously used to run the job. Default value is 1. Type: integer (or Expression with resultType integer), minimum: 1. + * + * @return the degreeOfParallelism value + */ + public Object degreeOfParallelism() { + return this.degreeOfParallelism; + } + + /** + * Set the maximum number of nodes simultaneously used to run the job. Default value is 1. Type: integer (or Expression with resultType integer), minimum: 1. + * + * @param degreeOfParallelism the degreeOfParallelism value to set + * @return the DataLakeAnalyticsUSQLActivity object itself. + */ + public DataLakeAnalyticsUSQLActivity withDegreeOfParallelism(Object degreeOfParallelism) { + this.degreeOfParallelism = degreeOfParallelism; + return this; + } + + /** + * Get determines which jobs out of all that are queued should be selected to run first. The lower the number, the higher the priority. Default value is 1000. Type: integer (or Expression with resultType integer), minimum: 1. + * + * @return the priority value + */ + public Object priority() { + return this.priority; + } + + /** + * Set determines which jobs out of all that are queued should be selected to run first. The lower the number, the higher the priority. Default value is 1000. Type: integer (or Expression with resultType integer), minimum: 1. + * + * @param priority the priority value to set + * @return the DataLakeAnalyticsUSQLActivity object itself. + */ + public DataLakeAnalyticsUSQLActivity withPriority(Object priority) { + this.priority = priority; + return this; + } + + /** + * Get parameters for U-SQL job request. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set parameters for U-SQL job request. + * + * @param parameters the parameters value to set + * @return the DataLakeAnalyticsUSQLActivity object itself. + */ + public DataLakeAnalyticsUSQLActivity withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get runtime version of the U-SQL engine to use. Type: string (or Expression with resultType string). + * + * @return the runtimeVersion value + */ + public Object runtimeVersion() { + return this.runtimeVersion; + } + + /** + * Set runtime version of the U-SQL engine to use. Type: string (or Expression with resultType string). + * + * @param runtimeVersion the runtimeVersion value to set + * @return the DataLakeAnalyticsUSQLActivity object itself. + */ + public DataLakeAnalyticsUSQLActivity withRuntimeVersion(Object runtimeVersion) { + this.runtimeVersion = runtimeVersion; + return this; + } + + /** + * Get compilation mode of U-SQL. Must be one of these values : Semantic, Full and SingleBox. Type: string (or Expression with resultType string). + * + * @return the compilationMode value + */ + public Object compilationMode() { + return this.compilationMode; + } + + /** + * Set compilation mode of U-SQL. Must be one of these values : Semantic, Full and SingleBox. Type: string (or Expression with resultType string). + * + * @param compilationMode the compilationMode value to set + * @return the DataLakeAnalyticsUSQLActivity object itself. + */ + public DataLakeAnalyticsUSQLActivity withCompilationMode(Object compilationMode) { + this.compilationMode = compilationMode; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatabricksNotebookActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatabricksNotebookActivity.java new file mode 100644 index 000000000000..920e92a03576 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatabricksNotebookActivity.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * DatabricksNotebook activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DatabricksNotebook") +@JsonFlatten +public class DatabricksNotebookActivity extends ExecutionActivity { + /** + * The absolute path of the notebook to be run in the Databricks Workspace. + * This path must begin with a slash. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.notebookPath", required = true) + private Object notebookPath; + + /** + * Base parameters to be used for each run of this job.If the notebook + * takes a parameter that is not specified, the default value from the + * notebook will be used. + */ + @JsonProperty(value = "typeProperties.baseParameters") + private Map baseParameters; + + /** + * Get the absolute path of the notebook to be run in the Databricks Workspace. This path must begin with a slash. Type: string (or Expression with resultType string). + * + * @return the notebookPath value + */ + public Object notebookPath() { + return this.notebookPath; + } + + /** + * Set the absolute path of the notebook to be run in the Databricks Workspace. This path must begin with a slash. Type: string (or Expression with resultType string). + * + * @param notebookPath the notebookPath value to set + * @return the DatabricksNotebookActivity object itself. + */ + public DatabricksNotebookActivity withNotebookPath(Object notebookPath) { + this.notebookPath = notebookPath; + return this; + } + + /** + * Get base parameters to be used for each run of this job.If the notebook takes a parameter that is not specified, the default value from the notebook will be used. + * + * @return the baseParameters value + */ + public Map baseParameters() { + return this.baseParameters; + } + + /** + * Set base parameters to be used for each run of this job.If the notebook takes a parameter that is not specified, the default value from the notebook will be used. + * + * @param baseParameters the baseParameters value to set + * @return the DatabricksNotebookActivity object itself. + */ + public DatabricksNotebookActivity withBaseParameters(Map baseParameters) { + this.baseParameters = baseParameters; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetBZip2Compression.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetBZip2Compression.java new file mode 100644 index 000000000000..93544ae27755 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetBZip2Compression.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The BZip2 compression method used on a dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("BZip2") +public class DatasetBZip2Compression extends DatasetCompression { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetCompression.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetCompression.java new file mode 100644 index 000000000000..3fe22d349f7a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetCompression.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The compression method used on a dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DatasetCompression") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ZipDeflate", value = DatasetZipDeflateCompression.class), + @JsonSubTypes.Type(name = "Deflate", value = DatasetDeflateCompression.class), + @JsonSubTypes.Type(name = "GZip", value = DatasetGZipCompression.class), + @JsonSubTypes.Type(name = "BZip2", value = DatasetBZip2Compression.class) +}) +public class DatasetCompression { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the DatasetCompression object itself. + */ + public DatasetCompression withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetDeflateCompression.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetDeflateCompression.java new file mode 100644 index 000000000000..274b0f71133b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetDeflateCompression.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The Deflate compression method used on a dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Deflate") +public class DatasetDeflateCompression extends DatasetCompression { + /** + * The Deflate compression level. + */ + @JsonProperty(value = "level") + private Object level; + + /** + * Get the Deflate compression level. + * + * @return the level value + */ + public Object level() { + return this.level; + } + + /** + * Set the Deflate compression level. + * + * @param level the level value to set + * @return the DatasetDeflateCompression object itself. + */ + public DatasetDeflateCompression withLevel(Object level) { + this.level = level; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetGZipCompression.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetGZipCompression.java new file mode 100644 index 000000000000..a51d35a6523b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetGZipCompression.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The GZip compression method used on a dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("GZip") +public class DatasetGZipCompression extends DatasetCompression { + /** + * The GZip compression level. + */ + @JsonProperty(value = "level") + private Object level; + + /** + * Get the GZip compression level. + * + * @return the level value + */ + public Object level() { + return this.level; + } + + /** + * Set the GZip compression level. + * + * @param level the level value to set + * @return the DatasetGZipCompression object itself. + */ + public DatasetGZipCompression withLevel(Object level) { + this.level = level; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetReference.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetReference.java new file mode 100644 index 000000000000..4aeb1b6df3e1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetReference.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Dataset reference type. + */ +public class DatasetReference { + /** + * Dataset reference type. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Reference dataset name. + */ + @JsonProperty(value = "referenceName", required = true) + private String referenceName; + + /** + * Arguments for dataset. + */ + @JsonProperty(value = "parameters") + private Map parameters; + + /** + * Creates an instance of DatasetReference class. + * @param referenceName reference dataset name. + */ + public DatasetReference() { + type = "DatasetReference"; + } + + /** + * Get dataset reference type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set dataset reference type. + * + * @param type the type value to set + * @return the DatasetReference object itself. + */ + public DatasetReference withType(String type) { + this.type = type; + return this; + } + + /** + * Get reference dataset name. + * + * @return the referenceName value + */ + public String referenceName() { + return this.referenceName; + } + + /** + * Set reference dataset name. + * + * @param referenceName the referenceName value to set + * @return the DatasetReference object itself. + */ + public DatasetReference withReferenceName(String referenceName) { + this.referenceName = referenceName; + return this; + } + + /** + * Get arguments for dataset. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set arguments for dataset. + * + * @param parameters the parameters value to set + * @return the DatasetReference object itself. + */ + public DatasetReference withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetResource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetResource.java new file mode 100644 index 000000000000..ea368a4858e6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetResource.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetResourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; +import java.util.Map; +import java.util.List; + +/** + * Type representing DatasetResource. + */ +public interface DatasetResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + DatasetInner properties(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DatasetResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithFactory, DefinitionStages.WithIfMatch, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatasetResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatasetResource definition. + */ + interface Blank extends WithFactory { + } + + /** + * The stage of the datasetresource definition allowing to specify Factory. + */ + interface WithFactory { + /** + * Specifies resourceGroupName, factoryName. + * @param resourceGroupName The resource group name + * @param factoryName The factory name + * @return the next definition stage + */ + WithIfMatch withExistingFactory(String resourceGroupName, String factoryName); + } + + /** + * The stage of the datasetresource definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the dataset entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update + * @return the next definition stage + */ + WithProperties withIfMatch(String ifMatch); + } + + /** + * The stage of the datasetresource definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Dataset properties + * @return the next definition stage + */ + WithCreate withProperties(DatasetInner properties); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a DatasetResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithProperties { + } + + /** + * Grouping of DatasetResource update stages. + */ + interface UpdateStages { + /** + * The stage of the datasetresource update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the dataset entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the datasetresource update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Dataset properties + * @return the next update stage + */ + Update withProperties(DatasetInner properties); + } + + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetStorageFormat.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetStorageFormat.java new file mode 100644 index 000000000000..e1b16cb65842 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetStorageFormat.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The format definition of a storage. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DatasetStorageFormat") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ParquetFormat", value = ParquetFormat.class), + @JsonSubTypes.Type(name = "OrcFormat", value = OrcFormat.class), + @JsonSubTypes.Type(name = "AvroFormat", value = AvroFormat.class), + @JsonSubTypes.Type(name = "JsonFormat", value = JsonFormat.class), + @JsonSubTypes.Type(name = "TextFormat", value = TextFormat.class) +}) +public class DatasetStorageFormat { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Serializer. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "serializer") + private Object serializer; + + /** + * Deserializer. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "deserializer") + private Object deserializer; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the DatasetStorageFormat object itself. + */ + public DatasetStorageFormat withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get serializer. Type: string (or Expression with resultType string). + * + * @return the serializer value + */ + public Object serializer() { + return this.serializer; + } + + /** + * Set serializer. Type: string (or Expression with resultType string). + * + * @param serializer the serializer value to set + * @return the DatasetStorageFormat object itself. + */ + public DatasetStorageFormat withSerializer(Object serializer) { + this.serializer = serializer; + return this; + } + + /** + * Get deserializer. Type: string (or Expression with resultType string). + * + * @return the deserializer value + */ + public Object deserializer() { + return this.deserializer; + } + + /** + * Set deserializer. Type: string (or Expression with resultType string). + * + * @param deserializer the deserializer value to set + * @return the DatasetStorageFormat object itself. + */ + public DatasetStorageFormat withDeserializer(Object deserializer) { + this.deserializer = deserializer; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetZipDeflateCompression.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetZipDeflateCompression.java new file mode 100644 index 000000000000..a9553708bb46 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DatasetZipDeflateCompression.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The ZipDeflate compression method used on a dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ZipDeflate") +public class DatasetZipDeflateCompression extends DatasetCompression { + /** + * The ZipDeflate compression level. + */ + @JsonProperty(value = "level") + private Object level; + + /** + * Get the ZipDeflate compression level. + * + * @return the level value + */ + public Object level() { + return this.level; + } + + /** + * Set the ZipDeflate compression level. + * + * @param level the level value to set + * @return the DatasetZipDeflateCompression object itself. + */ + public DatasetZipDeflateCompression withLevel(Object level) { + this.level = level; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Datasets.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Datasets.java new file mode 100644 index 000000000000..769dde976149 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Datasets.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Datasets. + */ +public interface Datasets extends SupportsCreating, HasInner { + /** + * Gets a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String factoryName, String datasetName); + + /** + * Lists datasets. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByFactoryAsync(final String resourceGroupName, final String factoryName); + + /** + * Deletes a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String factoryName, String datasetName); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DayOfWeek.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DayOfWeek.java new file mode 100644 index 000000000000..569d54543d40 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DayOfWeek.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DayOfWeek. + */ +public enum DayOfWeek { + /** Enum value Sunday. */ + SUNDAY("Sunday"), + + /** Enum value Monday. */ + MONDAY("Monday"), + + /** Enum value Tuesday. */ + TUESDAY("Tuesday"), + + /** Enum value Wednesday. */ + WEDNESDAY("Wednesday"), + + /** Enum value Thursday. */ + THURSDAY("Thursday"), + + /** Enum value Friday. */ + FRIDAY("Friday"), + + /** Enum value Saturday. */ + SATURDAY("Saturday"); + + /** The actual serialized value for a DayOfWeek instance. */ + private String value; + + DayOfWeek(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DayOfWeek instance. + * + * @param value the serialized value to parse. + * @return the parsed DayOfWeek object, or null if unable to parse. + */ + @JsonCreator + public static DayOfWeek fromString(String value) { + DayOfWeek[] items = DayOfWeek.values(); + for (DayOfWeek item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DaysOfWeek.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DaysOfWeek.java new file mode 100644 index 000000000000..d305767bd604 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DaysOfWeek.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DaysOfWeek. + */ +public enum DaysOfWeek { + /** Enum value Sunday. */ + SUNDAY("Sunday"), + + /** Enum value Monday. */ + MONDAY("Monday"), + + /** Enum value Tuesday. */ + TUESDAY("Tuesday"), + + /** Enum value Wednesday. */ + WEDNESDAY("Wednesday"), + + /** Enum value Thursday. */ + THURSDAY("Thursday"), + + /** Enum value Friday. */ + FRIDAY("Friday"), + + /** Enum value Saturday. */ + SATURDAY("Saturday"); + + /** The actual serialized value for a DaysOfWeek instance. */ + private String value; + + DaysOfWeek(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DaysOfWeek instance. + * + * @param value the serialized value to parse. + * @return the parsed DaysOfWeek object, or null if unable to parse. + */ + @JsonCreator + public static DaysOfWeek fromString(String value) { + DaysOfWeek[] items = DaysOfWeek.values(); + for (DaysOfWeek item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Db2AuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Db2AuthenticationType.java new file mode 100644 index 000000000000..0ff77b46e665 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Db2AuthenticationType.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Db2AuthenticationType. + */ +public final class Db2AuthenticationType extends ExpandableStringEnum { + /** Static value Basic for Db2AuthenticationType. */ + public static final Db2AuthenticationType BASIC = fromString("Basic"); + + /** + * Creates or finds a Db2AuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding Db2AuthenticationType + */ + @JsonCreator + public static Db2AuthenticationType fromString(String name) { + return fromString(name, Db2AuthenticationType.class); + } + + /** + * @return known Db2AuthenticationType values + */ + public static Collection values() { + return values(Db2AuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Db2LinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Db2LinkedService.java new file mode 100644 index 000000000000..241e8b9f4a5c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Db2LinkedService.java @@ -0,0 +1,186 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for DB2 data source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Db2") +@JsonFlatten +public class Db2LinkedService extends LinkedServiceInner { + /** + * Server name for connection. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.server", required = true) + private Object server; + + /** + * Database name for connection. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.database", required = true) + private Object database; + + /** + * AuthenticationType to be used for connection. Possible values include: + * 'Basic'. + */ + @JsonProperty(value = "typeProperties.authenticationType") + private Db2AuthenticationType authenticationType; + + /** + * Username for authentication. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * Password for authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get server name for connection. Type: string (or Expression with resultType string). + * + * @return the server value + */ + public Object server() { + return this.server; + } + + /** + * Set server name for connection. Type: string (or Expression with resultType string). + * + * @param server the server value to set + * @return the Db2LinkedService object itself. + */ + public Db2LinkedService withServer(Object server) { + this.server = server; + return this; + } + + /** + * Get database name for connection. Type: string (or Expression with resultType string). + * + * @return the database value + */ + public Object database() { + return this.database; + } + + /** + * Set database name for connection. Type: string (or Expression with resultType string). + * + * @param database the database value to set + * @return the Db2LinkedService object itself. + */ + public Db2LinkedService withDatabase(Object database) { + this.database = database; + return this; + } + + /** + * Get authenticationType to be used for connection. Possible values include: 'Basic'. + * + * @return the authenticationType value + */ + public Db2AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set authenticationType to be used for connection. Possible values include: 'Basic'. + * + * @param authenticationType the authenticationType value to set + * @return the Db2LinkedService object itself. + */ + public Db2LinkedService withAuthenticationType(Db2AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get username for authentication. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set username for authentication. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the Db2LinkedService object itself. + */ + public Db2LinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get password for authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password for authentication. + * + * @param password the password value to set + * @return the Db2LinkedService object itself. + */ + public Db2LinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the Db2LinkedService object itself. + */ + public Db2LinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DependencyCondition.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DependencyCondition.java new file mode 100644 index 000000000000..5ded9b209034 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DependencyCondition.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DependencyCondition. + */ +public final class DependencyCondition extends ExpandableStringEnum { + /** Static value Succeeded for DependencyCondition. */ + public static final DependencyCondition SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for DependencyCondition. */ + public static final DependencyCondition FAILED = fromString("Failed"); + + /** Static value Skipped for DependencyCondition. */ + public static final DependencyCondition SKIPPED = fromString("Skipped"); + + /** Static value Completed for DependencyCondition. */ + public static final DependencyCondition COMPLETED = fromString("Completed"); + + /** + * Creates or finds a DependencyCondition from its string representation. + * @param name a name to look for + * @return the corresponding DependencyCondition + */ + @JsonCreator + public static DependencyCondition fromString(String name) { + return fromString(name, DependencyCondition.class); + } + + /** + * @return known DependencyCondition values + */ + public static Collection values() { + return values(DependencyCondition.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DistcpSettings.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DistcpSettings.java new file mode 100644 index 000000000000..7d1f8996bd22 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DistcpSettings.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Distcp settings. + */ +public class DistcpSettings { + /** + * Specifies the Yarn ResourceManager endpoint. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "resourceManagerEndpoint", required = true) + private Object resourceManagerEndpoint; + + /** + * Specifies an existing folder path which will be used to store temp + * Distcp command script. The script file is generated by ADF and will be + * removed after Copy job finished. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "tempScriptPath", required = true) + private Object tempScriptPath; + + /** + * Specifies the Distcp options. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "distcpOptions") + private Object distcpOptions; + + /** + * Get specifies the Yarn ResourceManager endpoint. Type: string (or Expression with resultType string). + * + * @return the resourceManagerEndpoint value + */ + public Object resourceManagerEndpoint() { + return this.resourceManagerEndpoint; + } + + /** + * Set specifies the Yarn ResourceManager endpoint. Type: string (or Expression with resultType string). + * + * @param resourceManagerEndpoint the resourceManagerEndpoint value to set + * @return the DistcpSettings object itself. + */ + public DistcpSettings withResourceManagerEndpoint(Object resourceManagerEndpoint) { + this.resourceManagerEndpoint = resourceManagerEndpoint; + return this; + } + + /** + * Get specifies an existing folder path which will be used to store temp Distcp command script. The script file is generated by ADF and will be removed after Copy job finished. Type: string (or Expression with resultType string). + * + * @return the tempScriptPath value + */ + public Object tempScriptPath() { + return this.tempScriptPath; + } + + /** + * Set specifies an existing folder path which will be used to store temp Distcp command script. The script file is generated by ADF and will be removed after Copy job finished. Type: string (or Expression with resultType string). + * + * @param tempScriptPath the tempScriptPath value to set + * @return the DistcpSettings object itself. + */ + public DistcpSettings withTempScriptPath(Object tempScriptPath) { + this.tempScriptPath = tempScriptPath; + return this; + } + + /** + * Get specifies the Distcp options. Type: string (or Expression with resultType string). + * + * @return the distcpOptions value + */ + public Object distcpOptions() { + return this.distcpOptions; + } + + /** + * Set specifies the Distcp options. Type: string (or Expression with resultType string). + * + * @param distcpOptions the distcpOptions value to set + * @return the DistcpSettings object itself. + */ + public DistcpSettings withDistcpOptions(Object distcpOptions) { + this.distcpOptions = distcpOptions; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DocumentDbCollectionDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DocumentDbCollectionDataset.java new file mode 100644 index 000000000000..f64f948faf88 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DocumentDbCollectionDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Microsoft Azure Document Database Collection dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DocumentDbCollection") +@JsonFlatten +public class DocumentDbCollectionDataset extends DatasetInner { + /** + * Document Database collection name. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.collectionName", required = true) + private Object collectionName; + + /** + * Get document Database collection name. Type: string (or Expression with resultType string). + * + * @return the collectionName value + */ + public Object collectionName() { + return this.collectionName; + } + + /** + * Set document Database collection name. Type: string (or Expression with resultType string). + * + * @param collectionName the collectionName value to set + * @return the DocumentDbCollectionDataset object itself. + */ + public DocumentDbCollectionDataset withCollectionName(Object collectionName) { + this.collectionName = collectionName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DocumentDbCollectionSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DocumentDbCollectionSink.java new file mode 100644 index 000000000000..4972567fc75e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DocumentDbCollectionSink.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Document Database Collection sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DocumentDbCollectionSink") +public class DocumentDbCollectionSink extends CopySink { + /** + * Nested properties separator. Default is . (dot). Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "nestingSeparator") + private Object nestingSeparator; + + /** + * Get nested properties separator. Default is . (dot). Type: string (or Expression with resultType string). + * + * @return the nestingSeparator value + */ + public Object nestingSeparator() { + return this.nestingSeparator; + } + + /** + * Set nested properties separator. Default is . (dot). Type: string (or Expression with resultType string). + * + * @param nestingSeparator the nestingSeparator value to set + * @return the DocumentDbCollectionSink object itself. + */ + public DocumentDbCollectionSink withNestingSeparator(Object nestingSeparator) { + this.nestingSeparator = nestingSeparator; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DocumentDbCollectionSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DocumentDbCollectionSource.java new file mode 100644 index 000000000000..ee4a1a573f51 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DocumentDbCollectionSource.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Document Database Collection source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DocumentDbCollectionSource") +public class DocumentDbCollectionSource extends CopySource { + /** + * Documents query. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Nested properties separator. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "nestingSeparator") + private Object nestingSeparator; + + /** + * Get documents query. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set documents query. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the DocumentDbCollectionSource object itself. + */ + public DocumentDbCollectionSource withQuery(Object query) { + this.query = query; + return this; + } + + /** + * Get nested properties separator. Type: string (or Expression with resultType string). + * + * @return the nestingSeparator value + */ + public Object nestingSeparator() { + return this.nestingSeparator; + } + + /** + * Set nested properties separator. Type: string (or Expression with resultType string). + * + * @param nestingSeparator the nestingSeparator value to set + * @return the DocumentDbCollectionSource object itself. + */ + public DocumentDbCollectionSource withNestingSeparator(Object nestingSeparator) { + this.nestingSeparator = nestingSeparator; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DrillLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DrillLinkedService.java new file mode 100644 index 000000000000..5edeb15b225a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DrillLinkedService.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Drill server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Drill") +@JsonFlatten +public class DrillLinkedService extends LinkedServiceInner { + /** + * An ODBC connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString") + private Object connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the DrillLinkedService object itself. + */ + public DrillLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the DrillLinkedService object itself. + */ + public DrillLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DrillSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DrillSource.java new file mode 100644 index 000000000000..79d19d044600 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DrillSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Drill server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DrillSource") +public class DrillSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the DrillSource object itself. + */ + public DrillSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DrillTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DrillTableDataset.java new file mode 100644 index 000000000000..c8a72db2dfb6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DrillTableDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Drill server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DrillTable") +public class DrillTableDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsEntityDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsEntityDataset.java new file mode 100644 index 000000000000..665445512ed0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsEntityDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The Dynamics entity dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DynamicsEntity") +@JsonFlatten +public class DynamicsEntityDataset extends DatasetInner { + /** + * The logical name of the entity. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.entityName") + private Object entityName; + + /** + * Get the logical name of the entity. Type: string (or Expression with resultType string). + * + * @return the entityName value + */ + public Object entityName() { + return this.entityName; + } + + /** + * Set the logical name of the entity. Type: string (or Expression with resultType string). + * + * @param entityName the entityName value to set + * @return the DynamicsEntityDataset object itself. + */ + public DynamicsEntityDataset withEntityName(Object entityName) { + this.entityName = entityName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsLinkedService.java new file mode 100644 index 000000000000..c23b5ab5c4f1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsLinkedService.java @@ -0,0 +1,274 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Dynamics linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Dynamics") +@JsonFlatten +public class DynamicsLinkedService extends LinkedServiceInner { + /** + * The deployment type of the Dynamics instance. 'Online' for Dynamics + * Online and 'OnPremisesWithIfd' for Dynamics on-premises with Ifd. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.deploymentType", required = true) + private Object deploymentType; + + /** + * The host name of the on-premises Dynamics server. The property is + * required for on-prem and not allowed for online. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.hostName") + private Object hostName; + + /** + * The port of on-premises Dynamics server. The property is required for + * on-prem and not allowed for online. Default is 443. Type: integer (or + * Expression with resultType integer), minimum: 0. + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * The URL to the Microsoft Dynamics server. The property is required for + * on-line and not allowed for on-prem. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.serviceUri") + private Object serviceUri; + + /** + * The organization name of the Dynamics instance. The property is required + * for on-prem and required for online when there are more than one + * Dynamics instances associated with the user. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.organizationName") + private Object organizationName; + + /** + * The authentication type to connect to Dynamics server. 'Office365' for + * online scenario, 'Ifd' for on-premises with Ifd scenario. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.authenticationType", required = true) + private Object authenticationType; + + /** + * User name to access the Dynamics instance. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.username", required = true) + private Object username; + + /** + * Password to access the Dynamics instance. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the deployment type of the Dynamics instance. 'Online' for Dynamics Online and 'OnPremisesWithIfd' for Dynamics on-premises with Ifd. Type: string (or Expression with resultType string). + * + * @return the deploymentType value + */ + public Object deploymentType() { + return this.deploymentType; + } + + /** + * Set the deployment type of the Dynamics instance. 'Online' for Dynamics Online and 'OnPremisesWithIfd' for Dynamics on-premises with Ifd. Type: string (or Expression with resultType string). + * + * @param deploymentType the deploymentType value to set + * @return the DynamicsLinkedService object itself. + */ + public DynamicsLinkedService withDeploymentType(Object deploymentType) { + this.deploymentType = deploymentType; + return this; + } + + /** + * Get the host name of the on-premises Dynamics server. The property is required for on-prem and not allowed for online. Type: string (or Expression with resultType string). + * + * @return the hostName value + */ + public Object hostName() { + return this.hostName; + } + + /** + * Set the host name of the on-premises Dynamics server. The property is required for on-prem and not allowed for online. Type: string (or Expression with resultType string). + * + * @param hostName the hostName value to set + * @return the DynamicsLinkedService object itself. + */ + public DynamicsLinkedService withHostName(Object hostName) { + this.hostName = hostName; + return this; + } + + /** + * Get the port of on-premises Dynamics server. The property is required for on-prem and not allowed for online. Default is 443. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the port of on-premises Dynamics server. The property is required for on-prem and not allowed for online. Default is 443. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param port the port value to set + * @return the DynamicsLinkedService object itself. + */ + public DynamicsLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the URL to the Microsoft Dynamics server. The property is required for on-line and not allowed for on-prem. Type: string (or Expression with resultType string). + * + * @return the serviceUri value + */ + public Object serviceUri() { + return this.serviceUri; + } + + /** + * Set the URL to the Microsoft Dynamics server. The property is required for on-line and not allowed for on-prem. Type: string (or Expression with resultType string). + * + * @param serviceUri the serviceUri value to set + * @return the DynamicsLinkedService object itself. + */ + public DynamicsLinkedService withServiceUri(Object serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get the organization name of the Dynamics instance. The property is required for on-prem and required for online when there are more than one Dynamics instances associated with the user. Type: string (or Expression with resultType string). + * + * @return the organizationName value + */ + public Object organizationName() { + return this.organizationName; + } + + /** + * Set the organization name of the Dynamics instance. The property is required for on-prem and required for online when there are more than one Dynamics instances associated with the user. Type: string (or Expression with resultType string). + * + * @param organizationName the organizationName value to set + * @return the DynamicsLinkedService object itself. + */ + public DynamicsLinkedService withOrganizationName(Object organizationName) { + this.organizationName = organizationName; + return this; + } + + /** + * Get the authentication type to connect to Dynamics server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario. Type: string (or Expression with resultType string). + * + * @return the authenticationType value + */ + public Object authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type to connect to Dynamics server. 'Office365' for online scenario, 'Ifd' for on-premises with Ifd scenario. Type: string (or Expression with resultType string). + * + * @param authenticationType the authenticationType value to set + * @return the DynamicsLinkedService object itself. + */ + public DynamicsLinkedService withAuthenticationType(Object authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get user name to access the Dynamics instance. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set user name to access the Dynamics instance. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the DynamicsLinkedService object itself. + */ + public DynamicsLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get password to access the Dynamics instance. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password to access the Dynamics instance. + * + * @param password the password value to set + * @return the DynamicsLinkedService object itself. + */ + public DynamicsLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the DynamicsLinkedService object itself. + */ + public DynamicsLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsSink.java new file mode 100644 index 000000000000..5f59928065ff --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsSink.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Dynamics sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DynamicsSink") +public class DynamicsSink extends CopySink { + /** + * The write behavior for the operation. + */ + @JsonProperty(value = "writeBehavior", required = true) + private Object writeBehavior; + + /** + * The flag indicating whether ignore null values from input dataset + * (except key fields) during write operation. Default is false. Type: + * boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "ignoreNullValues") + private Object ignoreNullValues; + + /** + * Creates an instance of DynamicsSink class. + */ + public DynamicsSink() { + writeBehavior = Upsert; + } + + /** + * Get the write behavior for the operation. + * + * @return the writeBehavior value + */ + public Object writeBehavior() { + return this.writeBehavior; + } + + /** + * Set the write behavior for the operation. + * + * @param writeBehavior the writeBehavior value to set + * @return the DynamicsSink object itself. + */ + public DynamicsSink withWriteBehavior(Object writeBehavior) { + this.writeBehavior = writeBehavior; + return this; + } + + /** + * Get the flag indicating whether ignore null values from input dataset (except key fields) during write operation. Default is false. Type: boolean (or Expression with resultType boolean). + * + * @return the ignoreNullValues value + */ + public Object ignoreNullValues() { + return this.ignoreNullValues; + } + + /** + * Set the flag indicating whether ignore null values from input dataset (except key fields) during write operation. Default is false. Type: boolean (or Expression with resultType boolean). + * + * @param ignoreNullValues the ignoreNullValues value to set + * @return the DynamicsSink object itself. + */ + public DynamicsSink withIgnoreNullValues(Object ignoreNullValues) { + this.ignoreNullValues = ignoreNullValues; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsSource.java new file mode 100644 index 000000000000..8af8422e8ac6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/DynamicsSource.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Dynamics source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("DynamicsSource") +public class DynamicsSource extends CopySource { + /** + * FetchXML is a proprietary query language that is used in Microsoft + * Dynamics (online & on-premises). Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get fetchXML is a proprietary query language that is used in Microsoft Dynamics (online & on-premises). Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set fetchXML is a proprietary query language that is used in Microsoft Dynamics (online & on-premises). Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the DynamicsSource object itself. + */ + public DynamicsSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EloquaLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EloquaLinkedService.java new file mode 100644 index 000000000000..a1f6ed0844c4 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EloquaLinkedService.java @@ -0,0 +1,213 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Eloqua server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Eloqua") +@JsonFlatten +public class EloquaLinkedService extends LinkedServiceInner { + /** + * The endpoint of the Eloqua server. (i.e. eloqua.example.com). + */ + @JsonProperty(value = "typeProperties.endpoint", required = true) + private Object endpoint; + + /** + * The site name and user name of your Eloqua account in the form: + * sitename/username. (i.e. Eloqua/Alice). + */ + @JsonProperty(value = "typeProperties.username", required = true) + private Object username; + + /** + * The password corresponding to the user name. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the endpoint of the Eloqua server. (i.e. eloqua.example.com). + * + * @return the endpoint value + */ + public Object endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint of the Eloqua server. (i.e. eloqua.example.com). + * + * @param endpoint the endpoint value to set + * @return the EloquaLinkedService object itself. + */ + public EloquaLinkedService withEndpoint(Object endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Get the site name and user name of your Eloqua account in the form: sitename/username. (i.e. Eloqua/Alice). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the site name and user name of your Eloqua account in the form: sitename/username. (i.e. Eloqua/Alice). + * + * @param username the username value to set + * @return the EloquaLinkedService object itself. + */ + public EloquaLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password corresponding to the user name. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password corresponding to the user name. + * + * @param password the password value to set + * @return the EloquaLinkedService object itself. + */ + public EloquaLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the EloquaLinkedService object itself. + */ + public EloquaLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the EloquaLinkedService object itself. + */ + public EloquaLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the EloquaLinkedService object itself. + */ + public EloquaLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the EloquaLinkedService object itself. + */ + public EloquaLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EloquaObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EloquaObjectDataset.java new file mode 100644 index 000000000000..49a893c53b3c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EloquaObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Eloqua server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("EloquaObject") +public class EloquaObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EloquaSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EloquaSource.java new file mode 100644 index 000000000000..f5333245e9b7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EloquaSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Eloqua server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("EloquaSource") +public class EloquaSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the EloquaSource object itself. + */ + public EloquaSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EntityReference.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EntityReference.java new file mode 100644 index 000000000000..fa6153042eaa --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/EntityReference.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The entity reference. + */ +public class EntityReference { + /** + * The type of this referenced entity. Possible values include: + * 'IntegrationRuntimeReference', 'LinkedServiceReference'. + */ + @JsonProperty(value = "type") + private IntegrationRuntimeEntityReferenceType type; + + /** + * The name of this referenced entity. + */ + @JsonProperty(value = "referenceName") + private String referenceName; + + /** + * Get the type of this referenced entity. Possible values include: 'IntegrationRuntimeReference', 'LinkedServiceReference'. + * + * @return the type value + */ + public IntegrationRuntimeEntityReferenceType type() { + return this.type; + } + + /** + * Set the type of this referenced entity. Possible values include: 'IntegrationRuntimeReference', 'LinkedServiceReference'. + * + * @param type the type value to set + * @return the EntityReference object itself. + */ + public EntityReference withType(IntegrationRuntimeEntityReferenceType type) { + this.type = type; + return this; + } + + /** + * Get the name of this referenced entity. + * + * @return the referenceName value + */ + public String referenceName() { + return this.referenceName; + } + + /** + * Set the name of this referenced entity. + * + * @param referenceName the referenceName value to set + * @return the EntityReference object itself. + */ + public EntityReference withReferenceName(String referenceName) { + this.referenceName = referenceName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ErrorResponse.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ErrorResponse.java new file mode 100644 index 000000000000..d75ca77596dd --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ErrorResponse.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that defines the structure of an Azure Data Factory response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code", required = true) + private String code; + + /** + * Error message. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /** + * Property name/path in request associated with error. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Array with additional error details. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get property name/path in request associated with error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set property name/path in request associated with error. + * + * @param target the target value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get array with additional error details. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set array with additional error details. + * + * @param details the details value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withDetails(List details) { + this.details = details; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ErrorResponseException.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ErrorResponseException.java new file mode 100644 index 000000000000..b1e478273a7c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ExecutePipelineActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ExecutePipelineActivity.java new file mode 100644 index 000000000000..c680f6812f61 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ExecutePipelineActivity.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Execute pipeline activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ExecutePipeline") +@JsonFlatten +public class ExecutePipelineActivity extends ControlActivity { + /** + * Pipeline reference. + */ + @JsonProperty(value = "typeProperties.pipeline", required = true) + private PipelineReference pipeline; + + /** + * Pipeline parameters. + */ + @JsonProperty(value = "typeProperties.parameters") + private Map parameters; + + /** + * Defines whether activity execution will wait for the dependent pipeline + * execution to finish. Default is false. + */ + @JsonProperty(value = "typeProperties.waitOnCompletion") + private Boolean waitOnCompletion; + + /** + * Get pipeline reference. + * + * @return the pipeline value + */ + public PipelineReference pipeline() { + return this.pipeline; + } + + /** + * Set pipeline reference. + * + * @param pipeline the pipeline value to set + * @return the ExecutePipelineActivity object itself. + */ + public ExecutePipelineActivity withPipeline(PipelineReference pipeline) { + this.pipeline = pipeline; + return this; + } + + /** + * Get pipeline parameters. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set pipeline parameters. + * + * @param parameters the parameters value to set + * @return the ExecutePipelineActivity object itself. + */ + public ExecutePipelineActivity withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get defines whether activity execution will wait for the dependent pipeline execution to finish. Default is false. + * + * @return the waitOnCompletion value + */ + public Boolean waitOnCompletion() { + return this.waitOnCompletion; + } + + /** + * Set defines whether activity execution will wait for the dependent pipeline execution to finish. Default is false. + * + * @param waitOnCompletion the waitOnCompletion value to set + * @return the ExecutePipelineActivity object itself. + */ + public ExecutePipelineActivity withWaitOnCompletion(Boolean waitOnCompletion) { + this.waitOnCompletion = waitOnCompletion; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ExecuteSSISPackageActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ExecuteSSISPackageActivity.java new file mode 100644 index 000000000000..405e0371c2b2 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ExecuteSSISPackageActivity.java @@ -0,0 +1,339 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Execute SSIS package activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ExecuteSSISPackage") +@JsonFlatten +public class ExecuteSSISPackageActivity extends ExecutionActivity { + /** + * SSIS package location. + */ + @JsonProperty(value = "typeProperties.packageLocation", required = true) + private SSISPackageLocation packageLocation; + + /** + * Specifies the runtime to execute SSIS package. The value should be "x86" + * or "x64". Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.runtime") + private Object runtime; + + /** + * The logging level of SSIS package execution. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.loggingLevel") + private Object loggingLevel; + + /** + * The environment path to execute the SSIS package. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.environmentPath") + private Object environmentPath; + + /** + * The package execution credential. + */ + @JsonProperty(value = "typeProperties.executionCredential") + private SSISExecutionCredential executionCredential; + + /** + * The integration runtime reference. + */ + @JsonProperty(value = "typeProperties.connectVia", required = true) + private IntegrationRuntimeReference connectVia; + + /** + * The project level parameters to execute the SSIS package. + */ + @JsonProperty(value = "typeProperties.projectParameters") + private Map projectParameters; + + /** + * The package level parameters to execute the SSIS package. + */ + @JsonProperty(value = "typeProperties.packageParameters") + private Map packageParameters; + + /** + * The project level connection managers to execute the SSIS package. + */ + @JsonProperty(value = "typeProperties.projectConnectionManagers") + private Map> projectConnectionManagers; + + /** + * The package level connection managers to execute the SSIS package. + */ + @JsonProperty(value = "typeProperties.packageConnectionManagers") + private Map> packageConnectionManagers; + + /** + * The property overrides to execute the SSIS package. + */ + @JsonProperty(value = "typeProperties.propertyOverrides") + private Map propertyOverrides; + + /** + * SSIS package execution log location. + */ + @JsonProperty(value = "typeProperties.logLocation") + private SSISLogLocation logLocation; + + /** + * Get sSIS package location. + * + * @return the packageLocation value + */ + public SSISPackageLocation packageLocation() { + return this.packageLocation; + } + + /** + * Set sSIS package location. + * + * @param packageLocation the packageLocation value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withPackageLocation(SSISPackageLocation packageLocation) { + this.packageLocation = packageLocation; + return this; + } + + /** + * Get specifies the runtime to execute SSIS package. The value should be "x86" or "x64". Type: string (or Expression with resultType string). + * + * @return the runtime value + */ + public Object runtime() { + return this.runtime; + } + + /** + * Set specifies the runtime to execute SSIS package. The value should be "x86" or "x64". Type: string (or Expression with resultType string). + * + * @param runtime the runtime value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withRuntime(Object runtime) { + this.runtime = runtime; + return this; + } + + /** + * Get the logging level of SSIS package execution. Type: string (or Expression with resultType string). + * + * @return the loggingLevel value + */ + public Object loggingLevel() { + return this.loggingLevel; + } + + /** + * Set the logging level of SSIS package execution. Type: string (or Expression with resultType string). + * + * @param loggingLevel the loggingLevel value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withLoggingLevel(Object loggingLevel) { + this.loggingLevel = loggingLevel; + return this; + } + + /** + * Get the environment path to execute the SSIS package. Type: string (or Expression with resultType string). + * + * @return the environmentPath value + */ + public Object environmentPath() { + return this.environmentPath; + } + + /** + * Set the environment path to execute the SSIS package. Type: string (or Expression with resultType string). + * + * @param environmentPath the environmentPath value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withEnvironmentPath(Object environmentPath) { + this.environmentPath = environmentPath; + return this; + } + + /** + * Get the package execution credential. + * + * @return the executionCredential value + */ + public SSISExecutionCredential executionCredential() { + return this.executionCredential; + } + + /** + * Set the package execution credential. + * + * @param executionCredential the executionCredential value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withExecutionCredential(SSISExecutionCredential executionCredential) { + this.executionCredential = executionCredential; + return this; + } + + /** + * Get the integration runtime reference. + * + * @return the connectVia value + */ + public IntegrationRuntimeReference connectVia() { + return this.connectVia; + } + + /** + * Set the integration runtime reference. + * + * @param connectVia the connectVia value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withConnectVia(IntegrationRuntimeReference connectVia) { + this.connectVia = connectVia; + return this; + } + + /** + * Get the project level parameters to execute the SSIS package. + * + * @return the projectParameters value + */ + public Map projectParameters() { + return this.projectParameters; + } + + /** + * Set the project level parameters to execute the SSIS package. + * + * @param projectParameters the projectParameters value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withProjectParameters(Map projectParameters) { + this.projectParameters = projectParameters; + return this; + } + + /** + * Get the package level parameters to execute the SSIS package. + * + * @return the packageParameters value + */ + public Map packageParameters() { + return this.packageParameters; + } + + /** + * Set the package level parameters to execute the SSIS package. + * + * @param packageParameters the packageParameters value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withPackageParameters(Map packageParameters) { + this.packageParameters = packageParameters; + return this; + } + + /** + * Get the project level connection managers to execute the SSIS package. + * + * @return the projectConnectionManagers value + */ + public Map> projectConnectionManagers() { + return this.projectConnectionManagers; + } + + /** + * Set the project level connection managers to execute the SSIS package. + * + * @param projectConnectionManagers the projectConnectionManagers value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withProjectConnectionManagers(Map> projectConnectionManagers) { + this.projectConnectionManagers = projectConnectionManagers; + return this; + } + + /** + * Get the package level connection managers to execute the SSIS package. + * + * @return the packageConnectionManagers value + */ + public Map> packageConnectionManagers() { + return this.packageConnectionManagers; + } + + /** + * Set the package level connection managers to execute the SSIS package. + * + * @param packageConnectionManagers the packageConnectionManagers value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withPackageConnectionManagers(Map> packageConnectionManagers) { + this.packageConnectionManagers = packageConnectionManagers; + return this; + } + + /** + * Get the property overrides to execute the SSIS package. + * + * @return the propertyOverrides value + */ + public Map propertyOverrides() { + return this.propertyOverrides; + } + + /** + * Set the property overrides to execute the SSIS package. + * + * @param propertyOverrides the propertyOverrides value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withPropertyOverrides(Map propertyOverrides) { + this.propertyOverrides = propertyOverrides; + return this; + } + + /** + * Get sSIS package execution log location. + * + * @return the logLocation value + */ + public SSISLogLocation logLocation() { + return this.logLocation; + } + + /** + * Set sSIS package execution log location. + * + * @param logLocation the logLocation value to set + * @return the ExecuteSSISPackageActivity object itself. + */ + public ExecuteSSISPackageActivity withLogLocation(SSISLogLocation logLocation) { + this.logLocation = logLocation; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ExecutionActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ExecutionActivity.java new file mode 100644 index 000000000000..7f959932fb4c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ExecutionActivity.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Base class for all execution activities. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Execution") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "DatabricksNotebook", value = DatabricksNotebookActivity.class), + @JsonSubTypes.Type(name = "DataLakeAnalyticsU-SQL", value = DataLakeAnalyticsUSQLActivity.class), + @JsonSubTypes.Type(name = "AzureMLUpdateResource", value = AzureMLUpdateResourceActivity.class), + @JsonSubTypes.Type(name = "AzureMLBatchExecution", value = AzureMLBatchExecutionActivity.class), + @JsonSubTypes.Type(name = "GetMetadata", value = GetMetadataActivity.class), + @JsonSubTypes.Type(name = "WebActivity", value = WebActivity.class), + @JsonSubTypes.Type(name = "Lookup", value = LookupActivity.class), + @JsonSubTypes.Type(name = "SqlServerStoredProcedure", value = SqlServerStoredProcedureActivity.class), + @JsonSubTypes.Type(name = "Custom", value = CustomActivity.class), + @JsonSubTypes.Type(name = "ExecuteSSISPackage", value = ExecuteSSISPackageActivity.class), + @JsonSubTypes.Type(name = "HDInsightSpark", value = HDInsightSparkActivity.class), + @JsonSubTypes.Type(name = "HDInsightStreaming", value = HDInsightStreamingActivity.class), + @JsonSubTypes.Type(name = "HDInsightMapReduce", value = HDInsightMapReduceActivity.class), + @JsonSubTypes.Type(name = "HDInsightPig", value = HDInsightPigActivity.class), + @JsonSubTypes.Type(name = "HDInsightHive", value = HDInsightHiveActivity.class), + @JsonSubTypes.Type(name = "Copy", value = CopyActivity.class) +}) +public class ExecutionActivity extends Activity { + /** + * Linked service reference. + */ + @JsonProperty(value = "linkedServiceName") + private LinkedServiceReference linkedServiceName; + + /** + * Activity policy. + */ + @JsonProperty(value = "policy") + private ActivityPolicy policy; + + /** + * Get linked service reference. + * + * @return the linkedServiceName value + */ + public LinkedServiceReference linkedServiceName() { + return this.linkedServiceName; + } + + /** + * Set linked service reference. + * + * @param linkedServiceName the linkedServiceName value to set + * @return the ExecutionActivity object itself. + */ + public ExecutionActivity withLinkedServiceName(LinkedServiceReference linkedServiceName) { + this.linkedServiceName = linkedServiceName; + return this; + } + + /** + * Get activity policy. + * + * @return the policy value + */ + public ActivityPolicy policy() { + return this.policy; + } + + /** + * Set activity policy. + * + * @param policy the policy value to set + * @return the ExecutionActivity object itself. + */ + public ExecutionActivity withPolicy(ActivityPolicy policy) { + this.policy = policy; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Expression.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Expression.java new file mode 100644 index 000000000000..5acb861727ba --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Expression.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Azure Data Factory expression definition. + */ +public class Expression { + /** + * Expression type. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Expression value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Creates an instance of Expression class. + * @param value expression value. + */ + public Expression() { + type = "Expression"; + } + + /** + * Get expression type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set expression type. + * + * @param type the type value to set + * @return the Expression object itself. + */ + public Expression withType(String type) { + this.type = type; + return this; + } + + /** + * Get expression value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set expression value. + * + * @param value the value value to set + * @return the Expression object itself. + */ + public Expression withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Factories.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Factories.java new file mode 100644 index 000000000000..ee48c73a7976 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Factories.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.FactoriesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Factories. + */ +public interface Factories extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Cancel a pipeline run by its run ID. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelPipelineRunAsync(String resourceGroupName, String factoryName, String runId); + + /** + * Updates a factory's repo information. + * + * @param locationId The location identifier. + * @param factoryRepoUpdate Update factory repo request definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable configureFactoryRepoAsync(String locationId, FactoryRepoUpdate factoryRepoUpdate); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Factory.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Factory.java new file mode 100644 index 000000000000..3c000f290ab7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Factory.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import java.util.Map; +import org.joda.time.DateTime; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.FactoryInner; + +/** + * Type representing Factory. + */ +public interface Factory extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * @return the createTime value. + */ + DateTime createTime(); + + /** + * @return the identity value. + */ + FactoryIdentity identity(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the version value. + */ + String version(); + + /** + * @return the vstsConfiguration value. + */ + FactoryVSTSConfiguration vstsConfiguration(); + + /** + * The entirety of the Factory definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Factory definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Factory definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Factory definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the factory definition allowing to specify AdditionalProperties. + */ + interface WithAdditionalProperties { + /** + * Specifies additionalProperties. + * @param additionalProperties Unmatched properties from the message are deserialized this collection + * @return the next definition stage + */ + WithCreate withAdditionalProperties(Map additionalProperties); + } + + /** + * The stage of the factory definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity Managed service identity of the factory + * @return the next definition stage + */ + WithCreate withIdentity(FactoryIdentity identity); + } + + /** + * The stage of the factory definition allowing to specify VstsConfiguration. + */ + interface WithVstsConfiguration { + /** + * Specifies vstsConfiguration. + * @param vstsConfiguration VSTS repo information of the factory + * @return the next definition stage + */ + WithCreate withVstsConfiguration(FactoryVSTSConfiguration vstsConfiguration); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAdditionalProperties, DefinitionStages.WithIdentity, DefinitionStages.WithVstsConfiguration { + } + } + /** + * The template for a Factory update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithIdentity { + } + + /** + * Grouping of Factory update stages. + */ + interface UpdateStages { + /** + * The stage of the factory update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity Managed service identity of the factory + * @return the next update stage + */ + Update withIdentity(FactoryIdentity identity); + } + + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryIdentity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryIdentity.java new file mode 100644 index 000000000000..12024a3fd0f5 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryIdentity.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity properties of the factory resource. + */ +public class FactoryIdentity { + /** + * The identity type. Currently the only supported type is + * 'SystemAssigned'. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * The principal id of the identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /** + * The client tenant id of the identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /** + * Creates an instance of FactoryIdentity class. + */ + public FactoryIdentity() { + type = "SystemAssigned"; + } + + /** + * Get the identity type. Currently the only supported type is 'SystemAssigned'. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the identity type. Currently the only supported type is 'SystemAssigned'. + * + * @param type the type value to set + * @return the FactoryIdentity object itself. + */ + public FactoryIdentity withType(String type) { + this.type = type; + return this; + } + + /** + * Get the principal id of the identity. + * + * @return the principalId value + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the client tenant id of the identity. + * + * @return the tenantId value + */ + public UUID tenantId() { + return this.tenantId; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryRepoUpdate.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryRepoUpdate.java new file mode 100644 index 000000000000..543615ca0701 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryRepoUpdate.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Factory's VSTS repo information. + */ +public class FactoryRepoUpdate { + /** + * The factory resource id. + */ + @JsonProperty(value = "factoryResourceId") + private String factoryResourceId; + + /** + * The resource group name. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /** + * VSTS repo information of the factory. + */ + @JsonProperty(value = "vstsConfiguration") + private FactoryVSTSConfiguration vstsConfiguration; + + /** + * Get the factory resource id. + * + * @return the factoryResourceId value + */ + public String factoryResourceId() { + return this.factoryResourceId; + } + + /** + * Set the factory resource id. + * + * @param factoryResourceId the factoryResourceId value to set + * @return the FactoryRepoUpdate object itself. + */ + public FactoryRepoUpdate withFactoryResourceId(String factoryResourceId) { + this.factoryResourceId = factoryResourceId; + return this; + } + + /** + * Get the resource group name. + * + * @return the resourceGroupName value + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the resource group name. + * + * @param resourceGroupName the resourceGroupName value to set + * @return the FactoryRepoUpdate object itself. + */ + public FactoryRepoUpdate withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get vSTS repo information of the factory. + * + * @return the vstsConfiguration value + */ + public FactoryVSTSConfiguration vstsConfiguration() { + return this.vstsConfiguration; + } + + /** + * Set vSTS repo information of the factory. + * + * @param vstsConfiguration the vstsConfiguration value to set + * @return the FactoryRepoUpdate object itself. + */ + public FactoryRepoUpdate withVstsConfiguration(FactoryVSTSConfiguration vstsConfiguration) { + this.vstsConfiguration = vstsConfiguration; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryUpdateParameters.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryUpdateParameters.java new file mode 100644 index 000000000000..3c5a370b064e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryUpdateParameters.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for updating a factory resource. + */ +public class FactoryUpdateParameters { + /** + * The resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Managed service identity of the factory. + */ + @JsonProperty(value = "identity") + private FactoryIdentity identity; + + /** + * Get the resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the resource tags. + * + * @param tags the tags value to set + * @return the FactoryUpdateParameters object itself. + */ + public FactoryUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get managed service identity of the factory. + * + * @return the identity value + */ + public FactoryIdentity identity() { + return this.identity; + } + + /** + * Set managed service identity of the factory. + * + * @param identity the identity value to set + * @return the FactoryUpdateParameters object itself. + */ + public FactoryUpdateParameters withIdentity(FactoryIdentity identity) { + this.identity = identity; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryVSTSConfiguration.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryVSTSConfiguration.java new file mode 100644 index 000000000000..d13b5dc79c93 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FactoryVSTSConfiguration.java @@ -0,0 +1,199 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Factory's VSTS repo information. + */ +public class FactoryVSTSConfiguration { + /** + * VSTS account name. + */ + @JsonProperty(value = "accountName") + private String accountName; + + /** + * VSTS project name. + */ + @JsonProperty(value = "projectName") + private String projectName; + + /** + * VSTS repository name. + */ + @JsonProperty(value = "repositoryName") + private String repositoryName; + + /** + * VSTS collaboration branch. + */ + @JsonProperty(value = "collaborationBranch") + private String collaborationBranch; + + /** + * VSTS root folder. + */ + @JsonProperty(value = "rootFolder") + private String rootFolder; + + /** + * VSTS last commit id. + */ + @JsonProperty(value = "lastCommitId") + private String lastCommitId; + + /** + * VSTS tenant id. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * Get vSTS account name. + * + * @return the accountName value + */ + public String accountName() { + return this.accountName; + } + + /** + * Set vSTS account name. + * + * @param accountName the accountName value to set + * @return the FactoryVSTSConfiguration object itself. + */ + public FactoryVSTSConfiguration withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get vSTS project name. + * + * @return the projectName value + */ + public String projectName() { + return this.projectName; + } + + /** + * Set vSTS project name. + * + * @param projectName the projectName value to set + * @return the FactoryVSTSConfiguration object itself. + */ + public FactoryVSTSConfiguration withProjectName(String projectName) { + this.projectName = projectName; + return this; + } + + /** + * Get vSTS repository name. + * + * @return the repositoryName value + */ + public String repositoryName() { + return this.repositoryName; + } + + /** + * Set vSTS repository name. + * + * @param repositoryName the repositoryName value to set + * @return the FactoryVSTSConfiguration object itself. + */ + public FactoryVSTSConfiguration withRepositoryName(String repositoryName) { + this.repositoryName = repositoryName; + return this; + } + + /** + * Get vSTS collaboration branch. + * + * @return the collaborationBranch value + */ + public String collaborationBranch() { + return this.collaborationBranch; + } + + /** + * Set vSTS collaboration branch. + * + * @param collaborationBranch the collaborationBranch value to set + * @return the FactoryVSTSConfiguration object itself. + */ + public FactoryVSTSConfiguration withCollaborationBranch(String collaborationBranch) { + this.collaborationBranch = collaborationBranch; + return this; + } + + /** + * Get vSTS root folder. + * + * @return the rootFolder value + */ + public String rootFolder() { + return this.rootFolder; + } + + /** + * Set vSTS root folder. + * + * @param rootFolder the rootFolder value to set + * @return the FactoryVSTSConfiguration object itself. + */ + public FactoryVSTSConfiguration withRootFolder(String rootFolder) { + this.rootFolder = rootFolder; + return this; + } + + /** + * Get vSTS last commit id. + * + * @return the lastCommitId value + */ + public String lastCommitId() { + return this.lastCommitId; + } + + /** + * Set vSTS last commit id. + * + * @param lastCommitId the lastCommitId value to set + * @return the FactoryVSTSConfiguration object itself. + */ + public FactoryVSTSConfiguration withLastCommitId(String lastCommitId) { + this.lastCommitId = lastCommitId; + return this; + } + + /** + * Get vSTS tenant id. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set vSTS tenant id. + * + * @param tenantId the tenantId value to set + * @return the FactoryVSTSConfiguration object itself. + */ + public FactoryVSTSConfiguration withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileServerLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileServerLinkedService.java new file mode 100644 index 000000000000..e816baa2c0ff --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileServerLinkedService.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * File system linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("FileServer") +@JsonFlatten +public class FileServerLinkedService extends LinkedServiceInner { + /** + * Host name of the server. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * User ID to logon the server. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.userId") + private Object userId; + + /** + * Password to logon the server. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get host name of the server. Type: string (or Expression with resultType string). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set host name of the server. Type: string (or Expression with resultType string). + * + * @param host the host value to set + * @return the FileServerLinkedService object itself. + */ + public FileServerLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get user ID to logon the server. Type: string (or Expression with resultType string). + * + * @return the userId value + */ + public Object userId() { + return this.userId; + } + + /** + * Set user ID to logon the server. Type: string (or Expression with resultType string). + * + * @param userId the userId value to set + * @return the FileServerLinkedService object itself. + */ + public FileServerLinkedService withUserId(Object userId) { + this.userId = userId; + return this; + } + + /** + * Get password to logon the server. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password to logon the server. + * + * @param password the password value to set + * @return the FileServerLinkedService object itself. + */ + public FileServerLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the FileServerLinkedService object itself. + */ + public FileServerLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileShareDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileShareDataset.java new file mode 100644 index 000000000000..82a636a2d7eb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileShareDataset.java @@ -0,0 +1,158 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * An on-premises file system dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("FileShare") +@JsonFlatten +public class FileShareDataset extends DatasetInner { + /** + * The path of the on-premises file system. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.folderPath") + private Object folderPath; + + /** + * The name of the on-premises file system. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.fileName") + private Object fileName; + + /** + * The format of the files. + */ + @JsonProperty(value = "typeProperties.format") + private DatasetStorageFormat format; + + /** + * Specify a filter to be used to select a subset of files in the + * folderPath rather than all files. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.fileFilter") + private Object fileFilter; + + /** + * The data compression method used for the file system. + */ + @JsonProperty(value = "typeProperties.compression") + private DatasetCompression compression; + + /** + * Get the path of the on-premises file system. Type: string (or Expression with resultType string). + * + * @return the folderPath value + */ + public Object folderPath() { + return this.folderPath; + } + + /** + * Set the path of the on-premises file system. Type: string (or Expression with resultType string). + * + * @param folderPath the folderPath value to set + * @return the FileShareDataset object itself. + */ + public FileShareDataset withFolderPath(Object folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get the name of the on-premises file system. Type: string (or Expression with resultType string). + * + * @return the fileName value + */ + public Object fileName() { + return this.fileName; + } + + /** + * Set the name of the on-premises file system. Type: string (or Expression with resultType string). + * + * @param fileName the fileName value to set + * @return the FileShareDataset object itself. + */ + public FileShareDataset withFileName(Object fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get the format of the files. + * + * @return the format value + */ + public DatasetStorageFormat format() { + return this.format; + } + + /** + * Set the format of the files. + * + * @param format the format value to set + * @return the FileShareDataset object itself. + */ + public FileShareDataset withFormat(DatasetStorageFormat format) { + this.format = format; + return this; + } + + /** + * Get specify a filter to be used to select a subset of files in the folderPath rather than all files. Type: string (or Expression with resultType string). + * + * @return the fileFilter value + */ + public Object fileFilter() { + return this.fileFilter; + } + + /** + * Set specify a filter to be used to select a subset of files in the folderPath rather than all files. Type: string (or Expression with resultType string). + * + * @param fileFilter the fileFilter value to set + * @return the FileShareDataset object itself. + */ + public FileShareDataset withFileFilter(Object fileFilter) { + this.fileFilter = fileFilter; + return this; + } + + /** + * Get the data compression method used for the file system. + * + * @return the compression value + */ + public DatasetCompression compression() { + return this.compression; + } + + /** + * Set the data compression method used for the file system. + * + * @param compression the compression value to set + * @return the FileShareDataset object itself. + */ + public FileShareDataset withCompression(DatasetCompression compression) { + this.compression = compression; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileSystemSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileSystemSink.java new file mode 100644 index 000000000000..bd5ff676faf0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileSystemSink.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity file system sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("FileSystemSink") +public class FileSystemSink extends CopySink { + /** + * The type of copy behavior for copy sink. + */ + @JsonProperty(value = "copyBehavior") + private Object copyBehavior; + + /** + * Get the type of copy behavior for copy sink. + * + * @return the copyBehavior value + */ + public Object copyBehavior() { + return this.copyBehavior; + } + + /** + * Set the type of copy behavior for copy sink. + * + * @param copyBehavior the copyBehavior value to set + * @return the FileSystemSink object itself. + */ + public FileSystemSink withCopyBehavior(Object copyBehavior) { + this.copyBehavior = copyBehavior; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileSystemSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileSystemSource.java new file mode 100644 index 000000000000..feca377785c1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FileSystemSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity file system source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("FileSystemSource") +public class FileSystemSource extends CopySource { + /** + * If true, files under the folder path will be read recursively. Default + * is true. Type: boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "recursive") + private Object recursive; + + /** + * Get if true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). + * + * @return the recursive value + */ + public Object recursive() { + return this.recursive; + } + + /** + * Set if true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). + * + * @param recursive the recursive value to set + * @return the FileSystemSource object itself. + */ + public FileSystemSource withRecursive(Object recursive) { + this.recursive = recursive; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FilterActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FilterActivity.java new file mode 100644 index 000000000000..102c0a97d05a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FilterActivity.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Filter and return results from input array based on the conditions. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Filter") +@JsonFlatten +public class FilterActivity extends ControlActivity { + /** + * Input array on which filter should be applied. + */ + @JsonProperty(value = "typeProperties.items", required = true) + private Expression items; + + /** + * Condition to be used for filtering the input. + */ + @JsonProperty(value = "typeProperties.condition", required = true) + private Expression condition; + + /** + * Get input array on which filter should be applied. + * + * @return the items value + */ + public Expression items() { + return this.items; + } + + /** + * Set input array on which filter should be applied. + * + * @param items the items value to set + * @return the FilterActivity object itself. + */ + public FilterActivity withItems(Expression items) { + this.items = items; + return this; + } + + /** + * Get condition to be used for filtering the input. + * + * @return the condition value + */ + public Expression condition() { + return this.condition; + } + + /** + * Set condition to be used for filtering the input. + * + * @param condition the condition value to set + * @return the FilterActivity object itself. + */ + public FilterActivity withCondition(Expression condition) { + this.condition = condition; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ForEachActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ForEachActivity.java new file mode 100644 index 000000000000..877c88a81a0e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ForEachActivity.java @@ -0,0 +1,130 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * This activity is used for iterating over a collection and execute given + * activities. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ForEach") +@JsonFlatten +public class ForEachActivity extends ControlActivity { + /** + * Should the loop be executed in sequence or in parallel (max 50). + */ + @JsonProperty(value = "typeProperties.isSequential") + private Boolean isSequential; + + /** + * Batch count to be used for controlling the number of parallel execution + * (when isSequential is set to false). + */ + @JsonProperty(value = "typeProperties.batchCount") + private Integer batchCount; + + /** + * Collection to iterate. + */ + @JsonProperty(value = "typeProperties.items", required = true) + private Expression items; + + /** + * List of activities to execute . + */ + @JsonProperty(value = "typeProperties.activities", required = true) + private List activities; + + /** + * Get should the loop be executed in sequence or in parallel (max 50). + * + * @return the isSequential value + */ + public Boolean isSequential() { + return this.isSequential; + } + + /** + * Set should the loop be executed in sequence or in parallel (max 50). + * + * @param isSequential the isSequential value to set + * @return the ForEachActivity object itself. + */ + public ForEachActivity withIsSequential(Boolean isSequential) { + this.isSequential = isSequential; + return this; + } + + /** + * Get batch count to be used for controlling the number of parallel execution (when isSequential is set to false). + * + * @return the batchCount value + */ + public Integer batchCount() { + return this.batchCount; + } + + /** + * Set batch count to be used for controlling the number of parallel execution (when isSequential is set to false). + * + * @param batchCount the batchCount value to set + * @return the ForEachActivity object itself. + */ + public ForEachActivity withBatchCount(Integer batchCount) { + this.batchCount = batchCount; + return this; + } + + /** + * Get collection to iterate. + * + * @return the items value + */ + public Expression items() { + return this.items; + } + + /** + * Set collection to iterate. + * + * @param items the items value to set + * @return the ForEachActivity object itself. + */ + public ForEachActivity withItems(Expression items) { + this.items = items; + return this; + } + + /** + * Get list of activities to execute . + * + * @return the activities value + */ + public List activities() { + return this.activities; + } + + /** + * Set list of activities to execute . + * + * @param activities the activities value to set + * @return the ForEachActivity object itself. + */ + public ForEachActivity withActivities(List activities) { + this.activities = activities; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FtpAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FtpAuthenticationType.java new file mode 100644 index 000000000000..8488ab3f4553 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FtpAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FtpAuthenticationType. + */ +public final class FtpAuthenticationType extends ExpandableStringEnum { + /** Static value Basic for FtpAuthenticationType. */ + public static final FtpAuthenticationType BASIC = fromString("Basic"); + + /** Static value Anonymous for FtpAuthenticationType. */ + public static final FtpAuthenticationType ANONYMOUS = fromString("Anonymous"); + + /** + * Creates or finds a FtpAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding FtpAuthenticationType + */ + @JsonCreator + public static FtpAuthenticationType fromString(String name) { + return fromString(name, FtpAuthenticationType.class); + } + + /** + * @return known FtpAuthenticationType values + */ + public static Collection values() { + return values(FtpAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FtpServerLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FtpServerLinkedService.java new file mode 100644 index 000000000000..44fd53c24dec --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/FtpServerLinkedService.java @@ -0,0 +1,242 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * A FTP server Linked Service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("FtpServer") +@JsonFlatten +public class FtpServerLinkedService extends LinkedServiceInner { + /** + * Host name of the FTP server. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The TCP port number that the FTP server uses to listen for client + * connections. Default value is 21. Type: integer (or Expression with + * resultType integer), minimum: 0. + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * The authentication type to be used to connect to the FTP server. + * Possible values include: 'Basic', 'Anonymous'. + */ + @JsonProperty(value = "typeProperties.authenticationType") + private FtpAuthenticationType authenticationType; + + /** + * Username to logon the FTP server. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.userName") + private Object userName; + + /** + * Password to logon the FTP server. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * If true, connect to the FTP server over SSL/TLS channel. Default value + * is true. Type: boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "typeProperties.enableSsl") + private Object enableSsl; + + /** + * If true, validate the FTP server SSL certificate when connect over + * SSL/TLS channel. Default value is true. Type: boolean (or Expression + * with resultType boolean). + */ + @JsonProperty(value = "typeProperties.enableServerCertificateValidation") + private Object enableServerCertificateValidation; + + /** + * Get host name of the FTP server. Type: string (or Expression with resultType string). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set host name of the FTP server. Type: string (or Expression with resultType string). + * + * @param host the host value to set + * @return the FtpServerLinkedService object itself. + */ + public FtpServerLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the TCP port number that the FTP server uses to listen for client connections. Default value is 21. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port number that the FTP server uses to listen for client connections. Default value is 21. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param port the port value to set + * @return the FtpServerLinkedService object itself. + */ + public FtpServerLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the authentication type to be used to connect to the FTP server. Possible values include: 'Basic', 'Anonymous'. + * + * @return the authenticationType value + */ + public FtpAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type to be used to connect to the FTP server. Possible values include: 'Basic', 'Anonymous'. + * + * @param authenticationType the authenticationType value to set + * @return the FtpServerLinkedService object itself. + */ + public FtpServerLinkedService withAuthenticationType(FtpAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get username to logon the FTP server. Type: string (or Expression with resultType string). + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set username to logon the FTP server. Type: string (or Expression with resultType string). + * + * @param userName the userName value to set + * @return the FtpServerLinkedService object itself. + */ + public FtpServerLinkedService withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get password to logon the FTP server. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password to logon the FTP server. + * + * @param password the password value to set + * @return the FtpServerLinkedService object itself. + */ + public FtpServerLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the FtpServerLinkedService object itself. + */ + public FtpServerLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + + /** + * Get if true, connect to the FTP server over SSL/TLS channel. Default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the enableSsl value + */ + public Object enableSsl() { + return this.enableSsl; + } + + /** + * Set if true, connect to the FTP server over SSL/TLS channel. Default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param enableSsl the enableSsl value to set + * @return the FtpServerLinkedService object itself. + */ + public FtpServerLinkedService withEnableSsl(Object enableSsl) { + this.enableSsl = enableSsl; + return this; + } + + /** + * Get if true, validate the FTP server SSL certificate when connect over SSL/TLS channel. Default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the enableServerCertificateValidation value + */ + public Object enableServerCertificateValidation() { + return this.enableServerCertificateValidation; + } + + /** + * Set if true, validate the FTP server SSL certificate when connect over SSL/TLS channel. Default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param enableServerCertificateValidation the enableServerCertificateValidation value to set + * @return the FtpServerLinkedService object itself. + */ + public FtpServerLinkedService withEnableServerCertificateValidation(Object enableServerCertificateValidation) { + this.enableServerCertificateValidation = enableServerCertificateValidation; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GetMetadataActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GetMetadataActivity.java new file mode 100644 index 000000000000..21a681d1927c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GetMetadataActivity.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Activity to get metadata of dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("GetMetadata") +@JsonFlatten +public class GetMetadataActivity extends ExecutionActivity { + /** + * GetMetadata activity dataset reference. + */ + @JsonProperty(value = "typeProperties.dataset", required = true) + private DatasetReference dataset; + + /** + * Fields of metadata to get from dataset. + */ + @JsonProperty(value = "typeProperties.fieldList") + private List fieldList; + + /** + * Get getMetadata activity dataset reference. + * + * @return the dataset value + */ + public DatasetReference dataset() { + return this.dataset; + } + + /** + * Set getMetadata activity dataset reference. + * + * @param dataset the dataset value to set + * @return the GetMetadataActivity object itself. + */ + public GetMetadataActivity withDataset(DatasetReference dataset) { + this.dataset = dataset; + return this; + } + + /** + * Get fields of metadata to get from dataset. + * + * @return the fieldList value + */ + public List fieldList() { + return this.fieldList; + } + + /** + * Set fields of metadata to get from dataset. + * + * @param fieldList the fieldList value to set + * @return the GetMetadataActivity object itself. + */ + public GetMetadataActivity withFieldList(List fieldList) { + this.fieldList = fieldList; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQueryAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQueryAuthenticationType.java new file mode 100644 index 000000000000..2e6ac25468b7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQueryAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for GoogleBigQueryAuthenticationType. + */ +public final class GoogleBigQueryAuthenticationType extends ExpandableStringEnum { + /** Static value ServiceAuthentication for GoogleBigQueryAuthenticationType. */ + public static final GoogleBigQueryAuthenticationType SERVICE_AUTHENTICATION = fromString("ServiceAuthentication"); + + /** Static value UserAuthentication for GoogleBigQueryAuthenticationType. */ + public static final GoogleBigQueryAuthenticationType USER_AUTHENTICATION = fromString("UserAuthentication"); + + /** + * Creates or finds a GoogleBigQueryAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding GoogleBigQueryAuthenticationType + */ + @JsonCreator + public static GoogleBigQueryAuthenticationType fromString(String name) { + return fromString(name, GoogleBigQueryAuthenticationType.class); + } + + /** + * @return known GoogleBigQueryAuthenticationType values + */ + public static Collection values() { + return values(GoogleBigQueryAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQueryLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQueryLinkedService.java new file mode 100644 index 000000000000..54fa65a89da6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQueryLinkedService.java @@ -0,0 +1,351 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Google BigQuery service linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("GoogleBigQuery") +@JsonFlatten +public class GoogleBigQueryLinkedService extends LinkedServiceInner { + /** + * The default BigQuery project to query against. + */ + @JsonProperty(value = "typeProperties.project", required = true) + private Object project; + + /** + * A comma-separated list of public BigQuery projects to access. + */ + @JsonProperty(value = "typeProperties.additionalProjects") + private Object additionalProjects; + + /** + * Whether to request access to Google Drive. Allowing Google Drive access + * enables support for federated tables that combine BigQuery data with + * data from Google Drive. The default value is false. + */ + @JsonProperty(value = "typeProperties.requestGoogleDriveScope") + private Object requestGoogleDriveScope; + + /** + * The OAuth 2.0 authentication mechanism used for authentication. + * ServiceAuthentication can only be used on self-hosted IR. Possible + * values include: 'ServiceAuthentication', 'UserAuthentication'. + */ + @JsonProperty(value = "typeProperties.authenticationType", required = true) + private GoogleBigQueryAuthenticationType authenticationType; + + /** + * The refresh token obtained from Google for authorizing access to + * BigQuery for UserAuthentication. + */ + @JsonProperty(value = "typeProperties.refreshToken") + private SecretBase refreshToken; + + /** + * The client id of the google application used to acquire the refresh + * token. + */ + @JsonProperty(value = "typeProperties.clientId") + private SecretBase clientId; + + /** + * The client secret of the google application used to acquire the refresh + * token. + */ + @JsonProperty(value = "typeProperties.clientSecret") + private SecretBase clientSecret; + + /** + * The service account email ID that is used for ServiceAuthentication and + * can only be used on self-hosted IR. + */ + @JsonProperty(value = "typeProperties.email") + private Object email; + + /** + * The full path to the .p12 key file that is used to authenticate the + * service account email address and can only be used on self-hosted IR. + */ + @JsonProperty(value = "typeProperties.keyFilePath") + private Object keyFilePath; + + /** + * The full path of the .pem file containing trusted CA certificates for + * verifying the server when connecting over SSL. This property can only be + * set when using SSL on self-hosted IR. The default value is the + * cacerts.pem file installed with the IR. + */ + @JsonProperty(value = "typeProperties.trustedCertPath") + private Object trustedCertPath; + + /** + * Specifies whether to use a CA certificate from the system trust store or + * from a specified PEM file. The default value is false. + */ + @JsonProperty(value = "typeProperties.useSystemTrustStore") + private Object useSystemTrustStore; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the default BigQuery project to query against. + * + * @return the project value + */ + public Object project() { + return this.project; + } + + /** + * Set the default BigQuery project to query against. + * + * @param project the project value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withProject(Object project) { + this.project = project; + return this; + } + + /** + * Get a comma-separated list of public BigQuery projects to access. + * + * @return the additionalProjects value + */ + public Object additionalProjects() { + return this.additionalProjects; + } + + /** + * Set a comma-separated list of public BigQuery projects to access. + * + * @param additionalProjects the additionalProjects value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withAdditionalProjects(Object additionalProjects) { + this.additionalProjects = additionalProjects; + return this; + } + + /** + * Get whether to request access to Google Drive. Allowing Google Drive access enables support for federated tables that combine BigQuery data with data from Google Drive. The default value is false. + * + * @return the requestGoogleDriveScope value + */ + public Object requestGoogleDriveScope() { + return this.requestGoogleDriveScope; + } + + /** + * Set whether to request access to Google Drive. Allowing Google Drive access enables support for federated tables that combine BigQuery data with data from Google Drive. The default value is false. + * + * @param requestGoogleDriveScope the requestGoogleDriveScope value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withRequestGoogleDriveScope(Object requestGoogleDriveScope) { + this.requestGoogleDriveScope = requestGoogleDriveScope; + return this; + } + + /** + * Get the OAuth 2.0 authentication mechanism used for authentication. ServiceAuthentication can only be used on self-hosted IR. Possible values include: 'ServiceAuthentication', 'UserAuthentication'. + * + * @return the authenticationType value + */ + public GoogleBigQueryAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the OAuth 2.0 authentication mechanism used for authentication. ServiceAuthentication can only be used on self-hosted IR. Possible values include: 'ServiceAuthentication', 'UserAuthentication'. + * + * @param authenticationType the authenticationType value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withAuthenticationType(GoogleBigQueryAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the refresh token obtained from Google for authorizing access to BigQuery for UserAuthentication. + * + * @return the refreshToken value + */ + public SecretBase refreshToken() { + return this.refreshToken; + } + + /** + * Set the refresh token obtained from Google for authorizing access to BigQuery for UserAuthentication. + * + * @param refreshToken the refreshToken value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withRefreshToken(SecretBase refreshToken) { + this.refreshToken = refreshToken; + return this; + } + + /** + * Get the client id of the google application used to acquire the refresh token. + * + * @return the clientId value + */ + public SecretBase clientId() { + return this.clientId; + } + + /** + * Set the client id of the google application used to acquire the refresh token. + * + * @param clientId the clientId value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withClientId(SecretBase clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the client secret of the google application used to acquire the refresh token. + * + * @return the clientSecret value + */ + public SecretBase clientSecret() { + return this.clientSecret; + } + + /** + * Set the client secret of the google application used to acquire the refresh token. + * + * @param clientSecret the clientSecret value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withClientSecret(SecretBase clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get the service account email ID that is used for ServiceAuthentication and can only be used on self-hosted IR. + * + * @return the email value + */ + public Object email() { + return this.email; + } + + /** + * Set the service account email ID that is used for ServiceAuthentication and can only be used on self-hosted IR. + * + * @param email the email value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withEmail(Object email) { + this.email = email; + return this; + } + + /** + * Get the full path to the .p12 key file that is used to authenticate the service account email address and can only be used on self-hosted IR. + * + * @return the keyFilePath value + */ + public Object keyFilePath() { + return this.keyFilePath; + } + + /** + * Set the full path to the .p12 key file that is used to authenticate the service account email address and can only be used on self-hosted IR. + * + * @param keyFilePath the keyFilePath value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withKeyFilePath(Object keyFilePath) { + this.keyFilePath = keyFilePath; + return this; + } + + /** + * Get the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @return the trustedCertPath value + */ + public Object trustedCertPath() { + return this.trustedCertPath; + } + + /** + * Set the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @param trustedCertPath the trustedCertPath value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withTrustedCertPath(Object trustedCertPath) { + this.trustedCertPath = trustedCertPath; + return this; + } + + /** + * Get specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @return the useSystemTrustStore value + */ + public Object useSystemTrustStore() { + return this.useSystemTrustStore; + } + + /** + * Set specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @param useSystemTrustStore the useSystemTrustStore value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withUseSystemTrustStore(Object useSystemTrustStore) { + this.useSystemTrustStore = useSystemTrustStore; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the GoogleBigQueryLinkedService object itself. + */ + public GoogleBigQueryLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQueryObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQueryObjectDataset.java new file mode 100644 index 000000000000..01c5aa3300eb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQueryObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Google BigQuery service dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("GoogleBigQueryObject") +public class GoogleBigQueryObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQuerySource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQuerySource.java new file mode 100644 index 000000000000..80cc1f31ad98 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GoogleBigQuerySource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Google BigQuery service source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("GoogleBigQuerySource") +public class GoogleBigQuerySource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the GoogleBigQuerySource object itself. + */ + public GoogleBigQuerySource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GreenplumLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GreenplumLinkedService.java new file mode 100644 index 000000000000..c2dc9bcb9c65 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GreenplumLinkedService.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Greenplum Database linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Greenplum") +@JsonFlatten +public class GreenplumLinkedService extends LinkedServiceInner { + /** + * An ODBC connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString") + private Object connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the GreenplumLinkedService object itself. + */ + public GreenplumLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the GreenplumLinkedService object itself. + */ + public GreenplumLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GreenplumSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GreenplumSource.java new file mode 100644 index 000000000000..0e83c0e79392 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GreenplumSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Greenplum Database source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("GreenplumSource") +public class GreenplumSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the GreenplumSource object itself. + */ + public GreenplumSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GreenplumTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GreenplumTableDataset.java new file mode 100644 index 000000000000..3723e3389742 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/GreenplumTableDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Greenplum Database dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("GreenplumTable") +public class GreenplumTableDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseAuthenticationType.java new file mode 100644 index 000000000000..fb2e1346dc85 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HBaseAuthenticationType. + */ +public final class HBaseAuthenticationType extends ExpandableStringEnum { + /** Static value Anonymous for HBaseAuthenticationType. */ + public static final HBaseAuthenticationType ANONYMOUS = fromString("Anonymous"); + + /** Static value Basic for HBaseAuthenticationType. */ + public static final HBaseAuthenticationType BASIC = fromString("Basic"); + + /** + * Creates or finds a HBaseAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding HBaseAuthenticationType + */ + @JsonCreator + public static HBaseAuthenticationType fromString(String name) { + return fromString(name, HBaseAuthenticationType.class); + } + + /** + * @return known HBaseAuthenticationType values + */ + public static Collection values() { + return values(HBaseAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseLinkedService.java new file mode 100644 index 000000000000..eb1542114adc --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseLinkedService.java @@ -0,0 +1,322 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * HBase server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HBase") +@JsonFlatten +public class HBaseLinkedService extends LinkedServiceInner { + /** + * The IP address or host name of the HBase server. (i.e. 192.168.222.160). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The TCP port that the HBase instance uses to listen for client + * connections. The default value is 9090. + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * The partial URL corresponding to the HBase server. (i.e. + * /gateway/sandbox/hbase/version). + */ + @JsonProperty(value = "typeProperties.httpPath") + private Object httpPath; + + /** + * The authentication mechanism to use to connect to the HBase server. + * Possible values include: 'Anonymous', 'Basic'. + */ + @JsonProperty(value = "typeProperties.authenticationType", required = true) + private HBaseAuthenticationType authenticationType; + + /** + * The user name used to connect to the HBase instance. + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * The password corresponding to the user name. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * Specifies whether the connections to the server are encrypted using SSL. + * The default value is false. + */ + @JsonProperty(value = "typeProperties.enableSsl") + private Object enableSsl; + + /** + * The full path of the .pem file containing trusted CA certificates for + * verifying the server when connecting over SSL. This property can only be + * set when using SSL on self-hosted IR. The default value is the + * cacerts.pem file installed with the IR. + */ + @JsonProperty(value = "typeProperties.trustedCertPath") + private Object trustedCertPath; + + /** + * Specifies whether to require a CA-issued SSL certificate name to match + * the host name of the server when connecting over SSL. The default value + * is false. + */ + @JsonProperty(value = "typeProperties.allowHostNameCNMismatch") + private Object allowHostNameCNMismatch; + + /** + * Specifies whether to allow self-signed certificates from the server. The + * default value is false. + */ + @JsonProperty(value = "typeProperties.allowSelfSignedServerCert") + private Object allowSelfSignedServerCert; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the IP address or host name of the HBase server. (i.e. 192.168.222.160). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the IP address or host name of the HBase server. (i.e. 192.168.222.160). + * + * @param host the host value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the TCP port that the HBase instance uses to listen for client connections. The default value is 9090. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port that the HBase instance uses to listen for client connections. The default value is 9090. + * + * @param port the port value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the partial URL corresponding to the HBase server. (i.e. /gateway/sandbox/hbase/version). + * + * @return the httpPath value + */ + public Object httpPath() { + return this.httpPath; + } + + /** + * Set the partial URL corresponding to the HBase server. (i.e. /gateway/sandbox/hbase/version). + * + * @param httpPath the httpPath value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withHttpPath(Object httpPath) { + this.httpPath = httpPath; + return this; + } + + /** + * Get the authentication mechanism to use to connect to the HBase server. Possible values include: 'Anonymous', 'Basic'. + * + * @return the authenticationType value + */ + public HBaseAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication mechanism to use to connect to the HBase server. Possible values include: 'Anonymous', 'Basic'. + * + * @param authenticationType the authenticationType value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withAuthenticationType(HBaseAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the user name used to connect to the HBase instance. + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the user name used to connect to the HBase instance. + * + * @param username the username value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password corresponding to the user name. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password corresponding to the user name. + * + * @param password the password value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @return the enableSsl value + */ + public Object enableSsl() { + return this.enableSsl; + } + + /** + * Set specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @param enableSsl the enableSsl value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withEnableSsl(Object enableSsl) { + this.enableSsl = enableSsl; + return this; + } + + /** + * Get the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @return the trustedCertPath value + */ + public Object trustedCertPath() { + return this.trustedCertPath; + } + + /** + * Set the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @param trustedCertPath the trustedCertPath value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withTrustedCertPath(Object trustedCertPath) { + this.trustedCertPath = trustedCertPath; + return this; + } + + /** + * Get specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @return the allowHostNameCNMismatch value + */ + public Object allowHostNameCNMismatch() { + return this.allowHostNameCNMismatch; + } + + /** + * Set specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @param allowHostNameCNMismatch the allowHostNameCNMismatch value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withAllowHostNameCNMismatch(Object allowHostNameCNMismatch) { + this.allowHostNameCNMismatch = allowHostNameCNMismatch; + return this; + } + + /** + * Get specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @return the allowSelfSignedServerCert value + */ + public Object allowSelfSignedServerCert() { + return this.allowSelfSignedServerCert; + } + + /** + * Set specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @param allowSelfSignedServerCert the allowSelfSignedServerCert value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedServerCert) { + this.allowSelfSignedServerCert = allowSelfSignedServerCert; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the HBaseLinkedService object itself. + */ + public HBaseLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseObjectDataset.java new file mode 100644 index 000000000000..1855d0c47fd6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * HBase server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HBaseObject") +public class HBaseObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseSource.java new file mode 100644 index 000000000000..4138c4ced08b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HBaseSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity HBase server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HBaseSource") +public class HBaseSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the HBaseSource object itself. + */ + public HBaseSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightActivityDebugInfoOption.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightActivityDebugInfoOption.java new file mode 100644 index 000000000000..5513da9a78cd --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightActivityDebugInfoOption.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HDInsightActivityDebugInfoOption. + */ +public final class HDInsightActivityDebugInfoOption extends ExpandableStringEnum { + /** Static value None for HDInsightActivityDebugInfoOption. */ + public static final HDInsightActivityDebugInfoOption NONE = fromString("None"); + + /** Static value Always for HDInsightActivityDebugInfoOption. */ + public static final HDInsightActivityDebugInfoOption ALWAYS = fromString("Always"); + + /** Static value Failure for HDInsightActivityDebugInfoOption. */ + public static final HDInsightActivityDebugInfoOption FAILURE = fromString("Failure"); + + /** + * Creates or finds a HDInsightActivityDebugInfoOption from its string representation. + * @param name a name to look for + * @return the corresponding HDInsightActivityDebugInfoOption + */ + @JsonCreator + public static HDInsightActivityDebugInfoOption fromString(String name) { + return fromString(name, HDInsightActivityDebugInfoOption.class); + } + + /** + * @return known HDInsightActivityDebugInfoOption values + */ + public static Collection values() { + return values(HDInsightActivityDebugInfoOption.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightHiveActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightHiveActivity.java new file mode 100644 index 000000000000..29512356db33 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightHiveActivity.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * HDInsight Hive activity type. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HDInsightHive") +@JsonFlatten +public class HDInsightHiveActivity extends ExecutionActivity { + /** + * Storage linked service references. + */ + @JsonProperty(value = "typeProperties.storageLinkedServices") + private List storageLinkedServices; + + /** + * User specified arguments to HDInsightActivity. + */ + @JsonProperty(value = "typeProperties.arguments") + private List arguments; + + /** + * Debug info option. Possible values include: 'None', 'Always', 'Failure'. + */ + @JsonProperty(value = "typeProperties.getDebugInfo") + private HDInsightActivityDebugInfoOption getDebugInfo; + + /** + * Script path. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.scriptPath") + private Object scriptPath; + + /** + * Script linked service reference. + */ + @JsonProperty(value = "typeProperties.scriptLinkedService") + private LinkedServiceReference scriptLinkedService; + + /** + * Allows user to specify defines for Hive job request. + */ + @JsonProperty(value = "typeProperties.defines") + private Map defines; + + /** + * Get storage linked service references. + * + * @return the storageLinkedServices value + */ + public List storageLinkedServices() { + return this.storageLinkedServices; + } + + /** + * Set storage linked service references. + * + * @param storageLinkedServices the storageLinkedServices value to set + * @return the HDInsightHiveActivity object itself. + */ + public HDInsightHiveActivity withStorageLinkedServices(List storageLinkedServices) { + this.storageLinkedServices = storageLinkedServices; + return this; + } + + /** + * Get user specified arguments to HDInsightActivity. + * + * @return the arguments value + */ + public List arguments() { + return this.arguments; + } + + /** + * Set user specified arguments to HDInsightActivity. + * + * @param arguments the arguments value to set + * @return the HDInsightHiveActivity object itself. + */ + public HDInsightHiveActivity withArguments(List arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get debug info option. Possible values include: 'None', 'Always', 'Failure'. + * + * @return the getDebugInfo value + */ + public HDInsightActivityDebugInfoOption getDebugInfo() { + return this.getDebugInfo; + } + + /** + * Set debug info option. Possible values include: 'None', 'Always', 'Failure'. + * + * @param getDebugInfo the getDebugInfo value to set + * @return the HDInsightHiveActivity object itself. + */ + public HDInsightHiveActivity withGetDebugInfo(HDInsightActivityDebugInfoOption getDebugInfo) { + this.getDebugInfo = getDebugInfo; + return this; + } + + /** + * Get script path. Type: string (or Expression with resultType string). + * + * @return the scriptPath value + */ + public Object scriptPath() { + return this.scriptPath; + } + + /** + * Set script path. Type: string (or Expression with resultType string). + * + * @param scriptPath the scriptPath value to set + * @return the HDInsightHiveActivity object itself. + */ + public HDInsightHiveActivity withScriptPath(Object scriptPath) { + this.scriptPath = scriptPath; + return this; + } + + /** + * Get script linked service reference. + * + * @return the scriptLinkedService value + */ + public LinkedServiceReference scriptLinkedService() { + return this.scriptLinkedService; + } + + /** + * Set script linked service reference. + * + * @param scriptLinkedService the scriptLinkedService value to set + * @return the HDInsightHiveActivity object itself. + */ + public HDInsightHiveActivity withScriptLinkedService(LinkedServiceReference scriptLinkedService) { + this.scriptLinkedService = scriptLinkedService; + return this; + } + + /** + * Get allows user to specify defines for Hive job request. + * + * @return the defines value + */ + public Map defines() { + return this.defines; + } + + /** + * Set allows user to specify defines for Hive job request. + * + * @param defines the defines value to set + * @return the HDInsightHiveActivity object itself. + */ + public HDInsightHiveActivity withDefines(Map defines) { + this.defines = defines; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightLinkedService.java new file mode 100644 index 000000000000..931991b6f725 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightLinkedService.java @@ -0,0 +1,185 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * HDInsight linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HDInsight") +@JsonFlatten +public class HDInsightLinkedService extends LinkedServiceInner { + /** + * HDInsight cluster URI. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.clusterUri", required = true) + private Object clusterUri; + + /** + * HDInsight cluster user name. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.userName") + private Object userName; + + /** + * HDInsight cluster password. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The Azure Storage linked service reference. + */ + @JsonProperty(value = "typeProperties.linkedServiceName") + private LinkedServiceReference linkedServiceName; + + /** + * A reference to the Azure SQL linked service that points to the HCatalog + * database. + */ + @JsonProperty(value = "typeProperties.hcatalogLinkedServiceName") + private LinkedServiceReference hcatalogLinkedServiceName; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get hDInsight cluster URI. Type: string (or Expression with resultType string). + * + * @return the clusterUri value + */ + public Object clusterUri() { + return this.clusterUri; + } + + /** + * Set hDInsight cluster URI. Type: string (or Expression with resultType string). + * + * @param clusterUri the clusterUri value to set + * @return the HDInsightLinkedService object itself. + */ + public HDInsightLinkedService withClusterUri(Object clusterUri) { + this.clusterUri = clusterUri; + return this; + } + + /** + * Get hDInsight cluster user name. Type: string (or Expression with resultType string). + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set hDInsight cluster user name. Type: string (or Expression with resultType string). + * + * @param userName the userName value to set + * @return the HDInsightLinkedService object itself. + */ + public HDInsightLinkedService withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get hDInsight cluster password. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set hDInsight cluster password. + * + * @param password the password value to set + * @return the HDInsightLinkedService object itself. + */ + public HDInsightLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the Azure Storage linked service reference. + * + * @return the linkedServiceName value + */ + public LinkedServiceReference linkedServiceName() { + return this.linkedServiceName; + } + + /** + * Set the Azure Storage linked service reference. + * + * @param linkedServiceName the linkedServiceName value to set + * @return the HDInsightLinkedService object itself. + */ + public HDInsightLinkedService withLinkedServiceName(LinkedServiceReference linkedServiceName) { + this.linkedServiceName = linkedServiceName; + return this; + } + + /** + * Get a reference to the Azure SQL linked service that points to the HCatalog database. + * + * @return the hcatalogLinkedServiceName value + */ + public LinkedServiceReference hcatalogLinkedServiceName() { + return this.hcatalogLinkedServiceName; + } + + /** + * Set a reference to the Azure SQL linked service that points to the HCatalog database. + * + * @param hcatalogLinkedServiceName the hcatalogLinkedServiceName value to set + * @return the HDInsightLinkedService object itself. + */ + public HDInsightLinkedService withHcatalogLinkedServiceName(LinkedServiceReference hcatalogLinkedServiceName) { + this.hcatalogLinkedServiceName = hcatalogLinkedServiceName; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the HDInsightLinkedService object itself. + */ + public HDInsightLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightMapReduceActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightMapReduceActivity.java new file mode 100644 index 000000000000..e7ef7b5a83d0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightMapReduceActivity.java @@ -0,0 +1,233 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * HDInsight MapReduce activity type. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HDInsightMapReduce") +@JsonFlatten +public class HDInsightMapReduceActivity extends ExecutionActivity { + /** + * Storage linked service references. + */ + @JsonProperty(value = "typeProperties.storageLinkedServices") + private List storageLinkedServices; + + /** + * User specified arguments to HDInsightActivity. + */ + @JsonProperty(value = "typeProperties.arguments") + private List arguments; + + /** + * Debug info option. Possible values include: 'None', 'Always', 'Failure'. + */ + @JsonProperty(value = "typeProperties.getDebugInfo") + private HDInsightActivityDebugInfoOption getDebugInfo; + + /** + * Class name. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.className", required = true) + private Object className; + + /** + * Jar path. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.jarFilePath", required = true) + private Object jarFilePath; + + /** + * Jar linked service reference. + */ + @JsonProperty(value = "typeProperties.jarLinkedService") + private LinkedServiceReference jarLinkedService; + + /** + * Jar libs. + */ + @JsonProperty(value = "typeProperties.jarLibs") + private List jarLibs; + + /** + * Allows user to specify defines for the MapReduce job request. + */ + @JsonProperty(value = "typeProperties.defines") + private Map defines; + + /** + * Get storage linked service references. + * + * @return the storageLinkedServices value + */ + public List storageLinkedServices() { + return this.storageLinkedServices; + } + + /** + * Set storage linked service references. + * + * @param storageLinkedServices the storageLinkedServices value to set + * @return the HDInsightMapReduceActivity object itself. + */ + public HDInsightMapReduceActivity withStorageLinkedServices(List storageLinkedServices) { + this.storageLinkedServices = storageLinkedServices; + return this; + } + + /** + * Get user specified arguments to HDInsightActivity. + * + * @return the arguments value + */ + public List arguments() { + return this.arguments; + } + + /** + * Set user specified arguments to HDInsightActivity. + * + * @param arguments the arguments value to set + * @return the HDInsightMapReduceActivity object itself. + */ + public HDInsightMapReduceActivity withArguments(List arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get debug info option. Possible values include: 'None', 'Always', 'Failure'. + * + * @return the getDebugInfo value + */ + public HDInsightActivityDebugInfoOption getDebugInfo() { + return this.getDebugInfo; + } + + /** + * Set debug info option. Possible values include: 'None', 'Always', 'Failure'. + * + * @param getDebugInfo the getDebugInfo value to set + * @return the HDInsightMapReduceActivity object itself. + */ + public HDInsightMapReduceActivity withGetDebugInfo(HDInsightActivityDebugInfoOption getDebugInfo) { + this.getDebugInfo = getDebugInfo; + return this; + } + + /** + * Get class name. Type: string (or Expression with resultType string). + * + * @return the className value + */ + public Object className() { + return this.className; + } + + /** + * Set class name. Type: string (or Expression with resultType string). + * + * @param className the className value to set + * @return the HDInsightMapReduceActivity object itself. + */ + public HDInsightMapReduceActivity withClassName(Object className) { + this.className = className; + return this; + } + + /** + * Get jar path. Type: string (or Expression with resultType string). + * + * @return the jarFilePath value + */ + public Object jarFilePath() { + return this.jarFilePath; + } + + /** + * Set jar path. Type: string (or Expression with resultType string). + * + * @param jarFilePath the jarFilePath value to set + * @return the HDInsightMapReduceActivity object itself. + */ + public HDInsightMapReduceActivity withJarFilePath(Object jarFilePath) { + this.jarFilePath = jarFilePath; + return this; + } + + /** + * Get jar linked service reference. + * + * @return the jarLinkedService value + */ + public LinkedServiceReference jarLinkedService() { + return this.jarLinkedService; + } + + /** + * Set jar linked service reference. + * + * @param jarLinkedService the jarLinkedService value to set + * @return the HDInsightMapReduceActivity object itself. + */ + public HDInsightMapReduceActivity withJarLinkedService(LinkedServiceReference jarLinkedService) { + this.jarLinkedService = jarLinkedService; + return this; + } + + /** + * Get jar libs. + * + * @return the jarLibs value + */ + public List jarLibs() { + return this.jarLibs; + } + + /** + * Set jar libs. + * + * @param jarLibs the jarLibs value to set + * @return the HDInsightMapReduceActivity object itself. + */ + public HDInsightMapReduceActivity withJarLibs(List jarLibs) { + this.jarLibs = jarLibs; + return this; + } + + /** + * Get allows user to specify defines for the MapReduce job request. + * + * @return the defines value + */ + public Map defines() { + return this.defines; + } + + /** + * Set allows user to specify defines for the MapReduce job request. + * + * @param defines the defines value to set + * @return the HDInsightMapReduceActivity object itself. + */ + public HDInsightMapReduceActivity withDefines(Map defines) { + this.defines = defines; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightOnDemandLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightOnDemandLinkedService.java new file mode 100644 index 000000000000..f8d24f4ddde2 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightOnDemandLinkedService.java @@ -0,0 +1,833 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * HDInsight ondemand linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HDInsightOnDemand") +@JsonFlatten +public class HDInsightOnDemandLinkedService extends LinkedServiceInner { + /** + * Number of worker/data nodes in the cluster. Suggestion value: 4. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.clusterSize", required = true) + private Object clusterSize; + + /** + * The allowed idle time for the on-demand HDInsight cluster. Specifies how + * long the on-demand HDInsight cluster stays alive after completion of an + * activity run if there are no other active jobs in the cluster. The + * minimum value is 5 mins. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.timeToLive", required = true) + private Object timeToLive; + + /** + * Version of the HDInsight cluster.  Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.version", required = true) + private Object version; + + /** + * Azure Storage linked service to be used by the on-demand cluster for + * storing and processing data. + */ + @JsonProperty(value = "typeProperties.linkedServiceName", required = true) + private LinkedServiceReference linkedServiceName; + + /** + * The customer’s subscription to host the cluster. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.hostSubscriptionId", required = true) + private Object hostSubscriptionId; + + /** + * The service principal id for the hostSubscriptionId. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.servicePrincipalId") + private Object servicePrincipalId; + + /** + * The key for the service principal id. + */ + @JsonProperty(value = "typeProperties.servicePrincipalKey") + private SecretBase servicePrincipalKey; + + /** + * The Tenant id/name to which the service principal belongs. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.tenant", required = true) + private Object tenant; + + /** + * The resource group where the cluster belongs. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.clusterResourceGroup", required = true) + private Object clusterResourceGroup; + + /** + * The prefix of cluster name, postfix will be distinct with timestamp. + * Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.clusterNamePrefix") + private Object clusterNamePrefix; + + /** + * The username to access the cluster. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.clusterUserName") + private Object clusterUserName; + + /** + * The password to access the cluster. + */ + @JsonProperty(value = "typeProperties.clusterPassword") + private SecretBase clusterPassword; + + /** + * The username to SSH remotely connect to cluster’s node (for Linux). + * Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.clusterSshUserName") + private Object clusterSshUserName; + + /** + * The password to SSH remotely connect cluster’s node (for Linux). + */ + @JsonProperty(value = "typeProperties.clusterSshPassword") + private SecretBase clusterSshPassword; + + /** + * Specifies additional storage accounts for the HDInsight linked service + * so that the Data Factory service can register them on your behalf. + */ + @JsonProperty(value = "typeProperties.additionalLinkedServiceNames") + private List additionalLinkedServiceNames; + + /** + * The name of Azure SQL linked service that point to the HCatalog + * database. The on-demand HDInsight cluster is created by using the Azure + * SQL database as the metastore. + */ + @JsonProperty(value = "typeProperties.hcatalogLinkedServiceName") + private LinkedServiceReference hcatalogLinkedServiceName; + + /** + * The cluster type. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.clusterType") + private Object clusterType; + + /** + * The version of spark if the cluster type is 'spark'. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.sparkVersion") + private Object sparkVersion; + + /** + * Specifies the core configuration parameters (as in core-site.xml) for + * the HDInsight cluster to be created. + */ + @JsonProperty(value = "typeProperties.coreConfiguration") + private Object coreConfiguration; + + /** + * Specifies the HBase configuration parameters (hbase-site.xml) for the + * HDInsight cluster. + */ + @JsonProperty(value = "typeProperties.hBaseConfiguration") + private Object hBaseConfiguration; + + /** + * Specifies the HDFS configuration parameters (hdfs-site.xml) for the + * HDInsight cluster. + */ + @JsonProperty(value = "typeProperties.hdfsConfiguration") + private Object hdfsConfiguration; + + /** + * Specifies the hive configuration parameters (hive-site.xml) for the + * HDInsight cluster. + */ + @JsonProperty(value = "typeProperties.hiveConfiguration") + private Object hiveConfiguration; + + /** + * Specifies the MapReduce configuration parameters (mapred-site.xml) for + * the HDInsight cluster. + */ + @JsonProperty(value = "typeProperties.mapReduceConfiguration") + private Object mapReduceConfiguration; + + /** + * Specifies the Oozie configuration parameters (oozie-site.xml) for the + * HDInsight cluster. + */ + @JsonProperty(value = "typeProperties.oozieConfiguration") + private Object oozieConfiguration; + + /** + * Specifies the Storm configuration parameters (storm-site.xml) for the + * HDInsight cluster. + */ + @JsonProperty(value = "typeProperties.stormConfiguration") + private Object stormConfiguration; + + /** + * Specifies the Yarn configuration parameters (yarn-site.xml) for the + * HDInsight cluster. + */ + @JsonProperty(value = "typeProperties.yarnConfiguration") + private Object yarnConfiguration; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Specifies the size of the head node for the HDInsight cluster. + */ + @JsonProperty(value = "typeProperties.headNodeSize") + private Object headNodeSize; + + /** + * Specifies the size of the data node for the HDInsight cluster. + */ + @JsonProperty(value = "typeProperties.dataNodeSize") + private Object dataNodeSize; + + /** + * Specifies the size of the Zoo Keeper node for the HDInsight cluster. + */ + @JsonProperty(value = "typeProperties.zookeeperNodeSize") + private Object zookeeperNodeSize; + + /** + * Get number of worker/data nodes in the cluster. Suggestion value: 4. Type: string (or Expression with resultType string). + * + * @return the clusterSize value + */ + public Object clusterSize() { + return this.clusterSize; + } + + /** + * Set number of worker/data nodes in the cluster. Suggestion value: 4. Type: string (or Expression with resultType string). + * + * @param clusterSize the clusterSize value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withClusterSize(Object clusterSize) { + this.clusterSize = clusterSize; + return this; + } + + /** + * Get the allowed idle time for the on-demand HDInsight cluster. Specifies how long the on-demand HDInsight cluster stays alive after completion of an activity run if there are no other active jobs in the cluster. The minimum value is 5 mins. Type: string (or Expression with resultType string). + * + * @return the timeToLive value + */ + public Object timeToLive() { + return this.timeToLive; + } + + /** + * Set the allowed idle time for the on-demand HDInsight cluster. Specifies how long the on-demand HDInsight cluster stays alive after completion of an activity run if there are no other active jobs in the cluster. The minimum value is 5 mins. Type: string (or Expression with resultType string). + * + * @param timeToLive the timeToLive value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withTimeToLive(Object timeToLive) { + this.timeToLive = timeToLive; + return this; + } + + /** + * Get version of the HDInsight cluster.  Type: string (or Expression with resultType string). + * + * @return the version value + */ + public Object version() { + return this.version; + } + + /** + * Set version of the HDInsight cluster.  Type: string (or Expression with resultType string). + * + * @param version the version value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withVersion(Object version) { + this.version = version; + return this; + } + + /** + * Get azure Storage linked service to be used by the on-demand cluster for storing and processing data. + * + * @return the linkedServiceName value + */ + public LinkedServiceReference linkedServiceName() { + return this.linkedServiceName; + } + + /** + * Set azure Storage linked service to be used by the on-demand cluster for storing and processing data. + * + * @param linkedServiceName the linkedServiceName value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withLinkedServiceName(LinkedServiceReference linkedServiceName) { + this.linkedServiceName = linkedServiceName; + return this; + } + + /** + * Get the customer’s subscription to host the cluster. Type: string (or Expression with resultType string). + * + * @return the hostSubscriptionId value + */ + public Object hostSubscriptionId() { + return this.hostSubscriptionId; + } + + /** + * Set the customer’s subscription to host the cluster. Type: string (or Expression with resultType string). + * + * @param hostSubscriptionId the hostSubscriptionId value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withHostSubscriptionId(Object hostSubscriptionId) { + this.hostSubscriptionId = hostSubscriptionId; + return this; + } + + /** + * Get the service principal id for the hostSubscriptionId. Type: string (or Expression with resultType string). + * + * @return the servicePrincipalId value + */ + public Object servicePrincipalId() { + return this.servicePrincipalId; + } + + /** + * Set the service principal id for the hostSubscriptionId. Type: string (or Expression with resultType string). + * + * @param servicePrincipalId the servicePrincipalId value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withServicePrincipalId(Object servicePrincipalId) { + this.servicePrincipalId = servicePrincipalId; + return this; + } + + /** + * Get the key for the service principal id. + * + * @return the servicePrincipalKey value + */ + public SecretBase servicePrincipalKey() { + return this.servicePrincipalKey; + } + + /** + * Set the key for the service principal id. + * + * @param servicePrincipalKey the servicePrincipalKey value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withServicePrincipalKey(SecretBase servicePrincipalKey) { + this.servicePrincipalKey = servicePrincipalKey; + return this; + } + + /** + * Get the Tenant id/name to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @return the tenant value + */ + public Object tenant() { + return this.tenant; + } + + /** + * Set the Tenant id/name to which the service principal belongs. Type: string (or Expression with resultType string). + * + * @param tenant the tenant value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withTenant(Object tenant) { + this.tenant = tenant; + return this; + } + + /** + * Get the resource group where the cluster belongs. Type: string (or Expression with resultType string). + * + * @return the clusterResourceGroup value + */ + public Object clusterResourceGroup() { + return this.clusterResourceGroup; + } + + /** + * Set the resource group where the cluster belongs. Type: string (or Expression with resultType string). + * + * @param clusterResourceGroup the clusterResourceGroup value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withClusterResourceGroup(Object clusterResourceGroup) { + this.clusterResourceGroup = clusterResourceGroup; + return this; + } + + /** + * Get the prefix of cluster name, postfix will be distinct with timestamp. Type: string (or Expression with resultType string). + * + * @return the clusterNamePrefix value + */ + public Object clusterNamePrefix() { + return this.clusterNamePrefix; + } + + /** + * Set the prefix of cluster name, postfix will be distinct with timestamp. Type: string (or Expression with resultType string). + * + * @param clusterNamePrefix the clusterNamePrefix value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withClusterNamePrefix(Object clusterNamePrefix) { + this.clusterNamePrefix = clusterNamePrefix; + return this; + } + + /** + * Get the username to access the cluster. Type: string (or Expression with resultType string). + * + * @return the clusterUserName value + */ + public Object clusterUserName() { + return this.clusterUserName; + } + + /** + * Set the username to access the cluster. Type: string (or Expression with resultType string). + * + * @param clusterUserName the clusterUserName value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withClusterUserName(Object clusterUserName) { + this.clusterUserName = clusterUserName; + return this; + } + + /** + * Get the password to access the cluster. + * + * @return the clusterPassword value + */ + public SecretBase clusterPassword() { + return this.clusterPassword; + } + + /** + * Set the password to access the cluster. + * + * @param clusterPassword the clusterPassword value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withClusterPassword(SecretBase clusterPassword) { + this.clusterPassword = clusterPassword; + return this; + } + + /** + * Get the username to SSH remotely connect to cluster’s node (for Linux). Type: string (or Expression with resultType string). + * + * @return the clusterSshUserName value + */ + public Object clusterSshUserName() { + return this.clusterSshUserName; + } + + /** + * Set the username to SSH remotely connect to cluster’s node (for Linux). Type: string (or Expression with resultType string). + * + * @param clusterSshUserName the clusterSshUserName value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withClusterSshUserName(Object clusterSshUserName) { + this.clusterSshUserName = clusterSshUserName; + return this; + } + + /** + * Get the password to SSH remotely connect cluster’s node (for Linux). + * + * @return the clusterSshPassword value + */ + public SecretBase clusterSshPassword() { + return this.clusterSshPassword; + } + + /** + * Set the password to SSH remotely connect cluster’s node (for Linux). + * + * @param clusterSshPassword the clusterSshPassword value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withClusterSshPassword(SecretBase clusterSshPassword) { + this.clusterSshPassword = clusterSshPassword; + return this; + } + + /** + * Get specifies additional storage accounts for the HDInsight linked service so that the Data Factory service can register them on your behalf. + * + * @return the additionalLinkedServiceNames value + */ + public List additionalLinkedServiceNames() { + return this.additionalLinkedServiceNames; + } + + /** + * Set specifies additional storage accounts for the HDInsight linked service so that the Data Factory service can register them on your behalf. + * + * @param additionalLinkedServiceNames the additionalLinkedServiceNames value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withAdditionalLinkedServiceNames(List additionalLinkedServiceNames) { + this.additionalLinkedServiceNames = additionalLinkedServiceNames; + return this; + } + + /** + * Get the name of Azure SQL linked service that point to the HCatalog database. The on-demand HDInsight cluster is created by using the Azure SQL database as the metastore. + * + * @return the hcatalogLinkedServiceName value + */ + public LinkedServiceReference hcatalogLinkedServiceName() { + return this.hcatalogLinkedServiceName; + } + + /** + * Set the name of Azure SQL linked service that point to the HCatalog database. The on-demand HDInsight cluster is created by using the Azure SQL database as the metastore. + * + * @param hcatalogLinkedServiceName the hcatalogLinkedServiceName value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withHcatalogLinkedServiceName(LinkedServiceReference hcatalogLinkedServiceName) { + this.hcatalogLinkedServiceName = hcatalogLinkedServiceName; + return this; + } + + /** + * Get the cluster type. Type: string (or Expression with resultType string). + * + * @return the clusterType value + */ + public Object clusterType() { + return this.clusterType; + } + + /** + * Set the cluster type. Type: string (or Expression with resultType string). + * + * @param clusterType the clusterType value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withClusterType(Object clusterType) { + this.clusterType = clusterType; + return this; + } + + /** + * Get the version of spark if the cluster type is 'spark'. Type: string (or Expression with resultType string). + * + * @return the sparkVersion value + */ + public Object sparkVersion() { + return this.sparkVersion; + } + + /** + * Set the version of spark if the cluster type is 'spark'. Type: string (or Expression with resultType string). + * + * @param sparkVersion the sparkVersion value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withSparkVersion(Object sparkVersion) { + this.sparkVersion = sparkVersion; + return this; + } + + /** + * Get specifies the core configuration parameters (as in core-site.xml) for the HDInsight cluster to be created. + * + * @return the coreConfiguration value + */ + public Object coreConfiguration() { + return this.coreConfiguration; + } + + /** + * Set specifies the core configuration parameters (as in core-site.xml) for the HDInsight cluster to be created. + * + * @param coreConfiguration the coreConfiguration value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withCoreConfiguration(Object coreConfiguration) { + this.coreConfiguration = coreConfiguration; + return this; + } + + /** + * Get specifies the HBase configuration parameters (hbase-site.xml) for the HDInsight cluster. + * + * @return the hBaseConfiguration value + */ + public Object hBaseConfiguration() { + return this.hBaseConfiguration; + } + + /** + * Set specifies the HBase configuration parameters (hbase-site.xml) for the HDInsight cluster. + * + * @param hBaseConfiguration the hBaseConfiguration value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withHBaseConfiguration(Object hBaseConfiguration) { + this.hBaseConfiguration = hBaseConfiguration; + return this; + } + + /** + * Get specifies the HDFS configuration parameters (hdfs-site.xml) for the HDInsight cluster. + * + * @return the hdfsConfiguration value + */ + public Object hdfsConfiguration() { + return this.hdfsConfiguration; + } + + /** + * Set specifies the HDFS configuration parameters (hdfs-site.xml) for the HDInsight cluster. + * + * @param hdfsConfiguration the hdfsConfiguration value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withHdfsConfiguration(Object hdfsConfiguration) { + this.hdfsConfiguration = hdfsConfiguration; + return this; + } + + /** + * Get specifies the hive configuration parameters (hive-site.xml) for the HDInsight cluster. + * + * @return the hiveConfiguration value + */ + public Object hiveConfiguration() { + return this.hiveConfiguration; + } + + /** + * Set specifies the hive configuration parameters (hive-site.xml) for the HDInsight cluster. + * + * @param hiveConfiguration the hiveConfiguration value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withHiveConfiguration(Object hiveConfiguration) { + this.hiveConfiguration = hiveConfiguration; + return this; + } + + /** + * Get specifies the MapReduce configuration parameters (mapred-site.xml) for the HDInsight cluster. + * + * @return the mapReduceConfiguration value + */ + public Object mapReduceConfiguration() { + return this.mapReduceConfiguration; + } + + /** + * Set specifies the MapReduce configuration parameters (mapred-site.xml) for the HDInsight cluster. + * + * @param mapReduceConfiguration the mapReduceConfiguration value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withMapReduceConfiguration(Object mapReduceConfiguration) { + this.mapReduceConfiguration = mapReduceConfiguration; + return this; + } + + /** + * Get specifies the Oozie configuration parameters (oozie-site.xml) for the HDInsight cluster. + * + * @return the oozieConfiguration value + */ + public Object oozieConfiguration() { + return this.oozieConfiguration; + } + + /** + * Set specifies the Oozie configuration parameters (oozie-site.xml) for the HDInsight cluster. + * + * @param oozieConfiguration the oozieConfiguration value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withOozieConfiguration(Object oozieConfiguration) { + this.oozieConfiguration = oozieConfiguration; + return this; + } + + /** + * Get specifies the Storm configuration parameters (storm-site.xml) for the HDInsight cluster. + * + * @return the stormConfiguration value + */ + public Object stormConfiguration() { + return this.stormConfiguration; + } + + /** + * Set specifies the Storm configuration parameters (storm-site.xml) for the HDInsight cluster. + * + * @param stormConfiguration the stormConfiguration value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withStormConfiguration(Object stormConfiguration) { + this.stormConfiguration = stormConfiguration; + return this; + } + + /** + * Get specifies the Yarn configuration parameters (yarn-site.xml) for the HDInsight cluster. + * + * @return the yarnConfiguration value + */ + public Object yarnConfiguration() { + return this.yarnConfiguration; + } + + /** + * Set specifies the Yarn configuration parameters (yarn-site.xml) for the HDInsight cluster. + * + * @param yarnConfiguration the yarnConfiguration value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withYarnConfiguration(Object yarnConfiguration) { + this.yarnConfiguration = yarnConfiguration; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + + /** + * Get specifies the size of the head node for the HDInsight cluster. + * + * @return the headNodeSize value + */ + public Object headNodeSize() { + return this.headNodeSize; + } + + /** + * Set specifies the size of the head node for the HDInsight cluster. + * + * @param headNodeSize the headNodeSize value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withHeadNodeSize(Object headNodeSize) { + this.headNodeSize = headNodeSize; + return this; + } + + /** + * Get specifies the size of the data node for the HDInsight cluster. + * + * @return the dataNodeSize value + */ + public Object dataNodeSize() { + return this.dataNodeSize; + } + + /** + * Set specifies the size of the data node for the HDInsight cluster. + * + * @param dataNodeSize the dataNodeSize value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withDataNodeSize(Object dataNodeSize) { + this.dataNodeSize = dataNodeSize; + return this; + } + + /** + * Get specifies the size of the Zoo Keeper node for the HDInsight cluster. + * + * @return the zookeeperNodeSize value + */ + public Object zookeeperNodeSize() { + return this.zookeeperNodeSize; + } + + /** + * Set specifies the size of the Zoo Keeper node for the HDInsight cluster. + * + * @param zookeeperNodeSize the zookeeperNodeSize value to set + * @return the HDInsightOnDemandLinkedService object itself. + */ + public HDInsightOnDemandLinkedService withZookeeperNodeSize(Object zookeeperNodeSize) { + this.zookeeperNodeSize = zookeeperNodeSize; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightPigActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightPigActivity.java new file mode 100644 index 000000000000..186e521b124a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightPigActivity.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * HDInsight Pig activity type. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HDInsightPig") +@JsonFlatten +public class HDInsightPigActivity extends ExecutionActivity { + /** + * Storage linked service references. + */ + @JsonProperty(value = "typeProperties.storageLinkedServices") + private List storageLinkedServices; + + /** + * User specified arguments to HDInsightActivity. + */ + @JsonProperty(value = "typeProperties.arguments") + private List arguments; + + /** + * Debug info option. Possible values include: 'None', 'Always', 'Failure'. + */ + @JsonProperty(value = "typeProperties.getDebugInfo") + private HDInsightActivityDebugInfoOption getDebugInfo; + + /** + * Script path. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.scriptPath") + private Object scriptPath; + + /** + * Script linked service reference. + */ + @JsonProperty(value = "typeProperties.scriptLinkedService") + private LinkedServiceReference scriptLinkedService; + + /** + * Allows user to specify defines for Pig job request. + */ + @JsonProperty(value = "typeProperties.defines") + private Map defines; + + /** + * Get storage linked service references. + * + * @return the storageLinkedServices value + */ + public List storageLinkedServices() { + return this.storageLinkedServices; + } + + /** + * Set storage linked service references. + * + * @param storageLinkedServices the storageLinkedServices value to set + * @return the HDInsightPigActivity object itself. + */ + public HDInsightPigActivity withStorageLinkedServices(List storageLinkedServices) { + this.storageLinkedServices = storageLinkedServices; + return this; + } + + /** + * Get user specified arguments to HDInsightActivity. + * + * @return the arguments value + */ + public List arguments() { + return this.arguments; + } + + /** + * Set user specified arguments to HDInsightActivity. + * + * @param arguments the arguments value to set + * @return the HDInsightPigActivity object itself. + */ + public HDInsightPigActivity withArguments(List arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get debug info option. Possible values include: 'None', 'Always', 'Failure'. + * + * @return the getDebugInfo value + */ + public HDInsightActivityDebugInfoOption getDebugInfo() { + return this.getDebugInfo; + } + + /** + * Set debug info option. Possible values include: 'None', 'Always', 'Failure'. + * + * @param getDebugInfo the getDebugInfo value to set + * @return the HDInsightPigActivity object itself. + */ + public HDInsightPigActivity withGetDebugInfo(HDInsightActivityDebugInfoOption getDebugInfo) { + this.getDebugInfo = getDebugInfo; + return this; + } + + /** + * Get script path. Type: string (or Expression with resultType string). + * + * @return the scriptPath value + */ + public Object scriptPath() { + return this.scriptPath; + } + + /** + * Set script path. Type: string (or Expression with resultType string). + * + * @param scriptPath the scriptPath value to set + * @return the HDInsightPigActivity object itself. + */ + public HDInsightPigActivity withScriptPath(Object scriptPath) { + this.scriptPath = scriptPath; + return this; + } + + /** + * Get script linked service reference. + * + * @return the scriptLinkedService value + */ + public LinkedServiceReference scriptLinkedService() { + return this.scriptLinkedService; + } + + /** + * Set script linked service reference. + * + * @param scriptLinkedService the scriptLinkedService value to set + * @return the HDInsightPigActivity object itself. + */ + public HDInsightPigActivity withScriptLinkedService(LinkedServiceReference scriptLinkedService) { + this.scriptLinkedService = scriptLinkedService; + return this; + } + + /** + * Get allows user to specify defines for Pig job request. + * + * @return the defines value + */ + public Map defines() { + return this.defines; + } + + /** + * Set allows user to specify defines for Pig job request. + * + * @param defines the defines value to set + * @return the HDInsightPigActivity object itself. + */ + public HDInsightPigActivity withDefines(Map defines) { + this.defines = defines; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightSparkActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightSparkActivity.java new file mode 100644 index 000000000000..759491ecbfc4 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightSparkActivity.java @@ -0,0 +1,237 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * HDInsight Spark activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HDInsightSpark") +@JsonFlatten +public class HDInsightSparkActivity extends ExecutionActivity { + /** + * The root path in 'sparkJobLinkedService' for all the job’s files. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.rootPath", required = true) + private Object rootPath; + + /** + * The relative path to the root folder of the code/package to be executed. + * Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.entryFilePath", required = true) + private Object entryFilePath; + + /** + * The user-specified arguments to HDInsightSparkActivity. + */ + @JsonProperty(value = "typeProperties.arguments") + private List arguments; + + /** + * Debug info option. Possible values include: 'None', 'Always', 'Failure'. + */ + @JsonProperty(value = "typeProperties.getDebugInfo") + private HDInsightActivityDebugInfoOption getDebugInfo; + + /** + * The storage linked service for uploading the entry file and + * dependencies, and for receiving logs. + */ + @JsonProperty(value = "typeProperties.sparkJobLinkedService") + private LinkedServiceReference sparkJobLinkedService; + + /** + * The application's Java/Spark main class. + */ + @JsonProperty(value = "typeProperties.className") + private String className; + + /** + * The user to impersonate that will execute the job. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.proxyUser") + private Object proxyUser; + + /** + * Spark configuration property. + */ + @JsonProperty(value = "typeProperties.sparkConfig") + private Map sparkConfig; + + /** + * Get the root path in 'sparkJobLinkedService' for all the job’s files. Type: string (or Expression with resultType string). + * + * @return the rootPath value + */ + public Object rootPath() { + return this.rootPath; + } + + /** + * Set the root path in 'sparkJobLinkedService' for all the job’s files. Type: string (or Expression with resultType string). + * + * @param rootPath the rootPath value to set + * @return the HDInsightSparkActivity object itself. + */ + public HDInsightSparkActivity withRootPath(Object rootPath) { + this.rootPath = rootPath; + return this; + } + + /** + * Get the relative path to the root folder of the code/package to be executed. Type: string (or Expression with resultType string). + * + * @return the entryFilePath value + */ + public Object entryFilePath() { + return this.entryFilePath; + } + + /** + * Set the relative path to the root folder of the code/package to be executed. Type: string (or Expression with resultType string). + * + * @param entryFilePath the entryFilePath value to set + * @return the HDInsightSparkActivity object itself. + */ + public HDInsightSparkActivity withEntryFilePath(Object entryFilePath) { + this.entryFilePath = entryFilePath; + return this; + } + + /** + * Get the user-specified arguments to HDInsightSparkActivity. + * + * @return the arguments value + */ + public List arguments() { + return this.arguments; + } + + /** + * Set the user-specified arguments to HDInsightSparkActivity. + * + * @param arguments the arguments value to set + * @return the HDInsightSparkActivity object itself. + */ + public HDInsightSparkActivity withArguments(List arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get debug info option. Possible values include: 'None', 'Always', 'Failure'. + * + * @return the getDebugInfo value + */ + public HDInsightActivityDebugInfoOption getDebugInfo() { + return this.getDebugInfo; + } + + /** + * Set debug info option. Possible values include: 'None', 'Always', 'Failure'. + * + * @param getDebugInfo the getDebugInfo value to set + * @return the HDInsightSparkActivity object itself. + */ + public HDInsightSparkActivity withGetDebugInfo(HDInsightActivityDebugInfoOption getDebugInfo) { + this.getDebugInfo = getDebugInfo; + return this; + } + + /** + * Get the storage linked service for uploading the entry file and dependencies, and for receiving logs. + * + * @return the sparkJobLinkedService value + */ + public LinkedServiceReference sparkJobLinkedService() { + return this.sparkJobLinkedService; + } + + /** + * Set the storage linked service for uploading the entry file and dependencies, and for receiving logs. + * + * @param sparkJobLinkedService the sparkJobLinkedService value to set + * @return the HDInsightSparkActivity object itself. + */ + public HDInsightSparkActivity withSparkJobLinkedService(LinkedServiceReference sparkJobLinkedService) { + this.sparkJobLinkedService = sparkJobLinkedService; + return this; + } + + /** + * Get the application's Java/Spark main class. + * + * @return the className value + */ + public String className() { + return this.className; + } + + /** + * Set the application's Java/Spark main class. + * + * @param className the className value to set + * @return the HDInsightSparkActivity object itself. + */ + public HDInsightSparkActivity withClassName(String className) { + this.className = className; + return this; + } + + /** + * Get the user to impersonate that will execute the job. Type: string (or Expression with resultType string). + * + * @return the proxyUser value + */ + public Object proxyUser() { + return this.proxyUser; + } + + /** + * Set the user to impersonate that will execute the job. Type: string (or Expression with resultType string). + * + * @param proxyUser the proxyUser value to set + * @return the HDInsightSparkActivity object itself. + */ + public HDInsightSparkActivity withProxyUser(Object proxyUser) { + this.proxyUser = proxyUser; + return this; + } + + /** + * Get spark configuration property. + * + * @return the sparkConfig value + */ + public Map sparkConfig() { + return this.sparkConfig; + } + + /** + * Set spark configuration property. + * + * @param sparkConfig the sparkConfig value to set + * @return the HDInsightSparkActivity object itself. + */ + public HDInsightSparkActivity withSparkConfig(Map sparkConfig) { + this.sparkConfig = sparkConfig; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightStreamingActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightStreamingActivity.java new file mode 100644 index 000000000000..63ad0de77f90 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HDInsightStreamingActivity.java @@ -0,0 +1,340 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * HDInsight streaming activity type. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HDInsightStreaming") +@JsonFlatten +public class HDInsightStreamingActivity extends ExecutionActivity { + /** + * Storage linked service references. + */ + @JsonProperty(value = "typeProperties.storageLinkedServices") + private List storageLinkedServices; + + /** + * User specified arguments to HDInsightActivity. + */ + @JsonProperty(value = "typeProperties.arguments") + private List arguments; + + /** + * Debug info option. Possible values include: 'None', 'Always', 'Failure'. + */ + @JsonProperty(value = "typeProperties.getDebugInfo") + private HDInsightActivityDebugInfoOption getDebugInfo; + + /** + * Mapper executable name. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.mapper", required = true) + private Object mapper; + + /** + * Reducer executable name. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.reducer", required = true) + private Object reducer; + + /** + * Input blob path. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.input", required = true) + private Object input; + + /** + * Output blob path. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.output", required = true) + private Object output; + + /** + * Paths to streaming job files. Can be directories. + */ + @JsonProperty(value = "typeProperties.filePaths", required = true) + private List filePaths; + + /** + * Linked service reference where the files are located. + */ + @JsonProperty(value = "typeProperties.fileLinkedService") + private LinkedServiceReference fileLinkedService; + + /** + * Combiner executable name. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.combiner") + private Object combiner; + + /** + * Command line environment values. + */ + @JsonProperty(value = "typeProperties.commandEnvironment") + private List commandEnvironment; + + /** + * Allows user to specify defines for streaming job request. + */ + @JsonProperty(value = "typeProperties.defines") + private Map defines; + + /** + * Get storage linked service references. + * + * @return the storageLinkedServices value + */ + public List storageLinkedServices() { + return this.storageLinkedServices; + } + + /** + * Set storage linked service references. + * + * @param storageLinkedServices the storageLinkedServices value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withStorageLinkedServices(List storageLinkedServices) { + this.storageLinkedServices = storageLinkedServices; + return this; + } + + /** + * Get user specified arguments to HDInsightActivity. + * + * @return the arguments value + */ + public List arguments() { + return this.arguments; + } + + /** + * Set user specified arguments to HDInsightActivity. + * + * @param arguments the arguments value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withArguments(List arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get debug info option. Possible values include: 'None', 'Always', 'Failure'. + * + * @return the getDebugInfo value + */ + public HDInsightActivityDebugInfoOption getDebugInfo() { + return this.getDebugInfo; + } + + /** + * Set debug info option. Possible values include: 'None', 'Always', 'Failure'. + * + * @param getDebugInfo the getDebugInfo value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withGetDebugInfo(HDInsightActivityDebugInfoOption getDebugInfo) { + this.getDebugInfo = getDebugInfo; + return this; + } + + /** + * Get mapper executable name. Type: string (or Expression with resultType string). + * + * @return the mapper value + */ + public Object mapper() { + return this.mapper; + } + + /** + * Set mapper executable name. Type: string (or Expression with resultType string). + * + * @param mapper the mapper value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withMapper(Object mapper) { + this.mapper = mapper; + return this; + } + + /** + * Get reducer executable name. Type: string (or Expression with resultType string). + * + * @return the reducer value + */ + public Object reducer() { + return this.reducer; + } + + /** + * Set reducer executable name. Type: string (or Expression with resultType string). + * + * @param reducer the reducer value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withReducer(Object reducer) { + this.reducer = reducer; + return this; + } + + /** + * Get input blob path. Type: string (or Expression with resultType string). + * + * @return the input value + */ + public Object input() { + return this.input; + } + + /** + * Set input blob path. Type: string (or Expression with resultType string). + * + * @param input the input value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withInput(Object input) { + this.input = input; + return this; + } + + /** + * Get output blob path. Type: string (or Expression with resultType string). + * + * @return the output value + */ + public Object output() { + return this.output; + } + + /** + * Set output blob path. Type: string (or Expression with resultType string). + * + * @param output the output value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withOutput(Object output) { + this.output = output; + return this; + } + + /** + * Get paths to streaming job files. Can be directories. + * + * @return the filePaths value + */ + public List filePaths() { + return this.filePaths; + } + + /** + * Set paths to streaming job files. Can be directories. + * + * @param filePaths the filePaths value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withFilePaths(List filePaths) { + this.filePaths = filePaths; + return this; + } + + /** + * Get linked service reference where the files are located. + * + * @return the fileLinkedService value + */ + public LinkedServiceReference fileLinkedService() { + return this.fileLinkedService; + } + + /** + * Set linked service reference where the files are located. + * + * @param fileLinkedService the fileLinkedService value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withFileLinkedService(LinkedServiceReference fileLinkedService) { + this.fileLinkedService = fileLinkedService; + return this; + } + + /** + * Get combiner executable name. Type: string (or Expression with resultType string). + * + * @return the combiner value + */ + public Object combiner() { + return this.combiner; + } + + /** + * Set combiner executable name. Type: string (or Expression with resultType string). + * + * @param combiner the combiner value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withCombiner(Object combiner) { + this.combiner = combiner; + return this; + } + + /** + * Get command line environment values. + * + * @return the commandEnvironment value + */ + public List commandEnvironment() { + return this.commandEnvironment; + } + + /** + * Set command line environment values. + * + * @param commandEnvironment the commandEnvironment value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withCommandEnvironment(List commandEnvironment) { + this.commandEnvironment = commandEnvironment; + return this; + } + + /** + * Get allows user to specify defines for streaming job request. + * + * @return the defines value + */ + public Map defines() { + return this.defines; + } + + /** + * Set allows user to specify defines for streaming job request. + * + * @param defines the defines value to set + * @return the HDInsightStreamingActivity object itself. + */ + public HDInsightStreamingActivity withDefines(Map defines) { + this.defines = defines; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HdfsLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HdfsLinkedService.java new file mode 100644 index 000000000000..1341ca9feab6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HdfsLinkedService.java @@ -0,0 +1,161 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Hadoop Distributed File System (HDFS) linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Hdfs") +@JsonFlatten +public class HdfsLinkedService extends LinkedServiceInner { + /** + * The URL of the HDFS service endpoint, e.g. + * http://myhostname:50070/webhdfs/v1 . Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.url", required = true) + private Object url; + + /** + * Type of authentication used to connect to the HDFS. Possible values are: + * Anonymous and Windows. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.authenticationType") + private Object authenticationType; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * User name for Windows authentication. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.userName") + private Object userName; + + /** + * Password for Windows authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * Get the URL of the HDFS service endpoint, e.g. http://myhostname:50070/webhdfs/v1 . Type: string (or Expression with resultType string). + * + * @return the url value + */ + public Object url() { + return this.url; + } + + /** + * Set the URL of the HDFS service endpoint, e.g. http://myhostname:50070/webhdfs/v1 . Type: string (or Expression with resultType string). + * + * @param url the url value to set + * @return the HdfsLinkedService object itself. + */ + public HdfsLinkedService withUrl(Object url) { + this.url = url; + return this; + } + + /** + * Get type of authentication used to connect to the HDFS. Possible values are: Anonymous and Windows. Type: string (or Expression with resultType string). + * + * @return the authenticationType value + */ + public Object authenticationType() { + return this.authenticationType; + } + + /** + * Set type of authentication used to connect to the HDFS. Possible values are: Anonymous and Windows. Type: string (or Expression with resultType string). + * + * @param authenticationType the authenticationType value to set + * @return the HdfsLinkedService object itself. + */ + public HdfsLinkedService withAuthenticationType(Object authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the HdfsLinkedService object itself. + */ + public HdfsLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + + /** + * Get user name for Windows authentication. Type: string (or Expression with resultType string). + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set user name for Windows authentication. Type: string (or Expression with resultType string). + * + * @param userName the userName value to set + * @return the HdfsLinkedService object itself. + */ + public HdfsLinkedService withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get password for Windows authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password for Windows authentication. + * + * @param password the password value to set + * @return the HdfsLinkedService object itself. + */ + public HdfsLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HdfsSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HdfsSource.java new file mode 100644 index 000000000000..87af345fafa8 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HdfsSource.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity HDFS source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HdfsSource") +public class HdfsSource extends CopySource { + /** + * If true, files under the folder path will be read recursively. Default + * is true. Type: boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "recursive") + private Object recursive; + + /** + * Specifies Distcp-related settings. + */ + @JsonProperty(value = "distcpSettings") + private DistcpSettings distcpSettings; + + /** + * Get if true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). + * + * @return the recursive value + */ + public Object recursive() { + return this.recursive; + } + + /** + * Set if true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). + * + * @param recursive the recursive value to set + * @return the HdfsSource object itself. + */ + public HdfsSource withRecursive(Object recursive) { + this.recursive = recursive; + return this; + } + + /** + * Get specifies Distcp-related settings. + * + * @return the distcpSettings value + */ + public DistcpSettings distcpSettings() { + return this.distcpSettings; + } + + /** + * Set specifies Distcp-related settings. + * + * @param distcpSettings the distcpSettings value to set + * @return the HdfsSource object itself. + */ + public HdfsSource withDistcpSettings(DistcpSettings distcpSettings) { + this.distcpSettings = distcpSettings; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveAuthenticationType.java new file mode 100644 index 000000000000..77298c27cc5d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveAuthenticationType.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HiveAuthenticationType. + */ +public final class HiveAuthenticationType extends ExpandableStringEnum { + /** Static value Anonymous for HiveAuthenticationType. */ + public static final HiveAuthenticationType ANONYMOUS = fromString("Anonymous"); + + /** Static value Username for HiveAuthenticationType. */ + public static final HiveAuthenticationType USERNAME = fromString("Username"); + + /** Static value UsernameAndPassword for HiveAuthenticationType. */ + public static final HiveAuthenticationType USERNAME_AND_PASSWORD = fromString("UsernameAndPassword"); + + /** Static value WindowsAzureHDInsightService for HiveAuthenticationType. */ + public static final HiveAuthenticationType WINDOWS_AZURE_HDINSIGHT_SERVICE = fromString("WindowsAzureHDInsightService"); + + /** + * Creates or finds a HiveAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding HiveAuthenticationType + */ + @JsonCreator + public static HiveAuthenticationType fromString(String name) { + return fromString(name, HiveAuthenticationType.class); + } + + /** + * @return known HiveAuthenticationType values + */ + public static Collection values() { + return values(HiveAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveLinkedService.java new file mode 100644 index 000000000000..d5dd90b4d585 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveLinkedService.java @@ -0,0 +1,483 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Hive Server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Hive") +@JsonFlatten +public class HiveLinkedService extends LinkedServiceInner { + /** + * IP address or host name of the Hive server, separated by ';' for + * multiple hosts (only when serviceDiscoveryMode is enable). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The TCP port that the Hive server uses to listen for client connections. + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * The type of Hive server. Possible values include: 'HiveServer1', + * 'HiveServer2', 'HiveThriftServer'. + */ + @JsonProperty(value = "typeProperties.serverType") + private HiveServerType serverType; + + /** + * The transport protocol to use in the Thrift layer. Possible values + * include: 'Binary', 'SASL', 'HTTP '. + */ + @JsonProperty(value = "typeProperties.thriftTransportProtocol") + private HiveThriftTransportProtocol thriftTransportProtocol; + + /** + * The authentication method used to access the Hive server. Possible + * values include: 'Anonymous', 'Username', 'UsernameAndPassword', + * 'WindowsAzureHDInsightService'. + */ + @JsonProperty(value = "typeProperties.authenticationType", required = true) + private HiveAuthenticationType authenticationType; + + /** + * true to indicate using the ZooKeeper service, false not. + */ + @JsonProperty(value = "typeProperties.serviceDiscoveryMode") + private Object serviceDiscoveryMode; + + /** + * The namespace on ZooKeeper under which Hive Server 2 nodes are added. + */ + @JsonProperty(value = "typeProperties.zooKeeperNameSpace") + private Object zooKeeperNameSpace; + + /** + * Specifies whether the driver uses native HiveQL queries,or converts them + * into an equivalent form in HiveQL. + */ + @JsonProperty(value = "typeProperties.useNativeQuery") + private Object useNativeQuery; + + /** + * The user name that you use to access Hive Server. + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * The password corresponding to the user name that you provided in the + * Username field. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The partial URL corresponding to the Hive server. + */ + @JsonProperty(value = "typeProperties.httpPath") + private Object httpPath; + + /** + * Specifies whether the connections to the server are encrypted using SSL. + * The default value is false. + */ + @JsonProperty(value = "typeProperties.enableSsl") + private Object enableSsl; + + /** + * The full path of the .pem file containing trusted CA certificates for + * verifying the server when connecting over SSL. This property can only be + * set when using SSL on self-hosted IR. The default value is the + * cacerts.pem file installed with the IR. + */ + @JsonProperty(value = "typeProperties.trustedCertPath") + private Object trustedCertPath; + + /** + * Specifies whether to use a CA certificate from the system trust store or + * from a specified PEM file. The default value is false. + */ + @JsonProperty(value = "typeProperties.useSystemTrustStore") + private Object useSystemTrustStore; + + /** + * Specifies whether to require a CA-issued SSL certificate name to match + * the host name of the server when connecting over SSL. The default value + * is false. + */ + @JsonProperty(value = "typeProperties.allowHostNameCNMismatch") + private Object allowHostNameCNMismatch; + + /** + * Specifies whether to allow self-signed certificates from the server. The + * default value is false. + */ + @JsonProperty(value = "typeProperties.allowSelfSignedServerCert") + private Object allowSelfSignedServerCert; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get iP address or host name of the Hive server, separated by ';' for multiple hosts (only when serviceDiscoveryMode is enable). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set iP address or host name of the Hive server, separated by ';' for multiple hosts (only when serviceDiscoveryMode is enable). + * + * @param host the host value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the TCP port that the Hive server uses to listen for client connections. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port that the Hive server uses to listen for client connections. + * + * @param port the port value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the type of Hive server. Possible values include: 'HiveServer1', 'HiveServer2', 'HiveThriftServer'. + * + * @return the serverType value + */ + public HiveServerType serverType() { + return this.serverType; + } + + /** + * Set the type of Hive server. Possible values include: 'HiveServer1', 'HiveServer2', 'HiveThriftServer'. + * + * @param serverType the serverType value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withServerType(HiveServerType serverType) { + this.serverType = serverType; + return this; + } + + /** + * Get the transport protocol to use in the Thrift layer. Possible values include: 'Binary', 'SASL', 'HTTP '. + * + * @return the thriftTransportProtocol value + */ + public HiveThriftTransportProtocol thriftTransportProtocol() { + return this.thriftTransportProtocol; + } + + /** + * Set the transport protocol to use in the Thrift layer. Possible values include: 'Binary', 'SASL', 'HTTP '. + * + * @param thriftTransportProtocol the thriftTransportProtocol value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withThriftTransportProtocol(HiveThriftTransportProtocol thriftTransportProtocol) { + this.thriftTransportProtocol = thriftTransportProtocol; + return this; + } + + /** + * Get the authentication method used to access the Hive server. Possible values include: 'Anonymous', 'Username', 'UsernameAndPassword', 'WindowsAzureHDInsightService'. + * + * @return the authenticationType value + */ + public HiveAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication method used to access the Hive server. Possible values include: 'Anonymous', 'Username', 'UsernameAndPassword', 'WindowsAzureHDInsightService'. + * + * @param authenticationType the authenticationType value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withAuthenticationType(HiveAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get true to indicate using the ZooKeeper service, false not. + * + * @return the serviceDiscoveryMode value + */ + public Object serviceDiscoveryMode() { + return this.serviceDiscoveryMode; + } + + /** + * Set true to indicate using the ZooKeeper service, false not. + * + * @param serviceDiscoveryMode the serviceDiscoveryMode value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withServiceDiscoveryMode(Object serviceDiscoveryMode) { + this.serviceDiscoveryMode = serviceDiscoveryMode; + return this; + } + + /** + * Get the namespace on ZooKeeper under which Hive Server 2 nodes are added. + * + * @return the zooKeeperNameSpace value + */ + public Object zooKeeperNameSpace() { + return this.zooKeeperNameSpace; + } + + /** + * Set the namespace on ZooKeeper under which Hive Server 2 nodes are added. + * + * @param zooKeeperNameSpace the zooKeeperNameSpace value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withZooKeeperNameSpace(Object zooKeeperNameSpace) { + this.zooKeeperNameSpace = zooKeeperNameSpace; + return this; + } + + /** + * Get specifies whether the driver uses native HiveQL queries,or converts them into an equivalent form in HiveQL. + * + * @return the useNativeQuery value + */ + public Object useNativeQuery() { + return this.useNativeQuery; + } + + /** + * Set specifies whether the driver uses native HiveQL queries,or converts them into an equivalent form in HiveQL. + * + * @param useNativeQuery the useNativeQuery value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withUseNativeQuery(Object useNativeQuery) { + this.useNativeQuery = useNativeQuery; + return this; + } + + /** + * Get the user name that you use to access Hive Server. + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the user name that you use to access Hive Server. + * + * @param username the username value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password corresponding to the user name that you provided in the Username field. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password corresponding to the user name that you provided in the Username field. + * + * @param password the password value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the partial URL corresponding to the Hive server. + * + * @return the httpPath value + */ + public Object httpPath() { + return this.httpPath; + } + + /** + * Set the partial URL corresponding to the Hive server. + * + * @param httpPath the httpPath value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withHttpPath(Object httpPath) { + this.httpPath = httpPath; + return this; + } + + /** + * Get specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @return the enableSsl value + */ + public Object enableSsl() { + return this.enableSsl; + } + + /** + * Set specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @param enableSsl the enableSsl value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withEnableSsl(Object enableSsl) { + this.enableSsl = enableSsl; + return this; + } + + /** + * Get the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @return the trustedCertPath value + */ + public Object trustedCertPath() { + return this.trustedCertPath; + } + + /** + * Set the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @param trustedCertPath the trustedCertPath value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withTrustedCertPath(Object trustedCertPath) { + this.trustedCertPath = trustedCertPath; + return this; + } + + /** + * Get specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @return the useSystemTrustStore value + */ + public Object useSystemTrustStore() { + return this.useSystemTrustStore; + } + + /** + * Set specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @param useSystemTrustStore the useSystemTrustStore value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withUseSystemTrustStore(Object useSystemTrustStore) { + this.useSystemTrustStore = useSystemTrustStore; + return this; + } + + /** + * Get specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @return the allowHostNameCNMismatch value + */ + public Object allowHostNameCNMismatch() { + return this.allowHostNameCNMismatch; + } + + /** + * Set specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @param allowHostNameCNMismatch the allowHostNameCNMismatch value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withAllowHostNameCNMismatch(Object allowHostNameCNMismatch) { + this.allowHostNameCNMismatch = allowHostNameCNMismatch; + return this; + } + + /** + * Get specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @return the allowSelfSignedServerCert value + */ + public Object allowSelfSignedServerCert() { + return this.allowSelfSignedServerCert; + } + + /** + * Set specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @param allowSelfSignedServerCert the allowSelfSignedServerCert value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedServerCert) { + this.allowSelfSignedServerCert = allowSelfSignedServerCert; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the HiveLinkedService object itself. + */ + public HiveLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveObjectDataset.java new file mode 100644 index 000000000000..9fcdc7226a75 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Hive Server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HiveObject") +public class HiveObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveServerType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveServerType.java new file mode 100644 index 000000000000..fd45a8a51a89 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveServerType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HiveServerType. + */ +public final class HiveServerType extends ExpandableStringEnum { + /** Static value HiveServer1 for HiveServerType. */ + public static final HiveServerType HIVE_SERVER1 = fromString("HiveServer1"); + + /** Static value HiveServer2 for HiveServerType. */ + public static final HiveServerType HIVE_SERVER2 = fromString("HiveServer2"); + + /** Static value HiveThriftServer for HiveServerType. */ + public static final HiveServerType HIVE_THRIFT_SERVER = fromString("HiveThriftServer"); + + /** + * Creates or finds a HiveServerType from its string representation. + * @param name a name to look for + * @return the corresponding HiveServerType + */ + @JsonCreator + public static HiveServerType fromString(String name) { + return fromString(name, HiveServerType.class); + } + + /** + * @return known HiveServerType values + */ + public static Collection values() { + return values(HiveServerType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveSource.java new file mode 100644 index 000000000000..bc959c92de74 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Hive Server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HiveSource") +public class HiveSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the HiveSource object itself. + */ + public HiveSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveThriftTransportProtocol.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveThriftTransportProtocol.java new file mode 100644 index 000000000000..406d905b79cc --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HiveThriftTransportProtocol.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HiveThriftTransportProtocol. + */ +public final class HiveThriftTransportProtocol extends ExpandableStringEnum { + /** Static value Binary for HiveThriftTransportProtocol. */ + public static final HiveThriftTransportProtocol BINARY = fromString("Binary"); + + /** Static value SASL for HiveThriftTransportProtocol. */ + public static final HiveThriftTransportProtocol SASL = fromString("SASL"); + + /** Static value HTTP for HiveThriftTransportProtocol. */ + public static final HiveThriftTransportProtocol HTTP_ = fromString("HTTP "); + + /** + * Creates or finds a HiveThriftTransportProtocol from its string representation. + * @param name a name to look for + * @return the corresponding HiveThriftTransportProtocol + */ + @JsonCreator + public static HiveThriftTransportProtocol fromString(String name) { + return fromString(name, HiveThriftTransportProtocol.class); + } + + /** + * @return known HiveThriftTransportProtocol values + */ + public static Collection values() { + return values(HiveThriftTransportProtocol.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpAuthenticationType.java new file mode 100644 index 000000000000..807acd12e904 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpAuthenticationType.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HttpAuthenticationType. + */ +public final class HttpAuthenticationType extends ExpandableStringEnum { + /** Static value Basic for HttpAuthenticationType. */ + public static final HttpAuthenticationType BASIC = fromString("Basic"); + + /** Static value Anonymous for HttpAuthenticationType. */ + public static final HttpAuthenticationType ANONYMOUS = fromString("Anonymous"); + + /** Static value Digest for HttpAuthenticationType. */ + public static final HttpAuthenticationType DIGEST = fromString("Digest"); + + /** Static value Windows for HttpAuthenticationType. */ + public static final HttpAuthenticationType WINDOWS = fromString("Windows"); + + /** Static value ClientCertificate for HttpAuthenticationType. */ + public static final HttpAuthenticationType CLIENT_CERTIFICATE = fromString("ClientCertificate"); + + /** + * Creates or finds a HttpAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding HttpAuthenticationType + */ + @JsonCreator + public static HttpAuthenticationType fromString(String name) { + return fromString(name, HttpAuthenticationType.class); + } + + /** + * @return known HttpAuthenticationType values + */ + public static Collection values() { + return values(HttpAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpDataset.java new file mode 100644 index 000000000000..f4278994b524 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpDataset.java @@ -0,0 +1,191 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * A file in an HTTP web server. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HttpFile") +@JsonFlatten +public class HttpDataset extends DatasetInner { + /** + * The relative URL based on the URL in the HttpLinkedService refers to an + * HTTP file Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.relativeUrl") + private Object relativeUrl; + + /** + * The HTTP method for the HTTP request. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.requestMethod") + private Object requestMethod; + + /** + * The body for the HTTP request. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.requestBody") + private Object requestBody; + + /** + * The headers for the HTTP Request. e.g. + * request-header-name-1:request-header-value-1 + * ... + * request-header-name-n:request-header-value-n Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.additionalHeaders") + private Object additionalHeaders; + + /** + * The format of files. + */ + @JsonProperty(value = "typeProperties.format") + private DatasetStorageFormat format; + + /** + * The data compression method used on files. + */ + @JsonProperty(value = "typeProperties.compression") + private DatasetCompression compression; + + /** + * Get the relative URL based on the URL in the HttpLinkedService refers to an HTTP file Type: string (or Expression with resultType string). + * + * @return the relativeUrl value + */ + public Object relativeUrl() { + return this.relativeUrl; + } + + /** + * Set the relative URL based on the URL in the HttpLinkedService refers to an HTTP file Type: string (or Expression with resultType string). + * + * @param relativeUrl the relativeUrl value to set + * @return the HttpDataset object itself. + */ + public HttpDataset withRelativeUrl(Object relativeUrl) { + this.relativeUrl = relativeUrl; + return this; + } + + /** + * Get the HTTP method for the HTTP request. Type: string (or Expression with resultType string). + * + * @return the requestMethod value + */ + public Object requestMethod() { + return this.requestMethod; + } + + /** + * Set the HTTP method for the HTTP request. Type: string (or Expression with resultType string). + * + * @param requestMethod the requestMethod value to set + * @return the HttpDataset object itself. + */ + public HttpDataset withRequestMethod(Object requestMethod) { + this.requestMethod = requestMethod; + return this; + } + + /** + * Get the body for the HTTP request. Type: string (or Expression with resultType string). + * + * @return the requestBody value + */ + public Object requestBody() { + return this.requestBody; + } + + /** + * Set the body for the HTTP request. Type: string (or Expression with resultType string). + * + * @param requestBody the requestBody value to set + * @return the HttpDataset object itself. + */ + public HttpDataset withRequestBody(Object requestBody) { + this.requestBody = requestBody; + return this; + } + + /** + * Get the headers for the HTTP Request. e.g. request-header-name-1:request-header-value-1 + ... + request-header-name-n:request-header-value-n Type: string (or Expression with resultType string). + * + * @return the additionalHeaders value + */ + public Object additionalHeaders() { + return this.additionalHeaders; + } + + /** + * Set the headers for the HTTP Request. e.g. request-header-name-1:request-header-value-1 + ... + request-header-name-n:request-header-value-n Type: string (or Expression with resultType string). + * + * @param additionalHeaders the additionalHeaders value to set + * @return the HttpDataset object itself. + */ + public HttpDataset withAdditionalHeaders(Object additionalHeaders) { + this.additionalHeaders = additionalHeaders; + return this; + } + + /** + * Get the format of files. + * + * @return the format value + */ + public DatasetStorageFormat format() { + return this.format; + } + + /** + * Set the format of files. + * + * @param format the format value to set + * @return the HttpDataset object itself. + */ + public HttpDataset withFormat(DatasetStorageFormat format) { + this.format = format; + return this; + } + + /** + * Get the data compression method used on files. + * + * @return the compression value + */ + public DatasetCompression compression() { + return this.compression; + } + + /** + * Set the data compression method used on files. + * + * @param compression the compression value to set + * @return the HttpDataset object itself. + */ + public HttpDataset withCompression(DatasetCompression compression) { + this.compression = compression; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpLinkedService.java new file mode 100644 index 000000000000..5654f32237db --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpLinkedService.java @@ -0,0 +1,247 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for an HTTP source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HttpServer") +@JsonFlatten +public class HttpLinkedService extends LinkedServiceInner { + /** + * The base URL of the HTTP endpoint, e.g. http://www.microsoft.com. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.url", required = true) + private Object url; + + /** + * The authentication type to be used to connect to the HTTP server. + * Possible values include: 'Basic', 'Anonymous', 'Digest', 'Windows', + * 'ClientCertificate'. + */ + @JsonProperty(value = "typeProperties.authenticationType") + private HttpAuthenticationType authenticationType; + + /** + * User name for Basic, Digest, or Windows authentication. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.userName") + private Object userName; + + /** + * Password for Basic, Digest, Windows, or ClientCertificate with + * EmbeddedCertData authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * Base64 encoded certificate data for ClientCertificate authentication. + * For on-premises copy with ClientCertificate authentication, either + * CertThumbprint or EmbeddedCertData/Password should be specified. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.embeddedCertData") + private Object embeddedCertData; + + /** + * Thumbprint of certificate for ClientCertificate authentication. Only + * valid for on-premises copy. For on-premises copy with ClientCertificate + * authentication, either CertThumbprint or EmbeddedCertData/Password + * should be specified. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.certThumbprint") + private Object certThumbprint; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * If true, validate the HTTPS server SSL certificate. Default value is + * true. Type: boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "typeProperties.enableServerCertificateValidation") + private Object enableServerCertificateValidation; + + /** + * Get the base URL of the HTTP endpoint, e.g. http://www.microsoft.com. Type: string (or Expression with resultType string). + * + * @return the url value + */ + public Object url() { + return this.url; + } + + /** + * Set the base URL of the HTTP endpoint, e.g. http://www.microsoft.com. Type: string (or Expression with resultType string). + * + * @param url the url value to set + * @return the HttpLinkedService object itself. + */ + public HttpLinkedService withUrl(Object url) { + this.url = url; + return this; + } + + /** + * Get the authentication type to be used to connect to the HTTP server. Possible values include: 'Basic', 'Anonymous', 'Digest', 'Windows', 'ClientCertificate'. + * + * @return the authenticationType value + */ + public HttpAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type to be used to connect to the HTTP server. Possible values include: 'Basic', 'Anonymous', 'Digest', 'Windows', 'ClientCertificate'. + * + * @param authenticationType the authenticationType value to set + * @return the HttpLinkedService object itself. + */ + public HttpLinkedService withAuthenticationType(HttpAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get user name for Basic, Digest, or Windows authentication. Type: string (or Expression with resultType string). + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set user name for Basic, Digest, or Windows authentication. Type: string (or Expression with resultType string). + * + * @param userName the userName value to set + * @return the HttpLinkedService object itself. + */ + public HttpLinkedService withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get password for Basic, Digest, Windows, or ClientCertificate with EmbeddedCertData authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password for Basic, Digest, Windows, or ClientCertificate with EmbeddedCertData authentication. + * + * @param password the password value to set + * @return the HttpLinkedService object itself. + */ + public HttpLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get base64 encoded certificate data for ClientCertificate authentication. For on-premises copy with ClientCertificate authentication, either CertThumbprint or EmbeddedCertData/Password should be specified. Type: string (or Expression with resultType string). + * + * @return the embeddedCertData value + */ + public Object embeddedCertData() { + return this.embeddedCertData; + } + + /** + * Set base64 encoded certificate data for ClientCertificate authentication. For on-premises copy with ClientCertificate authentication, either CertThumbprint or EmbeddedCertData/Password should be specified. Type: string (or Expression with resultType string). + * + * @param embeddedCertData the embeddedCertData value to set + * @return the HttpLinkedService object itself. + */ + public HttpLinkedService withEmbeddedCertData(Object embeddedCertData) { + this.embeddedCertData = embeddedCertData; + return this; + } + + /** + * Get thumbprint of certificate for ClientCertificate authentication. Only valid for on-premises copy. For on-premises copy with ClientCertificate authentication, either CertThumbprint or EmbeddedCertData/Password should be specified. Type: string (or Expression with resultType string). + * + * @return the certThumbprint value + */ + public Object certThumbprint() { + return this.certThumbprint; + } + + /** + * Set thumbprint of certificate for ClientCertificate authentication. Only valid for on-premises copy. For on-premises copy with ClientCertificate authentication, either CertThumbprint or EmbeddedCertData/Password should be specified. Type: string (or Expression with resultType string). + * + * @param certThumbprint the certThumbprint value to set + * @return the HttpLinkedService object itself. + */ + public HttpLinkedService withCertThumbprint(Object certThumbprint) { + this.certThumbprint = certThumbprint; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the HttpLinkedService object itself. + */ + public HttpLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + + /** + * Get if true, validate the HTTPS server SSL certificate. Default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the enableServerCertificateValidation value + */ + public Object enableServerCertificateValidation() { + return this.enableServerCertificateValidation; + } + + /** + * Set if true, validate the HTTPS server SSL certificate. Default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param enableServerCertificateValidation the enableServerCertificateValidation value to set + * @return the HttpLinkedService object itself. + */ + public HttpLinkedService withEnableServerCertificateValidation(Object enableServerCertificateValidation) { + this.enableServerCertificateValidation = enableServerCertificateValidation; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpSource.java new file mode 100644 index 000000000000..66364181d696 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HttpSource.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity source for an HTTP file. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HttpSource") +public class HttpSource extends CopySource { + /** + * Specifies the timeout for a HTTP client to get HTTP response from HTTP + * server. The default value is equivalent to + * System.Net.HttpWebRequest.Timeout. Type: string (or Expression with + * resultType string), pattern: + * ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + */ + @JsonProperty(value = "httpRequestTimeout") + private Object httpRequestTimeout; + + /** + * Get specifies the timeout for a HTTP client to get HTTP response from HTTP server. The default value is equivalent to System.Net.HttpWebRequest.Timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @return the httpRequestTimeout value + */ + public Object httpRequestTimeout() { + return this.httpRequestTimeout; + } + + /** + * Set specifies the timeout for a HTTP client to get HTTP response from HTTP server. The default value is equivalent to System.Net.HttpWebRequest.Timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @param httpRequestTimeout the httpRequestTimeout value to set + * @return the HttpSource object itself. + */ + public HttpSource withHttpRequestTimeout(Object httpRequestTimeout) { + this.httpRequestTimeout = httpRequestTimeout; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HubspotLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HubspotLinkedService.java new file mode 100644 index 000000000000..fe5110099dc8 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HubspotLinkedService.java @@ -0,0 +1,240 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Hubspot Service linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Hubspot") +@JsonFlatten +public class HubspotLinkedService extends LinkedServiceInner { + /** + * The client ID associated with your Hubspot application. + */ + @JsonProperty(value = "typeProperties.clientId", required = true) + private Object clientId; + + /** + * The client secret associated with your Hubspot application. + */ + @JsonProperty(value = "typeProperties.clientSecret") + private SecretBase clientSecret; + + /** + * The access token obtained when initially authenticating your OAuth + * integration. + */ + @JsonProperty(value = "typeProperties.accessToken") + private SecretBase accessToken; + + /** + * The refresh token obtained when initially authenticating your OAuth + * integration. + */ + @JsonProperty(value = "typeProperties.refreshToken") + private SecretBase refreshToken; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the client ID associated with your Hubspot application. + * + * @return the clientId value + */ + public Object clientId() { + return this.clientId; + } + + /** + * Set the client ID associated with your Hubspot application. + * + * @param clientId the clientId value to set + * @return the HubspotLinkedService object itself. + */ + public HubspotLinkedService withClientId(Object clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the client secret associated with your Hubspot application. + * + * @return the clientSecret value + */ + public SecretBase clientSecret() { + return this.clientSecret; + } + + /** + * Set the client secret associated with your Hubspot application. + * + * @param clientSecret the clientSecret value to set + * @return the HubspotLinkedService object itself. + */ + public HubspotLinkedService withClientSecret(SecretBase clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get the access token obtained when initially authenticating your OAuth integration. + * + * @return the accessToken value + */ + public SecretBase accessToken() { + return this.accessToken; + } + + /** + * Set the access token obtained when initially authenticating your OAuth integration. + * + * @param accessToken the accessToken value to set + * @return the HubspotLinkedService object itself. + */ + public HubspotLinkedService withAccessToken(SecretBase accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Get the refresh token obtained when initially authenticating your OAuth integration. + * + * @return the refreshToken value + */ + public SecretBase refreshToken() { + return this.refreshToken; + } + + /** + * Set the refresh token obtained when initially authenticating your OAuth integration. + * + * @param refreshToken the refreshToken value to set + * @return the HubspotLinkedService object itself. + */ + public HubspotLinkedService withRefreshToken(SecretBase refreshToken) { + this.refreshToken = refreshToken; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the HubspotLinkedService object itself. + */ + public HubspotLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the HubspotLinkedService object itself. + */ + public HubspotLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the HubspotLinkedService object itself. + */ + public HubspotLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the HubspotLinkedService object itself. + */ + public HubspotLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HubspotObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HubspotObjectDataset.java new file mode 100644 index 000000000000..91f81745a8b5 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HubspotObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Hubspot Service dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HubspotObject") +public class HubspotObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HubspotSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HubspotSource.java new file mode 100644 index 000000000000..5f77c2fc5a82 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/HubspotSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Hubspot Service source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("HubspotSource") +public class HubspotSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the HubspotSource object itself. + */ + public HubspotSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IfConditionActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IfConditionActivity.java new file mode 100644 index 000000000000..c07a3fdd78a9 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IfConditionActivity.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * This activity evaluates a boolean expression and executes either the + * activities under the ifTrueActivities property or the ifFalseActivities + * property depending on the result of the expression. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("IfCondition") +@JsonFlatten +public class IfConditionActivity extends ControlActivity { + /** + * An expression that would evaluate to Boolean. This is used to determine + * the block of activities (ifTrueActivities or ifFalseActivities) that + * will be executed. + */ + @JsonProperty(value = "typeProperties.expression", required = true) + private Expression expression; + + /** + * List of activities to execute if expression is evaluated to true. This + * is an optional property and if not provided, the activity will exit + * without any action. + */ + @JsonProperty(value = "typeProperties.ifTrueActivities") + private List ifTrueActivities; + + /** + * List of activities to execute if expression is evaluated to false. This + * is an optional property and if not provided, the activity will exit + * without any action. + */ + @JsonProperty(value = "typeProperties.ifFalseActivities") + private List ifFalseActivities; + + /** + * Get an expression that would evaluate to Boolean. This is used to determine the block of activities (ifTrueActivities or ifFalseActivities) that will be executed. + * + * @return the expression value + */ + public Expression expression() { + return this.expression; + } + + /** + * Set an expression that would evaluate to Boolean. This is used to determine the block of activities (ifTrueActivities or ifFalseActivities) that will be executed. + * + * @param expression the expression value to set + * @return the IfConditionActivity object itself. + */ + public IfConditionActivity withExpression(Expression expression) { + this.expression = expression; + return this; + } + + /** + * Get list of activities to execute if expression is evaluated to true. This is an optional property and if not provided, the activity will exit without any action. + * + * @return the ifTrueActivities value + */ + public List ifTrueActivities() { + return this.ifTrueActivities; + } + + /** + * Set list of activities to execute if expression is evaluated to true. This is an optional property and if not provided, the activity will exit without any action. + * + * @param ifTrueActivities the ifTrueActivities value to set + * @return the IfConditionActivity object itself. + */ + public IfConditionActivity withIfTrueActivities(List ifTrueActivities) { + this.ifTrueActivities = ifTrueActivities; + return this; + } + + /** + * Get list of activities to execute if expression is evaluated to false. This is an optional property and if not provided, the activity will exit without any action. + * + * @return the ifFalseActivities value + */ + public List ifFalseActivities() { + return this.ifFalseActivities; + } + + /** + * Set list of activities to execute if expression is evaluated to false. This is an optional property and if not provided, the activity will exit without any action. + * + * @param ifFalseActivities the ifFalseActivities value to set + * @return the IfConditionActivity object itself. + */ + public IfConditionActivity withIfFalseActivities(List ifFalseActivities) { + this.ifFalseActivities = ifFalseActivities; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaAuthenticationType.java new file mode 100644 index 000000000000..ede8f96bde80 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaAuthenticationType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ImpalaAuthenticationType. + */ +public final class ImpalaAuthenticationType extends ExpandableStringEnum { + /** Static value Anonymous for ImpalaAuthenticationType. */ + public static final ImpalaAuthenticationType ANONYMOUS = fromString("Anonymous"); + + /** Static value SASLUsername for ImpalaAuthenticationType. */ + public static final ImpalaAuthenticationType SASLUSERNAME = fromString("SASLUsername"); + + /** Static value UsernameAndPassword for ImpalaAuthenticationType. */ + public static final ImpalaAuthenticationType USERNAME_AND_PASSWORD = fromString("UsernameAndPassword"); + + /** + * Creates or finds a ImpalaAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding ImpalaAuthenticationType + */ + @JsonCreator + public static ImpalaAuthenticationType fromString(String name) { + return fromString(name, ImpalaAuthenticationType.class); + } + + /** + * @return known ImpalaAuthenticationType values + */ + public static Collection values() { + return values(ImpalaAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaLinkedService.java new file mode 100644 index 000000000000..ac8daabd4b6c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaLinkedService.java @@ -0,0 +1,325 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Impala server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Impala") +@JsonFlatten +public class ImpalaLinkedService extends LinkedServiceInner { + /** + * The IP address or host name of the Impala server. (i.e. + * 192.168.222.160). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The TCP port that the Impala server uses to listen for client + * connections. The default value is 21050. + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * The authentication type to use. Possible values include: 'Anonymous', + * 'SASLUsername', 'UsernameAndPassword'. + */ + @JsonProperty(value = "typeProperties.authenticationType", required = true) + private ImpalaAuthenticationType authenticationType; + + /** + * The user name used to access the Impala server. The default value is + * anonymous when using SASLUsername. + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * The password corresponding to the user name when using + * UsernameAndPassword. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * Specifies whether the connections to the server are encrypted using SSL. + * The default value is false. + */ + @JsonProperty(value = "typeProperties.enableSsl") + private Object enableSsl; + + /** + * The full path of the .pem file containing trusted CA certificates for + * verifying the server when connecting over SSL. This property can only be + * set when using SSL on self-hosted IR. The default value is the + * cacerts.pem file installed with the IR. + */ + @JsonProperty(value = "typeProperties.trustedCertPath") + private Object trustedCertPath; + + /** + * Specifies whether to use a CA certificate from the system trust store or + * from a specified PEM file. The default value is false. + */ + @JsonProperty(value = "typeProperties.useSystemTrustStore") + private Object useSystemTrustStore; + + /** + * Specifies whether to require a CA-issued SSL certificate name to match + * the host name of the server when connecting over SSL. The default value + * is false. + */ + @JsonProperty(value = "typeProperties.allowHostNameCNMismatch") + private Object allowHostNameCNMismatch; + + /** + * Specifies whether to allow self-signed certificates from the server. The + * default value is false. + */ + @JsonProperty(value = "typeProperties.allowSelfSignedServerCert") + private Object allowSelfSignedServerCert; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the IP address or host name of the Impala server. (i.e. 192.168.222.160). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the IP address or host name of the Impala server. (i.e. 192.168.222.160). + * + * @param host the host value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the TCP port that the Impala server uses to listen for client connections. The default value is 21050. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port that the Impala server uses to listen for client connections. The default value is 21050. + * + * @param port the port value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the authentication type to use. Possible values include: 'Anonymous', 'SASLUsername', 'UsernameAndPassword'. + * + * @return the authenticationType value + */ + public ImpalaAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type to use. Possible values include: 'Anonymous', 'SASLUsername', 'UsernameAndPassword'. + * + * @param authenticationType the authenticationType value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withAuthenticationType(ImpalaAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the user name used to access the Impala server. The default value is anonymous when using SASLUsername. + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the user name used to access the Impala server. The default value is anonymous when using SASLUsername. + * + * @param username the username value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password corresponding to the user name when using UsernameAndPassword. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password corresponding to the user name when using UsernameAndPassword. + * + * @param password the password value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @return the enableSsl value + */ + public Object enableSsl() { + return this.enableSsl; + } + + /** + * Set specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @param enableSsl the enableSsl value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withEnableSsl(Object enableSsl) { + this.enableSsl = enableSsl; + return this; + } + + /** + * Get the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @return the trustedCertPath value + */ + public Object trustedCertPath() { + return this.trustedCertPath; + } + + /** + * Set the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @param trustedCertPath the trustedCertPath value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withTrustedCertPath(Object trustedCertPath) { + this.trustedCertPath = trustedCertPath; + return this; + } + + /** + * Get specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @return the useSystemTrustStore value + */ + public Object useSystemTrustStore() { + return this.useSystemTrustStore; + } + + /** + * Set specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @param useSystemTrustStore the useSystemTrustStore value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withUseSystemTrustStore(Object useSystemTrustStore) { + this.useSystemTrustStore = useSystemTrustStore; + return this; + } + + /** + * Get specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @return the allowHostNameCNMismatch value + */ + public Object allowHostNameCNMismatch() { + return this.allowHostNameCNMismatch; + } + + /** + * Set specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @param allowHostNameCNMismatch the allowHostNameCNMismatch value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withAllowHostNameCNMismatch(Object allowHostNameCNMismatch) { + this.allowHostNameCNMismatch = allowHostNameCNMismatch; + return this; + } + + /** + * Get specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @return the allowSelfSignedServerCert value + */ + public Object allowSelfSignedServerCert() { + return this.allowSelfSignedServerCert; + } + + /** + * Set specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @param allowSelfSignedServerCert the allowSelfSignedServerCert value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedServerCert) { + this.allowSelfSignedServerCert = allowSelfSignedServerCert; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the ImpalaLinkedService object itself. + */ + public ImpalaLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaObjectDataset.java new file mode 100644 index 000000000000..d3ccc0174f6a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Impala server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ImpalaObject") +public class ImpalaObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaSource.java new file mode 100644 index 000000000000..ac5dea283c30 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ImpalaSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Impala server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ImpalaSource") +public class ImpalaSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the ImpalaSource object itself. + */ + public ImpalaSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeAuthKeyName.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeAuthKeyName.java new file mode 100644 index 000000000000..b2463bdd80eb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeAuthKeyName.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IntegrationRuntimeAuthKeyName. + */ +public final class IntegrationRuntimeAuthKeyName extends ExpandableStringEnum { + /** Static value authKey1 for IntegrationRuntimeAuthKeyName. */ + public static final IntegrationRuntimeAuthKeyName AUTH_KEY1 = fromString("authKey1"); + + /** Static value authKey2 for IntegrationRuntimeAuthKeyName. */ + public static final IntegrationRuntimeAuthKeyName AUTH_KEY2 = fromString("authKey2"); + + /** + * Creates or finds a IntegrationRuntimeAuthKeyName from its string representation. + * @param name a name to look for + * @return the corresponding IntegrationRuntimeAuthKeyName + */ + @JsonCreator + public static IntegrationRuntimeAuthKeyName fromString(String name) { + return fromString(name, IntegrationRuntimeAuthKeyName.class); + } + + /** + * @return known IntegrationRuntimeAuthKeyName values + */ + public static Collection values() { + return values(IntegrationRuntimeAuthKeyName.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeAuthKeys.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeAuthKeys.java new file mode 100644 index 000000000000..fcb8244be493 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeAuthKeys.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeAuthKeysInner; + +/** + * Type representing IntegrationRuntimeAuthKeys. + */ +public interface IntegrationRuntimeAuthKeys extends HasInner, HasManager { + /** + * @return the authKey1 value. + */ + String authKey1(); + + /** + * @return the authKey2 value. + */ + String authKey2(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeAutoUpdate.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeAutoUpdate.java new file mode 100644 index 000000000000..e99036ecb812 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeAutoUpdate.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IntegrationRuntimeAutoUpdate. + */ +public final class IntegrationRuntimeAutoUpdate extends ExpandableStringEnum { + /** Static value On for IntegrationRuntimeAutoUpdate. */ + public static final IntegrationRuntimeAutoUpdate ON = fromString("On"); + + /** Static value Off for IntegrationRuntimeAutoUpdate. */ + public static final IntegrationRuntimeAutoUpdate OFF = fromString("Off"); + + /** + * Creates or finds a IntegrationRuntimeAutoUpdate from its string representation. + * @param name a name to look for + * @return the corresponding IntegrationRuntimeAutoUpdate + */ + @JsonCreator + public static IntegrationRuntimeAutoUpdate fromString(String name) { + return fromString(name, IntegrationRuntimeAutoUpdate.class); + } + + /** + * @return known IntegrationRuntimeAutoUpdate values + */ + public static Collection values() { + return values(IntegrationRuntimeAutoUpdate.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeComputeProperties.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeComputeProperties.java new file mode 100644 index 000000000000..c04931976094 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeComputeProperties.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The compute resource properties for managed integration runtime. + */ +public class IntegrationRuntimeComputeProperties { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The location for managed integration runtime. The supported regions + * could be found on + * https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The node size requirement to managed integration runtime. + */ + @JsonProperty(value = "nodeSize") + private String nodeSize; + + /** + * The required number of nodes for managed integration runtime. + */ + @JsonProperty(value = "numberOfNodes") + private Integer numberOfNodes; + + /** + * Maximum parallel executions count per node for managed integration + * runtime. + */ + @JsonProperty(value = "maxParallelExecutionsPerNode") + private Integer maxParallelExecutionsPerNode; + + /** + * VNet properties for managed integration runtime. + */ + @JsonProperty(value = "vNetProperties") + private IntegrationRuntimeVNetProperties vNetProperties; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the IntegrationRuntimeComputeProperties object itself. + */ + public IntegrationRuntimeComputeProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the location for managed integration runtime. The supported regions could be found on https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location for managed integration runtime. The supported regions could be found on https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities. + * + * @param location the location value to set + * @return the IntegrationRuntimeComputeProperties object itself. + */ + public IntegrationRuntimeComputeProperties withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the node size requirement to managed integration runtime. + * + * @return the nodeSize value + */ + public String nodeSize() { + return this.nodeSize; + } + + /** + * Set the node size requirement to managed integration runtime. + * + * @param nodeSize the nodeSize value to set + * @return the IntegrationRuntimeComputeProperties object itself. + */ + public IntegrationRuntimeComputeProperties withNodeSize(String nodeSize) { + this.nodeSize = nodeSize; + return this; + } + + /** + * Get the required number of nodes for managed integration runtime. + * + * @return the numberOfNodes value + */ + public Integer numberOfNodes() { + return this.numberOfNodes; + } + + /** + * Set the required number of nodes for managed integration runtime. + * + * @param numberOfNodes the numberOfNodes value to set + * @return the IntegrationRuntimeComputeProperties object itself. + */ + public IntegrationRuntimeComputeProperties withNumberOfNodes(Integer numberOfNodes) { + this.numberOfNodes = numberOfNodes; + return this; + } + + /** + * Get maximum parallel executions count per node for managed integration runtime. + * + * @return the maxParallelExecutionsPerNode value + */ + public Integer maxParallelExecutionsPerNode() { + return this.maxParallelExecutionsPerNode; + } + + /** + * Set maximum parallel executions count per node for managed integration runtime. + * + * @param maxParallelExecutionsPerNode the maxParallelExecutionsPerNode value to set + * @return the IntegrationRuntimeComputeProperties object itself. + */ + public IntegrationRuntimeComputeProperties withMaxParallelExecutionsPerNode(Integer maxParallelExecutionsPerNode) { + this.maxParallelExecutionsPerNode = maxParallelExecutionsPerNode; + return this; + } + + /** + * Get vNet properties for managed integration runtime. + * + * @return the vNetProperties value + */ + public IntegrationRuntimeVNetProperties vNetProperties() { + return this.vNetProperties; + } + + /** + * Set vNet properties for managed integration runtime. + * + * @param vNetProperties the vNetProperties value to set + * @return the IntegrationRuntimeComputeProperties object itself. + */ + public IntegrationRuntimeComputeProperties withVNetProperties(IntegrationRuntimeVNetProperties vNetProperties) { + this.vNetProperties = vNetProperties; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeConnectionInfo.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeConnectionInfo.java new file mode 100644 index 000000000000..e3e21ccdcb07 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeConnectionInfo.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeConnectionInfoInner; +import java.util.Map; + +/** + * Type representing IntegrationRuntimeConnectionInfo. + */ +public interface IntegrationRuntimeConnectionInfo extends HasInner, HasManager { + /** + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * @return the hostServiceUri value. + */ + String hostServiceUri(); + + /** + * @return the identityCertThumbprint value. + */ + String identityCertThumbprint(); + + /** + * @return the isIdentityCertExprired value. + */ + Boolean isIdentityCertExprired(); + + /** + * @return the publicKey value. + */ + String publicKey(); + + /** + * @return the serviceToken value. + */ + String serviceToken(); + + /** + * @return the version value. + */ + String version(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeCustomSetupScriptProperties.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeCustomSetupScriptProperties.java new file mode 100644 index 000000000000..0243b58a5239 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeCustomSetupScriptProperties.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Custom setup script properties for a managed dedicated integration runtime. + */ +public class IntegrationRuntimeCustomSetupScriptProperties { + /** + * The URI of the Azure blob container that contains the custom setup + * script. + */ + @JsonProperty(value = "blobContainerUri") + private String blobContainerUri; + + /** + * The SAS token of the Azure blob container. + */ + @JsonProperty(value = "sasToken") + private SecureString sasToken; + + /** + * Get the URI of the Azure blob container that contains the custom setup script. + * + * @return the blobContainerUri value + */ + public String blobContainerUri() { + return this.blobContainerUri; + } + + /** + * Set the URI of the Azure blob container that contains the custom setup script. + * + * @param blobContainerUri the blobContainerUri value to set + * @return the IntegrationRuntimeCustomSetupScriptProperties object itself. + */ + public IntegrationRuntimeCustomSetupScriptProperties withBlobContainerUri(String blobContainerUri) { + this.blobContainerUri = blobContainerUri; + return this; + } + + /** + * Get the SAS token of the Azure blob container. + * + * @return the sasToken value + */ + public SecureString sasToken() { + return this.sasToken; + } + + /** + * Set the SAS token of the Azure blob container. + * + * @param sasToken the sasToken value to set + * @return the IntegrationRuntimeCustomSetupScriptProperties object itself. + */ + public IntegrationRuntimeCustomSetupScriptProperties withSasToken(SecureString sasToken) { + this.sasToken = sasToken; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeDataProxyProperties.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeDataProxyProperties.java new file mode 100644 index 000000000000..4eb61b68697f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeDataProxyProperties.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Data proxy properties for a managed dedicated integration runtime. + */ +public class IntegrationRuntimeDataProxyProperties { + /** + * The self-hosted integration runtime reference. + */ + @JsonProperty(value = "connectVia") + private EntityReference connectVia; + + /** + * The staging linked service reference. + */ + @JsonProperty(value = "stagingLinkedService") + private EntityReference stagingLinkedService; + + /** + * The path to contain the staged data in the Blob storage. + */ + @JsonProperty(value = "path") + private String path; + + /** + * Get the self-hosted integration runtime reference. + * + * @return the connectVia value + */ + public EntityReference connectVia() { + return this.connectVia; + } + + /** + * Set the self-hosted integration runtime reference. + * + * @param connectVia the connectVia value to set + * @return the IntegrationRuntimeDataProxyProperties object itself. + */ + public IntegrationRuntimeDataProxyProperties withConnectVia(EntityReference connectVia) { + this.connectVia = connectVia; + return this; + } + + /** + * Get the staging linked service reference. + * + * @return the stagingLinkedService value + */ + public EntityReference stagingLinkedService() { + return this.stagingLinkedService; + } + + /** + * Set the staging linked service reference. + * + * @param stagingLinkedService the stagingLinkedService value to set + * @return the IntegrationRuntimeDataProxyProperties object itself. + */ + public IntegrationRuntimeDataProxyProperties withStagingLinkedService(EntityReference stagingLinkedService) { + this.stagingLinkedService = stagingLinkedService; + return this; + } + + /** + * Get the path to contain the staged data in the Blob storage. + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set the path to contain the staged data in the Blob storage. + * + * @param path the path value to set + * @return the IntegrationRuntimeDataProxyProperties object itself. + */ + public IntegrationRuntimeDataProxyProperties withPath(String path) { + this.path = path; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeEdition.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeEdition.java new file mode 100644 index 000000000000..ca4e1d289212 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeEdition.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IntegrationRuntimeEdition. + */ +public final class IntegrationRuntimeEdition extends ExpandableStringEnum { + /** Static value Standard for IntegrationRuntimeEdition. */ + public static final IntegrationRuntimeEdition STANDARD = fromString("Standard"); + + /** Static value Enterprise for IntegrationRuntimeEdition. */ + public static final IntegrationRuntimeEdition ENTERPRISE = fromString("Enterprise"); + + /** + * Creates or finds a IntegrationRuntimeEdition from its string representation. + * @param name a name to look for + * @return the corresponding IntegrationRuntimeEdition + */ + @JsonCreator + public static IntegrationRuntimeEdition fromString(String name) { + return fromString(name, IntegrationRuntimeEdition.class); + } + + /** + * @return known IntegrationRuntimeEdition values + */ + public static Collection values() { + return values(IntegrationRuntimeEdition.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeEntityReferenceType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeEntityReferenceType.java new file mode 100644 index 000000000000..3941603fea45 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeEntityReferenceType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IntegrationRuntimeEntityReferenceType. + */ +public final class IntegrationRuntimeEntityReferenceType extends ExpandableStringEnum { + /** Static value IntegrationRuntimeReference for IntegrationRuntimeEntityReferenceType. */ + public static final IntegrationRuntimeEntityReferenceType INTEGRATION_RUNTIME_REFERENCE = fromString("IntegrationRuntimeReference"); + + /** Static value LinkedServiceReference for IntegrationRuntimeEntityReferenceType. */ + public static final IntegrationRuntimeEntityReferenceType LINKED_SERVICE_REFERENCE = fromString("LinkedServiceReference"); + + /** + * Creates or finds a IntegrationRuntimeEntityReferenceType from its string representation. + * @param name a name to look for + * @return the corresponding IntegrationRuntimeEntityReferenceType + */ + @JsonCreator + public static IntegrationRuntimeEntityReferenceType fromString(String name) { + return fromString(name, IntegrationRuntimeEntityReferenceType.class); + } + + /** + * @return known IntegrationRuntimeEntityReferenceType values + */ + public static Collection values() { + return values(IntegrationRuntimeEntityReferenceType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeInternalChannelEncryptionMode.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeInternalChannelEncryptionMode.java new file mode 100644 index 000000000000..3d4ef2ade799 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeInternalChannelEncryptionMode.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IntegrationRuntimeInternalChannelEncryptionMode. + */ +public final class IntegrationRuntimeInternalChannelEncryptionMode extends ExpandableStringEnum { + /** Static value NotSet for IntegrationRuntimeInternalChannelEncryptionMode. */ + public static final IntegrationRuntimeInternalChannelEncryptionMode NOT_SET = fromString("NotSet"); + + /** Static value SslEncrypted for IntegrationRuntimeInternalChannelEncryptionMode. */ + public static final IntegrationRuntimeInternalChannelEncryptionMode SSL_ENCRYPTED = fromString("SslEncrypted"); + + /** Static value NotEncrypted for IntegrationRuntimeInternalChannelEncryptionMode. */ + public static final IntegrationRuntimeInternalChannelEncryptionMode NOT_ENCRYPTED = fromString("NotEncrypted"); + + /** + * Creates or finds a IntegrationRuntimeInternalChannelEncryptionMode from its string representation. + * @param name a name to look for + * @return the corresponding IntegrationRuntimeInternalChannelEncryptionMode + */ + @JsonCreator + public static IntegrationRuntimeInternalChannelEncryptionMode fromString(String name) { + return fromString(name, IntegrationRuntimeInternalChannelEncryptionMode.class); + } + + /** + * @return known IntegrationRuntimeInternalChannelEncryptionMode values + */ + public static Collection values() { + return values(IntegrationRuntimeInternalChannelEncryptionMode.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeLicenseType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeLicenseType.java new file mode 100644 index 000000000000..f3c0b2312fef --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeLicenseType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IntegrationRuntimeLicenseType. + */ +public final class IntegrationRuntimeLicenseType extends ExpandableStringEnum { + /** Static value BasePrice for IntegrationRuntimeLicenseType. */ + public static final IntegrationRuntimeLicenseType BASE_PRICE = fromString("BasePrice"); + + /** Static value LicenseIncluded for IntegrationRuntimeLicenseType. */ + public static final IntegrationRuntimeLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** + * Creates or finds a IntegrationRuntimeLicenseType from its string representation. + * @param name a name to look for + * @return the corresponding IntegrationRuntimeLicenseType + */ + @JsonCreator + public static IntegrationRuntimeLicenseType fromString(String name) { + return fromString(name, IntegrationRuntimeLicenseType.class); + } + + /** + * @return known IntegrationRuntimeLicenseType values + */ + public static Collection values() { + return values(IntegrationRuntimeLicenseType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeMonitoringData.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeMonitoringData.java new file mode 100644 index 000000000000..f77780d31942 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeMonitoringData.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeMonitoringDataInner; +import java.util.List; + +/** + * Type representing IntegrationRuntimeMonitoringData. + */ +public interface IntegrationRuntimeMonitoringData extends HasInner, HasManager { + /** + * @return the name value. + */ + String name(); + + /** + * @return the nodes value. + */ + List nodes(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeNodeIpAddress.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeNodeIpAddress.java new file mode 100644 index 000000000000..deeb5481d869 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeNodeIpAddress.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeNodeIpAddressInner; + +/** + * Type representing IntegrationRuntimeNodeIpAddress. + */ +public interface IntegrationRuntimeNodeIpAddress extends HasInner, HasManager { + /** + * @return the ipAddress value. + */ + String ipAddress(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeNodeMonitoringData.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeNodeMonitoringData.java new file mode 100644 index 000000000000..d6bb33badb40 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeNodeMonitoringData.java @@ -0,0 +1,164 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Monitoring data for integration runtime node. + */ +public class IntegrationRuntimeNodeMonitoringData { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Name of the integration runtime node. + */ + @JsonProperty(value = "nodeName", access = JsonProperty.Access.WRITE_ONLY) + private String nodeName; + + /** + * Available memory (MB) on the integration runtime node. + */ + @JsonProperty(value = "availableMemoryInMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer availableMemoryInMB; + + /** + * CPU percentage on the integration runtime node. + */ + @JsonProperty(value = "cpuUtilization", access = JsonProperty.Access.WRITE_ONLY) + private Double cpuUtilization; + + /** + * Maximum concurrent jobs on the integration runtime node. + */ + @JsonProperty(value = "concurrentJobsLimit", access = JsonProperty.Access.WRITE_ONLY) + private Integer concurrentJobsLimit; + + /** + * The number of jobs currently running on the integration runtime node. + */ + @JsonProperty(value = "concurrentJobsRunning", access = JsonProperty.Access.WRITE_ONLY) + private Integer concurrentJobsRunning; + + /** + * The maximum concurrent jobs in this integration runtime. + */ + @JsonProperty(value = "maxConcurrentJobs", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxConcurrentJobs; + + /** + * Sent bytes on the integration runtime node. + */ + @JsonProperty(value = "sentBytes", access = JsonProperty.Access.WRITE_ONLY) + private Double sentBytes; + + /** + * Received bytes on the integration runtime node. + */ + @JsonProperty(value = "receivedBytes", access = JsonProperty.Access.WRITE_ONLY) + private Double receivedBytes; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the IntegrationRuntimeNodeMonitoringData object itself. + */ + public IntegrationRuntimeNodeMonitoringData withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get name of the integration runtime node. + * + * @return the nodeName value + */ + public String nodeName() { + return this.nodeName; + } + + /** + * Get available memory (MB) on the integration runtime node. + * + * @return the availableMemoryInMB value + */ + public Integer availableMemoryInMB() { + return this.availableMemoryInMB; + } + + /** + * Get cPU percentage on the integration runtime node. + * + * @return the cpuUtilization value + */ + public Double cpuUtilization() { + return this.cpuUtilization; + } + + /** + * Get maximum concurrent jobs on the integration runtime node. + * + * @return the concurrentJobsLimit value + */ + public Integer concurrentJobsLimit() { + return this.concurrentJobsLimit; + } + + /** + * Get the number of jobs currently running on the integration runtime node. + * + * @return the concurrentJobsRunning value + */ + public Integer concurrentJobsRunning() { + return this.concurrentJobsRunning; + } + + /** + * Get the maximum concurrent jobs in this integration runtime. + * + * @return the maxConcurrentJobs value + */ + public Integer maxConcurrentJobs() { + return this.maxConcurrentJobs; + } + + /** + * Get sent bytes on the integration runtime node. + * + * @return the sentBytes value + */ + public Double sentBytes() { + return this.sentBytes; + } + + /** + * Get received bytes on the integration runtime node. + * + * @return the receivedBytes value + */ + public Double receivedBytes() { + return this.receivedBytes; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeNodes.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeNodes.java new file mode 100644 index 000000000000..82e2fd04d22b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeNodes.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeNodesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing IntegrationRuntimeNodes. + */ +public interface IntegrationRuntimeNodes extends HasInner { + /** + * Updates a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName); + + /** + * Get the IP address of self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getIpAddressAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName); + + /** + * Deletes a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeReference.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeReference.java new file mode 100644 index 000000000000..7b65702f4ff8 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeReference.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Integration runtime reference type. + */ +public class IntegrationRuntimeReference { + /** + * Type of integration runtime. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Reference integration runtime name. + */ + @JsonProperty(value = "referenceName", required = true) + private String referenceName; + + /** + * Arguments for integration runtime. + */ + @JsonProperty(value = "parameters") + private Map parameters; + + /** + * Creates an instance of IntegrationRuntimeReference class. + * @param referenceName reference integration runtime name. + */ + public IntegrationRuntimeReference() { + type = "IntegrationRuntimeReference"; + } + + /** + * Get type of integration runtime. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set type of integration runtime. + * + * @param type the type value to set + * @return the IntegrationRuntimeReference object itself. + */ + public IntegrationRuntimeReference withType(String type) { + this.type = type; + return this; + } + + /** + * Get reference integration runtime name. + * + * @return the referenceName value + */ + public String referenceName() { + return this.referenceName; + } + + /** + * Set reference integration runtime name. + * + * @param referenceName the referenceName value to set + * @return the IntegrationRuntimeReference object itself. + */ + public IntegrationRuntimeReference withReferenceName(String referenceName) { + this.referenceName = referenceName; + return this; + } + + /** + * Get arguments for integration runtime. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set arguments for integration runtime. + * + * @param parameters the parameters value to set + * @return the IntegrationRuntimeReference object itself. + */ + public IntegrationRuntimeReference withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeRegenerateKeyParameters.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeRegenerateKeyParameters.java new file mode 100644 index 000000000000..d042a50a13f8 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeRegenerateKeyParameters.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters to regenerate the authentication key. + */ +public class IntegrationRuntimeRegenerateKeyParameters { + /** + * The name of the authentication key to regenerate. Possible values + * include: 'authKey1', 'authKey2'. + */ + @JsonProperty(value = "keyName") + private IntegrationRuntimeAuthKeyName keyName; + + /** + * Get the name of the authentication key to regenerate. Possible values include: 'authKey1', 'authKey2'. + * + * @return the keyName value + */ + public IntegrationRuntimeAuthKeyName keyName() { + return this.keyName; + } + + /** + * Set the name of the authentication key to regenerate. Possible values include: 'authKey1', 'authKey2'. + * + * @param keyName the keyName value to set + * @return the IntegrationRuntimeRegenerateKeyParameters object itself. + */ + public IntegrationRuntimeRegenerateKeyParameters withKeyName(IntegrationRuntimeAuthKeyName keyName) { + this.keyName = keyName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeRemoveNodeRequest.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeRemoveNodeRequest.java new file mode 100644 index 000000000000..9c6014c770f8 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeRemoveNodeRequest.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request to remove a node. + */ +public class IntegrationRuntimeRemoveNodeRequest { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The name of the node to be removed. + */ + @JsonProperty(value = "nodeName") + private String nodeName; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the IntegrationRuntimeRemoveNodeRequest object itself. + */ + public IntegrationRuntimeRemoveNodeRequest withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the name of the node to be removed. + * + * @return the nodeName value + */ + public String nodeName() { + return this.nodeName; + } + + /** + * Set the name of the node to be removed. + * + * @param nodeName the nodeName value to set + * @return the IntegrationRuntimeRemoveNodeRequest object itself. + */ + public IntegrationRuntimeRemoveNodeRequest withNodeName(String nodeName) { + this.nodeName = nodeName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeResource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeResource.java new file mode 100644 index 000000000000..af9f088ce07b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeResource.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeResourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeInner; +import java.util.Map; + +/** + * Type representing IntegrationRuntimeResource. + */ +public interface IntegrationRuntimeResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + IntegrationRuntimeInner properties(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the IntegrationRuntimeResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithFactory, DefinitionStages.WithIfMatch, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of IntegrationRuntimeResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a IntegrationRuntimeResource definition. + */ + interface Blank extends WithFactory { + } + + /** + * The stage of the integrationruntimeresource definition allowing to specify Factory. + */ + interface WithFactory { + /** + * Specifies resourceGroupName, factoryName. + * @param resourceGroupName The resource group name + * @param factoryName The factory name + * @return the next definition stage + */ + WithIfMatch withExistingFactory(String resourceGroupName, String factoryName); + } + + /** + * The stage of the integrationruntimeresource definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the integration runtime entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update + * @return the next definition stage + */ + WithProperties withIfMatch(String ifMatch); + } + + /** + * The stage of the integrationruntimeresource definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Integration runtime properties + * @return the next definition stage + */ + WithCreate withProperties(IntegrationRuntimeInner properties); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a IntegrationRuntimeResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAutoUpdate, UpdateStages.WithUpdateDelayOffset { + } + + /** + * Grouping of IntegrationRuntimeResource update stages. + */ + interface UpdateStages { + /** + * The stage of the integrationruntimeresource update allowing to specify AutoUpdate. + */ + interface WithAutoUpdate { + /** + * Specifies autoUpdate. + * @param autoUpdate Enables or disables the auto-update feature of the self-hosted integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. Possible values include: 'On', 'Off' + * @return the next update stage + */ + Update withAutoUpdate(IntegrationRuntimeAutoUpdate autoUpdate); + } + + /** + * The stage of the integrationruntimeresource update allowing to specify UpdateDelayOffset. + */ + interface WithUpdateDelayOffset { + /** + * Specifies updateDelayOffset. + * @param updateDelayOffset The time offset (in hours) in the day, e.g., PT03H is 3 hours. The integration runtime auto update will happen on that time + * @return the next update stage + */ + Update withUpdateDelayOffset(String updateDelayOffset); + } + + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeSsisCatalogInfo.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeSsisCatalogInfo.java new file mode 100644 index 000000000000..ea0c4e1565a1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeSsisCatalogInfo.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Catalog information for managed dedicated integration runtime. + */ +public class IntegrationRuntimeSsisCatalogInfo { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The catalog database server URL. + */ + @JsonProperty(value = "catalogServerEndpoint") + private String catalogServerEndpoint; + + /** + * The administrator user name of catalog database. + */ + @JsonProperty(value = "catalogAdminUserName") + private String catalogAdminUserName; + + /** + * The password of the administrator user account of the catalog database. + */ + @JsonProperty(value = "catalogAdminPassword") + private SecureString catalogAdminPassword; + + /** + * The pricing tier for the catalog database. The valid values could be + * found in + * https://azure.microsoft.com/en-us/pricing/details/sql-database/. + */ + @JsonProperty(value = "catalogPricingTier") + private String catalogPricingTier; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the IntegrationRuntimeSsisCatalogInfo object itself. + */ + public IntegrationRuntimeSsisCatalogInfo withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the catalog database server URL. + * + * @return the catalogServerEndpoint value + */ + public String catalogServerEndpoint() { + return this.catalogServerEndpoint; + } + + /** + * Set the catalog database server URL. + * + * @param catalogServerEndpoint the catalogServerEndpoint value to set + * @return the IntegrationRuntimeSsisCatalogInfo object itself. + */ + public IntegrationRuntimeSsisCatalogInfo withCatalogServerEndpoint(String catalogServerEndpoint) { + this.catalogServerEndpoint = catalogServerEndpoint; + return this; + } + + /** + * Get the administrator user name of catalog database. + * + * @return the catalogAdminUserName value + */ + public String catalogAdminUserName() { + return this.catalogAdminUserName; + } + + /** + * Set the administrator user name of catalog database. + * + * @param catalogAdminUserName the catalogAdminUserName value to set + * @return the IntegrationRuntimeSsisCatalogInfo object itself. + */ + public IntegrationRuntimeSsisCatalogInfo withCatalogAdminUserName(String catalogAdminUserName) { + this.catalogAdminUserName = catalogAdminUserName; + return this; + } + + /** + * Get the password of the administrator user account of the catalog database. + * + * @return the catalogAdminPassword value + */ + public SecureString catalogAdminPassword() { + return this.catalogAdminPassword; + } + + /** + * Set the password of the administrator user account of the catalog database. + * + * @param catalogAdminPassword the catalogAdminPassword value to set + * @return the IntegrationRuntimeSsisCatalogInfo object itself. + */ + public IntegrationRuntimeSsisCatalogInfo withCatalogAdminPassword(SecureString catalogAdminPassword) { + this.catalogAdminPassword = catalogAdminPassword; + return this; + } + + /** + * Get the pricing tier for the catalog database. The valid values could be found in https://azure.microsoft.com/en-us/pricing/details/sql-database/. + * + * @return the catalogPricingTier value + */ + public String catalogPricingTier() { + return this.catalogPricingTier; + } + + /** + * Set the pricing tier for the catalog database. The valid values could be found in https://azure.microsoft.com/en-us/pricing/details/sql-database/. + * + * @param catalogPricingTier the catalogPricingTier value to set + * @return the IntegrationRuntimeSsisCatalogInfo object itself. + */ + public IntegrationRuntimeSsisCatalogInfo withCatalogPricingTier(String catalogPricingTier) { + this.catalogPricingTier = catalogPricingTier; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeSsisProperties.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeSsisProperties.java new file mode 100644 index 000000000000..cc01a8c39582 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeSsisProperties.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SSIS properties for managed integration runtime. + */ +public class IntegrationRuntimeSsisProperties { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Catalog information for managed dedicated integration runtime. + */ + @JsonProperty(value = "catalogInfo") + private IntegrationRuntimeSsisCatalogInfo catalogInfo; + + /** + * License type for bringing your own license scenario. Possible values + * include: 'BasePrice', 'LicenseIncluded'. + */ + @JsonProperty(value = "licenseType") + private IntegrationRuntimeLicenseType licenseType; + + /** + * Custom setup script properties for a managed dedicated integration + * runtime. + */ + @JsonProperty(value = "customSetupScriptProperties") + private IntegrationRuntimeCustomSetupScriptProperties customSetupScriptProperties; + + /** + * Data proxy properties for a managed dedicated integration runtime. + */ + @JsonProperty(value = "dataProxyProperties") + private IntegrationRuntimeDataProxyProperties dataProxyProperties; + + /** + * The edition for the SSIS Integration Runtime. Possible values include: + * 'Standard', 'Enterprise'. + */ + @JsonProperty(value = "edition") + private IntegrationRuntimeEdition edition; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the IntegrationRuntimeSsisProperties object itself. + */ + public IntegrationRuntimeSsisProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get catalog information for managed dedicated integration runtime. + * + * @return the catalogInfo value + */ + public IntegrationRuntimeSsisCatalogInfo catalogInfo() { + return this.catalogInfo; + } + + /** + * Set catalog information for managed dedicated integration runtime. + * + * @param catalogInfo the catalogInfo value to set + * @return the IntegrationRuntimeSsisProperties object itself. + */ + public IntegrationRuntimeSsisProperties withCatalogInfo(IntegrationRuntimeSsisCatalogInfo catalogInfo) { + this.catalogInfo = catalogInfo; + return this; + } + + /** + * Get license type for bringing your own license scenario. Possible values include: 'BasePrice', 'LicenseIncluded'. + * + * @return the licenseType value + */ + public IntegrationRuntimeLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set license type for bringing your own license scenario. Possible values include: 'BasePrice', 'LicenseIncluded'. + * + * @param licenseType the licenseType value to set + * @return the IntegrationRuntimeSsisProperties object itself. + */ + public IntegrationRuntimeSsisProperties withLicenseType(IntegrationRuntimeLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get custom setup script properties for a managed dedicated integration runtime. + * + * @return the customSetupScriptProperties value + */ + public IntegrationRuntimeCustomSetupScriptProperties customSetupScriptProperties() { + return this.customSetupScriptProperties; + } + + /** + * Set custom setup script properties for a managed dedicated integration runtime. + * + * @param customSetupScriptProperties the customSetupScriptProperties value to set + * @return the IntegrationRuntimeSsisProperties object itself. + */ + public IntegrationRuntimeSsisProperties withCustomSetupScriptProperties(IntegrationRuntimeCustomSetupScriptProperties customSetupScriptProperties) { + this.customSetupScriptProperties = customSetupScriptProperties; + return this; + } + + /** + * Get data proxy properties for a managed dedicated integration runtime. + * + * @return the dataProxyProperties value + */ + public IntegrationRuntimeDataProxyProperties dataProxyProperties() { + return this.dataProxyProperties; + } + + /** + * Set data proxy properties for a managed dedicated integration runtime. + * + * @param dataProxyProperties the dataProxyProperties value to set + * @return the IntegrationRuntimeSsisProperties object itself. + */ + public IntegrationRuntimeSsisProperties withDataProxyProperties(IntegrationRuntimeDataProxyProperties dataProxyProperties) { + this.dataProxyProperties = dataProxyProperties; + return this; + } + + /** + * Get the edition for the SSIS Integration Runtime. Possible values include: 'Standard', 'Enterprise'. + * + * @return the edition value + */ + public IntegrationRuntimeEdition edition() { + return this.edition; + } + + /** + * Set the edition for the SSIS Integration Runtime. Possible values include: 'Standard', 'Enterprise'. + * + * @param edition the edition value to set + * @return the IntegrationRuntimeSsisProperties object itself. + */ + public IntegrationRuntimeSsisProperties withEdition(IntegrationRuntimeEdition edition) { + this.edition = edition; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeState.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeState.java new file mode 100644 index 000000000000..9f4041c5481f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeState.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IntegrationRuntimeState. + */ +public final class IntegrationRuntimeState extends ExpandableStringEnum { + /** Static value Initial for IntegrationRuntimeState. */ + public static final IntegrationRuntimeState INITIAL = fromString("Initial"); + + /** Static value Stopped for IntegrationRuntimeState. */ + public static final IntegrationRuntimeState STOPPED = fromString("Stopped"); + + /** Static value Started for IntegrationRuntimeState. */ + public static final IntegrationRuntimeState STARTED = fromString("Started"); + + /** Static value Starting for IntegrationRuntimeState. */ + public static final IntegrationRuntimeState STARTING = fromString("Starting"); + + /** Static value Stopping for IntegrationRuntimeState. */ + public static final IntegrationRuntimeState STOPPING = fromString("Stopping"); + + /** Static value NeedRegistration for IntegrationRuntimeState. */ + public static final IntegrationRuntimeState NEED_REGISTRATION = fromString("NeedRegistration"); + + /** Static value Online for IntegrationRuntimeState. */ + public static final IntegrationRuntimeState ONLINE = fromString("Online"); + + /** Static value Limited for IntegrationRuntimeState. */ + public static final IntegrationRuntimeState LIMITED = fromString("Limited"); + + /** Static value Offline for IntegrationRuntimeState. */ + public static final IntegrationRuntimeState OFFLINE = fromString("Offline"); + + /** + * Creates or finds a IntegrationRuntimeState from its string representation. + * @param name a name to look for + * @return the corresponding IntegrationRuntimeState + */ + @JsonCreator + public static IntegrationRuntimeState fromString(String name) { + return fromString(name, IntegrationRuntimeState.class); + } + + /** + * @return known IntegrationRuntimeState values + */ + public static Collection values() { + return values(IntegrationRuntimeState.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeStatus.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeStatus.java new file mode 100644 index 000000000000..5a67931b7f14 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeStatus.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Integration runtime status. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("IntegrationRuntimeStatus") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "SelfHosted", value = SelfHostedIntegrationRuntimeStatus.class), + @JsonSubTypes.Type(name = "Managed", value = ManagedIntegrationRuntimeStatus.class) +}) +public class IntegrationRuntimeStatus { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The data factory name which the integration runtime belong to. + */ + @JsonProperty(value = "dataFactoryName", access = JsonProperty.Access.WRITE_ONLY) + private String dataFactoryName; + + /** + * The state of integration runtime. Possible values include: 'Initial', + * 'Stopped', 'Started', 'Starting', 'Stopping', 'NeedRegistration', + * 'Online', 'Limited', 'Offline'. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private IntegrationRuntimeState state; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the IntegrationRuntimeStatus object itself. + */ + public IntegrationRuntimeStatus withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the data factory name which the integration runtime belong to. + * + * @return the dataFactoryName value + */ + public String dataFactoryName() { + return this.dataFactoryName; + } + + /** + * Get the state of integration runtime. Possible values include: 'Initial', 'Stopped', 'Started', 'Starting', 'Stopping', 'NeedRegistration', 'Online', 'Limited', 'Offline'. + * + * @return the state value + */ + public IntegrationRuntimeState state() { + return this.state; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeStatusListResponse.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeStatusListResponse.java new file mode 100644 index 000000000000..39a1e8fb8812 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeStatusListResponse.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeStatusResponseInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A list of integration runtime status. + */ +public class IntegrationRuntimeStatusListResponse { + /** + * List of integration runtime status. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * The link to the next page of results, if any remaining results exist. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get list of integration runtime status. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set list of integration runtime status. + * + * @param value the value value to set + * @return the IntegrationRuntimeStatusListResponse object itself. + */ + public IntegrationRuntimeStatusListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the link to the next page of results, if any remaining results exist. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the link to the next page of results, if any remaining results exist. + * + * @param nextLink the nextLink value to set + * @return the IntegrationRuntimeStatusListResponse object itself. + */ + public IntegrationRuntimeStatusListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeStatusResponse.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeStatusResponse.java new file mode 100644 index 000000000000..ea9d67089c3c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeStatusResponse.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeStatusResponseInner; + +/** + * Type representing IntegrationRuntimeStatusResponse. + */ +public interface IntegrationRuntimeStatusResponse extends HasInner, HasManager { + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + IntegrationRuntimeStatus properties(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeType.java new file mode 100644 index 000000000000..ae3c530ccf3b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IntegrationRuntimeType. + */ +public final class IntegrationRuntimeType extends ExpandableStringEnum { + /** Static value Managed for IntegrationRuntimeType. */ + public static final IntegrationRuntimeType MANAGED = fromString("Managed"); + + /** Static value SelfHosted for IntegrationRuntimeType. */ + public static final IntegrationRuntimeType SELF_HOSTED = fromString("SelfHosted"); + + /** + * Creates or finds a IntegrationRuntimeType from its string representation. + * @param name a name to look for + * @return the corresponding IntegrationRuntimeType + */ + @JsonCreator + public static IntegrationRuntimeType fromString(String name) { + return fromString(name, IntegrationRuntimeType.class); + } + + /** + * @return known IntegrationRuntimeType values + */ + public static Collection values() { + return values(IntegrationRuntimeType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeUpdateResult.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeUpdateResult.java new file mode 100644 index 000000000000..4a2659619fd7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeUpdateResult.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IntegrationRuntimeUpdateResult. + */ +public final class IntegrationRuntimeUpdateResult extends ExpandableStringEnum { + /** Static value Succeed for IntegrationRuntimeUpdateResult. */ + public static final IntegrationRuntimeUpdateResult SUCCEED = fromString("Succeed"); + + /** Static value Fail for IntegrationRuntimeUpdateResult. */ + public static final IntegrationRuntimeUpdateResult FAIL = fromString("Fail"); + + /** + * Creates or finds a IntegrationRuntimeUpdateResult from its string representation. + * @param name a name to look for + * @return the corresponding IntegrationRuntimeUpdateResult + */ + @JsonCreator + public static IntegrationRuntimeUpdateResult fromString(String name) { + return fromString(name, IntegrationRuntimeUpdateResult.class); + } + + /** + * @return known IntegrationRuntimeUpdateResult values + */ + public static Collection values() { + return values(IntegrationRuntimeUpdateResult.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeVNetProperties.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeVNetProperties.java new file mode 100644 index 000000000000..e09713e775ec --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimeVNetProperties.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * VNet properties for managed integration runtime. + */ +public class IntegrationRuntimeVNetProperties { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The ID of the VNet that this integration runtime will join. + */ + @JsonProperty(value = "vNetId") + private String vNetId; + + /** + * The name of the subnet this integration runtime will join. + */ + @JsonProperty(value = "subnet") + private String subnet; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the IntegrationRuntimeVNetProperties object itself. + */ + public IntegrationRuntimeVNetProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the ID of the VNet that this integration runtime will join. + * + * @return the vNetId value + */ + public String vNetId() { + return this.vNetId; + } + + /** + * Set the ID of the VNet that this integration runtime will join. + * + * @param vNetId the vNetId value to set + * @return the IntegrationRuntimeVNetProperties object itself. + */ + public IntegrationRuntimeVNetProperties withVNetId(String vNetId) { + this.vNetId = vNetId; + return this; + } + + /** + * Get the name of the subnet this integration runtime will join. + * + * @return the subnet value + */ + public String subnet() { + return this.subnet; + } + + /** + * Set the name of the subnet this integration runtime will join. + * + * @param subnet the subnet value to set + * @return the IntegrationRuntimeVNetProperties object itself. + */ + public IntegrationRuntimeVNetProperties withSubnet(String subnet) { + this.subnet = subnet; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimes.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimes.java new file mode 100644 index 000000000000..2c7a4d762f94 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/IntegrationRuntimes.java @@ -0,0 +1,164 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing IntegrationRuntimes. + */ +public interface IntegrationRuntimes extends SupportsCreating, HasInner { + /** + * Gets detailed status information for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getStatusAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + + /** + * Gets the on-premises integration runtime connection information for encrypting the on-premises data source credentials. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getConnectionInfoAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + + /** + * Regenerates the authentication key for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateAuthKeyAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + + /** + * Retrieves the authentication keys for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAuthKeysAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + + /** + * Starts a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable startAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + + /** + * Stops a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable stopAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + + /** + * Remove a node from integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param removeNodeParameters The name of the node to be removed from an integration runtime. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable removeNodeAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeRemoveNodeRequest removeNodeParameters); + + /** + * Force the integration runtime to synchronize credentials across integration runtime nodes, and this will override the credentials across all worker nodes with those available on the dispatcher node. If you already have the latest credential backup file, you should manually import it (preferred) on any self-hosted integration runtime node than using this API directly. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable syncCredentialsAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + + /** + * Get the integration runtime monitoring data, which includes the monitor data for all the nodes under this integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getMonitoringDataAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + + /** + * Upgrade self-hosted integration runtime to latest version if availability. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable upgradeAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + + /** + * Gets an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + + /** + * Lists integration runtimes. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByFactoryAsync(final String resourceGroupName, final String factoryName); + + /** + * Deletes an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String factoryName, String integrationRuntimeName); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JiraLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JiraLinkedService.java new file mode 100644 index 000000000000..d5f8950d618b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JiraLinkedService.java @@ -0,0 +1,242 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Jira Service linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Jira") +@JsonFlatten +public class JiraLinkedService extends LinkedServiceInner { + /** + * The IP address or host name of the Jira service. (e.g. + * jira.example.com). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The TCP port that the Jira server uses to listen for client connections. + * The default value is 443 if connecting through HTTPS, or 8080 if + * connecting through HTTP. + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * The user name that you use to access Jira Service. + */ + @JsonProperty(value = "typeProperties.username", required = true) + private Object username; + + /** + * The password corresponding to the user name that you provided in the + * username field. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the IP address or host name of the Jira service. (e.g. jira.example.com). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the IP address or host name of the Jira service. (e.g. jira.example.com). + * + * @param host the host value to set + * @return the JiraLinkedService object itself. + */ + public JiraLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the TCP port that the Jira server uses to listen for client connections. The default value is 443 if connecting through HTTPS, or 8080 if connecting through HTTP. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port that the Jira server uses to listen for client connections. The default value is 443 if connecting through HTTPS, or 8080 if connecting through HTTP. + * + * @param port the port value to set + * @return the JiraLinkedService object itself. + */ + public JiraLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the user name that you use to access Jira Service. + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the user name that you use to access Jira Service. + * + * @param username the username value to set + * @return the JiraLinkedService object itself. + */ + public JiraLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password corresponding to the user name that you provided in the username field. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password corresponding to the user name that you provided in the username field. + * + * @param password the password value to set + * @return the JiraLinkedService object itself. + */ + public JiraLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the JiraLinkedService object itself. + */ + public JiraLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the JiraLinkedService object itself. + */ + public JiraLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the JiraLinkedService object itself. + */ + public JiraLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the JiraLinkedService object itself. + */ + public JiraLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JiraObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JiraObjectDataset.java new file mode 100644 index 000000000000..1cc278ee99e5 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JiraObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Jira Service dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("JiraObject") +public class JiraObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JiraSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JiraSource.java new file mode 100644 index 000000000000..c889694a34e0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JiraSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Jira Service source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("JiraSource") +public class JiraSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the JiraSource object itself. + */ + public JiraSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JsonFormat.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JsonFormat.java new file mode 100644 index 000000000000..63033b3e5162 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JsonFormat.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The data stored in JSON format. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("JsonFormat") +public class JsonFormat extends DatasetStorageFormat { + /** + * File pattern of JSON. To be more specific, the way of separating a + * collection of JSON objects. The default value is 'setOfObjects'. It is + * case-sensitive. Possible values include: 'setOfObjects', + * 'arrayOfObjects'. + */ + @JsonProperty(value = "filePattern") + private JsonFormatFilePattern filePattern; + + /** + * The character used to separate nesting levels. Default value is '.' + * (dot). Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "nestingSeparator") + private Object nestingSeparator; + + /** + * The code page name of the preferred encoding. If not provided, the + * default value is 'utf-8', unless the byte order mark (BOM) denotes + * another Unicode encoding. The full list of supported values can be found + * in the 'Name' column of the table of encodings in the following + * reference: https://go.microsoft.com/fwlink/?linkid=861078. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "encodingName") + private Object encodingName; + + /** + * The JSONPath of the JSON array element to be flattened. Example: + * "$.ArrayPath". Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "jsonNodeReference") + private Object jsonNodeReference; + + /** + * The JSONPath definition for each column mapping with a customized column + * name to extract data from JSON file. For fields under root object, start + * with "$"; for fields inside the array chosen by jsonNodeReference + * property, start from the array element. Example: {"Column1": + * "$.Column1Path", "Column2": "Column2PathInArray"}. Type: object (or + * Expression with resultType object). + */ + @JsonProperty(value = "jsonPathDefinition") + private Object jsonPathDefinition; + + /** + * Get file pattern of JSON. To be more specific, the way of separating a collection of JSON objects. The default value is 'setOfObjects'. It is case-sensitive. Possible values include: 'setOfObjects', 'arrayOfObjects'. + * + * @return the filePattern value + */ + public JsonFormatFilePattern filePattern() { + return this.filePattern; + } + + /** + * Set file pattern of JSON. To be more specific, the way of separating a collection of JSON objects. The default value is 'setOfObjects'. It is case-sensitive. Possible values include: 'setOfObjects', 'arrayOfObjects'. + * + * @param filePattern the filePattern value to set + * @return the JsonFormat object itself. + */ + public JsonFormat withFilePattern(JsonFormatFilePattern filePattern) { + this.filePattern = filePattern; + return this; + } + + /** + * Get the character used to separate nesting levels. Default value is '.' (dot). Type: string (or Expression with resultType string). + * + * @return the nestingSeparator value + */ + public Object nestingSeparator() { + return this.nestingSeparator; + } + + /** + * Set the character used to separate nesting levels. Default value is '.' (dot). Type: string (or Expression with resultType string). + * + * @param nestingSeparator the nestingSeparator value to set + * @return the JsonFormat object itself. + */ + public JsonFormat withNestingSeparator(Object nestingSeparator) { + this.nestingSeparator = nestingSeparator; + return this; + } + + /** + * Get the code page name of the preferred encoding. If not provided, the default value is 'utf-8', unless the byte order mark (BOM) denotes another Unicode encoding. The full list of supported values can be found in the 'Name' column of the table of encodings in the following reference: https://go.microsoft.com/fwlink/?linkid=861078. Type: string (or Expression with resultType string). + * + * @return the encodingName value + */ + public Object encodingName() { + return this.encodingName; + } + + /** + * Set the code page name of the preferred encoding. If not provided, the default value is 'utf-8', unless the byte order mark (BOM) denotes another Unicode encoding. The full list of supported values can be found in the 'Name' column of the table of encodings in the following reference: https://go.microsoft.com/fwlink/?linkid=861078. Type: string (or Expression with resultType string). + * + * @param encodingName the encodingName value to set + * @return the JsonFormat object itself. + */ + public JsonFormat withEncodingName(Object encodingName) { + this.encodingName = encodingName; + return this; + } + + /** + * Get the JSONPath of the JSON array element to be flattened. Example: "$.ArrayPath". Type: string (or Expression with resultType string). + * + * @return the jsonNodeReference value + */ + public Object jsonNodeReference() { + return this.jsonNodeReference; + } + + /** + * Set the JSONPath of the JSON array element to be flattened. Example: "$.ArrayPath". Type: string (or Expression with resultType string). + * + * @param jsonNodeReference the jsonNodeReference value to set + * @return the JsonFormat object itself. + */ + public JsonFormat withJsonNodeReference(Object jsonNodeReference) { + this.jsonNodeReference = jsonNodeReference; + return this; + } + + /** + * Get the JSONPath definition for each column mapping with a customized column name to extract data from JSON file. For fields under root object, start with "$"; for fields inside the array chosen by jsonNodeReference property, start from the array element. Example: {"Column1": "$.Column1Path", "Column2": "Column2PathInArray"}. Type: object (or Expression with resultType object). + * + * @return the jsonPathDefinition value + */ + public Object jsonPathDefinition() { + return this.jsonPathDefinition; + } + + /** + * Set the JSONPath definition for each column mapping with a customized column name to extract data from JSON file. For fields under root object, start with "$"; for fields inside the array chosen by jsonNodeReference property, start from the array element. Example: {"Column1": "$.Column1Path", "Column2": "Column2PathInArray"}. Type: object (or Expression with resultType object). + * + * @param jsonPathDefinition the jsonPathDefinition value to set + * @return the JsonFormat object itself. + */ + public JsonFormat withJsonPathDefinition(Object jsonPathDefinition) { + this.jsonPathDefinition = jsonPathDefinition; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JsonFormatFilePattern.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JsonFormatFilePattern.java new file mode 100644 index 000000000000..9417eb59a2f3 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/JsonFormatFilePattern.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JsonFormatFilePattern. + */ +public final class JsonFormatFilePattern extends ExpandableStringEnum { + /** Static value setOfObjects for JsonFormatFilePattern. */ + public static final JsonFormatFilePattern SET_OF_OBJECTS = fromString("setOfObjects"); + + /** Static value arrayOfObjects for JsonFormatFilePattern. */ + public static final JsonFormatFilePattern ARRAY_OF_OBJECTS = fromString("arrayOfObjects"); + + /** + * Creates or finds a JsonFormatFilePattern from its string representation. + * @param name a name to look for + * @return the corresponding JsonFormatFilePattern + */ + @JsonCreator + public static JsonFormatFilePattern fromString(String name) { + return fromString(name, JsonFormatFilePattern.class); + } + + /** + * @return known JsonFormatFilePattern values + */ + public static Collection values() { + return values(JsonFormatFilePattern.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntime.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntime.java new file mode 100644 index 000000000000..4b5ed8ef575d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntime.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The linked integration runtime information. + */ +public class LinkedIntegrationRuntime { + /** + * The name of the linked integration runtime. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The subscription ID for which the linked integration runtime belong to. + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The name of the data factory for which the linked integration runtime + * belong to. + */ + @JsonProperty(value = "dataFactoryName", access = JsonProperty.Access.WRITE_ONLY) + private String dataFactoryName; + + /** + * The location of the data factory for which the linked integration + * runtime belong to. + */ + @JsonProperty(value = "dataFactoryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String dataFactoryLocation; + + /** + * The creating time of the linked integration runtime. + */ + @JsonProperty(value = "createTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createTime; + + /** + * Get the name of the linked integration runtime. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the subscription ID for which the linked integration runtime belong to. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the name of the data factory for which the linked integration runtime belong to. + * + * @return the dataFactoryName value + */ + public String dataFactoryName() { + return this.dataFactoryName; + } + + /** + * Get the location of the data factory for which the linked integration runtime belong to. + * + * @return the dataFactoryLocation value + */ + public String dataFactoryLocation() { + return this.dataFactoryLocation; + } + + /** + * Get the creating time of the linked integration runtime. + * + * @return the createTime value + */ + public DateTime createTime() { + return this.createTime; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntimeKey.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntimeKey.java new file mode 100644 index 000000000000..c92ae3747415 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntimeKey.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The base definition of a secret type. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authorizationType") +@JsonTypeName("Key") +public class LinkedIntegrationRuntimeKey extends LinkedIntegrationRuntimeProperties { + /** + * Type of the secret. + */ + @JsonProperty(value = "key", required = true) + private SecureString key; + + /** + * Get type of the secret. + * + * @return the key value + */ + public SecureString key() { + return this.key; + } + + /** + * Set type of the secret. + * + * @param key the key value to set + * @return the LinkedIntegrationRuntimeKey object itself. + */ + public LinkedIntegrationRuntimeKey withKey(SecureString key) { + this.key = key; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntimeProperties.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntimeProperties.java new file mode 100644 index 000000000000..9e7572b7853f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntimeProperties.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The base definition of a secret type. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authorizationType") +@JsonTypeName("LinkedIntegrationRuntimeProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "RBAC", value = LinkedIntegrationRuntimeRbac.class), + @JsonSubTypes.Type(name = "Key", value = LinkedIntegrationRuntimeKey.class) +}) +public class LinkedIntegrationRuntimeProperties { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntimeRbac.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntimeRbac.java new file mode 100644 index 000000000000..509ff731728b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedIntegrationRuntimeRbac.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The base definition of a secret type. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authorizationType") +@JsonTypeName("RBAC") +public class LinkedIntegrationRuntimeRbac extends LinkedIntegrationRuntimeProperties { + /** + * The resource ID of the integration runtime to be shared. + */ + @JsonProperty(value = "resourceId", required = true) + private String resourceId; + + /** + * Get the resource ID of the integration runtime to be shared. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource ID of the integration runtime to be shared. + * + * @param resourceId the resourceId value to set + * @return the LinkedIntegrationRuntimeRbac object itself. + */ + public LinkedIntegrationRuntimeRbac withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedServiceReference.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedServiceReference.java new file mode 100644 index 000000000000..4a5228e483cf --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedServiceReference.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Linked service reference type. + */ +public class LinkedServiceReference { + /** + * Linked service reference type. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Reference LinkedService name. + */ + @JsonProperty(value = "referenceName", required = true) + private String referenceName; + + /** + * Arguments for LinkedService. + */ + @JsonProperty(value = "parameters") + private Map parameters; + + /** + * Creates an instance of LinkedServiceReference class. + * @param referenceName reference LinkedService name. + */ + public LinkedServiceReference() { + type = "LinkedServiceReference"; + } + + /** + * Get linked service reference type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set linked service reference type. + * + * @param type the type value to set + * @return the LinkedServiceReference object itself. + */ + public LinkedServiceReference withType(String type) { + this.type = type; + return this; + } + + /** + * Get reference LinkedService name. + * + * @return the referenceName value + */ + public String referenceName() { + return this.referenceName; + } + + /** + * Set reference LinkedService name. + * + * @param referenceName the referenceName value to set + * @return the LinkedServiceReference object itself. + */ + public LinkedServiceReference withReferenceName(String referenceName) { + this.referenceName = referenceName; + return this; + } + + /** + * Get arguments for LinkedService. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set arguments for LinkedService. + * + * @param parameters the parameters value to set + * @return the LinkedServiceReference object itself. + */ + public LinkedServiceReference withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedServiceResource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedServiceResource.java new file mode 100644 index 000000000000..75b18ab169e2 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedServiceResource.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceResourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; +import java.util.Map; +import java.util.List; + +/** + * Type representing LinkedServiceResource. + */ +public interface LinkedServiceResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + LinkedServiceInner properties(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the LinkedServiceResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithFactory, DefinitionStages.WithIfMatch, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of LinkedServiceResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LinkedServiceResource definition. + */ + interface Blank extends WithFactory { + } + + /** + * The stage of the linkedserviceresource definition allowing to specify Factory. + */ + interface WithFactory { + /** + * Specifies resourceGroupName, factoryName. + * @param resourceGroupName The resource group name + * @param factoryName The factory name + * @return the next definition stage + */ + WithIfMatch withExistingFactory(String resourceGroupName, String factoryName); + } + + /** + * The stage of the linkedserviceresource definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the linkedService entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update + * @return the next definition stage + */ + WithProperties withIfMatch(String ifMatch); + } + + /** + * The stage of the linkedserviceresource definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Properties of linked service + * @return the next definition stage + */ + WithCreate withProperties(LinkedServiceInner properties); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a LinkedServiceResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithProperties { + } + + /** + * Grouping of LinkedServiceResource update stages. + */ + interface UpdateStages { + /** + * The stage of the linkedserviceresource update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the linkedService entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the linkedserviceresource update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Properties of linked service + * @return the next update stage + */ + Update withProperties(LinkedServiceInner properties); + } + + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedServices.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedServices.java new file mode 100644 index 000000000000..6a35053edf42 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LinkedServices.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing LinkedServices. + */ +public interface LinkedServices extends SupportsCreating, HasInner { + /** + * Gets a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String factoryName, String linkedServiceName); + + /** + * Lists linked services. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByFactoryAsync(final String resourceGroupName, final String factoryName); + + /** + * Deletes a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String factoryName, String linkedServiceName); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LookupActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LookupActivity.java new file mode 100644 index 000000000000..c5f55e929672 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/LookupActivity.java @@ -0,0 +1,102 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Lookup activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Lookup") +@JsonFlatten +public class LookupActivity extends ExecutionActivity { + /** + * Dataset-specific source properties, same as copy activity source. + */ + @JsonProperty(value = "typeProperties.source", required = true) + private CopySource source; + + /** + * Lookup activity dataset reference. + */ + @JsonProperty(value = "typeProperties.dataset", required = true) + private DatasetReference dataset; + + /** + * Whether to return first row or all rows. Default value is true. Type: + * boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "typeProperties.firstRowOnly") + private Object firstRowOnly; + + /** + * Get dataset-specific source properties, same as copy activity source. + * + * @return the source value + */ + public CopySource source() { + return this.source; + } + + /** + * Set dataset-specific source properties, same as copy activity source. + * + * @param source the source value to set + * @return the LookupActivity object itself. + */ + public LookupActivity withSource(CopySource source) { + this.source = source; + return this; + } + + /** + * Get lookup activity dataset reference. + * + * @return the dataset value + */ + public DatasetReference dataset() { + return this.dataset; + } + + /** + * Set lookup activity dataset reference. + * + * @param dataset the dataset value to set + * @return the LookupActivity object itself. + */ + public LookupActivity withDataset(DatasetReference dataset) { + this.dataset = dataset; + return this; + } + + /** + * Get whether to return first row or all rows. Default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the firstRowOnly value + */ + public Object firstRowOnly() { + return this.firstRowOnly; + } + + /** + * Set whether to return first row or all rows. Default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param firstRowOnly the firstRowOnly value to set + * @return the LookupActivity object itself. + */ + public LookupActivity withFirstRowOnly(Object firstRowOnly) { + this.firstRowOnly = firstRowOnly; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MagentoLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MagentoLinkedService.java new file mode 100644 index 000000000000..324edd07b8e1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MagentoLinkedService.java @@ -0,0 +1,186 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Magento server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Magento") +@JsonFlatten +public class MagentoLinkedService extends LinkedServiceInner { + /** + * The URL of the Magento instance. (i.e. 192.168.222.110/magento3). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The access token from Magento. + */ + @JsonProperty(value = "typeProperties.accessToken") + private SecretBase accessToken; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the URL of the Magento instance. (i.e. 192.168.222.110/magento3). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the URL of the Magento instance. (i.e. 192.168.222.110/magento3). + * + * @param host the host value to set + * @return the MagentoLinkedService object itself. + */ + public MagentoLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the access token from Magento. + * + * @return the accessToken value + */ + public SecretBase accessToken() { + return this.accessToken; + } + + /** + * Set the access token from Magento. + * + * @param accessToken the accessToken value to set + * @return the MagentoLinkedService object itself. + */ + public MagentoLinkedService withAccessToken(SecretBase accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the MagentoLinkedService object itself. + */ + public MagentoLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the MagentoLinkedService object itself. + */ + public MagentoLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the MagentoLinkedService object itself. + */ + public MagentoLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the MagentoLinkedService object itself. + */ + public MagentoLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MagentoObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MagentoObjectDataset.java new file mode 100644 index 000000000000..3f3def8dd8a0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MagentoObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Magento server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MagentoObject") +public class MagentoObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MagentoSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MagentoSource.java new file mode 100644 index 000000000000..3320650ff5a4 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MagentoSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Magento server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MagentoSource") +public class MagentoSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the MagentoSource object itself. + */ + public MagentoSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntime.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntime.java new file mode 100644 index 000000000000..a4920a8e888f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntime.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeInner; + +/** + * Managed integration runtime, including managed elastic and managed dedicated + * integration runtimes. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Managed") +@JsonFlatten +public class ManagedIntegrationRuntime extends IntegrationRuntimeInner { + /** + * Integration runtime state, only valid for managed dedicated integration + * runtime. Possible values include: 'Initial', 'Stopped', 'Started', + * 'Starting', 'Stopping', 'NeedRegistration', 'Online', 'Limited', + * 'Offline'. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private IntegrationRuntimeState state; + + /** + * The compute resource for managed integration runtime. + */ + @JsonProperty(value = "typeProperties.computeProperties") + private IntegrationRuntimeComputeProperties computeProperties; + + /** + * SSIS properties for managed integration runtime. + */ + @JsonProperty(value = "typeProperties.ssisProperties") + private IntegrationRuntimeSsisProperties ssisProperties; + + /** + * Get integration runtime state, only valid for managed dedicated integration runtime. Possible values include: 'Initial', 'Stopped', 'Started', 'Starting', 'Stopping', 'NeedRegistration', 'Online', 'Limited', 'Offline'. + * + * @return the state value + */ + public IntegrationRuntimeState state() { + return this.state; + } + + /** + * Get the compute resource for managed integration runtime. + * + * @return the computeProperties value + */ + public IntegrationRuntimeComputeProperties computeProperties() { + return this.computeProperties; + } + + /** + * Set the compute resource for managed integration runtime. + * + * @param computeProperties the computeProperties value to set + * @return the ManagedIntegrationRuntime object itself. + */ + public ManagedIntegrationRuntime withComputeProperties(IntegrationRuntimeComputeProperties computeProperties) { + this.computeProperties = computeProperties; + return this; + } + + /** + * Get sSIS properties for managed integration runtime. + * + * @return the ssisProperties value + */ + public IntegrationRuntimeSsisProperties ssisProperties() { + return this.ssisProperties; + } + + /** + * Set sSIS properties for managed integration runtime. + * + * @param ssisProperties the ssisProperties value to set + * @return the ManagedIntegrationRuntime object itself. + */ + public ManagedIntegrationRuntime withSsisProperties(IntegrationRuntimeSsisProperties ssisProperties) { + this.ssisProperties = ssisProperties; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeError.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeError.java new file mode 100644 index 000000000000..8afe66233b0c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeError.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error definition for managed integration runtime. + */ +public class ManagedIntegrationRuntimeError { + /** + * The time when the error occurred. + */ + @JsonProperty(value = "time", access = JsonProperty.Access.WRITE_ONLY) + private DateTime time; + + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Managed integration runtime error parameters. + */ + @JsonProperty(value = "parameters", access = JsonProperty.Access.WRITE_ONLY) + private List parameters; + + /** + * Error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the time when the error occurred. + * + * @return the time value + */ + public DateTime time() { + return this.time; + } + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get managed integration runtime error parameters. + * + * @return the parameters value + */ + public List parameters() { + return this.parameters; + } + + /** + * Get error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeNode.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeNode.java new file mode 100644 index 000000000000..6ebb14619e02 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeNode.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of integration runtime node. + */ +public class ManagedIntegrationRuntimeNode { + /** + * The managed integration runtime node id. + */ + @JsonProperty(value = "nodeId", access = JsonProperty.Access.WRITE_ONLY) + private String nodeId; + + /** + * The managed integration runtime node status. Possible values include: + * 'Starting', 'Available', 'Recycling', 'Unavailable'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ManagedIntegrationRuntimeNodeStatus status; + + /** + * The errors that occurred on this integration runtime node. + */ + @JsonProperty(value = "errors") + private List errors; + + /** + * Get the managed integration runtime node id. + * + * @return the nodeId value + */ + public String nodeId() { + return this.nodeId; + } + + /** + * Get the managed integration runtime node status. Possible values include: 'Starting', 'Available', 'Recycling', 'Unavailable'. + * + * @return the status value + */ + public ManagedIntegrationRuntimeNodeStatus status() { + return this.status; + } + + /** + * Get the errors that occurred on this integration runtime node. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + + /** + * Set the errors that occurred on this integration runtime node. + * + * @param errors the errors value to set + * @return the ManagedIntegrationRuntimeNode object itself. + */ + public ManagedIntegrationRuntimeNode withErrors(List errors) { + this.errors = errors; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeNodeStatus.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeNodeStatus.java new file mode 100644 index 000000000000..d80ac2c96ffe --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeNodeStatus.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ManagedIntegrationRuntimeNodeStatus. + */ +public final class ManagedIntegrationRuntimeNodeStatus extends ExpandableStringEnum { + /** Static value Starting for ManagedIntegrationRuntimeNodeStatus. */ + public static final ManagedIntegrationRuntimeNodeStatus STARTING = fromString("Starting"); + + /** Static value Available for ManagedIntegrationRuntimeNodeStatus. */ + public static final ManagedIntegrationRuntimeNodeStatus AVAILABLE = fromString("Available"); + + /** Static value Recycling for ManagedIntegrationRuntimeNodeStatus. */ + public static final ManagedIntegrationRuntimeNodeStatus RECYCLING = fromString("Recycling"); + + /** Static value Unavailable for ManagedIntegrationRuntimeNodeStatus. */ + public static final ManagedIntegrationRuntimeNodeStatus UNAVAILABLE = fromString("Unavailable"); + + /** + * Creates or finds a ManagedIntegrationRuntimeNodeStatus from its string representation. + * @param name a name to look for + * @return the corresponding ManagedIntegrationRuntimeNodeStatus + */ + @JsonCreator + public static ManagedIntegrationRuntimeNodeStatus fromString(String name) { + return fromString(name, ManagedIntegrationRuntimeNodeStatus.class); + } + + /** + * @return known ManagedIntegrationRuntimeNodeStatus values + */ + public static Collection values() { + return values(ManagedIntegrationRuntimeNodeStatus.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeOperationResult.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeOperationResult.java new file mode 100644 index 000000000000..04784a221d83 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeOperationResult.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of managed integration runtime operation result. + */ +public class ManagedIntegrationRuntimeOperationResult { + /** + * The operation type. Could be start or stop. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The start time of the operation. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The operation result. + */ + @JsonProperty(value = "result", access = JsonProperty.Access.WRITE_ONLY) + private String result; + + /** + * The error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private String errorCode; + + /** + * Managed integration runtime error parameters. + */ + @JsonProperty(value = "parameters", access = JsonProperty.Access.WRITE_ONLY) + private List parameters; + + /** + * The activity id for the operation request. + */ + @JsonProperty(value = "activityId", access = JsonProperty.Access.WRITE_ONLY) + private String activityId; + + /** + * Get the operation type. Could be start or stop. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the start time of the operation. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the operation result. + * + * @return the result value + */ + public String result() { + return this.result; + } + + /** + * Get the error code. + * + * @return the errorCode value + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get managed integration runtime error parameters. + * + * @return the parameters value + */ + public List parameters() { + return this.parameters; + } + + /** + * Get the activity id for the operation request. + * + * @return the activityId value + */ + public String activityId() { + return this.activityId; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeStatus.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeStatus.java new file mode 100644 index 000000000000..de8244645552 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ManagedIntegrationRuntimeStatus.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Managed integration runtime status. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Managed") +@JsonFlatten +public class ManagedIntegrationRuntimeStatus extends IntegrationRuntimeStatus { + /** + * The time at which the integration runtime was created, in ISO8601 + * format. + */ + @JsonProperty(value = "typeProperties.createTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createTime; + + /** + * The list of nodes for managed integration runtime. + */ + @JsonProperty(value = "typeProperties.nodes", access = JsonProperty.Access.WRITE_ONLY) + private List nodes; + + /** + * The errors that occurred on this integration runtime. + */ + @JsonProperty(value = "typeProperties.otherErrors", access = JsonProperty.Access.WRITE_ONLY) + private List otherErrors; + + /** + * The last operation result that occurred on this integration runtime. + */ + @JsonProperty(value = "typeProperties.lastOperation", access = JsonProperty.Access.WRITE_ONLY) + private ManagedIntegrationRuntimeOperationResult lastOperation; + + /** + * Get the time at which the integration runtime was created, in ISO8601 format. + * + * @return the createTime value + */ + public DateTime createTime() { + return this.createTime; + } + + /** + * Get the list of nodes for managed integration runtime. + * + * @return the nodes value + */ + public List nodes() { + return this.nodes; + } + + /** + * Get the errors that occurred on this integration runtime. + * + * @return the otherErrors value + */ + public List otherErrors() { + return this.otherErrors; + } + + /** + * Get the last operation result that occurred on this integration runtime. + * + * @return the lastOperation value + */ + public ManagedIntegrationRuntimeOperationResult lastOperation() { + return this.lastOperation; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MariaDBLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MariaDBLinkedService.java new file mode 100644 index 000000000000..7d8084caa4ab --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MariaDBLinkedService.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * MariaDB server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MariaDB") +@JsonFlatten +public class MariaDBLinkedService extends LinkedServiceInner { + /** + * An ODBC connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString") + private Object connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the MariaDBLinkedService object itself. + */ + public MariaDBLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the MariaDBLinkedService object itself. + */ + public MariaDBLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MariaDBSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MariaDBSource.java new file mode 100644 index 000000000000..ab6ad006ddf8 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MariaDBSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity MariaDB server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MariaDBSource") +public class MariaDBSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the MariaDBSource object itself. + */ + public MariaDBSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MariaDBTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MariaDBTableDataset.java new file mode 100644 index 000000000000..82e9deab925c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MariaDBTableDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * MariaDB server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MariaDBTable") +public class MariaDBTableDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MarketoLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MarketoLinkedService.java new file mode 100644 index 000000000000..21ba905aad42 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MarketoLinkedService.java @@ -0,0 +1,212 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Marketo server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Marketo") +@JsonFlatten +public class MarketoLinkedService extends LinkedServiceInner { + /** + * The endpoint of the Marketo server. (i.e. 123-ABC-321.mktorest.com). + */ + @JsonProperty(value = "typeProperties.endpoint", required = true) + private Object endpoint; + + /** + * The client Id of your Marketo service. + */ + @JsonProperty(value = "typeProperties.clientId", required = true) + private Object clientId; + + /** + * The client secret of your Marketo service. + */ + @JsonProperty(value = "typeProperties.clientSecret") + private SecretBase clientSecret; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the endpoint of the Marketo server. (i.e. 123-ABC-321.mktorest.com). + * + * @return the endpoint value + */ + public Object endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint of the Marketo server. (i.e. 123-ABC-321.mktorest.com). + * + * @param endpoint the endpoint value to set + * @return the MarketoLinkedService object itself. + */ + public MarketoLinkedService withEndpoint(Object endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Get the client Id of your Marketo service. + * + * @return the clientId value + */ + public Object clientId() { + return this.clientId; + } + + /** + * Set the client Id of your Marketo service. + * + * @param clientId the clientId value to set + * @return the MarketoLinkedService object itself. + */ + public MarketoLinkedService withClientId(Object clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the client secret of your Marketo service. + * + * @return the clientSecret value + */ + public SecretBase clientSecret() { + return this.clientSecret; + } + + /** + * Set the client secret of your Marketo service. + * + * @param clientSecret the clientSecret value to set + * @return the MarketoLinkedService object itself. + */ + public MarketoLinkedService withClientSecret(SecretBase clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the MarketoLinkedService object itself. + */ + public MarketoLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the MarketoLinkedService object itself. + */ + public MarketoLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the MarketoLinkedService object itself. + */ + public MarketoLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the MarketoLinkedService object itself. + */ + public MarketoLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MarketoObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MarketoObjectDataset.java new file mode 100644 index 000000000000..363a98f2a51b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MarketoObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Marketo server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MarketoObject") +public class MarketoObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MarketoSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MarketoSource.java new file mode 100644 index 000000000000..a5afe9824332 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MarketoSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Marketo server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MarketoSource") +public class MarketoSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the MarketoSource object itself. + */ + public MarketoSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbAuthenticationType.java new file mode 100644 index 000000000000..86b078b74645 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for MongoDbAuthenticationType. + */ +public final class MongoDbAuthenticationType extends ExpandableStringEnum { + /** Static value Basic for MongoDbAuthenticationType. */ + public static final MongoDbAuthenticationType BASIC = fromString("Basic"); + + /** Static value Anonymous for MongoDbAuthenticationType. */ + public static final MongoDbAuthenticationType ANONYMOUS = fromString("Anonymous"); + + /** + * Creates or finds a MongoDbAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding MongoDbAuthenticationType + */ + @JsonCreator + public static MongoDbAuthenticationType fromString(String name) { + return fromString(name, MongoDbAuthenticationType.class); + } + + /** + * @return known MongoDbAuthenticationType values + */ + public static Collection values() { + return values(MongoDbAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbCollectionDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbCollectionDataset.java new file mode 100644 index 000000000000..b662336edcaa --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbCollectionDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The MongoDB database dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MongoDbCollection") +@JsonFlatten +public class MongoDbCollectionDataset extends DatasetInner { + /** + * The table name of the MongoDB database. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.collectionName", required = true) + private Object collectionName; + + /** + * Get the table name of the MongoDB database. Type: string (or Expression with resultType string). + * + * @return the collectionName value + */ + public Object collectionName() { + return this.collectionName; + } + + /** + * Set the table name of the MongoDB database. Type: string (or Expression with resultType string). + * + * @param collectionName the collectionName value to set + * @return the MongoDbCollectionDataset object itself. + */ + public MongoDbCollectionDataset withCollectionName(Object collectionName) { + this.collectionName = collectionName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbLinkedService.java new file mode 100644 index 000000000000..14286a18c373 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbLinkedService.java @@ -0,0 +1,297 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for MongoDb data source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MongoDb") +@JsonFlatten +public class MongoDbLinkedService extends LinkedServiceInner { + /** + * The IP address or server name of the MongoDB server. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.server", required = true) + private Object server; + + /** + * The authentication type to be used to connect to the MongoDB database. + * Possible values include: 'Basic', 'Anonymous'. + */ + @JsonProperty(value = "typeProperties.authenticationType") + private MongoDbAuthenticationType authenticationType; + + /** + * The name of the MongoDB database that you want to access. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.databaseName", required = true) + private Object databaseName; + + /** + * Username for authentication. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * Password for authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * Database to verify the username and password. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.authSource") + private Object authSource; + + /** + * The TCP port number that the MongoDB server uses to listen for client + * connections. The default value is 27017. Type: integer (or Expression + * with resultType integer), minimum: 0. + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * Specifies whether the connections to the server are encrypted using SSL. + * The default value is false. Type: boolean (or Expression with resultType + * boolean). + */ + @JsonProperty(value = "typeProperties.enableSsl") + private Object enableSsl; + + /** + * Specifies whether to allow self-signed certificates from the server. The + * default value is false. Type: boolean (or Expression with resultType + * boolean). + */ + @JsonProperty(value = "typeProperties.allowSelfSignedServerCert") + private Object allowSelfSignedServerCert; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the IP address or server name of the MongoDB server. Type: string (or Expression with resultType string). + * + * @return the server value + */ + public Object server() { + return this.server; + } + + /** + * Set the IP address or server name of the MongoDB server. Type: string (or Expression with resultType string). + * + * @param server the server value to set + * @return the MongoDbLinkedService object itself. + */ + public MongoDbLinkedService withServer(Object server) { + this.server = server; + return this; + } + + /** + * Get the authentication type to be used to connect to the MongoDB database. Possible values include: 'Basic', 'Anonymous'. + * + * @return the authenticationType value + */ + public MongoDbAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type to be used to connect to the MongoDB database. Possible values include: 'Basic', 'Anonymous'. + * + * @param authenticationType the authenticationType value to set + * @return the MongoDbLinkedService object itself. + */ + public MongoDbLinkedService withAuthenticationType(MongoDbAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the name of the MongoDB database that you want to access. Type: string (or Expression with resultType string). + * + * @return the databaseName value + */ + public Object databaseName() { + return this.databaseName; + } + + /** + * Set the name of the MongoDB database that you want to access. Type: string (or Expression with resultType string). + * + * @param databaseName the databaseName value to set + * @return the MongoDbLinkedService object itself. + */ + public MongoDbLinkedService withDatabaseName(Object databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get username for authentication. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set username for authentication. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the MongoDbLinkedService object itself. + */ + public MongoDbLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get password for authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password for authentication. + * + * @param password the password value to set + * @return the MongoDbLinkedService object itself. + */ + public MongoDbLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get database to verify the username and password. Type: string (or Expression with resultType string). + * + * @return the authSource value + */ + public Object authSource() { + return this.authSource; + } + + /** + * Set database to verify the username and password. Type: string (or Expression with resultType string). + * + * @param authSource the authSource value to set + * @return the MongoDbLinkedService object itself. + */ + public MongoDbLinkedService withAuthSource(Object authSource) { + this.authSource = authSource; + return this; + } + + /** + * Get the TCP port number that the MongoDB server uses to listen for client connections. The default value is 27017. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port number that the MongoDB server uses to listen for client connections. The default value is 27017. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param port the port value to set + * @return the MongoDbLinkedService object itself. + */ + public MongoDbLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get specifies whether the connections to the server are encrypted using SSL. The default value is false. Type: boolean (or Expression with resultType boolean). + * + * @return the enableSsl value + */ + public Object enableSsl() { + return this.enableSsl; + } + + /** + * Set specifies whether the connections to the server are encrypted using SSL. The default value is false. Type: boolean (or Expression with resultType boolean). + * + * @param enableSsl the enableSsl value to set + * @return the MongoDbLinkedService object itself. + */ + public MongoDbLinkedService withEnableSsl(Object enableSsl) { + this.enableSsl = enableSsl; + return this; + } + + /** + * Get specifies whether to allow self-signed certificates from the server. The default value is false. Type: boolean (or Expression with resultType boolean). + * + * @return the allowSelfSignedServerCert value + */ + public Object allowSelfSignedServerCert() { + return this.allowSelfSignedServerCert; + } + + /** + * Set specifies whether to allow self-signed certificates from the server. The default value is false. Type: boolean (or Expression with resultType boolean). + * + * @param allowSelfSignedServerCert the allowSelfSignedServerCert value to set + * @return the MongoDbLinkedService object itself. + */ + public MongoDbLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedServerCert) { + this.allowSelfSignedServerCert = allowSelfSignedServerCert; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the MongoDbLinkedService object itself. + */ + public MongoDbLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbSource.java new file mode 100644 index 000000000000..81bbb0e4427f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MongoDbSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity source for a MongoDB database. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MongoDbSource") +public class MongoDbSource extends CopySource { + /** + * Database query. Should be a SQL-92 query expression. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get database query. Should be a SQL-92 query expression. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set database query. Should be a SQL-92 query expression. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the MongoDbSource object itself. + */ + public MongoDbSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MultiplePipelineTrigger.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MultiplePipelineTrigger.java new file mode 100644 index 000000000000..18ca5c96f769 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MultiplePipelineTrigger.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.TriggerInner; + +/** + * Base class for all triggers that support one to many model for trigger to + * pipeline. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MultiplePipelineTrigger") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "BlobEventsTrigger", value = BlobEventsTrigger.class), + @JsonSubTypes.Type(name = "BlobTrigger", value = BlobTrigger.class), + @JsonSubTypes.Type(name = "ScheduleTrigger", value = ScheduleTrigger.class) +}) +public class MultiplePipelineTrigger extends TriggerInner { + /** + * Pipelines that need to be started. + */ + @JsonProperty(value = "pipelines") + private List pipelines; + + /** + * Get pipelines that need to be started. + * + * @return the pipelines value + */ + public List pipelines() { + return this.pipelines; + } + + /** + * Set pipelines that need to be started. + * + * @param pipelines the pipelines value to set + * @return the MultiplePipelineTrigger object itself. + */ + public MultiplePipelineTrigger withPipelines(List pipelines) { + this.pipelines = pipelines; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MySqlLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MySqlLinkedService.java new file mode 100644 index 000000000000..47aae9f0e42e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/MySqlLinkedService.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for MySQL data source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("MySql") +@JsonFlatten +public class MySqlLinkedService extends LinkedServiceInner { + /** + * The connection string. + */ + @JsonProperty(value = "typeProperties.connectionString", required = true) + private SecretBase connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the connection string. + * + * @return the connectionString value + */ + public SecretBase connectionString() { + return this.connectionString; + } + + /** + * Set the connection string. + * + * @param connectionString the connectionString value to set + * @return the MySqlLinkedService object itself. + */ + public MySqlLinkedService withConnectionString(SecretBase connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the MySqlLinkedService object itself. + */ + public MySqlLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/NetezzaLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/NetezzaLinkedService.java new file mode 100644 index 000000000000..cc37285b7a3e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/NetezzaLinkedService.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Netezza linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Netezza") +@JsonFlatten +public class NetezzaLinkedService extends LinkedServiceInner { + /** + * An ODBC connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString") + private Object connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the NetezzaLinkedService object itself. + */ + public NetezzaLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the NetezzaLinkedService object itself. + */ + public NetezzaLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/NetezzaSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/NetezzaSource.java new file mode 100644 index 000000000000..941b41b05eed --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/NetezzaSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Netezza source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("NetezzaSource") +public class NetezzaSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the NetezzaSource object itself. + */ + public NetezzaSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/NetezzaTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/NetezzaTableDataset.java new file mode 100644 index 000000000000..a6a1a126a63d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/NetezzaTableDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Netezza dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("NetezzaTable") +public class NetezzaTableDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ODataAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ODataAuthenticationType.java new file mode 100644 index 000000000000..1e6bcdecf1b2 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ODataAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ODataAuthenticationType. + */ +public final class ODataAuthenticationType extends ExpandableStringEnum { + /** Static value Basic for ODataAuthenticationType. */ + public static final ODataAuthenticationType BASIC = fromString("Basic"); + + /** Static value Anonymous for ODataAuthenticationType. */ + public static final ODataAuthenticationType ANONYMOUS = fromString("Anonymous"); + + /** + * Creates or finds a ODataAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding ODataAuthenticationType + */ + @JsonCreator + public static ODataAuthenticationType fromString(String name) { + return fromString(name, ODataAuthenticationType.class); + } + + /** + * @return known ODataAuthenticationType values + */ + public static Collection values() { + return values(ODataAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ODataLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ODataLinkedService.java new file mode 100644 index 000000000000..9306b69b480e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ODataLinkedService.java @@ -0,0 +1,159 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Open Data Protocol (OData) linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("OData") +@JsonFlatten +public class ODataLinkedService extends LinkedServiceInner { + /** + * The URL of the OData service endpoint. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.url", required = true) + private Object url; + + /** + * Type of authentication used to connect to the OData service. Possible + * values include: 'Basic', 'Anonymous'. + */ + @JsonProperty(value = "typeProperties.authenticationType") + private ODataAuthenticationType authenticationType; + + /** + * User name of the OData service. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.userName") + private Object userName; + + /** + * Password of the OData service. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the URL of the OData service endpoint. Type: string (or Expression with resultType string). + * + * @return the url value + */ + public Object url() { + return this.url; + } + + /** + * Set the URL of the OData service endpoint. Type: string (or Expression with resultType string). + * + * @param url the url value to set + * @return the ODataLinkedService object itself. + */ + public ODataLinkedService withUrl(Object url) { + this.url = url; + return this; + } + + /** + * Get type of authentication used to connect to the OData service. Possible values include: 'Basic', 'Anonymous'. + * + * @return the authenticationType value + */ + public ODataAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set type of authentication used to connect to the OData service. Possible values include: 'Basic', 'Anonymous'. + * + * @param authenticationType the authenticationType value to set + * @return the ODataLinkedService object itself. + */ + public ODataLinkedService withAuthenticationType(ODataAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get user name of the OData service. Type: string (or Expression with resultType string). + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set user name of the OData service. Type: string (or Expression with resultType string). + * + * @param userName the userName value to set + * @return the ODataLinkedService object itself. + */ + public ODataLinkedService withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get password of the OData service. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password of the OData service. + * + * @param password the password value to set + * @return the ODataLinkedService object itself. + */ + public ODataLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the ODataLinkedService object itself. + */ + public ODataLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ODataResourceDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ODataResourceDataset.java new file mode 100644 index 000000000000..c7e80c59e400 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ODataResourceDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The Open Data Protocol (OData) resource dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ODataResource") +@JsonFlatten +public class ODataResourceDataset extends DatasetInner { + /** + * The OData resource path. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.path") + private Object path; + + /** + * Get the OData resource path. Type: string (or Expression with resultType string). + * + * @return the path value + */ + public Object path() { + return this.path; + } + + /** + * Set the OData resource path. Type: string (or Expression with resultType string). + * + * @param path the path value to set + * @return the ODataResourceDataset object itself. + */ + public ODataResourceDataset withPath(Object path) { + this.path = path; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OdbcLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OdbcLinkedService.java new file mode 100644 index 000000000000..275d880d4335 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OdbcLinkedService.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Open Database Connectivity (ODBC) linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Odbc") +@JsonFlatten +public class OdbcLinkedService extends LinkedServiceInner { + /** + * The non-access credential portion of the connection string as well as an + * optional encrypted credential. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString", required = true) + private Object connectionString; + + /** + * Type of authentication used to connect to the ODBC data store. Possible + * values are: Anonymous and Basic. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.authenticationType") + private Object authenticationType; + + /** + * The access credential portion of the connection string specified in + * driver-specific property-value format. + */ + @JsonProperty(value = "typeProperties.credential") + private SecretBase credential; + + /** + * User name for Basic authentication. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.userName") + private Object userName; + + /** + * Password for Basic authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set the non-access credential portion of the connection string as well as an optional encrypted credential. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the OdbcLinkedService object itself. + */ + public OdbcLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get type of authentication used to connect to the ODBC data store. Possible values are: Anonymous and Basic. Type: string (or Expression with resultType string). + * + * @return the authenticationType value + */ + public Object authenticationType() { + return this.authenticationType; + } + + /** + * Set type of authentication used to connect to the ODBC data store. Possible values are: Anonymous and Basic. Type: string (or Expression with resultType string). + * + * @param authenticationType the authenticationType value to set + * @return the OdbcLinkedService object itself. + */ + public OdbcLinkedService withAuthenticationType(Object authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the access credential portion of the connection string specified in driver-specific property-value format. + * + * @return the credential value + */ + public SecretBase credential() { + return this.credential; + } + + /** + * Set the access credential portion of the connection string specified in driver-specific property-value format. + * + * @param credential the credential value to set + * @return the OdbcLinkedService object itself. + */ + public OdbcLinkedService withCredential(SecretBase credential) { + this.credential = credential; + return this; + } + + /** + * Get user name for Basic authentication. Type: string (or Expression with resultType string). + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set user name for Basic authentication. Type: string (or Expression with resultType string). + * + * @param userName the userName value to set + * @return the OdbcLinkedService object itself. + */ + public OdbcLinkedService withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get password for Basic authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password for Basic authentication. + * + * @param password the password value to set + * @return the OdbcLinkedService object itself. + */ + public OdbcLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the OdbcLinkedService object itself. + */ + public OdbcLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OdbcSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OdbcSink.java new file mode 100644 index 000000000000..d4ff6470ef96 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OdbcSink.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity ODBC sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("OdbcSink") +public class OdbcSink extends CopySink { + /** + * A query to execute before starting the copy. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "preCopyScript") + private Object preCopyScript; + + /** + * Get a query to execute before starting the copy. Type: string (or Expression with resultType string). + * + * @return the preCopyScript value + */ + public Object preCopyScript() { + return this.preCopyScript; + } + + /** + * Set a query to execute before starting the copy. Type: string (or Expression with resultType string). + * + * @param preCopyScript the preCopyScript value to set + * @return the OdbcSink object itself. + */ + public OdbcSink withPreCopyScript(Object preCopyScript) { + this.preCopyScript = preCopyScript; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationDisplay.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationDisplay.java new file mode 100644 index 000000000000..3fe9e26de07b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metadata associated with the operation. + */ +public class OperationDisplay { + /** + * The description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * The name of the provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * The name of the resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * The type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Get the description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the operation. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the name of the provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set the name of the provider. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the name of the resource type on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set the name of the resource type on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the type of operation: get, read, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the type of operation: get, read, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationListResponse.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationListResponse.java new file mode 100644 index 000000000000..83a84546f52f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationListResponse.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.OperationListResponseInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.OperationInner; +import java.util.List; + +/** + * Type representing OperationListResponse. + */ +public interface OperationListResponse extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationLogSpecification.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationLogSpecification.java new file mode 100644 index 000000000000..42a211304754 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationLogSpecification.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about an operation related to logs. + */ +public class OperationLogSpecification { + /** + * The name of the log category. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Localized display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Blobs created in the customer storage account, per hour. + */ + @JsonProperty(value = "blobDuration") + private String blobDuration; + + /** + * Get the name of the log category. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the log category. + * + * @param name the name value to set + * @return the OperationLogSpecification object itself. + */ + public OperationLogSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get localized display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set localized display name. + * + * @param displayName the displayName value to set + * @return the OperationLogSpecification object itself. + */ + public OperationLogSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get blobs created in the customer storage account, per hour. + * + * @return the blobDuration value + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Set blobs created in the customer storage account, per hour. + * + * @param blobDuration the blobDuration value to set + * @return the OperationLogSpecification object itself. + */ + public OperationLogSpecification withBlobDuration(String blobDuration) { + this.blobDuration = blobDuration; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationMetricAvailability.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationMetricAvailability.java new file mode 100644 index 000000000000..c75c1ff53d11 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationMetricAvailability.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines how often data for a metric becomes available. + */ +public class OperationMetricAvailability { + /** + * The granularity for the metric. + */ + @JsonProperty(value = "timeGrain") + private String timeGrain; + + /** + * Blob created in the customer storage account, per hour. + */ + @JsonProperty(value = "blobDuration") + private String blobDuration; + + /** + * Get the granularity for the metric. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Set the granularity for the metric. + * + * @param timeGrain the timeGrain value to set + * @return the OperationMetricAvailability object itself. + */ + public OperationMetricAvailability withTimeGrain(String timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get blob created in the customer storage account, per hour. + * + * @return the blobDuration value + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Set blob created in the customer storage account, per hour. + * + * @param blobDuration the blobDuration value to set + * @return the OperationMetricAvailability object itself. + */ + public OperationMetricAvailability withBlobDuration(String blobDuration) { + this.blobDuration = blobDuration; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationMetricSpecification.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationMetricSpecification.java new file mode 100644 index 000000000000..aa16b3fd3b68 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationMetricSpecification.java @@ -0,0 +1,252 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about an operation related to metrics. + */ +public class OperationMetricSpecification { + /** + * The name of the metric. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Localized display name of the metric. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The description of the metric. + */ + @JsonProperty(value = "displayDescription") + private String displayDescription; + + /** + * The unit that the metric is measured in. + */ + @JsonProperty(value = "unit") + private String unit; + + /** + * The type of metric aggregation. + */ + @JsonProperty(value = "aggregationType") + private String aggregationType; + + /** + * Whether or not the service is using regional MDM accounts. + */ + @JsonProperty(value = "enableRegionalMdmAccount") + private String enableRegionalMdmAccount; + + /** + * The name of the MDM account. + */ + @JsonProperty(value = "sourceMdmAccount") + private String sourceMdmAccount; + + /** + * The name of the MDM namespace. + */ + @JsonProperty(value = "sourceMdmNamespace") + private String sourceMdmNamespace; + + /** + * Defines how often data for metrics becomes available. + */ + @JsonProperty(value = "availabilities") + private List availabilities; + + /** + * Get the name of the metric. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the metric. + * + * @param name the name value to set + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get localized display name of the metric. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set localized display name of the metric. + * + * @param displayName the displayName value to set + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description of the metric. + * + * @return the displayDescription value + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Set the description of the metric. + * + * @param displayDescription the displayDescription value to set + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + return this; + } + + /** + * Get the unit that the metric is measured in. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit that the metric is measured in. + * + * @param unit the unit value to set + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the type of metric aggregation. + * + * @return the aggregationType value + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Set the type of metric aggregation. + * + * @param aggregationType the aggregationType value to set + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withAggregationType(String aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get whether or not the service is using regional MDM accounts. + * + * @return the enableRegionalMdmAccount value + */ + public String enableRegionalMdmAccount() { + return this.enableRegionalMdmAccount; + } + + /** + * Set whether or not the service is using regional MDM accounts. + * + * @param enableRegionalMdmAccount the enableRegionalMdmAccount value to set + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withEnableRegionalMdmAccount(String enableRegionalMdmAccount) { + this.enableRegionalMdmAccount = enableRegionalMdmAccount; + return this; + } + + /** + * Get the name of the MDM account. + * + * @return the sourceMdmAccount value + */ + public String sourceMdmAccount() { + return this.sourceMdmAccount; + } + + /** + * Set the name of the MDM account. + * + * @param sourceMdmAccount the sourceMdmAccount value to set + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withSourceMdmAccount(String sourceMdmAccount) { + this.sourceMdmAccount = sourceMdmAccount; + return this; + } + + /** + * Get the name of the MDM namespace. + * + * @return the sourceMdmNamespace value + */ + public String sourceMdmNamespace() { + return this.sourceMdmNamespace; + } + + /** + * Set the name of the MDM namespace. + * + * @param sourceMdmNamespace the sourceMdmNamespace value to set + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withSourceMdmNamespace(String sourceMdmNamespace) { + this.sourceMdmNamespace = sourceMdmNamespace; + return this; + } + + /** + * Get defines how often data for metrics becomes available. + * + * @return the availabilities value + */ + public List availabilities() { + return this.availabilities; + } + + /** + * Set defines how often data for metrics becomes available. + * + * @param availabilities the availabilities value to set + * @return the OperationMetricSpecification object itself. + */ + public OperationMetricSpecification withAvailabilities(List availabilities) { + this.availabilities = availabilities; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationServiceSpecification.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationServiceSpecification.java new file mode 100644 index 000000000000..c76a280fe0fc --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OperationServiceSpecification.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about a service operation. + */ +public class OperationServiceSpecification { + /** + * Details about operations related to logs. + */ + @JsonProperty(value = "logSpecifications") + private List logSpecifications; + + /** + * Details about operations related to metrics. + */ + @JsonProperty(value = "metricSpecifications") + private List metricSpecifications; + + /** + * Get details about operations related to logs. + * + * @return the logSpecifications value + */ + public List logSpecifications() { + return this.logSpecifications; + } + + /** + * Set details about operations related to logs. + * + * @param logSpecifications the logSpecifications value to set + * @return the OperationServiceSpecification object itself. + */ + public OperationServiceSpecification withLogSpecifications(List logSpecifications) { + this.logSpecifications = logSpecifications; + return this; + } + + /** + * Get details about operations related to metrics. + * + * @return the metricSpecifications value + */ + public List metricSpecifications() { + return this.metricSpecifications; + } + + /** + * Set details about operations related to metrics. + * + * @param metricSpecifications the metricSpecifications value to set + * @return the OperationServiceSpecification object itself. + */ + public OperationServiceSpecification withMetricSpecifications(List metricSpecifications) { + this.metricSpecifications = metricSpecifications; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Operations.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Operations.java new file mode 100644 index 000000000000..9a456cc018cb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists the available Azure Data Factory API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleLinkedService.java new file mode 100644 index 000000000000..73506b7e1078 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleLinkedService.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Oracle database. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Oracle") +@JsonFlatten +public class OracleLinkedService extends LinkedServiceInner { + /** + * The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString", required = true) + private Object connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the OracleLinkedService object itself. + */ + public OracleLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the OracleLinkedService object itself. + */ + public OracleLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleSink.java new file mode 100644 index 000000000000..5257a223371a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleSink.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Oracle sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("OracleSink") +public class OracleSink extends CopySink { + /** + * SQL pre-copy script. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "preCopyScript") + private Object preCopyScript; + + /** + * Get sQL pre-copy script. Type: string (or Expression with resultType string). + * + * @return the preCopyScript value + */ + public Object preCopyScript() { + return this.preCopyScript; + } + + /** + * Set sQL pre-copy script. Type: string (or Expression with resultType string). + * + * @param preCopyScript the preCopyScript value to set + * @return the OracleSink object itself. + */ + public OracleSink withPreCopyScript(Object preCopyScript) { + this.preCopyScript = preCopyScript; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleSource.java new file mode 100644 index 000000000000..6380ced71a7a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleSource.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Oracle source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("OracleSource") +public class OracleSource extends CopySource { + /** + * Oracle reader query. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "oracleReaderQuery") + private Object oracleReaderQuery; + + /** + * Query timeout. Type: string (or Expression with resultType string), + * pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + */ + @JsonProperty(value = "queryTimeout") + private Object queryTimeout; + + /** + * Get oracle reader query. Type: string (or Expression with resultType string). + * + * @return the oracleReaderQuery value + */ + public Object oracleReaderQuery() { + return this.oracleReaderQuery; + } + + /** + * Set oracle reader query. Type: string (or Expression with resultType string). + * + * @param oracleReaderQuery the oracleReaderQuery value to set + * @return the OracleSource object itself. + */ + public OracleSource withOracleReaderQuery(Object oracleReaderQuery) { + this.oracleReaderQuery = oracleReaderQuery; + return this; + } + + /** + * Get query timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @return the queryTimeout value + */ + public Object queryTimeout() { + return this.queryTimeout; + } + + /** + * Set query timeout. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @param queryTimeout the queryTimeout value to set + * @return the OracleSource object itself. + */ + public OracleSource withQueryTimeout(Object queryTimeout) { + this.queryTimeout = queryTimeout; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleTableDataset.java new file mode 100644 index 000000000000..45fdfd0f0b30 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OracleTableDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The on-premises Oracle database dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("OracleTable") +@JsonFlatten +public class OracleTableDataset extends DatasetInner { + /** + * The table name of the on-premises Oracle database. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.tableName", required = true) + private Object tableName; + + /** + * Get the table name of the on-premises Oracle database. Type: string (or Expression with resultType string). + * + * @return the tableName value + */ + public Object tableName() { + return this.tableName; + } + + /** + * Set the table name of the on-premises Oracle database. Type: string (or Expression with resultType string). + * + * @param tableName the tableName value to set + * @return the OracleTableDataset object itself. + */ + public OracleTableDataset withTableName(Object tableName) { + this.tableName = tableName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OrcFormat.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OrcFormat.java new file mode 100644 index 000000000000..ce4c0e8388ef --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/OrcFormat.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The data stored in Optimized Row Columnar (ORC) format. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("OrcFormat") +public class OrcFormat extends DatasetStorageFormat { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ParameterSpecification.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ParameterSpecification.java new file mode 100644 index 000000000000..d15bf0ecb16e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ParameterSpecification.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Definition of a single parameter for an entity. + */ +public class ParameterSpecification { + /** + * Parameter type. Possible values include: 'Object', 'String', 'Int', + * 'Float', 'Bool', 'Array', 'SecureString'. + */ + @JsonProperty(value = "type", required = true) + private ParameterType type; + + /** + * Default value of parameter. + */ + @JsonProperty(value = "defaultValue") + private Object defaultValue; + + /** + * Get parameter type. Possible values include: 'Object', 'String', 'Int', 'Float', 'Bool', 'Array', 'SecureString'. + * + * @return the type value + */ + public ParameterType type() { + return this.type; + } + + /** + * Set parameter type. Possible values include: 'Object', 'String', 'Int', 'Float', 'Bool', 'Array', 'SecureString'. + * + * @param type the type value to set + * @return the ParameterSpecification object itself. + */ + public ParameterSpecification withType(ParameterType type) { + this.type = type; + return this; + } + + /** + * Get default value of parameter. + * + * @return the defaultValue value + */ + public Object defaultValue() { + return this.defaultValue; + } + + /** + * Set default value of parameter. + * + * @param defaultValue the defaultValue value to set + * @return the ParameterSpecification object itself. + */ + public ParameterSpecification withDefaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ParameterType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ParameterType.java new file mode 100644 index 000000000000..9d0d46295b92 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ParameterType.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ParameterType. + */ +public final class ParameterType extends ExpandableStringEnum { + /** Static value Object for ParameterType. */ + public static final ParameterType OBJECT = fromString("Object"); + + /** Static value String for ParameterType. */ + public static final ParameterType STRING = fromString("String"); + + /** Static value Int for ParameterType. */ + public static final ParameterType INT = fromString("Int"); + + /** Static value Float for ParameterType. */ + public static final ParameterType FLOAT = fromString("Float"); + + /** Static value Bool for ParameterType. */ + public static final ParameterType BOOL = fromString("Bool"); + + /** Static value Array for ParameterType. */ + public static final ParameterType ARRAY = fromString("Array"); + + /** Static value SecureString for ParameterType. */ + public static final ParameterType SECURE_STRING = fromString("SecureString"); + + /** + * Creates or finds a ParameterType from its string representation. + * @param name a name to look for + * @return the corresponding ParameterType + */ + @JsonCreator + public static ParameterType fromString(String name) { + return fromString(name, ParameterType.class); + } + + /** + * @return known ParameterType values + */ + public static Collection values() { + return values(ParameterType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ParquetFormat.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ParquetFormat.java new file mode 100644 index 000000000000..afde3f764dc3 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ParquetFormat.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The data stored in Parquet format. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ParquetFormat") +public class ParquetFormat extends DatasetStorageFormat { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PaypalLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PaypalLinkedService.java new file mode 100644 index 000000000000..a9bbf319c446 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PaypalLinkedService.java @@ -0,0 +1,212 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Paypal Service linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Paypal") +@JsonFlatten +public class PaypalLinkedService extends LinkedServiceInner { + /** + * The URL of the PayPal instance. (i.e. api.sandbox.paypal.com). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The client ID associated with your PayPal application. + */ + @JsonProperty(value = "typeProperties.clientId", required = true) + private Object clientId; + + /** + * The client secret associated with your PayPal application. + */ + @JsonProperty(value = "typeProperties.clientSecret") + private SecretBase clientSecret; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the URL of the PayPal instance. (i.e. api.sandbox.paypal.com). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the URL of the PayPal instance. (i.e. api.sandbox.paypal.com). + * + * @param host the host value to set + * @return the PaypalLinkedService object itself. + */ + public PaypalLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the client ID associated with your PayPal application. + * + * @return the clientId value + */ + public Object clientId() { + return this.clientId; + } + + /** + * Set the client ID associated with your PayPal application. + * + * @param clientId the clientId value to set + * @return the PaypalLinkedService object itself. + */ + public PaypalLinkedService withClientId(Object clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the client secret associated with your PayPal application. + * + * @return the clientSecret value + */ + public SecretBase clientSecret() { + return this.clientSecret; + } + + /** + * Set the client secret associated with your PayPal application. + * + * @param clientSecret the clientSecret value to set + * @return the PaypalLinkedService object itself. + */ + public PaypalLinkedService withClientSecret(SecretBase clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the PaypalLinkedService object itself. + */ + public PaypalLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the PaypalLinkedService object itself. + */ + public PaypalLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the PaypalLinkedService object itself. + */ + public PaypalLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the PaypalLinkedService object itself. + */ + public PaypalLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PaypalObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PaypalObjectDataset.java new file mode 100644 index 000000000000..7ee5b4ce5436 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PaypalObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Paypal Service dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("PaypalObject") +public class PaypalObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PaypalSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PaypalSource.java new file mode 100644 index 000000000000..4e1a8380af94 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PaypalSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Paypal Service source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("PaypalSource") +public class PaypalSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the PaypalSource object itself. + */ + public PaypalSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixAuthenticationType.java new file mode 100644 index 000000000000..910b15074755 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixAuthenticationType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PhoenixAuthenticationType. + */ +public final class PhoenixAuthenticationType extends ExpandableStringEnum { + /** Static value Anonymous for PhoenixAuthenticationType. */ + public static final PhoenixAuthenticationType ANONYMOUS = fromString("Anonymous"); + + /** Static value UsernameAndPassword for PhoenixAuthenticationType. */ + public static final PhoenixAuthenticationType USERNAME_AND_PASSWORD = fromString("UsernameAndPassword"); + + /** Static value WindowsAzureHDInsightService for PhoenixAuthenticationType. */ + public static final PhoenixAuthenticationType WINDOWS_AZURE_HDINSIGHT_SERVICE = fromString("WindowsAzureHDInsightService"); + + /** + * Creates or finds a PhoenixAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding PhoenixAuthenticationType + */ + @JsonCreator + public static PhoenixAuthenticationType fromString(String name) { + return fromString(name, PhoenixAuthenticationType.class); + } + + /** + * @return known PhoenixAuthenticationType values + */ + public static Collection values() { + return values(PhoenixAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixLinkedService.java new file mode 100644 index 000000000000..a4a0c1c5f9f7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixLinkedService.java @@ -0,0 +1,352 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Phoenix server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Phoenix") +@JsonFlatten +public class PhoenixLinkedService extends LinkedServiceInner { + /** + * The IP address or host name of the Phoenix server. (i.e. + * 192.168.222.160). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The TCP port that the Phoenix server uses to listen for client + * connections. The default value is 8765. + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * The partial URL corresponding to the Phoenix server. (i.e. + * /gateway/sandbox/phoenix/version). The default value is hbasephoenix if + * using WindowsAzureHDInsightService. + */ + @JsonProperty(value = "typeProperties.httpPath") + private Object httpPath; + + /** + * The authentication mechanism used to connect to the Phoenix server. + * Possible values include: 'Anonymous', 'UsernameAndPassword', + * 'WindowsAzureHDInsightService'. + */ + @JsonProperty(value = "typeProperties.authenticationType", required = true) + private PhoenixAuthenticationType authenticationType; + + /** + * The user name used to connect to the Phoenix server. + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * The password corresponding to the user name. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * Specifies whether the connections to the server are encrypted using SSL. + * The default value is false. + */ + @JsonProperty(value = "typeProperties.enableSsl") + private Object enableSsl; + + /** + * The full path of the .pem file containing trusted CA certificates for + * verifying the server when connecting over SSL. This property can only be + * set when using SSL on self-hosted IR. The default value is the + * cacerts.pem file installed with the IR. + */ + @JsonProperty(value = "typeProperties.trustedCertPath") + private Object trustedCertPath; + + /** + * Specifies whether to use a CA certificate from the system trust store or + * from a specified PEM file. The default value is false. + */ + @JsonProperty(value = "typeProperties.useSystemTrustStore") + private Object useSystemTrustStore; + + /** + * Specifies whether to require a CA-issued SSL certificate name to match + * the host name of the server when connecting over SSL. The default value + * is false. + */ + @JsonProperty(value = "typeProperties.allowHostNameCNMismatch") + private Object allowHostNameCNMismatch; + + /** + * Specifies whether to allow self-signed certificates from the server. The + * default value is false. + */ + @JsonProperty(value = "typeProperties.allowSelfSignedServerCert") + private Object allowSelfSignedServerCert; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the IP address or host name of the Phoenix server. (i.e. 192.168.222.160). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the IP address or host name of the Phoenix server. (i.e. 192.168.222.160). + * + * @param host the host value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the TCP port that the Phoenix server uses to listen for client connections. The default value is 8765. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port that the Phoenix server uses to listen for client connections. The default value is 8765. + * + * @param port the port value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the partial URL corresponding to the Phoenix server. (i.e. /gateway/sandbox/phoenix/version). The default value is hbasephoenix if using WindowsAzureHDInsightService. + * + * @return the httpPath value + */ + public Object httpPath() { + return this.httpPath; + } + + /** + * Set the partial URL corresponding to the Phoenix server. (i.e. /gateway/sandbox/phoenix/version). The default value is hbasephoenix if using WindowsAzureHDInsightService. + * + * @param httpPath the httpPath value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withHttpPath(Object httpPath) { + this.httpPath = httpPath; + return this; + } + + /** + * Get the authentication mechanism used to connect to the Phoenix server. Possible values include: 'Anonymous', 'UsernameAndPassword', 'WindowsAzureHDInsightService'. + * + * @return the authenticationType value + */ + public PhoenixAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication mechanism used to connect to the Phoenix server. Possible values include: 'Anonymous', 'UsernameAndPassword', 'WindowsAzureHDInsightService'. + * + * @param authenticationType the authenticationType value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withAuthenticationType(PhoenixAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the user name used to connect to the Phoenix server. + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the user name used to connect to the Phoenix server. + * + * @param username the username value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password corresponding to the user name. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password corresponding to the user name. + * + * @param password the password value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @return the enableSsl value + */ + public Object enableSsl() { + return this.enableSsl; + } + + /** + * Set specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @param enableSsl the enableSsl value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withEnableSsl(Object enableSsl) { + this.enableSsl = enableSsl; + return this; + } + + /** + * Get the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @return the trustedCertPath value + */ + public Object trustedCertPath() { + return this.trustedCertPath; + } + + /** + * Set the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @param trustedCertPath the trustedCertPath value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withTrustedCertPath(Object trustedCertPath) { + this.trustedCertPath = trustedCertPath; + return this; + } + + /** + * Get specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @return the useSystemTrustStore value + */ + public Object useSystemTrustStore() { + return this.useSystemTrustStore; + } + + /** + * Set specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @param useSystemTrustStore the useSystemTrustStore value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withUseSystemTrustStore(Object useSystemTrustStore) { + this.useSystemTrustStore = useSystemTrustStore; + return this; + } + + /** + * Get specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @return the allowHostNameCNMismatch value + */ + public Object allowHostNameCNMismatch() { + return this.allowHostNameCNMismatch; + } + + /** + * Set specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @param allowHostNameCNMismatch the allowHostNameCNMismatch value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withAllowHostNameCNMismatch(Object allowHostNameCNMismatch) { + this.allowHostNameCNMismatch = allowHostNameCNMismatch; + return this; + } + + /** + * Get specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @return the allowSelfSignedServerCert value + */ + public Object allowSelfSignedServerCert() { + return this.allowSelfSignedServerCert; + } + + /** + * Set specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @param allowSelfSignedServerCert the allowSelfSignedServerCert value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedServerCert) { + this.allowSelfSignedServerCert = allowSelfSignedServerCert; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the PhoenixLinkedService object itself. + */ + public PhoenixLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixObjectDataset.java new file mode 100644 index 000000000000..0006100a7879 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Phoenix server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("PhoenixObject") +public class PhoenixObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixSource.java new file mode 100644 index 000000000000..0578bd4fd517 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PhoenixSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Phoenix server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("PhoenixSource") +public class PhoenixSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the PhoenixSource object itself. + */ + public PhoenixSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineReference.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineReference.java new file mode 100644 index 000000000000..3a8da61c76f1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineReference.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Pipeline reference type. + */ +public class PipelineReference { + /** + * Pipeline reference type. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Reference pipeline name. + */ + @JsonProperty(value = "referenceName", required = true) + private String referenceName; + + /** + * Reference name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Creates an instance of PipelineReference class. + * @param referenceName reference pipeline name. + */ + public PipelineReference() { + type = "PipelineReference"; + } + + /** + * Get pipeline reference type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set pipeline reference type. + * + * @param type the type value to set + * @return the PipelineReference object itself. + */ + public PipelineReference withType(String type) { + this.type = type; + return this; + } + + /** + * Get reference pipeline name. + * + * @return the referenceName value + */ + public String referenceName() { + return this.referenceName; + } + + /** + * Set reference pipeline name. + * + * @param referenceName the referenceName value to set + * @return the PipelineReference object itself. + */ + public PipelineReference withReferenceName(String referenceName) { + this.referenceName = referenceName; + return this; + } + + /** + * Get reference name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set reference name. + * + * @param name the name value to set + * @return the PipelineReference object itself. + */ + public PipelineReference withName(String name) { + this.name = name; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineResource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineResource.java new file mode 100644 index 000000000000..4a9d1a5c8627 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineResource.java @@ -0,0 +1,293 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.PipelineResourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import java.util.Map; +import java.util.List; + +/** + * Type representing PipelineResource. + */ +public interface PipelineResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the activities value. + */ + List activities(); + + /** + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * @return the annotations value. + */ + List annotations(); + + /** + * @return the concurrency value. + */ + Integer concurrency(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parameters value. + */ + Map parameters(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PipelineResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithFactory, DefinitionStages.WithIfMatch, DefinitionStages.WithCreate { + } + + /** + * Grouping of PipelineResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PipelineResource definition. + */ + interface Blank extends WithFactory { + } + + /** + * The stage of the pipelineresource definition allowing to specify Factory. + */ + interface WithFactory { + /** + * Specifies resourceGroupName, factoryName. + * @param resourceGroupName The resource group name + * @param factoryName The factory name + * @return the next definition stage + */ + WithIfMatch withExistingFactory(String resourceGroupName, String factoryName); + } + + /** + * The stage of the pipelineresource definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the pipeline entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update + * @return the next definition stage + */ + WithCreate withIfMatch(String ifMatch); + } + + /** + * The stage of the pipelineresource definition allowing to specify Activities. + */ + interface WithActivities { + /** + * Specifies activities. + * @param activities List of activities in pipeline + * @return the next definition stage + */ + WithCreate withActivities(List activities); + } + + /** + * The stage of the pipelineresource definition allowing to specify AdditionalProperties. + */ + interface WithAdditionalProperties { + /** + * Specifies additionalProperties. + * @param additionalProperties Unmatched properties from the message are deserialized this collection + * @return the next definition stage + */ + WithCreate withAdditionalProperties(Map additionalProperties); + } + + /** + * The stage of the pipelineresource definition allowing to specify Annotations. + */ + interface WithAnnotations { + /** + * Specifies annotations. + * @param annotations List of tags that can be used for describing the Pipeline + * @return the next definition stage + */ + WithCreate withAnnotations(List annotations); + } + + /** + * The stage of the pipelineresource definition allowing to specify Concurrency. + */ + interface WithConcurrency { + /** + * Specifies concurrency. + * @param concurrency The max number of concurrent runs for the pipeline + * @return the next definition stage + */ + WithCreate withConcurrency(Integer concurrency); + } + + /** + * The stage of the pipelineresource definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The description of the pipeline + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the pipelineresource definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters List of parameters for pipeline + * @return the next definition stage + */ + WithCreate withParameters(Map parameters); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithActivities, DefinitionStages.WithAdditionalProperties, DefinitionStages.WithAnnotations, DefinitionStages.WithConcurrency, DefinitionStages.WithDescription, DefinitionStages.WithParameters { + } + } + /** + * The template for a PipelineResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithActivities, UpdateStages.WithAdditionalProperties, UpdateStages.WithAnnotations, UpdateStages.WithConcurrency, UpdateStages.WithDescription, UpdateStages.WithParameters { + } + + /** + * Grouping of PipelineResource update stages. + */ + interface UpdateStages { + /** + * The stage of the pipelineresource update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the pipeline entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the pipelineresource update allowing to specify Activities. + */ + interface WithActivities { + /** + * Specifies activities. + * @param activities List of activities in pipeline + * @return the next update stage + */ + Update withActivities(List activities); + } + + /** + * The stage of the pipelineresource update allowing to specify AdditionalProperties. + */ + interface WithAdditionalProperties { + /** + * Specifies additionalProperties. + * @param additionalProperties Unmatched properties from the message are deserialized this collection + * @return the next update stage + */ + Update withAdditionalProperties(Map additionalProperties); + } + + /** + * The stage of the pipelineresource update allowing to specify Annotations. + */ + interface WithAnnotations { + /** + * Specifies annotations. + * @param annotations List of tags that can be used for describing the Pipeline + * @return the next update stage + */ + Update withAnnotations(List annotations); + } + + /** + * The stage of the pipelineresource update allowing to specify Concurrency. + */ + interface WithConcurrency { + /** + * Specifies concurrency. + * @param concurrency The max number of concurrent runs for the pipeline + * @return the next update stage + */ + Update withConcurrency(Integer concurrency); + } + + /** + * The stage of the pipelineresource update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The description of the pipeline + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the pipelineresource update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters List of parameters for pipeline + * @return the next update stage + */ + Update withParameters(Map parameters); + } + + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRun.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRun.java new file mode 100644 index 000000000000..4ac78eda66e7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRun.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.PipelineRunInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing PipelineRun. + */ +public interface PipelineRun extends HasInner, HasManager { + /** + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * @return the durationInMs value. + */ + Integer durationInMs(); + + /** + * @return the invokedBy value. + */ + PipelineRunInvokedBy invokedBy(); + + /** + * @return the lastUpdated value. + */ + DateTime lastUpdated(); + + /** + * @return the message value. + */ + String message(); + + /** + * @return the parameters value. + */ + Map parameters(); + + /** + * @return the pipelineName value. + */ + String pipelineName(); + + /** + * @return the runEnd value. + */ + DateTime runEnd(); + + /** + * @return the runId value. + */ + String runId(); + + /** + * @return the runStart value. + */ + DateTime runStart(); + + /** + * @return the status value. + */ + String status(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunFilterParameters.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunFilterParameters.java new file mode 100644 index 000000000000..c04b844926a6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunFilterParameters.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Query parameters for listing pipeline runs. + */ +public class PipelineRunFilterParameters { + /** + * The continuation token for getting the next page of results. Null for + * first page. + */ + @JsonProperty(value = "continuationToken") + private String continuationToken; + + /** + * The time at or after which the pipeline run event was updated in 'ISO + * 8601' format. + */ + @JsonProperty(value = "lastUpdatedAfter", required = true) + private DateTime lastUpdatedAfter; + + /** + * The time at or before which the pipeline run event was updated in 'ISO + * 8601' format. + */ + @JsonProperty(value = "lastUpdatedBefore", required = true) + private DateTime lastUpdatedBefore; + + /** + * List of filters. + */ + @JsonProperty(value = "filters") + private List filters; + + /** + * List of OrderBy option. + */ + @JsonProperty(value = "orderBy") + private List orderBy; + + /** + * Get the continuation token for getting the next page of results. Null for first page. + * + * @return the continuationToken value + */ + public String continuationToken() { + return this.continuationToken; + } + + /** + * Set the continuation token for getting the next page of results. Null for first page. + * + * @param continuationToken the continuationToken value to set + * @return the PipelineRunFilterParameters object itself. + */ + public PipelineRunFilterParameters withContinuationToken(String continuationToken) { + this.continuationToken = continuationToken; + return this; + } + + /** + * Get the time at or after which the pipeline run event was updated in 'ISO 8601' format. + * + * @return the lastUpdatedAfter value + */ + public DateTime lastUpdatedAfter() { + return this.lastUpdatedAfter; + } + + /** + * Set the time at or after which the pipeline run event was updated in 'ISO 8601' format. + * + * @param lastUpdatedAfter the lastUpdatedAfter value to set + * @return the PipelineRunFilterParameters object itself. + */ + public PipelineRunFilterParameters withLastUpdatedAfter(DateTime lastUpdatedAfter) { + this.lastUpdatedAfter = lastUpdatedAfter; + return this; + } + + /** + * Get the time at or before which the pipeline run event was updated in 'ISO 8601' format. + * + * @return the lastUpdatedBefore value + */ + public DateTime lastUpdatedBefore() { + return this.lastUpdatedBefore; + } + + /** + * Set the time at or before which the pipeline run event was updated in 'ISO 8601' format. + * + * @param lastUpdatedBefore the lastUpdatedBefore value to set + * @return the PipelineRunFilterParameters object itself. + */ + public PipelineRunFilterParameters withLastUpdatedBefore(DateTime lastUpdatedBefore) { + this.lastUpdatedBefore = lastUpdatedBefore; + return this; + } + + /** + * Get list of filters. + * + * @return the filters value + */ + public List filters() { + return this.filters; + } + + /** + * Set list of filters. + * + * @param filters the filters value to set + * @return the PipelineRunFilterParameters object itself. + */ + public PipelineRunFilterParameters withFilters(List filters) { + this.filters = filters; + return this; + } + + /** + * Get list of OrderBy option. + * + * @return the orderBy value + */ + public List orderBy() { + return this.orderBy; + } + + /** + * Set list of OrderBy option. + * + * @param orderBy the orderBy value to set + * @return the PipelineRunFilterParameters object itself. + */ + public PipelineRunFilterParameters withOrderBy(List orderBy) { + this.orderBy = orderBy; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunInvokedBy.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunInvokedBy.java new file mode 100644 index 000000000000..746e0f07baaf --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunInvokedBy.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Provides entity name and id that started the pipeline run. + */ +public class PipelineRunInvokedBy { + /** + * Name of the entity that started the pipeline run. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The ID of the entity that started the run. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get name of the entity that started the pipeline run. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the ID of the entity that started the run. + * + * @return the id value + */ + public String id() { + return this.id; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryFilter.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryFilter.java new file mode 100644 index 000000000000..e0007fe5915b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryFilter.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Query filter option for listing pipeline runs. + */ +public class PipelineRunQueryFilter { + /** + * Parameter name to be used for filter. Possible values include: + * 'PipelineName', 'Status', 'RunStart', 'RunEnd'. + */ + @JsonProperty(value = "operand", required = true) + private PipelineRunQueryFilterOperand operand; + + /** + * Operator to be used for filter. Possible values include: 'Equals', + * 'NotEquals', 'In', 'NotIn'. + */ + @JsonProperty(value = "operator", required = true) + private PipelineRunQueryFilterOperator operator; + + /** + * List of filter values. + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * Get parameter name to be used for filter. Possible values include: 'PipelineName', 'Status', 'RunStart', 'RunEnd'. + * + * @return the operand value + */ + public PipelineRunQueryFilterOperand operand() { + return this.operand; + } + + /** + * Set parameter name to be used for filter. Possible values include: 'PipelineName', 'Status', 'RunStart', 'RunEnd'. + * + * @param operand the operand value to set + * @return the PipelineRunQueryFilter object itself. + */ + public PipelineRunQueryFilter withOperand(PipelineRunQueryFilterOperand operand) { + this.operand = operand; + return this; + } + + /** + * Get operator to be used for filter. Possible values include: 'Equals', 'NotEquals', 'In', 'NotIn'. + * + * @return the operator value + */ + public PipelineRunQueryFilterOperator operator() { + return this.operator; + } + + /** + * Set operator to be used for filter. Possible values include: 'Equals', 'NotEquals', 'In', 'NotIn'. + * + * @param operator the operator value to set + * @return the PipelineRunQueryFilter object itself. + */ + public PipelineRunQueryFilter withOperator(PipelineRunQueryFilterOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get list of filter values. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set list of filter values. + * + * @param values the values value to set + * @return the PipelineRunQueryFilter object itself. + */ + public PipelineRunQueryFilter withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryFilterOperand.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryFilterOperand.java new file mode 100644 index 000000000000..ee9a96a4694c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryFilterOperand.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PipelineRunQueryFilterOperand. + */ +public final class PipelineRunQueryFilterOperand extends ExpandableStringEnum { + /** Static value PipelineName for PipelineRunQueryFilterOperand. */ + public static final PipelineRunQueryFilterOperand PIPELINE_NAME = fromString("PipelineName"); + + /** Static value Status for PipelineRunQueryFilterOperand. */ + public static final PipelineRunQueryFilterOperand STATUS = fromString("Status"); + + /** Static value RunStart for PipelineRunQueryFilterOperand. */ + public static final PipelineRunQueryFilterOperand RUN_START = fromString("RunStart"); + + /** Static value RunEnd for PipelineRunQueryFilterOperand. */ + public static final PipelineRunQueryFilterOperand RUN_END = fromString("RunEnd"); + + /** + * Creates or finds a PipelineRunQueryFilterOperand from its string representation. + * @param name a name to look for + * @return the corresponding PipelineRunQueryFilterOperand + */ + @JsonCreator + public static PipelineRunQueryFilterOperand fromString(String name) { + return fromString(name, PipelineRunQueryFilterOperand.class); + } + + /** + * @return known PipelineRunQueryFilterOperand values + */ + public static Collection values() { + return values(PipelineRunQueryFilterOperand.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryFilterOperator.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryFilterOperator.java new file mode 100644 index 000000000000..af713a8d8c32 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryFilterOperator.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PipelineRunQueryFilterOperator. + */ +public final class PipelineRunQueryFilterOperator extends ExpandableStringEnum { + /** Static value Equals for PipelineRunQueryFilterOperator. */ + public static final PipelineRunQueryFilterOperator EQUALS = fromString("Equals"); + + /** Static value NotEquals for PipelineRunQueryFilterOperator. */ + public static final PipelineRunQueryFilterOperator NOT_EQUALS = fromString("NotEquals"); + + /** Static value In for PipelineRunQueryFilterOperator. */ + public static final PipelineRunQueryFilterOperator IN = fromString("In"); + + /** Static value NotIn for PipelineRunQueryFilterOperator. */ + public static final PipelineRunQueryFilterOperator NOT_IN = fromString("NotIn"); + + /** + * Creates or finds a PipelineRunQueryFilterOperator from its string representation. + * @param name a name to look for + * @return the corresponding PipelineRunQueryFilterOperator + */ + @JsonCreator + public static PipelineRunQueryFilterOperator fromString(String name) { + return fromString(name, PipelineRunQueryFilterOperator.class); + } + + /** + * @return known PipelineRunQueryFilterOperator values + */ + public static Collection values() { + return values(PipelineRunQueryFilterOperator.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryOrder.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryOrder.java new file mode 100644 index 000000000000..50588bce5412 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryOrder.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PipelineRunQueryOrder. + */ +public final class PipelineRunQueryOrder extends ExpandableStringEnum { + /** Static value ASC for PipelineRunQueryOrder. */ + public static final PipelineRunQueryOrder ASC = fromString("ASC"); + + /** Static value DESC for PipelineRunQueryOrder. */ + public static final PipelineRunQueryOrder DESC = fromString("DESC"); + + /** + * Creates or finds a PipelineRunQueryOrder from its string representation. + * @param name a name to look for + * @return the corresponding PipelineRunQueryOrder + */ + @JsonCreator + public static PipelineRunQueryOrder fromString(String name) { + return fromString(name, PipelineRunQueryOrder.class); + } + + /** + * @return known PipelineRunQueryOrder values + */ + public static Collection values() { + return values(PipelineRunQueryOrder.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryOrderBy.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryOrderBy.java new file mode 100644 index 000000000000..d84c8b8a3396 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryOrderBy.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object to provide order by options for listing pipeline runs. + */ +public class PipelineRunQueryOrderBy { + /** + * Parameter name to be used for order by. Possible values include: + * 'RunStart', 'RunEnd'. + */ + @JsonProperty(value = "orderBy", required = true) + private PipelineRunQueryOrderByField orderBy; + + /** + * Sorting order of the parameter. Possible values include: 'ASC', 'DESC'. + */ + @JsonProperty(value = "order", required = true) + private PipelineRunQueryOrder order; + + /** + * Get parameter name to be used for order by. Possible values include: 'RunStart', 'RunEnd'. + * + * @return the orderBy value + */ + public PipelineRunQueryOrderByField orderBy() { + return this.orderBy; + } + + /** + * Set parameter name to be used for order by. Possible values include: 'RunStart', 'RunEnd'. + * + * @param orderBy the orderBy value to set + * @return the PipelineRunQueryOrderBy object itself. + */ + public PipelineRunQueryOrderBy withOrderBy(PipelineRunQueryOrderByField orderBy) { + this.orderBy = orderBy; + return this; + } + + /** + * Get sorting order of the parameter. Possible values include: 'ASC', 'DESC'. + * + * @return the order value + */ + public PipelineRunQueryOrder order() { + return this.order; + } + + /** + * Set sorting order of the parameter. Possible values include: 'ASC', 'DESC'. + * + * @param order the order value to set + * @return the PipelineRunQueryOrderBy object itself. + */ + public PipelineRunQueryOrderBy withOrder(PipelineRunQueryOrder order) { + this.order = order; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryOrderByField.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryOrderByField.java new file mode 100644 index 000000000000..af1bec151e2a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryOrderByField.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PipelineRunQueryOrderByField. + */ +public final class PipelineRunQueryOrderByField extends ExpandableStringEnum { + /** Static value RunStart for PipelineRunQueryOrderByField. */ + public static final PipelineRunQueryOrderByField RUN_START = fromString("RunStart"); + + /** Static value RunEnd for PipelineRunQueryOrderByField. */ + public static final PipelineRunQueryOrderByField RUN_END = fromString("RunEnd"); + + /** + * Creates or finds a PipelineRunQueryOrderByField from its string representation. + * @param name a name to look for + * @return the corresponding PipelineRunQueryOrderByField + */ + @JsonCreator + public static PipelineRunQueryOrderByField fromString(String name) { + return fromString(name, PipelineRunQueryOrderByField.class); + } + + /** + * @return known PipelineRunQueryOrderByField values + */ + public static Collection values() { + return values(PipelineRunQueryOrderByField.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryResponse.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryResponse.java new file mode 100644 index 000000000000..6a6908e7946b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRunQueryResponse.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.PipelineRunQueryResponseInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.PipelineRunInner; +import java.util.List; + +/** + * Type representing PipelineRunQueryResponse. + */ +public interface PipelineRunQueryResponse extends HasInner, HasManager { + /** + * @return the continuationToken value. + */ + String continuationToken(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRuns.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRuns.java new file mode 100644 index 000000000000..5aa234f89c51 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PipelineRuns.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.PipelineRunsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PipelineRuns. + */ +public interface PipelineRuns extends HasInner { + /** + * Get a pipeline run by its run ID. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String factoryName, String runId); + + /** + * Query pipeline runs in the factory based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param filterParameters Parameters to filter the pipeline run. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable queryByFactoryAsync(String resourceGroupName, String factoryName, PipelineRunFilterParameters filterParameters); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Pipelines.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Pipelines.java new file mode 100644 index 000000000000..f08ceacad2eb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Pipelines.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.PipelinesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Pipelines. + */ +public interface Pipelines extends SupportsCreating, HasInner { + /** + * Creates a run of a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createRunAsync(String resourceGroupName, String factoryName, String pipelineName); + + /** + * Gets a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String factoryName, String pipelineName); + + /** + * Lists pipelines. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByFactoryAsync(final String resourceGroupName, final String factoryName); + + /** + * Deletes a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String factoryName, String pipelineName); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PolybaseSettings.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PolybaseSettings.java new file mode 100644 index 000000000000..1596e04b134a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PolybaseSettings.java @@ -0,0 +1,154 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PolyBase settings. + */ +public class PolybaseSettings { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Reject type. + */ + @JsonProperty(value = "rejectType") + private Object rejectType; + + /** + * Specifies the value or the percentage of rows that can be rejected + * before the query fails. Type: number (or Expression with resultType + * number), minimum: 0. + */ + @JsonProperty(value = "rejectValue") + private Object rejectValue; + + /** + * Determines the number of rows to attempt to retrieve before the PolyBase + * recalculates the percentage of rejected rows. Type: integer (or + * Expression with resultType integer), minimum: 0. + */ + @JsonProperty(value = "rejectSampleValue") + private Object rejectSampleValue; + + /** + * Specifies how to handle missing values in delimited text files when + * PolyBase retrieves data from the text file. Type: boolean (or Expression + * with resultType boolean). + */ + @JsonProperty(value = "useTypeDefault") + private Object useTypeDefault; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the PolybaseSettings object itself. + */ + public PolybaseSettings withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get reject type. + * + * @return the rejectType value + */ + public Object rejectType() { + return this.rejectType; + } + + /** + * Set reject type. + * + * @param rejectType the rejectType value to set + * @return the PolybaseSettings object itself. + */ + public PolybaseSettings withRejectType(Object rejectType) { + this.rejectType = rejectType; + return this; + } + + /** + * Get specifies the value or the percentage of rows that can be rejected before the query fails. Type: number (or Expression with resultType number), minimum: 0. + * + * @return the rejectValue value + */ + public Object rejectValue() { + return this.rejectValue; + } + + /** + * Set specifies the value or the percentage of rows that can be rejected before the query fails. Type: number (or Expression with resultType number), minimum: 0. + * + * @param rejectValue the rejectValue value to set + * @return the PolybaseSettings object itself. + */ + public PolybaseSettings withRejectValue(Object rejectValue) { + this.rejectValue = rejectValue; + return this; + } + + /** + * Get determines the number of rows to attempt to retrieve before the PolyBase recalculates the percentage of rejected rows. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the rejectSampleValue value + */ + public Object rejectSampleValue() { + return this.rejectSampleValue; + } + + /** + * Set determines the number of rows to attempt to retrieve before the PolyBase recalculates the percentage of rejected rows. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param rejectSampleValue the rejectSampleValue value to set + * @return the PolybaseSettings object itself. + */ + public PolybaseSettings withRejectSampleValue(Object rejectSampleValue) { + this.rejectSampleValue = rejectSampleValue; + return this; + } + + /** + * Get specifies how to handle missing values in delimited text files when PolyBase retrieves data from the text file. Type: boolean (or Expression with resultType boolean). + * + * @return the useTypeDefault value + */ + public Object useTypeDefault() { + return this.useTypeDefault; + } + + /** + * Set specifies how to handle missing values in delimited text files when PolyBase retrieves data from the text file. Type: boolean (or Expression with resultType boolean). + * + * @param useTypeDefault the useTypeDefault value to set + * @return the PolybaseSettings object itself. + */ + public PolybaseSettings withUseTypeDefault(Object useTypeDefault) { + this.useTypeDefault = useTypeDefault; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PostgreSqlLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PostgreSqlLinkedService.java new file mode 100644 index 000000000000..bac655e46c64 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PostgreSqlLinkedService.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for PostgreSQL data source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("PostgreSql") +@JsonFlatten +public class PostgreSqlLinkedService extends LinkedServiceInner { + /** + * The connection string. + */ + @JsonProperty(value = "typeProperties.connectionString", required = true) + private SecretBase connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the connection string. + * + * @return the connectionString value + */ + public SecretBase connectionString() { + return this.connectionString; + } + + /** + * Set the connection string. + * + * @param connectionString the connectionString value to set + * @return the PostgreSqlLinkedService object itself. + */ + public PostgreSqlLinkedService withConnectionString(SecretBase connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the PostgreSqlLinkedService object itself. + */ + public PostgreSqlLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoAuthenticationType.java new file mode 100644 index 000000000000..701d1cce296b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PrestoAuthenticationType. + */ +public final class PrestoAuthenticationType extends ExpandableStringEnum { + /** Static value Anonymous for PrestoAuthenticationType. */ + public static final PrestoAuthenticationType ANONYMOUS = fromString("Anonymous"); + + /** Static value LDAP for PrestoAuthenticationType. */ + public static final PrestoAuthenticationType LDAP = fromString("LDAP"); + + /** + * Creates or finds a PrestoAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding PrestoAuthenticationType + */ + @JsonCreator + public static PrestoAuthenticationType fromString(String name) { + return fromString(name, PrestoAuthenticationType.class); + } + + /** + * @return known PrestoAuthenticationType values + */ + public static Collection values() { + return values(PrestoAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoLinkedService.java new file mode 100644 index 000000000000..15e8b7cf40ce --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoLinkedService.java @@ -0,0 +1,403 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Presto server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Presto") +@JsonFlatten +public class PrestoLinkedService extends LinkedServiceInner { + /** + * The IP address or host name of the Presto server. (i.e. + * 192.168.222.160). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The version of the Presto server. (i.e. 0.148-t). + */ + @JsonProperty(value = "typeProperties.serverVersion", required = true) + private Object serverVersion; + + /** + * The catalog context for all request against the server. + */ + @JsonProperty(value = "typeProperties.catalog", required = true) + private Object catalog; + + /** + * The TCP port that the Presto server uses to listen for client + * connections. The default value is 8080. + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * The authentication mechanism used to connect to the Presto server. + * Possible values include: 'Anonymous', 'LDAP'. + */ + @JsonProperty(value = "typeProperties.authenticationType", required = true) + private PrestoAuthenticationType authenticationType; + + /** + * The user name used to connect to the Presto server. + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * The password corresponding to the user name. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * Specifies whether the connections to the server are encrypted using SSL. + * The default value is false. + */ + @JsonProperty(value = "typeProperties.enableSsl") + private Object enableSsl; + + /** + * The full path of the .pem file containing trusted CA certificates for + * verifying the server when connecting over SSL. This property can only be + * set when using SSL on self-hosted IR. The default value is the + * cacerts.pem file installed with the IR. + */ + @JsonProperty(value = "typeProperties.trustedCertPath") + private Object trustedCertPath; + + /** + * Specifies whether to use a CA certificate from the system trust store or + * from a specified PEM file. The default value is false. + */ + @JsonProperty(value = "typeProperties.useSystemTrustStore") + private Object useSystemTrustStore; + + /** + * Specifies whether to require a CA-issued SSL certificate name to match + * the host name of the server when connecting over SSL. The default value + * is false. + */ + @JsonProperty(value = "typeProperties.allowHostNameCNMismatch") + private Object allowHostNameCNMismatch; + + /** + * Specifies whether to allow self-signed certificates from the server. The + * default value is false. + */ + @JsonProperty(value = "typeProperties.allowSelfSignedServerCert") + private Object allowSelfSignedServerCert; + + /** + * The local time zone used by the connection. Valid values for this option + * are specified in the IANA Time Zone Database. The default value is the + * system time zone. + */ + @JsonProperty(value = "typeProperties.timeZoneID") + private Object timeZoneID; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the IP address or host name of the Presto server. (i.e. 192.168.222.160). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the IP address or host name of the Presto server. (i.e. 192.168.222.160). + * + * @param host the host value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the version of the Presto server. (i.e. 0.148-t). + * + * @return the serverVersion value + */ + public Object serverVersion() { + return this.serverVersion; + } + + /** + * Set the version of the Presto server. (i.e. 0.148-t). + * + * @param serverVersion the serverVersion value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withServerVersion(Object serverVersion) { + this.serverVersion = serverVersion; + return this; + } + + /** + * Get the catalog context for all request against the server. + * + * @return the catalog value + */ + public Object catalog() { + return this.catalog; + } + + /** + * Set the catalog context for all request against the server. + * + * @param catalog the catalog value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withCatalog(Object catalog) { + this.catalog = catalog; + return this; + } + + /** + * Get the TCP port that the Presto server uses to listen for client connections. The default value is 8080. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port that the Presto server uses to listen for client connections. The default value is 8080. + * + * @param port the port value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the authentication mechanism used to connect to the Presto server. Possible values include: 'Anonymous', 'LDAP'. + * + * @return the authenticationType value + */ + public PrestoAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication mechanism used to connect to the Presto server. Possible values include: 'Anonymous', 'LDAP'. + * + * @param authenticationType the authenticationType value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withAuthenticationType(PrestoAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the user name used to connect to the Presto server. + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the user name used to connect to the Presto server. + * + * @param username the username value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password corresponding to the user name. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password corresponding to the user name. + * + * @param password the password value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @return the enableSsl value + */ + public Object enableSsl() { + return this.enableSsl; + } + + /** + * Set specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @param enableSsl the enableSsl value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withEnableSsl(Object enableSsl) { + this.enableSsl = enableSsl; + return this; + } + + /** + * Get the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @return the trustedCertPath value + */ + public Object trustedCertPath() { + return this.trustedCertPath; + } + + /** + * Set the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @param trustedCertPath the trustedCertPath value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withTrustedCertPath(Object trustedCertPath) { + this.trustedCertPath = trustedCertPath; + return this; + } + + /** + * Get specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @return the useSystemTrustStore value + */ + public Object useSystemTrustStore() { + return this.useSystemTrustStore; + } + + /** + * Set specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @param useSystemTrustStore the useSystemTrustStore value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withUseSystemTrustStore(Object useSystemTrustStore) { + this.useSystemTrustStore = useSystemTrustStore; + return this; + } + + /** + * Get specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @return the allowHostNameCNMismatch value + */ + public Object allowHostNameCNMismatch() { + return this.allowHostNameCNMismatch; + } + + /** + * Set specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @param allowHostNameCNMismatch the allowHostNameCNMismatch value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withAllowHostNameCNMismatch(Object allowHostNameCNMismatch) { + this.allowHostNameCNMismatch = allowHostNameCNMismatch; + return this; + } + + /** + * Get specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @return the allowSelfSignedServerCert value + */ + public Object allowSelfSignedServerCert() { + return this.allowSelfSignedServerCert; + } + + /** + * Set specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @param allowSelfSignedServerCert the allowSelfSignedServerCert value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedServerCert) { + this.allowSelfSignedServerCert = allowSelfSignedServerCert; + return this; + } + + /** + * Get the local time zone used by the connection. Valid values for this option are specified in the IANA Time Zone Database. The default value is the system time zone. + * + * @return the timeZoneID value + */ + public Object timeZoneID() { + return this.timeZoneID; + } + + /** + * Set the local time zone used by the connection. Valid values for this option are specified in the IANA Time Zone Database. The default value is the system time zone. + * + * @param timeZoneID the timeZoneID value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withTimeZoneID(Object timeZoneID) { + this.timeZoneID = timeZoneID; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the PrestoLinkedService object itself. + */ + public PrestoLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoObjectDataset.java new file mode 100644 index 000000000000..4a426e7b2294 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Presto server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("PrestoObject") +public class PrestoObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoSource.java new file mode 100644 index 000000000000..3a4b558cded8 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/PrestoSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Presto server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("PrestoSource") +public class PrestoSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the PrestoSource object itself. + */ + public PrestoSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/QuickBooksLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/QuickBooksLinkedService.java new file mode 100644 index 000000000000..778f7d7c24bb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/QuickBooksLinkedService.java @@ -0,0 +1,235 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * QuickBooks server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("QuickBooks") +@JsonFlatten +public class QuickBooksLinkedService extends LinkedServiceInner { + /** + * The endpoint of the QuickBooks server. (i.e. quickbooks.api.intuit.com). + */ + @JsonProperty(value = "typeProperties.endpoint", required = true) + private Object endpoint; + + /** + * The company ID of the QuickBooks company to authorize. + */ + @JsonProperty(value = "typeProperties.companyId", required = true) + private Object companyId; + + /** + * The consumer key for OAuth 1.0 authentication. + */ + @JsonProperty(value = "typeProperties.consumerKey", required = true) + private Object consumerKey; + + /** + * The consumer secret for OAuth 1.0 authentication. + */ + @JsonProperty(value = "typeProperties.consumerSecret", required = true) + private SecretBase consumerSecret; + + /** + * The access token for OAuth 1.0 authentication. + */ + @JsonProperty(value = "typeProperties.accessToken", required = true) + private SecretBase accessToken; + + /** + * The access token secret for OAuth 1.0 authentication. + */ + @JsonProperty(value = "typeProperties.accessTokenSecret", required = true) + private SecretBase accessTokenSecret; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the endpoint of the QuickBooks server. (i.e. quickbooks.api.intuit.com). + * + * @return the endpoint value + */ + public Object endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint of the QuickBooks server. (i.e. quickbooks.api.intuit.com). + * + * @param endpoint the endpoint value to set + * @return the QuickBooksLinkedService object itself. + */ + public QuickBooksLinkedService withEndpoint(Object endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Get the company ID of the QuickBooks company to authorize. + * + * @return the companyId value + */ + public Object companyId() { + return this.companyId; + } + + /** + * Set the company ID of the QuickBooks company to authorize. + * + * @param companyId the companyId value to set + * @return the QuickBooksLinkedService object itself. + */ + public QuickBooksLinkedService withCompanyId(Object companyId) { + this.companyId = companyId; + return this; + } + + /** + * Get the consumer key for OAuth 1.0 authentication. + * + * @return the consumerKey value + */ + public Object consumerKey() { + return this.consumerKey; + } + + /** + * Set the consumer key for OAuth 1.0 authentication. + * + * @param consumerKey the consumerKey value to set + * @return the QuickBooksLinkedService object itself. + */ + public QuickBooksLinkedService withConsumerKey(Object consumerKey) { + this.consumerKey = consumerKey; + return this; + } + + /** + * Get the consumer secret for OAuth 1.0 authentication. + * + * @return the consumerSecret value + */ + public SecretBase consumerSecret() { + return this.consumerSecret; + } + + /** + * Set the consumer secret for OAuth 1.0 authentication. + * + * @param consumerSecret the consumerSecret value to set + * @return the QuickBooksLinkedService object itself. + */ + public QuickBooksLinkedService withConsumerSecret(SecretBase consumerSecret) { + this.consumerSecret = consumerSecret; + return this; + } + + /** + * Get the access token for OAuth 1.0 authentication. + * + * @return the accessToken value + */ + public SecretBase accessToken() { + return this.accessToken; + } + + /** + * Set the access token for OAuth 1.0 authentication. + * + * @param accessToken the accessToken value to set + * @return the QuickBooksLinkedService object itself. + */ + public QuickBooksLinkedService withAccessToken(SecretBase accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Get the access token secret for OAuth 1.0 authentication. + * + * @return the accessTokenSecret value + */ + public SecretBase accessTokenSecret() { + return this.accessTokenSecret; + } + + /** + * Set the access token secret for OAuth 1.0 authentication. + * + * @param accessTokenSecret the accessTokenSecret value to set + * @return the QuickBooksLinkedService object itself. + */ + public QuickBooksLinkedService withAccessTokenSecret(SecretBase accessTokenSecret) { + this.accessTokenSecret = accessTokenSecret; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the QuickBooksLinkedService object itself. + */ + public QuickBooksLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the QuickBooksLinkedService object itself. + */ + public QuickBooksLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/QuickBooksObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/QuickBooksObjectDataset.java new file mode 100644 index 000000000000..4ac22bf83144 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/QuickBooksObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * QuickBooks server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("QuickBooksObject") +public class QuickBooksObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/QuickBooksSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/QuickBooksSource.java new file mode 100644 index 000000000000..698f13af76bd --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/QuickBooksSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity QuickBooks server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("QuickBooksSource") +public class QuickBooksSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the QuickBooksSource object itself. + */ + public QuickBooksSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RecurrenceFrequency.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RecurrenceFrequency.java new file mode 100644 index 000000000000..a2eead4f6a74 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RecurrenceFrequency.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for RecurrenceFrequency. + */ +public final class RecurrenceFrequency extends ExpandableStringEnum { + /** Static value NotSpecified for RecurrenceFrequency. */ + public static final RecurrenceFrequency NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Minute for RecurrenceFrequency. */ + public static final RecurrenceFrequency MINUTE = fromString("Minute"); + + /** Static value Hour for RecurrenceFrequency. */ + public static final RecurrenceFrequency HOUR = fromString("Hour"); + + /** Static value Day for RecurrenceFrequency. */ + public static final RecurrenceFrequency DAY = fromString("Day"); + + /** Static value Week for RecurrenceFrequency. */ + public static final RecurrenceFrequency WEEK = fromString("Week"); + + /** Static value Month for RecurrenceFrequency. */ + public static final RecurrenceFrequency MONTH = fromString("Month"); + + /** Static value Year for RecurrenceFrequency. */ + public static final RecurrenceFrequency YEAR = fromString("Year"); + + /** + * Creates or finds a RecurrenceFrequency from its string representation. + * @param name a name to look for + * @return the corresponding RecurrenceFrequency + */ + @JsonCreator + public static RecurrenceFrequency fromString(String name) { + return fromString(name, RecurrenceFrequency.class); + } + + /** + * @return known RecurrenceFrequency values + */ + public static Collection values() { + return values(RecurrenceFrequency.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RecurrenceSchedule.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RecurrenceSchedule.java new file mode 100644 index 000000000000..9059c8d5f0c6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RecurrenceSchedule.java @@ -0,0 +1,175 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The recurrence schedule. + */ +public class RecurrenceSchedule { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The minutes. + */ + @JsonProperty(value = "minutes") + private List minutes; + + /** + * The hours. + */ + @JsonProperty(value = "hours") + private List hours; + + /** + * The days of the week. + */ + @JsonProperty(value = "weekDays") + private List weekDays; + + /** + * The month days. + */ + @JsonProperty(value = "monthDays") + private List monthDays; + + /** + * The monthly occurrences. + */ + @JsonProperty(value = "monthlyOccurrences") + private List monthlyOccurrences; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the RecurrenceSchedule object itself. + */ + public RecurrenceSchedule withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the minutes. + * + * @return the minutes value + */ + public List minutes() { + return this.minutes; + } + + /** + * Set the minutes. + * + * @param minutes the minutes value to set + * @return the RecurrenceSchedule object itself. + */ + public RecurrenceSchedule withMinutes(List minutes) { + this.minutes = minutes; + return this; + } + + /** + * Get the hours. + * + * @return the hours value + */ + public List hours() { + return this.hours; + } + + /** + * Set the hours. + * + * @param hours the hours value to set + * @return the RecurrenceSchedule object itself. + */ + public RecurrenceSchedule withHours(List hours) { + this.hours = hours; + return this; + } + + /** + * Get the days of the week. + * + * @return the weekDays value + */ + public List weekDays() { + return this.weekDays; + } + + /** + * Set the days of the week. + * + * @param weekDays the weekDays value to set + * @return the RecurrenceSchedule object itself. + */ + public RecurrenceSchedule withWeekDays(List weekDays) { + this.weekDays = weekDays; + return this; + } + + /** + * Get the month days. + * + * @return the monthDays value + */ + public List monthDays() { + return this.monthDays; + } + + /** + * Set the month days. + * + * @param monthDays the monthDays value to set + * @return the RecurrenceSchedule object itself. + */ + public RecurrenceSchedule withMonthDays(List monthDays) { + this.monthDays = monthDays; + return this; + } + + /** + * Get the monthly occurrences. + * + * @return the monthlyOccurrences value + */ + public List monthlyOccurrences() { + return this.monthlyOccurrences; + } + + /** + * Set the monthly occurrences. + * + * @param monthlyOccurrences the monthlyOccurrences value to set + * @return the RecurrenceSchedule object itself. + */ + public RecurrenceSchedule withMonthlyOccurrences(List monthlyOccurrences) { + this.monthlyOccurrences = monthlyOccurrences; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RecurrenceScheduleOccurrence.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RecurrenceScheduleOccurrence.java new file mode 100644 index 000000000000..8fd83c26e9e4 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RecurrenceScheduleOccurrence.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The recurrence schedule occurrence. + */ +public class RecurrenceScheduleOccurrence { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The day of the week. Possible values include: 'Sunday', 'Monday', + * 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'. + */ + @JsonProperty(value = "day") + private DayOfWeek day; + + /** + * The occurrence. + */ + @JsonProperty(value = "occurrence") + private Integer occurrence; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the RecurrenceScheduleOccurrence object itself. + */ + public RecurrenceScheduleOccurrence withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the day of the week. Possible values include: 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'. + * + * @return the day value + */ + public DayOfWeek day() { + return this.day; + } + + /** + * Set the day of the week. Possible values include: 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'. + * + * @param day the day value to set + * @return the RecurrenceScheduleOccurrence object itself. + */ + public RecurrenceScheduleOccurrence withDay(DayOfWeek day) { + this.day = day; + return this; + } + + /** + * Get the occurrence. + * + * @return the occurrence value + */ + public Integer occurrence() { + return this.occurrence; + } + + /** + * Set the occurrence. + * + * @param occurrence the occurrence value to set + * @return the RecurrenceScheduleOccurrence object itself. + */ + public RecurrenceScheduleOccurrence withOccurrence(Integer occurrence) { + this.occurrence = occurrence; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RedirectIncompatibleRowSettings.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RedirectIncompatibleRowSettings.java new file mode 100644 index 000000000000..246b96dd741e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RedirectIncompatibleRowSettings.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Redirect incompatible row settings. + */ +public class RedirectIncompatibleRowSettings { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Name of the Azure Storage, Storage SAS, or Azure Data Lake Store linked + * service used for redirecting incompatible row. Must be specified if + * redirectIncompatibleRowSettings is specified. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "linkedServiceName", required = true) + private Object linkedServiceName; + + /** + * The path for storing the redirect incompatible row data. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "path") + private Object path; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the RedirectIncompatibleRowSettings object itself. + */ + public RedirectIncompatibleRowSettings withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get name of the Azure Storage, Storage SAS, or Azure Data Lake Store linked service used for redirecting incompatible row. Must be specified if redirectIncompatibleRowSettings is specified. Type: string (or Expression with resultType string). + * + * @return the linkedServiceName value + */ + public Object linkedServiceName() { + return this.linkedServiceName; + } + + /** + * Set name of the Azure Storage, Storage SAS, or Azure Data Lake Store linked service used for redirecting incompatible row. Must be specified if redirectIncompatibleRowSettings is specified. Type: string (or Expression with resultType string). + * + * @param linkedServiceName the linkedServiceName value to set + * @return the RedirectIncompatibleRowSettings object itself. + */ + public RedirectIncompatibleRowSettings withLinkedServiceName(Object linkedServiceName) { + this.linkedServiceName = linkedServiceName; + return this; + } + + /** + * Get the path for storing the redirect incompatible row data. Type: string (or Expression with resultType string). + * + * @return the path value + */ + public Object path() { + return this.path; + } + + /** + * Set the path for storing the redirect incompatible row data. Type: string (or Expression with resultType string). + * + * @param path the path value to set + * @return the RedirectIncompatibleRowSettings object itself. + */ + public RedirectIncompatibleRowSettings withPath(Object path) { + this.path = path; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RedshiftUnloadSettings.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RedshiftUnloadSettings.java new file mode 100644 index 000000000000..62a75ce3cab6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RedshiftUnloadSettings.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Amazon S3 settings needed for the interim Amazon S3 when copying from + * Amazon Redshift with unload. With this, data from Amazon Redshift source + * will be unloaded into S3 first and then copied into the targeted sink from + * the interim S3. + */ +public class RedshiftUnloadSettings { + /** + * The name of the Amazon S3 linked service which will be used for the + * unload operation when copying from the Amazon Redshift source. + */ + @JsonProperty(value = "s3LinkedServiceName", required = true) + private LinkedServiceReference s3LinkedServiceName; + + /** + * The bucket of the interim Amazon S3 which will be used to store the + * unloaded data from Amazon Redshift source. The bucket must be in the + * same region as the Amazon Redshift source. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "bucketName", required = true) + private Object bucketName; + + /** + * Get the name of the Amazon S3 linked service which will be used for the unload operation when copying from the Amazon Redshift source. + * + * @return the s3LinkedServiceName value + */ + public LinkedServiceReference s3LinkedServiceName() { + return this.s3LinkedServiceName; + } + + /** + * Set the name of the Amazon S3 linked service which will be used for the unload operation when copying from the Amazon Redshift source. + * + * @param s3LinkedServiceName the s3LinkedServiceName value to set + * @return the RedshiftUnloadSettings object itself. + */ + public RedshiftUnloadSettings withS3LinkedServiceName(LinkedServiceReference s3LinkedServiceName) { + this.s3LinkedServiceName = s3LinkedServiceName; + return this; + } + + /** + * Get the bucket of the interim Amazon S3 which will be used to store the unloaded data from Amazon Redshift source. The bucket must be in the same region as the Amazon Redshift source. Type: string (or Expression with resultType string). + * + * @return the bucketName value + */ + public Object bucketName() { + return this.bucketName; + } + + /** + * Set the bucket of the interim Amazon S3 which will be used to store the unloaded data from Amazon Redshift source. The bucket must be in the same region as the Amazon Redshift source. Type: string (or Expression with resultType string). + * + * @param bucketName the bucketName value to set + * @return the RedshiftUnloadSettings object itself. + */ + public RedshiftUnloadSettings withBucketName(Object bucketName) { + this.bucketName = bucketName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RelationalSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RelationalSource.java new file mode 100644 index 000000000000..c8fa7fa63ab1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RelationalSource.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity source for various relational databases. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("RelationalSource") +public class RelationalSource extends CopySource { + /** + * Database query. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get database query. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set database query. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the RelationalSource object itself. + */ + public RelationalSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RelationalTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RelationalTableDataset.java new file mode 100644 index 000000000000..2ee249b9eb5b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RelationalTableDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The relational table dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("RelationalTable") +@JsonFlatten +public class RelationalTableDataset extends DatasetInner { + /** + * The relational table name. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.tableName") + private Object tableName; + + /** + * Get the relational table name. Type: string (or Expression with resultType string). + * + * @return the tableName value + */ + public Object tableName() { + return this.tableName; + } + + /** + * Set the relational table name. Type: string (or Expression with resultType string). + * + * @param tableName the tableName value to set + * @return the RelationalTableDataset object itself. + */ + public RelationalTableDataset withTableName(Object tableName) { + this.tableName = tableName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ResponsysLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ResponsysLinkedService.java new file mode 100644 index 000000000000..27479e683b35 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ResponsysLinkedService.java @@ -0,0 +1,217 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Responsys linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Responsys") +@JsonFlatten +public class ResponsysLinkedService extends LinkedServiceInner { + /** + * The endpoint of the Responsys server. + */ + @JsonProperty(value = "typeProperties.endpoint", required = true) + private Object endpoint; + + /** + * The client ID associated with the Responsys application. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.clientId", required = true) + private Object clientId; + + /** + * The client secret associated with the Responsys application. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.clientSecret") + private SecretBase clientSecret; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. Type: boolean (or Expression with resultType + * boolean). + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. Type: boolean (or Expression with resultType + * boolean). + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. Type: boolean (or Expression with + * resultType boolean). + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the endpoint of the Responsys server. + * + * @return the endpoint value + */ + public Object endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint of the Responsys server. + * + * @param endpoint the endpoint value to set + * @return the ResponsysLinkedService object itself. + */ + public ResponsysLinkedService withEndpoint(Object endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Get the client ID associated with the Responsys application. Type: string (or Expression with resultType string). + * + * @return the clientId value + */ + public Object clientId() { + return this.clientId; + } + + /** + * Set the client ID associated with the Responsys application. Type: string (or Expression with resultType string). + * + * @param clientId the clientId value to set + * @return the ResponsysLinkedService object itself. + */ + public ResponsysLinkedService withClientId(Object clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the client secret associated with the Responsys application. Type: string (or Expression with resultType string). + * + * @return the clientSecret value + */ + public SecretBase clientSecret() { + return this.clientSecret; + } + + /** + * Set the client secret associated with the Responsys application. Type: string (or Expression with resultType string). + * + * @param clientSecret the clientSecret value to set + * @return the ResponsysLinkedService object itself. + */ + public ResponsysLinkedService withClientSecret(SecretBase clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the ResponsysLinkedService object itself. + */ + public ResponsysLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param useHostVerification the useHostVerification value to set + * @return the ResponsysLinkedService object itself. + */ + public ResponsysLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param usePeerVerification the usePeerVerification value to set + * @return the ResponsysLinkedService object itself. + */ + public ResponsysLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the ResponsysLinkedService object itself. + */ + public ResponsysLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ResponsysObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ResponsysObjectDataset.java new file mode 100644 index 000000000000..053a643958e9 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ResponsysObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Responsys dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ResponsysObject") +public class ResponsysObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ResponsysSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ResponsysSource.java new file mode 100644 index 000000000000..406312ed516e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ResponsysSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Responsys source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ResponsysSource") +public class ResponsysSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the ResponsysSource object itself. + */ + public ResponsysSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RetryPolicy.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RetryPolicy.java new file mode 100644 index 000000000000..6a7b69de4071 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/RetryPolicy.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Execution policy for an activity. + */ +public class RetryPolicy { + /** + * Maximum ordinary retry attempts. Default is 0. Type: integer (or + * Expression with resultType integer), minimum: 0. + */ + @JsonProperty(value = "count") + private Object count; + + /** + * Interval between retries in seconds. Default is 30. + */ + @JsonProperty(value = "intervalInSeconds") + private Integer intervalInSeconds; + + /** + * Get maximum ordinary retry attempts. Default is 0. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the count value + */ + public Object count() { + return this.count; + } + + /** + * Set maximum ordinary retry attempts. Default is 0. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param count the count value to set + * @return the RetryPolicy object itself. + */ + public RetryPolicy withCount(Object count) { + this.count = count; + return this; + } + + /** + * Get interval between retries in seconds. Default is 30. + * + * @return the intervalInSeconds value + */ + public Integer intervalInSeconds() { + return this.intervalInSeconds; + } + + /** + * Set interval between retries in seconds. Default is 30. + * + * @param intervalInSeconds the intervalInSeconds value to set + * @return the RetryPolicy object itself. + */ + public RetryPolicy withIntervalInSeconds(Integer intervalInSeconds) { + this.intervalInSeconds = intervalInSeconds; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISAccessCredential.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISAccessCredential.java new file mode 100644 index 000000000000..ce79f81e919f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISAccessCredential.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SSIS access credential. + */ +public class SSISAccessCredential { + /** + * Domain for windows authentication. + */ + @JsonProperty(value = "domain", required = true) + private Object domain; + + /** + * UseName for windows authentication. + */ + @JsonProperty(value = "userName", required = true) + private Object userName; + + /** + * Password for windows authentication. + */ + @JsonProperty(value = "password", required = true) + private SecretBase password; + + /** + * Get domain for windows authentication. + * + * @return the domain value + */ + public Object domain() { + return this.domain; + } + + /** + * Set domain for windows authentication. + * + * @param domain the domain value to set + * @return the SSISAccessCredential object itself. + */ + public SSISAccessCredential withDomain(Object domain) { + this.domain = domain; + return this; + } + + /** + * Get useName for windows authentication. + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set useName for windows authentication. + * + * @param userName the userName value to set + * @return the SSISAccessCredential object itself. + */ + public SSISAccessCredential withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get password for windows authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password for windows authentication. + * + * @param password the password value to set + * @return the SSISAccessCredential object itself. + */ + public SSISAccessCredential withPassword(SecretBase password) { + this.password = password; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISExecutionCredential.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISExecutionCredential.java new file mode 100644 index 000000000000..d1e5cc0931b7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISExecutionCredential.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SSIS package execution credential. + */ +public class SSISExecutionCredential { + /** + * Domain for windows authentication. + */ + @JsonProperty(value = "domain", required = true) + private Object domain; + + /** + * UseName for windows authentication. + */ + @JsonProperty(value = "userName", required = true) + private Object userName; + + /** + * Password for windows authentication. + */ + @JsonProperty(value = "password", required = true) + private SecureString password; + + /** + * Get domain for windows authentication. + * + * @return the domain value + */ + public Object domain() { + return this.domain; + } + + /** + * Set domain for windows authentication. + * + * @param domain the domain value to set + * @return the SSISExecutionCredential object itself. + */ + public SSISExecutionCredential withDomain(Object domain) { + this.domain = domain; + return this; + } + + /** + * Get useName for windows authentication. + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set useName for windows authentication. + * + * @param userName the userName value to set + * @return the SSISExecutionCredential object itself. + */ + public SSISExecutionCredential withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get password for windows authentication. + * + * @return the password value + */ + public SecureString password() { + return this.password; + } + + /** + * Set password for windows authentication. + * + * @param password the password value to set + * @return the SSISExecutionCredential object itself. + */ + public SSISExecutionCredential withPassword(SecureString password) { + this.password = password; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISExecutionParameter.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISExecutionParameter.java new file mode 100644 index 000000000000..4e276c59042f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISExecutionParameter.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SSIS execution parameter. + */ +public class SSISExecutionParameter { + /** + * SSIS package execution parameter value. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "value", required = true) + private Object value; + + /** + * Get sSIS package execution parameter value. Type: string (or Expression with resultType string). + * + * @return the value value + */ + public Object value() { + return this.value; + } + + /** + * Set sSIS package execution parameter value. Type: string (or Expression with resultType string). + * + * @param value the value value to set + * @return the SSISExecutionParameter object itself. + */ + public SSISExecutionParameter withValue(Object value) { + this.value = value; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISLogLocation.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISLogLocation.java new file mode 100644 index 000000000000..eb7930fdddab --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISLogLocation.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * SSIS package execution log location. + */ +@JsonFlatten +public class SSISLogLocation { + /** + * The SSIS package execution log path. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "logPath", required = true) + private Object logPath; + + /** + * The type of SSIS log location. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * The package execution log access credential. + */ + @JsonProperty(value = "typeProperties.accessCredential") + private SSISAccessCredential accessCredential; + + /** + * Specifies the interval to refresh log. The default interval is 5 + * minutes. Type: string (or Expression with resultType string), pattern: + * ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + */ + @JsonProperty(value = "typeProperties.logRefreshInterval") + private Object logRefreshInterval; + + /** + * Creates an instance of SSISLogLocation class. + * @param logPath the SSIS package execution log path. Type: string (or Expression with resultType string). + */ + public SSISLogLocation() { + type = "File"; + } + + /** + * Get the SSIS package execution log path. Type: string (or Expression with resultType string). + * + * @return the logPath value + */ + public Object logPath() { + return this.logPath; + } + + /** + * Set the SSIS package execution log path. Type: string (or Expression with resultType string). + * + * @param logPath the logPath value to set + * @return the SSISLogLocation object itself. + */ + public SSISLogLocation withLogPath(Object logPath) { + this.logPath = logPath; + return this; + } + + /** + * Get the type of SSIS log location. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of SSIS log location. + * + * @param type the type value to set + * @return the SSISLogLocation object itself. + */ + public SSISLogLocation withType(String type) { + this.type = type; + return this; + } + + /** + * Get the package execution log access credential. + * + * @return the accessCredential value + */ + public SSISAccessCredential accessCredential() { + return this.accessCredential; + } + + /** + * Set the package execution log access credential. + * + * @param accessCredential the accessCredential value to set + * @return the SSISLogLocation object itself. + */ + public SSISLogLocation withAccessCredential(SSISAccessCredential accessCredential) { + this.accessCredential = accessCredential; + return this; + } + + /** + * Get specifies the interval to refresh log. The default interval is 5 minutes. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @return the logRefreshInterval value + */ + public Object logRefreshInterval() { + return this.logRefreshInterval; + } + + /** + * Set specifies the interval to refresh log. The default interval is 5 minutes. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @param logRefreshInterval the logRefreshInterval value to set + * @return the SSISLogLocation object itself. + */ + public SSISLogLocation withLogRefreshInterval(Object logRefreshInterval) { + this.logRefreshInterval = logRefreshInterval; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISPackageLocation.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISPackageLocation.java new file mode 100644 index 000000000000..7e60e7089e21 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISPackageLocation.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * SSIS package location. + */ +@JsonFlatten +public class SSISPackageLocation { + /** + * The SSIS package path. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "packagePath", required = true) + private Object packagePath; + + /** + * The type of SSIS package location. Possible values include: 'SSISDB', + * 'File'. + */ + @JsonProperty(value = "type") + private SsisPackageLocationType type; + + /** + * Password of the package. + */ + @JsonProperty(value = "typeProperties.packagePassword") + private SecretBase packagePassword; + + /** + * The package access credential. + */ + @JsonProperty(value = "typeProperties.accessCredential") + private SSISAccessCredential accessCredential; + + /** + * The configuration file of the package execution. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.configurationPath") + private Object configurationPath; + + /** + * Get the SSIS package path. Type: string (or Expression with resultType string). + * + * @return the packagePath value + */ + public Object packagePath() { + return this.packagePath; + } + + /** + * Set the SSIS package path. Type: string (or Expression with resultType string). + * + * @param packagePath the packagePath value to set + * @return the SSISPackageLocation object itself. + */ + public SSISPackageLocation withPackagePath(Object packagePath) { + this.packagePath = packagePath; + return this; + } + + /** + * Get the type of SSIS package location. Possible values include: 'SSISDB', 'File'. + * + * @return the type value + */ + public SsisPackageLocationType type() { + return this.type; + } + + /** + * Set the type of SSIS package location. Possible values include: 'SSISDB', 'File'. + * + * @param type the type value to set + * @return the SSISPackageLocation object itself. + */ + public SSISPackageLocation withType(SsisPackageLocationType type) { + this.type = type; + return this; + } + + /** + * Get password of the package. + * + * @return the packagePassword value + */ + public SecretBase packagePassword() { + return this.packagePassword; + } + + /** + * Set password of the package. + * + * @param packagePassword the packagePassword value to set + * @return the SSISPackageLocation object itself. + */ + public SSISPackageLocation withPackagePassword(SecretBase packagePassword) { + this.packagePassword = packagePassword; + return this; + } + + /** + * Get the package access credential. + * + * @return the accessCredential value + */ + public SSISAccessCredential accessCredential() { + return this.accessCredential; + } + + /** + * Set the package access credential. + * + * @param accessCredential the accessCredential value to set + * @return the SSISPackageLocation object itself. + */ + public SSISPackageLocation withAccessCredential(SSISAccessCredential accessCredential) { + this.accessCredential = accessCredential; + return this; + } + + /** + * Get the configuration file of the package execution. Type: string (or Expression with resultType string). + * + * @return the configurationPath value + */ + public Object configurationPath() { + return this.configurationPath; + } + + /** + * Set the configuration file of the package execution. Type: string (or Expression with resultType string). + * + * @param configurationPath the configurationPath value to set + * @return the SSISPackageLocation object itself. + */ + public SSISPackageLocation withConfigurationPath(Object configurationPath) { + this.configurationPath = configurationPath; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISPropertyOverride.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISPropertyOverride.java new file mode 100644 index 000000000000..227d1b21bd37 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SSISPropertyOverride.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SSIS property override. + */ +public class SSISPropertyOverride { + /** + * SSIS package property override value. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "value", required = true) + private Object value; + + /** + * Whether SSIS package property override value is sensitive data. Value + * will be encrypted in SSISDB if it is true. + */ + @JsonProperty(value = "isSensitive") + private Boolean isSensitive; + + /** + * Get sSIS package property override value. Type: string (or Expression with resultType string). + * + * @return the value value + */ + public Object value() { + return this.value; + } + + /** + * Set sSIS package property override value. Type: string (or Expression with resultType string). + * + * @param value the value value to set + * @return the SSISPropertyOverride object itself. + */ + public SSISPropertyOverride withValue(Object value) { + this.value = value; + return this; + } + + /** + * Get whether SSIS package property override value is sensitive data. Value will be encrypted in SSISDB if it is true. + * + * @return the isSensitive value + */ + public Boolean isSensitive() { + return this.isSensitive; + } + + /** + * Set whether SSIS package property override value is sensitive data. Value will be encrypted in SSISDB if it is true. + * + * @param isSensitive the isSensitive value to set + * @return the SSISPropertyOverride object itself. + */ + public SSISPropertyOverride withIsSensitive(Boolean isSensitive) { + this.isSensitive = isSensitive; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceLinkedService.java new file mode 100644 index 000000000000..9ba7690a7082 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceLinkedService.java @@ -0,0 +1,161 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for Salesforce. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Salesforce") +@JsonFlatten +public class SalesforceLinkedService extends LinkedServiceInner { + /** + * The URL of Salesforce instance. Default is + * 'https://login.salesforce.com'. To copy data from sandbox, specify + * 'https://test.salesforce.com'. To copy data from custom domain, specify, + * for example, 'https://[domain].my.salesforce.com'. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.environmentUrl") + private Object environmentUrl; + + /** + * The username for Basic authentication of the Salesforce instance. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * The password for Basic authentication of the Salesforce instance. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The security token is required to remotely access Salesforce instance. + */ + @JsonProperty(value = "typeProperties.securityToken") + private SecretBase securityToken; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the URL of Salesforce instance. Default is 'https://login.salesforce.com'. To copy data from sandbox, specify 'https://test.salesforce.com'. To copy data from custom domain, specify, for example, 'https://[domain].my.salesforce.com'. Type: string (or Expression with resultType string). + * + * @return the environmentUrl value + */ + public Object environmentUrl() { + return this.environmentUrl; + } + + /** + * Set the URL of Salesforce instance. Default is 'https://login.salesforce.com'. To copy data from sandbox, specify 'https://test.salesforce.com'. To copy data from custom domain, specify, for example, 'https://[domain].my.salesforce.com'. Type: string (or Expression with resultType string). + * + * @param environmentUrl the environmentUrl value to set + * @return the SalesforceLinkedService object itself. + */ + public SalesforceLinkedService withEnvironmentUrl(Object environmentUrl) { + this.environmentUrl = environmentUrl; + return this; + } + + /** + * Get the username for Basic authentication of the Salesforce instance. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the username for Basic authentication of the Salesforce instance. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the SalesforceLinkedService object itself. + */ + public SalesforceLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password for Basic authentication of the Salesforce instance. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password for Basic authentication of the Salesforce instance. + * + * @param password the password value to set + * @return the SalesforceLinkedService object itself. + */ + public SalesforceLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the security token is required to remotely access Salesforce instance. + * + * @return the securityToken value + */ + public SecretBase securityToken() { + return this.securityToken; + } + + /** + * Set the security token is required to remotely access Salesforce instance. + * + * @param securityToken the securityToken value to set + * @return the SalesforceLinkedService object itself. + */ + public SalesforceLinkedService withSecurityToken(SecretBase securityToken) { + this.securityToken = securityToken; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SalesforceLinkedService object itself. + */ + public SalesforceLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceMarketingCloudLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceMarketingCloudLinkedService.java new file mode 100644 index 000000000000..b4759235918e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceMarketingCloudLinkedService.java @@ -0,0 +1,191 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Salesforce Marketing Cloud linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SalesforceMarketingCloud") +@JsonFlatten +public class SalesforceMarketingCloudLinkedService extends LinkedServiceInner { + /** + * The client ID associated with the Salesforce Marketing Cloud + * application. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.clientId", required = true) + private Object clientId; + + /** + * The client secret associated with the Salesforce Marketing Cloud + * application. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.clientSecret") + private SecretBase clientSecret; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. Type: boolean (or Expression with resultType + * boolean). + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. Type: boolean (or Expression with resultType + * boolean). + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. Type: boolean (or Expression with + * resultType boolean). + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the client ID associated with the Salesforce Marketing Cloud application. Type: string (or Expression with resultType string). + * + * @return the clientId value + */ + public Object clientId() { + return this.clientId; + } + + /** + * Set the client ID associated with the Salesforce Marketing Cloud application. Type: string (or Expression with resultType string). + * + * @param clientId the clientId value to set + * @return the SalesforceMarketingCloudLinkedService object itself. + */ + public SalesforceMarketingCloudLinkedService withClientId(Object clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the client secret associated with the Salesforce Marketing Cloud application. Type: string (or Expression with resultType string). + * + * @return the clientSecret value + */ + public SecretBase clientSecret() { + return this.clientSecret; + } + + /** + * Set the client secret associated with the Salesforce Marketing Cloud application. Type: string (or Expression with resultType string). + * + * @param clientSecret the clientSecret value to set + * @return the SalesforceMarketingCloudLinkedService object itself. + */ + public SalesforceMarketingCloudLinkedService withClientSecret(SecretBase clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the SalesforceMarketingCloudLinkedService object itself. + */ + public SalesforceMarketingCloudLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param useHostVerification the useHostVerification value to set + * @return the SalesforceMarketingCloudLinkedService object itself. + */ + public SalesforceMarketingCloudLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param usePeerVerification the usePeerVerification value to set + * @return the SalesforceMarketingCloudLinkedService object itself. + */ + public SalesforceMarketingCloudLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SalesforceMarketingCloudLinkedService object itself. + */ + public SalesforceMarketingCloudLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceMarketingCloudObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceMarketingCloudObjectDataset.java new file mode 100644 index 000000000000..4d02bc6dc26f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceMarketingCloudObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Salesforce Marketing Cloud dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SalesforceMarketingCloudObject") +public class SalesforceMarketingCloudObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceMarketingCloudSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceMarketingCloudSource.java new file mode 100644 index 000000000000..e03f08a2f222 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceMarketingCloudSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Salesforce Marketing Cloud source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SalesforceMarketingCloudSource") +public class SalesforceMarketingCloudSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the SalesforceMarketingCloudSource object itself. + */ + public SalesforceMarketingCloudSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceObjectDataset.java new file mode 100644 index 000000000000..887dc8beeffb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceObjectDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The Salesforce object dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SalesforceObject") +@JsonFlatten +public class SalesforceObjectDataset extends DatasetInner { + /** + * The Salesforce object API name. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.objectApiName") + private Object objectApiName; + + /** + * Get the Salesforce object API name. Type: string (or Expression with resultType string). + * + * @return the objectApiName value + */ + public Object objectApiName() { + return this.objectApiName; + } + + /** + * Set the Salesforce object API name. Type: string (or Expression with resultType string). + * + * @param objectApiName the objectApiName value to set + * @return the SalesforceObjectDataset object itself. + */ + public SalesforceObjectDataset withObjectApiName(Object objectApiName) { + this.objectApiName = objectApiName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceSink.java new file mode 100644 index 000000000000..c725395e590e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceSink.java @@ -0,0 +1,107 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Salesforce sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SalesforceSink") +public class SalesforceSink extends CopySink { + /** + * The write behavior for the operation. Default is Insert. + */ + @JsonProperty(value = "writeBehavior") + private Object writeBehavior; + + /** + * The name of the external ID field for upsert operation. Default value is + * 'Id' column. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "externalIdFieldName") + private Object externalIdFieldName; + + /** + * The flag indicating whether or not to ignore null values from input + * dataset (except key fields) during write operation. Default value is + * false. If set it to true, it means ADF will leave the data in the + * destination object unchanged when doing upsert/update operation and + * insert defined default value when doing insert operation, versus ADF + * will update the data in the destination object to NULL when doing + * upsert/update operation and insert NULL value when doing insert + * operation. Type: boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "ignoreNullValues") + private Object ignoreNullValues; + + /** + * Get the write behavior for the operation. Default is Insert. + * + * @return the writeBehavior value + */ + public Object writeBehavior() { + return this.writeBehavior; + } + + /** + * Set the write behavior for the operation. Default is Insert. + * + * @param writeBehavior the writeBehavior value to set + * @return the SalesforceSink object itself. + */ + public SalesforceSink withWriteBehavior(Object writeBehavior) { + this.writeBehavior = writeBehavior; + return this; + } + + /** + * Get the name of the external ID field for upsert operation. Default value is 'Id' column. Type: string (or Expression with resultType string). + * + * @return the externalIdFieldName value + */ + public Object externalIdFieldName() { + return this.externalIdFieldName; + } + + /** + * Set the name of the external ID field for upsert operation. Default value is 'Id' column. Type: string (or Expression with resultType string). + * + * @param externalIdFieldName the externalIdFieldName value to set + * @return the SalesforceSink object itself. + */ + public SalesforceSink withExternalIdFieldName(Object externalIdFieldName) { + this.externalIdFieldName = externalIdFieldName; + return this; + } + + /** + * Get the flag indicating whether or not to ignore null values from input dataset (except key fields) during write operation. Default value is false. If set it to true, it means ADF will leave the data in the destination object unchanged when doing upsert/update operation and insert defined default value when doing insert operation, versus ADF will update the data in the destination object to NULL when doing upsert/update operation and insert NULL value when doing insert operation. Type: boolean (or Expression with resultType boolean). + * + * @return the ignoreNullValues value + */ + public Object ignoreNullValues() { + return this.ignoreNullValues; + } + + /** + * Set the flag indicating whether or not to ignore null values from input dataset (except key fields) during write operation. Default value is false. If set it to true, it means ADF will leave the data in the destination object unchanged when doing upsert/update operation and insert defined default value when doing insert operation, versus ADF will update the data in the destination object to NULL when doing upsert/update operation and insert NULL value when doing insert operation. Type: boolean (or Expression with resultType boolean). + * + * @param ignoreNullValues the ignoreNullValues value to set + * @return the SalesforceSink object itself. + */ + public SalesforceSink withIgnoreNullValues(Object ignoreNullValues) { + this.ignoreNullValues = ignoreNullValues; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceSource.java new file mode 100644 index 000000000000..5467c65b05c5 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SalesforceSource.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Salesforce source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SalesforceSource") +public class SalesforceSource extends CopySource { + /** + * Database query. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * The read behavior for the operation. Default is Query. + */ + @JsonProperty(value = "readBehavior") + private Object readBehavior; + + /** + * Get database query. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set database query. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the SalesforceSource object itself. + */ + public SalesforceSource withQuery(Object query) { + this.query = query; + return this; + } + + /** + * Get the read behavior for the operation. Default is Query. + * + * @return the readBehavior value + */ + public Object readBehavior() { + return this.readBehavior; + } + + /** + * Set the read behavior for the operation. Default is Query. + * + * @param readBehavior the readBehavior value to set + * @return the SalesforceSource object itself. + */ + public SalesforceSource withReadBehavior(Object readBehavior) { + this.readBehavior = readBehavior; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapBWLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapBWLinkedService.java new file mode 100644 index 000000000000..dc9278652ff3 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapBWLinkedService.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * SAP Business Warehouse Linked Service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SapBW") +@JsonFlatten +public class SapBWLinkedService extends LinkedServiceInner { + /** + * Host name of the SAP BW instance. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.server", required = true) + private Object server; + + /** + * System number of the BW system. (Usually a two-digit decimal number + * represented as a string.) Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.systemNumber", required = true) + private Object systemNumber; + + /** + * Client ID of the client on the BW system. (Usually a three-digit decimal + * number represented as a string) Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.clientId", required = true) + private Object clientId; + + /** + * Username to access the SAP BW server. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.userName") + private Object userName; + + /** + * Password to access the SAP BW server. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get host name of the SAP BW instance. Type: string (or Expression with resultType string). + * + * @return the server value + */ + public Object server() { + return this.server; + } + + /** + * Set host name of the SAP BW instance. Type: string (or Expression with resultType string). + * + * @param server the server value to set + * @return the SapBWLinkedService object itself. + */ + public SapBWLinkedService withServer(Object server) { + this.server = server; + return this; + } + + /** + * Get system number of the BW system. (Usually a two-digit decimal number represented as a string.) Type: string (or Expression with resultType string). + * + * @return the systemNumber value + */ + public Object systemNumber() { + return this.systemNumber; + } + + /** + * Set system number of the BW system. (Usually a two-digit decimal number represented as a string.) Type: string (or Expression with resultType string). + * + * @param systemNumber the systemNumber value to set + * @return the SapBWLinkedService object itself. + */ + public SapBWLinkedService withSystemNumber(Object systemNumber) { + this.systemNumber = systemNumber; + return this; + } + + /** + * Get client ID of the client on the BW system. (Usually a three-digit decimal number represented as a string) Type: string (or Expression with resultType string). + * + * @return the clientId value + */ + public Object clientId() { + return this.clientId; + } + + /** + * Set client ID of the client on the BW system. (Usually a three-digit decimal number represented as a string) Type: string (or Expression with resultType string). + * + * @param clientId the clientId value to set + * @return the SapBWLinkedService object itself. + */ + public SapBWLinkedService withClientId(Object clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get username to access the SAP BW server. Type: string (or Expression with resultType string). + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set username to access the SAP BW server. Type: string (or Expression with resultType string). + * + * @param userName the userName value to set + * @return the SapBWLinkedService object itself. + */ + public SapBWLinkedService withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get password to access the SAP BW server. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password to access the SAP BW server. + * + * @param password the password value to set + * @return the SapBWLinkedService object itself. + */ + public SapBWLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SapBWLinkedService object itself. + */ + public SapBWLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerLinkedService.java new file mode 100644 index 000000000000..6997191c4b21 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerLinkedService.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for SAP Cloud for Customer. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SapCloudForCustomer") +@JsonFlatten +public class SapCloudForCustomerLinkedService extends LinkedServiceInner { + /** + * The URL of SAP Cloud for Customer OData API. For example, + * '[https://[tenantname].crm.ondemand.com/sap/c4c/odata/v1]'. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.url", required = true) + private Object url; + + /** + * The username for Basic authentication. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * The password for Basic authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Either + * encryptedCredential or username/password must be provided. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the URL of SAP Cloud for Customer OData API. For example, '[https://[tenantname].crm.ondemand.com/sap/c4c/odata/v1]'. Type: string (or Expression with resultType string). + * + * @return the url value + */ + public Object url() { + return this.url; + } + + /** + * Set the URL of SAP Cloud for Customer OData API. For example, '[https://[tenantname].crm.ondemand.com/sap/c4c/odata/v1]'. Type: string (or Expression with resultType string). + * + * @param url the url value to set + * @return the SapCloudForCustomerLinkedService object itself. + */ + public SapCloudForCustomerLinkedService withUrl(Object url) { + this.url = url; + return this; + } + + /** + * Get the username for Basic authentication. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the username for Basic authentication. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the SapCloudForCustomerLinkedService object itself. + */ + public SapCloudForCustomerLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password for Basic authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password for Basic authentication. + * + * @param password the password value to set + * @return the SapCloudForCustomerLinkedService object itself. + */ + public SapCloudForCustomerLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Either encryptedCredential or username/password must be provided. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Either encryptedCredential or username/password must be provided. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SapCloudForCustomerLinkedService object itself. + */ + public SapCloudForCustomerLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerResourceDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerResourceDataset.java new file mode 100644 index 000000000000..fed8d4811ff0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerResourceDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The path of the SAP Cloud for Customer OData entity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SapCloudForCustomerResource") +@JsonFlatten +public class SapCloudForCustomerResourceDataset extends DatasetInner { + /** + * The path of the SAP Cloud for Customer OData entity. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.path", required = true) + private Object path; + + /** + * Get the path of the SAP Cloud for Customer OData entity. Type: string (or Expression with resultType string). + * + * @return the path value + */ + public Object path() { + return this.path; + } + + /** + * Set the path of the SAP Cloud for Customer OData entity. Type: string (or Expression with resultType string). + * + * @param path the path value to set + * @return the SapCloudForCustomerResourceDataset object itself. + */ + public SapCloudForCustomerResourceDataset withPath(Object path) { + this.path = path; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerSink.java new file mode 100644 index 000000000000..afc1c2f50fb6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerSink.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity SAP Cloud for Customer sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SapCloudForCustomerSink") +public class SapCloudForCustomerSink extends CopySink { + /** + * The write behavior for the operation. Default is 'Insert'. + */ + @JsonProperty(value = "writeBehavior") + private Object writeBehavior; + + /** + * Get the write behavior for the operation. Default is 'Insert'. + * + * @return the writeBehavior value + */ + public Object writeBehavior() { + return this.writeBehavior; + } + + /** + * Set the write behavior for the operation. Default is 'Insert'. + * + * @param writeBehavior the writeBehavior value to set + * @return the SapCloudForCustomerSink object itself. + */ + public SapCloudForCustomerSink withWriteBehavior(Object writeBehavior) { + this.writeBehavior = writeBehavior; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerSource.java new file mode 100644 index 000000000000..62ef8c201eb7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapCloudForCustomerSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity source for SAP Cloud for Customer source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SapCloudForCustomerSource") +public class SapCloudForCustomerSource extends CopySource { + /** + * SAP Cloud for Customer OData query. For example, "$top=1". Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get sAP Cloud for Customer OData query. For example, "$top=1". Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set sAP Cloud for Customer OData query. For example, "$top=1". Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the SapCloudForCustomerSource object itself. + */ + public SapCloudForCustomerSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapEccLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapEccLinkedService.java new file mode 100644 index 000000000000..535da71425ad --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapEccLinkedService.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for SAP ERP Central Component(SAP ECC). + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SapEcc") +@JsonFlatten +public class SapEccLinkedService extends LinkedServiceInner { + /** + * The URL of SAP ECC OData API. For example, + * '[https://hostname:port/sap/opu/odata/sap/servicename/]'. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.url", required = true) + private String url; + + /** + * The username for Basic authentication. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.username") + private String username; + + /** + * The password for Basic authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Either + * encryptedCredential or username/password must be provided. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private String encryptedCredential; + + /** + * Get the URL of SAP ECC OData API. For example, '[https://hostname:port/sap/opu/odata/sap/servicename/]'. Type: string (or Expression with resultType string). + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set the URL of SAP ECC OData API. For example, '[https://hostname:port/sap/opu/odata/sap/servicename/]'. Type: string (or Expression with resultType string). + * + * @param url the url value to set + * @return the SapEccLinkedService object itself. + */ + public SapEccLinkedService withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the username for Basic authentication. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public String username() { + return this.username; + } + + /** + * Set the username for Basic authentication. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the SapEccLinkedService object itself. + */ + public SapEccLinkedService withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password for Basic authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password for Basic authentication. + * + * @param password the password value to set + * @return the SapEccLinkedService object itself. + */ + public SapEccLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Either encryptedCredential or username/password must be provided. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public String encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Either encryptedCredential or username/password must be provided. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SapEccLinkedService object itself. + */ + public SapEccLinkedService withEncryptedCredential(String encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapEccResourceDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapEccResourceDataset.java new file mode 100644 index 000000000000..d087fd649925 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapEccResourceDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The path of the SAP ECC OData entity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SapEccResource") +@JsonFlatten +public class SapEccResourceDataset extends DatasetInner { + /** + * The path of the SAP ECC OData entity. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.path", required = true) + private Object path; + + /** + * Get the path of the SAP ECC OData entity. Type: string (or Expression with resultType string). + * + * @return the path value + */ + public Object path() { + return this.path; + } + + /** + * Set the path of the SAP ECC OData entity. Type: string (or Expression with resultType string). + * + * @param path the path value to set + * @return the SapEccResourceDataset object itself. + */ + public SapEccResourceDataset withPath(Object path) { + this.path = path; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapEccSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapEccSource.java new file mode 100644 index 000000000000..d32793cc3041 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapEccSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity source for SAP ECC source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SapEccSource") +public class SapEccSource extends CopySource { + /** + * SAP ECC OData query. For example, "$top=1". Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get sAP ECC OData query. For example, "$top=1". Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set sAP ECC OData query. For example, "$top=1". Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the SapEccSource object itself. + */ + public SapEccSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapHanaAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapHanaAuthenticationType.java new file mode 100644 index 000000000000..c22a210d030d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapHanaAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SapHanaAuthenticationType. + */ +public final class SapHanaAuthenticationType extends ExpandableStringEnum { + /** Static value Basic for SapHanaAuthenticationType. */ + public static final SapHanaAuthenticationType BASIC = fromString("Basic"); + + /** Static value Windows for SapHanaAuthenticationType. */ + public static final SapHanaAuthenticationType WINDOWS = fromString("Windows"); + + /** + * Creates or finds a SapHanaAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding SapHanaAuthenticationType + */ + @JsonCreator + public static SapHanaAuthenticationType fromString(String name) { + return fromString(name, SapHanaAuthenticationType.class); + } + + /** + * @return known SapHanaAuthenticationType values + */ + public static Collection values() { + return values(SapHanaAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapHanaLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapHanaLinkedService.java new file mode 100644 index 000000000000..37f9ba392ed9 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SapHanaLinkedService.java @@ -0,0 +1,159 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * SAP HANA Linked Service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SapHana") +@JsonFlatten +public class SapHanaLinkedService extends LinkedServiceInner { + /** + * Host name of the SAP HANA server. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.server", required = true) + private Object server; + + /** + * The authentication type to be used to connect to the SAP HANA server. + * Possible values include: 'Basic', 'Windows'. + */ + @JsonProperty(value = "typeProperties.authenticationType") + private SapHanaAuthenticationType authenticationType; + + /** + * Username to access the SAP HANA server. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.userName") + private Object userName; + + /** + * Password to access the SAP HANA server. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get host name of the SAP HANA server. Type: string (or Expression with resultType string). + * + * @return the server value + */ + public Object server() { + return this.server; + } + + /** + * Set host name of the SAP HANA server. Type: string (or Expression with resultType string). + * + * @param server the server value to set + * @return the SapHanaLinkedService object itself. + */ + public SapHanaLinkedService withServer(Object server) { + this.server = server; + return this; + } + + /** + * Get the authentication type to be used to connect to the SAP HANA server. Possible values include: 'Basic', 'Windows'. + * + * @return the authenticationType value + */ + public SapHanaAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type to be used to connect to the SAP HANA server. Possible values include: 'Basic', 'Windows'. + * + * @param authenticationType the authenticationType value to set + * @return the SapHanaLinkedService object itself. + */ + public SapHanaLinkedService withAuthenticationType(SapHanaAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get username to access the SAP HANA server. Type: string (or Expression with resultType string). + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set username to access the SAP HANA server. Type: string (or Expression with resultType string). + * + * @param userName the userName value to set + * @return the SapHanaLinkedService object itself. + */ + public SapHanaLinkedService withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get password to access the SAP HANA server. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password to access the SAP HANA server. + * + * @param password the password value to set + * @return the SapHanaLinkedService object itself. + */ + public SapHanaLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SapHanaLinkedService object itself. + */ + public SapHanaLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ScheduleTrigger.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ScheduleTrigger.java new file mode 100644 index 000000000000..4bb3bd54dcf9 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ScheduleTrigger.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Trigger that creates pipeline runs periodically, on schedule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ScheduleTrigger") +@JsonFlatten +public class ScheduleTrigger extends MultiplePipelineTrigger { + /** + * Recurrence schedule configuration. + */ + @JsonProperty(value = "typeProperties.recurrence", required = true) + private ScheduleTriggerRecurrence recurrence; + + /** + * Get recurrence schedule configuration. + * + * @return the recurrence value + */ + public ScheduleTriggerRecurrence recurrence() { + return this.recurrence; + } + + /** + * Set recurrence schedule configuration. + * + * @param recurrence the recurrence value to set + * @return the ScheduleTrigger object itself. + */ + public ScheduleTrigger withRecurrence(ScheduleTriggerRecurrence recurrence) { + this.recurrence = recurrence; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ScheduleTriggerRecurrence.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ScheduleTriggerRecurrence.java new file mode 100644 index 000000000000..25606de76a8e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ScheduleTriggerRecurrence.java @@ -0,0 +1,202 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The workflow trigger recurrence. + */ +public class ScheduleTriggerRecurrence { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The frequency. Possible values include: 'NotSpecified', 'Minute', + * 'Hour', 'Day', 'Week', 'Month', 'Year'. + */ + @JsonProperty(value = "frequency") + private RecurrenceFrequency frequency; + + /** + * The interval. + */ + @JsonProperty(value = "interval") + private Integer interval; + + /** + * The start time. + */ + @JsonProperty(value = "startTime") + private DateTime startTime; + + /** + * The end time. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * The time zone. + */ + @JsonProperty(value = "timeZone") + private String timeZone; + + /** + * The recurrence schedule. + */ + @JsonProperty(value = "schedule") + private RecurrenceSchedule schedule; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ScheduleTriggerRecurrence object itself. + */ + public ScheduleTriggerRecurrence withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the frequency. Possible values include: 'NotSpecified', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year'. + * + * @return the frequency value + */ + public RecurrenceFrequency frequency() { + return this.frequency; + } + + /** + * Set the frequency. Possible values include: 'NotSpecified', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year'. + * + * @param frequency the frequency value to set + * @return the ScheduleTriggerRecurrence object itself. + */ + public ScheduleTriggerRecurrence withFrequency(RecurrenceFrequency frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the interval. + * + * @return the interval value + */ + public Integer interval() { + return this.interval; + } + + /** + * Set the interval. + * + * @param interval the interval value to set + * @return the ScheduleTriggerRecurrence object itself. + */ + public ScheduleTriggerRecurrence withInterval(Integer interval) { + this.interval = interval; + return this; + } + + /** + * Get the start time. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the start time. + * + * @param startTime the startTime value to set + * @return the ScheduleTriggerRecurrence object itself. + */ + public ScheduleTriggerRecurrence withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the end time. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set the end time. + * + * @param endTime the endTime value to set + * @return the ScheduleTriggerRecurrence object itself. + */ + public ScheduleTriggerRecurrence withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the time zone. + * + * @return the timeZone value + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the time zone. + * + * @param timeZone the timeZone value to set + * @return the ScheduleTriggerRecurrence object itself. + */ + public ScheduleTriggerRecurrence withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the recurrence schedule. + * + * @return the schedule value + */ + public RecurrenceSchedule schedule() { + return this.schedule; + } + + /** + * Set the recurrence schedule. + * + * @param schedule the schedule value to set + * @return the ScheduleTriggerRecurrence object itself. + */ + public ScheduleTriggerRecurrence withSchedule(RecurrenceSchedule schedule) { + this.schedule = schedule; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SecretBase.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SecretBase.java new file mode 100644 index 000000000000..43b5cec7e1da --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SecretBase.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The base definition of a secret type. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SecretBase") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "SecureString", value = SecureString.class), + @JsonSubTypes.Type(name = "AzureKeyVaultSecret", value = AzureKeyVaultSecretReference.class) +}) +public class SecretBase { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SecureString.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SecureString.java new file mode 100644 index 000000000000..79b5b88ef225 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SecureString.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Azure Data Factory secure string definition. The string value will be masked + * with asterisks '*' during Get or List API calls. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SecureString") +public class SecureString extends SecretBase { + /** + * Value of secure string. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get value of secure string. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set value of secure string. + * + * @param value the value value to set + * @return the SecureString object itself. + */ + public SecureString withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntime.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntime.java new file mode 100644 index 000000000000..c3372bf214e4 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntime.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.IntegrationRuntimeInner; + +/** + * Self-hosted integration runtime. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SelfHosted") +@JsonFlatten +public class SelfHostedIntegrationRuntime extends IntegrationRuntimeInner { + /** + * The linkedInfo property. + */ + @JsonProperty(value = "typeProperties.linkedInfo") + private LinkedIntegrationRuntimeProperties linkedInfo; + + /** + * Get the linkedInfo value. + * + * @return the linkedInfo value + */ + public LinkedIntegrationRuntimeProperties linkedInfo() { + return this.linkedInfo; + } + + /** + * Set the linkedInfo value. + * + * @param linkedInfo the linkedInfo value to set + * @return the SelfHostedIntegrationRuntime object itself. + */ + public SelfHostedIntegrationRuntime withLinkedInfo(LinkedIntegrationRuntimeProperties linkedInfo) { + this.linkedInfo = linkedInfo; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntimeNode.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntimeNode.java new file mode 100644 index 000000000000..d2594de3f3c3 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntimeNode.java @@ -0,0 +1,112 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.SelfHostedIntegrationRuntimeNodeInner; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing SelfHostedIntegrationRuntimeNode. + */ +public interface SelfHostedIntegrationRuntimeNode extends HasInner, HasManager { + /** + * @return the capabilities value. + */ + Map capabilities(); + + /** + * @return the concurrentJobsLimit value. + */ + Integer concurrentJobsLimit(); + + /** + * @return the expiryTime value. + */ + DateTime expiryTime(); + + /** + * @return the hostServiceUri value. + */ + String hostServiceUri(); + + /** + * @return the isActiveDispatcher value. + */ + Boolean isActiveDispatcher(); + + /** + * @return the lastConnectTime value. + */ + DateTime lastConnectTime(); + + /** + * @return the lastEndUpdateTime value. + */ + DateTime lastEndUpdateTime(); + + /** + * @return the lastStartTime value. + */ + DateTime lastStartTime(); + + /** + * @return the lastStartUpdateTime value. + */ + DateTime lastStartUpdateTime(); + + /** + * @return the lastStopTime value. + */ + DateTime lastStopTime(); + + /** + * @return the lastUpdateResult value. + */ + IntegrationRuntimeUpdateResult lastUpdateResult(); + + /** + * @return the machineName value. + */ + String machineName(); + + /** + * @return the maxConcurrentJobs value. + */ + Integer maxConcurrentJobs(); + + /** + * @return the nodeName value. + */ + String nodeName(); + + /** + * @return the registerTime value. + */ + DateTime registerTime(); + + /** + * @return the status value. + */ + SelfHostedIntegrationRuntimeNodeStatus status(); + + /** + * @return the version value. + */ + String version(); + + /** + * @return the versionStatus value. + */ + String versionStatus(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntimeNodeStatus.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntimeNodeStatus.java new file mode 100644 index 000000000000..7125300b2cc5 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntimeNodeStatus.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SelfHostedIntegrationRuntimeNodeStatus. + */ +public final class SelfHostedIntegrationRuntimeNodeStatus extends ExpandableStringEnum { + /** Static value NeedRegistration for SelfHostedIntegrationRuntimeNodeStatus. */ + public static final SelfHostedIntegrationRuntimeNodeStatus NEED_REGISTRATION = fromString("NeedRegistration"); + + /** Static value Online for SelfHostedIntegrationRuntimeNodeStatus. */ + public static final SelfHostedIntegrationRuntimeNodeStatus ONLINE = fromString("Online"); + + /** Static value Limited for SelfHostedIntegrationRuntimeNodeStatus. */ + public static final SelfHostedIntegrationRuntimeNodeStatus LIMITED = fromString("Limited"); + + /** Static value Offline for SelfHostedIntegrationRuntimeNodeStatus. */ + public static final SelfHostedIntegrationRuntimeNodeStatus OFFLINE = fromString("Offline"); + + /** Static value Upgrading for SelfHostedIntegrationRuntimeNodeStatus. */ + public static final SelfHostedIntegrationRuntimeNodeStatus UPGRADING = fromString("Upgrading"); + + /** Static value Initializing for SelfHostedIntegrationRuntimeNodeStatus. */ + public static final SelfHostedIntegrationRuntimeNodeStatus INITIALIZING = fromString("Initializing"); + + /** Static value InitializeFailed for SelfHostedIntegrationRuntimeNodeStatus. */ + public static final SelfHostedIntegrationRuntimeNodeStatus INITIALIZE_FAILED = fromString("InitializeFailed"); + + /** + * Creates or finds a SelfHostedIntegrationRuntimeNodeStatus from its string representation. + * @param name a name to look for + * @return the corresponding SelfHostedIntegrationRuntimeNodeStatus + */ + @JsonCreator + public static SelfHostedIntegrationRuntimeNodeStatus fromString(String name) { + return fromString(name, SelfHostedIntegrationRuntimeNodeStatus.class); + } + + /** + * @return known SelfHostedIntegrationRuntimeNodeStatus values + */ + public static Collection values() { + return values(SelfHostedIntegrationRuntimeNodeStatus.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntimeStatus.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntimeStatus.java new file mode 100644 index 000000000000..6b3e120a41f1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SelfHostedIntegrationRuntimeStatus.java @@ -0,0 +1,252 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.SelfHostedIntegrationRuntimeNodeInner; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Self-hosted integration runtime status. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SelfHosted") +@JsonFlatten +public class SelfHostedIntegrationRuntimeStatus extends IntegrationRuntimeStatus { + /** + * The time at which the integration runtime was created, in ISO8601 + * format. + */ + @JsonProperty(value = "typeProperties.createTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createTime; + + /** + * The task queue id of the integration runtime. + */ + @JsonProperty(value = "typeProperties.taskQueueId", access = JsonProperty.Access.WRITE_ONLY) + private String taskQueueId; + + /** + * It is used to set the encryption mode for node-node communication + * channel (when more than 2 self-hosted integration runtime nodes exist). + * Possible values include: 'NotSet', 'SslEncrypted', 'NotEncrypted'. + */ + @JsonProperty(value = "typeProperties.internalChannelEncryption", access = JsonProperty.Access.WRITE_ONLY) + private IntegrationRuntimeInternalChannelEncryptionMode internalChannelEncryption; + + /** + * Version of the integration runtime. + */ + @JsonProperty(value = "typeProperties.version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * The list of nodes for this integration runtime. + */ + @JsonProperty(value = "typeProperties.nodes") + private List nodes; + + /** + * The date at which the integration runtime will be scheduled to update, + * in ISO8601 format. + */ + @JsonProperty(value = "typeProperties.scheduledUpdateDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime scheduledUpdateDate; + + /** + * The time in the date scheduled by service to update the integration + * runtime, e.g., PT03H is 3 hours. + */ + @JsonProperty(value = "typeProperties.updateDelayOffset", access = JsonProperty.Access.WRITE_ONLY) + private String updateDelayOffset; + + /** + * The local time zone offset in hours. + */ + @JsonProperty(value = "typeProperties.localTimeZoneOffset", access = JsonProperty.Access.WRITE_ONLY) + private String localTimeZoneOffset; + + /** + * Object with additional information about integration runtime + * capabilities. + */ + @JsonProperty(value = "typeProperties.capabilities", access = JsonProperty.Access.WRITE_ONLY) + private Map capabilities; + + /** + * The URLs for the services used in integration runtime backend service. + */ + @JsonProperty(value = "typeProperties.serviceUrls", access = JsonProperty.Access.WRITE_ONLY) + private List serviceUrls; + + /** + * Whether Self-hosted integration runtime auto update has been turned on. + * Possible values include: 'On', 'Off'. + */ + @JsonProperty(value = "typeProperties.autoUpdate", access = JsonProperty.Access.WRITE_ONLY) + private IntegrationRuntimeAutoUpdate autoUpdate; + + /** + * Status of the integration runtime version. + */ + @JsonProperty(value = "typeProperties.versionStatus", access = JsonProperty.Access.WRITE_ONLY) + private String versionStatus; + + /** + * The list of linked integration runtimes that are created to share with + * this integration runtime. + */ + @JsonProperty(value = "typeProperties.links") + private List links; + + /** + * Get the time at which the integration runtime was created, in ISO8601 format. + * + * @return the createTime value + */ + public DateTime createTime() { + return this.createTime; + } + + /** + * Get the task queue id of the integration runtime. + * + * @return the taskQueueId value + */ + public String taskQueueId() { + return this.taskQueueId; + } + + /** + * Get it is used to set the encryption mode for node-node communication channel (when more than 2 self-hosted integration runtime nodes exist). Possible values include: 'NotSet', 'SslEncrypted', 'NotEncrypted'. + * + * @return the internalChannelEncryption value + */ + public IntegrationRuntimeInternalChannelEncryptionMode internalChannelEncryption() { + return this.internalChannelEncryption; + } + + /** + * Get version of the integration runtime. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Get the list of nodes for this integration runtime. + * + * @return the nodes value + */ + public List nodes() { + return this.nodes; + } + + /** + * Set the list of nodes for this integration runtime. + * + * @param nodes the nodes value to set + * @return the SelfHostedIntegrationRuntimeStatus object itself. + */ + public SelfHostedIntegrationRuntimeStatus withNodes(List nodes) { + this.nodes = nodes; + return this; + } + + /** + * Get the date at which the integration runtime will be scheduled to update, in ISO8601 format. + * + * @return the scheduledUpdateDate value + */ + public DateTime scheduledUpdateDate() { + return this.scheduledUpdateDate; + } + + /** + * Get the time in the date scheduled by service to update the integration runtime, e.g., PT03H is 3 hours. + * + * @return the updateDelayOffset value + */ + public String updateDelayOffset() { + return this.updateDelayOffset; + } + + /** + * Get the local time zone offset in hours. + * + * @return the localTimeZoneOffset value + */ + public String localTimeZoneOffset() { + return this.localTimeZoneOffset; + } + + /** + * Get object with additional information about integration runtime capabilities. + * + * @return the capabilities value + */ + public Map capabilities() { + return this.capabilities; + } + + /** + * Get the URLs for the services used in integration runtime backend service. + * + * @return the serviceUrls value + */ + public List serviceUrls() { + return this.serviceUrls; + } + + /** + * Get whether Self-hosted integration runtime auto update has been turned on. Possible values include: 'On', 'Off'. + * + * @return the autoUpdate value + */ + public IntegrationRuntimeAutoUpdate autoUpdate() { + return this.autoUpdate; + } + + /** + * Get status of the integration runtime version. + * + * @return the versionStatus value + */ + public String versionStatus() { + return this.versionStatus; + } + + /** + * Get the list of linked integration runtimes that are created to share with this integration runtime. + * + * @return the links value + */ + public List links() { + return this.links; + } + + /** + * Set the list of linked integration runtimes that are created to share with this integration runtime. + * + * @param links the links value to set + * @return the SelfHostedIntegrationRuntimeStatus object itself. + */ + public SelfHostedIntegrationRuntimeStatus withLinks(List links) { + this.links = links; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowAuthenticationType.java new file mode 100644 index 000000000000..378a8c6fdcfb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ServiceNowAuthenticationType. + */ +public final class ServiceNowAuthenticationType extends ExpandableStringEnum { + /** Static value Basic for ServiceNowAuthenticationType. */ + public static final ServiceNowAuthenticationType BASIC = fromString("Basic"); + + /** Static value OAuth2 for ServiceNowAuthenticationType. */ + public static final ServiceNowAuthenticationType OAUTH2 = fromString("OAuth2"); + + /** + * Creates or finds a ServiceNowAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding ServiceNowAuthenticationType + */ + @JsonCreator + public static ServiceNowAuthenticationType fromString(String name) { + return fromString(name, ServiceNowAuthenticationType.class); + } + + /** + * @return known ServiceNowAuthenticationType values + */ + public static Collection values() { + return values(ServiceNowAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowLinkedService.java new file mode 100644 index 000000000000..d3d8a44c3221 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowLinkedService.java @@ -0,0 +1,294 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * ServiceNow server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ServiceNow") +@JsonFlatten +public class ServiceNowLinkedService extends LinkedServiceInner { + /** + * The endpoint of the ServiceNow server. (i.e. + * <instance>.service-now.com). + */ + @JsonProperty(value = "typeProperties.endpoint", required = true) + private Object endpoint; + + /** + * The authentication type to use. Possible values include: 'Basic', + * 'OAuth2'. + */ + @JsonProperty(value = "typeProperties.authenticationType", required = true) + private ServiceNowAuthenticationType authenticationType; + + /** + * The user name used to connect to the ServiceNow server for Basic and + * OAuth2 authentication. + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * The password corresponding to the user name for Basic and OAuth2 + * authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The client id for OAuth2 authentication. + */ + @JsonProperty(value = "typeProperties.clientId") + private Object clientId; + + /** + * The client secret for OAuth2 authentication. + */ + @JsonProperty(value = "typeProperties.clientSecret") + private SecretBase clientSecret; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the endpoint of the ServiceNow server. (i.e. <instance>.service-now.com). + * + * @return the endpoint value + */ + public Object endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint of the ServiceNow server. (i.e. <instance>.service-now.com). + * + * @param endpoint the endpoint value to set + * @return the ServiceNowLinkedService object itself. + */ + public ServiceNowLinkedService withEndpoint(Object endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Get the authentication type to use. Possible values include: 'Basic', 'OAuth2'. + * + * @return the authenticationType value + */ + public ServiceNowAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type to use. Possible values include: 'Basic', 'OAuth2'. + * + * @param authenticationType the authenticationType value to set + * @return the ServiceNowLinkedService object itself. + */ + public ServiceNowLinkedService withAuthenticationType(ServiceNowAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the user name used to connect to the ServiceNow server for Basic and OAuth2 authentication. + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the user name used to connect to the ServiceNow server for Basic and OAuth2 authentication. + * + * @param username the username value to set + * @return the ServiceNowLinkedService object itself. + */ + public ServiceNowLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password corresponding to the user name for Basic and OAuth2 authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password corresponding to the user name for Basic and OAuth2 authentication. + * + * @param password the password value to set + * @return the ServiceNowLinkedService object itself. + */ + public ServiceNowLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the client id for OAuth2 authentication. + * + * @return the clientId value + */ + public Object clientId() { + return this.clientId; + } + + /** + * Set the client id for OAuth2 authentication. + * + * @param clientId the clientId value to set + * @return the ServiceNowLinkedService object itself. + */ + public ServiceNowLinkedService withClientId(Object clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the client secret for OAuth2 authentication. + * + * @return the clientSecret value + */ + public SecretBase clientSecret() { + return this.clientSecret; + } + + /** + * Set the client secret for OAuth2 authentication. + * + * @param clientSecret the clientSecret value to set + * @return the ServiceNowLinkedService object itself. + */ + public ServiceNowLinkedService withClientSecret(SecretBase clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the ServiceNowLinkedService object itself. + */ + public ServiceNowLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the ServiceNowLinkedService object itself. + */ + public ServiceNowLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the ServiceNowLinkedService object itself. + */ + public ServiceNowLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the ServiceNowLinkedService object itself. + */ + public ServiceNowLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowObjectDataset.java new file mode 100644 index 000000000000..3fd0a5bfaf77 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * ServiceNow server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ServiceNowObject") +public class ServiceNowObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowSource.java new file mode 100644 index 000000000000..f3353e1377ae --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ServiceNowSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity ServiceNow server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ServiceNowSource") +public class ServiceNowSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the ServiceNowSource object itself. + */ + public ServiceNowSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SftpAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SftpAuthenticationType.java new file mode 100644 index 000000000000..c8a45939c298 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SftpAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SftpAuthenticationType. + */ +public final class SftpAuthenticationType extends ExpandableStringEnum { + /** Static value Basic for SftpAuthenticationType. */ + public static final SftpAuthenticationType BASIC = fromString("Basic"); + + /** Static value SshPublicKey for SftpAuthenticationType. */ + public static final SftpAuthenticationType SSH_PUBLIC_KEY = fromString("SshPublicKey"); + + /** + * Creates or finds a SftpAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding SftpAuthenticationType + */ + @JsonCreator + public static SftpAuthenticationType fromString(String name) { + return fromString(name, SftpAuthenticationType.class); + } + + /** + * @return known SftpAuthenticationType values + */ + public static Collection values() { + return values(SftpAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SftpServerLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SftpServerLinkedService.java new file mode 100644 index 000000000000..f544bbd89ce0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SftpServerLinkedService.java @@ -0,0 +1,328 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * A linked service for an SSH File Transfer Protocol (SFTP) server. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Sftp") +@JsonFlatten +public class SftpServerLinkedService extends LinkedServiceInner { + /** + * The SFTP server host name. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The TCP port number that the SFTP server uses to listen for client + * connections. Default value is 22. Type: integer (or Expression with + * resultType integer), minimum: 0. + */ + @JsonProperty(value = "typeProperties.port") + private Object port; + + /** + * The authentication type to be used to connect to the FTP server. + * Possible values include: 'Basic', 'SshPublicKey'. + */ + @JsonProperty(value = "typeProperties.authenticationType") + private SftpAuthenticationType authenticationType; + + /** + * The username used to log on to the SFTP server. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.userName") + private Object userName; + + /** + * Password to logon the SFTP server for Basic authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * The SSH private key file path for SshPublicKey authentication. Only + * valid for on-premises copy. For on-premises copy with SshPublicKey + * authentication, either PrivateKeyPath or PrivateKeyContent should be + * specified. SSH private key should be OpenSSH format. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.privateKeyPath") + private Object privateKeyPath; + + /** + * Base64 encoded SSH private key content for SshPublicKey authentication. + * For on-premises copy with SshPublicKey authentication, either + * PrivateKeyPath or PrivateKeyContent should be specified. SSH private key + * should be OpenSSH format. + */ + @JsonProperty(value = "typeProperties.privateKeyContent") + private SecretBase privateKeyContent; + + /** + * The password to decrypt the SSH private key if the SSH private key is + * encrypted. + */ + @JsonProperty(value = "typeProperties.passPhrase") + private SecretBase passPhrase; + + /** + * If true, skip the SSH host key validation. Default value is false. Type: + * boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "typeProperties.skipHostKeyValidation") + private Object skipHostKeyValidation; + + /** + * The host key finger-print of the SFTP server. When SkipHostKeyValidation + * is false, HostKeyFingerprint should be specified. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.hostKeyFingerprint") + private Object hostKeyFingerprint; + + /** + * Get the SFTP server host name. Type: string (or Expression with resultType string). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the SFTP server host name. Type: string (or Expression with resultType string). + * + * @param host the host value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the TCP port number that the SFTP server uses to listen for client connections. Default value is 22. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port number that the SFTP server uses to listen for client connections. Default value is 22. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param port the port value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the authentication type to be used to connect to the FTP server. Possible values include: 'Basic', 'SshPublicKey'. + * + * @return the authenticationType value + */ + public SftpAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication type to be used to connect to the FTP server. Possible values include: 'Basic', 'SshPublicKey'. + * + * @param authenticationType the authenticationType value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withAuthenticationType(SftpAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the username used to log on to the SFTP server. Type: string (or Expression with resultType string). + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set the username used to log on to the SFTP server. Type: string (or Expression with resultType string). + * + * @param userName the userName value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get password to logon the SFTP server for Basic authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password to logon the SFTP server for Basic authentication. + * + * @param password the password value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + + /** + * Get the SSH private key file path for SshPublicKey authentication. Only valid for on-premises copy. For on-premises copy with SshPublicKey authentication, either PrivateKeyPath or PrivateKeyContent should be specified. SSH private key should be OpenSSH format. Type: string (or Expression with resultType string). + * + * @return the privateKeyPath value + */ + public Object privateKeyPath() { + return this.privateKeyPath; + } + + /** + * Set the SSH private key file path for SshPublicKey authentication. Only valid for on-premises copy. For on-premises copy with SshPublicKey authentication, either PrivateKeyPath or PrivateKeyContent should be specified. SSH private key should be OpenSSH format. Type: string (or Expression with resultType string). + * + * @param privateKeyPath the privateKeyPath value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withPrivateKeyPath(Object privateKeyPath) { + this.privateKeyPath = privateKeyPath; + return this; + } + + /** + * Get base64 encoded SSH private key content for SshPublicKey authentication. For on-premises copy with SshPublicKey authentication, either PrivateKeyPath or PrivateKeyContent should be specified. SSH private key should be OpenSSH format. + * + * @return the privateKeyContent value + */ + public SecretBase privateKeyContent() { + return this.privateKeyContent; + } + + /** + * Set base64 encoded SSH private key content for SshPublicKey authentication. For on-premises copy with SshPublicKey authentication, either PrivateKeyPath or PrivateKeyContent should be specified. SSH private key should be OpenSSH format. + * + * @param privateKeyContent the privateKeyContent value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withPrivateKeyContent(SecretBase privateKeyContent) { + this.privateKeyContent = privateKeyContent; + return this; + } + + /** + * Get the password to decrypt the SSH private key if the SSH private key is encrypted. + * + * @return the passPhrase value + */ + public SecretBase passPhrase() { + return this.passPhrase; + } + + /** + * Set the password to decrypt the SSH private key if the SSH private key is encrypted. + * + * @param passPhrase the passPhrase value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withPassPhrase(SecretBase passPhrase) { + this.passPhrase = passPhrase; + return this; + } + + /** + * Get if true, skip the SSH host key validation. Default value is false. Type: boolean (or Expression with resultType boolean). + * + * @return the skipHostKeyValidation value + */ + public Object skipHostKeyValidation() { + return this.skipHostKeyValidation; + } + + /** + * Set if true, skip the SSH host key validation. Default value is false. Type: boolean (or Expression with resultType boolean). + * + * @param skipHostKeyValidation the skipHostKeyValidation value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withSkipHostKeyValidation(Object skipHostKeyValidation) { + this.skipHostKeyValidation = skipHostKeyValidation; + return this; + } + + /** + * Get the host key finger-print of the SFTP server. When SkipHostKeyValidation is false, HostKeyFingerprint should be specified. Type: string (or Expression with resultType string). + * + * @return the hostKeyFingerprint value + */ + public Object hostKeyFingerprint() { + return this.hostKeyFingerprint; + } + + /** + * Set the host key finger-print of the SFTP server. When SkipHostKeyValidation is false, HostKeyFingerprint should be specified. Type: string (or Expression with resultType string). + * + * @param hostKeyFingerprint the hostKeyFingerprint value to set + * @return the SftpServerLinkedService object itself. + */ + public SftpServerLinkedService withHostKeyFingerprint(Object hostKeyFingerprint) { + this.hostKeyFingerprint = hostKeyFingerprint; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ShopifyLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ShopifyLinkedService.java new file mode 100644 index 000000000000..d69682c5b875 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ShopifyLinkedService.java @@ -0,0 +1,187 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Shopify Service linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Shopify") +@JsonFlatten +public class ShopifyLinkedService extends LinkedServiceInner { + /** + * The endpoint of the Shopify server. (i.e. mystore.myshopify.com). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The API access token that can be used to access Shopify’s data. The + * token won't expire if it is offline mode. + */ + @JsonProperty(value = "typeProperties.accessToken") + private SecretBase accessToken; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the endpoint of the Shopify server. (i.e. mystore.myshopify.com). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the endpoint of the Shopify server. (i.e. mystore.myshopify.com). + * + * @param host the host value to set + * @return the ShopifyLinkedService object itself. + */ + public ShopifyLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the API access token that can be used to access Shopify’s data. The token won't expire if it is offline mode. + * + * @return the accessToken value + */ + public SecretBase accessToken() { + return this.accessToken; + } + + /** + * Set the API access token that can be used to access Shopify’s data. The token won't expire if it is offline mode. + * + * @param accessToken the accessToken value to set + * @return the ShopifyLinkedService object itself. + */ + public ShopifyLinkedService withAccessToken(SecretBase accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the ShopifyLinkedService object itself. + */ + public ShopifyLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the ShopifyLinkedService object itself. + */ + public ShopifyLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the ShopifyLinkedService object itself. + */ + public ShopifyLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the ShopifyLinkedService object itself. + */ + public ShopifyLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ShopifyObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ShopifyObjectDataset.java new file mode 100644 index 000000000000..207a9e480386 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ShopifyObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Shopify Service dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ShopifyObject") +public class ShopifyObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ShopifySource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ShopifySource.java new file mode 100644 index 000000000000..be4f887b9547 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ShopifySource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Shopify Service source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ShopifySource") +public class ShopifySource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the ShopifySource object itself. + */ + public ShopifySource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkAuthenticationType.java new file mode 100644 index 000000000000..00f6b8bae7a4 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkAuthenticationType.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SparkAuthenticationType. + */ +public final class SparkAuthenticationType extends ExpandableStringEnum { + /** Static value Anonymous for SparkAuthenticationType. */ + public static final SparkAuthenticationType ANONYMOUS = fromString("Anonymous"); + + /** Static value Username for SparkAuthenticationType. */ + public static final SparkAuthenticationType USERNAME = fromString("Username"); + + /** Static value UsernameAndPassword for SparkAuthenticationType. */ + public static final SparkAuthenticationType USERNAME_AND_PASSWORD = fromString("UsernameAndPassword"); + + /** Static value WindowsAzureHDInsightService for SparkAuthenticationType. */ + public static final SparkAuthenticationType WINDOWS_AZURE_HDINSIGHT_SERVICE = fromString("WindowsAzureHDInsightService"); + + /** + * Creates or finds a SparkAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding SparkAuthenticationType + */ + @JsonCreator + public static SparkAuthenticationType fromString(String name) { + return fromString(name, SparkAuthenticationType.class); + } + + /** + * @return known SparkAuthenticationType values + */ + public static Collection values() { + return values(SparkAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkLinkedService.java new file mode 100644 index 000000000000..69fd7b5b3090 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkLinkedService.java @@ -0,0 +1,404 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Spark Server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Spark") +@JsonFlatten +public class SparkLinkedService extends LinkedServiceInner { + /** + * IP address or host name of the Spark server. + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The TCP port that the Spark server uses to listen for client + * connections. + */ + @JsonProperty(value = "typeProperties.port", required = true) + private Object port; + + /** + * The type of Spark server. Possible values include: 'SharkServer', + * 'SharkServer2', 'SparkThriftServer'. + */ + @JsonProperty(value = "typeProperties.serverType") + private SparkServerType serverType; + + /** + * The transport protocol to use in the Thrift layer. Possible values + * include: 'Binary', 'SASL', 'HTTP '. + */ + @JsonProperty(value = "typeProperties.thriftTransportProtocol") + private SparkThriftTransportProtocol thriftTransportProtocol; + + /** + * The authentication method used to access the Spark server. Possible + * values include: 'Anonymous', 'Username', 'UsernameAndPassword', + * 'WindowsAzureHDInsightService'. + */ + @JsonProperty(value = "typeProperties.authenticationType", required = true) + private SparkAuthenticationType authenticationType; + + /** + * The user name that you use to access Spark Server. + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * The password corresponding to the user name that you provided in the + * Username field. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The partial URL corresponding to the Spark server. + */ + @JsonProperty(value = "typeProperties.httpPath") + private Object httpPath; + + /** + * Specifies whether the connections to the server are encrypted using SSL. + * The default value is false. + */ + @JsonProperty(value = "typeProperties.enableSsl") + private Object enableSsl; + + /** + * The full path of the .pem file containing trusted CA certificates for + * verifying the server when connecting over SSL. This property can only be + * set when using SSL on self-hosted IR. The default value is the + * cacerts.pem file installed with the IR. + */ + @JsonProperty(value = "typeProperties.trustedCertPath") + private Object trustedCertPath; + + /** + * Specifies whether to use a CA certificate from the system trust store or + * from a specified PEM file. The default value is false. + */ + @JsonProperty(value = "typeProperties.useSystemTrustStore") + private Object useSystemTrustStore; + + /** + * Specifies whether to require a CA-issued SSL certificate name to match + * the host name of the server when connecting over SSL. The default value + * is false. + */ + @JsonProperty(value = "typeProperties.allowHostNameCNMismatch") + private Object allowHostNameCNMismatch; + + /** + * Specifies whether to allow self-signed certificates from the server. The + * default value is false. + */ + @JsonProperty(value = "typeProperties.allowSelfSignedServerCert") + private Object allowSelfSignedServerCert; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get iP address or host name of the Spark server. + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set iP address or host name of the Spark server. + * + * @param host the host value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the TCP port that the Spark server uses to listen for client connections. + * + * @return the port value + */ + public Object port() { + return this.port; + } + + /** + * Set the TCP port that the Spark server uses to listen for client connections. + * + * @param port the port value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withPort(Object port) { + this.port = port; + return this; + } + + /** + * Get the type of Spark server. Possible values include: 'SharkServer', 'SharkServer2', 'SparkThriftServer'. + * + * @return the serverType value + */ + public SparkServerType serverType() { + return this.serverType; + } + + /** + * Set the type of Spark server. Possible values include: 'SharkServer', 'SharkServer2', 'SparkThriftServer'. + * + * @param serverType the serverType value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withServerType(SparkServerType serverType) { + this.serverType = serverType; + return this; + } + + /** + * Get the transport protocol to use in the Thrift layer. Possible values include: 'Binary', 'SASL', 'HTTP '. + * + * @return the thriftTransportProtocol value + */ + public SparkThriftTransportProtocol thriftTransportProtocol() { + return this.thriftTransportProtocol; + } + + /** + * Set the transport protocol to use in the Thrift layer. Possible values include: 'Binary', 'SASL', 'HTTP '. + * + * @param thriftTransportProtocol the thriftTransportProtocol value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withThriftTransportProtocol(SparkThriftTransportProtocol thriftTransportProtocol) { + this.thriftTransportProtocol = thriftTransportProtocol; + return this; + } + + /** + * Get the authentication method used to access the Spark server. Possible values include: 'Anonymous', 'Username', 'UsernameAndPassword', 'WindowsAzureHDInsightService'. + * + * @return the authenticationType value + */ + public SparkAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authentication method used to access the Spark server. Possible values include: 'Anonymous', 'Username', 'UsernameAndPassword', 'WindowsAzureHDInsightService'. + * + * @param authenticationType the authenticationType value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withAuthenticationType(SparkAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the user name that you use to access Spark Server. + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set the user name that you use to access Spark Server. + * + * @param username the username value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password corresponding to the user name that you provided in the Username field. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password corresponding to the user name that you provided in the Username field. + * + * @param password the password value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the partial URL corresponding to the Spark server. + * + * @return the httpPath value + */ + public Object httpPath() { + return this.httpPath; + } + + /** + * Set the partial URL corresponding to the Spark server. + * + * @param httpPath the httpPath value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withHttpPath(Object httpPath) { + this.httpPath = httpPath; + return this; + } + + /** + * Get specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @return the enableSsl value + */ + public Object enableSsl() { + return this.enableSsl; + } + + /** + * Set specifies whether the connections to the server are encrypted using SSL. The default value is false. + * + * @param enableSsl the enableSsl value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withEnableSsl(Object enableSsl) { + this.enableSsl = enableSsl; + return this; + } + + /** + * Get the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @return the trustedCertPath value + */ + public Object trustedCertPath() { + return this.trustedCertPath; + } + + /** + * Set the full path of the .pem file containing trusted CA certificates for verifying the server when connecting over SSL. This property can only be set when using SSL on self-hosted IR. The default value is the cacerts.pem file installed with the IR. + * + * @param trustedCertPath the trustedCertPath value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withTrustedCertPath(Object trustedCertPath) { + this.trustedCertPath = trustedCertPath; + return this; + } + + /** + * Get specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @return the useSystemTrustStore value + */ + public Object useSystemTrustStore() { + return this.useSystemTrustStore; + } + + /** + * Set specifies whether to use a CA certificate from the system trust store or from a specified PEM file. The default value is false. + * + * @param useSystemTrustStore the useSystemTrustStore value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withUseSystemTrustStore(Object useSystemTrustStore) { + this.useSystemTrustStore = useSystemTrustStore; + return this; + } + + /** + * Get specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @return the allowHostNameCNMismatch value + */ + public Object allowHostNameCNMismatch() { + return this.allowHostNameCNMismatch; + } + + /** + * Set specifies whether to require a CA-issued SSL certificate name to match the host name of the server when connecting over SSL. The default value is false. + * + * @param allowHostNameCNMismatch the allowHostNameCNMismatch value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withAllowHostNameCNMismatch(Object allowHostNameCNMismatch) { + this.allowHostNameCNMismatch = allowHostNameCNMismatch; + return this; + } + + /** + * Get specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @return the allowSelfSignedServerCert value + */ + public Object allowSelfSignedServerCert() { + return this.allowSelfSignedServerCert; + } + + /** + * Set specifies whether to allow self-signed certificates from the server. The default value is false. + * + * @param allowSelfSignedServerCert the allowSelfSignedServerCert value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withAllowSelfSignedServerCert(Object allowSelfSignedServerCert) { + this.allowSelfSignedServerCert = allowSelfSignedServerCert; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SparkLinkedService object itself. + */ + public SparkLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkObjectDataset.java new file mode 100644 index 000000000000..9fa51eb01d33 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Spark Server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SparkObject") +public class SparkObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkServerType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkServerType.java new file mode 100644 index 000000000000..89fa94095825 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkServerType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SparkServerType. + */ +public final class SparkServerType extends ExpandableStringEnum { + /** Static value SharkServer for SparkServerType. */ + public static final SparkServerType SHARK_SERVER = fromString("SharkServer"); + + /** Static value SharkServer2 for SparkServerType. */ + public static final SparkServerType SHARK_SERVER2 = fromString("SharkServer2"); + + /** Static value SparkThriftServer for SparkServerType. */ + public static final SparkServerType SPARK_THRIFT_SERVER = fromString("SparkThriftServer"); + + /** + * Creates or finds a SparkServerType from its string representation. + * @param name a name to look for + * @return the corresponding SparkServerType + */ + @JsonCreator + public static SparkServerType fromString(String name) { + return fromString(name, SparkServerType.class); + } + + /** + * @return known SparkServerType values + */ + public static Collection values() { + return values(SparkServerType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkSource.java new file mode 100644 index 000000000000..2b6aec144dbe --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Spark Server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SparkSource") +public class SparkSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the SparkSource object itself. + */ + public SparkSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkThriftTransportProtocol.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkThriftTransportProtocol.java new file mode 100644 index 000000000000..39a98704c92b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SparkThriftTransportProtocol.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SparkThriftTransportProtocol. + */ +public final class SparkThriftTransportProtocol extends ExpandableStringEnum { + /** Static value Binary for SparkThriftTransportProtocol. */ + public static final SparkThriftTransportProtocol BINARY = fromString("Binary"); + + /** Static value SASL for SparkThriftTransportProtocol. */ + public static final SparkThriftTransportProtocol SASL = fromString("SASL"); + + /** Static value HTTP for SparkThriftTransportProtocol. */ + public static final SparkThriftTransportProtocol HTTP_ = fromString("HTTP "); + + /** + * Creates or finds a SparkThriftTransportProtocol from its string representation. + * @param name a name to look for + * @return the corresponding SparkThriftTransportProtocol + */ + @JsonCreator + public static SparkThriftTransportProtocol fromString(String name) { + return fromString(name, SparkThriftTransportProtocol.class); + } + + /** + * @return known SparkThriftTransportProtocol values + */ + public static Collection values() { + return values(SparkThriftTransportProtocol.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlDWSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlDWSink.java new file mode 100644 index 000000000000..64f339e108c9 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlDWSink.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity SQL Data Warehouse sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SqlDWSink") +public class SqlDWSink extends CopySink { + /** + * SQL pre-copy script. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "preCopyScript") + private Object preCopyScript; + + /** + * Indicates to use PolyBase to copy data into SQL Data Warehouse when + * applicable. Type: boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "allowPolyBase") + private Object allowPolyBase; + + /** + * Specifies PolyBase-related settings when allowPolyBase is true. + */ + @JsonProperty(value = "polyBaseSettings") + private PolybaseSettings polyBaseSettings; + + /** + * Get sQL pre-copy script. Type: string (or Expression with resultType string). + * + * @return the preCopyScript value + */ + public Object preCopyScript() { + return this.preCopyScript; + } + + /** + * Set sQL pre-copy script. Type: string (or Expression with resultType string). + * + * @param preCopyScript the preCopyScript value to set + * @return the SqlDWSink object itself. + */ + public SqlDWSink withPreCopyScript(Object preCopyScript) { + this.preCopyScript = preCopyScript; + return this; + } + + /** + * Get indicates to use PolyBase to copy data into SQL Data Warehouse when applicable. Type: boolean (or Expression with resultType boolean). + * + * @return the allowPolyBase value + */ + public Object allowPolyBase() { + return this.allowPolyBase; + } + + /** + * Set indicates to use PolyBase to copy data into SQL Data Warehouse when applicable. Type: boolean (or Expression with resultType boolean). + * + * @param allowPolyBase the allowPolyBase value to set + * @return the SqlDWSink object itself. + */ + public SqlDWSink withAllowPolyBase(Object allowPolyBase) { + this.allowPolyBase = allowPolyBase; + return this; + } + + /** + * Get specifies PolyBase-related settings when allowPolyBase is true. + * + * @return the polyBaseSettings value + */ + public PolybaseSettings polyBaseSettings() { + return this.polyBaseSettings; + } + + /** + * Set specifies PolyBase-related settings when allowPolyBase is true. + * + * @param polyBaseSettings the polyBaseSettings value to set + * @return the SqlDWSink object itself. + */ + public SqlDWSink withPolyBaseSettings(PolybaseSettings polyBaseSettings) { + this.polyBaseSettings = polyBaseSettings; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlDWSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlDWSource.java new file mode 100644 index 000000000000..5a094543436b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlDWSource.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity SQL Data Warehouse source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SqlDWSource") +public class SqlDWSource extends CopySource { + /** + * SQL Data Warehouse reader query. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "sqlReaderQuery") + private Object sqlReaderQuery; + + /** + * Name of the stored procedure for a SQL Data Warehouse source. This + * cannot be used at the same time as SqlReaderQuery. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "sqlReaderStoredProcedureName") + private Object sqlReaderStoredProcedureName; + + /** + * Value and type setting for stored procedure parameters. Example: + * "{Parameter1: {value: "1", type: "int"}}". Type: object (or Expression + * with resultType object), itemType: StoredProcedureParameter. + */ + @JsonProperty(value = "storedProcedureParameters") + private Object storedProcedureParameters; + + /** + * Get sQL Data Warehouse reader query. Type: string (or Expression with resultType string). + * + * @return the sqlReaderQuery value + */ + public Object sqlReaderQuery() { + return this.sqlReaderQuery; + } + + /** + * Set sQL Data Warehouse reader query. Type: string (or Expression with resultType string). + * + * @param sqlReaderQuery the sqlReaderQuery value to set + * @return the SqlDWSource object itself. + */ + public SqlDWSource withSqlReaderQuery(Object sqlReaderQuery) { + this.sqlReaderQuery = sqlReaderQuery; + return this; + } + + /** + * Get name of the stored procedure for a SQL Data Warehouse source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string). + * + * @return the sqlReaderStoredProcedureName value + */ + public Object sqlReaderStoredProcedureName() { + return this.sqlReaderStoredProcedureName; + } + + /** + * Set name of the stored procedure for a SQL Data Warehouse source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string). + * + * @param sqlReaderStoredProcedureName the sqlReaderStoredProcedureName value to set + * @return the SqlDWSource object itself. + */ + public SqlDWSource withSqlReaderStoredProcedureName(Object sqlReaderStoredProcedureName) { + this.sqlReaderStoredProcedureName = sqlReaderStoredProcedureName; + return this; + } + + /** + * Get value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". Type: object (or Expression with resultType object), itemType: StoredProcedureParameter. + * + * @return the storedProcedureParameters value + */ + public Object storedProcedureParameters() { + return this.storedProcedureParameters; + } + + /** + * Set value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". Type: object (or Expression with resultType object), itemType: StoredProcedureParameter. + * + * @param storedProcedureParameters the storedProcedureParameters value to set + * @return the SqlDWSource object itself. + */ + public SqlDWSource withStoredProcedureParameters(Object storedProcedureParameters) { + this.storedProcedureParameters = storedProcedureParameters; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlServerLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlServerLinkedService.java new file mode 100644 index 000000000000..d0cbdfa400f5 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlServerLinkedService.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * SQL Server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SqlServer") +@JsonFlatten +public class SqlServerLinkedService extends LinkedServiceInner { + /** + * The connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString", required = true) + private Object connectionString; + + /** + * The on-premises Windows authentication user name. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.userName") + private Object userName; + + /** + * The on-premises Windows authentication password. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set the connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the SqlServerLinkedService object itself. + */ + public SqlServerLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the on-premises Windows authentication user name. Type: string (or Expression with resultType string). + * + * @return the userName value + */ + public Object userName() { + return this.userName; + } + + /** + * Set the on-premises Windows authentication user name. Type: string (or Expression with resultType string). + * + * @param userName the userName value to set + * @return the SqlServerLinkedService object itself. + */ + public SqlServerLinkedService withUserName(Object userName) { + this.userName = userName; + return this; + } + + /** + * Get the on-premises Windows authentication password. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the on-premises Windows authentication password. + * + * @param password the password value to set + * @return the SqlServerLinkedService object itself. + */ + public SqlServerLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SqlServerLinkedService object itself. + */ + public SqlServerLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlServerStoredProcedureActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlServerStoredProcedureActivity.java new file mode 100644 index 000000000000..269fb8c17f04 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlServerStoredProcedureActivity.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * SQL stored procedure activity type. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SqlServerStoredProcedure") +@JsonFlatten +public class SqlServerStoredProcedureActivity extends ExecutionActivity { + /** + * Stored procedure name. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.storedProcedureName", required = true) + private Object storedProcedureName; + + /** + * Value and type setting for stored procedure parameters. Example: + * "{Parameter1: {value: "1", type: "int"}}". + */ + @JsonProperty(value = "typeProperties.storedProcedureParameters") + private Map storedProcedureParameters; + + /** + * Get stored procedure name. Type: string (or Expression with resultType string). + * + * @return the storedProcedureName value + */ + public Object storedProcedureName() { + return this.storedProcedureName; + } + + /** + * Set stored procedure name. Type: string (or Expression with resultType string). + * + * @param storedProcedureName the storedProcedureName value to set + * @return the SqlServerStoredProcedureActivity object itself. + */ + public SqlServerStoredProcedureActivity withStoredProcedureName(Object storedProcedureName) { + this.storedProcedureName = storedProcedureName; + return this; + } + + /** + * Get value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". + * + * @return the storedProcedureParameters value + */ + public Map storedProcedureParameters() { + return this.storedProcedureParameters; + } + + /** + * Set value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". + * + * @param storedProcedureParameters the storedProcedureParameters value to set + * @return the SqlServerStoredProcedureActivity object itself. + */ + public SqlServerStoredProcedureActivity withStoredProcedureParameters(Map storedProcedureParameters) { + this.storedProcedureParameters = storedProcedureParameters; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlServerTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlServerTableDataset.java new file mode 100644 index 000000000000..ef95194f0daa --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlServerTableDataset.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The on-premises SQL Server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SqlServerTable") +@JsonFlatten +public class SqlServerTableDataset extends DatasetInner { + /** + * The table name of the SQL Server dataset. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.tableName", required = true) + private Object tableName; + + /** + * Get the table name of the SQL Server dataset. Type: string (or Expression with resultType string). + * + * @return the tableName value + */ + public Object tableName() { + return this.tableName; + } + + /** + * Set the table name of the SQL Server dataset. Type: string (or Expression with resultType string). + * + * @param tableName the tableName value to set + * @return the SqlServerTableDataset object itself. + */ + public SqlServerTableDataset withTableName(Object tableName) { + this.tableName = tableName; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlSink.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlSink.java new file mode 100644 index 000000000000..e6889b5251b2 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlSink.java @@ -0,0 +1,129 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity SQL sink. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SqlSink") +public class SqlSink extends CopySink { + /** + * SQL writer stored procedure name. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "sqlWriterStoredProcedureName") + private Object sqlWriterStoredProcedureName; + + /** + * SQL writer table type. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "sqlWriterTableType") + private Object sqlWriterTableType; + + /** + * SQL pre-copy script. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "preCopyScript") + private Object preCopyScript; + + /** + * SQL stored procedure parameters. + */ + @JsonProperty(value = "storedProcedureParameters") + private Map storedProcedureParameters; + + /** + * Get sQL writer stored procedure name. Type: string (or Expression with resultType string). + * + * @return the sqlWriterStoredProcedureName value + */ + public Object sqlWriterStoredProcedureName() { + return this.sqlWriterStoredProcedureName; + } + + /** + * Set sQL writer stored procedure name. Type: string (or Expression with resultType string). + * + * @param sqlWriterStoredProcedureName the sqlWriterStoredProcedureName value to set + * @return the SqlSink object itself. + */ + public SqlSink withSqlWriterStoredProcedureName(Object sqlWriterStoredProcedureName) { + this.sqlWriterStoredProcedureName = sqlWriterStoredProcedureName; + return this; + } + + /** + * Get sQL writer table type. Type: string (or Expression with resultType string). + * + * @return the sqlWriterTableType value + */ + public Object sqlWriterTableType() { + return this.sqlWriterTableType; + } + + /** + * Set sQL writer table type. Type: string (or Expression with resultType string). + * + * @param sqlWriterTableType the sqlWriterTableType value to set + * @return the SqlSink object itself. + */ + public SqlSink withSqlWriterTableType(Object sqlWriterTableType) { + this.sqlWriterTableType = sqlWriterTableType; + return this; + } + + /** + * Get sQL pre-copy script. Type: string (or Expression with resultType string). + * + * @return the preCopyScript value + */ + public Object preCopyScript() { + return this.preCopyScript; + } + + /** + * Set sQL pre-copy script. Type: string (or Expression with resultType string). + * + * @param preCopyScript the preCopyScript value to set + * @return the SqlSink object itself. + */ + public SqlSink withPreCopyScript(Object preCopyScript) { + this.preCopyScript = preCopyScript; + return this; + } + + /** + * Get sQL stored procedure parameters. + * + * @return the storedProcedureParameters value + */ + public Map storedProcedureParameters() { + return this.storedProcedureParameters; + } + + /** + * Set sQL stored procedure parameters. + * + * @param storedProcedureParameters the storedProcedureParameters value to set + * @return the SqlSink object itself. + */ + public SqlSink withStoredProcedureParameters(Map storedProcedureParameters) { + this.storedProcedureParameters = storedProcedureParameters; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlSource.java new file mode 100644 index 000000000000..12f0e1ac8dd7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SqlSource.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity SQL source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SqlSource") +public class SqlSource extends CopySource { + /** + * SQL reader query. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "sqlReaderQuery") + private Object sqlReaderQuery; + + /** + * Name of the stored procedure for a SQL Database source. This cannot be + * used at the same time as SqlReaderQuery. Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "sqlReaderStoredProcedureName") + private Object sqlReaderStoredProcedureName; + + /** + * Value and type setting for stored procedure parameters. Example: + * "{Parameter1: {value: "1", type: "int"}}". + */ + @JsonProperty(value = "storedProcedureParameters") + private Map storedProcedureParameters; + + /** + * Get sQL reader query. Type: string (or Expression with resultType string). + * + * @return the sqlReaderQuery value + */ + public Object sqlReaderQuery() { + return this.sqlReaderQuery; + } + + /** + * Set sQL reader query. Type: string (or Expression with resultType string). + * + * @param sqlReaderQuery the sqlReaderQuery value to set + * @return the SqlSource object itself. + */ + public SqlSource withSqlReaderQuery(Object sqlReaderQuery) { + this.sqlReaderQuery = sqlReaderQuery; + return this; + } + + /** + * Get name of the stored procedure for a SQL Database source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string). + * + * @return the sqlReaderStoredProcedureName value + */ + public Object sqlReaderStoredProcedureName() { + return this.sqlReaderStoredProcedureName; + } + + /** + * Set name of the stored procedure for a SQL Database source. This cannot be used at the same time as SqlReaderQuery. Type: string (or Expression with resultType string). + * + * @param sqlReaderStoredProcedureName the sqlReaderStoredProcedureName value to set + * @return the SqlSource object itself. + */ + public SqlSource withSqlReaderStoredProcedureName(Object sqlReaderStoredProcedureName) { + this.sqlReaderStoredProcedureName = sqlReaderStoredProcedureName; + return this; + } + + /** + * Get value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". + * + * @return the storedProcedureParameters value + */ + public Map storedProcedureParameters() { + return this.storedProcedureParameters; + } + + /** + * Set value and type setting for stored procedure parameters. Example: "{Parameter1: {value: "1", type: "int"}}". + * + * @param storedProcedureParameters the storedProcedureParameters value to set + * @return the SqlSource object itself. + */ + public SqlSource withStoredProcedureParameters(Map storedProcedureParameters) { + this.storedProcedureParameters = storedProcedureParameters; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SquareLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SquareLinkedService.java new file mode 100644 index 000000000000..64a0bb7ea94f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SquareLinkedService.java @@ -0,0 +1,239 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Square Service linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Square") +@JsonFlatten +public class SquareLinkedService extends LinkedServiceInner { + /** + * The URL of the Square instance. (i.e. mystore.mysquare.com). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The client ID associated with your Square application. + */ + @JsonProperty(value = "typeProperties.clientId", required = true) + private Object clientId; + + /** + * The client secret associated with your Square application. + */ + @JsonProperty(value = "typeProperties.clientSecret") + private SecretBase clientSecret; + + /** + * The redirect URL assigned in the Square application dashboard. (i.e. + * http://localhost:2500). + */ + @JsonProperty(value = "typeProperties.redirectUri", required = true) + private Object redirectUri; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the URL of the Square instance. (i.e. mystore.mysquare.com). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the URL of the Square instance. (i.e. mystore.mysquare.com). + * + * @param host the host value to set + * @return the SquareLinkedService object itself. + */ + public SquareLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the client ID associated with your Square application. + * + * @return the clientId value + */ + public Object clientId() { + return this.clientId; + } + + /** + * Set the client ID associated with your Square application. + * + * @param clientId the clientId value to set + * @return the SquareLinkedService object itself. + */ + public SquareLinkedService withClientId(Object clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the client secret associated with your Square application. + * + * @return the clientSecret value + */ + public SecretBase clientSecret() { + return this.clientSecret; + } + + /** + * Set the client secret associated with your Square application. + * + * @param clientSecret the clientSecret value to set + * @return the SquareLinkedService object itself. + */ + public SquareLinkedService withClientSecret(SecretBase clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get the redirect URL assigned in the Square application dashboard. (i.e. http://localhost:2500). + * + * @return the redirectUri value + */ + public Object redirectUri() { + return this.redirectUri; + } + + /** + * Set the redirect URL assigned in the Square application dashboard. (i.e. http://localhost:2500). + * + * @param redirectUri the redirectUri value to set + * @return the SquareLinkedService object itself. + */ + public SquareLinkedService withRedirectUri(Object redirectUri) { + this.redirectUri = redirectUri; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the SquareLinkedService object itself. + */ + public SquareLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the SquareLinkedService object itself. + */ + public SquareLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the SquareLinkedService object itself. + */ + public SquareLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SquareLinkedService object itself. + */ + public SquareLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SquareObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SquareObjectDataset.java new file mode 100644 index 000000000000..428cfb77ce10 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SquareObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Square Service dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SquareObject") +public class SquareObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SquareSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SquareSource.java new file mode 100644 index 000000000000..ff0ab36da834 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SquareSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Square Service source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SquareSource") +public class SquareSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the SquareSource object itself. + */ + public SquareSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SsisPackageLocationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SsisPackageLocationType.java new file mode 100644 index 000000000000..f5ab5cb09ec6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SsisPackageLocationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SsisPackageLocationType. + */ +public final class SsisPackageLocationType extends ExpandableStringEnum { + /** Static value SSISDB for SsisPackageLocationType. */ + public static final SsisPackageLocationType SSISDB = fromString("SSISDB"); + + /** Static value File for SsisPackageLocationType. */ + public static final SsisPackageLocationType FILE = fromString("File"); + + /** + * Creates or finds a SsisPackageLocationType from its string representation. + * @param name a name to look for + * @return the corresponding SsisPackageLocationType + */ + @JsonCreator + public static SsisPackageLocationType fromString(String name) { + return fromString(name, SsisPackageLocationType.class); + } + + /** + * @return known SsisPackageLocationType values + */ + public static Collection values() { + return values(SsisPackageLocationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/StagingSettings.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/StagingSettings.java new file mode 100644 index 000000000000..698c78fb811e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/StagingSettings.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Staging settings. + */ +public class StagingSettings { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Staging linked service reference. + */ + @JsonProperty(value = "linkedServiceName", required = true) + private LinkedServiceReference linkedServiceName; + + /** + * The path to storage for storing the interim data. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "path") + private Object path; + + /** + * Specifies whether to use compression when copying data via an interim + * staging. Default value is false. Type: boolean (or Expression with + * resultType boolean). + */ + @JsonProperty(value = "enableCompression") + private Object enableCompression; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the StagingSettings object itself. + */ + public StagingSettings withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get staging linked service reference. + * + * @return the linkedServiceName value + */ + public LinkedServiceReference linkedServiceName() { + return this.linkedServiceName; + } + + /** + * Set staging linked service reference. + * + * @param linkedServiceName the linkedServiceName value to set + * @return the StagingSettings object itself. + */ + public StagingSettings withLinkedServiceName(LinkedServiceReference linkedServiceName) { + this.linkedServiceName = linkedServiceName; + return this; + } + + /** + * Get the path to storage for storing the interim data. Type: string (or Expression with resultType string). + * + * @return the path value + */ + public Object path() { + return this.path; + } + + /** + * Set the path to storage for storing the interim data. Type: string (or Expression with resultType string). + * + * @param path the path value to set + * @return the StagingSettings object itself. + */ + public StagingSettings withPath(Object path) { + this.path = path; + return this; + } + + /** + * Get specifies whether to use compression when copying data via an interim staging. Default value is false. Type: boolean (or Expression with resultType boolean). + * + * @return the enableCompression value + */ + public Object enableCompression() { + return this.enableCompression; + } + + /** + * Set specifies whether to use compression when copying data via an interim staging. Default value is false. Type: boolean (or Expression with resultType boolean). + * + * @param enableCompression the enableCompression value to set + * @return the StagingSettings object itself. + */ + public StagingSettings withEnableCompression(Object enableCompression) { + this.enableCompression = enableCompression; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/StoredProcedureParameter.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/StoredProcedureParameter.java new file mode 100644 index 000000000000..dc8b6248e928 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/StoredProcedureParameter.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SQL stored procedure parameter. + */ +public class StoredProcedureParameter { + /** + * Stored procedure parameter value. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "value", required = true) + private Object value; + + /** + * Stored procedure parameter type. + */ + @JsonProperty(value = "type") + private Object type; + + /** + * Get stored procedure parameter value. Type: string (or Expression with resultType string). + * + * @return the value value + */ + public Object value() { + return this.value; + } + + /** + * Set stored procedure parameter value. Type: string (or Expression with resultType string). + * + * @param value the value value to set + * @return the StoredProcedureParameter object itself. + */ + public StoredProcedureParameter withValue(Object value) { + this.value = value; + return this; + } + + /** + * Get stored procedure parameter type. + * + * @return the type value + */ + public Object type() { + return this.type; + } + + /** + * Set stored procedure parameter type. + * + * @param type the type value to set + * @return the StoredProcedureParameter object itself. + */ + public StoredProcedureParameter withType(Object type) { + this.type = type; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SybaseAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SybaseAuthenticationType.java new file mode 100644 index 000000000000..e7c6e987bb6d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SybaseAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SybaseAuthenticationType. + */ +public final class SybaseAuthenticationType extends ExpandableStringEnum { + /** Static value Basic for SybaseAuthenticationType. */ + public static final SybaseAuthenticationType BASIC = fromString("Basic"); + + /** Static value Windows for SybaseAuthenticationType. */ + public static final SybaseAuthenticationType WINDOWS = fromString("Windows"); + + /** + * Creates or finds a SybaseAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding SybaseAuthenticationType + */ + @JsonCreator + public static SybaseAuthenticationType fromString(String name) { + return fromString(name, SybaseAuthenticationType.class); + } + + /** + * @return known SybaseAuthenticationType values + */ + public static Collection values() { + return values(SybaseAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SybaseLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SybaseLinkedService.java new file mode 100644 index 000000000000..cac33961e799 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/SybaseLinkedService.java @@ -0,0 +1,213 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for Sybase data source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Sybase") +@JsonFlatten +public class SybaseLinkedService extends LinkedServiceInner { + /** + * Server name for connection. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.server", required = true) + private Object server; + + /** + * Database name for connection. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.database", required = true) + private Object database; + + /** + * Schema name for connection. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.schema") + private Object schema; + + /** + * AuthenticationType to be used for connection. Possible values include: + * 'Basic', 'Windows'. + */ + @JsonProperty(value = "typeProperties.authenticationType") + private SybaseAuthenticationType authenticationType; + + /** + * Username for authentication. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * Password for authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get server name for connection. Type: string (or Expression with resultType string). + * + * @return the server value + */ + public Object server() { + return this.server; + } + + /** + * Set server name for connection. Type: string (or Expression with resultType string). + * + * @param server the server value to set + * @return the SybaseLinkedService object itself. + */ + public SybaseLinkedService withServer(Object server) { + this.server = server; + return this; + } + + /** + * Get database name for connection. Type: string (or Expression with resultType string). + * + * @return the database value + */ + public Object database() { + return this.database; + } + + /** + * Set database name for connection. Type: string (or Expression with resultType string). + * + * @param database the database value to set + * @return the SybaseLinkedService object itself. + */ + public SybaseLinkedService withDatabase(Object database) { + this.database = database; + return this; + } + + /** + * Get schema name for connection. Type: string (or Expression with resultType string). + * + * @return the schema value + */ + public Object schema() { + return this.schema; + } + + /** + * Set schema name for connection. Type: string (or Expression with resultType string). + * + * @param schema the schema value to set + * @return the SybaseLinkedService object itself. + */ + public SybaseLinkedService withSchema(Object schema) { + this.schema = schema; + return this; + } + + /** + * Get authenticationType to be used for connection. Possible values include: 'Basic', 'Windows'. + * + * @return the authenticationType value + */ + public SybaseAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set authenticationType to be used for connection. Possible values include: 'Basic', 'Windows'. + * + * @param authenticationType the authenticationType value to set + * @return the SybaseLinkedService object itself. + */ + public SybaseLinkedService withAuthenticationType(SybaseAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get username for authentication. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set username for authentication. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the SybaseLinkedService object itself. + */ + public SybaseLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get password for authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password for authentication. + * + * @param password the password value to set + * @return the SybaseLinkedService object itself. + */ + public SybaseLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the SybaseLinkedService object itself. + */ + public SybaseLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TeradataAuthenticationType.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TeradataAuthenticationType.java new file mode 100644 index 000000000000..5aaab3afdc42 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TeradataAuthenticationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TeradataAuthenticationType. + */ +public final class TeradataAuthenticationType extends ExpandableStringEnum { + /** Static value Basic for TeradataAuthenticationType. */ + public static final TeradataAuthenticationType BASIC = fromString("Basic"); + + /** Static value Windows for TeradataAuthenticationType. */ + public static final TeradataAuthenticationType WINDOWS = fromString("Windows"); + + /** + * Creates or finds a TeradataAuthenticationType from its string representation. + * @param name a name to look for + * @return the corresponding TeradataAuthenticationType + */ + @JsonCreator + public static TeradataAuthenticationType fromString(String name) { + return fromString(name, TeradataAuthenticationType.class); + } + + /** + * @return known TeradataAuthenticationType values + */ + public static Collection values() { + return values(TeradataAuthenticationType.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TeradataLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TeradataLinkedService.java new file mode 100644 index 000000000000..c77086d1ddf6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TeradataLinkedService.java @@ -0,0 +1,159 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Linked service for Teradata data source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Teradata") +@JsonFlatten +public class TeradataLinkedService extends LinkedServiceInner { + /** + * Server name for connection. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.server", required = true) + private Object server; + + /** + * AuthenticationType to be used for connection. Possible values include: + * 'Basic', 'Windows'. + */ + @JsonProperty(value = "typeProperties.authenticationType") + private TeradataAuthenticationType authenticationType; + + /** + * Username for authentication. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "typeProperties.username") + private Object username; + + /** + * Password for authentication. + */ + @JsonProperty(value = "typeProperties.password") + private SecretBase password; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get server name for connection. Type: string (or Expression with resultType string). + * + * @return the server value + */ + public Object server() { + return this.server; + } + + /** + * Set server name for connection. Type: string (or Expression with resultType string). + * + * @param server the server value to set + * @return the TeradataLinkedService object itself. + */ + public TeradataLinkedService withServer(Object server) { + this.server = server; + return this; + } + + /** + * Get authenticationType to be used for connection. Possible values include: 'Basic', 'Windows'. + * + * @return the authenticationType value + */ + public TeradataAuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set authenticationType to be used for connection. Possible values include: 'Basic', 'Windows'. + * + * @param authenticationType the authenticationType value to set + * @return the TeradataLinkedService object itself. + */ + public TeradataLinkedService withAuthenticationType(TeradataAuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get username for authentication. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set username for authentication. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the TeradataLinkedService object itself. + */ + public TeradataLinkedService withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get password for authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password for authentication. + * + * @param password the password value to set + * @return the TeradataLinkedService object itself. + */ + public TeradataLinkedService withPassword(SecretBase password) { + this.password = password; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the TeradataLinkedService object itself. + */ + public TeradataLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TextFormat.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TextFormat.java new file mode 100644 index 000000000000..44aa6eef2a9e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TextFormat.java @@ -0,0 +1,270 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The data stored in text format. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("TextFormat") +public class TextFormat extends DatasetStorageFormat { + /** + * The column delimiter. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "columnDelimiter") + private Object columnDelimiter; + + /** + * The row delimiter. Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "rowDelimiter") + private Object rowDelimiter; + + /** + * The escape character. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "escapeChar") + private Object escapeChar; + + /** + * The quote character. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "quoteChar") + private Object quoteChar; + + /** + * The null value string. Type: string (or Expression with resultType + * string). + */ + @JsonProperty(value = "nullValue") + private Object nullValue; + + /** + * The code page name of the preferred encoding. If miss, the default value + * is ΓÇ£utf-8ΓÇ¥, unless BOM denotes another Unicode encoding. Refer to + * the ΓÇ£NameΓÇ¥ column of the table in the following link to set + * supported values: + * https://msdn.microsoft.com/library/system.text.encoding.aspx. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "encodingName") + private Object encodingName; + + /** + * Treat empty column values in the text file as null. The default value is + * true. Type: boolean (or Expression with resultType boolean). + */ + @JsonProperty(value = "treatEmptyAsNull") + private Object treatEmptyAsNull; + + /** + * The number of lines/rows to be skipped when parsing text files. The + * default value is 0. Type: integer (or Expression with resultType + * integer). + */ + @JsonProperty(value = "skipLineCount") + private Object skipLineCount; + + /** + * When used as input, treat the first row of data as headers. When used as + * output,write the headers into the output as the first row of data. The + * default value is false. Type: boolean (or Expression with resultType + * boolean). + */ + @JsonProperty(value = "firstRowAsHeader") + private Object firstRowAsHeader; + + /** + * Get the column delimiter. Type: string (or Expression with resultType string). + * + * @return the columnDelimiter value + */ + public Object columnDelimiter() { + return this.columnDelimiter; + } + + /** + * Set the column delimiter. Type: string (or Expression with resultType string). + * + * @param columnDelimiter the columnDelimiter value to set + * @return the TextFormat object itself. + */ + public TextFormat withColumnDelimiter(Object columnDelimiter) { + this.columnDelimiter = columnDelimiter; + return this; + } + + /** + * Get the row delimiter. Type: string (or Expression with resultType string). + * + * @return the rowDelimiter value + */ + public Object rowDelimiter() { + return this.rowDelimiter; + } + + /** + * Set the row delimiter. Type: string (or Expression with resultType string). + * + * @param rowDelimiter the rowDelimiter value to set + * @return the TextFormat object itself. + */ + public TextFormat withRowDelimiter(Object rowDelimiter) { + this.rowDelimiter = rowDelimiter; + return this; + } + + /** + * Get the escape character. Type: string (or Expression with resultType string). + * + * @return the escapeChar value + */ + public Object escapeChar() { + return this.escapeChar; + } + + /** + * Set the escape character. Type: string (or Expression with resultType string). + * + * @param escapeChar the escapeChar value to set + * @return the TextFormat object itself. + */ + public TextFormat withEscapeChar(Object escapeChar) { + this.escapeChar = escapeChar; + return this; + } + + /** + * Get the quote character. Type: string (or Expression with resultType string). + * + * @return the quoteChar value + */ + public Object quoteChar() { + return this.quoteChar; + } + + /** + * Set the quote character. Type: string (or Expression with resultType string). + * + * @param quoteChar the quoteChar value to set + * @return the TextFormat object itself. + */ + public TextFormat withQuoteChar(Object quoteChar) { + this.quoteChar = quoteChar; + return this; + } + + /** + * Get the null value string. Type: string (or Expression with resultType string). + * + * @return the nullValue value + */ + public Object nullValue() { + return this.nullValue; + } + + /** + * Set the null value string. Type: string (or Expression with resultType string). + * + * @param nullValue the nullValue value to set + * @return the TextFormat object itself. + */ + public TextFormat withNullValue(Object nullValue) { + this.nullValue = nullValue; + return this; + } + + /** + * Get the code page name of the preferred encoding. If miss, the default value is ΓÇ£utf-8ΓÇ¥, unless BOM denotes another Unicode encoding. Refer to the ΓÇ£NameΓÇ¥ column of the table in the following link to set supported values: https://msdn.microsoft.com/library/system.text.encoding.aspx. Type: string (or Expression with resultType string). + * + * @return the encodingName value + */ + public Object encodingName() { + return this.encodingName; + } + + /** + * Set the code page name of the preferred encoding. If miss, the default value is ΓÇ£utf-8ΓÇ¥, unless BOM denotes another Unicode encoding. Refer to the ΓÇ£NameΓÇ¥ column of the table in the following link to set supported values: https://msdn.microsoft.com/library/system.text.encoding.aspx. Type: string (or Expression with resultType string). + * + * @param encodingName the encodingName value to set + * @return the TextFormat object itself. + */ + public TextFormat withEncodingName(Object encodingName) { + this.encodingName = encodingName; + return this; + } + + /** + * Get treat empty column values in the text file as null. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @return the treatEmptyAsNull value + */ + public Object treatEmptyAsNull() { + return this.treatEmptyAsNull; + } + + /** + * Set treat empty column values in the text file as null. The default value is true. Type: boolean (or Expression with resultType boolean). + * + * @param treatEmptyAsNull the treatEmptyAsNull value to set + * @return the TextFormat object itself. + */ + public TextFormat withTreatEmptyAsNull(Object treatEmptyAsNull) { + this.treatEmptyAsNull = treatEmptyAsNull; + return this; + } + + /** + * Get the number of lines/rows to be skipped when parsing text files. The default value is 0. Type: integer (or Expression with resultType integer). + * + * @return the skipLineCount value + */ + public Object skipLineCount() { + return this.skipLineCount; + } + + /** + * Set the number of lines/rows to be skipped when parsing text files. The default value is 0. Type: integer (or Expression with resultType integer). + * + * @param skipLineCount the skipLineCount value to set + * @return the TextFormat object itself. + */ + public TextFormat withSkipLineCount(Object skipLineCount) { + this.skipLineCount = skipLineCount; + return this; + } + + /** + * Get when used as input, treat the first row of data as headers. When used as output,write the headers into the output as the first row of data. The default value is false. Type: boolean (or Expression with resultType boolean). + * + * @return the firstRowAsHeader value + */ + public Object firstRowAsHeader() { + return this.firstRowAsHeader; + } + + /** + * Set when used as input, treat the first row of data as headers. When used as output,write the headers into the output as the first row of data. The default value is false. Type: boolean (or Expression with resultType boolean). + * + * @param firstRowAsHeader the firstRowAsHeader value to set + * @return the TextFormat object itself. + */ + public TextFormat withFirstRowAsHeader(Object firstRowAsHeader) { + this.firstRowAsHeader = firstRowAsHeader; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerPipelineReference.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerPipelineReference.java new file mode 100644 index 000000000000..cecc916d4e18 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerPipelineReference.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Pipeline that needs to be triggered with the given parameters. + */ +public class TriggerPipelineReference { + /** + * Pipeline reference. + */ + @JsonProperty(value = "pipelineReference") + private PipelineReference pipelineReference; + + /** + * Pipeline parameters. + */ + @JsonProperty(value = "parameters") + private Map parameters; + + /** + * Get pipeline reference. + * + * @return the pipelineReference value + */ + public PipelineReference pipelineReference() { + return this.pipelineReference; + } + + /** + * Set pipeline reference. + * + * @param pipelineReference the pipelineReference value to set + * @return the TriggerPipelineReference object itself. + */ + public TriggerPipelineReference withPipelineReference(PipelineReference pipelineReference) { + this.pipelineReference = pipelineReference; + return this; + } + + /** + * Get pipeline parameters. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set pipeline parameters. + * + * @param parameters the parameters value to set + * @return the TriggerPipelineReference object itself. + */ + public TriggerPipelineReference withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerResource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerResource.java new file mode 100644 index 000000000000..0e03716a8940 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerResource.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.TriggerResourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.TriggerInner; +import java.util.Map; + +/** + * Type representing TriggerResource. + */ +public interface TriggerResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + TriggerInner properties(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the TriggerResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithFactory, DefinitionStages.WithIfMatch, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of TriggerResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a TriggerResource definition. + */ + interface Blank extends WithFactory { + } + + /** + * The stage of the triggerresource definition allowing to specify Factory. + */ + interface WithFactory { + /** + * Specifies resourceGroupName, factoryName. + * @param resourceGroupName The resource group name + * @param factoryName The factory name + * @return the next definition stage + */ + WithIfMatch withExistingFactory(String resourceGroupName, String factoryName); + } + + /** + * The stage of the triggerresource definition allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update + * @return the next definition stage + */ + WithProperties withIfMatch(String ifMatch); + } + + /** + * The stage of the triggerresource definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Properties of the trigger + * @return the next definition stage + */ + WithCreate withProperties(TriggerInner properties); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a TriggerResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIfMatch, UpdateStages.WithProperties { + } + + /** + * Grouping of TriggerResource update stages. + */ + interface UpdateStages { + /** + * The stage of the triggerresource update allowing to specify IfMatch. + */ + interface WithIfMatch { + /** + * Specifies ifMatch. + * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update + * @return the next update stage + */ + Update withIfMatch(String ifMatch); + } + + /** + * The stage of the triggerresource update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Properties of the trigger + * @return the next update stage + */ + Update withProperties(TriggerInner properties); + } + + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerRun.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerRun.java new file mode 100644 index 000000000000..7409d92e72dd --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerRun.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.TriggerRunInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DataFactoryManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing TriggerRun. + */ +public interface TriggerRun extends HasInner, HasManager { + /** + * @return the additionalProperties value. + */ + Map additionalProperties(); + + /** + * @return the message value. + */ + String message(); + + /** + * @return the properties value. + */ + Map properties(); + + /** + * @return the status value. + */ + TriggerRunStatus status(); + + /** + * @return the triggeredPipelines value. + */ + Map triggeredPipelines(); + + /** + * @return the triggerName value. + */ + String triggerName(); + + /** + * @return the triggerRunId value. + */ + String triggerRunId(); + + /** + * @return the triggerRunTimestamp value. + */ + DateTime triggerRunTimestamp(); + + /** + * @return the triggerType value. + */ + String triggerType(); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerRunStatus.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerRunStatus.java new file mode 100644 index 000000000000..b5f67e1a7d24 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerRunStatus.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TriggerRunStatus. + */ +public final class TriggerRunStatus extends ExpandableStringEnum { + /** Static value Succeeded for TriggerRunStatus. */ + public static final TriggerRunStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for TriggerRunStatus. */ + public static final TriggerRunStatus FAILED = fromString("Failed"); + + /** Static value Inprogress for TriggerRunStatus. */ + public static final TriggerRunStatus INPROGRESS = fromString("Inprogress"); + + /** + * Creates or finds a TriggerRunStatus from its string representation. + * @param name a name to look for + * @return the corresponding TriggerRunStatus + */ + @JsonCreator + public static TriggerRunStatus fromString(String name) { + return fromString(name, TriggerRunStatus.class); + } + + /** + * @return known TriggerRunStatus values + */ + public static Collection values() { + return values(TriggerRunStatus.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerRuntimeState.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerRuntimeState.java new file mode 100644 index 000000000000..5272fb76cfd9 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TriggerRuntimeState.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TriggerRuntimeState. + */ +public final class TriggerRuntimeState extends ExpandableStringEnum { + /** Static value Started for TriggerRuntimeState. */ + public static final TriggerRuntimeState STARTED = fromString("Started"); + + /** Static value Stopped for TriggerRuntimeState. */ + public static final TriggerRuntimeState STOPPED = fromString("Stopped"); + + /** Static value Disabled for TriggerRuntimeState. */ + public static final TriggerRuntimeState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a TriggerRuntimeState from its string representation. + * @param name a name to look for + * @return the corresponding TriggerRuntimeState + */ + @JsonCreator + public static TriggerRuntimeState fromString(String name) { + return fromString(name, TriggerRuntimeState.class); + } + + /** + * @return known TriggerRuntimeState values + */ + public static Collection values() { + return values(TriggerRuntimeState.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Triggers.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Triggers.java new file mode 100644 index 000000000000..078e53db5a70 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/Triggers.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.TriggersInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.TriggerRun; + +/** + * Type representing Triggers. + */ +public interface Triggers extends SupportsCreating, HasInner { + /** + * Starts a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable startAsync(String resourceGroupName, String factoryName, String triggerName); + + /** + * Stops a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable stopAsync(String resourceGroupName, String factoryName, String triggerName); + + /** + * Gets a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String factoryName, String triggerName); + + /** + * Lists triggers. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByFactoryAsync(final String resourceGroupName, final String factoryName); + + /** + * Deletes a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String factoryName, String triggerName); + + /** + * List trigger runs. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param startTime Start time for trigger runs. + * @param endTime End time for trigger runs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listRunsAsync(final String resourceGroupName, final String factoryName, final String triggerName, final DateTime startTime, final DateTime endTime); + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TumblingWindowFrequency.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TumblingWindowFrequency.java new file mode 100644 index 000000000000..d7b5ed327d00 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TumblingWindowFrequency.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TumblingWindowFrequency. + */ +public final class TumblingWindowFrequency extends ExpandableStringEnum { + /** Static value Minute for TumblingWindowFrequency. */ + public static final TumblingWindowFrequency MINUTE = fromString("Minute"); + + /** Static value Hour for TumblingWindowFrequency. */ + public static final TumblingWindowFrequency HOUR = fromString("Hour"); + + /** + * Creates or finds a TumblingWindowFrequency from its string representation. + * @param name a name to look for + * @return the corresponding TumblingWindowFrequency + */ + @JsonCreator + public static TumblingWindowFrequency fromString(String name) { + return fromString(name, TumblingWindowFrequency.class); + } + + /** + * @return known TumblingWindowFrequency values + */ + public static Collection values() { + return values(TumblingWindowFrequency.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TumblingWindowTrigger.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TumblingWindowTrigger.java new file mode 100644 index 000000000000..76dbba6add11 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/TumblingWindowTrigger.java @@ -0,0 +1,245 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.TriggerInner; + +/** + * Trigger that schedules pipeline runs for all fixed time interval windows + * from a start time without gaps and also supports backfill scenarios (when + * start time is in the past). + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("TumblingWindowTrigger") +@JsonFlatten +public class TumblingWindowTrigger extends TriggerInner { + /** + * Pipeline for which runs are created when an event is fired for trigger + * window that is ready. + */ + @JsonProperty(value = "pipeline", required = true) + private TriggerPipelineReference pipeline; + + /** + * The frequency of the time windows. Possible values include: 'Minute', + * 'Hour'. + */ + @JsonProperty(value = "typeProperties.frequency", required = true) + private TumblingWindowFrequency frequency; + + /** + * The interval of the time windows. The minimum interval allowed is 15 + * Minutes. + */ + @JsonProperty(value = "typeProperties.interval", required = true) + private int interval; + + /** + * The start time for the time period for the trigger during which events + * are fired for windows that are ready. Only UTC time is currently + * supported. + */ + @JsonProperty(value = "typeProperties.startTime", required = true) + private DateTime startTime; + + /** + * The end time for the time period for the trigger during which events are + * fired for windows that are ready. Only UTC time is currently supported. + */ + @JsonProperty(value = "typeProperties.endTime") + private DateTime endTime; + + /** + * Specifies how long the trigger waits past due time before triggering new + * run. It doesn't alter window start and end time. The default is 0. Type: + * string (or Expression with resultType string), pattern: + * ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + */ + @JsonProperty(value = "typeProperties.delay") + private Object delay; + + /** + * The max number of parallel time windows (ready for execution) for which + * a new run is triggered. + */ + @JsonProperty(value = "typeProperties.maxConcurrency", required = true) + private int maxConcurrency; + + /** + * Retry policy that will be applied for failed pipeline runs. + */ + @JsonProperty(value = "typeProperties.retryPolicy") + private RetryPolicy retryPolicy; + + /** + * Get pipeline for which runs are created when an event is fired for trigger window that is ready. + * + * @return the pipeline value + */ + public TriggerPipelineReference pipeline() { + return this.pipeline; + } + + /** + * Set pipeline for which runs are created when an event is fired for trigger window that is ready. + * + * @param pipeline the pipeline value to set + * @return the TumblingWindowTrigger object itself. + */ + public TumblingWindowTrigger withPipeline(TriggerPipelineReference pipeline) { + this.pipeline = pipeline; + return this; + } + + /** + * Get the frequency of the time windows. Possible values include: 'Minute', 'Hour'. + * + * @return the frequency value + */ + public TumblingWindowFrequency frequency() { + return this.frequency; + } + + /** + * Set the frequency of the time windows. Possible values include: 'Minute', 'Hour'. + * + * @param frequency the frequency value to set + * @return the TumblingWindowTrigger object itself. + */ + public TumblingWindowTrigger withFrequency(TumblingWindowFrequency frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the interval of the time windows. The minimum interval allowed is 15 Minutes. + * + * @return the interval value + */ + public int interval() { + return this.interval; + } + + /** + * Set the interval of the time windows. The minimum interval allowed is 15 Minutes. + * + * @param interval the interval value to set + * @return the TumblingWindowTrigger object itself. + */ + public TumblingWindowTrigger withInterval(int interval) { + this.interval = interval; + return this; + } + + /** + * Get the start time for the time period for the trigger during which events are fired for windows that are ready. Only UTC time is currently supported. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the start time for the time period for the trigger during which events are fired for windows that are ready. Only UTC time is currently supported. + * + * @param startTime the startTime value to set + * @return the TumblingWindowTrigger object itself. + */ + public TumblingWindowTrigger withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the end time for the time period for the trigger during which events are fired for windows that are ready. Only UTC time is currently supported. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set the end time for the time period for the trigger during which events are fired for windows that are ready. Only UTC time is currently supported. + * + * @param endTime the endTime value to set + * @return the TumblingWindowTrigger object itself. + */ + public TumblingWindowTrigger withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get specifies how long the trigger waits past due time before triggering new run. It doesn't alter window start and end time. The default is 0. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @return the delay value + */ + public Object delay() { + return this.delay; + } + + /** + * Set specifies how long the trigger waits past due time before triggering new run. It doesn't alter window start and end time. The default is 0. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @param delay the delay value to set + * @return the TumblingWindowTrigger object itself. + */ + public TumblingWindowTrigger withDelay(Object delay) { + this.delay = delay; + return this; + } + + /** + * Get the max number of parallel time windows (ready for execution) for which a new run is triggered. + * + * @return the maxConcurrency value + */ + public int maxConcurrency() { + return this.maxConcurrency; + } + + /** + * Set the max number of parallel time windows (ready for execution) for which a new run is triggered. + * + * @param maxConcurrency the maxConcurrency value to set + * @return the TumblingWindowTrigger object itself. + */ + public TumblingWindowTrigger withMaxConcurrency(int maxConcurrency) { + this.maxConcurrency = maxConcurrency; + return this; + } + + /** + * Get retry policy that will be applied for failed pipeline runs. + * + * @return the retryPolicy value + */ + public RetryPolicy retryPolicy() { + return this.retryPolicy; + } + + /** + * Set retry policy that will be applied for failed pipeline runs. + * + * @param retryPolicy the retryPolicy value to set + * @return the TumblingWindowTrigger object itself. + */ + public TumblingWindowTrigger withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/UntilActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/UntilActivity.java new file mode 100644 index 000000000000..79d44a386b82 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/UntilActivity.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * This activity executes inner activities until the specified boolean + * expression results to true or timeout is reached, whichever is earlier. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Until") +@JsonFlatten +public class UntilActivity extends ControlActivity { + /** + * An expression that would evaluate to Boolean. The loop will continue + * until this expression evaluates to true. + */ + @JsonProperty(value = "typeProperties.expression", required = true) + private Expression expression; + + /** + * Specifies the timeout for the activity to run. If there is no value + * specified, it takes the value of TimeSpan.FromDays(7) which is 1 week as + * default. Type: string (or Expression with resultType string), pattern: + * ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). Type: string (or + * Expression with resultType string), pattern: + * ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + */ + @JsonProperty(value = "typeProperties.timeout") + private Object timeout; + + /** + * List of activities to execute. + */ + @JsonProperty(value = "typeProperties.activities", required = true) + private List activities; + + /** + * Get an expression that would evaluate to Boolean. The loop will continue until this expression evaluates to true. + * + * @return the expression value + */ + public Expression expression() { + return this.expression; + } + + /** + * Set an expression that would evaluate to Boolean. The loop will continue until this expression evaluates to true. + * + * @param expression the expression value to set + * @return the UntilActivity object itself. + */ + public UntilActivity withExpression(Expression expression) { + this.expression = expression; + return this; + } + + /** + * Get specifies the timeout for the activity to run. If there is no value specified, it takes the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @return the timeout value + */ + public Object timeout() { + return this.timeout; + } + + /** + * Set specifies the timeout for the activity to run. If there is no value specified, it takes the value of TimeSpan.FromDays(7) which is 1 week as default. Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). Type: string (or Expression with resultType string), pattern: ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + * + * @param timeout the timeout value to set + * @return the UntilActivity object itself. + */ + public UntilActivity withTimeout(Object timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get list of activities to execute. + * + * @return the activities value + */ + public List activities() { + return this.activities; + } + + /** + * Set list of activities to execute. + * + * @param activities the activities value to set + * @return the UntilActivity object itself. + */ + public UntilActivity withActivities(List activities) { + this.activities = activities; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/UpdateIntegrationRuntimeNodeRequest.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/UpdateIntegrationRuntimeNodeRequest.java new file mode 100644 index 000000000000..d9f7ab6bfde6 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/UpdateIntegrationRuntimeNodeRequest.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Update integration runtime node request. + */ +public class UpdateIntegrationRuntimeNodeRequest { + /** + * The number of concurrent jobs permitted to run on the integration + * runtime node. Values between 1 and maxConcurrentJobs(inclusive) are + * allowed. + */ + @JsonProperty(value = "concurrentJobsLimit") + private Integer concurrentJobsLimit; + + /** + * Get the number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. + * + * @return the concurrentJobsLimit value + */ + public Integer concurrentJobsLimit() { + return this.concurrentJobsLimit; + } + + /** + * Set the number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. + * + * @param concurrentJobsLimit the concurrentJobsLimit value to set + * @return the UpdateIntegrationRuntimeNodeRequest object itself. + */ + public UpdateIntegrationRuntimeNodeRequest withConcurrentJobsLimit(Integer concurrentJobsLimit) { + this.concurrentJobsLimit = concurrentJobsLimit; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/UpdateIntegrationRuntimeRequest.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/UpdateIntegrationRuntimeRequest.java new file mode 100644 index 000000000000..0691afb9508a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/UpdateIntegrationRuntimeRequest.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Update integration runtime request. + */ +public class UpdateIntegrationRuntimeRequest { + /** + * Enables or disables the auto-update feature of the self-hosted + * integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. + * Possible values include: 'On', 'Off'. + */ + @JsonProperty(value = "autoUpdate") + private IntegrationRuntimeAutoUpdate autoUpdate; + + /** + * The time offset (in hours) in the day, e.g., PT03H is 3 hours. The + * integration runtime auto update will happen on that time. + */ + @JsonProperty(value = "updateDelayOffset") + private String updateDelayOffset; + + /** + * Get enables or disables the auto-update feature of the self-hosted integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. Possible values include: 'On', 'Off'. + * + * @return the autoUpdate value + */ + public IntegrationRuntimeAutoUpdate autoUpdate() { + return this.autoUpdate; + } + + /** + * Set enables or disables the auto-update feature of the self-hosted integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. Possible values include: 'On', 'Off'. + * + * @param autoUpdate the autoUpdate value to set + * @return the UpdateIntegrationRuntimeRequest object itself. + */ + public UpdateIntegrationRuntimeRequest withAutoUpdate(IntegrationRuntimeAutoUpdate autoUpdate) { + this.autoUpdate = autoUpdate; + return this; + } + + /** + * Get the time offset (in hours) in the day, e.g., PT03H is 3 hours. The integration runtime auto update will happen on that time. + * + * @return the updateDelayOffset value + */ + public String updateDelayOffset() { + return this.updateDelayOffset; + } + + /** + * Set the time offset (in hours) in the day, e.g., PT03H is 3 hours. The integration runtime auto update will happen on that time. + * + * @param updateDelayOffset the updateDelayOffset value to set + * @return the UpdateIntegrationRuntimeRequest object itself. + */ + public UpdateIntegrationRuntimeRequest withUpdateDelayOffset(String updateDelayOffset) { + this.updateDelayOffset = updateDelayOffset; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/VerticaLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/VerticaLinkedService.java new file mode 100644 index 000000000000..450b3f4e16e7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/VerticaLinkedService.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Vertica linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Vertica") +@JsonFlatten +public class VerticaLinkedService extends LinkedServiceInner { + /** + * An ODBC connection string. Type: string, SecureString or + * AzureKeyVaultSecretReference. + */ + @JsonProperty(value = "typeProperties.connectionString") + private Object connectionString; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @return the connectionString value + */ + public Object connectionString() { + return this.connectionString; + } + + /** + * Set an ODBC connection string. Type: string, SecureString or AzureKeyVaultSecretReference. + * + * @param connectionString the connectionString value to set + * @return the VerticaLinkedService object itself. + */ + public VerticaLinkedService withConnectionString(Object connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the VerticaLinkedService object itself. + */ + public VerticaLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/VerticaSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/VerticaSource.java new file mode 100644 index 000000000000..208d4aba9738 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/VerticaSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Vertica source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("VerticaSource") +public class VerticaSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the VerticaSource object itself. + */ + public VerticaSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/VerticaTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/VerticaTableDataset.java new file mode 100644 index 000000000000..56190d27c55c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/VerticaTableDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Vertica dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("VerticaTable") +public class VerticaTableDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WaitActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WaitActivity.java new file mode 100644 index 000000000000..71414841fe1f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WaitActivity.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * This activity suspends pipeline execution for the specified interval. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Wait") +@JsonFlatten +public class WaitActivity extends ControlActivity { + /** + * Duration in seconds. + */ + @JsonProperty(value = "typeProperties.waitTimeInSeconds", required = true) + private int waitTimeInSeconds; + + /** + * Get duration in seconds. + * + * @return the waitTimeInSeconds value + */ + public int waitTimeInSeconds() { + return this.waitTimeInSeconds; + } + + /** + * Set duration in seconds. + * + * @param waitTimeInSeconds the waitTimeInSeconds value to set + * @return the WaitActivity object itself. + */ + public WaitActivity withWaitTimeInSeconds(int waitTimeInSeconds) { + this.waitTimeInSeconds = waitTimeInSeconds; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebActivity.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebActivity.java new file mode 100644 index 000000000000..cda8b863bcee --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebActivity.java @@ -0,0 +1,213 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Web activity. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("WebActivity") +@JsonFlatten +public class WebActivity extends ExecutionActivity { + /** + * Rest API method for target endpoint. Possible values include: 'GET', + * 'POST', 'PUT', 'DELETE'. + */ + @JsonProperty(value = "typeProperties.method", required = true) + private WebActivityMethod method; + + /** + * Web activity target endpoint and path. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "typeProperties.url", required = true) + private Object url; + + /** + * Represents the headers that will be sent to the request. For example, to + * set the language and type on a request: "headers" : { "Accept-Language": + * "en-us", "Content-Type": "application/json" }. Type: string (or + * Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.headers") + private Object headers; + + /** + * Represents the payload that will be sent to the endpoint. Required for + * POST/PUT method, not allowed for GET method Type: string (or Expression + * with resultType string). + */ + @JsonProperty(value = "typeProperties.body") + private Object body; + + /** + * Authentication method used for calling the endpoint. + */ + @JsonProperty(value = "typeProperties.authentication") + private WebActivityAuthentication authentication; + + /** + * List of datasets passed to web endpoint. + */ + @JsonProperty(value = "typeProperties.datasets") + private List datasets; + + /** + * List of linked services passed to web endpoint. + */ + @JsonProperty(value = "typeProperties.linkedServices") + private List linkedServices; + + /** + * Get rest API method for target endpoint. Possible values include: 'GET', 'POST', 'PUT', 'DELETE'. + * + * @return the method value + */ + public WebActivityMethod method() { + return this.method; + } + + /** + * Set rest API method for target endpoint. Possible values include: 'GET', 'POST', 'PUT', 'DELETE'. + * + * @param method the method value to set + * @return the WebActivity object itself. + */ + public WebActivity withMethod(WebActivityMethod method) { + this.method = method; + return this; + } + + /** + * Get web activity target endpoint and path. Type: string (or Expression with resultType string). + * + * @return the url value + */ + public Object url() { + return this.url; + } + + /** + * Set web activity target endpoint and path. Type: string (or Expression with resultType string). + * + * @param url the url value to set + * @return the WebActivity object itself. + */ + public WebActivity withUrl(Object url) { + this.url = url; + return this; + } + + /** + * Get represents the headers that will be sent to the request. For example, to set the language and type on a request: "headers" : { "Accept-Language": "en-us", "Content-Type": "application/json" }. Type: string (or Expression with resultType string). + * + * @return the headers value + */ + public Object headers() { + return this.headers; + } + + /** + * Set represents the headers that will be sent to the request. For example, to set the language and type on a request: "headers" : { "Accept-Language": "en-us", "Content-Type": "application/json" }. Type: string (or Expression with resultType string). + * + * @param headers the headers value to set + * @return the WebActivity object itself. + */ + public WebActivity withHeaders(Object headers) { + this.headers = headers; + return this; + } + + /** + * Get represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string). + * + * @return the body value + */ + public Object body() { + return this.body; + } + + /** + * Set represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET method Type: string (or Expression with resultType string). + * + * @param body the body value to set + * @return the WebActivity object itself. + */ + public WebActivity withBody(Object body) { + this.body = body; + return this; + } + + /** + * Get authentication method used for calling the endpoint. + * + * @return the authentication value + */ + public WebActivityAuthentication authentication() { + return this.authentication; + } + + /** + * Set authentication method used for calling the endpoint. + * + * @param authentication the authentication value to set + * @return the WebActivity object itself. + */ + public WebActivity withAuthentication(WebActivityAuthentication authentication) { + this.authentication = authentication; + return this; + } + + /** + * Get list of datasets passed to web endpoint. + * + * @return the datasets value + */ + public List datasets() { + return this.datasets; + } + + /** + * Set list of datasets passed to web endpoint. + * + * @param datasets the datasets value to set + * @return the WebActivity object itself. + */ + public WebActivity withDatasets(List datasets) { + this.datasets = datasets; + return this; + } + + /** + * Get list of linked services passed to web endpoint. + * + * @return the linkedServices value + */ + public List linkedServices() { + return this.linkedServices; + } + + /** + * Set list of linked services passed to web endpoint. + * + * @param linkedServices the linkedServices value to set + * @return the WebActivity object itself. + */ + public WebActivity withLinkedServices(List linkedServices) { + this.linkedServices = linkedServices; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebActivityAuthentication.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebActivityAuthentication.java new file mode 100644 index 000000000000..5db75fa3dad4 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebActivityAuthentication.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Web activity authentication properties. + */ +public class WebActivityAuthentication { + /** + * Web activity authentication (Basic/ClientCertificate/MSI). + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Base64-encoded contents of a PFX file. + */ + @JsonProperty(value = "pfx") + private SecureString pfx; + + /** + * Web activity authentication user name for basic authentication. + */ + @JsonProperty(value = "username") + private String username; + + /** + * Password for the PFX file or basic authentication. + */ + @JsonProperty(value = "password") + private SecureString password; + + /** + * Resource for which Azure Auth token will be requested when using MSI + * Authentication. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Get web activity authentication (Basic/ClientCertificate/MSI). + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set web activity authentication (Basic/ClientCertificate/MSI). + * + * @param type the type value to set + * @return the WebActivityAuthentication object itself. + */ + public WebActivityAuthentication withType(String type) { + this.type = type; + return this; + } + + /** + * Get base64-encoded contents of a PFX file. + * + * @return the pfx value + */ + public SecureString pfx() { + return this.pfx; + } + + /** + * Set base64-encoded contents of a PFX file. + * + * @param pfx the pfx value to set + * @return the WebActivityAuthentication object itself. + */ + public WebActivityAuthentication withPfx(SecureString pfx) { + this.pfx = pfx; + return this; + } + + /** + * Get web activity authentication user name for basic authentication. + * + * @return the username value + */ + public String username() { + return this.username; + } + + /** + * Set web activity authentication user name for basic authentication. + * + * @param username the username value to set + * @return the WebActivityAuthentication object itself. + */ + public WebActivityAuthentication withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get password for the PFX file or basic authentication. + * + * @return the password value + */ + public SecureString password() { + return this.password; + } + + /** + * Set password for the PFX file or basic authentication. + * + * @param password the password value to set + * @return the WebActivityAuthentication object itself. + */ + public WebActivityAuthentication withPassword(SecureString password) { + this.password = password; + return this; + } + + /** + * Get resource for which Azure Auth token will be requested when using MSI Authentication. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource for which Azure Auth token will be requested when using MSI Authentication. + * + * @param resource the resource value to set + * @return the WebActivityAuthentication object itself. + */ + public WebActivityAuthentication withResource(String resource) { + this.resource = resource; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebActivityMethod.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebActivityMethod.java new file mode 100644 index 000000000000..1c4eda28af00 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebActivityMethod.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for WebActivityMethod. + */ +public final class WebActivityMethod extends ExpandableStringEnum { + /** Static value GET for WebActivityMethod. */ + public static final WebActivityMethod GET = fromString("GET"); + + /** Static value POST for WebActivityMethod. */ + public static final WebActivityMethod POST = fromString("POST"); + + /** Static value PUT for WebActivityMethod. */ + public static final WebActivityMethod PUT = fromString("PUT"); + + /** Static value DELETE for WebActivityMethod. */ + public static final WebActivityMethod DELETE = fromString("DELETE"); + + /** + * Creates or finds a WebActivityMethod from its string representation. + * @param name a name to look for + * @return the corresponding WebActivityMethod + */ + @JsonCreator + public static WebActivityMethod fromString(String name) { + return fromString(name, WebActivityMethod.class); + } + + /** + * @return known WebActivityMethod values + */ + public static Collection values() { + return values(WebActivityMethod.class); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebAnonymousAuthentication.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebAnonymousAuthentication.java new file mode 100644 index 000000000000..89c66b458f40 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebAnonymousAuthentication.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A WebLinkedService that uses anonymous authentication to communicate with an + * HTTP endpoint. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authenticationType") +@JsonTypeName("Anonymous") +public class WebAnonymousAuthentication extends WebLinkedServiceTypeProperties { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebBasicAuthentication.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebBasicAuthentication.java new file mode 100644 index 000000000000..f7f26c4016a2 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebBasicAuthentication.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A WebLinkedService that uses basic authentication to communicate with an + * HTTP endpoint. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authenticationType") +@JsonTypeName("Basic") +public class WebBasicAuthentication extends WebLinkedServiceTypeProperties { + /** + * User name for Basic authentication. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "username", required = true) + private Object username; + + /** + * The password for Basic authentication. + */ + @JsonProperty(value = "password", required = true) + private SecretBase password; + + /** + * Get user name for Basic authentication. Type: string (or Expression with resultType string). + * + * @return the username value + */ + public Object username() { + return this.username; + } + + /** + * Set user name for Basic authentication. Type: string (or Expression with resultType string). + * + * @param username the username value to set + * @return the WebBasicAuthentication object itself. + */ + public WebBasicAuthentication withUsername(Object username) { + this.username = username; + return this; + } + + /** + * Get the password for Basic authentication. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set the password for Basic authentication. + * + * @param password the password value to set + * @return the WebBasicAuthentication object itself. + */ + public WebBasicAuthentication withPassword(SecretBase password) { + this.password = password; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebClientCertificateAuthentication.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebClientCertificateAuthentication.java new file mode 100644 index 000000000000..38b844aa81eb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebClientCertificateAuthentication.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A WebLinkedService that uses client certificate based authentication to + * communicate with an HTTP endpoint. This scheme follows mutual + * authentication; the server must also provide valid credentials to the + * client. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authenticationType") +@JsonTypeName("ClientCertificate") +public class WebClientCertificateAuthentication extends WebLinkedServiceTypeProperties { + /** + * Base64-encoded contents of a PFX file. + */ + @JsonProperty(value = "pfx", required = true) + private SecretBase pfx; + + /** + * Password for the PFX file. + */ + @JsonProperty(value = "password", required = true) + private SecretBase password; + + /** + * Get base64-encoded contents of a PFX file. + * + * @return the pfx value + */ + public SecretBase pfx() { + return this.pfx; + } + + /** + * Set base64-encoded contents of a PFX file. + * + * @param pfx the pfx value to set + * @return the WebClientCertificateAuthentication object itself. + */ + public WebClientCertificateAuthentication withPfx(SecretBase pfx) { + this.pfx = pfx; + return this; + } + + /** + * Get password for the PFX file. + * + * @return the password value + */ + public SecretBase password() { + return this.password; + } + + /** + * Set password for the PFX file. + * + * @param password the password value to set + * @return the WebClientCertificateAuthentication object itself. + */ + public WebClientCertificateAuthentication withPassword(SecretBase password) { + this.password = password; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebLinkedService.java new file mode 100644 index 000000000000..b591b0bb213c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebLinkedService.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Web linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Web") +public class WebLinkedService extends LinkedServiceInner { + /** + * Web linked service properties. + */ + @JsonProperty(value = "typeProperties", required = true) + private WebLinkedServiceTypeProperties typeProperties; + + /** + * Get web linked service properties. + * + * @return the typeProperties value + */ + public WebLinkedServiceTypeProperties typeProperties() { + return this.typeProperties; + } + + /** + * Set web linked service properties. + * + * @param typeProperties the typeProperties value to set + * @return the WebLinkedService object itself. + */ + public WebLinkedService withTypeProperties(WebLinkedServiceTypeProperties typeProperties) { + this.typeProperties = typeProperties; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebLinkedServiceTypeProperties.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebLinkedServiceTypeProperties.java new file mode 100644 index 000000000000..a51246a04d31 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebLinkedServiceTypeProperties.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Base definition of WebLinkedServiceTypeProperties, this typeProperties is + * polymorphic based on authenticationType, so not flattened in SDK models. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authenticationType") +@JsonTypeName("WebLinkedServiceTypeProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ClientCertificate", value = WebClientCertificateAuthentication.class), + @JsonSubTypes.Type(name = "Basic", value = WebBasicAuthentication.class), + @JsonSubTypes.Type(name = "Anonymous", value = WebAnonymousAuthentication.class) +}) +public class WebLinkedServiceTypeProperties { + /** + * The URL of the web service endpoint, e.g. http://www.microsoft.com . + * Type: string (or Expression with resultType string). + */ + @JsonProperty(value = "url", required = true) + private Object url; + + /** + * Get the URL of the web service endpoint, e.g. http://www.microsoft.com . Type: string (or Expression with resultType string). + * + * @return the url value + */ + public Object url() { + return this.url; + } + + /** + * Set the URL of the web service endpoint, e.g. http://www.microsoft.com . Type: string (or Expression with resultType string). + * + * @param url the url value to set + * @return the WebLinkedServiceTypeProperties object itself. + */ + public WebLinkedServiceTypeProperties withUrl(Object url) { + this.url = url; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebSource.java new file mode 100644 index 000000000000..1ef127f35502 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebSource.java @@ -0,0 +1,20 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity source for web page table. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("WebSource") +public class WebSource extends CopySource { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebTableDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebTableDataset.java new file mode 100644 index 000000000000..ea7523d60f22 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/WebTableDataset.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * The dataset points to a HTML table in the web page. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("WebTable") +@JsonFlatten +public class WebTableDataset extends DatasetInner { + /** + * The zero-based index of the table in the web page. Type: integer (or + * Expression with resultType integer), minimum: 0. + */ + @JsonProperty(value = "typeProperties.index", required = true) + private Object index; + + /** + * The relative URL to the web page from the linked service URL. Type: + * string (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.path") + private Object path; + + /** + * Get the zero-based index of the table in the web page. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @return the index value + */ + public Object index() { + return this.index; + } + + /** + * Set the zero-based index of the table in the web page. Type: integer (or Expression with resultType integer), minimum: 0. + * + * @param index the index value to set + * @return the WebTableDataset object itself. + */ + public WebTableDataset withIndex(Object index) { + this.index = index; + return this; + } + + /** + * Get the relative URL to the web page from the linked service URL. Type: string (or Expression with resultType string). + * + * @return the path value + */ + public Object path() { + return this.path; + } + + /** + * Set the relative URL to the web page from the linked service URL. Type: string (or Expression with resultType string). + * + * @param path the path value to set + * @return the WebTableDataset object itself. + */ + public WebTableDataset withPath(Object path) { + this.path = path; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/XeroLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/XeroLinkedService.java new file mode 100644 index 000000000000..c193d4b8ffc8 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/XeroLinkedService.java @@ -0,0 +1,217 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Xero Service linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Xero") +@JsonFlatten +public class XeroLinkedService extends LinkedServiceInner { + /** + * The endpoint of the Xero server. (i.e. api.xero.com). + */ + @JsonProperty(value = "typeProperties.host", required = true) + private Object host; + + /** + * The consumer key associated with the Xero application. + */ + @JsonProperty(value = "typeProperties.consumerKey") + private SecretBase consumerKey; + + /** + * The private key from the .pem file that was generated for your Xero + * private application. You must include all the text from the .pem file, + * including the Unix line endings( + * ). + */ + @JsonProperty(value = "typeProperties.privateKey") + private SecretBase privateKey; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the endpoint of the Xero server. (i.e. api.xero.com). + * + * @return the host value + */ + public Object host() { + return this.host; + } + + /** + * Set the endpoint of the Xero server. (i.e. api.xero.com). + * + * @param host the host value to set + * @return the XeroLinkedService object itself. + */ + public XeroLinkedService withHost(Object host) { + this.host = host; + return this; + } + + /** + * Get the consumer key associated with the Xero application. + * + * @return the consumerKey value + */ + public SecretBase consumerKey() { + return this.consumerKey; + } + + /** + * Set the consumer key associated with the Xero application. + * + * @param consumerKey the consumerKey value to set + * @return the XeroLinkedService object itself. + */ + public XeroLinkedService withConsumerKey(SecretBase consumerKey) { + this.consumerKey = consumerKey; + return this; + } + + /** + * Get the private key from the .pem file that was generated for your Xero private application. You must include all the text from the .pem file, including the Unix line endings( + ). + * + * @return the privateKey value + */ + public SecretBase privateKey() { + return this.privateKey; + } + + /** + * Set the private key from the .pem file that was generated for your Xero private application. You must include all the text from the .pem file, including the Unix line endings( + ). + * + * @param privateKey the privateKey value to set + * @return the XeroLinkedService object itself. + */ + public XeroLinkedService withPrivateKey(SecretBase privateKey) { + this.privateKey = privateKey; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the XeroLinkedService object itself. + */ + public XeroLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the XeroLinkedService object itself. + */ + public XeroLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the XeroLinkedService object itself. + */ + public XeroLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the XeroLinkedService object itself. + */ + public XeroLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/XeroObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/XeroObjectDataset.java new file mode 100644 index 000000000000..ac40ed1561de --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/XeroObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Xero Service dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("XeroObject") +public class XeroObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/XeroSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/XeroSource.java new file mode 100644 index 000000000000..ac46e892c85e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/XeroSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Xero Service source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("XeroSource") +public class XeroSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the XeroSource object itself. + */ + public XeroSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ZohoLinkedService.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ZohoLinkedService.java new file mode 100644 index 000000000000..c56f59e4661d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ZohoLinkedService.java @@ -0,0 +1,186 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.LinkedServiceInner; + +/** + * Zoho server linked service. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Zoho") +@JsonFlatten +public class ZohoLinkedService extends LinkedServiceInner { + /** + * The endpoint of the Zoho server. (i.e. crm.zoho.com/crm/private). + */ + @JsonProperty(value = "typeProperties.endpoint", required = true) + private Object endpoint; + + /** + * The access token for Zoho authentication. + */ + @JsonProperty(value = "typeProperties.accessToken") + private SecretBase accessToken; + + /** + * Specifies whether the data source endpoints are encrypted using HTTPS. + * The default value is true. + */ + @JsonProperty(value = "typeProperties.useEncryptedEndpoints") + private Object useEncryptedEndpoints; + + /** + * Specifies whether to require the host name in the server's certificate + * to match the host name of the server when connecting over SSL. The + * default value is true. + */ + @JsonProperty(value = "typeProperties.useHostVerification") + private Object useHostVerification; + + /** + * Specifies whether to verify the identity of the server when connecting + * over SSL. The default value is true. + */ + @JsonProperty(value = "typeProperties.usePeerVerification") + private Object usePeerVerification; + + /** + * The encrypted credential used for authentication. Credentials are + * encrypted using the integration runtime credential manager. Type: string + * (or Expression with resultType string). + */ + @JsonProperty(value = "typeProperties.encryptedCredential") + private Object encryptedCredential; + + /** + * Get the endpoint of the Zoho server. (i.e. crm.zoho.com/crm/private). + * + * @return the endpoint value + */ + public Object endpoint() { + return this.endpoint; + } + + /** + * Set the endpoint of the Zoho server. (i.e. crm.zoho.com/crm/private). + * + * @param endpoint the endpoint value to set + * @return the ZohoLinkedService object itself. + */ + public ZohoLinkedService withEndpoint(Object endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Get the access token for Zoho authentication. + * + * @return the accessToken value + */ + public SecretBase accessToken() { + return this.accessToken; + } + + /** + * Set the access token for Zoho authentication. + * + * @param accessToken the accessToken value to set + * @return the ZohoLinkedService object itself. + */ + public ZohoLinkedService withAccessToken(SecretBase accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Get specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @return the useEncryptedEndpoints value + */ + public Object useEncryptedEndpoints() { + return this.useEncryptedEndpoints; + } + + /** + * Set specifies whether the data source endpoints are encrypted using HTTPS. The default value is true. + * + * @param useEncryptedEndpoints the useEncryptedEndpoints value to set + * @return the ZohoLinkedService object itself. + */ + public ZohoLinkedService withUseEncryptedEndpoints(Object useEncryptedEndpoints) { + this.useEncryptedEndpoints = useEncryptedEndpoints; + return this; + } + + /** + * Get specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @return the useHostVerification value + */ + public Object useHostVerification() { + return this.useHostVerification; + } + + /** + * Set specifies whether to require the host name in the server's certificate to match the host name of the server when connecting over SSL. The default value is true. + * + * @param useHostVerification the useHostVerification value to set + * @return the ZohoLinkedService object itself. + */ + public ZohoLinkedService withUseHostVerification(Object useHostVerification) { + this.useHostVerification = useHostVerification; + return this; + } + + /** + * Get specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @return the usePeerVerification value + */ + public Object usePeerVerification() { + return this.usePeerVerification; + } + + /** + * Set specifies whether to verify the identity of the server when connecting over SSL. The default value is true. + * + * @param usePeerVerification the usePeerVerification value to set + * @return the ZohoLinkedService object itself. + */ + public ZohoLinkedService withUsePeerVerification(Object usePeerVerification) { + this.usePeerVerification = usePeerVerification; + return this; + } + + /** + * Get the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @return the encryptedCredential value + */ + public Object encryptedCredential() { + return this.encryptedCredential; + } + + /** + * Set the encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string). + * + * @param encryptedCredential the encryptedCredential value to set + * @return the ZohoLinkedService object itself. + */ + public ZohoLinkedService withEncryptedCredential(Object encryptedCredential) { + this.encryptedCredential = encryptedCredential; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ZohoObjectDataset.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ZohoObjectDataset.java new file mode 100644 index 000000000000..94f1e807baf0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ZohoObjectDataset.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation.DatasetInner; + +/** + * Zoho server dataset. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ZohoObject") +public class ZohoObjectDataset extends DatasetInner { +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ZohoSource.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ZohoSource.java new file mode 100644 index 000000000000..b26c120304c0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/ZohoSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A copy activity Zoho server source. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ZohoSource") +public class ZohoSource extends CopySource { + /** + * A query to retrieve data from source. Type: string (or Expression with + * resultType string). + */ + @JsonProperty(value = "query") + private Object query; + + /** + * Get a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @return the query value + */ + public Object query() { + return this.query; + } + + /** + * Set a query to retrieve data from source. Type: string (or Expression with resultType string). + * + * @param query the query value to set + * @return the ZohoSource object itself. + */ + public ZohoSource withQuery(Object query) { + this.query = query; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunImpl.java new file mode 100644 index 000000000000..65b28a795b43 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunImpl.java @@ -0,0 +1,102 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ActivityRun; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.Map; + +class ActivityRunImpl extends WrapperImpl implements ActivityRun { + private final DataFactoryManager manager; + + ActivityRunImpl(ActivityRunInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + + + @Override + public String activityName() { + return this.inner().activityName(); + } + + @Override + public DateTime activityRunEnd() { + return this.inner().activityRunEnd(); + } + + @Override + public String activityRunId() { + return this.inner().activityRunId(); + } + + @Override + public DateTime activityRunStart() { + return this.inner().activityRunStart(); + } + + @Override + public String activityType() { + return this.inner().activityType(); + } + + @Override + public Map additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public Integer durationInMs() { + return this.inner().durationInMs(); + } + + @Override + public Object error() { + return this.inner().error(); + } + + @Override + public Object input() { + return this.inner().input(); + } + + @Override + public String linkedServiceName() { + return this.inner().linkedServiceName(); + } + + @Override + public Object output() { + return this.inner().output(); + } + + @Override + public String pipelineName() { + return this.inner().pipelineName(); + } + + @Override + public String pipelineRunId() { + return this.inner().pipelineRunId(); + } + + @Override + public String status() { + return this.inner().status(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunInner.java new file mode 100644 index 000000000000..6c634d2dca13 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunInner.java @@ -0,0 +1,240 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about an activity run in a pipeline. + */ +public class ActivityRunInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The name of the pipeline. + */ + @JsonProperty(value = "pipelineName", access = JsonProperty.Access.WRITE_ONLY) + private String pipelineName; + + /** + * The id of the pipeline run. + */ + @JsonProperty(value = "pipelineRunId", access = JsonProperty.Access.WRITE_ONLY) + private String pipelineRunId; + + /** + * The name of the activity. + */ + @JsonProperty(value = "activityName", access = JsonProperty.Access.WRITE_ONLY) + private String activityName; + + /** + * The type of the activity. + */ + @JsonProperty(value = "activityType", access = JsonProperty.Access.WRITE_ONLY) + private String activityType; + + /** + * The id of the activity run. + */ + @JsonProperty(value = "activityRunId", access = JsonProperty.Access.WRITE_ONLY) + private String activityRunId; + + /** + * The name of the compute linked service. + */ + @JsonProperty(value = "linkedServiceName", access = JsonProperty.Access.WRITE_ONLY) + private String linkedServiceName; + + /** + * The status of the activity run. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The start time of the activity run in 'ISO 8601' format. + */ + @JsonProperty(value = "activityRunStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime activityRunStart; + + /** + * The end time of the activity run in 'ISO 8601' format. + */ + @JsonProperty(value = "activityRunEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime activityRunEnd; + + /** + * The duration of the activity run. + */ + @JsonProperty(value = "durationInMs", access = JsonProperty.Access.WRITE_ONLY) + private Integer durationInMs; + + /** + * The input for the activity. + */ + @JsonProperty(value = "input", access = JsonProperty.Access.WRITE_ONLY) + private Object input; + + /** + * The output for the activity. + */ + @JsonProperty(value = "output", access = JsonProperty.Access.WRITE_ONLY) + private Object output; + + /** + * The error if any from the activity run. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private Object error; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ActivityRunInner object itself. + */ + public ActivityRunInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the name of the pipeline. + * + * @return the pipelineName value + */ + public String pipelineName() { + return this.pipelineName; + } + + /** + * Get the id of the pipeline run. + * + * @return the pipelineRunId value + */ + public String pipelineRunId() { + return this.pipelineRunId; + } + + /** + * Get the name of the activity. + * + * @return the activityName value + */ + public String activityName() { + return this.activityName; + } + + /** + * Get the type of the activity. + * + * @return the activityType value + */ + public String activityType() { + return this.activityType; + } + + /** + * Get the id of the activity run. + * + * @return the activityRunId value + */ + public String activityRunId() { + return this.activityRunId; + } + + /** + * Get the name of the compute linked service. + * + * @return the linkedServiceName value + */ + public String linkedServiceName() { + return this.linkedServiceName; + } + + /** + * Get the status of the activity run. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the start time of the activity run in 'ISO 8601' format. + * + * @return the activityRunStart value + */ + public DateTime activityRunStart() { + return this.activityRunStart; + } + + /** + * Get the end time of the activity run in 'ISO 8601' format. + * + * @return the activityRunEnd value + */ + public DateTime activityRunEnd() { + return this.activityRunEnd; + } + + /** + * Get the duration of the activity run. + * + * @return the durationInMs value + */ + public Integer durationInMs() { + return this.durationInMs; + } + + /** + * Get the input for the activity. + * + * @return the input value + */ + public Object input() { + return this.input; + } + + /** + * Get the output for the activity. + * + * @return the output value + */ + public Object output() { + return this.output; + } + + /** + * Get the error if any from the activity run. + * + * @return the error value + */ + public Object error() { + return this.error; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunsImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunsImpl.java new file mode 100644 index 000000000000..17e1f761fa37 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunsImpl.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ActivityRuns; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ActivityRun; + +class ActivityRunsImpl extends WrapperImpl implements ActivityRuns { + private final DataFactoryManager manager; + + ActivityRunsImpl(DataFactoryManager manager) { + super(manager.inner().activityRuns()); + this.manager = manager; + } + + public DataFactoryManager manager() { + return this.manager; + } + + private ActivityRunImpl wrapModel(ActivityRunInner inner) { + return new ActivityRunImpl(inner, manager()); + } + + @Override + public Observable listByPipelineRunAsync(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime) { + ActivityRunsInner client = this.inner(); + return client.listByPipelineRunAsync(resourceGroupName, factoryName, runId, startTime, endTime) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ActivityRun call(ActivityRunInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunsInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunsInner.java new file mode 100644 index 000000000000..3f0c465ab577 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/ActivityRunsInner.java @@ -0,0 +1,486 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ActivityRuns. + */ +public class ActivityRunsInner { + /** The Retrofit service to perform REST calls. */ + private ActivityRunsService service; + /** The service client containing this operation class. */ + private DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of ActivityRunsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ActivityRunsInner(Retrofit retrofit, DataFactoryManagementClientImpl client) { + this.service = retrofit.create(ActivityRunsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ActivityRuns to be + * used by Retrofit to perform actually REST calls. + */ + interface ActivityRunsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.ActivityRuns listByPipelineRun" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelineruns/{runId}/activityruns") + Observable> listByPipelineRun(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("runId") String runId, @Query("api-version") String apiVersion, @Query("startTime") DateTime startTime, @Query("endTime") DateTime endTime, @Query("status") String status, @Query("activityName") String activityName, @Query("linkedServiceName") String linkedServiceName, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.ActivityRuns listByPipelineRunNext" }) + @GET + Observable> listByPipelineRunNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List activity runs based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param startTime The start time of activity runs in ISO8601 format. + * @param endTime The end time of activity runs in ISO8601 format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ActivityRunInner> object if successful. + */ + public PagedList listByPipelineRun(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime) { + ServiceResponse> response = listByPipelineRunSinglePageAsync(resourceGroupName, factoryName, runId, startTime, endTime).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPipelineRunNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List activity runs based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param startTime The start time of activity runs in ISO8601 format. + * @param endTime The end time of activity runs in ISO8601 format. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPipelineRunAsync(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPipelineRunSinglePageAsync(resourceGroupName, factoryName, runId, startTime, endTime), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPipelineRunNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List activity runs based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param startTime The start time of activity runs in ISO8601 format. + * @param endTime The end time of activity runs in ISO8601 format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ActivityRunInner> object + */ + public Observable> listByPipelineRunAsync(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime) { + return listByPipelineRunWithServiceResponseAsync(resourceGroupName, factoryName, runId, startTime, endTime) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List activity runs based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param startTime The start time of activity runs in ISO8601 format. + * @param endTime The end time of activity runs in ISO8601 format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ActivityRunInner> object + */ + public Observable>> listByPipelineRunWithServiceResponseAsync(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime) { + return listByPipelineRunSinglePageAsync(resourceGroupName, factoryName, runId, startTime, endTime) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPipelineRunNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List activity runs based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param startTime The start time of activity runs in ISO8601 format. + * @param endTime The end time of activity runs in ISO8601 format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ActivityRunInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPipelineRunSinglePageAsync(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (runId == null) { + throw new IllegalArgumentException("Parameter runId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startTime == null) { + throw new IllegalArgumentException("Parameter startTime is required and cannot be null."); + } + if (endTime == null) { + throw new IllegalArgumentException("Parameter endTime is required and cannot be null."); + } + final String status = null; + final String activityName = null; + final String linkedServiceName = null; + return service.listByPipelineRun(this.client.subscriptionId(), resourceGroupName, factoryName, runId, this.client.apiVersion(), startTime, endTime, status, activityName, linkedServiceName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPipelineRunDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List activity runs based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param startTime The start time of activity runs in ISO8601 format. + * @param endTime The end time of activity runs in ISO8601 format. + * @param status The status of the pipeline run. + * @param activityName The name of the activity. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ActivityRunInner> object if successful. + */ + public PagedList listByPipelineRun(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime, final String status, final String activityName, final String linkedServiceName) { + ServiceResponse> response = listByPipelineRunSinglePageAsync(resourceGroupName, factoryName, runId, startTime, endTime, status, activityName, linkedServiceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPipelineRunNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List activity runs based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param startTime The start time of activity runs in ISO8601 format. + * @param endTime The end time of activity runs in ISO8601 format. + * @param status The status of the pipeline run. + * @param activityName The name of the activity. + * @param linkedServiceName The linked service name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPipelineRunAsync(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime, final String status, final String activityName, final String linkedServiceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPipelineRunSinglePageAsync(resourceGroupName, factoryName, runId, startTime, endTime, status, activityName, linkedServiceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPipelineRunNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List activity runs based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param startTime The start time of activity runs in ISO8601 format. + * @param endTime The end time of activity runs in ISO8601 format. + * @param status The status of the pipeline run. + * @param activityName The name of the activity. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ActivityRunInner> object + */ + public Observable> listByPipelineRunAsync(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime, final String status, final String activityName, final String linkedServiceName) { + return listByPipelineRunWithServiceResponseAsync(resourceGroupName, factoryName, runId, startTime, endTime, status, activityName, linkedServiceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List activity runs based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param startTime The start time of activity runs in ISO8601 format. + * @param endTime The end time of activity runs in ISO8601 format. + * @param status The status of the pipeline run. + * @param activityName The name of the activity. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ActivityRunInner> object + */ + public Observable>> listByPipelineRunWithServiceResponseAsync(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime, final String status, final String activityName, final String linkedServiceName) { + return listByPipelineRunSinglePageAsync(resourceGroupName, factoryName, runId, startTime, endTime, status, activityName, linkedServiceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPipelineRunNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List activity runs based on input filter conditions. + * + ServiceResponse> * @param resourceGroupName The resource group name. + ServiceResponse> * @param factoryName The factory name. + ServiceResponse> * @param runId The pipeline run identifier. + ServiceResponse> * @param startTime The start time of activity runs in ISO8601 format. + ServiceResponse> * @param endTime The end time of activity runs in ISO8601 format. + ServiceResponse> * @param status The status of the pipeline run. + ServiceResponse> * @param activityName The name of the activity. + ServiceResponse> * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ActivityRunInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPipelineRunSinglePageAsync(final String resourceGroupName, final String factoryName, final String runId, final DateTime startTime, final DateTime endTime, final String status, final String activityName, final String linkedServiceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (runId == null) { + throw new IllegalArgumentException("Parameter runId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startTime == null) { + throw new IllegalArgumentException("Parameter startTime is required and cannot be null."); + } + if (endTime == null) { + throw new IllegalArgumentException("Parameter endTime is required and cannot be null."); + } + return service.listByPipelineRun(this.client.subscriptionId(), resourceGroupName, factoryName, runId, this.client.apiVersion(), startTime, endTime, status, activityName, linkedServiceName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPipelineRunDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByPipelineRunDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List activity runs based on input filter conditions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ActivityRunInner> object if successful. + */ + public PagedList listByPipelineRunNext(final String nextPageLink) { + ServiceResponse> response = listByPipelineRunNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByPipelineRunNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List activity runs based on input filter conditions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByPipelineRunNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByPipelineRunNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByPipelineRunNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List activity runs based on input filter conditions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ActivityRunInner> object + */ + public Observable> listByPipelineRunNextAsync(final String nextPageLink) { + return listByPipelineRunNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List activity runs based on input filter conditions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ActivityRunInner> object + */ + public Observable>> listByPipelineRunNextWithServiceResponseAsync(final String nextPageLink) { + return listByPipelineRunNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByPipelineRunNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List activity runs based on input filter conditions. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ActivityRunInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByPipelineRunNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByPipelineRunNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByPipelineRunNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByPipelineRunNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/CreateRunResponseImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/CreateRunResponseImpl.java new file mode 100644 index 000000000000..e3aa7d8196ee --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/CreateRunResponseImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.CreateRunResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class CreateRunResponseImpl extends WrapperImpl implements CreateRunResponse { + private final DataFactoryManager manager; + CreateRunResponseImpl(CreateRunResponseInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public String runId() { + return this.inner().runId(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/CreateRunResponseInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/CreateRunResponseInner.java new file mode 100644 index 000000000000..b8bbb0845ae2 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/CreateRunResponseInner.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response body with a run identifier. + */ +public class CreateRunResponseInner { + /** + * Identifier of a run. + */ + @JsonProperty(value = "runId", required = true) + private String runId; + + /** + * Get identifier of a run. + * + * @return the runId value + */ + public String runId() { + return this.runId; + } + + /** + * Set identifier of a run. + * + * @param runId the runId value to set + * @return the CreateRunResponseInner object itself. + */ + public CreateRunResponseInner withRunId(String runId) { + this.runId = runId; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DataFactoryManagementClientImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DataFactoryManagementClientImpl.java new file mode 100644 index 000000000000..54a4966ae97a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DataFactoryManagementClientImpl.java @@ -0,0 +1,322 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the DataFactoryManagementClientImpl class. + */ +public class DataFactoryManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The subscription identifier. */ + private String subscriptionId; + + /** + * Gets The subscription identifier. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription identifier. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public DataFactoryManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version. */ + private String apiVersion; + + /** + * Gets The API version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public DataFactoryManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public DataFactoryManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public DataFactoryManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The FactoriesInner object to access its operations. + */ + private FactoriesInner factories; + + /** + * Gets the FactoriesInner object to access its operations. + * @return the FactoriesInner object. + */ + public FactoriesInner factories() { + return this.factories; + } + + /** + * The IntegrationRuntimesInner object to access its operations. + */ + private IntegrationRuntimesInner integrationRuntimes; + + /** + * Gets the IntegrationRuntimesInner object to access its operations. + * @return the IntegrationRuntimesInner object. + */ + public IntegrationRuntimesInner integrationRuntimes() { + return this.integrationRuntimes; + } + + /** + * The IntegrationRuntimeNodesInner object to access its operations. + */ + private IntegrationRuntimeNodesInner integrationRuntimeNodes; + + /** + * Gets the IntegrationRuntimeNodesInner object to access its operations. + * @return the IntegrationRuntimeNodesInner object. + */ + public IntegrationRuntimeNodesInner integrationRuntimeNodes() { + return this.integrationRuntimeNodes; + } + + /** + * The LinkedServicesInner object to access its operations. + */ + private LinkedServicesInner linkedServices; + + /** + * Gets the LinkedServicesInner object to access its operations. + * @return the LinkedServicesInner object. + */ + public LinkedServicesInner linkedServices() { + return this.linkedServices; + } + + /** + * The DatasetsInner object to access its operations. + */ + private DatasetsInner datasets; + + /** + * Gets the DatasetsInner object to access its operations. + * @return the DatasetsInner object. + */ + public DatasetsInner datasets() { + return this.datasets; + } + + /** + * The PipelinesInner object to access its operations. + */ + private PipelinesInner pipelines; + + /** + * Gets the PipelinesInner object to access its operations. + * @return the PipelinesInner object. + */ + public PipelinesInner pipelines() { + return this.pipelines; + } + + /** + * The PipelineRunsInner object to access its operations. + */ + private PipelineRunsInner pipelineRuns; + + /** + * Gets the PipelineRunsInner object to access its operations. + * @return the PipelineRunsInner object. + */ + public PipelineRunsInner pipelineRuns() { + return this.pipelineRuns; + } + + /** + * The ActivityRunsInner object to access its operations. + */ + private ActivityRunsInner activityRuns; + + /** + * Gets the ActivityRunsInner object to access its operations. + * @return the ActivityRunsInner object. + */ + public ActivityRunsInner activityRuns() { + return this.activityRuns; + } + + /** + * The TriggersInner object to access its operations. + */ + private TriggersInner triggers; + + /** + * Gets the TriggersInner object to access its operations. + * @return the TriggersInner object. + */ + public TriggersInner triggers() { + return this.triggers; + } + + /** + * Initializes an instance of DataFactoryManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public DataFactoryManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of DataFactoryManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public DataFactoryManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of DataFactoryManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public DataFactoryManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-09-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.factories = new FactoriesInner(restClient().retrofit(), this); + this.integrationRuntimes = new IntegrationRuntimesInner(restClient().retrofit(), this); + this.integrationRuntimeNodes = new IntegrationRuntimeNodesInner(restClient().retrofit(), this); + this.linkedServices = new LinkedServicesInner(restClient().retrofit(), this); + this.datasets = new DatasetsInner(restClient().retrofit(), this); + this.pipelines = new PipelinesInner(restClient().retrofit(), this); + this.pipelineRuns = new PipelineRunsInner(restClient().retrofit(), this); + this.activityRuns = new ActivityRunsInner(restClient().retrofit(), this); + this.triggers = new TriggersInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "DataFactoryManagementClient", "2017-09-01-preview"); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DataFactoryManager.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DataFactoryManager.java new file mode 100644 index 000000000000..5d331fd766f7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DataFactoryManager.java @@ -0,0 +1,207 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Operations; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeNodes; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServices; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Datasets; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Pipelines; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRuns; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ActivityRuns; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure DataFactory resource management. + */ +public final class DataFactoryManager extends ManagerCore { + private Operations operations; + private Factories factories; + private IntegrationRuntimes integrationRuntimes; + private IntegrationRuntimeNodes integrationRuntimeNodes; + private LinkedServices linkedServices; + private Datasets datasets; + private Pipelines pipelines; + private PipelineRuns pipelineRuns; + private ActivityRuns activityRuns; + private Triggers triggers; + /** + * Get a Configurable instance that can be used to create DataFactoryManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new DataFactoryManager.ConfigurableImpl(); + } + /** + * Creates an instance of DataFactoryManager that exposes DataFactory resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the DataFactoryManager + */ + public static DataFactoryManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new DataFactoryManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of DataFactoryManager that exposes DataFactory resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the DataFactoryManager + */ + public static DataFactoryManager authenticate(RestClient restClient, String subscriptionId) { + return new DataFactoryManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of DataFactoryManager that exposes DataFactory management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing DataFactory management API entry points that work across subscriptions + */ + DataFactoryManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Factories. + */ + public Factories factories() { + if (this.factories == null) { + this.factories = new FactoriesImpl(this); + } + return this.factories; + } + + /** + * @return Entry point to manage IntegrationRuntimes. + */ + public IntegrationRuntimes integrationRuntimes() { + if (this.integrationRuntimes == null) { + this.integrationRuntimes = new IntegrationRuntimesImpl(this); + } + return this.integrationRuntimes; + } + + /** + * @return Entry point to manage IntegrationRuntimeNodes. + */ + public IntegrationRuntimeNodes integrationRuntimeNodes() { + if (this.integrationRuntimeNodes == null) { + this.integrationRuntimeNodes = new IntegrationRuntimeNodesImpl(this); + } + return this.integrationRuntimeNodes; + } + + /** + * @return Entry point to manage LinkedServices. + */ + public LinkedServices linkedServices() { + if (this.linkedServices == null) { + this.linkedServices = new LinkedServicesImpl(this); + } + return this.linkedServices; + } + + /** + * @return Entry point to manage Datasets. + */ + public Datasets datasets() { + if (this.datasets == null) { + this.datasets = new DatasetsImpl(this); + } + return this.datasets; + } + + /** + * @return Entry point to manage Pipelines. + */ + public Pipelines pipelines() { + if (this.pipelines == null) { + this.pipelines = new PipelinesImpl(this); + } + return this.pipelines; + } + + /** + * @return Entry point to manage PipelineRuns. + */ + public PipelineRuns pipelineRuns() { + if (this.pipelineRuns == null) { + this.pipelineRuns = new PipelineRunsImpl(this); + } + return this.pipelineRuns; + } + + /** + * @return Entry point to manage ActivityRuns. + */ + public ActivityRuns activityRuns() { + if (this.activityRuns == null) { + this.activityRuns = new ActivityRunsImpl(this); + } + return this.activityRuns; + } + + /** + * @return Entry point to manage Triggers. + */ + public Triggers triggers() { + if (this.triggers == null) { + this.triggers = new TriggersImpl(this); + } + return this.triggers; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public DataFactoryManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return DataFactoryManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private DataFactoryManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new DataFactoryManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetInner.java new file mode 100644 index 000000000000..ddf3f8e6bee5 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetInner.java @@ -0,0 +1,239 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServiceReference; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ParameterSpecification; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The Azure Data Factory nested object which identifies data within different + * data stores, such as tables, files, folders, and documents. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Dataset") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ResponsysObject", value = ResponsysObjectDataset.class), + @JsonSubTypes.Type(name = "SalesforceMarketingCloudObject", value = SalesforceMarketingCloudObjectDataset.class), + @JsonSubTypes.Type(name = "VerticaTable", value = VerticaTableDataset.class), + @JsonSubTypes.Type(name = "NetezzaTable", value = NetezzaTableDataset.class), + @JsonSubTypes.Type(name = "ZohoObject", value = ZohoObjectDataset.class), + @JsonSubTypes.Type(name = "XeroObject", value = XeroObjectDataset.class), + @JsonSubTypes.Type(name = "SquareObject", value = SquareObjectDataset.class), + @JsonSubTypes.Type(name = "SparkObject", value = SparkObjectDataset.class), + @JsonSubTypes.Type(name = "ShopifyObject", value = ShopifyObjectDataset.class), + @JsonSubTypes.Type(name = "ServiceNowObject", value = ServiceNowObjectDataset.class), + @JsonSubTypes.Type(name = "QuickBooksObject", value = QuickBooksObjectDataset.class), + @JsonSubTypes.Type(name = "PrestoObject", value = PrestoObjectDataset.class), + @JsonSubTypes.Type(name = "PhoenixObject", value = PhoenixObjectDataset.class), + @JsonSubTypes.Type(name = "PaypalObject", value = PaypalObjectDataset.class), + @JsonSubTypes.Type(name = "MarketoObject", value = MarketoObjectDataset.class), + @JsonSubTypes.Type(name = "MariaDBTable", value = MariaDBTableDataset.class), + @JsonSubTypes.Type(name = "MagentoObject", value = MagentoObjectDataset.class), + @JsonSubTypes.Type(name = "JiraObject", value = JiraObjectDataset.class), + @JsonSubTypes.Type(name = "ImpalaObject", value = ImpalaObjectDataset.class), + @JsonSubTypes.Type(name = "HubspotObject", value = HubspotObjectDataset.class), + @JsonSubTypes.Type(name = "HiveObject", value = HiveObjectDataset.class), + @JsonSubTypes.Type(name = "HBaseObject", value = HBaseObjectDataset.class), + @JsonSubTypes.Type(name = "GreenplumTable", value = GreenplumTableDataset.class), + @JsonSubTypes.Type(name = "GoogleBigQueryObject", value = GoogleBigQueryObjectDataset.class), + @JsonSubTypes.Type(name = "EloquaObject", value = EloquaObjectDataset.class), + @JsonSubTypes.Type(name = "DrillTable", value = DrillTableDataset.class), + @JsonSubTypes.Type(name = "CouchbaseTable", value = CouchbaseTableDataset.class), + @JsonSubTypes.Type(name = "ConcurObject", value = ConcurObjectDataset.class), + @JsonSubTypes.Type(name = "AzurePostgreSqlTable", value = AzurePostgreSqlTableDataset.class), + @JsonSubTypes.Type(name = "AmazonMWSObject", value = AmazonMWSObjectDataset.class), + @JsonSubTypes.Type(name = "HttpFile", value = HttpDataset.class), + @JsonSubTypes.Type(name = "AzureSearchIndex", value = AzureSearchIndexDataset.class), + @JsonSubTypes.Type(name = "WebTable", value = WebTableDataset.class), + @JsonSubTypes.Type(name = "SqlServerTable", value = SqlServerTableDataset.class), + @JsonSubTypes.Type(name = "SapEccResource", value = SapEccResourceDataset.class), + @JsonSubTypes.Type(name = "SapCloudForCustomerResource", value = SapCloudForCustomerResourceDataset.class), + @JsonSubTypes.Type(name = "SalesforceObject", value = SalesforceObjectDataset.class), + @JsonSubTypes.Type(name = "RelationalTable", value = RelationalTableDataset.class), + @JsonSubTypes.Type(name = "AzureMySqlTable", value = AzureMySqlTableDataset.class), + @JsonSubTypes.Type(name = "OracleTable", value = OracleTableDataset.class), + @JsonSubTypes.Type(name = "ODataResource", value = ODataResourceDataset.class), + @JsonSubTypes.Type(name = "MongoDbCollection", value = MongoDbCollectionDataset.class), + @JsonSubTypes.Type(name = "FileShare", value = FileShareDataset.class), + @JsonSubTypes.Type(name = "AzureDataLakeStoreFile", value = AzureDataLakeStoreDataset.class), + @JsonSubTypes.Type(name = "DynamicsEntity", value = DynamicsEntityDataset.class), + @JsonSubTypes.Type(name = "DocumentDbCollection", value = DocumentDbCollectionDataset.class), + @JsonSubTypes.Type(name = "CustomDataset", value = CustomDataset.class), + @JsonSubTypes.Type(name = "CassandraTable", value = CassandraTableDataset.class), + @JsonSubTypes.Type(name = "AzureSqlDWTable", value = AzureSqlDWTableDataset.class), + @JsonSubTypes.Type(name = "AzureSqlTable", value = AzureSqlTableDataset.class), + @JsonSubTypes.Type(name = "AzureTable", value = AzureTableDataset.class), + @JsonSubTypes.Type(name = "AzureBlob", value = AzureBlobDataset.class), + @JsonSubTypes.Type(name = "AmazonS3Object", value = AmazonS3Dataset.class) +}) +public class DatasetInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Dataset description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Columns that define the structure of the dataset. Type: array (or + * Expression with resultType array), itemType: DatasetDataElement. + */ + @JsonProperty(value = "structure") + private Object structure; + + /** + * Linked service reference. + */ + @JsonProperty(value = "linkedServiceName", required = true) + private LinkedServiceReference linkedServiceName; + + /** + * Parameters for dataset. + */ + @JsonProperty(value = "parameters") + private Map parameters; + + /** + * List of tags that can be used for describing the Dataset. + */ + @JsonProperty(value = "annotations") + private List annotations; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the DatasetInner object itself. + */ + public DatasetInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get dataset description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set dataset description. + * + * @param description the description value to set + * @return the DatasetInner object itself. + */ + public DatasetInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. + * + * @return the structure value + */ + public Object structure() { + return this.structure; + } + + /** + * Set columns that define the structure of the dataset. Type: array (or Expression with resultType array), itemType: DatasetDataElement. + * + * @param structure the structure value to set + * @return the DatasetInner object itself. + */ + public DatasetInner withStructure(Object structure) { + this.structure = structure; + return this; + } + + /** + * Get linked service reference. + * + * @return the linkedServiceName value + */ + public LinkedServiceReference linkedServiceName() { + return this.linkedServiceName; + } + + /** + * Set linked service reference. + * + * @param linkedServiceName the linkedServiceName value to set + * @return the DatasetInner object itself. + */ + public DatasetInner withLinkedServiceName(LinkedServiceReference linkedServiceName) { + this.linkedServiceName = linkedServiceName; + return this; + } + + /** + * Get parameters for dataset. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set parameters for dataset. + * + * @param parameters the parameters value to set + * @return the DatasetInner object itself. + */ + public DatasetInner withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get list of tags that can be used for describing the Dataset. + * + * @return the annotations value + */ + public List annotations() { + return this.annotations; + } + + /** + * Set list of tags that can be used for describing the Dataset. + * + * @param annotations the annotations value to set + * @return the DatasetInner object itself. + */ + public DatasetInner withAnnotations(List annotations) { + this.annotations = annotations; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetResourceImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetResourceImpl.java new file mode 100644 index 000000000000..2bc41bae7c35 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetResourceImpl.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.DatasetResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServiceReference; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ParameterSpecification; +import java.util.List; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.; +import rx.functions.Func1; + +class DatasetResourceImpl extends CreatableUpdatableImpl implements DatasetResource, DatasetResource.Definition, DatasetResource.Update { + private final DataFactoryManager manager; + private String resourceGroupName; + private String factoryName; + private String datasetName; + private String cifMatch; + private DatasetInner cproperties; + private String uifMatch; + private DatasetInner uproperties; + + DatasetResourceImpl(String name, DataFactoryManager manager) { + super(name, new DatasetResourceInner()); + this.manager = manager; + // Set resource name + this.datasetName = name; + // + this.cproperties = new DatasetInner(); + this.uproperties = new DatasetInner(); + } + + DatasetResourceImpl(DatasetResourceInner inner, DataFactoryManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.datasetName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.factoryName = IdParsingUtils.getValueFromIdByName(inner.id(), "factories"); + this.datasetName = IdParsingUtils.getValueFromIdByName(inner.id(), "datasets"); + // + this.cproperties = new DatasetInner(); + this.uproperties = new DatasetInner(); + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatasetsInner client = this.manager().inner().datasets(); + return client.createOrUpdateAsync(this.resourceGroupName, this.factoryName, this.datasetName, this.cproperties, this.cifMatch) + .map(new Func1() { + @Override + public DatasetResourceInner call(DatasetResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatasetsInner client = this.manager().inner().datasets(); + return client.createOrUpdateAsync(this.resourceGroupName, this.factoryName, this.datasetName, this.uproperties, this.uifMatch) + .map(new Func1() { + @Override + public DatasetResourceInner call(DatasetResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatasetsInner client = this.manager().inner().datasets(); + return client.getAsync(this.resourceGroupName, this.factoryName, this.datasetName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.cproperties = new DatasetInner(); + this.uproperties = new DatasetInner(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DatasetInner properties() { + return this.inner().properties(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatasetResourceImpl withExistingFactory(String resourceGroupName, String factoryName) { + this.resourceGroupName = resourceGroupName; + this.factoryName = factoryName; + return this; + } + + @Override + public DatasetResourceImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public DatasetResourceImpl withProperties(DatasetInner properties) { + if (isInCreateMode()) { + this.cproperties = properties; + } else { + this.uproperties = properties; + } + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetResourceInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetResourceInner.java new file mode 100644 index 000000000000..402ba6b8f90a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetResourceInner.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.SubResource; + +/** + * Dataset resource type. + */ +public class DatasetResourceInner extends SubResource { + /** + * Dataset properties. + */ + @JsonProperty(value = "properties", required = true) + private DatasetInner properties; + + /** + * The resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Etag identifies change in the resource. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get dataset properties. + * + * @return the properties value + */ + public DatasetInner properties() { + return this.properties; + } + + /** + * Set dataset properties. + * + * @param properties the properties value to set + * @return the DatasetResourceInner object itself. + */ + public DatasetResourceInner withProperties(DatasetInner properties) { + this.properties = properties; + return this; + } + + /** + * Get the resource name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get etag identifies change in the resource. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetsImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetsImpl.java new file mode 100644 index 000000000000..51621a9d2ffb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetsImpl.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Datasets; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.DatasetResource; + +class DatasetsImpl extends WrapperImpl implements Datasets { + private final DataFactoryManager manager; + + DatasetsImpl(DataFactoryManager manager) { + super(manager.inner().datasets()); + this.manager = manager; + } + + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public DatasetResourceImpl define(String name) { + return wrapModel(name); + } + + private DatasetResourceImpl wrapModel(DatasetResourceInner inner) { + return new DatasetResourceImpl(inner, manager()); + } + + private DatasetResourceImpl wrapModel(String name) { + return new DatasetResourceImpl(name, this.manager()); + } + + @Override + public Observable listByFactoryAsync(final String resourceGroupName, final String factoryName) { + DatasetsInner client = this.inner(); + return client.listByFactoryAsync(resourceGroupName, factoryName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DatasetResource call(DatasetResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String factoryName, String datasetName) { + DatasetsInner client = this.inner(); + return client.getAsync(resourceGroupName, factoryName, datasetName) + .map(new Func1() { + @Override + public DatasetResource call(DatasetResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String factoryName, String datasetName) { + DatasetsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, factoryName, datasetName).toCompletable(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetsInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetsInner.java new file mode 100644 index 000000000000..1340ec8db3c3 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/DatasetsInner.java @@ -0,0 +1,710 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Datasets. + */ +public class DatasetsInner { + /** The Retrofit service to perform REST calls. */ + private DatasetsService service; + /** The service client containing this operation class. */ + private DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of DatasetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatasetsInner(Retrofit retrofit, DataFactoryManagementClientImpl client) { + this.service = retrofit.create(DatasetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Datasets to be + * used by Retrofit to perform actually REST calls. + */ + interface DatasetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Datasets listByFactory" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets") + Observable> listByFactory(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Datasets createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("datasetName") String datasetName, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Body DatasetResourceInner dataset, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Datasets get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("datasetName") String datasetName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Datasets delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("datasetName") String datasetName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Datasets listByFactoryNext" }) + @GET + Observable> listByFactoryNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists datasets. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DatasetResourceInner> object if successful. + */ + public PagedList listByFactory(final String resourceGroupName, final String factoryName) { + ServiceResponse> response = listByFactorySinglePageAsync(resourceGroupName, factoryName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists datasets. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByFactoryAsync(final String resourceGroupName, final String factoryName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByFactorySinglePageAsync(resourceGroupName, factoryName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists datasets. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatasetResourceInner> object + */ + public Observable> listByFactoryAsync(final String resourceGroupName, final String factoryName) { + return listByFactoryWithServiceResponseAsync(resourceGroupName, factoryName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists datasets. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatasetResourceInner> object + */ + public Observable>> listByFactoryWithServiceResponseAsync(final String resourceGroupName, final String factoryName) { + return listByFactorySinglePageAsync(resourceGroupName, factoryName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByFactoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists datasets. + * + ServiceResponse> * @param resourceGroupName The resource group name. + ServiceResponse> * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatasetResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByFactorySinglePageAsync(final String resourceGroupName, final String factoryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByFactory(this.client.subscriptionId(), resourceGroupName, factoryName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByFactoryDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByFactoryDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @param properties Dataset properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatasetResourceInner object if successful. + */ + public DatasetResourceInner createOrUpdate(String resourceGroupName, String factoryName, String datasetName, DatasetInner properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, datasetName, properties).toBlocking().single().body(); + } + + /** + * Creates or updates a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @param properties Dataset properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, String datasetName, DatasetInner properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, datasetName, properties), serviceCallback); + } + + /** + * Creates or updates a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @param properties Dataset properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatasetResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, String datasetName, DatasetInner properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, datasetName, properties).map(new Func1, DatasetResourceInner>() { + @Override + public DatasetResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @param properties Dataset properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatasetResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, String datasetName, DatasetInner properties) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (datasetName == null) { + throw new IllegalArgumentException("Parameter datasetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + final String ifMatch = null; + DatasetResourceInner dataset = new DatasetResourceInner(); + dataset.withProperties(properties); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, datasetName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), dataset, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @param properties Dataset properties. + * @param ifMatch ETag of the dataset entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatasetResourceInner object if successful. + */ + public DatasetResourceInner createOrUpdate(String resourceGroupName, String factoryName, String datasetName, DatasetInner properties, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, datasetName, properties, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @param properties Dataset properties. + * @param ifMatch ETag of the dataset entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, String datasetName, DatasetInner properties, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, datasetName, properties, ifMatch), serviceCallback); + } + + /** + * Creates or updates a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @param properties Dataset properties. + * @param ifMatch ETag of the dataset entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatasetResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, String datasetName, DatasetInner properties, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, datasetName, properties, ifMatch).map(new Func1, DatasetResourceInner>() { + @Override + public DatasetResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @param properties Dataset properties. + * @param ifMatch ETag of the dataset entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatasetResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, String datasetName, DatasetInner properties, String ifMatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (datasetName == null) { + throw new IllegalArgumentException("Parameter datasetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + DatasetResourceInner dataset = new DatasetResourceInner(); + dataset.withProperties(properties); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, datasetName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), dataset, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatasetResourceInner object if successful. + */ + public DatasetResourceInner get(String resourceGroupName, String factoryName, String datasetName) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, datasetName).toBlocking().single().body(); + } + + /** + * Gets a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String factoryName, String datasetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, factoryName, datasetName), serviceCallback); + } + + /** + * Gets a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatasetResourceInner object + */ + public Observable getAsync(String resourceGroupName, String factoryName, String datasetName) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, datasetName).map(new Func1, DatasetResourceInner>() { + @Override + public DatasetResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatasetResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String factoryName, String datasetName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (datasetName == null) { + throw new IllegalArgumentException("Parameter datasetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, factoryName, datasetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String factoryName, String datasetName) { + deleteWithServiceResponseAsync(resourceGroupName, factoryName, datasetName).toBlocking().single().body(); + } + + /** + * Deletes a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String factoryName, String datasetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, factoryName, datasetName), serviceCallback); + } + + /** + * Deletes a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String factoryName, String datasetName) { + return deleteWithServiceResponseAsync(resourceGroupName, factoryName, datasetName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a dataset. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param datasetName The dataset name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String factoryName, String datasetName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (datasetName == null) { + throw new IllegalArgumentException("Parameter datasetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, factoryName, datasetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists datasets. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DatasetResourceInner> object if successful. + */ + public PagedList listByFactoryNext(final String nextPageLink) { + ServiceResponse> response = listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists datasets. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByFactoryNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByFactoryNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists datasets. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatasetResourceInner> object + */ + public Observable> listByFactoryNextAsync(final String nextPageLink) { + return listByFactoryNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists datasets. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DatasetResourceInner> object + */ + public Observable>> listByFactoryNextWithServiceResponseAsync(final String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByFactoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists datasets. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DatasetResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByFactoryNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByFactoryNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByFactoryNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByFactoryNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoriesImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoriesImpl.java new file mode 100644 index 000000000000..8f52d6e57320 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoriesImpl.java @@ -0,0 +1,157 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factory; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.FactoryRepoUpdate; + +class FactoriesImpl extends GroupableResourcesCoreImpl implements Factories { + protected FactoriesImpl(DataFactoryManager manager) { + super(manager.inner().factories(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + FactoriesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + FactoriesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + FactoriesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + FactoriesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Factory call(FactoryInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + FactoriesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + FactoriesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Factory call(FactoryInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public FactoryImpl define(String name) { + return wrapModel(name); + } + + @Override + public Completable cancelPipelineRunAsync(String resourceGroupName, String factoryName, String runId) { + FactoriesInner client = this.inner(); + return client.cancelPipelineRunAsync(resourceGroupName, factoryName, runId).toCompletable(); + } + + @Override + protected FactoryImpl wrapModel(FactoryInner inner) { + return new FactoryImpl(inner.name(), inner, manager()); + } + + @Override + protected FactoryImpl wrapModel(String name) { + return new FactoryImpl(name, new FactoryInner(), this.manager()); + } + + @Override + public Observable configureFactoryRepoAsync(String locationId, FactoryRepoUpdate factoryRepoUpdate) { + FactoriesInner client = this.inner(); + return client.configureFactoryRepoAsync(locationId, factoryRepoUpdate) + .map(new Func1() { + @Override + public Factory call(FactoryInner inner) { + return new FactoryImpl(inner.name(), inner, manager()); + } + }); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoriesInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoriesInner.java new file mode 100644 index 000000000000..727b28f7aca1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoriesInner.java @@ -0,0 +1,1096 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ErrorResponseException; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.FactoryRepoUpdate; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.FactoryUpdateParameters; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Factories. + */ +public class FactoriesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private FactoriesService service; + /** The service client containing this operation class. */ + private DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of FactoriesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FactoriesInner(Retrofit retrofit, DataFactoryManagementClientImpl client) { + this.service = retrofit.create(FactoriesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Factories to be + * used by Retrofit to perform actually REST calls. + */ + interface FactoriesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/factories") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories configureFactoryRepo" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/configureFactoryRepo") + Observable> configureFactoryRepo(@Path("subscriptionId") String subscriptionId, @Path("locationId") String locationId, @Query("api-version") String apiVersion, @Body FactoryRepoUpdate factoryRepoUpdate, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Body FactoryInner factory, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Body FactoryUpdateParameters factoryUpdateParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories cancelPipelineRun" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/cancelpipelinerun/{runId}") + Observable> cancelPipelineRun(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("runId") String runId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factories listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists factories under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FactoryInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists factories under the specified subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists factories under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FactoryInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists factories under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FactoryInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists factories under the specified subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FactoryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates a factory's repo information. + * + * @param locationId The location identifier. + * @param factoryRepoUpdate Update factory repo request definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FactoryInner object if successful. + */ + public FactoryInner configureFactoryRepo(String locationId, FactoryRepoUpdate factoryRepoUpdate) { + return configureFactoryRepoWithServiceResponseAsync(locationId, factoryRepoUpdate).toBlocking().single().body(); + } + + /** + * Updates a factory's repo information. + * + * @param locationId The location identifier. + * @param factoryRepoUpdate Update factory repo request definition. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture configureFactoryRepoAsync(String locationId, FactoryRepoUpdate factoryRepoUpdate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(configureFactoryRepoWithServiceResponseAsync(locationId, factoryRepoUpdate), serviceCallback); + } + + /** + * Updates a factory's repo information. + * + * @param locationId The location identifier. + * @param factoryRepoUpdate Update factory repo request definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FactoryInner object + */ + public Observable configureFactoryRepoAsync(String locationId, FactoryRepoUpdate factoryRepoUpdate) { + return configureFactoryRepoWithServiceResponseAsync(locationId, factoryRepoUpdate).map(new Func1, FactoryInner>() { + @Override + public FactoryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a factory's repo information. + * + * @param locationId The location identifier. + * @param factoryRepoUpdate Update factory repo request definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FactoryInner object + */ + public Observable> configureFactoryRepoWithServiceResponseAsync(String locationId, FactoryRepoUpdate factoryRepoUpdate) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (locationId == null) { + throw new IllegalArgumentException("Parameter locationId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (factoryRepoUpdate == null) { + throw new IllegalArgumentException("Parameter factoryRepoUpdate is required and cannot be null."); + } + Validator.validate(factoryRepoUpdate); + return service.configureFactoryRepo(this.client.subscriptionId(), locationId, this.client.apiVersion(), factoryRepoUpdate, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = configureFactoryRepoDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse configureFactoryRepoDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists factories. + * + * @param resourceGroupName The resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FactoryInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists factories. + * + * @param resourceGroupName The resource group name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists factories. + * + * @param resourceGroupName The resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FactoryInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists factories. + * + * @param resourceGroupName The resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FactoryInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists factories. + * + ServiceResponse> * @param resourceGroupName The resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FactoryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param factory Factory resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FactoryInner object if successful. + */ + public FactoryInner createOrUpdate(String resourceGroupName, String factoryName, FactoryInner factory) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, factory).toBlocking().single().body(); + } + + /** + * Creates or updates a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param factory Factory resource definition. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, FactoryInner factory, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, factory), serviceCallback); + } + + /** + * Creates or updates a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param factory Factory resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FactoryInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, FactoryInner factory) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, factory).map(new Func1, FactoryInner>() { + @Override + public FactoryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param factory Factory resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FactoryInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, FactoryInner factory) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (factory == null) { + throw new IllegalArgumentException("Parameter factory is required and cannot be null."); + } + Validator.validate(factory); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, this.client.apiVersion(), factory, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param factoryUpdateParameters The parameters for updating a factory. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FactoryInner object if successful. + */ + public FactoryInner update(String resourceGroupName, String factoryName, FactoryUpdateParameters factoryUpdateParameters) { + return updateWithServiceResponseAsync(resourceGroupName, factoryName, factoryUpdateParameters).toBlocking().single().body(); + } + + /** + * Updates a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param factoryUpdateParameters The parameters for updating a factory. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String factoryName, FactoryUpdateParameters factoryUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, factoryName, factoryUpdateParameters), serviceCallback); + } + + /** + * Updates a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param factoryUpdateParameters The parameters for updating a factory. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FactoryInner object + */ + public Observable updateAsync(String resourceGroupName, String factoryName, FactoryUpdateParameters factoryUpdateParameters) { + return updateWithServiceResponseAsync(resourceGroupName, factoryName, factoryUpdateParameters).map(new Func1, FactoryInner>() { + @Override + public FactoryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param factoryUpdateParameters The parameters for updating a factory. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FactoryInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String factoryName, FactoryUpdateParameters factoryUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (factoryUpdateParameters == null) { + throw new IllegalArgumentException("Parameter factoryUpdateParameters is required and cannot be null."); + } + Validator.validate(factoryUpdateParameters); + return service.update(this.client.subscriptionId(), resourceGroupName, factoryName, this.client.apiVersion(), factoryUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FactoryInner object if successful. + */ + public FactoryInner getByResourceGroup(String resourceGroupName, String factoryName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, factoryName).toBlocking().single().body(); + } + + /** + * Gets a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String factoryName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, factoryName), serviceCallback); + } + + /** + * Gets a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FactoryInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String factoryName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, factoryName).map(new Func1, FactoryInner>() { + @Override + public FactoryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FactoryInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String factoryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, factoryName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String factoryName) { + deleteWithServiceResponseAsync(resourceGroupName, factoryName).toBlocking().single().body(); + } + + /** + * Deletes a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String factoryName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, factoryName), serviceCallback); + } + + /** + * Deletes a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String factoryName) { + return deleteWithServiceResponseAsync(resourceGroupName, factoryName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a factory. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String factoryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, factoryName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Cancel a pipeline run by its run ID. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void cancelPipelineRun(String resourceGroupName, String factoryName, String runId) { + cancelPipelineRunWithServiceResponseAsync(resourceGroupName, factoryName, runId).toBlocking().single().body(); + } + + /** + * Cancel a pipeline run by its run ID. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture cancelPipelineRunAsync(String resourceGroupName, String factoryName, String runId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelPipelineRunWithServiceResponseAsync(resourceGroupName, factoryName, runId), serviceCallback); + } + + /** + * Cancel a pipeline run by its run ID. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelPipelineRunAsync(String resourceGroupName, String factoryName, String runId) { + return cancelPipelineRunWithServiceResponseAsync(resourceGroupName, factoryName, runId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel a pipeline run by its run ID. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelPipelineRunWithServiceResponseAsync(String resourceGroupName, String factoryName, String runId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (runId == null) { + throw new IllegalArgumentException("Parameter runId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.cancelPipelineRun(this.client.subscriptionId(), resourceGroupName, factoryName, runId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelPipelineRunDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelPipelineRunDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists factories under the specified subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FactoryInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists factories under the specified subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists factories under the specified subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FactoryInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists factories under the specified subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FactoryInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists factories under the specified subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FactoryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists factories. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FactoryInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists factories. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists factories. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FactoryInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists factories. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FactoryInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists factories. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FactoryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoryImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoryImpl.java new file mode 100644 index 000000000000..cea072ecf271 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoryImpl.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Factory; +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.FactoryUpdateParameters; +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.FactoryIdentity; +import org.joda.time.DateTime; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.FactoryVSTSConfiguration; +import rx.functions.Func1; + +class FactoryImpl extends GroupableResourceCoreImpl implements Factory, Factory.Definition, Factory.Update { + private FactoryUpdateParameters updateParameter; + FactoryImpl(String name, FactoryInner inner, DataFactoryManager manager) { + super(name, inner, manager); + this.updateParameter = new FactoryUpdateParameters(); + } + + @Override + public Observable createResourceAsync() { + FactoriesInner client = this.manager().inner().factories(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public FactoryInner call(FactoryInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FactoriesInner client = this.manager().inner().factories(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public FactoryInner call(FactoryInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FactoriesInner client = this.manager().inner().factories(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new FactoryUpdateParameters(); + } + + @Override + public Map additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public DateTime createTime() { + return this.inner().createTime(); + } + + @Override + public FactoryIdentity identity() { + return this.inner().identity(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String version() { + return this.inner().version(); + } + + @Override + public FactoryVSTSConfiguration vstsConfiguration() { + return this.inner().vstsConfiguration(); + } + + @Override + public FactoryImpl withAdditionalProperties(Map additionalProperties) { + this.inner().withAdditionalProperties(additionalProperties); + return this; + } + + @Override + public FactoryImpl withVstsConfiguration(FactoryVSTSConfiguration vstsConfiguration) { + this.inner().withVstsConfiguration(vstsConfiguration); + return this; + } + + @Override + public FactoryImpl withIdentity(FactoryIdentity identity) { + if (isInCreateMode()) { + this.inner().withIdentity(identity); + } else { + this.updateParameter.withIdentity(identity); + } + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoryInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoryInner.java new file mode 100644 index 000000000000..2dbf4265e561 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/FactoryInner.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.FactoryIdentity; +import org.joda.time.DateTime; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.FactoryVSTSConfiguration; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Factory resource type. + */ +@JsonFlatten +@SkipParentValidation +public class FactoryInner extends Resource { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Managed service identity of the factory. + */ + @JsonProperty(value = "identity") + private FactoryIdentity identity; + + /** + * Factory provisioning state, example Succeeded. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Time the factory was created in ISO8601 format. + */ + @JsonProperty(value = "properties.createTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createTime; + + /** + * Version of the factory. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * VSTS repo information of the factory. + */ + @JsonProperty(value = "properties.vstsConfiguration") + private FactoryVSTSConfiguration vstsConfiguration; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the FactoryInner object itself. + */ + public FactoryInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get managed service identity of the factory. + * + * @return the identity value + */ + public FactoryIdentity identity() { + return this.identity; + } + + /** + * Set managed service identity of the factory. + * + * @param identity the identity value to set + * @return the FactoryInner object itself. + */ + public FactoryInner withIdentity(FactoryIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get factory provisioning state, example Succeeded. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get time the factory was created in ISO8601 format. + * + * @return the createTime value + */ + public DateTime createTime() { + return this.createTime; + } + + /** + * Get version of the factory. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Get vSTS repo information of the factory. + * + * @return the vstsConfiguration value + */ + public FactoryVSTSConfiguration vstsConfiguration() { + return this.vstsConfiguration; + } + + /** + * Set vSTS repo information of the factory. + * + * @param vstsConfiguration the vstsConfiguration value to set + * @return the FactoryInner object itself. + */ + public FactoryInner withVstsConfiguration(FactoryVSTSConfiguration vstsConfiguration) { + this.vstsConfiguration = vstsConfiguration; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IdParsingUtils.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..c976373fb576 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeAuthKeysImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeAuthKeysImpl.java new file mode 100644 index 000000000000..412d4c2f31de --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeAuthKeysImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeAuthKeys; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class IntegrationRuntimeAuthKeysImpl extends WrapperImpl implements IntegrationRuntimeAuthKeys { + private final DataFactoryManager manager; + IntegrationRuntimeAuthKeysImpl(IntegrationRuntimeAuthKeysInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public String authKey1() { + return this.inner().authKey1(); + } + + @Override + public String authKey2() { + return this.inner().authKey2(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeAuthKeysInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeAuthKeysInner.java new file mode 100644 index 000000000000..866d0378a259 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeAuthKeysInner.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The integration runtime authentication keys. + */ +public class IntegrationRuntimeAuthKeysInner { + /** + * The primary integration runtime authentication key. + */ + @JsonProperty(value = "authKey1") + private String authKey1; + + /** + * The secondary integration runtime authentication key. + */ + @JsonProperty(value = "authKey2") + private String authKey2; + + /** + * Get the primary integration runtime authentication key. + * + * @return the authKey1 value + */ + public String authKey1() { + return this.authKey1; + } + + /** + * Set the primary integration runtime authentication key. + * + * @param authKey1 the authKey1 value to set + * @return the IntegrationRuntimeAuthKeysInner object itself. + */ + public IntegrationRuntimeAuthKeysInner withAuthKey1(String authKey1) { + this.authKey1 = authKey1; + return this; + } + + /** + * Get the secondary integration runtime authentication key. + * + * @return the authKey2 value + */ + public String authKey2() { + return this.authKey2; + } + + /** + * Set the secondary integration runtime authentication key. + * + * @param authKey2 the authKey2 value to set + * @return the IntegrationRuntimeAuthKeysInner object itself. + */ + public IntegrationRuntimeAuthKeysInner withAuthKey2(String authKey2) { + this.authKey2 = authKey2; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeConnectionInfoImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeConnectionInfoImpl.java new file mode 100644 index 000000000000..4ee76a336dc3 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeConnectionInfoImpl.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeConnectionInfo; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; + +class IntegrationRuntimeConnectionInfoImpl extends WrapperImpl implements IntegrationRuntimeConnectionInfo { + private final DataFactoryManager manager; + IntegrationRuntimeConnectionInfoImpl(IntegrationRuntimeConnectionInfoInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public Map additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public String hostServiceUri() { + return this.inner().hostServiceUri(); + } + + @Override + public String identityCertThumbprint() { + return this.inner().identityCertThumbprint(); + } + + @Override + public Boolean isIdentityCertExprired() { + return this.inner().isIdentityCertExprired(); + } + + @Override + public String publicKey() { + return this.inner().publicKey(); + } + + @Override + public String serviceToken() { + return this.inner().serviceToken(); + } + + @Override + public String version() { + return this.inner().version(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeConnectionInfoInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeConnectionInfoInner.java new file mode 100644 index 000000000000..3417401938be --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeConnectionInfoInner.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Connection information for encrypting the on-premises data source + * credentials. + */ +public class IntegrationRuntimeConnectionInfoInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The token generated in service. Callers use this token to authenticate + * to integration runtime. + */ + @JsonProperty(value = "serviceToken", access = JsonProperty.Access.WRITE_ONLY) + private String serviceToken; + + /** + * The integration runtime SSL certificate thumbprint. Click-Once + * application uses it to do server validation. + */ + @JsonProperty(value = "identityCertThumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String identityCertThumbprint; + + /** + * The on-premises integration runtime host URL. + */ + @JsonProperty(value = "hostServiceUri", access = JsonProperty.Access.WRITE_ONLY) + private String hostServiceUri; + + /** + * The integration runtime version. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * The public key for encrypting a credential when transferring the + * credential to the integration runtime. + */ + @JsonProperty(value = "publicKey", access = JsonProperty.Access.WRITE_ONLY) + private String publicKey; + + /** + * Whether the identity certificate is expired. + */ + @JsonProperty(value = "isIdentityCertExprired", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isIdentityCertExprired; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the IntegrationRuntimeConnectionInfoInner object itself. + */ + public IntegrationRuntimeConnectionInfoInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the token generated in service. Callers use this token to authenticate to integration runtime. + * + * @return the serviceToken value + */ + public String serviceToken() { + return this.serviceToken; + } + + /** + * Get the integration runtime SSL certificate thumbprint. Click-Once application uses it to do server validation. + * + * @return the identityCertThumbprint value + */ + public String identityCertThumbprint() { + return this.identityCertThumbprint; + } + + /** + * Get the on-premises integration runtime host URL. + * + * @return the hostServiceUri value + */ + public String hostServiceUri() { + return this.hostServiceUri; + } + + /** + * Get the integration runtime version. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Get the public key for encrypting a credential when transferring the credential to the integration runtime. + * + * @return the publicKey value + */ + public String publicKey() { + return this.publicKey; + } + + /** + * Get whether the identity certificate is expired. + * + * @return the isIdentityCertExprired value + */ + public Boolean isIdentityCertExprired() { + return this.isIdentityCertExprired; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeInner.java new file mode 100644 index 000000000000..ede23e441b2d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeInner.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Azure Data Factory nested object which serves as a compute resource for + * activities. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("IntegrationRuntime") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "SelfHosted", value = SelfHostedIntegrationRuntime.class), + @JsonSubTypes.Type(name = "Managed", value = ManagedIntegrationRuntime.class) +}) +public class IntegrationRuntimeInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Integration runtime description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the IntegrationRuntimeInner object itself. + */ + public IntegrationRuntimeInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get integration runtime description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set integration runtime description. + * + * @param description the description value to set + * @return the IntegrationRuntimeInner object itself. + */ + public IntegrationRuntimeInner withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeMonitoringDataImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeMonitoringDataImpl.java new file mode 100644 index 000000000000..4f17d3f53e2f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeMonitoringDataImpl.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeMonitoringData; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeNodeMonitoringData; + +class IntegrationRuntimeMonitoringDataImpl extends WrapperImpl implements IntegrationRuntimeMonitoringData { + private final DataFactoryManager manager; + IntegrationRuntimeMonitoringDataImpl(IntegrationRuntimeMonitoringDataInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List nodes() { + return this.inner().nodes(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeMonitoringDataInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeMonitoringDataInner.java new file mode 100644 index 000000000000..6863072a5326 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeMonitoringDataInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeNodeMonitoringData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Get monitoring data response. + */ +public class IntegrationRuntimeMonitoringDataInner { + /** + * Integration runtime name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Integration runtime node monitoring data. + */ + @JsonProperty(value = "nodes") + private List nodes; + + /** + * Get integration runtime name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set integration runtime name. + * + * @param name the name value to set + * @return the IntegrationRuntimeMonitoringDataInner object itself. + */ + public IntegrationRuntimeMonitoringDataInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get integration runtime node monitoring data. + * + * @return the nodes value + */ + public List nodes() { + return this.nodes; + } + + /** + * Set integration runtime node monitoring data. + * + * @param nodes the nodes value to set + * @return the IntegrationRuntimeMonitoringDataInner object itself. + */ + public IntegrationRuntimeMonitoringDataInner withNodes(List nodes) { + this.nodes = nodes; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodeIpAddressImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodeIpAddressImpl.java new file mode 100644 index 000000000000..da2f23bece3d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodeIpAddressImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeNodeIpAddress; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class IntegrationRuntimeNodeIpAddressImpl extends WrapperImpl implements IntegrationRuntimeNodeIpAddress { + private final DataFactoryManager manager; + IntegrationRuntimeNodeIpAddressImpl(IntegrationRuntimeNodeIpAddressInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public String ipAddress() { + return this.inner().ipAddress(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodeIpAddressInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodeIpAddressInner.java new file mode 100644 index 000000000000..de2e8de6ad77 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodeIpAddressInner.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The IP address of self-hosted integration runtime node. + */ +public class IntegrationRuntimeNodeIpAddressInner { + /** + * The IP address of self-hosted integration runtime node. + */ + @JsonProperty(value = "ipAddress", access = JsonProperty.Access.WRITE_ONLY) + private String ipAddress; + + /** + * Get the IP address of self-hosted integration runtime node. + * + * @return the ipAddress value + */ + public String ipAddress() { + return this.ipAddress; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodesImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodesImpl.java new file mode 100644 index 000000000000..b52bd644c1cb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodesImpl.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeNodes; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.SelfHostedIntegrationRuntimeNode; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeNodeIpAddress; + +class IntegrationRuntimeNodesImpl extends WrapperImpl implements IntegrationRuntimeNodes { + private final DataFactoryManager manager; + + IntegrationRuntimeNodesImpl(DataFactoryManager manager) { + super(manager.inner().integrationRuntimeNodes()); + this.manager = manager; + } + + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public Observable updateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + IntegrationRuntimeNodesInner client = this.inner(); + return client.updateAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName) + .map(new Func1() { + @Override + public SelfHostedIntegrationRuntimeNode call(SelfHostedIntegrationRuntimeNodeInner inner) { + return new SelfHostedIntegrationRuntimeNodeImpl(inner, manager()); + } + }); + } + + @Override + public Observable getIpAddressAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + IntegrationRuntimeNodesInner client = this.inner(); + return client.getIpAddressAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName) + .map(new Func1() { + @Override + public IntegrationRuntimeNodeIpAddress call(IntegrationRuntimeNodeIpAddressInner inner) { + return new IntegrationRuntimeNodeIpAddressImpl(inner, manager()); + } + }); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodesInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodesInner.java new file mode 100644 index 000000000000..fd8358de228f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeNodesInner.java @@ -0,0 +1,474 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ErrorResponseException; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.UpdateIntegrationRuntimeNodeRequest; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in IntegrationRuntimeNodes. + */ +public class IntegrationRuntimeNodesInner { + /** The Retrofit service to perform REST calls. */ + private IntegrationRuntimeNodesService service; + /** The service client containing this operation class. */ + private DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of IntegrationRuntimeNodesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public IntegrationRuntimeNodesInner(Retrofit retrofit, DataFactoryManagementClientImpl client) { + this.service = retrofit.create(IntegrationRuntimeNodesService.class); + this.client = client; + } + + /** + * The interface defining all the services for IntegrationRuntimeNodes to be + * used by Retrofit to perform actually REST calls. + */ + interface IntegrationRuntimeNodesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeNodes delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Path("nodeName") String nodeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeNodes update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Path("nodeName") String nodeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UpdateIntegrationRuntimeNodeRequest updateIntegrationRuntimeNodeRequest, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeNodes getIpAddress" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}/ipAddress") + Observable> getIpAddress(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Path("nodeName") String nodeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + deleteWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName).toBlocking().single().body(); + } + + /** + * Deletes a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName), serviceCallback); + } + + /** + * Deletes a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + return deleteWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SelfHostedIntegrationRuntimeNodeInner object if successful. + */ + public SelfHostedIntegrationRuntimeNodeInner update(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + return updateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName).toBlocking().single().body(); + } + + /** + * Updates a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName), serviceCallback); + } + + /** + * Updates a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SelfHostedIntegrationRuntimeNodeInner object + */ + public Observable updateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + return updateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName).map(new Func1, SelfHostedIntegrationRuntimeNodeInner>() { + @Override + public SelfHostedIntegrationRuntimeNodeInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SelfHostedIntegrationRuntimeNodeInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer concurrentJobsLimit = null; + UpdateIntegrationRuntimeNodeRequest updateIntegrationRuntimeNodeRequest = new UpdateIntegrationRuntimeNodeRequest(); + updateIntegrationRuntimeNodeRequest.withConcurrentJobsLimit(null); + return service.update(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), updateIntegrationRuntimeNodeRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @param concurrentJobsLimit The number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SelfHostedIntegrationRuntimeNodeInner object if successful. + */ + public SelfHostedIntegrationRuntimeNodeInner update(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName, Integer concurrentJobsLimit) { + return updateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName, concurrentJobsLimit).toBlocking().single().body(); + } + + /** + * Updates a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @param concurrentJobsLimit The number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName, Integer concurrentJobsLimit, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName, concurrentJobsLimit), serviceCallback); + } + + /** + * Updates a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @param concurrentJobsLimit The number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SelfHostedIntegrationRuntimeNodeInner object + */ + public Observable updateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName, Integer concurrentJobsLimit) { + return updateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName, concurrentJobsLimit).map(new Func1, SelfHostedIntegrationRuntimeNodeInner>() { + @Override + public SelfHostedIntegrationRuntimeNodeInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @param concurrentJobsLimit The number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SelfHostedIntegrationRuntimeNodeInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName, Integer concurrentJobsLimit) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + UpdateIntegrationRuntimeNodeRequest updateIntegrationRuntimeNodeRequest = new UpdateIntegrationRuntimeNodeRequest(); + updateIntegrationRuntimeNodeRequest.withConcurrentJobsLimit(concurrentJobsLimit); + return service.update(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), updateIntegrationRuntimeNodeRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the IP address of self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeNodeIpAddressInner object if successful. + */ + public IntegrationRuntimeNodeIpAddressInner getIpAddress(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + return getIpAddressWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName).toBlocking().single().body(); + } + + /** + * Get the IP address of self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getIpAddressAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getIpAddressWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName), serviceCallback); + } + + /** + * Get the IP address of self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeNodeIpAddressInner object + */ + public Observable getIpAddressAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + return getIpAddressWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, nodeName).map(new Func1, IntegrationRuntimeNodeIpAddressInner>() { + @Override + public IntegrationRuntimeNodeIpAddressInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the IP address of self-hosted integration runtime node. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param nodeName The integration runtime node name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeNodeIpAddressInner object + */ + public Observable> getIpAddressWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (nodeName == null) { + throw new IllegalArgumentException("Parameter nodeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getIpAddress(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, nodeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getIpAddressDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getIpAddressDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeResourceImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeResourceImpl.java new file mode 100644 index 000000000000..887a8aeaac2a --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeResourceImpl.java @@ -0,0 +1,158 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.UpdateIntegrationRuntimeRequest; +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeAutoUpdate; +import rx.functions.Func1; + +class IntegrationRuntimeResourceImpl extends CreatableUpdatableImpl implements IntegrationRuntimeResource, IntegrationRuntimeResource.Definition, IntegrationRuntimeResource.Update { + private final DataFactoryManager manager; + private String resourceGroupName; + private String factoryName; + private String integrationRuntimeName; + private String cifMatch; + private IntegrationRuntimeInner cproperties; + private UpdateIntegrationRuntimeRequest updateParameter; + + IntegrationRuntimeResourceImpl(String name, DataFactoryManager manager) { + super(name, new IntegrationRuntimeResourceInner()); + this.manager = manager; + // Set resource name + this.integrationRuntimeName = name; + // + this.cproperties = new IntegrationRuntimeInner(); + this.updateParameter = new UpdateIntegrationRuntimeRequest(); + } + + IntegrationRuntimeResourceImpl(IntegrationRuntimeResourceInner inner, DataFactoryManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.integrationRuntimeName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.factoryName = IdParsingUtils.getValueFromIdByName(inner.id(), "factories"); + this.integrationRuntimeName = IdParsingUtils.getValueFromIdByName(inner.id(), "integrationRuntimes"); + // + this.cproperties = new IntegrationRuntimeInner(); + this.updateParameter = new UpdateIntegrationRuntimeRequest(); + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + IntegrationRuntimesInner client = this.manager().inner().integrationRuntimes(); + return client.createOrUpdateAsync(this.resourceGroupName, this.factoryName, this.integrationRuntimeName, this.cproperties, this.cifMatch) + .map(new Func1() { + @Override + public IntegrationRuntimeResourceInner call(IntegrationRuntimeResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + IntegrationRuntimesInner client = this.manager().inner().integrationRuntimes(); + return client.updateAsync(this.resourceGroupName, this.factoryName, this.integrationRuntimeName, this.updateParameter) + .map(new Func1() { + @Override + public IntegrationRuntimeResourceInner call(IntegrationRuntimeResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + IntegrationRuntimesInner client = this.manager().inner().integrationRuntimes(); + return client.getAsync(this.resourceGroupName, this.factoryName, this.integrationRuntimeName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.cproperties = new IntegrationRuntimeInner(); + this.updateParameter = new UpdateIntegrationRuntimeRequest(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public IntegrationRuntimeInner properties() { + return this.inner().properties(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public IntegrationRuntimeResourceImpl withExistingFactory(String resourceGroupName, String factoryName) { + this.resourceGroupName = resourceGroupName; + this.factoryName = factoryName; + return this; + } + + @Override + public IntegrationRuntimeResourceImpl withIfMatch(String ifMatch) { + this.cifMatch = ifMatch; + return this; + } + + @Override + public IntegrationRuntimeResourceImpl withProperties(IntegrationRuntimeInner properties) { + this.cproperties = properties; + return this; + } + + @Override + public IntegrationRuntimeResourceImpl withAutoUpdate(IntegrationRuntimeAutoUpdate autoUpdate) { + this.updateParameter.withAutoUpdate(autoUpdate); + return this; + } + + @Override + public IntegrationRuntimeResourceImpl withUpdateDelayOffset(String updateDelayOffset) { + this.updateParameter.withUpdateDelayOffset(updateDelayOffset); + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeResourceInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeResourceInner.java new file mode 100644 index 000000000000..f9cc2909bcd0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeResourceInner.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.SubResource; + +/** + * Integration runtime resource type. + */ +public class IntegrationRuntimeResourceInner extends SubResource { + /** + * Integration runtime properties. + */ + @JsonProperty(value = "properties", required = true) + private IntegrationRuntimeInner properties; + + /** + * The resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Etag identifies change in the resource. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get integration runtime properties. + * + * @return the properties value + */ + public IntegrationRuntimeInner properties() { + return this.properties; + } + + /** + * Set integration runtime properties. + * + * @param properties the properties value to set + * @return the IntegrationRuntimeResourceInner object itself. + */ + public IntegrationRuntimeResourceInner withProperties(IntegrationRuntimeInner properties) { + this.properties = properties; + return this; + } + + /** + * Get the resource name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get etag identifies change in the resource. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeStatusResponseImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeStatusResponseImpl.java new file mode 100644 index 000000000000..6568bea32034 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeStatusResponseImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeStatusResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeStatus; + +class IntegrationRuntimeStatusResponseImpl extends WrapperImpl implements IntegrationRuntimeStatusResponse { + private final DataFactoryManager manager; + IntegrationRuntimeStatusResponseImpl(IntegrationRuntimeStatusResponseInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public IntegrationRuntimeStatus properties() { + return this.inner().properties(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeStatusResponseInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeStatusResponseInner.java new file mode 100644 index 000000000000..496c2aba8595 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimeStatusResponseInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Integration runtime status response. + */ +public class IntegrationRuntimeStatusResponseInner { + /** + * The integration runtime name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Integration runtime properties. + */ + @JsonProperty(value = "properties", required = true) + private IntegrationRuntimeStatus properties; + + /** + * Get the integration runtime name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get integration runtime properties. + * + * @return the properties value + */ + public IntegrationRuntimeStatus properties() { + return this.properties; + } + + /** + * Set integration runtime properties. + * + * @param properties the properties value to set + * @return the IntegrationRuntimeStatusResponseInner object itself. + */ + public IntegrationRuntimeStatusResponseInner withProperties(IntegrationRuntimeStatus properties) { + this.properties = properties; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimesImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimesImpl.java new file mode 100644 index 000000000000..ca3b1d6869bd --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimesImpl.java @@ -0,0 +1,182 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeStatusResponse; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeConnectionInfo; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeAuthKeys; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeMonitoringData; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeRemoveNodeRequest; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeResource; + +class IntegrationRuntimesImpl extends WrapperImpl implements IntegrationRuntimes { + private final DataFactoryManager manager; + + IntegrationRuntimesImpl(DataFactoryManager manager) { + super(manager.inner().integrationRuntimes()); + this.manager = manager; + } + + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public IntegrationRuntimeResourceImpl define(String name) { + return wrapModel(name); + } + + private IntegrationRuntimeResourceImpl wrapModel(IntegrationRuntimeResourceInner inner) { + return new IntegrationRuntimeResourceImpl(inner, manager()); + } + + private IntegrationRuntimeResourceImpl wrapModel(String name) { + return new IntegrationRuntimeResourceImpl(name, this.manager()); + } + + @Override + public Observable getStatusAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.getStatusAsync(resourceGroupName, factoryName, integrationRuntimeName) + .map(new Func1() { + @Override + public IntegrationRuntimeStatusResponse call(IntegrationRuntimeStatusResponseInner inner) { + return new IntegrationRuntimeStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable getConnectionInfoAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.getConnectionInfoAsync(resourceGroupName, factoryName, integrationRuntimeName) + .map(new Func1() { + @Override + public IntegrationRuntimeConnectionInfo call(IntegrationRuntimeConnectionInfoInner inner) { + return new IntegrationRuntimeConnectionInfoImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateAuthKeyAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.regenerateAuthKeyAsync(resourceGroupName, factoryName, integrationRuntimeName) + .map(new Func1() { + @Override + public IntegrationRuntimeAuthKeys call(IntegrationRuntimeAuthKeysInner inner) { + return new IntegrationRuntimeAuthKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAuthKeysAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.listAuthKeysAsync(resourceGroupName, factoryName, integrationRuntimeName) + .map(new Func1() { + @Override + public IntegrationRuntimeAuthKeys call(IntegrationRuntimeAuthKeysInner inner) { + return new IntegrationRuntimeAuthKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable startAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.startAsync(resourceGroupName, factoryName, integrationRuntimeName) + .map(new Func1() { + @Override + public IntegrationRuntimeStatusResponse call(IntegrationRuntimeStatusResponseInner inner) { + return new IntegrationRuntimeStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Completable stopAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.stopAsync(resourceGroupName, factoryName, integrationRuntimeName).toCompletable(); + } + + @Override + public Completable removeNodeAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeRemoveNodeRequest removeNodeParameters) { + IntegrationRuntimesInner client = this.inner(); + return client.removeNodeAsync(resourceGroupName, factoryName, integrationRuntimeName, removeNodeParameters).toCompletable(); + } + + @Override + public Completable syncCredentialsAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.syncCredentialsAsync(resourceGroupName, factoryName, integrationRuntimeName).toCompletable(); + } + + @Override + public Observable getMonitoringDataAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.getMonitoringDataAsync(resourceGroupName, factoryName, integrationRuntimeName) + .map(new Func1() { + @Override + public IntegrationRuntimeMonitoringData call(IntegrationRuntimeMonitoringDataInner inner) { + return new IntegrationRuntimeMonitoringDataImpl(inner, manager()); + } + }); + } + + @Override + public Completable upgradeAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.upgradeAsync(resourceGroupName, factoryName, integrationRuntimeName).toCompletable(); + } + + @Override + public Observable listByFactoryAsync(final String resourceGroupName, final String factoryName) { + IntegrationRuntimesInner client = this.inner(); + return client.listByFactoryAsync(resourceGroupName, factoryName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public IntegrationRuntimeResource call(IntegrationRuntimeResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.getAsync(resourceGroupName, factoryName, integrationRuntimeName) + .map(new Func1() { + @Override + public IntegrationRuntimeResource call(IntegrationRuntimeResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + IntegrationRuntimesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, factoryName, integrationRuntimeName).toCompletable(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimesInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimesInner.java new file mode 100644 index 000000000000..59a421b48b84 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/IntegrationRuntimesInner.java @@ -0,0 +1,2052 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ErrorResponseException; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeAuthKeyName; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeRegenerateKeyParameters; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeRemoveNodeRequest; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.UpdateIntegrationRuntimeRequest; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in IntegrationRuntimes. + */ +public class IntegrationRuntimesInner { + /** The Retrofit service to perform REST calls. */ + private IntegrationRuntimesService service; + /** The service client containing this operation class. */ + private DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of IntegrationRuntimesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public IntegrationRuntimesInner(Retrofit retrofit, DataFactoryManagementClientImpl client) { + this.service = retrofit.create(IntegrationRuntimesService.class); + this.client = client; + } + + /** + * The interface defining all the services for IntegrationRuntimes to be + * used by Retrofit to perform actually REST calls. + */ + interface IntegrationRuntimesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes listByFactory" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes") + Observable> listByFactory(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Body IntegrationRuntimeResourceInner integrationRuntime, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Body UpdateIntegrationRuntimeRequest updateIntegrationRuntimeRequest, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes getStatus" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/getStatus") + Observable> getStatus(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes getConnectionInfo" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/getConnectionInfo") + Observable> getConnectionInfo(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes regenerateAuthKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey") + Observable> regenerateAuthKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body IntegrationRuntimeRegenerateKeyParameters regenerateKeyParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes listAuthKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys") + Observable> listAuthKeys(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes start" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/start") + Observable> start(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes beginStart" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/start") + Observable> beginStart(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes stop" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/stop") + Observable> stop(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes beginStop" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/stop") + Observable> beginStop(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes removeNode" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/removeNode") + Observable> removeNode(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Body IntegrationRuntimeRemoveNodeRequest removeNodeParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes syncCredentials" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/syncCredentials") + Observable> syncCredentials(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes getMonitoringData" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/monitoringData") + Observable> getMonitoringData(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes upgrade" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/upgrade") + Observable> upgrade(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("integrationRuntimeName") String integrationRuntimeName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimes listByFactoryNext" }) + @GET + Observable> listByFactoryNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists integration runtimes. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<IntegrationRuntimeResourceInner> object if successful. + */ + public PagedList listByFactory(final String resourceGroupName, final String factoryName) { + ServiceResponse> response = listByFactorySinglePageAsync(resourceGroupName, factoryName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists integration runtimes. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByFactoryAsync(final String resourceGroupName, final String factoryName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByFactorySinglePageAsync(resourceGroupName, factoryName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists integration runtimes. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IntegrationRuntimeResourceInner> object + */ + public Observable> listByFactoryAsync(final String resourceGroupName, final String factoryName) { + return listByFactoryWithServiceResponseAsync(resourceGroupName, factoryName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists integration runtimes. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IntegrationRuntimeResourceInner> object + */ + public Observable>> listByFactoryWithServiceResponseAsync(final String resourceGroupName, final String factoryName) { + return listByFactorySinglePageAsync(resourceGroupName, factoryName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByFactoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists integration runtimes. + * + ServiceResponse> * @param resourceGroupName The resource group name. + ServiceResponse> * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IntegrationRuntimeResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByFactorySinglePageAsync(final String resourceGroupName, final String factoryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByFactory(this.client.subscriptionId(), resourceGroupName, factoryName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByFactoryDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByFactoryDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param properties Integration runtime properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeResourceInner object if successful. + */ + public IntegrationRuntimeResourceInner createOrUpdate(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeInner properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, properties).toBlocking().single().body(); + } + + /** + * Creates or updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param properties Integration runtime properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeInner properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, properties), serviceCallback); + } + + /** + * Creates or updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param properties Integration runtime properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeInner properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, properties).map(new Func1, IntegrationRuntimeResourceInner>() { + @Override + public IntegrationRuntimeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param properties Integration runtime properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeInner properties) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + final String ifMatch = null; + IntegrationRuntimeResourceInner integrationRuntime = new IntegrationRuntimeResourceInner(); + integrationRuntime.withProperties(properties); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), integrationRuntime, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param properties Integration runtime properties. + * @param ifMatch ETag of the integration runtime entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeResourceInner object if successful. + */ + public IntegrationRuntimeResourceInner createOrUpdate(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeInner properties, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, properties, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param properties Integration runtime properties. + * @param ifMatch ETag of the integration runtime entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeInner properties, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, properties, ifMatch), serviceCallback); + } + + /** + * Creates or updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param properties Integration runtime properties. + * @param ifMatch ETag of the integration runtime entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeInner properties, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, properties, ifMatch).map(new Func1, IntegrationRuntimeResourceInner>() { + @Override + public IntegrationRuntimeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param properties Integration runtime properties. + * @param ifMatch ETag of the integration runtime entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeInner properties, String ifMatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + IntegrationRuntimeResourceInner integrationRuntime = new IntegrationRuntimeResourceInner(); + integrationRuntime.withProperties(properties); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), integrationRuntime, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeResourceInner object if successful. + */ + public IntegrationRuntimeResourceInner get(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Gets an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Gets an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeResourceInner object + */ + public Observable getAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, IntegrationRuntimeResourceInner>() { + @Override + public IntegrationRuntimeResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param updateIntegrationRuntimeRequest The parameters for updating an integration runtime. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeStatusResponseInner object if successful. + */ + public IntegrationRuntimeStatusResponseInner update(String resourceGroupName, String factoryName, String integrationRuntimeName, UpdateIntegrationRuntimeRequest updateIntegrationRuntimeRequest) { + return updateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, updateIntegrationRuntimeRequest).toBlocking().single().body(); + } + + /** + * Updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param updateIntegrationRuntimeRequest The parameters for updating an integration runtime. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, UpdateIntegrationRuntimeRequest updateIntegrationRuntimeRequest, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, updateIntegrationRuntimeRequest), serviceCallback); + } + + /** + * Updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param updateIntegrationRuntimeRequest The parameters for updating an integration runtime. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeStatusResponseInner object + */ + public Observable updateAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, UpdateIntegrationRuntimeRequest updateIntegrationRuntimeRequest) { + return updateWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, updateIntegrationRuntimeRequest).map(new Func1, IntegrationRuntimeStatusResponseInner>() { + @Override + public IntegrationRuntimeStatusResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param updateIntegrationRuntimeRequest The parameters for updating an integration runtime. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeStatusResponseInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, UpdateIntegrationRuntimeRequest updateIntegrationRuntimeRequest) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (updateIntegrationRuntimeRequest == null) { + throw new IllegalArgumentException("Parameter updateIntegrationRuntimeRequest is required and cannot be null."); + } + Validator.validate(updateIntegrationRuntimeRequest); + return service.update(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), updateIntegrationRuntimeRequest, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String factoryName, String integrationRuntimeName) { + deleteWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Deletes an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Deletes an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return deleteWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets detailed status information for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeStatusResponseInner object if successful. + */ + public IntegrationRuntimeStatusResponseInner getStatus(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return getStatusWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Gets detailed status information for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getStatusAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getStatusWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Gets detailed status information for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeStatusResponseInner object + */ + public Observable getStatusAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return getStatusWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, IntegrationRuntimeStatusResponseInner>() { + @Override + public IntegrationRuntimeStatusResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets detailed status information for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeStatusResponseInner object + */ + public Observable> getStatusWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getStatus(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getStatusDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the on-premises integration runtime connection information for encrypting the on-premises data source credentials. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeConnectionInfoInner object if successful. + */ + public IntegrationRuntimeConnectionInfoInner getConnectionInfo(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return getConnectionInfoWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Gets the on-premises integration runtime connection information for encrypting the on-premises data source credentials. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getConnectionInfoAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getConnectionInfoWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Gets the on-premises integration runtime connection information for encrypting the on-premises data source credentials. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeConnectionInfoInner object + */ + public Observable getConnectionInfoAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return getConnectionInfoWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, IntegrationRuntimeConnectionInfoInner>() { + @Override + public IntegrationRuntimeConnectionInfoInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the on-premises integration runtime connection information for encrypting the on-premises data source credentials. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeConnectionInfoInner object + */ + public Observable> getConnectionInfoWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getConnectionInfo(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getConnectionInfoDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getConnectionInfoDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Regenerates the authentication key for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeAuthKeysInner object if successful. + */ + public IntegrationRuntimeAuthKeysInner regenerateAuthKey(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return regenerateAuthKeyWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Regenerates the authentication key for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateAuthKeyAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateAuthKeyWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Regenerates the authentication key for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeAuthKeysInner object + */ + public Observable regenerateAuthKeyAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return regenerateAuthKeyWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, IntegrationRuntimeAuthKeysInner>() { + @Override + public IntegrationRuntimeAuthKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the authentication key for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeAuthKeysInner object + */ + public Observable> regenerateAuthKeyWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final IntegrationRuntimeAuthKeyName keyName = null; + IntegrationRuntimeRegenerateKeyParameters regenerateKeyParameters = new IntegrationRuntimeRegenerateKeyParameters(); + regenerateKeyParameters.withKeyName(null); + return service.regenerateAuthKey(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), regenerateKeyParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateAuthKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Regenerates the authentication key for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param keyName The name of the authentication key to regenerate. Possible values include: 'authKey1', 'authKey2' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeAuthKeysInner object if successful. + */ + public IntegrationRuntimeAuthKeysInner regenerateAuthKey(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeAuthKeyName keyName) { + return regenerateAuthKeyWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, keyName).toBlocking().single().body(); + } + + /** + * Regenerates the authentication key for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param keyName The name of the authentication key to regenerate. Possible values include: 'authKey1', 'authKey2' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateAuthKeyAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeAuthKeyName keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateAuthKeyWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, keyName), serviceCallback); + } + + /** + * Regenerates the authentication key for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param keyName The name of the authentication key to regenerate. Possible values include: 'authKey1', 'authKey2' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeAuthKeysInner object + */ + public Observable regenerateAuthKeyAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeAuthKeyName keyName) { + return regenerateAuthKeyWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, keyName).map(new Func1, IntegrationRuntimeAuthKeysInner>() { + @Override + public IntegrationRuntimeAuthKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the authentication key for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param keyName The name of the authentication key to regenerate. Possible values include: 'authKey1', 'authKey2' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeAuthKeysInner object + */ + public Observable> regenerateAuthKeyWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeAuthKeyName keyName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + IntegrationRuntimeRegenerateKeyParameters regenerateKeyParameters = new IntegrationRuntimeRegenerateKeyParameters(); + regenerateKeyParameters.withKeyName(keyName); + return service.regenerateAuthKey(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), regenerateKeyParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateAuthKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateAuthKeyDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves the authentication keys for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeAuthKeysInner object if successful. + */ + public IntegrationRuntimeAuthKeysInner listAuthKeys(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return listAuthKeysWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Retrieves the authentication keys for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAuthKeysAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listAuthKeysWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Retrieves the authentication keys for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeAuthKeysInner object + */ + public Observable listAuthKeysAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return listAuthKeysWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, IntegrationRuntimeAuthKeysInner>() { + @Override + public IntegrationRuntimeAuthKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves the authentication keys for an integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeAuthKeysInner object + */ + public Observable> listAuthKeysWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listAuthKeys(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listAuthKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listAuthKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Starts a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeStatusResponseInner object if successful. + */ + public IntegrationRuntimeStatusResponseInner start(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return startWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().last().body(); + } + + /** + * Starts a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture startAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(startWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Starts a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable startAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return startWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, IntegrationRuntimeStatusResponseInner>() { + @Override + public IntegrationRuntimeStatusResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> startWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.start(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Starts a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeStatusResponseInner object if successful. + */ + public IntegrationRuntimeStatusResponseInner beginStart(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return beginStartWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Starts a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginStartAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginStartWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Starts a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeStatusResponseInner object + */ + public Observable beginStartAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return beginStartWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, IntegrationRuntimeStatusResponseInner>() { + @Override + public IntegrationRuntimeStatusResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeStatusResponseInner object + */ + public Observable> beginStartWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStart(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStartDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStartDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Stops a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void stop(String resourceGroupName, String factoryName, String integrationRuntimeName) { + stopWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().last().body(); + } + + /** + * Stops a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture stopAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(stopWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Stops a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable stopAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return stopWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Stops a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> stopWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.stop(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Stops a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginStop(String resourceGroupName, String factoryName, String integrationRuntimeName) { + beginStopWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Stops a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginStopAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginStopWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Stops a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginStopAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return beginStopWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Stops a ManagedReserved type integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginStopWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStop(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStopDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStopDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Remove a node from integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param removeNodeParameters The name of the node to be removed from an integration runtime. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void removeNode(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeRemoveNodeRequest removeNodeParameters) { + removeNodeWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, removeNodeParameters).toBlocking().single().body(); + } + + /** + * Remove a node from integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param removeNodeParameters The name of the node to be removed from an integration runtime. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture removeNodeAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeRemoveNodeRequest removeNodeParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(removeNodeWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, removeNodeParameters), serviceCallback); + } + + /** + * Remove a node from integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param removeNodeParameters The name of the node to be removed from an integration runtime. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable removeNodeAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeRemoveNodeRequest removeNodeParameters) { + return removeNodeWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName, removeNodeParameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Remove a node from integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param removeNodeParameters The name of the node to be removed from an integration runtime. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> removeNodeWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, IntegrationRuntimeRemoveNodeRequest removeNodeParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (removeNodeParameters == null) { + throw new IllegalArgumentException("Parameter removeNodeParameters is required and cannot be null."); + } + Validator.validate(removeNodeParameters); + return service.removeNode(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), removeNodeParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = removeNodeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse removeNodeDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Force the integration runtime to synchronize credentials across integration runtime nodes, and this will override the credentials across all worker nodes with those available on the dispatcher node. If you already have the latest credential backup file, you should manually import it (preferred) on any self-hosted integration runtime node than using this API directly. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void syncCredentials(String resourceGroupName, String factoryName, String integrationRuntimeName) { + syncCredentialsWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Force the integration runtime to synchronize credentials across integration runtime nodes, and this will override the credentials across all worker nodes with those available on the dispatcher node. If you already have the latest credential backup file, you should manually import it (preferred) on any self-hosted integration runtime node than using this API directly. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture syncCredentialsAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(syncCredentialsWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Force the integration runtime to synchronize credentials across integration runtime nodes, and this will override the credentials across all worker nodes with those available on the dispatcher node. If you already have the latest credential backup file, you should manually import it (preferred) on any self-hosted integration runtime node than using this API directly. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable syncCredentialsAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return syncCredentialsWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Force the integration runtime to synchronize credentials across integration runtime nodes, and this will override the credentials across all worker nodes with those available on the dispatcher node. If you already have the latest credential backup file, you should manually import it (preferred) on any self-hosted integration runtime node than using this API directly. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> syncCredentialsWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.syncCredentials(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = syncCredentialsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse syncCredentialsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the integration runtime monitoring data, which includes the monitor data for all the nodes under this integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IntegrationRuntimeMonitoringDataInner object if successful. + */ + public IntegrationRuntimeMonitoringDataInner getMonitoringData(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return getMonitoringDataWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Get the integration runtime monitoring data, which includes the monitor data for all the nodes under this integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getMonitoringDataAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getMonitoringDataWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Get the integration runtime monitoring data, which includes the monitor data for all the nodes under this integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeMonitoringDataInner object + */ + public Observable getMonitoringDataAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return getMonitoringDataWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, IntegrationRuntimeMonitoringDataInner>() { + @Override + public IntegrationRuntimeMonitoringDataInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the integration runtime monitoring data, which includes the monitor data for all the nodes under this integration runtime. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IntegrationRuntimeMonitoringDataInner object + */ + public Observable> getMonitoringDataWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getMonitoringData(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMonitoringDataDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMonitoringDataDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Upgrade self-hosted integration runtime to latest version if availability. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void upgrade(String resourceGroupName, String factoryName, String integrationRuntimeName) { + upgradeWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).toBlocking().single().body(); + } + + /** + * Upgrade self-hosted integration runtime to latest version if availability. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture upgradeAsync(String resourceGroupName, String factoryName, String integrationRuntimeName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(upgradeWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName), serviceCallback); + } + + /** + * Upgrade self-hosted integration runtime to latest version if availability. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable upgradeAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + return upgradeWithServiceResponseAsync(resourceGroupName, factoryName, integrationRuntimeName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrade self-hosted integration runtime to latest version if availability. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param integrationRuntimeName The integration runtime name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> upgradeWithServiceResponseAsync(String resourceGroupName, String factoryName, String integrationRuntimeName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (integrationRuntimeName == null) { + throw new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.upgrade(this.client.subscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = upgradeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse upgradeDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists integration runtimes. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<IntegrationRuntimeResourceInner> object if successful. + */ + public PagedList listByFactoryNext(final String nextPageLink) { + ServiceResponse> response = listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists integration runtimes. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByFactoryNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByFactoryNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists integration runtimes. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IntegrationRuntimeResourceInner> object + */ + public Observable> listByFactoryNextAsync(final String nextPageLink) { + return listByFactoryNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists integration runtimes. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<IntegrationRuntimeResourceInner> object + */ + public Observable>> listByFactoryNextWithServiceResponseAsync(final String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByFactoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists integration runtimes. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<IntegrationRuntimeResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByFactoryNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByFactoryNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByFactoryNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByFactoryNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServiceInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServiceInner.java new file mode 100644 index 000000000000..9a2067f8c46e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServiceInner.java @@ -0,0 +1,230 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeReference; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ParameterSpecification; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The Azure Data Factory nested object which contains the information and + * credential which can be used to connect with related store or compute + * resource. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("LinkedService") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Responsys", value = ResponsysLinkedService.class), + @JsonSubTypes.Type(name = "AzureDatabricks", value = AzureDatabricksLinkedService.class), + @JsonSubTypes.Type(name = "AzureDataLakeAnalytics", value = AzureDataLakeAnalyticsLinkedService.class), + @JsonSubTypes.Type(name = "HDInsightOnDemand", value = HDInsightOnDemandLinkedService.class), + @JsonSubTypes.Type(name = "SalesforceMarketingCloud", value = SalesforceMarketingCloudLinkedService.class), + @JsonSubTypes.Type(name = "Netezza", value = NetezzaLinkedService.class), + @JsonSubTypes.Type(name = "Vertica", value = VerticaLinkedService.class), + @JsonSubTypes.Type(name = "Zoho", value = ZohoLinkedService.class), + @JsonSubTypes.Type(name = "Xero", value = XeroLinkedService.class), + @JsonSubTypes.Type(name = "Square", value = SquareLinkedService.class), + @JsonSubTypes.Type(name = "Spark", value = SparkLinkedService.class), + @JsonSubTypes.Type(name = "Shopify", value = ShopifyLinkedService.class), + @JsonSubTypes.Type(name = "ServiceNow", value = ServiceNowLinkedService.class), + @JsonSubTypes.Type(name = "QuickBooks", value = QuickBooksLinkedService.class), + @JsonSubTypes.Type(name = "Presto", value = PrestoLinkedService.class), + @JsonSubTypes.Type(name = "Phoenix", value = PhoenixLinkedService.class), + @JsonSubTypes.Type(name = "Paypal", value = PaypalLinkedService.class), + @JsonSubTypes.Type(name = "Marketo", value = MarketoLinkedService.class), + @JsonSubTypes.Type(name = "MariaDB", value = MariaDBLinkedService.class), + @JsonSubTypes.Type(name = "Magento", value = MagentoLinkedService.class), + @JsonSubTypes.Type(name = "Jira", value = JiraLinkedService.class), + @JsonSubTypes.Type(name = "Impala", value = ImpalaLinkedService.class), + @JsonSubTypes.Type(name = "Hubspot", value = HubspotLinkedService.class), + @JsonSubTypes.Type(name = "Hive", value = HiveLinkedService.class), + @JsonSubTypes.Type(name = "HBase", value = HBaseLinkedService.class), + @JsonSubTypes.Type(name = "Greenplum", value = GreenplumLinkedService.class), + @JsonSubTypes.Type(name = "GoogleBigQuery", value = GoogleBigQueryLinkedService.class), + @JsonSubTypes.Type(name = "Eloqua", value = EloquaLinkedService.class), + @JsonSubTypes.Type(name = "Drill", value = DrillLinkedService.class), + @JsonSubTypes.Type(name = "Couchbase", value = CouchbaseLinkedService.class), + @JsonSubTypes.Type(name = "Concur", value = ConcurLinkedService.class), + @JsonSubTypes.Type(name = "AzurePostgreSql", value = AzurePostgreSqlLinkedService.class), + @JsonSubTypes.Type(name = "AmazonMWS", value = AmazonMWSLinkedService.class), + @JsonSubTypes.Type(name = "SapHana", value = SapHanaLinkedService.class), + @JsonSubTypes.Type(name = "SapBW", value = SapBWLinkedService.class), + @JsonSubTypes.Type(name = "Sftp", value = SftpServerLinkedService.class), + @JsonSubTypes.Type(name = "FtpServer", value = FtpServerLinkedService.class), + @JsonSubTypes.Type(name = "HttpServer", value = HttpLinkedService.class), + @JsonSubTypes.Type(name = "AzureSearch", value = AzureSearchLinkedService.class), + @JsonSubTypes.Type(name = "CustomDataSource", value = CustomDataSourceLinkedService.class), + @JsonSubTypes.Type(name = "AmazonRedshift", value = AmazonRedshiftLinkedService.class), + @JsonSubTypes.Type(name = "AmazonS3", value = AmazonS3LinkedService.class), + @JsonSubTypes.Type(name = "SapEcc", value = SapEccLinkedService.class), + @JsonSubTypes.Type(name = "SapCloudForCustomer", value = SapCloudForCustomerLinkedService.class), + @JsonSubTypes.Type(name = "Salesforce", value = SalesforceLinkedService.class), + @JsonSubTypes.Type(name = "AzureDataLakeStore", value = AzureDataLakeStoreLinkedService.class), + @JsonSubTypes.Type(name = "MongoDb", value = MongoDbLinkedService.class), + @JsonSubTypes.Type(name = "Cassandra", value = CassandraLinkedService.class), + @JsonSubTypes.Type(name = "Web", value = WebLinkedService.class), + @JsonSubTypes.Type(name = "OData", value = ODataLinkedService.class), + @JsonSubTypes.Type(name = "Hdfs", value = HdfsLinkedService.class), + @JsonSubTypes.Type(name = "Odbc", value = OdbcLinkedService.class), + @JsonSubTypes.Type(name = "AzureML", value = AzureMLLinkedService.class), + @JsonSubTypes.Type(name = "Teradata", value = TeradataLinkedService.class), + @JsonSubTypes.Type(name = "Db2", value = Db2LinkedService.class), + @JsonSubTypes.Type(name = "Sybase", value = SybaseLinkedService.class), + @JsonSubTypes.Type(name = "PostgreSql", value = PostgreSqlLinkedService.class), + @JsonSubTypes.Type(name = "MySql", value = MySqlLinkedService.class), + @JsonSubTypes.Type(name = "AzureMySql", value = AzureMySqlLinkedService.class), + @JsonSubTypes.Type(name = "Oracle", value = OracleLinkedService.class), + @JsonSubTypes.Type(name = "FileServer", value = FileServerLinkedService.class), + @JsonSubTypes.Type(name = "HDInsight", value = HDInsightLinkedService.class), + @JsonSubTypes.Type(name = "Dynamics", value = DynamicsLinkedService.class), + @JsonSubTypes.Type(name = "CosmosDb", value = CosmosDbLinkedService.class), + @JsonSubTypes.Type(name = "AzureKeyVault", value = AzureKeyVaultLinkedService.class), + @JsonSubTypes.Type(name = "AzureBatch", value = AzureBatchLinkedService.class), + @JsonSubTypes.Type(name = "AzureSqlDatabase", value = AzureSqlDatabaseLinkedService.class), + @JsonSubTypes.Type(name = "SqlServer", value = SqlServerLinkedService.class), + @JsonSubTypes.Type(name = "AzureSqlDW", value = AzureSqlDWLinkedService.class), + @JsonSubTypes.Type(name = "AzureStorage", value = AzureStorageLinkedService.class) +}) +public class LinkedServiceInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The integration runtime reference. + */ + @JsonProperty(value = "connectVia") + private IntegrationRuntimeReference connectVia; + + /** + * Linked service description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Parameters for linked service. + */ + @JsonProperty(value = "parameters") + private Map parameters; + + /** + * List of tags that can be used for describing the Dataset. + */ + @JsonProperty(value = "annotations") + private List annotations; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the integration runtime reference. + * + * @return the connectVia value + */ + public IntegrationRuntimeReference connectVia() { + return this.connectVia; + } + + /** + * Set the integration runtime reference. + * + * @param connectVia the connectVia value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withConnectVia(IntegrationRuntimeReference connectVia) { + this.connectVia = connectVia; + return this; + } + + /** + * Get linked service description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set linked service description. + * + * @param description the description value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get parameters for linked service. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set parameters for linked service. + * + * @param parameters the parameters value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get list of tags that can be used for describing the Dataset. + * + * @return the annotations value + */ + public List annotations() { + return this.annotations; + } + + /** + * Set list of tags that can be used for describing the Dataset. + * + * @param annotations the annotations value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withAnnotations(List annotations) { + this.annotations = annotations; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServiceResourceImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServiceResourceImpl.java new file mode 100644 index 000000000000..600de6d891ac --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServiceResourceImpl.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServiceResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeReference; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ParameterSpecification; +import java.util.List; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.; +import rx.functions.Func1; + +class LinkedServiceResourceImpl extends CreatableUpdatableImpl implements LinkedServiceResource, LinkedServiceResource.Definition, LinkedServiceResource.Update { + private final DataFactoryManager manager; + private String resourceGroupName; + private String factoryName; + private String linkedServiceName; + private String cifMatch; + private LinkedServiceInner cproperties; + private String uifMatch; + private LinkedServiceInner uproperties; + + LinkedServiceResourceImpl(String name, DataFactoryManager manager) { + super(name, new LinkedServiceResourceInner()); + this.manager = manager; + // Set resource name + this.linkedServiceName = name; + // + this.cproperties = new LinkedServiceInner(); + this.uproperties = new LinkedServiceInner(); + } + + LinkedServiceResourceImpl(LinkedServiceResourceInner inner, DataFactoryManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.linkedServiceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.factoryName = IdParsingUtils.getValueFromIdByName(inner.id(), "factories"); + this.linkedServiceName = IdParsingUtils.getValueFromIdByName(inner.id(), "linkedservices"); + // + this.cproperties = new LinkedServiceInner(); + this.uproperties = new LinkedServiceInner(); + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + LinkedServicesInner client = this.manager().inner().linkedServices(); + return client.createOrUpdateAsync(this.resourceGroupName, this.factoryName, this.linkedServiceName, this.cproperties, this.cifMatch) + .map(new Func1() { + @Override + public LinkedServiceResourceInner call(LinkedServiceResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + LinkedServicesInner client = this.manager().inner().linkedServices(); + return client.createOrUpdateAsync(this.resourceGroupName, this.factoryName, this.linkedServiceName, this.uproperties, this.uifMatch) + .map(new Func1() { + @Override + public LinkedServiceResourceInner call(LinkedServiceResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + LinkedServicesInner client = this.manager().inner().linkedServices(); + return client.getAsync(this.resourceGroupName, this.factoryName, this.linkedServiceName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.cproperties = new LinkedServiceInner(); + this.uproperties = new LinkedServiceInner(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public LinkedServiceInner properties() { + return this.inner().properties(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public LinkedServiceResourceImpl withExistingFactory(String resourceGroupName, String factoryName) { + this.resourceGroupName = resourceGroupName; + this.factoryName = factoryName; + return this; + } + + @Override + public LinkedServiceResourceImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public LinkedServiceResourceImpl withProperties(LinkedServiceInner properties) { + if (isInCreateMode()) { + this.cproperties = properties; + } else { + this.uproperties = properties; + } + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServiceResourceInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServiceResourceInner.java new file mode 100644 index 000000000000..9dbf66a7a10c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServiceResourceInner.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.SubResource; + +/** + * Linked service resource type. + */ +public class LinkedServiceResourceInner extends SubResource { + /** + * Properties of linked service. + */ + @JsonProperty(value = "properties", required = true) + private LinkedServiceInner properties; + + /** + * The resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Etag identifies change in the resource. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get properties of linked service. + * + * @return the properties value + */ + public LinkedServiceInner properties() { + return this.properties; + } + + /** + * Set properties of linked service. + * + * @param properties the properties value to set + * @return the LinkedServiceResourceInner object itself. + */ + public LinkedServiceResourceInner withProperties(LinkedServiceInner properties) { + this.properties = properties; + return this; + } + + /** + * Get the resource name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get etag identifies change in the resource. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServicesImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServicesImpl.java new file mode 100644 index 000000000000..1a3886184ad1 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServicesImpl.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServices; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServiceResource; + +class LinkedServicesImpl extends WrapperImpl implements LinkedServices { + private final DataFactoryManager manager; + + LinkedServicesImpl(DataFactoryManager manager) { + super(manager.inner().linkedServices()); + this.manager = manager; + } + + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public LinkedServiceResourceImpl define(String name) { + return wrapModel(name); + } + + private LinkedServiceResourceImpl wrapModel(LinkedServiceResourceInner inner) { + return new LinkedServiceResourceImpl(inner, manager()); + } + + private LinkedServiceResourceImpl wrapModel(String name) { + return new LinkedServiceResourceImpl(name, this.manager()); + } + + @Override + public Observable listByFactoryAsync(final String resourceGroupName, final String factoryName) { + LinkedServicesInner client = this.inner(); + return client.listByFactoryAsync(resourceGroupName, factoryName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LinkedServiceResource call(LinkedServiceResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String factoryName, String linkedServiceName) { + LinkedServicesInner client = this.inner(); + return client.getAsync(resourceGroupName, factoryName, linkedServiceName) + .map(new Func1() { + @Override + public LinkedServiceResource call(LinkedServiceResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String factoryName, String linkedServiceName) { + LinkedServicesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, factoryName, linkedServiceName).toCompletable(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServicesInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServicesInner.java new file mode 100644 index 000000000000..cbf3385bd408 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/LinkedServicesInner.java @@ -0,0 +1,710 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LinkedServices. + */ +public class LinkedServicesInner { + /** The Retrofit service to perform REST calls. */ + private LinkedServicesService service; + /** The service client containing this operation class. */ + private DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of LinkedServicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LinkedServicesInner(Retrofit retrofit, DataFactoryManagementClientImpl client) { + this.service = retrofit.create(LinkedServicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for LinkedServices to be + * used by Retrofit to perform actually REST calls. + */ + interface LinkedServicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServices listByFactory" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/linkedservices") + Observable> listByFactory(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServices createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/linkedservices/{linkedServiceName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("linkedServiceName") String linkedServiceName, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Body LinkedServiceResourceInner linkedService, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServices get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/linkedservices/{linkedServiceName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("linkedServiceName") String linkedServiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServices delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/linkedservices/{linkedServiceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("linkedServiceName") String linkedServiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.LinkedServices listByFactoryNext" }) + @GET + Observable> listByFactoryNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists linked services. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LinkedServiceResourceInner> object if successful. + */ + public PagedList listByFactory(final String resourceGroupName, final String factoryName) { + ServiceResponse> response = listByFactorySinglePageAsync(resourceGroupName, factoryName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists linked services. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByFactoryAsync(final String resourceGroupName, final String factoryName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByFactorySinglePageAsync(resourceGroupName, factoryName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists linked services. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LinkedServiceResourceInner> object + */ + public Observable> listByFactoryAsync(final String resourceGroupName, final String factoryName) { + return listByFactoryWithServiceResponseAsync(resourceGroupName, factoryName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists linked services. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LinkedServiceResourceInner> object + */ + public Observable>> listByFactoryWithServiceResponseAsync(final String resourceGroupName, final String factoryName) { + return listByFactorySinglePageAsync(resourceGroupName, factoryName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByFactoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists linked services. + * + ServiceResponse> * @param resourceGroupName The resource group name. + ServiceResponse> * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LinkedServiceResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByFactorySinglePageAsync(final String resourceGroupName, final String factoryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByFactory(this.client.subscriptionId(), resourceGroupName, factoryName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByFactoryDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByFactoryDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @param properties Properties of linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LinkedServiceResourceInner object if successful. + */ + public LinkedServiceResourceInner createOrUpdate(String resourceGroupName, String factoryName, String linkedServiceName, LinkedServiceInner properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName, properties).toBlocking().single().body(); + } + + /** + * Creates or updates a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @param properties Properties of linked service. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, String linkedServiceName, LinkedServiceInner properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName, properties), serviceCallback); + } + + /** + * Creates or updates a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @param properties Properties of linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, String linkedServiceName, LinkedServiceInner properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName, properties).map(new Func1, LinkedServiceResourceInner>() { + @Override + public LinkedServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @param properties Properties of linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, String linkedServiceName, LinkedServiceInner properties) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (linkedServiceName == null) { + throw new IllegalArgumentException("Parameter linkedServiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + final String ifMatch = null; + LinkedServiceResourceInner linkedService = new LinkedServiceResourceInner(); + linkedService.withProperties(properties); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, linkedServiceName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), linkedService, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @param properties Properties of linked service. + * @param ifMatch ETag of the linkedService entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LinkedServiceResourceInner object if successful. + */ + public LinkedServiceResourceInner createOrUpdate(String resourceGroupName, String factoryName, String linkedServiceName, LinkedServiceInner properties, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName, properties, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @param properties Properties of linked service. + * @param ifMatch ETag of the linkedService entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, String linkedServiceName, LinkedServiceInner properties, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName, properties, ifMatch), serviceCallback); + } + + /** + * Creates or updates a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @param properties Properties of linked service. + * @param ifMatch ETag of the linkedService entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, String linkedServiceName, LinkedServiceInner properties, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName, properties, ifMatch).map(new Func1, LinkedServiceResourceInner>() { + @Override + public LinkedServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @param properties Properties of linked service. + * @param ifMatch ETag of the linkedService entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, String linkedServiceName, LinkedServiceInner properties, String ifMatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (linkedServiceName == null) { + throw new IllegalArgumentException("Parameter linkedServiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + LinkedServiceResourceInner linkedService = new LinkedServiceResourceInner(); + linkedService.withProperties(properties); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, linkedServiceName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), linkedService, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LinkedServiceResourceInner object if successful. + */ + public LinkedServiceResourceInner get(String resourceGroupName, String factoryName, String linkedServiceName) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName).toBlocking().single().body(); + } + + /** + * Gets a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String factoryName, String linkedServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName), serviceCallback); + } + + /** + * Gets a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceResourceInner object + */ + public Observable getAsync(String resourceGroupName, String factoryName, String linkedServiceName) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName).map(new Func1, LinkedServiceResourceInner>() { + @Override + public LinkedServiceResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String factoryName, String linkedServiceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (linkedServiceName == null) { + throw new IllegalArgumentException("Parameter linkedServiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, factoryName, linkedServiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String factoryName, String linkedServiceName) { + deleteWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName).toBlocking().single().body(); + } + + /** + * Deletes a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String factoryName, String linkedServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName), serviceCallback); + } + + /** + * Deletes a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String factoryName, String linkedServiceName) { + return deleteWithServiceResponseAsync(resourceGroupName, factoryName, linkedServiceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a linked service. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param linkedServiceName The linked service name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String factoryName, String linkedServiceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (linkedServiceName == null) { + throw new IllegalArgumentException("Parameter linkedServiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, factoryName, linkedServiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists linked services. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LinkedServiceResourceInner> object if successful. + */ + public PagedList listByFactoryNext(final String nextPageLink) { + ServiceResponse> response = listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists linked services. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByFactoryNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByFactoryNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists linked services. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LinkedServiceResourceInner> object + */ + public Observable> listByFactoryNextAsync(final String nextPageLink) { + return listByFactoryNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists linked services. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LinkedServiceResourceInner> object + */ + public Observable>> listByFactoryNextWithServiceResponseAsync(final String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByFactoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists linked services. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LinkedServiceResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByFactoryNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByFactoryNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByFactoryNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByFactoryNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationInner.java new file mode 100644 index 000000000000..339cc10e23e5 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationInner.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.OperationDisplay; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.OperationServiceSpecification; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Azure Data Factory API operation definition. + */ +@JsonFlatten +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The intended executor of the operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * Metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Details about a service operation. + */ + @JsonProperty(value = "properties.serviceSpecification") + private OperationServiceSpecification serviceSpecification; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the intended executor of the operation. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set the intended executor of the operation. + * + * @param origin the origin value to set + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get metadata associated with the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set metadata associated with the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get details about a service operation. + * + * @return the serviceSpecification value + */ + public OperationServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set details about a service operation. + * + * @param serviceSpecification the serviceSpecification value to set + * @return the OperationInner object itself. + */ + public OperationInner withServiceSpecification(OperationServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationListResponseImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationListResponseImpl.java new file mode 100644 index 000000000000..e0e2d93086e3 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationListResponseImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.OperationListResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class OperationListResponseImpl extends WrapperImpl implements OperationListResponse { + private final DataFactoryManager manager; + OperationListResponseImpl(OperationListResponseInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationListResponseInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationListResponseInner.java new file mode 100644 index 000000000000..fbcd28ee9fd0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationListResponseInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A list of operations that can be performed by the Data Factory service. + */ +public class OperationListResponseInner { + /** + * List of Data Factory operations supported by the Data Factory resource + * provider. + */ + @JsonProperty(value = "value") + private List value; + + /** + * The link to the next page of results, if any remaining results exist. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get list of Data Factory operations supported by the Data Factory resource provider. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set list of Data Factory operations supported by the Data Factory resource provider. + * + * @param value the value value to set + * @return the OperationListResponseInner object itself. + */ + public OperationListResponseInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the link to the next page of results, if any remaining results exist. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the link to the next page of results, if any remaining results exist. + * + * @param nextLink the nextLink value to set + * @return the OperationListResponseInner object itself. + */ + public OperationListResponseInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationsImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationsImpl.java new file mode 100644 index 000000000000..2f6588b4695e --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationsImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.OperationListResponse; + +class OperationsImpl extends WrapperImpl implements Operations { + private final DataFactoryManager manager; + + OperationsImpl(DataFactoryManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .map(new Func1() { + @Override + public OperationListResponse call(OperationListResponseInner inner) { + return new OperationListResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationsInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationsInner.java new file mode 100644 index 000000000000..04e6c86aa5bb --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/OperationsInner.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, DataFactoryManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Operations list" }) + @GET("providers/Microsoft.DataFactory/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the available Azure Data Factory API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationListResponseInner object if successful. + */ + public OperationListResponseInner list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Lists the available Azure Data Factory API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists the available Azure Data Factory API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationListResponseInner object + */ + public Observable listAsync() { + return listWithServiceResponseAsync().map(new Func1, OperationListResponseInner>() { + @Override + public OperationListResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the available Azure Data Factory API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationListResponseInner object + */ + public Observable> listWithServiceResponseAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PageImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PageImpl.java new file mode 100644 index 000000000000..f83cf370573d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineResourceImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineResourceImpl.java new file mode 100644 index 000000000000..ab4c9ba113bf --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineResourceImpl.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Activity; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ParameterSpecification; + +class PipelineResourceImpl extends CreatableUpdatableImpl implements PipelineResource, PipelineResource.Definition, PipelineResource.Update { + private final DataFactoryManager manager; + private String resourceGroupName; + private String factoryName; + private String pipelineName; + private String cifMatch; + private String uifMatch; + + PipelineResourceImpl(String name, DataFactoryManager manager) { + super(name, new PipelineResourceInner()); + this.manager = manager; + // Set resource name + this.pipelineName = name; + // + } + + PipelineResourceImpl(PipelineResourceInner inner, DataFactoryManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.pipelineName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.factoryName = IdParsingUtils.getValueFromIdByName(inner.id(), "factories"); + this.pipelineName = IdParsingUtils.getValueFromIdByName(inner.id(), "pipelines"); + // + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PipelinesInner client = this.manager().inner().pipelines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.factoryName, this.pipelineName, this.inner(), this.cifMatch) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PipelinesInner client = this.manager().inner().pipelines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.factoryName, this.pipelineName, this.inner(), this.uifMatch) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PipelinesInner client = this.manager().inner().pipelines(); + return client.getAsync(this.resourceGroupName, this.factoryName, this.pipelineName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List activities() { + return this.inner().activities(); + } + + @Override + public Map additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public List annotations() { + return this.inner().annotations(); + } + + @Override + public Integer concurrency() { + return this.inner().concurrency(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map parameters() { + return this.inner().parameters(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PipelineResourceImpl withExistingFactory(String resourceGroupName, String factoryName) { + this.resourceGroupName = resourceGroupName; + this.factoryName = factoryName; + return this; + } + + @Override + public PipelineResourceImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public PipelineResourceImpl withActivities(List activities) { + this.inner().withActivities(activities); + return this; + } + + @Override + public PipelineResourceImpl withAdditionalProperties(Map additionalProperties) { + this.inner().withAdditionalProperties(additionalProperties); + return this; + } + + @Override + public PipelineResourceImpl withAnnotations(List annotations) { + this.inner().withAnnotations(annotations); + return this; + } + + @Override + public PipelineResourceImpl withConcurrency(Integer concurrency) { + this.inner().withConcurrency(concurrency); + return this; + } + + @Override + public PipelineResourceImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PipelineResourceImpl withParameters(Map parameters) { + this.inner().withParameters(parameters); + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineResourceInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineResourceInner.java new file mode 100644 index 000000000000..7544aa11a270 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineResourceInner.java @@ -0,0 +1,225 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Activity; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ParameterSpecification; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.SubResource; + +/** + * Pipeline resource type. + */ +@JsonFlatten +public class PipelineResourceInner extends SubResource { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * The description of the pipeline. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * List of activities in pipeline. + */ + @JsonProperty(value = "properties.activities") + private List activities; + + /** + * List of parameters for pipeline. + */ + @JsonProperty(value = "properties.parameters") + private Map parameters; + + /** + * The max number of concurrent runs for the pipeline. + */ + @JsonProperty(value = "properties.concurrency") + private Integer concurrency; + + /** + * List of tags that can be used for describing the Pipeline. + */ + @JsonProperty(value = "properties.annotations") + private List annotations; + + /** + * The resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Etag identifies change in the resource. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the PipelineResourceInner object itself. + */ + public PipelineResourceInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the description of the pipeline. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the pipeline. + * + * @param description the description value to set + * @return the PipelineResourceInner object itself. + */ + public PipelineResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get list of activities in pipeline. + * + * @return the activities value + */ + public List activities() { + return this.activities; + } + + /** + * Set list of activities in pipeline. + * + * @param activities the activities value to set + * @return the PipelineResourceInner object itself. + */ + public PipelineResourceInner withActivities(List activities) { + this.activities = activities; + return this; + } + + /** + * Get list of parameters for pipeline. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set list of parameters for pipeline. + * + * @param parameters the parameters value to set + * @return the PipelineResourceInner object itself. + */ + public PipelineResourceInner withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the max number of concurrent runs for the pipeline. + * + * @return the concurrency value + */ + public Integer concurrency() { + return this.concurrency; + } + + /** + * Set the max number of concurrent runs for the pipeline. + * + * @param concurrency the concurrency value to set + * @return the PipelineResourceInner object itself. + */ + public PipelineResourceInner withConcurrency(Integer concurrency) { + this.concurrency = concurrency; + return this; + } + + /** + * Get list of tags that can be used for describing the Pipeline. + * + * @return the annotations value + */ + public List annotations() { + return this.annotations; + } + + /** + * Set list of tags that can be used for describing the Pipeline. + * + * @param annotations the annotations value to set + * @return the PipelineResourceInner object itself. + */ + public PipelineResourceInner withAnnotations(List annotations) { + this.annotations = annotations; + return this; + } + + /** + * Get the resource name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get etag identifies change in the resource. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunImpl.java new file mode 100644 index 000000000000..47837812d327 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunImpl.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRun; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRunInvokedBy; +import org.joda.time.DateTime; + +class PipelineRunImpl extends WrapperImpl implements PipelineRun { + private final DataFactoryManager manager; + private String resourceGroupName; + private String factoryName; + private String runId; + + PipelineRunImpl(PipelineRunInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + + + @Override + public Map additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public Integer durationInMs() { + return this.inner().durationInMs(); + } + + @Override + public PipelineRunInvokedBy invokedBy() { + return this.inner().invokedBy(); + } + + @Override + public DateTime lastUpdated() { + return this.inner().lastUpdated(); + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Map parameters() { + return this.inner().parameters(); + } + + @Override + public String pipelineName() { + return this.inner().pipelineName(); + } + + @Override + public DateTime runEnd() { + return this.inner().runEnd(); + } + + @Override + public String runId() { + return this.inner().runId(); + } + + @Override + public DateTime runStart() { + return this.inner().runStart(); + } + + @Override + public String status() { + return this.inner().status(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunInner.java new file mode 100644 index 000000000000..98a1f78bf36f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunInner.java @@ -0,0 +1,197 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRunInvokedBy; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a pipeline run. + */ +public class PipelineRunInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Identifier of a run. + */ + @JsonProperty(value = "runId", access = JsonProperty.Access.WRITE_ONLY) + private String runId; + + /** + * The pipeline name. + */ + @JsonProperty(value = "pipelineName", access = JsonProperty.Access.WRITE_ONLY) + private String pipelineName; + + /** + * The full or partial list of parameter name, value pair used in the + * pipeline run. + */ + @JsonProperty(value = "parameters", access = JsonProperty.Access.WRITE_ONLY) + private Map parameters; + + /** + * Entity that started the pipeline run. + */ + @JsonProperty(value = "invokedBy", access = JsonProperty.Access.WRITE_ONLY) + private PipelineRunInvokedBy invokedBy; + + /** + * The last updated timestamp for the pipeline run event in ISO8601 format. + */ + @JsonProperty(value = "lastUpdated", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdated; + + /** + * The start time of a pipeline run in ISO8601 format. + */ + @JsonProperty(value = "runStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime runStart; + + /** + * The end time of a pipeline run in ISO8601 format. + */ + @JsonProperty(value = "runEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime runEnd; + + /** + * The duration of a pipeline run. + */ + @JsonProperty(value = "durationInMs", access = JsonProperty.Access.WRITE_ONLY) + private Integer durationInMs; + + /** + * The status of a pipeline run. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The message from a pipeline run. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the PipelineRunInner object itself. + */ + public PipelineRunInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get identifier of a run. + * + * @return the runId value + */ + public String runId() { + return this.runId; + } + + /** + * Get the pipeline name. + * + * @return the pipelineName value + */ + public String pipelineName() { + return this.pipelineName; + } + + /** + * Get the full or partial list of parameter name, value pair used in the pipeline run. + * + * @return the parameters value + */ + public Map parameters() { + return this.parameters; + } + + /** + * Get entity that started the pipeline run. + * + * @return the invokedBy value + */ + public PipelineRunInvokedBy invokedBy() { + return this.invokedBy; + } + + /** + * Get the last updated timestamp for the pipeline run event in ISO8601 format. + * + * @return the lastUpdated value + */ + public DateTime lastUpdated() { + return this.lastUpdated; + } + + /** + * Get the start time of a pipeline run in ISO8601 format. + * + * @return the runStart value + */ + public DateTime runStart() { + return this.runStart; + } + + /** + * Get the end time of a pipeline run in ISO8601 format. + * + * @return the runEnd value + */ + public DateTime runEnd() { + return this.runEnd; + } + + /** + * Get the duration of a pipeline run. + * + * @return the durationInMs value + */ + public Integer durationInMs() { + return this.durationInMs; + } + + /** + * Get the status of a pipeline run. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the message from a pipeline run. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunQueryResponseImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunQueryResponseImpl.java new file mode 100644 index 000000000000..6a5f19a04932 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunQueryResponseImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRunQueryResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class PipelineRunQueryResponseImpl extends WrapperImpl implements PipelineRunQueryResponse { + private final DataFactoryManager manager; + PipelineRunQueryResponseImpl(PipelineRunQueryResponseInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public String continuationToken() { + return this.inner().continuationToken(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunQueryResponseInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunQueryResponseInner.java new file mode 100644 index 000000000000..1cf860a9887c --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunQueryResponseInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A list pipeline runs. + */ +public class PipelineRunQueryResponseInner { + /** + * List of pipeline runs. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * The continuation token for getting the next page of results, if any + * remaining results exist, null otherwise. + */ + @JsonProperty(value = "continuationToken") + private String continuationToken; + + /** + * Get list of pipeline runs. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set list of pipeline runs. + * + * @param value the value value to set + * @return the PipelineRunQueryResponseInner object itself. + */ + public PipelineRunQueryResponseInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the continuation token for getting the next page of results, if any remaining results exist, null otherwise. + * + * @return the continuationToken value + */ + public String continuationToken() { + return this.continuationToken; + } + + /** + * Set the continuation token for getting the next page of results, if any remaining results exist, null otherwise. + * + * @param continuationToken the continuationToken value to set + * @return the PipelineRunQueryResponseInner object itself. + */ + public PipelineRunQueryResponseInner withContinuationToken(String continuationToken) { + this.continuationToken = continuationToken; + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunsImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunsImpl.java new file mode 100644 index 000000000000..80b508b440bd --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunsImpl.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRuns; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRun; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRunQueryResponse; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRunFilterParameters; + +class PipelineRunsImpl extends WrapperImpl implements PipelineRuns { + private final DataFactoryManager manager; + + PipelineRunsImpl(DataFactoryManager manager) { + super(manager.inner().pipelineRuns()); + this.manager = manager; + } + + public DataFactoryManager manager() { + return this.manager; + } + + private PipelineRunImpl wrapModel(PipelineRunInner inner) { + return new PipelineRunImpl(inner, manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String factoryName, String runId) { + PipelineRunsInner client = this.inner(); + return client.getAsync(resourceGroupName, factoryName, runId) + .map(new Func1() { + @Override + public PipelineRun call(PipelineRunInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable queryByFactoryAsync(String resourceGroupName, String factoryName, PipelineRunFilterParameters filterParameters) { + PipelineRunsInner client = this.inner(); + return client.queryByFactoryAsync(resourceGroupName, factoryName, filterParameters) + .map(new Func1() { + @Override + public PipelineRunQueryResponse call(PipelineRunQueryResponseInner inner) { + return new PipelineRunQueryResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunsInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunsInner.java new file mode 100644 index 000000000000..f87502113cd7 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelineRunsInner.java @@ -0,0 +1,255 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ErrorResponseException; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRunFilterParameters; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PipelineRuns. + */ +public class PipelineRunsInner { + /** The Retrofit service to perform REST calls. */ + private PipelineRunsService service; + /** The service client containing this operation class. */ + private DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of PipelineRunsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PipelineRunsInner(Retrofit retrofit, DataFactoryManagementClientImpl client) { + this.service = retrofit.create(PipelineRunsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PipelineRuns to be + * used by Retrofit to perform actually REST calls. + */ + interface PipelineRunsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRuns queryByFactory" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelineruns") + Observable> queryByFactory(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Body PipelineRunFilterParameters filterParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineRuns get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelineruns/{runId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("runId") String runId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Query pipeline runs in the factory based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param filterParameters Parameters to filter the pipeline run. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PipelineRunQueryResponseInner object if successful. + */ + public PipelineRunQueryResponseInner queryByFactory(String resourceGroupName, String factoryName, PipelineRunFilterParameters filterParameters) { + return queryByFactoryWithServiceResponseAsync(resourceGroupName, factoryName, filterParameters).toBlocking().single().body(); + } + + /** + * Query pipeline runs in the factory based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param filterParameters Parameters to filter the pipeline run. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture queryByFactoryAsync(String resourceGroupName, String factoryName, PipelineRunFilterParameters filterParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(queryByFactoryWithServiceResponseAsync(resourceGroupName, factoryName, filterParameters), serviceCallback); + } + + /** + * Query pipeline runs in the factory based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param filterParameters Parameters to filter the pipeline run. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PipelineRunQueryResponseInner object + */ + public Observable queryByFactoryAsync(String resourceGroupName, String factoryName, PipelineRunFilterParameters filterParameters) { + return queryByFactoryWithServiceResponseAsync(resourceGroupName, factoryName, filterParameters).map(new Func1, PipelineRunQueryResponseInner>() { + @Override + public PipelineRunQueryResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Query pipeline runs in the factory based on input filter conditions. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param filterParameters Parameters to filter the pipeline run. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PipelineRunQueryResponseInner object + */ + public Observable> queryByFactoryWithServiceResponseAsync(String resourceGroupName, String factoryName, PipelineRunFilterParameters filterParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filterParameters == null) { + throw new IllegalArgumentException("Parameter filterParameters is required and cannot be null."); + } + Validator.validate(filterParameters); + return service.queryByFactory(this.client.subscriptionId(), resourceGroupName, factoryName, this.client.apiVersion(), filterParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = queryByFactoryDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse queryByFactoryDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a pipeline run by its run ID. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PipelineRunInner object if successful. + */ + public PipelineRunInner get(String resourceGroupName, String factoryName, String runId) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, runId).toBlocking().single().body(); + } + + /** + * Get a pipeline run by its run ID. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String factoryName, String runId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, factoryName, runId), serviceCallback); + } + + /** + * Get a pipeline run by its run ID. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PipelineRunInner object + */ + public Observable getAsync(String resourceGroupName, String factoryName, String runId) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, runId).map(new Func1, PipelineRunInner>() { + @Override + public PipelineRunInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a pipeline run by its run ID. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param runId The pipeline run identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PipelineRunInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String factoryName, String runId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (runId == null) { + throw new IllegalArgumentException("Parameter runId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, factoryName, runId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelinesImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelinesImpl.java new file mode 100644 index 000000000000..674ec6589be4 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelinesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Pipelines; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.CreateRunResponse; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.PipelineResource; + +class PipelinesImpl extends WrapperImpl implements Pipelines { + private final DataFactoryManager manager; + + PipelinesImpl(DataFactoryManager manager) { + super(manager.inner().pipelines()); + this.manager = manager; + } + + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public PipelineResourceImpl define(String name) { + return wrapModel(name); + } + + private PipelineResourceImpl wrapModel(PipelineResourceInner inner) { + return new PipelineResourceImpl(inner, manager()); + } + + private PipelineResourceImpl wrapModel(String name) { + return new PipelineResourceImpl(name, this.manager()); + } + + @Override + public Observable createRunAsync(String resourceGroupName, String factoryName, String pipelineName) { + PipelinesInner client = this.inner(); + return client.createRunAsync(resourceGroupName, factoryName, pipelineName) + .map(new Func1() { + @Override + public CreateRunResponse call(CreateRunResponseInner inner) { + return new CreateRunResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByFactoryAsync(final String resourceGroupName, final String factoryName) { + PipelinesInner client = this.inner(); + return client.listByFactoryAsync(resourceGroupName, factoryName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PipelineResource call(PipelineResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String factoryName, String pipelineName) { + PipelinesInner client = this.inner(); + return client.getAsync(resourceGroupName, factoryName, pipelineName) + .map(new Func1() { + @Override + public PipelineResource call(PipelineResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String factoryName, String pipelineName) { + PipelinesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, factoryName, pipelineName).toCompletable(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelinesInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelinesInner.java new file mode 100644 index 000000000000..9aece8a59932 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/PipelinesInner.java @@ -0,0 +1,897 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Pipelines. + */ +public class PipelinesInner { + /** The Retrofit service to perform REST calls. */ + private PipelinesService service; + /** The service client containing this operation class. */ + private DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of PipelinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PipelinesInner(Retrofit retrofit, DataFactoryManagementClientImpl client) { + this.service = retrofit.create(PipelinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Pipelines to be + * used by Retrofit to perform actually REST calls. + */ + interface PipelinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Pipelines listByFactory" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines") + Observable> listByFactory(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Pipelines createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("pipelineName") String pipelineName, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @Body PipelineResourceInner pipeline, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Pipelines get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("pipelineName") String pipelineName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Pipelines delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("pipelineName") String pipelineName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Pipelines createRun" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName}/createRun") + Observable> createRun(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("pipelineName") String pipelineName, @Query("api-version") String apiVersion, @Body Map parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Pipelines listByFactoryNext" }) + @GET + Observable> listByFactoryNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists pipelines. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PipelineResourceInner> object if successful. + */ + public PagedList listByFactory(final String resourceGroupName, final String factoryName) { + ServiceResponse> response = listByFactorySinglePageAsync(resourceGroupName, factoryName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists pipelines. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByFactoryAsync(final String resourceGroupName, final String factoryName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByFactorySinglePageAsync(resourceGroupName, factoryName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists pipelines. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PipelineResourceInner> object + */ + public Observable> listByFactoryAsync(final String resourceGroupName, final String factoryName) { + return listByFactoryWithServiceResponseAsync(resourceGroupName, factoryName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists pipelines. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PipelineResourceInner> object + */ + public Observable>> listByFactoryWithServiceResponseAsync(final String resourceGroupName, final String factoryName) { + return listByFactorySinglePageAsync(resourceGroupName, factoryName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByFactoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists pipelines. + * + ServiceResponse> * @param resourceGroupName The resource group name. + ServiceResponse> * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PipelineResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByFactorySinglePageAsync(final String resourceGroupName, final String factoryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByFactory(this.client.subscriptionId(), resourceGroupName, factoryName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByFactoryDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByFactoryDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param pipeline Pipeline resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PipelineResourceInner object if successful. + */ + public PipelineResourceInner createOrUpdate(String resourceGroupName, String factoryName, String pipelineName, PipelineResourceInner pipeline) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName, pipeline).toBlocking().single().body(); + } + + /** + * Creates or updates a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param pipeline Pipeline resource definition. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, String pipelineName, PipelineResourceInner pipeline, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName, pipeline), serviceCallback); + } + + /** + * Creates or updates a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param pipeline Pipeline resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PipelineResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, String pipelineName, PipelineResourceInner pipeline) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName, pipeline).map(new Func1, PipelineResourceInner>() { + @Override + public PipelineResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param pipeline Pipeline resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PipelineResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, String pipelineName, PipelineResourceInner pipeline) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (pipelineName == null) { + throw new IllegalArgumentException("Parameter pipelineName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (pipeline == null) { + throw new IllegalArgumentException("Parameter pipeline is required and cannot be null."); + } + Validator.validate(pipeline); + final String ifMatch = null; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, pipelineName, this.client.apiVersion(), ifMatch, pipeline, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param pipeline Pipeline resource definition. + * @param ifMatch ETag of the pipeline entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PipelineResourceInner object if successful. + */ + public PipelineResourceInner createOrUpdate(String resourceGroupName, String factoryName, String pipelineName, PipelineResourceInner pipeline, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName, pipeline, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param pipeline Pipeline resource definition. + * @param ifMatch ETag of the pipeline entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, String pipelineName, PipelineResourceInner pipeline, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName, pipeline, ifMatch), serviceCallback); + } + + /** + * Creates or updates a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param pipeline Pipeline resource definition. + * @param ifMatch ETag of the pipeline entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PipelineResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, String pipelineName, PipelineResourceInner pipeline, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName, pipeline, ifMatch).map(new Func1, PipelineResourceInner>() { + @Override + public PipelineResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param pipeline Pipeline resource definition. + * @param ifMatch ETag of the pipeline entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PipelineResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, String pipelineName, PipelineResourceInner pipeline, String ifMatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (pipelineName == null) { + throw new IllegalArgumentException("Parameter pipelineName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (pipeline == null) { + throw new IllegalArgumentException("Parameter pipeline is required and cannot be null."); + } + Validator.validate(pipeline); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, pipelineName, this.client.apiVersion(), ifMatch, pipeline, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PipelineResourceInner object if successful. + */ + public PipelineResourceInner get(String resourceGroupName, String factoryName, String pipelineName) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName).toBlocking().single().body(); + } + + /** + * Gets a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String factoryName, String pipelineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName), serviceCallback); + } + + /** + * Gets a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PipelineResourceInner object + */ + public Observable getAsync(String resourceGroupName, String factoryName, String pipelineName) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName).map(new Func1, PipelineResourceInner>() { + @Override + public PipelineResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PipelineResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String factoryName, String pipelineName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (pipelineName == null) { + throw new IllegalArgumentException("Parameter pipelineName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, factoryName, pipelineName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String factoryName, String pipelineName) { + deleteWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName).toBlocking().single().body(); + } + + /** + * Deletes a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String factoryName, String pipelineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName), serviceCallback); + } + + /** + * Deletes a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String factoryName, String pipelineName) { + return deleteWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String factoryName, String pipelineName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (pipelineName == null) { + throw new IllegalArgumentException("Parameter pipelineName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, factoryName, pipelineName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates a run of a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CreateRunResponseInner object if successful. + */ + public CreateRunResponseInner createRun(String resourceGroupName, String factoryName, String pipelineName) { + return createRunWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName).toBlocking().single().body(); + } + + /** + * Creates a run of a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createRunAsync(String resourceGroupName, String factoryName, String pipelineName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createRunWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName), serviceCallback); + } + + /** + * Creates a run of a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CreateRunResponseInner object + */ + public Observable createRunAsync(String resourceGroupName, String factoryName, String pipelineName) { + return createRunWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName).map(new Func1, CreateRunResponseInner>() { + @Override + public CreateRunResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a run of a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CreateRunResponseInner object + */ + public Observable> createRunWithServiceResponseAsync(String resourceGroupName, String factoryName, String pipelineName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (pipelineName == null) { + throw new IllegalArgumentException("Parameter pipelineName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Map parameters = null; + return service.createRun(this.client.subscriptionId(), resourceGroupName, factoryName, pipelineName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createRunDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a run of a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param parameters Parameters of the pipeline run. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CreateRunResponseInner object if successful. + */ + public CreateRunResponseInner createRun(String resourceGroupName, String factoryName, String pipelineName, Map parameters) { + return createRunWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName, parameters).toBlocking().single().body(); + } + + /** + * Creates a run of a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param parameters Parameters of the pipeline run. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createRunAsync(String resourceGroupName, String factoryName, String pipelineName, Map parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createRunWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName, parameters), serviceCallback); + } + + /** + * Creates a run of a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param parameters Parameters of the pipeline run. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CreateRunResponseInner object + */ + public Observable createRunAsync(String resourceGroupName, String factoryName, String pipelineName, Map parameters) { + return createRunWithServiceResponseAsync(resourceGroupName, factoryName, pipelineName, parameters).map(new Func1, CreateRunResponseInner>() { + @Override + public CreateRunResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a run of a pipeline. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param pipelineName The pipeline name. + * @param parameters Parameters of the pipeline run. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CreateRunResponseInner object + */ + public Observable> createRunWithServiceResponseAsync(String resourceGroupName, String factoryName, String pipelineName, Map parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (pipelineName == null) { + throw new IllegalArgumentException("Parameter pipelineName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createRun(this.client.subscriptionId(), resourceGroupName, factoryName, pipelineName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createRunDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createRunDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists pipelines. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PipelineResourceInner> object if successful. + */ + public PagedList listByFactoryNext(final String nextPageLink) { + ServiceResponse> response = listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists pipelines. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByFactoryNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByFactoryNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists pipelines. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PipelineResourceInner> object + */ + public Observable> listByFactoryNextAsync(final String nextPageLink) { + return listByFactoryNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists pipelines. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PipelineResourceInner> object + */ + public Observable>> listByFactoryNextWithServiceResponseAsync(final String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByFactoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists pipelines. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PipelineResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByFactoryNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByFactoryNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByFactoryNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByFactoryNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/SelfHostedIntegrationRuntimeNodeImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/SelfHostedIntegrationRuntimeNodeImpl.java new file mode 100644 index 000000000000..c16a32f90267 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/SelfHostedIntegrationRuntimeNodeImpl.java @@ -0,0 +1,120 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.SelfHostedIntegrationRuntimeNode; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; +import org.joda.time.DateTime; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeUpdateResult; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.SelfHostedIntegrationRuntimeNodeStatus; + +class SelfHostedIntegrationRuntimeNodeImpl extends WrapperImpl implements SelfHostedIntegrationRuntimeNode { + private final DataFactoryManager manager; + SelfHostedIntegrationRuntimeNodeImpl(SelfHostedIntegrationRuntimeNodeInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public Map capabilities() { + return this.inner().capabilities(); + } + + @Override + public Integer concurrentJobsLimit() { + return this.inner().concurrentJobsLimit(); + } + + @Override + public DateTime expiryTime() { + return this.inner().expiryTime(); + } + + @Override + public String hostServiceUri() { + return this.inner().hostServiceUri(); + } + + @Override + public Boolean isActiveDispatcher() { + return this.inner().isActiveDispatcher(); + } + + @Override + public DateTime lastConnectTime() { + return this.inner().lastConnectTime(); + } + + @Override + public DateTime lastEndUpdateTime() { + return this.inner().lastEndUpdateTime(); + } + + @Override + public DateTime lastStartTime() { + return this.inner().lastStartTime(); + } + + @Override + public DateTime lastStartUpdateTime() { + return this.inner().lastStartUpdateTime(); + } + + @Override + public DateTime lastStopTime() { + return this.inner().lastStopTime(); + } + + @Override + public IntegrationRuntimeUpdateResult lastUpdateResult() { + return this.inner().lastUpdateResult(); + } + + @Override + public String machineName() { + return this.inner().machineName(); + } + + @Override + public Integer maxConcurrentJobs() { + return this.inner().maxConcurrentJobs(); + } + + @Override + public String nodeName() { + return this.inner().nodeName(); + } + + @Override + public DateTime registerTime() { + return this.inner().registerTime(); + } + + @Override + public SelfHostedIntegrationRuntimeNodeStatus status() { + return this.inner().status(); + } + + @Override + public String version() { + return this.inner().version(); + } + + @Override + public String versionStatus() { + return this.inner().versionStatus(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/SelfHostedIntegrationRuntimeNodeInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/SelfHostedIntegrationRuntimeNodeInner.java new file mode 100644 index 000000000000..510b5aad1bca --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/SelfHostedIntegrationRuntimeNodeInner.java @@ -0,0 +1,297 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.SelfHostedIntegrationRuntimeNodeStatus; +import java.util.Map; +import org.joda.time.DateTime; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.IntegrationRuntimeUpdateResult; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of Self-hosted integration runtime node. + */ +public class SelfHostedIntegrationRuntimeNodeInner { + /** + * Name of the integration runtime node. + */ + @JsonProperty(value = "nodeName", access = JsonProperty.Access.WRITE_ONLY) + private String nodeName; + + /** + * Machine name of the integration runtime node. + */ + @JsonProperty(value = "machineName", access = JsonProperty.Access.WRITE_ONLY) + private String machineName; + + /** + * URI for the host machine of the integration runtime. + */ + @JsonProperty(value = "hostServiceUri", access = JsonProperty.Access.WRITE_ONLY) + private String hostServiceUri; + + /** + * Status of the integration runtime node. Possible values include: + * 'NeedRegistration', 'Online', 'Limited', 'Offline', 'Upgrading', + * 'Initializing', 'InitializeFailed'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private SelfHostedIntegrationRuntimeNodeStatus status; + + /** + * The integration runtime capabilities dictionary. + */ + @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY) + private Map capabilities; + + /** + * Status of the integration runtime node version. + */ + @JsonProperty(value = "versionStatus", access = JsonProperty.Access.WRITE_ONLY) + private String versionStatus; + + /** + * Version of the integration runtime node. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * The time at which the integration runtime node was registered in ISO8601 + * format. + */ + @JsonProperty(value = "registerTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime registerTime; + + /** + * The most recent time at which the integration runtime was connected in + * ISO8601 format. + */ + @JsonProperty(value = "lastConnectTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastConnectTime; + + /** + * The time at which the integration runtime will expire in ISO8601 format. + */ + @JsonProperty(value = "expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expiryTime; + + /** + * The time the node last started up. + */ + @JsonProperty(value = "lastStartTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastStartTime; + + /** + * The integration runtime node last stop time. + */ + @JsonProperty(value = "lastStopTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastStopTime; + + /** + * The result of the last integration runtime node update. Possible values + * include: 'Succeed', 'Fail'. + */ + @JsonProperty(value = "lastUpdateResult", access = JsonProperty.Access.WRITE_ONLY) + private IntegrationRuntimeUpdateResult lastUpdateResult; + + /** + * The last time for the integration runtime node update start. + */ + @JsonProperty(value = "lastStartUpdateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastStartUpdateTime; + + /** + * The last time for the integration runtime node update end. + */ + @JsonProperty(value = "lastEndUpdateTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastEndUpdateTime; + + /** + * Indicates whether this node is the active dispatcher for integration + * runtime requests. + */ + @JsonProperty(value = "isActiveDispatcher", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isActiveDispatcher; + + /** + * Maximum concurrent jobs on the integration runtime node. + */ + @JsonProperty(value = "concurrentJobsLimit", access = JsonProperty.Access.WRITE_ONLY) + private Integer concurrentJobsLimit; + + /** + * The maximum concurrent jobs in this integration runtime. + */ + @JsonProperty(value = "maxConcurrentJobs", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxConcurrentJobs; + + /** + * Get name of the integration runtime node. + * + * @return the nodeName value + */ + public String nodeName() { + return this.nodeName; + } + + /** + * Get machine name of the integration runtime node. + * + * @return the machineName value + */ + public String machineName() { + return this.machineName; + } + + /** + * Get uRI for the host machine of the integration runtime. + * + * @return the hostServiceUri value + */ + public String hostServiceUri() { + return this.hostServiceUri; + } + + /** + * Get status of the integration runtime node. Possible values include: 'NeedRegistration', 'Online', 'Limited', 'Offline', 'Upgrading', 'Initializing', 'InitializeFailed'. + * + * @return the status value + */ + public SelfHostedIntegrationRuntimeNodeStatus status() { + return this.status; + } + + /** + * Get the integration runtime capabilities dictionary. + * + * @return the capabilities value + */ + public Map capabilities() { + return this.capabilities; + } + + /** + * Get status of the integration runtime node version. + * + * @return the versionStatus value + */ + public String versionStatus() { + return this.versionStatus; + } + + /** + * Get version of the integration runtime node. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Get the time at which the integration runtime node was registered in ISO8601 format. + * + * @return the registerTime value + */ + public DateTime registerTime() { + return this.registerTime; + } + + /** + * Get the most recent time at which the integration runtime was connected in ISO8601 format. + * + * @return the lastConnectTime value + */ + public DateTime lastConnectTime() { + return this.lastConnectTime; + } + + /** + * Get the time at which the integration runtime will expire in ISO8601 format. + * + * @return the expiryTime value + */ + public DateTime expiryTime() { + return this.expiryTime; + } + + /** + * Get the time the node last started up. + * + * @return the lastStartTime value + */ + public DateTime lastStartTime() { + return this.lastStartTime; + } + + /** + * Get the integration runtime node last stop time. + * + * @return the lastStopTime value + */ + public DateTime lastStopTime() { + return this.lastStopTime; + } + + /** + * Get the result of the last integration runtime node update. Possible values include: 'Succeed', 'Fail'. + * + * @return the lastUpdateResult value + */ + public IntegrationRuntimeUpdateResult lastUpdateResult() { + return this.lastUpdateResult; + } + + /** + * Get the last time for the integration runtime node update start. + * + * @return the lastStartUpdateTime value + */ + public DateTime lastStartUpdateTime() { + return this.lastStartUpdateTime; + } + + /** + * Get the last time for the integration runtime node update end. + * + * @return the lastEndUpdateTime value + */ + public DateTime lastEndUpdateTime() { + return this.lastEndUpdateTime; + } + + /** + * Get indicates whether this node is the active dispatcher for integration runtime requests. + * + * @return the isActiveDispatcher value + */ + public Boolean isActiveDispatcher() { + return this.isActiveDispatcher; + } + + /** + * Get maximum concurrent jobs on the integration runtime node. + * + * @return the concurrentJobsLimit value + */ + public Integer concurrentJobsLimit() { + return this.concurrentJobsLimit; + } + + /** + * Get the maximum concurrent jobs in this integration runtime. + * + * @return the maxConcurrentJobs value + */ + public Integer maxConcurrentJobs() { + return this.maxConcurrentJobs; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerInner.java new file mode 100644 index 000000000000..6d34afcf225b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.TriggerRuntimeState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Azure data factory nested object which contains information about creating + * pipeline run. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Trigger") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "TumblingWindowTrigger", value = TumblingWindowTrigger.class), + @JsonSubTypes.Type(name = "MultiplePipelineTrigger", value = MultiplePipelineTrigger.class) +}) +public class TriggerInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Trigger description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Indicates if trigger is running or not. Updated when Start/Stop APIs are + * called on the Trigger. Possible values include: 'Started', 'Stopped', + * 'Disabled'. + */ + @JsonProperty(value = "runtimeState", access = JsonProperty.Access.WRITE_ONLY) + private TriggerRuntimeState runtimeState; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the TriggerInner object itself. + */ + public TriggerInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get trigger description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set trigger description. + * + * @param description the description value to set + * @return the TriggerInner object itself. + */ + public TriggerInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get indicates if trigger is running or not. Updated when Start/Stop APIs are called on the Trigger. Possible values include: 'Started', 'Stopped', 'Disabled'. + * + * @return the runtimeState value + */ + public TriggerRuntimeState runtimeState() { + return this.runtimeState; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerResourceImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerResourceImpl.java new file mode 100644 index 000000000000..5ebe6abe9f94 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerResourceImpl.java @@ -0,0 +1,154 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.TriggerResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.TriggerRuntimeState; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.; +import rx.functions.Func1; + +class TriggerResourceImpl extends CreatableUpdatableImpl implements TriggerResource, TriggerResource.Definition, TriggerResource.Update { + private final DataFactoryManager manager; + private String resourceGroupName; + private String factoryName; + private String triggerName; + private String cifMatch; + private TriggerInner cproperties; + private String uifMatch; + private TriggerInner uproperties; + + TriggerResourceImpl(String name, DataFactoryManager manager) { + super(name, new TriggerResourceInner()); + this.manager = manager; + // Set resource name + this.triggerName = name; + // + this.cproperties = new TriggerInner(); + this.uproperties = new TriggerInner(); + } + + TriggerResourceImpl(TriggerResourceInner inner, DataFactoryManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.triggerName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.factoryName = IdParsingUtils.getValueFromIdByName(inner.id(), "factories"); + this.triggerName = IdParsingUtils.getValueFromIdByName(inner.id(), "triggers"); + // + this.cproperties = new TriggerInner(); + this.uproperties = new TriggerInner(); + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + TriggersInner client = this.manager().inner().triggers(); + return client.createOrUpdateAsync(this.resourceGroupName, this.factoryName, this.triggerName, this.cproperties, this.cifMatch) + .map(new Func1() { + @Override + public TriggerResourceInner call(TriggerResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + TriggersInner client = this.manager().inner().triggers(); + return client.createOrUpdateAsync(this.resourceGroupName, this.factoryName, this.triggerName, this.uproperties, this.uifMatch) + .map(new Func1() { + @Override + public TriggerResourceInner call(TriggerResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + TriggersInner client = this.manager().inner().triggers(); + return client.getAsync(this.resourceGroupName, this.factoryName, this.triggerName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.cproperties = new TriggerInner(); + this.uproperties = new TriggerInner(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public TriggerInner properties() { + return this.inner().properties(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public TriggerResourceImpl withExistingFactory(String resourceGroupName, String factoryName) { + this.resourceGroupName = resourceGroupName; + this.factoryName = factoryName; + return this; + } + + @Override + public TriggerResourceImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.cifMatch = ifMatch; + } else { + this.uifMatch = ifMatch; + } + return this; + } + + @Override + public TriggerResourceImpl withProperties(TriggerInner properties) { + if (isInCreateMode()) { + this.cproperties = properties; + } else { + this.uproperties = properties; + } + return this; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerResourceInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerResourceInner.java new file mode 100644 index 000000000000..566a4eacc51f --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerResourceInner.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.SubResource; + +/** + * Trigger resource type. + */ +public class TriggerResourceInner extends SubResource { + /** + * Properties of the trigger. + */ + @JsonProperty(value = "properties", required = true) + private TriggerInner properties; + + /** + * The resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Etag identifies change in the resource. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get properties of the trigger. + * + * @return the properties value + */ + public TriggerInner properties() { + return this.properties; + } + + /** + * Set properties of the trigger. + * + * @param properties the properties value to set + * @return the TriggerResourceInner object itself. + */ + public TriggerResourceInner withProperties(TriggerInner properties) { + this.properties = properties; + return this; + } + + /** + * Get the resource name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get etag identifies change in the resource. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerRunImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerRunImpl.java new file mode 100644 index 000000000000..14b40dc2b742 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerRunImpl.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.TriggerRun; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.TriggerRunStatus; +import org.joda.time.DateTime; + +class TriggerRunImpl extends WrapperImpl implements TriggerRun { + private final DataFactoryManager manager; + + TriggerRunImpl(TriggerRunInner inner, DataFactoryManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DataFactoryManager manager() { + return this.manager; + } + + + + @Override + public Map additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Map properties() { + return this.inner().properties(); + } + + @Override + public TriggerRunStatus status() { + return this.inner().status(); + } + + @Override + public Map triggeredPipelines() { + return this.inner().triggeredPipelines(); + } + + @Override + public String triggerName() { + return this.inner().triggerName(); + } + + @Override + public String triggerRunId() { + return this.inner().triggerRunId(); + } + + @Override + public DateTime triggerRunTimestamp() { + return this.inner().triggerRunTimestamp(); + } + + @Override + public String triggerType() { + return this.inner().triggerType(); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerRunInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerRunInner.java new file mode 100644 index 000000000000..da524f923709 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggerRunInner.java @@ -0,0 +1,168 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import java.util.Map; +import org.joda.time.DateTime; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.TriggerRunStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Trigger runs. + */ +public class TriggerRunInner { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Trigger run id. + */ + @JsonProperty(value = "triggerRunId", access = JsonProperty.Access.WRITE_ONLY) + private String triggerRunId; + + /** + * Trigger name. + */ + @JsonProperty(value = "triggerName", access = JsonProperty.Access.WRITE_ONLY) + private String triggerName; + + /** + * Trigger type. + */ + @JsonProperty(value = "triggerType", access = JsonProperty.Access.WRITE_ONLY) + private String triggerType; + + /** + * Trigger run start time. + */ + @JsonProperty(value = "triggerRunTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime triggerRunTimestamp; + + /** + * Trigger run status. Possible values include: 'Succeeded', 'Failed', + * 'Inprogress'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private TriggerRunStatus status; + + /** + * Trigger error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * List of property name and value related to trigger run. Name, value pair + * depends on type of trigger. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private Map properties; + + /** + * List of pipeline name and run Id triggered by the trigger run. + */ + @JsonProperty(value = "triggeredPipelines", access = JsonProperty.Access.WRITE_ONLY) + private Map triggeredPipelines; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the TriggerRunInner object itself. + */ + public TriggerRunInner withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get trigger run id. + * + * @return the triggerRunId value + */ + public String triggerRunId() { + return this.triggerRunId; + } + + /** + * Get trigger name. + * + * @return the triggerName value + */ + public String triggerName() { + return this.triggerName; + } + + /** + * Get trigger type. + * + * @return the triggerType value + */ + public String triggerType() { + return this.triggerType; + } + + /** + * Get trigger run start time. + * + * @return the triggerRunTimestamp value + */ + public DateTime triggerRunTimestamp() { + return this.triggerRunTimestamp; + } + + /** + * Get trigger run status. Possible values include: 'Succeeded', 'Failed', 'Inprogress'. + * + * @return the status value + */ + public TriggerRunStatus status() { + return this.status; + } + + /** + * Get trigger error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get list of property name and value related to trigger run. Name, value pair depends on type of trigger. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + + /** + * Get list of pipeline name and run Id triggered by the trigger run. + * + * @return the triggeredPipelines value + */ + public Map triggeredPipelines() { + return this.triggeredPipelines; + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggersImpl.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggersImpl.java new file mode 100644 index 000000000000..2155cf6ce20b --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggersImpl.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.TriggerResource; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.TriggerRun; + +class TriggersImpl extends WrapperImpl implements Triggers { + private final DataFactoryManager manager; + + TriggersImpl(DataFactoryManager manager) { + super(manager.inner().triggers()); + this.manager = manager; + } + + public DataFactoryManager manager() { + return this.manager; + } + + @Override + public TriggerResourceImpl define(String name) { + return wrapModel(name); + } + + private TriggerResourceImpl wrapModel(TriggerResourceInner inner) { + return new TriggerResourceImpl(inner, manager()); + } + + private TriggerResourceImpl wrapModel(String name) { + return new TriggerResourceImpl(name, this.manager()); + } + + @Override + public Completable startAsync(String resourceGroupName, String factoryName, String triggerName) { + TriggersInner client = this.inner(); + return client.startAsync(resourceGroupName, factoryName, triggerName).toCompletable(); + } + + @Override + public Completable stopAsync(String resourceGroupName, String factoryName, String triggerName) { + TriggersInner client = this.inner(); + return client.stopAsync(resourceGroupName, factoryName, triggerName).toCompletable(); + } + + @Override + public Observable listByFactoryAsync(final String resourceGroupName, final String factoryName) { + TriggersInner client = this.inner(); + return client.listByFactoryAsync(resourceGroupName, factoryName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TriggerResource call(TriggerResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String factoryName, String triggerName) { + TriggersInner client = this.inner(); + return client.getAsync(resourceGroupName, factoryName, triggerName) + .map(new Func1() { + @Override + public TriggerResource call(TriggerResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String factoryName, String triggerName) { + TriggersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, factoryName, triggerName).toCompletable(); + } + + private TriggerRunImpl wrapTriggerRunModel(TriggerRunInner inner) { + return new TriggerRunImpl(inner, manager()); + } + + @Override + public Observable listRunsAsync(final String resourceGroupName, final String factoryName, final String triggerName, final DateTime startTime, final DateTime endTime) { + TriggersInner client = this.inner(); + return client.listRunsAsync(resourceGroupName, factoryName, triggerName, startTime, endTime) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TriggerRun call(TriggerRunInner inner) { + return wrapTriggerRunModel(inner); + } + }); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggersInner.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggersInner.java new file mode 100644 index 000000000000..72c3df87879d --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/TriggersInner.java @@ -0,0 +1,1328 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.datafactory.v2017_09_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Triggers. + */ +public class TriggersInner { + /** The Retrofit service to perform REST calls. */ + private TriggersService service; + /** The service client containing this operation class. */ + private DataFactoryManagementClientImpl client; + + /** + * Initializes an instance of TriggersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TriggersInner(Retrofit retrofit, DataFactoryManagementClientImpl client) { + this.service = retrofit.create(TriggersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Triggers to be + * used by Retrofit to perform actually REST calls. + */ + interface TriggersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers listByFactory" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers") + Observable> listByFactory(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Header("If-Match") String ifMatch, @Header("accept-language") String acceptLanguage, @Body TriggerResourceInner trigger, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers start" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/start") + Observable> start(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers beginStart" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/start") + Observable> beginStart(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers stop" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/stop") + Observable> stop(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers beginStop" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/stop") + Observable> beginStop(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers listRuns" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/triggers/{triggerName}/triggerruns") + Observable> listRuns(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("factoryName") String factoryName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Query("startTime") DateTime startTime, @Query("endTime") DateTime endTime, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers listByFactoryNext" }) + @GET + Observable> listByFactoryNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datafactory.v2017_09_01_preview.Triggers listRunsNext" }) + @GET + Observable> listRunsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists triggers. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TriggerResourceInner> object if successful. + */ + public PagedList listByFactory(final String resourceGroupName, final String factoryName) { + ServiceResponse> response = listByFactorySinglePageAsync(resourceGroupName, factoryName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists triggers. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByFactoryAsync(final String resourceGroupName, final String factoryName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByFactorySinglePageAsync(resourceGroupName, factoryName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists triggers. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TriggerResourceInner> object + */ + public Observable> listByFactoryAsync(final String resourceGroupName, final String factoryName) { + return listByFactoryWithServiceResponseAsync(resourceGroupName, factoryName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists triggers. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TriggerResourceInner> object + */ + public Observable>> listByFactoryWithServiceResponseAsync(final String resourceGroupName, final String factoryName) { + return listByFactorySinglePageAsync(resourceGroupName, factoryName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByFactoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists triggers. + * + ServiceResponse> * @param resourceGroupName The resource group name. + ServiceResponse> * @param factoryName The factory name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TriggerResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByFactorySinglePageAsync(final String resourceGroupName, final String factoryName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByFactory(this.client.subscriptionId(), resourceGroupName, factoryName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByFactoryDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByFactoryDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param properties Properties of the trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TriggerResourceInner object if successful. + */ + public TriggerResourceInner createOrUpdate(String resourceGroupName, String factoryName, String triggerName, TriggerInner properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, triggerName, properties).toBlocking().single().body(); + } + + /** + * Creates or updates a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param properties Properties of the trigger. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, String triggerName, TriggerInner properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, triggerName, properties), serviceCallback); + } + + /** + * Creates or updates a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param properties Properties of the trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TriggerResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, String triggerName, TriggerInner properties) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, triggerName, properties).map(new Func1, TriggerResourceInner>() { + @Override + public TriggerResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param properties Properties of the trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TriggerResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, String triggerName, TriggerInner properties) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + final String ifMatch = null; + TriggerResourceInner trigger = new TriggerResourceInner(); + trigger.withProperties(properties); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, triggerName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), trigger, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates or updates a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param properties Properties of the trigger. + * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TriggerResourceInner object if successful. + */ + public TriggerResourceInner createOrUpdate(String resourceGroupName, String factoryName, String triggerName, TriggerInner properties, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, triggerName, properties, ifMatch).toBlocking().single().body(); + } + + /** + * Creates or updates a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param properties Properties of the trigger. + * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String factoryName, String triggerName, TriggerInner properties, String ifMatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, triggerName, properties, ifMatch), serviceCallback); + } + + /** + * Creates or updates a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param properties Properties of the trigger. + * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TriggerResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String factoryName, String triggerName, TriggerInner properties, String ifMatch) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, factoryName, triggerName, properties, ifMatch).map(new Func1, TriggerResourceInner>() { + @Override + public TriggerResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param properties Properties of the trigger. + * @param ifMatch ETag of the trigger entity. Should only be specified for update, for which it should match existing entity or can be * for unconditional update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TriggerResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String factoryName, String triggerName, TriggerInner properties, String ifMatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (properties == null) { + throw new IllegalArgumentException("Parameter properties is required and cannot be null."); + } + Validator.validate(properties); + TriggerResourceInner trigger = new TriggerResourceInner(); + trigger.withProperties(properties); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, factoryName, triggerName, this.client.apiVersion(), ifMatch, this.client.acceptLanguage(), trigger, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TriggerResourceInner object if successful. + */ + public TriggerResourceInner get(String resourceGroupName, String factoryName, String triggerName) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).toBlocking().single().body(); + } + + /** + * Gets a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String factoryName, String triggerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, factoryName, triggerName), serviceCallback); + } + + /** + * Gets a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TriggerResourceInner object + */ + public Observable getAsync(String resourceGroupName, String factoryName, String triggerName) { + return getWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).map(new Func1, TriggerResourceInner>() { + @Override + public TriggerResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TriggerResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String factoryName, String triggerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, factoryName, triggerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String factoryName, String triggerName) { + deleteWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).toBlocking().single().body(); + } + + /** + * Deletes a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String factoryName, String triggerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, factoryName, triggerName), serviceCallback); + } + + /** + * Deletes a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String factoryName, String triggerName) { + return deleteWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String factoryName, String triggerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, factoryName, triggerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Starts a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void start(String resourceGroupName, String factoryName, String triggerName) { + startWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).toBlocking().last().body(); + } + + /** + * Starts a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture startAsync(String resourceGroupName, String factoryName, String triggerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(startWithServiceResponseAsync(resourceGroupName, factoryName, triggerName), serviceCallback); + } + + /** + * Starts a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable startAsync(String resourceGroupName, String factoryName, String triggerName) { + return startWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> startWithServiceResponseAsync(String resourceGroupName, String factoryName, String triggerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.start(this.client.subscriptionId(), resourceGroupName, factoryName, triggerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Starts a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginStart(String resourceGroupName, String factoryName, String triggerName) { + beginStartWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).toBlocking().single().body(); + } + + /** + * Starts a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginStartAsync(String resourceGroupName, String factoryName, String triggerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginStartWithServiceResponseAsync(resourceGroupName, factoryName, triggerName), serviceCallback); + } + + /** + * Starts a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginStartAsync(String resourceGroupName, String factoryName, String triggerName) { + return beginStartWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginStartWithServiceResponseAsync(String resourceGroupName, String factoryName, String triggerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStart(this.client.subscriptionId(), resourceGroupName, factoryName, triggerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStartDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStartDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Stops a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void stop(String resourceGroupName, String factoryName, String triggerName) { + stopWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).toBlocking().last().body(); + } + + /** + * Stops a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture stopAsync(String resourceGroupName, String factoryName, String triggerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(stopWithServiceResponseAsync(resourceGroupName, factoryName, triggerName), serviceCallback); + } + + /** + * Stops a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable stopAsync(String resourceGroupName, String factoryName, String triggerName) { + return stopWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Stops a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> stopWithServiceResponseAsync(String resourceGroupName, String factoryName, String triggerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.stop(this.client.subscriptionId(), resourceGroupName, factoryName, triggerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Stops a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginStop(String resourceGroupName, String factoryName, String triggerName) { + beginStopWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).toBlocking().single().body(); + } + + /** + * Stops a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginStopAsync(String resourceGroupName, String factoryName, String triggerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginStopWithServiceResponseAsync(resourceGroupName, factoryName, triggerName), serviceCallback); + } + + /** + * Stops a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginStopAsync(String resourceGroupName, String factoryName, String triggerName) { + return beginStopWithServiceResponseAsync(resourceGroupName, factoryName, triggerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Stops a trigger. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginStopWithServiceResponseAsync(String resourceGroupName, String factoryName, String triggerName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStop(this.client.subscriptionId(), resourceGroupName, factoryName, triggerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStopDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStopDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List trigger runs. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param startTime Start time for trigger runs. + * @param endTime End time for trigger runs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TriggerRunInner> object if successful. + */ + public PagedList listRuns(final String resourceGroupName, final String factoryName, final String triggerName, final DateTime startTime, final DateTime endTime) { + ServiceResponse> response = listRunsSinglePageAsync(resourceGroupName, factoryName, triggerName, startTime, endTime).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listRunsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List trigger runs. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param startTime Start time for trigger runs. + * @param endTime End time for trigger runs. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listRunsAsync(final String resourceGroupName, final String factoryName, final String triggerName, final DateTime startTime, final DateTime endTime, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listRunsSinglePageAsync(resourceGroupName, factoryName, triggerName, startTime, endTime), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listRunsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List trigger runs. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param startTime Start time for trigger runs. + * @param endTime End time for trigger runs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TriggerRunInner> object + */ + public Observable> listRunsAsync(final String resourceGroupName, final String factoryName, final String triggerName, final DateTime startTime, final DateTime endTime) { + return listRunsWithServiceResponseAsync(resourceGroupName, factoryName, triggerName, startTime, endTime) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List trigger runs. + * + * @param resourceGroupName The resource group name. + * @param factoryName The factory name. + * @param triggerName The trigger name. + * @param startTime Start time for trigger runs. + * @param endTime End time for trigger runs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TriggerRunInner> object + */ + public Observable>> listRunsWithServiceResponseAsync(final String resourceGroupName, final String factoryName, final String triggerName, final DateTime startTime, final DateTime endTime) { + return listRunsSinglePageAsync(resourceGroupName, factoryName, triggerName, startTime, endTime) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listRunsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List trigger runs. + * + ServiceResponse> * @param resourceGroupName The resource group name. + ServiceResponse> * @param factoryName The factory name. + ServiceResponse> * @param triggerName The trigger name. + ServiceResponse> * @param startTime Start time for trigger runs. + ServiceResponse> * @param endTime End time for trigger runs. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TriggerRunInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listRunsSinglePageAsync(final String resourceGroupName, final String factoryName, final String triggerName, final DateTime startTime, final DateTime endTime) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (factoryName == null) { + throw new IllegalArgumentException("Parameter factoryName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startTime == null) { + throw new IllegalArgumentException("Parameter startTime is required and cannot be null."); + } + if (endTime == null) { + throw new IllegalArgumentException("Parameter endTime is required and cannot be null."); + } + return service.listRuns(this.client.subscriptionId(), resourceGroupName, factoryName, triggerName, this.client.apiVersion(), startTime, endTime, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listRunsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listRunsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists triggers. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TriggerResourceInner> object if successful. + */ + public PagedList listByFactoryNext(final String nextPageLink) { + ServiceResponse> response = listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists triggers. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByFactoryNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByFactoryNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists triggers. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TriggerResourceInner> object + */ + public Observable> listByFactoryNextAsync(final String nextPageLink) { + return listByFactoryNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists triggers. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TriggerResourceInner> object + */ + public Observable>> listByFactoryNextWithServiceResponseAsync(final String nextPageLink) { + return listByFactoryNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByFactoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists triggers. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TriggerResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByFactoryNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByFactoryNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByFactoryNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByFactoryNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List trigger runs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TriggerRunInner> object if successful. + */ + public PagedList listRunsNext(final String nextPageLink) { + ServiceResponse> response = listRunsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listRunsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List trigger runs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listRunsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listRunsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listRunsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List trigger runs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TriggerRunInner> object + */ + public Observable> listRunsNextAsync(final String nextPageLink) { + return listRunsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List trigger runs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TriggerRunInner> object + */ + public Observable>> listRunsNextWithServiceResponseAsync(final String nextPageLink) { + return listRunsNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listRunsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List trigger runs. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TriggerRunInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listRunsNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listRunsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listRunsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listRunsNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/package-info.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/package-info.java new file mode 100644 index 000000000000..a7aff0b57ea0 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for DataFactoryManagementClient. + * The Azure Data Factory V2 management API provides a RESTful set of web services that interact with Azure Data Factory V2 services. + */ +package com.microsoft.azure.management.datafactory.v2017_09_01_preview.implementation; diff --git a/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/package-info.java b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/package-info.java new file mode 100644 index 000000000000..f293c744db75 --- /dev/null +++ b/datafactory/resource-manager/v2017_09_01_preview/src/main/java/com/microsoft/azure/management/datafactory/v2017_09_01_preview/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for DataFactoryManagementClient. + * The Azure Data Factory V2 management API provides a RESTful set of web services that interact with Azure Data Factory V2 services. + */ +package com.microsoft.azure.management.datafactory.v2017_09_01_preview; diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 3ae4c9aa409d..4fb91b2a5c7e 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -75,6 +75,9 @@ known_content_issues: - ['sdk/cosmos/changelog/README.md', '#3113'] - ['sdk/cosmos/microsoft-azure-cosmos-benchmark/README.md', '#3113'] - ['sdk/cosmos/README.md', '#3113'] + - ['sdk/storage/azure-storage-blob/swagger/README.md', '#3113'] + - ['sdk/storage/azure-storage-queue/swagger/README.md', '#3113'] + - ['sdk/storage/azure-storage-file/swagger/README.md', '#3113'] package_indexing_exclusion_list: - azure-loganalytics-sample - azure-applicationinsights-query-sample diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/EnforceFinalFieldsCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/EnforceFinalFieldsCheck.java new file mode 100644 index 000000000000..34b71ddc486c --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/EnforceFinalFieldsCheck.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.api.AbstractCheck; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Verify the whenever a field is assigned just once in constructor to be final + * Tree traversal will pre-compute and fill 3 private containers: + * nonFinalFields: keep an array of non private fields as tokens (to keep line number) + * assignmentsFromConstructor: Save a set of string for each field name that gets its value assigned in constructor + * assignmentsFromMethods: Save a set of strings for each field name that gets updated in any method + * + * On finish tree, check what non-final fields get a value only in constructor and nowhere else by looking for + * strings inside nonFinalFields AND assignmentsFromConstructor but NOT in assignmentsFromMethods + */ +public class EnforceFinalFieldsCheck extends AbstractCheck { + private static final String ERROR_SUGGESTION = "You should consider making the field final, " + + "or suppressing the warning."; + private static final String ERROR_MSG = "Field \"%s\" is only assigned in constructor and it is not final. " + + ERROR_SUGGESTION; + private static final String ERROR_FIELD_ALONE = "Field \"%s\" is not assigned in constructor or methods." + + ERROR_SUGGESTION; + + private List nonFinalFields; + private Set assignmentsFromConstructor; + private Set assignmentsFromMethods; + private DetailAST scopeParent = null; + private Set currentScopeParameterSet = null; + private String currentClassName = null; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.CLASS_DEF, + TokenTypes.ASSIGN, + TokenTypes.PLUS_ASSIGN, + TokenTypes.BAND_ASSIGN, + TokenTypes.BOR_ASSIGN, + TokenTypes.BSR_ASSIGN, + TokenTypes.BXOR_ASSIGN, + TokenTypes.DIV_ASSIGN, + TokenTypes.MINUS_ASSIGN, + TokenTypes.MOD_ASSIGN, + TokenTypes.SL_ASSIGN, + TokenTypes.SR_ASSIGN, + TokenTypes.STAR_ASSIGN, + TokenTypes.INC, + TokenTypes.POST_INC, + TokenTypes.DEC, + TokenTypes.POST_DEC, + TokenTypes.METHOD_DEF, + TokenTypes.CTOR_DEF, + }; + } + + @Override + public void beginTree(DetailAST root) { + nonFinalFields = new ArrayList<>(); + assignmentsFromConstructor = new HashSet<>(); + assignmentsFromMethods = new HashSet<>(); + } + + @Override + public void visitToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.CLASS_DEF: + this.currentClassName = token.findFirstToken(TokenTypes.IDENT).getText(); + fillClassFieldDefinitions(token); + break; + case TokenTypes.ASSIGN: + case TokenTypes.PLUS_ASSIGN: + case TokenTypes.BAND_ASSIGN: + case TokenTypes.BOR_ASSIGN: + case TokenTypes.BSR_ASSIGN: + case TokenTypes.BXOR_ASSIGN: + case TokenTypes.DIV_ASSIGN: + case TokenTypes.MINUS_ASSIGN: + case TokenTypes.MOD_ASSIGN: + case TokenTypes.SL_ASSIGN: + case TokenTypes.SR_ASSIGN: + case TokenTypes.STAR_ASSIGN: + case TokenTypes.INC: + case TokenTypes.POST_INC: + case TokenTypes.DEC: + case TokenTypes.POST_DEC: + checkAssignation(token); + break; + case TokenTypes.METHOD_DEF: + case TokenTypes.CTOR_DEF: + scopeParent = token; + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + @Override + public void leaveToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.METHOD_DEF: + case TokenTypes.CTOR_DEF: + scopeParent = null; + currentScopeParameterSet = null; + break; + default: + break; + } + } + + @Override + public void finishTree(DetailAST token) { + for (DetailAST field : nonFinalFields) { + final String fieldName = field.findFirstToken(TokenTypes.IDENT).getText(); + if (assignmentsFromConstructor.contains(fieldName) && !assignmentsFromMethods.contains(fieldName)) { + log(field, String.format(ERROR_MSG, fieldName)); + } else if (field.branchContains(TokenTypes.ASSIGN) + && !assignmentsFromConstructor.contains(fieldName) + && !assignmentsFromMethods.contains(fieldName)) { + log(field, String.format(ERROR_FIELD_ALONE, fieldName)); + } + } + } + + /* + * Get the field token from an assignation token. + * This method handles cases for fields referenced as `this.field` or only `field` + * It will get parameters from the method definition to ignore assignations to those parameters + */ + private DetailAST getAssignedField(final DetailAST assignationToken) { + final Set scopeParentParameterSet = getParameterSet(scopeParent.findFirstToken( + TokenTypes.PARAMETERS)); + final DetailAST firstChild = assignationToken.getFirstChild(); + final DetailAST assignationWithDot = firstChild.getType() == TokenTypes.DOT ? firstChild : null; + + if (assignationWithDot != null) { + if (assignationWithDot.branchContains(TokenTypes.LITERAL_THIS)) { + return assignationWithDot.findFirstToken(TokenTypes.IDENT); + } else if (TokenUtil.findFirstTokenByPredicate(assignationWithDot, + token -> token.getText().equals(this.currentClassName)).isPresent()) { + // Case when referencing same class for private static fields + return assignationWithDot.getLastChild(); + } + } else { + final DetailAST variableNameToken = assignationToken.getFirstChild(); + // make sure the assignation is not for a method parameter + if (!scopeParentParameterSet.contains(variableNameToken.getText())) { + return variableNameToken; + } + } + + return null; + } + + /* + * Saves a field name to a container depending on the provided type + */ + private void saveField(final String fieldName, final int scopeParentType) { + if (scopeParentType == TokenTypes.METHOD_DEF) { + assignmentsFromMethods.add(fieldName); + } else if (scopeParentType == TokenTypes.CTOR_DEF) { + assignmentsFromConstructor.add(fieldName); + } + } + + /* + * Review an assignation to save fields that gets assigned in constructor or in any method + * + * @param assignationToken an assignation token + */ + private void checkAssignation(final DetailAST assignationToken) { + if (scopeParent == null || assignationToken.getChildCount() == 0) { + // not inside any method or constructor definition. No need to check anything + // or this is an assignation from a notation like @Test(timeout = 5000) where assignation has not ChildCount + return; + } + + final DetailAST assignationParent = assignationToken.getParent(); + if (assignationParent != null && TokenTypes.VARIABLE_DEF == assignationParent.getType()) { + // Assignation for a variable definition. No need to check this assignation + return; + } + + DetailAST fieldToken = getAssignedField(assignationToken); + + if (fieldToken != null) { + saveField(fieldToken.getText(), scopeParent.getType()); + } + } + + + /* + * Check each non-final field definition from a class and fill nonFinalFields + * + * @param classDefinitionAST a class definition AST + */ + private void fillClassFieldDefinitions(DetailAST classDefinitionAST) { + final DetailAST classObjBlockAst = classDefinitionAST.findFirstToken(TokenTypes.OBJBLOCK); + + TokenUtil.forEachChild(classObjBlockAst, TokenTypes.VARIABLE_DEF, (definitionToken) -> { + final DetailAST variableModifiersAst = definitionToken.findFirstToken(TokenTypes.MODIFIERS); + if (!variableModifiersAst.branchContains(TokenTypes.FINAL) + && !Utils.hasIllegalCombination(variableModifiersAst)) { + nonFinalFields.add(definitionToken); + } + }); + } + + /* + * Get a node AST with parameters definition and return the list of all parameter names + * The set of parameters is created the first time an assignation is check within a method or constructor + * and we don't need to generate it again until visiting a different method or constructor. + * Field `currentScopeParameterSet` ensures we don't create the set multiple times for the same method/constructor + * + * @param parametersAST a TokenTypes.PARAMETERS + * @return a set of parameter names + */ + private Set getParameterSet(DetailAST parametersAST) { + if (currentScopeParameterSet != null) { + return currentScopeParameterSet; + } + currentScopeParameterSet = new HashSet<>(); + TokenUtil.forEachChild(parametersAST, TokenTypes.PARAMETER_DEF, (paramDefToken) -> { + final String parameterName = paramDefToken.findFirstToken(TokenTypes.IDENT).getText(); + currentScopeParameterSet.add(parameterName); + }); + + return currentScopeParameterSet; + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/FluentMethodNameCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/FluentMethodNameCheck.java new file mode 100644 index 000000000000..5c2cca7ca2ab --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/FluentMethodNameCheck.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.api.AbstractCheck; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + +import java.util.ArrayDeque; +import java.util.Collections; +import java.util.Deque; +import java.util.HashSet; +import java.util.Set; + +/** + * Model Class Method check requirements: + *
    +*
  1. Fluent Methods: All methods that return an instance of the class, and that have one parameter.
  2. + *
  3. The method name should not start with {@code avoidStartWords}.
  4. + *
  5. All methods should not throw checked exceptions.
  6. + *
+ */ +public class FluentMethodNameCheck extends AbstractCheck { + /** + * This is a custom defined set which contains all prefixes that are not allowed. + */ + private final Set avoidStartWords = new HashSet<>(); + + /** + * Use this stack to track the status of the inner class names when traversals the AST tree. + */ + private final Deque classNameStack = new ArrayDeque<>(); + + /** + * Adds words that methods in fluent classes should not be prefixed with. + * @param avoidStartWords the starting strings that should not start with in fluent method + */ + public final void setAvoidStartWords(String... avoidStartWords) { + Collections.addAll(this.avoidStartWords, avoidStartWords); + } + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.CLASS_DEF, + TokenTypes.METHOD_DEF + }; + } + + @Override + public void visitToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.CLASS_DEF: + classNameStack.addLast(token.findFirstToken(TokenTypes.IDENT).getText()); + break; + case TokenTypes.METHOD_DEF: + if (!isFluentMethod(token)) { + return; + } + checkMethodNamePrefix(token); + + // logs error if the @Fluent method has 'throws' at the method declaration. + if (token.findFirstToken(TokenTypes.LITERAL_THROWS) != null) { + log(token, String.format( + "Fluent Method ''%s'' must not be declared to throw any checked exceptions")); + } + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + @Override + public void leaveToken(DetailAST token) { + if (token.getType() == TokenTypes.CLASS_DEF && !classNameStack.isEmpty()) { + classNameStack.removeLast(); + } + } + + /** + * Log the error if the method name is not start with {@code avoidStartWord} + * @param methodDefToken METHOD_DEF AST node + */ + private void checkMethodNamePrefix(DetailAST methodDefToken) { + // A fluent method should only has one parameter. + if (TokenUtil.findFirstTokenByPredicate(methodDefToken, parameters -> + parameters.getType() == TokenTypes.PARAMETERS && parameters.getChildCount() != 1).isPresent()) { + log(methodDefToken, "A fluent method should only have one parameter."); + } + + // A fluent method's return type should be the class itself + final DetailAST typeToken = methodDefToken.findFirstToken(TokenTypes.TYPE); + if (TokenUtil.findFirstTokenByPredicate(typeToken, ident -> ident.getType() == TokenTypes.IDENT + && !ident.getText().equals(classNameStack.peekLast())).isPresent()) { + log(methodDefToken, "Return type of fluent method should be the class itself"); + } + + final String methodName = methodDefToken.findFirstToken(TokenTypes.IDENT).getText(); + // method name should not start with words in the avoid string list + avoidStartWords.forEach(avoidStartWord -> { + if (methodName.length() >= avoidStartWord.length() && methodName.startsWith(avoidStartWord)) { + log(methodDefToken, String.format("''%s'' fluent method name should not start with keyword ''%s''.", + methodName, avoidStartWord)); + } + }); + } + + /** + * Checks if the method is annotated with annotation @Fluent + * + * @param methodDefToken the METHOD_DEF AST node + * @return true if the class is annotated with @Fluent, false otherwise. + */ + private boolean isFluentMethod(DetailAST methodDefToken) { + // Always has MODIFIERS node + final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); + // If no @Fluent annotated with this class, return false + return TokenUtil.findFirstTokenByPredicate(modifiersToken, + annotationToken -> annotationToken.getType() == TokenTypes.ANNOTATION + && TokenUtil.findFirstTokenByPredicate(annotationToken, + identToken -> identToken.getType() == TokenTypes.IDENT + && "Fluent".equals(identToken.getText())).isPresent()) + .isPresent(); + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/GoodLoggingCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/GoodLoggingCheck.java new file mode 100644 index 000000000000..682c60f9e83f --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/GoodLoggingCheck.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.api.AbstractCheck; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.FullIdent; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + +import java.util.ArrayDeque; +import java.util.Arrays; +import java.util.Collections; +import java.util.Deque; +import java.util.HashSet; +import java.util.Set; + +/** + * Good Logging Practice: + *
    + *
  1. A non-static instance logger.
  2. + *
  3. ClientLogger in public API should all named 'logger', public API classes are those classes that are declared + * as public and that do not exist in an implementation package or subpackage.
  4. + *
  5. Should not use any external logger class, only use ClientLogger. No slf4j, log4j, or other logging imports are allowed.
  6. + *
  7. 'System.out' and 'System.err' is not allowed as well.
  8. + *
+ */ +public class GoodLoggingCheck extends AbstractCheck { + private static final String CLIENT_LOGGER_PATH = "com.azure.core.util.logging.ClientLogger"; + private static final String CLIENT_LOGGER = "ClientLogger"; + private static final String LOGGER = "logger"; + + private static final String LOGGER_NAME_ERROR = "ClientLogger instance naming: use ''%s'' instead of ''%s'' for consistency."; + private static final String STATIC_LOGGER_ERROR = "ClientLogger should not be static. Remove static modifier."; + private static final String NOT_CLIENT_LOGGER_ERROR = "Do not use %s class. Use ''%s'' as a logging mechanism instead of ''%s''."; + + // Boolean indicator that indicates if the java class imports ClientLogger + private boolean hasClientLoggerImported; + // A container stores the class names, pop top element if exist the class name AST node + private Deque classNameDeque = new ArrayDeque<>(); + // Collection of Invalid logging packages + private static final Set INVALID_LOGS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( + "org.slf4j", "org.apache.logging.log4j", "java.util.logging" + ))); + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.IMPORT, + TokenTypes.CLASS_DEF, + TokenTypes.LITERAL_NEW, + TokenTypes.VARIABLE_DEF, + TokenTypes.METHOD_CALL + }; + } + + @Override + public void finishTree(DetailAST ast) { + hasClientLoggerImported = false; + } + + @Override + public void leaveToken(DetailAST ast) { + if (ast.getType() == TokenTypes.CLASS_DEF) { + classNameDeque.pollFirst(); + } + } + + @Override + public void visitToken(DetailAST ast) { + switch (ast.getType()) { + case TokenTypes.IMPORT: + final String importClassPath = FullIdent.createFullIdentBelow(ast).getText(); + hasClientLoggerImported = hasClientLoggerImported || importClassPath.equals(CLIENT_LOGGER_PATH); + + INVALID_LOGS.forEach(item -> { + if (importClassPath.startsWith(item)) { + log(ast, String.format(NOT_CLIENT_LOGGER_ERROR, "external logger", CLIENT_LOGGER_PATH, item)); + } + }); + break; + case TokenTypes.CLASS_DEF: + classNameDeque.addFirst(ast.findFirstToken(TokenTypes.IDENT).getText()); + break; + case TokenTypes.LITERAL_NEW: + checkLoggerInstantiation(ast); + break; + case TokenTypes.VARIABLE_DEF: + checkLoggerNameMatch(ast); + break; + case TokenTypes.METHOD_CALL: + final DetailAST dotToken = ast.findFirstToken(TokenTypes.DOT); + if (dotToken == null) { + return; + } + final String methodCallName = FullIdent.createFullIdentBelow(dotToken).getText(); + if (methodCallName.startsWith("System.out") || methodCallName.startsWith("System.err")) { + log(ast, String.format(NOT_CLIENT_LOGGER_ERROR, "Java System", CLIENT_LOGGER_PATH, methodCallName)); + } + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + /** + * Check if the VARIABLE_DEF AST node type is 'ClientLogger'. + * + * @param varDefAST VARIABLE_DEF AST node + * @return true if the variable type is 'ClientLogger'. + */ + private boolean isTypeClientLogger(DetailAST varDefAST) { + final DetailAST typeAST = varDefAST.findFirstToken(TokenTypes.TYPE); + if (typeAST == null) { + return false; + } + return TokenUtil.findFirstTokenByPredicate(typeAST, node -> + node.getType() == TokenTypes.IDENT && node.getText().equals(CLIENT_LOGGER) + ).isPresent(); + } + + /** + * Check if instantiating a matched class name for the same class. + * + * @param literalNewToken LITERAL_NEW node + */ + private void checkLoggerInstantiation(DetailAST literalNewToken) { + final DetailAST identToken = literalNewToken.findFirstToken(TokenTypes.IDENT); + // Not ClientLogger instance + if (identToken == null || !identToken.getText().equals(CLIENT_LOGGER)) { + return; + } + // LITERAL_NEW node always has ELIST node below + TokenUtil.findFirstTokenByPredicate(literalNewToken.findFirstToken(TokenTypes.ELIST), exprToken -> { + // Skip check if not EXPR node or if has no DOT node below. EXPR always has children below + if (exprToken.getType() != TokenTypes.EXPR || exprToken.getFirstChild().getType() != TokenTypes.DOT) { + return false; + } + // Check instantiation of ClientLogger + final String containerClassName = FullIdent.createFullIdent(exprToken.getFirstChild()).getText(); + // Add suffix of '.class' at the end of class name + final String className = classNameDeque.peekFirst(); + if (!containerClassName.equals(className + ".class")) { + log(exprToken, String.format("Not newing a ClientLogger with matching class name. Use ''%s.class'' instead of ''%s''", className, containerClassName)); + } + return true; + }); + } + + /** + * Check if the given ClientLogger named 'logger' + * + * @param varToken VARIABLE_DEF node + */ + private void checkLoggerNameMatch(DetailAST varToken) { + if (!hasClientLoggerImported || !isTypeClientLogger(varToken)) { + return; + } + // Check if the Logger instance named as 'logger'. + final DetailAST identAST = varToken.findFirstToken(TokenTypes.IDENT); + if (identAST != null && !identAST.getText().equals(LOGGER)) { + log(varToken, String.format(LOGGER_NAME_ERROR, LOGGER, identAST.getText())); + } + // Check if the Logger is static instance, log as error if it is static instance logger. + if (TokenUtil.findFirstTokenByPredicate(varToken, node -> node.getType() == TokenTypes.MODIFIERS && node.branchContains(TokenTypes.LITERAL_STATIC)).isPresent()) { + log(varToken, STATIC_LOGGER_ERROR); + } + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/HttpPipelinePolicyCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/HttpPipelinePolicyCheck.java index a6c6b0b075b7..28ea43e69780 100644 --- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/HttpPipelinePolicyCheck.java +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/HttpPipelinePolicyCheck.java @@ -48,7 +48,7 @@ public void visitToken(DetailAST token) { switch (token.getType()) { case TokenTypes.PACKAGE_DEF: - final String packageName = FullIdent.createFullIdentBelow(token).getText(); + final String packageName = FullIdent.createFullIdent(token.findFirstToken(TokenTypes.DOT)).getText(); isImplementationPackage = packageName.contains("implementation"); break; case TokenTypes.CLASS_DEF: diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavaDocFormatting.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavaDocFormatting.java new file mode 100644 index 000000000000..cc14e559aa93 --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavaDocFormatting.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.api.DetailNode; +import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; +import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck; +import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; + +/** + * Description text should only have one space character after the parameter name or {@code @return} statement. + * Text should not start on a new line or have any additional spacing or indentation. + */ +public class JavaDocFormatting extends AbstractJavadocCheck { + + private static final String JAVA_DOC_RETURN = "javadoc return"; + private static final String JAVA_DOC_PARAMETER = "javadoc parameter"; + private static final String JAVA_DOC_THROW = "javadoc throw"; + private static final String JAVA_DOC_DEPRECATED = "javadoc deprecated"; + + private static final String ERROR_DESCRIPTION_ON_NEW_LINE = "Description for %s must be on same the same line."; + private static final String ERROR_NO_DESCRIPTION = "Description is missing for %s. Consider adding a description."; + private static final String ERROR_NO_WS_AFTER_IDENT = "No white space after %s. Consider fixing format."; + private static final String ERROR_EXTRA_SPACE = "Only one white space is expected after %s. Consider removing extra spaces."; + + @Override + public int[] getAcceptableJavadocTokens() { + return getRequiredJavadocTokens(); + } + + @Override + public int[] getRequiredJavadocTokens() { + return new int[] { + JavadocTokenTypes.PARAMETER_NAME, + JavadocTokenTypes.RETURN_LITERAL, + JavadocTokenTypes.THROWS_LITERAL, + JavadocTokenTypes.DEPRECATED_LITERAL, + }; + } + + @Override + public int[] getDefaultJavadocTokens() { + return getRequiredJavadocTokens(); + } + + @Override + public void visitJavadocToken(DetailNode javaDocTag) { + switch (javaDocTag.getType()) { + case JavadocTokenTypes.RETURN_LITERAL: + evaluateValidFormat(javaDocTag, JAVA_DOC_RETURN); + break; + case JavadocTokenTypes.PARAMETER_NAME: + evaluateValidFormat(javaDocTag, JAVA_DOC_PARAMETER); + break; + case JavadocTokenTypes.THROWS_LITERAL: + // Evaluate what is the format after the CLASS_NAME of a @throw + DetailNode throwFormat = JavadocUtil.getNextSibling(javaDocTag, JavadocTokenTypes.CLASS_NAME); + evaluateValidFormat(throwFormat, JAVA_DOC_THROW); + break; + case JavadocTokenTypes.DEPRECATED_LITERAL: + evaluateValidFormat(javaDocTag, JAVA_DOC_DEPRECATED); + break; + default: + break; + } + } + + /* + * Function receives a DetailNode as the start token and then validates what comes after that node. + * valid format is: + * - A single white space is expected after the node. (no NEW_LINE) or other token + * + */ + private void evaluateValidFormat(DetailNode javaDocTag, String identifier) { + DetailNode nextNodeAfterParameterName = JavadocUtil.getNextSibling(javaDocTag); + + if (nextNodeAfterParameterName.getType() == JavadocTokenTypes.NEWLINE) { + if (JavadocUtil.getNextSibling(nextNodeAfterParameterName, JavadocTokenTypes.DESCRIPTION) != null) { + // Description on next line or after some other lines/spaces/staff + log(javaDocTag.getLineNumber(), String.format(ERROR_DESCRIPTION_ON_NEW_LINE, identifier)); + } else { + // No description for parameter name + log(javaDocTag.getLineNumber(), String.format(ERROR_NO_DESCRIPTION, identifier)); + } + } else if (nextNodeAfterParameterName.getType() != JavadocTokenTypes.WS) { + log(javaDocTag.getLineNumber(), String.format(ERROR_NO_WS_AFTER_IDENT, identifier)); + } else if (!nextNodeAfterParameterName.getText().equals(" ")) { + log(javaDocTag.getLineNumber(), String.format(ERROR_EXTRA_SPACE, identifier)); + } + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocCodeSnippetCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocCodeSnippetCheck.java new file mode 100644 index 000000000000..56e8821f1880 --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocCodeSnippetCheck.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.DetailNodeTreeStringPrinter; +import com.puppycrawl.tools.checkstyle.api.AbstractCheck; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.DetailNode; +import com.puppycrawl.tools.checkstyle.api.FullIdent; +import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.BlockCommentPosition; +import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.Locale; + +/** + * Codesnippet description should match naming pattern requirement below: + *
    + *
  1. Package, class, and method names should be concatenated with a dot '.'. Ex., packageName.className.methodName
  2. + *
  3. Methods arguments should be concatenated with a dash '-'. Ex. String-String for methodName(String s, String s2)
  4. + *
  5. Use '#' to concatenate 1) and 2), ex packageName.className.methodName#String-String
  6. + *
  7. Ignore identifier after method arguments
  8. + *
+ */ +public class JavadocCodeSnippetCheck extends AbstractCheck { + + private static final String CODE_SNIPPET_ANNOTATION = "@codesnippet"; + private static final String MISSING_CODESNIPPET_TAG_MESSAGE = "There is a @codesnippet block in the JavaDoc, but it" + + " does not refer to any sample."; + + private static final int[] TOKENS = new int[] { + TokenTypes.PACKAGE_DEF, + TokenTypes.BLOCK_COMMENT_BEGIN, + TokenTypes.CLASS_DEF, + TokenTypes.METHOD_DEF + }; + + private String packageName; + // A container to contains all class name visited, remove the class name when leave the same token + private Deque classNameStack = new ArrayDeque<>(); + // Current METHOD_DEF token while traversal tree + private DetailAST methodDefToken = null; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return TOKENS; + } + + @Override + public boolean isCommentNodesRequired() { + return true; + } + + @Override + public void leaveToken(DetailAST token) { + if (token.getType() == TokenTypes.CLASS_DEF && !classNameStack.isEmpty()) { + classNameStack.pop(); + } + } + + @Override + public void visitToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.PACKAGE_DEF: + packageName = FullIdent.createFullIdent(token.findFirstToken(TokenTypes.DOT)).getText(); + break; + case TokenTypes.CLASS_DEF: + classNameStack.push(token.findFirstToken(TokenTypes.IDENT).getText()); + break; + case TokenTypes.METHOD_DEF: + methodDefToken = token; + break; + case TokenTypes.BLOCK_COMMENT_BEGIN: + checkNamingPattern(token); + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + /** + * Check if the given block comment is on method. If not, skip the check. + * Otherwise, check if the codesnippet has matching the naming pattern + * + * @param blockCommentToken BLOCK_COMMENT_BEGIN token + */ + private void checkNamingPattern(DetailAST blockCommentToken) { + if (!BlockCommentPosition.isOnMethod(blockCommentToken)) { + return; + } + + // Turn the DetailAST into a Javadoc DetailNode. + DetailNode javadocNode = null; + try { + javadocNode = DetailNodeTreeStringPrinter.parseJavadocAsDetailNode(blockCommentToken); + } catch (IllegalArgumentException ex) { + // Exceptions are thrown if the JavaDoc has invalid formatting. + } + + if (javadocNode == null) { + return; + } + + // Iterate through all the top level nodes in the Javadoc, looking for the @codesnippet tag. + for (DetailNode node : javadocNode.getChildren()) { + if (node.getType() != JavadocTokenTypes.JAVADOC_INLINE_TAG) { + continue; + } + // Skip if not codesnippet + DetailNode customNameNode = JavadocUtil.findFirstToken(node, JavadocTokenTypes.CUSTOM_NAME); + if (customNameNode == null || !CODE_SNIPPET_ANNOTATION.equals(customNameNode.getText())) { + return; + } + // Missing Description + DetailNode descriptionNode = JavadocUtil.findFirstToken(node, JavadocTokenTypes.DESCRIPTION); + if (descriptionNode == null) { + log(node.getLineNumber(), MISSING_CODESNIPPET_TAG_MESSAGE); + return; + } + + // There will always have TEXT token if there is DESCRIPTION token exists. + String customDescription = JavadocUtil.findFirstToken(descriptionNode, JavadocTokenTypes.TEXT).getText(); + + // Find method name + final String methodName = methodDefToken.findFirstToken(TokenTypes.IDENT).getText(); + final String className = classNameStack.isEmpty() ? "" : classNameStack.peek(); + final String parameters = constructParametersString(methodDefToken); + String fullPath = packageName + "." + className + "." + methodName; + final String fullPathWithoutParameters = fullPath; + if (parameters != null) { + fullPath = fullPath + "#" + parameters; + } + + // Check for CodeSnippet naming pattern matching + if (customDescription == null || customDescription.isEmpty() + || !isNamingMatched(customDescription.toLowerCase(Locale.ROOT), + fullPathWithoutParameters.toLowerCase(Locale.ROOT), parameters)) { + log(node.getLineNumber(), String.format("Naming pattern mismatch. The @codesnippet description " + + "''%s'' does not match ''%s''. Case Insensitive.", customDescription, fullPath)); + } + } + } + + /** + * Construct a parameters string if the method has arguments. + * + * @param methodDefToken METHOD_DEF token + * @return a valid parameter string or null if no method arguments exist. + */ + private String constructParametersString(DetailAST methodDefToken) { + final StringBuilder sb = new StringBuilder(); + // Checks for the parameters of the method + final DetailAST parametersToken = methodDefToken.findFirstToken(TokenTypes.PARAMETERS); + for (DetailAST ast = parametersToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { + if (ast.getType() != TokenTypes.PARAMETER_DEF) { + continue; + } + + final DetailAST typeToken = ast.findFirstToken(TokenTypes.TYPE); + final DetailAST identToken = typeToken.findFirstToken(TokenTypes.IDENT); + String parameterType = ""; + if (identToken != null) { + // For example, Map, String, Mono types + parameterType = identToken.getText(); + } else { + + DetailAST arrayDeclarator = typeToken.findFirstToken(TokenTypes.ARRAY_DECLARATOR); + if (arrayDeclarator == null) { + // For example, int, boolean, byte primitive types + parameterType = typeToken.getFirstChild().getText(); + } + + DetailAST arrayDeclaratorIterator = arrayDeclarator; + while (arrayDeclaratorIterator != null) { + DetailAST temp = arrayDeclaratorIterator.findFirstToken(TokenTypes.ARRAY_DECLARATOR); + if (temp == null) { + // For example, int[][], byte[] types + parameterType = arrayDeclaratorIterator.getFirstChild().getText(); + break; + } + arrayDeclaratorIterator = temp; + } + } + sb.append(parameterType).append("-"); + } + int size = sb.length(); + if (size == 0) { + return null; + } + return sb.substring(0, size - 1); + } + + /** + * Check if the given customDescription from codesnippet matches the naming pattern rule. + * + * @param customDescription full sample code reference name from annotation codesnippet + * @param fullPathWithoutParameters a string contains package name, class name, and method name if exist. + * @param parameters parameters string which concatenate of argument types + * @return false if the given custom description not matched with naming rule. Otherwise, return true. + */ + private boolean isNamingMatched(String customDescription, String fullPathWithoutParameters, String parameters) { + // Two same codesnippet samples should have two different key names, + // For example, for method name methodName(string, string), + // (1) packagename.classname.methodname#string-string + // (2) packagename.classname.methodname#string-string-2 + final String[] descriptionSegments = customDescription.split("#"); + if (descriptionSegments.length == 1) { + // There exists parameters in the actual Java sample, but there is no custom parameters exist. + if (parameters != null) { + return false; + } + + final String pathUntilMethodName = descriptionSegments[0].split("-")[0]; + if (!fullPathWithoutParameters.equalsIgnoreCase(pathUntilMethodName)) { + return false; + } + } + + if (descriptionSegments.length == 2) { + // Both of codesnippet name and the method has parameters + if (parameters != null) { + return descriptionSegments[1].toLowerCase().startsWith(parameters.toLowerCase()); + } + + // Codesnippet name has parameters but the method does not. + return false; + } + return true; + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocInlineTagCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocInlineTagCheck.java new file mode 100644 index 000000000000..bafe189465e3 --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocInlineTagCheck.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.DetailNode; +import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; +import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck; +import com.puppycrawl.tools.checkstyle.utils.BlockCommentPosition; +import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** + * Javadoc Inline tag check: + *
    + *
  1. Use {@literal {@codesnippet ...}} instead of {@literal }, {@literal
    }, or {@literal {@code ...}}
    + * if these tags span multiple lines. Inline code sample are fine as-is
  2. + *
  3. No check on class-level Javadoc
  4. + *
+ */ +public class JavadocInlineTagCheck extends AbstractJavadocCheck { + private static final String MULTIPLE_LINE_SPAN_ERROR = "Tag '%s' spans multiple lines. Use @codesnippet annotation" + + " instead of '%s' to ensure that the code block always compiles."; + + // HTML tag set that need to be checked to see if there tags span on multiple lines. + private static final Set CHECK_TAGS = Collections.unmodifiableSet(new HashSet<>( + Arrays.asList("pre", "code"))); + + @Override + public int[] getDefaultJavadocTokens() { + return getRequiredJavadocTokens(); + } + + @Override + public int[] getRequiredJavadocTokens() { + return new int[] { + JavadocTokenTypes.HTML_ELEMENT_START, + JavadocTokenTypes.JAVADOC_INLINE_TAG + }; + } + + @Override + public void visitJavadocToken(DetailNode token) { + DetailAST blockCommentToken = getBlockCommentAst(); + // Skip check on class-level Javadoc + if (!BlockCommentPosition.isOnMethod(blockCommentToken) && !BlockCommentPosition.isOnConstructor(blockCommentToken)) { + return; + } + + switch (token.getType()) { + case JavadocTokenTypes.HTML_ELEMENT_START: + checkHtmlElementStart(token); + break; + case JavadocTokenTypes.JAVADOC_INLINE_TAG: + checkJavadocInlineTag(token); + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + /** + * Use {@literal {@codesnippet ...}} instead of '', '
', or {@literal {@code ...}) if these tags span
+     * multiple lines. Inline code sample are fine as-is.
+     *
+     * @param htmlElementStartNode HTML_ELEMENT_START node
+     */
+    private void checkHtmlElementStart(DetailNode htmlElementStartNode) {
+        final DetailNode tagNameNode = JavadocUtil.findFirstToken(htmlElementStartNode, JavadocTokenTypes.HTML_TAG_NAME);
+        // HTML tags are case-insensitive
+        final String tagName = tagNameNode.getText().toLowerCase();
+        if (!CHECK_TAGS.contains(tagName)) {
+            return;
+        }
+
+        final String tagNameBracket = "<" + tagName + ">";
+        final DetailNode htmlTagNode = htmlElementStartNode.getParent();
+        if (!isInlineCode(htmlTagNode)) {
+            log(htmlTagNode.getLineNumber(), htmlTagNode.getColumnNumber(),
+                String.format(MULTIPLE_LINE_SPAN_ERROR, tagNameBracket, tagNameBracket));
+        }
+    }
+
+    /**
+     * Check to see if the JAVADOC_INLINE_TAG node is {@literal @code} tag. If it is, check if the tag contains a new line
+     * or a leading asterisk, which implies the tag has spanned in multiple lines.
+     *
+     * @param inlineTagNode JAVADOC_INLINE_TAG javadoc node
+     */
+    private void checkJavadocInlineTag(DetailNode inlineTagNode) {
+        final DetailNode codeLiteralNode = JavadocUtil.findFirstToken(inlineTagNode, JavadocTokenTypes.CODE_LITERAL);
+        if (codeLiteralNode == null) {
+            return;
+        }
+
+        final String codeLiteral = codeLiteralNode.getText();
+        if (!isInlineCode(inlineTagNode)) {
+            log(codeLiteralNode.getLineNumber(), codeLiteralNode.getColumnNumber(),
+                String.format(MULTIPLE_LINE_SPAN_ERROR, codeLiteral, codeLiteral));
+        }
+    }
+
+    /**
+     * Find if the given tag node is in-line code sample.
+     * @param node A given node that could be HTML_TAG or JAVADOC_INLINE_TAG
+     * @return false if it is a code block, otherwise, return true if it is a in-line code.
+     */
+    private boolean isInlineCode(DetailNode node) {
+        for (final DetailNode child : node.getChildren()) {
+            final int childType = child.getType();
+            if (childType == JavadocTokenTypes.NEWLINE || childType == JavadocTokenTypes.LEADING_ASTERISK) {
+                return false;
+            }
+        }
+        return true;
+    }
+}
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/NoImplInPublicAPI.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/NoImplInPublicAPI.java
index a21ed603ab72..99e9ee2ce794 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/NoImplInPublicAPI.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/NoImplInPublicAPI.java
@@ -18,8 +18,6 @@ public class NoImplInPublicAPI extends AbstractCheck {
     private static final String PARAM_TYPE_ERROR = "\"%s\" class is in an implementation package, and it should not be used as a parameter type in public API. Alternatively, it can be removed from the implementation package and made public API, after appropriate API review.";
     private static final String RETURN_TYPE_ERROR = "\"%s\" class is in an implementation package, and it should not be a return type from public API. Alternatively, it can be removed from the implementation package and made public API.";
 
-    private static boolean isTrackTwo;
-    private static boolean isImplPackage;
     private Set implementationClassSet = new HashSet<>();
 
     @Override
@@ -43,28 +41,11 @@ public int[] getRequiredTokens() {
 
     @Override
     public void beginTree(DetailAST root) {
-        this.isImplPackage = false;
-        this.isTrackTwo = false;
         this.implementationClassSet.clear();
     }
 
     @Override
     public void visitToken(DetailAST ast) {
-        if (ast.getType() == TokenTypes.PACKAGE_DEF) {
-            String packageName = FullIdent.createFullIdent(ast.findFirstToken(TokenTypes.DOT)).getText();
-            this.isTrackTwo = packageName.startsWith(COM_AZURE);
-            this.isImplPackage = packageName.contains(DOT_IMPLEMENTATION);
-            return;
-        } else {
-            if (this.isTrackTwo) {
-                if (this.isImplPackage) {
-                    return;
-                }
-            } else {
-                return;
-            }
-        }
-
         switch (ast.getType()) {
             case TokenTypes.IMPORT:
                 String importClassPath = FullIdent.createFullIdentBelow(ast).getText();
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java
index 85252a28a214..916c7533859f 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java
@@ -1,5 +1,5 @@
-// Licensed under the MIT License.
 // Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
 
 package com.azure.tools.checkstyle.checks;
 
@@ -19,8 +19,8 @@
  */
 public class OnlyFinalFieldsForImmutableClassCheck extends AbstractCheck {
     private static final String IMMUTABLE_NOTATION = "Immutable";
-    private static final String ERROR_MSG = "The variable field ''%s'' should be final." +
-        "Classes annotated with @Immutable are supposed to be immutable.";
+    private static final String ERROR_MSG = "The variable field ''%s'' should be final."
+        + "Classes annotated with @Immutable are supposed to be immutable.";
 
     private boolean hasImmutableAnnotation;
 
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java
index 8623828a9c63..417643ccc4f8 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java
@@ -90,7 +90,7 @@ public void visitToken(DetailAST token) {
                 // method name has prefix 'build' but not 'build*Client' or 'build*AsyncClient'
                 if (!methodName.endsWith("Client")) {
                     log(token, String.format(
-                        "@ServiceClientBuilder class should not have a method name, ''%s'' starting with ''build'' but not ending with ''Client''." , methodName));
+                        "@ServiceClientBuilder class should not have a method name, ''%s'' starting with ''build'' but not ending with ''Client''.", methodName));
                 }
                 break;
             default:
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientCheck.java
new file mode 100644
index 000000000000..c7c6fc297529
--- /dev/null
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientCheck.java
@@ -0,0 +1,499 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.tools.checkstyle.checks;
+
+import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.FullIdent;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import com.puppycrawl.tools.checkstyle.checks.naming.AccessModifier;
+import com.puppycrawl.tools.checkstyle.utils.CheckUtil;
+import com.puppycrawl.tools.checkstyle.utils.TokenUtil;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * Verify the classes with annotation @ServiceClient should have following rules:
+ * 
    + *
  1. No public or protected constructors
  2. + *
  3. No public static method named 'builder'
  4. + *
  5. Since these classes are supposed to be immutable, all fields in the service client classes should be final
  6. + *
+ * + * All methods that has a @ServiceMethod annotation in a class annotated with @ServiceClient should follow below rules: + *
    + *
  1. Follows method naming pattern. Refer to Java Spec:
  2. + *
  3. Methods should not have "Async" added to the method name
  4. + *
  5. Return type of async and sync clients should be as per guidelines: + *
      + *
    1. The return type for async collection should be of type that extends PagedFlux
    2. + *
    3. The return type for async single value should be of type that extends Mono
    4. + *
    5. The return type for sync collection should be of type that extends PagedIterable
    6. + *
    7. The return type for sync single value should be of type that extends Response
    8. + *
    + *
  6. + *
+ */ +public class ServiceClientCheck extends AbstractCheck { + private static final String ASYNC = "Async"; + private static final String SERVICE_CLIENT = "ServiceClient"; + private static final String BUILDER = "builder"; + private static final String ASYNC_CLIENT = "AsyncClient"; + private static final String CLIENT = "Client"; + private static final String IS_ASYNC = "isAsync"; + private static final String CONTEXT = "Context"; + + private static final String RESPONSE_BRACKET = "Response<"; + private static final String MONO_BRACKET = "Mono<"; + private static final String MONO_RESPONSE_BRACKET = "Mono COMMON_NAMING_PREFIX_SET = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( + "upsert", "set", "create", "update", "replace", "delete", "add", "get", "list" + ))); + + // Add all imported classes into a map, key is the name of class and value is the full package path of class. + private final Map simpleClassNameToQualifiedNameMap = new HashMap<>(); + + private boolean isAsync; + private boolean isServiceClientAnnotation; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.IMPORT, + TokenTypes.CLASS_DEF, + TokenTypes.CTOR_DEF, + TokenTypes.METHOD_DEF, + TokenTypes.OBJBLOCK + }; + } + + @Override + public void beginTree(DetailAST root) { + isServiceClientAnnotation = false; + isAsync = false; + } + + @Override + public void visitToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.IMPORT: + addImportedClassPath(token); + break; + case TokenTypes.CLASS_DEF: + isServiceClientAnnotation = hasServiceClientAnnotation(token); + if (!isServiceClientAnnotation) { + return; + } + checkServiceClientNaming(token); + break; + case TokenTypes.CTOR_DEF: + if (!isServiceClientAnnotation) { + return; + } + checkConstructor(token); + break; + case TokenTypes.METHOD_DEF: + if (!isServiceClientAnnotation) { + return; + } + checkMethodNameBuilder(token); + checkMethodNamingPattern(token); + break; + case TokenTypes.OBJBLOCK: + if (!isServiceClientAnnotation) { + return; + } + checkClassField(token); + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + /** + * Checks for public or protected constructor for the service client class. + * Log error if the service client has public or protected constructor. + * + * @param ctorToken the CTOR_DEF AST node + */ + private void checkConstructor(DetailAST ctorToken) { + final DetailAST modifiersToken = ctorToken.findFirstToken(TokenTypes.MODIFIERS); + // find constructor's modifier accessibility, no public or protected constructor + final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersToken); + if (accessModifier.equals(AccessModifier.PUBLIC) || accessModifier.equals(AccessModifier.PROTECTED)) { + log(modifiersToken, "@ServiceClient class should not have any public or protected constructor."); + } + } + + /** + * Checks for public static method named 'builder'. Should avoid to use method name, 'builder'. + * + * @param methodDefToken the METHOD_DEF AST node + */ + private void checkMethodNameBuilder(DetailAST methodDefToken) { + final DetailAST methodNameToken = methodDefToken.findFirstToken(TokenTypes.IDENT); + if (!BUILDER.equals(methodNameToken.getText())) { + return; + } + + final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); + // find method's modifier accessibility, should not have a public static method called 'builder' + final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersToken); + if (accessModifier.equals(AccessModifier.PUBLIC) && modifiersToken.branchContains(TokenTypes.LITERAL_STATIC)) { + log(modifiersToken, "@ServiceClient class should not have a public static method named ''builder''."); + } + } + + /** + * Checks that the field variables in the @ServiceClient are final. ServiceClients should be immutable. + * + * @param objBlockToken the OBJBLOCK AST node + */ + private void checkClassField(DetailAST objBlockToken) { + final Optional varDefTokenOption = TokenUtil.findFirstTokenByPredicate(objBlockToken, node -> + node.getType() == TokenTypes.VARIABLE_DEF && !node.findFirstToken(TokenTypes.MODIFIERS).branchContains(TokenTypes.FINAL)); + if (varDefTokenOption.isPresent()) { + final DetailAST varDefToken = varDefTokenOption.get(); + final String varName = varDefToken.findFirstToken(TokenTypes.IDENT).getText(); + log(varDefToken, String.format("The variable field ''%s'' of class ''%s'' should be final. Classes " + + "annotated with @ServiceClient are supposed to be immutable.", varName, objBlockToken.getPreviousSibling().getText())); + } + } + + /** + * Checks for the class name of Service Client. It should be named AsyncClient or Client. + * + * @param classDefToken the CLASS_DEF AST node + */ + private void checkServiceClientNaming(DetailAST classDefToken) { + final String className = classDefToken.findFirstToken(TokenTypes.IDENT).getText(); + // Async client must be named AsyncClient, and Sync client must be named Client + if (isAsync && !className.endsWith(ASYNC_CLIENT)) { + log(classDefToken, String.format("Asynchronous class ''%s'' must be named AsyncClient, which " + + "concatenates by service name and a fixed word 'AsyncClient'.", className)); + } else if (!isAsync && !className.endsWith(CLIENT)) { + log(classDefToken, String.format("Synchronous class %s must be named Client," + + " which concatenates by service name and a fixed word 'Client'.", className)); + } + + // Class named AsyncClient, the property 'isAsync' must set to true + // Class named Client, the property 'isAsync' must to be false or use the default value + if (className.endsWith(ASYNC_CLIENT) && !isAsync) { + log(classDefToken, String.format("class ''%s'' is an asynchronous client, must set property ''%s'' to true.", className, IS_ASYNC)); + } else if (className.endsWith(CLIENT) && !className.endsWith(ASYNC_CLIENT) && isAsync) { + log(classDefToken, String.format("class ''%s'' is a synchronous client, must set property ''%s'' to false or without the property.", className, IS_ASYNC)); + } + } + + /** + * Verify all methods that have a @ServiceMethod annotation in a class annotated with @ServiceClient should + * follow below rules: + * 1) Follows method naming pattern. Refer to Java Spec. + * 2) Methods should not have "Async" added to the method name. + * 3) The return type of async and sync clients should be as per guidelines: + * 3.1) The return type for async collection should be of type? extends PagedFlux. + * 3.2) The return type for async single value should be of type? extends Mono. + * 3.3) The return type for sync collection should be of type? extends PagedIterable. + * 3.4) The return type for sync single value should be of type? extends Response. + * 4) Naming pattern for 'WithResponse'. + * 5) Synchronous method with annotation @ServiceMethod has to have {@code Context} as a parameter. + * Asynchronous method with annotation @ServiceMethod must not has {@code Context} as a parameter. + * + * @param methodDefToken METHOD_DEF AST node + */ + private void checkMethodNamingPattern(DetailAST methodDefToken) { + final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); + final Optional serviceMethodAnnotationOption = TokenUtil.findFirstTokenByPredicate(modifiersToken, + node -> { + if (node.getType() != TokenTypes.ANNOTATION) { + return false; + } + final DetailAST annotationIdentToken = node.findFirstToken(TokenTypes.IDENT); + return annotationIdentToken != null && "ServiceMethod".equals(annotationIdentToken.getText()); + }); + // NOT a @ServiceMethod method + if (!serviceMethodAnnotationOption.isPresent()) { + return; + } + + final DetailAST serviceMethodAnnotation = serviceMethodAnnotationOption.get(); + final String methodName = methodDefToken.findFirstToken(TokenTypes.IDENT).getText(); + + // 1) Follows method naming pattern. Refer to Java Spec. + // prefix of method name that contains all lower letters + final String prefix = methodName.split("[A-Z]", 2)[0]; + if (!methodName.endsWith("Exists") && !COMMON_NAMING_PREFIX_SET.contains(prefix)) { + log(methodDefToken, String.format("Method name ''%s'' should follow a common vocabulary. Refer to Java Spec: %s.", + methodName, JAVA_SPEC_LINK)); + } + + // 2) Methods should not have "Async" added to the method name + if (methodName.contains(ASYNC)) { + log(methodDefToken, String.format("Method name ''%s'' should not contain ''%s'' in the method name.", + methodName, ASYNC)); + } + + // 3) The return type of async and sync clients should be as per guidelines + checkServiceClientMethodReturnType(methodDefToken, serviceMethodAnnotation, methodName); + + // 4) Check 'withResponse' naming pattern + checkReturnTypeNamingPattern(methodDefToken, methodName); + + // 5) Synchronous method with annotation @ServiceMethod has to have {@code Context} as a parameter. + // Asynchronous method with annotation @ServiceMethod must not has {@code Context} as a parameter. + checkContextInRightPlace(methodDefToken); + } + + /** + * Checks for the return type of async and sync clients should be as per guidelines: + * 1) The return type for async collection should be of type? extends PagedFlux + * 2) The return type for async single value should be of type? extends Mono + * 3) The return type for sync collection should be of type? extends PagedIterable + * 4) The return type for sync single value should be of type? extends Response + * + * @param methodDefToken METHOD_DEF AST node + * @param serviceMethodAnnotation ANNOTATION AST node which used to find the if the annotation has 'return' key, + * @param methodName method name + * if found. return the value of member'return'. + */ + private void checkServiceClientMethodReturnType(DetailAST methodDefToken, DetailAST serviceMethodAnnotation, String methodName) { + // Find the annotation member 'returns' value + String returnsAnnotationMemberValue = null; + final Optional returnValueOption = TokenUtil.findFirstTokenByPredicate(serviceMethodAnnotation, node -> + node.getType() == TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR && node.findFirstToken(TokenTypes.IDENT).getText().equals("returns") + && !FullIdent.createFullIdentBelow(node.findFirstToken(TokenTypes.EXPR)).getText().isEmpty()); + + if (returnValueOption.isPresent()) { + returnsAnnotationMemberValue = FullIdent.createFullIdentBelow(returnValueOption.get().findFirstToken(TokenTypes.EXPR)).getText(); + } + + final String returnType = getReturnType(methodDefToken.findFirstToken(TokenTypes.TYPE), new StringBuilder()).toString(); + + if (isAsync) { + if (SINGLE_RETURN_TYPE.equals(returnsAnnotationMemberValue)) { + // If value of 'returns' is SINGLE, and then log error if the return type of the method is not start with {@code Mono} + if (!returnType.startsWith(MONO_BRACKET)) { + log(methodDefToken, String.format(RETURN_TYPE_ERROR, "Asynchronous", SINGLE_RETURN_TYPE, MONO)); + } + } else if (COLLECTION_RETURN_TYPE.equals(returnsAnnotationMemberValue)) { + // If value of 'returns' is COLLECTION, and then log error if the return type of the method is not start with {@code PagedFlux} + if (!returnType.startsWith(PAGED_FLUX_BRACKET)) { + log(methodDefToken, String.format(RETURN_TYPE_ERROR, "Asynchronous", COLLECTION_RETURN_TYPE, PAGED_FLUX)); + } + } + } else { + if (SINGLE_RETURN_TYPE.equals(returnsAnnotationMemberValue)) { + // If value of 'returns' is SINGLE, and then log error if the return type of the method is not start + // with {@code Response} when the method name ends with 'WithResponse'. + if ((returnType.startsWith(RESPONSE_BRACKET) && !methodName.endsWith(WITH_RESPONSE)) + || (!returnType.startsWith(RESPONSE_BRACKET) && methodName.endsWith(WITH_RESPONSE))) { + log(methodDefToken, String.format(RESPONSE_METHOD_NAME_ERROR, "Synchronous", SINGLE_RETURN_TYPE, + RESPONSE, WITH_RESPONSE, WITH_RESPONSE, RESPONSE)); + } + } else if (COLLECTION_RETURN_TYPE.equals(returnsAnnotationMemberValue)) { + // If value of 'returns' is COLLECTION, and then log error if the return type of the method is not start with {@code PagedIterable} + if (!returnType.startsWith(PAGED_ITERABLE_BRACKET)) { + log(methodDefToken, String.format(RETURN_TYPE_ERROR, "Synchronous", COLLECTION_RETURN_TYPE, PAGED_ITERABLE)); + } + } + } + } + + /** + * Given the method is already annotated @ServiceMethod. Checks if the return type is {@code Response} or + * {@code Mono>}, + * Sync: + * If the return type is Response, the method name must end with WithResponse. + * If the return type is T, the method name must NOT end with WithResponse. + * Async: + * If the return type is Mono>, the method name must end with WithResponse. + * If the return type is Mono, the method name must NOT end with WithResponse. + * + * @param methodDefToken METHOD_DEF AST node + */ + private void checkReturnTypeNamingPattern(DetailAST methodDefToken, String methodName) { + final DetailAST typeToken = methodDefToken.findFirstToken(TokenTypes.TYPE); + // Use recursion to get the return type + final String returnType = getReturnType(typeToken, new StringBuilder()).toString(); + + if (methodName.endsWith(WITH_RESPONSE)) { + if (!returnType.startsWith(RESPONSE_BRACKET) && !returnType.startsWith(MONO_RESPONSE_BRACKET)) { + log(methodDefToken, String.format(RETURN_TYPE_WITH_RESPONSE_ERROR, returnType, "must not", WITH_RESPONSE)); + } + } else { + if (returnType.startsWith(RESPONSE_BRACKET) || returnType.startsWith(MONO_RESPONSE_BRACKET)) { + log(methodDefToken, String.format(RETURN_TYPE_WITH_RESPONSE_ERROR, returnType, "must", WITH_RESPONSE)); + } + } + } + + /** + * Checks the type Context should be in the right place. Context should be passed in as an argument to all public + * methods annotated with @ServiceMethod that return {@code Response} in synchronous clients. + * Synchronous method with annotation @ServiceMethod has to have {@code Context} as a parameter. + * Asynchronous method with annotation @ServiceMethod must not has {@code Context} as a parameter. + * + * @param methodDefToken METHOD_DEF AST token + */ + private void checkContextInRightPlace(DetailAST methodDefToken) { + final DetailAST parametersToken = methodDefToken.findFirstToken(TokenTypes.PARAMETERS); + final String returnType = getReturnType(methodDefToken.findFirstToken(TokenTypes.TYPE), new StringBuilder()).toString(); + + final boolean containsContextParameter = TokenUtil.findFirstTokenByPredicate(parametersToken, + parameterToken -> { + if (parameterToken.getType() != TokenTypes.PARAMETER_DEF) { + return false; + } + final DetailAST paramTypeIdentToken = parameterToken.findFirstToken(TokenTypes.TYPE).findFirstToken(TokenTypes.IDENT); + return paramTypeIdentToken != null && CONTEXT.equals(paramTypeIdentToken.getText()); + }) + .isPresent(); + + if (containsContextParameter) { + // MONO and PagedFlux return type implies Asynchronous method + if (returnType.startsWith(MONO_BRACKET) || returnType.startsWith(PAGED_FLUX_BRACKET)) { + log(methodDefToken, String.format(ASYNC_CONTEXT_ERROR, CONTEXT)); + } + } else { + // Context should be passed in as an argument to all public methods annotated with @ServiceMethod that + // return Response in sync clients. + if (returnType.startsWith(RESPONSE_BRACKET)) { + log(methodDefToken, String.format(SYNC_CONTEXT_ERROR, CONTEXT)); + } + } + } + + /** + * Checks if the class is annotated with annotation @ServiceClient. A class could have multiple annotations. + * + * @param classDefToken the CLASS_DEF AST node + * @return true if the class is annotated with @ServiceClient, false otherwise. + */ + private boolean hasServiceClientAnnotation(DetailAST classDefToken) { + // Always has MODIFIERS node + final DetailAST modifiersToken = classDefToken.findFirstToken(TokenTypes.MODIFIERS); + final Optional serviceClientAnnotationOption = TokenUtil.findFirstTokenByPredicate(modifiersToken, + node -> { + if (node.getType() != TokenTypes.ANNOTATION) { + return false; + } + final DetailAST annotationIdentToken = node.findFirstToken(TokenTypes.IDENT); + return annotationIdentToken != null && SERVICE_CLIENT.equals(annotationIdentToken.getText()); + } + ); + if (serviceClientAnnotationOption.isPresent()) { + isAsync = isAsyncServiceClient(serviceClientAnnotationOption.get()); + return true; + } + // If no @ServiceClient annotated with this class, return false + return false; + } + + /** + * Add all imported classes into a map, key is the name of class and value is the full package path of class. + * + * @param token the IMPORT AST node + */ + private void addImportedClassPath(DetailAST token) { + final String importClassPath = FullIdent.createFullIdentBelow(token).getText(); + final String className = importClassPath.substring(importClassPath.lastIndexOf(".") + 1); + simpleClassNameToQualifiedNameMap.put(className, importClassPath); + } + + /** + * A function checks if the annotation node has a member key is {@code IS_ASYNC} with value equals to 'true'. + * If the value equals 'true', which indicates the @ServiceClient is an asynchronous client. + * If the member pair is missing. By default, it is a synchronous service client. + * + * @param annotationToken the ANNOTATION AST node + * @return true if the annotation has {@code IS_ASYNC} value 'true', otherwise, false. + */ + private boolean isAsyncServiceClient(DetailAST annotationToken) { + for (DetailAST ast = annotationToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { + if (ast.getType() != TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR) { + continue; + } + + // skip this annotation member value pair if no IDENT found, since we are looking for member, 'isAsync'. + final DetailAST identToken = ast.findFirstToken(TokenTypes.IDENT); + if (identToken == null) { + continue; + } + + // skip this annotation member value pair if the member is not 'isAsync'. + if (!IS_ASYNC.equals(identToken.getText())) { + continue; + } + + // skip this annotation member value pair if the member has no EXPR value + final DetailAST exprToken = ast.findFirstToken(TokenTypes.EXPR); + if (exprToken == null) { + continue; + } + + // true if isAsync = true, false otherwise. + return exprToken.branchContains(TokenTypes.LITERAL_TRUE); + } + // By default, if the IS_ASYNC doesn't exist, the service client is a synchronous client. + return false; + } + + /** + * Get full name of return type. Such as Response, Mono. + * + * @param token a token could be a TYPE, TYPE_ARGUMENT, TYPE_ARGUMENTS token + * @param sb a StringBuilder that used to collect method return type. + */ + private StringBuilder getReturnType(DetailAST token, StringBuilder sb) { + for (DetailAST currentToken = token.getFirstChild(); currentToken != null; currentToken = currentToken.getNextSibling()) { + switch (currentToken.getType()) { + case TokenTypes.TYPE_ARGUMENT: + case TokenTypes.TYPE_ARGUMENTS: + // Recursive call + getReturnType(currentToken, sb); + break; + default: + sb.append(currentToken.getText()); + } + } + return sb; + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientChecks.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientChecks.java deleted file mode 100644 index d5e15ce5f1f1..000000000000 --- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientChecks.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.tools.checkstyle.checks; - -import com.puppycrawl.tools.checkstyle.api.AbstractCheck; -import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.FullIdent; -import com.puppycrawl.tools.checkstyle.api.TokenTypes; -import com.puppycrawl.tools.checkstyle.utils.TokenUtil; - -/** - * Verifies that subclasses of ServiceClient meet a set of guidelines. - *
    - *
  1. No public or protected constructors
  2. - *
  3. Implements a public static method named builder
  4. - *
- */ -public class ServiceClientChecks extends AbstractCheck { - private static final String BUILDER_METHOD_NAME = "builder"; - private static final String SERVICE_CLIENT_CLASS_NAME = "com.azure.common.ServiceClient"; - - private static final String FAILED_TO_LOAD_MESSAGE = "%s class failed to load, ServiceClientChecks will be ignored."; - private static final String CONSTRUCTOR_ERROR_MESSAGE = "Descendants of ServiceClient cannot have public or protected constructors."; - private static final String BUILDER_ERROR_MESSAGE = "Descendants of ServiceClient must have a static method named builder."; - - private static final int[] TOKENS = new int[] { - TokenTypes.PACKAGE_DEF, - TokenTypes.CTOR_DEF, - TokenTypes.METHOD_DEF - }; - - private Class serviceClientClass; - private boolean extendsServiceClient; - private boolean hasStaticBuilder; - - @Override - public int[] getDefaultTokens() { - return getRequiredTokens(); - } - - @Override - public int[] getAcceptableTokens() { - return getRequiredTokens(); - } - - /** - * Array of tokens that trigger visitToken when the TreeWalker is traversing the AST. - * @return The list of tokens that trigger visitToken. - */ - @Override - public int[] getRequiredTokens() { - return TOKENS; - } - - @Override - public void init() { - try { - this.serviceClientClass = Class.forName(SERVICE_CLIENT_CLASS_NAME); - } catch (ClassNotFoundException ex) { - log(0, String.format(FAILED_TO_LOAD_MESSAGE, "ServiceClient")); - } - } - - /** - * Start of the TreeWalker traversal. - * @param rootAST Root of the AST. - */ - @Override - public void beginTree(DetailAST rootAST) { - this.extendsServiceClient = false; - this.hasStaticBuilder = false; - } - /** - * Processes a token from the required tokens list when the TreeWalker visits it. - * @param token Node in the AST. - */ - @Override - public void visitToken(DetailAST token) { - // Failed to load ServiceClient's class, don't validate anything. - if (this.serviceClientClass == null) { - return; - } - - switch (token.getType()) { - case TokenTypes.PACKAGE_DEF: - this.extendsServiceClient = extendsServiceClient(token); - break; - case TokenTypes.CTOR_DEF: - if (this.extendsServiceClient && visibilityIsPublicOrProtected(token)) { - log(token, CONSTRUCTOR_ERROR_MESSAGE); - } - break; - case TokenTypes.METHOD_DEF: - if (this.extendsServiceClient && !this.hasStaticBuilder && methodIsStaticBuilder(token)) { - this.hasStaticBuilder = true; - } - break; - default: - // Checkstyle complains if there's no default block in switch - break; - } - } - - /** - * End of the TreeWalker traversal. - * @param rootAST Root of the AST. - */ - @Override - public void finishTree(DetailAST rootAST) { - if (this.extendsServiceClient && !this.hasStaticBuilder) { - log(0, BUILDER_ERROR_MESSAGE); - } - } - - /** - * Determines if the class extends ServiceClient. - * @param packageDefinitionToken Package definition token. - * @return True if the package is not in "com.microsoft", the file is a class definition, and the class extends ServiceClient. - */ - private boolean extendsServiceClient(DetailAST packageDefinitionToken) { - String packageName = FullIdent.createFullIdent(packageDefinitionToken.findFirstToken(TokenTypes.DOT)).getText(); - if (packageName.startsWith("com.microsoft")) { - return false; - } - - DetailAST classDefinitionToken = packageDefinitionToken.findFirstToken(TokenTypes.CLASS_DEF); - if (classDefinitionToken == null) { - return false; - } - - String className = classDefinitionToken.findFirstToken(TokenTypes.IDENT).getText(); - try { - Class clazz = Class.forName(packageName + "." + className); - - return this.serviceClientClass.isAssignableFrom(clazz); - } catch (ClassNotFoundException ex) { - log(classDefinitionToken, String.format(FAILED_TO_LOAD_MESSAGE, className)); - return false; - } - } - - /** - * Checks if the constructor is using the public or protected scope. - * @param constructorToken Construction token. - * @return True if the constructor has a public or protected modifier token. - */ - private boolean visibilityIsPublicOrProtected(DetailAST constructorToken) { - DetailAST modifierToken = constructorToken.findFirstToken(TokenTypes.MODIFIERS); - - // No modifiers means package private. - if (modifierToken == null) { - return false; - } - - return TokenUtil.findFirstTokenByPredicate(modifierToken, - node -> node.getType() == TokenTypes.LITERAL_PUBLIC || node.getType() == TokenTypes.LITERAL_PROTECTED) - .isPresent(); - } - - /** - * Checks if the method node is public static and named builder. - * @param methodToken Method node - * @return True if the method is public static and is named builder - */ - private boolean methodIsStaticBuilder(DetailAST methodToken) { - DetailAST modifierToken = methodToken.findFirstToken(TokenTypes.MODIFIERS); - if (modifierToken == null) { - return false; - } - - if (modifierToken.findFirstToken(TokenTypes.LITERAL_STATIC) == null - || modifierToken.findFirstToken(TokenTypes.LITERAL_PUBLIC) == null) { - return false; - } - - return methodToken.findFirstToken(TokenTypes.IDENT).getText().equals(BUILDER_METHOD_NAME); - } -} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java deleted file mode 100644 index 02669178d0ca..000000000000 --- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.tools.checkstyle.checks; - -import com.puppycrawl.tools.checkstyle.api.AbstractCheck; -import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.FullIdent; -import com.puppycrawl.tools.checkstyle.api.TokenTypes; -import com.puppycrawl.tools.checkstyle.checks.naming.AccessModifier; -import com.puppycrawl.tools.checkstyle.utils.CheckUtil; - -/** - * Verify the classes with annotation @ServiceClient should have following rules: - *
    - *
  1. No public or protected constructors
  2. - *
  3. No public static method named 'builder'
  4. - *
  5. Since these classes are supposed to be immutable, all fields in the service client classes should be final.
  6. - *
- */ -public class ServiceClientInstantiationCheck extends AbstractCheck { - private static final String SERVICE_CLIENT = "ServiceClient"; - private static final String BUILDER = "builder"; - private static final String ASYNC_CLIENT = "AsyncClient"; - private static final String CLIENT = "Client"; - private static final String IS_ASYNC = "isAsync"; - - private static boolean hasServiceClientAnnotation; - private static boolean isAsync; - private static boolean isImplPackage; - - @Override - public int[] getDefaultTokens() { - return getRequiredTokens(); - } - - @Override - public int[] getAcceptableTokens() { - return getRequiredTokens(); - } - - @Override - public int[] getRequiredTokens() { - return new int[] { - TokenTypes.PACKAGE_DEF, - TokenTypes.CLASS_DEF, - TokenTypes.CTOR_DEF, - TokenTypes.METHOD_DEF, - TokenTypes.OBJBLOCK - }; - } - - @Override - public void beginTree(DetailAST root) { - hasServiceClientAnnotation = false; - isAsync = false; - isImplPackage = false; - } - - @Override - public void visitToken(DetailAST token) { - if (isImplPackage) { - return; - } - - switch (token.getType()) { - case TokenTypes.PACKAGE_DEF: - String packageName = FullIdent.createFullIdent(token.findFirstToken(TokenTypes.DOT)).getText(); - isImplPackage = packageName.contains(".implementation"); - break; - case TokenTypes.CLASS_DEF: - hasServiceClientAnnotation = hasServiceClientAnnotation(token); - if (hasServiceClientAnnotation) { - checkServiceClientNaming(token); - } - break; - case TokenTypes.CTOR_DEF: - if (hasServiceClientAnnotation) { - checkConstructor(token); - } - break; - case TokenTypes.METHOD_DEF: - if (hasServiceClientAnnotation) { - checkMethodName(token); - } - break; - case TokenTypes.OBJBLOCK: - if (hasServiceClientAnnotation) { - checkClassField(token); - } - break; - default: - // Checkstyle complains if there's no default block in switch - break; - } - } - - /** - * Checks if the class is annotated with annotation @ServiceClient. A class could have multiple annotations. - * - * @param classDefToken the CLASS_DEF AST node - * @return true if the class is annotated with @ServiceClient, false otherwise. - */ - private boolean hasServiceClientAnnotation(DetailAST classDefToken) { - // Always has MODIFIERS node - final DetailAST modifiersToken = classDefToken.findFirstToken(TokenTypes.MODIFIERS); - - for (DetailAST ast = modifiersToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { - if (ast.getType() != TokenTypes.ANNOTATION) { - continue; - } - // One class could have multiple annotations, return true if found one. - final DetailAST annotationIdent = ast.findFirstToken(TokenTypes.IDENT); - if (annotationIdent != null && SERVICE_CLIENT.equals(annotationIdent.getText())) { - isAsync = isAsyncServiceClient(ast); - return true; - } - } - // If no @ServiceClient annotated with this class, return false - return false; - } - - /** - * Checks for public or protected constructor for the service client class. - * Log error if the service client has public or protected constructor. - * - * @param ctorToken the CTOR_DEF AST node - */ - private void checkConstructor(DetailAST ctorToken) { - final DetailAST modifiersToken = ctorToken.findFirstToken(TokenTypes.MODIFIERS); - // find constructor's modifier accessibility, no public or protected constructor - final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersToken); - if (accessModifier.equals(AccessModifier.PUBLIC) || accessModifier.equals(AccessModifier.PROTECTED)) { - log(modifiersToken, "@ServiceClient class should not have any public or protected constructor."); - } - } - - /** - * Checks for public static method named 'builder'. Should avoid to use method name, 'builder'. - * - * @param methodDefToken the METHOD_DEF AST node - */ - private void checkMethodName(DetailAST methodDefToken) { - final DetailAST methodNameToken = methodDefToken.findFirstToken(TokenTypes.IDENT); - if (!BUILDER.equals(methodNameToken.getText())) { - return; - } - - final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); - // find method's modifier accessibility, should not have a public static method called 'builder' - final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersToken); - if (accessModifier.equals(AccessModifier.PUBLIC) && modifiersToken.branchContains(TokenTypes.LITERAL_STATIC)) { - log(modifiersToken, "@ServiceClient class should not have a public static method named ''builder''."); - } - } - - /** - * Checks that the field variables in the @ServiceClient are final. ServiceClients should be immutable. - * - * @param objBlockToken the OBJBLOCK AST node - */ - private void checkClassField(DetailAST objBlockToken) { - for (DetailAST ast = objBlockToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { - if (TokenTypes.VARIABLE_DEF != ast.getType()) { - continue; - } - final DetailAST modifiersToken = ast.findFirstToken(TokenTypes.MODIFIERS); - // VARIABLE_DEF token will always MODIFIERS token. If there is no modifier at the variable, no child under - // MODIFIERS token. Also the previous sibling of OBJBLOCK will always be class name IDENT node. - if (!modifiersToken.branchContains(TokenTypes.FINAL)) { - log(modifiersToken, String.format("The variable field ''%s'' of class ''%s'' should be final. Classes annotated with @ServiceClient are supposed to be immutable.", - ast.findFirstToken(TokenTypes.IDENT).getText(), objBlockToken.getPreviousSibling().getText())); - } - } - } - - /** - * Checks for the class name of Service Client. It should be named AsyncClient or Client. - * - * @param classDefToken the CLASS_DEF AST node - */ - private void checkServiceClientNaming(DetailAST classDefToken) { - final String className = classDefToken.findFirstToken(TokenTypes.IDENT).getText(); - // Async service client - if (isAsync && !className.endsWith(ASYNC_CLIENT)) { - log(classDefToken, String.format("Async class ''%s'' must be named AsyncClient ", className)); - } - // Sync service client - if (!isAsync && !className.endsWith(CLIENT)) { - log(classDefToken, String.format("Sync class %s must be named Client.", className)); - } - } - - /** - * A function checks if the annotation node has a member key is {@code IS_ASYNC} with value equals to 'true'. - * If the value equals 'true', which indicates the @ServiceClient is an asynchronous client. - * If the member pair is missing. By default, it is a synchronous service client. - * - * @param annotationToken the ANNOTATION AST node - * @return true if the annotation has {@code IS_ASYNC} value 'true', otherwise, false. - */ - private boolean isAsyncServiceClient(DetailAST annotationToken) { - for (DetailAST ast = annotationToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { - if (ast.getType() != TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR) { - continue; - } - - // skip this annotation member value pair if no IDENT found, since we are looking for member, 'isAsync'. - final DetailAST identToken = ast.findFirstToken(TokenTypes.IDENT); - if (identToken == null) { - continue; - } - - // skip this annotation member value pair if the member is not 'isAsync'. - if (!IS_ASYNC.equals(identToken.getText())) { - continue; - } - - // skip this annotation member value pair if the member has no EXPR value - final DetailAST exprToken = ast.findFirstToken(TokenTypes.EXPR); - if (exprToken == null) { - continue; - } - - // true if isAsync = true, false otherwise. - return exprToken.branchContains(TokenTypes.LITERAL_TRUE); - } - // By default, if the IS_ASYNC doesn't exist, the service client is a synchronous client. - return false; - } -} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ThrowFromClientLoggerCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ThrowFromClientLoggerCheck.java new file mode 100644 index 000000000000..fb8018d62286 --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ThrowFromClientLoggerCheck.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.api.AbstractCheck; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.FullIdent; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; + +import java.util.ArrayDeque; +import java.util.Deque; + +/** + * To throw an exception, Must throw it through a 'logger.logExceptionAsError', rather than by directly calling 'throw exception'. + * + * Skip check if throwing exception from + *
    + *
  1. Static method
  2. + *
  3. Static class
  4. + *
  5. Constructor
  6. + *
+ */ +public class ThrowFromClientLoggerCheck extends AbstractCheck { + private static final String LOGGER_LOG_EXCEPTION_AS_ERROR = "logger.logExceptionAsError"; + private static final String LOGGER_LOG_EXCEPTION_AS_WARNING = "logger.logExceptionAsWarning"; + private static final String THROW_LOGGER_EXCEPTION_MESSAGE = "Directly throwing an exception is disallowed. Must " + + "throw through ''ClientLogger'' API, either of ''%s'' or ''%s'' where ''logger'' is type of ClientLogger from Azure Core package."; + + // A container stores the static status of class, skip this ThrowFromClientLoggerCheck if the class is static + private final Deque classStaticDeque = new ArrayDeque<>(); + // A container stores the static status of method, skip this ThrowFromClientLoggerCheck if the method is static + private final Deque methodStaticDeque = new ArrayDeque<>(); + // The variable is used to indicate if current node is still inside of constructor. + private boolean isInConstructor = false; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.CLASS_DEF, + TokenTypes.CTOR_DEF, + TokenTypes.LITERAL_THROW, + TokenTypes.METHOD_DEF + }; + } + + @Override + public void leaveToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.CLASS_DEF: + classStaticDeque.pop(); + break; + case TokenTypes.CTOR_DEF: + isInConstructor = false; + break; + case TokenTypes.METHOD_DEF: + methodStaticDeque.pop(); + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + @Override + public void visitToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.CLASS_DEF: + DetailAST modifiersToken = token.findFirstToken(TokenTypes.MODIFIERS); + classStaticDeque.addLast(modifiersToken.branchContains(TokenTypes.LITERAL_STATIC)); + break; + case TokenTypes.CTOR_DEF: + isInConstructor = true; + break; + case TokenTypes.METHOD_DEF: + DetailAST methodModifiersToken = token.findFirstToken(TokenTypes.MODIFIERS); + methodStaticDeque.addLast(methodModifiersToken.branchContains(TokenTypes.LITERAL_STATIC)); + break; + case TokenTypes.LITERAL_THROW: + // Skip check if the throw exception from static class, constructor or static method + if (classStaticDeque.isEmpty() || classStaticDeque.peekLast() || isInConstructor + || methodStaticDeque.isEmpty() || methodStaticDeque.peekLast()) { + return; + } + DetailAST methodCallToken = token.findFirstToken(TokenTypes.EXPR).findFirstToken(TokenTypes.METHOD_CALL); + if (methodCallToken == null) { + log(token, String.format(THROW_LOGGER_EXCEPTION_MESSAGE, LOGGER_LOG_EXCEPTION_AS_ERROR, LOGGER_LOG_EXCEPTION_AS_WARNING)); + return; + } + + String methodCallName = FullIdent.createFullIdent(methodCallToken.findFirstToken(TokenTypes.DOT)).getText(); + if (!LOGGER_LOG_EXCEPTION_AS_ERROR.equals(methodCallName) && !LOGGER_LOG_EXCEPTION_AS_WARNING.equals(methodCallName)) { + log(token, String.format(THROW_LOGGER_EXCEPTION_MESSAGE, LOGGER_LOG_EXCEPTION_AS_ERROR, LOGGER_LOG_EXCEPTION_AS_WARNING)); + } + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java index 5cc32d5249c2..903c0a706d6e 100644 --- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -14,13 +17,23 @@ * Common utils amount custom checks */ public class Utils { + /* + * Set of modifiers that cannot be combined with final because it causes a violation. + */ private static final Set INVALID_FINAL_COMBINATION = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( TokenTypes.LITERAL_TRANSIENT, - TokenTypes.LITERAL_VOLATILE + TokenTypes.LITERAL_VOLATILE, + TokenTypes.LITERAL_DEFAULT, + TokenTypes.LITERAL_PROTECTED ))); + /* + * Set of annotations that cannot be combined with modifier 'final' because it would break serialization. + */ private static final Set INVALID_FINAL_ANNOTATIONS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( - "JsonProperty" + "JsonProperty", + "JsonAlias", + "JacksonXmlProperty" ))); /** @@ -39,7 +52,7 @@ protected static boolean hasIllegalCombination(DetailAST modifiers) { Optional illegalCombination = TokenUtil.findFirstTokenByPredicate(modifiers, (node) -> { final int type = node.getType(); return INVALID_FINAL_COMBINATION.contains(node.getType()) || (TokenTypes.ANNOTATION == type - && INVALID_FINAL_ANNOTATIONS.contains(node.findFirstToken(TokenTypes.IDENT).getText())); + && INVALID_FINAL_ANNOTATIONS.contains(node.findFirstToken(TokenTypes.IDENT).getText())); }); return illegalCombination.isPresent(); diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index 553c34ca080f..5f006328f281 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -32,7 +32,7 @@ - + @@ -86,34 +86,34 @@ - - - - - - - - - - - - + + + + + + + + + + - - - - - + + - - - + + - - + + + + + @@ -122,11 +122,35 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml index d9856fa79891..cf9849b09b2d 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml @@ -10,6 +10,11 @@ page at http://checkstyle.sourceforge.net/config.html --> + + + + + @@ -96,6 +101,8 @@ page at http://checkstyle.sourceforge.net/config.html --> + + @@ -274,39 +281,42 @@ page at http://checkstyle.sourceforge.net/config.html --> - - - - - - + - + 3) Since these classes are supposed to be immutable, all fields in the service client classes should be final. + + Also, verify all methods that have a @ServiceMethod annotation in a class annotated with @ServiceClient should + follow below rules: + 1) Follows method naming pattern. Refer to Java Spec. + 2) Methods should not have "Async" added to the method name + 3) The return type of async and sync clients should be as per guidelines: + 3.1) The return type for async collection should be of type? extends PagedFlux + 3.2) The return type for async single value should be of type? extends Mono + 3.3) The return type for sync collection should be of type? extends PagedIterable + 3.4) The return type for sync single value should be of type? extends Response --> + - + - + - + @@ -317,14 +327,55 @@ page at http://checkstyle.sourceforge.net/config.html --> 1) All fields must be final --> - + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + diff --git a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml index 6cfdbbd51923..8c123ecd5dd6 100755 --- a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml +++ b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml @@ -65,6 +65,9 @@ + + + @@ -446,12 +449,19 @@ - + + + + + + + + @@ -537,4 +547,19 @@ + + + + + + + + + + + + + + + diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml index bfe7f05dbccd..015665b9897b 100644 --- a/eng/jacoco-test-coverage/pom.xml +++ b/eng/jacoco-test-coverage/pom.xml @@ -25,12 +25,14 @@ 1.0.0-preview.4 1.0.0-preview.4 + 1.0.0-preview.4 1.0.0-preview.4 1.0.0-preview.4 1.0.0-preview.3 1.0.0-preview.3 4.0.0-preview.3 5.0.0-preview.3 + 12.0.0-preview.3 12.0.0-preview.3 12.0.0-preview.3 12.0.0-preview.3 @@ -60,6 +62,11 @@ azure-core-amqp ${azure-core.version} + + com.azure + azure-core-http-netty + ${azure-core-http-netty.version} + com.azure azure-core-management @@ -90,6 +97,11 @@ azure-messaging-eventhubs ${azure-messaging-eventhubs.version} + + com.azure + azure-storage-common + ${azure-storage-common.version} + com.azure azure-storage-blob diff --git a/eng/pipelines/mgmt.yml b/eng/pipelines/mgmt.yml index c9c850dcc820..45f84e7cee2c 100644 --- a/eng/pipelines/mgmt.yml +++ b/eng/pipelines/mgmt.yml @@ -1,6 +1,19 @@ trigger: - - master - + branches: + include: + - master + paths: + exclude: + - sdk/ + +pr: + branches: + include: + - master + paths: + exclude: + - sdk/ + variables: MavenGoals: 'clean,compile' diff --git a/eng/pipelines/smoke-test.yml b/eng/pipelines/smoke-test.yml new file mode 100644 index 000000000000..1b1a5a749728 --- /dev/null +++ b/eng/pipelines/smoke-test.yml @@ -0,0 +1,48 @@ +jobs: + - job: SmokeTest + variables: + - template: ./templates/variables/globals.yml + - name: PomFile + value: eng/smoke-tests/pom.xml + + strategy: + matrix: + Java 8: + ProfileFlag: '' + JavaVersion: '1.8' + Java LTS: + ProfileFlag: '-Djava-lts' + JavaVersion: '1.11' + + steps: + - task: Maven@3 + displayName: 'Build and Package' + inputs: + mavenPomFile: $(PomFile) + goals: 'package' + options: '$(DefaultOptions) $(ProfileFlag) -Dmaven.test.skip=true' + javaHomeOption: 'JDKVersion' + jdkVersionOption: $(JavaVersion) + jdkArchitectureOption: 'x64' + publishJUnitResults: false + + - task: Maven@3 + displayName: 'Run Smoke Tests' + inputs: + mavenPomFile: $(PomFile) + goals: 'exec:java' + options: '$(DefaultOptions) $(ProfileFlag) -Dexec.mainClass="com.azure.App"' + javaHomeOption: 'JDKVersion' + jdkVersionOption: $(JavaVersion) + jdkArchitectureOption: 'x64' + publishJUnitResults: false + env: + AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) + AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) + AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) + AZURE_PROJECT_URL: $(smoke-tests-key-vault-project-url) + AZURE_EVENT_HUBS_CONNECTION_STRING: $(smoke-tests-event-hubs-connection-string) + AZURE_STORAGE_CONNECTION_STRING: $(smoke-tests-storage-connection-string) + AZURE_COSMOS_KEY: $(smoke-tests-cosmos-key) + AZURE_COSMOS_ENDPOINT: $(smoke-tests-cosmos-endpoint) + AZURE_LOG_LEVEL: 2 \ No newline at end of file diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 06ce79cd972c..631cde581973 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -61,12 +61,14 @@ jobs: displayName: 'Tag scheduled builds' condition: and(eq(variables['Build.SourceBranchName'],'master'),eq(variables['Build.Reason'],'Schedule')) + - template: ../steps/cache-maven-repository.yml + - task: Maven@3 displayName: 'Build and Package' inputs: mavenPomFile: sdk/${{parameters.ServiceDirectory}}/pom.service.xml goals: 'package' - options: '$(DefaultOptions) $(ProfileFlag) "-DpackageOutputDirectory=$(Build.ArtifactStagingDirectory)" -Dmaven.test.skip=true -Dinclude-template' # We include template-module so we ensure it always builds in CI + options: '$(DefaultOptions) $(ProfileFlag) "-DpackageOutputDirectory=$(Build.ArtifactStagingDirectory)" -DskipTests -Dinclude-template' # We include template-module so we ensure it always builds in CI mavenOptions: '$(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: $(JavaVersion) @@ -226,8 +228,11 @@ jobs: parameters: OSName: $(OSName) + - template: ../steps/cache-maven-repository.yml + - task: Maven@3 displayName: 'Start Jetty' + condition: ne(variables['SdkType'], 'client') inputs: mavenPomFile: pom.client.xml options: '$(DefaultOptions) $(ProfileFlag)' diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index e42186eac993..7beb7d4dddfb 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -22,7 +22,9 @@ parameters: jobs: - job: ${{ parameters.TestName }} timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} - + + variables: + - template: ../variables/globals.yml strategy: matrix: ${{ parameters.Matrix }} maxParallel: ${{ parameters.MaxParallel }} diff --git a/eng/pipelines/templates/stages/cosmos-sdk-client.yml b/eng/pipelines/templates/stages/cosmos-sdk-client.yml new file mode 100644 index 000000000000..8648a1c87d95 --- /dev/null +++ b/eng/pipelines/templates/stages/cosmos-sdk-client.yml @@ -0,0 +1,118 @@ +parameters: + Artifacts: [] + ServiceDirectory: not-specified + +stages: + - stage: Build + jobs: + - template: ../jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: ${{parameters.ServiceDirectory}} + TestMatrix: + Windows - java8: + OSVmImage: 'vs2017-win2016' + JavaVersion: '1.8' + OSName: Windows + ProfileFlag: '-Punit' + MacOS - java8: + OSVmImage: 'macOS-10.13' + JavaVersion: '1.8' + OSName: macOS + ProfileFlag: '-Punit' + PreTestSteps: + - template: ../steps/install-reporting-tools.yml + + - template: ../jobs/archetype-sdk-tests.yml + parameters: + TestName: Emulator + ServiceDirectory: cosmos + Matrix: + Tcp_Integration_Tests_Java8: + OSVmImage: 'vs2017-win2016' + JavaVersion: '1.8' + ProfileFlag: '-Pemulator' + DisplayName: 'Emulator only Integration Tests' + PROTOCOLS: '["Tcp"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + Https_Integration_Tests_Java8: + OSVmImage: 'vs2017-win2016' + JavaVersion: '1.8' + ProfileFlag: '-Pemulator' + DisplayName: 'Emulator only Integration Tests' + PROTOCOLS: '["Https"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + Examples_Integration_Tests_Java8: + OSVmImage: 'vs2017-win2016' + JavaVersion: '1.8' + ProfileFlag: '-Pexamples' + DisplayName: 'Examples Integration Tests' + PROTOCOLS: '["Https", "Tcp"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + + TestStepMavenInputs: + goals: 'verify' + options: '$(ProfileFlag) -Dgpg.skip -DargLine="-DACCOUNT_HOST=https://localhost:8081/"' + mavenAuthenticateFeed: true + jdkVersionOption: $(JavaVersion) + + PreRunSteps: + - powershell: | + Write-Host "Downloading Cosmos Emulator - $(EmulatorMsiUrl)" + wget "$(EmulatorMsiUrl)" -outfile "$env:temp\azure-cosmosdb-emulator.msi" + Write-Host "Finished Downloading Cosmos Emulator - $env:temp\azure-cosmosdb-emulator.msi" + dir "$env:temp" + displayName: 'Download Public Cosmos DB Emulator' + + - script: | + choco install lessmsi + choco upgrade lessmsi + mkdir "%TEMP%\Azure Cosmos DB Emulator" + lessmsi x "%TEMP%\azure-cosmosdb-emulator.msi" "%TEMP%\Azure Cosmos DB Emulator\" + displayName: 'Install Public Cosmos DB Emulator' + + - powershell: | + Write-Host "Starting Comsos DB Emulator" + Start-Process "$env:Temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" "/NoExplorer /NoUI /DisableRateLimiting /PartitionCount=100 /Consistency=Strong" -Verb RunAs + displayName: 'Run Public Cosmos DB Emulator' + + - powershell: | + Import-Module "$env:Temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator" + + Do { + sleep 5 + $cosmosStatus = Get-CosmosDbEmulatorStatus + Write-Host "Cosmos Status: $cosmosStatus" + } While ($cosmosStatus -ne 'Running') + + Write-Host "Done" + displayName: 'Check Public Cosmos DB Emulator Status' + + - powershell: | + $Key = 'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==' + $password = ConvertTo-SecureString -String $Key -Force -AsPlainText + $cert = Get-ChildItem cert:\LocalMachine\My | Where-Object { $_.FriendlyName -eq "DocumentDbEmulatorCertificate" } + Export-PfxCertificate -Cert $cert -FilePath ".\CosmosDbEmulatorCert.pfx" -Password $password | Out-Null + $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 + $cert.Import(".\CosmosDbEmulatorCert.pfx", $Key, "DefaultKeySet") + $cert | Export-Certificate -FilePath "$env:temp\CosmosDbEmulatorCert.cer" -Type CERT + displayName: 'Export Cosmos DB Emulator Certificate' + + - powershell: | + cd $env:java_home\jre\lib\security + cp $env:temp\CosmosDbEmulatorCert.cer . + keytool -keystore cacerts -importcert -noprompt -trustcacerts -alias CosmosDbEmulatorCert -file CosmosDbEmulatorCert.cer -storepass changeit + displayName: 'Create Java TrustStore' + + # We `install` separately from running `site:site site:stage` so that the `install` brings in the non-shipping-modules, + # but we don't include them in the Maven site commands (so that we don't generate reports for the non-shipping modules). + - template: ../steps/install-reporting-tools.yml + + # The Prerelease and Release stages are conditioned on whether we are building a pull request and the branch. + - ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))}}: + - template: pipelines/stages/archetype-java-release.yml@azure-sdk-build-tools + parameters: + DependsOn: Build + Artifacts: ${{parameters.Artifacts}} + ArtifactName: packages + + \ No newline at end of file diff --git a/eng/pipelines/templates/steps/cache-maven-repository.yml b/eng/pipelines/templates/steps/cache-maven-repository.yml new file mode 100644 index 000000000000..65c1f7667b90 --- /dev/null +++ b/eng/pipelines/templates/steps/cache-maven-repository.yml @@ -0,0 +1,15 @@ +steps: +- script: | + echo "##vso[task.setvariable variable=Maven.RepositoryPath;]%USERPROFILE%\.m2\repository" + condition: eq(variables['Agent.OS'], 'Windows_NT') + displayName: Detecting Maven repository on Windows +- script: | + echo "##vso[task.setvariable variable=Maven.RepositoryPath;]$HOME/.m2/repository" + condition: ne(variables['Agent.OS'], 'Windows_NT') + displayName: Detecting Maven repository on Linux and macOS +- task: CacheBeta@0 + inputs: + key: $(Agent.JobName)|$(CacheSalt)|$(Build.SourcesDirectory)/sdk/**/pom.xml + path: $(Maven.RepositoryPath) + displayName: 'Download/upload cache' + condition: ne(variables['EnableCaching'], 'false') \ No newline at end of file diff --git a/eng/pipelines/templates/variables/globals.yml b/eng/pipelines/templates/variables/globals.yml index 72a7e440ad3f..e3aa988e515f 100644 --- a/eng/pipelines/templates/variables/globals.yml +++ b/eng/pipelines/templates/variables/globals.yml @@ -2,4 +2,5 @@ variables: DefaultOptions: '--batch-mode -Dmaven.wagon.http.pool=false --settings eng/settings.xml' LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' Agent.Source.Git.ShallowFetchDepth: 1 - skipComponentGovernanceDetection: true \ No newline at end of file + skipComponentGovernanceDetection: true + EmulatorMsiUrl: 'https://acpedaily1.blob.core.windows.net/emulator/azure-cosmos-emulator.msi' \ No newline at end of file diff --git a/eng/smoke-tests/README.md b/eng/smoke-tests/README.md new file mode 100644 index 000000000000..8c81bcb61e4e --- /dev/null +++ b/eng/smoke-tests/README.md @@ -0,0 +1,135 @@ +# Azure Smoke Test for Java +This sample code is a smoke test to ensure that Azure Preview for Java work while loaded into the same process by performing 2 or more actions with them. + +Libraries tested: +* keyvault-secrets +* identity +* storage-blob +* event-hubs +* cosmos + +## Getting started +### Setup Azure resources +For this sample, it is necessary to create/have the following resources in the [Azure Portal](https://portal.azure.com/): +* **App registration**: Register a new app or use an existing one. + * Under _Certificates & secrets_ create a new **client secret** and store the value in a safe place. +* **Key Vaults**: Create a new Key Vault resource or use an existing one. + * Under _Access policies_, add the app registrated in the previous step. +* **Storage acounts**: Create a container in a new or existing storage account. The container in this sample is named "mycontainer", if you want to use other name you can change the value in `BlobStorage.ts` file: +`const containerName = "mycontainer";` +* **Event Hubs**: Create an event hub inside a new or existing Event Hubs Namespace. The container in this sample is named "myeventhub", if you want to use other name you can change the value in `EventHubsTest.ts` file: `let eventHubName = "myeventhub";` +* **Azure Cosmos DB**: Create a new account or use an existing one. + +### Azure credentials +The following environment variables are needed: +* From **App Registration**, in the _Overview_ section: + * AZURE_TENANT_ID: The directory tentant ID. + * AZURE_CLIENT_ID: The application ID. + * AZURE_CLIENT_SECRET: The client secret stored previusly when creating the _client secret_. + +* From **Key Vault**, in the _Overview_ section: + * AZURE_PROJECT_URL: The DNS Name + +* From **Event Hubs**, in _Shared access policies_ section: + * AZURE_EVENT_HUBS_CONNECTION_STRING: Connection string from a policy + +* From **Storage Account**, in the _Access Keys_ section: + * AZURE_STORAGE_CONNECTION_STRING : A connection strings. + +* From **Azure Cosmos DB**, in the _Keys_ section, select the _Read-Write Keys_ tab: + * AZURE_COSMOS_ENDPOINT: URI. + * AZURE_COSMOS_KEY: Primary or secondary key. + +```bash +# Bash code to create the environment variables +export AZURE_CLIENT_ID="" +export AZURE_CLIENT_SECRET="" +export AZURE_TENANT_ID="" +export AZURE_EVENT_HUBS_CONNECTION_STRING="" +export AZURE_AZURE_PROJECT_URL="" +export AZURE_STORAGE_CONNECTION_STRING="" +export AZURE_COSMOS_ENDPOINT="" +export AZURE_COSMOS_KEY="" +``` +### Client Logger +The Azure clients use a ClientLogger. Create an environment variable `AZURE_LOG_LEVEL` and set it to the desire level: +* Verbose = 1 +* Informational = 2 +* Warnings = 3 +* Errors = 4 +* Disabled = 5 + +### Running the console app +[Java](https://www.java.com/en/) version 11.0.4 was used to run this sample. + +Install Maven dependencies: + +Run `App.main()`: + + +## Key concepts + +## Examples +All the classes in this sample not depend on each other. + +It is possible to run them individually: +```java +package com.azure; +import java.io.IOException; + +public class App { + public static void main(String[] args) throws IllegalArgumentException, IOException { + StorageBlob.main(null); + } +} +``` + +The classes can be used as base code and be changed to satisfied specific needs. For example, the method `EventHubs().sendAndReceiveEvents()` can be change to only send events from an array given from a parameter: +```java +private void sendEvents(String partitionId, Flux events) { + EventHubProducer producer = client.createProducer(new EventHubProducerOptions().partitionId(partitionId)); + + producer.send(events).subscribe( + (ignored) -> logger.info("sent"), + error -> logger.error("Error received:" + error), + () -> { + //Closing the producer once is done with sending the events + try { + producer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + ); + } +``` + +**Note:** The methods in the classes are not necessary independent on each other, and the order matters. For example, in order to run `StorageBlob.deleteBlob();`, the method `StorageBlob.uploadBLob();` must be run before, since in the other way it will fail because there is not going to be a blob to delete. + +## Troubleshooting + +### Authentication +Be sure to set the environment variables and credentials required before running the sample. + +### SLF4J Logger +Be sure to include the SLF4J dependency in the `pom.xml` file. + +```xml + + org.slf4j + slf4j-simple + 1.7.28 + +``` + +## Next steps +Check the [Azure SDK for Java Repository](https://github.com/Azure/azure-sdk-for-java) for more samples. + +## Contributing +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. + +If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code. + +This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. diff --git a/eng/smoke-tests/pom.xml b/eng/smoke-tests/pom.xml new file mode 100644 index 000000000000..a190d3297de2 --- /dev/null +++ b/eng/smoke-tests/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + com.azure + smoke-test + 1.0-SNAPSHOT + smoke-test + https://github.com/Azure/azure-sdk-for-java + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.11 + test + + + + com.microsoft.azure + azure-cosmos + 3.1.0 + + + + com.azure + azure-identity + 1.0.0-preview.2 + + + + com.azure + azure-keyvault-secrets + 4.0.0-preview.2 + + + + com.azure + azure-messaging-eventhubs + 5.0.0-preview.2 + + + + com.azure + azure-storage-blob + 12.0.0-preview.2 + + + + org.slf4j + slf4j-simple + 1.7.28 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + diff --git a/eng/smoke-tests/src/main/java/com/azure/App.java b/eng/smoke-tests/src/main/java/com/azure/App.java new file mode 100644 index 000000000000..ba5978475f59 --- /dev/null +++ b/eng/smoke-tests/src/main/java/com/azure/App.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure; + +import java.io.IOException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class App { + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + + public static void main(String[] args) throws IllegalArgumentException, IOException { + LOGGER.info("================================"); + LOGGER.info(" AZURE SDK SMOKE TEST"); + LOGGER.info("================================"); + + KeyVaultSecrets.main(null); + StorageBlob.main(null); + EventHubs.main(null); + CosmosDB.main(null); + + } +} diff --git a/eng/smoke-tests/src/main/java/com/azure/CosmosDB.java b/eng/smoke-tests/src/main/java/com/azure/CosmosDB.java new file mode 100644 index 000000000000..b19b96bb1ac1 --- /dev/null +++ b/eng/smoke-tests/src/main/java/com/azure/CosmosDB.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure; + +import com.azure.data.cosmos.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +public class CosmosDB { + private static final String DB_NAME = "JavaSolarSystem-" + UUID.randomUUID(); + private static final String COLLECTION_NAME = "Planets"; + + private static final String AZURE_COSMOS_ENDPOINT = System.getenv("AZURE_COSMOS_ENDPOINT"); + private static final String AZURE_COSMOS_KEY= System.getenv("AZURE_COSMOS_KEY"); + + private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDB.class); + + private static Mono createDatabase(CosmosClient client) { + LOGGER.info("Creating database '{}'... ", DB_NAME); + return client.createDatabaseIfNotExists(DB_NAME).then(); + } + + private static Mono createCollection(CosmosClient client) { + LOGGER.info("Creating collection '{}'... ", COLLECTION_NAME); + return client.getDatabase(DB_NAME).createContainer(COLLECTION_NAME, "/id") + .map(response -> response.container()); + } + + private static Mono createDocuments(CosmosContainer container) { + LOGGER.info("Inserting Items... "); + List planets = Arrays.asList( + new Planet( + "Earth", + false, + 3959, + new Moon[]{ + new Moon("Moon") + }), + new Planet( + "Mars", + false, + 2106, + new Moon[]{ + new Moon("Phobos"), + new Moon("Deimos") + }) + ); + + return Flux.fromIterable(planets).flatMap(planet -> container.createItem(planet)).then(); + } + + private static Mono simpleQuery(CosmosContainer container) { + LOGGER.info("Querying collection..."); + FeedOptions options = new FeedOptions().enableCrossPartitionQuery(true); + Flux> queryResults = container.queryItems("SELECT c.id FROM c", options); + + return queryResults.map(cosmosItemPropertiesFeedResponse -> { + LOGGER.info("\t{}",cosmosItemPropertiesFeedResponse.results().toString()); + return cosmosItemPropertiesFeedResponse; + }).then(); + } + + private static Mono deleteDatabase(CosmosClient client) { + LOGGER.info("Cleaning up the resource..."); + return client.getDatabase(DB_NAME).delete().then(); + } + + public static void main(String[] args) { + LOGGER.info("---------------------"); + LOGGER.info("COSMOS DB"); + LOGGER.info("---------------------"); + + CosmosClient client = CosmosClient + .builder().endpoint(AZURE_COSMOS_ENDPOINT) + .key(AZURE_COSMOS_KEY) + .build(); + + try { + //if the database already exists, it is going to be deleted with all its content. + deleteDatabase(client).block(); + } catch (Exception e) { + //This means that the database does not exists already, it's fine + } + + try { + createDatabase(client) + .then(createCollection(client)) + .flatMap(collection -> createDocuments(collection) + .then(simpleQuery(collection)) + ) + .block(); + } finally { + deleteDatabase(client).block(); + client.close(); + } + } +} + +// Classes for this sample +class Planet { + public String id; + public boolean hasRings; + public int radius; + public Moon[] moons; + + public Planet(String id, boolean hasRings, int radius, Moon[] moons) { + this.id = id; + this.hasRings = hasRings; + this.radius = radius; + this.moons = moons; + } +} + +class Moon { + public String name; + + public Moon(String name) { + this.name = name; + } + +} diff --git a/eng/smoke-tests/src/main/java/com/azure/EventHubs.java b/eng/smoke-tests/src/main/java/com/azure/EventHubs.java new file mode 100644 index 000000000000..0628eb927d48 --- /dev/null +++ b/eng/smoke-tests/src/main/java/com/azure/EventHubs.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure; + +import com.azure.messaging.eventhubs.EventHubClientBuilder; +import com.azure.messaging.eventhubs.EventHubAsyncClient; +import com.azure.messaging.eventhubs.EventHubConsumer; +import com.azure.messaging.eventhubs.EventHubProducer; +import com.azure.messaging.eventhubs.EventData; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.Disposable; +import reactor.core.publisher.Flux; + +import java.time.Duration; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; + + +public class EventHubs { + private static final String EVENT_HUBS_CONNECTION_STRING = System.getenv("AZURE_EVENT_HUBS_CONNECTION_STRING"); + private static EventHubAsyncClient client; + + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubs.class); + + private static String getPartitionID() { + LOGGER.info("Getting partition id... "); + Flux partitions = client.getPartitionIds(); + LOGGER.info("\tDONE."); + //In ths sample, the events are going to be send and consume from the first partition. + return partitions.blockFirst(); + } + + private static void sendAndReceiveEvents(String partitionId) { + LOGGER.info("Creating consumer... "); + EventHubConsumer consumer = client.createConsumer( + EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, + partitionId, + EventPosition.latest()); + LOGGER.info("\tDONE."); + + LOGGER.info("Creating producer... "); + EventHubProducer producer = client.createProducer(new EventHubProducerOptions().partitionId(partitionId)); + LOGGER.info("\tDONE."); + + LOGGER.info("Sending Events... "); + Flux events = Flux.just( + new EventData(("Test event 1 in Java").getBytes(StandardCharsets.UTF_8)), + new EventData(("Test event 2 in Java").getBytes(StandardCharsets.UTF_8)), + new EventData(("Test event 3 in Java").getBytes(StandardCharsets.UTF_8)) + ); + + producer.send(events).subscribe( + (ignored) -> LOGGER.info("sent"), + error -> LOGGER.error("Error received:" + error), + () -> { + //Closing the producer once is done with sending the events + try { + producer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + ); + LOGGER.info("\tDONE."); + + LOGGER.info("Consuming Events... "); + final int maxSeconds = 5; + final int numOfEventsExpected = 3; + CountDownLatch countDownLatch = new CountDownLatch(numOfEventsExpected); + Disposable consumerSubscription = consumer.receive().subscribe(e -> { + LOGGER.info("\tEvent received: " + StandardCharsets.UTF_8.decode(e.body())); + countDownLatch.countDown(); + }); + + //Wait to get all the events + try { + boolean isSuccessful = countDownLatch.await(Duration.ofSeconds(maxSeconds).getSeconds(), TimeUnit.SECONDS); + if (!isSuccessful) { + throw new Exception("Error, expecting 3 events but " + countDownLatch.getCount() + " are missing."); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + //Dispose both subscriptions and close the clients + consumerSubscription.dispose(); + try { + producer.close(); + consumer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + client.close(); + } + + LOGGER.info("DONE."); + + } + + public static void main(String[] args) { + LOGGER.info("---------------------"); + LOGGER.info("EVENT HUBS"); + LOGGER.info("---------------------"); + + client = new EventHubClientBuilder().connectionString(EVENT_HUBS_CONNECTION_STRING).buildAsyncClient(); + + String partitionId = getPartitionID(); + sendAndReceiveEvents(partitionId); + } +} diff --git a/eng/smoke-tests/src/main/java/com/azure/KeyVaultSecrets.java b/eng/smoke-tests/src/main/java/com/azure/KeyVaultSecrets.java new file mode 100644 index 000000000000..a20296a8858e --- /dev/null +++ b/eng/smoke-tests/src/main/java/com/azure/KeyVaultSecrets.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.secrets.SecretClient; +import com.azure.security.keyvault.secrets.SecretClientBuilder; +import com.azure.security.keyvault.secrets.models.DeletedSecret; +import com.azure.security.keyvault.secrets.models.Secret; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.UUID; + +public class KeyVaultSecrets { + private static SecretClient secretClient; + private static final String SECRET_NAME = "MySecretName-" + UUID.randomUUID(); + private static final String SECRET_VALUE = "MySecretValue"; + + private static final Logger LOGGER = LoggerFactory.getLogger(KeyVaultSecrets.class); + + private static void setSecret() { + LOGGER.info("Setting a secret..."); + Secret response = secretClient.setSecret(SECRET_NAME, SECRET_VALUE); + LOGGER.info("\tDONE: ({},{}).", response.name(), response.value()); + } + + private static void getSecret() { + LOGGER.info("Getting the secret... "); + Secret response = secretClient.getSecret(SECRET_NAME); + LOGGER.info("\tDONE: secret ({},{}) retrieved.", response.name(), response.value()); + } + + private static void deleteSecret() { + LOGGER.info("Deleting the secret... "); + DeletedSecret response = secretClient.deleteSecret(SECRET_NAME); + LOGGER.info("\tDONE: '{}' deleted.", response.name()); + } + + public static void main(String[] args) { + LOGGER.info("---------------------"); + LOGGER.info("KEY VAULT - SECRETS"); + LOGGER.info("IDENTITY - CREDENTIAL"); + LOGGER.info("---------------------"); + + /* DefaultAzureCredentialBuilder() is expecting the following environment variables: + * AZURE_CLIENT_ID + * AZURE_CLIENT_SECRET + * AZURE_TENANT_ID + */ + secretClient = new SecretClientBuilder() + .endpoint(System.getenv("AZURE_PROJECT_URL")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildClient(); + + try { + setSecret(); + getSecret(); + } finally { + deleteSecret(); + } + } +} diff --git a/eng/smoke-tests/src/main/java/com/azure/StorageBlob.java b/eng/smoke-tests/src/main/java/com/azure/StorageBlob.java new file mode 100644 index 000000000000..ee5373d180c4 --- /dev/null +++ b/eng/smoke-tests/src/main/java/com/azure/StorageBlob.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure; + +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.BlobServiceClientBuilder; +import com.azure.storage.blob.BlockBlobClient; +import com.azure.storage.blob.ContainerClient; +import com.azure.storage.blob.models.BlobItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.UUID; + +public class StorageBlob { + private static ContainerClient containerClient; + private static BlockBlobClient blobClient; + + private static final String STORAGE_CONNECTION_STRING = System.getenv("AZURE_STORAGE_CONNECTION_STRING"); + + private static final String CONTAINER_NAME = "mycontainer"; //This sample needs an existing container + private static final String BLOB_NAME = "javaSmokeTestBlob-"+ UUID.randomUUID() +".txt"; + + private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDB.class); + + private static void uploadBlob() throws IOException { + LOGGER.info("Uploading blob... "); + String text = "This is a sample block blob created for SDK Smoke Test in Java!"; + ByteArrayInputStream data = new ByteArrayInputStream(text.getBytes()); + blobClient.upload(data, text.length()); + LOGGER.info("\tDONE."); + + } + + private static void listBlobsInContainer() { + LOGGER.info("Listing all blobs in container..."); + Iterable storageResponse = containerClient.listBlobsFlat(); + storageResponse.forEach(blobItem -> LOGGER.info("\t{}",blobItem.name())); + LOGGER.info("DONE."); + } + + private static void deleteBlob() { + LOGGER.info("Deleting blob... "); + blobClient.delete(); + LOGGER.info("\tDONE."); + } + + public static void main(String[] args) throws IOException { + LOGGER.info("---------------------"); + LOGGER.info("STORAGE - BLOB"); + LOGGER.info("---------------------"); + + BlobServiceClient serviceClient = new BlobServiceClientBuilder().connectionString(STORAGE_CONNECTION_STRING).buildClient(); + containerClient = serviceClient.getContainerClient(CONTAINER_NAME); + blobClient = containerClient.getBlockBlobClient(BLOB_NAME); + + try{ + uploadBlob(); + listBlobsInContainer(); + } + finally { + deleteBlob(); + } + } +} diff --git a/eng/spotbugs-aggregate-report/pom.xml b/eng/spotbugs-aggregate-report/pom.xml index 6f2b66734cfa..a092047e0e67 100644 --- a/eng/spotbugs-aggregate-report/pom.xml +++ b/eng/spotbugs-aggregate-report/pom.xml @@ -27,6 +27,7 @@ 1.0.0-preview.3 4.0.0-preview.3 5.0.0-preview.3 + 12.0.0-preview.3 12.0.0-preview.3 12.0.0-preview.3 12.0.0-preview.3 @@ -57,6 +58,7 @@ ..\..\sdk\core\azure-core\src\main\java ..\..\sdk\core\azure-core\src\samples\java ..\..\sdk\core\azure-core-amqp\src\main\java + ..\..\sdk\core\azure-core-http-netty\src\main\java ..\..\sdk\core\azure-core-management\src\main\java ..\..\sdk\core\azure-core-test\src\main\java ..\..\sdk\eventhubs\azure-messaging-eventhubs\src\main\java @@ -67,12 +69,13 @@ - - - - - - + ..\..\sdk\storage\azure-storage-common\src\main\java + ..\..\sdk\storage\azure-storage-blob\src\main\java + ..\..\sdk\storage\azure-storage-blob\src\samples\java + ..\..\sdk\storage\azure-storage-file\src\main\java + ..\..\sdk\storage\azure-storage-file\src\samples\java + ..\..\sdk\storage\azure-storage-queue\src\main\java + ..\..\sdk\storage\azure-storage-queue\src\samples\java @@ -149,6 +152,11 @@ azure-core-amqp ${azure-core.version} + + com.azure + azure-core-http-netty + ${azure-core.version} + com.azure azure-core-management @@ -179,6 +187,11 @@ azure-keyvault-secrets ${azure-keyvault.version} + + com.azure + azure-storage-common + ${azure-storage-common.version} + com.azure azure-storage-blob diff --git a/network/resource-manager/v2019_06_01/pom.xml b/network/resource-manager/v2019_06_01/pom.xml index 2c5ed872eb71..512de75073b2 100644 --- a/network/resource-manager/v2019_06_01/pom.xml +++ b/network/resource-manager/v2019_06_01/pom.xml @@ -15,7 +15,7 @@ ../../../pom.management.xml azure-mgmt-network - 1.0.0-beta + 1.0.0-beta-1 jar Microsoft Azure SDK for Network Management This package contains Microsoft Network Management SDK. diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationGatewayOnDemandProbe.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationGatewayOnDemandProbe.java index 51e0e4d71d94..6f2694d6bb58 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationGatewayOnDemandProbe.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationGatewayOnDemandProbe.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.network.v2019_06_01; +import com.microsoft.azure.SubResource; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -56,18 +57,18 @@ public class ApplicationGatewayOnDemandProbe { private ApplicationGatewayProbeHealthResponseMatch match; /** - * Name of backend pool of application gateway to which probe request will - * be sent. + * Reference of backend pool of application gateway to which probe request + * will be sent. */ - @JsonProperty(value = "backendPoolName") - private String backendPoolName; + @JsonProperty(value = "backendAddressPool") + private SubResource backendAddressPool; /** - * Name of backend http setting of application gateway to be used for test - * probe. + * Reference of backend http setting of application gateway to be used for + * test probe. */ - @JsonProperty(value = "backendHttpSettingName") - private String backendHttpSettingName; + @JsonProperty(value = "backendHttpSettings") + private SubResource backendHttpSettings; /** * Get the protocol used for the probe. Possible values include: 'Http', 'Https'. @@ -190,42 +191,42 @@ public ApplicationGatewayOnDemandProbe withMatch(ApplicationGatewayProbeHealthRe } /** - * Get name of backend pool of application gateway to which probe request will be sent. + * Get reference of backend pool of application gateway to which probe request will be sent. * - * @return the backendPoolName value + * @return the backendAddressPool value */ - public String backendPoolName() { - return this.backendPoolName; + public SubResource backendAddressPool() { + return this.backendAddressPool; } /** - * Set name of backend pool of application gateway to which probe request will be sent. + * Set reference of backend pool of application gateway to which probe request will be sent. * - * @param backendPoolName the backendPoolName value to set + * @param backendAddressPool the backendAddressPool value to set * @return the ApplicationGatewayOnDemandProbe object itself. */ - public ApplicationGatewayOnDemandProbe withBackendPoolName(String backendPoolName) { - this.backendPoolName = backendPoolName; + public ApplicationGatewayOnDemandProbe withBackendAddressPool(SubResource backendAddressPool) { + this.backendAddressPool = backendAddressPool; return this; } /** - * Get name of backend http setting of application gateway to be used for test probe. + * Get reference of backend http setting of application gateway to be used for test probe. * - * @return the backendHttpSettingName value + * @return the backendHttpSettings value */ - public String backendHttpSettingName() { - return this.backendHttpSettingName; + public SubResource backendHttpSettings() { + return this.backendHttpSettings; } /** - * Set name of backend http setting of application gateway to be used for test probe. + * Set reference of backend http setting of application gateway to be used for test probe. * - * @param backendHttpSettingName the backendHttpSettingName value to set + * @param backendHttpSettings the backendHttpSettings value to set * @return the ApplicationGatewayOnDemandProbe object itself. */ - public ApplicationGatewayOnDemandProbe withBackendHttpSettingName(String backendHttpSettingName) { - this.backendHttpSettingName = backendHttpSettingName; + public ApplicationGatewayOnDemandProbe withBackendHttpSettings(SubResource backendHttpSettings) { + this.backendHttpSettings = backendHttpSettings; return this; } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationRuleCondition.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationRuleCondition.java new file mode 100644 index 000000000000..f55c53c63f34 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationRuleCondition.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Rule condition of type application. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleConditionType", defaultImpl = ApplicationRuleCondition.class) +@JsonTypeName("ApplicationRuleCondition") +public class ApplicationRuleCondition extends FirewallPolicyRuleCondition { + /** + * List of source IP addresses for this rule. + */ + @JsonProperty(value = "sourceAddresses") + private List sourceAddresses; + + /** + * List of destination IP addresses or Service Tags. + */ + @JsonProperty(value = "destinationAddresses") + private List destinationAddresses; + + /** + * Array of Application Protocols. + */ + @JsonProperty(value = "protocols") + private List protocols; + + /** + * List of FQDNs for this rule condition. + */ + @JsonProperty(value = "targetFqdns") + private List targetFqdns; + + /** + * List of FQDN Tags for this rule condition. + */ + @JsonProperty(value = "fqdnTags") + private List fqdnTags; + + /** + * Get list of source IP addresses for this rule. + * + * @return the sourceAddresses value + */ + public List sourceAddresses() { + return this.sourceAddresses; + } + + /** + * Set list of source IP addresses for this rule. + * + * @param sourceAddresses the sourceAddresses value to set + * @return the ApplicationRuleCondition object itself. + */ + public ApplicationRuleCondition withSourceAddresses(List sourceAddresses) { + this.sourceAddresses = sourceAddresses; + return this; + } + + /** + * Get list of destination IP addresses or Service Tags. + * + * @return the destinationAddresses value + */ + public List destinationAddresses() { + return this.destinationAddresses; + } + + /** + * Set list of destination IP addresses or Service Tags. + * + * @param destinationAddresses the destinationAddresses value to set + * @return the ApplicationRuleCondition object itself. + */ + public ApplicationRuleCondition withDestinationAddresses(List destinationAddresses) { + this.destinationAddresses = destinationAddresses; + return this; + } + + /** + * Get array of Application Protocols. + * + * @return the protocols value + */ + public List protocols() { + return this.protocols; + } + + /** + * Set array of Application Protocols. + * + * @param protocols the protocols value to set + * @return the ApplicationRuleCondition object itself. + */ + public ApplicationRuleCondition withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + + /** + * Get list of FQDNs for this rule condition. + * + * @return the targetFqdns value + */ + public List targetFqdns() { + return this.targetFqdns; + } + + /** + * Set list of FQDNs for this rule condition. + * + * @param targetFqdns the targetFqdns value to set + * @return the ApplicationRuleCondition object itself. + */ + public ApplicationRuleCondition withTargetFqdns(List targetFqdns) { + this.targetFqdns = targetFqdns; + return this; + } + + /** + * Get list of FQDN Tags for this rule condition. + * + * @return the fqdnTags value + */ + public List fqdnTags() { + return this.fqdnTags; + } + + /** + * Set list of FQDN Tags for this rule condition. + * + * @param fqdnTags the fqdnTags value to set + * @return the ApplicationRuleCondition object itself. + */ + public ApplicationRuleCondition withFqdnTags(List fqdnTags) { + this.fqdnTags = fqdnTags; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewall.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewall.java index 25e1e50a0546..bc5afeb64027 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewall.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewall.java @@ -19,6 +19,7 @@ import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.network.v2019_06_01.implementation.NetworkManager; import java.util.List; +import com.microsoft.azure.SubResource; import com.microsoft.azure.management.network.v2019_06_01.implementation.AzureFirewallInner; /** @@ -35,6 +36,16 @@ public interface AzureFirewall extends HasInner, Resource, G */ String etag(); + /** + * @return the firewallPolicy value. + */ + SubResource firewallPolicy(); + + /** + * @return the hubIpAddresses value. + */ + HubIPAddresses hubIpAddresses(); + /** * @return the ipConfigurations value. */ @@ -60,6 +71,11 @@ public interface AzureFirewall extends HasInner, Resource, G */ AzureFirewallThreatIntelMode threatIntelMode(); + /** + * @return the virtualHub value. + */ + SubResource virtualHub(); + /** * @return the zones value. */ @@ -99,6 +115,18 @@ interface WithApplicationRuleCollections { WithCreate withApplicationRuleCollections(List applicationRuleCollections); } + /** + * The stage of the azurefirewall definition allowing to specify FirewallPolicy. + */ + interface WithFirewallPolicy { + /** + * Specifies firewallPolicy. + * @param firewallPolicy The firewallPolicy associated with this azure firewall + * @return the next definition stage + */ + WithCreate withFirewallPolicy(SubResource firewallPolicy); + } + /** * The stage of the azurefirewall definition allowing to specify IpConfigurations. */ @@ -159,6 +187,18 @@ interface WithThreatIntelMode { WithCreate withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode); } + /** + * The stage of the azurefirewall definition allowing to specify VirtualHub. + */ + interface WithVirtualHub { + /** + * Specifies virtualHub. + * @param virtualHub The virtualHub to which the firewall belongs + * @return the next definition stage + */ + WithCreate withVirtualHub(SubResource virtualHub); + } + /** * The stage of the azurefirewall definition allowing to specify Zones. */ @@ -176,13 +216,13 @@ interface WithZones { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithApplicationRuleCollections, DefinitionStages.WithIpConfigurations, DefinitionStages.WithNatRuleCollections, DefinitionStages.WithNetworkRuleCollections, DefinitionStages.WithProvisioningState, DefinitionStages.WithThreatIntelMode, DefinitionStages.WithZones { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithApplicationRuleCollections, DefinitionStages.WithFirewallPolicy, DefinitionStages.WithIpConfigurations, DefinitionStages.WithNatRuleCollections, DefinitionStages.WithNetworkRuleCollections, DefinitionStages.WithProvisioningState, DefinitionStages.WithThreatIntelMode, DefinitionStages.WithVirtualHub, DefinitionStages.WithZones { } } /** * The template for a AzureFirewall update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithApplicationRuleCollections, UpdateStages.WithIpConfigurations, UpdateStages.WithNatRuleCollections, UpdateStages.WithNetworkRuleCollections, UpdateStages.WithProvisioningState, UpdateStages.WithThreatIntelMode, UpdateStages.WithZones { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithApplicationRuleCollections, UpdateStages.WithFirewallPolicy, UpdateStages.WithIpConfigurations, UpdateStages.WithNatRuleCollections, UpdateStages.WithNetworkRuleCollections, UpdateStages.WithProvisioningState, UpdateStages.WithThreatIntelMode, UpdateStages.WithVirtualHub, UpdateStages.WithZones { } /** @@ -201,6 +241,18 @@ interface WithApplicationRuleCollections { Update withApplicationRuleCollections(List applicationRuleCollections); } + /** + * The stage of the azurefirewall update allowing to specify FirewallPolicy. + */ + interface WithFirewallPolicy { + /** + * Specifies firewallPolicy. + * @param firewallPolicy The firewallPolicy associated with this azure firewall + * @return the next update stage + */ + Update withFirewallPolicy(SubResource firewallPolicy); + } + /** * The stage of the azurefirewall update allowing to specify IpConfigurations. */ @@ -261,6 +313,18 @@ interface WithThreatIntelMode { Update withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode); } + /** + * The stage of the azurefirewall update allowing to specify VirtualHub. + */ + interface WithVirtualHub { + /** + * Specifies virtualHub. + * @param virtualHub The virtualHub to which the firewall belongs + * @return the next update stage + */ + Update withVirtualHub(SubResource virtualHub); + } + /** * The stage of the azurefirewall update allowing to specify Zones. */ diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewallPublicIPAddress.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewallPublicIPAddress.java new file mode 100644 index 000000000000..589d2a121a9f --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewallPublicIPAddress.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Public IP Address associated with azure firewall. + */ +public class AzureFirewallPublicIPAddress { + /** + * Public IP Address value. + */ + @JsonProperty(value = "address") + private String address; + + /** + * Get public IP Address value. + * + * @return the address value + */ + public String address() { + return this.address; + } + + /** + * Set public IP Address value. + * + * @param address the address value to set + * @return the AzureFirewallPublicIPAddress object itself. + */ + public AzureFirewallPublicIPAddress withAddress(String address) { + this.address = address; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicies.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicies.java new file mode 100644 index 000000000000..cf0089b32b64 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicies.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.network.v2019_06_01.implementation.FirewallPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing FirewallPolicies. + */ +public interface FirewallPolicies extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicy.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicy.java new file mode 100644 index 000000000000..c0c4408df172 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicy.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.network.v2019_06_01.implementation.NetworkManager; +import java.util.List; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.network.v2019_06_01.implementation.FirewallPolicyInner; + +/** + * Type representing FirewallPolicy. + */ +public interface FirewallPolicy extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the basePolicy value. + */ + SubResource basePolicy(); + + /** + * @return the childPolicies value. + */ + List childPolicies(); + + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the firewalls value. + */ + List firewalls(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the ruleGroups value. + */ + List ruleGroups(); + + /** + * @return the threatIntelMode value. + */ + AzureFirewallThreatIntelMode threatIntelMode(); + + /** + * The entirety of the FirewallPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of FirewallPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a FirewallPolicy definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the FirewallPolicy definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the firewallpolicy definition allowing to specify BasePolicy. + */ + interface WithBasePolicy { + /** + * Specifies basePolicy. + * @param basePolicy The parent firewall policy from which rules are inherited + * @return the next definition stage + */ + WithCreate withBasePolicy(SubResource basePolicy); + } + + /** + * The stage of the firewallpolicy definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } + + /** + * The stage of the firewallpolicy definition allowing to specify ThreatIntelMode. + */ + interface WithThreatIntelMode { + /** + * Specifies threatIntelMode. + * @param threatIntelMode The operation mode for Threat Intelligence. Possible values include: 'Alert', 'Deny', 'Off' + * @return the next definition stage + */ + WithCreate withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithBasePolicy, DefinitionStages.WithProvisioningState, DefinitionStages.WithThreatIntelMode { + } + } + /** + * The template for a FirewallPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithBasePolicy, UpdateStages.WithProvisioningState, UpdateStages.WithThreatIntelMode { + } + + /** + * Grouping of FirewallPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the firewallpolicy update allowing to specify BasePolicy. + */ + interface WithBasePolicy { + /** + * Specifies basePolicy. + * @param basePolicy The parent firewall policy from which rules are inherited + * @return the next update stage + */ + Update withBasePolicy(SubResource basePolicy); + } + + /** + * The stage of the firewallpolicy update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningState provisioningState); + } + + /** + * The stage of the firewallpolicy update allowing to specify ThreatIntelMode. + */ + interface WithThreatIntelMode { + /** + * Specifies threatIntelMode. + * @param threatIntelMode The operation mode for Threat Intelligence. Possible values include: 'Alert', 'Deny', 'Off' + * @return the next update stage + */ + Update withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode); + } + + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRule.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRule.java new file mode 100644 index 000000000000..98ea6d614ff1 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRule.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Firewall Policy Filter Rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType", defaultImpl = FirewallPolicyFilterRule.class) +@JsonTypeName("FirewallPolicyFilterRule") +public class FirewallPolicyFilterRule extends FirewallPolicyRule { + /** + * The action type of a Filter rule. + */ + @JsonProperty(value = "action") + private FirewallPolicyFilterRuleAction action; + + /** + * Collection of rule conditions used by a rule. + */ + @JsonProperty(value = "ruleConditions") + private List ruleConditions; + + /** + * Get the action type of a Filter rule. + * + * @return the action value + */ + public FirewallPolicyFilterRuleAction action() { + return this.action; + } + + /** + * Set the action type of a Filter rule. + * + * @param action the action value to set + * @return the FirewallPolicyFilterRule object itself. + */ + public FirewallPolicyFilterRule withAction(FirewallPolicyFilterRuleAction action) { + this.action = action; + return this; + } + + /** + * Get collection of rule conditions used by a rule. + * + * @return the ruleConditions value + */ + public List ruleConditions() { + return this.ruleConditions; + } + + /** + * Set collection of rule conditions used by a rule. + * + * @param ruleConditions the ruleConditions value to set + * @return the FirewallPolicyFilterRule object itself. + */ + public FirewallPolicyFilterRule withRuleConditions(List ruleConditions) { + this.ruleConditions = ruleConditions; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleAction.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleAction.java new file mode 100644 index 000000000000..00384f4a762d --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleAction.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the FirewallPolicyFilterRuleAction. + */ +public class FirewallPolicyFilterRuleAction { + /** + * The type of action. Possible values include: 'Allow', 'Deny', 'Alert '. + */ + @JsonProperty(value = "type") + private FirewallPolicyFilterRuleActionType type; + + /** + * Get the type of action. Possible values include: 'Allow', 'Deny', 'Alert '. + * + * @return the type value + */ + public FirewallPolicyFilterRuleActionType type() { + return this.type; + } + + /** + * Set the type of action. Possible values include: 'Allow', 'Deny', 'Alert '. + * + * @param type the type value to set + * @return the FirewallPolicyFilterRuleAction object itself. + */ + public FirewallPolicyFilterRuleAction withType(FirewallPolicyFilterRuleActionType type) { + this.type = type; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleActionType.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleActionType.java new file mode 100644 index 000000000000..c9314890a681 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleActionType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FirewallPolicyFilterRuleActionType. + */ +public final class FirewallPolicyFilterRuleActionType extends ExpandableStringEnum { + /** Static value Allow for FirewallPolicyFilterRuleActionType. */ + public static final FirewallPolicyFilterRuleActionType ALLOW = fromString("Allow"); + + /** Static value Deny for FirewallPolicyFilterRuleActionType. */ + public static final FirewallPolicyFilterRuleActionType DENY = fromString("Deny"); + + /** Static value Alert for FirewallPolicyFilterRuleActionType. */ + public static final FirewallPolicyFilterRuleActionType ALERT_ = fromString("Alert "); + + /** + * Creates or finds a FirewallPolicyFilterRuleActionType from its string representation. + * @param name a name to look for + * @return the corresponding FirewallPolicyFilterRuleActionType + */ + @JsonCreator + public static FirewallPolicyFilterRuleActionType fromString(String name) { + return fromString(name, FirewallPolicyFilterRuleActionType.class); + } + + /** + * @return known FirewallPolicyFilterRuleActionType values + */ + public static Collection values() { + return values(FirewallPolicyFilterRuleActionType.class); + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRule.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRule.java new file mode 100644 index 000000000000..cf3f43dc9408 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRule.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Firewall Policy NAT Rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType", defaultImpl = FirewallPolicyNatRule.class) +@JsonTypeName("FirewallPolicyNatRule") +public class FirewallPolicyNatRule extends FirewallPolicyRule { + /** + * The action type of a Nat rule, SNAT or DNAT. + */ + @JsonProperty(value = "action") + private FirewallPolicyNatRuleAction action; + + /** + * The translated address for this NAT rule. + */ + @JsonProperty(value = "translatedAddress") + private String translatedAddress; + + /** + * The translated port for this NAT rule. + */ + @JsonProperty(value = "translatedPort") + private String translatedPort; + + /** + * The match conditions for incoming traffic. + */ + @JsonProperty(value = "ruleCondition") + private FirewallPolicyRuleCondition ruleCondition; + + /** + * Get the action type of a Nat rule, SNAT or DNAT. + * + * @return the action value + */ + public FirewallPolicyNatRuleAction action() { + return this.action; + } + + /** + * Set the action type of a Nat rule, SNAT or DNAT. + * + * @param action the action value to set + * @return the FirewallPolicyNatRule object itself. + */ + public FirewallPolicyNatRule withAction(FirewallPolicyNatRuleAction action) { + this.action = action; + return this; + } + + /** + * Get the translated address for this NAT rule. + * + * @return the translatedAddress value + */ + public String translatedAddress() { + return this.translatedAddress; + } + + /** + * Set the translated address for this NAT rule. + * + * @param translatedAddress the translatedAddress value to set + * @return the FirewallPolicyNatRule object itself. + */ + public FirewallPolicyNatRule withTranslatedAddress(String translatedAddress) { + this.translatedAddress = translatedAddress; + return this; + } + + /** + * Get the translated port for this NAT rule. + * + * @return the translatedPort value + */ + public String translatedPort() { + return this.translatedPort; + } + + /** + * Set the translated port for this NAT rule. + * + * @param translatedPort the translatedPort value to set + * @return the FirewallPolicyNatRule object itself. + */ + public FirewallPolicyNatRule withTranslatedPort(String translatedPort) { + this.translatedPort = translatedPort; + return this; + } + + /** + * Get the match conditions for incoming traffic. + * + * @return the ruleCondition value + */ + public FirewallPolicyRuleCondition ruleCondition() { + return this.ruleCondition; + } + + /** + * Set the match conditions for incoming traffic. + * + * @param ruleCondition the ruleCondition value to set + * @return the FirewallPolicyNatRule object itself. + */ + public FirewallPolicyNatRule withRuleCondition(FirewallPolicyRuleCondition ruleCondition) { + this.ruleCondition = ruleCondition; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleAction.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleAction.java new file mode 100644 index 000000000000..e7b7760d891f --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleAction.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the FirewallPolicyNatRuleAction. + */ +public class FirewallPolicyNatRuleAction { + /** + * The type of action. Possible values include: 'DNAT', 'SNAT'. + */ + @JsonProperty(value = "type") + private FirewallPolicyNatRuleActionType type; + + /** + * Get the type of action. Possible values include: 'DNAT', 'SNAT'. + * + * @return the type value + */ + public FirewallPolicyNatRuleActionType type() { + return this.type; + } + + /** + * Set the type of action. Possible values include: 'DNAT', 'SNAT'. + * + * @param type the type value to set + * @return the FirewallPolicyNatRuleAction object itself. + */ + public FirewallPolicyNatRuleAction withType(FirewallPolicyNatRuleActionType type) { + this.type = type; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleActionType.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleActionType.java new file mode 100644 index 000000000000..38137eead757 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleActionType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FirewallPolicyNatRuleActionType. + */ +public final class FirewallPolicyNatRuleActionType extends ExpandableStringEnum { + /** Static value DNAT for FirewallPolicyNatRuleActionType. */ + public static final FirewallPolicyNatRuleActionType DNAT = fromString("DNAT"); + + /** Static value SNAT for FirewallPolicyNatRuleActionType. */ + public static final FirewallPolicyNatRuleActionType SNAT = fromString("SNAT"); + + /** + * Creates or finds a FirewallPolicyNatRuleActionType from its string representation. + * @param name a name to look for + * @return the corresponding FirewallPolicyNatRuleActionType + */ + @JsonCreator + public static FirewallPolicyNatRuleActionType fromString(String name) { + return fromString(name, FirewallPolicyNatRuleActionType.class); + } + + /** + * @return known FirewallPolicyNatRuleActionType values + */ + public static Collection values() { + return values(FirewallPolicyNatRuleActionType.class); + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRule.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRule.java new file mode 100644 index 000000000000..d44082c64d72 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRule.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Properties of the rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType", defaultImpl = FirewallPolicyRule.class) +@JsonTypeName("FirewallPolicyRule") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "FirewallPolicyNatRule", value = FirewallPolicyNatRule.class), + @JsonSubTypes.Type(name = "FirewallPolicyFilterRule", value = FirewallPolicyFilterRule.class) +}) +public class FirewallPolicyRule { + /** + * Name of the Rule. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Priority of the Firewall Policy Rule resource. + */ + @JsonProperty(value = "priority") + private Integer priority; + + /** + * Get name of the Rule. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the Rule. + * + * @param name the name value to set + * @return the FirewallPolicyRule object itself. + */ + public FirewallPolicyRule withName(String name) { + this.name = name; + return this; + } + + /** + * Get priority of the Firewall Policy Rule resource. + * + * @return the priority value + */ + public Integer priority() { + return this.priority; + } + + /** + * Set priority of the Firewall Policy Rule resource. + * + * @param priority the priority value to set + * @return the FirewallPolicyRule object itself. + */ + public FirewallPolicyRule withPriority(Integer priority) { + this.priority = priority; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleCondition.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleCondition.java new file mode 100644 index 000000000000..83baae2c4846 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleCondition.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Properties of a rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleConditionType", defaultImpl = FirewallPolicyRuleCondition.class) +@JsonTypeName("FirewallPolicyRuleCondition") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ApplicationRuleCondition", value = ApplicationRuleCondition.class), + @JsonSubTypes.Type(name = "NetworkRuleCondition", value = NetworkRuleCondition.class) +}) +public class FirewallPolicyRuleCondition { + /** + * Name of the rule condition. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Description of the rule condition. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get name of the rule condition. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the rule condition. + * + * @param name the name value to set + * @return the FirewallPolicyRuleCondition object itself. + */ + public FirewallPolicyRuleCondition withName(String name) { + this.name = name; + return this; + } + + /** + * Get description of the rule condition. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the rule condition. + * + * @param description the description value to set + * @return the FirewallPolicyRuleCondition object itself. + */ + public FirewallPolicyRuleCondition withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocol.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocol.java new file mode 100644 index 000000000000..f73a53d6ae11 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocol.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the application rule protocol. + */ +public class FirewallPolicyRuleConditionApplicationProtocol { + /** + * Protocol type. Possible values include: 'Http', 'Https'. + */ + @JsonProperty(value = "protocolType") + private FirewallPolicyRuleConditionApplicationProtocolType protocolType; + + /** + * Port number for the protocol, cannot be greater than 64000. + */ + @JsonProperty(value = "port") + private Integer port; + + /** + * Get protocol type. Possible values include: 'Http', 'Https'. + * + * @return the protocolType value + */ + public FirewallPolicyRuleConditionApplicationProtocolType protocolType() { + return this.protocolType; + } + + /** + * Set protocol type. Possible values include: 'Http', 'Https'. + * + * @param protocolType the protocolType value to set + * @return the FirewallPolicyRuleConditionApplicationProtocol object itself. + */ + public FirewallPolicyRuleConditionApplicationProtocol withProtocolType(FirewallPolicyRuleConditionApplicationProtocolType protocolType) { + this.protocolType = protocolType; + return this; + } + + /** + * Get port number for the protocol, cannot be greater than 64000. + * + * @return the port value + */ + public Integer port() { + return this.port; + } + + /** + * Set port number for the protocol, cannot be greater than 64000. + * + * @param port the port value to set + * @return the FirewallPolicyRuleConditionApplicationProtocol object itself. + */ + public FirewallPolicyRuleConditionApplicationProtocol withPort(Integer port) { + this.port = port; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocolType.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocolType.java new file mode 100644 index 000000000000..637b75d7b7fe --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocolType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FirewallPolicyRuleConditionApplicationProtocolType. + */ +public final class FirewallPolicyRuleConditionApplicationProtocolType extends ExpandableStringEnum { + /** Static value Http for FirewallPolicyRuleConditionApplicationProtocolType. */ + public static final FirewallPolicyRuleConditionApplicationProtocolType HTTP = fromString("Http"); + + /** Static value Https for FirewallPolicyRuleConditionApplicationProtocolType. */ + public static final FirewallPolicyRuleConditionApplicationProtocolType HTTPS = fromString("Https"); + + /** + * Creates or finds a FirewallPolicyRuleConditionApplicationProtocolType from its string representation. + * @param name a name to look for + * @return the corresponding FirewallPolicyRuleConditionApplicationProtocolType + */ + @JsonCreator + public static FirewallPolicyRuleConditionApplicationProtocolType fromString(String name) { + return fromString(name, FirewallPolicyRuleConditionApplicationProtocolType.class); + } + + /** + * @return known FirewallPolicyRuleConditionApplicationProtocolType values + */ + public static Collection values() { + return values(FirewallPolicyRuleConditionApplicationProtocolType.class); + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionNetworkProtocol.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionNetworkProtocol.java new file mode 100644 index 000000000000..47f4c457dd62 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionNetworkProtocol.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FirewallPolicyRuleConditionNetworkProtocol. + */ +public final class FirewallPolicyRuleConditionNetworkProtocol extends ExpandableStringEnum { + /** Static value TCP for FirewallPolicyRuleConditionNetworkProtocol. */ + public static final FirewallPolicyRuleConditionNetworkProtocol TCP = fromString("TCP"); + + /** Static value UDP for FirewallPolicyRuleConditionNetworkProtocol. */ + public static final FirewallPolicyRuleConditionNetworkProtocol UDP = fromString("UDP"); + + /** Static value Any for FirewallPolicyRuleConditionNetworkProtocol. */ + public static final FirewallPolicyRuleConditionNetworkProtocol ANY = fromString("Any"); + + /** Static value ICMP for FirewallPolicyRuleConditionNetworkProtocol. */ + public static final FirewallPolicyRuleConditionNetworkProtocol ICMP = fromString("ICMP"); + + /** + * Creates or finds a FirewallPolicyRuleConditionNetworkProtocol from its string representation. + * @param name a name to look for + * @return the corresponding FirewallPolicyRuleConditionNetworkProtocol + */ + @JsonCreator + public static FirewallPolicyRuleConditionNetworkProtocol fromString(String name) { + return fromString(name, FirewallPolicyRuleConditionNetworkProtocol.class); + } + + /** + * @return known FirewallPolicyRuleConditionNetworkProtocol values + */ + public static Collection values() { + return values(FirewallPolicyRuleConditionNetworkProtocol.class); + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroup.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroup.java new file mode 100644 index 000000000000..665cbba3a074 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroup.java @@ -0,0 +1,229 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.network.v2019_06_01.implementation.FirewallPolicyRuleGroupInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.network.v2019_06_01.implementation.NetworkManager; +import java.util.List; + +/** + * Type representing FirewallPolicyRuleGroup. + */ +public interface FirewallPolicyRuleGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the priority value. + */ + Integer priority(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the rules value. + */ + List rules(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the FirewallPolicyRuleGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithFirewallPolicy, DefinitionStages.WithCreate { + } + + /** + * Grouping of FirewallPolicyRuleGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a FirewallPolicyRuleGroup definition. + */ + interface Blank extends WithFirewallPolicy { + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify FirewallPolicy. + */ + interface WithFirewallPolicy { + /** + * Specifies resourceGroupName, firewallPolicyName. + * @param resourceGroupName The name of the resource group + * @param firewallPolicyName The name of the Firewall Policy + * @return the next definition stage + */ + WithCreate withExistingFirewallPolicy(String resourceGroupName, String firewallPolicyName); + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify Id. + */ + interface WithId { + /** + * Specifies id. + * @param id Resource ID + * @return the next definition stage + */ + WithCreate withId(String id); + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Gets name of the resource that is unique within a resource group. This name can be used to access the resource + * @return the next definition stage + */ + WithCreate withName(String name); + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify Priority. + */ + interface WithPriority { + /** + * Specifies priority. + * @param priority Priority of the Firewall Policy Rule Group resource + * @return the next definition stage + */ + WithCreate withPriority(Integer priority); + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify Rules. + */ + interface WithRules { + /** + * Specifies rules. + * @param rules Group of Firewall Policy rules + * @return the next definition stage + */ + WithCreate withRules(List rules); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithId, DefinitionStages.WithName, DefinitionStages.WithPriority, DefinitionStages.WithProvisioningState, DefinitionStages.WithRules { + } + } + /** + * The template for a FirewallPolicyRuleGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithId, UpdateStages.WithName, UpdateStages.WithPriority, UpdateStages.WithProvisioningState, UpdateStages.WithRules { + } + + /** + * Grouping of FirewallPolicyRuleGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the firewallpolicyrulegroup update allowing to specify Id. + */ + interface WithId { + /** + * Specifies id. + * @param id Resource ID + * @return the next update stage + */ + Update withId(String id); + } + + /** + * The stage of the firewallpolicyrulegroup update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Gets name of the resource that is unique within a resource group. This name can be used to access the resource + * @return the next update stage + */ + Update withName(String name); + } + + /** + * The stage of the firewallpolicyrulegroup update allowing to specify Priority. + */ + interface WithPriority { + /** + * Specifies priority. + * @param priority Priority of the Firewall Policy Rule Group resource + * @return the next update stage + */ + Update withPriority(Integer priority); + } + + /** + * The stage of the firewallpolicyrulegroup update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningState provisioningState); + } + + /** + * The stage of the firewallpolicyrulegroup update allowing to specify Rules. + */ + interface WithRules { + /** + * Specifies rules. + * @param rules Group of Firewall Policy rules + * @return the next update stage + */ + Update withRules(List rules); + } + + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroups.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroups.java new file mode 100644 index 000000000000..75ddbc77f160 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroups.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.network.v2019_06_01.implementation.FirewallPolicyRuleGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing FirewallPolicyRuleGroups. + */ +public interface FirewallPolicyRuleGroups extends SupportsCreating, HasInner { + /** + * Gets the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName); + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String firewallPolicyName); + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName); + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/HubIPAddresses.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/HubIPAddresses.java new file mode 100644 index 000000000000..b43f1237a6c7 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/HubIPAddresses.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * IP addresses associated with azure firewall. + */ +public class HubIPAddresses { + /** + * List of Public IP addresses associated with azure firewall. + */ + @JsonProperty(value = "publicIPAddresses") + private List publicIPAddresses; + + /** + * Private IP Address associated with azure firewall. + */ + @JsonProperty(value = "privateIPAddress") + private String privateIPAddress; + + /** + * Get list of Public IP addresses associated with azure firewall. + * + * @return the publicIPAddresses value + */ + public List publicIPAddresses() { + return this.publicIPAddresses; + } + + /** + * Set list of Public IP addresses associated with azure firewall. + * + * @param publicIPAddresses the publicIPAddresses value to set + * @return the HubIPAddresses object itself. + */ + public HubIPAddresses withPublicIPAddresses(List publicIPAddresses) { + this.publicIPAddresses = publicIPAddresses; + return this; + } + + /** + * Get private IP Address associated with azure firewall. + * + * @return the privateIPAddress value + */ + public String privateIPAddress() { + return this.privateIPAddress; + } + + /** + * Set private IP Address associated with azure firewall. + * + * @param privateIPAddress the privateIPAddress value to set + * @return the HubIPAddresses object itself. + */ + public HubIPAddresses withPrivateIPAddress(String privateIPAddress) { + this.privateIPAddress = privateIPAddress; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/NetworkRuleCondition.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/NetworkRuleCondition.java new file mode 100644 index 000000000000..b69f1b4fb70d --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/NetworkRuleCondition.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Rule condition of type network. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleConditionType", defaultImpl = NetworkRuleCondition.class) +@JsonTypeName("NetworkRuleCondition") +public class NetworkRuleCondition extends FirewallPolicyRuleCondition { + /** + * Array of FirewallPolicyRuleConditionNetworkProtocols. + */ + @JsonProperty(value = "ipProtocols") + private List ipProtocols; + + /** + * List of source IP addresses for this rule. + */ + @JsonProperty(value = "sourceAddresses") + private List sourceAddresses; + + /** + * List of destination IP addresses or Service Tags. + */ + @JsonProperty(value = "destinationAddresses") + private List destinationAddresses; + + /** + * List of destination ports. + */ + @JsonProperty(value = "destinationPorts") + private List destinationPorts; + + /** + * Get array of FirewallPolicyRuleConditionNetworkProtocols. + * + * @return the ipProtocols value + */ + public List ipProtocols() { + return this.ipProtocols; + } + + /** + * Set array of FirewallPolicyRuleConditionNetworkProtocols. + * + * @param ipProtocols the ipProtocols value to set + * @return the NetworkRuleCondition object itself. + */ + public NetworkRuleCondition withIpProtocols(List ipProtocols) { + this.ipProtocols = ipProtocols; + return this; + } + + /** + * Get list of source IP addresses for this rule. + * + * @return the sourceAddresses value + */ + public List sourceAddresses() { + return this.sourceAddresses; + } + + /** + * Set list of source IP addresses for this rule. + * + * @param sourceAddresses the sourceAddresses value to set + * @return the NetworkRuleCondition object itself. + */ + public NetworkRuleCondition withSourceAddresses(List sourceAddresses) { + this.sourceAddresses = sourceAddresses; + return this; + } + + /** + * Get list of destination IP addresses or Service Tags. + * + * @return the destinationAddresses value + */ + public List destinationAddresses() { + return this.destinationAddresses; + } + + /** + * Set list of destination IP addresses or Service Tags. + * + * @param destinationAddresses the destinationAddresses value to set + * @return the NetworkRuleCondition object itself. + */ + public NetworkRuleCondition withDestinationAddresses(List destinationAddresses) { + this.destinationAddresses = destinationAddresses; + return this; + } + + /** + * Get list of destination ports. + * + * @return the destinationPorts value + */ + public List destinationPorts() { + return this.destinationPorts; + } + + /** + * Set list of destination ports. + * + * @param destinationPorts the destinationPorts value to set + * @return the NetworkRuleCondition object itself. + */ + public NetworkRuleCondition withDestinationPorts(List destinationPorts) { + this.destinationPorts = destinationPorts; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpoint.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpoint.java index 2354b744fa94..58eab488ec41 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpoint.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpoint.java @@ -49,7 +49,7 @@ public interface PrivateEndpoint extends HasInner, Resourc /** * @return the provisioningState value. */ - String provisioningState(); + ProvisioningState provisioningState(); /** * @return the subnet value. @@ -84,7 +84,7 @@ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup privateLinkServiceConnections); } + /** + * The stage of the privateendpoint definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the private endpoint. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } + /** * The stage of the privateendpoint definition allowing to specify Subnet. */ @@ -131,13 +143,13 @@ interface WithSubnet { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithEtag, DefinitionStages.WithManualPrivateLinkServiceConnections, DefinitionStages.WithPrivateLinkServiceConnections, DefinitionStages.WithSubnet { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithEtag, DefinitionStages.WithManualPrivateLinkServiceConnections, DefinitionStages.WithPrivateLinkServiceConnections, DefinitionStages.WithProvisioningState, DefinitionStages.WithSubnet { } } /** * The template for a PrivateEndpoint update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEtag, UpdateStages.WithManualPrivateLinkServiceConnections, UpdateStages.WithPrivateLinkServiceConnections, UpdateStages.WithSubnet { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEtag, UpdateStages.WithManualPrivateLinkServiceConnections, UpdateStages.WithPrivateLinkServiceConnections, UpdateStages.WithProvisioningState, UpdateStages.WithSubnet { } /** @@ -150,7 +162,7 @@ interface UpdateStages { interface WithEtag { /** * Specifies etag. - * @param etag Gets a unique read-only string that changes whenever the resource is updated + * @param etag A unique read-only string that changes whenever the resource is updated * @return the next update stage */ Update withEtag(String etag); @@ -180,6 +192,18 @@ interface WithPrivateLinkServiceConnections { Update withPrivateLinkServiceConnections(List privateLinkServiceConnections); } + /** + * The stage of the privateendpoint update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the private endpoint. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningState provisioningState); + } + /** * The stage of the privateendpoint update allowing to specify Subnet. */ diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpointConnection.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpointConnection.java index c24be5c2a812..623399d59cc7 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpointConnection.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpointConnection.java @@ -21,6 +21,11 @@ * Type representing PrivateEndpointConnection. */ public interface PrivateEndpointConnection extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the etag value. + */ + String etag(); + /** * @return the id value. */ @@ -41,10 +46,20 @@ public interface PrivateEndpointConnection extends HasInner, UpdateStages.WithId, UpdateStages.WithName, UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + interface Update extends Appliable, UpdateStages.WithId, UpdateStages.WithName, UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState, UpdateStages.WithProvisioningState { } /** @@ -99,5 +114,17 @@ interface WithPrivateLinkServiceConnectionState { Update withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState); } + /** + * The stage of the privateendpointconnection update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the private endpoint connection. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningState provisioningState); + } + } } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkService.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkService.java index 8c5316610645..aff516f9142d 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkService.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkService.java @@ -70,7 +70,7 @@ public interface PrivateLinkService extends HasInner, R /** * @return the provisioningState value. */ - String provisioningState(); + ProvisioningState provisioningState(); /** * @return the visibility value. @@ -117,7 +117,7 @@ interface WithAutoApproval { interface WithEtag { /** * Specifies etag. - * @param etag Gets a unique read-only string that changes whenever the resource is updated + * @param etag A unique read-only string that changes whenever the resource is updated * @return the next definition stage */ WithCreate withEtag(String etag); @@ -171,6 +171,18 @@ interface WithPrivateEndpointConnections { WithCreate withPrivateEndpointConnections(List privateEndpointConnections); } + /** + * The stage of the privatelinkservice definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the private link service. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } + /** * The stage of the privatelinkservice definition allowing to specify Visibility. */ @@ -188,13 +200,13 @@ interface WithVisibility { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAutoApproval, DefinitionStages.WithEtag, DefinitionStages.WithFqdns, DefinitionStages.WithIpConfigurations, DefinitionStages.WithLoadBalancerFrontendIpConfigurations, DefinitionStages.WithPrivateEndpointConnections, DefinitionStages.WithVisibility { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAutoApproval, DefinitionStages.WithEtag, DefinitionStages.WithFqdns, DefinitionStages.WithIpConfigurations, DefinitionStages.WithLoadBalancerFrontendIpConfigurations, DefinitionStages.WithPrivateEndpointConnections, DefinitionStages.WithProvisioningState, DefinitionStages.WithVisibility { } } /** * The template for a PrivateLinkService update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAutoApproval, UpdateStages.WithEtag, UpdateStages.WithFqdns, UpdateStages.WithIpConfigurations, UpdateStages.WithLoadBalancerFrontendIpConfigurations, UpdateStages.WithPrivateEndpointConnections, UpdateStages.WithVisibility { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAutoApproval, UpdateStages.WithEtag, UpdateStages.WithFqdns, UpdateStages.WithIpConfigurations, UpdateStages.WithLoadBalancerFrontendIpConfigurations, UpdateStages.WithPrivateEndpointConnections, UpdateStages.WithProvisioningState, UpdateStages.WithVisibility { } /** @@ -219,7 +231,7 @@ interface WithAutoApproval { interface WithEtag { /** * Specifies etag. - * @param etag Gets a unique read-only string that changes whenever the resource is updated + * @param etag A unique read-only string that changes whenever the resource is updated * @return the next update stage */ Update withEtag(String etag); @@ -273,6 +285,18 @@ interface WithPrivateEndpointConnections { Update withPrivateEndpointConnections(List privateEndpointConnections); } + /** + * The stage of the privatelinkservice update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the private link service. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningState provisioningState); + } + /** * The stage of the privatelinkservice update allowing to specify Visibility. */ diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceConnection.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceConnection.java index 48acebdc7ee4..459674eb0867 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceConnection.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceConnection.java @@ -18,6 +18,13 @@ */ @JsonFlatten public class PrivateLinkServiceConnection extends SubResource { + /** + * The provisioning state of the private link service connection. Possible + * values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + /** * The resource id of private link service. */ @@ -52,6 +59,38 @@ public class PrivateLinkServiceConnection extends SubResource { @JsonProperty(value = "name") private String name; + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the provisioning state of the private link service connection. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the private link service connection. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the PrivateLinkServiceConnection object itself. + */ + public PrivateLinkServiceConnection withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + /** * Get the resource id of private link service. * @@ -152,4 +191,22 @@ public PrivateLinkServiceConnection withName(String name) { return this; } + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get a unique read-only string that changes whenever the resource is updated. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceIpConfiguration.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceIpConfiguration.java index 6869bc0cf203..4a7109f4bfaa 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceIpConfiguration.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceIpConfiguration.java @@ -9,15 +9,15 @@ package com.microsoft.azure.management.network.v2019_06_01; import com.microsoft.azure.management.network.v2019_06_01.implementation.SubnetInner; -import com.microsoft.azure.management.network.v2019_06_01.implementation.PublicIPAddressInner; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.SubResource; /** * The private link service ip configuration. */ @JsonFlatten -public class PrivateLinkServiceIpConfiguration { +public class PrivateLinkServiceIpConfiguration extends SubResource { /** * The private IP address of the IP configuration. */ @@ -38,17 +38,17 @@ public class PrivateLinkServiceIpConfiguration { private SubnetInner subnet; /** - * The reference of the public IP resource. + * Whether the ip configuration is primary or not. */ - @JsonProperty(value = "properties.publicIPAddress") - private PublicIPAddressInner publicIPAddress; + @JsonProperty(value = "properties.primary") + private Boolean primary; /** - * Gets the provisioning state of the public IP resource. Possible values - * are: 'Updating', 'Deleting', and 'Failed'. + * The provisioning state of the private link service ip configuration. + * Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. */ @JsonProperty(value = "properties.provisioningState") - private String provisioningState; + private ProvisioningState provisioningState; /** * Available from Api-Version 2016-03-30 onwards, it represents whether the @@ -64,6 +64,18 @@ public class PrivateLinkServiceIpConfiguration { @JsonProperty(value = "name") private String name; + /** + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + /** * Get the private IP address of the IP configuration. * @@ -125,41 +137,41 @@ public PrivateLinkServiceIpConfiguration withSubnet(SubnetInner subnet) { } /** - * Get the reference of the public IP resource. + * Get whether the ip configuration is primary or not. * - * @return the publicIPAddress value + * @return the primary value */ - public PublicIPAddressInner publicIPAddress() { - return this.publicIPAddress; + public Boolean primary() { + return this.primary; } /** - * Set the reference of the public IP resource. + * Set whether the ip configuration is primary or not. * - * @param publicIPAddress the publicIPAddress value to set + * @param primary the primary value to set * @return the PrivateLinkServiceIpConfiguration object itself. */ - public PrivateLinkServiceIpConfiguration withPublicIPAddress(PublicIPAddressInner publicIPAddress) { - this.publicIPAddress = publicIPAddress; + public PrivateLinkServiceIpConfiguration withPrimary(Boolean primary) { + this.primary = primary; return this; } /** - * Get gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * Get the provisioning state of the private link service ip configuration. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. * * @return the provisioningState value */ - public String provisioningState() { + public ProvisioningState provisioningState() { return this.provisioningState; } /** - * Set gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * Set the provisioning state of the private link service ip configuration. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. * * @param provisioningState the provisioningState value to set * @return the PrivateLinkServiceIpConfiguration object itself. */ - public PrivateLinkServiceIpConfiguration withProvisioningState(String provisioningState) { + public PrivateLinkServiceIpConfiguration withProvisioningState(ProvisioningState provisioningState) { this.provisioningState = provisioningState; return this; } @@ -204,4 +216,22 @@ public PrivateLinkServiceIpConfiguration withName(String name) { return this; } + /** + * Get a unique read-only string that changes whenever the resource is updated. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PublicIPPrefix.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PublicIPPrefix.java index 651a29a4f093..df05289ea5c0 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PublicIPPrefix.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PublicIPPrefix.java @@ -19,6 +19,7 @@ import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.network.v2019_06_01.implementation.NetworkManager; import java.util.List; +import com.microsoft.azure.SubResource; import com.microsoft.azure.management.network.v2019_06_01.implementation.PublicIPPrefixInner; /** @@ -40,6 +41,11 @@ public interface PublicIPPrefix extends HasInner, Resource, */ List ipTags(); + /** + * @return the loadBalancerFrontendIpConfiguration value. + */ + SubResource loadBalancerFrontendIpConfiguration(); + /** * @return the prefixLength value. */ diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ServiceTags.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ServiceTags.java index 3b5456c2c4ff..2c8a63d707a5 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ServiceTags.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ServiceTags.java @@ -19,7 +19,7 @@ public interface ServiceTags extends HasInner { /** * Gets a list of service tag information resources. * - * @param location The location. + * @param location The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/Subnets.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/Subnets.java index 40695f84f6dd..0822a5a7db6b 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/Subnets.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/Subnets.java @@ -30,6 +30,17 @@ public interface Subnets extends SupportsCreating */ Completable prepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, PrepareNetworkPoliciesRequest prepareNetworkPoliciesRequestParameters); + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable unprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName); + /** * Gets the specified subnet by virtual network and resource group. * diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/UnprepareNetworkPoliciesRequest.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/UnprepareNetworkPoliciesRequest.java new file mode 100644 index 000000000000..73db7523285e --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/UnprepareNetworkPoliciesRequest.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of UnprepareNetworkPolicies for Subnet. + */ +public class UnprepareNetworkPoliciesRequest { + /** + * The name of the service for which subnet is being unprepared for. + */ + @JsonProperty(value = "serviceName") + private String serviceName; + + /** + * Get the name of the service for which subnet is being unprepared for. + * + * @return the serviceName value + */ + public String serviceName() { + return this.serviceName; + } + + /** + * Set the name of the service for which subnet is being unprepared for. + * + * @param serviceName the serviceName value to set + * @return the UnprepareNetworkPoliciesRequest object itself. + */ + public UnprepareNetworkPoliciesRequest withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysImpl.java index 84712071560c..22b2f3d4ee74 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysImpl.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysImpl.java @@ -106,13 +106,13 @@ public ApplicationGateway call(ApplicationGatewayInner inner) { @Override public PagedList list() { ApplicationGatewaysInner client = this.inner(); - return this.wrapList(client.listAll()); + return this.wrapList(client.list()); } @Override public Observable listAsync() { ApplicationGatewaysInner client = this.inner(); - return client.listAllAsync() + return client.listAsync() .flatMapIterable(new Func1, Iterable>() { @Override public Iterable call(Page page) { diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysInner.java index c7213cbcb0b8..fa09ea989dc4 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysInner.java @@ -10,6 +10,7 @@ import com.microsoft.azure.arm.collection.InnerSupportsGet; import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; @@ -44,14 +45,12 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined * in ApplicationGateways. */ -public class ApplicationGatewaysInner implements InnerSupportsGet, InnerSupportsDelete { +public class ApplicationGatewaysInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { /** The Retrofit service to perform REST calls. */ private ApplicationGatewaysService service; /** The service client containing this operation class. */ @@ -105,9 +104,9 @@ interface ApplicationGatewaysService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways") Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways listAll" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways list" }) @GET("subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways") - Observable> listAll(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways start" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start") @@ -173,9 +172,9 @@ interface ApplicationGatewaysService { @GET Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways listAllNext" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways listNext" }) @GET - Observable> listAllNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways listAvailableSslPredefinedPoliciesNext" }) @GET @@ -1021,12 +1020,12 @@ private ServiceResponse> listByResourceGroupDe * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<ApplicationGatewayInner> object if successful. */ - public PagedList listAll() { - ServiceResponse> response = listAllSinglePageAsync().toBlocking().single(); + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listAllNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -1038,13 +1037,13 @@ public Page nextPage(String nextPageLink) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listAllAsync(final ListOperationCallback serviceCallback) { + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listAllSinglePageAsync(), + listSinglePageAsync(), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listAllNextSinglePageAsync(nextPageLink); + return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); @@ -1056,8 +1055,8 @@ public Observable>> call(String ne * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ApplicationGatewayInner> object */ - public Observable> listAllAsync() { - return listAllWithServiceResponseAsync() + public Observable> listAsync() { + return listWithServiceResponseAsync() .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -1072,8 +1071,8 @@ public Page call(ServiceResponse>> listAllWithServiceResponseAsync() { - return listAllSinglePageAsync() + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -1081,7 +1080,7 @@ public Observable>> call(ServiceRe if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listAllNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } @@ -1092,17 +1091,17 @@ public Observable>> call(ServiceRe * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ApplicationGatewayInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listAllSinglePageAsync() { + public Observable>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2019-06-01"; - return service.listAll(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listAllDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1111,7 +1110,7 @@ public Observable>> call(Response< }); } - private ServiceResponse> listAllDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) @@ -2712,12 +2711,12 @@ private ServiceResponse> listByResourceGroupNe * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<ApplicationGatewayInner> object if successful. */ - public PagedList listAllNext(final String nextPageLink) { - ServiceResponse> response = listAllNextSinglePageAsync(nextPageLink).toBlocking().single(); + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listAllNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -2731,13 +2730,13 @@ public Page nextPage(String nextPageLink) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listAllNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listAllNextSinglePageAsync(nextPageLink), + listNextSinglePageAsync(nextPageLink), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listAllNextSinglePageAsync(nextPageLink); + return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); @@ -2750,8 +2749,8 @@ public Observable>> call(String ne * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ApplicationGatewayInner> object */ - public Observable> listAllNextAsync(final String nextPageLink) { - return listAllNextWithServiceResponseAsync(nextPageLink) + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -2767,8 +2766,8 @@ public Page call(ServiceResponse>> listAllNextWithServiceResponseAsync(final String nextPageLink) { - return listAllNextSinglePageAsync(nextPageLink) + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -2776,7 +2775,7 @@ public Observable>> call(ServiceRe if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listAllNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } @@ -2788,17 +2787,17 @@ public Observable>> call(ServiceRe * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ApplicationGatewayInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listAllNextSinglePageAsync(final String nextPageLink) { + public Observable>> listNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } String nextUrl = String.format("%s", nextPageLink); - return service.listAllNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listAllNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -2807,7 +2806,7 @@ public Observable>> call(Response< }); } - private ServiceResponse> listAllNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallImpl.java index 1a54dcc1a582..8728726bb8a4 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallImpl.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallImpl.java @@ -18,6 +18,8 @@ import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallIPConfiguration; import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallThreatIntelMode; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.network.v2019_06_01.HubIPAddresses; class AzureFirewallImpl extends GroupableResourceCoreImpl implements AzureFirewall, AzureFirewall.Definition, AzureFirewall.Update { AzureFirewallImpl(String name, AzureFirewallInner inner, NetworkManager manager) { @@ -60,6 +62,16 @@ public String etag() { return this.inner().etag(); } + @Override + public SubResource firewallPolicy() { + return this.inner().firewallPolicy(); + } + + @Override + public HubIPAddresses hubIpAddresses() { + return this.inner().hubIpAddresses(); + } + @Override public List ipConfigurations() { return this.inner().ipConfigurations(); @@ -85,6 +97,11 @@ public AzureFirewallThreatIntelMode threatIntelMode() { return this.inner().threatIntelMode(); } + @Override + public SubResource virtualHub() { + return this.inner().virtualHub(); + } + @Override public List zones() { return this.inner().zones(); @@ -96,6 +113,12 @@ public AzureFirewallImpl withApplicationRuleCollections(List ipConfigurations) { this.inner().withIpConfigurations(ipConfigurations); @@ -126,6 +149,12 @@ public AzureFirewallImpl withThreatIntelMode(AzureFirewallThreatIntelMode threat return this; } + @Override + public AzureFirewallImpl withVirtualHub(SubResource virtualHub) { + this.inner().withVirtualHub(virtualHub); + return this; + } + @Override public AzureFirewallImpl withZones(List zones) { this.inner().withZones(zones); diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallInner.java index 4d813f99f13d..8c4d2c4c3ec9 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallInner.java @@ -15,6 +15,8 @@ import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallIPConfiguration; import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallThreatIntelMode; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.network.v2019_06_01.HubIPAddresses; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.rest.SkipParentValidation; @@ -64,6 +66,24 @@ public class AzureFirewallInner extends Resource { @JsonProperty(value = "properties.threatIntelMode") private AzureFirewallThreatIntelMode threatIntelMode; + /** + * The virtualHub to which the firewall belongs. + */ + @JsonProperty(value = "properties.virtualHub") + private SubResource virtualHub; + + /** + * The firewallPolicy associated with this azure firewall. + */ + @JsonProperty(value = "properties.firewallPolicy") + private SubResource firewallPolicy; + + /** + * IP addresses associated with AzureFirewall. + */ + @JsonProperty(value = "properties.hubIpAddresses", access = JsonProperty.Access.WRITE_ONLY) + private HubIPAddresses hubIpAddresses; + /** * A list of availability zones denoting where the resource needs to come * from. @@ -204,6 +224,55 @@ public AzureFirewallInner withThreatIntelMode(AzureFirewallThreatIntelMode threa return this; } + /** + * Get the virtualHub to which the firewall belongs. + * + * @return the virtualHub value + */ + public SubResource virtualHub() { + return this.virtualHub; + } + + /** + * Set the virtualHub to which the firewall belongs. + * + * @param virtualHub the virtualHub value to set + * @return the AzureFirewallInner object itself. + */ + public AzureFirewallInner withVirtualHub(SubResource virtualHub) { + this.virtualHub = virtualHub; + return this; + } + + /** + * Get the firewallPolicy associated with this azure firewall. + * + * @return the firewallPolicy value + */ + public SubResource firewallPolicy() { + return this.firewallPolicy; + } + + /** + * Set the firewallPolicy associated with this azure firewall. + * + * @param firewallPolicy the firewallPolicy value to set + * @return the AzureFirewallInner object itself. + */ + public AzureFirewallInner withFirewallPolicy(SubResource firewallPolicy) { + this.firewallPolicy = firewallPolicy; + return this; + } + + /** + * Get iP addresses associated with AzureFirewall. + * + * @return the hubIpAddresses value + */ + public HubIPAddresses hubIpAddresses() { + return this.hubIpAddresses; + } + /** * Get a list of availability zones denoting where the resource needs to come from. * diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ConnectionMonitorsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ConnectionMonitorsInner.java index 268f86843902..a6211edc5dbd 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ConnectionMonitorsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ConnectionMonitorsInner.java @@ -32,8 +32,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCircuitsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCircuitsInner.java index 88a1f8304595..9f9fa1eee4a7 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCircuitsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCircuitsInner.java @@ -43,8 +43,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCrossConnectionsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCrossConnectionsInner.java index 75c4e3fb8e65..e290547d5731 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCrossConnectionsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCrossConnectionsInner.java @@ -41,8 +41,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesImpl.java new file mode 100644 index 000000000000..b7e135790bc0 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesImpl.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicy; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class FirewallPoliciesImpl extends GroupableResourcesCoreImpl implements FirewallPolicies { + protected FirewallPoliciesImpl(NetworkManager manager) { + super(manager.inner().firewallPolicies(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + FirewallPoliciesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + FirewallPoliciesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + FirewallPoliciesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + FirewallPoliciesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public FirewallPolicy call(FirewallPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + FirewallPoliciesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + FirewallPoliciesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public FirewallPolicy call(FirewallPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public FirewallPolicyImpl define(String name) { + return wrapModel(name); + } + + @Override + protected FirewallPolicyImpl wrapModel(FirewallPolicyInner inner) { + return new FirewallPolicyImpl(inner.name(), inner, manager()); + } + + @Override + protected FirewallPolicyImpl wrapModel(String name) { + return new FirewallPolicyImpl(name, new FirewallPolicyInner(), this.manager()); + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesInner.java new file mode 100644 index 000000000000..6463ff23fea8 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesInner.java @@ -0,0 +1,1209 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.network.v2019_06_01.ErrorException; +import com.microsoft.azure.management.network.v2019_06_01.TagsObject; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in FirewallPolicies. + */ +public class FirewallPoliciesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private FirewallPoliciesService service; + /** The service client containing this operation class. */ + private NetworkManagementClientImpl client; + + /** + * Initializes an instance of FirewallPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FirewallPoliciesInner(Retrofit retrofit, NetworkManagementClientImpl client) { + this.service = retrofit.create(FirewallPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for FirewallPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface FirewallPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies updateTags" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") + Observable> updateTags(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsObject firewallPolicyParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Body FirewallPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Body FirewallPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String firewallPolicyName) { + deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().last().body(); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String firewallPolicyName) { + return deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + Observable> observable = service.delete(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String firewallPolicyName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().single().body(); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String firewallPolicyName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.beginDelete(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner getByResourceGroup(String resourceGroupName, String firewallPolicyName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().single().body(); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + final String expand = null; + return service.getByResourceGroup(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param expand Expands referenced resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner getByResourceGroup(String resourceGroupName, String firewallPolicyName, String expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName, expand).toBlocking().single().body(); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param expand Expands referenced resources. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName, expand), serviceCallback); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param expand Expands referenced resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName, String expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName, expand).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param expand Expands referenced resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String expand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.getByResourceGroup(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner updateTags(String resourceGroupName, String firewallPolicyName) { + return updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().single().body(); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateTagsAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable updateTagsAsync(String resourceGroupName, String firewallPolicyName) { + return updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable> updateTagsWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + final Map tags = null; + TagsObject firewallPolicyParameters = new TagsObject(); + firewallPolicyParameters.withTags(null); + return service.updateTags(this.client.subscriptionId(), resourceGroupName, firewallPolicyName, apiVersion, this.client.acceptLanguage(), firewallPolicyParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateTagsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner updateTags(String resourceGroupName, String firewallPolicyName, Map tags) { + return updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName, tags).toBlocking().single().body(); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @param tags Resource tags. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateTagsAsync(String resourceGroupName, String firewallPolicyName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName, tags), serviceCallback); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable updateTagsAsync(String resourceGroupName, String firewallPolicyName, Map tags) { + return updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName, tags).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable> updateTagsWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, Map tags) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2019-06-01"; + TagsObject firewallPolicyParameters = new TagsObject(); + firewallPolicyParameters.withTags(tags); + return service.updateTags(this.client.subscriptionId(), resourceGroupName, firewallPolicyName, apiVersion, this.client.acceptLanguage(), firewallPolicyParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateTagsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateTagsDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner createOrUpdate(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters), serviceCallback); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-06-01"; + Observable> observable = service.createOrUpdate(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner beginCreateOrUpdate(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters), serviceCallback); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-06-01"; + return service.beginCreateOrUpdate(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Firewall Policies in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Firewall Policies in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyImpl.java new file mode 100644 index 000000000000..ba1541abccf9 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyImpl.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicy; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; +import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallThreatIntelMode; + +class FirewallPolicyImpl extends GroupableResourceCoreImpl implements FirewallPolicy, FirewallPolicy.Definition, FirewallPolicy.Update { + FirewallPolicyImpl(String name, FirewallPolicyInner inner, NetworkManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + FirewallPoliciesInner client = this.manager().inner().firewallPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FirewallPoliciesInner client = this.manager().inner().firewallPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FirewallPoliciesInner client = this.manager().inner().firewallPolicies(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public SubResource basePolicy() { + return this.inner().basePolicy(); + } + + @Override + public List childPolicies() { + return this.inner().childPolicies(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public List firewalls() { + return this.inner().firewalls(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public List ruleGroups() { + return this.inner().ruleGroups(); + } + + @Override + public AzureFirewallThreatIntelMode threatIntelMode() { + return this.inner().threatIntelMode(); + } + + @Override + public FirewallPolicyImpl withBasePolicy(SubResource basePolicy) { + this.inner().withBasePolicy(basePolicy); + return this; + } + + @Override + public FirewallPolicyImpl withProvisioningState(ProvisioningState provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public FirewallPolicyImpl withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode) { + this.inner().withThreatIntelMode(threatIntelMode); + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyInner.java new file mode 100644 index 000000000000..48838025c9b2 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyInner.java @@ -0,0 +1,194 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import java.util.List; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; +import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallThreatIntelMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * FirewallPolicy Resource. + */ +@JsonFlatten +@SkipParentValidation +public class FirewallPolicyInner extends Resource { + /** + * List of references to FirewallPolicyRuleGroups. + */ + @JsonProperty(value = "properties.ruleGroups", access = JsonProperty.Access.WRITE_ONLY) + private List ruleGroups; + + /** + * The provisioning state of the resource. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + + /** + * The parent firewall policy from which rules are inherited. + */ + @JsonProperty(value = "properties.basePolicy") + private SubResource basePolicy; + + /** + * List of references to Azure Firewalls that this Firewall Policy is + * associated with. + */ + @JsonProperty(value = "properties.firewalls", access = JsonProperty.Access.WRITE_ONLY) + private List firewalls; + + /** + * List of references to Child Firewall Policies. + */ + @JsonProperty(value = "properties.childPolicies", access = JsonProperty.Access.WRITE_ONLY) + private List childPolicies; + + /** + * The operation mode for Threat Intelligence. Possible values include: + * 'Alert', 'Deny', 'Off'. + */ + @JsonProperty(value = "properties.threatIntelMode") + private AzureFirewallThreatIntelMode threatIntelMode; + + /** + * Gets a unique read-only string that changes whenever the resource is + * updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Resource ID. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get list of references to FirewallPolicyRuleGroups. + * + * @return the ruleGroups value + */ + public List ruleGroups() { + return this.ruleGroups; + } + + /** + * Get the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the FirewallPolicyInner object itself. + */ + public FirewallPolicyInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the parent firewall policy from which rules are inherited. + * + * @return the basePolicy value + */ + public SubResource basePolicy() { + return this.basePolicy; + } + + /** + * Set the parent firewall policy from which rules are inherited. + * + * @param basePolicy the basePolicy value to set + * @return the FirewallPolicyInner object itself. + */ + public FirewallPolicyInner withBasePolicy(SubResource basePolicy) { + this.basePolicy = basePolicy; + return this; + } + + /** + * Get list of references to Azure Firewalls that this Firewall Policy is associated with. + * + * @return the firewalls value + */ + public List firewalls() { + return this.firewalls; + } + + /** + * Get list of references to Child Firewall Policies. + * + * @return the childPolicies value + */ + public List childPolicies() { + return this.childPolicies; + } + + /** + * Get the operation mode for Threat Intelligence. Possible values include: 'Alert', 'Deny', 'Off'. + * + * @return the threatIntelMode value + */ + public AzureFirewallThreatIntelMode threatIntelMode() { + return this.threatIntelMode; + } + + /** + * Set the operation mode for Threat Intelligence. Possible values include: 'Alert', 'Deny', 'Off'. + * + * @param threatIntelMode the threatIntelMode value to set + * @return the FirewallPolicyInner object itself. + */ + public FirewallPolicyInner withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode) { + this.threatIntelMode = threatIntelMode; + return this; + } + + /** + * Get gets a unique read-only string that changes whenever the resource is updated. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get resource ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set resource ID. + * + * @param id the id value to set + * @return the FirewallPolicyInner object itself. + */ + public FirewallPolicyInner withId(String id) { + this.id = id; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupImpl.java new file mode 100644 index 000000000000..3cc084afc3fb --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupImpl.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRule; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; + +class FirewallPolicyRuleGroupImpl extends CreatableUpdatableImpl implements FirewallPolicyRuleGroup, FirewallPolicyRuleGroup.Definition, FirewallPolicyRuleGroup.Update { + private final NetworkManager manager; + private String resourceGroupName; + private String firewallPolicyName; + private String ruleGroupName; + + FirewallPolicyRuleGroupImpl(String name, NetworkManager manager) { + super(name, new FirewallPolicyRuleGroupInner()); + this.manager = manager; + // Set resource name + this.ruleGroupName = name; + // + } + + FirewallPolicyRuleGroupImpl(FirewallPolicyRuleGroupInner inner, NetworkManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.ruleGroupName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.firewallPolicyName = IdParsingUtils.getValueFromIdByName(inner.id(), "firewallPolicies"); + this.ruleGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "ruleGroups"); + // + } + + @Override + public NetworkManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + FirewallPolicyRuleGroupsInner client = this.manager().inner().firewallPolicyRuleGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.firewallPolicyName, this.ruleGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FirewallPolicyRuleGroupsInner client = this.manager().inner().firewallPolicyRuleGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.firewallPolicyName, this.ruleGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FirewallPolicyRuleGroupsInner client = this.manager().inner().firewallPolicyRuleGroups(); + return client.getAsync(this.resourceGroupName, this.firewallPolicyName, this.ruleGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer priority() { + return this.inner().priority(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public List rules() { + return this.inner().rules(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public FirewallPolicyRuleGroupImpl withExistingFirewallPolicy(String resourceGroupName, String firewallPolicyName) { + this.resourceGroupName = resourceGroupName; + this.firewallPolicyName = firewallPolicyName; + return this; + } + + @Override + public FirewallPolicyRuleGroupImpl withId(String id) { + this.inner().withId(id); + return this; + } + + @Override + public FirewallPolicyRuleGroupImpl withName(String name) { + this.inner().withName(name); + return this; + } + + @Override + public FirewallPolicyRuleGroupImpl withPriority(Integer priority) { + this.inner().withPriority(priority); + return this; + } + + @Override + public FirewallPolicyRuleGroupImpl withProvisioningState(ProvisioningState provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public FirewallPolicyRuleGroupImpl withRules(List rules) { + this.inner().withRules(rules); + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupInner.java new file mode 100644 index 000000000000..cd0c9d673f7a --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupInner.java @@ -0,0 +1,160 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRule; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.SubResource; + +/** + * Rule Group resource. + */ +@JsonFlatten +public class FirewallPolicyRuleGroupInner extends SubResource { + /** + * Priority of the Firewall Policy Rule Group resource. + */ + @JsonProperty(value = "properties.priority") + private Integer priority; + + /** + * Group of Firewall Policy rules. + */ + @JsonProperty(value = "properties.rules") + private List rules; + + /** + * The provisioning state of the resource. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + + /** + * Gets name of the resource that is unique within a resource group. This + * name can be used to access the resource. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Gets a unique read-only string that changes whenever the resource is + * updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Rule Group type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get priority of the Firewall Policy Rule Group resource. + * + * @return the priority value + */ + public Integer priority() { + return this.priority; + } + + /** + * Set priority of the Firewall Policy Rule Group resource. + * + * @param priority the priority value to set + * @return the FirewallPolicyRuleGroupInner object itself. + */ + public FirewallPolicyRuleGroupInner withPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get group of Firewall Policy rules. + * + * @return the rules value + */ + public List rules() { + return this.rules; + } + + /** + * Set group of Firewall Policy rules. + * + * @param rules the rules value to set + * @return the FirewallPolicyRuleGroupInner object itself. + */ + public FirewallPolicyRuleGroupInner withRules(List rules) { + this.rules = rules; + return this; + } + + /** + * Get the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the FirewallPolicyRuleGroupInner object itself. + */ + public FirewallPolicyRuleGroupInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get gets name of the resource that is unique within a resource group. This name can be used to access the resource. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set gets name of the resource that is unique within a resource group. This name can be used to access the resource. + * + * @param name the name value to set + * @return the FirewallPolicyRuleGroupInner object itself. + */ + public FirewallPolicyRuleGroupInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get gets a unique read-only string that changes whenever the resource is updated. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get rule Group type. + * + * @return the type value + */ + public String type() { + return this.type; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsImpl.java new file mode 100644 index 000000000000..43e45f050972 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroup; + +class FirewallPolicyRuleGroupsImpl extends WrapperImpl implements FirewallPolicyRuleGroups { + private final NetworkManager manager; + + FirewallPolicyRuleGroupsImpl(NetworkManager manager) { + super(manager.inner().firewallPolicyRuleGroups()); + this.manager = manager; + } + + public NetworkManager manager() { + return this.manager; + } + + @Override + public FirewallPolicyRuleGroupImpl define(String name) { + return wrapModel(name); + } + + private FirewallPolicyRuleGroupImpl wrapModel(FirewallPolicyRuleGroupInner inner) { + return new FirewallPolicyRuleGroupImpl(inner, manager()); + } + + private FirewallPolicyRuleGroupImpl wrapModel(String name) { + return new FirewallPolicyRuleGroupImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String firewallPolicyName) { + FirewallPolicyRuleGroupsInner client = this.inner(); + return client.listAsync(resourceGroupName, firewallPolicyName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public FirewallPolicyRuleGroup call(FirewallPolicyRuleGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + FirewallPolicyRuleGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, firewallPolicyName, ruleGroupName) + .flatMap(new Func1>() { + @Override + public Observable call(FirewallPolicyRuleGroupInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((FirewallPolicyRuleGroup)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + FirewallPolicyRuleGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, firewallPolicyName, ruleGroupName).toCompletable(); + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsInner.java new file mode 100644 index 000000000000..feefe0270181 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsInner.java @@ -0,0 +1,764 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in FirewallPolicyRuleGroups. + */ +public class FirewallPolicyRuleGroupsInner { + /** The Retrofit service to perform REST calls. */ + private FirewallPolicyRuleGroupsService service; + /** The service client containing this operation class. */ + private NetworkManagementClientImpl client; + + /** + * Initializes an instance of FirewallPolicyRuleGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FirewallPolicyRuleGroupsInner(Retrofit retrofit, NetworkManagementClientImpl client) { + this.service = retrofit.create(FirewallPolicyRuleGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for FirewallPolicyRuleGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface FirewallPolicyRuleGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("ruleGroupName") String ruleGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("ruleGroupName") String ruleGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("ruleGroupName") String ruleGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("ruleGroupName") String ruleGroupName, @Path("subscriptionId") String subscriptionId, @Body FirewallPolicyRuleGroupInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("ruleGroupName") String ruleGroupName, @Path("subscriptionId") String subscriptionId, @Body FirewallPolicyRuleGroupInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).toBlocking().last().body(); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName), serviceCallback); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (ruleGroupName == null) { + throw new IllegalArgumentException("Parameter ruleGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + Observable> observable = service.delete(resourceGroupName, firewallPolicyName, ruleGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).toBlocking().single().body(); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName), serviceCallback); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (ruleGroupName == null) { + throw new IllegalArgumentException("Parameter ruleGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.beginDelete(resourceGroupName, firewallPolicyName, ruleGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyRuleGroupInner object if successful. + */ + public FirewallPolicyRuleGroupInner get(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + return getWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).toBlocking().single().body(); + } + + /** + * Gets the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName), serviceCallback); + } + + /** + * Gets the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyRuleGroupInner object + */ + public Observable getAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + return getWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).map(new Func1, FirewallPolicyRuleGroupInner>() { + @Override + public FirewallPolicyRuleGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyRuleGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (ruleGroupName == null) { + throw new IllegalArgumentException("Parameter ruleGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.get(resourceGroupName, firewallPolicyName, ruleGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyRuleGroupInner object if successful. + */ + public FirewallPolicyRuleGroupInner createOrUpdate(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters).map(new Func1, FirewallPolicyRuleGroupInner>() { + @Override + public FirewallPolicyRuleGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (ruleGroupName == null) { + throw new IllegalArgumentException("Parameter ruleGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-06-01"; + Observable> observable = service.createOrUpdate(resourceGroupName, firewallPolicyName, ruleGroupName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyRuleGroupInner object if successful. + */ + public FirewallPolicyRuleGroupInner beginCreateOrUpdate(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyRuleGroupInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters).map(new Func1, FirewallPolicyRuleGroupInner>() { + @Override + public FirewallPolicyRuleGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyRuleGroupInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (ruleGroupName == null) { + throw new IllegalArgumentException("Parameter ruleGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-06-01"; + return service.beginCreateOrUpdate(resourceGroupName, firewallPolicyName, ruleGroupName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyRuleGroupInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String firewallPolicyName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, firewallPolicyName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String firewallPolicyName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, firewallPolicyName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyRuleGroupInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String firewallPolicyName) { + return listWithServiceResponseAsync(resourceGroupName, firewallPolicyName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyRuleGroupInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String firewallPolicyName) { + return listSinglePageAsync(resourceGroupName, firewallPolicyName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyRuleGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String firewallPolicyName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.list(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyRuleGroupInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyRuleGroupInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyRuleGroupInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyRuleGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkInterfacesInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkInterfacesInner.java index 5d44a85c9707..3cc1c17f3dea 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkInterfacesInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkInterfacesInner.java @@ -43,8 +43,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManagementClientImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManagementClientImpl.java index 909b73e1ec0d..cf1caddeff97 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManagementClientImpl.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManagementClientImpl.java @@ -449,6 +449,32 @@ public ExpressRouteLinksInner expressRouteLinks() { return this.expressRouteLinks; } + /** + * The FirewallPoliciesInner object to access its operations. + */ + private FirewallPoliciesInner firewallPolicies; + + /** + * Gets the FirewallPoliciesInner object to access its operations. + * @return the FirewallPoliciesInner object. + */ + public FirewallPoliciesInner firewallPolicies() { + return this.firewallPolicies; + } + + /** + * The FirewallPolicyRuleGroupsInner object to access its operations. + */ + private FirewallPolicyRuleGroupsInner firewallPolicyRuleGroups; + + /** + * Gets the FirewallPolicyRuleGroupsInner object to access its operations. + * @return the FirewallPolicyRuleGroupsInner object. + */ + public FirewallPolicyRuleGroupsInner firewallPolicyRuleGroups() { + return this.firewallPolicyRuleGroups; + } + /** * The LoadBalancersInner object to access its operations. */ @@ -1248,6 +1274,8 @@ protected void initialize() { this.expressRoutePortsLocations = new ExpressRoutePortsLocationsInner(restClient().retrofit(), this); this.expressRoutePorts = new ExpressRoutePortsInner(restClient().retrofit(), this); this.expressRouteLinks = new ExpressRouteLinksInner(restClient().retrofit(), this); + this.firewallPolicies = new FirewallPoliciesInner(restClient().retrofit(), this); + this.firewallPolicyRuleGroups = new FirewallPolicyRuleGroupsInner(restClient().retrofit(), this); this.loadBalancers = new LoadBalancersInner(restClient().retrofit(), this); this.loadBalancerBackendAddressPools = new LoadBalancerBackendAddressPoolsInner(restClient().retrofit(), this); this.loadBalancerFrontendIPConfigurations = new LoadBalancerFrontendIPConfigurationsInner(restClient().retrofit(), this); diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManager.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManager.java index 5a516353d3cd..d8c9edc9370d 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManager.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManager.java @@ -39,6 +39,8 @@ import com.microsoft.azure.management.network.v2019_06_01.ExpressRoutePortsLocations; import com.microsoft.azure.management.network.v2019_06_01.ExpressRoutePorts; import com.microsoft.azure.management.network.v2019_06_01.ExpressRouteLinks; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups; import com.microsoft.azure.management.network.v2019_06_01.LoadBalancers; import com.microsoft.azure.management.network.v2019_06_01.LoadBalancerBackendAddressPools; import com.microsoft.azure.management.network.v2019_06_01.LoadBalancerFrontendIPConfigurations; @@ -126,6 +128,8 @@ public final class NetworkManager extends ManagerCore implements PrivateEndpointConnection, PrivateEndpointConnection.Update { @@ -70,6 +71,11 @@ public boolean isInCreateMode() { } + @Override + public String etag() { + return this.inner().etag(); + } + @Override public String id() { return this.inner().id(); @@ -95,6 +101,16 @@ public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { return this.inner().privateLinkServiceConnectionState(); } + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String type() { + return this.inner().type(); + } + @Override public PrivateEndpointConnectionImpl withId(String id) { this.inner().withId(id); @@ -119,4 +135,10 @@ public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState(Priva return this; } + @Override + public PrivateEndpointConnectionImpl withProvisioningState(ProvisioningState provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointConnectionInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointConnectionInner.java index cb1cf987c683..aee49d0a8a14 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointConnectionInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointConnectionInner.java @@ -9,6 +9,7 @@ package com.microsoft.azure.management.network.v2019_06_01.implementation; import com.microsoft.azure.management.network.v2019_06_01.PrivateLinkServiceConnectionState; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.SubResource; @@ -31,6 +32,13 @@ public class PrivateEndpointConnectionInner extends SubResource { @JsonProperty(value = "properties.privateLinkServiceConnectionState") private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + /** + * The provisioning state of the private endpoint connection. Possible + * values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + /** * The name of the resource that is unique within a resource group. This * name can be used to access the resource. @@ -38,6 +46,18 @@ public class PrivateEndpointConnectionInner extends SubResource { @JsonProperty(value = "name") private String name; + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + /** * Get the resource of private end point. * @@ -78,6 +98,26 @@ public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState(Priv return this; } + /** + * Get the provisioning state of the private endpoint connection. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the private endpoint connection. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + /** * Get the name of the resource that is unique within a resource group. This name can be used to access the resource. * @@ -98,4 +138,22 @@ public PrivateEndpointConnectionInner withName(String name) { return this; } + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get a unique read-only string that changes whenever the resource is updated. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointImpl.java index b9d4f83f9a18..918e9b37cc25 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointImpl.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointImpl.java @@ -12,6 +12,7 @@ import com.microsoft.azure.management.network.v2019_06_01.PrivateEndpoint; import rx.Observable; import java.util.List; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; import com.microsoft.azure.management.network.v2019_06_01.PrivateLinkServiceConnection; import java.util.ArrayList; import com.microsoft.azure.management.network.v2019_06_01.NetworkInterface; @@ -75,7 +76,7 @@ public List privateLinkServiceConnections() { } @Override - public String provisioningState() { + public ProvisioningState provisioningState() { return this.inner().provisioningState(); } @@ -107,6 +108,12 @@ public PrivateEndpointImpl withPrivateLinkServiceConnections(List networkInterfaces; /** - * The provisioning state of the private endpoint. Possible values are: - * 'Updating', 'Deleting', and 'Failed'. + * The provisioning state of the private endpoint. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. */ - @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private String provisioningState; + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; /** * A grouping of information about the connection to the remote resource. @@ -56,8 +57,7 @@ public class PrivateEndpointInner extends Resource { private List manualPrivateLinkServiceConnections; /** - * Gets a unique read-only string that changes whenever the resource is - * updated. + * A unique read-only string that changes whenever the resource is updated. */ @JsonProperty(value = "etag") private String etag; @@ -98,14 +98,25 @@ public List networkInterfaces() { } /** - * Get the provisioning state of the private endpoint. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * Get the provisioning state of the private endpoint. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. * * @return the provisioningState value */ - public String provisioningState() { + public ProvisioningState provisioningState() { return this.provisioningState; } + /** + * Set the provisioning state of the private endpoint. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the PrivateEndpointInner object itself. + */ + public PrivateEndpointInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + /** * Get a grouping of information about the connection to the remote resource. * @@ -147,7 +158,7 @@ public PrivateEndpointInner withManualPrivateLinkServiceConnections(List privateEndpointConnections() { } @Override - public String provisioningState() { + public ProvisioningState provisioningState() { return this.inner().provisioningState(); } @@ -155,6 +156,12 @@ public PrivateLinkServiceImpl withPrivateEndpointConnections(List networkInterfaces; /** - * The provisioning state of the private link service. Possible values are: - * 'Updating', 'Succeeded', and 'Failed'. + * The provisioning state of the private link service. Possible values + * include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. */ - @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private String provisioningState; + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; /** * An array of list about connections to the private endpoint. @@ -80,8 +81,7 @@ public class PrivateLinkServiceInner extends Resource { private String alias; /** - * Gets a unique read-only string that changes whenever the resource is - * updated. + * A unique read-only string that changes whenever the resource is updated. */ @JsonProperty(value = "etag") private String etag; @@ -142,14 +142,25 @@ public List networkInterfaces() { } /** - * Get the provisioning state of the private link service. Possible values are: 'Updating', 'Succeeded', and 'Failed'. + * Get the provisioning state of the private link service. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. * * @return the provisioningState value */ - public String provisioningState() { + public ProvisioningState provisioningState() { return this.provisioningState; } + /** + * Set the provisioning state of the private link service. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the PrivateLinkServiceInner object itself. + */ + public PrivateLinkServiceInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + /** * Get an array of list about connections to the private endpoint. * @@ -240,7 +251,7 @@ public String alias() { } /** - * Get gets a unique read-only string that changes whenever the resource is updated. + * Get a unique read-only string that changes whenever the resource is updated. * * @return the etag value */ @@ -249,7 +260,7 @@ public String etag() { } /** - * Set gets a unique read-only string that changes whenever the resource is updated. + * Set a unique read-only string that changes whenever the resource is updated. * * @param etag the etag value to set * @return the PrivateLinkServiceInner object itself. diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixImpl.java index a3cefb967d23..13f787da412e 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixImpl.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixImpl.java @@ -16,6 +16,7 @@ import java.util.List; import com.microsoft.azure.management.network.v2019_06_01.IpTag; import com.microsoft.azure.management.network.v2019_06_01.ReferencedPublicIpAddress; +import com.microsoft.azure.SubResource; class PublicIPPrefixImpl extends GroupableResourceCoreImpl implements PublicIPPrefix, PublicIPPrefix.Definition, PublicIPPrefix.Update { PublicIPPrefixImpl(String name, PublicIPPrefixInner inner, NetworkManager manager) { @@ -63,6 +64,11 @@ public List ipTags() { return this.inner().ipTags(); } + @Override + public SubResource loadBalancerFrontendIpConfiguration() { + return this.inner().loadBalancerFrontendIpConfiguration(); + } + @Override public Integer prefixLength() { return this.inner().prefixLength(); diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixInner.java index d6418f70bdfe..3c7c4aac0dd8 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixInner.java @@ -13,6 +13,7 @@ import java.util.List; import com.microsoft.azure.management.network.v2019_06_01.IpTag; import com.microsoft.azure.management.network.v2019_06_01.ReferencedPublicIpAddress; +import com.microsoft.azure.SubResource; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.rest.SkipParentValidation; @@ -60,6 +61,13 @@ public class PublicIPPrefixInner extends Resource { @JsonProperty(value = "properties.publicIPAddresses") private List publicIPAddresses; + /** + * The reference to load balancer frontend IP configuration associated with + * the public IP prefix. + */ + @JsonProperty(value = "properties.loadBalancerFrontendIpConfiguration", access = JsonProperty.Access.WRITE_ONLY) + private SubResource loadBalancerFrontendIpConfiguration; + /** * The resource GUID property of the public IP prefix resource. */ @@ -212,6 +220,15 @@ public PublicIPPrefixInner withPublicIPAddresses(List return this; } + /** + * Get the reference to load balancer frontend IP configuration associated with the public IP prefix. + * + * @return the loadBalancerFrontendIpConfiguration value + */ + public SubResource loadBalancerFrontendIpConfiguration() { + return this.loadBalancerFrontendIpConfiguration; + } + /** * Get the resource GUID property of the public IP prefix resource. * diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ServiceTagsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ServiceTagsInner.java index ac7caf22444b..a501945b13a7 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ServiceTagsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ServiceTagsInner.java @@ -60,7 +60,7 @@ interface ServiceTagsService { /** * Gets a list of service tag information resources. * - * @param location The location. + * @param location The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -73,7 +73,7 @@ public ServiceTagsListResultInner list(String location) { /** * Gets a list of service tag information resources. * - * @param location The location. + * @param location The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -85,7 +85,7 @@ public ServiceFuture listAsync(String location, fina /** * Gets a list of service tag information resources. * - * @param location The location. + * @param location The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ServiceTagsListResultInner object */ @@ -101,7 +101,7 @@ public ServiceTagsListResultInner call(ServiceResponse listAsync(final String resourceGroupName, final String virtualNetworkName) { SubnetsInner client = this.inner(); diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/SubnetsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/SubnetsInner.java index d652fb1fe4d3..842c732d0000 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/SubnetsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/SubnetsInner.java @@ -14,6 +14,7 @@ import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.v2019_06_01.PrepareNetworkPoliciesRequest; +import com.microsoft.azure.management.network.v2019_06_01.UnprepareNetworkPoliciesRequest; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -38,8 +39,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -95,6 +94,14 @@ interface SubnetsService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies") Observable> beginPrepareNetworkPolicies(@Path("resourceGroupName") String resourceGroupName, @Path("virtualNetworkName") String virtualNetworkName, @Path("subnetName") String subnetName, @Path("subscriptionId") String subscriptionId, @Body PrepareNetworkPoliciesRequest prepareNetworkPoliciesRequestParameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.Subnets unprepareNetworkPolicies" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies") + Observable> unprepareNetworkPolicies(@Path("resourceGroupName") String resourceGroupName, @Path("virtualNetworkName") String virtualNetworkName, @Path("subnetName") String subnetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.Subnets beginUnprepareNetworkPolicies" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies") + Observable> beginUnprepareNetworkPolicies(@Path("resourceGroupName") String resourceGroupName, @Path("virtualNetworkName") String virtualNetworkName, @Path("subnetName") String subnetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.Subnets list" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets") Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("virtualNetworkName") String virtualNetworkName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -812,6 +819,343 @@ private ServiceResponse beginPrepareNetworkPoliciesDelegate(Response unprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(unprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName), serviceCallback); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable unprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName) { + return unprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> unprepareNetworkPoliciesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualNetworkName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); + } + if (subnetName == null) { + throw new IllegalArgumentException("Parameter subnetName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + final String serviceName = null; + UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters = new UnprepareNetworkPoliciesRequest(); + unprepareNetworkPoliciesRequestParameters.withServiceName(null); + Observable> observable = service.unprepareNetworkPolicies(resourceGroupName, virtualNetworkName, subnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), unprepareNetworkPoliciesRequestParameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void unprepareNetworkPolicies(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + unprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName).toBlocking().last().body(); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture unprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(unprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName), serviceCallback); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable unprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + return unprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> unprepareNetworkPoliciesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualNetworkName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); + } + if (subnetName == null) { + throw new IllegalArgumentException("Parameter subnetName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters = new UnprepareNetworkPoliciesRequest(); + unprepareNetworkPoliciesRequestParameters.withServiceName(serviceName); + Observable> observable = service.unprepareNetworkPolicies(resourceGroupName, virtualNetworkName, subnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), unprepareNetworkPoliciesRequestParameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginUnprepareNetworkPolicies(String resourceGroupName, String virtualNetworkName, String subnetName) { + beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName).toBlocking().single().body(); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUnprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName), serviceCallback); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginUnprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName) { + return beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginUnprepareNetworkPoliciesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualNetworkName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); + } + if (subnetName == null) { + throw new IllegalArgumentException("Parameter subnetName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + final String serviceName = null; + UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters = new UnprepareNetworkPoliciesRequest(); + unprepareNetworkPoliciesRequestParameters.withServiceName(null); + return service.beginUnprepareNetworkPolicies(resourceGroupName, virtualNetworkName, subnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), unprepareNetworkPoliciesRequestParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUnprepareNetworkPoliciesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginUnprepareNetworkPolicies(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName).toBlocking().single().body(); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUnprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName), serviceCallback); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginUnprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + return beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginUnprepareNetworkPoliciesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualNetworkName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); + } + if (subnetName == null) { + throw new IllegalArgumentException("Parameter subnetName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters = new UnprepareNetworkPoliciesRequest(); + unprepareNetworkPoliciesRequestParameters.withServiceName(serviceName); + return service.beginUnprepareNetworkPolicies(resourceGroupName, virtualNetworkName, subnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), unprepareNetworkPoliciesRequestParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUnprepareNetworkPoliciesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUnprepareNetworkPoliciesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Gets all subnets in a virtual network. * diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewayConnectionsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewayConnectionsInner.java index 3840a6900f24..0781e91aa089 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewayConnectionsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewayConnectionsInner.java @@ -42,8 +42,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -842,6 +840,7 @@ public Observable> call(Re private ServiceResponse beginUpdateTagsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewaysInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewaysInner.java index 10349caef887..ca319c80d262 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewaysInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewaysInner.java @@ -44,8 +44,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -928,6 +926,7 @@ public Observable> call(Response beginUpdateTagsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnGatewaysInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnGatewaysInner.java index 27991484fb1a..929a07aed149 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnGatewaysInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnGatewaysInner.java @@ -44,8 +44,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnSitesConfigurationsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnSitesConfigurationsInner.java index d9935c0dce8b..0b63491735c9 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnSitesConfigurationsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnSitesConfigurationsInner.java @@ -29,8 +29,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/parent/pom.xml b/parent/pom.xml index 29eb19b7c990..abdd0a97a163 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -107,11 +107,12 @@ 0.31.0 1.2.0 2.11.1 - 2.9.3-01 - 2.4.16-03 + 3.4.0-01 + 2.5.8-01 2.1.1 1.7.6 1.7.0 + 3.2.10.RELEASE 0.8.3.RELEASE 4.1.33.Final 2.5.2 @@ -331,6 +332,11 @@ ${slf4j-log4j12.version} + + io.projectreactor + reactor-core + ${reactor-core.version} + io.projectreactor.netty reactor-netty diff --git a/pom.client.xml b/pom.client.xml index ce6957bcaeed..520f1d2f9a89 100644 --- a/pom.client.xml +++ b/pom.client.xml @@ -1,7 +1,7 @@ - + 4.0.0 com.azure azure-client-sdk-parent @@ -107,6 +107,27 @@ + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-maven + + enforce + + + + + 3.6.1 + + + + + + + org.apache.maven.plugins @@ -164,12 +185,13 @@ - Max + max Low true ${project.build.directory}/spotbugs spotbugs/spotbugs-exclude.xml true + false @@ -341,7 +363,6 @@ false - com.microsoft.azure.template: *.impl*: *.implementation*: com.azure.tools.checkstyle* @@ -401,6 +422,10 @@ Azure Storage - Queues com.azure.storage.queue* + + Azure Telemetry + com.azure.tracing.opentelemetry* + https://docs.oracle.com/javase/8/docs/api/ @@ -438,12 +463,13 @@ - Max + max Low true ${project.build.directory}/spotbugs spotbugs/spotbugs-exclude.xml true + false @@ -511,12 +537,13 @@ spotbugs-maven-plugin ${spotbugs.maven.version} - Max + max Low true ${project.build.directory}/spotbugs eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml true + false @@ -671,6 +698,32 @@ + + + modulename + + + src/main/java/module-info.java + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + + ${project.automatic.module.name} + + + + + + + + @@ -724,12 +777,13 @@ ./eng/jacoco-test-coverage - + template-module - include-template + env.ENABLETEMPLATEDOCS + true @@ -743,6 +797,7 @@ ./sdk/core/azure-core ./sdk/core/azure-core-amqp ./sdk/core/azure-core-management + ./sdk/core/azure-core-http-netty ./sdk/core/azure-core-test ./sdk/eventhubs/azure-messaging-eventhubs ./sdk/keyvault/azure-keyvault-secrets diff --git a/pom.data.xml b/pom.data.xml index b29bea93bc9d..11675dffb68a 100644 --- a/pom.data.xml +++ b/pom.data.xml @@ -543,9 +543,11 @@ ./sdk/batch/microsoft-azure-batch ./sdk/cosmos - ./sdk/eventhubs/pom.data.xml + ./sdk/eventhubs/microsoft-azure-eventhubs/pom.xml + ./sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml + ./sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml ./sdk/keyvault/pom.data.xml - ./sdk/servicebus/azure-servicebus + ./sdk/servicebus/microsoft-azure-servicebus ./sdk/storage/microsoft-azure-storage-blob diff --git a/sdk/appconfiguration/azure-data-appconfiguration/README.md b/sdk/appconfiguration/azure-data-appconfiguration/README.md index cf9bfa46796e..8ee71afb4ab4 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/README.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/README.md @@ -197,3 +197,5 @@ If you would like to become an active contributor to this project please follow [samples]: src/samples/java/com/azure/data/appconfiguration [source_code]: src [spring_quickstart]: https://docs.microsoft.com/azure/azure-app-configuration/quickstart-java-spring-app + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/appconfiguration/azure-data-appconfiguration/README.png) \ No newline at end of file diff --git a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml index 17733f2f7427..1708c2bf7f17 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml +++ b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml @@ -32,6 +32,10 @@ HEAD + + com.azure.data.appconfiguration + + com.azure @@ -49,6 +53,12 @@ 1.0.0-preview.4 test + + com.azure + azure-core-http-netty + 1.0.0-preview.4 + test + junit junit diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java index 33337dcb5734..2289acc99c03 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java @@ -51,7 +51,7 @@ public final class ConfigurationClient { * *

Add a setting with the key "prodDBConnection" and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.addSetting#string-string} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.addSetting#String-String} * * @param key The key of the configuration setting to add. * @param value The value associated with this configuration setting key. @@ -74,7 +74,7 @@ public ConfigurationSetting addSetting(String key, String value) { * *

Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.addSetting#ConfigurationSetting} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.addSetting#ConfigurationSetting} * * @param setting The setting to add to the configuration service. * @return The {@link ConfigurationSetting} that was created, or {@code null}, if a key collision occurs or the key @@ -97,7 +97,7 @@ public ConfigurationSetting addSetting(ConfigurationSetting setting) { * *

Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.addSettingWithResponse#ConfigurationSetting-Context} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.addSettingWithResponse#ConfigurationSetting-Context} * * @param setting The setting to add to the configuration service. * @param context Additional context that is passed through the Http pipeline during the service call. @@ -124,7 +124,7 @@ private Response addSetting(ConfigurationSetting setting, * *

Add a setting with the key "prodDBConnection" and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.setSetting#string-string} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.setSetting#String-String} * * @param key The key of the configuration setting to create or update. * @param value The value of this configuration setting. @@ -151,7 +151,7 @@ public ConfigurationSetting setSetting(String key, String value) { * *

Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.setSetting#ConfigurationSetting} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.setSetting#ConfigurationSetting} * * @param setting The configuration setting to create or update. * @return The {@link ConfigurationSetting} that was created or updated, or {@code null}, if the key is an invalid @@ -181,7 +181,7 @@ public ConfigurationSetting setSetting(ConfigurationSetting setting) { * *

Add a setting with the key "prodDBConnection" and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.setSettingWithResponse#ConfigurationSetting-Context} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.setSettingWithResponse#ConfigurationSetting-Context} * * @param setting The configuration setting to create or update. * @param context Additional context that is passed through the Http pipeline during the service call. @@ -210,7 +210,7 @@ private Response setSetting(ConfigurationSetting setting, * *

Update a setting with the key "prodDBConnection" to have the value "updated_db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.updateSetting#string-string} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.updateSetting#String-String} * * @param key The key of the configuration setting to update. * @param value The updated value of this configuration setting. diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java index 41d70711b853..d1c9d152b01f 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java @@ -83,7 +83,7 @@ public final class ConfigurationClientBuilder { private HttpClient httpClient; private HttpLogDetailLevel httpLogDetailLevel; private HttpPipeline pipeline; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/credentials/ConfigurationClientCredentials.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/credentials/ConfigurationClientCredentials.java index 6370024bb578..b2fd9baafad9 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/credentials/ConfigurationClientCredentials.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/credentials/ConfigurationClientCredentials.java @@ -2,10 +2,10 @@ // Licensed under the MIT License. package com.azure.data.appconfiguration.credentials; +import com.azure.core.util.logging.ClientLogger; import com.azure.data.appconfiguration.ConfigurationClientBuilder; import com.azure.data.appconfiguration.policy.ConfigurationCredentialsPolicy; import com.azure.core.implementation.util.ImplUtils; -import io.netty.buffer.ByteBuf; import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -14,6 +14,7 @@ import javax.crypto.spec.SecretKeySpec; import java.net.MalformedURLException; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.security.InvalidKeyException; import java.security.MessageDigest; @@ -37,6 +38,8 @@ * @see ConfigurationClientBuilder */ public class ConfigurationClientCredentials { + private final ClientLogger logger = new ClientLogger(ConfigurationClientCredentials.class); + private static final String HOST_HEADER = "Host"; private static final String DATE_HEADER = "Date"; private static final String CONTENT_HASH_HEADER = "x-ms-content-sha256"; @@ -75,17 +78,17 @@ public URL baseUri() { * @return a flux of headers to add for authorization * @throws NoSuchAlgorithmException If the SHA-256 algorithm doesn't exist. */ - public Mono> getAuthorizationHeadersAsync(URL url, String httpMethod, Flux contents) { + public Mono> getAuthorizationHeadersAsync(URL url, String httpMethod, Flux contents) { return contents .collect(() -> { try { return MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { - throw Exceptions.propagate(e); + throw logger.logExceptionAsError(Exceptions.propagate(e)); } }, (messageDigest, byteBuffer) -> { if (messageDigest != null) { - messageDigest.update(byteBuffer.nioBuffer()); + messageDigest.update(byteBuffer); } }) .flatMap(messageDigest -> Mono.just(headerProvider.getAuthenticationHeaders(url, httpMethod, messageDigest))); @@ -149,9 +152,9 @@ private static class CredentialInformation { private static final String ID = "id="; private static final String SECRET = "secret="; - private URL baseUri; - private String id; - private byte[] secret; + private final URL baseUri; + private final String id; + private final byte[] secret; URL baseUri() { return baseUri; @@ -175,24 +178,32 @@ byte[] secret() { throw new IllegalArgumentException("invalid connection string segment count"); } + URL baseUri = null; + String id = null; + byte[] secret = null; + for (String arg : args) { String segment = arg.trim(); String lowerCase = segment.toLowerCase(Locale.US); if (lowerCase.startsWith(ENDPOINT)) { try { - this.baseUri = new URL(segment.substring(ENDPOINT.length())); + baseUri = new URL(segment.substring(ENDPOINT.length())); } catch (MalformedURLException ex) { throw new IllegalArgumentException(ex); } } else if (lowerCase.startsWith(ID)) { - this.id = segment.substring(ID.length()); + id = segment.substring(ID.length()); } else if (lowerCase.startsWith(SECRET)) { String secretBase64 = segment.substring(SECRET.length()); - this.secret = Base64.getDecoder().decode(secretBase64); + secret = Base64.getDecoder().decode(secretBase64); } } + this.baseUri = baseUri; + this.id = id; + this.secret = secret; + if (this.baseUri == null || this.id == null || this.secret == null) { throw new IllegalArgumentException("Could not parse 'connectionString'." + " Expected format: 'endpoint={endpoint};id={id};secret={secret}'. Actual:" + connectionString); diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/policy/ConfigurationCredentialsPolicy.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/policy/ConfigurationCredentialsPolicy.java index 7d32848c2041..6fff8bd066b4 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/policy/ConfigurationCredentialsPolicy.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/policy/ConfigurationCredentialsPolicy.java @@ -9,12 +9,11 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.HttpPipelinePolicy; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.EmptyByteBuf; -import io.netty.buffer.UnpooledByteBufAllocator; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; + /** * A policy that authenticates requests with Azure App Configuration service. The content added by this policy * is leveraged in {@link ConfigurationClientCredentials} to generate the correct "Authorization" header value. @@ -47,7 +46,7 @@ public ConfigurationCredentialsPolicy(ConfigurationClientCredentials credentials */ @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - final Flux contents = context.httpRequest().body() == null + final Flux contents = context.httpRequest().body() == null ? Flux.just(getEmptyBuffer()) : context.httpRequest().body(); @@ -58,8 +57,8 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN .flatMap(request -> next.process()); } - private ByteBuf getEmptyBuffer() { - return new EmptyByteBuf(UnpooledByteBufAllocator.DEFAULT); + private ByteBuffer getEmptyBuffer() { + return ByteBuffer.allocate(0); } } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java index 379cce877425..3ffce424c997 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java @@ -92,31 +92,31 @@ public ConfigurationClient createSyncConfigurationClient() { */ public void addSetting() { ConfigurationClient configurationClient = createSyncConfigurationClient(); - // BEGIN: com.azure.data.applicationconfig.configurationclient.addSetting#string-string + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.addSetting#String-String ConfigurationSetting result = configurationClient .addSetting("prodDBConnection", "db_connection"); System.out.printf("Key: %s, Value: %s", result.key(), result.value()); - // END: com.azure.data.applicationconfig.configurationclient.addSetting#string-string + // END: com.azure.data.appconfiguration.ConfigurationClient.addSetting#String-String /* Generates code sample for using {@link ConfigurationClient#addSetting(ConfigurationSetting)} */ - // BEGIN: com.azure.data.applicationconfig.configurationclient.addSetting#ConfigurationSetting + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.addSetting#ConfigurationSetting ConfigurationSetting resultSetting = configurationClient .addSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS").value("db_connection")); System.out.printf("Key: %s, Value: %s", resultSetting.key(), resultSetting.value()); - // END: com.azure.data.applicationconfig.configurationclient.addSetting#ConfigurationSetting + // END: com.azure.data.appconfiguration.ConfigurationClient.addSetting#ConfigurationSetting /* Generates code sample for using {@link ConfigurationClient#addSettingWithResponse(ConfigurationSetting, Context)} */ - // BEGIN: com.azure.data.applicationconfig.configurationclient.addSettingWithResponse#ConfigurationSetting-Context + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.addSettingWithResponse#ConfigurationSetting-Context Response responseResultSetting = configurationClient .addSettingWithResponse( new ConfigurationSetting() .key("prodDBConnection").label("westUS").value("db_connection"), new Context(key1, value1)); System.out.printf("Key: %s, Value: %s", responseResultSetting.value().key(), responseResultSetting.value().value()); - // END: com.azure.data.applicationconfig.configurationclient.addSettingWithResponse#ConfigurationSetting-Context + // END: com.azure.data.appconfiguration.ConfigurationClient.addSettingWithResponse#ConfigurationSetting-Context } /** @@ -124,7 +124,7 @@ public void addSetting() { */ public void setSetting() { ConfigurationClient configurationClient = createSyncConfigurationClient(); - // BEGIN: com.azure.data.applicationconfig.configurationclient.setSetting#string-string + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.setSetting#String-String ConfigurationSetting result = configurationClient .setSetting("prodDBConnection", "db_connection"); System.out.printf("Key: %s, Value: %s", result.key(), result.value()); @@ -132,12 +132,12 @@ public void setSetting() { // Update the value of the setting to "updated_db_connection". result = configurationClient.setSetting("prodDBConnection", "updated_db_connection"); System.out.printf("Key: %s, Value: %s", result.key(), result.value()); - // END: com.azure.data.applicationconfig.configurationclient.setSetting#string-string + // END: com.azure.data.appconfiguration.ConfigurationClient.setSetting#String-String /* Generates code sample for using {@link ConfigurationClient#setSetting(ConfigurationSetting)} */ - // BEGIN: com.azure.data.applicationconfig.configurationclient.setSetting#ConfigurationSetting + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.setSetting#ConfigurationSetting // Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection" ConfigurationSetting resultSetting = configurationClient .setSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS").value("db_connection")); @@ -148,12 +148,12 @@ public void setSetting() { .setSetting(new ConfigurationSetting() .key("prodDBConnection").label("westUS").value("updated_db_connection")); System.out.printf("Key: %s, Value: %s", resultSetting.key(), resultSetting.value()); - // END: com.azure.data.applicationconfig.configurationclient.setSetting#ConfigurationSetting + // END: com.azure.data.appconfiguration.ConfigurationClient.setSetting#ConfigurationSetting /* Generates code sample for using {@link ConfigurationClient#setSettingWithResponse(ConfigurationSetting, Context)} */ - // BEGIN: com.azure.data.applicationconfig.configurationclient.setSettingWithResponse#ConfigurationSetting-Context + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.setSettingWithResponse#ConfigurationSetting-Context // Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection" Response responseSetting = configurationClient .setSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") @@ -165,7 +165,7 @@ public void setSetting() { .setSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") .value("updated_db_connection"), new Context(key2, value2)); System.out.printf("Key: %s, Value: %s", responseSetting.value().key(), responseSetting.value().value()); - // END: com.azure.data.applicationconfig.configurationclient.setSettingWithResponse#ConfigurationSetting-Context + // END: com.azure.data.appconfiguration.ConfigurationClient.setSettingWithResponse#ConfigurationSetting-Context } /** @@ -206,13 +206,11 @@ public void getSetting() { */ public void updateSetting() { ConfigurationClient configurationClient = createSyncConfigurationClient(); - // BEGIN: com.azure.data.applicationconfig.configurationclient.updateSetting#string-string - + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.updateSetting#String-String // Update a setting with the key "prodDBConnection" to have the value "updated_db_connection". - ConfigurationSetting result = configurationClient.updateSetting("prodDBConnection", "updated_db_connection"); System.out.printf("Key: %s, Value: %s", result.key(), result.value()); - // END: com.azure.data.applicationconfig.configurationclient.updateSetting#string-string + // END: com.azure.data.appconfiguration.ConfigurationClient.updateSetting#String-String /* Generates code sample for using {@link ConfigurationClient#updateSetting(ConfigurationSetting)} diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java index 8b29dc51d313..3818d2dc71bd 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java @@ -14,11 +14,11 @@ import com.azure.data.appconfiguration.models.Range; import com.azure.data.appconfiguration.models.SettingFields; import com.azure.data.appconfiguration.models.SettingSelector; -import io.netty.handler.codec.http.HttpResponseStatus; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; +import java.net.HttpURLConnection; import java.time.Duration; import java.util.ArrayList; import java.util.List; @@ -80,7 +80,7 @@ public void addSetting() { */ public void addSettingEmptyKey() { StepVerifier.create(client.addSetting("", "A value")) - .verifyErrorSatisfies(ex -> assertRestException(ex, HttpResponseStatus.METHOD_NOT_ALLOWED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, HttpURLConnection.HTTP_BAD_METHOD)); } /** @@ -112,7 +112,7 @@ public void addSettingNullKey() { public void addExistingSetting() { addExistingSettingRunner((expected) -> StepVerifier.create(client.addSetting(expected).then(client.addSetting(expected))) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.PRECONDITION_FAILED.code()))); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_PRECON_FAILED))); } /** @@ -135,7 +135,7 @@ public void setSettingIfEtag() { setSettingIfEtagRunner((initial, update) -> { // This etag is not the correct format. It is not the correct hash that the service is expecting. StepVerifier.create(client.setSetting(initial.etag("badEtag"))) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); final String etag = client.addSetting(initial).block().etag(); @@ -144,7 +144,7 @@ public void setSettingIfEtag() { .verifyComplete(); StepVerifier.create(client.setSetting(initial)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); StepVerifier.create(client.getSetting(update)) .assertNext(response -> assertConfigurationEquals(update, response)) @@ -157,7 +157,7 @@ public void setSettingIfEtag() { */ public void setSettingEmptyKey() { StepVerifier.create(client.setSetting("", "A value")) - .verifyErrorSatisfies(ex -> assertRestException(ex, HttpResponseStatus.METHOD_NOT_ALLOWED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, HttpURLConnection.HTTP_BAD_METHOD)); } /** @@ -191,7 +191,7 @@ public void setSettingNullKey() { public void updateNoExistingSetting() { updateNoExistingSettingRunner((expected) -> StepVerifier.create(client.updateSetting(expected)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()))); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED))); } /** @@ -244,7 +244,7 @@ public void updateSettingIfEtag() { // The setting does not exist in the service yet, so we cannot update it. StepVerifier.create(client.updateSetting(new ConfigurationSetting().key(last.key()).label(last.label()).value(last.value()).etag(initialEtag))) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); StepVerifier.create(client.getSetting(update)) .assertNext(response -> assertConfigurationEquals(update, response)) @@ -259,7 +259,7 @@ public void updateSettingIfEtag() { .verifyComplete(); StepVerifier.create(client.updateSetting(new ConfigurationSetting().key(initial.key()).label(initial.label()).value(initial.value()).etag(updateEtag))) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); }); } @@ -286,11 +286,11 @@ public void getSettingNotFound() { .verifyComplete(); StepVerifier.create(client.getSetting("myNonExistentKey")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); StepVerifier.create(client.getSetting(nonExistentLabel)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -309,7 +309,7 @@ public void deleteSetting() { .verifyComplete(); StepVerifier.create(client.getSetting(expected)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); }); } @@ -325,11 +325,11 @@ public void deleteSettingNotFound() { .verifyComplete(); StepVerifier.create(client.deleteSettingWithResponse(new ConfigurationSetting().key("myNonExistentKey"))) - .assertNext(response -> assertConfigurationEquals(null, response, HttpResponseStatus.NO_CONTENT.code())) + .assertNext(response -> assertConfigurationEquals(null, response, HttpURLConnection.HTTP_NO_CONTENT)) .verifyComplete(); StepVerifier.create(client.deleteSettingWithResponse(new ConfigurationSetting().key(neverDeletedConfiguration.key()).label("myNonExistentLabel"))) - .assertNext(response -> assertConfigurationEquals(null, response, HttpResponseStatus.NO_CONTENT.code())) + .assertNext(response -> assertConfigurationEquals(null, response, HttpURLConnection.HTTP_NO_CONTENT)) .verifyComplete(); StepVerifier.create(client.getSetting(neverDeletedConfiguration.key())) @@ -351,14 +351,14 @@ public void deleteSettingWithETag() { .verifyComplete(); StepVerifier.create(client.deleteSetting(initiallyAddedConfig)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); StepVerifier.create(client.deleteSetting(updatedConfig)) .assertNext(response -> assertConfigurationEquals(update, response)) .verifyComplete(); StepVerifier.create(client.getSetting(initial)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); }); } @@ -656,7 +656,7 @@ public void listRevisionsInvalidRange() { .verifyComplete(); StepVerifier.create(client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(0, 10)))) - .verifyErrorSatisfies(exception -> assertRestException(exception, HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE.code())); + .verifyErrorSatisfies(exception -> assertRestException(exception, 416)); // REQUESTED_RANGE_NOT_SATISFIABLE } /** diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java index 1f243bb73ec2..4bb381b23b8e 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java @@ -15,7 +15,7 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import io.netty.handler.codec.http.HttpResponseStatus; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.List; @@ -73,7 +73,7 @@ public void addSetting() { * Tests that we cannot add a configuration setting when the key is an empty string. */ public void addSettingEmptyKey() { - assertRestException(() -> client.addSetting("", "A value"), HttpResponseStatus.METHOD_NOT_ALLOWED.code()); + assertRestException(() -> client.addSetting("", "A value"), HttpURLConnection.HTTP_BAD_METHOD); } /** @@ -100,7 +100,7 @@ public void addSettingNullKey() { public void addExistingSetting() { addExistingSettingRunner((expected) -> { client.addSetting(expected); - assertRestException(() -> client.addSetting(expected), ResourceModifiedException.class, HttpResponseStatus.PRECONDITION_FAILED.code()); + assertRestException(() -> client.addSetting(expected), ResourceModifiedException.class, HttpURLConnection.HTTP_PRECON_FAILED); }); } @@ -120,12 +120,12 @@ public void setSetting() { public void setSettingIfEtag() { setSettingIfEtagRunner((initial, update) -> { // This etag is not the correct format. It is not the correct hash that the service is expecting. - assertRestException(() -> client.setSetting(initial.etag("badEtag")), ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()); + assertRestException(() -> client.setSetting(initial.etag("badEtag")), ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED); final String etag = client.addSetting(initial).etag(); assertConfigurationEquals(update, client.setSetting(update.etag(etag))); - assertRestException(() -> client.setSetting(initial), ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()); + assertRestException(() -> client.setSetting(initial), ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED); assertConfigurationEquals(update, client.getSetting(update)); }); } @@ -134,7 +134,7 @@ public void setSettingIfEtag() { * Tests that we cannot set a configuration setting when the key is an empty string. */ public void setSettingEmptyKey() { - assertRestException(() -> client.setSetting("", "A value"), HttpResponseStatus.METHOD_NOT_ALLOWED.code()); + assertRestException(() -> client.setSetting("", "A value"), HttpURLConnection.HTTP_BAD_METHOD); } /** @@ -162,7 +162,7 @@ public void setSettingNullKey() { */ public void updateNoExistingSetting() { updateNoExistingSettingRunner((expected) -> - assertRestException(() -> client.updateSetting(expected), ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()) + assertRestException(() -> client.updateSetting(expected), ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED) ); } @@ -201,7 +201,7 @@ public void updateSettingIfEtag() { // The setting does not exist in the service yet, so we cannot update it. assertRestException(() -> client.updateSetting(new ConfigurationSetting().key(last.key()).label(last.label()).value(last.value()).etag(initialEtag)), ResourceNotFoundException.class, - HttpResponseStatus.PRECONDITION_FAILED.code()); + HttpURLConnection.HTTP_PRECON_FAILED); assertConfigurationEquals(update, client.getSetting(update)); assertConfigurationEquals(last, client.updateSetting(new ConfigurationSetting().key(last.key()).label(last.label()).value(last.value()).etag(updateEtag))); @@ -209,7 +209,7 @@ public void updateSettingIfEtag() { assertRestException(() -> client.updateSetting(new ConfigurationSetting().key(initial.key()).label(initial.label()).value(initial.value()).etag(updateEtag)), ResourceNotFoundException.class, - HttpResponseStatus.PRECONDITION_FAILED.code()); + HttpURLConnection.HTTP_PRECON_FAILED); }); } @@ -241,8 +241,8 @@ public void getSettingNotFound() { assertConfigurationEquals(neverRetrievedConfiguration, client.addSetting(neverRetrievedConfiguration)); - assertRestException(() -> client.getSetting("myNonExistentKey"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); - assertRestException(() -> client.getSetting(nonExistentLabel), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getSetting("myNonExistentKey"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); + assertRestException(() -> client.getSetting(nonExistentLabel), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -256,7 +256,7 @@ public void deleteSetting() { assertConfigurationEquals(expected, client.getSetting(expected)); assertConfigurationEquals(expected, client.deleteSetting(expected)); - assertRestException(() -> client.getSetting(expected), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getSetting(expected), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); }); } @@ -271,7 +271,7 @@ public void deleteSettingNotFound() { assertConfigurationEquals(neverDeletedConfiguation, client.addSetting(neverDeletedConfiguation)); assertConfigurationEquals(null, client.deleteSetting("myNonExistentKey")); - assertConfigurationEquals(null, client.deleteSettingWithResponse(notFoundDelete, Context.NONE), HttpResponseStatus.NO_CONTENT.code()); + assertConfigurationEquals(null, client.deleteSettingWithResponse(notFoundDelete, Context.NONE), HttpURLConnection.HTTP_NO_CONTENT); assertConfigurationEquals(neverDeletedConfiguation, client.getSetting(neverDeletedConfiguation.key())); } @@ -286,9 +286,9 @@ public void deleteSettingWithETag() { final ConfigurationSetting updatedConfig = client.updateSetting(update); assertConfigurationEquals(update, client.getSetting(initial)); - assertRestException(() -> client.deleteSetting(initiallyAddedConfig), ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()); + assertRestException(() -> client.deleteSetting(initiallyAddedConfig), ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED); assertConfigurationEquals(update, client.deleteSetting(updatedConfig)); - assertRestException(() -> client.getSetting(initial), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getSetting(initial), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); }); } @@ -474,13 +474,14 @@ public void listRevisionsWithRange() { /** * Verifies that an exception will be thrown from the service if it cannot satisfy the range request. */ + @Override public void listRevisionsInvalidRange() { final String key = getKey(); final ConfigurationSetting original = new ConfigurationSetting().key(key).value("myValue"); assertConfigurationEquals(original, client.addSetting(original)); - assertRestException(() -> client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(0, 10))).forEach(cs -> cs.key()), - HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE.code()); + assertRestException(() -> client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(0, 10))), + 416); // REQUESTED_RANGE_NOT_SATISFIABLE } /** diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java index 097d604b5be8..1419e3cca47c 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java @@ -420,6 +420,7 @@ void listRevisionsWithMultipleLabelsRunner(String key, String label, String labe public abstract void listRevisionsWithRange(); @Test + @Ignore("alzimmermsft to investigate") public abstract void listRevisionsInvalidRange(); @Test diff --git a/sdk/appconfiguration/ci.yml b/sdk/appconfiguration/ci.yml index 75985c51833a..aa7e15af9d76 100644 --- a/sdk/appconfiguration/ci.yml +++ b/sdk/appconfiguration/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: appconfiguration Artifacts: - name: azure-data-appconfiguration - safeName: azuredataappconfiguration \ No newline at end of file + safeName: azuredataappconfiguration + stagingProfileId: 88192f04117501 \ No newline at end of file diff --git a/sdk/appconfiguration/pom.service.xml b/sdk/appconfiguration/pom.service.xml index 1dcb85086aea..fbb523f353b6 100644 --- a/sdk/appconfiguration/pom.service.xml +++ b/sdk/appconfiguration/pom.service.xml @@ -11,6 +11,7 @@ ../core/azure-core ../core/azure-core-test + ../core/azure-core-http-netty azure-data-appconfiguration diff --git a/sdk/applicationinsights/ci.yml b/sdk/applicationinsights/ci.yml index 63952b81e94b..c1941bac908f 100644 --- a/sdk/applicationinsights/ci.yml +++ b/sdk/applicationinsights/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/applicationinsights/ @@ -13,11 +22,18 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/applicationinsights/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: applicationinsights \ No newline at end of file + ServiceDirectory: applicationinsights + Artifacts: + - name: azure-applicationinsights-query + safeName: azureapplicationinsightsquery + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/authorization/ci.yml b/sdk/authorization/ci.yml index 3ca739a2628b..470053362208 100644 --- a/sdk/authorization/ci.yml +++ b/sdk/authorization/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/authorization/ @@ -13,11 +22,18 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/authorization/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: authorization \ No newline at end of file + ServiceDirectory: authorization + Artifacts: + - name: microsoft-azure-authentication-msi-token-provider + safeName: microsoftazureauthenticationmsitokenprovider + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/batch/ci.yml b/sdk/batch/ci.yml index b1d6f5dba929..aaeab77c5fe1 100644 --- a/sdk/batch/ci.yml +++ b/sdk/batch/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: batch Artifacts: - name: azure-batch - safeName: azurebatch \ No newline at end of file + safeName: azurebatch + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/cognitiveservices/ci.yml b/sdk/cognitiveservices/ci.yml index 509ffbc81865..e82f1985e1b1 100644 --- a/sdk/cognitiveservices/ci.yml +++ b/sdk/cognitiveservices/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/cognitiveservices/ @@ -13,11 +22,69 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/cognitiveservices/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: cognitiveservices \ No newline at end of file + ServiceDirectory: cognitiveservices + Artifacts: + - name: azure-cognitiveservices-autosuggest + safeName: azurecognitiveservicesautosuggest + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-computervision + safeName: azurecognitiveservicescomputervision + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-contentmoderator + safeName: azurecognitiveservicescontentmoderator + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-customimagesearch + safeName: azurecognitiveservicescustomimagesearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-customsearch + safeName: azurecognitiveservicescustomsearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-customvision-prediction + safeName: azurecognitiveservicescustomvisionprediction + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-customvision-training + safeName: azurecognitiveservicescustomvisiontraining + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-entitysearch + safeName: azurecognitiveservicesentitysearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-faceapi + safeName: azurecognitiveservicesfaceapi + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-imagesearch + safeName: azurecognitiveservicesimagesearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-luis-authoring + safeName: azurecognitiveservicesluisauthoring + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-luis-runtime + safeName: azurecognitiveservicesluisruntime + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-newssearch + safeName: azurecognitiveservicesnewssearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-spellcheck + safeName: azurecognitiveservicesspellcheck + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-textanalytics + safeName: azurecognitiveservicestextanalytics + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-videosearch + safeName: azurecognitiveservicesvideosearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-visualsearch + safeName: azurecognitiveservicesvisualsearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-websearch + safeName: azurecognitiveserviceswebsearch + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/core/README.md b/sdk/core/README.md index ec88ce9e1a07..1c8402a7e798 100644 --- a/sdk/core/README.md +++ b/sdk/core/README.md @@ -25,3 +25,5 @@ Azure Core is split into a number of sub-components: * [azure-core-test](azure-core-test) provides utilities and API to make writing tests for Azure Core simpler and consistent. For documentation on using Azure Core, refer to the [azure-core readme](azure-core). + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/core/README.png) \ No newline at end of file diff --git a/sdk/core/azure-core-amqp/README.md b/sdk/core/azure-core-amqp/README.md index 38e2442aabd5..d948d741a3f8 100644 --- a/sdk/core/azure-core-amqp/README.md +++ b/sdk/core/azure-core-amqp/README.md @@ -40,3 +40,5 @@ Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). 1. Commit your changes (`git commit -am 'Add some feature'`) 1. Push to the branch (`git push origin my-new-feature`) 1. Create new Pull Request + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/core/azure-core-amqp/README.png) diff --git a/sdk/core/azure-core-amqp/pom.xml b/sdk/core/azure-core-amqp/pom.xml index 34afa7dce2db..d5a2b6faeee9 100644 --- a/sdk/core/azure-core-amqp/pom.xml +++ b/sdk/core/azure-core-amqp/pom.xml @@ -44,6 +44,7 @@ UTF-8 + com.azure.core.amqp diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryPolicy.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryPolicy.java index 5424f705ff1f..b81c5d1ac9e7 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryPolicy.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryPolicy.java @@ -101,8 +101,8 @@ public Duration calculateRetryDelay(Exception lastException, int retryCount) { } /** - * Calculates the amount of time to delay before the next retry attempt based on the {@code retryCound}, {@code - * baseDelay}, and {@code baseJitter}. + * Calculates the amount of time to delay before the next retry attempt based on the {@code retryCound}, + * {@code baseDelay}, and {@code baseJitter}. * * @param retryCount The number of attempts that have been made, including the initial attempt before any * retries. diff --git a/sdk/core/azure-core-http-netty/README.md b/sdk/core/azure-core-http-netty/README.md new file mode 100644 index 000000000000..bf8bc5624604 --- /dev/null +++ b/sdk/core/azure-core-http-netty/README.md @@ -0,0 +1,38 @@ +# Azure Core Netty HTTP client library for Java + +Azure Core Netty HTTP client is a plugin for the azure-core HTTP client API. + +## Getting started + +### Prerequisites + +- Java Development Kit (JDK) with version 8 or above + +### Adding the package to your product + +```xml + + com.azure + azure-core-http-netty + 1.0.0-preview.4 + +``` + +## Key concepts + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request diff --git a/sdk/core/azure-core-http-netty/pom.xml b/sdk/core/azure-core-http-netty/pom.xml new file mode 100644 index 000000000000..cbd06e146641 --- /dev/null +++ b/sdk/core/azure-core-http-netty/pom.xml @@ -0,0 +1,113 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.3.0 + ../../../pom.client.xml + + + com.azure + azure-core-http-netty + jar + 1.0.0-preview.4 + + Microsoft Azure Netty HTTP Client Library + This package contains the Netty HTTP client plugin for azure-core. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + + azure-java-build-docs + ${site.url}/site/${project.artifactId} + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:https://github.com/Azure/azure-sdk-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java.git + + + + UTF-8 + + com.azure.core.http.netty + + + + + microsoft + Microsoft + + + + + + com.azure + azure-core + 1.0.0-preview.4 + + + + io.netty + netty-handler + + + io.netty + netty-handler-proxy + + + io.netty + netty-buffer + + + io.netty + netty-codec-http + + + + io.projectreactor.netty + reactor-netty + + + + + com.azure + azure-core + 1.0.0-preview.4 + test-jar + test + + + io.projectreactor + reactor-test + test + + + + junit + junit + test + + + + com.github.tomakehurst + wiremock-standalone + test + + + diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/ReactorNettyClient.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/ReactorNettyClient.java similarity index 84% rename from sdk/core/azure-core/src/main/java/com/azure/core/http/ReactorNettyClient.java rename to sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/ReactorNettyClient.java index 0b17d052e1be..51e3bd0cb528 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/ReactorNettyClient.java +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/ReactorNettyClient.java @@ -1,8 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.http; - +package com.azure.core.http.netty.implementation; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.ProxyOptions; +import com.azure.core.util.logging.ClientLogger; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.HttpMethod; @@ -14,7 +21,9 @@ import reactor.netty.NettyOutbound; import reactor.netty.http.client.HttpClientRequest; import reactor.netty.http.client.HttpClientResponse; +import reactor.netty.tcp.ProxyProvider; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.Objects; import java.util.function.BiFunction; @@ -25,6 +34,7 @@ * HttpClient that is implemented using reactor-netty. */ class ReactorNettyClient implements HttpClient { + private final ClientLogger logger = new ClientLogger(ReactorNettyClient.class); private reactor.netty.http.client.HttpClient httpClient; /** @@ -104,7 +114,15 @@ private static BiFunction proxyOptionsSupplier) { return new ReactorNettyClient(this.httpClient, client -> client.tcpConfiguration(c -> { ProxyOptions options = proxyOptionsSupplier.get(); - return c.proxy(ts -> ts.type(options.type().value()).address(options.address())); + ProxyProvider.Proxy nettyProxy; + switch (options.type()) { + case HTTP: nettyProxy = ProxyProvider.Proxy.HTTP; break; + case SOCKS4: nettyProxy = ProxyProvider.Proxy.SOCKS4; break; + case SOCKS5: nettyProxy = ProxyProvider.Proxy.SOCKS5; break; + default: + throw logger.logExceptionAsWarning(new IllegalStateException("Unknown Proxy type '" + options.type() + "' in use. Not configuring Netty proxy.")); + } + return c.proxy(ts -> ts.type(nettyProxy).address(options.address())); })); } @@ -118,7 +136,7 @@ public final HttpClient port(int port) { return new ReactorNettyClient(this.httpClient, client -> client.port(port)); } - private static class ReactorNettyHttpResponse extends HttpResponse { + static class ReactorNettyHttpResponse extends HttpResponse { private final HttpClientResponse reactorNettyResponse; private final Connection reactorNettyConnection; @@ -145,12 +163,12 @@ public HttpHeaders headers() { } @Override - public Flux body() { + public Flux body() { return bodyIntern().doFinally(s -> { if (!reactorNettyConnection.isDisposed()) { reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); } - }); + }).map(ByteBuf::nioBuffer); } @Override @@ -191,7 +209,7 @@ private ByteBufFlux bodyIntern() { return reactorNettyConnection.inbound().receive(); } - @Override + // used for testing only Connection internConnection() { return reactorNettyConnection; } diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/ReactorNettyClientProvider.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/ReactorNettyClientProvider.java new file mode 100644 index 000000000000..96f59ffda61c --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/ReactorNettyClientProvider.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty.implementation; + +import com.azure.core.http.HttpClient; +import com.azure.core.implementation.http.spi.HttpClientProvider; + +public class ReactorNettyClientProvider implements HttpClientProvider { + + @Override + public HttpClient createInstance() { + return new ReactorNettyClient(); + } +} diff --git a/sdk/core/azure-core-http-netty/src/main/resources/META-INF/services/com.azure.core.implementation.http.spi.HttpClientProvider b/sdk/core/azure-core-http-netty/src/main/resources/META-INF/services/com.azure.core.implementation.http.spi.HttpClientProvider new file mode 100644 index 000000000000..e14f80af27db --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/main/resources/META-INF/services/com.azure.core.implementation.http.spi.HttpClientProvider @@ -0,0 +1 @@ +com.azure.core.http.netty.implementation.ReactorNettyClientProvider diff --git a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTestUtils.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTestUtils.java new file mode 100644 index 000000000000..026d46efeb01 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTestUtils.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty.implementation; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufAllocator; +import org.reactivestreams.Subscriber; +import org.reactivestreams.Subscription; +import reactor.core.CoreSubscriber; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Operators; + +import java.nio.channels.AsynchronousFileChannel; +import java.nio.channels.CompletionHandler; +import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; +import java.util.concurrent.atomic.AtomicLongFieldUpdater; + +public class NettyFluxTestUtils { + private static final int DEFAULT_CHUNK_SIZE = 1024 * 64; + + /** + * Splits a ByteBuffer into ByteBuf chunks. + * + * @param whole the ByteBuffer to split + * @param chunkSize the maximum size of each ByteBuf chunk + * @return A stream that emits chunks of the original whole ByteBuf + */ + public static Flux split(final ByteBuf whole, final int chunkSize) { + return Flux.generate(whole::readerIndex, (readFromIndex, synchronousSync) -> { + final int writerIndex = whole.writerIndex(); + // + if (readFromIndex >= writerIndex) { + synchronousSync.complete(); + return writerIndex; + } else { + int readSize = Math.min(writerIndex - readFromIndex, chunkSize); + // Netty slice operation will not increment the ref count. + // + // Here we invoke 'retain' on each slice, since + // consumer of the returned Flux stream is responsible for + // releasing each chunk as it gets consumed. + // + synchronousSync.next(whole.slice(readFromIndex, readSize).retain()); + return readFromIndex + readSize; + } + }); + } + + /** + * Creates a {@link Flux} from an {@link AsynchronousFileChannel} + * which reads part of a file into chunks of the given size. + * + * @param fileChannel The file channel. + * @param chunkSize the size of file chunks to read. + * @param offset The offset in the file to begin reading. + * @param length The number of bytes to read from the file. + * @return the Flowable. + */ + public static Flux byteBufStreamFromFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { + return new ByteBufStreamFromFile(fileChannel, chunkSize, offset, length); + } + + /** + * Creates a {@link Flux} from an {@link AsynchronousFileChannel} + * which reads part of a file. + * + * @param fileChannel The file channel. + * @param offset The offset in the file to begin reading. + * @param length The number of bytes to read from the file. + * @return the Flowable. + */ + public static Flux byteBufStreamFromFile(AsynchronousFileChannel fileChannel, long offset, long length) { + return byteBufStreamFromFile(fileChannel, DEFAULT_CHUNK_SIZE, offset, length); + } + + //region ByteBufStreamFromFile implementation + private static final class ByteBufStreamFromFile extends Flux { + private final ByteBufAllocator alloc; + private final AsynchronousFileChannel fileChannel; + private final int chunkSize; + private final long offset; + private final long length; + + ByteBufStreamFromFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { + this.alloc = ByteBufAllocator.DEFAULT; + this.fileChannel = fileChannel; + this.chunkSize = chunkSize; + this.offset = offset; + this.length = length; + } + + @Override + public void subscribe(CoreSubscriber actual) { + FileReadSubscription subscription = new FileReadSubscription(actual, fileChannel, alloc, chunkSize, offset, length); + actual.onSubscribe(subscription); + } + + static final class FileReadSubscription implements Subscription, CompletionHandler { + private static final int NOT_SET = -1; + private static final long serialVersionUID = -6831808726875304256L; + // + private final Subscriber subscriber; + private volatile long position; + // + private final AsynchronousFileChannel fileChannel; + private final ByteBufAllocator alloc; + private final int chunkSize; + private final long offset; + private final long length; + // + private volatile boolean done; + private Throwable error; + private volatile ByteBuf next; + private volatile boolean cancelled; + // + volatile int wip; + @SuppressWarnings("rawtypes") + static final AtomicIntegerFieldUpdater WIP = AtomicIntegerFieldUpdater.newUpdater(FileReadSubscription.class, "wip"); + volatile long requested; + @SuppressWarnings("rawtypes") + static final AtomicLongFieldUpdater REQUESTED = AtomicLongFieldUpdater.newUpdater(FileReadSubscription.class, "requested"); + // + + FileReadSubscription(Subscriber subscriber, AsynchronousFileChannel fileChannel, ByteBufAllocator alloc, int chunkSize, long offset, long length) { + this.subscriber = subscriber; + // + this.fileChannel = fileChannel; + this.alloc = alloc; + this.chunkSize = chunkSize; + this.offset = offset; + this.length = length; + // + this.position = NOT_SET; + } + + //region Subscription implementation + + @Override + public void request(long n) { + if (Operators.validate(n)) { + Operators.addCap(REQUESTED, this, n); + drain(); + } + } + + @Override + public void cancel() { + this.cancelled = true; + } + + //endregion + + //region CompletionHandler implementation + + @Override + public void completed(Integer bytesRead, ByteBuf buffer) { + if (!cancelled) { + if (bytesRead == -1) { + done = true; + } else { + // use local variable to perform fewer volatile reads + long pos = position; + // + int bytesWanted = Math.min(bytesRead, maxRequired(pos)); + buffer.writerIndex(bytesWanted); + long position2 = pos + bytesWanted; + //noinspection NonAtomicOperationOnVolatileField + position = position2; + next = buffer; + if (position2 >= offset + length) { + done = true; + } + } + drain(); + } + } + + @Override + public void failed(Throwable exc, ByteBuf attachment) { + if (!cancelled) { + // must set error before setting done to true + // so that is visible in drain loop + error = exc; + done = true; + drain(); + } + } + + //endregion + + private void drain() { + if (WIP.getAndIncrement(this) != 0) { + return; + } + // on first drain (first request) we initiate the first read + if (position == NOT_SET) { + position = offset; + doRead(); + } + int missed = 1; + for (;;) { + if (cancelled) { + return; + } + if (REQUESTED.get(this) > 0) { + boolean emitted = false; + // read d before next to avoid race + boolean d = done; + ByteBuf bb = next; + if (bb != null) { + next = null; + // + // try { + subscriber.onNext(bb); + // } finally { + // Note: Don't release here, we follow netty disposal pattern + // it's consumers responsiblity to release chunks after consumption. + // + // ReferenceCountUtil.release(bb); + // } + // + emitted = true; + } else { + emitted = false; + } + if (d) { + if (error != null) { + subscriber.onError(error); + // exit without reducing wip so that further drains will be NOOP + return; + } else { + subscriber.onComplete(); + // exit without reducing wip so that further drains will be NOOP + return; + } + } + if (emitted) { + // do this after checking d to avoid calling read + // when done + Operators.produced(REQUESTED, this, 1); + // + doRead(); + } + } + missed = WIP.addAndGet(this, -missed); + if (missed == 0) { + return; + } + } + } + + private void doRead() { + // use local variable to limit volatile reads + long pos = position; + int readSize = Math.min(chunkSize, maxRequired(pos)); + ByteBuf innerBuf = alloc.buffer(readSize, readSize); + fileChannel.read(innerBuf.nioBuffer(0, readSize), pos, innerBuf, this); + } + + private int maxRequired(long pos) { + long maxRequired = offset + length - pos; + if (maxRequired <= 0) { + return 0; + } else { + int m = (int) (maxRequired); + // support really large files by checking for overflow + if (m < 0) { + return Integer.MAX_VALUE; + } else { + return m; + } + } + } + } + } +} diff --git a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTests.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTests.java new file mode 100644 index 000000000000..c0d49b1ada3c --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTests.java @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty.implementation; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpMethod; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.implementation.http.PagedResponseBase; +import com.azure.core.implementation.util.FluxUtil; +import com.azure.core.util.Context; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.http.HttpResponseStatus; +import io.netty.util.ReferenceCountUtil; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import reactor.core.Exceptions; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.channels.AsynchronousFileChannel; +import java.nio.charset.StandardCharsets; +import java.nio.file.StandardOpenOption; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class NettyFluxTests { + + @Test + public void testCanReadSlice() throws IOException { + File file = createFileIfNotExist("target/test1"); + FileOutputStream stream = new FileOutputStream(file); + stream.write("hello there".getBytes(StandardCharsets.UTF_8)); + stream.close(); + + try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { + byte[] bytes = NettyFluxTestUtils.byteBufStreamFromFile(channel, 1, 3) + .map(bb -> { + byte[] bt = toBytes(bb); + ReferenceCountUtil.release(bb); + return bt; + }) + .collect(() -> new ByteArrayOutputStream(), + (bos, b) -> { + try { + bos.write(b); + } catch (IOException ioe) { + throw Exceptions.propagate(ioe); + } + }) + .block() + .toByteArray(); + assertEquals("ell", new String(bytes, StandardCharsets.UTF_8)); + } catch (IOException ioe) { + + } + + } + + @Test + public void testCanReadEmptyFile() throws IOException { + File file = createFileIfNotExist("target/test2"); + + try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { + byte[] bytes = NettyFluxTestUtils.byteBufStreamFromFile(channel, 1, 3) + .map(bb -> { + byte[] bt = bb.array(); + ReferenceCountUtil.release(bb); + return bt; + }) + .collect(() -> new ByteArrayOutputStream(), + (bos, b) -> { + try { + bos.write(b); + } catch (IOException ioe) { + throw Exceptions.propagate(ioe); + } + }) + .block().toByteArray(); + assertEquals(0, bytes.length); + } + assertTrue(file.delete()); + } + + @Test + public void testAsynchronyShortInput() throws IOException { + File file = createFileIfNotExist("target/test3"); + FileOutputStream stream = new FileOutputStream(file); + stream.write("hello there".getBytes(StandardCharsets.UTF_8)); + stream.close(); + try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { + byte[] bytes = FluxUtil.readFile(channel) + .map(bb -> { + byte[] bt = new byte[bb.remaining()]; + bb.get(bt); + return bt; + }) + .limitRequest(1) + .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) + .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) + .collect(() -> new ByteArrayOutputStream(), + (bos, b) -> { + try { + bos.write(b); + } catch (IOException ioe) { + throw Exceptions.propagate(ioe); + } + }) + .block() + .toByteArray(); + assertEquals("hello there", new String(bytes, StandardCharsets.UTF_8)); + } + assertTrue(file.delete()); + } + + private static final int NUM_CHUNKS_IN_LONG_INPUT = 10_000_000; + + @Test + public void testAsynchronyLongInput() throws IOException, NoSuchAlgorithmException { + File file = createFileIfNotExist("target/test4"); + byte[] array = "1234567690".getBytes(StandardCharsets.UTF_8); + MessageDigest digest = MessageDigest.getInstance("MD5"); + try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { + for (int i = 0; i < NUM_CHUNKS_IN_LONG_INPUT; i++) { + out.write(array); + digest.update(array); + } + } + System.out.println("long input file size=" + file.length() / (1024 * 1024) + "MB"); + byte[] expected = digest.digest(); + digest.reset(); + try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { + FluxUtil.readFile(channel) + .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) + .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) + .toIterable().forEach(digest::update); + + assertArrayEquals(expected, digest.digest()); + } + assertTrue(file.delete()); + } + + @Test + @Ignore("Need to sync with smaldini to find equivalent for rx.test.awaitDone") + public void testBackpressureLongInput() throws IOException, NoSuchAlgorithmException { +// File file = new File("target/test4"); +// byte[] array = "1234567690".getBytes(StandardCharsets.UTF_8); +// MessageDigest digest = MessageDigest.getInstance("MD5"); +// try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { +// for (int i = 0; i < NUM_CHUNKS_IN_LONG_INPUT; i++) { +// out.write(array); +// digest.update(array); +// } +// } +// byte[] expected = digest.digest(); +// digest.reset(); +// +// try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { +// FluxUtil1.byteBufferStreamFromFile(channel) +// .rebatchRequests(1) +// .subscribeOn(Schedulers.io()) +// .observeOn(Schedulers.io()) +// .doOnNext(bb -> digest.update(bb)) +// .test(0) +// .assertNoValues() +// .requestMore(1) +// .awaitCount(1) +// .assertValueCount(1) +// .requestMore(1) +// .awaitCount(2) +// .assertValueCount(2) +// .requestMore(Long.MAX_VALUE) +// .awaitDone(20, TimeUnit.SECONDS) +// .assertComplete(); +// } +// +// assertArrayEquals(expected, digest.digest()); +// assertTrue(file.delete()); + } + + @Test + public void testSplitForMultipleSplitSizesFromOneTo16() throws NoSuchAlgorithmException { + ByteBuf bb = null; + try { + bb = Unpooled.directBuffer(1000); + byte[] oneByte = new byte[1]; + for (int i = 0; i < 1000; i++) { + oneByte[0] = (byte) i; + bb.writeBytes(oneByte); + } + MessageDigest digest = MessageDigest.getInstance("MD5"); + digest.update(bb.nioBuffer()); + byte[] expected = digest.digest(); + for (int size = 1; size < 16; size++) { + System.out.println("size=" + size); + digest.reset(); + bb.readerIndex(0); + // + NettyFluxTestUtils.split(bb, 3) + .doOnNext(b -> digest.update(b.nioBuffer())) + .subscribe(); +// +// StepVerifier.create(FluxUtil1.split(bb, 3).doOnNext(b -> digest.update(b))) +// .expectNextCount(?) // TODO: ? is Unknown. Check with smaldini - what is the Verifier way to ignore all next calls and simply check stream completes? +// .verifyComplete(); +// + assertArrayEquals(expected, digest.digest()); + } + } finally { + if (bb != null) { + bb.release(); + } + } + } + + @Test + public void testSplitOnEmptyContent() { + ByteBuf bb = null; + try { + bb = Unpooled.directBuffer(16); + StepVerifier.create(NettyFluxTestUtils.split(bb, 3)) + .expectNextCount(0) + .expectComplete() + .verify(); + } finally { + if (bb != null) { + bb.release(); + } + } + } + +// @Test +// public void toByteArrayWithEmptyByteBuffer() { +// assertArrayEquals(new byte[0], byteBufToArray(Unpooled.wrappedBuffer(new byte[0]))); +// } +// +// @Test +// public void toByteArrayWithNonEmptyByteBuffer() { +// final ByteBuf byteBuffer = Unpooled.wrappedBuffer(new byte[] { 0, 1, 2, 3, 4 }); +// assertEquals(5, byteBuffer.readableBytes()); +// final byte[] byteArray = byteBufToArray(byteBuffer); +// assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, byteArray); +// assertEquals(5, byteBuffer.readableBytes()); +// } +// +// @Test +// public void testCollectByteBufStream() { +// Flux byteBufFlux = Flux +// .just(Unpooled.copyInt(1), Unpooled.copyInt(255), Unpooled.copyInt(256)); +// Mono result = collectByteBufStream(byteBufFlux, false); +// byte[] bytes = ByteBufUtil.getBytes(result.block()); +// assertEquals(12, bytes.length); +// assertArrayEquals(new byte[]{ +// 0, 0, 0, 1, +// 0, 0, 0, (byte) 255, +// 0, 0, 1, 0}, bytes); +// } +// +// @Test +// public void testToMono() { +// String value = "test"; +// Assert.assertEquals(getMonoRestResponse(value).flatMap(FluxUtil::toMono).block(), value); +// Assert.assertEquals(getMonoRestResponse("").flatMap(FluxUtil::toMono).block(), ""); +// } + + @Test + public void testCallWithContextGetSingle() { + String response = getSingle("Hello, ") + .subscriberContext(reactor.util.context.Context.of("FirstName", "Foo", "LastName", "Bar")) + .block(); + Assert.assertEquals("Hello, Foo Bar", response); + } + + @Test + public void testCallWithContextGetCollection() { + List expectedLines = Arrays.asList("Hello,", "Foo", "Bar"); + List actualLines = new ArrayList<>(); + getCollection("Hello, ") + .subscriberContext(reactor.util.context.Context.of("FirstName", "Foo", "LastName", "Bar")) + .doOnNext(line -> actualLines.add(line)) + .subscribe(); + Assert.assertEquals(expectedLines, actualLines); + } + + @Test + public void testCallWithContextGetPagedCollection() throws Exception { + // Simulates the customer code that includes context + getPagedCollection() + .subscriberContext( + reactor.util.context.Context.of("Key1", "Val1", "Key2", "Val2")) + .doOnNext(System.out::println) + .subscribe(); + } + + private PagedFlux getPagedCollection() + throws Exception { + // Simulates the client library API + List> pagedResponses = getPagedResponses(4); + return new PagedFlux<>( + () -> FluxUtil.withContext(context -> getFirstPage(pagedResponses, context)), + continuationToken -> FluxUtil + .withContext(context -> getNextPage(continuationToken, pagedResponses, context))); + } + + private List> getPagedResponses(int noOfPages) + throws MalformedURLException { + HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") + .put("header2", "value2"); + HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); + String deserializedHeaders = "header1,value1,header2,value2"; + return IntStream.range(0, noOfPages) + .boxed() + .map(i -> createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, i, noOfPages)) + .collect(Collectors.toList()); + } + + private Mono> getFirstPage(List> pagedResponses, + Context context) { + // Simulates the service side code which should get the context provided by customer code + Assert.assertEquals("Val1", context.getData("Key1").get()); + return pagedResponses.isEmpty() ? Mono.empty() : Mono.just(pagedResponses.get(0)); + } + + private Mono> getNextPage(String continuationToken, + List> pagedResponses, Context context) { + // Simulates the service side code which should get the context provided by customer code + Assert.assertEquals("Val2", context.getData("Key2").get()); + if (continuationToken == null || continuationToken.isEmpty()) { + return Mono.empty(); + } + return Mono.just(pagedResponses.get(Integer.valueOf(continuationToken))); + } + + private PagedResponseBase createPagedResponse(HttpRequest httpRequest, + HttpHeaders httpHeaders, String deserializedHeaders, int i, int noOfPages) { + return new PagedResponseBase<>(httpRequest, HttpResponseStatus.OK.code(), + httpHeaders, + getItems(i), + i < noOfPages - 1 ? String.valueOf(i + 1) : null, + deserializedHeaders); + } + + private List getItems(Integer i) { + return IntStream.range(i * 3, i * 3 + 3).boxed().collect(Collectors.toList()); + } + + + private Mono getSingle(String prefix) { + return FluxUtil.withContext(context -> serviceCallSingle(prefix, context)); + } + + private Flux getCollection(String prefix) { + return FluxUtil + .fluxContext(context -> serviceCallCollection(prefix, context)); + } + + private Mono serviceCallSingle(String prefix, Context context) { + String msg = prefix + + context.getData("FirstName").orElse("Stranger") + + " " + + context.getData("LastName").orElse(""); + return Mono.just(msg); + } + + private Flux serviceCallCollection(String prefix, Context context) { + String msg = prefix + + context.getData("FirstName").orElse("Stranger") + + " " + + context.getData("LastName").orElse(""); + + return Flux.just(msg.split(" ")); + } +// + private static byte[] toBytes(ByteBuf bb) { + byte[] bytes = new byte[bb.readableBytes()]; + bb.readBytes(bytes); + return bytes; + } + + private File createFileIfNotExist(String fileName) throws IOException { + File file = new File(fileName); + if (file.getParentFile() != null) { + file.getParentFile().mkdirs(); + } + file.createNewFile(); + return file; + } + + private Mono> getMonoRestResponse(T value) { + Response response = new Response() { + @Override + public int statusCode() { + return 200; + } + + @Override + public HttpHeaders headers() { + return null; + } + + @Override + public HttpRequest request() { + return null; + } + + @Override + public T value() { + return value; + } + }; + return Mono.just(response); + } +} diff --git a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/ReactorNettyClientTests.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/ReactorNettyClientTests.java new file mode 100644 index 000000000000..6de54e234616 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/ReactorNettyClientTests.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty.implementation; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpMethod; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import io.netty.buffer.ByteBuf; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; +import reactor.test.StepVerifier; +import reactor.test.StepVerifierOptions; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicReference; + +import static com.azure.core.http.netty.implementation.ReactorNettyClient.ReactorNettyHttpResponse; + +public class ReactorNettyClientTests { + + private static final String SHORT_BODY = "hi there"; + private static final String LONG_BODY = createLongBody(); + + private static WireMockServer server; + + @BeforeClass + public static void beforeClass() { + server = new WireMockServer(WireMockConfiguration.options().dynamicPort().disableRequestJournal()); + server.stubFor( + WireMock.get("/short").willReturn(WireMock.aResponse().withBody(SHORT_BODY))); + server.stubFor(WireMock.get("/long").willReturn(WireMock.aResponse().withBody(LONG_BODY))); + server.stubFor(WireMock.get("/error") + .willReturn(WireMock.aResponse().withBody("error").withStatus(500))); + server.stubFor( + WireMock.post("/shortPost").willReturn(WireMock.aResponse().withBody(SHORT_BODY))); + server.start(); + // ResourceLeakDetector.setLevel(Level.PARANOID); + } + + @AfterClass + public static void afterClass() { + if (server != null) { + server.shutdown(); + } + } + + @Test + public void testFlowableResponseShortBodyAsByteArrayAsync() { + checkBodyReceived(SHORT_BODY, "/short"); + } + + @Test + public void testFlowableResponseLongBodyAsByteArrayAsync() { + checkBodyReceived(LONG_BODY, "/long"); + } + + @Test + public void testMultipleSubscriptionsEmitsError() { + HttpResponse response = getResponse("/short"); + // Subscription:1 + response.bodyAsByteArray().block(); + // Subscription:2 + StepVerifier.create(response.bodyAsByteArray()) + .expectNextCount(0) // TODO: Check with smaldini, what is the verifier operator equivalent to .awaitDone(20, TimeUnit.SECONDS) + .verifyError(IllegalStateException.class); + + } + + @Test + public void testDispose() throws InterruptedException { + ReactorNettyHttpResponse response = getResponse("/long"); + response.body().subscribe().dispose(); + // Wait for scheduled connection disposal action to execute on netty event-loop + Thread.sleep(5000); + Assert.assertTrue(response.internConnection().isDisposed()); + } + + @Test + public void testCancel() { + ReactorNettyHttpResponse response = getResponse("/long"); + // + StepVerifierOptions stepVerifierOptions = StepVerifierOptions.create(); + stepVerifierOptions.initialRequest(0); + // + StepVerifier.create(response.body(), stepVerifierOptions) + .expectNextCount(0) + .thenRequest(1) + .expectNextCount(1) + .thenCancel() + .verify(); + Assert.assertTrue(response.internConnection().isDisposed()); + } + + @Test + public void testFlowableWhenServerReturnsBodyAndNoErrorsWhenHttp500Returned() { + HttpResponse response = getResponse("/error"); + StepVerifier.create(response.bodyAsString()) + .expectNext("error") // TODO: .awaitDone(20, TimeUnit.SECONDS) [See previous todo] + .verifyComplete(); + Assert.assertEquals(500, response.statusCode()); + } + + @Test + @Ignore("Not working accurately at present") + public void testFlowableBackpressure() { + HttpResponse response = getResponse("/long"); + // + StepVerifierOptions stepVerifierOptions = StepVerifierOptions.create(); + stepVerifierOptions.initialRequest(0); + // + StepVerifier.create(response.body(), stepVerifierOptions) + .expectNextCount(0) + .thenRequest(1) + .expectNextCount(1) + .thenRequest(3) + .expectNextCount(3) + .thenRequest(Long.MAX_VALUE)// TODO: Check with smaldini, what is the verifier operator to ignore all next emissions + .expectNextCount(1507) + .verifyComplete(); + } + + @Test + public void testRequestBodyIsErrorShouldPropagateToResponse() { + HttpClient client = HttpClient.createDefault(); + HttpRequest request = new HttpRequest(HttpMethod.POST, url(server, "/shortPost")) + .header("Content-Length", "123") + .body(Flux.error(new RuntimeException("boo"))); + + StepVerifier.create(client.send(request)) + .expectErrorMessage("boo") + .verify(); + } + + @Test + public void testRequestBodyEndsInErrorShouldPropagateToResponse() { + HttpClient client = HttpClient.createDefault(); + String contentChunk = "abcdefgh"; + int repetitions = 1000; + HttpRequest request = new HttpRequest(HttpMethod.POST, url(server, "/shortPost")) + .header("Content-Length", String.valueOf(contentChunk.length() * repetitions)) + .body(Flux.just(contentChunk) + .repeat(repetitions) + .map(s -> ByteBuffer.wrap(s.getBytes(StandardCharsets.UTF_8))) + .concatWith(Flux.error(new RuntimeException("boo")))); + StepVerifier.create(client.send(request)) + // .awaitDone(10, TimeUnit.SECONDS) + .expectErrorMessage("boo") + .verify(); + } + + @Test(timeout = 5000) + public void testServerShutsDownSocketShouldPushErrorToContentFlowable() + throws IOException, InterruptedException { + CountDownLatch latch = new CountDownLatch(1); + AtomicReference sock = new AtomicReference<>(); + ServerSocket ss = new ServerSocket(0); + try { + Mono.fromCallable(() -> { + latch.countDown(); + Socket socket = ss.accept(); + sock.set(socket); + // give the client time to get request across + Thread.sleep(500); + // respond but don't send the complete response + byte[] bytes = new byte[1024]; + int n = socket.getInputStream().read(bytes); + System.out.println(new String(bytes, 0, n, StandardCharsets.UTF_8)); + String response = "HTTP/1.1 200 OK\r\n" // + + "Content-Type: text/plain\r\n" // + + "Content-Length: 10\r\n" // + + "\r\n" // + + "zi"; + OutputStream out = socket.getOutputStream(); + out.write(response.getBytes()); + out.flush(); + // kill the socket with HTTP response body incomplete + socket.close(); + return 1; + }) + .subscribeOn(Schedulers.elastic()) + .subscribe(); + // + latch.await(); + HttpClient client = HttpClient.createDefault(); + HttpRequest request = new HttpRequest(HttpMethod.GET, + new URL("http://localhost:" + ss.getLocalPort() + "/get")); + HttpResponse response = client.send(request).block(); + Assert.assertEquals(200, response.statusCode()); + System.out.println("reading body"); + // + StepVerifier.create(response.bodyAsByteArray()) + // .awaitDone(20, TimeUnit.SECONDS) + .verifyError(IOException.class); + } finally { + ss.close(); + } + } + + @Ignore("This flakey test fails often on MacOS. https://github.com/Azure/azure-sdk-for-java/issues/4357.") + @Test + public void testConcurrentRequests() throws NoSuchAlgorithmException { +// long t = System.currentTimeMillis(); +// int numRequests = 100; // 100 = 1GB of data read +// long timeoutSeconds = 60; +// ReactorNettyClient client = new ReactorNettyClient(); +// byte[] expectedDigest = digest(LONG_BODY); +// +// Mono numBytesMono = Flux.range(1, numRequests) +// .parallel(10) +// .runOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) +// .flatMap(n -> Mono.fromCallable(() -> getResponse(client, "/long")).flatMapMany(response -> { +// MessageDigest md = md5Digest(); +// return response.body() +// .doOnNext(bb -> { +// bb.retain(); +// if (bb.hasArray()) { +// // Heap buffer +// md.update(bb.array()); +// } else { +// // Direct buffer +// int len = bb.readableBytes(); +// byte[] array = new byte[len]; +// bb.getBytes(bb.readerIndex(), array); +// md.update(array); +// } +// }) +// .map(bb -> new NumberedByteBuf(n, bb)) +//// .doOnComplete(() -> System.out.println("completed " + n)) +// .doOnComplete(() -> Assert.assertArrayEquals("wrong digest!", expectedDigest, +// md.digest())); +// })) +// .sequential() +// // enable the doOnNext call to see request numbers and thread names +// // .doOnNext(g -> System.out.println(g.n + " " + +// // Thread.currentThread().getName())) +// .map(nbb -> { +// long bytesCount = (long) nbb.bb.readableBytes(); +// ReferenceCountUtil.release(nbb.bb); +// return bytesCount; +// }) +// .reduce((x, y) -> x + y) +// .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) +// .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)); +// +// StepVerifier.create(numBytesMono) +//// .awaitDone(timeoutSeconds, TimeUnit.SECONDS) +// .expectNext((long) (numRequests * LONG_BODY.getBytes(StandardCharsets.UTF_8).length)) +// .verifyComplete(); +//// +//// long numBytes = numBytesMono.block(); +//// t = System.currentTimeMillis() - t; +//// System.out.println("totalBytesRead=" + numBytes / 1024 / 1024 + "MB in " + t / 1000.0 + "s"); +//// assertEquals(numRequests * LONG_BODY.getBytes(StandardCharsets.UTF_8).length, numBytes); + + Assert.fail("Method needs to be reimplemented"); + } + + private static MessageDigest md5Digest() { + try { + return MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + + private static byte[] digest(String s) throws NoSuchAlgorithmException { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(s.getBytes(StandardCharsets.UTF_8)); + byte[] expectedDigest = md.digest(); + return expectedDigest; + } + + private static final class NumberedByteBuf { + final long n; + final ByteBuf bb; + + NumberedByteBuf(long n, ByteBuf bb) { + this.n = n; + this.bb = bb; + } + } + + private static ReactorNettyHttpResponse getResponse(String path) { + ReactorNettyClient client = new ReactorNettyClient(); + return getResponse(client, path); + } + + private static ReactorNettyHttpResponse getResponse(ReactorNettyClient client, String path) { + HttpRequest request = new HttpRequest(HttpMethod.GET, url(server, path)); + return (ReactorNettyHttpResponse) client.send(request).block(); + } + + private static URL url(WireMockServer server, String path) { + try { + return new URL("http://localhost:" + server.port() + path); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + + private static String createLongBody() { + StringBuilder s = new StringBuilder(10000000); + for (int i = 0; i < 1000000; i++) { + s.append("abcdefghijk"); + } + return s.toString(); + } + + private void checkBodyReceived(String expectedBody, String path) { + ReactorNettyClient client = new ReactorNettyClient(); + HttpResponse response = doRequest(client, path); + String s = new String(response.bodyAsByteArray().block(), + StandardCharsets.UTF_8); + Assert.assertEquals(expectedBody, s); + } + + private ReactorNettyHttpResponse doRequest(ReactorNettyClient client, String path) { + HttpRequest request = new HttpRequest(HttpMethod.GET, url(server, path)); + ReactorNettyHttpResponse response = (ReactorNettyHttpResponse) client.send(request).block(); + return response; + } +} diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithHttpProxyNettyTests.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithHttpProxyNettyTests.java similarity index 86% rename from sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithHttpProxyNettyTests.java rename to sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithHttpProxyNettyTests.java index 4cd0e9cb04a4..b12368bda744 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithHttpProxyNettyTests.java +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithHttpProxyNettyTests.java @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.implementation; +package com.azure.core.http.netty.implementation; import com.azure.core.http.HttpClient; import com.azure.core.http.ProxyOptions; import com.azure.core.http.ProxyOptions.Type; +import com.azure.core.implementation.RestProxyTests; import org.junit.Ignore; import java.net.InetSocketAddress; diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithNettyTests.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithNettyTests.java similarity index 75% rename from sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithNettyTests.java rename to sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithNettyTests.java index d5fec7bdffbd..6e879462f09b 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithNettyTests.java +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithNettyTests.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.implementation; +package com.azure.core.http.netty.implementation; import com.azure.core.http.HttpClient; +import com.azure.core.implementation.RestProxyTests; public class RestProxyWithNettyTests extends RestProxyTests { diff --git a/sdk/core/azure-core-http-netty/src/test/resources/upload.txt b/sdk/core/azure-core-http-netty/src/test/resources/upload.txt new file mode 100644 index 000000000000..ff3bb63948b4 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/test/resources/upload.txt @@ -0,0 +1 @@ +The quick brown fox jumps over the lazy dog \ No newline at end of file diff --git a/sdk/core/azure-core-management/pom.xml b/sdk/core/azure-core-management/pom.xml index 0644c64e9532..3767e2db548e 100644 --- a/sdk/core/azure-core-management/pom.xml +++ b/sdk/core/azure-core-management/pom.xml @@ -44,6 +44,7 @@ UTF-8 + com.azure.core.management @@ -69,7 +70,13 @@ com.azure azure-core-test - 1.0.0-preview.3 + 1.0.0-preview.4 + test + + + com.azure + azure-core-http-netty + 1.0.0-preview.4 test @@ -79,4 +86,5 @@ test
+ diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudError.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudError.java index 462ccbf967c2..d5e44cc951c1 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudError.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudError.java @@ -28,7 +28,7 @@ public final class CloudError { /** * Details for the error. */ - private List details; + private final List details; /** * Initializes a new instance of CloudError. diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/PagedList.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/PagedList.java index 60af05f9a643..d6066d6c3ad3 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/PagedList.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/PagedList.java @@ -4,6 +4,7 @@ package com.azure.core.management; import com.azure.core.exception.HttpResponseException; +import com.azure.core.util.logging.ClientLogger; import java.io.IOException; import java.util.ArrayList; @@ -21,8 +22,10 @@ * @param the element type. */ public abstract class PagedList implements List { + private final ClientLogger logger = new ClientLogger(PagedList.class); + /** The actual items in the list. */ - private List items; + private final List items; /** Stores the latest page fetched. */ private Page currentPage; /** Cached page right after the current one. */ @@ -67,7 +70,7 @@ private void cachePage(String nextPageLink) { } } } catch (IOException ex) { - throw new RuntimeException(ex); + throw logger.logExceptionAsError(new RuntimeException(ex)); } } @@ -137,6 +140,8 @@ protected void setCurrentPage(Page currentPage) { * The implementation of {@link ListIterator} for PagedList. */ private class ListItr implements ListIterator { + private final ClientLogger logger = new ClientLogger(ListItr.class); + /** * index of next element to return. */ @@ -164,7 +169,7 @@ public boolean hasNext() { public E next() { if (this.nextIndex >= items.size()) { if (!hasNextPage()) { - throw new NoSuchElementException(); + throw logger.logExceptionAsError(new NoSuchElementException()); } else { loadNextPage(); } @@ -179,7 +184,7 @@ public E next() { } catch (IndexOutOfBoundsException ex) { // The nextIndex got invalid means a different instance of iterator // removed item from this index. - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } } @@ -187,14 +192,14 @@ public E next() { @Override public void remove() { if (this.lastRetIndex < 0) { - throw new IllegalStateException(); + throw logger.logExceptionAsError(new IllegalStateException()); } else { try { items.remove(this.lastRetIndex); this.nextIndex = this.lastRetIndex; this.lastRetIndex = -1; } catch (IndexOutOfBoundsException ex) { - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } } @@ -208,16 +213,16 @@ public boolean hasPrevious() { public E previous() { int i = this.nextIndex - 1; if (i < 0) { - throw new NoSuchElementException(); + throw logger.logExceptionAsError(new NoSuchElementException()); } else if (i >= items.size()) { - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException()); } else { try { this.nextIndex = i; this.lastRetIndex = i; return items.get(this.lastRetIndex); } catch (IndexOutOfBoundsException ex) { - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } } @@ -235,12 +240,12 @@ public int previousIndex() { @Override public void set(E e) { if (this.lastRetIndex < 0) { - throw new IllegalStateException(); + throw logger.logExceptionAsError(new IllegalStateException()); } else { try { items.set(this.lastRetIndex, e); } catch (IndexOutOfBoundsException ex) { - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } } @@ -252,7 +257,7 @@ public void add(E e) { this.nextIndex = this.nextIndex + 1; this.lastRetIndex = -1; } catch (IndexOutOfBoundsException ex) { - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureAsyncOperationPollStrategy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureAsyncOperationPollStrategy.java index cd83e122cbd1..8054078d0557 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureAsyncOperationPollStrategy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureAsyncOperationPollStrategy.java @@ -11,6 +11,7 @@ import com.azure.core.management.AsyncOperationResource; import com.azure.core.management.CloudException; import com.azure.core.management.OperationState; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.io.IOException; @@ -23,6 +24,8 @@ * running operation. */ public final class AzureAsyncOperationPollStrategy extends PollStrategy { + private final ClientLogger logger = new ClientLogger(AzureAsyncOperationPollStrategy.class); + private AzureAsyncOperationPollStrategyData data; /** @@ -59,11 +62,11 @@ private static class AzureAsyncOperationPollStrategyData extends PollStrategyDat * Create a new AzureAsyncOperationPollStrategyData object that will poll the provided operation * resource URL. * @param operationResourceUrl The URL of the operation resource this pollStrategy will poll. - * @param originalResourceUrl The URL of the resource that the long running operation is + * @param originalResourceUrl The URL of the resource that the long running operation is * operating on. - * @param locationUrl The location uri received from service along with operationResourceUrl. - * @param initialHttpMethod The http method used to initiate the long running operation - * @param delayInMilliseconds The delay (in milliseconds) that the pollStrategy will use when + * @param locationUrl The location uri received from service along with operationResourceUrl. + * @param initialHttpMethod The http method used to initiate the long running operation + * @param delayInMilliseconds The delay (in milliseconds) that the pollStrategy will use when * polling. */ AzureAsyncOperationPollStrategyData(RestProxy restProxy, SwaggerMethodParser methodParser, URL operationResourceUrl, URL originalResourceUrl, URL locationUrl, HttpMethod initialHttpMethod, long delayInMilliseconds) { @@ -100,7 +103,7 @@ public HttpRequest createPollRequest() { pollUrl = data.originalResourceUrl; } } else { - throw new IllegalStateException("Polling is completed and did not succeed. Cannot create a polling request."); + throw logger.logExceptionAsError(new IllegalStateException("Polling is completed and did not succeed. Cannot create a polling request.")); } return new HttpRequest(HttpMethod.GET, pollUrl); @@ -122,7 +125,7 @@ public Mono updateFromAsync(HttpResponse httpPollResponse) { } catch (IOException ignored) { } // if (operationResource == null || operationResource.status() == null) { - throw new CloudException("The polling response does not contain a valid body", bufferedHttpPollResponse, null); + throw logger.logExceptionAsError(new CloudException("The polling response does not contain a valid body", bufferedHttpPollResponse, null)); } else { final String status = operationResource.status(); setStatus(status); @@ -133,7 +136,7 @@ public Mono updateFromAsync(HttpResponse httpPollResponse) { clearDelayInMilliseconds(); if (!data.pollingSucceeded) { - throw new CloudException("Async operation failed with provisioning state: " + status, bufferedHttpPollResponse); + throw logger.logExceptionAsError(new CloudException("Async operation failed with provisioning state: " + status, bufferedHttpPollResponse)); } if (operationResource.id() != null) { diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java index d892d00ce718..ecc119b3c06b 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java @@ -30,6 +30,7 @@ import com.azure.core.management.annotations.AzureHost; import com.azure.core.management.serializer.AzureJacksonAdapter; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -52,6 +53,7 @@ */ public final class AzureProxy extends RestProxy { private static long defaultPollingDelayInMilliseconds = 30 * 1000; + private final ClientLogger logger = new ClientLogger(AzureProxy.class); /** * Create a new instance of RestProxy. @@ -226,7 +228,7 @@ protected Object handleHttpResponse(final HttpRequest httpRequest, Mono final Type operationStatusResultType = ((ParameterizedType) operationStatusType).getActualTypeArguments()[0]; @@ -257,7 +259,7 @@ protected Object handleResumeOperation(final HttpRequest httpRequest, Context context) { final Type operationStatusType = ((ParameterizedType) returnType).getActualTypeArguments()[0]; if (!TypeUtil.isTypeOrSubTypeOf(operationStatusType, OperationStatus.class)) { - throw new InvalidReturnTypeException("AzureProxy only supports swagger interface methods that return Flux (such as " + methodParser.fullyQualifiedMethodName() + "()) if the Flux's inner type that is OperationStatus (not " + returnType.toString() + ")."); + throw logger.logExceptionAsError(new InvalidReturnTypeException("AzureProxy only supports swagger interface methods that return Flux (such as " + methodParser.fullyQualifiedMethodName() + "()) if the Flux's inner type that is OperationStatus (not " + returnType.toString() + ").")); } PollStrategy.PollStrategyData pollStrategyData = @@ -307,7 +309,7 @@ private Mono createPollStrategy(final HttpRequest originalHttpRequ if (pollStrategy == null) { pollStrategy = LocationPollStrategy.tryToCreate(AzureProxy.this, methodParser, originalHttpRequest, originalHttpResponse, delayInMilliseconds); if (pollStrategy == null) { - throw new CloudException("Response does not contain an Azure-AsyncOperation or Location header.", originalHttpResponse); + throw logger.logExceptionAsError(new CloudException("Response does not contain an Azure-AsyncOperation or Location header.", originalHttpResponse)); } } } @@ -342,7 +344,7 @@ private Mono createProvisioningStateOrCompletedPollStrategy(final pollStrategyMono = bufferedOriginalHttpResponse.bodyAsString() .map(originalHttpResponseBody -> { if (originalHttpResponseBody == null || originalHttpResponseBody.isEmpty()) { - throw new CloudException("The HTTP response does not contain a body.", bufferedOriginalHttpResponse); + throw logger.logExceptionAsError(new CloudException("The HTTP response does not contain a body.", bufferedOriginalHttpResponse)); } PollStrategy pollStrategy; try { @@ -358,7 +360,7 @@ private Mono createProvisioningStateOrCompletedPollStrategy(final AzureProxy.this, methodParser, bufferedOriginalHttpResponse)); } } catch (IOException e) { - throw Exceptions.propagate(e); + throw logger.logExceptionAsError(Exceptions.propagate(e)); } return pollStrategy; }); diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/CompletedPollStrategy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/CompletedPollStrategy.java index cfda53c45496..0ab2012dbc36 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/CompletedPollStrategy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/CompletedPollStrategy.java @@ -9,6 +9,7 @@ import com.azure.core.implementation.SwaggerMethodParser; import com.azure.core.management.OperationState; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -20,6 +21,8 @@ * further polling. */ public class CompletedPollStrategy extends PollStrategy { + private final ClientLogger logger = new ClientLogger(CompletedPollStrategy.class); + private final HttpResponse firstHttpResponse; private CompletedPollStrategyData data; @@ -65,7 +68,7 @@ PollStrategy initializeStrategy(RestProxy restProxy, @Override public HttpRequest createPollRequest() { - throw new UnsupportedOperationException(); + throw logger.logExceptionAsError(new UnsupportedOperationException()); } @Override diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/LocationPollStrategy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/LocationPollStrategy.java index 89d7af92d12f..f1232c4b3906 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/LocationPollStrategy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/LocationPollStrategy.java @@ -8,6 +8,7 @@ import com.azure.core.http.HttpResponse; import com.azure.core.implementation.RestProxy; import com.azure.core.implementation.SwaggerMethodParser; +import com.azure.core.util.logging.ClientLogger; import reactor.core.Exceptions; import reactor.core.publisher.Mono; @@ -21,6 +22,8 @@ * operation. */ public final class LocationPollStrategy extends PollStrategy { + private final ClientLogger logger = new ClientLogger(LocationPollStrategy.class); + LocationPollStrategyData data; /** @@ -91,7 +94,7 @@ public Mono updateFromAsync(HttpResponse httpPollResponse) { try { data.locationUrl = new URL(newLocationUrl); } catch (MalformedURLException mfue) { - throw Exceptions.propagate(mfue); + throw logger.logExceptionAsError(Exceptions.propagate(mfue)); } } } else { diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ProvisioningStatePollStrategy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ProvisioningStatePollStrategy.java index affef85b7a56..6c07ee8d3dd8 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ProvisioningStatePollStrategy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ProvisioningStatePollStrategy.java @@ -10,6 +10,7 @@ import com.azure.core.implementation.SwaggerMethodParser; import com.azure.core.management.CloudException; import com.azure.core.management.OperationState; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.io.IOException; @@ -20,7 +21,7 @@ * state property is in a completed state. */ public final class ProvisioningStatePollStrategy extends PollStrategy { - + private final ClientLogger logger = new ClientLogger(ProvisioningStatePollStrategy.class); private ProvisioningStatePollStrategyData data; ProvisioningStatePollStrategy(ProvisioningStatePollStrategyData data) { @@ -87,9 +88,9 @@ Mono updateFromAsync(HttpResponse pollResponse) { } if (resource == null || resource.properties() == null || resource.properties().provisioningState() == null) { - throw new CloudException("The polling response does not contain a valid body", bufferedHttpPollResponse, null); + throw logger.logExceptionAsError(new CloudException("The polling response does not contain a valid body", bufferedHttpPollResponse, null)); } else if (OperationState.isFailedOrCanceled(resource.properties().provisioningState())) { - throw new CloudException("Async operation failed with provisioning state: " + resource.properties().provisioningState(), bufferedHttpPollResponse); + throw logger.logExceptionAsError(new CloudException("Async operation failed with provisioning state: " + resource.properties().provisioningState(), bufferedHttpPollResponse)); } else { setStatus(resource.properties().provisioningState()); } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/serializer/CloudErrorDeserializer.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/serializer/CloudErrorDeserializer.java index d189374d4f7d..fdb443dcbd52 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/serializer/CloudErrorDeserializer.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/serializer/CloudErrorDeserializer.java @@ -19,7 +19,7 @@ */ final class CloudErrorDeserializer extends JsonDeserializer { /** Object mapper for default deserializations. */ - private ObjectMapper mapper; + private final ObjectMapper mapper; /** * Creates an instance of CloudErrorDeserializer. diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyWithNettyTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyWithNettyTests.java deleted file mode 100644 index 30fdd2481542..000000000000 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyWithNettyTests.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.management; - -import com.azure.core.http.HttpClient; - -public class AzureProxyToRestProxyWithNettyTests extends AzureProxyToRestProxyTests { - - @Override - protected HttpClient createHttpClient() { - return HttpClient.createDefault(); - } -} diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/AzureProxyToRestProxyWithDefaultHttpClientTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/AzureProxyToRestProxyWithDefaultHttpClientTests.java new file mode 100644 index 000000000000..82e0054186ee --- /dev/null +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/AzureProxyToRestProxyWithDefaultHttpClientTests.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.management.http; + +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureProxyToRestProxyTests; + +public class AzureProxyToRestProxyWithDefaultHttpClientTests extends AzureProxyToRestProxyTests { + + @Override + protected HttpClient createHttpClient() { + return HttpClient.createDefault(); + } +} diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/MockAzureHttpClient.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/MockAzureHttpClient.java index 00f5e943a014..db3c251be230 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/MockAzureHttpClient.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/MockAzureHttpClient.java @@ -288,7 +288,7 @@ private static Map queryToMap(String url) { } private static String bodyToString(HttpRequest request) throws IOException { - Mono asyncString = FluxUtil.collectBytesInByteBufStream(request.body(), false) + Mono asyncString = FluxUtil.collectBytesInByteBufferStream(request.body()) .map(bytes -> new String(bytes, StandardCharsets.UTF_8)); return asyncString.block(); } diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/Value.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/Value.java index eb1191d90f12..d78c093467d4 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/Value.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/Value.java @@ -6,7 +6,7 @@ /** * A container for a generic type. Serves a similar purpose as pointers in C/C++. It's a workaround * for the fact that Java doesn't allow mutation of local variables in closure. - * @param + * @param The type of the object stored within the {@link Value} instance */ public class Value { private T value; @@ -19,7 +19,7 @@ public class Value { /** * Create a new Value with the provided inner value. - * @param value + * @param value The type of the object stored within the {@link Value} instance */ Value(T value) { set(value); diff --git a/sdk/core/azure-core-test/README.md b/sdk/core/azure-core-test/README.md index 6bd321f2e250..1f208b0159c0 100644 --- a/sdk/core/azure-core-test/README.md +++ b/sdk/core/azure-core-test/README.md @@ -116,3 +116,5 @@ If you would like to become an active contributor to this project please follow [RecordedData.java]: ./src/main/java/com/azure/core/test/models/RecordedData.java [RecordNetworkCallPolicy.java]: ./src/main/java/com/azure/core/test/policy/RecordNetworkCallPolicy.java [TestBase.java]: ./src/main/java/com/azure/core/test/TestBase.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/core/azure-core-test/README.png) diff --git a/sdk/core/azure-core-test/pom.xml b/sdk/core/azure-core-test/pom.xml index 1dfe550f3e2e..a1711c507603 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -32,6 +32,10 @@ scm:git:https://github.com/Azure/azure-sdk-for-java.git + + com.azure.core.test + + com.azure diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/TestBase.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/TestBase.java index 6bc1b4a0e6ae..2f1a9aa734cd 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/TestBase.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/TestBase.java @@ -82,8 +82,8 @@ public TestMode getTestMode() { /** * Gets the name of the current test being run. *

- * NOTE: This could not be implemented in the base class using {@link TestName} because it always returns {@code - * null}. See https://stackoverflow.com/a/16113631/4220757. + * NOTE: This could not be implemented in the base class using {@link TestName} because it always returns + * {@code null}. See https://stackoverflow.com/a/16113631/4220757. * * @return The name of the current test. */ diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpResponse.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpResponse.java index 92e995f8c9a0..d3b3e3d0bdff 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpResponse.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpResponse.java @@ -10,12 +10,11 @@ import com.azure.core.implementation.serializer.SerializerEncoding; import com.azure.core.implementation.serializer.jackson.JacksonAdapter; import com.azure.core.implementation.util.ImplUtils; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.io.IOException; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Objects; @@ -135,11 +134,11 @@ public Mono bodyAsByteArray() { * {@inheritDoc} */ @Override - public Flux body() { + public Flux body() { if (bodyBytes == null) { return Flux.empty(); } else { - return Flux.just(Unpooled.wrappedBuffer(bodyBytes)); + return Flux.just(ByteBuffer.wrap(bodyBytes)); } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/PlaybackClient.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/PlaybackClient.java index fc3641a95017..cf75085a00e9 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/PlaybackClient.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/PlaybackClient.java @@ -7,13 +7,14 @@ import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; import com.azure.core.http.ProxyOptions; +import com.azure.core.implementation.http.UrlBuilder; import com.azure.core.test.models.NetworkCallRecord; import com.azure.core.test.models.RecordedData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.azure.core.util.logging.ClientLogger; +import reactor.core.Exceptions; import reactor.core.publisher.Mono; -import java.net.URI; +import java.io.ByteArrayOutputStream; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; @@ -25,14 +26,14 @@ * HTTP client that plays back {@link NetworkCallRecord NetworkCallRecords}. */ public final class PlaybackClient implements HttpClient { - private final Logger logger = LoggerFactory.getLogger(PlaybackClient.class); + private final ClientLogger logger = new ClientLogger(PlaybackClient.class); private final AtomicInteger count = new AtomicInteger(0); private final Map textReplacementRules; private final RecordedData recordedData; /** - * Creates a PlaybackClient that replays network calls from {@code recordedData} and replaces - * {@link NetworkCallRecord#response() response text} for any rules specified in {@code textReplacementRules}. + * Creates a PlaybackClient that replays network calls from {@code recordedData} and replaces {@link + * NetworkCallRecord#response() response text} for any rules specified in {@code textReplacementRules}. * * @param recordedData The data to playback. * @param textReplacementRules A set of rules to replace text in network call responses. @@ -88,14 +89,16 @@ private Mono playbackHttpResponse(final HttpRequest request) { count.incrementAndGet(); if (networkCallRecord == null) { - if (logger.isWarnEnabled()) { - logger.warn("NOT FOUND - Method: {} URL: {}", incomingMethod, incomingUrl); - logger.warn("Records requested: {}.", count); - } + logger.warning("NOT FOUND - Method: {} URL: {}", incomingMethod, incomingUrl); + logger.warning("Records requested: {}.", count); return Mono.error(new IllegalStateException("==> Unexpected request: " + incomingMethod + " " + incomingUrl)); } + if (networkCallRecord.exception() != null) { + throw logger.logExceptionAsWarning(Exceptions.propagate(networkCallRecord.exception().get())); + } + int recordStatusCode = Integer.parseInt(networkCallRecord.response().get("StatusCode")); HttpHeaders headers = new HttpHeaders(); @@ -112,7 +115,7 @@ private Mono playbackHttpResponse(final HttpRequest request) { } String rawBody = networkCallRecord.response().get("Body"); - byte[] bytes = new byte[0]; + byte[] bytes = null; if (rawBody != null) { for (Map.Entry rule : textReplacementRules.entrySet()) { @@ -121,7 +124,20 @@ private Mono playbackHttpResponse(final HttpRequest request) { } } - bytes = rawBody.getBytes(StandardCharsets.UTF_8); + String contentType = networkCallRecord.response().get("Content-Type"); + + // octet-stream's are written to disk using Arrays.toString() which creates an output such as "[12, -1]". + if (contentType != null && contentType.equalsIgnoreCase("application/octet-stream")) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + for (String piece : rawBody.substring(1, rawBody.length() - 1).split(", ")) { + outputStream.write(Byte.parseByte(piece)); + } + + bytes = outputStream.toByteArray(); + } else { + bytes = rawBody.getBytes(StandardCharsets.UTF_8); + } + if (bytes.length > 0) { headers.put("Content-Length", String.valueOf(bytes.length)); } @@ -141,7 +157,12 @@ private String applyReplacementRule(String text) { } private static String removeHost(String url) { - URI uri = URI.create(url); - return String.format("%s?%s", uri.getPath(), uri.getQuery()); + UrlBuilder urlBuilder = UrlBuilder.parse(url); + + if (urlBuilder.query().containsKey("sig")) { + urlBuilder.setQueryParameter("sig", "REDACTED"); + } + + return String.format("%s%s", urlBuilder.path(), urlBuilder.queryString()); } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallError.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallError.java new file mode 100644 index 000000000000..a9bd6025550f --- /dev/null +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallError.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.test.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.UnknownHostException; + +/** + * This class represents a caught throwable during a network call. It is used to serialize exceptions that were thrown + * during the pipeline and deserialize them back into their actual throwable class when running in playback mode. + */ +public class NetworkCallError { + @JsonProperty("Throwable") + private Throwable throwable; + + @JsonProperty("ClassName") + private String className; + + /** + * Empty constructor used by deserialization. + */ + public NetworkCallError() { + } + + /** + * Constructs the class setting the throwable and its class name. + * + * @param throwable Throwable thrown during a network call. + */ + public NetworkCallError(Throwable throwable) { + this.throwable = throwable; + this.className = throwable.getClass().getName(); + } + + /** + * @return the thrown throwable as the class it was thrown as by converting is using its class name. + */ + public Throwable get() { + switch (className) { + case "java.lang.NullPointerException": + return new NullPointerException(throwable.getMessage()); + + case "java.lang.IndexOutOfBoundsException": + return new IndexOutOfBoundsException(throwable.getMessage()); + + case "java.net.UnknownHostException": + return new UnknownHostException(throwable.getMessage()); + + default: + return throwable; + } + } + + /** + * Sets the throwable that was thrown during a network call. + * + * @param throwable Throwable that was thrown. + */ + public void throwable(Throwable throwable) { + this.throwable = throwable; + } + + /** + * Sets the name of the class of the throwable. This is used during deserialization the construct the throwable + * as the actual class that was thrown. + * + * @param className Class name of the throwable. + */ + public void className(String className) { + this.className = className; + } +} diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallRecord.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallRecord.java index e7a080912a2b..ca6446e591ff 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallRecord.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallRecord.java @@ -23,6 +23,9 @@ public class NetworkCallRecord { @JsonProperty("Response") private Map response; + @JsonProperty("Exception") + private NetworkCallError exception; + /** * Gets the HTTP method for with this network call * @@ -96,4 +99,22 @@ public Map response() { public void response(Map response) { this.response = response; } + + /** + * Gets the throwable thrown during evaluation of the network call. + * + * @return Throwable thrown during the network call. + */ + public NetworkCallError exception() { + return exception; + } + + /** + * Sets the throwable thrown during evaluation of the network call. + * + * @param exception Throwable thrown during the network call. + */ + public void exception(NetworkCallError exception) { + this.exception = exception; + } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/RecordNetworkCallPolicy.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/RecordNetworkCallPolicy.java index df9d27cabe25..0fb90cf536d0 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/RecordNetworkCallPolicy.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/RecordNetworkCallPolicy.java @@ -8,30 +8,48 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.implementation.http.UrlBuilder; +import com.azure.core.test.models.NetworkCallError; import com.azure.core.test.models.NetworkCallRecord; import com.azure.core.test.models.RecordedData; -import io.netty.handler.codec.http.HttpResponseStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.azure.core.util.logging.ClientLogger; import reactor.core.Exceptions; import reactor.core.publisher.Mono; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.net.HttpURLConnection; import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Base64; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.zip.GZIPInputStream; /** - * HTTP Pipeline policy that keeps track of each HTTP request and response that flows through the pipeline. - * Data is recorded into {@link RecordedData}. + * HTTP Pipeline policy that keeps track of each HTTP request and response that flows through the pipeline. Data is + * recorded into {@link RecordedData}. */ public class RecordNetworkCallPolicy implements HttpPipelinePolicy { private static final int DEFAULT_BUFFER_LENGTH = 1024; - private final Logger logger = LoggerFactory.getLogger(RecordNetworkCallPolicy.class); + private static final String CONTENT_TYPE = "Content-Type"; + private static final String CONTENT_ENCODING = "Content-Encoding"; + private static final String X_MS_VERSION = "x-ms-version"; + private static final String USER_AGENT = "User-Agent"; + private static final String STATUS_CODE = "StatusCode"; + private static final String BODY = "Body"; + private static final String SIG = "sig"; + + private static final Pattern DELEGATIONKEY_KEY_PATTERN = Pattern.compile("(?:)(.*)(?:)"); + private static final Pattern DELEGATIONKEY_CLIENTID_PATTERN = Pattern.compile("(?:)(.*)(?:)"); + private static final Pattern DELEGATIONKEY_TENANTID_PATTERN = Pattern.compile("(?:)(.*)(?:)"); + + private final ClientLogger logger = new ClientLogger(RecordNetworkCallPolicy.class); private final RecordedData recordedData; /** @@ -49,45 +67,54 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN final NetworkCallRecord networkCallRecord = new NetworkCallRecord(); Map headers = new HashMap<>(); - if (context.httpRequest().headers().value("Content-Type") != null) { - headers.put("Content-Type", context.httpRequest().headers().value("Content-Type")); + if (context.httpRequest().headers().value(CONTENT_TYPE) != null) { + headers.put(CONTENT_TYPE, context.httpRequest().headers().value(CONTENT_TYPE)); } - if (context.httpRequest().headers().value("x-ms-version") != null) { - headers.put("x-ms-version", context.httpRequest().headers().value("x-ms-version")); + if (context.httpRequest().headers().value(X_MS_VERSION) != null) { + headers.put(X_MS_VERSION, context.httpRequest().headers().value(X_MS_VERSION)); } - if (context.httpRequest().headers().value("User-Agent") != null) { - headers.put("User-Agent", context.httpRequest().headers().value("User-Agent")); + if (context.httpRequest().headers().value(USER_AGENT) != null) { + headers.put(USER_AGENT, context.httpRequest().headers().value(USER_AGENT)); } networkCallRecord.headers(headers); networkCallRecord.method(context.httpRequest().httpMethod().toString()); - networkCallRecord.uri(context.httpRequest().url().toString().replaceAll("\\?$", "")); - return next.process().flatMap(httpResponse -> { - final HttpResponse bufferedResponse = httpResponse.buffer(); - - return extractResponseData(bufferedResponse).map(responseData -> { - networkCallRecord.response(responseData); - String body = responseData.get("Body"); - - // Remove pre-added header if this is a waiting or redirection - if (body != null && body.contains("InProgress") - || Integer.parseInt(responseData.get("StatusCode")) == HttpResponseStatus.TEMPORARY_REDIRECT.code()) { - if (logger.isInfoEnabled()) { + // Remove sensitive information such as SAS token signatures from the recording. + UrlBuilder urlBuilder = UrlBuilder.parse(context.httpRequest().url()); + if (urlBuilder.query().containsKey(SIG)) { + urlBuilder.setQueryParameter(SIG, "REDACTED"); + } + networkCallRecord.uri(urlBuilder.toString().replaceAll("\\?$", "")); + + return next.process() + .doOnError(throwable -> { + networkCallRecord.exception(new NetworkCallError(throwable)); + recordedData.addNetworkCall(networkCallRecord); + throw logger.logExceptionAsWarning(Exceptions.propagate(throwable)); + }).flatMap(httpResponse -> { + final HttpResponse bufferedResponse = httpResponse.buffer(); + + return extractResponseData(bufferedResponse).map(responseData -> { + networkCallRecord.response(responseData); + String body = responseData.get(BODY); + + // Remove pre-added header if this is a waiting or redirection + if (body != null && body.contains("InProgress") + || Integer.parseInt(responseData.get(STATUS_CODE)) == HttpURLConnection.HTTP_MOVED_TEMP) { logger.info("Waiting for a response or redirection."); + } else { + recordedData.addNetworkCall(networkCallRecord); } - } else { - recordedData.addNetworkCall(networkCallRecord); - } - return bufferedResponse; + return bufferedResponse; + }); }); - }); } private Mono> extractResponseData(final HttpResponse response) { final Map responseData = new HashMap<>(); - responseData.put("StatusCode", Integer.toString(response.statusCode())); + responseData.put(STATUS_CODE, Integer.toString(response.statusCode())); boolean addedRetryAfter = false; for (HttpHeader header : response.headers()) { @@ -104,40 +131,77 @@ private Mono> extractResponseData(final HttpResponse respons responseData.put("retry-after", "0"); } - String contentType = response.headerValue("content-type"); + String contentType = response.headerValue(CONTENT_TYPE); if (contentType == null) { return Mono.just(responseData); - } else if (contentType.contains("json") || response.headerValue("content-encoding") == null) { - return response.bodyAsString().switchIfEmpty(Mono.just("")).map(content -> { - responseData.put("Body", content); + } else if (contentType.equalsIgnoreCase("application/octet-stream")) { + return response.bodyAsByteArray().switchIfEmpty(Mono.just(new byte[0])).map(bytes -> { + if (bytes.length == 0) { + return responseData; + } + + responseData.put(BODY, Arrays.toString(bytes)); + return responseData; + }); + } else if (contentType.contains("json") || response.headerValue(CONTENT_ENCODING) == null) { + return response.bodyAsString(StandardCharsets.UTF_8).switchIfEmpty(Mono.just("")).map(content -> { + responseData.put(BODY, redactUserDelegationKey(content)); return responseData; }); } else { - return response.bodyAsByteArray().map(bytes -> { + return response.bodyAsByteArray().switchIfEmpty(Mono.just(new byte[0])).map(bytes -> { + if (bytes.length == 0) { + return responseData; + } + String content; - try (GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); - ByteArrayOutputStream output = new ByteArrayOutputStream()) { - byte[] buffer = new byte[DEFAULT_BUFFER_LENGTH]; - int position = 0; - int bytesRead = gis.read(buffer, position, buffer.length); - - while (bytesRead != -1) { - output.write(buffer, 0, bytesRead); - position += bytesRead; - bytesRead = gis.read(buffer, position, buffer.length); + if ("gzip".equalsIgnoreCase(response.headerValue(CONTENT_ENCODING))) { + try (GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); + ByteArrayOutputStream output = new ByteArrayOutputStream()) { + byte[] buffer = new byte[DEFAULT_BUFFER_LENGTH]; + int position = 0; + int bytesRead = gis.read(buffer, position, buffer.length); + + while (bytesRead != -1) { + output.write(buffer, 0, bytesRead); + position += bytesRead; + bytesRead = gis.read(buffer, position, buffer.length); + } + + content = new String(output.toByteArray(), StandardCharsets.UTF_8); + } catch (IOException e) { + throw logger.logExceptionAsWarning(Exceptions.propagate(e)); } - - content = new String(output.toByteArray(), StandardCharsets.UTF_8); - } catch (IOException e) { - throw Exceptions.propagate(e); + } else { + content = new String(bytes, StandardCharsets.UTF_8); } - responseData.remove("content-encoding"); - responseData.put("content-length", Integer.toString(content.length())); + responseData.remove(CONTENT_ENCODING); + responseData.put("Content-Length", Integer.toString(content.length())); - responseData.put("body", content); + responseData.put(BODY, content); return responseData; }); } } + + private String redactUserDelegationKey(String content) { + if (!content.contains("UserDelegationKey")) { + return content; + } + + content = redactionReplacement(content, DELEGATIONKEY_KEY_PATTERN.matcher(content), Base64.getEncoder().encodeToString("REDACTED".getBytes(StandardCharsets.UTF_8))); + content = redactionReplacement(content, DELEGATIONKEY_CLIENTID_PATTERN.matcher(content), UUID.randomUUID().toString()); + content = redactionReplacement(content, DELEGATIONKEY_TENANTID_PATTERN.matcher(content), UUID.randomUUID().toString()); + + return content; + } + + private String redactionReplacement(String content, Matcher matcher, String replacement) { + while (matcher.find()) { + content = content.replace(matcher.group(1), replacement); + } + + return content; + } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestResourceNamer.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestResourceNamer.java index c5b939230f0e..423d3843eb2c 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestResourceNamer.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestResourceNamer.java @@ -6,6 +6,8 @@ import com.azure.core.test.TestMode; import com.azure.core.test.models.RecordedData; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; import java.util.Objects; /** @@ -64,4 +66,19 @@ public String randomUuid() { return uuid; } } + + /** + * Gets an OffsetDateTime of UTC now. + * + * @return OffsetDateTime of UTC now. + */ + public OffsetDateTime now() { + if (testMode == TestMode.PLAYBACK) { + return OffsetDateTime.parse(recordedData.removeVariable()); + } else { + OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC); + recordedData.addVariable(now.toString()); + return now; + } + } } diff --git a/sdk/core/azure-core/README.md b/sdk/core/azure-core/README.md index 1cb9a0ffe9c6..6d5e5e6b2c36 100644 --- a/sdk/core/azure-core/README.md +++ b/sdk/core/azure-core/README.md @@ -75,3 +75,5 @@ If you would like to become an active contributor to this project please follow 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/core/azure-core/README.png) \ No newline at end of file diff --git a/sdk/core/azure-core/pom.xml b/sdk/core/azure-core/pom.xml index 445d02a09685..f81d06772c01 100644 --- a/sdk/core/azure-core/pom.xml +++ b/sdk/core/azure-core/pom.xml @@ -44,6 +44,7 @@ UTF-8 + com.azure.core @@ -54,22 +55,6 @@ - - io.netty - netty-handler - - - io.netty - netty-handler-proxy - - - io.netty - netty-buffer - - - io.netty - netty-codec-http - com.fasterxml.jackson.datatype jackson-datatype-jsr310 @@ -94,8 +79,9 @@ - io.projectreactor.netty - reactor-netty + io.projectreactor + reactor-core + 3.2.10.RELEASE io.projectreactor @@ -162,6 +148,20 @@ test + + + + maven-jar-plugin + + + test-jar + test-compile + + test-jar + + + + diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/credentials/AccessToken.java b/sdk/core/azure-core/src/main/java/com/azure/core/credentials/AccessToken.java index 711bd4ba3118..ec508ea6bb58 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/credentials/AccessToken.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/credentials/AccessToken.java @@ -9,8 +9,8 @@ * Represents an immutable access token with a token string and an expiration time. */ public class AccessToken { - private String token; - private OffsetDateTime expiresOn; + private final String token; + private final OffsetDateTime expiresOn; /** * Creates an access token instance. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/credentials/BasicAuthenticationCredential.java b/sdk/core/azure-core/src/main/java/com/azure/core/credentials/BasicAuthenticationCredential.java index a86eeeb09a20..6a1426039eee 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/credentials/BasicAuthenticationCredential.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/credentials/BasicAuthenticationCredential.java @@ -4,6 +4,7 @@ package com.azure.core.credentials; import com.azure.core.implementation.util.Base64Util; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.io.UnsupportedEncodingException; @@ -13,15 +14,16 @@ * Basic Auth credentials for use with a REST Service Client. */ public class BasicAuthenticationCredential implements TokenCredential { + private final ClientLogger logger = new ClientLogger(BasicAuthenticationCredential.class); /** * Basic auth user name. */ - private String userName; + private final String userName; /** * Basic auth password. */ - private String password; + private final String password; /** * Creates a basic authentication credential. @@ -45,7 +47,7 @@ public Mono getToken(String... scopes) { encodedCredential = Base64Util.encodeToString(credential.getBytes("UTF8")); } catch (UnsupportedEncodingException e) { // The encoding is hard-coded, so if it's unsupported, it needs to be fixed right here. - throw new RuntimeException(e); + throw logger.logExceptionAsError(new RuntimeException(e)); } return Mono.just(new AccessToken(encodedCredential, OffsetDateTime.MAX)); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpResponseException.java b/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpResponseException.java index 559b0e5934fc..d6320a6abcd7 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpResponseException.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpResponseException.java @@ -14,7 +14,7 @@ public class HttpResponseException extends AzureException { /** * The HTTP response value. */ - private Object value; + private final Object value; /** * Information about the associated HTTP response. @@ -29,6 +29,7 @@ public class HttpResponseException extends AzureException { */ public HttpResponseException(final String message, final HttpResponse response) { super(message); + this.value = null; this.response = response; } @@ -54,6 +55,7 @@ public HttpResponseException(final String message, final HttpResponse response, */ public HttpResponseException(final String message, final HttpResponse response, final Throwable cause) { super(message, cause); + this.value = null; this.response = response; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpClient.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpClient.java index de3f86fc5994..1326f20e6c54 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpClient.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpClient.java @@ -3,6 +3,7 @@ package com.azure.core.http; +import com.azure.core.implementation.http.spi.HttpClientProviders; import reactor.core.publisher.Mono; import java.util.function.Supplier; @@ -25,7 +26,7 @@ public interface HttpClient { * @return the HttpClient */ static HttpClient createDefault() { - return new ReactorNettyClient(); + return HttpClientProviders.createInstance(); } /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpRequest.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpRequest.java index 930153ab1459..b406c5ae9b4c 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpRequest.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpRequest.java @@ -3,12 +3,11 @@ package com.azure.core.http; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import java.io.Serializable; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; /** @@ -20,7 +19,7 @@ public class HttpRequest implements Serializable { private HttpMethod httpMethod; private URL url; private HttpHeaders headers; - private Flux body; + private Flux body; /** * Create a new HttpRequest instance. @@ -42,7 +41,7 @@ public HttpRequest(HttpMethod httpMethod, URL url) { * @param headers the HTTP headers to use with this request * @param body the request content */ - public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux body) { + public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux body) { this.httpMethod = httpMethod; this.url = url; this.headers = headers; @@ -127,7 +126,7 @@ public HttpRequest header(String name, String value) { * * @return the content to be send */ - public Flux body() { + public Flux body() { return body; } @@ -151,8 +150,7 @@ public HttpRequest body(String content) { */ public HttpRequest body(byte[] content) { headers.put("Content-Length", String.valueOf(content.length)); - // Unpooled.wrappedBuffer(body) allocates ByteBuf from unpooled heap - return body(Flux.defer(() -> Flux.just(Unpooled.wrappedBuffer(content)))); + return body(Flux.defer(() -> Flux.just(ByteBuffer.wrap(content)))); } /** @@ -164,7 +162,7 @@ public HttpRequest body(byte[] content) { * @param content the request content * @return this HttpRequest */ - public HttpRequest body(Flux content) { + public HttpRequest body(Flux content) { this.body = content; return this; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpResponse.java index 1761b6bbbc0d..c5382a6620ae 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpResponse.java @@ -4,12 +4,11 @@ package com.azure.core.http; import com.azure.core.implementation.http.BufferedHttpResponse; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.netty.Connection; import java.io.Closeable; +import java.nio.ByteBuffer; import java.nio.charset.Charset; /** @@ -66,9 +65,9 @@ public abstract class HttpResponse implements Closeable { * the `subscribeOn` and `observeOn` but should be considered a template for * more complex situations. * - * @return The response's content as a stream of {@link ByteBuf}. + * @return The response's content as a stream of {@link ByteBuffer}. */ - public abstract Flux body(); + public abstract Flux body(); /** * Get the response content as a byte[]. @@ -128,9 +127,4 @@ public HttpResponse buffer() { @Override public void close() { } - - // package private for test purpose - Connection internConnection() { - return null; - } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java index f8d4aecb3c94..da5d9e8c9d03 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java @@ -3,8 +3,6 @@ package com.azure.core.http; -import reactor.netty.tcp.ProxyProvider.Proxy; - import java.net.InetSocketAddress; /** @@ -46,24 +44,14 @@ public enum Type { /** * HTTP proxy type. */ - HTTP(Proxy.HTTP), + HTTP(), /** * SOCKS4 proxy type. */ - SOCKS4(Proxy.SOCKS4), + SOCKS4(), /** * SOCKS5 proxy type. */ - SOCKS5(Proxy.SOCKS5); - - private final Proxy value; - - Type(Proxy reactorProxyType) { - this.value = reactorProxyType; - } - - Proxy value() { - return value; - } + SOCKS5(); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/CookiePolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/CookiePolicy.java index a9e84bb6ad44..89bac5c9cbfc 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/CookiePolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/CookiePolicy.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpPipelineCallContext; import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; +import com.azure.core.util.logging.ClientLogger; import reactor.core.Exceptions; import reactor.core.publisher.Mono; @@ -25,6 +26,7 @@ * The Pipeline policy that which stores cookies based on the response Set-Cookie header and adds cookies to requests. */ public class CookiePolicy implements HttpPipelinePolicy { + private final ClientLogger logger = new ClientLogger(CookiePolicy.class); private final CookieHandler cookies = new CookieManager(); @Override @@ -51,7 +53,7 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN try { cookies.put(uri, responseHeaders); } catch (IOException e) { - throw Exceptions.propagate(e); + throw logger.logExceptionAsError(Exceptions.propagate(e)); } return httpResponse; }); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HostPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HostPolicy.java index 71576d93cbb5..d3431a66e3f5 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HostPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HostPolicy.java @@ -7,8 +7,8 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; import com.azure.core.implementation.http.UrlBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.net.MalformedURLException; @@ -18,7 +18,7 @@ */ public class HostPolicy implements HttpPipelinePolicy { private final String host; - private static final Logger LOGGER = LoggerFactory.getLogger(HostPolicy.class); + private final ClientLogger logger = new ClientLogger(HostPolicy.class); /** * Create HostPolicy. @@ -31,7 +31,7 @@ public HostPolicy(String host) { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - LOGGER.info("Setting host to {}", host); + logger.info("Setting host to {}", host); Mono result; final UrlBuilder urlBuilder = UrlBuilder.parse(context.httpRequest().url()); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java index 7668f1e1d5c8..407e41149e3f 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java @@ -13,7 +13,6 @@ import com.azure.core.implementation.util.FluxUtil; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import io.netty.handler.codec.http.HttpResponseStatus; import reactor.core.publisher.Mono; import java.net.URL; @@ -91,7 +90,7 @@ private Mono logRequest(final ClientLogger logger, final HttpRequest reque if (contentLength < MAX_BODY_LOG_SIZE && isHumanReadableContentType) { try { - Mono collectedBytes = FluxUtil.collectBytesInByteBufStream(request.body(), true); + Mono collectedBytes = FluxUtil.collectBytesInByteBufferStream(request.body()); reqBodyLoggingMono = collectedBytes.flatMap(bytes -> { String bodyString = new String(bytes, StandardCharsets.UTF_8); bodyString = prettyPrintIfNeeded(logger, request.headers().value("Content-Type"), bodyString); @@ -123,9 +122,9 @@ private Function> logResponseDelegate(final Cli bodySize = contentLengthString + "-byte"; } - HttpResponseStatus responseStatus = HttpResponseStatus.valueOf(response.statusCode()); +// HttpResponseStatus responseStatus = HttpResponseStatus.valueOf(response.statusCode()); if (detailLevel.shouldLogURL()) { - logger.info("<-- {} {} {} ({} ms, {} body)", response.statusCode(), responseStatus.reasonPhrase(), url, tookMs, bodySize); + logger.info("<-- {} {} ({} ms, {} body)", response.statusCode(), url, tookMs, bodySize); } if (detailLevel.shouldLogHeaders()) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/PortPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/PortPolicy.java index f585187067c7..f182b04a7b90 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/PortPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/PortPolicy.java @@ -7,8 +7,7 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; import com.azure.core.implementation.http.UrlBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.net.MalformedURLException; @@ -19,7 +18,7 @@ public class PortPolicy implements HttpPipelinePolicy { private final int port; private final boolean overwrite; - private static final Logger LOGGER = LoggerFactory.getLogger(PortPolicy.class); + private final ClientLogger logger = new ClientLogger(PortPolicy.class); /** * Create a new PortPolicy object. @@ -36,7 +35,7 @@ public PortPolicy(int port, boolean overwrite) { public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { final UrlBuilder urlBuilder = UrlBuilder.parse(context.httpRequest().url()); if (overwrite || urlBuilder.port() == null) { - LOGGER.info("Changing port to {}", port); + logger.info("Changing port to {}", port); try { context.httpRequest().url(urlBuilder.port(port).toURL()); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProtocolPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProtocolPolicy.java index 393e51221c6a..343b0b520d7a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProtocolPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProtocolPolicy.java @@ -7,8 +7,7 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; import com.azure.core.implementation.http.UrlBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.net.MalformedURLException; @@ -19,7 +18,7 @@ public class ProtocolPolicy implements HttpPipelinePolicy { private final String protocol; private final boolean overwrite; - private static final Logger LOGGER = LoggerFactory.getLogger(ProtocolPolicy.class); + private final ClientLogger logger = new ClientLogger(ProtocolPolicy.class); /** * Create a new ProtocolPolicy. @@ -36,7 +35,7 @@ public ProtocolPolicy(String protocol, boolean overwrite) { public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { final UrlBuilder urlBuilder = UrlBuilder.parse(context.httpRequest().url()); if (overwrite || urlBuilder.scheme() == null) { - LOGGER.info("Setting protocol to {}", protocol); + logger.info("Setting protocol to {}", protocol); try { context.httpRequest().url(urlBuilder.scheme(protocol).toURL()); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RetryPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RetryPolicy.java index 2267cb7896c0..d1d602e7e078 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RetryPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RetryPolicy.java @@ -7,9 +7,9 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import io.netty.handler.codec.http.HttpResponseStatus; import reactor.core.publisher.Mono; +import java.net.HttpURLConnection; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -70,10 +70,10 @@ private Mono attemptAsync(final HttpPipelineCallContext context, f private boolean shouldRetry(HttpResponse response, int tryCount) { int code = response.statusCode(); return tryCount < maxRetries - && (code == HttpResponseStatus.REQUEST_TIMEOUT.code() - || (code >= HttpResponseStatus.INTERNAL_SERVER_ERROR.code() - && code != HttpResponseStatus.NOT_IMPLEMENTED.code() - && code != HttpResponseStatus.HTTP_VERSION_NOT_SUPPORTED.code())); + && (code == HttpURLConnection.HTTP_CLIENT_TIMEOUT + || (code >= HttpURLConnection.HTTP_INTERNAL_ERROR + && code != HttpURLConnection.HTTP_NOT_IMPLEMENTED + && code != HttpURLConnection.HTTP_VERSION)); } /** @@ -86,8 +86,8 @@ private Duration determineDelayDuration(HttpResponse response) { int code = response.statusCode(); // Response will not have a retry-after-ms header. - if (code != HttpResponseStatus.TOO_MANY_REQUESTS.code() - && code != HttpResponseStatus.SERVICE_UNAVAILABLE.code()) { + if (code != 429 // too many requests + && code != 503) { // service unavailable return this.delayDuration; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/IterableResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/IterableResponse.java deleted file mode 100644 index abdb328a556c..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/IterableResponse.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.http.rest; - -import reactor.core.publisher.Flux; - -import java.util.Iterator; -import java.util.stream.Stream; - -/** - * This class provides utility to iterate over values. All the values are preserved even if they are traversed multiple times. - * - *

Code sample using Stream

- * - * {@codesnippet com.azure.core.http.rest.iterableResponse.stream} - * - *

Code sample using Iterator

- * - * {@codesnippet com.azure.core.http.rest.iterableResponse.iterator.while} - * - *

Code sample using Stream and filter

- * - * {@codesnippet com.azure.core.http.rest.iterableResponse.stream.filter} - * - * @param The type of value in this {@link Iterable}. - * @see Iterable - */ -public class IterableResponse implements Iterable { - private final Flux flux; - - /** - * Creates instance given {@link Flux}. - * @param flux to iterate over - */ - public IterableResponse(Flux flux) { - this.flux = flux; - } - - /** - * Utility function to provide {@link Stream} of value T. - * It will provide same stream of T values if called multiple times. - * @return {@link Stream} of value T. - */ - public Stream stream() { - return flux.toStream(); - } - - /** - * Utility function to provide {@link Iterator} of value T. - * It will provide same collection of T values if called multiple times. - * @return {@link Iterator} of value T. - */ - @Override - public Iterator iterator() { - return flux.toIterable().iterator(); - } - -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterable.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterable.java index cac6c353efae..7b65e6d0b852 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterable.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterable.java @@ -3,6 +3,8 @@ package com.azure.core.http.rest; +import com.azure.core.util.IterableStream; + import java.util.stream.Stream; /** @@ -20,11 +22,11 @@ * * {@codesnippet com.azure.core.http.rest.pagedIterable.iterableByPage.while} * - * @param The type of value contained in this {@link IterableResponse}. + * @param The type of value contained in this {@link IterableStream}. * @see PagedResponse - * @see IterableResponse + * @see IterableStream */ -public class PagedIterable extends IterableResponse { +public class PagedIterable extends IterableStream { private final PagedFlux pagedFlux; /** @@ -45,6 +47,18 @@ public Stream> streamByPage() { return pagedFlux.byPage().toStream(); } + /** + * Retrieve the {@link Stream}, one page at a time, starting from the next page associated with the given + * continuation token. To start from first page, use {@link #streamByPage()} instead. + * + * @param continuationToken The continuation token used to fetch the next page + * + * @return {@link Stream} of {@link PagedResponse}, starting from the page associated with the continuation token + */ + public Stream> streamByPage(String continuationToken) { + return pagedFlux.byPage(continuationToken).toStream(); + } + /** * Provides {@link Iterable} API for{ @link PagedResponse} * It will provide same collection of T values from starting if called multiple times. @@ -54,4 +68,16 @@ public Iterable> iterableByPage() { return pagedFlux.byPage().toIterable(); } + /** + * Provides {@link Iterable} API for {@link PagedResponse}, starting from the next page associated with the given + * continuation token. To start from first page, use {@link #streamByPage()} instead. + * It will provide same collection of T values from starting if called multiple times. + * + * @param continuationToken The continuation token used to fetch the next page + * + * @return {@link Iterable} interface + */ + public Iterable> iterableByPage(String continuationToken) { + return pagedFlux.byPage(continuationToken).toIterable(); + } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/StreamResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/StreamResponse.java index 2d425664720b..eb9ca543d242 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/StreamResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/StreamResponse.java @@ -4,15 +4,15 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import java.io.Closeable; +import java.nio.ByteBuffer; /** * REST response with a streaming content. */ -public final class StreamResponse extends SimpleResponse> implements Closeable { +public final class StreamResponse extends SimpleResponse> implements Closeable { /** * Creates StreamResponse. * @@ -21,7 +21,7 @@ public final class StreamResponse extends SimpleResponse> implemen * @param headers the headers of the HTTP response * @param value the streaming value */ - public StreamResponse(HttpRequest request, int statusCode, HttpHeaders headers, Flux value) { + public StreamResponse(HttpRequest request, int statusCode, HttpHeaders headers, Flux value) { super(request, statusCode, headers, value); } @@ -29,7 +29,7 @@ public StreamResponse(HttpRequest request, int statusCode, HttpHeaders headers, * @return the stream content */ @Override - public Flux value() { + public Flux value() { return super.value(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java index 107a3c410b24..51e64acd037a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java @@ -35,7 +35,7 @@ import com.azure.core.implementation.util.ImplUtils; import com.azure.core.implementation.util.TypeUtil; import com.azure.core.util.Context; -import io.netty.buffer.ByteBuf; +import com.azure.core.util.logging.ClientLogger; import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -49,6 +49,7 @@ import java.lang.reflect.Proxy; import java.lang.reflect.Type; import java.net.URL; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -66,6 +67,7 @@ * deserialized Java object. */ public class RestProxy implements InvocationHandler { + private final ClientLogger logger = new ClientLogger(RestProxy.class); private final HttpPipeline httpPipeline; private final SerializerAdapter serializer; private final SwaggerInterfaceParser interfaceParser; @@ -148,7 +150,7 @@ public Object invoke(Object proxy, final Method method, Object[] args) { } } catch (Exception e) { - throw Exceptions.propagate(e); + throw logger.logExceptionAsError(Exceptions.propagate(e)); } } @@ -196,16 +198,22 @@ private HttpRequest createHttpRequest(SwaggerMethodParser methodParser, Object[] } else { urlBuilder = new UrlBuilder(); - // We add path to the UrlBuilder first because this is what is - // provided to the HTTP Method annotation. Any path substitutions - // from other substitution annotations will overwrite this. - urlBuilder.path(path); - final String scheme = methodParser.scheme(args); urlBuilder.scheme(scheme); final String host = methodParser.host(args); urlBuilder.host(host); + + // Set the path after host, concatenating the path + // segment in the host. + if (path != null && !path.isEmpty() && !path.equals("/")) { + String hostPath = urlBuilder.path(); + if (hostPath == null || hostPath.isEmpty() || hostPath.equals("/")) { + urlBuilder.path(path); + } else { + urlBuilder.path(hostPath + "/" + path); + } + } } for (final EncodedParameter queryParameter : methodParser.encodedQueryParameters(args)) { @@ -271,10 +279,10 @@ private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser metho if (isJson) { final String bodyContentString = serializer.serialize(bodyContentObject, SerializerEncoding.JSON); request.body(bodyContentString); - } else if (FluxUtil.isFluxByteBuf(methodParser.bodyJavaType())) { + } else if (FluxUtil.isFluxByteBuffer(methodParser.bodyJavaType())) { // Content-Length or Transfer-Encoding: chunked must be provided by a user-specified header when a Flowable is given for the body. //noinspection ConstantConditions - request.body((Flux) bodyContentObject); + request.body((Flux) bodyContentObject); } else if (bodyContentObject instanceof byte[]) { request.body((byte[]) bodyContentObject); } else if (bodyContentObject instanceof String) { @@ -420,7 +428,7 @@ private Response createResponse(HttpDecodedResponse response, Type entityType cls = (Class>) (Object) PagedResponseBase.class; if (bodyAsObject != null && !TypeUtil.isTypeOrSubTypeOf(bodyAsObject.getClass(), Page.class)) { - throw new RuntimeException("Unable to create PagedResponse. Body must be of a type that implements: " + Page.class); + throw logger.logExceptionAsError(new RuntimeException("Unable to create PagedResponse. Body must be of a type that implements: " + Page.class)); } } @@ -437,7 +445,7 @@ private Response createResponse(HttpDecodedResponse response, Type entityType .collect(Collectors.toList()); if (constructors.isEmpty()) { - throw new RuntimeException("Cannot find suitable constructor for class " + cls); + throw logger.logExceptionAsError(new RuntimeException("Cannot find suitable constructor for class " + cls)); } // try to create an instance using our list of potential candidates @@ -455,14 +463,14 @@ private Response createResponse(HttpDecodedResponse response, Type entityType case 5: return ctor.newInstance(httpRequest, responseStatusCode, responseHeaders, bodyAsObject, response.decodedHeaders().block()); default: - throw new IllegalStateException("Response constructor with expected parameters not found."); + throw logger.logExceptionAsError(new IllegalStateException("Response constructor with expected parameters not found.")); } } catch (IllegalAccessException | InvocationTargetException | InstantiationException e) { - throw reactor.core.Exceptions.propagate(e); + throw logger.logExceptionAsError(reactor.core.Exceptions.propagate(e)); } } // error - throw new RuntimeException("Cannot find suitable constructor for class " + cls); + throw logger.logExceptionAsError(new RuntimeException("Cannot find suitable constructor for class " + cls)); } protected final Mono handleBodyReturnType(final HttpDecodedResponse response, final SwaggerMethodParser methodParser, final Type entityType) { @@ -483,8 +491,8 @@ protected final Mono handleBodyReturnType(final HttpDecodedResponse response, responseBodyBytesAsync = responseBodyBytesAsync.map(base64UrlBytes -> new Base64Url(base64UrlBytes).decodedBytes()); } asyncResult = responseBodyBytesAsync; - } else if (FluxUtil.isFluxByteBuf(entityType)) { - // Mono> + } else if (FluxUtil.isFluxByteBuffer(entityType)) { + // Mono> asyncResult = Mono.just(response.sourceResponse().body()); } else { // Mono or Mono> @@ -527,8 +535,8 @@ public final Object handleRestReturnType(Mono asyncHttpDeco result = asyncExpectedResponse.flatMap(response -> handleRestResponseReturnType(response, methodParser, monoTypeParam)); } - } else if (FluxUtil.isFluxByteBuf(returnType)) { - // ProxyMethod ReturnType: Flux + } else if (FluxUtil.isFluxByteBuffer(returnType)) { + // ProxyMethod ReturnType: Flux result = asyncExpectedResponse.flatMapMany(ar -> ar.sourceResponse().body()); } else if (TypeUtil.isTypeOrSubTypeOf(returnType, void.class) || TypeUtil.isTypeOrSubTypeOf(returnType, Void.class)) { // ProxyMethod ReturnType: Void diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerMethodParser.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerMethodParser.java index 1fd98ca0298c..33691e1f14fe 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerMethodParser.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerMethodParser.java @@ -276,7 +276,7 @@ private Iterable encodeParameters(Object[] swaggerMethodArgume if (substitutions == null) { return Collections.emptyList(); } - + final List result = new ArrayList<>(); final PercentEscaper escaper = UrlEscapers.QUERY_ESCAPER; for (Substitution substitution : substitutions) { @@ -542,9 +542,12 @@ private String applySubstitutions(String originalValue, Iterable s if (substitutionValue != null && !substitutionValue.isEmpty() && substitution.shouldEncode() && escaper != null) { substitutionValue = escaper.escape(substitutionValue); } - if (substitutionValue != null) { - result = result.replace("{" + substitution.urlParameterName() + "}", substitutionValue); + // if a parameter is null, we treat it as empty string. This is + // assuming no {...} will be allowed otherwise in a path template + if (substitutionValue == null) { + substitutionValue = ""; } + result = result.replace("{" + substitution.urlParameterName() + "}", substitutionValue); } } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/BufferedHttpResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/BufferedHttpResponse.java index 8363b150176d..3fa0766ea563 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/BufferedHttpResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/BufferedHttpResponse.java @@ -5,11 +5,10 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpResponse; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -52,8 +51,8 @@ public Mono bodyAsByteArray() { } @Override - public Flux body() { - return bodyAsByteArray().flatMapMany(bytes -> Flux.just(Unpooled.wrappedBuffer(bytes))); + public Flux body() { + return bodyAsByteArray().flatMapMany(bytes -> Flux.just(ByteBuffer.wrap(bytes))); } @Override diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/UrlBuilder.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/UrlBuilder.java index fb9d7e56ccd4..088310ed22ac 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/UrlBuilder.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/UrlBuilder.java @@ -3,6 +3,8 @@ package com.azure.core.implementation.http; +import com.azure.core.util.logging.ClientLogger; + import java.net.MalformedURLException; import java.net.URL; import java.util.LinkedHashMap; @@ -12,6 +14,8 @@ * A builder class that is used to create URLs. */ public final class UrlBuilder { + private final ClientLogger logger = new ClientLogger(UrlBuilder.class); + private String scheme; private String host; private String port; @@ -22,6 +26,7 @@ public final class UrlBuilder { /** * Set the scheme/protocol that will be used to build the final URL. + * * @param scheme The scheme/protocol that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ @@ -36,6 +41,7 @@ public UrlBuilder scheme(String scheme) { /** * Get the scheme/protocol that has been assigned to this UrlBuilder. + * * @return the scheme/protocol that has been assigned to this UrlBuilder. */ public String scheme() { @@ -44,6 +50,7 @@ public String scheme() { /** * Set the host that will be used to build the final URL. + * * @param host The host that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ @@ -58,6 +65,7 @@ public UrlBuilder host(String host) { /** * Get the host that has been assigned to this UrlBuilder. + * * @return the host that has been assigned to this UrlBuilder. */ public String host() { @@ -66,6 +74,7 @@ public String host() { /** * Set the port that will be used to build the final URL. + * * @param port The port that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ @@ -80,6 +89,7 @@ public UrlBuilder port(String port) { /** * Set the port that will be used to build the final URL. + * * @param port The port that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ @@ -89,6 +99,7 @@ public UrlBuilder port(int port) { /** * Get the port that has been assigned to this UrlBuilder. + * * @return the port that has been assigned to this UrlBuilder. */ public Integer port() { @@ -97,6 +108,7 @@ public Integer port() { /** * Set the path that will be used to build the final URL. + * * @param path The path that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ @@ -111,6 +123,7 @@ public UrlBuilder path(String path) { /** * Get the path that has been assigned to this UrlBuilder. + * * @return the path that has been assigned to this UrlBuilder. */ public String path() { @@ -119,10 +132,10 @@ public String path() { /** * Set the provided query parameter name and encoded value to query string for the final URL. + * * @param queryParameterName The name of the query parameter. * @param queryParameterEncodedValue The encoded value of the query parameter. - * @return The provided query parameter name and encoded value to query string for the final - * URL. + * @return The provided query parameter name and encoded value to query string for the final URL. */ public UrlBuilder setQueryParameter(String queryParameterName, String queryParameterEncodedValue) { query.put(queryParameterName, queryParameterEncodedValue); @@ -131,6 +144,7 @@ public UrlBuilder setQueryParameter(String queryParameterName, String queryParam /** * Set the query that will be used to build the final URL. + * * @param query The query that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ @@ -145,12 +159,31 @@ public UrlBuilder query(String query) { /** * Get the query that has been assigned to this UrlBuilder. + * * @return the query that has been assigned to this UrlBuilder. */ public Map query() { return query; } + public String queryString() { + if (query.isEmpty()) { + return ""; + } + + StringBuilder queryBuilder = new StringBuilder("?"); + for (Map.Entry entry : query.entrySet()) { + if (queryBuilder.length() > 1) { + queryBuilder.append("&"); + } + queryBuilder.append(entry.getKey()); + queryBuilder.append("="); + queryBuilder.append(entry.getValue()); + } + + return queryBuilder.toString(); + } + private UrlBuilder with(String text, UrlTokenizerState startState) { final UrlTokenizer tokenizer = new UrlTokenizer(text, startState); @@ -190,7 +223,7 @@ private UrlBuilder with(String text, UrlTokenizerState startState) { if (nameValue.length == 2) { setQueryParameter(nameValue[0], nameValue[1]); } else { - throw new IllegalArgumentException("Malformed query entry: " + entry); + setQueryParameter(nameValue[0], ""); } } } @@ -206,6 +239,7 @@ private UrlBuilder with(String text, UrlTokenizerState startState) { /** * Get the URL that is being built. + * * @return The URL that is being built. * @throws MalformedURLException if the URL is not fully formed. */ @@ -215,6 +249,7 @@ public URL toURL() throws MalformedURLException { /** * Get the string representation of the URL that is being built. + * * @return The string representation of the URL that is being built. */ public String toString() { @@ -247,25 +282,14 @@ public String toString() { result.append(path); } - if (!query.isEmpty()) { - StringBuilder queryBuilder = new StringBuilder("?"); - for (Map.Entry entry : query.entrySet()) { - if (queryBuilder.length() > 1) { - queryBuilder.append("&"); - } - queryBuilder.append(entry.getKey()); - queryBuilder.append("="); - queryBuilder.append(entry.getValue()); - } - - result.append(queryBuilder.toString()); - } + result.append(queryString()); return result.toString(); } /** * Parse a UrlBuilder from the provided URL string. + * * @param url The string to parse. * @return The UrlBuilder that was parsed from the string. */ @@ -277,6 +301,7 @@ public static UrlBuilder parse(String url) { /** * Parse a UrlBuilder from the provided URL object. + * * @param url The URL object to parse. * @return The UrlBuilder that was parsed from the URL object. */ diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProvider.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProvider.java new file mode 100644 index 000000000000..f938fb61e6be --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProvider.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.implementation.http.spi; + +import com.azure.core.http.HttpClient; + +/** + * An interface to be implemented by any azure-core plugin that wishes to provide an alternate {@link HttpClient} + * implementation. + */ +@FunctionalInterface +public interface HttpClientProvider { + + /** + * Creates a new instance of the {@link HttpClient} that this HttpClientProvider is configured to create. + * @return A new {@link HttpClient} instance, entirely unrelated to all other instances that were created previously. + */ + HttpClient createInstance(); +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProviders.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProviders.java new file mode 100644 index 000000000000..ea084439a0d2 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProviders.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation.http.spi; + +import com.azure.core.http.HttpClient; + +import java.util.Iterator; +import java.util.ServiceLoader; + +/** + * This class handles loading available HTTP clients + */ +public final class HttpClientProviders { + private static HttpClientProvider defaultProvider; + + static { + ServiceLoader serviceLoader = ServiceLoader.load(HttpClientProvider.class); + + // Use the first provider found in the service loader iterator. + Iterator it = serviceLoader.iterator(); + if (it.hasNext()) { + defaultProvider = it.next(); + } + } + + private HttpClientProviders() { + // no-op + } + + public static HttpClient createInstance() { + if (defaultProvider == null) { + throw new IllegalStateException( + "Cannot find any HttpClient provider on the classpath - unable to create a default HttpClient instance"); + } + + return defaultProvider.createInstance(); + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseBodyDecoder.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseBodyDecoder.java index 0d3fc8995365..2bdd6c3a1578 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseBodyDecoder.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseBodyDecoder.java @@ -397,7 +397,7 @@ private static boolean isReturnTypeDecodable(HttpResponseDecodeData decodeData) if (returnType == null) { return false; } else { - return !FluxUtil.isFluxByteBuf(returnType) + return !FluxUtil.isFluxByteBuffer(returnType) && !(TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class) && TypeUtil.isTypeOrSubTypeOf(TypeUtil.getTypeArgument(returnType), Void.class)) && !TypeUtil.isTypeOrSubTypeOf(returnType, byte[].class) && !TypeUtil.isTypeOrSubTypeOf(returnType, Void.TYPE) && !TypeUtil.isTypeOrSubTypeOf(returnType, Void.class); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseHeaderDecoder.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseHeaderDecoder.java index 1621f23e6ff5..eaf131d805ef 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseHeaderDecoder.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseHeaderDecoder.java @@ -75,7 +75,7 @@ static Mono decode(HttpResponse httpResponse, SerializerAdapter serializ * @param headers the REST API returned headers * @return instance of header entity type created based on provided {@headers}, if header entity model does * not exists then return null - * @throws IOException + * @throws IOException If an I/O error occurs */ private static Object deserializeHeaders(HttpHeaders headers, SerializerAdapter serializer, HttpResponseDecodeData decodeData) throws IOException { final Type deserializedHeadersType = decodeData.headersType(); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/ItemPage.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/ItemPage.java index 48bcd6e5ca06..f106991f6e9d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/ItemPage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/ItemPage.java @@ -20,7 +20,7 @@ * "items": [{ serialized(T) }, ... ] * } * or any other cases where the property names of that type are swapped - * @param + * @param The type of the object stored within the {@link ItemPage} instance */ class ItemPage implements Page { @JsonAlias({"items", "value"}) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java index abfe37c5caf6..e0e07489c717 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java @@ -7,6 +7,7 @@ import com.azure.core.implementation.serializer.MalformedValueException; import com.azure.core.implementation.serializer.SerializerAdapter; import com.azure.core.implementation.serializer.SerializerEncoding; +import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonParseException; @@ -29,6 +30,8 @@ * Implementation of {@link SerializerAdapter} for Jackson. */ public class JacksonAdapter implements SerializerAdapter { + private final ClientLogger logger = new ClientLogger(JacksonAdapter.class); + /** * An instance of {@link ObjectMapper} to serialize/deserialize objects. */ @@ -156,7 +159,7 @@ public T deserialize(String value, final Type type, SerializerEncoding encod return (T) serializer().readValue(value, javaType); } } catch (JsonParseException jpe) { - throw new MalformedValueException(jpe.getMessage(), jpe); + throw logger.logExceptionAsError(new MalformedValueException(jpe.getMessage(), jpe)); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java index 032fed01998b..84b8bd2d7289 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java @@ -5,13 +5,17 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.CompositeByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.util.ReferenceCountUtil; +import org.reactivestreams.Subscriber; +import org.reactivestreams.Subscription; +import reactor.core.CoreSubscriber; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.publisher.Operators; + +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.reflect.Type; +import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; import java.nio.channels.CompletionHandler; import java.util.Map; @@ -20,28 +24,21 @@ import java.util.concurrent.atomic.AtomicLongFieldUpdater; import java.util.function.Function; import java.util.stream.Collectors; -import org.reactivestreams.Subscriber; -import org.reactivestreams.Subscription; -import reactor.core.CoreSubscriber; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.core.publisher.MonoSink; -import reactor.core.publisher.Operators; /** * Utility type exposing methods to deal with {@link Flux}. */ public final class FluxUtil { /** - * Checks if a type is Flux<ByteBuf>. + * Checks if a type is Flux<ByteBuffer>. * * @param entityType the type to check - * @return whether the type represents a Flux that emits ByteBuf + * @return whether the type represents a Flux that emits ByteBuffer */ - public static boolean isFluxByteBuf(Type entityType) { + public static boolean isFluxByteBuffer(Type entityType) { if (TypeUtil.isTypeOrSubTypeOf(entityType, Flux.class)) { final Type innerType = TypeUtil.getTypeArguments(entityType)[0]; - if (TypeUtil.isTypeOrSubTypeOf(innerType, ByteBuf.class)) { + if (TypeUtil.isTypeOrSubTypeOf(innerType, ByteBuffer.class)) { return true; } } @@ -49,142 +46,45 @@ public static boolean isFluxByteBuf(Type entityType) { } /** - * Collects ByteBuf emitted by a Flux into a byte array. - * @param stream A stream which emits ByteBuf instances. - * @param autoReleaseEnabled if ByteBuf instances in stream gets automatically released as they consumed - * @return A Mono which emits the concatenation of all the ByteBuf instances given by the source Flux. + * Collects ByteBuffer emitted by a Flux into a byte array. + * + * @param stream A stream which emits ByteBuffer instances. + * @return A Mono which emits the concatenation of all the ByteBuffer instances given by the source Flux. */ - public static Mono collectBytesInByteBufStream(Flux stream, boolean autoReleaseEnabled) { - if (autoReleaseEnabled) { - // A stream is auto-release enabled means - the ByteBuf chunks in the stream get - // released as consumer consumes each chunk. - return Mono.using(Unpooled::compositeBuffer, - cbb -> stream.collect(() -> cbb, - (cbb1, buffer) -> cbb1.addComponent(true, Unpooled.wrappedBuffer(buffer).retain())), - ReferenceCountUtil::release) - .filter((CompositeByteBuf cbb) -> cbb.isReadable()) - .map(FluxUtil::byteBufToArray); - } else { - return stream.collect(Unpooled::compositeBuffer, - (cbb1, buffer) -> cbb1.addComponent(true, Unpooled.wrappedBuffer(buffer))) - .filter((CompositeByteBuf cbb) -> cbb.isReadable()) - .map(FluxUtil::byteBufToArray); - } + public static Mono collectBytesInByteBufferStream(Flux stream) { + return stream + .collect(ByteArrayOutputStream::new, FluxUtil::accept) + .map(ByteArrayOutputStream::toByteArray); } - /** - * Splits a ByteBuf into ByteBuf chunks. - * - * @param whole the ByteBuf to split - * @param chunkSize the maximum size of each ByteBuf chunk - * @return A stream that emits chunks of the original whole ByteBuf - */ - public static Flux split(final ByteBuf whole, final int chunkSize) { - return Flux.generate(whole::readerIndex, (readFromIndex, synchronousSync) -> { - final int writerIndex = whole.writerIndex(); - // - if (readFromIndex >= writerIndex) { - synchronousSync.complete(); - return writerIndex; - } else { - int readSize = Math.min(writerIndex - readFromIndex, chunkSize); - // Netty slice operation will not increment the ref count. - // - // Here we invoke 'retain' on each slice, since - // consumer of the returned Flux stream is responsible for - // releasing each chunk as it gets consumed. - // - synchronousSync.next(whole.slice(readFromIndex, readSize).retain()); - return readFromIndex + readSize; - } - }); + private static void accept(ByteArrayOutputStream byteOutputStream, ByteBuffer byteBuffer) { + try { + byteOutputStream.write(byteBufferToArray(byteBuffer)); + } catch (IOException e) { + throw new RuntimeException(e); + } } /** - * Gets the content of the provided ByteBuf as a byte array. - * This method will create a new byte array even if the ByteBuf can - * have optionally backing array. - * + * Gets the content of the provided ByteBuffer as a byte array. This method will create a new byte array even if the + * ByteBuffer can have optionally backing array. * - * @param byteBuf the byte buffer + * @param byteBuffer the byte buffer * @return the byte array */ - public static byte[] byteBufToArray(ByteBuf byteBuf) { - int length = byteBuf.readableBytes(); + public static byte[] byteBufferToArray(ByteBuffer byteBuffer) { + int length = byteBuffer.remaining(); byte[] byteArray = new byte[length]; - byteBuf.getBytes(byteBuf.readerIndex(), byteArray); + byteBuffer.get(byteArray); return byteArray; } - /** - * Collects byte buffers emitted by a Flux into a ByteBuf. - * - * @param stream A stream which emits ByteBuf instances. - * @param autoReleaseEnabled if ByteBuf instances in stream gets automatically released as they consumed - * @return A Mono which emits the concatenation of all the byte buffers given by the source Flux. - */ - public static Mono collectByteBufStream(Flux stream, boolean autoReleaseEnabled) { - if (autoReleaseEnabled) { - Mono mergedCbb = Mono.using( - // Resource supplier - () -> { - CompositeByteBuf initialCbb = Unpooled.compositeBuffer(); - return initialCbb; - }, - // source Mono creator - (CompositeByteBuf initialCbb) -> { - Mono reducedCbb = stream.reduce(initialCbb, (CompositeByteBuf currentCbb, ByteBuf nextBb) -> { - CompositeByteBuf updatedCbb = currentCbb.addComponent(nextBb.retain()); - return updatedCbb; - }); - // - return reducedCbb - .doOnNext((CompositeByteBuf cbb) -> cbb.writerIndex(cbb.capacity())) - .filter((CompositeByteBuf cbb) -> cbb.isReadable()); - }, - // Resource cleaner - (CompositeByteBuf finalCbb) -> finalCbb.release()); - return mergedCbb; - } else { - return stream.collect(Unpooled::compositeBuffer, - (cbb1, buffer) -> cbb1.addComponent(true, Unpooled.wrappedBuffer(buffer))) - .filter((CompositeByteBuf cbb) -> cbb.isReadable()) - .map(bb -> bb); - } - } - - private static final int DEFAULT_CHUNK_SIZE = 1024 * 64; - - /** - * Writes the bytes emitted by a Flux to an AsynchronousFileChannel. - * - * @param content the Flux content - * @param outFile the file channel - * @return a Completable which performs the write operation when subscribed - */ - public static Mono bytebufStreamToFile(Flux content, AsynchronousFileChannel outFile) { - return bytebufStreamToFile(content, outFile, 0); - } - - /** - * Writes the bytes emitted by a Flux to an AsynchronousFileChannel - * starting at the given position in the file. - * - * @param content the Flux content - * @param outFile the file channel - * @param position the position in the file to begin writing - * @return a Mono<Void> which performs the write operation when subscribed - */ - public static Mono bytebufStreamToFile(Flux content, AsynchronousFileChannel outFile, long position) { - return Mono.create(emitter -> content.subscribe(new ByteBufToFileSubscriber(outFile, position, emitter))); - } - /** * This method converts the incoming {@code subscriberContext} from {@link reactor.util.context.Context Reactor * Context} to {@link Context Azure Context} and calls the given lambda function with this context and returns a * single entity of type {@code T} *

- * If the reactor context is empty, {@link Context#NONE} will be used to call the lambda function + * If the reactor context is empty, {@link Context#NONE} will be used to call the lambda function *

* *

Code samples

@@ -215,11 +115,11 @@ public static Mono toMono(Response response) { * Context} to {@link Context Azure Context} and calls the given lambda function with this context and returns a * collection of type {@code T} *

- * If the reactor context is empty, {@link Context#NONE} will be used to call the lambda function + * If the reactor context is empty, {@link Context#NONE} will be used to call the lambda function *

* - *

Code samples

- * {@codesnippet com.azure.core.implementation.util.fluxutil.fluxcontext} + *

Code samples

+ * {@codesnippet com.azure.core.implementation.util.fluxutil.fluxcontext} * * @param serviceCall The lambda function that makes the service call into which the context will be passed * @param The type of response returned from the service call @@ -232,146 +132,147 @@ public static Flux fluxContext(Function> serviceCall) { } /** - * Converts a reactor context to azure context. If the reactor context is {@code null} or empty, - * {@link Context#NONE} will be returned. + * Converts a reactor context to azure context. If the reactor context is {@code null} or empty, {@link + * Context#NONE} will be returned. * * @param context The reactor context * @return The azure context */ private static Context toAzureContext(reactor.util.context.Context context) { - Map keyValues = context.stream() - .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); + Map keyValues = context.stream().collect(Collectors.toMap(Entry::getKey, Entry::getValue)); if (ImplUtils.isNullOrEmpty(keyValues)) { return Context.NONE; } return Context.of(keyValues); } - private static class ByteBufToFileSubscriber implements Subscriber { - private ByteBufToFileSubscriber(AsynchronousFileChannel outFile, long position, MonoSink emitter) { - this.outFile = outFile; - this.pos = position; - this.emitter = emitter; - } - - // volatile ensures that writes to these fields by one thread will be immediately visible to other threads. - // An I/O pool thread will write to isWriting and read isCompleted, - // while another thread may read isWriting and write to isCompleted. - volatile boolean isWriting = false; - volatile boolean isCompleted = false; - volatile Subscription subscription; - volatile long pos; - AsynchronousFileChannel outFile; - MonoSink emitter; + /** + * Writes the bytes emitted by a Flux to an AsynchronousFileChannel. + * + * @param content the Flux content + * @param outFile the file channel + * @return a Mono which performs the write operation when subscribed + */ + public static Mono writeFile(Flux content, AsynchronousFileChannel outFile) { + return writeFile(content, outFile, 0); + } - @Override - public void onSubscribe(Subscription s) { - subscription = s; - s.request(1); - } + /** + * Writes the bytes emitted by a Flux to an AsynchronousFileChannel starting at the given position in the file. + * + * @param content the Flux content + * @param outFile the file channel + * @param position the position in the file to begin writing + * @return a Mono which performs the write operation when subscribed + */ + public static Mono writeFile(Flux content, AsynchronousFileChannel outFile, long position) { + return Mono.create(emitter -> content.subscribe(new Subscriber() { + // volatile ensures that writes to these fields by one thread will be immediately visible to other threads. + // An I/O pool thread will write to isWriting and read isCompleted, + // while another thread may read isWriting and write to isCompleted. + volatile boolean isWriting = false; + volatile boolean isCompleted = false; + volatile Subscription subscription; + volatile long pos = position; - @Override - public void onNext(ByteBuf bytes) { - isWriting = true; - outFile.write(bytes.nioBuffer(), pos, null, onWriteCompleted); - } + @Override + public void onSubscribe(Subscription s) { + subscription = s; + s.request(1); + } - CompletionHandler onWriteCompleted = new CompletionHandler() { @Override - public void completed(Integer bytesWritten, Object attachment) { - isWriting = false; - if (isCompleted) { - emitter.success(); - } - //noinspection NonAtomicOperationOnVolatileField - pos += bytesWritten; - if (subscription != null) { + public void onNext(ByteBuffer bytes) { + isWriting = true; + outFile.write(bytes, pos, null, onWriteCompleted); + } + + + CompletionHandler onWriteCompleted = new CompletionHandler() { + @Override + public void completed(Integer bytesWritten, Object attachment) { + isWriting = false; + if (isCompleted) { + emitter.success(); + } + //noinspection NonAtomicOperationOnVolatileField + pos += bytesWritten; subscription.request(1); } - } - @Override - public void failed(Throwable exc, Object attachment) { - if (subscription != null) { + @Override + public void failed(Throwable exc, Object attachment) { subscription.cancel(); + emitter.error(exc); } - emitter.error(exc); - } - }; + }; - @Override - public void onError(Throwable throwable) { - if (subscription != null) { + @Override + public void onError(Throwable throwable) { subscription.cancel(); + emitter.error(throwable); } - emitter.error(throwable); - } - @Override - public void onComplete() { - isCompleted = true; - if (!isWriting) { - emitter.success(); + @Override + public void onComplete() { + isCompleted = true; + if (!isWriting) { + emitter.success(); + } } - } + })); } - //region Utility methods to create Flux that read and emits chunks from AsynchronousFileChannel. - /** - * Creates a {@link Flux} from an {@link AsynchronousFileChannel} - * which reads part of a file into chunks of the given size. + * Creates a {@link Flux} from an {@link AsynchronousFileChannel} which reads part of a file into chunks of the + * given size. * * @param fileChannel The file channel. * @param chunkSize the size of file chunks to read. * @param offset The offset in the file to begin reading. * @param length The number of bytes to read from the file. - * @return the Flowable. + * @return the Flux. */ - public static Flux byteBufStreamFromFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { - return new ByteBufStreamFromFile(fileChannel, chunkSize, offset, length); + public static Flux readFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { + return new FileReadFlux(fileChannel, chunkSize, offset, length); } /** - * Creates a {@link Flux} from an {@link AsynchronousFileChannel} - * which reads part of a file. + * Creates a {@link Flux} from an {@link AsynchronousFileChannel} which reads part of a file. * * @param fileChannel The file channel. * @param offset The offset in the file to begin reading. * @param length The number of bytes to read from the file. - * @return the Flowable. + * @return the Flux. */ - public static Flux byteBufStreamFromFile(AsynchronousFileChannel fileChannel, long offset, long length) { - return byteBufStreamFromFile(fileChannel, DEFAULT_CHUNK_SIZE, offset, length); + public static Flux readFile(AsynchronousFileChannel fileChannel, long offset, long length) { + return readFile(fileChannel, DEFAULT_CHUNK_SIZE, offset, length); } /** - * Creates a {@link Flux} from an {@link AsynchronousFileChannel} - * which reads the entire file. + * Creates a {@link Flux} from an {@link AsynchronousFileChannel} which reads the entire file. * * @param fileChannel The file channel. * @return The AsyncInputStream. */ - public static Flux byteBufStreamFromFile(AsynchronousFileChannel fileChannel) { + public static Flux readFile(AsynchronousFileChannel fileChannel) { try { long size = fileChannel.size(); - return byteBufStreamFromFile(fileChannel, DEFAULT_CHUNK_SIZE, 0, size); + return readFile(fileChannel, DEFAULT_CHUNK_SIZE, 0, size); } catch (IOException e) { return Flux.error(e); } } - //endregion - //region ByteBufStreamFromFile implementation - private static final class ByteBufStreamFromFile extends Flux { - private final ByteBufAllocator alloc; + private static final int DEFAULT_CHUNK_SIZE = 1024 * 64; + + private static final class FileReadFlux extends Flux { private final AsynchronousFileChannel fileChannel; private final int chunkSize; private final long offset; private final long length; - ByteBufStreamFromFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { - this.alloc = ByteBufAllocator.DEFAULT; + FileReadFlux(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { this.fileChannel = fileChannel; this.chunkSize = chunkSize; this.offset = offset; @@ -379,27 +280,26 @@ private static final class ByteBufStreamFromFile extends Flux { } @Override - public void subscribe(CoreSubscriber actual) { - FileReadSubscription subscription = new FileReadSubscription(actual, fileChannel, alloc, chunkSize, offset, length); + public void subscribe(CoreSubscriber actual) { + FileReadSubscription subscription = new FileReadSubscription(actual, fileChannel, chunkSize, offset, length); actual.onSubscribe(subscription); } - static final class FileReadSubscription implements Subscription, CompletionHandler { + static final class FileReadSubscription implements Subscription, CompletionHandler { private static final int NOT_SET = -1; private static final long serialVersionUID = -6831808726875304256L; // - private final Subscriber subscriber; + private final Subscriber subscriber; private volatile long position; // private final AsynchronousFileChannel fileChannel; - private final ByteBufAllocator alloc; private final int chunkSize; private final long offset; private final long length; // private volatile boolean done; private Throwable error; - private volatile ByteBuf next; + private volatile ByteBuffer next; private volatile boolean cancelled; // volatile int wip; @@ -410,11 +310,10 @@ static final class FileReadSubscription implements Subscription, CompletionHandl static final AtomicLongFieldUpdater REQUESTED = AtomicLongFieldUpdater.newUpdater(FileReadSubscription.class, "requested"); // - FileReadSubscription(Subscriber subscriber, AsynchronousFileChannel fileChannel, ByteBufAllocator alloc, int chunkSize, long offset, long length) { + FileReadSubscription(Subscriber subscriber, AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { this.subscriber = subscriber; // this.fileChannel = fileChannel; - this.alloc = alloc; this.chunkSize = chunkSize; this.offset = offset; this.length = length; @@ -442,19 +341,19 @@ public void cancel() { //region CompletionHandler implementation @Override - public void completed(Integer bytesRead, ByteBuf buffer) { + public void completed(Integer bytesRead, ByteBuffer buffer) { if (!cancelled) { if (bytesRead == -1) { done = true; } else { // use local variable to perform fewer volatile reads long pos = position; - // int bytesWanted = Math.min(bytesRead, maxRequired(pos)); - buffer.writerIndex(bytesWanted); long position2 = pos + bytesWanted; //noinspection NonAtomicOperationOnVolatileField position = position2; + buffer.position(bytesWanted); + buffer.flip(); next = buffer; if (position2 >= offset + length) { done = true; @@ -465,7 +364,7 @@ public void completed(Integer bytesRead, ByteBuf buffer) { } @Override - public void failed(Throwable exc, ByteBuf attachment) { + public void failed(Throwable exc, ByteBuffer attachment) { if (!cancelled) { // must set error before setting done to true // so that is visible in drain loop @@ -495,19 +394,10 @@ private void drain() { boolean emitted = false; // read d before next to avoid race boolean d = done; - ByteBuf bb = next; + ByteBuffer bb = next; if (bb != null) { next = null; - // - // try { subscriber.onNext(bb); - // } finally { - // Note: Don't release here, we follow netty disposal pattern - // it's consumers responsiblity to release chunks after consumption. - // - // ReferenceCountUtil.release(bb); - // } - // emitted = true; } else { emitted = false; @@ -541,9 +431,8 @@ private void drain() { private void doRead() { // use local variable to limit volatile reads long pos = position; - int readSize = Math.min(chunkSize, maxRequired(pos)); - ByteBuf innerBuf = alloc.buffer(readSize, readSize); - fileChannel.read(innerBuf.nioBuffer(0, readSize), pos, innerBuf, this); + ByteBuffer innerBuf = ByteBuffer.allocate(Math.min(chunkSize, maxRequired(pos))); + fileChannel.read(innerBuf, pos, innerBuf, this); } private int maxRequired(long pos) { @@ -563,7 +452,6 @@ private int maxRequired(long pos) { } } - //endregion // Private Ctr private FluxUtil() { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/Context.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/Context.java index bb58ed298737..2945cf00f5d4 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/Context.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/Context.java @@ -5,6 +5,8 @@ import com.azure.core.implementation.annotation.Immutable; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; + import java.util.Map; import java.util.Optional; @@ -16,6 +18,8 @@ */ @Immutable public class Context { + private final ClientLogger logger = new ClientLogger(Context.class); + // All fields must be immutable. // /** @@ -60,7 +64,7 @@ private Context(Context parent, Object key, Object value) { */ public Context addData(Object key, Object value) { if (key == null) { - throw new IllegalArgumentException("key cannot be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("key cannot be null")); } return new Context(this, key, value); } @@ -99,7 +103,7 @@ public static Context of(Map keyValues) { */ public Optional getData(Object key) { if (key == null) { - throw new IllegalArgumentException("key cannot be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("key cannot be null")); } for (Context c = this; c != null; c = c.parent) { if (key.equals(c.key)) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java index 7f65ab94dfc5..075bbbd22a92 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java @@ -17,7 +17,8 @@ * @param a specific expandable enum type */ public abstract class ExpandableStringEnum> { - private static ConcurrentMap> valuesByName = new ConcurrentHashMap<>(); + private static final ConcurrentMap> VALUES_BY_NAME = new ConcurrentHashMap<>(); private String name; private Class clazz; @@ -34,7 +35,7 @@ private static String uniqueKey(Class clazz, String name) { T nameValue(String name, T value, Class clazz) { this.name = name; this.clazz = clazz; - ((ConcurrentMap) valuesByName).put(uniqueKey(clazz, name), value); + ((ConcurrentMap) VALUES_BY_NAME).put(uniqueKey(clazz, name), value); return (T) this; } @@ -49,8 +50,8 @@ T nameValue(String name, T value, Class clazz) { protected static > T fromString(String name, Class clazz) { if (name == null) { return null; - } else if (valuesByName != null) { - T value = (T) valuesByName.get(uniqueKey(clazz, name)); + } else if (VALUES_BY_NAME != null) { + T value = (T) VALUES_BY_NAME.get(uniqueKey(clazz, name)); if (value != null) { return value; } @@ -73,7 +74,7 @@ protected static > T fromString(String name, C @SuppressWarnings("unchecked") protected static > Collection values(Class clazz) { // Make a copy of all values - Collection> values = new ArrayList<>(valuesByName.values()); + Collection> values = new ArrayList<>(VALUES_BY_NAME.values()); Collection list = new HashSet(); for (ExpandableStringEnum value : values) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/IterableStream.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/IterableStream.java new file mode 100644 index 000000000000..7c7d68551b50 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/IterableStream.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.util; + +import reactor.core.publisher.Flux; + +import java.util.Iterator; +import java.util.stream.Stream; + +/** + * This class provides utility to iterate over values using standard 'for-each' style loops, or to convert them into a + * Stream and operate in that fashion. All the values are preserved even if they are traversed multiple times. + * + *

Code sample using Stream

+ * + * {@codesnippet com.azure.core.util.iterableStream.stream} + * + *

Code sample using Iterator

+ * + * {@codesnippet com.azure.core.util.iterableStream.iterator.while} + * + *

Code sample using Stream and filter

+ * + * {@codesnippet com.azure.core.util.iterableStream.stream.filter} + * + * @param The type of value in this {@link Iterable}. + * @see Iterable + */ +public class IterableStream implements Iterable { + private final Flux flux; + + /** + * Creates instance given {@link Flux}. + * @param flux to iterate over + */ + public IterableStream(Flux flux) { + this.flux = flux; + } + + /** + * Utility function to provide {@link Stream} of value T. + * It will provide same stream of T values if called multiple times. + * @return {@link Stream} of value T. + */ + public Stream stream() { + return flux.toStream(); + } + + /** + * Utility function to provide {@link Iterator} of value T. + * It will provide same collection of T values if called multiple times. + * @return {@link Iterator} of value T. + */ + @Override + public Iterator iterator() { + return flux.toIterable().iterator(); + } + +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/Configuration.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/Configuration.java index f4f4365af3c0..b561987700e1 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/Configuration.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/Configuration.java @@ -24,13 +24,14 @@ public class Configuration implements Cloneable { private final ClientLogger logger = new ClientLogger(Configuration.class); - private ConcurrentMap configurations = new ConcurrentHashMap<>(); + private final ConcurrentMap configurations; private boolean loadedBaseConfigurations = false; /** * Constructs an empty configuration. */ public Configuration() { + this.configurations = new ConcurrentHashMap<>(); } private Configuration(ConcurrentMap configurations) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/ConfigurationManager.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/ConfigurationManager.java index 4f74b634d1b2..6ff272ab05a2 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/ConfigurationManager.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/ConfigurationManager.java @@ -7,12 +7,12 @@ * Manages the global configuration store. */ public final class ConfigurationManager { - private static Configuration configuration = new Configuration(); + private static final Configuration CONFIGURATION = new Configuration(); /** * @return the global configuration store. */ public static Configuration getConfiguration() { - return configuration; + return CONFIGURATION; } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/Poller.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/Poller.java index e20d7d32f5f5..5c7dc744e3f2 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/Poller.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/Poller.java @@ -49,7 +49,7 @@ * {@codesnippet com.azure.core.util.polling.poller.block} * *

Disable auto polling and polling manually

- * {@codesnippet com.azure.core.util.polling.poller.poll} + * {@codesnippet com.azure.core.util.polling.poller.poll-manually} * * @param Type of poll response value * @see PollResponse @@ -67,7 +67,7 @@ public class Poller { /* * poll interval before next auto poll. This value will be used if the PollResponse does not include retryAfter from the service. */ - private Duration pollInterval; + private final Duration pollInterval; /* * This will save last poll response. @@ -77,7 +77,7 @@ public class Poller { /* * This will be called when cancel operation is triggered. */ - private Consumer> cancelOperation; + private final Consumer> cancelOperation; /* * Indicate to poll automatically or not when poller is created. @@ -90,7 +90,7 @@ public class Poller { * This could be shared among many subscriber. One of the subscriber will be this poller itself. * Once subscribed, this Flux will continue to poll for status until poll operation is done/complete. */ - private Flux> fluxHandle; + private final Flux> fluxHandle; /* * Since constructor create a subscriber and start auto polling. @@ -116,6 +116,25 @@ public class Poller { * @throws IllegalArgumentException if {@code pollInterval} is less than or equal to zero and if {@code pollInterval} or {@code pollOperation} are {@code null} */ public Poller(Duration pollInterval, Function, Mono>> pollOperation) { + this(pollInterval, pollOperation, null); + } + + /** + * Create a {@link Poller} instance with poll interval, poll operation and cancel operation. The polling starts immediately by invoking {@code pollOperation}. + * The next poll cycle will be defined by retryAfter value in {@link PollResponse}. + * In absence of {@link PollResponse#getRetryAfter()}, the {@link Poller} will use {@code pollInterval}. + * + * @param pollInterval Not-null and greater than zero poll interval. + * @param pollOperation The polling operation to be called by the {@link Poller} instance. This is a callback into the client library, + * which must never return {@code null}, and which must always have a non-null {@link OperationStatus}. + *{@link Mono} returned from poll operation should never return {@link Mono#error(Throwable)}.If any unexpected scenario happens in poll operation, + * it should handle it and return a valid {@link PollResponse}. However if poll operation returns {@link Mono#error(Throwable)}, + * the {@link Poller} will disregard that and continue to poll. + * @param cancelOperation cancel operation if cancellation is supported by the service. It can be {@code null} which will indicate to the {@link Poller} + * that cancel operation is not supported by Azure service. + * @throws IllegalArgumentException if {@code pollInterval} is less than or equal to zero and if {@code pollInterval} or {@code pollOperation} are {@code null} + */ + public Poller(Duration pollInterval, Function, Mono>> pollOperation, Consumer> cancelOperation) { if (pollInterval == null || pollInterval.toNanos() <= 0) { throw logger.logExceptionAsWarning(new IllegalArgumentException("Null, negative or zero value for poll interval is not allowed.")); } @@ -136,25 +155,6 @@ public Poller(Duration pollInterval, Function, Mono, Mono>> pollOperation, Consumer> cancelOperation) { - this(pollInterval, pollOperation); this.cancelOperation = cancelOperation; } @@ -168,7 +168,7 @@ public Poller(Duration pollInterval, Function, Mono> getObserver() { * *

Manual Polling

*

- * {@codesnippet com.azure.core.util.polling.poller.poll.indepth} + * {@codesnippet com.azure.core.util.polling.poller.poll-indepth} * * @return a Mono of {@link PollResponse} This will call poll operation once. The {@link Mono} returned here could be subscribed * for receiving {@link PollResponse} in async manner. diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/IterableResponseJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/IterableResponseJavaDocCodeSnippets.java deleted file mode 100644 index 9ccdd4157ed4..000000000000 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/IterableResponseJavaDocCodeSnippets.java +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.http.rest; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpMethod; -import com.azure.core.http.HttpRequest; -import com.azure.core.implementation.http.PagedResponseBase; -import reactor.core.publisher.Flux; - -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Iterator; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -/** - * Code snippets for {@link IterableResponse} - */ -public class IterableResponseJavaDocCodeSnippets { - - /** - * Iterate over {@link java.util.stream.Stream} - * @throws MalformedURLException if can not create URL object. - */ - public void streamSnippet() throws MalformedURLException { - HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") - .put("header2", "value2"); - HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); - - String deserializedHeaders = "header1,value1,header2,value2"; - - IterableResponse> myIterableResponse = - new IterableResponse<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); - - // BEGIN: com.azure.core.http.rest.iterableResponse.stream - // process the stream - myIterableResponse.stream().forEach(resp -> { - if (resp.statusCode() == HttpURLConnection.HTTP_OK) { - System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url()); - resp.items().forEach(value -> { - System.out.printf("Response value is %d%n", value); - }); - } - }); - // END: com.azure.core.http.rest.iterableResponse.stream - } - - /** - * Iterate with {@link Iterator} interface. - * @throws MalformedURLException if can not create URL object. - */ - public void iteratorwhileSnippet() throws MalformedURLException { - HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") - .put("header2", "value2"); - HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); - - String deserializedHeaders = "header1,value1,header2,value2"; - - IterableResponse> myIterableResponse = - new IterableResponse<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); - - // BEGIN: com.azure.core.http.rest.iterableResponse.iterator.while - // Iterate over iterator - Iterator> ite = myIterableResponse.iterator(); - while (ite.hasNext()) { - PagedResponseBase resp = ite.next(); - if (resp.statusCode() == HttpURLConnection.HTTP_OK) { - System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url()); - resp.items().forEach(value -> { - System.out.printf("Response value is %d%n", value); - }); - } - } - // END: com.azure.core.http.rest.iterableResponse.iterator.while - } - - /** - * Iterate over {@link java.util.stream.Stream} - * @throws MalformedURLException if can not create URL object. - */ - public void iteratorStreamFilterSnippet() throws MalformedURLException { - HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") - .put("header2", "value2"); - HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); - - String deserializedHeaders = "header1,value1,header2,value2"; - - IterableResponse> myIterableResponse = - new IterableResponse<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); - - // BEGIN: com.azure.core.http.rest.iterableResponse.stream.filter - // process the stream - myIterableResponse.stream().filter(resp -> resp.statusCode() == HttpURLConnection.HTTP_OK) - .limit(10) - .forEach(resp -> { - System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url()); - resp.items().forEach(value -> { - System.out.printf("Response value is %d%n", value); - }); - }); - // END: com.azure.core.http.rest.iterableResponse.stream.filter - } - - private PagedResponseBase createPagedResponse(HttpRequest httpRequest, HttpHeaders httpHeaders, - String deserializedHeaders, int i, int noOfPages) { - return new PagedResponseBase<>(httpRequest, HttpURLConnection.HTTP_OK, - httpHeaders, - getItems(i), - i < noOfPages - 1 ? String.valueOf(i + 1) : null, - deserializedHeaders); - } - - private List getItems(Integer i) { - return IntStream.range(i * 3, i * 3 + 3).boxed().collect(Collectors.toList()); - } -} diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/IterableStreamJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/IterableStreamJavaDocCodeSnippets.java new file mode 100644 index 000000000000..d348faf10951 --- /dev/null +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/IterableStreamJavaDocCodeSnippets.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.util; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpMethod; +import com.azure.core.http.HttpRequest; +import com.azure.core.implementation.http.PagedResponseBase; +import reactor.core.publisher.Flux; + +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +/** + * Code snippets for {@link IterableStream} + */ +public class IterableStreamJavaDocCodeSnippets { + + /** + * Iterate over {@link java.util.stream.Stream} + * @throws MalformedURLException if can not create URL object. + */ + public void streamSnippet() throws MalformedURLException { + HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") + .put("header2", "value2"); + HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); + + String deserializedHeaders = "header1,value1,header2,value2"; + + IterableStream> myIterableStream = + new IterableStream<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); + + // BEGIN: com.azure.core.util.iterableStream.stream + // process the stream + myIterableStream.stream().forEach(resp -> { + if (resp.statusCode() == HttpURLConnection.HTTP_OK) { + System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url()); + resp.items().forEach(value -> { + System.out.printf("Response value is %d%n", value); + }); + } + }); + // END: com.azure.core.util.iterableStream.stream + } + + /** + * Iterate with {@link Iterator} interface. + * @throws MalformedURLException if can not create URL object. + */ + public void iteratorwhileSnippet() throws MalformedURLException { + HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") + .put("header2", "value2"); + HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); + + String deserializedHeaders = "header1,value1,header2,value2"; + + IterableStream> myIterableStream = + new IterableStream<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); + + // BEGIN: com.azure.core.util.iterableStream.iterator.while + // Iterate over iterator + Iterator> ite = myIterableStream.iterator(); + while (ite.hasNext()) { + PagedResponseBase resp = ite.next(); + if (resp.statusCode() == HttpURLConnection.HTTP_OK) { + System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url()); + resp.items().forEach(value -> { + System.out.printf("Response value is %d%n", value); + }); + } + } + // END: com.azure.core.util.iterableStream.iterator.while + } + + /** + * Iterate over {@link java.util.stream.Stream} + * @throws MalformedURLException if can not create URL object. + */ + public void iteratorStreamFilterSnippet() throws MalformedURLException { + HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") + .put("header2", "value2"); + HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); + + String deserializedHeaders = "header1,value1,header2,value2"; + + IterableStream> myIterableStream = + new IterableStream<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); + + // BEGIN: com.azure.core.util.iterableStream.stream.filter + // process the stream + myIterableStream.stream().filter(resp -> resp.statusCode() == HttpURLConnection.HTTP_OK) + .limit(10) + .forEach(resp -> { + System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url()); + resp.items().forEach(value -> { + System.out.printf("Response value is %d%n", value); + }); + }); + // END: com.azure.core.util.iterableStream.stream.filter + } + + private PagedResponseBase createPagedResponse(HttpRequest httpRequest, HttpHeaders httpHeaders, + String deserializedHeaders, int i, int noOfPages) { + return new PagedResponseBase<>(httpRequest, HttpURLConnection.HTTP_OK, + httpHeaders, + getItems(i), + i < noOfPages - 1 ? String.valueOf(i + 1) : null, + deserializedHeaders); + } + + private List getItems(Integer i) { + return IntStream.range(i * 3, i * 3 + 3).boxed().collect(Collectors.toList()); + } +} diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollResponseJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollResponseJavaDocCodeSnippets.java index 24dd473bfbad..5f33118da9d2 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollResponseJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollResponseJavaDocCodeSnippets.java @@ -11,7 +11,7 @@ /** * Code snipper for PollResponse * - * @param + * @param The type of the object stored within the {@link PollResponseJavaDocCodeSnippets} instance */ diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollerJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollerJavaDocCodeSnippets.java index 3cabbac3a8a4..acbdf8420ba8 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollerJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollerJavaDocCodeSnippets.java @@ -173,7 +173,7 @@ public void poll() { Poller myPoller = null; - // BEGIN: com.azure.core.util.polling.poller.poll + // BEGIN: com.azure.core.util.polling.poller.poll-manually myPoller.setAutoPollingEnabled(false); PollResponse pollResponse = null; // We assume that we get SUCCESSFULLY_COMPLETED status from pollOperation when polling is complete. @@ -187,7 +187,7 @@ public void poll() { } } System.out.println("Polling complete with status " + myPoller.getStatus().toString()); - // END: com.azure.core.util.polling.poller.poll + // END: com.azure.core.util.polling.poller.poll-manually } /** @@ -197,7 +197,7 @@ public void pollIndepth() { Poller myPoller = null; - // BEGIN: com.azure.core.util.polling.poller.poll.indepth + // BEGIN: com.azure.core.util.polling.poller.poll-indepth // Turn off auto polling and this code will take control of polling myPoller.setAutoPollingEnabled(false); @@ -216,6 +216,6 @@ public void pollIndepth() { } } System.out.println("Polling complete with status " + myPoller.getStatus().toString()); - // END: com.azure.core.util.polling.poller.poll.indepth + // END: com.azure.core.util.polling.poller.poll-indepth } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java index c97baf2b59ad..a04e4b60d26f 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java @@ -5,11 +5,11 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import com.azure.core.http.MockHttpClient; import com.azure.core.http.MockHttpResponse; +import com.azure.core.http.clients.NoOpHttpClient; import com.azure.core.http.policy.UserAgentPolicy; import org.junit.Assert; import org.junit.Test; @@ -21,13 +21,13 @@ public class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { Assert.assertEquals( request.headers().value("User-Agent"), "AutoRest-Java"); - return Mono.just(new MockHttpResponse(request, 200)); + return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new UserAgentPolicy("AutoRest-Java")) @@ -42,12 +42,12 @@ public Mono send(HttpRequest request) { @Test public void customUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { String header = request.headers().value("User-Agent"); Assert.assertEquals("Awesome", header); - return Mono.just(new MockHttpResponse(request, 200)); + return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new UserAgentPolicy("Awesome")) diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java index 581042362bc4..b6f28d8c5de9 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java @@ -7,7 +7,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpRequest; -import com.azure.core.http.MockHttpClient; +import com.azure.core.http.clients.NoOpHttpClient; import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import org.junit.Assert; @@ -30,7 +30,7 @@ public void basicCredentialsTest() throws Exception { }; // final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies((context, next) -> credentials.getToken("scope./default") .flatMap(token -> { context.httpRequest().headers().put("Authorization", "Basic " + token.token()); @@ -58,7 +58,7 @@ public Mono getToken(String... scopes) { }; final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies(new BearerTokenAuthenticationPolicy(credentials, "scope./default"), auditorPolicy) .build(); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java index fc4d59e79685..c846ccf7cab5 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java @@ -3,6 +3,7 @@ package com.azure.core.http; +import com.azure.core.http.clients.NoOpHttpClient; import com.azure.core.http.policy.PortPolicy; import com.azure.core.http.policy.ProtocolPolicy; import com.azure.core.http.policy.RequestIdPolicy; @@ -13,20 +14,24 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.function.Supplier; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; public class HttpPipelineTests { @Test public void constructorWithNoArguments() { - HttpPipeline pipeline = new HttpPipelineBuilder().build(); + HttpPipeline pipeline = new HttpPipelineBuilder() + .httpClient(new NoOpHttpClient() { + @Override + public Mono send(HttpRequest request) { + // do nothing + return null; + } + }).build(); assertEquals(0, pipeline.getPolicyCount()); assertNotNull(pipeline.httpClient()); - assertTrue(pipeline.httpClient() instanceof ReactorNettyClient); } @Test @@ -35,14 +40,19 @@ public void withRequestPolicy() { .policies(new PortPolicy(80, true), new ProtocolPolicy("ftp", true), new RetryPolicy()) - .build(); + .httpClient(new NoOpHttpClient() { + @Override + public Mono send(HttpRequest request) { + // do nothing + return null; + } + }).build(); assertEquals(3, pipeline.getPolicyCount()); assertEquals(PortPolicy.class, pipeline.getPolicy(0).getClass()); assertEquals(ProtocolPolicy.class, pipeline.getPolicy(1).getClass()); assertEquals(RetryPolicy.class, pipeline.getPolicy(2).getClass()); assertNotNull(pipeline.httpClient()); - assertTrue(pipeline.httpClient() instanceof ReactorNettyClient); } @Test @@ -51,12 +61,17 @@ public void withRequestOptions() throws MalformedURLException { .policies(new PortPolicy(80, true), new ProtocolPolicy("ftp", true), new RetryPolicy()) - .build(); + .httpClient(new NoOpHttpClient() { + @Override + public Mono send(HttpRequest request) { + // do nothing + return null; + } + }).build(); HttpPipelineCallContext context = new HttpPipelineCallContext(new HttpRequest(HttpMethod.GET, new URL("http://foo.com"))); assertNotNull(context); assertNotNull(pipeline.httpClient()); - assertTrue(pipeline.httpClient() instanceof ReactorNettyClient); } @Test @@ -64,13 +79,13 @@ public void withNoRequestPolicies() throws MalformedURLException { final HttpMethod expectedHttpMethod = HttpMethod.GET; final URL expectedUrl = new URL("http://my.site.com"); final HttpPipeline httpPipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { assertEquals(0, request.headers().size()); assertEquals(expectedHttpMethod, request.httpMethod()); assertEquals(expectedUrl, request.url()); - return Mono.just(new MockHttpResponse(request, 200)); + return Mono.just(new MockHttpResponse(request, 200)); } }) .build(); @@ -85,14 +100,14 @@ public void withUserAgentRequestPolicy() throws MalformedURLException { final HttpMethod expectedHttpMethod = HttpMethod.GET; final URL expectedUrl = new URL("http://my.site.com/1"); final String expectedUserAgent = "my-user-agent"; - final HttpClient httpClient = new MockHttpClient() { + final HttpClient httpClient = new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { assertEquals(1, request.headers().size()); assertEquals(expectedUserAgent, request.headers().value("User-Agent")); assertEquals(expectedHttpMethod, request.httpMethod()); assertEquals(expectedUrl, request.url()); - return Mono.just(new MockHttpResponse(request, 200)); + return Mono.just(new MockHttpResponse(request, 200)); } }; @@ -111,7 +126,7 @@ public void withRequestIdRequestPolicy() throws MalformedURLException { final HttpMethod expectedHttpMethod = HttpMethod.GET; final URL expectedUrl = new URL("http://my.site.com/1"); final HttpPipeline httpPipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { assertEquals(1, request.headers().size()); @@ -121,7 +136,7 @@ public Mono send(HttpRequest request) { assertEquals(expectedHttpMethod, request.httpMethod()); assertEquals(expectedUrl, request.url()); - return Mono.just(new MockHttpResponse(request, 200)); + return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new RequestIdPolicy()) @@ -131,25 +146,4 @@ public Mono send(HttpRequest request) { assertNotNull(response); assertEquals(200, response.statusCode()); } - - private abstract static class MockHttpClient implements HttpClient { - - @Override - public abstract Mono send(HttpRequest request); - - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } - } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpRequestTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpRequestTests.java index ea3dcd688592..04a76ab62541 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpRequestTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpRequestTests.java @@ -3,7 +3,6 @@ package com.azure.core.http; -import io.netty.buffer.Unpooled; import org.junit.Test; import reactor.core.publisher.Flux; @@ -32,7 +31,7 @@ public void testClone() throws IOException { HttpMethod.PUT, new URL("http://request.url"), headers, - Flux.just(Unpooled.buffer(0, 0))); + Flux.empty()); final HttpRequest bufferedRequest = request.buffer(); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpResponse.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpResponse.java index 02285a3428d2..697e26422496 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpResponse.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpResponse.java @@ -6,12 +6,11 @@ import com.azure.core.implementation.serializer.SerializerAdapter; import com.azure.core.implementation.serializer.SerializerEncoding; import com.azure.core.implementation.serializer.jackson.JacksonAdapter; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.io.IOException; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -83,11 +82,11 @@ public Mono bodyAsByteArray() { } @Override - public Flux body() { + public Flux body() { if (bodyBytes == null) { return Flux.empty(); } else { - return Flux.just(Unpooled.wrappedBuffer(bodyBytes)); + return Flux.just(ByteBuffer.wrap(bodyBytes)); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/ReactorNettyClientTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/ReactorNettyClientTests.java deleted file mode 100644 index d5b182d58592..000000000000 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/ReactorNettyClientTests.java +++ /dev/null @@ -1,338 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.http; - -import com.github.tomakehurst.wiremock.WireMockServer; -import com.github.tomakehurst.wiremock.client.WireMock; -import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.util.ReferenceCountUtil; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; -import reactor.test.StepVerifier; -import reactor.test.StepVerifierOptions; - -import java.io.IOException; -import java.io.OutputStream; -import java.net.MalformedURLException; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicReference; - -import static org.junit.Assert.assertEquals; - -public class ReactorNettyClientTests { - - private static final String SHORT_BODY = "hi there"; - private static final String LONG_BODY = createLongBody(); - - private static WireMockServer server; - - @BeforeClass - public static void beforeClass() { - server = new WireMockServer(WireMockConfiguration.options().dynamicPort().disableRequestJournal()); - server.stubFor( - WireMock.get("/short").willReturn(WireMock.aResponse().withBody(SHORT_BODY))); - server.stubFor(WireMock.get("/long").willReturn(WireMock.aResponse().withBody(LONG_BODY))); - server.stubFor(WireMock.get("/error") - .willReturn(WireMock.aResponse().withBody("error").withStatus(500))); - server.stubFor( - WireMock.post("/shortPost").willReturn(WireMock.aResponse().withBody(SHORT_BODY))); - server.start(); - // ResourceLeakDetector.setLevel(Level.PARANOID); - } - - @AfterClass - public static void afterClass() { - if (server != null) { - server.shutdown(); - } - } - - @Test - public void testFlowableResponseShortBodyAsByteArrayAsync() { - checkBodyReceived(SHORT_BODY, "/short"); - } - - @Test - public void testFlowableResponseLongBodyAsByteArrayAsync() { - checkBodyReceived(LONG_BODY, "/long"); - } - - @Test - public void testMultipleSubscriptionsEmitsError() { - HttpResponse response = getResponse("/short"); - // Subscription:1 - response.bodyAsByteArray().block(); - // Subscription:2 - StepVerifier.create(response.bodyAsByteArray()) - .expectNextCount(0) // TODO: Check with smaldini, what is the verifier operator equivalent to .awaitDone(20, TimeUnit.SECONDS) - .verifyError(IllegalStateException.class); - - } - - @Test - public void testDispose() throws InterruptedException { - HttpResponse response = getResponse("/long"); - response.body().subscribe().dispose(); - // Wait for scheduled connection disposal action to execute on netty event-loop - Thread.sleep(5000); - Assert.assertTrue(response.internConnection().isDisposed()); - } - - @Test - public void testCancel() { - HttpResponse response = getResponse("/long"); - // - StepVerifierOptions stepVerifierOptions = StepVerifierOptions.create(); - stepVerifierOptions.initialRequest(0); - // - StepVerifier.create(response.body(), stepVerifierOptions) - .expectNextCount(0) - .thenRequest(1) - .expectNextCount(1) - .thenCancel() - .verify(); - Assert.assertTrue(response.internConnection().isDisposed()); - } - - @Test - public void testFlowableWhenServerReturnsBodyAndNoErrorsWhenHttp500Returned() { - HttpResponse response = getResponse("/error"); - StepVerifier.create(response.bodyAsString()) - .expectNext("error") // TODO: .awaitDone(20, TimeUnit.SECONDS) [See previous todo] - .verifyComplete(); - assertEquals(500, response.statusCode()); - } - - @Test - @Ignore("Not working accurately at present") - public void testFlowableBackpressure() { - HttpResponse response = getResponse("/long"); - // - StepVerifierOptions stepVerifierOptions = StepVerifierOptions.create(); - stepVerifierOptions.initialRequest(0); - // - StepVerifier.create(response.body(), stepVerifierOptions) - .expectNextCount(0) - .thenRequest(1) - .expectNextCount(1) - .thenRequest(3) - .expectNextCount(3) - .thenRequest(Long.MAX_VALUE)// TODO: Check with smaldini, what is the verifier operator to ignore all next emissions - .expectNextCount(1507) - .verifyComplete(); - } - - @Test - public void testRequestBodyIsErrorShouldPropagateToResponse() { - HttpClient client = HttpClient.createDefault(); - HttpRequest request = new HttpRequest(HttpMethod.POST, url(server, "/shortPost")) - .header("Content-Length", "123") - .body(Flux.error(new RuntimeException("boo"))); - - StepVerifier.create(client.send(request)) - .expectErrorMessage("boo") - .verify(); - } - - @Test - public void testRequestBodyEndsInErrorShouldPropagateToResponse() { - HttpClient client = HttpClient.createDefault(); - String contentChunk = "abcdefgh"; - int repetitions = 1000; - HttpRequest request = new HttpRequest(HttpMethod.POST, url(server, "/shortPost")) - .header("Content-Length", String.valueOf(contentChunk.length() * repetitions)) - .body(Flux.just(contentChunk) - .repeat(repetitions) - .map(s -> Unpooled.wrappedBuffer(s.getBytes(StandardCharsets.UTF_8))) - .concatWith(Flux.error(new RuntimeException("boo")))); - StepVerifier.create(client.send(request)) - // .awaitDone(10, TimeUnit.SECONDS) - .expectErrorMessage("boo") - .verify(); - } - - @Test(timeout = 5000) - public void testServerShutsDownSocketShouldPushErrorToContentFlowable() - throws IOException, InterruptedException { - CountDownLatch latch = new CountDownLatch(1); - AtomicReference sock = new AtomicReference<>(); - ServerSocket ss = new ServerSocket(0); - try { - Mono.fromCallable(() -> { - latch.countDown(); - Socket socket = ss.accept(); - sock.set(socket); - // give the client time to get request across - Thread.sleep(500); - // respond but don't send the complete response - byte[] bytes = new byte[1024]; - int n = socket.getInputStream().read(bytes); - System.out.println(new String(bytes, 0, n, StandardCharsets.UTF_8)); - String response = "HTTP/1.1 200 OK\r\n" // - + "Content-Type: text/plain\r\n" // - + "Content-Length: 10\r\n" // - + "\r\n" // - + "zi"; - OutputStream out = socket.getOutputStream(); - out.write(response.getBytes()); - out.flush(); - // kill the socket with HTTP response body incomplete - socket.close(); - return 1; - }) - .subscribeOn(Schedulers.elastic()) - .subscribe(); - // - latch.await(); - HttpClient client = HttpClient.createDefault(); - HttpRequest request = new HttpRequest(HttpMethod.GET, - new URL("http://localhost:" + ss.getLocalPort() + "/get")); - HttpResponse response = client.send(request).block(); - assertEquals(200, response.statusCode()); - System.out.println("reading body"); - // - StepVerifier.create(response.bodyAsByteArray()) - // .awaitDone(20, TimeUnit.SECONDS) - .verifyError(IOException.class); - } finally { - ss.close(); - } - } - - @Ignore("This flakey test fails often on MacOS. https://github.com/Azure/azure-sdk-for-java/issues/4357.") - @Test - public void testConcurrentRequests() throws NoSuchAlgorithmException { - long t = System.currentTimeMillis(); - int numRequests = 100; // 100 = 1GB of data read - long timeoutSeconds = 60; - HttpClient client = HttpClient.createDefault(); - byte[] expectedDigest = digest(LONG_BODY); - - Mono numBytesMono = Flux.range(1, numRequests) - .parallel(10) - .runOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .flatMap(n -> Mono.fromCallable(() -> getResponse(client, "/long")).flatMapMany(response -> { - MessageDigest md = md5Digest(); - return response.body() - .doOnNext(bb -> { - bb.retain(); - if (bb.hasArray()) { - // Heap buffer - md.update(bb.array()); - } else { - // Direct buffer - int len = bb.readableBytes(); - byte[] array = new byte[len]; - bb.getBytes(bb.readerIndex(), array); - md.update(array); - } - }) - .map(bb -> new NumberedByteBuf(n, bb)) -// .doOnComplete(() -> System.out.println("completed " + n)) - .doOnComplete(() -> Assert.assertArrayEquals("wrong digest!", expectedDigest, - md.digest())); - })) - .sequential() - // enable the doOnNext call to see request numbers and thread names - // .doOnNext(g -> System.out.println(g.n + " " + - // Thread.currentThread().getName())) - .map(nbb -> { - long bytesCount = (long) nbb.bb.readableBytes(); - ReferenceCountUtil.release(nbb.bb); - return bytesCount; - }) - .reduce((x, y) -> x + y) - .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)); - - StepVerifier.create(numBytesMono) -// .awaitDone(timeoutSeconds, TimeUnit.SECONDS) - .expectNext((long) (numRequests * LONG_BODY.getBytes(StandardCharsets.UTF_8).length)) - .verifyComplete(); -// -// long numBytes = numBytesMono.block(); -// t = System.currentTimeMillis() - t; -// System.out.println("totalBytesRead=" + numBytes / 1024 / 1024 + "MB in " + t / 1000.0 + "s"); -// assertEquals(numRequests * LONG_BODY.getBytes(StandardCharsets.UTF_8).length, numBytes); - } - - private static MessageDigest md5Digest() { - try { - return MessageDigest.getInstance("MD5"); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - } - - private static byte[] digest(String s) throws NoSuchAlgorithmException { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(s.getBytes(StandardCharsets.UTF_8)); - byte[] expectedDigest = md.digest(); - return expectedDigest; - } - - private static final class NumberedByteBuf { - final long n; - final ByteBuf bb; - - NumberedByteBuf(long n, ByteBuf bb) { - this.n = n; - this.bb = bb; - } - } - - private static HttpResponse getResponse(String path) { - HttpClient client = HttpClient.createDefault(); - return getResponse(client, path); - } - - private static HttpResponse getResponse(HttpClient client, String path) { - HttpRequest request = new HttpRequest(HttpMethod.GET, url(server, path)); - return client.send(request).block(); - } - - private static URL url(WireMockServer server, String path) { - try { - return new URL("http://localhost:" + server.port() + path); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - private static String createLongBody() { - StringBuilder s = new StringBuilder(10000000); - for (int i = 0; i < 1000000; i++) { - s.append("abcdefghijk"); - } - return s.toString(); - } - - private void checkBodyReceived(String expectedBody, String path) { - HttpClient client = HttpClient.createDefault(); - HttpResponse response = doRequest(client, path); - String s = new String(response.bodyAsByteArray().block(), - StandardCharsets.UTF_8); - assertEquals(expectedBody, s); - } - - private HttpResponse doRequest(HttpClient client, String path) { - HttpRequest request = new HttpRequest(HttpMethod.GET, url(server, path)); - HttpResponse response = client.send(request).block(); - return response; - } -} diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpClient.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/MockHttpClient.java similarity index 90% rename from sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpClient.java rename to sdk/core/azure-core/src/test/java/com/azure/core/http/clients/MockHttpClient.java index dad19ec73036..73e370c9bc8f 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpClient.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/MockHttpClient.java @@ -1,21 +1,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.http; +package com.azure.core.http.clients; import com.azure.core.entities.HttpBinFormDataJSON; import com.azure.core.entities.HttpBinFormDataJSON.Form; import com.azure.core.entities.HttpBinFormDataJSON.PizzaSize; import com.azure.core.entities.HttpBinJSON; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.MockHttpResponse; import com.azure.core.implementation.Base64Url; import com.azure.core.implementation.DateTimeRfc1123; import com.azure.core.implementation.util.FluxUtil; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Mono; import java.net.URL; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.Instant; import java.time.OffsetDateTime; @@ -25,12 +27,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Supplier; /** * This HttpClient attempts to mimic the behavior of http://httpbin.org without ever making a network call. */ -public class MockHttpClient implements HttpClient { +public class MockHttpClient extends NoOpHttpClient { private static final HttpHeaders RESPONSE_HEADERS = new HttpHeaders() .put("Date", "Fri, 13 Oct 2017 20:33:09 GMT") .put("Via", "1.1 vegur") @@ -143,7 +144,7 @@ public Mono send(HttpRequest request) { json.data(createHttpBinResponseDataForRequest(request)); response = new MockHttpResponse(request, 200, json); } else if (requestPathLower.equals("/post")) { - if ("x-www-form-urlencoded".equalsIgnoreCase(contentType)) { + if (contentType != null && contentType.contains("x-www-form-urlencoded")) { Map parsed = bodyToMap(request); final HttpBinFormDataJSON json = new HttpBinFormDataJSON(); Form form = new Form(); @@ -153,6 +154,7 @@ public Mono send(HttpRequest request) { form.pizzaSize(PizzaSize.valueOf(parsed.get("size"))); form.toppings(Arrays.asList(parsed.get("toppings").split(","))); json.form(form); + response = new MockHttpResponse(request, 200, RESPONSE_HEADERS, json); } else { final HttpBinJSON json = new HttpBinJSON(); json.url(request.url().toString()); @@ -172,13 +174,8 @@ public Mono send(HttpRequest request) { response = new MockHttpResponse(request, statusCode); } } else if ("echo.org".equalsIgnoreCase(requestHost)) { - return request.body() - .map(ByteBuf::nioBuffer) - .collectList() - .map(list -> { - byte[] bytes = Unpooled.wrappedBuffer(list.toArray(new ByteBuffer[0])).array(); - return new MockHttpResponse(request, 200, new HttpHeaders(request.headers()), bytes); - }); + return FluxUtil.collectBytesInByteBufferStream(request.body()) + .map(bytes -> new MockHttpResponse(request, 200, new HttpHeaders(request.headers()), bytes)); } } catch (Exception ex) { return Mono.error(ex); @@ -191,21 +188,6 @@ public Mono send(HttpRequest request) { return Mono.just(response); } - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } - private static String createHttpBinResponseDataForRequest(HttpRequest request) { String body = bodyToString(request); if (body == null) { @@ -218,7 +200,7 @@ private static String createHttpBinResponseDataForRequest(HttpRequest request) { private static String bodyToString(HttpRequest request) { String body = ""; if (request.body() != null) { - Mono asyncString = FluxUtil.collectBytesInByteBufStream(request.body(), true) + Mono asyncString = FluxUtil.collectBytesInByteBufferStream(request.body()) .map(bytes -> new String(bytes, StandardCharsets.UTF_8)); body = asyncString.block(); } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/NoOpHttpClient.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/NoOpHttpClient.java new file mode 100644 index 000000000000..1edcbc4c5ad3 --- /dev/null +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/NoOpHttpClient.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.clients; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.ProxyOptions; +import reactor.core.publisher.Mono; + +import java.util.function.Supplier; + +public class NoOpHttpClient implements HttpClient { + + @Override + public Mono send(HttpRequest request) { + return Mono.empty(); // NOP + } + + @Override + public HttpClient proxy(Supplier proxyOptions) { + throw new IllegalStateException("MockHttpClient.proxy"); + } + + @Override + public HttpClient wiretap(boolean enableWiretap) { + throw new IllegalStateException("MockHttpClient.wiretap"); + } + + @Override + public HttpClient port(int port) { + throw new IllegalStateException("MockHttpClient.port"); + } +} diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java index beb4a130ad97..a4f39303b7c3 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java @@ -3,19 +3,15 @@ package com.azure.core.http.policy; -import com.azure.core.http.HttpClient; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpRequest; +import com.azure.core.http.clients.NoOpHttpClient; import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.ProxyOptions; import org.junit.Test; -import reactor.core.publisher.Mono; import java.net.MalformedURLException; import java.net.URL; -import java.util.function.Supplier; import static org.junit.Assert.assertEquals; @@ -34,7 +30,7 @@ public void withPort() throws MalformedURLException { private static HttpPipeline createPipeline(String host, String expectedUrl) { return new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies(new HostPolicy(host), (context, next) -> { assertEquals(expectedUrl, context.httpRequest().url().toString()); @@ -46,27 +42,4 @@ private static HttpPipeline createPipeline(String host, String expectedUrl) { private static HttpRequest createHttpRequest(String url) throws MalformedURLException { return new HttpRequest(HttpMethod.GET, new URL(url)); } - - private static class MockHttpClient implements HttpClient { - - @Override - public Mono send(HttpRequest request) { - return Mono.empty(); // NOP - } - - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } - } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java index 3701b984d40d..13bbe6b1e793 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java @@ -3,19 +3,15 @@ package com.azure.core.http.policy; -import com.azure.core.http.HttpClient; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.ProxyOptions; +import com.azure.core.http.clients.NoOpHttpClient; import org.junit.Test; -import reactor.core.publisher.Mono; import java.net.MalformedURLException; import java.net.URL; -import java.util.function.Supplier; import static org.junit.Assert.assertEquals; @@ -34,7 +30,7 @@ public void withNoOverwrite() throws MalformedURLException { } private static HttpPipeline createPipeline(String protocol, String expectedUrl) { return new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies(new ProtocolPolicy(protocol, true), (context, next) -> { assertEquals(expectedUrl, context.httpRequest().url().toString()); @@ -45,7 +41,7 @@ private static HttpPipeline createPipeline(String protocol, String expectedUrl) private static HttpPipeline createPipeline(String protocol, boolean overwrite, String expectedUrl) { return new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies(new ProtocolPolicy(protocol, overwrite), (context, next) -> { assertEquals(expectedUrl, context.httpRequest().url().toString()); @@ -57,27 +53,4 @@ private static HttpPipeline createPipeline(String protocol, boolean overwrite, S private static HttpRequest createHttpRequest(String url) throws MalformedURLException { return new HttpRequest(HttpMethod.GET, new URL(url)); } - - private static class MockHttpClient implements HttpClient { - - @Override - public Mono send(HttpRequest request) { - return Mono.empty(); - } - - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } - } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java index 7c0331086ae0..8741b9434e49 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java @@ -7,7 +7,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpRequest; -import com.azure.core.http.MockHttpClient; +import com.azure.core.http.clients.NoOpHttpClient; import org.junit.Test; import java.net.MalformedURLException; @@ -25,7 +25,7 @@ public void test() throws MalformedURLException { final String password = "testpass"; // final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies(new ProxyAuthenticationPolicy(username, password), (context, next) -> { assertEquals("Basic dGVzdHVzZXI6dGVzdHBhc3M=", context.httpRequest().headers().value("Proxy-Authentication")); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java index 035a0ded64c8..272b5c0155eb 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java @@ -9,14 +9,14 @@ import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpResponse; -import com.azure.core.http.MockHttpClient; -import io.netty.buffer.ByteBuf; +import com.azure.core.http.clients.NoOpHttpClient; import org.junit.Assert; import org.junit.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -44,7 +44,7 @@ public Mono bodyAsByteArray() { } @Override - public Flux body() { + public Flux body() { return Flux.empty(); } @@ -64,7 +64,7 @@ public Mono bodyAsString(Charset charset) { @Test public void newRequestIdForEachCall() throws Exception { HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { String firstRequestId = null; @Override public Mono send(HttpRequest request) { @@ -91,7 +91,7 @@ public Mono send(HttpRequest request) { @Test public void sameRequestIdForRetry() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { String firstRequestId = null; @Override diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java index 03eb57f79fb6..d389040ec7c4 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java @@ -5,11 +5,11 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import com.azure.core.http.MockHttpClient; import com.azure.core.http.MockHttpResponse; +import com.azure.core.http.clients.NoOpHttpClient; import org.junit.Assert; import org.junit.Test; import reactor.core.publisher.Mono; @@ -22,14 +22,14 @@ public class RetryPolicyTests { @Test public void exponentialRetryEndOn501() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { // Send 408, 500, 502, all retried, with a 501 ending private final int[] codes = new int[]{408, 500, 502, 501}; private int count = 0; @Override public Mono send(HttpRequest request) { - return Mono.just(new MockHttpResponse(request, codes[count++])); + return Mono.just(new MockHttpResponse(request, codes[count++])); } }) .policies(new RetryPolicy(3, Duration.of(0, ChronoUnit.MILLIS))) @@ -45,13 +45,13 @@ public Mono send(HttpRequest request) { public void exponentialRetryMax() throws Exception { final int maxRetries = 5; final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { int count = -1; @Override public Mono send(HttpRequest request) { Assert.assertTrue(count++ < maxRetries); - return Mono.just(new MockHttpResponse(request, 500)); + return Mono.just(new MockHttpResponse(request, 500)); } }) .policies(new RetryPolicy(maxRetries, Duration.of(0, ChronoUnit.MILLIS))) diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/IterableResponseTest.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/IterableResponseTest.java index e74104f1a6b6..a5b05348eee7 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/IterableResponseTest.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/IterableResponseTest.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.stream.Collectors; +import com.azure.core.util.IterableStream; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; @@ -30,7 +31,7 @@ public void setup() { /*Ensure that if we call stream multiple times, it always returns same values and they are same as original list of values.*/ @Test public void testIterableResponseStreamFromStart() { - IterableResponse iterableResponse = getIntegerIterableResponse(2, 5); + IterableStream iterableResponse = getIntegerIterableResponse(2, 5); Assert.assertEquals(iterableResponse.stream().collect(Collectors.toList()).size(), iterableResponse.stream().collect(Collectors.toList()).size()); // ensure original list of values are same after calling iterator() @@ -41,7 +42,7 @@ public void testIterableResponseStreamFromStart() { /*Ensure that if we call iterator multiple times, it always returns same values and they are same as original list of values.*/ @Test public void testIterableResponseIteratorFromStart() { - IterableResponse iterableResponse = getIntegerIterableResponse(2, 5); + IterableStream iterableResponse = getIntegerIterableResponse(2, 5); List actualNumberValues1 = new ArrayList<>(); List actualNumberValues2 = new ArrayList<>(); iterableResponse.iterator().forEachRemaining(number -> actualNumberValues1.add(number)); @@ -53,8 +54,8 @@ public void testIterableResponseIteratorFromStart() { iterableResponse.iterator().forEachRemaining(number -> Assert.assertTrue(originalIntegerList.contains(number))); } - private IterableResponse getIntegerIterableResponse(int startNumber, int noOfValues) { + private IterableStream getIntegerIterableResponse(int startNumber, int noOfValues) { Flux integerFlux = Flux.range(startNumber, noOfValues); - return new IterableResponse<>(integerFlux); + return new IterableStream<>(integerFlux); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedFluxTest.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedFluxTest.java index ebbc020f8529..aa560087d84e 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedFluxTest.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedFluxTest.java @@ -7,7 +7,6 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpRequest; import com.azure.core.implementation.http.PagedResponseBase; -import io.netty.handler.codec.http.HttpResponseStatus; import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -126,7 +125,7 @@ private PagedFlux getIntegerPagedFlux(int noOfPages) throws MalformedUR private PagedResponseBase createPagedResponse(HttpRequest httpRequest, HttpHeaders httpHeaders, String deserializedHeaders, int i, int noOfPages) { - return new PagedResponseBase<>(httpRequest, HttpResponseStatus.OK.code(), + return new PagedResponseBase<>(httpRequest, 200, httpHeaders, getItems(i), i < noOfPages - 1 ? String.valueOf(i + 1) : null, diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java index a8a7258c419f..c63e1168289c 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java @@ -4,14 +4,6 @@ package com.azure.core.implementation; import com.azure.core.MockServer; -import com.azure.core.implementation.annotation.BodyParam; -import com.azure.core.implementation.annotation.Delete; -import com.azure.core.implementation.annotation.ExpectedResponses; -import com.azure.core.implementation.annotation.Get; -import com.azure.core.implementation.annotation.HeaderParam; -import com.azure.core.implementation.annotation.Host; -import com.azure.core.implementation.annotation.Put; -import com.azure.core.implementation.annotation.PathParam; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipelineBuilder; @@ -26,11 +18,15 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.rest.StreamResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.Delete; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.Put; import com.azure.core.implementation.http.ContentType; -import com.azure.core.implementation.util.FluxUtil; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.util.ResourceLeakDetector; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Assume; @@ -46,16 +42,13 @@ import java.io.File; import java.io.IOException; import java.lang.ProcessBuilder.Redirect; -import java.nio.MappedByteBuffer; -import java.nio.channels.AsynchronousFileChannel; -import java.nio.channels.FileChannel; +import java.nio.ByteBuffer; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; -import java.nio.file.StandardOpenOption; import java.nio.file.attribute.BasicFileAttributes; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -65,10 +58,10 @@ import java.util.ArrayList; import java.util.Base64; import java.util.List; -import java.util.Random; import java.util.concurrent.ThreadLocalRandom; import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.fail; public class RestProxyStressTests { private static IOService service; @@ -84,9 +77,6 @@ public static void beforeClass() throws IOException { "Set the environment variable JAVA_SDK_STRESS_TESTS to \"true\" to run stress tests", Boolean.parseBoolean(System.getenv("JAVA_SDK_STRESS_TESTS"))); - ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID); - LoggerFactory.getLogger(RestProxyStressTests.class).info("ResourceLeakDetector level: " + ResourceLeakDetector.getLevel()); - String tempFolderPath = System.getenv("JAVA_STRESS_TEST_TEMP_PATH"); if (tempFolderPath == null || tempFolderPath.isEmpty()) { tempFolderPath = "temp"; @@ -174,7 +164,7 @@ Mono process(final int waitTimeSeconds, final HttpPipelineCallCont interface IOService { @ExpectedResponses({201}) @Put("/javasdktest/upload/100m-{id}.dat?{sas}") - Mono upload100MB(@PathParam("id") String id, @PathParam(value = "sas", encoded = true) String sas, @HeaderParam("x-ms-blob-type") String blobType, @BodyParam(ContentType.APPLICATION_OCTET_STREAM) Flux stream, @HeaderParam("content-length") long contentLength); + Mono upload100MB(@PathParam("id") String id, @PathParam(value = "sas", encoded = true) String sas, @HeaderParam("x-ms-blob-type") String blobType, @BodyParam(ContentType.APPLICATION_OCTET_STREAM) Flux stream, @HeaderParam("content-length") long contentLength); @Get("/javasdktest/upload/100m-{id}.dat?{sas}") Mono download100M(@PathParam("id") String id, @PathParam(value = "sas", encoded = true) String sas); @@ -218,50 +208,53 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx } private static void create100MFiles(boolean recreate) throws IOException { - final Flux contentGenerator = Flux.generate(Random::new, (random, emitter) -> { - byte[] ba = new byte[CHUNK_SIZE]; - random.nextBytes(ba); - emitter.next(Unpooled.wrappedBuffer(ba)); - return random; - }); - - if (recreate) { - deleteRecursive(tempFolderPath); - } - - if (Files.exists(tempFolderPath)) { - LoggerFactory.getLogger(RestProxyStressTests.class).info("Temp files directory already exists: " + tempFolderPath.toAbsolutePath()); - } else { - LoggerFactory.getLogger(RestProxyStressTests.class).info("Generating temp files in directory: " + tempFolderPath.toAbsolutePath()); - Files.createDirectory(tempFolderPath); - Flux.range(0, NUM_FILES).flatMap(integer -> { - try { - final int i = integer; - final Path filePath = tempFolderPath.resolve("100m-" + i + ".dat"); - - Files.deleteIfExists(filePath); - Files.createFile(filePath); - final AsynchronousFileChannel file = AsynchronousFileChannel.open(filePath, StandardOpenOption.READ, StandardOpenOption.WRITE); - final MessageDigest messageDigest = MessageDigest.getInstance("MD5"); - - Flux fileContent = contentGenerator - .take(CHUNKS_PER_FILE) - .doOnNext(buf -> messageDigest.update(buf.array())); - - return FluxUtil.bytebufStreamToFile(fileContent, file).then(Mono.fromRunnable(() -> { - try { - file.close(); - Files.write(tempFolderPath.resolve("100m-" + i + "-md5.dat"), messageDigest.digest()); - LoggerFactory.getLogger(RestProxyStressTests.class).info("Finished writing file " + i); - } catch (Exception e) { - throw Exceptions.propagate(e); - } - })); - } catch (Exception e) { - return Flux.error(e); - } - }).blockLast(); - } +// final Flux contentGenerator = Flux.generate(Random::new, (random, emitter) -> { +// byte[] ba = new byte[CHUNK_SIZE]; +// random.nextBytes(ba); +// emitter.next(ByteBuffer.wrap(ba)); +// return random; +// }); +// +// if (recreate) { +// deleteRecursive(tempFolderPath); +// } +// +// if (Files.exists(tempFolderPath)) { +// LoggerFactory.getLogger(RestProxyStressTests.class).info("Temp files directory already exists: " + tempFolderPath.toAbsolutePath()); +// } else { +// LoggerFactory.getLogger(RestProxyStressTests.class).info("Generating temp files in directory: " + tempFolderPath.toAbsolutePath()); +// Files.createDirectory(tempFolderPath); +// Flux.range(0, NUM_FILES).flatMap(integer -> { +// try { +// final int i = integer; +// final Path filePath = tempFolderPath.resolve("100m-" + i + ".dat"); +// +// Files.deleteIfExists(filePath); +// Files.createFile(filePath); +// final AsynchronousFileChannel file = AsynchronousFileChannel.open(filePath, StandardOpenOption.READ, StandardOpenOption.WRITE); +// final MessageDigest messageDigest = MessageDigest.getInstance("MD5"); +// +// Flux fileContent = contentGenerator +// .take(CHUNKS_PER_FILE) +// .doOnNext(buf -> messageDigest.update(buf.array())); +// +// return FluxUtil.bytebufStreamToFile(fileContent, file).then(Mono.fromRunnable(() -> { +// try { +// file.close(); +// Files.write(tempFolderPath.resolve("100m-" + i + "-md5.dat"), messageDigest.digest()); +// LoggerFactory.getLogger(RestProxyStressTests.class).info("Finished writing file " + i); +// } catch (Exception e) { +// throw Exceptions.propagate(e); +// } +// })); +// } catch (Exception e) { +// return Flux.error(e); +// } +// }).blockLast(); +// } + + // TODO + fail("This method is not yet re-implemented"); } @Test @@ -272,90 +265,92 @@ public void prepare100MFiles() throws Exception { @Test public void upload100MParallelTest() { - final String sas = System.getenv("JAVA_SDK_TEST_SAS") == null ? "" : System.getenv("JAVA_SDK_TEST_SAS"); - - Flux md5s = Flux.range(0, NUM_FILES) - .map(integer -> { - final Path filePath = tempFolderPath.resolve("100m-" + integer + "-md5.dat"); - try { - return Files.readAllBytes(filePath); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } - }); - // - Instant uploadStart = Instant.now(); - // - Flux.range(0, NUM_FILES) - .zipWith(md5s, (id, md5) -> { - AsynchronousFileChannel fileStream = null; - try { - fileStream = AsynchronousFileChannel.open(tempFolderPath.resolve("100m-" + id + ".dat")); - } catch (IOException ioe) { - Exceptions.propagate(ioe); - } - return service.upload100MB(String.valueOf(id), sas, "BlockBlob", FluxUtil.byteBufStreamFromFile(fileStream), FILE_SIZE).map(response -> { - String base64MD5 = response.headers().value("Content-MD5"); - byte[] receivedMD5 = Base64.getDecoder().decode(base64MD5); - Assert.assertArrayEquals(md5, receivedMD5); - return response; - }); - }) - .flatMapDelayError(m -> m, 15, 1) - .blockLast(); - // - long durationMilliseconds = Duration.between(uploadStart, Instant.now()).toMillis(); - LoggerFactory.getLogger(getClass()).info("Upload took " + durationMilliseconds + " milliseconds."); +// final String sas = System.getenv("JAVA_SDK_TEST_SAS") == null ? "" : System.getenv("JAVA_SDK_TEST_SAS"); +// +// Flux md5s = Flux.range(0, NUM_FILES) +// .map(integer -> { +// final Path filePath = tempFolderPath.resolve("100m-" + integer + "-md5.dat"); +// try { +// return Files.readAllBytes(filePath); +// } catch (IOException ioe) { +// throw Exceptions.propagate(ioe); +// } +// }); +// // +// Instant uploadStart = Instant.now(); +// // +// Flux.range(0, NUM_FILES) +// .zipWith(md5s, (id, md5) -> { +// AsynchronousFileChannel fileStream = null; +// try { +// fileStream = AsynchronousFileChannel.open(tempFolderPath.resolve("100m-" + id + ".dat")); +// } catch (IOException ioe) { +// Exceptions.propagate(ioe); +// } +// return service.upload100MB(String.valueOf(id), sas, "BlockBlob", FluxUtil.byteBufStreamFromFile(fileStream), FILE_SIZE).map(response -> { +// String base64MD5 = response.headers().value("Content-MD5"); +// byte[] receivedMD5 = Base64.getDecoder().decode(base64MD5); +// Assert.assertArrayEquals(md5, receivedMD5); +// return response; +// }); +// }) +// .flatMapDelayError(m -> m, 15, 1) +// .blockLast(); +// // +// long durationMilliseconds = Duration.between(uploadStart, Instant.now()).toMillis(); +// LoggerFactory.getLogger(getClass()).info("Upload took " + durationMilliseconds + " milliseconds."); + Assert.fail("Need to implement this test again"); } @Test public void uploadMemoryMappedTest() { - final String sas = System.getenv("JAVA_SDK_TEST_SAS") == null ? "" : System.getenv("JAVA_SDK_TEST_SAS"); - - Flux md5s = Flux.range(0, NUM_FILES) - .map(integer -> { - final Path filePath = tempFolderPath.resolve("100m-" + integer + "-md5.dat"); - try { - return Files.readAllBytes(filePath); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } - }); - - Instant uploadStart = Instant.now(); - // - Flux.range(0, NUM_FILES) - .zipWith(md5s, (id, md5) -> { - FileChannel fileStream = null; - try { - fileStream = FileChannel.open(tempFolderPath.resolve("100m-" + id + ".dat"), StandardOpenOption.READ); - } catch (IOException ioe) { - Exceptions.propagate(ioe); - } - // - ByteBuf mappedByteBufFile = null; - Flux stream = null; - try { - MappedByteBuffer mappedByteBufferFile = fileStream.map(FileChannel.MapMode.READ_ONLY, 0, fileStream.size()); - mappedByteBufFile = Unpooled.wrappedBuffer(mappedByteBufferFile); - stream = FluxUtil.split(mappedByteBufFile, CHUNK_SIZE); - } catch (IOException ioe) { - mappedByteBufFile.release(); - Exceptions.propagate(ioe); - } - // - return service.upload100MB(String.valueOf(id), sas, "BlockBlob", stream, FILE_SIZE).map(response -> { - String base64MD5 = response.headers().value("Content-MD5"); - byte[] receivedMD5 = Base64.getDecoder().decode(base64MD5); - Assert.assertArrayEquals(md5, receivedMD5); - return response; - }); - }) - .flatMapDelayError(m -> m, 15, 1) - .blockLast(); - // - long durationMilliseconds = Duration.between(uploadStart, Instant.now()).toMillis(); - LoggerFactory.getLogger(getClass()).info("Upload took " + durationMilliseconds + " milliseconds."); +// final String sas = System.getenv("JAVA_SDK_TEST_SAS") == null ? "" : System.getenv("JAVA_SDK_TEST_SAS"); +// +// Flux md5s = Flux.range(0, NUM_FILES) +// .map(integer -> { +// final Path filePath = tempFolderPath.resolve("100m-" + integer + "-md5.dat"); +// try { +// return Files.readAllBytes(filePath); +// } catch (IOException ioe) { +// throw Exceptions.propagate(ioe); +// } +// }); +// +// Instant uploadStart = Instant.now(); +// // +// Flux.range(0, NUM_FILES) +// .zipWith(md5s, (id, md5) -> { +// FileChannel fileStream = null; +// try { +// fileStream = FileChannel.open(tempFolderPath.resolve("100m-" + id + ".dat"), StandardOpenOption.READ); +// } catch (IOException ioe) { +// Exceptions.propagate(ioe); +// } +// // +// ByteBuffer mappedByteBufFile = null; +// Flux stream = null; +// try { +// MappedByteBuffer mappedByteBufferFile = fileStream.map(FileChannel.MapMode.READ_ONLY, 0, fileStream.size()); +// mappedByteBufFile = Unpooled.wrappedBuffer(mappedByteBufferFile); +// stream = FluxUtil.split(mappedByteBufFile, CHUNK_SIZE); +// } catch (IOException ioe) { +// mappedByteBufFile.release(); +// Exceptions.propagate(ioe); +// } +// // +// return service.upload100MB(String.valueOf(id), sas, "BlockBlob", stream, FILE_SIZE).map(response -> { +// String base64MD5 = response.headers().value("Content-MD5"); +// byte[] receivedMD5 = Base64.getDecoder().decode(base64MD5); +// Assert.assertArrayEquals(md5, receivedMD5); +// return response; +// }); +// }) +// .flatMapDelayError(m -> m, 15, 1) +// .blockLast(); +// // +// long durationMilliseconds = Duration.between(uploadStart, Instant.now()).toMillis(); +// LoggerFactory.getLogger(getClass()).info("Upload took " + durationMilliseconds + " milliseconds."); + Assert.fail("Need to implement this test again"); } @@ -381,11 +376,11 @@ public void download100MParallelTest() { Flux.range(0, NUM_FILES) .zipWith(md5s, (id, md5) -> { return service.download100M(String.valueOf(id), sas).flatMap(response -> { - Flux content; + Flux content; try { MessageDigest messageDigest = MessageDigest.getInstance("MD5"); content = response.value() - .doOnNext(buf -> messageDigest.update(buf.slice().nioBuffer())); + .doOnNext(buf -> messageDigest.update(buf.slice())); return content.last().doOnSuccess(b -> { assertArrayEquals(md5, messageDigest.digest()); @@ -424,7 +419,7 @@ public void downloadUploadStreamingTest() { Flux.range(0, NUM_FILES) .zipWith(md5s, (integer, md5) -> { final int id = integer; - Flux downloadContent = service.download100M(String.valueOf(id), sas) + Flux downloadContent = service.download100M(String.valueOf(id), sas) // Ideally we would intercept this content to load an MD5 to check consistency between download and upload directly, // but it's sufficient to demonstrate that no corruption occurred between preparation->upload->download->upload. .flatMapMany(StreamResponse::value) @@ -453,7 +448,9 @@ public void downloadUploadStreamingTest() { // // Solution is to aware of ByteBufFlux auto-release property and retain each chunk before passing to Netty.write(). // - return reactorNettybb.retain(); +// return reactorNettybb.retain(); + // TODO + throw new IllegalStateException("This method is not yet re-implemented"); }); // return service.upload100MB("copy-" + integer, sas, "BlockBlob", downloadContent, FILE_SIZE) diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java index 36137bf7e205..c0c59cab5d68 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java @@ -40,14 +40,13 @@ import com.azure.core.implementation.serializer.SerializerAdapter; import com.azure.core.implementation.serializer.jackson.JacksonAdapter; import com.azure.core.implementation.util.FluxUtil; -import io.netty.buffer.ByteBuf; -import io.netty.util.ReferenceCountUtil; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; import java.nio.file.Files; import java.nio.file.Path; @@ -1483,17 +1482,16 @@ interface DownloadService { StreamResponse getBytes(); @Get("/bytes/30720") - Flux getBytesFlowable(); + Flux getBytesFlowable(); } @Test public void simpleDownloadTest() { try (StreamResponse response = createService(DownloadService.class).getBytes()) { int count = 0; - for (ByteBuf byteBuf : response.value().doOnNext(b -> b.retain()).toIterable()) { + for (ByteBuffer byteBuf : response.value().toIterable()) { // assertEquals(1, byteBuf.refCnt()); - count += byteBuf.readableBytes(); - ReferenceCountUtil.refCnt(byteBuf); + count += byteBuf.remaining(); } assertEquals(30720, count); } @@ -1501,11 +1499,10 @@ public void simpleDownloadTest() { @Test public void rawFlowableDownloadTest() { - Flux response = createService(DownloadService.class).getBytesFlowable(); + Flux response = createService(DownloadService.class).getBytesFlowable(); int count = 0; - for (ByteBuf byteBuf : response.doOnNext(b -> b.retain()).toIterable()) { - count += byteBuf.readableBytes(); - ReferenceCountUtil.refCnt(byteBuf); + for (ByteBuffer byteBuf : response.toIterable()) { + count += byteBuf.remaining(); } assertEquals(30720, count); } @@ -1514,13 +1511,13 @@ public void rawFlowableDownloadTest() { @ServiceInterface(name = "FlowableUploadService") interface FlowableUploadService { @Put("/put") - Response put(@BodyParam("text/plain") Flux content, @HeaderParam("Content-Length") long contentLength); + Response put(@BodyParam("text/plain") Flux content, @HeaderParam("Content-Length") long contentLength); } @Test - public void flowableUploadTest() throws Exception { + public void fluxUploadTest() throws Exception { Path filePath = Paths.get(getClass().getClassLoader().getResource("upload.txt").toURI()); - Flux stream = FluxUtil.byteBufStreamFromFile(AsynchronousFileChannel.open(filePath)); + Flux stream = FluxUtil.readFile(AsynchronousFileChannel.open(filePath)); final HttpClient httpClient = createHttpClient(); // Scenario: Log the body so that body buffering/replay behavior is exercised. @@ -1542,7 +1539,7 @@ public void segmentUploadTest() throws Exception { Path filePath = Paths.get(getClass().getClassLoader().getResource("upload.txt").toURI()); AsynchronousFileChannel fileChannel = AsynchronousFileChannel.open(filePath, StandardOpenOption.READ); Response response = createService(FlowableUploadService.class) - .put(FluxUtil.byteBufStreamFromFile(fileChannel, 4, 15), 15); + .put(FluxUtil.readFile(fileChannel, 4, 15), 15); assertEquals("quick brown fox", response.value().data()); } @@ -1550,7 +1547,7 @@ public void segmentUploadTest() throws Exception { @Host("{url}") @ServiceInterface(name = "Service22") interface Service22 { - @Get("{container}/{blob}") + @Get("/") byte[] getBytes(@HostParam("url") String url); } @@ -1640,7 +1637,7 @@ interface Service26 { @Test public void postUrlFormEncoded() { - Service26 service = RestProxy.create(Service26.class, new HttpPipelineBuilder().build()); + Service26 service = createService(Service26.class); HttpBinFormDataJSON response = service.postForm("Foo", "123", "foo@bar.com", PizzaSize.LARGE, Arrays.asList("Bacon", "Onion")); assertNotNull(response); assertNotNull(response.form()); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java index 32ae6b6789fb..86b758508b2d 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java @@ -3,6 +3,7 @@ package com.azure.core.implementation; +import com.azure.core.http.clients.NoOpHttpClient; import com.azure.core.implementation.annotation.BodyParam; import com.azure.core.implementation.annotation.ExpectedResponses; import com.azure.core.implementation.annotation.Get; @@ -18,7 +19,7 @@ import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import com.azure.core.http.MockHttpClient; +import com.azure.core.http.clients.MockHttpClient; import com.azure.core.http.MockHttpResponse; import com.azure.core.http.ProxyOptions; import com.azure.core.http.rest.Page; @@ -328,7 +329,7 @@ interface ServiceHeaderCollections { ResponseBase packagePrivateFields(); } - private static final HttpClient HEADER_COLLECTION_HTTP_CLIENT = new MockHttpClient() { + private static final HttpClient HEADER_COLLECTION_HTTP_CLIENT = new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { final HttpHeaders headers = new HttpHeaders().put("name", "Phillip") @@ -336,7 +337,7 @@ public Mono send(HttpRequest request) { .put("header-collection-prefix-two", "2") .put("header-collection-prefix-three", "3"); final MockHttpResponse response = new MockHttpResponse(request, 200, headers); - return Mono.just(response); + return Mono.just(response); } }; diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java index b533a6ff9103..aeaff7c8fcaf 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java @@ -116,7 +116,7 @@ static class MockXMLReceiverClient implements HttpClient { @Override public Mono send(HttpRequest request) { if (request.url().toString().endsWith("SetContainerACLs")) { - return FluxUtil.collectBytesInByteBufStream(request.body(), false) + return FluxUtil.collectBytesInByteBufferStream(request.body()) .map(bytes -> { receivedBytes = bytes; return new MockHttpResponse(request, 200); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/UrlBuilderTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/UrlBuilderTests.java index 13b950c80c2a..dc2000d4a03f 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/UrlBuilderTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/UrlBuilderTests.java @@ -463,6 +463,46 @@ public void pathWhenBuilderPathIsForwardSlashAndPath() { assertEquals("test/path.html", builder.path()); } + @Test + public void pathWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .host("www.example.com/site") + .path("index.html"); + assertEquals("www.example.com", builder.host()); + assertEquals("index.html", builder.path()); + assertEquals("www.example.com/index.html", builder.toString()); + } + + @Test + public void pathFirstWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .path("index.html") + .host("www.example.com/site"); + assertEquals("www.example.com", builder.host()); + assertEquals("/site", builder.path()); + assertEquals("www.example.com/site", builder.toString()); + } + + @Test + public void emptyPathWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .path("") + .host("www.example.com/site"); + assertEquals("www.example.com", builder.host()); + assertEquals("/site", builder.path()); + assertEquals("www.example.com/site", builder.toString()); + } + + @Test + public void slashPathWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .path("//") + .host("www.example.com/site"); + assertEquals("www.example.com", builder.host()); + assertEquals("/site", builder.path()); + assertEquals("www.example.com/site", builder.toString()); + } + @Test public void withAbsolutePath() { final UrlBuilder builder = new UrlBuilder() diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/util/FluxUtilTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/util/FluxUtilTests.java deleted file mode 100644 index 3ebeb7544b14..000000000000 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/util/FluxUtilTests.java +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.implementation.util; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpMethod; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.implementation.http.PagedResponseBase; -import com.azure.core.util.Context; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.util.ReferenceCountUtil; -import java.io.BufferedOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.channels.AsynchronousFileChannel; -import java.nio.charset.StandardCharsets; -import java.nio.file.StandardOpenOption; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import reactor.core.Exceptions; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; - -public class FluxUtilTests { - - @Test - public void testCanReadSlice() throws IOException { - File file = createFileIfNotExist("target/test1"); - FileOutputStream stream = new FileOutputStream(file); - stream.write("hello there".getBytes(StandardCharsets.UTF_8)); - stream.close(); - - try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { - byte[] bytes = FluxUtil.byteBufStreamFromFile(channel, 1, 3) - .map(bb -> { - byte[] bt = toBytes(bb); - ReferenceCountUtil.release(bb); - return bt; - }) - .collect(() -> new ByteArrayOutputStream(), - (bos, b) -> { - try { - bos.write(b); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } - }) - .block() - .toByteArray(); - assertEquals("ell", new String(bytes, StandardCharsets.UTF_8)); - } catch (IOException ioe) { - - } - - } - - @Test - public void testCanReadEmptyFile() throws IOException { - File file = createFileIfNotExist("target/test2"); - - try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { - byte[] bytes = FluxUtil.byteBufStreamFromFile(channel, 1, 3) - .map(bb -> { - byte[] bt = toBytes(bb); - ReferenceCountUtil.release(bb); - return bt; - }) - .collect(() -> new ByteArrayOutputStream(), - (bos, b) -> { - try { - bos.write(b); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } - }) - .block().toByteArray(); - assertEquals(0, bytes.length); - } - assertTrue(file.delete()); - } - - @Test - public void testAsynchronyShortInput() throws IOException { - File file = createFileIfNotExist("target/test3"); - FileOutputStream stream = new FileOutputStream(file); - stream.write("hello there".getBytes(StandardCharsets.UTF_8)); - stream.close(); - try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { - byte[] bytes = FluxUtil.byteBufStreamFromFile(channel) - .map(bb -> { - byte[] bt = toBytes(bb); - ReferenceCountUtil.release(bb); - return bt; - }) - .limitRequest(1) - .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .collect(() -> new ByteArrayOutputStream(), - (bos, b) -> { - try { - bos.write(b); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } - }) - .block() - .toByteArray(); - assertEquals("hello there", new String(bytes, StandardCharsets.UTF_8)); - } - assertTrue(file.delete()); - } - - private static final int NUM_CHUNKS_IN_LONG_INPUT = 10_000_000; - - @Test - public void testAsynchronyLongInput() throws IOException, NoSuchAlgorithmException { - File file = createFileIfNotExist("target/test4"); - byte[] array = "1234567690".getBytes(StandardCharsets.UTF_8); - MessageDigest digest = MessageDigest.getInstance("MD5"); - try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { - for (int i = 0; i < NUM_CHUNKS_IN_LONG_INPUT; i++) { - out.write(array); - digest.update(array); - } - } - System.out.println("long input file size=" + file.length() / (1024 * 1024) + "MB"); - byte[] expected = digest.digest(); - digest.reset(); - try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { - FluxUtil.byteBufStreamFromFile(channel) - .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .toIterable().forEach(bb -> { - digest.update(bb.nioBuffer()); - ReferenceCountUtil.release(bb); - }); - - assertArrayEquals(expected, digest.digest()); - } - assertTrue(file.delete()); - } - - @Test - @Ignore("Need to sync with smaldini to find equivalent for rx.test.awaitDone") - public void testBackpressureLongInput() throws IOException, NoSuchAlgorithmException { -// File file = new File("target/test4"); -// byte[] array = "1234567690".getBytes(StandardCharsets.UTF_8); -// MessageDigest digest = MessageDigest.getInstance("MD5"); -// try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { -// for (int i = 0; i < NUM_CHUNKS_IN_LONG_INPUT; i++) { -// out.write(array); -// digest.update(array); -// } -// } -// byte[] expected = digest.digest(); -// digest.reset(); -// -// try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { -// FluxUtil1.byteBufferStreamFromFile(channel) -// .rebatchRequests(1) -// .subscribeOn(Schedulers.io()) -// .observeOn(Schedulers.io()) -// .doOnNext(bb -> digest.update(bb)) -// .test(0) -// .assertNoValues() -// .requestMore(1) -// .awaitCount(1) -// .assertValueCount(1) -// .requestMore(1) -// .awaitCount(2) -// .assertValueCount(2) -// .requestMore(Long.MAX_VALUE) -// .awaitDone(20, TimeUnit.SECONDS) -// .assertComplete(); -// } -// -// assertArrayEquals(expected, digest.digest()); -// assertTrue(file.delete()); - } - - @Test - public void testSplitForMultipleSplitSizesFromOneTo16() throws NoSuchAlgorithmException { - ByteBuf bb = null; - try { - bb = Unpooled.directBuffer(1000); - byte[] oneByte = new byte[1]; - for (int i = 0; i < 1000; i++) { - oneByte[0] = (byte) i; - bb.writeBytes(oneByte); - } - MessageDigest digest = MessageDigest.getInstance("MD5"); - digest.update(bb.nioBuffer()); - byte[] expected = digest.digest(); - for (int size = 1; size < 16; size++) { - System.out.println("size=" + size); - digest.reset(); - bb.readerIndex(0); - // - FluxUtil.split(bb, 3).doOnNext(b -> digest.update(b.nioBuffer())) - .subscribe(); -// -// StepVerifier.create(FluxUtil1.split(bb, 3).doOnNext(b -> digest.update(b))) -// .expectNextCount(?) // TODO: ? is Unknown. Check with smaldini - what is the Verifier way to ignore all next calls and simply check stream completes? -// .verifyComplete(); -// - assertArrayEquals(expected, digest.digest()); - } - } finally { - if (bb != null) { - bb.release(); - } - } - } - - @Test - public void testSplitOnEmptyContent() { - ByteBuf bb = null; - try { - bb = Unpooled.directBuffer(16); - StepVerifier.create(FluxUtil.split(bb, 3)) - .expectNextCount(0) - .expectComplete() - .verify(); - } finally { - if (bb != null) { - bb.release(); - } - } - } - - @Test - public void toByteArrayWithEmptyByteBuffer() { - assertArrayEquals(new byte[0], FluxUtil.byteBufToArray(Unpooled.wrappedBuffer(new byte[0]))); - } - - @Test - public void toByteArrayWithNonEmptyByteBuffer() { - final ByteBuf byteBuffer = Unpooled.wrappedBuffer(new byte[] { 0, 1, 2, 3, 4 }); - assertEquals(5, byteBuffer.readableBytes()); - final byte[] byteArray = FluxUtil.byteBufToArray(byteBuffer); - assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, byteArray); - assertEquals(5, byteBuffer.readableBytes()); - } - - @Test - public void testCollectByteBufStream() { - Flux byteBufFlux = Flux - .just(Unpooled.copyInt(1), Unpooled.copyInt(255), Unpooled.copyInt(256)); - Mono result = FluxUtil.collectByteBufStream(byteBufFlux, false); - byte[] bytes = ByteBufUtil.getBytes(result.block()); - assertEquals(12, bytes.length); - assertArrayEquals(new byte[]{ - 0, 0, 0, 1, - 0, 0, 0, (byte) 255, - 0, 0, 1, 0}, bytes); - } - - @Test - public void testToMono() { - String value = "test"; - Assert.assertEquals(getMonoRestResponse(value).flatMap(FluxUtil::toMono).block(), value); - Assert.assertEquals(getMonoRestResponse("").flatMap(FluxUtil::toMono).block(), ""); - } - - @Test - public void testCallWithContextGetSingle() { - String response = getSingle("Hello, ") - .subscriberContext(reactor.util.context.Context.of("FirstName", "Foo", "LastName", "Bar")) - .block(); - Assert.assertEquals("Hello, Foo Bar", response); - } - - @Test - public void testCallWithContextGetCollection() { - List expectedLines = Arrays.asList("Hello,", "Foo", "Bar"); - List actualLines = new ArrayList<>(); - getCollection("Hello, ") - .subscriberContext(reactor.util.context.Context.of("FirstName", "Foo", "LastName", "Bar")) - .doOnNext(line -> actualLines.add(line)) - .subscribe(); - Assert.assertEquals(expectedLines, actualLines); - } - - @Test - public void testCallWithContextGetPagedCollection() throws Exception { - // Simulates the customer code that includes context - getPagedCollection() - .subscriberContext( - reactor.util.context.Context.of("Key1", "Val1", "Key2", "Val2")) - .doOnNext(System.out::println) - .subscribe(); - } - - private PagedFlux getPagedCollection() - throws Exception { - // Simulates the client library API - List> pagedResponses = getPagedResponses(4); - return new PagedFlux<>( - () -> FluxUtil.withContext(context -> getFirstPage(pagedResponses, context)), - continuationToken -> FluxUtil - .withContext(context -> getNextPage(continuationToken, pagedResponses, context))); - } - - private List> getPagedResponses(int noOfPages) - throws MalformedURLException { - HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") - .put("header2", "value2"); - HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); - String deserializedHeaders = "header1,value1,header2,value2"; - return IntStream.range(0, noOfPages) - .boxed() - .map(i -> createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, i, noOfPages)) - .collect(Collectors.toList()); - } - - private Mono> getFirstPage(List> pagedResponses, - Context context) { - // Simulates the service side code which should get the context provided by customer code - Assert.assertEquals("Val1", context.getData("Key1").get()); - return pagedResponses.isEmpty() ? Mono.empty() : Mono.just(pagedResponses.get(0)); - } - - private Mono> getNextPage(String continuationToken, - List> pagedResponses, Context context) { - // Simulates the service side code which should get the context provided by customer code - Assert.assertEquals("Val2", context.getData("Key2").get()); - if (continuationToken == null || continuationToken.isEmpty()) { - return Mono.empty(); - } - return Mono.just(pagedResponses.get(Integer.valueOf(continuationToken))); - } - - private PagedResponseBase createPagedResponse(HttpRequest httpRequest, - HttpHeaders httpHeaders, String deserializedHeaders, int i, int noOfPages) { - return new PagedResponseBase<>(httpRequest, HttpResponseStatus.OK.code(), - httpHeaders, - getItems(i), - i < noOfPages - 1 ? String.valueOf(i + 1) : null, - deserializedHeaders); - } - - private List getItems(Integer i) { - return IntStream.range(i * 3, i * 3 + 3).boxed().collect(Collectors.toList()); - } - - - private Mono getSingle(String prefix) { - return FluxUtil.withContext(context -> serviceCallSingle(prefix, context)); - } - - private Flux getCollection(String prefix) { - return FluxUtil - .fluxContext(context -> serviceCallCollection(prefix, context)); - } - - private Mono serviceCallSingle(String prefix, Context context) { - String msg = prefix - + context.getData("FirstName").orElse("Stranger") - + " " - + context.getData("LastName").orElse(""); - return Mono.just(msg); - } - - private Flux serviceCallCollection(String prefix, Context context) { - String msg = prefix - + context.getData("FirstName").orElse("Stranger") - + " " - + context.getData("LastName").orElse(""); - - return Flux.just(msg.split(" ")); - } -// - private static byte[] toBytes(ByteBuf bb) { - byte[] bytes = new byte[bb.readableBytes()]; - bb.readBytes(bytes); - return bytes; - } - - private File createFileIfNotExist(String fileName) throws IOException { - File file = new File(fileName); - if (file.getParentFile() != null) { - file.getParentFile().mkdirs(); - } - file.createNewFile(); - return file; - } - - private Mono> getMonoRestResponse(T value) { - Response response = new Response() { - @Override - public int statusCode() { - return 200; - } - - @Override - public HttpHeaders headers() { - return null; - } - - @Override - public HttpRequest request() { - return null; - } - - @Override - public T value() { - return value; - } - }; - return Mono.just(response); - } - -} diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index 1f44374c8d28..a299d26560f1 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -6,7 +6,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - + trigger: branches: include: @@ -36,9 +36,13 @@ stages: Artifacts: - name: azure-core safeName: azurecore + stagingProfileId: 88192f04117501 - name: azure-core-amqp safeName: azurecoreamqp + stagingProfileId: 88192f04117501 - name: azure-core-management safeName: azurecoremanagement + stagingProfileId: 88192f04117501 - name: azure-core-test - safeName: azurecoretest \ No newline at end of file + safeName: azurecoretest + stagingProfileId: 88192f04117501 diff --git a/sdk/core/pom.service.xml b/sdk/core/pom.service.xml index 10c012fa679b..979a55875925 100644 --- a/sdk/core/pom.service.xml +++ b/sdk/core/pom.service.xml @@ -11,6 +11,7 @@ azure-core azure-core-amqp + azure-core-http-netty azure-core-management azure-core-test diff --git a/sdk/cosmos/README.md b/sdk/cosmos/README.md index f7854c9ae68e..db27f10b1c75 100644 --- a/sdk/cosmos/README.md +++ b/sdk/cosmos/README.md @@ -1,4 +1,4 @@ -# Java SDK for SQL API of Azure Cosmos DB +# Java SDK for SQL API of Azure Cosmos DB [![Maven Central](https://img.shields.io/maven-central/v/com.microsoft.azure/azure-cosmos.svg)](https://search.maven.org/artifact/com.microsoft.azure/azure-cosmos) [![Known Vulnerabilities](https://snyk.io/test/github/Azure/azure-cosmosdb-java/badge.svg?targetFile=sdk%2Fpom.xml)](https://snyk.io/test/github/Azure/azure-cosmosdb-java?targetFile=sdk%2Fpom.xml) @@ -248,3 +248,5 @@ If you encounter any bugs with the SDK please file an [issue](https://github.com [MIT License](LICENSE) Copyright (c) 2018 Copyright (c) Microsoft Corporation + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/cosmos/README.png) diff --git a/sdk/cosmos/ci.yml b/sdk/cosmos/ci.yml index 3b1fbf6fa17e..3d5b6a219100 100644 --- a/sdk/cosmos/ci.yml +++ b/sdk/cosmos/ci.yml @@ -1,122 +1,39 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - - master + - master + - feature/* + - hotfix/* + - release/* paths: include: - - sdk/cosmos/ + - sdk/cosmos/ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/cosmos/ -variables: - EmulatorMsiUrl: 'https://acpedaily1.blob.core.windows.net/emulator/azure-cosmos-emulator.msi' - -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/cosmos-sdk-client.yml #NOTE: Non-standard template. parameters: ServiceDirectory: cosmos - TestGoals: test - TestMatrix: - Windows - java8: - OSVmImage: 'vs2017-win2016' - JavaVersion: '1.8' - OSName: Windows - ProfileFlag: '-Punit' - MacOS - java8: - OSVmImage: 'macOS-10.13' - JavaVersion: '1.8' - OSName: macOS - ProfileFlag: '-Punit' - PreTestSteps: - - template: ../steps/install-reporting-tools.yml - - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml - parameters: - TestName: Emulator - ServiceDirectory: cosmos - Matrix: - Tcp_Integration_Tests_Java8: - OSVmImage: 'vs2017-win2016' - JavaVersion: '1.8' - ProfileFlag: '-Pemulator' - DisplayName: 'Emulator only Integration Tests' - PROTOCOLS: '["Tcp"]' - DESIRED_CONSISTENCIES: '["Strong", "Session"]' - Https_Integration_Tests_Java8: - OSVmImage: 'vs2017-win2016' - JavaVersion: '1.8' - ProfileFlag: '-Pemulator' - DisplayName: 'Emulator only Integration Tests' - PROTOCOLS: '["Https"]' - DESIRED_CONSISTENCIES: '["Strong", "Session"]' - Examples_Integration_Tests_Java8: - OSVmImage: 'vs2017-win2016' - JavaVersion: '1.8' - ProfileFlag: '-Pexamples' - DisplayName: 'Examples Integration Tests' - PROTOCOLS: '["Https", "Tcp"]' - DESIRED_CONSISTENCIES: '["Strong", "Session"]' - - TestStepMavenInputs: - goals: 'verify' - options: '$(ProfileFlag) -Dgpg.skip -DargLine="-DACCOUNT_HOST=https://localhost:8081/"' - mavenAuthenticateFeed: true - jdkVersionOption: $(JavaVersion) - - PreRunSteps: - - powershell: | - Write-Host "Downloading Cosmos Emulator - $(EmulatorMsiUrl)" - wget "$(EmulatorMsiUrl)" -outfile "$env:temp\azure-cosmosdb-emulator.msi" - Write-Host "Finished Downloading Cosmos Emulator - $env:temp\azure-cosmosdb-emulator.msi" - dir "$env:temp" - displayName: 'Download Public Cosmos DB Emulator' - - - script: | - choco install lessmsi - choco upgrade lessmsi - mkdir "%TEMP%\Azure Cosmos DB Emulator" - lessmsi x "%TEMP%\azure-cosmosdb-emulator.msi" "%TEMP%\Azure Cosmos DB Emulator\" - displayName: 'Install Public Cosmos DB Emulator' - - - powershell: | - Write-Host "Starting Comsos DB Emulator" - Start-Process "$env:Temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" "/NoExplorer /NoUI /DisableRateLimiting /PartitionCount=100 /Consistency=Strong" -Verb RunAs - displayName: 'Run Public Cosmos DB Emulator' - - - powershell: | - Import-Module "$env:Temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator" - - Do { - sleep 5 - $cosmosStatus = Get-CosmosDbEmulatorStatus - Write-Host "Cosmos Status: $cosmosStatus" - } While ($cosmosStatus -ne 'Running') - - Write-Host "Done" - displayName: 'Check Public Cosmos DB Emulator Status' - - - powershell: | - $Key = 'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==' - $password = ConvertTo-SecureString -String $Key -Force -AsPlainText - $cert = Get-ChildItem cert:\LocalMachine\My | Where-Object { $_.FriendlyName -eq "DocumentDbEmulatorCertificate" } - Export-PfxCertificate -Cert $cert -FilePath ".\CosmosDbEmulatorCert.pfx" -Password $password | Out-Null - $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 - $cert.Import(".\CosmosDbEmulatorCert.pfx", $Key, "DefaultKeySet") - $cert | Export-Certificate -FilePath "$env:temp\CosmosDbEmulatorCert.cer" -Type CERT - displayName: 'Export Cosmos DB Emulator Certificate' - - - powershell: | - cd $env:java_home\jre\lib\security - cp $env:temp\CosmosDbEmulatorCert.cer . - keytool -keystore cacerts -importcert -noprompt -trustcacerts -alias CosmosDbEmulatorCert -file CosmosDbEmulatorCert.cer -storepass changeit - displayName: 'Create Java TrustStore' - - # We `install` separately from running `site:site site:stage` so that the `install` brings in the non-shipping-modules, - # but we don't include them in the Maven site commands (so that we don't generate reports for the non-shipping modules). - - template: ../steps/install-reporting-tools.yml + Artifacts: + - name: azure-cosmos + safeName: azurecosmos + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml b/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml index 69d8a67066ab..aca30d8f51f7 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml @@ -43,28 +43,46 @@ Licensed under the MIT License. com.google.guava guava + ${guava.version} io.dropwizard.metrics metrics-core + ${metrics.version} io.dropwizard.metrics metrics-jvm + ${metrics.version} io.dropwizard.metrics metrics-graphite + ${metrics.version} + + io.micrometer + micrometer-registry-azure-monitor + ${micrometer.version} + + + + io.micrometer + micrometer-registry-graphite + ${micrometer.version} + + + log4j diff --git a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/AsyncBenchmark.java b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/AsyncBenchmark.java index 6aae3eb043ee..cc654b35fb7b 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/AsyncBenchmark.java +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/AsyncBenchmark.java @@ -21,6 +21,7 @@ import com.codahale.metrics.jvm.CachedThreadStatesGaugeSet; import com.codahale.metrics.jvm.GarbageCollectorMetricSet; import com.codahale.metrics.jvm.MemoryUsageGaugeSet; +import io.micrometer.core.instrument.MeterRegistry; import org.apache.commons.lang3.RandomStringUtils; import org.reactivestreams.Subscription; import org.slf4j.Logger; @@ -114,6 +115,18 @@ abstract class AsyncBenchmark { reporter = ConsoleReporter.forRegistry(metricsRegistry).convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS).build(); } + + MeterRegistry registry = configuration.getAzureMonitorMeterRegistry(); + + if (registry != null) { + BridgeInternal.monitorTelemetry(registry); + } + + registry = configuration.getGraphiteMeterRegistry(); + + if (registry != null) { + BridgeInternal.monitorTelemetry(registry); + } } protected void init() { diff --git a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/Configuration.java b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/Configuration.java index da084832dedc..1ab63af0d5cf 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/Configuration.java +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/Configuration.java @@ -11,15 +11,30 @@ import com.beust.jcommander.Parameter; import com.beust.jcommander.ParameterException; import com.google.common.base.Strings; +import com.google.common.net.HostAndPort; +import com.google.common.net.PercentEscaper; +import io.micrometer.azuremonitor.AzureMonitorConfig; +import io.micrometer.azuremonitor.AzureMonitorMeterRegistry; +import io.micrometer.core.instrument.Clock; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.config.NamingConvention; +import io.micrometer.core.lang.Nullable; +import io.micrometer.graphite.GraphiteConfig; +import io.micrometer.graphite.GraphiteMeterRegistry; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.time.Duration; import java.util.Arrays; class Configuration { - private final static int GRAPHITE_SERVER_DEFAULT_PORT = 2003; + + private final static int DEFAULT_GRAPHITE_SERVER_PORT = 2003; + private MeterRegistry azureMonitorMeterRegistry; + private MeterRegistry graphiteMeterRegistry; @Parameter(names = "-serviceEndpoint", description = "Service Endpoint") private String serviceEndpoint; @@ -246,6 +261,20 @@ public boolean isEnableJvmStats() { return enableJvmStats; } + public MeterRegistry getAzureMonitorMeterRegistry() { + String instrumentationKey = System.getProperty("azure.cosmos.monitoring.azureMonitor.instrumentationKey", + StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("AZURE_INSTRUMENTATION_KEY")), null)); + return instrumentationKey == null ? null : this.azureMonitorMeterRegistry(instrumentationKey); + } + + public MeterRegistry getGraphiteMeterRegistry() { + String serviceAddress = System.getProperty("azure.cosmos.monitoring.graphite.serviceAddress", + StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("GRAPHITE_SERVICE_ADDRESS")), null)); + return serviceAddress == null ? null : this.graphiteMeterRegistry(serviceAddress); + } + public String getGraphiteEndpoint() { if (graphiteEndpoint == null) { return null; @@ -261,7 +290,7 @@ public int getGraphiteEndpointPort() { String portAsString = Strings.emptyToNull(StringUtils.substringAfterLast(graphiteEndpoint, ":")); if (portAsString == null) { - return GRAPHITE_SERVER_DEFAULT_PORT; + return DEFAULT_GRAPHITE_SERVER_PORT; } else { return Integer.parseInt(portAsString); } @@ -306,4 +335,112 @@ void tryGetValuesFromSystem() { Strings.emptyToNull(System.getenv().get("NUMBER_OF_OPERATIONS")), Integer.toString(numberOfOperations)); numberOfOperations = Integer.parseInt(numberOfOperationsValue); } + + private synchronized MeterRegistry azureMonitorMeterRegistry(String instrumentationKey) { + + if (this.azureMonitorMeterRegistry == null) { + + Duration step = Duration.ofSeconds(Integer.getInteger("azure.cosmos.monitoring.azureMonitor.step", this.printingInterval)); + boolean enabled = !Boolean.getBoolean("azure.cosmos.monitoring.azureMonitor.disabled"); + + final AzureMonitorConfig config = new AzureMonitorConfig() { + + @Override + @Nullable + public String get(@Nullable String key) { + return null; + } + + @Override + @Nullable + public String instrumentationKey() { + return instrumentationKey; + } + + @Override + public Duration step() { + return step; + } + + @Override + public boolean enabled() { + return enabled; + } + }; + + this.azureMonitorMeterRegistry = new AzureMonitorMeterRegistry(config, Clock.SYSTEM); + } + + return this.azureMonitorMeterRegistry; + } + + @SuppressWarnings("UnstableApiUsage") + private synchronized MeterRegistry graphiteMeterRegistry(String serviceAddress) { + + if (this.graphiteMeterRegistry == null) { + + HostAndPort address = HostAndPort.fromString(serviceAddress); + + String host = address.getHost(); + int port = address.getPortOrDefault(DEFAULT_GRAPHITE_SERVER_PORT); + boolean enabled = !Boolean.getBoolean("azure.cosmos.monitoring.graphite.disabled"); + Duration step = Duration.ofSeconds(Integer.getInteger("azure.cosmos.monitoring.graphite.step", this.printingInterval)); + + final GraphiteConfig config = new GraphiteConfig() { + + private String[] tagNames = { "source" }; + + @Override + @Nullable + public String get(@Nullable String key) { + return null; + } + + @Override + public boolean enabled() { + return enabled; + } + + @Override + @Nullable + public String host() { + return host; + } + + @Override + @Nullable + public int port() { + return port; + } + + @Override + @Nullable + public Duration step() { + return step; + } + + @Override + @Nullable + public String[] tagsAsPrefix() { + return this.tagNames; + } + }; + + this.graphiteMeterRegistry = new GraphiteMeterRegistry(config, Clock.SYSTEM); + String source; + + try { + PercentEscaper escaper = new PercentEscaper("_-", false); + source = escaper.escape(InetAddress.getLocalHost().getHostName()); + } catch (UnknownHostException error) { + source = "unknown-host"; + } + + this.graphiteMeterRegistry.config() + .namingConvention(NamingConvention.dot) + .commonTags("source", source); + } + + return this.graphiteMeterRegistry; + } } diff --git a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/test/java/com/azure/data/cosmos/benchmark/ReadMyWritesConsistencyTest.java b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/test/java/com/azure/data/cosmos/benchmark/ReadMyWritesConsistencyTest.java index 584353ee6362..4cc7b35e01b0 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/test/java/com/azure/data/cosmos/benchmark/ReadMyWritesConsistencyTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/test/java/com/azure/data/cosmos/benchmark/ReadMyWritesConsistencyTest.java @@ -3,27 +3,28 @@ package com.azure.data.cosmos.benchmark; -import com.azure.data.cosmos.internal.AsyncDocumentClient; import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.DataType; -import com.azure.data.cosmos.internal.Database; -import com.azure.data.cosmos.internal.DocumentCollection; import com.azure.data.cosmos.IncludedPath; import com.azure.data.cosmos.Index; import com.azure.data.cosmos.IndexingPolicy; import com.azure.data.cosmos.PartitionKeyDefinition; +import com.azure.data.cosmos.internal.AsyncDocumentClient; +import com.azure.data.cosmos.internal.Database; +import com.azure.data.cosmos.internal.DocumentCollection; import com.azure.data.cosmos.internal.RequestOptions; import com.azure.data.cosmos.internal.TestConfigurations; +import com.azure.data.cosmos.internal.directconnectivity.Protocol; import com.beust.jcommander.JCommander; import com.google.common.base.CaseFormat; import com.google.common.base.Strings; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; import reactor.core.publisher.Flux; import reactor.core.scheduler.Schedulers; @@ -38,52 +39,91 @@ import static org.assertj.core.api.Assertions.assertThat; public class ReadMyWritesConsistencyTest { + private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); - private final int initialCollectionThroughput = 10_000; - private final int newCollectionThroughput = 100_000; + + private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); + private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiationCollectionScaleUpInSeconds = 60; - private final Duration defaultMaxRunningTimeInSeconds = Duration.ofMinutes(45); + + private final String desiredConsistency = + System.getProperty("DESIRED_CONSISTENCY", + StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("DESIRED_CONSISTENCY")), "Session")); + + private final int initialCollectionThroughput = 10_000; private final String maxRunningTime = - System.getProperty("MAX_RUNNING_TIME", StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("MAX_RUNNING_TIME")), defaultMaxRunningTimeInSeconds.toString())); + System.getProperty("MAX_RUNNING_TIME", StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("MAX_RUNNING_TIME")), defaultMaxRunningTime.toString())); - private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); - private final String desiredConsistency = - System.getProperty("DESIRED_CONSISTENCY", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("DESIRED_CONSISTENCY")), "Session")); + private final int newCollectionThroughput = 100_000; private final String numberOfOperationsAsString = - System.getProperty("NUMBER_OF_OPERATIONS", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("NUMBER_OF_OPERATIONS")), "-1")); + System.getProperty("NUMBER_OF_OPERATIONS", + StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("NUMBER_OF_OPERATIONS")), "-1")); - private Database database; private DocumentCollection collection; + private Database database; + + @AfterClass(groups = "e2e") + public void afterClass() { + AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); + Utils.safeCleanDatabases(housekeepingClient); + Utils.safeClean(housekeepingClient, database); + Utils.safeClose(housekeepingClient); + } + + @BeforeClass(groups = "e2e") + public void beforeClass() { + RequestOptions options = new RequestOptions(); + options.setOfferThroughput(initialCollectionThroughput); + AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); + database = Utils.createDatabaseForTest(housekeepingClient); + collection = housekeepingClient.createCollection("dbs/" + database.id(), + getCollectionDefinitionWithRangeRangeIndex(), + options).single().block().getResource(); + housekeepingClient.close(); + } + + @DataProvider(name = "collectionLinkTypeArgProvider") + public Object[][] collectionLinkTypeArgProvider() { + return new Object[][] { + // is namebased + { true }, + }; + } - //FIXME: Test is flaky, fails inconsistently + // FIXME: Test is flaky, fails inconsistently @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "e2e") public void readMyWrites(boolean useNameLink) throws Exception { + int concurrency = 5; + String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel %s -concurrency %d" + - " -numberOfOperations %s" + - " -maxRunningTimeDuration %s" + - " -operation ReadMyWrites -connectionMode DIRECT -numberOfPreCreatedDocuments 100 " + - " -printingInterval 60"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.id(), - collection.id(), - CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, desiredConsistency), - concurrency, - numberOfOperationsAsString, - maxRunningTime) - + (useNameLink ? " -useNameLink" : ""); + " -databaseId %s" + + " -collectionId %s" + + " -consistencyLevel %s" + + " -concurrency %s" + + " -numberOfOperations %s" + + " -maxRunningTimeDuration %s" + + " -operation ReadMyWrites" + + " -connectionMode Direct" + + " -numberOfPreCreatedDocuments 100" + + " -printingInterval 60" + + "%s"; + + String cmd = Strings.lenientFormat(cmdFormat, + TestConfigurations.HOST, + TestConfigurations.MASTER_KEY, + database.id(), + collection.id(), + CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, desiredConsistency), + concurrency, + numberOfOperationsAsString, + maxRunningTime, + (useNameLink ? " -useNameLink" : "")); Configuration cfg = new Configuration(); new JCommander(cfg, StringUtils.split(cmd)); @@ -119,35 +159,6 @@ protected void onSuccess() { } } - @BeforeClass(groups = "e2e") - public void beforeClass() { - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(initialCollectionThroughput); - AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); - database = Utils.createDatabaseForTest(housekeepingClient); - collection = housekeepingClient.createCollection("dbs/" + database.id(), - getCollectionDefinitionWithRangeRangeIndex(), - options) - .single().block().getResource(); - housekeepingClient.close(); - } - - @DataProvider(name = "collectionLinkTypeArgProvider") - public Object[][] collectionLinkTypeArgProvider() { - return new Object[][]{ - // is namebased - {true}, - }; - } - - @AfterClass(groups = "e2e") - public void afterClass() { - AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); - Utils.safeCleanDatabases(housekeepingClient); - Utils.safeClean(housekeepingClient, database); - Utils.safeClose(housekeepingClient); - } - DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList<>(); @@ -184,24 +195,24 @@ private void scheduleScaleUp(int delayStartInSeconds, int newThroughput) { // increase throughput to max for a single partition collection to avoid throttling // for bulk insert and later queries. return housekeepingClient.queryOffers( - String.format("SELECT * FROM r WHERE r.offerResourceId = '%s'", - collection.resourceId()) - , null).flatMap(page -> Flux.fromIterable(page.results())) - .take(1).flatMap(offer -> { - logger.info("going to scale up collection, newThroughput {}", newThroughput); - offer.setThroughput(newThroughput); - return housekeepingClient.replaceOffer(offer); - }); + String.format("SELECT * FROM r WHERE r.offerResourceId = '%s'", + collection.resourceId()) + , null).flatMap(page -> Flux.fromIterable(page.results())) + .take(1).flatMap(offer -> { + logger.info("going to scale up collection, newThroughput {}", newThroughput); + offer.setThroughput(newThroughput); + return housekeepingClient.replaceOffer(offer); + }); }).doOnTerminate(housekeepingClient::close) - .subscribe(aVoid -> { - }, e -> { - logger.error("collectionScaleUpFailed to scale up collection", e); - collectionScaleUpFailed.set(true); - }, - () -> { - logger.info("Collection Scale up request sent to the service"); - - } - ); + .subscribe(aVoid -> { + }, e -> { + logger.error("collectionScaleUpFailed to scale up collection", e); + collectionScaleUpFailed.set(true); + }, + () -> { + logger.info("Collection Scale up request sent to the service"); + + } + ); } -} \ No newline at end of file +} diff --git a/sdk/cosmos/microsoft-azure-cosmos-examples/src/main/java/com/azure/data/cosmos/examples/AccountSettings.java b/sdk/cosmos/microsoft-azure-cosmos-examples/src/main/java/com/azure/data/cosmos/examples/AccountSettings.java index 71c4b3190e44..c29d55586a15 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-examples/src/main/java/com/azure/data/cosmos/examples/AccountSettings.java +++ b/sdk/cosmos/microsoft-azure-cosmos-examples/src/main/java/com/azure/data/cosmos/examples/AccountSettings.java @@ -7,17 +7,17 @@ /** * Contains the account configurations for Sample. - * + * * For running tests, you can pass a customized endpoint configuration in one of the following * ways: *

    - *
  • -DACCOUNT_KEY="[your-key]" -ACCOUNT_HOST="[your-endpoint]" as JVM + *
  • -DACCOUNT_KEY="[your-key]" -DACCOUNT_HOST="[your-endpoint]" as JVM * command-line option.
  • - *
  • You can set ACCOUNT_KEY and ACCOUNT_HOST as environment variables.
  • + *
  • You can set COSMOS_ACCOUNT_KEY and COSMOS_ACCOUNT_HOST as environment variables.
  • *
- * + * * If none of the above is set, emulator endpoint will be used. - * Emulator http cert is self signed. If you are using emulator, + * Emulator http cert is self signed. If you are using emulator, * make sure emulator https certificate is imported * to java trusted cert store: * https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator-export-ssl-certificates @@ -25,15 +25,14 @@ public class AccountSettings { // REPLACE MASTER_KEY and HOST with values from your Azure Cosmos DB account. // The default values are credentials of the local emulator, which are not used in any production environment. - public static String MASTER_KEY = - System.getProperty("ACCOUNT_KEY", - StringUtils.defaultString(StringUtils.trimToNull( - System.getenv().get("COSMOS_ACCOUNT_KEY")), - "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")); - - public static String HOST = - System.getProperty("ACCOUNT_HOST", - StringUtils.defaultString(StringUtils.trimToNull( - System.getenv().get("COSMOS_ACCOUNT_HOST")), - "https://localhost:8081/")); + public static final String HOST = + System.getProperty("ACCOUNT_HOST", + StringUtils.defaultString(StringUtils.trimToNull( + System.getenv().get("COSMOS_ACCOUNT_HOST")), + "https://localhost:8081/")); + public static final String MASTER_KEY = + System.getProperty("ACCOUNT_KEY", + StringUtils.defaultString(StringUtils.trimToNull( + System.getenv().get("COSMOS_ACCOUNT_KEY")), + "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/pom.xml b/sdk/cosmos/microsoft-azure-cosmos/pom.xml index 7e1565f41e72..07ca4dae678c 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos/pom.xml @@ -113,6 +113,18 @@ Licensed under the MIT License. guava + + io.dropwizard.metrics + metrics-core + ${metrics.version} + + + + io.micrometer + micrometer-core + ${micrometer.version} + + io.projectreactor reactor-test @@ -129,16 +141,12 @@ Licensed under the MIT License. reactor-netty - - io.dropwizard.metrics - metrics-core - - org.mockito mockito-core test + diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/BridgeInternal.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/BridgeInternal.java index 44ab64c860af..bbc4511fa889 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/BridgeInternal.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/BridgeInternal.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; +import io.micrometer.core.instrument.MeterRegistry; import java.net.URI; import java.time.OffsetDateTime; @@ -52,6 +53,10 @@ public static Document documentFromObject(Object document, ObjectMapper mapper) return Document.FromObject(document, mapper); } + public static void monitorTelemetry(MeterRegistry registry) { + CosmosClient.monitorTelemetry(registry); + } + public static ResourceResponse toResourceResponse(RxDocumentServiceResponse response, Class cls) { return new ResourceResponse(response, cls); @@ -380,7 +385,7 @@ public static void setMapper(JsonSerializable jsonSerializable, ObjectMapper om) public static void setTimestamp(Resource resource, OffsetDateTime date) { resource.timestamp(date); } - + public static CosmosResponseDiagnostics createCosmosResponseDiagnostics() { return new CosmosResponseDiagnostics(); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java index cafe847f1b5b..9a0ac20c65c4 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java @@ -8,6 +8,8 @@ import com.azure.data.cosmos.internal.DatabaseAccount; import com.azure.data.cosmos.internal.HttpConstants; import com.azure.data.cosmos.internal.Permission; +import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdMetrics; +import io.micrometer.core.instrument.MeterRegistry; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -20,7 +22,7 @@ */ public class CosmosClient implements AutoCloseable { - //Document client wrapper + // Async document client wrapper private final Configs configs; private final AsyncDocumentClient asyncDocumentClient; private final String serviceEndpoint; @@ -64,6 +66,14 @@ public static CosmosClientBuilder builder(){ return new CosmosClientBuilder(); } + /** + * Monitor Cosmos client performance and resource utilization using the specified meter registry + * @param registry meter registry to use for performance monitoring + */ + static void monitorTelemetry(MeterRegistry registry) { + RntbdMetrics.add(registry); + } + /** * Get the service endpoint * @return the service endpoint diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientException.java index 0ee13f2bfa38..cf4c22abae08 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientException.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientException.java @@ -43,7 +43,7 @@ public class CosmosClientException extends Exception { String resourceAddress; CosmosClientException(int statusCode, String message, Map responseHeaders, Throwable cause) { - super(message, cause, /* enableSuppression */ true, /* writableStackTrace */ false); + super(message, cause); this.statusCode = statusCode; this.responseHeaders = responseHeaders == null ? new HashMap<>() : new HashMap<>(responseHeaders); } @@ -107,7 +107,7 @@ public class CosmosClientException extends Exception { /** * Creates a new instance of the CosmosClientException class. - * + * * @param message the string message. * @param statusCode the http status code of the response. * @param exception the exception object. diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Configs.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Configs.java index 23a0bc075b90..e747ffa0ed6f 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Configs.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Configs.java @@ -12,11 +12,19 @@ import javax.net.ssl.SSLException; +import static com.google.common.base.MoreObjects.firstNonNull; +import static com.google.common.base.Strings.emptyToNull; + public class Configs { private static final Logger logger = LoggerFactory.getLogger(Configs.class); private final SslContext sslContext; - private static final String PROTOCOL = "cosmos.directModeProtocol"; + // The names we use are consistent with the: + // * Azure environment variable naming conventions documented at https://azure.github.io/azure-sdk/java_implementation.html and + // * Java property naming conventions as illustrated by the name/value pairs returned by System.getProperties. + + private static final String PROTOCOL_ENVIRONMENT_VARIABLE = "AZURE_COSMOS_DIRECT_MODE_PROTOCOL"; + private static final String PROTOCOL_PROPERTY = "azure.cosmos.directModeProtocol"; private static final Protocol DEFAULT_PROTOCOL = Protocol.TCP; private static final String UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS = "COSMOS.UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS"; @@ -68,9 +76,11 @@ public SslContext getSslContext() { } public Protocol getProtocol() { - String protocol = getJVMConfigAsString(PROTOCOL, DEFAULT_PROTOCOL.toString()); + String protocol = System.getProperty(PROTOCOL_PROPERTY, firstNonNull( + emptyToNull(System.getenv().get(PROTOCOL_ENVIRONMENT_VARIABLE)), + DEFAULT_PROTOCOL.name())); try { - return Protocol.valueOf(StringUtils.upperCase(protocol.toLowerCase())); + return Protocol.valueOf(protocol.toUpperCase()); } catch (Exception e) { logger.error("Parsing protocol {} failed. Using the default {}.", protocol, DEFAULT_PROTOCOL, e); return DEFAULT_PROTOCOL; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserver.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserver.java index 3e76eca2ffd4..39adb35794db 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserver.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserver.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.changefeed; import com.azure.data.cosmos.CosmosItemProperties; +import reactor.core.publisher.Mono; import java.util.List; @@ -30,6 +31,7 @@ public interface ChangeFeedObserver { * * @param context the context specifying partition for this observer, etc. * @param docs the documents changed. + * @return a deferred operation of this call. */ - void processChanges(ChangeFeedObserverContext context, List docs); + Mono processChanges(ChangeFeedObserverContext context, List docs); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/ObserverException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/ObserverException.java index e5ef270984da..7a7784286689 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/ObserverException.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/ObserverException.java @@ -11,9 +11,9 @@ public class ObserverException extends RuntimeException { /** * Initializes a new instance of the {@link ObserverException} class using the specified internal exception. * - * @param originalException {@link Exception} thrown by the user code. + * @param originalException {@link Throwable} thrown by the user code. */ - public ObserverException(Exception originalException) { - super(DefaultMessage, originalException.getCause()); + public ObserverException(Throwable originalException) { + super(DefaultMessage, originalException); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/AutoCheckpointer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/AutoCheckpointer.java index 8b35b706ac9f..b064834a1c1b 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/AutoCheckpointer.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/AutoCheckpointer.java @@ -7,6 +7,7 @@ import com.azure.data.cosmos.internal.changefeed.ChangeFeedObserverCloseReason; import com.azure.data.cosmos.internal.changefeed.ChangeFeedObserverContext; import com.azure.data.cosmos.internal.changefeed.CheckpointFrequency; +import reactor.core.publisher.Mono; import java.time.Duration; import java.time.ZoneId; @@ -19,12 +20,17 @@ class AutoCheckpointer implements ChangeFeedObserver { private final CheckpointFrequency checkpointFrequency; private final ChangeFeedObserver observer; - private int processedDocCount; - private ZonedDateTime lastCheckpointTime; + private volatile int processedDocCount; + private volatile ZonedDateTime lastCheckpointTime; public AutoCheckpointer(CheckpointFrequency checkpointFrequency, ChangeFeedObserver observer) { - if (checkpointFrequency == null) throw new IllegalArgumentException("checkpointFrequency"); - if (observer == null) throw new IllegalArgumentException("observer"); + if (checkpointFrequency == null) { + throw new IllegalArgumentException("checkpointFrequency"); + } + + if (observer == null) { + throw new IllegalArgumentException("observer"); + } this.checkpointFrequency = checkpointFrequency; this.observer = observer; @@ -42,15 +48,22 @@ public void close(ChangeFeedObserverContext context, ChangeFeedObserverCloseReas } @Override - public void processChanges(ChangeFeedObserverContext context, List docs) { - this.observer.processChanges(context, docs); + public Mono processChanges(ChangeFeedObserverContext context, List docs) { + return this.observer.processChanges(context, docs) + .then(this.afterProcessChanges(context)); + } + + private Mono afterProcessChanges(ChangeFeedObserverContext context) { this.processedDocCount ++; if (this.isCheckpointNeeded()) { - context.checkpoint().block(); - this.processedDocCount = 0; - this.lastCheckpointTime = ZonedDateTime.now(ZoneId.of("UTC")); + return context.checkpoint() + .doOnSuccess((Void) -> { + this.processedDocCount = 0; + this.lastCheckpointTime = ZonedDateTime.now(ZoneId.of("UTC")); + }); } + return Mono.empty(); } private boolean isCheckpointNeeded() { @@ -64,10 +77,6 @@ private boolean isCheckpointNeeded() { Duration delta = Duration.between(this.lastCheckpointTime, ZonedDateTime.now(ZoneId.of("UTC"))); - if (delta.compareTo(this.checkpointFrequency.getTimeInterval()) >= 0) { - return true; - } - - return false; + return delta.compareTo(this.checkpointFrequency.getTimeInterval()) >= 0; } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/BootstrapperImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/BootstrapperImpl.java index 63dbdcc835ac..ab4b5385d56a 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/BootstrapperImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/BootstrapperImpl.java @@ -21,56 +21,71 @@ class BootstrapperImpl implements Bootstrapper { private final Duration lockTime; private final Duration sleepTime; - public BootstrapperImpl(PartitionSynchronizer synchronizer, LeaseStore leaseStore, Duration lockTime, Duration sleepTime) - { - if (synchronizer == null) throw new IllegalArgumentException("synchronizer"); - if (leaseStore == null) throw new IllegalArgumentException("leaseStore"); - if (lockTime == null || lockTime.isNegative() || lockTime.isZero()) throw new IllegalArgumentException("lockTime should be non-null and positive"); - if (sleepTime == null || sleepTime.isNegative() || sleepTime.isZero()) throw new IllegalArgumentException("sleepTime should be non-null and positive"); + private volatile boolean isInitialized; + private volatile boolean isLockAcquired; + + public BootstrapperImpl(PartitionSynchronizer synchronizer, LeaseStore leaseStore, Duration lockTime, Duration sleepTime) { + if (synchronizer == null) { + throw new IllegalArgumentException("synchronizer"); + } + + if (leaseStore == null) { + throw new IllegalArgumentException("leaseStore"); + } + + if (lockTime == null || lockTime.isNegative() || lockTime.isZero()) { + throw new IllegalArgumentException("lockTime should be non-null and positive"); + } + + if (sleepTime == null || sleepTime.isNegative() || sleepTime.isZero()) { + throw new IllegalArgumentException("sleepTime should be non-null and positive"); + } this.synchronizer = synchronizer; this.leaseStore = leaseStore; this.lockTime = lockTime; this.sleepTime = sleepTime; + + this.isInitialized = false; } @Override public Mono initialize() { - BootstrapperImpl self = this; + this.isInitialized = false; - return Mono.fromRunnable( () -> { - while (true) { - boolean initialized = self.leaseStore.isInitialized().block(); + return Mono.just(this) + .flatMap( value -> this.leaseStore.isInitialized()) + .flatMap(initialized -> { + this.isInitialized = initialized; - if (initialized) break; + if (initialized) { + return Mono.empty(); + } else { + return this.leaseStore.acquireInitializationLock(this.lockTime) + .flatMap(lockAcquired -> { + this.isLockAcquired = lockAcquired; - boolean isLockAcquired = self.leaseStore.acquireInitializationLock(self.lockTime).block(); - - try { - if (!isLockAcquired) { - logger.info("Another instance is initializing the store"); - try { - Thread.sleep(self.sleepTime.toMillis()); - } catch (InterruptedException ex) { - logger.warn("Unexpected exception caught", ex); - } - continue; - } - - logger.info("Initializing the store"); - self.synchronizer.createMissingLeases().block(); - self.leaseStore.markInitialized().block(); - - } catch (RuntimeException ex) { - break; - } finally { - if (isLockAcquired) { - self.leaseStore.releaseInitializationLock().block(); - } + if (!this.isLockAcquired) { + logger.info("Another instance is initializing the store"); + return Mono.just(isLockAcquired).delayElement(this.sleepTime); + } else { + return this.synchronizer.createMissingLeases() + .then(this.leaseStore.markInitialized()); + } + }) + .onErrorResume(throwable -> { + logger.warn("Unexpected exception caught", throwable); + return Mono.just(this.isLockAcquired); + }) + .flatMap(lockAcquired -> { + if (this.isLockAcquired) { + return this.leaseStore.releaseInitializationLock(); + } + return Mono.just(lockAcquired); + }); } - } - - logger.info("The store is initialized"); - }); + }) + .repeat( () -> !this.isInitialized) + .then(); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedContextClientImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedContextClientImpl.java index 4de1c3a5f98c..0f28122fa5be 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedContextClientImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedContextClientImpl.java @@ -20,6 +20,8 @@ import com.azure.data.cosmos.SqlQuerySpec; import com.azure.data.cosmos.internal.PartitionKeyRange; import com.azure.data.cosmos.internal.changefeed.ChangeFeedContextClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Scheduler; @@ -33,6 +35,8 @@ * Implementation for ChangeFeedDocumentClient. */ public class ChangeFeedContextClientImpl implements ChangeFeedContextClient { + private final Logger logger = LoggerFactory.getLogger(ChangeFeedContextClientImpl.class); + private final AsyncDocumentClient documentClient; private final CosmosContainer cosmosContainer; private Scheduler rxScheduler; @@ -41,8 +45,7 @@ public class ChangeFeedContextClientImpl implements ChangeFeedContextClient { * Initializes a new instance of the {@link ChangeFeedContextClient} interface. * @param cosmosContainer existing client. */ - public ChangeFeedContextClientImpl(CosmosContainer cosmosContainer) - { + public ChangeFeedContextClientImpl(CosmosContainer cosmosContainer) { if (cosmosContainer == null) { throw new IllegalArgumentException("cosmosContainer"); } @@ -57,8 +60,7 @@ public ChangeFeedContextClientImpl(CosmosContainer cosmosContainer) * @param cosmosContainer existing client. * @param rxScheduler the RX Java scheduler to observe on. */ - public ChangeFeedContextClientImpl(CosmosContainer cosmosContainer, Scheduler rxScheduler) - { + public ChangeFeedContextClientImpl(CosmosContainer cosmosContainer, Scheduler rxScheduler) { if (cosmosContainer == null) { throw new IllegalArgumentException("cosmosContainer"); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedHelper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedHelper.java index da0b2bf54120..a4280cc3d4fb 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedHelper.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedHelper.java @@ -133,8 +133,7 @@ public static class KeyValuePair implements Map.Entry private K key; private V value; - public KeyValuePair(K key, V value) - { + public KeyValuePair(K key, V value) { this.key = key; this.value = value; } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverContextImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverContextImpl.java index 0166064eb76d..d15d45a486c0 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverContextImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverContextImpl.java @@ -24,8 +24,7 @@ public ChangeFeedObserverContextImpl(String leaseToken) { this.feedResponse = null; } - public ChangeFeedObserverContextImpl(String leaseToken, FeedResponse feedResponse, PartitionCheckpointer checkpointer) - { + public ChangeFeedObserverContextImpl(String leaseToken, FeedResponse feedResponse, PartitionCheckpointer checkpointer) { this.partitionKeyRangeId = leaseToken; this.feedResponse = feedResponse; this.checkpointer = checkpointer; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedProcessorBuilderImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedProcessorBuilderImpl.java index 52e4df15789f..4ba7811fa9ec 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedProcessorBuilderImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedProcessorBuilderImpl.java @@ -22,13 +22,12 @@ import com.azure.data.cosmos.internal.changefeed.PartitionSupervisorFactory; import com.azure.data.cosmos.internal.changefeed.RequestOptionsFactory; import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; import reactor.core.scheduler.Schedulers; import java.net.URI; import java.time.Duration; import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.function.Consumer; /** @@ -63,8 +62,8 @@ public class ChangeFeedProcessorBuilderImpl implements ChangeFeedProcessor.Build private ChangeFeedContextClient feedContextClient; private ChangeFeedProcessorOptions changeFeedProcessorOptions; private ChangeFeedObserverFactory observerFactory; - private String databaseResourceId; - private String collectionResourceId; + private volatile String databaseResourceId; + private volatile String collectionResourceId; private ChangeFeedContextClient leaseContextClient; private PartitionLoadBalancingStrategy loadBalancingStrategy; private PartitionProcessorFactory partitionProcessorFactory; @@ -72,7 +71,7 @@ public class ChangeFeedProcessorBuilderImpl implements ChangeFeedProcessor.Build private HealthMonitor healthMonitor; private PartitionManager partitionManager; - private ExecutorService executorService; + private Scheduler scheduler; /** * Start listening for changes asynchronously. @@ -81,7 +80,18 @@ public class ChangeFeedProcessorBuilderImpl implements ChangeFeedProcessor.Build */ @Override public Mono start() { - return partitionManager.start(); + if (this.partitionManager == null) { + return this.initializeCollectionPropertiesForBuild() + .then(this.getLeaseStoreManager() + .flatMap(leaseStoreManager -> this.buildPartitionManager(leaseStoreManager))) + .flatMap(partitionManager1 -> { + this.partitionManager = partitionManager1; + return this.partitionManager.start(); + }); + + } else { + return partitionManager.start(); + } } /** @@ -278,29 +288,19 @@ public ChangeFeedProcessorBuilderImpl withHealthMonitor(HealthMonitor healthMoni */ @Override public ChangeFeedProcessor build() { - ChangeFeedProcessorBuilderImpl self = this; - - if (this.hostName == null) - { + if (this.hostName == null) { throw new IllegalArgumentException("Host name was not specified"); } - if (this.observerFactory == null) - { + if (this.observerFactory == null) { throw new IllegalArgumentException("Observer was not specified"); } - if (this.executorService == null) { - this.executorService = Executors.newCachedThreadPool(); + if (this.scheduler == null) { + this.scheduler = Schedulers.elastic(); } - // TBD: Move this initialization code as part of the start() call. - return this.initializeCollectionPropertiesForBuild() - .then(self.getLeaseStoreManager().flatMap(leaseStoreManager -> self.buildPartitionManager(leaseStoreManager))) - .map(partitionManager1 -> { - self.partitionManager = partitionManager1; - return self; - }).block(); + return this; } public ChangeFeedProcessorBuilderImpl() { @@ -313,8 +313,6 @@ public ChangeFeedProcessorBuilderImpl(PartitionManager partitionManager) { } private Mono initializeCollectionPropertiesForBuild() { - ChangeFeedProcessorBuilderImpl self = this; - if (this.changeFeedProcessorOptions == null) { this.changeFeedProcessorOptions = new ChangeFeedProcessorOptions(); } @@ -322,21 +320,19 @@ private Mono initializeCollectionPropertiesForBuild() { return this.feedContextClient .readDatabase(this.feedContextClient.getDatabaseClient(), null) .map( databaseResourceResponse -> { - self.databaseResourceId = databaseResourceResponse.database().id(); - return self.databaseResourceId; + this.databaseResourceId = databaseResourceResponse.database().id(); + return this.databaseResourceId; }) - .flatMap( id -> self.feedContextClient - .readContainer(self.feedContextClient.getContainerClient(), null) + .flatMap( id -> this.feedContextClient + .readContainer(this.feedContextClient.getContainerClient(), null) .map(documentCollectionResourceResponse -> { - self.collectionResourceId = documentCollectionResourceResponse.container().id(); - return self.collectionResourceId; + this.collectionResourceId = documentCollectionResourceResponse.container().id(); + return this.collectionResourceId; })) .then(); } private Mono getLeaseStoreManager() { - ChangeFeedProcessorBuilderImpl self = this; - if (this.leaseStoreManager == null) { return this.leaseContextClient.readContainerSettings(this.leaseContextClient.getContainerClient(), null) @@ -352,18 +348,18 @@ private Mono getLeaseStoreManager() { RequestOptionsFactory requestOptionsFactory = new PartitionedByIdCollectionRequestOptionsFactory(); - String leasePrefix = self.getLeasePrefix(); + String leasePrefix = this.getLeasePrefix(); return LeaseStoreManager.Builder() .leasePrefix(leasePrefix) - .leaseCollectionLink(self.leaseContextClient.getContainerClient()) - .leaseContextClient(self.leaseContextClient) + .leaseCollectionLink(this.leaseContextClient.getContainerClient()) + .leaseContextClient(this.leaseContextClient) .requestOptionsFactory(requestOptionsFactory) - .hostName(self.hostName) + .hostName(this.hostName) .build() .map(manager -> { - self.leaseStoreManager = manager; - return self.leaseStoreManager; + this.leaseStoreManager = manager; + return this.leaseStoreManager; }); }); } @@ -389,8 +385,6 @@ private String getLeasePrefix() { } private Mono buildPartitionManager(LeaseStoreManager leaseStoreManager) { - ChangeFeedProcessorBuilderImpl self = this; - CheckpointerObserverFactory factory = new CheckpointerObserverFactory(this.observerFactory, new CheckpointFrequency()); PartitionSynchronizerImpl synchronizer = new PartitionSynchronizerImpl( @@ -412,7 +406,7 @@ private Mono buildPartitionManager(LeaseStoreManager leaseStor leaseStoreManager, this.feedContextClient.getContainerClient()), this.changeFeedProcessorOptions, - executorService + this.scheduler ); if (this.loadBalancingStrategy == null) { @@ -423,7 +417,7 @@ private Mono buildPartitionManager(LeaseStoreManager leaseStor this.changeFeedProcessorOptions.leaseExpirationInterval()); } - PartitionController partitionController = new PartitionControllerImpl(leaseStoreManager, leaseStoreManager, partitionSupervisorFactory, synchronizer, executorService); + PartitionController partitionController = new PartitionControllerImpl(leaseStoreManager, leaseStoreManager, partitionSupervisorFactory, synchronizer, scheduler); if (this.healthMonitor == null) { this.healthMonitor = new TraceHealthMonitor(); @@ -436,7 +430,7 @@ private Mono buildPartitionManager(LeaseStoreManager leaseStor leaseStoreManager, this.loadBalancingStrategy, this.changeFeedProcessorOptions.leaseAcquireInterval(), - this.executorService + this.scheduler ); PartitionManager partitionManager = new PartitionManagerImpl(bootstrapper, partitionController, partitionLoadBalancer); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/CheckpointerObserverFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/CheckpointerObserverFactory.java index a77ea13957c2..b9912d94a00f 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/CheckpointerObserverFactory.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/CheckpointerObserverFactory.java @@ -19,10 +19,14 @@ class CheckpointerObserverFactory implements ChangeFeedObserverFactory { * @param observerFactory the instance of observer factory. * @param checkpointFrequency the the frequency of lease event. */ - public CheckpointerObserverFactory(ChangeFeedObserverFactory observerFactory, CheckpointFrequency checkpointFrequency) - { - if (observerFactory == null) throw new IllegalArgumentException("observerFactory"); - if (checkpointFrequency == null) throw new IllegalArgumentException("checkpointFrequency"); + public CheckpointerObserverFactory(ChangeFeedObserverFactory observerFactory, CheckpointFrequency checkpointFrequency) { + if (observerFactory == null) { + throw new IllegalArgumentException("observerFactory"); + } + + if (checkpointFrequency == null) { + throw new IllegalArgumentException("checkpointFrequency"); + } this.observerFactory = observerFactory; this.checkpointFrequency = checkpointFrequency; @@ -34,7 +38,9 @@ public CheckpointerObserverFactory(ChangeFeedObserverFactory observerFactory, Ch @Override public ChangeFeedObserver createObserver() { ChangeFeedObserver observer = new ObserverExceptionWrappingChangeFeedObserverDecorator(this.observerFactory.createObserver()); - if (this.checkpointFrequency.isExplicitCheckpoint()) return observer; + if (this.checkpointFrequency.isExplicitCheckpoint()) { + return observer; + } return new AutoCheckpointer(this.checkpointFrequency, observer); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserver.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserver.java index 2f26e3813211..cc64f34c94ca 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserver.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserver.java @@ -8,13 +8,14 @@ import com.azure.data.cosmos.internal.changefeed.ChangeFeedObserverContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import reactor.core.publisher.Mono; import java.util.List; import java.util.function.Consumer; class DefaultObserver implements ChangeFeedObserver { - private final Logger log = LoggerFactory.getLogger(DefaultObserver.class); - private Consumer> consumer; + private static final Logger log = LoggerFactory.getLogger(DefaultObserver.class); + private final Consumer> consumer; public DefaultObserver(Consumer> consumer) { this.consumer = consumer; @@ -31,9 +32,11 @@ public void close(ChangeFeedObserverContext context, ChangeFeedObserverCloseReas } @Override - public void processChanges(ChangeFeedObserverContext context, List docs) { + public Mono processChanges(ChangeFeedObserverContext context, List docs) { log.info("Start processing from thread {}", Thread.currentThread().getId()); consumer.accept(docs); log.info("Done processing from thread {}", Thread.currentThread().getId()); + + return Mono.empty(); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseStore.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseStore.java index 05bfeb29e75c..8e29ae6f4112 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseStore.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseStore.java @@ -26,14 +26,14 @@ class DocumentServiceLeaseStore implements LeaseStore { private String containerNamePrefix; private CosmosContainer leaseCollectionLink; private RequestOptionsFactory requestOptionsFactory; - private String lockETag; + private volatile String lockETag; // TODO: rename to LeaseStoreImpl public DocumentServiceLeaseStore( - ChangeFeedContextClient client, - String containerNamePrefix, - CosmosContainer leaseCollectionLink, - RequestOptionsFactory requestOptionsFactory) { + ChangeFeedContextClient client, + String containerNamePrefix, + CosmosContainer leaseCollectionLink, + RequestOptionsFactory requestOptionsFactory) { this.client = client; this.containerNamePrefix = containerNamePrefix; @@ -91,12 +91,10 @@ public Mono acquireInitializationLock(Duration lockExpirationTime) { containerDocument.id(lockId); BridgeInternal.setProperty(containerDocument, com.azure.data.cosmos.internal.Constants.Properties.TTL, Long.valueOf(lockExpirationTime.getSeconds()).intValue()); - DocumentServiceLeaseStore self = this; - return this.client.createItem(this.leaseCollectionLink, containerDocument, null, false) .map(documentResourceResponse -> { if (documentResourceResponse.item() != null) { - self.lockETag = documentResourceResponse.properties().etag(); + this.lockETag = documentResourceResponse.properties().etag(); return true; } else { return false; @@ -130,13 +128,12 @@ public Mono releaseInitializationLock() { accessCondition.type(AccessConditionType.IF_MATCH); accessCondition.condition(this.lockETag); requestOptions.accessCondition(accessCondition); - DocumentServiceLeaseStore self = this; CosmosItem docItem = this.client.getContainerClient().getItem(lockId, "/id"); return this.client.deleteItem(docItem, requestOptions) .map(documentResourceResponse -> { if (documentResourceResponse.item() != null) { - self.lockETag = null; + this.lockETag = null; return true; } else { return false; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseUpdaterImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseUpdaterImpl.java index 104b2c2bfbec..e28c13cbf500 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseUpdaterImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseUpdaterImpl.java @@ -15,7 +15,6 @@ import com.azure.data.cosmos.internal.changefeed.exceptions.LeaseLostException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import reactor.core.Exceptions; import reactor.core.publisher.Mono; import java.time.ZoneId; @@ -44,7 +43,6 @@ public DocumentServiceLeaseUpdaterImpl(ChangeFeedContextClient client) { @Override public Mono updateLease(Lease cachedLease, CosmosItem itemLink, CosmosItemRequestOptions requestOptions, Function updateLease) { - DocumentServiceLeaseUpdaterImpl self = this; Lease arrayLease[] = {cachedLease}; arrayLease[0] = updateLease.apply(cachedLease); @@ -54,7 +52,7 @@ public Mono updateLease(Lease cachedLease, CosmosItem itemLink, CosmosIte arrayLease[0].setTimestamp(ZonedDateTime.now(ZoneId.of("UTC"))); - return self.tryReplaceLease(arrayLease[0], itemLink) + return this.tryReplaceLease(arrayLease[0], itemLink) .map(leaseDocument -> { arrayLease[0] = ServiceItemLease.fromDocument(leaseDocument); return arrayLease[0]; @@ -71,7 +69,7 @@ public Mono updateLease(Lease cachedLease, CosmosItem itemLink, CosmosIte CosmosClientException ex = (CosmosClientException) throwable; if (ex.statusCode() == HTTP_STATUS_CODE_NOT_FOUND) { // Partition lease no longer exists - throw Exceptions.propagate(new LeaseLostException(arrayLease[0])); + throw new LeaseLostException(arrayLease[0]); } } return Mono.error(throwable); @@ -87,7 +85,7 @@ public Mono updateLease(Lease cachedLease, CosmosItem itemLink, CosmosIte serverLease.getConcurrencyToken()); arrayLease[0] = serverLease; - throw Exceptions.propagate(new RuntimeException("")); + throw new RuntimeException("Partition update failed"); }); }) .retry(RETRY_COUNT_ON_CONFLICT, throwable -> { @@ -96,57 +94,9 @@ public Mono updateLease(Lease cachedLease, CosmosItem itemLink, CosmosIte } return false; }); - -// Lease lease = cachedLease; -// -// for (int retryCount = RETRY_COUNT_ON_CONFLICT; retryCount > 0; retryCount--) { -// lease = updateLease.apply(lease); -// -// if (lease == null) { -// return Mono.empty(); -// } -// -// lease.setTimestamp(ZonedDateTime.now(ZoneId.of("UTC"))); -// CosmosItemProperties leaseDocument = this.tryReplaceLease(lease, itemLink).block(); -// -// if (leaseDocument != null) { -// return Mono.just(ServiceItemLease.fromDocument(leaseDocument)); -// } -// -// // Partition lease update conflict. Reading the current version of lease. -// CosmosItemProperties document = null; -// try { -// CosmosItemResponse response = this.client.readItem(itemLink, requestOptions) -// .block(); -// document = response.properties(); -// } catch (RuntimeException re) { -// if (re.getCause() instanceof CosmosClientException) { -// CosmosClientException ex = (CosmosClientException) re.getCause(); -// if (ex.statusCode() == HTTP_STATUS_CODE_NOT_FOUND) { -// // Partition lease no longer exists -// throw new LeaseLostException(lease); -// } -// } -// throw re; -// } -// -// ServiceItemLease serverLease = ServiceItemLease.fromDocument(document); -// logger.info( -// "Partition {} update failed because the lease with token '{}' was updated by host '{}' with token '{}'. Will retry, {} retry(s) left.", -// lease.getLeaseToken(), -// lease.getConcurrencyToken(), -// serverLease.getOwner(), -// serverLease.getConcurrencyToken(), -// retryCount); -// -// lease = serverLease; -// } -// -// throw new LeaseLostException(lease); } private Mono tryReplaceLease(Lease lease, CosmosItem itemLink) throws LeaseLostException { - DocumentServiceLeaseUpdaterImpl self = this; return this.client.replaceItem(itemLink, lease, this.getCreateIfMatchOptions(lease)) .map(cosmosItemResponse -> cosmosItemResponse.properties()) .onErrorResume(re -> { @@ -157,10 +107,10 @@ private Mono tryReplaceLease(Lease lease, CosmosItem itemL return Mono.empty(); } case HTTP_STATUS_CODE_CONFLICT: { - throw Exceptions.propagate( new LeaseLostException(lease, ex, false)); + throw new LeaseLostException(lease, ex, false); } case HTTP_STATUS_CODE_NOT_FOUND: { - throw Exceptions.propagate( new LeaseLostException(lease, ex, true)); + throw new LeaseLostException(lease, ex, true); } default: { return Mono.error(re); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/EqualPartitionsBalancingStrategy.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/EqualPartitionsBalancingStrategy.java index acf7c0adaf5e..6338e0138167 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/EqualPartitionsBalancingStrategy.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/EqualPartitionsBalancingStrategy.java @@ -26,7 +26,10 @@ class EqualPartitionsBalancingStrategy implements PartitionLoadBalancingStrategy private final Duration leaseExpirationInterval; public EqualPartitionsBalancingStrategy(String hostName, int minPartitionCount, int maxPartitionCount, Duration leaseExpirationInterval) { - if (hostName == null) throw new IllegalArgumentException("hostName"); + if (hostName == null) { + throw new IllegalArgumentException("hostName"); + } + this.hostName = hostName; this.minPartitionCount = minPartitionCount; this.maxPartitionCount = maxPartitionCount; @@ -43,8 +46,10 @@ public List selectLeasesToTake(List allLeases) { int partitionCount = allPartitions.size(); int workerCount = workerToPartitionCount.size(); - if (partitionCount <= 0) + + if (partitionCount <= 0) { return new ArrayList(); + } int target = this.calculateTargetPartitionCount(partitionCount, workerCount); int myCount = workerToPartitionCount.get(this.hostName); @@ -102,6 +107,7 @@ private static Lease getLeaseToSteal( private static Map.Entry findWorkerWithMostPartitions(Map workerToPartitionCount) { Map.Entry workerToStealFrom = new ChangeFeedHelper.KeyValuePair<>("", 0); + for (Map.Entry entry : workerToPartitionCount.entrySet()) { if (workerToStealFrom.getValue() <= entry.getValue()) { workerToStealFrom = entry; @@ -113,6 +119,7 @@ private static Map.Entry findWorkerWithMostPartitions(Map workerCount) { target = (int)Math.ceil((double)partitionCount / workerCount); } @@ -163,6 +170,7 @@ private boolean isExpired(Lease lease) { if (lease.getOwner() == null || lease.getOwner().isEmpty() || lease.getTimestamp() == null) { return true; } + ZonedDateTime time = ZonedDateTime.parse(lease.getTimestamp()); return time.plus(this.leaseExpirationInterval).isBefore(ZonedDateTime.now(ZoneId.of("UTC"))); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ExceptionClassifier.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ExceptionClassifier.java index c70552c429d6..cdf19f79d55d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ExceptionClassifier.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ExceptionClassifier.java @@ -23,20 +23,23 @@ class ExceptionClassifier { public static StatusCodeErrorType classifyClientException(CosmosClientException clientException) { Integer subStatusCode = clientException.subStatusCode(); - if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_NOT_FOUND && subStatusCode != SubStatusCode_ReadSessionNotAvailable) + if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_NOT_FOUND && subStatusCode != SubStatusCode_ReadSessionNotAvailable) { return StatusCodeErrorType.PARTITION_NOT_FOUND; + } - if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_GONE && (subStatusCode == SubStatusCode_PartitionKeyRangeGone || subStatusCode == SubStatusCode_Splitting)) + if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_GONE && (subStatusCode == SubStatusCode_PartitionKeyRangeGone || subStatusCode == SubStatusCode_Splitting)) { return StatusCodeErrorType.PARTITION_SPLIT; + } - if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_TOO_MANY_REQUESTS || clientException.statusCode() >= ChangeFeedHelper.HTTP_STATUS_CODE_INTERNAL_SERVER_ERROR) + if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_TOO_MANY_REQUESTS || clientException.statusCode() >= ChangeFeedHelper.HTTP_STATUS_CODE_INTERNAL_SERVER_ERROR) { return StatusCodeErrorType.TRANSIENT_ERROR; + } // Temporary workaround to compare exception message, until server provides better way of handling this case. - if (clientException.getMessage().contains("Reduce page size and try again.")) + if (clientException.getMessage().contains("Reduce page size and try again.")) { return StatusCodeErrorType.MAX_ITEM_COUNT_TOO_LARGE; + } return StatusCodeErrorType.UNDEFINED; - } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/HealthMonitoringPartitionControllerDecorator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/HealthMonitoringPartitionControllerDecorator.java index 8a40ed04a439..185558f97556 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/HealthMonitoringPartitionControllerDecorator.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/HealthMonitoringPartitionControllerDecorator.java @@ -17,8 +17,13 @@ class HealthMonitoringPartitionControllerDecorator implements PartitionControlle private final HealthMonitor monitor; public HealthMonitoringPartitionControllerDecorator(PartitionController inner, HealthMonitor monitor) { - if (inner == null) throw new IllegalArgumentException("inner"); - if (monitor == null) throw new IllegalArgumentException("monitor"); + if (inner == null) { + throw new IllegalArgumentException("inner"); + } + + if (monitor == null) { + throw new IllegalArgumentException("monitor"); + } this.inner = inner; this.monitor = monitor; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseRenewerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseRenewerImpl.java index 62a3bbdb6bc4..cf466b109d03 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseRenewerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseRenewerImpl.java @@ -12,19 +12,19 @@ import reactor.core.publisher.Mono; import java.time.Duration; +import java.time.ZonedDateTime; /** * Implementation for the {@link LeaseRenewer}. */ class LeaseRenewerImpl implements LeaseRenewer { - private final Logger logger = LoggerFactory.getLogger(LeaseRenewerImpl.class); + private static final Logger logger = LoggerFactory.getLogger(LeaseRenewerImpl.class); private final LeaseManager leaseManager; private final Duration leaseRenewInterval; private Lease lease; private RuntimeException resultException; - public LeaseRenewerImpl(Lease lease, LeaseManager leaseManager, Duration leaseRenewInterval) - { + public LeaseRenewerImpl(Lease lease, LeaseManager leaseManager, Duration leaseRenewInterval) { this.lease = lease; this.leaseManager = leaseManager; this.leaseRenewInterval = leaseRenewInterval; @@ -32,44 +32,40 @@ public LeaseRenewerImpl(Lease lease, LeaseManager leaseManager, Duration leaseRe @Override public Mono run(CancellationToken cancellationToken) { - LeaseRenewerImpl self = this; + logger.info("Partition {}: renewer task started.", this.lease.getLeaseToken()); - return Mono.fromRunnable( () -> { - try { - logger.info(String.format("Partition %s: renewer task started.", self.lease.getLeaseToken())); - long remainingWork = this.leaseRenewInterval.toMillis() / 2; - - try { - while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { - Thread.sleep(100); - remainingWork -= 100; - } - } catch (InterruptedException ex) { - // exception caught - logger.info(String.format("Partition %s: renewer task stopped.", self.lease.getLeaseToken())); + return Mono.just(this) + .flatMap(value -> { + if (cancellationToken.isCancellationRequested()) { + return Mono.empty(); } - while (!cancellationToken.isCancellationRequested()) { - self.renew().block(); - - remainingWork = this.leaseRenewInterval.toMillis(); - - try { - while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { - Thread.sleep(100); - remainingWork -= 100; - } - } catch (InterruptedException ex) { - // exception caught - logger.info(String.format("Partition %s: renewer task stopped.", self.lease.getLeaseToken())); - break; - } + ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.leaseRenewInterval); + return Mono.just(value) + .delayElement(Duration.ofMillis(100)) + .repeat( () -> { + ZonedDateTime currentTime = ZonedDateTime.now(); + return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); + }).last(); + }) + .flatMap(value -> { + if (cancellationToken.isCancellationRequested()) { + return Mono.empty(); + } + return this.renew(cancellationToken); + }) + .repeat(() -> { + if (cancellationToken.isCancellationRequested()) { + logger.info("Partition {}: renewer task stopped.", this.lease.getLeaseToken()); } - } catch (RuntimeException ex) { - logger.error(String.format("Partition %s: renew lease loop failed.", self.lease.getLeaseToken()), ex); - self.resultException = ex; - } - }); + + return !cancellationToken.isCancellationRequested(); + }) + .then() + .onErrorResume(throwable -> { + logger.error("Partition {}: renew lease loop failed.", this.lease.getLeaseToken(), throwable); + return Mono.error(throwable); + }); } @Override @@ -77,23 +73,30 @@ public RuntimeException getResultException() { return this.resultException; } - private Mono renew() { - LeaseRenewerImpl self = this; + private Mono renew(CancellationToken cancellationToken) { + if (cancellationToken.isCancellationRequested()) { + return Mono.empty(); + } - return Mono.fromRunnable( () -> { - try { - Lease renewedLease = self.leaseManager.renew(this.lease).block(); - if (renewedLease != null) this.lease = renewedLease; + return this.leaseManager.renew(this.lease) + .map(renewedLease -> { + if (renewedLease != null) { + this.lease = renewedLease; + } + logger.info("Partition {}: renewed lease with result {}", this.lease.getLeaseToken(), renewedLease != null); + return renewedLease; + }) + .onErrorResume(throwable -> { + if (throwable instanceof LeaseLostException) { + LeaseLostException lle = (LeaseLostException) throwable; + this.resultException = lle; + logger.error("Partition {}: lost lease on renew.", this.lease.getLeaseToken(), lle); + return Mono.error(lle); + } - logger.info(String.format("Partition %s: renewed lease with result %s", self.lease.getLeaseToken(), renewedLease != null)); - } catch (LeaseLostException leaseLostException) { - logger.error(String.format("Partition %s: lost lease on renew.", self.lease.getLeaseToken()), leaseLostException); - self.resultException = leaseLostException; - throw leaseLostException; - } catch (Exception ex) { - logger.error(String.format("Partition %s: failed to renew lease.", self.lease.getLeaseToken()), ex); - } - }); + logger.error("Partition {}: failed to renew lease.", this.lease.getLeaseToken(), throwable); + return Mono.empty(); + }); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseStoreManagerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseStoreManagerImpl.java index 993f220205de..20980f6e0074 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseStoreManagerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseStoreManagerImpl.java @@ -21,7 +21,6 @@ import com.azure.data.cosmos.internal.changefeed.exceptions.LeaseLostException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -101,12 +100,30 @@ public LeaseStoreManagerBuilderDefinition hostName(String hostName) { @Override public Mono build() { - if (this.settings == null) throw new IllegalArgumentException("properties"); - if (this.settings.getContainerNamePrefix() == null) throw new IllegalArgumentException("properties.containerNamePrefix"); - if (this.settings.getLeaseCollectionLink() == null) throw new IllegalArgumentException("properties.leaseCollectionLink"); - if (this.settings.getHostName() == null || this.settings.getHostName().isEmpty()) throw new IllegalArgumentException("properties.hostName"); - if (this.leaseDocumentClient == null) throw new IllegalArgumentException("leaseDocumentClient"); - if (this.requestOptionsFactory == null) throw new IllegalArgumentException("requestOptionsFactory"); + if (this.settings == null) { + throw new IllegalArgumentException("properties"); + } + + if (this.settings.getContainerNamePrefix() == null) { + throw new IllegalArgumentException("properties.containerNamePrefix"); + } + + if (this.settings.getLeaseCollectionLink() == null) { + throw new IllegalArgumentException("properties.leaseCollectionLink"); + } + + if (this.settings.getHostName() == null || this.settings.getHostName().isEmpty()) { + throw new IllegalArgumentException("properties.hostName"); + } + + if (this.leaseDocumentClient == null) { + throw new IllegalArgumentException("leaseDocumentClient"); + } + + if (this.requestOptionsFactory == null) { + throw new IllegalArgumentException("requestOptionsFactory"); + } + if (this.leaseUpdater == null) { this.leaseUpdater = new DocumentServiceLeaseUpdaterImpl(leaseDocumentClient); } @@ -117,13 +134,15 @@ public Mono build() { this.settings.getLeaseCollectionLink(), this.requestOptionsFactory); - LeaseStoreManagerImpl self = this; - if (this.settings.getLeaseCollectionLink() == null) + if (this.settings.getLeaseCollectionLink() == null) { throw new IllegalArgumentException("leaseCollectionLink was not specified"); - if (this.requestOptionsFactory == null) + } + + if (this.requestOptionsFactory == null) { throw new IllegalArgumentException("requestOptionsFactory was not specified"); + } - return Mono.just(self); + return Mono.just(this); } @Override @@ -134,14 +153,15 @@ public Flux getAllLeases() { @Override public Flux getOwnedLeases() { - LeaseStoreManagerImpl self = this; return this.getAllLeases() - .filter(lease -> lease.getOwner() != null && lease.getOwner().equalsIgnoreCase(self.settings.getHostName())); + .filter(lease -> lease.getOwner() != null && lease.getOwner().equalsIgnoreCase(this.settings.getHostName())); } @Override public Mono createLeaseIfNotExist(String leaseToken, String continuationToken) { - if (leaseToken == null) throw new IllegalArgumentException("leaseToken"); + if (leaseToken == null) { + throw new IllegalArgumentException("leaseToken"); + } String leaseDocId = this.getDocumentId(leaseToken); ServiceItemLease documentServiceLease = new ServiceItemLease() @@ -162,7 +182,9 @@ public Mono createLeaseIfNotExist(String leaseToken, String continuationT return Mono.error(ex); }) .map(documentResourceResponse -> { - if (documentResourceResponse == null) return null; + if (documentResourceResponse == null) { + return null; + } CosmosItemProperties document = documentResourceResponse.properties(); @@ -177,7 +199,9 @@ public Mono createLeaseIfNotExist(String leaseToken, String continuationT @Override public Mono delete(Lease lease) { - if (lease == null || lease.getId() == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null || lease.getId() == null) { + throw new IllegalArgumentException("lease"); + } CosmosItem itemForLease = this.createItemForLease(lease.getId()); @@ -201,7 +225,9 @@ public Mono delete(Lease lease) { @Override public Mono acquire(Lease lease) { - if (lease == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } String oldOwner = lease.getOwner(); @@ -212,7 +238,7 @@ public Mono acquire(Lease lease) { serverLease -> { if (serverLease.getOwner() != null && !serverLease.getOwner().equalsIgnoreCase(oldOwner)) { logger.info("Partition {} lease was taken over by owner '{}'", lease.getLeaseToken(), serverLease.getOwner()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } serverLease.setOwner(this.settings.getHostName()); serverLease.setProperties(lease.getProperties()); @@ -223,10 +249,11 @@ public Mono acquire(Lease lease) { @Override public Mono release(Lease lease) { - if (lease == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } CosmosItem itemForLease = this.createItemForLease(lease.getId()); - LeaseStoreManagerImpl self = this; return this.leaseDocumentClient.readItem(itemForLease, this.requestOptionsFactory.createRequestOptions(lease)) .onErrorResume( ex -> { @@ -234,23 +261,23 @@ public Mono release(Lease lease) { CosmosClientException e = (CosmosClientException) ex; if (e.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_NOT_FOUND) { logger.info("Partition {} failed to renew lease. The lease is gone already.", lease.getLeaseToken()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } } return Mono.error(ex); }) .map( documentResourceResponse -> ServiceItemLease.fromDocument(documentResourceResponse.properties())) - .flatMap( refreshedLease -> self.leaseUpdater.updateLease( + .flatMap( refreshedLease -> this.leaseUpdater.updateLease( refreshedLease, - self.createItemForLease(refreshedLease.getId()), - self.requestOptionsFactory.createRequestOptions(lease), + this.createItemForLease(refreshedLease.getId()), + this.requestOptionsFactory.createRequestOptions(lease), serverLease -> { if (serverLease.getOwner() != null) { if (!serverLease.getOwner().equalsIgnoreCase(lease.getOwner())) { logger.info("Partition {} no need to release lease. The lease was already taken by another host '{}'.", lease.getLeaseToken(), serverLease.getOwner()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } } @@ -263,12 +290,13 @@ public Mono release(Lease lease) { @Override public Mono renew(Lease lease) { - if (lease == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } // Get fresh lease. The assumption here is that check-pointing is done with higher frequency than lease renewal so almost // certainly the lease was updated in between. CosmosItem itemForLease = this.createItemForLease(lease.getId()); - LeaseStoreManagerImpl self = this; return this.leaseDocumentClient.readItem(itemForLease, this.requestOptionsFactory.createRequestOptions(lease)) .onErrorResume( ex -> { @@ -276,22 +304,22 @@ public Mono renew(Lease lease) { CosmosClientException e = (CosmosClientException) ex; if (e.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_NOT_FOUND) { logger.info("Partition {} failed to renew lease. The lease is gone already.", lease.getLeaseToken()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } } return Mono.error(ex); }) .map( documentResourceResponse -> ServiceItemLease.fromDocument(documentResourceResponse.properties())) - .flatMap( refreshedLease -> self.leaseUpdater.updateLease( + .flatMap( refreshedLease -> this.leaseUpdater.updateLease( refreshedLease, - self.createItemForLease(refreshedLease.getId()), - self.requestOptionsFactory.createRequestOptions(lease), + this.createItemForLease(refreshedLease.getId()), + this.requestOptionsFactory.createRequestOptions(lease), serverLease -> { if (!serverLease.getOwner().equalsIgnoreCase(lease.getOwner())) { logger.info("Partition {} lease was taken over by owner '{}'", lease.getLeaseToken(), serverLease.getOwner()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } return serverLease; @@ -301,10 +329,11 @@ public Mono renew(Lease lease) { @Override public Mono updateProperties(Lease lease) { - if (lease == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } - if (!lease.getOwner().equalsIgnoreCase(this.settings.getHostName())) - { + if (!lease.getOwner().equalsIgnoreCase(this.settings.getHostName())) { logger.info("Partition '{}' lease was taken over by owner '{}' before lease item update", lease.getLeaseToken(), lease.getOwner()); throw new LeaseLostException(lease); } @@ -316,7 +345,7 @@ public Mono updateProperties(Lease lease) { serverLease -> { if (!serverLease.getOwner().equalsIgnoreCase(lease.getOwner())) { logger.info("Partition '{}' lease was taken over by owner '{}'", lease.getLeaseToken(), serverLease.getOwner()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } serverLease.setProperties(lease.getProperties()); return serverLease; @@ -325,7 +354,9 @@ public Mono updateProperties(Lease lease) { @Override public Mono checkpoint(Lease lease, String continuationToken) { - if (lease == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } if (continuationToken == null || continuationToken.isEmpty()) { throw new IllegalArgumentException("continuationToken must be a non-empty string"); @@ -338,7 +369,7 @@ public Mono checkpoint(Lease lease, String continuationToken) { serverLease -> { if (serverLease.getOwner() != null && !serverLease.getOwner().equalsIgnoreCase(lease.getOwner())) { logger.info("Partition {} lease was taken over by owner '{}'", lease.getLeaseToken(), serverLease.getOwner()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } serverLease.setContinuationToken(continuationToken); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ObserverExceptionWrappingChangeFeedObserverDecorator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ObserverExceptionWrappingChangeFeedObserverDecorator.java index 75a2781dc680..301c5230df7d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ObserverExceptionWrappingChangeFeedObserverDecorator.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ObserverExceptionWrappingChangeFeedObserverDecorator.java @@ -7,6 +7,9 @@ import com.azure.data.cosmos.internal.changefeed.ChangeFeedObserverCloseReason; import com.azure.data.cosmos.internal.changefeed.ChangeFeedObserverContext; import com.azure.data.cosmos.internal.changefeed.exceptions.ObserverException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Mono; import java.util.List; @@ -14,49 +17,44 @@ * Exception wrapping decorator implementation for {@link ChangeFeedObserver}. */ class ObserverExceptionWrappingChangeFeedObserverDecorator implements ChangeFeedObserver { + private final Logger logger = LoggerFactory.getLogger(ObserverExceptionWrappingChangeFeedObserverDecorator.class); + private ChangeFeedObserver changeFeedObserver; - public ObserverExceptionWrappingChangeFeedObserverDecorator(ChangeFeedObserver changeFeedObserver) - { + public ObserverExceptionWrappingChangeFeedObserverDecorator(ChangeFeedObserver changeFeedObserver) { this.changeFeedObserver = changeFeedObserver; } @Override public void open(ChangeFeedObserverContext context) { - try - { + try { this.changeFeedObserver.open(context); } catch (RuntimeException userException) { - // Logger.WarnException("Exception happened on Observer.OpenAsync", userException); + this.logger.warn("Exception happened on ChangeFeedObserver.open", userException); throw new ObserverException(userException); } } @Override public void close(ChangeFeedObserverContext context, ChangeFeedObserverCloseReason reason) { - try - { + try { this.changeFeedObserver.close(context, reason); } catch (RuntimeException userException) { - // Logger.WarnException("Exception happened on Observer.CloseAsync", userException); + this.logger.warn("Exception happened on ChangeFeedObserver.close", userException); throw new ObserverException(userException); } } @Override - public void processChanges(ChangeFeedObserverContext context, List docs) { - try - { - this.changeFeedObserver.processChanges(context, docs); - } - catch (Exception userException) - { - // Logger.WarnException("Exception happened on Observer.OpenAsync", userException); - throw new ObserverException(userException); - } + public Mono processChanges(ChangeFeedObserverContext context, List docs) { + return this.changeFeedObserver.processChanges(context, docs) + .onErrorResume(throwable -> { + this.logger.warn("Exception happened on ChangeFeedObserver.processChanges", throwable); + return Mono.error(new ObserverException(throwable)); + }); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionCheckpointerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionCheckpointerImpl.java index 1aaa8fcd7ad0..894f7c17e1d1 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionCheckpointerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionCheckpointerImpl.java @@ -24,11 +24,10 @@ public PartitionCheckpointerImpl(LeaseCheckpointer leaseCheckpointer, Lease leas @Override public Mono checkpointPartition(String сontinuationToken) { - PartitionCheckpointerImpl self = this; return this.leaseCheckpointer.checkpoint(this.lease, сontinuationToken) .map(lease1 -> { - self.lease = lease1; - logger.info(String.format("Checkpoint: partition %s, new continuation %s", self.lease.getLeaseToken(), self.lease.getContinuationToken())); + this.lease = lease1; + logger.info("Checkpoint: partition {}, new continuation {}", this.lease.getLeaseToken(), this.lease.getContinuationToken()); return lease1; }) .then(); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionControllerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionControllerImpl.java index 4d346471a80d..3a3ff5708f26 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionControllerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionControllerImpl.java @@ -16,16 +16,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; /** * Implementation for {@link PartitionController}. */ class PartitionControllerImpl implements PartitionController { - private final Logger logger = LoggerFactory.getLogger(PartitionControllerImpl.class); + private static final Logger logger = LoggerFactory.getLogger(PartitionControllerImpl.class); private final Map currentlyOwnedPartitions = new ConcurrentHashMap<>(); private final LeaseContainer leaseContainer; @@ -34,20 +34,20 @@ class PartitionControllerImpl implements PartitionController { private final PartitionSynchronizer synchronizer; private CancellationTokenSource shutdownCts; - private final ExecutorService executorService; + private final Scheduler scheduler; public PartitionControllerImpl( - LeaseContainer leaseContainer, - LeaseManager leaseManager, - PartitionSupervisorFactory partitionSupervisorFactory, - PartitionSynchronizer synchronizer, - ExecutorService executorService) { + LeaseContainer leaseContainer, + LeaseManager leaseManager, + PartitionSupervisorFactory partitionSupervisorFactory, + PartitionSynchronizer synchronizer, + Scheduler scheduler) { this.leaseContainer = leaseContainer; this.leaseManager = leaseManager; this.partitionSupervisorFactory = partitionSupervisorFactory; this.synchronizer = synchronizer; - this.executorService = executorService; + this.scheduler = scheduler; } @Override @@ -57,28 +57,25 @@ public Mono initialize() { } @Override - public synchronized Mono addOrUpdateLease(Lease lease) { + public synchronized Mono addOrUpdateLease(final Lease lease) { WorkerTask workerTask = this.currentlyOwnedPartitions.get(lease.getLeaseToken()); if ( workerTask != null && workerTask.isRunning()) { - Lease updatedLease = this.leaseManager.updateProperties(lease).block(); - logger.debug(String.format("Partition %s: updated.", lease.getLeaseToken())); - return Mono.just(updatedLease); - } - - try { - Lease updatedLease = this.leaseManager.acquire(lease).block(); - if (updatedLease != null) lease = updatedLease; - - logger.info(String.format("Partition %s: acquired.", lease.getLeaseToken())); - } catch (RuntimeException ex) { - this.removeLease(lease).block(); - throw ex; + return this.leaseManager.updateProperties(lease) + .map(updatedLease -> { + logger.debug("Partition {}: updated.", updatedLease.getLeaseToken()); + return updatedLease; + }); } - PartitionSupervisor supervisor = this.partitionSupervisorFactory.create(lease); - this.currentlyOwnedPartitions.put(lease.getLeaseToken(), this.processPartition(supervisor, lease)); - - return Mono.just(lease); + return this.leaseManager.acquire(lease) + .defaultIfEmpty(lease) + .map(updatedLease -> { + logger.info("Partition {}: acquired.", updatedLease.getLeaseToken()); + PartitionSupervisor supervisor = this.partitionSupervisorFactory.create(updatedLease); + this.currentlyOwnedPartitions.put(updatedLease.getLeaseToken(), this.processPartition(supervisor, updatedLease)); + return updatedLease; + }) + .onErrorResume(throwable -> this.removeLease(lease).then(Mono.error(throwable))); } @Override @@ -91,13 +88,12 @@ public Mono shutdown() { } private Mono loadLeases() { - PartitionControllerImpl self = this; logger.debug("Starting renew leases assigned to this host on initialize."); return this.leaseContainer.getOwnedLeases() .flatMap( lease -> { - logger.info(String.format("Acquired lease for PartitionId '%s' on startup.", lease.getLeaseToken())); - return self.addOrUpdateLease(lease); + logger.info("Acquired lease for PartitionId '{}' on startup.", lease.getLeaseToken()); + return this.addOrUpdateLease(lease); }).then(); } @@ -109,12 +105,12 @@ private Mono removeLease(Lease lease) { workerTask.interrupt(); } - logger.info(String.format("Partition %s: released.", lease.getLeaseToken())); + logger.info("Partition {}: released.", lease.getLeaseToken()); } return this.leaseManager.release(lease) .onErrorResume(e -> { - logger.warn(String.format("Partition %s: failed to remove lease.", lease.getLeaseToken()), e); + logger.warn("Partition {}: failed to remove lease.", lease.getLeaseToken(), e); return Mono.empty(); } ).doOnSuccess(aVoid -> { @@ -123,8 +119,6 @@ private Mono removeLease(Lease lease) { } private WorkerTask processPartition(PartitionSupervisor partitionSupervisor, Lease lease) { - PartitionControllerImpl self = this; - CancellationToken cancellationToken = this.shutdownCts.getToken(); WorkerTask partitionSupervisorTask = new WorkerTask(lease, () -> { @@ -132,34 +126,32 @@ private WorkerTask processPartition(PartitionSupervisor partitionSupervisor, Lea .onErrorResume(throwable -> { if (throwable instanceof PartitionSplitException) { PartitionSplitException ex = (PartitionSplitException) throwable; - return self.handleSplit(lease, ex.getLastContinuation()); + return this.handleSplit(lease, ex.getLastContinuation()); } else if (throwable instanceof TaskCancelledException) { - logger.debug(String.format("Partition %s: processing canceled.", lease.getLeaseToken())); + logger.debug("Partition {}: processing canceled.", lease.getLeaseToken()); } else { - logger.warn(String.format("Partition %s: processing failed.", lease.getLeaseToken()), throwable); + logger.warn("Partition {}: processing failed.", lease.getLeaseToken(), throwable); } return Mono.empty(); }) - .then(self.removeLease(lease)).subscribe(); + .then(this.removeLease(lease)).subscribe(); }); - this.executorService.execute(partitionSupervisorTask); + this.scheduler.schedule(partitionSupervisorTask); return partitionSupervisorTask; } private Mono handleSplit(Lease lease, String lastContinuationToken) { - PartitionControllerImpl self = this; - lease.setContinuationToken(lastContinuationToken); return this.synchronizer.splitPartition(lease) .flatMap(l -> { l.setProperties(lease.getProperties()); - return self.addOrUpdateLease(l); - }).then(self.leaseManager.delete(lease)) + return this.addOrUpdateLease(l); + }).then(this.leaseManager.delete(lease)) .onErrorResume(throwable -> { - logger.warn(String.format("partition %s: failed to split", lease.getLeaseToken()), throwable); + logger.warn("Partition {}: failed to split", lease.getLeaseToken(), throwable); return Mono.empty(); }); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java index d95c2a9d0707..7884440f5468 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java @@ -11,11 +11,13 @@ import com.azure.data.cosmos.internal.changefeed.PartitionLoadBalancingStrategy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; import java.time.Duration; +import java.time.ZonedDateTime; import java.util.List; -import java.util.concurrent.ExecutorService; /** * Implementation for {@link PartitionLoadBalancer}. @@ -26,7 +28,7 @@ class PartitionLoadBalancerImpl implements PartitionLoadBalancer { private final LeaseContainer leaseContainer; private final PartitionLoadBalancingStrategy partitionLoadBalancingStrategy; private final Duration leaseAcquireInterval; - private final ExecutorService executorService; + private final Scheduler scheduler; private CancellationTokenSource cancellationTokenSource; @@ -35,22 +37,33 @@ class PartitionLoadBalancerImpl implements PartitionLoadBalancer { private final Object lock; public PartitionLoadBalancerImpl( - PartitionController partitionController, - LeaseContainer leaseContainer, - PartitionLoadBalancingStrategy partitionLoadBalancingStrategy, - Duration leaseAcquireInterval, - ExecutorService executorService) { + PartitionController partitionController, + LeaseContainer leaseContainer, + PartitionLoadBalancingStrategy partitionLoadBalancingStrategy, + Duration leaseAcquireInterval, + Scheduler scheduler) { - if (partitionController == null) throw new IllegalArgumentException("partitionController"); - if (leaseContainer == null) throw new IllegalArgumentException("leaseContainer"); - if (partitionLoadBalancingStrategy == null) throw new IllegalArgumentException("partitionLoadBalancingStrategy"); - if (executorService == null) throw new IllegalArgumentException("executorService"); + if (partitionController == null) { + throw new IllegalArgumentException("partitionController"); + } + + if (leaseContainer == null) { + throw new IllegalArgumentException("leaseContainer"); + } + + if (partitionLoadBalancingStrategy == null) { + throw new IllegalArgumentException("partitionLoadBalancingStrategy"); + } + + if (scheduler == null) { + throw new IllegalArgumentException("executorService"); + } this.partitionController = partitionController; this.leaseContainer = leaseContainer; this.partitionLoadBalancingStrategy = partitionLoadBalancingStrategy; this.leaseAcquireInterval = leaseAcquireInterval; - this.executorService = executorService; + this.scheduler = scheduler; this.started = false; this.lock = new Object(); @@ -58,66 +71,68 @@ public PartitionLoadBalancerImpl( @Override public Mono start() { - PartitionLoadBalancerImpl self = this; - - return Mono.fromRunnable( () -> { - synchronized (lock) { - if (this.started) { - throw new IllegalStateException("Partition load balancer already started"); - } - - this.started = true; - this.cancellationTokenSource = new CancellationTokenSource(); + synchronized (lock) { + if (this.started) { + throw new IllegalStateException("Partition load balancer already started"); } - CancellationToken cancellationToken = this.cancellationTokenSource.getToken(); + this.started = true; + this.cancellationTokenSource = new CancellationTokenSource(); + } - this.executorService.execute(() -> self.run(cancellationToken).block()); + return Mono.fromRunnable( () -> { + scheduler.schedule(() -> this.run(this.cancellationTokenSource.getToken()).subscribe()); }); } @Override public Mono stop() { - return Mono.fromRunnable( () -> { - synchronized (lock) { - this.started = false; - this.cancellationTokenSource.cancel(); - } + synchronized (lock) { + this.started = false; + this.cancellationTokenSource.cancel(); + } - this.partitionController.shutdown().block(); - this.cancellationTokenSource = null; - }); + return this.partitionController.shutdown(); } private Mono run(CancellationToken cancellationToken) { - PartitionLoadBalancerImpl self = this; - - return Mono.fromRunnable( () -> { - try { - while (!cancellationToken.isCancellationRequested()) { - List allLeases = self.leaseContainer.getAllLeases().collectList().block(); - List leasesToTake = self.partitionLoadBalancingStrategy.selectLeasesToTake(allLeases); - for (Lease lease : leasesToTake) { - self.partitionController.addOrUpdateLease(lease).block(); - } - - long remainingWork = this.leaseAcquireInterval.toMillis(); - - try { - while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { - Thread.sleep(100); - remainingWork -= 100; - } - } catch (InterruptedException ex) { - // exception caught - logger.warn("Partition load balancer caught an interrupted exception", ex); - } - } - } catch (Exception ex) { + return Flux.just(this) + .flatMap(value -> this.leaseContainer.getAllLeases()) + .collectList() + .flatMap(allLeases -> { + if (cancellationToken.isCancellationRequested()) return Mono.empty(); + List leasesToTake = this.partitionLoadBalancingStrategy.selectLeasesToTake(allLeases); + + if (cancellationToken.isCancellationRequested()) return Mono.empty(); + return Flux.fromIterable(leasesToTake) + .flatMap(lease -> { + if (cancellationToken.isCancellationRequested()) return Mono.empty(); + return this.partitionController.addOrUpdateLease(lease); + }) + .then(Mono.just(this) + .flatMap(value -> { + if (cancellationToken.isCancellationRequested()) { + return Mono.empty(); + } + + ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.leaseAcquireInterval); + return Mono.just(value) + .delayElement(Duration.ofMillis(100)) + .repeat( () -> { + ZonedDateTime currentTime = ZonedDateTime.now(); + return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); + }).last(); + }) + ); + }) + .repeat(() -> { + return !cancellationToken.isCancellationRequested(); + }) + .then() + .onErrorResume(throwable -> { // We should not get here. logger.info("Partition load balancer task stopped."); - this.stop(); - } - }); + return this.stop(); + }); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionManagerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionManagerImpl.java index 4f8e2903977a..69a6695b6cc7 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionManagerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionManagerImpl.java @@ -24,16 +24,13 @@ public PartitionManagerImpl(Bootstrapper bootstrapper, PartitionController parti @Override public Mono start() { - PartitionManagerImpl self = this; - - return self.bootstrapper.initialize() - .then(self.partitionController.initialize()) - .then(self.partitionLoadBalancer.start()); + return this.bootstrapper.initialize() + .then(this.partitionController.initialize()) + .then(this.partitionLoadBalancer.start()); } @Override public Mono stop() { - PartitionManagerImpl self = this; - return self.partitionLoadBalancer.stop(); + return this.partitionLoadBalancer.stop(); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorFactoryImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorFactoryImpl.java index 5801b71250ed..e508129d91f8 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorFactoryImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorFactoryImpl.java @@ -23,15 +23,26 @@ class PartitionProcessorFactoryImpl implements PartitionProcessorFactory { private final CosmosContainer collectionSelfLink; public PartitionProcessorFactoryImpl( - ChangeFeedContextClient documentClient, - ChangeFeedProcessorOptions changeFeedProcessorOptions, - LeaseCheckpointer leaseCheckpointer, - CosmosContainer collectionSelfLink) { + ChangeFeedContextClient documentClient, + ChangeFeedProcessorOptions changeFeedProcessorOptions, + LeaseCheckpointer leaseCheckpointer, + CosmosContainer collectionSelfLink) { - if (documentClient == null) throw new IllegalArgumentException("documentClient"); - if (changeFeedProcessorOptions == null) throw new IllegalArgumentException("changeFeedProcessorOptions"); - if (leaseCheckpointer == null) throw new IllegalArgumentException("leaseCheckpointer"); - if (collectionSelfLink == null) throw new IllegalArgumentException("collectionSelfLink"); + if (documentClient == null) { + throw new IllegalArgumentException("documentClient"); + } + + if (changeFeedProcessorOptions == null) { + throw new IllegalArgumentException("changeFeedProcessorOptions"); + } + + if (leaseCheckpointer == null) { + throw new IllegalArgumentException("leaseCheckpointer"); + } + + if (collectionSelfLink == null) { + throw new IllegalArgumentException("collectionSelfLink"); + } this.documentClient = documentClient; this.changeFeedProcessorOptions = changeFeedProcessorOptions; @@ -41,8 +52,13 @@ public PartitionProcessorFactoryImpl( @Override public PartitionProcessor create(Lease lease, ChangeFeedObserver observer) { - if (observer == null) throw new IllegalArgumentException("observer"); - if (lease == null) throw new IllegalArgumentException("lease"); + if (observer == null) { + throw new IllegalArgumentException("observer"); + } + + if (lease == null) { + throw new IllegalArgumentException("lease"); + } String startContinuation = lease.getContinuationToken(); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorImpl.java index 68a1d1ce81dd..7b5564186bf1 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorImpl.java @@ -16,6 +16,10 @@ import com.azure.data.cosmos.internal.changefeed.exceptions.PartitionNotFoundException; import com.azure.data.cosmos.internal.changefeed.exceptions.PartitionSplitException; import com.azure.data.cosmos.internal.changefeed.exceptions.TaskCancelledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.Exceptions; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.time.Duration; @@ -27,14 +31,15 @@ * Implementation for {@link PartitionProcessor}. */ class PartitionProcessorImpl implements PartitionProcessor { + private static final Logger logger = LoggerFactory.getLogger(PartitionProcessorImpl.class); + private static final int DefaultMaxItemCount = 100; - // private final Observable> query; private final ProcessorSettings settings; private final PartitionCheckpointer checkpointer; private final ChangeFeedObserver observer; private final ChangeFeedOptions options; private final ChangeFeedContextClient documentClient; - private RuntimeException resultException; + private volatile RuntimeException resultException; private String lastContinuation; @@ -51,83 +56,90 @@ public PartitionProcessorImpl(ChangeFeedObserver observer, ChangeFeedContextClie this.options.startFromBeginning(settings.isStartFromBeginning()); this.options.requestContinuation(settings.getStartContinuation()); this.options.startDateTime(settings.getStartTime()); - - //this.query = documentClient.createDocumentChangeFeedQuery(self.properties.getCollectionSelfLink(), this.options); } @Override public Mono run(CancellationToken cancellationToken) { - PartitionProcessorImpl self = this; this.lastContinuation = this.settings.getStartContinuation(); - return Mono.fromRunnable( () -> { - while (!cancellationToken.isCancellationRequested()) { - Duration delay = self.settings.getFeedPollDelay(); + this.options.requestContinuation(this.lastContinuation); - try { - self.options.requestContinuation(self.lastContinuation); - List> documentFeedResponseList = self.documentClient.createDocumentChangeFeedQuery(self.settings.getCollectionSelfLink(), self.options) - .collectList() - .block(); - - for (FeedResponse documentFeedResponse : documentFeedResponseList) { - self.lastContinuation = documentFeedResponse.continuationToken(); - if (documentFeedResponse.results() != null && documentFeedResponse.results().size() > 0) { - self.dispatchChanges(documentFeedResponse); - } + return Flux.just(this) + .flatMap(value -> this.documentClient.createDocumentChangeFeedQuery(this.settings.getCollectionSelfLink(), this.options) + .limitRequest(1) + ) + .flatMap(documentFeedResponse -> { + if (cancellationToken.isCancellationRequested()) return Flux.error(new TaskCancelledException()); - self.options.requestContinuation(self.lastContinuation); + this.lastContinuation = documentFeedResponse.continuationToken(); + if (documentFeedResponse.results() != null && documentFeedResponse.results().size() > 0) { + return this.dispatchChanges(documentFeedResponse) + .doFinally( (Void) -> { + this.options.requestContinuation(this.lastContinuation); - if (cancellationToken.isCancellationRequested()) { - // Observation was cancelled. - throw new TaskCancelledException(); - } - } + if (cancellationToken.isCancellationRequested()) throw new TaskCancelledException(); + }).flux(); + } + this.options.requestContinuation(this.lastContinuation); - if (this.options.maxItemCount().compareTo(this.settings.getMaxItemCount()) == 0) { - this.options.maxItemCount(this.settings.getMaxItemCount()); // Reset after successful execution. - } - } catch (RuntimeException ex) { - if (ex.getCause() instanceof CosmosClientException) { + if (cancellationToken.isCancellationRequested()) { + return Flux.error(new TaskCancelledException()); + } - CosmosClientException clientException = (CosmosClientException) ex.getCause(); - // this.logger.WarnException("exception: partition '{0}'", clientException, this.properties.PartitionKeyRangeId); - StatusCodeErrorType docDbError = ExceptionClassifier.classifyClientException(clientException); + return Flux.empty(); + }) + .doOnComplete(() -> { + if (this.options.maxItemCount().compareTo(this.settings.getMaxItemCount()) != 0) { + this.options.maxItemCount(this.settings.getMaxItemCount()); // Reset after successful execution. + } + }) + .onErrorResume(throwable -> { + if (throwable instanceof CosmosClientException) { - switch (docDbError) { - case PARTITION_NOT_FOUND: { - self.resultException = new PartitionNotFoundException("Partition not found.", self.lastContinuation); - } - case PARTITION_SPLIT: { - self.resultException = new PartitionSplitException("Partition split.", self.lastContinuation); - } - case UNDEFINED: { - self.resultException = ex; - } - case MAX_ITEM_COUNT_TOO_LARGE: { - if (this.options.maxItemCount() == null) { - this.options.maxItemCount(DefaultMaxItemCount); - } else if (this.options.maxItemCount() <= 1) { - // this.logger.ErrorFormat("Cannot reduce maxItemCount further as it's already at {0}.", this.options.MaxItemCount); - throw ex; - } - - this.options.maxItemCount(this.options.maxItemCount() / 2); - // this.logger.WarnFormat("Reducing maxItemCount, new value: {0}.", this.options.MaxItemCount); - break; - } - default: { - // this.logger.Fatal($"Unrecognized DocDbError enum value {docDbError}"); - // Debug.Fail($"Unrecognized DocDbError enum value {docDbError}"); - self.resultException = ex; + CosmosClientException clientException = (CosmosClientException) throwable; + this.logger.warn("Exception: partition {}", this.options.partitionKey().getInternalPartitionKey(), clientException); + StatusCodeErrorType docDbError = ExceptionClassifier.classifyClientException(clientException); + + switch (docDbError) { + case PARTITION_NOT_FOUND: { + this.resultException = new PartitionNotFoundException("Partition not found.", this.lastContinuation); + } + case PARTITION_SPLIT: { + this.resultException = new PartitionSplitException("Partition split.", this.lastContinuation); + } + case UNDEFINED: { + this.resultException = new RuntimeException(clientException); + } + case MAX_ITEM_COUNT_TOO_LARGE: { + if (this.options.maxItemCount() == null) { + this.options.maxItemCount(DefaultMaxItemCount); + } else if (this.options.maxItemCount() <= 1) { + this.logger.error("Cannot reduce maxItemCount further as it's already at {}", this.options.maxItemCount(), clientException); + this.resultException = new RuntimeException(clientException); } + + this.options.maxItemCount(this.options.maxItemCount() / 2); + this.logger.warn("Reducing maxItemCount, new value: {}", this.options.maxItemCount()); + return Flux.empty(); + } + default: { + this.logger.error("Unrecognized DocDbError enum value {}", docDbError, clientException); + this.resultException = new RuntimeException(clientException); } - } else if (ex instanceof TaskCancelledException) { - // this.logger.WarnException("exception: partition '{0}'", canceledException, this.properties.PartitionKeyRangeId); - self.resultException = ex; } + } else if (throwable instanceof TaskCancelledException) { + this.logger.warn("Exception: partition {}", this.settings.getPartitionKeyRangeId(), throwable); + this.resultException = (TaskCancelledException) throwable; + } + return Flux.error(throwable); + }) + .repeat(() -> { + if (cancellationToken.isCancellationRequested()) { + this.resultException = new TaskCancelledException(); + return false; } + Duration delay = this.settings.getFeedPollDelay(); long remainingWork = delay.toMillis(); try { @@ -137,9 +149,18 @@ public Mono run(CancellationToken cancellationToken) { } } catch (InterruptedException iex) { // exception caught + return false; } - } - }); + + if (cancellationToken.isCancellationRequested()) { + this.resultException = new TaskCancelledException(); + return false; + } + + return true; + }) + .onErrorResume(throwable -> Flux.empty()) + .then(); } @Override @@ -147,9 +168,10 @@ public RuntimeException getResultException() { return this.resultException; } - private void dispatchChanges(FeedResponse response) { + private Mono dispatchChanges(FeedResponse response) { ChangeFeedObserverContext context = new ChangeFeedObserverContextImpl(this.settings.getPartitionKeyRangeId(), response, this.checkpointer); this.observer.processChanges(context, response.results()); + return Mono.empty(); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorFactoryImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorFactoryImpl.java index 8ba904934348..e6101e43b80d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorFactoryImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorFactoryImpl.java @@ -12,6 +12,7 @@ import com.azure.data.cosmos.internal.changefeed.PartitionProcessorFactory; import com.azure.data.cosmos.internal.changefeed.PartitionSupervisor; import com.azure.data.cosmos.internal.changefeed.PartitionSupervisorFactory; +import reactor.core.scheduler.Scheduler; import java.util.concurrent.ExecutorService; @@ -23,35 +24,49 @@ class PartitionSupervisorFactoryImpl implements PartitionSupervisorFactory { private final LeaseManager leaseManager; private final ChangeFeedProcessorOptions changeFeedProcessorOptions; private final PartitionProcessorFactory partitionProcessorFactory; - private final ExecutorService executorService; + private final Scheduler scheduler; public PartitionSupervisorFactoryImpl( - ChangeFeedObserverFactory observerFactory, - LeaseManager leaseManager, - PartitionProcessorFactory partitionProcessorFactory, - ChangeFeedProcessorOptions options, - ExecutorService executorService) { - if (observerFactory == null) throw new IllegalArgumentException("observerFactory"); - if (leaseManager == null) throw new IllegalArgumentException("leaseManager"); - if (options == null) throw new IllegalArgumentException("options"); - if (partitionProcessorFactory == null) throw new IllegalArgumentException("partitionProcessorFactory"); + ChangeFeedObserverFactory observerFactory, + LeaseManager leaseManager, + PartitionProcessorFactory partitionProcessorFactory, + ChangeFeedProcessorOptions options, + Scheduler scheduler) { + + if (observerFactory == null) { + throw new IllegalArgumentException("observerFactory"); + } + + if (leaseManager == null) { + throw new IllegalArgumentException("leaseManager"); + } + + if (options == null) { + throw new IllegalArgumentException("options"); + } + + if (partitionProcessorFactory == null) { + throw new IllegalArgumentException("partitionProcessorFactory"); + } this.observerFactory = observerFactory; this.leaseManager = leaseManager; this.changeFeedProcessorOptions = options; this.partitionProcessorFactory = partitionProcessorFactory; - this.executorService = executorService; + this.scheduler = scheduler; } @Override public PartitionSupervisor create(Lease lease) { - if (lease == null) throw new IllegalArgumentException("lease"); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } ChangeFeedObserver changeFeedObserver = this.observerFactory.createObserver(); PartitionProcessor processor = this.partitionProcessorFactory.create(lease, changeFeedObserver); LeaseRenewer renewer = new LeaseRenewerImpl(lease, this.leaseManager, this.changeFeedProcessorOptions.leaseRenewInterval()); - return new PartitionSupervisorImpl(lease, changeFeedObserver, processor, renewer, this.executorService); + return new PartitionSupervisorImpl(lease, changeFeedObserver, processor, renewer, this.scheduler); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorImpl.java index 7e4831e56e6e..3bbf420c16df 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorImpl.java @@ -16,11 +16,12 @@ import com.azure.data.cosmos.internal.changefeed.exceptions.PartitionSplitException; import com.azure.data.cosmos.internal.changefeed.exceptions.TaskCancelledException; import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; +import reactor.core.scheduler.Schedulers; import java.io.Closeable; import java.io.IOException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; +import java.time.Duration; /** * Implementation for {@link PartitionSupervisor}. @@ -33,72 +34,61 @@ class PartitionSupervisorImpl implements PartitionSupervisor, Closeable { private CancellationTokenSource renewerCancellation; private CancellationTokenSource processorCancellation; - private RuntimeException resultException; + private volatile RuntimeException resultException; - private ExecutorService executorService; + private Scheduler scheduler; - public PartitionSupervisorImpl(Lease lease, ChangeFeedObserver observer, PartitionProcessor processor, LeaseRenewer renewer, ExecutorService executorService) { + public PartitionSupervisorImpl(Lease lease, ChangeFeedObserver observer, PartitionProcessor processor, LeaseRenewer renewer, Scheduler scheduler) { this.lease = lease; this.observer = observer; this.processor = processor; this.renewer = renewer; - this.executorService = executorService; + this.scheduler = scheduler; - if (executorService == null) { - this.executorService = Executors.newFixedThreadPool(3); + if (scheduler == null) { + this.scheduler = Schedulers.elastic(); } } @Override public Mono run(CancellationToken shutdownToken) { - PartitionSupervisorImpl self = this; this.resultException = null; - ChangeFeedObserverContext context = new ChangeFeedObserverContextImpl(self.lease.getLeaseToken()); + ChangeFeedObserverContext context = new ChangeFeedObserverContextImpl(this.lease.getLeaseToken()); - self.observer.open(context); + this.observer.open(context); + this.processorCancellation = new CancellationTokenSource(); + + this.scheduler.schedule(() -> this.processor.run(this.processorCancellation.getToken()) + .subscribe()); + + this.renewerCancellation = new CancellationTokenSource(); + + this.scheduler.schedule(() -> this.renewer.run(this.renewerCancellation.getToken()) + .subscribe()); + + return Mono.just(this) + .delayElement(Duration.ofMillis(100)) + .repeat( () -> !shutdownToken.isCancellationRequested() && this.processor.getResultException() == null && this.renewer.getResultException() == null) + .last() + .flatMap( value -> this.afterRun(context, shutdownToken)); + } + + private Mono afterRun(ChangeFeedObserverContext context, CancellationToken shutdownToken) { ChangeFeedObserverCloseReason closeReason = ChangeFeedObserverCloseReason.UNKNOWN; try { - self.processorCancellation = new CancellationTokenSource(); - - Thread processorThread = new Thread(new Runnable() { - @Override - public void run() { - self.processor.run(self.processorCancellation.getToken()).block(); - } - }); - - self.renewerCancellation = new CancellationTokenSource(); - - Thread renewerThread = new Thread(new Runnable() { - @Override - public void run() { - self.renewer.run(self.renewerCancellation.getToken()).block(); - } - }); - - self.executorService.execute(processorThread); - self.executorService.execute(renewerThread); - - while (!shutdownToken.isCancellationRequested() && self.processor.getResultException() == null && self.renewer.getResultException() == null) { - try { - Thread.sleep(100); - } catch (InterruptedException iex) { - break; - } - } this.processorCancellation.cancel(); this.renewerCancellation.cancel(); - if (self.processor.getResultException() != null) { - throw self.processor.getResultException(); + if (this.processor.getResultException() != null) { + throw this.processor.getResultException(); } - if (self.renewer.getResultException() != null) { - throw self.renewer.getResultException(); + if (this.renewer.getResultException() != null) { + throw this.renewer.getResultException(); } closeReason = shutdownToken.isCancellationRequested() ? @@ -107,24 +97,24 @@ public void run() { } catch (LeaseLostException llex) { closeReason = ChangeFeedObserverCloseReason.LEASE_LOST; - self.resultException = llex; + this.resultException = llex; } catch (PartitionSplitException pex) { closeReason = ChangeFeedObserverCloseReason.LEASE_GONE; - self.resultException = pex; + this.resultException = pex; } catch (TaskCancelledException tcex) { closeReason = ChangeFeedObserverCloseReason.SHUTDOWN; - self.resultException = null; + this.resultException = null; } catch (ObserverException oex) { closeReason = ChangeFeedObserverCloseReason.OBSERVER_ERROR; - self.resultException = oex; + this.resultException = oex; } catch (Exception ex) { closeReason = ChangeFeedObserverCloseReason.UNKNOWN; } finally { - self.observer.close(context, closeReason); + this.observer.close(context, closeReason); } - if (self.resultException != null) { - return Mono.error(self.resultException); + if (this.resultException != null) { + return Mono.error(this.resultException); } else { return Mono.empty(); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSynchronizerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSynchronizerImpl.java index 951a2b584544..8811f075c514 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSynchronizerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSynchronizerImpl.java @@ -33,13 +33,13 @@ class PartitionSynchronizerImpl implements PartitionSynchronizer { private final int maxBatchSize; public PartitionSynchronizerImpl( - ChangeFeedContextClient documentClient, - CosmosContainer collectionSelfLink, - LeaseContainer leaseContainer, - LeaseManager leaseManager, - int degreeOfParallelism, - int maxBatchSize) - { + ChangeFeedContextClient documentClient, + CosmosContainer collectionSelfLink, + LeaseContainer leaseContainer, + LeaseManager leaseManager, + int degreeOfParallelism, + int maxBatchSize) { + this.documentClient = documentClient; this.collectionSelfLink = collectionSelfLink; this.leaseContainer = leaseContainer; @@ -50,8 +50,6 @@ public PartitionSynchronizerImpl( @Override public Mono createMissingLeases() { - PartitionSynchronizerImpl self = this; - return this.enumPartitionKeyRanges() .map(partitionKeyRange -> { // TODO: log the partition key ID found. @@ -60,7 +58,7 @@ public Mono createMissingLeases() { .collectList() .flatMap( partitionKeyRangeIds -> { Set leaseTokens = new HashSet<>(partitionKeyRangeIds); - return self.createLeases(leaseTokens).then(); + return this.createLeases(leaseTokens).then(); }) .onErrorResume( throwable -> { // TODO: log the exception. @@ -70,13 +68,14 @@ public Mono createMissingLeases() { @Override public Flux splitPartition(Lease lease) { - if (lease == null) throw new IllegalArgumentException("lease"); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } - PartitionSynchronizerImpl self = this; String leaseToken = lease.getLeaseToken(); String lastContinuationToken = lease.getContinuationToken(); - logger.info(String.format("Partition %s is gone due to split.", leaseToken)); + logger.info("Partition {} is gone due to split.", leaseToken); // After a split, the children are either all or none available return this.enumPartitionKeyRanges() @@ -85,23 +84,22 @@ public Flux splitPartition(Lease lease) { .collectList() .flatMapMany(addedLeaseTokens -> { if (addedLeaseTokens.size() == 0) { - logger.error(String.format("Partition %s had split but we failed to find at least one child partition", leaseToken)); + logger.error("Partition {} had split but we failed to find at least one child partition", leaseToken); throw new RuntimeException(String.format("Partition %s had split but we failed to find at least one child partition", leaseToken)); } return Flux.fromIterable(addedLeaseTokens); }) .flatMap(addedRangeId -> { // Creating new lease. - return self.leaseManager.createLeaseIfNotExist(addedRangeId, lastContinuationToken); - }, self.degreeOfParallelism) + return this.leaseManager.createLeaseIfNotExist(addedRangeId, lastContinuationToken); + }, this.degreeOfParallelism) .map(newLease -> { - logger.info(String.format("Partition %s split into new partition with lease token %s.", leaseToken, newLease.getLeaseToken())); + logger.info("Partition {} split into new partition with lease token {}.", leaseToken, newLease.getLeaseToken()); return newLease; }); } private Flux enumPartitionKeyRanges() { - // STRING partitionKeyRangesPath = STRING.format("%spkranges", this.collectionSelfLink); String partitionKeyRangesPath = extractContainerSelfLink(this.collectionSelfLink); FeedOptions feedOptions = new FeedOptions(); feedOptions.maxItemCount(this.maxBatchSize); @@ -129,7 +127,6 @@ private Flux enumPartitionKeyRanges() { */ private Flux createLeases(Set leaseTokens) { - PartitionSynchronizerImpl self = this; Set addedLeaseTokens = new HashSet<>(leaseTokens); return this.leaseContainer.getAllLeases() @@ -144,7 +141,7 @@ private Flux createLeases(Set leaseTokens) }) .thenMany(Flux.fromIterable(addedLeaseTokens) .flatMap( addedRangeId -> - self.leaseManager.createLeaseIfNotExist(addedRangeId, null), self.degreeOfParallelism) + this.leaseManager.createLeaseIfNotExist(addedRangeId, null), this.degreeOfParallelism) .map( lease -> { // TODO: log the lease info that was added. return lease; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingPartitionWorkImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingPartitionWorkImpl.java index e0b83b0d9d4a..5e1da46ec0ea 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingPartitionWorkImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingPartitionWorkImpl.java @@ -18,7 +18,9 @@ class RemainingPartitionWorkImpl implements RemainingPartitionWork { * @param remainingWork the amount of documents remaining to be processed. */ public RemainingPartitionWorkImpl(String partitionKeyRangeId, long remainingWork) { - if (partitionKeyRangeId == null || partitionKeyRangeId.isEmpty()) throw new IllegalArgumentException("partitionKeyRangeId"); + if (partitionKeyRangeId == null || partitionKeyRangeId.isEmpty()) { + throw new IllegalArgumentException("partitionKeyRangeId"); + } this.partitionKeyRangeId = partitionKeyRangeId; this.remainingWork = remainingWork; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingWorkEstimatorImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingWorkEstimatorImpl.java index 4f5341aedc5b..fd2511242a9c 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingWorkEstimatorImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingWorkEstimatorImpl.java @@ -27,10 +27,21 @@ public RemainingWorkEstimatorImpl( String collectionSelfLink, int degreeOfParallelism) { - if (leaseContainer == null) throw new IllegalArgumentException("leaseContainer"); - if (collectionSelfLink == null || collectionSelfLink.isEmpty()) throw new IllegalArgumentException("collectionSelfLink"); - if (feedDocumentClient == null) throw new IllegalArgumentException("feedDocumentClient"); - if (degreeOfParallelism < 1) throw new IllegalArgumentException("degreeOfParallelism - Degree of parallelism is out of range"); + if (leaseContainer == null) { + throw new IllegalArgumentException("leaseContainer"); + } + + if (collectionSelfLink == null || collectionSelfLink.isEmpty()) { + throw new IllegalArgumentException("collectionSelfLink"); + } + + if (feedDocumentClient == null) { + throw new IllegalArgumentException("feedDocumentClient"); + } + + if (degreeOfParallelism < 1) { + throw new IllegalArgumentException("degreeOfParallelism - Degree of parallelism is out of range"); + } this.leaseContainer = leaseContainer; this.collectionSelfLink = collectionSelfLink; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/TraceHealthMonitor.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/TraceHealthMonitor.java index 4bfc6e433c02..e4be68a9bd05 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/TraceHealthMonitor.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/TraceHealthMonitor.java @@ -17,7 +17,7 @@ class TraceHealthMonitor implements HealthMonitor { public Mono inspect(HealthMonitoringRecord record) { return Mono.fromRunnable(() -> { if (record.getSeverity() == HealthMonitoringRecord.HealthSeverity.ERROR) { - logger.error(String.format("Unhealthiness detected in the operation %s for %s.", record.operation.name(), record.lease.getId()), record.throwable); + logger.error("Unhealthiness detected in the operation {} for {}.", record.operation.name(), record.lease.getId(), record.throwable); } }); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java index 8b0951801807..52007f9e426e 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java @@ -7,7 +7,6 @@ import com.azure.data.cosmos.internal.RxDocumentServiceRequest; import com.azure.data.cosmos.internal.UserAgentContainer; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdEndpoint; -import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdMetrics; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdObjectMapper; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdRequestArgs; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdRequestRecord; @@ -16,6 +15,8 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.google.common.base.Strings; +import io.micrometer.core.instrument.Tag; import io.netty.handler.ssl.SslContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,27 +38,30 @@ public final class RntbdTransportClient extends TransportClient { // region Fields + private static final String TAG_NAME = RntbdTransportClient.class.getSimpleName(); + private static final AtomicLong instanceCount = new AtomicLong(); private static final Logger logger = LoggerFactory.getLogger(RntbdTransportClient.class); - private static final String namePrefix = RntbdTransportClient.class.getSimpleName() + '-'; private final AtomicBoolean closed = new AtomicBoolean(); private final RntbdEndpoint.Provider endpointProvider; - private final RntbdMetrics metrics; - private final String name; + private final long id; + private final Tag tag; // endregion // region Constructors RntbdTransportClient(final RntbdEndpoint.Provider endpointProvider) { - this.name = RntbdTransportClient.namePrefix + RntbdTransportClient.instanceCount.incrementAndGet(); this.endpointProvider = endpointProvider; - this.metrics = new RntbdMetrics(this.name); + this.id = instanceCount.incrementAndGet(); + this.tag = RntbdTransportClient.tag(this.id); } RntbdTransportClient(final Options options, final SslContext sslContext) { - this(new RntbdServiceEndpoint.Provider(options, sslContext)); + this.endpointProvider = new RntbdServiceEndpoint.Provider(this, options, sslContext); + this.id = instanceCount.incrementAndGet(); + this.tag = RntbdTransportClient.tag(this.id); } RntbdTransportClient(final Configs configs, final int requestTimeoutInSeconds, final UserAgentContainer userAgent) { @@ -66,6 +70,30 @@ public final class RntbdTransportClient extends TransportClient { // endregion + // region Accessors + + public int endpointCount() { + return this.endpointProvider.count(); + } + + public int endpointEvictionCount() { + return this.endpointProvider.evictions(); + } + + public long id() { + return this.id; + } + + public boolean isClosed() { + return this.closed.get(); + } + + public Tag tag() { + return this.tag; + } + + // endregion + // region Methods @Override @@ -75,7 +103,6 @@ public void close() { if (this.closed.compareAndSet(false, true)) { this.endpointProvider.close(); - this.metrics.close(); return; } @@ -90,24 +117,11 @@ public Mono invokeStoreAsync(final URI physicalAddress, final RxD this.throwIfClosed(); final RntbdRequestArgs requestArgs = new RntbdRequestArgs(request, physicalAddress); - - if (logger.isDebugEnabled()) { - requestArgs.traceOperation(logger, null, "invokeStoreAsync"); - logger.debug("\n [{}]\n {}\n INVOKE_STORE_ASYNC", this, requestArgs); - } + requestArgs.traceOperation(logger, null, "invokeStoreAsync"); final RntbdEndpoint endpoint = this.endpointProvider.get(physicalAddress); - this.metrics.incrementRequestCount(); - final RntbdRequestRecord requestRecord = endpoint.request(requestArgs); - requestRecord.whenComplete((response, error) -> { - this.metrics.incrementResponseCount(); - if (error != null) { - this.metrics.incrementErrorResponseCount(); - } - }); - return Mono.fromFuture(requestRecord).doFinally(signal -> { if (signal == SignalType.CANCEL) { requestRecord.cancel(false); @@ -117,7 +131,7 @@ public Mono invokeStoreAsync(final URI physicalAddress, final RxD @Override public String toString() { - return RntbdObjectMapper.toJson(this); + return RntbdObjectMapper.toString(this); } private void throwIfClosed() { @@ -126,37 +140,40 @@ private void throwIfClosed() { // endregion + // region Privates + + private static Tag tag(long id) { + return Tag.of(TAG_NAME, Strings.padStart(Long.toHexString(id).toUpperCase(), 4, '0')); + } + + // endregion + // region Types static final class JsonSerializer extends StdSerializer { public JsonSerializer() { - this(null); - } - - public JsonSerializer(Class type) { - super(type); + super(RntbdTransportClient.class); } @Override public void serialize(RntbdTransportClient value, JsonGenerator generator, SerializerProvider provider) throws IOException { generator.writeStartObject(); - - generator.writeArrayFieldStart(value.name); + generator.writeNumberField("id", value.id()); + generator.writeBooleanField("isClosed", value.isClosed()); + generator.writeObjectField("configuration", value.endpointProvider.config()); + generator.writeArrayFieldStart("serviceEndpoints"); value.endpointProvider.list().forEach(endpoint -> { try { generator.writeObject(endpoint); } catch (IOException error) { - logger.error("failed to serialize {} due to ", endpoint.getName(), error); + logger.error("failed to serialize instance {} due to:", value.id(), error); } }); generator.writeEndArray(); - - generator.writeObjectField("config", value.endpointProvider.config()); - generator.writeObjectField("metrics", value.metrics); generator.writeEndObject(); } } @@ -165,14 +182,19 @@ public static final class Options { // region Fields + private final int bufferPageSize; private final String certificateHostNameOverride; + private final Duration connectionTimeout; + private final Duration idleChannelTimeout; + private final Duration idleEndpointTimeout; + private final int maxBufferCapacity; private final int maxChannelsPerEndpoint; private final int maxRequestsPerChannel; - private final Duration connectionTimeout; private final int partitionCount; private final Duration receiveHangDetectionTime; private final Duration requestTimeout; private final Duration sendHangDetectionTime; + private final Duration shutdownTimeout; private final UserAgentContainer userAgent; // endregion @@ -180,15 +202,19 @@ public static final class Options { // region Constructors private Options(Builder builder) { - + this.bufferPageSize = builder.bufferPageSize; this.certificateHostNameOverride = builder.certificateHostNameOverride; + this.connectionTimeout = builder.connectionTimeout == null ? builder.requestTimeout : builder.connectionTimeout; + this.idleChannelTimeout = builder.idleChannelTimeout; + this.idleEndpointTimeout = builder.idleEndpointTimeout; + this.maxBufferCapacity = builder.maxBufferCapacity; this.maxChannelsPerEndpoint = builder.maxChannelsPerEndpoint; this.maxRequestsPerChannel = builder.maxRequestsPerChannel; - this.connectionTimeout = builder.connectionTimeout == null ? builder.requestTimeout : builder.connectionTimeout; this.partitionCount = builder.partitionCount; - this.requestTimeout = builder.requestTimeout; this.receiveHangDetectionTime = builder.receiveHangDetectionTime; + this.requestTimeout = builder.requestTimeout; this.sendHangDetectionTime = builder.sendHangDetectionTime; + this.shutdownTimeout = builder.shutdownTimeout; this.userAgent = builder.userAgent; } @@ -196,39 +222,59 @@ private Options(Builder builder) { // region Accessors - public String getCertificateHostNameOverride() { + public int bufferPageSize() { + return this.bufferPageSize; + } + + public String certificateHostNameOverride() { return this.certificateHostNameOverride; } - public int getMaxChannelsPerEndpoint() { - return this.maxChannelsPerEndpoint; + public Duration connectionTimeout() { + return this.connectionTimeout; } - public int getMaxRequestsPerChannel() { - return this.maxRequestsPerChannel; + public Duration idleChannelTimeout() { + return this.idleChannelTimeout; } - public Duration getConnectionTimeout() { - return this.connectionTimeout; + public Duration idleEndpointTimeout() { + return this.idleEndpointTimeout; } - public int getPartitionCount() { + public int maxBufferCapacity() { + return this.maxBufferCapacity; + } + + public int maxChannelsPerEndpoint() { + return this.maxChannelsPerEndpoint; + } + + public int maxRequestsPerChannel() { + return this.maxRequestsPerChannel; + } + + public int partitionCount() { return this.partitionCount; } - public Duration getReceiveHangDetectionTime() { + public Duration receiveHangDetectionTime() { return this.receiveHangDetectionTime; } - public Duration getRequestTimeout() { + public Duration requestTimeout() { return this.requestTimeout; } - public Duration getSendHangDetectionTime() { + public Duration sendHangDetectionTime() { return this.sendHangDetectionTime; } - public UserAgentContainer getUserAgent() { + public Duration shutdownTimeout() { + return this.shutdownTimeout; + } + + public UserAgentContainer userAgent() { return this.userAgent; } @@ -250,22 +296,24 @@ public static class Builder { // region Fields private static final UserAgentContainer DEFAULT_USER_AGENT_CONTAINER = new UserAgentContainer(); + private static final Duration FIFTEEN_SECONDS = Duration.ofSeconds(15L); + private static final Duration SEVENTY_SECONDS = Duration.ofSeconds(70L); private static final Duration SIXTY_FIVE_SECONDS = Duration.ofSeconds(65L); private static final Duration TEN_SECONDS = Duration.ofSeconds(10L); - // Required parameters - + private int bufferPageSize = 8192; private String certificateHostNameOverride = null; - - // Optional parameters - + private Duration connectionTimeout = null; + private Duration idleChannelTimeout = Duration.ZERO; + private Duration idleEndpointTimeout = SEVENTY_SECONDS; + private int maxBufferCapacity = 8192 << 10; private int maxChannelsPerEndpoint = 10; private int maxRequestsPerChannel = 30; - private Duration connectionTimeout = null; private int partitionCount = 1; private Duration receiveHangDetectionTime = SIXTY_FIVE_SECONDS; private Duration requestTimeout; private Duration sendHangDetectionTime = TEN_SECONDS; + private Duration shutdownTimeout = FIFTEEN_SECONDS; private UserAgentContainer userAgent = DEFAULT_USER_AGENT_CONTAINER; // endregion @@ -285,9 +333,18 @@ public Builder(int requestTimeoutInSeconds) { // region Methods public Options build() { + checkState(this.bufferPageSize <= this.maxBufferCapacity, "bufferPageSize (%s) > maxBufferCapacity (%s)", + this.bufferPageSize, this.maxBufferCapacity + ); return new Options(this); } + public Builder bufferPageSize(final int value) { + checkArgument(value >= 4096 && (value & (value - 1)) == 0, "value: %s", value); + this.bufferPageSize = value; + return this; + } + public Builder certificateHostNameOverride(final String value) { this.certificateHostNameOverride = value; return this; @@ -299,9 +356,21 @@ public Builder connectionTimeout(final Duration value) { return this; } - public Builder maxRequestsPerChannel(final int value) { - checkArgument(value > 0, "value: %s", value); - this.maxRequestsPerChannel = value; + public Builder idleChannelTimeout(final Duration value) { + checkNotNull(value, "value: null"); + this.idleChannelTimeout = value; + return this; + } + + public Builder idleEndpointTimeout(final Duration value) { + checkArgument(value != null && value.compareTo(Duration.ZERO) > 0, "value: %s", value); + this.idleEndpointTimeout = value; + return this; + } + + public Builder maxBufferCapacity(final int value) { + checkArgument(value > 0 && (value & (value - 1)) == 0, "value: %s", value); + this.maxBufferCapacity = value; return this; } @@ -311,6 +380,12 @@ public Builder maxChannelsPerEndpoint(final int value) { return this; } + public Builder maxRequestsPerChannel(final int value) { + checkArgument(value > 0, "value: %s", value); + this.maxRequestsPerChannel = value; + return this; + } + public Builder partitionCount(final int value) { checkArgument(value > 0, "value: %s", value); this.partitionCount = value; @@ -344,6 +419,15 @@ public Builder sendHangDetectionTime(final Duration value) { return this; } + public Builder shutdownTimeout(final Duration value) { + + checkNotNull(value, "value: null"); + checkArgument(value.compareTo(Duration.ZERO) > 0, "value: %s", value); + + this.shutdownTimeout = value; + return this; + } + public Builder userAgent(final UserAgentContainer value) { checkNotNull(value, "value: null"); this.userAgent = value; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java index c52d3b3fb3f3..5d8fcf81fe1a 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java @@ -7,27 +7,31 @@ import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.EventLoop; +import io.netty.channel.pool.ChannelHealthChecker; import io.netty.channel.pool.ChannelPool; import io.netty.channel.pool.ChannelPoolHandler; import io.netty.handler.logging.LoggingHandler; -import io.netty.handler.ssl.SslHandler; -import io.netty.handler.timeout.ReadTimeoutHandler; -import io.netty.handler.timeout.WriteTimeoutHandler; +import io.netty.handler.timeout.IdleStateHandler; +import io.netty.util.AttributeKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.net.ssl.SSLEngine; import java.util.concurrent.TimeUnit; +import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdEndpoint.Config; import static com.google.common.base.Preconditions.checkNotNull; public class RntbdClientChannelHandler extends ChannelInitializer implements ChannelPoolHandler { - private static Logger logger = LoggerFactory.getLogger(RntbdClientChannelHandler.class); - private final RntbdEndpoint.Config config; + private static final AttributeKey REQUEST_MANAGER = AttributeKey.newInstance("requestManager"); + private static final Logger logger = LoggerFactory.getLogger(RntbdClientChannelHandler.class); + private final ChannelHealthChecker healthChecker; + private final Config config; - RntbdClientChannelHandler(final RntbdEndpoint.Config config) { + RntbdClientChannelHandler(final Config config, final ChannelHealthChecker healthChecker) { + checkNotNull(healthChecker, "healthChecker"); checkNotNull(config, "config"); + this.healthChecker = healthChecker; this.config = config; } @@ -74,13 +78,13 @@ public void channelReleased(final Channel channel) { * This method constructs this pipeline: *
{@code
      * ChannelPipeline {
-     *     (ReadTimeoutHandler#0 = io.netty.handler.timeout.ReadTimeoutHandler),
      *     (SslHandler#0 = io.netty.handler.ssl.SslHandler),
-     *     (RntbdContextNegotiator#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdContextNegotiator),
-     *     (RntbdResponseDecoder#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdResponseDecoder),
-     *     (RntbdRequestEncoder#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestEncoder),
-     *     (WriteTimeoutHandler#0 = io.netty.handler.timeout.WriteTimeoutHandler),
-     *     (RntbdRequestManager#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestManager),
+     *     (IdleTimeoutHandler#0 = io.netty.handler.timeout.IdleTimeoutHandler),
+     *     (LoggingHandler#0 = io.netty.handler.logging.LoggingHandler),  // iff RntbdClientChannelHandler.config.wireLogLevel != null
+     *     (RntbdContextNegotiator#0 = com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdContextNegotiator),
+     *     (RntbdResponseDecoder#0 = com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdResponseDecoder),
+     *     (RntbdRequestEncoder#0 = com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdRequestEncoder),
+     *     (RntbdRequestManager#0 = com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdRequestManager),
      * }
      * }
* @@ -91,28 +95,28 @@ protected void initChannel(final Channel channel) { checkNotNull(channel); - final RntbdRequestManager requestManager = new RntbdRequestManager(this.config.getMaxRequestsPerChannel()); - final long readerIdleTime = this.config.getReceiveHangDetectionTime(); - final long writerIdleTime = this.config.getSendHangDetectionTime(); + final RntbdRequestManager requestManager = new RntbdRequestManager(this.healthChecker, this.config.maxRequestsPerChannel()); + final long readerIdleTime = this.config.receiveHangDetectionTime(); + final long writerIdleTime = this.config.sendHangDetectionTime(); + final long allIdleTime = this.config.idleConnectionTimeout(); final ChannelPipeline pipeline = channel.pipeline(); pipeline.addFirst( - new RntbdContextNegotiator(requestManager, this.config.getUserAgent()), + new RntbdContextNegotiator(requestManager, this.config.userAgent()), new RntbdResponseDecoder(), new RntbdRequestEncoder(), - new WriteTimeoutHandler(writerIdleTime, TimeUnit.NANOSECONDS), requestManager ); - if (this.config.getWireLogLevel() != null) { - pipeline.addFirst(new LoggingHandler(this.config.getWireLogLevel())); + if (this.config.wireLogLevel() != null) { + pipeline.addFirst(new LoggingHandler(this.config.wireLogLevel())); } - final SSLEngine sslEngine = this.config.getSslContext().newEngine(channel.alloc()); - pipeline.addFirst( - new ReadTimeoutHandler(readerIdleTime, TimeUnit.NANOSECONDS), - new SslHandler(sslEngine) + this.config.sslContext().newHandler(channel.alloc()), + new IdleStateHandler(readerIdleTime, writerIdleTime, allIdleTime, TimeUnit.NANOSECONDS) ); + + channel.attr(REQUEST_MANAGER).set(requestManager); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHealthChecker.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHealthChecker.java new file mode 100644 index 000000000000..934e05e4fabc --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHealthChecker.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.internal.directconnectivity.rntbd; + +import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdEndpoint.Config; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import io.netty.channel.Channel; +import io.netty.channel.pool.ChannelHealthChecker; +import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.Promise; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicLongFieldUpdater; + +import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static java.util.concurrent.atomic.AtomicLongFieldUpdater.newUpdater; + +@JsonSerialize(using = RntbdClientChannelHealthChecker.JsonSerializer.class) +public final class RntbdClientChannelHealthChecker implements ChannelHealthChecker { + + // region Fields + + private static final Logger logger = LoggerFactory.getLogger(RntbdClientChannelHealthChecker.class); + + // A channel will be declared healthy if a read succeeded recently as defined by this value. + private static final long recentReadWindow = 1_000_000_000L; + + // A channel should not be declared unhealthy if a write succeeded recently. As such gaps between + // Timestamps.lastChannelWrite and Timestamps.lastChannelRead lower than this value are ignored. + // Guidance: The grace period should be large enough to accommodate the round trip time of the slowest server + // request. Assuming 1s of network RTT, a 2 MB request, a 2 MB response, a connection that can sustain 1 MB/s + // both ways, and a 5-second deadline at the server, 10 seconds should be enough. + private static final long readHangGracePeriod = 10L * 1_000_000_000L; + + // A channel will not be declared unhealthy if a write was attempted recently. As such gaps between + // Timestamps.lastChannelWriteAttempt and Timestamps.lastChannelWrite lower than this value are ignored. + // Guidance: The grace period should be large enough to accommodate slow writes. For example, a value of 2s requires + // that the client can sustain data rates of at least 1 MB/s when writing 2 MB documents. + private static final long writeHangGracePeriod = 2L * 1_000_000_000L; + + // A channel is considered idle if: + // idleConnectionTimeout > 0L && System.nanoTime() - Timestamps.lastChannelRead() >= idleConnectionTimeout + private final long idleConnectionTimeout; + + // A channel will be declared unhealthy if the gap between Timestamps.lastChannelWrite and Timestamps.lastChannelRead + // grows beyond this value. + // Constraint: readDelayLimit > readHangGracePeriod + private final long readDelayLimit; + + // A channel will be declared unhealthy if the gap between Timestamps.lastChannelWriteAttempt and Timestamps.lastChannelWrite + // grows beyond this value. + // Constraint: writeDelayLimit > writeHangGracePeriod + private final long writeDelayLimit; + + // endregion + + // region Constructors + + public RntbdClientChannelHealthChecker(final Config config) { + + checkNotNull(config, "config: null"); + + this.idleConnectionTimeout = config.idleConnectionTimeout(); + + this.readDelayLimit = config.receiveHangDetectionTime(); + checkArgument(this.readDelayLimit > readHangGracePeriod, "config.receiveHangDetectionTime: %s", this.readDelayLimit); + + this.writeDelayLimit = config.sendHangDetectionTime(); + checkArgument(this.writeDelayLimit > writeHangGracePeriod, "config.sendHangDetectionTime: %s", this.writeDelayLimit); + } + + // endregion + + // region Methods + + public long idleConnectionTimeout() { + return this.idleConnectionTimeout; + } + + public long readDelayLimit() { + return this.readDelayLimit; + } + + public long writeDelayLimit() { + return this.writeDelayLimit; + } + + public Future isHealthy(final Channel channel) { + + checkNotNull(channel, "channel: null"); + + final RntbdRequestManager requestManager = channel.pipeline().get(RntbdRequestManager.class); + final Promise promise = channel.eventLoop().newPromise(); + + if (requestManager == null) { + reportIssueUnless(logger, !channel.isActive(), channel, "active with no request manager"); + return promise.setSuccess(Boolean.FALSE); + } + + final Timestamps timestamps = requestManager.snapshotTimestamps(); + final long currentTime = System.nanoTime(); + + if (currentTime - timestamps.lastChannelRead() < recentReadWindow) { + return promise.setSuccess(Boolean.TRUE); // because we recently received data + } + + // Black hole detection, part 1: + // Treat the channel as unhealthy if the gap between the last attempted write and the last successful write + // grew beyond acceptable limits, unless a write was attempted recently. This is a sign of a hung write. + + final long writeDelay = timestamps.lastChannelWriteAttempt() - timestamps.lastChannelWrite(); + + if (writeDelay > this.writeDelayLimit && currentTime - timestamps.lastChannelWriteAttempt() > writeHangGracePeriod) { + + final Optional rntbdContext = requestManager.rntbdContext(); + final int pendingRequestCount = requestManager.pendingRequestCount(); + + logger.warn("{} health check failed due to hung write: {lastChannelWriteAttempt: {}, lastChannelWrite: {}, " + + "writeDelay: {}, writeDelayLimit: {}, rntbdContext: {}, pendingRequestCount: {}}", channel, + timestamps.lastChannelWriteAttempt(), timestamps.lastChannelWrite(), writeDelay, + this.writeDelayLimit, rntbdContext, pendingRequestCount); + + return promise.setSuccess(Boolean.FALSE); + } + + // Black hole detection, part 2: + // Treat the connection as unhealthy if the gap between the last successful write and the last successful read + // grew beyond acceptable limits, unless a write succeeded recently. This is a sign of a hung read. + + final long readDelay = timestamps.lastChannelWrite() - timestamps.lastChannelRead(); + + if (readDelay > this.readDelayLimit && currentTime - timestamps.lastChannelWrite() > readHangGracePeriod) { + + final Optional rntbdContext = requestManager.rntbdContext(); + final int pendingRequestCount = requestManager.pendingRequestCount(); + + logger.warn("{} health check failed due to hung read: {lastChannelWrite: {}, lastChannelRead: {}, " + + "readDelay: {}, readDelayLimit: {}, rntbdContext: {}, pendingRequestCount: {}}", channel, + timestamps.lastChannelWrite(), timestamps.lastChannelRead(), readDelay, + this.readDelayLimit, rntbdContext, pendingRequestCount); + + return promise.setSuccess(Boolean.FALSE); + } + + if (this.idleConnectionTimeout > 0L) { + if (currentTime - timestamps.lastChannelRead() > this.idleConnectionTimeout) { + return promise.setSuccess(Boolean.FALSE); + } + } + + channel.writeAndFlush(RntbdHealthCheckRequest.MESSAGE).addListener(completed -> { + if (completed.isSuccess()) { + promise.setSuccess(Boolean.TRUE); + } else { + logger.warn("{} health check request failed due to:", channel, completed.cause()); + promise.setSuccess(Boolean.FALSE); + } + }); + + return promise; + } + + @Override + public String toString() { + return RntbdObjectMapper.toString(this); + } + + // endregion + + // region Types + + static final class JsonSerializer extends StdSerializer { + + JsonSerializer() { + super(RntbdClientChannelHealthChecker.class); + } + + @Override + public void serialize(RntbdClientChannelHealthChecker value, JsonGenerator generator, SerializerProvider provider) throws IOException { + generator.writeStartObject(); + generator.writeNumberField("idleConnectionTimeout", value.idleConnectionTimeout()); + generator.writeNumberField("readDelayLimit", value.readDelayLimit()); + generator.writeNumberField("writeDelayLimit", value.writeDelayLimit()); + generator.writeEndObject(); + } + } + + @JsonSerialize(using = Timestamps.JsonSerializer.class) + static final class Timestamps { + + private static final AtomicLongFieldUpdater lastPingUpdater = + newUpdater(Timestamps.class, "lastPing"); + + private static final AtomicLongFieldUpdater lastReadUpdater = + newUpdater(Timestamps.class, "lastRead"); + + private static final AtomicLongFieldUpdater lastWriteUpdater = + newUpdater(Timestamps.class, "lastWrite"); + + private static final AtomicLongFieldUpdater lastWriteAttemptUpdater = + newUpdater(Timestamps.class, "lastWriteAttempt"); + + private volatile long lastPing; + private volatile long lastRead; + private volatile long lastWrite; + private volatile long lastWriteAttempt; + + public Timestamps() { + } + + @SuppressWarnings("CopyConstructorMissesField") + public Timestamps(Timestamps other) { + checkNotNull(other, "other: null"); + this.lastPing = lastPingUpdater.get(other); + this.lastRead = lastReadUpdater.get(other); + this.lastWrite = lastWriteUpdater.get(other); + this.lastWriteAttempt = lastWriteAttemptUpdater.get(other); + } + + public void channelPingCompleted() { + lastPingUpdater.set(this, System.nanoTime()); + } + + public void channelReadCompleted() { + lastReadUpdater.set(this, System.nanoTime()); + } + + public void channelWriteAttempted() { + lastWriteUpdater.set(this, System.nanoTime()); + } + + public void channelWriteCompleted() { + lastWriteAttemptUpdater.set(this, System.nanoTime()); + } + + public long lastChannelPing() { + return lastPingUpdater.get(this); + } + + public long lastChannelRead() { + return lastReadUpdater.get(this); + } + + public long lastChannelWrite() { + return lastWriteUpdater.get(this); + } + + public long lastChannelWriteAttempt() { + return lastWriteAttemptUpdater.get(this); + } + + @Override + public String toString() { + return "RntbdClientChannelHealthChecker.Timestamps(" + RntbdObjectMapper.toJson(this) + ')'; + } + + static final class JsonSerializer extends StdSerializer { + + JsonSerializer() { + super(Timestamps.class); + } + + @Override + public void serialize(Timestamps value, JsonGenerator generator, SerializerProvider provider) throws IOException { + generator.writeStartObject(); + generator.writeNumberField("lastChannelPing", value.lastChannelPing()); + generator.writeNumberField("lastChannelRead", value.lastChannelRead()); + generator.writeNumberField("lastChannelWrite", value.lastChannelWrite()); + generator.writeNumberField("lastChannelWriteAttempt", value.lastChannelWriteAttempt()); + generator.writeEndObject(); + } + } + } + + // endregion +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelPool.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelPool.java index cb3fa29561fe..54443ae53d8f 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelPool.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelPool.java @@ -3,87 +3,179 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; +import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdEndpoint.Config; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.PooledByteBufAllocatorMetric; import io.netty.channel.Channel; -import io.netty.channel.pool.ChannelHealthChecker; -import io.netty.channel.pool.FixedChannelPool; +import io.netty.channel.ChannelPipeline; +import io.netty.channel.pool.ChannelPool; +import io.netty.channel.pool.SimpleChannelPool; +import io.netty.util.concurrent.EventExecutor; import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.FutureListener; +import io.netty.util.concurrent.GlobalEventExecutor; import io.netty.util.concurrent.Promise; -import org.apache.commons.lang3.reflect.FieldUtils; +import io.netty.util.internal.ThrowableUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; -import java.lang.reflect.Field; import java.net.SocketAddress; +import java.nio.channels.ClosedChannelException; +import java.time.Duration; +import java.util.ArrayDeque; +import java.util.Queue; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; -import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdReporter.reportIssue; import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless; import static com.google.common.base.Preconditions.checkState; +/** + * {@link ChannelPool} implementation that enforces a maximum number of concurrent direct TCP Cosmos connections + */ @JsonSerialize(using = RntbdClientChannelPool.JsonSerializer.class) -public final class RntbdClientChannelPool extends FixedChannelPool { +public final class RntbdClientChannelPool extends SimpleChannelPool { - // region Fields + private static final TimeoutException ACQUISITION_TIMEOUT = ThrowableUtil.unknownStackTrace( + new TimeoutException("Acquisition took longer than the configured maximum time"), + RntbdClientChannelPool.class, ""); + + private static final ClosedChannelException CHANNEL_CLOSED_ON_ACQUIRE = ThrowableUtil.unknownStackTrace( + new ClosedChannelException(), RntbdClientChannelPool.class, "acquire0(...)"); + + private static final IllegalStateException POOL_CLOSED_ON_ACQUIRE = ThrowableUtil.unknownStackTrace( + new IllegalStateException("RntbdClientChannelPool was closed"), + RntbdClientChannelPool.class, "acquire0"); + + private static final IllegalStateException POOL_CLOSED_ON_RELEASE = ThrowableUtil.unknownStackTrace( + new IllegalStateException("RntbdClientChannelPool was closed"), + RntbdClientChannelPool.class, "release"); + + private static final IllegalStateException TOO_MANY_PENDING_ACQUISITIONS = ThrowableUtil.unknownStackTrace( + new IllegalStateException("Too many outstanding acquire operations"), + RntbdClientChannelPool.class, "acquire0"); private static final Logger logger = LoggerFactory.getLogger(RntbdClientChannelPool.class); - private static final AtomicReference pendingAcquireCount = new AtomicReference<>(); - private final AtomicInteger availableChannelCount; - private final AtomicBoolean closed; + private final long acquisitionTimeoutNanos; + private final PooledByteBufAllocatorMetric allocatorMetric; + private final EventExecutor executor; + private final ScheduledFuture idleStateDetectionScheduledFuture; private final int maxChannels; + private final int maxPendingAcquisitions; private final int maxRequestsPerChannel; - // endregion + // No need to worry about synchronization as everything that modified the queue or counts is done by this.executor - // region Methods + private final Queue pendingAcquisitionQueue = new ArrayDeque(); + private final Runnable acquisitionTimeoutTask; + + // Because these values can be requested on any thread... + + private final AtomicInteger acquiredChannelCount = new AtomicInteger(); + private final AtomicInteger availableChannelCount = new AtomicInteger(); + private final AtomicBoolean closed = new AtomicBoolean(); /** * Initializes a newly created {@link RntbdClientChannelPool} object - * - * @param bootstrap the {@link Bootstrap} that is used for connections - * @param config the {@link RntbdEndpoint.Config} that is used for the channel pool instance created + * @param bootstrap the {@link Bootstrap} that is used for connections + * @param config the {@link Config} that is used for the channel pool instance created */ - RntbdClientChannelPool(final Bootstrap bootstrap, final RntbdEndpoint.Config config) { + RntbdClientChannelPool(final RntbdServiceEndpoint endpoint, final Bootstrap bootstrap, final Config config) { + this(endpoint, bootstrap, config, new RntbdClientChannelHealthChecker(config)); + } - super(bootstrap, new RntbdClientChannelHandler(config), ChannelHealthChecker.ACTIVE, null, - -1L, config.getMaxChannelsPerEndpoint(), Integer.MAX_VALUE, true - ); + private RntbdClientChannelPool( + final RntbdServiceEndpoint endpoint, final Bootstrap bootstrap, final Config config, + final RntbdClientChannelHealthChecker healthChecker + ) { + + super(bootstrap, new RntbdClientChannelHandler(config, healthChecker), healthChecker, true, true); + + this.allocatorMetric = config.allocator().metric(); + this.executor = bootstrap.config().group().next(); + this.maxChannels = config.maxChannelsPerEndpoint(); + this.maxPendingAcquisitions = Integer.MAX_VALUE; + this.maxRequestsPerChannel = config.maxRequestsPerChannel(); + + // TODO: DANOBLE: Add RntbdEndpoint.Config settings for acquisition timeout and acquisition timeout action + // Alternatively: drop acquisition timeout and acquisition timeout action + // Decision should be based on performance, reliability, and usability considerations + + final AcquisitionTimeoutAction acquisitionTimeoutAction = null; + final long acquisitionTimeoutNanos = -1L; + + if (acquisitionTimeoutAction == null) { + + this.acquisitionTimeoutNanos = -1L; + this.acquisitionTimeoutTask = null; + + } else { + + this.acquisitionTimeoutNanos = acquisitionTimeoutNanos; + + switch (acquisitionTimeoutAction) { + case FAIL: + this.acquisitionTimeoutTask = new AcquireTimeoutTask(this) { + @Override + public void onTimeout(AcquireTask task) { + task.promise.setFailure(ACQUISITION_TIMEOUT); + } + }; + break; + case NEW: + this.acquisitionTimeoutTask = new AcquireTimeoutTask(this) { + @Override + public void onTimeout(AcquireTask task) { + // Increment the acquire count and get a new Channel by delegating to super.acquire + task.acquired(); + RntbdClientChannelPool.super.acquire(task.promise); + } + }; + break; + default: + throw new Error(); + } + } - this.maxRequestsPerChannel = config.getMaxRequestsPerChannel(); - this.maxChannels = config.getMaxChannelsPerEndpoint(); - this.availableChannelCount = new AtomicInteger(); - this.closed = new AtomicBoolean(); - } + final long idleEndpointTimeout = config.idleEndpointTimeout(); - @Override - public Future acquire(Promise promise) { - this.throwIfClosed(); - return super.acquire(promise); - } + this.idleStateDetectionScheduledFuture = this.executor.scheduleAtFixedRate( + () -> { - @Override - public Future release(Channel channel, Promise promise) { - this.throwIfClosed(); - return super.release(channel, promise); + final long currentTime = System.nanoTime(); + final long lastRequestTime = endpoint.lastRequestTime(); + final long elapsedTime = currentTime - lastRequestTime; + + if (elapsedTime > idleEndpointTimeout) { + + if (logger.isWarnEnabled()) { + logger.warn( + "{} closing due to inactivity (time elapsed since last request: {} > idleEndpointTimeout: {})", + endpoint, Duration.ofNanos(elapsedTime), Duration.ofNanos(idleEndpointTimeout)); + } + + endpoint.close(); + } + + }, idleEndpointTimeout, idleEndpointTimeout, TimeUnit.NANOSECONDS); } - @Override - public void close() { - if (this.closed.compareAndSet(false, true)) { - this.availableChannelCount.set(0); - super.close(); - } + // region Accessors + + public int channelsAcquired() { + return this.acquiredChannelCount.get(); } - public int availableChannelCount() { + public int channelsAvailable() { return this.availableChannelCount.get(); } @@ -95,38 +187,125 @@ public int maxRequestsPerChannel() { return this.maxRequestsPerChannel; } - public int pendingAcquisitionCount() { + public SocketAddress remoteAddress() { + return this.bootstrap().config().remoteAddress(); + } - Field field = pendingAcquireCount.get(); + public int requestQueueLength() { + return this.pendingAcquisitionQueue.size(); + } - if (field == null) { - synchronized (pendingAcquireCount) { - field = pendingAcquireCount.get(); - if (field == null) { - field = FieldUtils.getDeclaredField(FixedChannelPool.class, "pendingAcquireCount", true); - pendingAcquireCount.set(field); - } + public long usedDirectMemory() { + return this.allocatorMetric.usedDirectMemory(); + } + + public long usedHeapMemory() { + return this.allocatorMetric.usedHeapMemory(); + } + + // endregion + + // region Methods + + public boolean isClosed() { + return this.closed.get(); + } + + @Override + public Future acquire(final Promise promise) { + + this.throwIfClosed(); + + try { + if (this.executor.inEventLoop()) { + this.acquire0(promise); + } else { + this.executor.execute(() -> this.acquire0(promise)); } + } catch (Throwable cause) { + promise.setFailure(cause); } - try { - return (int)FieldUtils.readField(field, this); - } catch (IllegalAccessException error) { - reportIssue(logger, this, "could not access field due to ", error); + return promise; + } + + @Override + public void close() { + if (this.closed.compareAndSet(false, true)) { + if (this.executor.inEventLoop()) { + this.close0(); + } else { + this.executor.submit(this::close0).awaitUninterruptibly(); + } } + } - return -1; + @Override + public Future release(final Channel channel, final Promise promise) { + + // We do not call this.throwIfClosed because a channel may be released back to the pool during close + + super.release(channel, this.executor.newPromise().addListener((FutureListener)future -> { + + checkState(this.executor.inEventLoop()); + + if (this.isClosed()) { + // Since the pool is closed, we have no choice but to close the channel + promise.setFailure(POOL_CLOSED_ON_RELEASE); + channel.close(); + return; + } + + if (future.isSuccess()) { + + this.decrementAndRunTaskQueue(); + promise.setSuccess(null); + + } else { + + final Throwable cause = future.cause(); + + if (!(cause instanceof IllegalArgumentException)) { + this.decrementAndRunTaskQueue(); + } + + promise.setFailure(cause); + } + })); + + return promise; + } + + @Override + public String toString() { + return RntbdObjectMapper.toString(this); + } + + /** + * Offer a {@link Channel} back to the internal storage + *

+ * Maintainers: Implementations of this method must be thread-safe. + * + * @param channel the {@link Channel} to return to internal storage + * @return {@code true}, if the {@link Channel} could be added to internal storage; otherwise {@code false} + */ + @Override + protected boolean offerChannel(final Channel channel) { + if (super.offerChannel(channel)) { + this.availableChannelCount.incrementAndGet(); + return true; + } + return false; } /** * Poll a {@link Channel} out of internal storage to reuse it *

- * Maintainers: Implementations of this method must be thread-safe and this type's base class, {@link FixedChannelPool}, - * ensures thread safety. It does this by calling this method serially on a single-threaded EventExecutor. As a - * result this method need not (and should not) be synchronized. + * Maintainers: Implementations of this method must be thread-safe and this type ensures thread safety by calling + * this method serially on a single-threaded EventExecutor. As a result this method need not (and should not) be + * synchronized. * * @return a value of {@code null}, if no {@link Channel} is ready to be reused - * * @see #acquire(Promise) */ @Override @@ -138,18 +317,18 @@ protected Channel pollChannel() { return null; } - if (this.closed.get()) { - return first; // because we're being called following a call to close (from super.close) + if (this.isClosed()) { + return first; // because this.close -> this.close0 -> super.close -> this.pollChannel } - if (this.isInactiveOrServiceableChannel(first)) { + if (this.isServiceableOrInactiveChannel(first)) { return this.decrementAvailableChannelCountAndAccept(first); } super.offerChannel(first); // because we need a non-null sentinel to stop the search for a channel for (Channel next = super.pollChannel(); next != first; super.offerChannel(next), next = super.pollChannel()) { - if (this.isInactiveOrServiceableChannel(next)) { + if (this.isServiceableOrInactiveChannel(next)) { return this.decrementAvailableChannelCountAndAccept(next); } } @@ -158,42 +337,102 @@ protected Channel pollChannel() { return null; } - /** - * Offer a {@link Channel} back to the internal storage - *

- * Maintainers: Implementations of this method must be thread-safe. - * - * @param channel the {@link Channel} to return to internal storage - * @return {@code true}, if the {@link Channel} could be added to internal storage; otherwise {@code false} - */ - @Override - protected boolean offerChannel(final Channel channel) { - if (super.offerChannel(channel)) { - this.availableChannelCount.incrementAndGet(); - return true; + // endregion + + // region Privates + + private void acquire0(final Promise promise) { + + checkState(this.executor.inEventLoop()); + + if (this.isClosed()) { + promise.setFailure(POOL_CLOSED_ON_ACQUIRE); + return; } - return false; - } - public SocketAddress remoteAddress() { - return this.bootstrap().config().remoteAddress(); + if (this.acquiredChannelCount.get() < this.maxChannels) { + + // We need to create a new promise to ensure the AcquireListener runs in the correct event loop + + checkState(this.acquiredChannelCount.get() >= 0); + + final AcquireListener l = new AcquireListener(this, promise); + l.acquired(); + + final Promise p = this.executor.newPromise(); + p.addListener(l); + + super.acquire(p); // acquire an existing channel or create and acquire a new channel + + } else { + + if (this.pendingAcquisitionQueue.size() >= this.maxPendingAcquisitions) { + + promise.setFailure(TOO_MANY_PENDING_ACQUISITIONS); + + } else { + + // Add a task to the pending acquisition queue and we'll satisfy the request later + + AcquireTask task = new AcquireTask(this, promise); + + if (this.pendingAcquisitionQueue.offer(task)) { + + if (acquisitionTimeoutTask != null) { + task.timeoutFuture = executor.schedule(acquisitionTimeoutTask, acquisitionTimeoutNanos, TimeUnit.NANOSECONDS); + } + + } else { + promise.setFailure(TOO_MANY_PENDING_ACQUISITIONS); + } + } + + checkState(this.pendingAcquisitionQueue.size() > 0); + } } - @Override - public String toString() { - return "RntbdClientChannelPool(" + RntbdObjectMapper.toJson(this) + ")"; + private void close0() { + + checkState(this.executor.inEventLoop()); + + this.idleStateDetectionScheduledFuture.cancel(false); + this.acquiredChannelCount.set(0); + this.availableChannelCount.set(0); + + for (; ; ) { + final AcquireTask task = this.pendingAcquisitionQueue.poll(); + if (task == null) { + break; + } + final ScheduledFuture timeoutFuture = task.timeoutFuture; + if (timeoutFuture != null) { + timeoutFuture.cancel(false); + } + task.promise.setFailure(new ClosedChannelException()); + } + + // Ensure we dispatch this on another Thread as close0 will be called from the EventExecutor and we need + // to ensure we will not block in an EventExecutor + + GlobalEventExecutor.INSTANCE.execute(RntbdClientChannelPool.super::close); } - // endregion + private void decrementAndRunTaskQueue() { - // region Privates + checkState(acquiredChannelCount.decrementAndGet() >= 0); + + // Run the pending acquisition tasks before notifying the original promise so that if the user tries to + // acquire again from the ChannelFutureListener and the pendingChannelAcquisitionCount is greater than + // maxPendingAcquisitions we may be able to run some pending tasks first and so allow to add more + runTaskQueue(); + } private Channel decrementAvailableChannelCountAndAccept(final Channel first) { this.availableChannelCount.decrementAndGet(); return first; } - private boolean isInactiveOrServiceableChannel(final Channel channel) { + private boolean isServiceableOrInactiveChannel(final Channel channel) { if (!channel.isActive()) { return true; @@ -202,44 +441,236 @@ private boolean isInactiveOrServiceableChannel(final Channel channel) { final RntbdRequestManager requestManager = channel.pipeline().get(RntbdRequestManager.class); if (requestManager == null) { - reportIssueUnless(!channel.isActive(), logger, this, "{} active with no request manager", channel); + reportIssueUnless(logger, !channel.isActive(), channel, "active with no request manager"); return true; // inactive } - return requestManager.isServiceable(this.maxRequestsPerChannel); + return requestManager.isServiceable(1 /* this.maxRequestsPerChannel */); + } + + private void runTaskQueue() { + + while (this.acquiredChannelCount.get() < this.maxChannels) { + + final AcquireTask task = this.pendingAcquisitionQueue.poll(); + + if (task == null) { + break; + } + + final ScheduledFuture timeoutFuture = task.timeoutFuture; + + if (timeoutFuture != null) { + timeoutFuture.cancel(false); + } + + task.acquired(); + + super.acquire(task.promise); + } + + checkState(this.acquiredChannelCount.get() >= 0); // we should never have negative values } private void throwIfClosed() { - checkState(!this.closed.get(), "%s is closed", this); + checkState(!this.isClosed(), "%s is closed", this); } // endregion // region Types - static final class JsonSerializer extends StdSerializer { + private enum AcquisitionTimeoutAction { + + /** + * Create a new connection when the timeout is detected. + */ + NEW, + + /** + * Fail the {@link Future} of the acquire call with a {@link TimeoutException}. + */ + FAIL + } + + private static class AcquireListener implements FutureListener { + + private final Promise originalPromise; + private final RntbdClientChannelPool pool; + private boolean acquired; + + AcquireListener(RntbdClientChannelPool pool, Promise originalPromise) { + this.originalPromise = originalPromise; + this.pool = pool; + } + + public void acquired() { + if (this.acquired) { + return; + } + this.pool.acquiredChannelCount.incrementAndGet(); + this.acquired = true; + } + + @Override + public void operationComplete(Future future) { + + checkState(this.pool.executor.inEventLoop()); + + if (this.pool.isClosed()) { + if (future.isSuccess()) { + // Since the pool is closed, we have no choice but to close the channel + future.getNow().close(); + } + this.originalPromise.setFailure(POOL_CLOSED_ON_ACQUIRE); + return; + } + + if (future.isSuccess()) { + + // Ensure that the channel is active and ready to receive requests + // A Direct TCP channel is ready to receive requests when it: + // * is active and + // * has an RntbdContext + // We send a health check request on a channel without an RntbdContext to force: + // 1. SSL negotiation + // 2. RntbdContextRequest -> RntbdContext + // 3. RntbdHealthCheckRequest -> receive acknowledgement + + final Channel channel = future.getNow(); + + channel.eventLoop().execute(() -> { + + if (!channel.isActive()) { + this.fail(CHANNEL_CLOSED_ON_ACQUIRE); + return; + } + + final ChannelPipeline pipeline = channel.pipeline(); + checkState(pipeline != null); + + final RntbdRequestManager requestManager = pipeline.get(RntbdRequestManager.class); + checkState(requestManager != null); + + if (requestManager.hasRequestedRntbdContext()) { + + this.originalPromise.setSuccess(channel); + + } else { + + channel.writeAndFlush(RntbdHealthCheckRequest.MESSAGE).addListener(completed -> { + + if (completed.isSuccess()) { + + reportIssueUnless(logger, this.acquired && requestManager.hasRntbdContext(), + channel,"acquired: {}, rntbdContext: {}", this.acquired, + requestManager.rntbdContext()); + + this.originalPromise.setSuccess(channel); + + } else { + + logger.warn("Channel({}) health check request failed due to:", channel, completed.cause()); + this.fail(completed.cause()); + } + }); + } + }); + + } else { + logger.warn("channel acquisition failed due to:", future.cause()); + this.fail(future.cause()); + } + } + + private void fail(Throwable cause) { + if (this.acquired) { + this.pool.decrementAndRunTaskQueue(); + } else { + this.pool.runTaskQueue(); + } + this.originalPromise.setFailure(cause); + } + } + + private static final class AcquireTask extends AcquireListener { + + // AcquireTask extends AcquireListener to reduce object creations and so GC pressure + + final long expireNanoTime; + final Promise promise; + + ScheduledFuture timeoutFuture; + + AcquireTask(RntbdClientChannelPool pool, Promise promise) { + // We need to create a new promise to ensure the AcquireListener runs in the correct event loop + super(pool, promise); + this.promise = pool.executor.newPromise().addListener(this); + this.expireNanoTime = System.nanoTime() + pool.acquisitionTimeoutNanos; + } + } + + private static abstract class AcquireTimeoutTask implements Runnable { + + final RntbdClientChannelPool pool; - public JsonSerializer() { - this(null); + public AcquireTimeoutTask(RntbdClientChannelPool pool) { + this.pool = pool; } - public JsonSerializer(Class type) { - super(type); + public abstract void onTimeout(AcquireTask task); + + @Override + public final void run() { + + checkState(this.pool.executor.inEventLoop()); + final long nanoTime = System.nanoTime(); + + for (; ; ) { + AcquireTask task = this.pool.pendingAcquisitionQueue.peek(); + // Compare nanoTime as described in the System.nanoTime documentation + // See: + // * https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#nanoTime() + // * https://github.com/netty/netty/issues/3705 + if (task == null || nanoTime - task.expireNanoTime < 0) { + break; + } + this.pool.pendingAcquisitionQueue.remove(); + this.onTimeout(task); + } + } + } + + static final class JsonSerializer extends StdSerializer { + + JsonSerializer() { + super(RntbdClientChannelPool.class); } @Override - public void serialize(RntbdClientChannelPool value, JsonGenerator generator, SerializerProvider provider) throws IOException { + public void serialize(final RntbdClientChannelPool value, final JsonGenerator generator, final SerializerProvider provider) throws IOException { + + RntbdClientChannelHealthChecker healthChecker = (RntbdClientChannelHealthChecker)value.healthChecker(); + generator.writeStartObject(); - generator.writeStringField("remoteAddress", value.remoteAddress().toString()); + generator.writeBooleanField("isClosed", value.isClosed()); + generator.writeObjectFieldStart("configuration"); generator.writeNumberField("maxChannels", value.maxChannels()); generator.writeNumberField("maxRequestsPerChannel", value.maxRequestsPerChannel()); + generator.writeNumberField("idleConnectionTimeout", healthChecker.idleConnectionTimeout()); + generator.writeNumberField("readDelayLimit", healthChecker.readDelayLimit()); + generator.writeNumberField("writeDelayLimit", healthChecker.writeDelayLimit()); + generator.writeEndObject(); generator.writeObjectFieldStart("state"); - generator.writeBooleanField("isClosed", value.closed.get()); - generator.writeNumberField("acquiredChannelCount", value.acquiredChannelCount()); - generator.writeNumberField("availableChannelCount", value.availableChannelCount()); - generator.writeNumberField("pendingAcquisitionCount", value.pendingAcquisitionCount()); + generator.writeNumberField("channelsAcquired", value.channelsAcquired()); + generator.writeNumberField("channelsAvailable", value.channelsAvailable()); + generator.writeNumberField("requestQueueLength", value.requestQueueLength()); + generator.writeNumberField("usedDirectMemory", value.usedDirectMemory()); + generator.writeNumberField("usedHeapMemory", value.usedHeapMemory()); generator.writeEndObject(); generator.writeEndObject(); } } + + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdConstants.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdConstants.java index 6933093496fc..f80162c545ed 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdConstants.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdConstants.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; @@ -618,7 +619,7 @@ public static RntbdResourceType fromId(final short id) throws IllegalArgumentExc case 0x001D: return RntbdResourceType.UserDefinedType; } - throw new IllegalArgumentException(String.format("id: %d", id)); + throw new IllegalArgumentException(Strings.lenientFormat("id: %s", id)); } public short id() { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContext.java index 65aa87d375d3..6c3f56776908 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContext.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContext.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.node.ObjectNode; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.HttpResponseStatus; import java.util.Collections; @@ -20,65 +21,81 @@ public final class RntbdContext { - private final RntbdResponseStatus frame; - private final Headers headers; - private ServerProperties serverProperties; + private final UUID activityId; + private final HttpResponseStatus status; + private final String clientVersion; + private final long idleTimeoutInSeconds; + private final int protocolVersion; + private final ServerProperties serverProperties; + private final long unauthenticatedTimeoutInSeconds; - private RntbdContext(final RntbdResponseStatus frame, final Headers headers) { - this.frame = frame; - this.headers = headers; + private RntbdContext(final RntbdResponseStatus responseStatus, final Headers headers) { + + this.activityId = responseStatus.getActivityId(); + this.status = responseStatus.getStatus(); + + this.clientVersion = headers.clientVersion.getValue(String.class); + this.idleTimeoutInSeconds = headers.idleTimeoutInSeconds.getValue(Long.class); + this.protocolVersion = headers.protocolVersion.getValue(Long.class).intValue(); + this.unauthenticatedTimeoutInSeconds = headers.unauthenticatedTimeoutInSeconds.getValue(Long.class); + + this.serverProperties = new ServerProperties( + headers.serverAgent.getValue(String.class), headers.serverVersion.getValue(String.class) + ); } @JsonProperty - public UUID getActivityId() { - return this.frame.getActivityId(); + public UUID activityId() { + return this.activityId; } @JsonProperty - public String getClientVersion() { - return this.headers.clientVersion.getValue(String.class); + public String clientVersion() { + return this.clientVersion; } @JsonProperty - public long getIdleTimeoutInSeconds() { - return this.headers.idleTimeoutInSeconds.getValue(Long.class); + public long idleTimeoutInSeconds() { + return this.idleTimeoutInSeconds; } @JsonProperty - public int getProtocolVersion() { - return this.headers.protocolVersion.getValue(Long.class).intValue(); + public int protocolVersion() { + return this.protocolVersion; } @JsonProperty - public ServerProperties getServerProperties() { - return this.serverProperties == null ? (this.serverProperties = new ServerProperties( - this.headers.serverAgent.getValue(String.class), - this.headers.serverVersion.getValue(String.class)) - ) : this.serverProperties; + public ServerProperties serverProperties() { + return this.serverProperties; } @JsonIgnore - public String getServerVersion() { - return this.headers.serverVersion.getValue(String.class); + public String serverVersion() { + return this.serverProperties.getVersion(); + } + + @JsonIgnore + public HttpResponseStatus status() { + return this.status; } @JsonProperty public int getStatusCode() { - return this.frame.getStatusCode(); + return this.status.code(); } @JsonProperty public long getUnauthenticatedTimeoutInSeconds() { - return this.headers.unauthenticatedTimeoutInSeconds.getValue(Long.class); + return this.unauthenticatedTimeoutInSeconds; } public static RntbdContext decode(final ByteBuf in) { in.markReaderIndex(); - final RntbdResponseStatus frame = RntbdResponseStatus.decode(in); - final int statusCode = frame.getStatusCode(); - final int headersLength = frame.getHeadersLength(); + final RntbdResponseStatus responseStatus = RntbdResponseStatus.decode(in); + final int statusCode = responseStatus.getStatusCode(); + final int headersLength = responseStatus.getHeadersLength(); if (statusCode < 200 || statusCode >= 400) { if (!RntbdFramer.canDecodePayload(in, in.readerIndex() + headersLength)) { @@ -110,21 +127,31 @@ public static RntbdContext decode(final ByteBuf in) { map.put("serverVersion", headers.serverVersion.getValue()); } - throw new RntbdContextException(frame.getStatus(), details, Collections.unmodifiableMap(map)); - } + headers.releaseBuffers(); + throw new RntbdContextException(responseStatus.getStatus(), details, Collections.unmodifiableMap(map)); - return new RntbdContext(frame, headers); + } else { + RntbdContext context = new RntbdContext(responseStatus, headers); + headers.releaseBuffers(); + return context; + } } public void encode(final ByteBuf out) { + final Headers headers = new Headers(this); + final int length = RntbdResponseStatus.LENGTH + headers.computeLength(); + final RntbdResponseStatus responseStatus = new RntbdResponseStatus(length, this.status(), this.activityId()); + final int start = out.writerIndex(); - this.frame.encode(out); - this.headers.encode(out); + responseStatus.encode(out); + headers.encode(out); + headers.releaseBuffers(); + + final int end = out.writerIndex(); - final int length = out.writerIndex() - start; - checkState(length == this.frame.getLength()); + checkState(end - start == responseStatus.getLength()); } public static RntbdContext from(final RntbdContextRequest request, final ServerProperties properties, final HttpResponseStatus status) { @@ -134,7 +161,7 @@ public static RntbdContext from(final RntbdContextRequest request, final ServerP // In its current form this method is meant to enable a limited set of test scenarios. It will be revised as // required to support test scenarios as they are developed. - final Headers headers = new Headers(); + final Headers headers = new Headers(Unpooled.EMPTY_BUFFER); headers.clientVersion.setValue(request.getClientVersion()); headers.idleTimeoutInSeconds.setValue(0); @@ -146,29 +173,37 @@ public static RntbdContext from(final RntbdContextRequest request, final ServerP final int length = RntbdResponseStatus.LENGTH + headers.computeLength(); final UUID activityId = request.getActivityId(); - final RntbdResponseStatus frame = new RntbdResponseStatus(length, status, activityId); + final RntbdResponseStatus responseStatus = new RntbdResponseStatus(length, status, activityId); - return new RntbdContext(frame, headers); + return new RntbdContext(responseStatus, headers); } @Override public String toString() { - return RntbdObjectMapper.toJson(this); + return RntbdObjectMapper.toString(this); } private static final class Headers extends RntbdTokenStream { - RntbdToken clientVersion; - RntbdToken idleTimeoutInSeconds; - RntbdToken protocolVersion; - RntbdToken serverAgent; - RntbdToken serverVersion; - RntbdToken unauthenticatedTimeoutInSeconds; - - Headers() { - - super(RntbdContextHeader.set, RntbdContextHeader.map); + final RntbdToken clientVersion; + final RntbdToken idleTimeoutInSeconds; + final RntbdToken protocolVersion; + final RntbdToken serverAgent; + final RntbdToken serverVersion; + final RntbdToken unauthenticatedTimeoutInSeconds; + + private Headers(final RntbdContext context) { + this(Unpooled.EMPTY_BUFFER); + this.clientVersion.setValue(context.clientVersion()); + this.idleTimeoutInSeconds.setValue(context.idleTimeoutInSeconds()); + this.protocolVersion.setValue(context.protocolVersion()); + this.serverAgent.setValue(context.serverProperties().getAgent()); + this.serverVersion.setValue(context.serverProperties().getVersion()); + this.unauthenticatedTimeoutInSeconds.setValue(context.unauthenticatedTimeoutInSeconds); + } + Headers(final ByteBuf in) { + super(RntbdContextHeader.set, RntbdContextHeader.map, in); this.clientVersion = this.get(RntbdContextHeader.ClientVersion); this.idleTimeoutInSeconds = this.get(RntbdContextHeader.IdleTimeoutInSeconds); this.protocolVersion = this.get(RntbdContextHeader.ProtocolVersion); @@ -178,8 +213,8 @@ private static final class Headers extends RntbdTokenStream } static Headers decode(final ByteBuf in) { - final Headers headers = new Headers(); - Headers.decode(in, headers); + final Headers headers = new Headers(in); + Headers.decode(headers); return headers; } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextNegotiator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextNegotiator.java index 46f0490e1766..21489ae1f58b 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextNegotiator.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextNegotiator.java @@ -50,9 +50,7 @@ public RntbdContextNegotiator(final RntbdRequestManager manager, final UserAgent * @throws Exception thrown if an error occurs */ @Override - public void write( - final ChannelHandlerContext context, final Object message, final ChannelPromise promise - ) throws Exception { + public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise promise) throws Exception { checkArgument(message instanceof ByteBuf, "message: %s", message.getClass()); final ByteBuf out = (ByteBuf)message; @@ -77,7 +75,7 @@ private void startRntbdContextRequest(final ChannelHandlerContext context) throw final Channel channel = context.channel(); final RntbdContextRequest request = new RntbdContextRequest(Utils.randomUUID(), this.userAgent); - final CompletableFuture contextRequestFuture = this.manager.getRntbdContextRequestFuture(); + final CompletableFuture contextRequestFuture = this.manager.rntbdContextRequestFuture(); super.write(context, request, channel.newPromise().addListener((ChannelFutureListener)future -> { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequest.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequest.java index baa1f09cb5aa..13eda1ccb8b1 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequest.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectWriter; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import io.netty.handler.codec.CorruptedFrameException; import java.nio.charset.StandardCharsets; @@ -62,7 +64,7 @@ public static RntbdContextRequest decode(final ByteBuf in) { final int observedLength = in.readerIndex() - start; if (observedLength != expectedLength) { - final String reason = String.format("expectedLength=%d, observeredLength=%d", expectedLength, observedLength); + final String reason = Strings.lenientFormat("expectedLength=%s, observedLength=%s", expectedLength, observedLength); throw new IllegalStateException(reason); } @@ -84,7 +86,7 @@ public void encode(final ByteBuf out) { final int observedLength = out.writerIndex() - start; if (observedLength != expectedLength) { - final String reason = String.format("expectedLength=%d, observeredLength=%d", expectedLength, observedLength); + final String reason = Strings.lenientFormat("expectedLength=%s, observedLength=%s", expectedLength, observedLength); throw new IllegalStateException(reason); } } @@ -113,17 +115,15 @@ private static final class Headers extends RntbdTokenStream list(); @@ -38,6 +73,7 @@ interface Provider extends AutoCloseable { final class Config { + private final PooledByteBufAllocator allocator; private final Options options; private final SslContext sslContext; private final LogLevel wireLogLevel; @@ -47,52 +83,99 @@ public Config(final Options options, final SslContext sslContext, final LogLevel checkNotNull(options, "options"); checkNotNull(sslContext, "sslContext"); + int directArenaCount = PooledByteBufAllocator.defaultNumDirectArena(); + int heapArenaCount = PooledByteBufAllocator.defaultNumHeapArena(); + int pageSize = options.bufferPageSize(); + int maxOrder = Integer.numberOfTrailingZeros(options.maxBufferCapacity()) - Integer.numberOfTrailingZeros(pageSize); + + this.allocator = new PooledByteBufAllocator(heapArenaCount, directArenaCount, pageSize, maxOrder); this.options = options; this.sslContext = sslContext; this.wireLogLevel = wireLogLevel; } - public int getConnectionTimeout() { - final long value = this.options.getConnectionTimeout().toMillis(); + @JsonIgnore + public PooledByteBufAllocator allocator() { + return this.allocator; + } + + @JsonProperty + public int bufferPageSize() { + return this.options.bufferPageSize(); + } + + @JsonProperty + public int connectionTimeout() { + final long value = this.options.connectionTimeout().toMillis(); assert value <= Integer.MAX_VALUE; return (int)value; } - public int getMaxChannelsPerEndpoint() { - return this.options.getMaxChannelsPerEndpoint(); + @JsonProperty + public long idleConnectionTimeout() { + return this.options.idleChannelTimeout().toNanos(); + } + + @JsonProperty + public long idleEndpointTimeout() { + return this.options.idleEndpointTimeout().toNanos(); } - public int getMaxRequestsPerChannel() { - return this.options.getMaxRequestsPerChannel(); + @JsonProperty + public int maxBufferCapacity() { + return this.options.maxBufferCapacity(); } - public long getReceiveHangDetectionTime() { - return this.options.getReceiveHangDetectionTime().toNanos(); + @JsonProperty + public int maxChannelsPerEndpoint() { + return this.options.maxChannelsPerEndpoint(); } - public long getRequestTimeout() { - return this.options.getRequestTimeout().toNanos(); + @JsonProperty + public int maxRequestsPerChannel() { + return this.options.maxRequestsPerChannel(); } - public long getSendHangDetectionTime() { - return this.options.getSendHangDetectionTime().toNanos(); + @JsonProperty + public long receiveHangDetectionTime() { + return this.options.receiveHangDetectionTime().toNanos(); } - public SslContext getSslContext() { + @JsonProperty + public long requestTimeout() { + return this.options.requestTimeout().toNanos(); + } + + @JsonProperty + public long sendHangDetectionTime() { + return this.options.sendHangDetectionTime().toNanos(); + } + + @JsonProperty + public long shutdownTimeout() { + return this.options.shutdownTimeout().toNanos(); + } + + @JsonIgnore + public SslContext sslContext() { return this.sslContext; } - public UserAgentContainer getUserAgent() { - return this.options.getUserAgent(); + @JsonProperty + public UserAgentContainer userAgent() { + return this.options.userAgent(); } - public LogLevel getWireLogLevel() { + @JsonProperty + public LogLevel wireLogLevel() { return this.wireLogLevel; } @Override public String toString() { - return RntbdObjectMapper.toJson(this); + return RntbdObjectMapper.toString(this); } } + + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdFramer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdFramer.java index 7a612c85b5b5..6a8a070f2735 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdFramer.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdFramer.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.CorruptedFrameException; @@ -25,14 +26,14 @@ static boolean canDecodeHead(final ByteBuf in) throws CorruptedFrameException { final long length = in.getUnsignedIntLE(start); if (length > Integer.MAX_VALUE) { - final String reason = String.format("Head frame length exceeds Integer.MAX_VALUE, %d: %d", + final String reason = Strings.lenientFormat("Head frame length exceeds Integer.MAX_VALUE, %s: %s", Integer.MAX_VALUE, length ); throw new CorruptedFrameException(reason); } if (length < Integer.BYTES) { - final String reason = String.format("Head frame length is less than size of length field, %d: %d", + final String reason = Strings.lenientFormat("Head frame length is less than size of length field, %s: %s", Integer.BYTES, length ); throw new CorruptedFrameException(reason); @@ -60,7 +61,7 @@ static boolean canDecodePayload(final ByteBuf in, final int start) { final long length = in.getUnsignedIntLE(start); if (length > Integer.MAX_VALUE) { - final String reason = String.format("Payload frame length exceeds Integer.MAX_VALUE, %d: %d", + final String reason = Strings.lenientFormat("Payload frame length exceeds Integer.MAX_VALUE, %s: %s", Integer.MAX_VALUE, length ); throw new CorruptedFrameException(reason); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdHealthCheckRequest.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdHealthCheckRequest.java new file mode 100644 index 000000000000..ce2b0347ef3c --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdHealthCheckRequest.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.internal.directconnectivity.rntbd; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +final class RntbdHealthCheckRequest { + + public static final ByteBuf MESSAGE = Unpooled.EMPTY_BUFFER; + + private RntbdHealthCheckRequest() { + } +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdMetrics.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdMetrics.java index a32b86bff43a..a6f9dc5a5c91 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdMetrics.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdMetrics.java @@ -3,136 +3,266 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; -import com.codahale.metrics.Gauge; -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricFilter; +import com.azure.data.cosmos.internal.directconnectivity.RntbdTransportClient; +import com.codahale.metrics.ConsoleReporter; import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.RatioGauge; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.google.common.base.Stopwatch; - -import java.time.Duration; - +import com.google.common.net.PercentEscaper; +import io.micrometer.core.instrument.Clock; +import io.micrometer.core.instrument.Gauge; +import io.micrometer.core.instrument.Measurement; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.Tags; +import io.micrometer.core.instrument.Timer; +import io.micrometer.core.instrument.composite.CompositeMeterRegistry; +import io.micrometer.core.instrument.config.NamingConvention; +import io.micrometer.core.instrument.dropwizard.DropwizardConfig; +import io.micrometer.core.instrument.dropwizard.DropwizardMeterRegistry; +import io.micrometer.core.instrument.util.HierarchicalNameMapper; +import io.micrometer.core.lang.Nullable; + +import java.util.concurrent.TimeUnit; + +@SuppressWarnings("UnstableApiUsage") @JsonPropertyOrder({ - "lifetime", "requests", "responses", "errorResponses", "responseRate", "completionRate", "throughput" + "tags", "concurrentRequests", "requests", "responseErrors", "responseSuccesses", "completionRate", "responseRate", + "channelsAcquired", "channelsAvailable", "requestQueueLength", "usedDirectMemory", "usedHeapMemory" }) -public final class RntbdMetrics implements AutoCloseable { +public final class RntbdMetrics { // region Fields - private static final MetricRegistry registry = new MetricRegistry(); + private static final PercentEscaper escaper = new PercentEscaper("_-", false); + private static final CompositeMeterRegistry registry = new CompositeMeterRegistry(); - private final Gauge completionRate; - private final Meter errorResponses; - private final Stopwatch lifetime; - private final String prefix; - private final Meter requests; - private final Gauge responseRate; - private final Meter responses; + private static final String prefix = "azure.cosmos.directTcp."; + private static MeterRegistry consoleLoggingRegistry; - // endregion + private final RntbdTransportClient transportClient; + private final RntbdEndpoint endpoint; - // region Constructors + private final Timer requests; + private final Timer responseErrors; + private final Timer responseSuccesses; + private final Tags tags; - public RntbdMetrics(final String name) { + static { + int step = Integer.getInteger("azure.cosmos.monitoring.consoleLogging.step", 0); + if (step > 0) { + RntbdMetrics.add(RntbdMetrics.consoleLoggingRegistry(step)); + } + } - this.lifetime = Stopwatch.createStarted(); - this.prefix = name + '.'; + // endregion + + // region Constructors - this.requests = registry.register(this.prefix + "requests", new Meter()); - this.responses = registry.register(this.prefix + "responses", new Meter()); - this.errorResponses = registry.register(this.prefix + "errorResponses", new Meter()); - this.responseRate = registry.register(this.prefix + "responseRate", new ResponseRate(this)); - this.completionRate = registry.register(this.prefix + "completionRate", new CompletionRate(this)); + public RntbdMetrics(RntbdTransportClient client, RntbdEndpoint endpoint) { + + this.transportClient = client; + this.endpoint = endpoint; + + this.tags = Tags.of(client.tag(), endpoint.tag()); + this.requests = registry.timer(nameOf("requests"), tags); + this.responseErrors = registry.timer(nameOf("responseErrors"), tags); + this.responseSuccesses = registry.timer(nameOf("responseSuccesses"), tags); + + Gauge.builder(nameOf("endpoints"), client, RntbdTransportClient::endpointCount) + .description("endpoint count") + .tag(client.tag().getKey(), client.tag().getValue()) + .register(registry); + + Gauge.builder(nameOf("endpointsEvicted"), client, RntbdTransportClient::endpointEvictionCount) + .description("endpoint eviction count") + .tag(client.tag().getKey(), client.tag().getValue()) + .register(registry); + + Gauge.builder(nameOf("concurrentRequests"), endpoint, RntbdEndpoint::concurrentRequests) + .description("executing or queued request count") + .tags(this.tags) + .register(registry); + + Gauge.builder(nameOf("requestQueueLength"), endpoint, RntbdEndpoint::requestQueueLength) + .description("queued request count") + .tags(this.tags) + .register(registry); + + Gauge.builder(nameOf("channelsAcquired"), endpoint, RntbdEndpoint::channelsAcquired) + .description("acquired channel count") + .tags(this.tags) + .register(registry); + + Gauge.builder(nameOf("channelsAvailable"), endpoint, RntbdEndpoint::channelsAvailable) + .description("available channel count") + .tags(this.tags) + .register(registry); + + Gauge.builder(nameOf("usedDirectMemory"), endpoint, x -> x.usedDirectMemory()) + .description("Java direct memory usage") + .baseUnit("bytes") + .tags(this.tags) + .register(registry); + + Gauge.builder(nameOf("usedHeapMemory"), endpoint, x -> x.usedHeapMemory()) + .description("Java heap memory usage") + .baseUnit("MiB") + .tags(this.tags) + .register(registry); } // endregion // region Accessors - public double getCompletionRate() { - return this.completionRate.getValue(); + @JsonIgnore + private static synchronized MeterRegistry consoleLoggingRegistry(final int step) { + + if (consoleLoggingRegistry == null) { + + MetricRegistry dropwizardRegistry = new MetricRegistry(); + + ConsoleReporter consoleReporter = ConsoleReporter + .forRegistry(dropwizardRegistry) + .convertRatesTo(TimeUnit.SECONDS) + .convertDurationsTo(TimeUnit.MILLISECONDS) + .build(); + + consoleReporter.start(step, TimeUnit.SECONDS); + + DropwizardConfig dropwizardConfig = new DropwizardConfig() { + + @Override + public String get(@Nullable String key) { + return null; + } + + @Override + public String prefix() { + return "console"; + } + + }; + + consoleLoggingRegistry = new DropwizardMeterRegistry(dropwizardConfig, dropwizardRegistry, HierarchicalNameMapper.DEFAULT, Clock.SYSTEM) { + @Override + @Nullable + protected Double nullGaugeValue() { + return null; + } + }; + + consoleLoggingRegistry.config().namingConvention(NamingConvention.dot); + } + + return consoleLoggingRegistry; } - public long getErrorResponses() { - return this.errorResponses.getCount(); + @JsonProperty + public int channelsAcquired() { + return this.endpoint.channelsAcquired(); } - public double getLifetime() { - final Duration elapsed = this.lifetime.elapsed(); - return elapsed.getSeconds() + (1E-9D * elapsed.getNano()); + @JsonProperty + public int channelsAvailable() { + return this.endpoint.channelsAvailable(); } - public long getRequests() { - return this.requests.getCount(); + /*** + * Computes the number of successful (non-error) responses received divided by the number of completed requests + * + * @return The number of successful (non-error) responses received divided by the number of completed requests + */ + @JsonProperty + public double completionRate() { + return this.responseSuccesses.count() / (double)this.requests.count(); } - public double getResponseRate() { - return this.responseRate.getValue(); + @JsonProperty + public long concurrentRequests() { + return this.endpoint.concurrentRequests(); } - public long getResponses() { - return this.responses.getCount(); + @JsonProperty + public int endpoints() { + return this.transportClient.endpointCount(); } - public double getThroughput() { - return this.responses.getMeanRate(); + @JsonProperty + public int requestQueueLength() { + return this.endpoint.requestQueueLength(); } - // endregion + @JsonProperty + public Iterable requests() { + return this.requests.measure(); + } - // region Methods + @JsonProperty + public Iterable responseErrors() { + return this.responseErrors.measure(); + } - @Override - public void close() { - registry.removeMatching(MetricFilter.startsWith(this.prefix)); + /*** + * Computes the number of successful (non-error) responses received divided by the number of requests sent + * + * @return The number of successful (non-error) responses received divided by the number of requests sent + */ + @JsonProperty + public double responseRate() { + return this.responseSuccesses.count() / (double)(this.requests.count() + this.endpoint.concurrentRequests()); } - public final void incrementErrorResponseCount() { - this.errorResponses.mark(); + @JsonProperty + public Iterable responseSuccesses() { + return this.responseSuccesses.measure(); } - public final void incrementRequestCount() { - this.requests.mark(); + @JsonProperty + public Iterable tags() { + return this.tags; } - public final void incrementResponseCount() { - this.responses.mark(); + @JsonProperty + public long usedDirectMemory() { + return this.endpoint.usedDirectMemory(); } - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); + @JsonProperty + public long usedHeapMemory() { + return this.endpoint.usedHeapMemory(); } // endregion - private static final class CompletionRate extends RatioGauge { + // region Methods - private final RntbdMetrics metrics; + public static void add(MeterRegistry registry) { + RntbdMetrics.registry.add(registry); + } - private CompletionRate(RntbdMetrics metrics) { - this.metrics = metrics; - } + public void markComplete(RntbdRequestRecord record) { + record.stop(this.requests, record.isCompletedExceptionally() ? this.responseErrors : this.responseSuccesses); + } - @Override - protected Ratio getRatio() { - return Ratio.of(this.metrics.responses.getCount() - this.metrics.errorResponses.getCount(), - this.metrics.requests.getCount()); - } + public static String escape(String value) { + return escaper.escape(value); } - private static final class ResponseRate extends RatioGauge { + @Override + public String toString() { + return RntbdObjectMapper.toString(this); + } - private final RntbdMetrics metrics; + // endregion - private ResponseRate(RntbdMetrics metrics) { - this.metrics = metrics; - } + // region Private - @Override - protected Ratio getRatio() { - return Ratio.of(this.metrics.responses.getCount(), this.metrics.requests.getCount()); - } + private static String nameOf(final String member) { + return prefix + member; } + + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdObjectMapper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdObjectMapper.java index 77fe5133756e..de59bf295b36 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdObjectMapper.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdObjectMapper.java @@ -11,28 +11,50 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.PropertyFilter; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufInputStream; import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.EncoderException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; +import java.util.concurrent.ConcurrentHashMap; import static com.google.common.base.Preconditions.checkNotNull; public final class RntbdObjectMapper { - private static final SimpleFilterProvider filterProvider; - private static final ObjectMapper objectMapper; - private static final ObjectWriter objectWriter; + private static final Logger logger = LoggerFactory.getLogger(RntbdObjectMapper.class); + private static final SimpleFilterProvider filterProvider = new SimpleFilterProvider(); + private static final ObjectMapper objectMapper = new ObjectMapper().setFilterProvider(filterProvider); + private static final ObjectWriter objectWriter = objectMapper.writer(); + private static final ConcurrentHashMap, String> simpleClassNames = new ConcurrentHashMap<>(); - static { - objectMapper = new ObjectMapper().setFilterProvider(filterProvider = new SimpleFilterProvider()); - objectWriter = objectMapper.writer(); + private RntbdObjectMapper() { } - private RntbdObjectMapper() { + public static String toJson(final Object value) { + try { + return objectWriter.writeValueAsString(value); + } catch (final JsonProcessingException error) { + logger.error("could not convert {} value to JSON due to:", value.getClass(), error); + try { + return Strings.lenientFormat("{\"error\":%s", objectWriter.writeValueAsString(error.toString())); + } catch (final JsonProcessingException exception) { + return "null"; + } + } + } + + public static String toString(final Object value) { + final String name = simpleClassNames.computeIfAbsent(value.getClass(), Class::getSimpleName); + return Strings.lenientFormat("%s(%s)", name, toJson(value)); + } + + public static ObjectWriter writer() { + return objectWriter; } static ObjectNode readTree(final RntbdResponse response) { @@ -55,7 +77,7 @@ static ObjectNode readTree(final ByteBuf in) { return (ObjectNode)node; } - final String cause = String.format("Expected %s, not %s", JsonNodeType.OBJECT, node.getNodeType()); + final String cause = Strings.lenientFormat("Expected %s, not %s", JsonNodeType.OBJECT, node.getNodeType()); throw new CorruptedFrameException(cause); } @@ -70,16 +92,4 @@ static void registerPropertyFilter(final Class type, final Class arg == null ? "null" : arg.toString()).collect(Collectors.joining(",") ), @@ -106,4 +128,6 @@ public void traceOperation(final Logger logger, final ChannelHandlerContext cont ); } } + + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFrame.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFrame.java index aadbe1e1cd28..53e172414f4d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFrame.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFrame.java @@ -5,9 +5,9 @@ import com.azure.data.cosmos.internal.OperationType; import com.azure.data.cosmos.internal.ResourceType; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; -import java.util.Locale; import java.util.UUID; import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdConstants.RntbdOperationType; @@ -129,7 +129,7 @@ private static RntbdResourceType map(final ResourceType resourceType) { case RidRange: return RntbdResourceType.RidRange; default: - final String reason = String.format(Locale.ROOT, "Unrecognized resource type: %s", resourceType); + final String reason = Strings.lenientFormat("Unrecognized resource type: %s", resourceType); throw new UnsupportedOperationException(reason); } } @@ -204,7 +204,7 @@ private static RntbdOperationType map(final OperationType operationType) { case AddComputeGatewayRequestCharges: return RntbdOperationType.AddComputeGatewayRequestCharges; default: - final String reason = String.format(Locale.ROOT, "Unrecognized operation type: %s", operationType); + final String reason = Strings.lenientFormat("Unrecognized operation type: %s", operationType); throw new UnsupportedOperationException(reason); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestHeaders.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestHeaders.java index 86224ce7a91a..e3223d17cf05 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestHeaders.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestHeaders.java @@ -3,7 +3,6 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; - import com.azure.data.cosmos.ConsistencyLevel; import com.azure.data.cosmos.IndexingDirective; import com.azure.data.cosmos.internal.ContentSerializationFormat; @@ -18,6 +17,7 @@ import com.azure.data.cosmos.internal.RxDocumentServiceRequest; import com.fasterxml.jackson.annotation.JsonFilter; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; @@ -53,17 +53,17 @@ final class RntbdRequestHeaders extends RntbdTokenStream { RntbdRequestHeaders(final RntbdRequestArgs args, final RntbdRequestFrame frame) { - this(); + this(Unpooled.EMPTY_BUFFER); checkNotNull(args, "args"); checkNotNull(frame, "frame"); - final RxDocumentServiceRequest request = args.getServiceRequest(); + final RxDocumentServiceRequest request = args.serviceRequest(); final byte[] content = request.getContent(); this.getPayloadPresent().setValue(content != null && content.length > 0); - this.getReplicaPath().setValue(args.getReplicaPath()); - this.getTransportRequestID().setValue(args.getTransportRequestId()); + this.getReplicaPath().setValue(args.replicaPath()); + this.getTransportRequestID().setValue(args.transportRequestId()); final Map headers = request.getHeaders(); @@ -156,8 +156,8 @@ final class RntbdRequestHeaders extends RntbdTokenStream { this.fillTokenFromHeader(headers, this::getClientVersion, HttpHeaders.VERSION); } - private RntbdRequestHeaders() { - super(RntbdRequestHeader.set, RntbdRequestHeader.map); + private RntbdRequestHeaders(ByteBuf in) { + super(RntbdRequestHeader.set, RntbdRequestHeader.map, in); } // endregion @@ -165,8 +165,8 @@ private RntbdRequestHeaders() { // region Methods static RntbdRequestHeaders decode(final ByteBuf in) { - final RntbdRequestHeaders metadata = new RntbdRequestHeaders(); - return RntbdRequestHeaders.decode(in, metadata); + final RntbdRequestHeaders metadata = new RntbdRequestHeaders(in); + return RntbdRequestHeaders.decode(metadata); } // endregion diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestManager.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestManager.java index 66532b30050f..426242e1804a 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestManager.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestManager.java @@ -26,7 +26,6 @@ import com.azure.data.cosmos.ServiceUnavailableException; import com.azure.data.cosmos.UnauthorizedException; import com.azure.data.cosmos.internal.directconnectivity.StoreResponse; -import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdConstants.RntbdResponseHeader; import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; @@ -40,15 +39,20 @@ import io.netty.channel.ChannelPromise; import io.netty.channel.CoalescingBufferQueue; import io.netty.channel.EventLoop; +import io.netty.channel.pool.ChannelHealthChecker; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.ssl.SslHandler; -import io.netty.util.ReferenceCountUtil; +import io.netty.handler.timeout.IdleStateEvent; +import io.netty.util.ReferenceCounted; import io.netty.util.Timeout; import io.netty.util.concurrent.EventExecutor; +import io.netty.util.concurrent.Future; +import io.netty.util.internal.ThrowableUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.SocketAddress; +import java.nio.channels.ClosedChannelException; import java.util.Map; import java.util.Optional; import java.util.UUID; @@ -58,31 +62,46 @@ import static com.azure.data.cosmos.internal.HttpConstants.StatusCodes; import static com.azure.data.cosmos.internal.HttpConstants.SubStatusCodes; -import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdReporter.reportIssue; -import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless; +import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdClientChannelHealthChecker.Timestamps; +import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdConstants.RntbdResponseHeader; import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; +import static com.google.common.base.Preconditions.checkNotNull; public final class RntbdRequestManager implements ChannelHandler, ChannelInboundHandler, ChannelOutboundHandler { // region Fields + private static final ClosedChannelException ON_CHANNEL_UNREGISTERED = + ThrowableUtil.unknownStackTrace(new ClosedChannelException(), RntbdRequestManager.class, "channelUnregistered"); + + private static final ClosedChannelException ON_CLOSE = + ThrowableUtil.unknownStackTrace(new ClosedChannelException(), RntbdRequestManager.class, "close"); + + private static final ClosedChannelException ON_DEREGISTER = + ThrowableUtil.unknownStackTrace(new ClosedChannelException(), RntbdRequestManager.class, "deregister"); + private static final Logger logger = LoggerFactory.getLogger(RntbdRequestManager.class); private final CompletableFuture contextFuture = new CompletableFuture<>(); private final CompletableFuture contextRequestFuture = new CompletableFuture<>(); - private final ConcurrentHashMap pendingRequests; + private final ChannelHealthChecker healthChecker; private final int pendingRequestLimit; + private final ConcurrentHashMap pendingRequests; + private final Timestamps timestamps = new Timestamps(); private boolean closingExceptionally = false; private CoalescingBufferQueue pendingWrites; // endregion - public RntbdRequestManager(int capacity) { - checkArgument(capacity > 0, "capacity: %s", capacity); - this.pendingRequests = new ConcurrentHashMap<>(capacity); - this.pendingRequestLimit = capacity; + public RntbdRequestManager(final ChannelHealthChecker healthChecker, final int pendingRequestLimit) { + + checkArgument(pendingRequestLimit > 0, "pendingRequestLimit: %s", pendingRequestLimit); + checkNotNull(healthChecker, "healthChecker"); + + this.pendingRequests = new ConcurrentHashMap<>(pendingRequestLimit); + this.pendingRequestLimit = pendingRequestLimit; + this.healthChecker = healthChecker; } // region ChannelHandler methods @@ -124,7 +143,7 @@ public void channelActive(final ChannelHandlerContext context) { } /** - * Completes all pending requests exceptionally when a channel reaches the end of its lifetime + * The {@link Channel} of the {@link ChannelHandlerContext} was registered and has reached the end of its lifetime *

* This method will only be called after the channel is closed. * @@ -136,39 +155,51 @@ public void channelInactive(final ChannelHandlerContext context) { context.fireChannelInactive(); } + /** + * The {@link Channel} of the {@link ChannelHandlerContext} has read a message from its peer + *

+ * + * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs + * @param message The message read + */ @Override public void channelRead(final ChannelHandlerContext context, final Object message) { this.traceOperation(context, "channelRead"); - if (message instanceof RntbdResponse) { + try { + if (message instanceof RntbdResponse) { - try { - this.messageReceived(context, (RntbdResponse)message); - } catch (Throwable throwable) { - reportIssue(logger, context, "{} ", message, throwable); - this.exceptionCaught(context, throwable); - } finally { - ReferenceCountUtil.release(message); - } + try { + this.messageReceived(context, (RntbdResponse)message); + } catch (Throwable throwable) { + reportIssue(context, "{} ", message, throwable); + this.exceptionCaught(context, throwable); + } - } else { + } else { - final IllegalStateException error = new IllegalStateException( - Strings.lenientFormat("expected message of %s, not %s: %s", - RntbdResponse.class, message.getClass(), message - ) - ); + final IllegalStateException error = new IllegalStateException( + Strings.lenientFormat("expected message of %s, not %s: %s", + RntbdResponse.class, message.getClass(), message + ) + ); - reportIssue(logger, context, "", error); - this.exceptionCaught(context, error); + reportIssue(context, "", error); + this.exceptionCaught(context, error); + } + } finally { + if (message instanceof ReferenceCounted) { + boolean released = ((ReferenceCounted)message).release(); + reportIssueUnless(released, context, "failed to release message: {}", message); + } } } /** - * Invoked when the last message read by the current read operation has been consumed + * The {@link Channel} of the {@link ChannelHandlerContext} has fully consumed the most-recent message read *

- * If {@link ChannelOption#AUTO_READ} is off, no further attempt to read an inbound data from the current + * If {@link ChannelOption#AUTO_READ} is off, no further attempt to read inbound data from the current * {@link Channel} will be made until {@link ChannelHandlerContext#read} is called. This leaves time * for outbound messages to be written. * @@ -177,6 +208,7 @@ public void channelRead(final ChannelHandlerContext context, final Object messag @Override public void channelReadComplete(final ChannelHandlerContext context) { this.traceOperation(context, "channelReadComplete"); + this.timestamps.channelReadCompleted(); context.fireChannelReadComplete(); } @@ -195,7 +227,7 @@ public void channelRegistered(final ChannelHandlerContext context) { this.traceOperation(context, "channelRegistered"); - checkState(this.pendingWrites == null, "pendingWrites: %s", this.pendingWrites); + reportIssueUnless(this.pendingWrites == null, context, "pendingWrites: {}", pendingWrites); this.pendingWrites = new CoalescingBufferQueue(context.channel()); context.fireChannelRegistered(); @@ -211,9 +243,11 @@ public void channelUnregistered(final ChannelHandlerContext context) { this.traceOperation(context, "channelUnregistered"); - checkState(this.pendingWrites != null, "pendingWrites: null"); - this.completeAllPendingRequestsExceptionally(context, ClosedWithPendingRequestsException.INSTANCE); - this.pendingWrites = null; + if (!this.closingExceptionally) { + this.completeAllPendingRequestsExceptionally(context, ON_CHANNEL_UNREGISTERED); + } else { + logger.warn("{} channelUnregistered exceptionally", context); + } context.fireChannelUnregistered(); } @@ -253,12 +287,9 @@ public void exceptionCaught(final ChannelHandlerContext context, final Throwable this.traceOperation(context, "exceptionCaught", cause); if (!this.closingExceptionally) { - - reportIssueUnless(cause != ClosedWithPendingRequestsException.INSTANCE, logger, context, - "expected an exception other than ", ClosedWithPendingRequestsException.INSTANCE); - this.completeAllPendingRequestsExceptionally(context, cause); - context.pipeline().flush().close(); + logger.warn("{} closing due to:", context, cause); + context.flush().close(); } } @@ -276,6 +307,27 @@ public void userEventTriggered(final ChannelHandlerContext context, final Object this.traceOperation(context, "userEventTriggered", event); try { + + if (event instanceof IdleStateEvent) { + + this.healthChecker.isHealthy(context.channel()).addListener((Future future) -> { + + final Throwable cause; + + if (future.isSuccess()) { + if (future.get()) { + return; + } + cause = UnhealthyChannelException.INSTANCE; + } else { + cause = future.cause(); + } + + this.exceptionCaught(context, cause); + }); + + return; + } if (event instanceof RntbdContext) { this.contextFuture.complete((RntbdContext)event); this.removeContextNegotiatorAndFlushPendingWrites(context); @@ -289,7 +341,7 @@ public void userEventTriggered(final ChannelHandlerContext context, final Object context.fireUserEventTriggered(event); } catch (Throwable error) { - reportIssue(logger, context, "{}: ", event, error); + reportIssue(context, "{}: ", event, error); this.exceptionCaught(context, error); } } @@ -322,7 +374,12 @@ public void close(final ChannelHandlerContext context, final ChannelPromise prom this.traceOperation(context, "close"); - this.completeAllPendingRequestsExceptionally(context, ClosedWithPendingRequestsException.INSTANCE); + if (!this.closingExceptionally) { + this.completeAllPendingRequestsExceptionally(context, ON_CLOSE); + } else { + logger.warn("{} closed exceptionally", context); + } + final SslHandler sslHandler = context.pipeline().get(SslHandler.class); if (sslHandler != null) { @@ -355,12 +412,20 @@ public void connect( /** * Called once a deregister operation is made from the current registered {@link EventLoop}. * - * @param context the {@link ChannelHandlerContext} for which the close operation is made + * @param context the {@link ChannelHandlerContext} for which the deregister operation is made * @param promise the {@link ChannelPromise} to notify once the operation completes */ @Override public void deregister(final ChannelHandlerContext context, final ChannelPromise promise) { + this.traceOperation(context, "deregister"); + + if (!this.closingExceptionally) { + this.completeAllPendingRequestsExceptionally(context, ON_DEREGISTER); + } else { + logger.warn("{} deregistered exceptionally", context); + } + context.deregister(promise); } @@ -414,34 +479,59 @@ public void read(final ChannelHandlerContext context) { public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise promise) { // TODO: DANOBLE: Ensure that all write errors are reported with a root cause of type EncoderException + // Requires a full scan of the rntbd code this.traceOperation(context, "write", message); if (message instanceof RntbdRequestRecord) { - context.write(this.addPendingRequestRecord(context, (RntbdRequestRecord)message), promise); + this.timestamps.channelWriteAttempted(); - } else { + context.write(this.addPendingRequestRecord(context, (RntbdRequestRecord)message), promise).addListener(completed -> { + if (completed.isSuccess()) { + this.timestamps.channelWriteCompleted(); + } + }); - final IllegalStateException error = new IllegalStateException( - Strings.lenientFormat("expected message of %s, not %s: %s", - RntbdRequestRecord.class, message.getClass(), message - ) - ); + return; + } - reportIssue(logger, context, "", error); - this.exceptionCaught(context, error); + if (message == RntbdHealthCheckRequest.MESSAGE) { + + context.write(RntbdHealthCheckRequest.MESSAGE, promise).addListener(completed -> { + if (completed.isSuccess()) { + this.timestamps.channelPingCompleted(); + } + }); + + return; } + + final IllegalStateException error = new IllegalStateException(Strings.lenientFormat("message of %s: %s", message.getClass(), message)); + reportIssue(context, "", error); + this.exceptionCaught(context, error); } // endregion - // region Private and package private methods + // region Package private methods - CompletableFuture getRntbdContextRequestFuture() { + int pendingRequestCount() { + return this.pendingRequests.size(); + } + + Optional rntbdContext() { + return Optional.of(this.contextFuture.getNow(null)); + } + + CompletableFuture rntbdContextRequestFuture() { return this.contextRequestFuture; } + boolean hasRequestedRntbdContext() { + return this.contextRequestFuture.getNow(null) != null; + } + boolean hasRntbdContext() { return this.contextFuture.getNow(null) != null; } @@ -455,11 +545,22 @@ void pendWrite(final ByteBuf out, final ChannelPromise promise) { this.pendingWrites.add(out, promise); } + RntbdClientChannelHealthChecker.Timestamps snapshotTimestamps() { + return new RntbdClientChannelHealthChecker.Timestamps(this.timestamps); + } + + // endregion + + // region Private methods + private RntbdRequestArgs addPendingRequestRecord(final ChannelHandlerContext context, final RntbdRequestRecord record) { - return this.pendingRequests.compute(record.getTransportRequestId(), (id, current) -> { + return this.pendingRequests.compute(record.transportRequestId(), (id, current) -> { + + boolean predicate = current == null; + String format = "id: {}, current: {}, request: {}"; - reportIssueUnless(current == null, logger, context, "id: {}, current: {}, request: {}", id, current, record); + reportIssueUnless(predicate, context, format, record); final Timeout pendingRequestTimeout = record.newTimeout(timeout -> { @@ -481,31 +582,17 @@ private RntbdRequestArgs addPendingRequestRecord(final ChannelHandlerContext con return record; - }).getArgs(); - } - - private Optional getRntbdContext() { - return Optional.of(this.contextFuture.getNow(null)); + }).args(); } private void completeAllPendingRequestsExceptionally(final ChannelHandlerContext context, final Throwable throwable) { - if (this.closingExceptionally) { - - reportIssueUnless(throwable == ClosedWithPendingRequestsException.INSTANCE, logger, context, - "throwable: ", throwable); - - reportIssueUnless(this.pendingRequests.isEmpty() && this.pendingWrites.isEmpty(), logger, context, - "pendingRequests: {}, pendingWrites: {}", this.pendingRequests.isEmpty(), - this.pendingWrites.isEmpty()); - - return; - } - + reportIssueUnless(!this.closingExceptionally, context, "", throwable); this.closingExceptionally = true; - if (!this.pendingWrites.isEmpty()) { - this.pendingWrites.releaseAndFailAll(context, ClosedWithPendingRequestsException.INSTANCE); + if (this.pendingWrites != null && !this.pendingWrites.isEmpty()) { + // an expensive call that fires at least one exceptionCaught event + this.pendingWrites.releaseAndFailAll(context, throwable); } if (!this.pendingRequests.isEmpty()) { @@ -560,10 +647,10 @@ private void completeAllPendingRequestsExceptionally(final ChannelHandlerContext final String message = Strings.lenientFormat("%s %s with %s pending requests", context, phrase, count); final Exception cause; - if (throwable == ClosedWithPendingRequestsException.INSTANCE) { + if (throwable instanceof ClosedChannelException) { cause = contextRequestException == null - ? ClosedWithPendingRequestsException.INSTANCE + ? (ClosedChannelException)throwable : contextRequestException; } else { @@ -575,8 +662,8 @@ private void completeAllPendingRequestsExceptionally(final ChannelHandlerContext for (RntbdRequestRecord record : this.pendingRequests.values()) { - final Map requestHeaders = record.getArgs().getServiceRequest().getHeaders(); - final String requestUri = record.getArgs().getPhysicalAddress().toString(); + final Map requestHeaders = record.args().serviceRequest().getHeaders(); + final String requestUri = record.args().physicalAddress().toString(); final GoneException error = new GoneException(message, cause, (Map)null, requestUri); BridgeInternal.setRequestHeaders(error, requestHeaders); @@ -597,14 +684,14 @@ private void messageReceived(final ChannelHandlerContext context, final RntbdRes final Long transportRequestId = response.getTransportRequestId(); if (transportRequestId == null) { - reportIssue(logger, context, "{} ignored because there is no transport request identifier, response"); + reportIssue(context, "response ignored because its transport request identifier is missing: {}", response); return; } final RntbdRequestRecord pendingRequest = this.pendingRequests.get(transportRequestId); if (pendingRequest == null) { - reportIssue(logger, context, "{} ignored because there is no matching pending request", response); + logger.warn("{} response ignored because there is no matching pending request: {}", context, response); return; } @@ -629,14 +716,14 @@ private void messageReceived(final ChannelHandlerContext context, final RntbdRes // ..Create Error instance - final CosmosError cosmosError = response.hasPayload() ? + final CosmosError error = response.hasPayload() ? BridgeInternal.createCosmosError(RntbdObjectMapper.readTree(response)) : new CosmosError(Integer.toString(status.code()), status.reasonPhrase(), status.codeClass().name()); // ..Map RNTBD response headers to HTTP response headers final Map responseHeaders = response.getHeaders().asMap( - this.getRntbdContext().orElseThrow(IllegalStateException::new), activityId + this.rntbdContext().orElseThrow(IllegalStateException::new), activityId ); // ..Create CosmosClientException based on status and sub-status codes @@ -644,15 +731,15 @@ private void messageReceived(final ChannelHandlerContext context, final RntbdRes switch (status.code()) { case StatusCodes.BADREQUEST: - cause = new BadRequestException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new BadRequestException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.CONFLICT: - cause = new ConflictException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new ConflictException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.FORBIDDEN: - cause = new ForbiddenException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new ForbiddenException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.GONE: @@ -661,69 +748,69 @@ private void messageReceived(final ChannelHandlerContext context, final RntbdRes switch (subStatusCode) { case SubStatusCodes.COMPLETING_SPLIT: - cause = new PartitionKeyRangeIsSplittingException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new PartitionKeyRangeIsSplittingException(error, lsn, partitionKeyRangeId, responseHeaders); break; case SubStatusCodes.COMPLETING_PARTITION_MIGRATION: - cause = new PartitionIsMigratingException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new PartitionIsMigratingException(error, lsn, partitionKeyRangeId, responseHeaders); break; case SubStatusCodes.NAME_CACHE_IS_STALE: - cause = new InvalidPartitionException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new InvalidPartitionException(error, lsn, partitionKeyRangeId, responseHeaders); break; case SubStatusCodes.PARTITION_KEY_RANGE_GONE: - cause = new PartitionKeyRangeGoneException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new PartitionKeyRangeGoneException(error, lsn, partitionKeyRangeId, responseHeaders); break; default: - cause = new GoneException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new GoneException(error, lsn, partitionKeyRangeId, responseHeaders); break; } break; case StatusCodes.INTERNAL_SERVER_ERROR: - cause = new InternalServerErrorException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new InternalServerErrorException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.LOCKED: - cause = new LockedException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new LockedException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.METHOD_NOT_ALLOWED: - cause = new MethodNotAllowedException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new MethodNotAllowedException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.NOTFOUND: - cause = new NotFoundException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new NotFoundException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.PRECONDITION_FAILED: - cause = new PreconditionFailedException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new PreconditionFailedException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.REQUEST_ENTITY_TOO_LARGE: - cause = new RequestEntityTooLargeException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new RequestEntityTooLargeException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.REQUEST_TIMEOUT: - cause = new RequestTimeoutException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new RequestTimeoutException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.RETRY_WITH: - cause = new RetryWithException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new RetryWithException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.SERVICE_UNAVAILABLE: - cause = new ServiceUnavailableException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new ServiceUnavailableException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.TOO_MANY_REQUESTS: - cause = new RequestRateTooLargeException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new RequestRateTooLargeException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.UNAUTHORIZED: - cause = new UnauthorizedException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new UnauthorizedException(error, lsn, partitionKeyRangeId, responseHeaders); break; default: - cause = BridgeInternal.createCosmosClientException(status.code(), cosmosError, responseHeaders); + cause = BridgeInternal.createCosmosClientException(status.code(), error, responseHeaders); break; } @@ -739,9 +826,20 @@ private void removeContextNegotiatorAndFlushPendingWrites(final ChannelHandlerCo if (!this.pendingWrites.isEmpty()) { this.pendingWrites.writeAndRemoveAll(context); + context.flush(); } } + private static void reportIssue(final Object subject, final String format, final Object... args) { + RntbdReporter.reportIssue(logger, subject, format, args); + } + + private static void reportIssueUnless( + final boolean predicate, final Object subject, final String format, final Object... args + ) { + RntbdReporter.reportIssueUnless(logger, predicate, subject, format, args); + } + private void traceOperation(final ChannelHandlerContext context, final String operationName, final Object... args) { logger.trace("{}\n{}\n{}", operationName, context, args); } @@ -750,25 +848,17 @@ private void traceOperation(final ChannelHandlerContext context, final String op // region Types - private static class ClosedWithPendingRequestsException extends RuntimeException { + private static final class UnhealthyChannelException extends ChannelException { - static ClosedWithPendingRequestsException INSTANCE = new ClosedWithPendingRequestsException(); + static final UnhealthyChannelException INSTANCE = new UnhealthyChannelException(); - // TODO: DANOBLE: Consider revising strategy for closing an RntbdTransportClient with pending requests - // One possibility: - // A channel associated with an RntbdTransportClient will not be closed immediately, if there are any pending - // requests on it. Instead it will be scheduled to close after the request timeout interval (default: 60s) has - // elapsed. - // Algorithm: - // When the RntbdTransportClient is closed, it closes each of its RntbdServiceEndpoint instances. In turn each - // RntbdServiceEndpoint closes its RntbdClientChannelPool. The RntbdClientChannelPool.close method should - // schedule closure of any channel with pending requests for later; when the request timeout interval has - // elapsed or--ideally--when all pending requests have completed. - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/388987 + private UnhealthyChannelException() { + super("health check failed"); + } - private ClosedWithPendingRequestsException() { - super(null, null, /* enableSuppression */ false, /* writableStackTrace */ false); + @Override + public Throwable fillInStackTrace() { + return this; } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java index 719bb6b3c0af..d983db42b347 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java @@ -6,6 +6,7 @@ import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.RequestTimeoutException; import com.azure.data.cosmos.internal.directconnectivity.StoreResponse; +import io.micrometer.core.instrument.Timer; import io.netty.util.Timeout; import io.netty.util.TimerTask; @@ -18,8 +19,6 @@ public final class RntbdRequestRecord extends CompletableFuture { - private static final String simpleClassName = RntbdRequestRecord.class.getSimpleName(); - private final RntbdRequestArgs args; private final RntbdRequestTimer timer; @@ -32,33 +31,39 @@ public RntbdRequestRecord(final RntbdRequestArgs args, final RntbdRequestTimer t this.timer = timer; } - public UUID getActivityId() { - return this.args.getActivityId(); + // region Accessors + + public UUID activityId() { + return this.args.activityId(); } - public RntbdRequestArgs getArgs() { + public RntbdRequestArgs args() { return this.args; } - public long getBirthTime() { - return this.args.getBirthTime(); + public long creationTime() { + return this.args.creationTime(); } - public Duration getLifetime() { - return this.args.getLifetime(); + public Duration lifetime() { + return this.args.lifetime(); } - public long getTransportRequestId() { - return this.args.getTransportRequestId(); + public long transportRequestId() { + return this.args.transportRequestId(); } + // endregion + + // region Methods + public boolean expire() { final long timeoutInterval = this.timer.getRequestTimeout(TimeUnit.MILLISECONDS); final String message = String.format("Request timeout interval (%,d ms) elapsed", timeoutInterval); - final RequestTimeoutException error = new RequestTimeoutException(message, this.args.getPhysicalAddress()); + final RequestTimeoutException error = new RequestTimeoutException(message, this.args.physicalAddress()); - BridgeInternal.setRequestHeaders(error, this.args.getServiceRequest().getHeaders()); + BridgeInternal.setRequestHeaders(error, this.args.serviceRequest().getHeaders()); return this.completeExceptionally(error); } @@ -67,8 +72,14 @@ public Timeout newTimeout(final TimerTask task) { return this.timer.newTimeout(task); } + public long stop(Timer requests, Timer responses) { + return this.args.stop(requests, responses); + } + @Override public String toString() { - return simpleClassName + '(' + RntbdObjectMapper.toJson(this.args) + ')'; + return RntbdObjectMapper.toString(this.args); } + + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponse.java index 7af4d0e56c1a..279189b1247e 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponse.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponse.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.EmptyByteBuf; +import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.ReferenceCounted; import io.netty.util.ResourceLeakDetector; @@ -34,10 +34,8 @@ public final class RntbdResponse implements ReferenceCounted { // region Fields - private static final String simpleClassName = RntbdResponse.class.getSimpleName(); - - @JsonProperty @JsonSerialize(using = PayloadSerializer.class) + @JsonProperty private final ByteBuf content; @JsonProperty @@ -46,14 +44,17 @@ public final class RntbdResponse implements ReferenceCounted { @JsonProperty private final RntbdResponseHeaders headers; - private AtomicInteger referenceCount = new AtomicInteger(); + private final ByteBuf in; + + private final AtomicInteger referenceCount = new AtomicInteger(); // endregion public RntbdResponse(final UUID activityId, final int statusCode, final Map map, final ByteBuf content) { this.headers = RntbdResponseHeaders.fromMap(map, content.readableBytes() > 0); - this.content = content.retain(); + this.in = Unpooled.EMPTY_BUFFER; + this.content = content.copy().retain(); final HttpResponseStatus status = HttpResponseStatus.valueOf(statusCode); final int length = RntbdResponseStatus.LENGTH + this.headers.computeLength(); @@ -61,8 +62,10 @@ public RntbdResponse(final UUID activityId, final int statusCode, final Map { + return this.referenceCount.accumulateAndGet(decrement, (value, n) -> { + value = value - min(value, n); + if (value == 0) { - assert this.headers != null && this.content != null; + + checkState(this.headers != null && this.content != null); this.headers.releaseBuffers(); - this.content.release(); + + if (this.in != Unpooled.EMPTY_BUFFER) { + this.in.release(); + } + + if (this.content != Unpooled.EMPTY_BUFFER) { + this.content.release(); + } + + checkState(this.in == Unpooled.EMPTY_BUFFER || this.in.refCnt() == 0); + checkState(this.content == Unpooled.EMPTY_BUFFER || this.content.refCnt() == 0); } + return value; + }) == 0; } @@ -219,7 +241,7 @@ StoreResponse toStoreResponse(final RntbdContext context) { @Override public String toString() { - return simpleClassName + '(' + RntbdObjectMapper.toJson(this) + ')'; + return RntbdObjectMapper.toString(this); } /** diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseDecoder.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseDecoder.java index 5c4d06af57d4..1c963e97cfd4 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseDecoder.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseDecoder.java @@ -34,7 +34,8 @@ protected void decode(final ChannelHandlerContext context, final ByteBuf in, fin if (response != null) { Logger.debug("{} DECODE COMPLETE: {}", context.channel(), response); in.discardReadBytes(); - out.add(response.retain()); + response.retain(); + out.add(response); } } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseHeaders.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseHeaders.java index 1b6a9a95704f..c2732927b90c 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseHeaders.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseHeaders.java @@ -10,6 +10,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import io.netty.handler.codec.CorruptedFrameException; import java.math.BigDecimal; @@ -131,9 +132,9 @@ class RntbdResponseHeaders extends RntbdTokenStream { // endregion - private RntbdResponseHeaders() { + private RntbdResponseHeaders(ByteBuf in) { - super(RntbdResponseHeader.set, RntbdResponseHeader.map); + super(RntbdResponseHeader.set, RntbdResponseHeader.map, in); this.LSN = this.get(RntbdResponseHeader.LSN); this.collectionLazyIndexProgress = this.get(RntbdResponseHeader.CollectionLazyIndexProgress); @@ -193,7 +194,7 @@ boolean isPayloadPresent() { List> asList(final RntbdContext context, final UUID activityId) { final ImmutableList.Builder> builder = ImmutableList.builderWithExpectedSize(this.computeCount() + 2); - builder.add(new Entry(HttpHeaders.SERVER_VERSION, context.getServerVersion())); + builder.add(new Entry(HttpHeaders.SERVER_VERSION, context.serverVersion())); builder.add(new Entry(HttpHeaders.ACTIVITY_ID, activityId.toString())); this.collectEntries((token, toEntry) -> { @@ -208,7 +209,7 @@ List> asList(final RntbdContext context, final UUID ac public Map asMap(final RntbdContext context, final UUID activityId) { final ImmutableMap.Builder builder = ImmutableMap.builderWithExpectedSize(this.computeCount() + 2); - builder.put(new Entry(HttpHeaders.SERVER_VERSION, context.getServerVersion())); + builder.put(new Entry(HttpHeaders.SERVER_VERSION, context.serverVersion())); builder.put(new Entry(HttpHeaders.ACTIVITY_ID, activityId.toString())); this.collectEntries((token, toEntry) -> { @@ -221,14 +222,14 @@ public Map asMap(final RntbdContext context, final UUID activity } static RntbdResponseHeaders decode(final ByteBuf in) { - final RntbdResponseHeaders headers = new RntbdResponseHeaders(); - RntbdTokenStream.decode(in, headers); + final RntbdResponseHeaders headers = new RntbdResponseHeaders(in); + RntbdTokenStream.decode(headers); return headers; } public static RntbdResponseHeaders fromMap(final Map map, final boolean payloadPresent) { - final RntbdResponseHeaders headers = new RntbdResponseHeaders(); + final RntbdResponseHeaders headers = new RntbdResponseHeaders(Unpooled.EMPTY_BUFFER); headers.payloadPresent.setValue(payloadPresent); headers.setValues(map); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseStatus.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseStatus.java index ffdfabd0a0e6..30332ca7870f 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseStatus.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseStatus.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectWriter; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.CorruptedFrameException; import io.netty.handler.codec.http.HttpResponseStatus; @@ -64,7 +65,7 @@ static RntbdResponseStatus decode(final ByteBuf in) { final long length = in.readUnsignedIntLE(); if (!(LENGTH <= length && length <= Integer.MAX_VALUE)) { - final String reason = String.format("frame length: %d", length); + final String reason = Strings.lenientFormat("frame length: %s", length); throw new CorruptedFrameException(reason); } @@ -72,7 +73,7 @@ static RntbdResponseStatus decode(final ByteBuf in) { final HttpResponseStatus status = HttpResponseStatus.valueOf(code); if (status == null) { - final String reason = String.format("status code: %d", code); + final String reason = Strings.lenientFormat("status code: %s", code); throw new CorruptedFrameException(reason); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java index 34ad472777d2..d3a4e6466b2e 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java @@ -5,14 +5,16 @@ import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.GoneException; -import com.azure.data.cosmos.internal.HttpConstants; -import com.azure.data.cosmos.internal.directconnectivity.RntbdTransportClient.Options; +import com.azure.data.cosmos.internal.directconnectivity.RntbdTransportClient; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; +import io.micrometer.core.instrument.Tag; import io.netty.bootstrap.Bootstrap; +import io.netty.channel.AdaptiveRecvByteBufAllocator; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelOption; @@ -29,47 +31,71 @@ import java.net.URI; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Stream; +import static com.azure.data.cosmos.internal.HttpConstants.HttpHeaders; +import static com.azure.data.cosmos.internal.directconnectivity.RntbdTransportClient.Options; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; @JsonSerialize(using = RntbdServiceEndpoint.JsonSerializer.class) public final class RntbdServiceEndpoint implements RntbdEndpoint { + // region Fields + + private static final String TAG_NAME = RntbdServiceEndpoint.class.getSimpleName(); + private static final long QUIET_PERIOD = 2L * 1_000_000_000L; + private static final AtomicLong instanceCount = new AtomicLong(); private static final Logger logger = LoggerFactory.getLogger(RntbdServiceEndpoint.class); - private static final String namePrefix = RntbdServiceEndpoint.class.getSimpleName() + '-'; + private static final AdaptiveRecvByteBufAllocator receiveBufferAllocator = new AdaptiveRecvByteBufAllocator(); private final RntbdClientChannelPool channelPool; private final AtomicBoolean closed; + private final AtomicInteger concurrentRequests; + private final long id; + private final AtomicLong lastRequestTime; private final RntbdMetrics metrics; - private final String name; + private final Provider provider; private final SocketAddress remoteAddress; private final RntbdRequestTimer requestTimer; + private final Tag tag; + + // endregion // region Constructors private RntbdServiceEndpoint( - final Config config, final NioEventLoopGroup group, final RntbdRequestTimer timer, final URI physicalAddress + final Provider provider, final Config config, final NioEventLoopGroup group, final RntbdRequestTimer timer, + final URI physicalAddress ) { final Bootstrap bootstrap = new Bootstrap() .channel(NioSocketChannel.class) .group(group) + .option(ChannelOption.ALLOCATOR, config.allocator()) .option(ChannelOption.AUTO_READ, true) - .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.getConnectionTimeout()) + .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.connectionTimeout()) + .option(ChannelOption.RCVBUF_ALLOCATOR, receiveBufferAllocator) .option(ChannelOption.SO_KEEPALIVE, true) .remoteAddress(physicalAddress.getHost(), physicalAddress.getPort()); - this.name = RntbdServiceEndpoint.namePrefix + instanceCount.incrementAndGet(); - this.channelPool = new RntbdClientChannelPool(bootstrap, config); + this.channelPool = new RntbdClientChannelPool(this, bootstrap, config); this.remoteAddress = bootstrap.config().remoteAddress(); - this.metrics = new RntbdMetrics(this.name); + this.concurrentRequests = new AtomicInteger(); + this.lastRequestTime = new AtomicLong(); this.closed = new AtomicBoolean(); this.requestTimer = timer; + + this.tag = Tag.of(TAG_NAME, RntbdMetrics.escape(this.remoteAddress.toString())); + this.id = instanceCount.incrementAndGet(); + this.provider = provider; + + this.metrics = new RntbdMetrics(provider.transportClient, this); } // endregion @@ -77,8 +103,57 @@ private RntbdServiceEndpoint( // region Accessors @Override - public String getName() { - return this.name; + public int channelsAcquired() { + return this.channelPool.channelsAcquired(); + } + + @Override + public int channelsAvailable() { + return this.channelPool.channelsAvailable(); + } + + @Override + public int concurrentRequests() { + return this.concurrentRequests.get(); + } + + @Override + public long id() { + return this.id; + } + + @Override + public boolean isClosed() { + return this.closed.get(); + } + + public long lastRequestTime() { + return this.lastRequestTime.get(); + } + + @Override + public SocketAddress remoteAddress() { + return this.remoteAddress; + } + + @Override + public int requestQueueLength() { + return this.channelPool.requestQueueLength(); + } + + @Override + public Tag tag() { + return this.tag; + } + + @Override + public long usedDirectMemory() { + return this.channelPool.usedDirectMemory(); + } + + @Override + public long usedHeapMemory() { + return this.channelPool.usedHeapMemory(); } // endregion @@ -88,8 +163,8 @@ public String getName() { @Override public void close() { if (this.closed.compareAndSet(false, true)) { + this.provider.evict(this); this.channelPool.close(); - this.metrics.close(); } } @@ -97,39 +172,36 @@ public RntbdRequestRecord request(final RntbdRequestArgs args) { this.throwIfClosed(); + this.concurrentRequests.incrementAndGet(); + this.lastRequestTime.set(args.creationTime()); + if (logger.isDebugEnabled()) { args.traceOperation(logger, null, "request"); logger.debug("\n {}\n {}\n REQUEST", this, args); } - final RntbdRequestRecord requestRecord = this.write(args); - this.metrics.incrementRequestCount(); + final RntbdRequestRecord record = this.write(args); - requestRecord.whenComplete((response, error) -> { + record.whenComplete((response, error) -> { args.traceOperation(logger, null, "requestComplete", response, error); - this.metrics.incrementResponseCount(); - if (error != null) { - this.metrics.incrementErrorResponseCount(); + if (error == null) { + logger.debug("\n [{}]\n {}\n request succeeded with response status: {}", this, args, response.getStatus()); + } else { + logger.debug("\n [{}]\n {}\n request failed due to ", this, args, error); } - if (logger.isDebugEnabled()) { - if (error == null) { - final int status = response.getStatus(); - logger.debug("\n [{}]\n {}\n request succeeded with response status: {}", this, args, status); - } else { - logger.debug("\n [{}]\n {}\n request failed due to ", this, args, error); - } - } + this.concurrentRequests.decrementAndGet(); + this.metrics.markComplete(record); }); - return requestRecord; + return record; } @Override public String toString() { - return RntbdObjectMapper.toJson(this); + return RntbdObjectMapper.toString(this); } // endregion @@ -170,15 +242,12 @@ private RntbdRequestRecord write(final RntbdRequestArgs requestArgs) { channel.write(requestRecord).addListener((ChannelFuture future) -> { requestArgs.traceOperation(logger, null, "writeComplete", channel); - if (!future.isSuccess()) { - this.metrics.incrementErrorResponseCount(); - } }); return; } - final UUID activityId = requestArgs.getActivityId(); + final UUID activityId = requestArgs.activityId(); final Throwable cause = connected.cause(); if (connected.isCancelled()) { @@ -192,13 +261,13 @@ private RntbdRequestRecord write(final RntbdRequestArgs requestArgs) { final String reason = cause.getMessage(); final GoneException goneException = new GoneException( - String.format("failed to establish connection to %s: %s", this.remoteAddress, reason), + Strings.lenientFormat("failed to establish connection to %s: %s", this.remoteAddress, reason), cause instanceof Exception ? (Exception)cause : new IOException(reason, cause), - ImmutableMap.of(HttpConstants.HttpHeaders.ACTIVITY_ID, activityId.toString()), - requestArgs.getReplicaPath() + ImmutableMap.of(HttpHeaders.ACTIVITY_ID, activityId.toString()), + requestArgs.replicaPath() ); - BridgeInternal.setRequestHeaders(goneException, requestArgs.getServiceRequest().getHeaders()); + BridgeInternal.setRequestHeaders(goneException, requestArgs.serviceRequest().getHeaders()); requestRecord.completeExceptionally(goneException); } }); @@ -213,19 +282,17 @@ private RntbdRequestRecord write(final RntbdRequestArgs requestArgs) { static final class JsonSerializer extends StdSerializer { public JsonSerializer() { - this(null); - } - - public JsonSerializer(Class type) { - super(type); + super(RntbdServiceEndpoint.class); } @Override public void serialize(RntbdServiceEndpoint value, JsonGenerator generator, SerializerProvider provider) throws IOException { - generator.writeStartObject(); - generator.writeStringField(value.name, value.remoteAddress.toString()); + generator.writeNumberField("id", value.id); + generator.writeBooleanField("isClosed", value.isClosed()); + generator.writeNumberField("concurrentRequests", value.concurrentRequests()); + generator.writeStringField("remoteAddress", value.remoteAddress.toString()); generator.writeObjectField("channelPool", value.channelPool); generator.writeEndObject(); } @@ -235,14 +302,17 @@ public static final class Provider implements RntbdEndpoint.Provider { private static final Logger logger = LoggerFactory.getLogger(Provider.class); - private final AtomicBoolean closed = new AtomicBoolean(); + private final AtomicBoolean closed; private final Config config; - private final ConcurrentHashMap endpoints = new ConcurrentHashMap<>(); + private final ConcurrentHashMap endpoints; private final NioEventLoopGroup eventLoopGroup; + private final AtomicInteger evictions; private final RntbdRequestTimer requestTimer; + private final RntbdTransportClient transportClient; - public Provider(final Options options, final SslContext sslContext) { + public Provider(final RntbdTransportClient transportClient, final Options options, final SslContext sslContext) { + checkNotNull(transportClient, "provider"); checkNotNull(options, "options"); checkNotNull(sslContext, "sslContext"); @@ -258,13 +328,18 @@ public Provider(final Options options, final SslContext sslContext) { wireLogLevel = null; } + this.transportClient = transportClient; this.config = new Config(options, sslContext, wireLogLevel); - this.requestTimer = new RntbdRequestTimer(config.getRequestTimeout()); + this.requestTimer = new RntbdRequestTimer(config.requestTimeout()); this.eventLoopGroup = new NioEventLoopGroup(threadCount, threadFactory); + + this.endpoints = new ConcurrentHashMap<>(); + this.evictions = new AtomicInteger(); + this.closed = new AtomicBoolean(); } @Override - public void close() throws RuntimeException { + public void close() { if (this.closed.compareAndSet(false, true)) { @@ -274,7 +349,7 @@ public void close() throws RuntimeException { endpoint.close(); } - this.eventLoopGroup.shutdownGracefully().addListener(future -> { + this.eventLoopGroup.shutdownGracefully(QUIET_PERIOD, this.config.shutdownTimeout(), TimeUnit.NANOSECONDS).addListener(future -> { if (future.isSuccess()) { logger.debug("\n [{}]\n closed endpoints", this); return; @@ -297,10 +372,15 @@ public int count() { return this.endpoints.size(); } + @Override + public int evictions() { + return this.evictions.get(); + } + @Override public RntbdEndpoint get(URI physicalAddress) { return endpoints.computeIfAbsent(physicalAddress.getAuthority(), authority -> - new RntbdServiceEndpoint(config, eventLoopGroup, requestTimer, physicalAddress) + new RntbdServiceEndpoint(this, config, eventLoopGroup, requestTimer, physicalAddress) ); } @@ -309,7 +389,7 @@ public Stream list() { return this.endpoints.values().stream(); } - private void deleteEndpoint(final URI physicalAddress) { + private void evict(RntbdEndpoint endpoint) { // TODO: DANOBLE: Utilize this method of tearing down unhealthy endpoints // Specifically, ensure that this method is called when a Read/WriteTimeoutException occurs or a health @@ -318,13 +398,8 @@ private void deleteEndpoint(final URI physicalAddress) { // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/331552 // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/331593 - checkNotNull(physicalAddress, "physicalAddress: %s", physicalAddress); - - final String authority = physicalAddress.getAuthority(); - final RntbdEndpoint endpoint = this.endpoints.remove(authority); - - if (endpoint != null) { - endpoint.close(); + if (this.endpoints.remove(endpoint.remoteAddress().toString()) != null) { + this.evictions.incrementAndGet(); } } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdToken.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdToken.java index 187fe2a78114..8bb5f7f7f095 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdToken.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdToken.java @@ -10,11 +10,13 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.PropertyWriter; import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdConstants.RntbdHeader; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; @JsonPropertyOrder({ "id", "name", "type", "present", "required", "value" }) final class RntbdToken { @@ -86,8 +88,9 @@ public T getValue(final Class cls) { @JsonProperty public void setValue(final Object value) { this.ensureValid(value); - this.length = Integer.MIN_VALUE; + this.releaseBuffer(); this.value = value; + this.length = Integer.MIN_VALUE; } @JsonIgnore @@ -117,7 +120,7 @@ public int computeLength() { if (this.value instanceof ByteBuf) { final ByteBuf buffer = (ByteBuf)this.value; - assert buffer.readerIndex() == 0; + checkState(buffer.readerIndex() == 0); return HEADER_LENGTH + buffer.readableBytes(); } @@ -140,7 +143,7 @@ public void decode(final ByteBuf in) { ((ByteBuf)this.value).release(); } - this.value = this.header.type().codec().readSlice(in).retain(); // No data transfer until the first call to RntbdToken.getValue + this.value = this.header.type().codec().readSlice(in).retain(); // No data transfer until first call to RntbdToken.getValue } public void encode(final ByteBuf out) { @@ -149,7 +152,7 @@ public void encode(final ByteBuf out) { if (!this.isPresent()) { if (this.isRequired()) { - final String message = String.format("Missing value for required header: %s", this); + final String message = Strings.lenientFormat("Missing value for required header: %s", this); throw new IllegalStateException(message); } return; @@ -166,16 +169,13 @@ public void encode(final ByteBuf out) { } } - public void releaseBuffer() { - if (this.value instanceof ByteBuf) { - final ByteBuf buffer = (ByteBuf)this.value; - buffer.release(); - } + public boolean releaseBuffer() { + return this.value instanceof ByteBuf && ((ByteBuf)this.value).release(); } @Override public String toString() { - return RntbdObjectMapper.toJson(this); + return RntbdObjectMapper.toString(this); } // endregion @@ -183,8 +183,8 @@ public String toString() { // region Privates private void ensureValid(final Object value) { - checkNotNull(value, "value"); - checkArgument(this.header.type().codec().isValid(value), "value: %s", value.getClass()); + checkArgument(value != null, "value: null"); + checkArgument(this.header.type().codec().isValid(value), "value: %s = %s", value.getClass().getName(), value); } // endregion diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenStream.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenStream.java index c28724b9f905..9c60d50d71f7 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenStream.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenStream.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; @@ -16,17 +17,20 @@ @SuppressWarnings("UnstableApiUsage") abstract class RntbdTokenStream & RntbdHeader> { + final ByteBuf in; final ImmutableMap headers; final ImmutableMap tokens; - RntbdTokenStream(final ImmutableSet headers, final ImmutableMap ids) { + RntbdTokenStream(final ImmutableSet headers, final ImmutableMap ids, final ByteBuf in) { checkNotNull(headers, "headers"); checkNotNull(ids, "ids"); + checkNotNull(in, "in"); final Collector> collector = Maps.toImmutableEnumMap(h -> h, RntbdToken::create); this.tokens = headers.stream().collect(collector); this.headers = ids; + this.in = in.retain(); } final int computeCount() { @@ -53,7 +57,9 @@ final int computeLength() { return total; } - static > T decode(final ByteBuf in, final T stream) { + static > T decode(final T stream) { + + ByteBuf in = stream.in; while (in.readableBytes() > 0) { @@ -71,7 +77,7 @@ static > T decode(final ByteBuf in, final T stream for (final RntbdToken token : stream.tokens.values()) { if (!token.isPresent() && token.isRequired()) { - final String reason = String.format("Required token not found on RNTBD stream: type: %s, identifier: %s", + final String reason = Strings.lenientFormat("Required token not found on token stream: type=%s, identifier=%s", token.getTokenType(), token.getId()); throw new IllegalStateException(reason); } @@ -94,6 +100,7 @@ final void releaseBuffers() { for (final RntbdToken token : this.tokens.values()) { token.releaseBuffer(); } + in.release(); } private static final class UndefinedHeader implements RntbdHeader { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenType.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenType.java index f441e432f2d1..3d31340966d7 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenType.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenType.java @@ -7,11 +7,14 @@ import com.google.common.base.Utf8; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; +import io.netty.handler.codec.CorruptedFrameException; import io.netty.handler.codec.DecoderException; import java.nio.charset.StandardCharsets; import java.util.UUID; +import static com.google.common.base.Preconditions.checkState; + enum RntbdTokenType { // All values are encoded as little endian byte sequences except for Guid @@ -88,6 +91,14 @@ public interface Codec { Class valueType(); void write(Object value, ByteBuf out); + + static void checkReadableBytes(final ByteBuf in, final long length, final long maxLength) { + if (length != in.readableBytes() || length > maxLength) { + String message = Strings.lenientFormat("maxLength: %s, length: %s, readableBytes: %s", + maxLength, length, in.readableBytes()); + throw new CorruptedFrameException(message); + } + } } private static class RntbdByte implements Codec { @@ -141,7 +152,7 @@ public final Class valueType() { @Override public final void write(final Object value, final ByteBuf out) { assert this.isValid(value); - out.writeByte(value instanceof java.lang.Byte ? (byte)value : ((boolean)value ? 0x01 : 0x00)); + out.writeByte(value instanceof Byte ? (byte)value : ((boolean)value ? 0x01 : 0x00)); } } @@ -178,6 +189,7 @@ public boolean isValid(final Object value) { @Override public Object read(final ByteBuf in) { final int length = in.readUnsignedShortLE(); + Codec.checkReadableBytes(in, length, 0xFFFF); return in.readBytes(length); } @@ -189,7 +201,7 @@ public ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.Byte[].class; + return Byte[].class; } @Override @@ -250,7 +262,7 @@ public final ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.Double.class; + return Double.class; } @Override @@ -301,7 +313,7 @@ public final ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.Float.class; + return Float.class; } @Override @@ -454,7 +466,7 @@ public final ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.Long.class; + return Long.class; } @Override @@ -479,28 +491,20 @@ public final int computeLength(final Object value) { @Override public final boolean isValid(final Object value) { - return value instanceof byte[] && ((byte[])value).length < 0xFFFF; + return value instanceof byte[]; } @Override public final Object read(final ByteBuf in) { - final long length = in.readUnsignedIntLE(); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } + Codec.checkReadableBytes(in, length, Integer.MAX_VALUE); return in.readBytes((int)length); } @Override public final ByteBuf readSlice(final ByteBuf in) { - final long length = in.getUnsignedIntLE(in.readerIndex()); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } + checkState(length <= Integer.MAX_VALUE); return in.readSlice(Integer.BYTES + (int)length); } @@ -529,19 +533,13 @@ public final int computeLength(final Object value) { @Override public final Object read(final ByteBuf in) { - final long length = in.readUnsignedIntLE(); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } - + Codec.checkReadableBytes(in, length, Integer.MAX_VALUE); return in.readCharSequence((int)length, StandardCharsets.UTF_8).toString(); } @Override public final void write(final Object value, final ByteBuf out) { - final int length = this.computeLength(value, Integer.MAX_VALUE); out.writeIntLE(length); writeValue(out, value, length); @@ -607,13 +605,14 @@ public final int computeLength(final Object value) { @Override public final boolean isValid(final Object value) { - return value instanceof byte[] && ((byte[])value).length < 0xFFFF; + return value instanceof byte[] && ((byte[])value).length <= 0xFF; } @Override public final Object read(final ByteBuf in) { final int length = in.readUnsignedByte(); + Codec.checkReadableBytes(in, length, 0xFF); final byte[] bytes = new byte[length]; in.readBytes(bytes); @@ -656,7 +655,9 @@ public final int computeLength(final Object value) { @Override public final Object read(final ByteBuf in) { - return in.readCharSequence(in.readUnsignedByte(), StandardCharsets.UTF_8).toString(); + final int length = in.readUnsignedByte(); + Codec.checkReadableBytes(in, length, 0xFF); + return in.readCharSequence(length, StandardCharsets.UTF_8).toString(); } @Override @@ -685,9 +686,9 @@ final int computeLength(final Object value, final int maxLength) { assert this.isValid(value); final int length; - if (value instanceof java.lang.String) { + if (value instanceof String) { - final java.lang.String string = (java.lang.String)value; + final String string = (String)value; length = Utf8.encodedLength(string); } else { @@ -695,7 +696,7 @@ final int computeLength(final Object value, final int maxLength) { final byte[] string = (byte[])value; if (!Utf8.isWellFormed(string)) { - final java.lang.String reason = Strings.lenientFormat("UTF-8 byte string is ill-formed: %s", ByteBufUtil.hexDump(string)); + final String reason = Strings.lenientFormat("UTF-8 byte string is ill-formed: %s", ByteBufUtil.hexDump(string)); throw new DecoderException(reason); } @@ -703,7 +704,7 @@ final int computeLength(final Object value, final int maxLength) { } if (length > maxLength) { - final java.lang.String reason = Strings.lenientFormat("UTF-8 byte string exceeds %s bytes: %s bytes", maxLength, length); + final String reason = Strings.lenientFormat("UTF-8 byte string exceeds %s bytes: %s bytes", maxLength, length); throw new DecoderException(reason); } @@ -718,7 +719,7 @@ public int computeLength(final Object value) { @Override public final Object convert(final Object value) { assert this.isValid(value); - return value instanceof java.lang.String ? value : new String((byte[])value, StandardCharsets.UTF_8); + return value instanceof String ? value : new String((byte[])value, StandardCharsets.UTF_8); } @Override @@ -728,12 +729,13 @@ public final Object defaultValue() { @Override public final boolean isValid(final Object value) { - return value instanceof java.lang.String || value instanceof byte[]; + return value instanceof String || value instanceof byte[]; } @Override public Object read(final ByteBuf in) { final int length = in.readUnsignedShortLE(); + Codec.checkReadableBytes(in, length, 0xFFFF); return in.readCharSequence(length, StandardCharsets.UTF_8).toString(); } @@ -744,7 +746,7 @@ public ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.String.class; + return String.class; } @Override @@ -759,8 +761,8 @@ static void writeValue(final ByteBuf out, final Object value, final int length) final int start = out.writerIndex(); - if (value instanceof java.lang.String) { - out.writeCharSequence((java.lang.String)value, StandardCharsets.UTF_8); + if (value instanceof String) { + out.writeCharSequence((String)value, StandardCharsets.UTF_8); } else { out.writeBytes((byte[])value); } @@ -810,7 +812,7 @@ public final ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.Long.class; + return Long.class; } @Override diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdUUID.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdUUID.java index d63c6bbb8a84..c66bcf4a73f6 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdUUID.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdUUID.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.CorruptedFrameException; @@ -39,7 +40,7 @@ public static UUID decode(final ByteBuf in) { checkNotNull(in, "in"); if (in.readableBytes() < 2 * Long.BYTES) { - final String reason = String.format("invalid frame length: %d", in.readableBytes()); + final String reason = Strings.lenientFormat("invalid frame length: %s", in.readableBytes()); throw new CorruptedFrameException(reason); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsTests.java index 556c42bb294b..9aa1ecd0db4a 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsTests.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsTests.java @@ -25,7 +25,7 @@ public void maxHttpBodyLength() { @Test(groups = { "unit" }) public void getProtocol() { Configs config = new Configs(); - assertThat(config.getProtocol()).isEqualTo(Protocol.valueOf(System.getProperty("cosmos.directModeProtocol", "TCP").toUpperCase())); + assertThat(config.getProtocol()).isEqualTo(Protocol.valueOf(System.getProperty("azure.cosmos.directModeProtocol", "TCP").toUpperCase())); } @Test(groups = { "unit" }) diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java index 607d78fe57cb..c2342deed0cc 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java @@ -3,14 +3,20 @@ package com.azure.data.cosmos.internal.directconnectivity; +import com.azure.data.cosmos.BadRequestException; import com.azure.data.cosmos.ConflictException; import com.azure.data.cosmos.CosmosClientException; import com.azure.data.cosmos.CosmosKeyCredential; import com.azure.data.cosmos.ForbiddenException; import com.azure.data.cosmos.GoneException; +import com.azure.data.cosmos.InternalServerErrorException; +import com.azure.data.cosmos.InvalidPartitionException; import com.azure.data.cosmos.LockedException; import com.azure.data.cosmos.MethodNotAllowedException; +import com.azure.data.cosmos.NotFoundException; +import com.azure.data.cosmos.PartitionIsMigratingException; import com.azure.data.cosmos.PartitionKeyRangeGoneException; +import com.azure.data.cosmos.PartitionKeyRangeIsSplittingException; import com.azure.data.cosmos.PreconditionFailedException; import com.azure.data.cosmos.RequestEntityTooLargeException; import com.azure.data.cosmos.RequestRateTooLargeException; @@ -18,6 +24,15 @@ import com.azure.data.cosmos.RetryWithException; import com.azure.data.cosmos.ServiceUnavailableException; import com.azure.data.cosmos.UnauthorizedException; +import com.azure.data.cosmos.internal.BaseAuthorizationTokenProvider; +import com.azure.data.cosmos.internal.FailureValidator; +import com.azure.data.cosmos.internal.OperationType; +import com.azure.data.cosmos.internal.Paths; +import com.azure.data.cosmos.internal.ResourceType; +import com.azure.data.cosmos.internal.RxDocumentServiceRequest; +import com.azure.data.cosmos.internal.UserAgentContainer; +import com.azure.data.cosmos.internal.Utils; +import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdClientChannelHealthChecker; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdContext; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdContextNegotiator; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdContextRequest; @@ -31,15 +46,9 @@ import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdResponse; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdResponseDecoder; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdUUID; -import com.azure.data.cosmos.BadRequestException; -import com.azure.data.cosmos.internal.*; -import com.azure.data.cosmos.InternalServerErrorException; -import com.azure.data.cosmos.InvalidPartitionException; -import com.azure.data.cosmos.NotFoundException; -import com.azure.data.cosmos.PartitionIsMigratingException; -import com.azure.data.cosmos.PartitionKeyRangeIsSplittingException; import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; +import io.micrometer.core.instrument.Tag; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandler; @@ -50,14 +59,12 @@ import io.netty.handler.ssl.SslContextBuilder; import io.reactivex.subscribers.TestSubscriber; import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.testng.annotations.DataProvider; -import org.testng.annotations.Ignore; import org.testng.annotations.Test; import reactor.core.publisher.Mono; import java.net.ConnectException; +import java.net.SocketAddress; import java.net.URI; import java.time.Duration; import java.util.Arrays; @@ -76,7 +83,6 @@ public final class RntbdTransportClientTest { - private static final Logger logger = LoggerFactory.getLogger(RntbdTransportClientTest.class); private static final int lsn = 5; private static final ByteBuf noContent = Unpooled.wrappedBuffer(new byte[0]); private static final String partitionKeyRangeId = "3"; @@ -599,7 +605,7 @@ public Object[][] fromMockedRntbdResponseToExpectedDocumentClientException() { /** * Verifies that a request for a non-existent resource produces a {@link }GoneException} */ - @Test(enabled = false, groups = { "direct" }) + @Test(enabled = false, groups = "direct") public void verifyGoneResponseMapsToGoneException() throws Exception { final RntbdTransportClient.Options options = new RntbdTransportClient.Options.Builder(requestTimeout).build(); @@ -681,9 +687,7 @@ public void verifyNetworkFailure( * @param request An RNTBD request instance * @param response The RNTBD response instance to be returned as a result of the request */ - //FIXME: Test inconsistently flakes with assertion error. - @Ignore - @Test(enabled = true, groups = { "unit" }, dataProvider = "fromMockedRntbdResponseToExpectedDocumentClientException") + @Test(enabled = true, groups = "unit", dataProvider = "fromMockedRntbdResponseToExpectedDocumentClientException") public void verifyRequestFailures( final FailureValidator.Builder builder, final RxDocumentServiceRequest request, @@ -805,6 +809,7 @@ private static final class FakeEndpoint implements RntbdEndpoint { final RntbdRequestTimer requestTimer; final FakeChannel fakeChannel; final URI physicalAddress; + final Tag tag; private FakeEndpoint( final Config config, final RntbdRequestTimer timer, final URI physicalAddress, @@ -815,23 +820,76 @@ private FakeEndpoint( expected.length, true, Arrays.asList(expected) ); - RntbdRequestManager requestManager = new RntbdRequestManager(30); + RntbdRequestManager requestManager = new RntbdRequestManager(new RntbdClientChannelHealthChecker(config), 30); this.physicalAddress = physicalAddress; this.requestTimer = timer; this.fakeChannel = new FakeChannel(responses, - new RntbdContextNegotiator(requestManager, config.getUserAgent()), + new RntbdContextNegotiator(requestManager, config.userAgent()), new RntbdRequestEncoder(), new RntbdResponseDecoder(), requestManager ); + + this.tag = Tag.of(FakeEndpoint.class.getSimpleName(), this.fakeChannel.remoteAddress().toString()); + } + + // region Accessors + + @Override + public int channelsAcquired() { + return 0; + } + + @Override + public int channelsAvailable() { + return 0; + } + + @Override + public int concurrentRequests() { + return 0; } @Override - public String getName() { - return "FakeEndpoint"; + public long id() { + return 0L; } + @Override + public boolean isClosed() { + return !this.fakeChannel.isOpen(); + } + + @Override + public SocketAddress remoteAddress() { + return this.fakeChannel.remoteAddress(); + } + + @Override + public int requestQueueLength() { + return 0; + } + + @Override + public Tag tag() { + return this.tag; + } + + @Override + public long usedDirectMemory() { + return 0; + } + + @Override + public long usedHeapMemory() { + return 0; + } + + // endregion + + // region Methods + @Override public void close() { this.fakeChannel.close().syncUninterruptibly(); @@ -844,6 +902,10 @@ public RntbdRequestRecord request(final RntbdRequestArgs requestArgs) { return requestRecord; } + // endregion + + // region Types + static class Provider implements RntbdEndpoint.Provider { final Config config; @@ -852,7 +914,7 @@ static class Provider implements RntbdEndpoint.Provider { Provider(RntbdTransportClient.Options options, SslContext sslContext, RntbdResponse expected) { this.config = new Config(options, sslContext, LogLevel.WARN); - this.timer = new RntbdRequestTimer(config.getRequestTimeout()); + this.timer = new RntbdRequestTimer(config.requestTimeout()); this.expected = expected; } @@ -871,6 +933,11 @@ public int count() { return 1; } + @Override + public int evictions() { + return 0; + } + @Override public RntbdEndpoint get(URI physicalAddress) { return new FakeEndpoint(config, timer, physicalAddress, expected); @@ -881,6 +948,8 @@ public Stream list() { return Stream.empty(); } } + + // endregion } private static final class RntbdTestConfiguration { diff --git a/sdk/cosmos/pom.xml b/sdk/cosmos/pom.xml index be5969442abd..3477993a4597 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -36,12 +36,14 @@ Licensed under the MIT License. UTF-8 3.1.0 3.1.0 + 4.1.0 + 1.2.0 1.10.19 - 4.1.36.Final + 4.1.38.Final + 2.0.25.Final 3.1.0 27.0.1-jre 3.2.9.RELEASE - 2.0.25.Final unit ${project.basedir}/target/collectedArtifactsForRelease diff --git a/sdk/eventgrid/ci.yml b/sdk/eventgrid/ci.yml index cbbf63586bf3..b749a54d465d 100644 --- a/sdk/eventgrid/ci.yml +++ b/sdk/eventgrid/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/eventgrid/ @@ -13,11 +22,18 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/eventgrid/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: eventgrid \ No newline at end of file + ServiceDirectory: eventgrid + Artifacts: + - name: azure-eventgrid + safeName: azureeventgrid + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/eventhubs/azure-messaging-eventhubs/README.md b/sdk/eventhubs/azure-messaging-eventhubs/README.md index 3c185370c177..6971f65710b8 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/README.md @@ -386,3 +386,5 @@ Guidelines](./CONTRIBUTING.md) for more information. [source_inmemorypartitionmanager]: ./src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java [source_loglevels]: ../../core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java [source_partition_processor]: ./src/main/java/com/azure/messaging/eventhubs/PartitionProcessor.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/eventhubs/azure-messaging-eventhubs/README.png) \ No newline at end of file diff --git a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml index 51c992af0178..15e1c9a62cbf 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml @@ -33,6 +33,10 @@ HEAD + + com.azure.messaging.eventhubs + + com.azure diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventData.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventData.java index 0d259a28fd56..77d8ba7f78de 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventData.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventData.java @@ -45,6 +45,7 @@ * types) and Data section is not supported. *

* + * @see EventHubProducer * @see EventHubAsyncProducer */ public class EventData implements Comparable { @@ -85,7 +86,7 @@ public EventData(byte[] body) { * @throws NullPointerException if {@code body} is {@code null}. */ public EventData(ByteBuffer body) { - Objects.requireNonNull(body); + Objects.requireNonNull(body, "'body' cannot be null."); this.body = body; this.properties = new HashMap<>(); @@ -164,8 +165,8 @@ public EventData(ByteBuffer body) { * @throws NullPointerException if {@code key} or {@code value} is null. */ public EventData addProperty(String key, Object value) { - Objects.requireNonNull(key); - Objects.requireNonNull(value); + Objects.requireNonNull(key, "'key' cannot be null."); + Objects.requireNonNull(value, "'value' cannot be null."); properties.put(key, value); return this; @@ -177,15 +178,9 @@ public EventData addProperty(String key, Object value) { * *

* A common use case for {@code properties()} is to associate serialization hints for the {@link #body()} as an aid - * to consumers who wish to deserialize the binary data. - *

- * - *

- * Adding serialization hint using {@link #addProperty(String, Object)} + * to consumers who wish to deserialize the binary data. See {@link #addProperty(String, Object)} for a sample. *

* - * {@codesnippet com.azure.messaging.eventhubs.eventdata.addProperty#string-object} - * * @return Application properties associated with this {@link EventData}. */ public Map properties() { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventDataBatch.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventDataBatch.java index 100a6df43caa..c4a25d0edd41 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventDataBatch.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventDataBatch.java @@ -9,7 +9,6 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.AmqpConstants; import com.azure.messaging.eventhubs.implementation.ErrorContextProvider; -import com.azure.messaging.eventhubs.models.BatchOptions; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; @@ -26,12 +25,13 @@ import java.util.Objects; /** - * A class for aggregating EventData into a single, size-limited, batch that will be treated as a single message when - * sent to the Azure Event Hubs service. + * A class for aggregating EventData into a single, size-limited, batch. It is treated as a single message when sent to + * the Azure Event Hubs service. * + * @see EventHubProducer#createBatch() * @see EventHubAsyncProducer#createBatch() - * @see EventHubAsyncProducer#createBatch(BatchOptions) - * @see EventHubAsyncProducer See EventHubAsyncProducer for examples. + * @see EventHubProducer See EventHubProducer for examples using the synchronous producer. + * @see EventHubAsyncProducer See EventHubAsyncProducer for examples using the asynchronous producer. */ public final class EventDataBatch { private final ClientLogger logger = new ClientLogger(EventDataBatch.class); @@ -115,7 +115,7 @@ String getPartitionKey() { } private int getSize(final EventData eventData, final boolean isFirst) { - Objects.requireNonNull(eventData); + Objects.requireNonNull(eventData, "'eventData' cannot be null."); final Message amqpMessage = createAmqpMessage(eventData, partitionKey); int eventSize = amqpMessage.encode(this.eventBytes, 0, maxMessageSize); // actual encoded bytes size diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java index b071a586319d..46c53a51dc80 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java @@ -45,19 +45,24 @@ import static com.azure.core.amqp.MessageConstant.SEQUENCE_NUMBER_ANNOTATION_NAME; /** - * The main point of interaction with Azure Event Hubs, the client offers a connection to a specific Event Hub within - * the Event Hubs namespace and offers operations for sending event data, receiving events, and inspecting the connected - * Event Hub. + * An asynchronous client that is the main point of interaction with Azure Event Hubs. It connects to a + * specific Event Hub and allows operations for sending event data, receiving data, and inspecting the Event Hub's + * metadata. * - *

Creating an {@link EventHubAsyncClient} using Event Hubs namespace connection string

+ *

+ * Instantiated through {@link EventHubClientBuilder}. + *

* - * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string} + *

Creating an {@link EventHubAsyncClient} using an Event Hubs namespace connection string

* - *

Creating an {@link EventHubAsyncClient} using Event Hub instance connection string

+ * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string} * - * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string} + *

Creating an {@link EventHubAsyncClient} using an Event Hub instance connection string

+ * + * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string} * * @see EventHubClientBuilder + * @see EventHubClient See EventHubClient to communicate with an Event Hub using a synchronous client. * @see About Azure Event Hubs */ @ServiceClient(builder = EventHubClientBuilder.class, isAsync = true) @@ -80,9 +85,9 @@ public class EventHubAsyncClient implements Closeable { private final EventHubConsumerOptions defaultConsumerOptions; EventHubAsyncClient(ConnectionOptions connectionOptions, ReactorProvider provider, ReactorHandlerProvider handlerProvider) { - Objects.requireNonNull(connectionOptions); - Objects.requireNonNull(provider); - Objects.requireNonNull(handlerProvider); + Objects.requireNonNull(connectionOptions, "'connectionOptions' cannot be null."); + Objects.requireNonNull(provider, "'provider' cannot be null."); + Objects.requireNonNull(handlerProvider, "'handlerProvider' cannot be null."); this.connectionOptions = connectionOptions; this.eventHubName = connectionOptions.eventHubName(); @@ -156,7 +161,7 @@ public EventHubAsyncProducer createProducer() { * @throws NullPointerException if {@code options} is {@code null}. */ public EventHubAsyncProducer createProducer(EventHubProducerOptions options) { - Objects.requireNonNull(options); + Objects.requireNonNull(options, "'options' cannot be null."); final EventHubProducerOptions clonedOptions = options.clone(); @@ -236,20 +241,21 @@ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partiti * @param options The set of options to apply when creating the consumer. * @return An new {@link EventHubAsyncConsumer} that receives events from the partition with all configured {@link * EventHubConsumerOptions}. - * @throws NullPointerException If {@code eventPosition}, or {@code options} is {@code null}. - * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is {@code null} or an - * empty string. + * @throws NullPointerException If {@code eventPosition}, {@code consumerGroup}, {@code partitionId}, or + * {@code options} is {@code null}. + * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is an empty string. */ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition, EventHubConsumerOptions options) { - Objects.requireNonNull(eventPosition); - Objects.requireNonNull(options); - - if (ImplUtils.isNullOrEmpty(consumerGroup)) { - throw new IllegalArgumentException("'consumerGroup' cannot be null or empty."); - } - if (ImplUtils.isNullOrEmpty(partitionId)) { - throw new IllegalArgumentException("'partitionId' cannot be null or empty."); + Objects.requireNonNull(eventPosition, "'eventPosition' cannot be null."); + Objects.requireNonNull(options, "'options' cannot be null."); + Objects.requireNonNull(consumerGroup, "'consumerGroup' cannot be null."); + Objects.requireNonNull(partitionId, "'partitionId' cannot be null."); + + if (consumerGroup.isEmpty()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'consumerGroup' cannot be an empty string.")); + } else if (partitionId.isEmpty()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'partitionId' cannot be an empty string.")); } final EventHubConsumerOptions clonedOptions = options.clone(); @@ -268,8 +274,6 @@ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partiti return connection.createSession(entityPath).cast(EventHubSession.class); }).flatMap(session -> { logger.verbose("Creating consumer for path: {}", entityPath); - - logger.verbose("Creating producer for {}", entityPath); final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(clonedOptions.retry()); return session.createConsumer(linkName, entityPath, getExpression(eventPosition), @@ -293,8 +297,8 @@ public void close() { connection.close(); } } catch (IOException exception) { - throw new AmqpException(false, "Unable to close connection to service", exception, - new ErrorContext(connectionOptions.host())); + throw logger.logExceptionAsError(new AmqpException(false, "Unable to close connection to service", exception, + new ErrorContext(connectionOptions.host()))); } } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java index e4626ddf7045..7c61b9549ccc 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java @@ -58,28 +58,24 @@ *

Create a producer that routes events to any partition

* To allow automatic routing of messages to available partition, do not specify the {@link * EventHubProducerOptions#partitionId() partitionId} when creating the {@link EventHubAsyncProducer}. - *

* {@codesnippet com.azure.messaging.eventhubs.eventhubasyncproducer.instantiation} * *

Create a producer that publishes events to partition "foo" with a timeout of 45 seconds.

- *

* Developers can push events to a single partition by specifying the {@link EventHubProducerOptions#partitionId(String) * partitionId} when creating an {@link EventHubAsyncProducer}. - *

+ * * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncproducer.instantiation#partitionId} * *

Publish events to the same partition, grouped together using {@link SendOptions#partitionKey(String)}.

- *

* If developers want to push similar events to end up at the same partition, but do not require them to go to a * specific partition, they can use {@link SendOptions#partitionKey(String)}. *

* In the sample below, all the "sandwiches" end up in the same partition, but it could end up in partition 0, 1, etc. * of the available partitions. All that matters to the end user is that they are grouped together. - *

+ *

* {@codesnippet com.azure.messaging.eventhubs.eventhubasyncproducer.send#publisher-sendOptions} * *

Publish events using an {@link EventDataBatch}.

- *

* Developers can create an {@link EventDataBatch}, add the events they want into it, and publish these * events together. When creating a {@link EventDataBatch batch}, developers can specify a set of {@link BatchOptions * options} to configure this batch. @@ -88,9 +84,11 @@ * users' gaming systems, but do not want to slow down the network with telemetry. So they limit the size of their * {@link EventDataBatch batches} to be no larger than 256 bytes. The events within the batch also get hashed to the * same partition because they all share the same {@link BatchOptions#partitionKey()}. - *

+ *

* {@codesnippet com.azure.messaging.eventhubs.eventhubasyncproducer.send#eventDataBatch} + * * @see EventHubAsyncClient#createProducer() + * @see EventHubAsyncClient#createProducer(EventHubProducerOptions) */ @Immutable public class EventHubAsyncProducer implements Closeable { @@ -137,7 +135,7 @@ public Mono createBatch() { * @return A new {@link EventDataBatch} that can fit as many events as the transport allows. */ public Mono createBatch(BatchOptions options) { - Objects.requireNonNull(options); + Objects.requireNonNull(options, "'options' cannot be null."); final BatchOptions clone = options.clone(); @@ -166,16 +164,19 @@ public Mono createBatch(BatchOptions options) { /** * Sends a single event to the associated Event Hub. If the size of the single event exceeds the maximum size * allowed, an exception will be triggered and the send will fail. + *

* For more information regarding the maximum event size allowed, see * Azure Event Hubs Quotas and * Limits. + *

+ * * @param event Event to send to the service. * * @return A {@link Mono} that completes when the event is pushed to the service. */ public Mono send(EventData event) { - Objects.requireNonNull(event); + Objects.requireNonNull(event, "'event' cannot be null."); return send(Flux.just(event)); } @@ -183,18 +184,20 @@ public Mono send(EventData event) { /** * Sends a single event to the associated Event Hub with the send options. If the size of the single event exceeds * the maximum size allowed, an exception will be triggered and the send will fail. + * *

* For more information regarding the maximum event size allowed, see * Azure Event Hubs Quotas and * Limits. - * @param event Event to send to the service. + *

+ * @param event Event to send to the service. * @param options The set of options to consider when sending this event. * * @return A {@link Mono} that completes when the event is pushed to the service. */ public Mono send(EventData event, SendOptions options) { - Objects.requireNonNull(event); - Objects.requireNonNull(options); + Objects.requireNonNull(event, "'event' cannot be null."); + Objects.requireNonNull(options, "'options' cannot be null."); return send(Flux.just(event), options); } @@ -208,7 +211,7 @@ public Mono send(EventData event, SendOptions options) { * @return A {@link Mono} that completes when all events are pushed to the service. */ public Mono send(Iterable events) { - Objects.requireNonNull(events); + Objects.requireNonNull(events, "'events' cannot be null."); return send(Flux.fromIterable(events)); } @@ -217,13 +220,13 @@ public Mono send(Iterable events) { * Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message * size is the max amount allowed on the link. - * @param events Events to send to the service. + * @param events Events to send to the service. * @param options The set of options to consider when sending this batch. * * @return A {@link Mono} that completes when all events are pushed to the service. */ public Mono send(Iterable events, SendOptions options) { - Objects.requireNonNull(events); + Objects.requireNonNull(events, "'options' cannot be null."); return send(Flux.fromIterable(events), options); } @@ -237,7 +240,7 @@ public Mono send(Iterable events, SendOptions options) { * @return A {@link Mono} that completes when all events are pushed to the service. */ public Mono send(Flux events) { - Objects.requireNonNull(events); + Objects.requireNonNull(events, "'events' cannot be null."); return send(events, DEFAULT_SEND_OPTIONS); } @@ -246,14 +249,14 @@ public Mono send(Flux events) { * Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message * size is the max amount allowed on the link. - * @param events Events to send to the service. + * @param events Events to send to the service. * @param options The set of options to consider when sending this batch. * * @return A {@link Mono} that completes when all events are pushed to the service. */ public Mono send(Flux events, SendOptions options) { - Objects.requireNonNull(events); - Objects.requireNonNull(options); + Objects.requireNonNull(events, "'events' cannot be null."); + Objects.requireNonNull(options, "'options' cannot be null."); return sendInternal(events, options); } @@ -268,7 +271,7 @@ public Mono send(Flux events, SendOptions options) { * @see EventHubAsyncProducer#createBatch(BatchOptions) */ public Mono send(EventDataBatch batch) { - Objects.requireNonNull(batch); + Objects.requireNonNull(batch, "'batch' cannot be null."); if (batch.getEvents().isEmpty()) { logger.info("Cannot send an EventBatch that is empty."); @@ -318,13 +321,13 @@ private void verifyPartitionKey(String partitionKey) { } if (isPartitionSender) { - throw new IllegalArgumentException(String.format(Locale.US, + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, "BatchOptions.partitionKey() cannot be set when an EventHubProducer is created with" + "EventHubProducerOptions.partitionId() set. This EventHubProducer can only send events to partition '%s'.", - senderOptions.partitionId())); + senderOptions.partitionId()))); } else if (partitionKey.length() > MAX_PARTITION_KEY_LENGTH) { - throw new IllegalArgumentException(String.format(Locale.US, - "PartitionKey '%s' exceeds the maximum allowed length: '%s'.", partitionKey, MAX_PARTITION_KEY_LENGTH)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "PartitionKey '%s' exceeds the maximum allowed length: '%s'.", partitionKey, MAX_PARTITION_KEY_LENGTH))); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClient.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClient.java new file mode 100644 index 000000000000..74d75c6e91d4 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClient.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.amqp.RetryOptions; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceClient; +import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.util.IterableStream; +import com.azure.messaging.eventhubs.implementation.ConnectionOptions; +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; + +import java.io.Closeable; +import java.time.Duration; +import java.util.Objects; + +/** + * A synchronous client that is the main point of interaction with Azure Event Hubs. It connects to a + * specific Event Hub and allows operations for sending event data, receiving data, and inspecting the Event Hub's + * metadata. + * + *

+ * Instantiated through {@link EventHubClientBuilder}. + *

+ * + *

+ * Creating a synchronous {@link EventHubClient} using an Event Hub instance connection string + *

+ * + * {@codesnippet com.azure.messaging.eventhubs.eventhubclient.instantiation} + * + * @see EventHubClientBuilder + * @see EventHubAsyncClient To communicate with Event Hub using an asynchronous client. + * @see About Azure Event Hubs + */ +@ServiceClient(builder = EventHubClientBuilder.class) +public class EventHubClient implements Closeable { + private final EventHubAsyncClient client; + private final RetryOptions retry; + private final EventHubProducerOptions defaultProducerOptions; + private final EventHubConsumerOptions defaultConsumerOptions; + + EventHubClient(EventHubAsyncClient client, ConnectionOptions connectionOptions) { + Objects.requireNonNull(connectionOptions, "'connectionOptions' cannot be null."); + + this.client = Objects.requireNonNull(client, "'client' cannot be null."); + this.retry = connectionOptions.retry(); + this.defaultProducerOptions = new EventHubProducerOptions() + .retry(connectionOptions.retry()); + this.defaultConsumerOptions = new EventHubConsumerOptions() + .retry(connectionOptions.retry()) + .scheduler(connectionOptions.scheduler()); + } + + /** + * Retrieves information about an Event Hub, including the number of partitions present and their identifiers. + * + * @return The set of information for the Event Hub that this client is associated with. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventHubProperties getProperties() { + return client.getProperties().block(retry.tryTimeout()); + } + + /** + * Retrieves the identifiers for all the partitions of an Event Hub. + * + * @return The identifiers for all partitions of an Event Hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public IterableStream getPartitionIds() { + return new IterableStream<>(client.getPartitionIds()); + } + + /** + * Retrieves information about a specific partition for an Event Hub, including elements that describe the available + * events in the partition event stream. + * + * @param partitionId The unique identifier of a partition associated with the Event Hub. + * @return The information for the requested partition under the Event Hub this client is associated with. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PartitionProperties getPartitionProperties(String partitionId) { + return client.getPartitionProperties(partitionId).block(retry.tryTimeout()); + } + + /** + * Creates an Event Hub producer responsible for transmitting {@link EventData} to the Event Hub, grouped together + * in batches. Event data is automatically routed to an available partition. + * + * @return A new {@link EventHubProducer}. + */ + public EventHubProducer createProducer() { + return createProducer(defaultProducerOptions); + } + + /** + * Creates an Event Hub producer responsible for transmitting {@link EventData} to the Event Hub, grouped together + * in batches. If {@link EventHubProducerOptions#partitionId() options.partitionId()} is not {@code null}, the + * events are routed to that specific partition. Otherwise, events are automatically routed to an available + * partition. + * + * @param options The set of options to apply when creating the producer. + * @return A new {@link EventHubProducer}. + * @throws NullPointerException if {@code options} is {@code null}. + */ + public EventHubProducer createProducer(EventHubProducerOptions options) { + Objects.requireNonNull(options, "'options' cannot be null."); + + final EventHubAsyncProducer producer = client.createProducer(options); + + final Duration tryTimeout = options.retry() != null && options.retry().tryTimeout() != null + ? options.retry().tryTimeout() + : defaultProducerOptions.retry().tryTimeout(); + + return new EventHubProducer(producer, tryTimeout); + } + + /** + * Creates an Event Hub consumer responsible for reading {@link EventData} from a specific Event Hub partition, as a + * member of the specified consumer group, and begins reading events from the {@code eventPosition}. + * + * The consumer created is non-exclusive, allowing multiple consumers from the same consumer group to be actively + * reading events from the partition. These non-exclusive consumers are sometimes referred to as "Non-epoch + * Consumers". + * + * @param consumerGroup The name of the consumer group this consumer is associated with. Events are read in the + * context of this group. The name of the consumer group that is created by default is {@link + * EventHubAsyncClient#DEFAULT_CONSUMER_GROUP_NAME "$Default"}. + * @param partitionId The identifier of the Event Hub partition. + * @param eventPosition The position within the partition where the consumer should begin reading events. + * @return A new {@link EventHubConsumer} that receives events from the partition at the given position. + * @throws NullPointerException If {@code eventPosition}, {@code consumerGroup}, {@code partitionId}, or + * {@code options} is {@code null}. + * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is an empty string. + */ + public EventHubConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition) { + final EventHubAsyncConsumer consumer = client.createConsumer(consumerGroup, partitionId, eventPosition); + return new EventHubConsumer(consumer, defaultConsumerOptions); + } + + /** + * Creates an Event Hub consumer responsible for reading {@link EventData} from a specific Event Hub partition, as a + * member of the configured consumer group, and begins reading events from the specified {@code eventPosition}. + * + *

+ * A consumer may be exclusive, which asserts ownership over the partition for the consumer group to ensure that + * only one consumer from that group is reading from the partition. These exclusive consumers are sometimes referred + * to as "Epoch Consumers." + * + * A consumer may also be non-exclusive, allowing multiple consumers from the same consumer group to be actively + * reading events from the partition. These non-exclusive consumers are sometimes referred to as "Non-epoch + * Consumers." + * + * Designating a consumer as exclusive may be specified in the {@code options}, by setting {@link + * EventHubConsumerOptions#ownerLevel(Long)} to a non-null value. By default, consumers are created as + * non-exclusive. + *

+ * + * @param consumerGroup The name of the consumer group this consumer is associated with. Events are read in the + * context of this group. The name of the consumer group that is created by default is {@link + * EventHubAsyncClient#DEFAULT_CONSUMER_GROUP_NAME "$Default"}. + * @param partitionId The identifier of the Event Hub partition from which events will be received. + * @param eventPosition The position within the partition where the consumer should begin reading events. + * @param options The set of options to apply when creating the consumer. + * @return An new {@link EventHubConsumer} that receives events from the partition with all configured {@link + * EventHubConsumerOptions}. + * @throws NullPointerException If {@code eventPosition}, {@code consumerGroup}, {@code partitionId}, or + * {@code options} is {@code null}. + * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is an empty string. + */ + public EventHubConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition, + EventHubConsumerOptions options) { + final EventHubAsyncConsumer consumer = client.createConsumer(consumerGroup, partitionId, eventPosition, options); + return new EventHubConsumer(consumer, options); + } + + /** + * {@inheritDoc} + */ + @Override + public void close() { + client.close(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java index 8fd54fc4b773..4c20b7a9b8b2 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java @@ -12,6 +12,7 @@ import com.azure.core.util.configuration.BaseConfigurations; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.CBSAuthorizationType; import com.azure.messaging.eventhubs.implementation.ClientConstants; import com.azure.messaging.eventhubs.implementation.ConnectionOptions; @@ -32,37 +33,46 @@ import java.util.Objects; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link - * EventHubAsyncClient}. Calling {@link #buildAsyncClient()} constructs an instant of the client. + * This class provides a fluent builder API to aid the instantiation of {@link EventHubAsyncClient} and + * {@link EventHubClient}. Calling {@link #buildAsyncClient() buildAsyncClient()} or + * {@link #buildClient() buildClient()} constructs an instance of the respective client. * *

- * The client requires credentials or a connection string to perform operations against Azure Event Hubs. Setting - * credentials by using {@link #connectionString(String)}, {@link #connectionString(String, String)}, or {@link - * #credential(String, String, TokenCredential)}, is required in order to construct an {@link EventHubAsyncClient}. - *

- * - *

Creating an {@link EventHubAsyncClient} using Event Hubs namespace connection string

+ * Credentials are required to perform operations against Azure Event Hubs. They can be set by using + * one of the following methods: + *
    + *
  • {@link #connectionString(String)} with a connection string to a specific Event Hub.
  • + *
  • {@link #connectionString(String, String)} with an Event Hub namespace connection string and the + * Event Hub name.
  • + *
  • {@link #credential(String, String, TokenCredential)} with the hostname, Event Hub name, and a set of + * credentials authorized to use the Event Hub.
  • + *
* - * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string} + *

+ * Creating an asynchronous {@link EventHubAsyncClient} using Event Hubs namespace connection string + *

* - *

Creating an {@link EventHubAsyncClient} using Event Hub instance connection string

+ * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string} * - * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string} + *

+ * Creating a synchronous {@link EventHubClient} using an Event Hub instance connection string + *

* - *

Creating an {@link EventHubAsyncClient} using Event Hub with no retry, different timeout and new - * Scheduler

+ * {@codesnippet com.azure.messaging.eventhubs.eventhubclient.instantiation} * - * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.retry-timeout-scheduler} + *

+ * Creating an {@link EventProcessor} using Event Hub instance connection string + *

* - *

Creating an {@link EventProcessor} instance using Event Hub instance connection - * string

* {@codesnippet com.azure.messaging.eventhubs.eventprocessor.instantiation} * + * @see EventHubClient * @see EventHubAsyncClient * @see EventProcessor */ -@ServiceClientBuilder(serviceClients = {EventHubAsyncClient.class, EventProcessor.class}) +@ServiceClientBuilder(serviceClients = {EventHubAsyncClient.class, EventHubClient.class, EventProcessor.class}) public class EventHubClientBuilder { + private final ClientLogger logger = new ClientLogger(EventHubClientBuilder.class); private static final String AZURE_EVENT_HUBS_CONNECTION_STRING = "AZURE_EVENT_HUBS_CONNECTION_STRING"; private static final RetryOptions DEFAULT_RETRY = new RetryOptions() @@ -106,8 +116,8 @@ public EventHubClientBuilder() { * expected that the Event Hub name and the shared access key properties are contained in this connection * string. * @return The updated {@link EventHubClientBuilder} object. - * @throws IllegalArgumentException if {@code connectionString} is null or empty. Or, the {@code - * connectionString} does not contain the "EntityPath" key, which is the name of the Event Hub instance. + * @throws IllegalArgumentException if {@code connectionString} is null or empty. Or, the {@code connectionString} + * does not contain the "EntityPath" key, which is the name of the Event Hub instance. * @throws AzureException If the shared access signature token credential could not be created using the * connection string. */ @@ -118,7 +128,7 @@ public EventHubClientBuilder connectionString(String connectionString) { tokenCredential = new EventHubSharedAccessKeyCredential(properties.sharedAccessKeyName(), properties.sharedAccessKey(), ClientConstants.TOKEN_VALIDITY); } catch (InvalidKeyException | NoSuchAlgorithmException e) { - throw new AzureException("Could not create the EventHubSharedAccessKeyCredential.", e); + throw logger.logExceptionAsError(new AzureException("Could not create the EventHubSharedAccessKeyCredential.", e)); } return credential(properties.endpoint().getHost(), properties.eventHubName(), tokenCredential); @@ -133,14 +143,20 @@ public EventHubClientBuilder connectionString(String connectionString) { * Hub name. * @param eventHubName The name of the Event Hub to connect the client to. * @return The updated {@link EventHubClientBuilder} object. - * @throws IllegalArgumentException if {@code connectionString} or {@code eventHubName} is null or empty. + * @throws NullPointerException if {@code connectionString} or {@code eventHubName} is null. + * @throws IllegalArgumentException if {@code connectionString} or {@code eventHubName} is an empty string. * Or, if the {@code connectionString} contains the Event Hub name. * @throws AzureException If the shared access signature token credential could not be created using the * connection string. */ public EventHubClientBuilder connectionString(String connectionString, String eventHubName) { - if (ImplUtils.isNullOrEmpty(eventHubName)) { - throw new IllegalArgumentException("'eventHubName' cannot be null or empty"); + Objects.requireNonNull(connectionString, "'connectionString' cannot be null."); + Objects.requireNonNull(eventHubName, "'eventHubName' cannot be null."); + + if (connectionString.isEmpty()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'connectionString' cannot be an empty string.")); + } else if (eventHubName.isEmpty()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'eventHubName' cannot be an empty string.")); } final ConnectionStringProperties properties = new ConnectionStringProperties(connectionString); @@ -149,14 +165,15 @@ public EventHubClientBuilder connectionString(String connectionString, String ev tokenCredential = new EventHubSharedAccessKeyCredential(properties.sharedAccessKeyName(), properties.sharedAccessKey(), ClientConstants.TOKEN_VALIDITY); } catch (InvalidKeyException | NoSuchAlgorithmException e) { - throw new AzureException("Could not create the EventHubSharedAccessKeyCredential.", e); + throw logger.logExceptionAsError(new AzureException("Could not create the EventHubSharedAccessKeyCredential.", e)); } - if (!ImplUtils.isNullOrEmpty(properties.eventHubName())) { - throw new IllegalArgumentException(String.format(Locale.US, - "'connectionString' contains an Event Hub name [%s]. Please use the" - + " credentials(String connectionString) overload. Or supply a 'connectionString' without" - + " 'EntityPath' in it.", properties.eventHubName())); + if (!ImplUtils.isNullOrEmpty(properties.eventHubName()) && !eventHubName.equals(properties.eventHubName())) { + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "'connectionString' contains an Event Hub name [%s] and it does not match the given " + + "'eventHubName' parameter [%s]. Please use the credentials(String connectionString) overload. " + + "Or supply a 'connectionString' without 'EntityPath' in it.", + properties.eventHubName(), eventHubName))); } return credential(properties.endpoint().getHost(), eventHubName, tokenCredential); @@ -180,27 +197,25 @@ public EventHubClientBuilder configuration(Configuration configuration) { * Sets the credential information for which Event Hub instance to connect to, and how to authorize against it. * * @param host The fully qualified host name for the Event Hubs namespace. This is likely to be similar to - * {@literal "{your-namespace}.servicebus.windows.net}". + * {@literal "{your-namespace}.servicebus.windows.net}". * @param eventHubName The name of the Event Hub to connect the client to. * @param credential The token credential to use for authorization. Access controls may be specified by the * Event Hubs namespace or the requested Event Hub, depending on Azure configuration. * @return The updated {@link EventHubClientBuilder} object. - * @throws IllegalArgumentException if {@code host} or {@code eventHubName} is null or empty. - * @throws NullPointerException if {@code credentials} is null. + * @throws IllegalArgumentException if {@code host} or {@code eventHubName} is an empty string. + * @throws NullPointerException if {@code host}, {@code eventHubName}, {@code credentials} is null. */ public EventHubClientBuilder credential(String host, String eventHubName, TokenCredential credential) { + this.host = Objects.requireNonNull(host, "'host' cannot be null."); + this.credentials = Objects.requireNonNull(credential, "'credential' cannot be null."); + this.eventHubName = Objects.requireNonNull(eventHubName, "'eventHubName' cannot be null."); + if (ImplUtils.isNullOrEmpty(host)) { - throw new IllegalArgumentException("'host' cannot be null or empty"); + throw logger.logExceptionAsError(new IllegalArgumentException("'host' cannot be an empty string.")); + } else if (ImplUtils.isNullOrEmpty(eventHubName)) { + throw logger.logExceptionAsError(new IllegalArgumentException("'eventHubName' cannot be an empty string.")); } - if (ImplUtils.isNullOrEmpty(eventHubName)) { - throw new IllegalArgumentException("'eventHubName' cannot be null or empty."); - } - - Objects.requireNonNull(credential); - this.host = host; - this.credentials = credential; - this.eventHubName = eventHubName; return this; } @@ -253,8 +268,8 @@ public EventHubClientBuilder retry(RetryOptions retryOptions) { } /** - * Creates a new {@link EventHubAsyncClient} based on options set on this builder. Every time {@code - * buildAsyncClient()} is invoked, a new instance of {@link EventHubAsyncClient} is created. + * Creates a new {@link EventHubAsyncClient} based on options set on this builder. Every time + * {@code buildAsyncClient()} is invoked, a new instance of {@link EventHubAsyncClient} is created. * *

* The following options are used if ones are not specified in the builder: @@ -277,74 +292,44 @@ public EventHubClientBuilder retry(RetryOptions retryOptions) { * specified but the transport type is not {@link TransportType#AMQP_WEB_SOCKETS web sockets}. */ public EventHubAsyncClient buildAsyncClient() { - configuration = configuration == null ? ConfigurationManager.getConfiguration().clone() : configuration; - - if (credentials == null) { - final String connectionString = configuration.get(AZURE_EVENT_HUBS_CONNECTION_STRING); - - if (ImplUtils.isNullOrEmpty(connectionString)) { - throw new IllegalArgumentException("Credentials have not been set using 'EventHubClientBuilder.credentials(String)'" - + "EventHubClientBuilder.credentials(String, String, TokenCredential). And the connection string is" - + "not set in the '" + AZURE_EVENT_HUBS_CONNECTION_STRING + "' environment variable."); - } - - connectionString(connectionString); - } - - if (retryOptions == null) { - retryOptions = DEFAULT_RETRY; - } - - // If the proxy has been configured by the user but they have overridden the TransportType with something that - // is not AMQP_WEB_SOCKETS. - if (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured() - && transport != TransportType.AMQP_WEB_SOCKETS) { - throw new IllegalArgumentException("Cannot use a proxy when TransportType is not AMQP."); - } - - if (proxyConfiguration == null) { - proxyConfiguration = getDefaultProxyConfiguration(configuration); - } - - if (scheduler == null) { - scheduler = Schedulers.elastic(); - } - + final ConnectionOptions connectionOptions = getConnectionOptions(); final ReactorProvider provider = new ReactorProvider(); final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(provider); - final CBSAuthorizationType authorizationType = credentials instanceof EventHubSharedAccessKeyCredential - ? CBSAuthorizationType.SHARED_ACCESS_SIGNATURE - : CBSAuthorizationType.JSON_WEB_TOKEN; - final ConnectionOptions parameters = new ConnectionOptions(host, eventHubName, credentials, authorizationType, - transport, retryOptions, proxyConfiguration, scheduler); - return new EventHubAsyncClient(parameters, provider, handlerProvider); + return new EventHubAsyncClient(connectionOptions, provider, handlerProvider); } - private ProxyConfiguration getDefaultProxyConfiguration(Configuration configuration) { - ProxyAuthenticationType authentication = ProxyAuthenticationType.NONE; - if (proxyConfiguration != null) { - authentication = proxyConfiguration.authentication(); - } - - String proxyAddress = configuration.get(BaseConfigurations.HTTP_PROXY); - - if (ImplUtils.isNullOrEmpty(proxyAddress)) { - return ProxyConfiguration.SYSTEM_DEFAULTS; - } - - final String[] hostPort = proxyAddress.split(":"); - if (hostPort.length < 2) { - throw new IllegalArgumentException("HTTP_PROXY cannot be parsed into a proxy"); - } - - final String host = hostPort[0]; - final int port = Integer.parseInt(hostPort[1]); - final Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port)); - final String username = configuration.get(ProxyConfiguration.PROXY_USERNAME); - final String password = configuration.get(ProxyConfiguration.PROXY_PASSWORD); + /** + * Creates a new {@link EventHubClient} based on options set on this builder. Every time {@code buildClient()} + * is invoked, a new instance of {@link EventHubClient} is created. + * + *

+ * The following options are used if ones are not specified in the builder: + * + *

    + *
  • If no configuration is specified, the {@link ConfigurationManager#getConfiguration() global configuration} + * is used to provide any shared configuration values. The configuration values read are the {@link + * BaseConfigurations#HTTP_PROXY}, {@link ProxyConfiguration#PROXY_USERNAME}, and {@link + * ProxyConfiguration#PROXY_PASSWORD}.
  • + *
  • If no retry is specified, the default retry options are used.
  • + *
  • If no proxy is specified, the builder checks the {@link ConfigurationManager#getConfiguration() global + * configuration} for a configured proxy, then it checks to see if a system proxy is configured.
  • + *
  • If no timeout is specified, a {@link ClientConstants#OPERATION_TIMEOUT timeout of one minute} is used.
  • + *
  • If no scheduler is specified, an {@link Schedulers#elastic() elastic scheduler} is used.
  • + *
+ * + * @return A new {@link EventHubClient} instance with all the configured options. + * @throws IllegalArgumentException if the credentials have not been set using either {@link + * #connectionString(String)} or {@link #credential(String, String, TokenCredential)}. Or, if a proxy is + * specified but the transport type is not {@link TransportType#AMQP_WEB_SOCKETS web sockets}. + */ + public EventHubClient buildClient() { + final ConnectionOptions connectionOptions = getConnectionOptions(); + final ReactorProvider provider = new ReactorProvider(); + final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(provider); + final EventHubAsyncClient client = new EventHubAsyncClient(connectionOptions, provider, handlerProvider); - return new ProxyConfiguration(authentication, proxy, username, password); + return new EventHubClient(client, connectionOptions); } /** @@ -429,4 +414,73 @@ public EventProcessor buildEventProcessor() { return new EventProcessor(buildAsyncClient(), this.consumerGroupName, this.partitionProcessorFactory, initialEventPosition, partitionManager, eventHubName); } + + private ConnectionOptions getConnectionOptions() { + configuration = configuration == null ? ConfigurationManager.getConfiguration().clone() : configuration; + + if (credentials == null) { + final String connectionString = configuration.get(AZURE_EVENT_HUBS_CONNECTION_STRING); + + if (ImplUtils.isNullOrEmpty(connectionString)) { + throw logger.logExceptionAsError(new IllegalArgumentException("Credentials have not been set. " + + "They can be set using: connectionString(String), connectionString(String, String), " + + "credentials(String, String, TokenCredential), or setting the environment variable '" + + AZURE_EVENT_HUBS_CONNECTION_STRING + "' with a connection string")); + } + + connectionString(connectionString); + } + + if (retryOptions == null) { + retryOptions = DEFAULT_RETRY; + } + + // If the proxy has been configured by the user but they have overridden the TransportType with something that + // is not AMQP_WEB_SOCKETS. + if (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured() + && transport != TransportType.AMQP_WEB_SOCKETS) { + throw logger.logExceptionAsError(new IllegalArgumentException("Cannot use a proxy when TransportType is not AMQP.")); + } + + if (proxyConfiguration == null) { + proxyConfiguration = getDefaultProxyConfiguration(configuration); + } + + if (scheduler == null) { + scheduler = Schedulers.elastic(); + } + + final CBSAuthorizationType authorizationType = credentials instanceof EventHubSharedAccessKeyCredential + ? CBSAuthorizationType.SHARED_ACCESS_SIGNATURE + : CBSAuthorizationType.JSON_WEB_TOKEN; + + return new ConnectionOptions(host, eventHubName, credentials, authorizationType, + transport, retryOptions, proxyConfiguration, scheduler); + } + + private ProxyConfiguration getDefaultProxyConfiguration(Configuration configuration) { + ProxyAuthenticationType authentication = ProxyAuthenticationType.NONE; + if (proxyConfiguration != null) { + authentication = proxyConfiguration.authentication(); + } + + String proxyAddress = configuration.get(BaseConfigurations.HTTP_PROXY); + + if (ImplUtils.isNullOrEmpty(proxyAddress)) { + return ProxyConfiguration.SYSTEM_DEFAULTS; + } + + final String[] hostPort = proxyAddress.split(":"); + if (hostPort.length < 2) { + throw logger.logExceptionAsError(new IllegalArgumentException("HTTP_PROXY cannot be parsed into a proxy")); + } + + final String host = hostPort[0]; + final int port = Integer.parseInt(hostPort[1]); + final Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port)); + final String username = configuration.get(ProxyConfiguration.PROXY_USERNAME); + final String password = configuration.get(ProxyConfiguration.PROXY_PASSWORD); + + return new ProxyConfiguration(authentication, proxy, username, password); + } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java new file mode 100644 index 000000000000..f5e0764905ef --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.util.IterableStream; +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import reactor.core.publisher.Flux; + +import java.io.Closeable; +import java.io.IOException; +import java.time.Duration; +import java.util.Objects; + +/** + * A consumer responsible for reading {@link EventData} from a specific Event Hub partition in the context of a specific + * consumer group. + * + *
    + *
  • If {@link EventHubConsumer} is created where {@link EventHubConsumerOptions#ownerLevel()} has a + * value, then Event Hubs service will guarantee only one active consumer exists per partitionId and consumer group + * combination. This consumer is sometimes referred to as an "Epoch Consumer."
  • + *
  • Multiple consumers per partitionId and consumer group combination can be created by not setting + * {@link EventHubConsumerOptions#ownerLevel()} when creating consumers. This non-exclusive consumer is sometimes + * referred to as a "Non-Epoch Consumer."
  • + *
+ * + * @see EventHubClient#createConsumer(String, String, EventPosition) + * @see EventHubClient#createConsumer(String, String, EventPosition, EventHubConsumerOptions) + */ +public class EventHubConsumer implements Closeable { + private final EventHubAsyncConsumer consumer; + private final EventHubConsumerOptions options; + + EventHubConsumer(EventHubAsyncConsumer consumer, EventHubConsumerOptions options) { + this.consumer = Objects.requireNonNull(consumer, "'consumer' cannot be null."); + this.options = Objects.requireNonNull(options, "'options' cannot be null."); + + //TODO (conniey): Keep track of the last sequence number as each method invoked. + this.consumer.receive().windowTimeout(options.prefetchCount(), this.options.retry().tryTimeout()); + } + + /** + * Receives a batch of EventData from the Event Hub partition. + * + * @param maximumMessageCount The maximum number of messages to receive in this batch. + * @return A set of {@link EventData} that was received. The iterable contains up to {@code maximumMessageCount} + * events. + */ + public IterableStream receive(int maximumMessageCount) { + return new IterableStream<>(Flux.empty()); + } + + /** + * Receives a batch of EventData from the Event Hub partition + * + * @param maximumMessageCount The maximum number of messages to receive in this batch. + * @param maximumWaitTime The maximum amount of time to wait to build up the requested message count for the + * batch; if not specified, the default wait time specified when the consumer was created will be used. + * @return A set of {@link EventData} that was received. The iterable contains up to {@code maximumMessageCount} + * events. + */ + public IterableStream receive(int maximumMessageCount, Duration maximumWaitTime) { + return new IterableStream<>(Flux.empty()); + } + + /** + * {@inheritDoc} + */ + @Override + public void close() throws IOException { + consumer.close(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java new file mode 100644 index 000000000000..b7d8df736d88 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.implementation.annotation.Immutable; +import com.azure.messaging.eventhubs.models.BatchOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.SendOptions; + +import java.io.Closeable; +import java.io.IOException; +import java.time.Duration; +import java.util.Objects; + +/** + * A producer responsible for transmitting {@link EventData} to a specific Event Hub, grouped together in batches. + * Depending on the options specified at creation, the producer may be created to allow event data to be automatically + * routed to an available partition or specific to a partition. + * + *

+ * Allowing automatic routing of partitions is recommended when: + *

    + *
  • The sending of events needs to be highly available.
  • + *
  • The event data should be evenly distributed among all available partitions.
  • + *
+ *

+ * + *

+ * If no {@link EventHubProducerOptions#partitionId() partitionId} is specified, the following rules are used for + * automatically selecting one: + * + *

    + *
  1. Distribute the events equally amongst all available partitions using a round-robin approach.
  2. + *
  3. If a partition becomes unavailable, the Event Hubs service will automatically detect it and forward the + * message to another available partition.
  4. + *
+ *

+ * + *

Create a producer that routes events to any partition

+ * To allow automatic routing of messages to available partition, do not specify the {@link + * EventHubProducerOptions#partitionId() partitionId} when creating the {@link EventHubProducer}. + * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.instantiation} + * + *

Create a producer that publishes events to partition "foo" with a timeout of 45 seconds.

+ * Developers can push events to a single partition by specifying the {@link EventHubProducerOptions#partitionId(String) + * partitionId} when creating an {@link EventHubProducer}. + * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.instantiation#partitionId} + * + *

Publish events to the same partition, grouped together using {@link SendOptions#partitionKey(String)}.

+ * If developers want to push similar events to end up at the same partition, but do not require them to go to a + * specific partition, they can use {@link SendOptions#partitionKey(String)}. + * + *

+ * In the sample below, all the "sandwiches" end up in the same partition, but it could end up in partition 0, 1, etc. + * of the available partitions. All that matters to the end user is that they are grouped together. + *

+ * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.send#publisher-sendOptions} + * + *

Publish events using an {@link EventDataBatch}.

+ * Developers can create an {@link EventDataBatch}, add the events they want into it, and publish these events together. + * When creating a {@link EventDataBatch batch}, developers can specify a set of {@link BatchOptions options} to + * configure this batch. + * + *

+ * In the scenario below, the developer is creating a networked video game. They want to receive telemetry about their + * users' gaming systems, but do not want to slow down the network with telemetry. So they limit the size of their + * {@link EventDataBatch batches} to be no larger than 256 bytes. The events within the batch also get hashed to the + * same partition because they all share the same {@link BatchOptions#partitionKey()}. + *

+ * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.send#eventDataBatch} + * + * @see EventHubClient#createProducer() + * @see EventHubClient#createProducer(EventHubProducerOptions) + * @see EventHubAsyncProducer To asynchronously generate events to an Event Hub, see EventHubAsyncProducer. + */ +@Immutable +public class EventHubProducer implements Closeable { + private final EventHubAsyncProducer producer; + private final Duration tryTimeout; + + /** + * Creates a new instance of {@link EventHubProducer} that sends messages to an Azure Event Hub. + * + * @throws NullPointerException if {@code producer} or {@code tryTimeout} is null. + */ + EventHubProducer(EventHubAsyncProducer producer, Duration tryTimeout) { + this.producer = Objects.requireNonNull(producer, "'producer' cannot be null."); + this.tryTimeout = Objects.requireNonNull(tryTimeout, "'tryTimeout' cannot be null."); + } + + /** + * Creates an {@link EventDataBatch} that can fit as many events as the transport allows. + * + * @return A new {@link EventDataBatch} that can fit as many events as the transport allows. + */ + public EventDataBatch createBatch() { + return producer.createBatch().block(tryTimeout); + } + + /** + * Creates an {@link EventDataBatch} that can fit as many events as the transport allows. + * + * @param options A set of options used to configure the {@link EventDataBatch}. + * @return A new {@link EventDataBatch} that can fit as many events as the transport allows. + */ + public EventDataBatch createBatch(BatchOptions options) { + return producer.createBatch(options).block(tryTimeout); + } + + /** + * Sends a single event to the associated Event Hub. If the size of the single event exceeds the maximum size + * allowed, an exception will be triggered and the send will fail. + * + *

+ * For more information regarding the maximum event size allowed, see + * Azure Event Hubs Quotas and + * Limits. + *

+ * + * @param event Event to send to the service. + */ + public void send(EventData event) { + producer.send(event).block(); + } + + /** + * Sends a single event to the associated Event Hub with the send options. If the size of the single event exceeds + * the maximum size allowed, an exception will be triggered and the send will fail. + * + *

+ * For more information regarding the maximum event size allowed, see + * Azure Event Hubs Quotas and + * Limits. + *

+ * + * @param event Event to send to the service. + * @param options The set of options to consider when sending this event. + */ + public void send(EventData event, SendOptions options) { + producer.send(event, options).block(); + } + + /** + * Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the + * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message + * size is the max amount allowed on the link. + * + *

+ * For more information regarding the maximum event size allowed, see + * Azure Event Hubs Quotas and + * Limits. + *

+ * + * @param events Events to send to the service. + */ + public void send(Iterable events) { + producer.send(events).block(); + } + + /** + * Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the + * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message + * size is the max amount allowed on the link. + * + *

+ * For more information regarding the maximum event size allowed, see + * Azure Event Hubs Quotas and + * Limits. + *

+ * + * @param events Events to send to the service. + * @param options The set of options to consider when sending this batch. + */ + public void send(Iterable events, SendOptions options) { + producer.send(events, options).block(); + } + + /** + * Sends the batch to the associated Event Hub. + * + * @param batch The batch to send to the service. + * @throws NullPointerException if {@code batch} is {@code null}. + * @see EventHubProducer#createBatch() + * @see EventHubProducer#createBatch(BatchOptions) + */ + public void send(EventDataBatch batch) { + producer.send(batch).block(); + } + + /** + * {@inheritDoc} + */ + @Override + public void close() throws IOException { + producer.close(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProperties.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProperties.java index 8378b550b2d3..7cb9789e40ee 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProperties.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProperties.java @@ -4,17 +4,17 @@ package com.azure.messaging.eventhubs; import com.azure.core.implementation.annotation.Immutable; -import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; import com.azure.messaging.eventhubs.models.EventPosition; import java.time.Instant; import java.util.Arrays; /** - * Holds information about Event Hubs which can come handy while performing data-plane operations like - * {@link EventHubAsyncClient#createConsumer(String, String, EventPosition)} and - * {@link EventHubAsyncClient#createConsumer(String, String, EventPosition, EventHubConsumerOptions)}. + * Holds information about an Event Hub which can come handy while performing operations like + * {@link EventHubClient#createConsumer(String, String, EventPosition) creating an EventHubConsumer} or + * {@link EventHubAsyncClient#createConsumer(String, String, EventPosition) an EventHubAsyncConsumer}. * + * @see EventHubClient * @see EventHubAsyncClient */ @Immutable diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredential.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredential.java index ae23b11a6eb3..cb03a2e76f3c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredential.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredential.java @@ -7,6 +7,7 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.implementation.annotation.Immutable; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import javax.crypto.Mac; @@ -27,48 +28,58 @@ /** * Authorizes with Azure Event Hubs service using a shared access key from either an Event Hubs namespace or a specific * Event Hub. + * + *

+ * The shared access key can be obtained by creating a shared access policy for the Event Hubs namespace or for a + * specific Event Hub instance. See + * + * Shared access authorization policies for more information. + *

+ * + * @see Authorize + * access with shared access signature. */ @Immutable public class EventHubSharedAccessKeyCredential implements TokenCredential { private static final String SHARED_ACCESS_SIGNATURE_FORMAT = "SharedAccessSignature sr=%s&sig=%s&se=%s&skn=%s"; private static final String HASH_ALGORITHM = "HMACSHA256"; - private final String keyName; + private final ClientLogger logger = new ClientLogger(EventHubSharedAccessKeyCredential.class); + + private final String policyName; private final Mac hmac; private final Duration tokenValidity; /** - * Creates an instance that authorizes using the {@code keyName} and {@code sharedAccessKey}. The authorization + * Creates an instance that authorizes using the {@code policyName} and {@code sharedAccessKey}. The authorization * lasts for a period of {@code tokenValidity} before another token must be requested. * - * @param keyName Name of the shared access key policy. + * @param policyName Name of the shared access key policy. * @param sharedAccessKey Value of the shared access key. * @param tokenValidity The duration for which the shared access signature is valid. - * @throws IllegalArgumentException if {@code keyName}, {@code sharedAccessKey} is null or empty. Or the duration of - * {@code tokenValidity} is zero or a negative value. - * @throws NoSuchAlgorithmException If the hashing algorithm cannot be instantiated, which is used to generate the - * shared access signatures. + * @throws IllegalArgumentException if {@code policyName}, {@code sharedAccessKey} is an empty string. Or the + * duration of {@code tokenValidity} is zero or a negative value. + * @throws NoSuchAlgorithmException If the hashing algorithm cannot be instantiated, which is used to generate + * the shared access signatures. * @throws InvalidKeyException If the {@code sharedAccessKey} is an invalid value for the hashing algorithm. - * @throws NullPointerException if {@code tokenValidity} is null. + * @throws NullPointerException if {@code policyName}, {@code sharedAccessKey}, or {@code tokenValidity} is + * null. */ - public EventHubSharedAccessKeyCredential(String keyName, String sharedAccessKey, Duration tokenValidity) + public EventHubSharedAccessKeyCredential(String policyName, String sharedAccessKey, Duration tokenValidity) throws NoSuchAlgorithmException, InvalidKeyException { - if (ImplUtils.isNullOrEmpty(keyName)) { - throw new IllegalArgumentException("keyName cannot be null or empty"); - } - if (ImplUtils.isNullOrEmpty(sharedAccessKey)) { - throw new IllegalArgumentException("sharedAccessKey cannot be null or empty."); - } + Objects.requireNonNull(sharedAccessKey, "'sharedAccessKey' cannot be null."); + this.policyName = Objects.requireNonNull(policyName, "'sharedAccessKey' cannot be null."); + this.tokenValidity = Objects.requireNonNull(tokenValidity, "'tokenValidity' cannot be null."); - Objects.requireNonNull(tokenValidity); - if (tokenValidity.isZero() || tokenValidity.isNegative()) { - throw new IllegalArgumentException("tokenTimeToLive has to positive and in the order-of seconds"); + if (policyName.isEmpty()) { + throw new IllegalArgumentException("'policyName' cannot be an empty string."); + } else if (sharedAccessKey.isEmpty()) { + throw new IllegalArgumentException("'sharedAccessKey' cannot be an empty string."); + } else if (tokenValidity.isZero() || tokenValidity.isNegative()) { + throw new IllegalArgumentException("'tokenTimeToLive' has to positive and in the order-of seconds"); } - this.keyName = keyName; - this.tokenValidity = tokenValidity; - hmac = Mac.getInstance(HASH_ALGORITHM); final byte[] sasKeyBytes = sharedAccessKey.getBytes(UTF_8); @@ -82,12 +93,13 @@ public EventHubSharedAccessKeyCredential(String keyName, String sharedAccessKey, * * @param scopes The name of the resource or token audience to obtain a token for. * @return A Mono that completes and returns the shared access signature. - * @throws IllegalArgumentException if {@code scopes} does not contain a single value, which is the token audience. + * @throws IllegalArgumentException if {@code scopes} does not contain a single value, which is the token + * audience. */ @Override public Mono getToken(String... scopes) { if (scopes.length != 1) { - throw new IllegalArgumentException("'scopes' should only contain a single argument that is the token audience or resource name."); + throw logger.logExceptionAsError(new IllegalArgumentException("'scopes' should only contain a single argument that is the token audience or resource name.")); } return Mono.fromCallable(() -> generateSharedAccessSignature(scopes[0])); @@ -95,7 +107,7 @@ public Mono getToken(String... scopes) { private AccessToken generateSharedAccessSignature(final String resource) throws UnsupportedEncodingException { if (ImplUtils.isNullOrEmpty(resource)) { - throw new IllegalArgumentException("resource cannot be empty"); + throw logger.logExceptionAsError(new IllegalArgumentException("resource cannot be empty")); } final String utf8Encoding = UTF_8.name(); @@ -111,7 +123,7 @@ private AccessToken generateSharedAccessSignature(final String resource) throws audienceUri, URLEncoder.encode(signature, utf8Encoding), URLEncoder.encode(expiresOnEpochSeconds, utf8Encoding), - URLEncoder.encode(keyName, utf8Encoding)); + URLEncoder.encode(policyName, utf8Encoding)); return new AccessToken(token, expiresOn); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java index 041c116e93cb..83d7f8617a8b 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java @@ -6,14 +6,17 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.models.Checkpoint; import com.azure.messaging.eventhubs.models.PartitionOwnership; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; /** - * A simple in-memory implementation of a {@link PartitionManager}. + * A simple in-memory implementation of a {@link PartitionManager}. This implementation keeps track of partition + * ownership details including checkpointing information in-memory. Using this implementation will only facilitate + * checkpointing and load balancing of Event Processors running within this process. */ public class InMemoryPartitionManager implements PartitionManager { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java index d7fb6945df95..da3f4fdb00f5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java @@ -5,12 +5,11 @@ import com.azure.messaging.eventhubs.models.Checkpoint; import com.azure.messaging.eventhubs.models.PartitionOwnership; - import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** - * Partition manager stores and retrieves partition ownership information and checkpoint details for each partition. + * A partition manager stores and retrieves partition ownership information and checkpoint details for each partition. */ public interface PartitionManager { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionStringProperties.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionStringProperties.java index 5681a7e5d8d4..38b7b6bca582 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionStringProperties.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionStringProperties.java @@ -3,14 +3,13 @@ package com.azure.messaging.eventhubs.implementation; -import com.azure.core.implementation.util.ImplUtils; - import java.net.URI; import java.net.URISyntaxException; import java.util.Locale; +import java.util.Objects; /** - * The set of properties that comprise a connection string from the Azure portal. + * The set of properties that comprise a connection string from the Azure portal. */ public class ConnectionStringProperties { private static final String TOKEN_VALUE_SEPARATOR = "="; @@ -33,12 +32,14 @@ public class ConnectionStringProperties { * Creates a new instance by parsing the {@code connectionString} into its components. * * @param connectionString The connection string to the Event Hub instance. - * @throws IllegalArgumentException if {@code connectionString} is {@code null} or empty, the connection string has - * an invalid format. + * @throws NullPointerException if {@code connectionString} is null. + * @throws IllegalArgumentException if {@code connectionString} is an empty string or the connection string has + * an invalid format. */ public ConnectionStringProperties(String connectionString) { - if (ImplUtils.isNullOrEmpty(connectionString)) { - throw new IllegalArgumentException("'connectionString' cannot be null or empty"); + Objects.requireNonNull(connectionString, "'connectionString' cannot be null."); + if (connectionString.isEmpty()) { + throw new IllegalArgumentException("'connectionString' cannot be an empty string."); } final String[] tokenValuePairs = connectionString.split(TOKEN_VALUE_PAIR_DELIMITER); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java index 44e3fc8a87de..60341d96247c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java @@ -132,12 +132,12 @@ private Mono getProperties(Map properties, Function x.sendWithAck(request, provider.getReactorDispatcher())).map(message -> { if (!(message.getBody() instanceof AmqpValue)) { - throw new IllegalArgumentException("Expected message.getBody() to be AmqpValue, but is: " + message.getBody()); + throw logger.logExceptionAsError(new IllegalArgumentException("Expected message.getBody() to be AmqpValue, but is: " + message.getBody())); } AmqpValue body = (AmqpValue) message.getBody(); if (!(body.getValue() instanceof Map)) { - throw new IllegalArgumentException("Expected message.getBody().getValue() to be of type Map"); + throw logger.logExceptionAsError(new IllegalArgumentException("Expected message.getBody().getValue() to be of type Map")); } Map map = (Map) body.getValue(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorDispatcher.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorDispatcher.java index b11077be4410..8dc68be81578 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorDispatcher.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorDispatcher.java @@ -83,13 +83,13 @@ private void throwIfSchedulerError() { final RejectedExecutionException rejectedException = this.reactor.attachments() .get(RejectedExecutionException.class, RejectedExecutionException.class); if (rejectedException != null) { - throw new RejectedExecutionException(rejectedException.getMessage(), rejectedException); + throw logger.logExceptionAsError(new RejectedExecutionException(rejectedException.getMessage(), rejectedException)); } // throw when the pipe is in closed state - in which case, // signalling the new event-dispatch will fail if (!this.ioSignal.sink().isOpen()) { - throw new RejectedExecutionException("ReactorDispatcher instance is closed."); + throw logger.logExceptionAsError(new RejectedExecutionException("ReactorDispatcher instance is closed.")); } } @@ -118,7 +118,7 @@ public void run(Selectable selectable) { logger.info("WorkScheduler.run() failed with an error: %s", ignorePipeClosedDuringReactorShutdown); } catch (IOException ioException) { logger.error("WorkScheduler.run() failed with an error: %s", ioException); - throw new RuntimeException(ioException); + throw logger.logExceptionAsError(new RuntimeException(ioException)); } Work topWork; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorProvider.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorProvider.java index 82657ca04de0..8c7c731247ed 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorProvider.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorProvider.java @@ -3,6 +3,7 @@ package com.azure.messaging.eventhubs.implementation; +import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.handler.CustomIOHandler; import com.azure.messaging.eventhubs.implementation.handler.ReactorHandler; import org.apache.qpid.proton.Proton; @@ -15,6 +16,7 @@ import java.util.Objects; public class ReactorProvider { + private final ClientLogger logger = new ClientLogger(ReactorProvider.class); private final Object lock = new Object(); private Reactor reactor; private ReactorDispatcher reactorDispatcher; @@ -57,7 +59,7 @@ private Reactor createReactor(final int maxFrameSize, final Handler globalHandle Objects.requireNonNull(globalHandler); if (maxFrameSize <= 0) { - throw new IllegalArgumentException("'maxFrameSize' must be a positive number."); + throw logger.logExceptionAsError(new IllegalArgumentException("'maxFrameSize' must be a positive number.")); } final ReactorOptions reactorOptions = new ReactorOptions(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RequestResponseChannel.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RequestResponseChannel.java index 4f3c5e0f70f5..56b47b4c49a2 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RequestResponseChannel.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RequestResponseChannel.java @@ -104,13 +104,13 @@ Mono sendWithAck(final Message message, final ReactorDispatcher dispatc start(); if (message == null) { - throw new IllegalArgumentException("message cannot be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("message cannot be null")); } if (message.getMessageId() != null) { - throw new IllegalArgumentException("message.getMessageId() should be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("message.getMessageId() should be null")); } if (message.getReplyTo() != null) { - throw new IllegalArgumentException("message.getReplyTo() should be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("message.getReplyTo() should be null")); } final UnsignedLong messageId = UnsignedLong.valueOf(requestId.incrementAndGet()); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TokenResourceProvider.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TokenResourceProvider.java index 47a03bd1d7ff..33519b5e2962 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TokenResourceProvider.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TokenResourceProvider.java @@ -3,6 +3,8 @@ package com.azure.messaging.eventhubs.implementation; +import com.azure.core.util.logging.ClientLogger; + import java.util.Locale; import java.util.Objects; @@ -13,6 +15,7 @@ class TokenResourceProvider { private static final String TOKEN_AUDIENCE_FORMAT = "amqp://%s/%s"; private static final String AZURE_ACTIVE_DIRECTORY_SCOPE = "https://eventhubs.azure.net//.default"; + private final ClientLogger logger = new ClientLogger(TokenResourceProvider.class); private final CBSAuthorizationType authorizationType; private final String host; @@ -31,8 +34,8 @@ String getResourceString(String resource) { case SHARED_ACCESS_SIGNATURE: return String.format(Locale.US, TOKEN_AUDIENCE_FORMAT, host, resource); default: - throw new IllegalArgumentException(String.format(Locale.US, - "'%s' is not supported authorization type for token audience.", authorizationType)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "'%s' is not supported authorization type for token audience.", authorizationType))); } } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandler.java index db80eb963fab..02326c954050 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandler.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandler.java @@ -263,7 +263,7 @@ private void notifyErrorContext(Connection connection, ErrorCondition condition) } if (condition == null) { - throw new IllegalStateException("notifyErrorContext does not have an ErrorCondition."); + throw logger.logExceptionAsError(new IllegalStateException("notifyErrorContext does not have an ErrorCondition.")); } // if the remote-peer abruptly closes the connection without issuing close frame issue one diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java index f9ab89c2164b..b2eed58b2147 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java @@ -5,11 +5,12 @@ import com.azure.messaging.eventhubs.EventDataBatch; import com.azure.messaging.eventhubs.EventHubAsyncProducer; +import com.azure.messaging.eventhubs.EventHubProducer; /** * The set of options that can be specified when creating an {@link EventDataBatch}. * - * @see EventHubAsyncProducer#createBatch() + * @see EventHubProducer#createBatch(BatchOptions) * @see EventHubAsyncProducer#createBatch(BatchOptions) */ public class BatchOptions implements Cloneable { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptions.java index 3db1c4c07d0c..09ba3db05b46 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptions.java @@ -6,22 +6,27 @@ import com.azure.core.amqp.RetryOptions; import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.EventHubAsyncClient; import com.azure.messaging.eventhubs.EventHubAsyncConsumer; +import com.azure.messaging.eventhubs.EventHubClient; +import com.azure.messaging.eventhubs.EventHubConsumer; import reactor.core.scheduler.Scheduler; import java.util.Locale; import java.util.Optional; /** - * The baseline set of options that can be specified when creating a {@link EventHubAsyncConsumer} to configure its - * behavior. + * The baseline set of options that can be specified when creating an {@link EventHubConsumer} or an + * {@link EventHubAsyncConsumer} to configure its behavior. * - * @see EventHubAsyncConsumer + * @see EventHubClient#createConsumer(String, String, EventPosition, EventHubConsumerOptions) * @see EventHubAsyncClient#createConsumer(String, String, EventPosition, EventHubConsumerOptions) */ @Fluent public class EventHubConsumerOptions implements Cloneable { + private final ClientLogger logger = new ClientLogger(EventHubConsumerOptions.class); + /** * The maximum length, in characters, for the identifier assigned to an {@link EventHubAsyncConsumer}. */ @@ -61,8 +66,8 @@ public EventHubConsumerOptions() { */ public EventHubConsumerOptions identifier(String identifier) { if (!ImplUtils.isNullOrEmpty(identifier) && identifier.length() > MAXIMUM_IDENTIFIER_LENGTH) { - throw new IllegalArgumentException(String.format(Locale.US, - "identifier length cannot exceed %s", MAXIMUM_IDENTIFIER_LENGTH)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "identifier length cannot exceed %s", MAXIMUM_IDENTIFIER_LENGTH))); } this.identifier = identifier; @@ -89,7 +94,7 @@ public EventHubConsumerOptions identifier(String identifier) { */ public EventHubConsumerOptions ownerLevel(Long priority) { if (priority != null && priority < 0) { - throw new IllegalArgumentException("'priority' cannot be a negative value. Please specify a zero or positive long value."); + throw logger.logExceptionAsError(new IllegalArgumentException("'priority' cannot be a negative value. Please specify a zero or positive long value.")); } this.ownerLevel = priority; @@ -119,13 +124,13 @@ public EventHubConsumerOptions retry(RetryOptions retry) { */ public EventHubConsumerOptions prefetchCount(int prefetchCount) { if (prefetchCount < MINIMUM_PREFETCH_COUNT) { - throw new IllegalArgumentException(String.format(Locale.US, - "PrefetchCount, '%s' has to be above %s", prefetchCount, MINIMUM_PREFETCH_COUNT)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "PrefetchCount, '%s' has to be above %s", prefetchCount, MINIMUM_PREFETCH_COUNT))); } if (prefetchCount > MAXIMUM_PREFETCH_COUNT) { - throw new IllegalArgumentException(String.format(Locale.US, - "PrefetchCount, '%s', has to be below %s", prefetchCount, MAXIMUM_PREFETCH_COUNT)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "PrefetchCount, '%s', has to be below %s", prefetchCount, MAXIMUM_PREFETCH_COUNT))); } this.prefetchCount = prefetchCount; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java index 83be11882728..102f0cd538b8 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java @@ -50,16 +50,16 @@ public EventHubProducerOptions retry(RetryOptions retry) { /** * Gets the retry options used to govern retry attempts when an issue is encountered while sending. * - * @return the retry options used to govern retry attempts when an issue is encountered while sending. If {@code - * null}, then the retry options configured on the associated {@link EventHubAsyncClient} is used. + * @return the retry options used to govern retry attempts when an issue is encountered while sending. If + * {@code null}, then the retry options configured on the associated {@link EventHubAsyncClient} is used. */ public RetryOptions retry() { return retryOptions; } /** - * Gets the identifier of the Event Hub partition that the {@link EventHubAsyncProducer} will be bound to, limiting it to - * sending events to only that partition. + * Gets the identifier of the Event Hub partition that the {@link EventHubAsyncProducer} will be bound to, limiting + * it to sending events to only that partition. * * If the identifier is not specified, the Event Hubs service will be responsible for routing events that are sent * to an available partition. diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java index e9fb3f0c9e37..f64b6f9bc45e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java @@ -6,7 +6,9 @@ import com.azure.core.implementation.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.EventData; +import com.azure.messaging.eventhubs.EventHubAsyncClient; import com.azure.messaging.eventhubs.EventHubAsyncConsumer; +import com.azure.messaging.eventhubs.EventHubClient; import java.time.Instant; import java.util.Locale; @@ -16,7 +18,8 @@ * Defines a position of an {@link EventData} in the Event Hub partition. The position can be an offset, sequence * number, or enqueued time. * - * @see EventHubAsyncConsumer + * @see EventHubClient#createConsumer(String, String, EventPosition) + * @see EventHubAsyncClient#createConsumer(String, String, EventPosition) */ @Immutable public final class EventPosition { @@ -106,9 +109,10 @@ public static EventPosition fromOffset(String offset) { * @param isInclusive If true, the event with the {@code offset} is included; otherwise, the next event will * be received. * @return An {@link EventPosition} object. + * @throws NullPointerException if {@code offset} is null. */ public static EventPosition fromOffset(String offset, boolean isInclusive) { - Objects.requireNonNull(offset); + Objects.requireNonNull(offset, "'offset' cannot be null."); return new EventPosition(isInclusive, offset, null, null); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyConfiguration.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyConfiguration.java index 3dce44b44b49..63c16d8dfcfd 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyConfiguration.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyConfiguration.java @@ -3,8 +3,9 @@ package com.azure.messaging.eventhubs.models; -import com.azure.core.util.logging.ClientLogger; import com.azure.core.implementation.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.EventHubClientBuilder; import java.net.PasswordAuthentication; import java.net.Proxy; @@ -13,6 +14,8 @@ /** * Properties for configuring proxies with Event Hubs. + * + * @see EventHubClientBuilder#proxyConfiguration(ProxyConfiguration) */ @Immutable public class ProxyConfiguration implements AutoCloseable { @@ -57,8 +60,7 @@ private ProxyConfiguration() { * {@link ProxyAuthenticationType#DIGEST} and {@code username} or {@code password} are {@code null}. */ public ProxyConfiguration(ProxyAuthenticationType authentication, Proxy proxyAddress, String username, String password) { - Objects.requireNonNull(authentication); - this.authentication = authentication; + this.authentication = Objects.requireNonNull(authentication, "'authentication' cannot be null."); this.proxyAddress = proxyAddress; if (username != null && password != null) { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/SendOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/SendOptions.java index a78a8951c379..2da468ccc781 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/SendOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/SendOptions.java @@ -6,12 +6,15 @@ import com.azure.core.implementation.annotation.Fluent; import com.azure.messaging.eventhubs.EventData; import com.azure.messaging.eventhubs.EventHubAsyncProducer; +import com.azure.messaging.eventhubs.EventHubProducer; import reactor.core.publisher.Flux; /** * The set of options that can be specified when sending a set of events to influence the way in which events are sent * to the Event Hubs service. * + * @see EventHubProducer#send(EventData, SendOptions) + * @see EventHubProducer#send(Iterable, SendOptions) * @see EventHubAsyncProducer#send(EventData, SendOptions) * @see EventHubAsyncProducer#send(Iterable, SendOptions) * @see EventHubAsyncProducer#send(Flux, SendOptions) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/package-info.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/package-info.java index 3ef8e300da4e..7810797995e5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/package-info.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/package-info.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. /** - * Package containing classes for creating a {@link com.azure.messaging.eventhubs.EventHubAsyncClient} to - * perform operations on Azure Event Hubs. + * Package containing classes for creating an {@link com.azure.messaging.eventhubs.EventHubClient} or an + * {@link com.azure.messaging.eventhubs.EventHubAsyncClient} to perform operations on Azure Event Hubs. */ package com.azure.messaging.eventhubs; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java index 89f7b0f63257..2f33f372ba32 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java @@ -51,6 +51,11 @@ public static void main(String[] args) throws InterruptedException, IOException // TimeoutException is thrown. String firstPartition = client.getPartitionIds().blockFirst(OPERATION_TIMEOUT); + // This shouldn't happen, but if we are unable to get the partitions within the timeout period. + if (firstPartition == null) { + firstPartition = "0"; + } + // Create a consumer. // The "$Default" consumer group is created by default. This value can be found by going to the Event Hub // instance you are connecting to, and selecting the "Consumer groups" page. EventPosition.latest() tells the diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java index 99b1b75dfa20..796a0738b6c7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java @@ -3,11 +3,6 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.RetryOptions; -import reactor.core.scheduler.Schedulers; - -import java.time.Duration; - /** * Contains code snippets when generating javadocs through doclets for {@link EventHubAsyncClient}. */ @@ -17,15 +12,15 @@ public class EventHubAsyncClientJavaDocCodeSamples { * Creating an {@link EventHubAsyncClient} using an Event Hubs namespace connection string with an Event Hub name. */ public void instantiation() { - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + "SharedAccessKey={sharedAccessKey}"; String eventHubName = "my-event-hub"; EventHubAsyncClient client = new EventHubClientBuilder() .connectionString(connectionString, eventHubName) .buildAsyncClient(); - // END: com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string + // END: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string client.close(); } @@ -34,34 +29,14 @@ public void instantiation() { * Creating an {@link EventHubAsyncClient} using a connection string specific to an Event Hub instance. */ public void instantiationInstance() { - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; - - EventHubAsyncClient client = new EventHubClientBuilder() - .connectionString(connectionString) - .buildAsyncClient(); - // END: com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string - - client.close(); - } - - /** - * Demonstrates an {@link EventHubClientBuilder} using retry, timeout and a different scheduler. - */ - public void instantiationRetry() { - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.retry-timeout-scheduler + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; - RetryOptions retryOptions = new RetryOptions() - .tryTimeout(Duration.ofSeconds(30)); EventHubAsyncClient client = new EventHubClientBuilder() .connectionString(connectionString) - .retry(retryOptions) - .scheduler(Schedulers.newElastic("dedicated-event-hub-scheduler")) .buildAsyncClient(); - // END: com.azure.messaging.eventhubs.eventhubasyncclient.retry-timeout-scheduler + // END: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string client.close(); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java index 1c00ee7e23e5..f176ebb2825e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java @@ -22,7 +22,8 @@ public class EventHubAsyncProducerJavaDocCodeSamples { private final EventHubAsyncClient client = new EventHubClientBuilder().connectionString("fake-string").buildAsyncClient(); /** - * Code snippet demonstrating how to create an EventHubProducer that automatically routes events to any partition. + * Code snippet demonstrating how to create an {@link EventHubAsyncProducer} that automatically routes events to any + * partition. * * @throws IOException if the producer cannot be disposed. */ @@ -39,7 +40,8 @@ public void instantiate() throws IOException { } /** - * Code snippet demonstrating how to create an EventHubProducer that routes events to a single partition. + * Code snippet demonstrating how to create an {@link EventHubAsyncProducer} that routes events to a single + * partition. * * @throws IOException if the producer cannot be disposed. */ diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientJavaDocCodeSamples.java new file mode 100644 index 000000000000..c4f947fd78c4 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientJavaDocCodeSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +/** + * Contains code snippets when generating javadocs through doclets for {@link EventHubClient}. + */ +public class EventHubClientJavaDocCodeSamples { + /** + * Creating an {@link EventHubClient} using a connection string specific to an Event Hub instance with different + * retry options. + */ + public void instantiation() { + // BEGIN: com.azure.messaging.eventhubs.eventhubclient.instantiation + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + EventHubClient client = new EventHubClientBuilder() + .connectionString(connectionString) + .buildClient(); + // END: com.azure.messaging.eventhubs.eventhubclient.instantiation + + client.close(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java new file mode 100644 index 000000000000..a525234d4bad --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.amqp.RetryOptions; +import com.azure.messaging.eventhubs.models.BatchOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.SendOptions; + +import java.io.IOException; +import java.time.Duration; +import java.util.Arrays; +import java.util.List; + +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Contains code snippets when generating javadocs through doclets for {@link EventHubProducer}. + */ +public class EventHubProducerJavaDocCodeSamples { + private final EventHubClient client = new EventHubClientBuilder() + .connectionString("fake-string") + .buildClient(); + + /** + * Code snippet demonstrating how to create an {@link EventHubProducer} that automatically routes events to any + * partition. + * + * @throws IOException if the producer cannot be disposed. + */ + public void instantiate() throws IOException { + // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.instantiation + EventHubClient client = new EventHubClientBuilder() + .connectionString("event-hubs-namespace-connection-string", "event-hub-name") + .buildClient(); + + EventHubProducer producer = client.createProducer(); + // END: com.azure.messaging.eventhubs.eventhubproducer.instantiation + + producer.close(); + } + + /** + * Code snippet demonstrating how to create an {@link EventHubProducer} that routes events to a single partition. + * + * @throws IOException if the producer cannot be disposed. + */ + public void instantiatePartitionProducer() throws IOException { + // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.instantiation#partitionId + RetryOptions retryOptions = new RetryOptions() + .tryTimeout(Duration.ofSeconds(45)); + EventHubProducerOptions options = new EventHubProducerOptions() + .partitionId("foo") + .retry(retryOptions); + + EventHubProducer producer = client.createProducer(options); + // END: com.azure.messaging.eventhubs.eventhubproducer.instantiation#partitionId + + producer.close(); + } + + /** + * Code snippet demonstrating how to send events with a partition key. + */ + public void sendEventsSendOptions() { + // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.send#publisher-sendOptions + final List events = Arrays.asList( + new EventData("sourdough".getBytes(UTF_8)), + new EventData("rye".getBytes(UTF_8)), + new EventData("wheat".getBytes(UTF_8)) + ); + + final EventHubProducer producer = client.createProducer(); + final SendOptions options = new SendOptions() + .partitionKey("bread"); + + producer.send(events, options); + // END: com.azure.messaging.eventhubs.eventhubproducer.send#publisher-sendOptions + } + + /** + * Code snippet demonstrating how to create an {@link EventDataBatch} and send it. + */ + public void sendEventDataBatch() { + final EventHubProducer producer = client.createProducer(); + + // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.send#eventDataBatch + final List telemetryEvents = Arrays.asList( + new EventData("92".getBytes(UTF_8)).addProperty("telemetry", "latency"), + new EventData("98".getBytes(UTF_8)).addProperty("telemetry", "cpu-temperature"), + new EventData("120".getBytes(UTF_8)).addProperty("telemetry", "fps") + ); + + final BatchOptions options = new BatchOptions() + .partitionKey("telemetry") + .maximumSizeInBytes(256); + + EventDataBatch currentBatch = producer.createBatch(options); + + // For each telemetry event, we try to add it to the current batch. + // When the batch is full, send it then create another batch to add more events to. + for (EventData event : telemetryEvents) { + if (!currentBatch.tryAdd(event)) { + producer.send(currentBatch); + currentBatch = producer.createBatch(options); + } + } + // END: com.azure.messaging.eventhubs.eventhubproducer.send#eventDataBatch + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/LogPartitionProcessor.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/LogPartitionProcessor.java index e5747d55d577..9f3062bebf00 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/LogPartitionProcessor.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/LogPartitionProcessor.java @@ -9,8 +9,8 @@ import reactor.core.publisher.Mono; /** - * A sample implementation of {@link PartitionProcessor}. This implementation logs the APIs that were called by {@link - * EventProcessor} while processing a partition. + * A sample implementation of {@link PartitionProcessor}. This implementation logs the APIs that are called by + * {@link EventProcessor} while processing a partition. */ public class LogPartitionProcessor implements PartitionProcessor { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java new file mode 100644 index 000000000000..c6f2c028eeea --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.amqp.TransportType; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.implementation.ApiTestBase; +import com.azure.messaging.eventhubs.implementation.ConnectionOptions; +import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import reactor.core.Disposable; +import reactor.core.Disposables; +import reactor.core.publisher.Flux; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +import static com.azure.messaging.eventhubs.EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME; +import static com.azure.messaging.eventhubs.TestUtils.isMatchingEvent; +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Tests scenarios on {@link EventHubAsyncClient}. + */ +@RunWith(Parameterized.class) +public class EventHubAsyncClientIntegrationTest extends ApiTestBase { + private static final int NUMBER_OF_EVENTS = 5; + + @Parameterized.Parameters(name = "{index}: transportType={0}") + public static Iterable getTransportTypes() { + return Arrays.asList(TransportType.AMQP, TransportType.AMQP_WEB_SOCKETS); + } + + private static final String PARTITION_ID = "1"; + private static final AtomicBoolean HAS_PUSHED_EVENTS = new AtomicBoolean(); + private static final AtomicReference MESSAGES_PUSHED_INSTANT = new AtomicReference<>(); + private static final String MESSAGE_TRACKING_VALUE = UUID.randomUUID().toString(); + + private EventHubAsyncClient client; + + @Rule + public TestName testName = new TestName(); + + public EventHubAsyncClientIntegrationTest(TransportType transportType) { + super(new ClientLogger(EventHubAsyncClientIntegrationTest.class)); + + setTransportType(transportType); + } + + @Override + protected String testName() { + return testName.getMethodName(); + } + + @Override + protected void beforeTest() { + skipIfNotRecordMode(); + + final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); + final ConnectionOptions connectionOptions = getConnectionOptions(); + + client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); + + setupEventTestData(client); + } + + @Override + protected void afterTest() { + dispose(client); + } + + @Test(expected = NullPointerException.class) + public void nullConstructor() throws NullPointerException { + new EventHubAsyncClient(null, null, null); + } + + /** + * Verifies that we can receive messages, and that the receiver continues to fetch messages when the prefetch queue + * is exhausted. + */ + @Test + public void receiveMessage() { + // Arrange + final EventHubConsumerOptions options = new EventHubConsumerOptions() + .prefetchCount(2); + final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, + EventPosition.fromEnqueuedTime(MESSAGES_PUSHED_INSTANT.get()), options); + + // Act & Assert + StepVerifier.create(consumer.receive().filter(x -> isMatchingEvent(x, MESSAGE_TRACKING_VALUE)).take(NUMBER_OF_EVENTS)) + .expectNextCount(NUMBER_OF_EVENTS) + .verifyComplete(); + } + + /** + * Verifies that we can have multiple consumers listening to the same partition + consumer group at the same time. + */ + @Ignore("Investigate. Only 2 of the 4 consumers get the events. The other two consumers do not.") + @Test + public void parallelEventHubClients() throws InterruptedException { + skipIfNotRecordMode(); + + // Arrange + final int numberOfClients = 4; + final int numberOfEvents = 10; + final String messageTrackingId = "message-tracking-id"; + final String messageTrackingValue = UUID.randomUUID().toString(); + final Flux events = Flux.range(0, numberOfEvents).map(number -> { + final EventData eventData = new EventData("testString".getBytes(UTF_8)); + eventData.addProperty(messageTrackingId, messageTrackingValue); + return eventData; + }); + + final CountDownLatch countDownLatch = new CountDownLatch(numberOfClients); + final EventHubAsyncClient[] clients = new EventHubAsyncClient[numberOfClients]; + for (int i = 0; i < numberOfClients; i++) { + clients[i] = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), new ReactorHandlerProvider(getReactorProvider())); + } + + final EventHubAsyncProducer producer = clients[0].createProducer(new EventHubProducerOptions().partitionId(PARTITION_ID)); + final List consumers = new ArrayList<>(); + final Disposable.Composite subscriptions = Disposables.composite(); + + try { + for (final EventHubAsyncClient hubClient : clients) { + final EventHubAsyncConsumer consumer = hubClient.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.latest()); + consumers.add(consumer); + + final Disposable subscription = consumer.receive().filter(event -> { + return event.properties() != null + && event.properties().containsKey(messageTrackingId) + && messageTrackingValue.equals(event.properties().get(messageTrackingId)); + }).take(numberOfEvents).subscribe(event -> { + logger.info("Event[{}] matched.", event.sequenceNumber()); + }, error -> Assert.fail("An error should not have occurred:" + error.toString()), () -> { + long count = countDownLatch.getCount(); + logger.info("Finished consuming events. Counting down: {}", count); + countDownLatch.countDown(); + }); + + subscriptions.add(subscription); + } + + // Act + producer.send(events).block(TIMEOUT); + + // Assert + // Wait for all the events we sent to be received by each of the consumers. + countDownLatch.await(TIMEOUT.getSeconds(), TimeUnit.SECONDS); + Assert.assertEquals(0, countDownLatch.getCount()); + + logger.info("Completed successfully."); + } finally { + logger.info("Disposing of subscriptions, consumers and clients."); + subscriptions.dispose(); + + dispose(producer); + dispose(consumers.toArray(new EventHubAsyncConsumer[0])); + dispose(clients); + } + } + + /** + * When we run this test, we check if there have been events already pushed to the partition, if not, we push some + * events there. + */ + private void setupEventTestData(EventHubAsyncClient client) { + if (HAS_PUSHED_EVENTS.getAndSet(true)) { + logger.info("Already pushed events to partition. Skipping."); + return; + } + + logger.info("Pushing events to partition. Message tracking value: {}", MESSAGE_TRACKING_VALUE); + + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID); + final EventHubAsyncProducer producer = client.createProducer(producerOptions); + final Flux events = TestUtils.getEvents(NUMBER_OF_EVENTS, MESSAGE_TRACKING_VALUE); + + try { + MESSAGES_PUSHED_INSTANT.set(Instant.now()); + producer.send(events).block(TIMEOUT); + } finally { + dispose(producer); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java index 11b676fdffa5..1741a14c08c7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java @@ -3,15 +3,10 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.TransportType; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.ApiTestBase; -import com.azure.messaging.eventhubs.implementation.ConnectionOptions; -import com.azure.messaging.eventhubs.implementation.ConnectionStringProperties; -import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; import com.azure.messaging.eventhubs.models.BatchOptions; import com.azure.messaging.eventhubs.models.EventHubProducerOptions; -import com.azure.messaging.eventhubs.models.ProxyConfiguration; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; @@ -45,13 +40,13 @@ protected String testName() { @Override protected void beforeTest() { - final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); - final ConnectionStringProperties properties = new ConnectionStringProperties(getConnectionString()); - final ConnectionOptions connectionOptions = new ConnectionOptions(properties.endpoint().getHost(), - properties.eventHubName(), getTokenCredential(), getAuthorizationType(), TransportType.AMQP, RETRY_OPTIONS, - ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.parallel()); + skipIfNotRecordMode(); - client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); + client = new EventHubClientBuilder() + .connectionString(getConnectionString()) + .retry(RETRY_OPTIONS) + .scheduler(Schedulers.parallel()) + .buildAsyncClient(); } @Override @@ -64,8 +59,6 @@ protected void afterTest() { */ @Test public void sendMessageToPartition() throws IOException { - skipIfNotRecordMode(); - // Arrange final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID); final List events = Arrays.asList( @@ -86,8 +79,6 @@ public void sendMessageToPartition() throws IOException { */ @Test public void sendMessage() throws IOException { - skipIfNotRecordMode(); - // Arrange final List events = Arrays.asList( new EventData("Event 1".getBytes(UTF_8)), @@ -106,8 +97,6 @@ public void sendMessage() throws IOException { */ @Test public void sendBatch() throws IOException { - skipIfNotRecordMode(); - // Arrange final List events = Arrays.asList( new EventData("Event 1".getBytes(UTF_8)), @@ -134,8 +123,6 @@ public void sendBatch() throws IOException { */ @Test public void sendBatchWithPartitionKey() throws IOException { - skipIfNotRecordMode(); - // Arrange final List events = Arrays.asList( new EventData("Event 1".getBytes(UTF_8)), diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java index eaf3bc89e17a..76892d08ac55 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java @@ -68,7 +68,7 @@ public void teardown() { public void sendMultipleMessages() { // Arrange final int count = 4; - final byte[] contents = CONTENTS.getBytes(UTF_8); + final byte[] contents = TEST_CONTENTS.getBytes(UTF_8); final Flux testData = Flux.range(0, count).flatMap(number -> { final EventData data = new EventData(contents); return Flux.just(data); @@ -100,7 +100,7 @@ public void sendMultipleMessages() { @Test public void sendSingleMessage() { // Arrange - final EventData testData = new EventData(CONTENTS.getBytes(UTF_8)); + final EventData testData = new EventData(TEST_CONTENTS.getBytes(UTF_8)); when(sendLink.send(any(Message.class))).thenReturn(Mono.empty()); @@ -128,8 +128,8 @@ public void sendSingleMessage() { public void partitionProducerCannotSendWithPartitionKey() { // Arrange final Flux testData = Flux.just( - new EventData(CONTENTS.getBytes(UTF_8)), - new EventData(CONTENTS.getBytes(UTF_8))); + new EventData(TEST_CONTENTS.getBytes(UTF_8)), + new EventData(TEST_CONTENTS.getBytes(UTF_8))); when(sendLink.send(anyList())).thenReturn(Mono.empty()); @@ -163,7 +163,7 @@ public void sendTooManyMessages() { // We believe 20 events is enough for that EventDataBatch to be greater than max size. final Flux testData = Flux.range(0, 20).flatMap(number -> { - final EventData data = new EventData(CONTENTS.getBytes(UTF_8)); + final EventData data = new EventData(TEST_CONTENTS.getBytes(UTF_8)); return Flux.just(data); }); @@ -378,7 +378,7 @@ public void sendsAnEventDataBatch() { verify(link, times(2)).getLinkSize(); } - private static final String CONTENTS = "SSLorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vehicula posuere lobortis. Aliquam finibus volutpat dolor, faucibus pellentesque ipsum bibendum vitae. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut sit amet urna hendrerit, dapibus justo a, sodales justo. Mauris finibus augue id pulvinar congue. Nam maximus luctus ipsum, at commodo ligula euismod ac. Phasellus vitae lacus sit amet diam porta placerat. \n" + static final String TEST_CONTENTS = "SSLorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vehicula posuere lobortis. Aliquam finibus volutpat dolor, faucibus pellentesque ipsum bibendum vitae. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut sit amet urna hendrerit, dapibus justo a, sodales justo. Mauris finibus augue id pulvinar congue. Nam maximus luctus ipsum, at commodo ligula euismod ac. Phasellus vitae lacus sit amet diam porta placerat. \n" + "Ut sodales efficitur sapien ut posuere. Morbi sed tellus est. Proin eu erat purus. Proin massa nunc, condimentum id iaculis dignissim, consectetur et odio. Cras suscipit sem eu libero aliquam tincidunt. Nullam ut arcu suscipit, eleifend velit in, cursus libero. Ut eleifend facilisis odio sit amet feugiat. Phasellus at nunc sit amet elit sagittis commodo ac in nisi. Fusce vitae aliquam quam. Integer vel nibh euismod, tempus elit vitae, pharetra est. Duis vulputate enim a elementum dignissim. Morbi dictum enim id elit scelerisque, in elementum nulla pharetra. \n" + "Aenean aliquet aliquet condimentum. Proin dapibus dui id libero tempus feugiat. Sed commodo ligula a lectus mattis, vitae tincidunt velit auctor. Fusce quis semper dui. Phasellus eu efficitur sem. Ut non sem sit amet enim condimentum venenatis id dictum massa. Nullam sagittis lacus a neque sodales, et ultrices arcu mattis. Aliquam erat volutpat. \n" + "Aenean fringilla quam elit, id mattis purus vestibulum nec. Praesent porta eros in dapibus molestie. Vestibulum orci libero, tincidunt et turpis eget, condimentum lobortis enim. Fusce suscipit ante et mauris consequat cursus nec laoreet lorem. Maecenas in sollicitudin diam, non tincidunt purus. Nunc mauris purus, laoreet eget interdum vitae, placerat a sapien. In mi risus, blandit eu facilisis nec, molestie suscipit leo. Pellentesque molestie urna vitae dui faucibus bibendum. \n" diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java index 83eb91c70326..31fbc407153a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java @@ -3,66 +3,27 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.TransportType; +import com.azure.core.util.IterableStream; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.ApiTestBase; -import com.azure.messaging.eventhubs.implementation.ConnectionOptions; -import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; -import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; -import com.azure.messaging.eventhubs.models.EventHubProducerOptions; -import com.azure.messaging.eventhubs.models.EventPosition; +import com.azure.messaging.eventhubs.implementation.ConnectionStringProperties; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import reactor.core.Disposable; -import reactor.core.Disposables; -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; - -import static com.azure.messaging.eventhubs.EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME; -import static com.azure.messaging.eventhubs.TestUtils.isMatchingEvent; -import static java.nio.charset.StandardCharsets.UTF_8; - -/** - * Tests scenarios on {@link EventHubAsyncClient}. - */ -@RunWith(Parameterized.class) -public class EventHubClientIntegrationTest extends ApiTestBase { - private static final int NUMBER_OF_EVENTS = 5; - - @Parameterized.Parameters(name = "{index}: transportType={0}") - public static Iterable getTransportTypes() { - return Arrays.asList(TransportType.AMQP, TransportType.AMQP_WEB_SOCKETS); - } +import java.util.stream.Collectors; - private static final String PARTITION_ID = "1"; - private static final AtomicBoolean HAS_PUSHED_EVENTS = new AtomicBoolean(); - private static final AtomicReference MESSAGES_PUSHED_INSTANT = new AtomicReference<>(); - private static final String MESSAGE_TRACKING_VALUE = UUID.randomUUID().toString(); - - private EventHubAsyncClient client; +public class EventHubClientIntegrationTest extends ApiTestBase { + private EventHubClient client; @Rule public TestName testName = new TestName(); - public EventHubClientIntegrationTest(TransportType transportType) { + public EventHubClientIntegrationTest() { super(new ClientLogger(EventHubClientIntegrationTest.class)); - - setTransportType(transportType); } @Override @@ -74,12 +35,10 @@ protected String testName() { protected void beforeTest() { skipIfNotRecordMode(); - final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); - final ConnectionOptions connectionOptions = getConnectionOptions(); - - client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); - - setupEventTestData(client); + client = new EventHubClientBuilder() + .connectionString(getConnectionString()) + .retry(RETRY_OPTIONS) + .buildClient(); } @Override @@ -87,118 +46,58 @@ protected void afterTest() { dispose(client); } - @Test(expected = NullPointerException.class) - public void nullConstructor() throws NullPointerException { - new EventHubAsyncClient(null, null, null); - } - /** - * Verifies that we can receive messages, and that the receiver continues to fetch messages when the prefetch queue - * is exhausted. + * Verifies we can get partition ids of an Event Hub. */ @Test - public void receiveMessage() { - // Arrange - final EventHubConsumerOptions options = new EventHubConsumerOptions() - .prefetchCount(2); - final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, - EventPosition.fromEnqueuedTime(MESSAGES_PUSHED_INSTANT.get()), options); - - // Act & Assert - StepVerifier.create(consumer.receive().filter(x -> isMatchingEvent(x, MESSAGE_TRACKING_VALUE)).take(NUMBER_OF_EVENTS)) - .expectNextCount(NUMBER_OF_EVENTS) - .verifyComplete(); + public void getPartitionIds() { + // Act + final IterableStream response = client.getPartitionIds(); + + // Assert + Assert.assertNotNull(response); + + final List partitionIds = response.stream().collect(Collectors.toList()); + Assert.assertTrue(partitionIds.size() > 1); } /** - * Verifies that we can have multiple consumers listening to the same partition + consumer group at the same time. + * Verifies we can get partition ids of an Event Hub. */ - @Ignore("Investigate. Only 2 of the 4 consumers get the events. The other two consumers do not.") @Test - public void parallelEventHubClients() throws InterruptedException { - skipIfNotRecordMode(); - + public void getMetadata() { // Arrange - final int numberOfClients = 4; - final int numberOfEvents = 10; - final String messageTrackingId = "message-tracking-id"; - final String messageTrackingValue = UUID.randomUUID().toString(); - final Flux events = Flux.range(0, numberOfEvents).map(number -> { - final EventData eventData = new EventData("testString".getBytes(UTF_8)); - eventData.addProperty(messageTrackingId, messageTrackingValue); - return eventData; - }); - - final CountDownLatch countDownLatch = new CountDownLatch(numberOfClients); - final EventHubAsyncClient[] clients = new EventHubAsyncClient[numberOfClients]; - for (int i = 0; i < numberOfClients; i++) { - clients[i] = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), new ReactorHandlerProvider(getReactorProvider())); - } - - final EventHubAsyncProducer producer = clients[0].createProducer(new EventHubProducerOptions().partitionId(PARTITION_ID)); - final List consumers = new ArrayList<>(); - final Disposable.Composite subscriptions = Disposables.composite(); - - try { - for (final EventHubAsyncClient hubClient : clients) { - final EventHubAsyncConsumer consumer = hubClient.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.latest()); - consumers.add(consumer); - - final Disposable subscription = consumer.receive().filter(event -> { - return event.properties() != null - && event.properties().containsKey(messageTrackingId) - && messageTrackingValue.equals(event.properties().get(messageTrackingId)); - }).take(numberOfEvents).subscribe(event -> { - logger.info("Event[{}] matched.", event.sequenceNumber()); - }, error -> Assert.fail("An error should not have occurred:" + error.toString()), () -> { - long count = countDownLatch.getCount(); - logger.info("Finished consuming events. Counting down: {}", count); - countDownLatch.countDown(); - }); - - subscriptions.add(subscription); - } - - // Act - producer.send(events).block(TIMEOUT); - - // Assert - // Wait for all the events we sent to be received by each of the consumers. - countDownLatch.await(TIMEOUT.getSeconds(), TimeUnit.SECONDS); - Assert.assertEquals(0, countDownLatch.getCount()); - - logger.info("Completed successfully."); - } finally { - logger.info("Disposing of subscriptions, consumers and clients."); - subscriptions.dispose(); - - dispose(producer); - dispose(consumers.toArray(new EventHubAsyncConsumer[0])); - dispose(clients); - } + final ConnectionStringProperties connectionProperties = getConnectionStringProperties(); + + // Act + final EventHubProperties properties = client.getProperties(); + + // Assert + Assert.assertNotNull(properties); + Assert.assertEquals(connectionProperties.eventHubName(), properties.name()); + Assert.assertTrue(properties.createdAt().isBefore(Instant.now())); + + Assert.assertNotNull(properties.partitionIds()); + Assert.assertTrue(properties.partitionIds().length > 1); } /** - * When we run this test, we check if there have been events already pushed to the partition, if not, we push some - * events there. + * Verifies we can get partition ids of an Event Hub. */ - private void setupEventTestData(EventHubAsyncClient client) { - if (HAS_PUSHED_EVENTS.getAndSet(true)) { - logger.info("Already pushed events to partition. Skipping."); - return; - } - - logger.info("Pushing events to partition. Message tracking value: {}", MESSAGE_TRACKING_VALUE); - - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID); - final EventHubAsyncProducer producer = client.createProducer(producerOptions); - final Flux events = TestUtils.getEvents(NUMBER_OF_EVENTS, MESSAGE_TRACKING_VALUE); - - try { - MESSAGES_PUSHED_INSTANT.set(Instant.now()); - producer.send(events).block(TIMEOUT); - } finally { - dispose(producer); - } + @Test + public void getPartitionProperties() { + // Arrange + final ConnectionStringProperties connectionProperties = getConnectionStringProperties(); + final EventHubProperties properties = client.getProperties(); + final String partitionId = properties.partitionIds()[0]; + + // Act + final PartitionProperties partitionProperties = client.getPartitionProperties(partitionId); + + // Assert + Assert.assertNotNull(partitionProperties); + + Assert.assertEquals(connectionProperties.eventHubName(), partitionProperties.eventHubName()); + Assert.assertEquals(partitionId, partitionProperties.id()); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java new file mode 100644 index 000000000000..524d7981611e --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.implementation.ApiTestBase; +import com.azure.messaging.eventhubs.models.BatchOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import reactor.core.scheduler.Schedulers; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +import static java.nio.charset.StandardCharsets.UTF_8; + +public class EventHubProducerIntegrationTest extends ApiTestBase { + private static final String PARTITION_ID = "1"; + private EventHubClient client; + + public EventHubProducerIntegrationTest() { + super(new ClientLogger(EventHubProducerIntegrationTest.class)); + } + + @Rule + public TestName testName = new TestName(); + + @Override + protected String testName() { + return testName.getMethodName(); + } + + @Override + protected void beforeTest() { + skipIfNotRecordMode(); + + client = new EventHubClientBuilder() + .connectionString(getConnectionString()) + .retry(RETRY_OPTIONS) + .scheduler(Schedulers.parallel()) + .buildClient(); + } + + @Override + protected void afterTest() { + dispose(client); + } + + /** + * Verifies that we can create and send a message to an Event Hub partition. + */ + @Test + public void sendMessageToPartition() throws IOException { + // Arrange + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID); + final List events = Arrays.asList( + new EventData("Event 1".getBytes(UTF_8)), + new EventData("Event 2".getBytes(UTF_8)), + new EventData("Event 3".getBytes(UTF_8))); + + // Act & Assert + try (EventHubProducer producer = client.createProducer(producerOptions)) { + producer.send(events); + } + } + + /** + * Verifies that we can create an {@link EventHubProducer} that does not care about partitions and lets the service + * distribute the events. + */ + @Test + public void sendMessage() throws IOException { + // Arrange + final List events = Arrays.asList( + new EventData("Event 1".getBytes(UTF_8)), + new EventData("Event 2".getBytes(UTF_8)), + new EventData("Event 3".getBytes(UTF_8))); + + // Act & Assert + try (EventHubProducer producer = client.createProducer()) { + producer.send(events); + } + } + + /** + * Verifies we can create an {@link EventDataBatch} and send it using our EventHubProducer. + */ + @Test + public void sendBatch() throws IOException { + // Arrange + final List events = Arrays.asList( + new EventData("Event 1".getBytes(UTF_8)), + new EventData("Event 2".getBytes(UTF_8)), + new EventData("Event 3".getBytes(UTF_8))); + + // Act & Assert + try (EventHubProducer producer = client.createProducer()) { + EventDataBatch batch = producer.createBatch(); + events.forEach(event -> { + Assert.assertTrue(batch.tryAdd(event)); + }); + + producer.send(batch); + } + } + + /** + * Verifies we can create an {@link EventDataBatch} with a partition key and send it using our EventHubProducer. + */ + @Test + public void sendBatchWithPartitionKey() throws IOException { + // Arrange + final List events = Arrays.asList( + new EventData("Event 1".getBytes(UTF_8)), + new EventData("Event 2".getBytes(UTF_8)), + new EventData("Event 3".getBytes(UTF_8))); + + // Act & Assert + try (EventHubProducer producer = client.createProducer()) { + final BatchOptions options = new BatchOptions().partitionKey("my-partition-key"); + final EventDataBatch batch = producer.createBatch(options); + + events.forEach(event -> { + Assert.assertTrue(batch.tryAdd(event)); + }); + + producer.send(batch); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java new file mode 100644 index 000000000000..db2fae439f3b --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.amqp.RetryOptions; +import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.amqp.exception.ErrorCondition; +import com.azure.core.amqp.exception.ErrorContext; +import com.azure.messaging.eventhubs.implementation.AmqpSendLink; +import com.azure.messaging.eventhubs.models.BatchOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.SendOptions; +import org.apache.qpid.proton.amqp.messaging.Section; +import org.apache.qpid.proton.message.Message; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Duration; +import java.util.List; + +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +/** + * Unit tests to verify functionality of {@link EventHubProducer}. + */ +public class EventHubProducerTest { + @Mock + private AmqpSendLink sendLink; + @Captor + private ArgumentCaptor singleMessageCaptor; + @Captor + private ArgumentCaptor> messagesCaptor; + + private EventHubAsyncProducer asyncProducer; + private RetryOptions retryOptions = new RetryOptions().tryTimeout(Duration.ofSeconds(30)); + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + when(sendLink.getLinkSize()).thenReturn(Mono.just(EventHubAsyncProducer.MAX_MESSAGE_LENGTH_BYTES)); + when(sendLink.getErrorContext()).thenReturn(new ErrorContext("test-namespace")); + when(sendLink.send(anyList())).thenReturn(Mono.empty()); + when(sendLink.send(any(Message.class))).thenReturn(Mono.empty()); + + asyncProducer = new EventHubAsyncProducer( + Mono.fromCallable(() -> sendLink), + new EventHubProducerOptions().retry(retryOptions)); + } + + @After + public void teardown() { + Mockito.framework().clearInlineMocks(); + sendLink = null; + singleMessageCaptor = null; + messagesCaptor = null; + } + + /** + * Verifies can send a single message. + */ + @Test + public void sendSingleMessage() { + // Arrange + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout()); + final EventData eventData = new EventData("hello-world".getBytes(UTF_8)); + + // Act + producer.send(eventData); + + // Assert + verify(sendLink, times(1)).send(any(Message.class)); + verify(sendLink).send(singleMessageCaptor.capture()); + + final Message message = singleMessageCaptor.getValue(); + Assert.assertEquals(Section.SectionType.Data, message.getBody().getType()); + } + + /** + * Verifies we can send multiple messages. + */ + @Test + public void sendMultipleMessages() { + // Arrange + final int count = 4; + final Iterable events = Flux.range(0, count).map(number -> { + final String contents = "event-data-" + number; + return new EventData(contents.getBytes(UTF_8)); + }).toIterable(); + + final SendOptions options = new SendOptions(); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout()); + + // Act + producer.send(events, options); + + // Assert + verify(sendLink).send(messagesCaptor.capture()); + + final List messagesSent = messagesCaptor.getValue(); + Assert.assertEquals(count, messagesSent.size()); + + messagesSent.forEach(message -> Assert.assertEquals(Section.SectionType.Data, message.getBody().getType())); + } + + /** + * Verifies that the producer can create an {@link EventDataBatch} with the size given by the underlying AMQP send + * link. + */ + @Test + public void createsEventDataBatch() { + // Arrange + int maxLinkSize = 1024; + + // Overhead when serializing an event, to figure out what the maximum size we can use for an event payload. + int eventOverhead = 24; + int maxEventPayload = maxLinkSize - eventOverhead; + + final AmqpSendLink link = mock(AmqpSendLink.class); + when(link.getLinkSize()).thenReturn(Mono.just(maxLinkSize)); + + // This event is 1024 bytes when serialized. + final EventData event = new EventData(new byte[maxEventPayload]); + + // This event will be 1025 bytes when serialized. + final EventData tooLargeEvent = new EventData(new byte[maxEventPayload + 1]); + + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(retryOptions); + final EventHubAsyncProducer hubAsyncProducer = new EventHubAsyncProducer(Mono.fromCallable(() -> link), producerOptions); + final EventHubProducer hubProducer = new EventHubProducer(hubAsyncProducer, retryOptions.tryTimeout()); + + // Act + final EventDataBatch batch = hubProducer.createBatch(); + + // Assert + Assert.assertNull(batch.getPartitionKey()); + Assert.assertFalse(batch.tryAdd(tooLargeEvent)); + Assert.assertTrue(batch.tryAdd(event)); + + verify(link, times(1)).getLinkSize(); + } + + /** + * Verifies we can create an EventDataBatch with partition key and link size. + */ + @Test + public void createsEventDataBatchWithPartitionKey() { + // Arrange + int maxBatchSize = 1024; + + // Overhead when serializing an event, to figure out what the maximum size we can use for an event payload. + int eventOverhead = 98; + int maxEventPayload = maxBatchSize - eventOverhead; + + // This event is 1024 bytes when serialized. + final EventData event = new EventData(new byte[maxEventPayload]); + + // No idea what the overhead for adding partition key is. But we know this will be smaller than the max size. + final BatchOptions options = new BatchOptions() + .partitionKey("some-key") + .maximumSizeInBytes(maxBatchSize); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout()); + + // Act + final EventDataBatch batch = producer.createBatch(options); + + // Arrange + Assert.assertEquals(options.partitionKey(), batch.getPartitionKey()); + Assert.assertTrue(batch.tryAdd(event)); + } + + /** + * Verifies we can create an EventDataBatch with partition key and link size. + */ + @Test + public void payloadTooLarge() { + // Arrange + int maxBatchSize = 1024; + + // Overhead when serializing an event, to figure out what the maximum size we can use for an event payload. + int eventOverhead = 24; + int maxEventPayload = maxBatchSize - eventOverhead; + + // This event is 1025 bytes when serialized. + final EventData event = new EventData(new byte[maxEventPayload + 1]); + + // No idea what the overhead for adding partition key is. But we know this will be smaller than the max size. + final BatchOptions options = new BatchOptions() + .maximumSizeInBytes(maxBatchSize); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.tryTimeout()); + final EventDataBatch batch = producer.createBatch(options); + + // Act & Assert + try { + batch.tryAdd(event); + } catch (AmqpException e) { + Assert.assertEquals(ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED, e.getErrorCondition()); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java index 095b3a4cb034..1c44f320c239 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java @@ -29,16 +29,26 @@ public void constructorNullDuration() throws InvalidKeyException, NoSuchAlgorith new EventHubSharedAccessKeyCredential(KEY_NAME, KEY_VALUE, null); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = NullPointerException.class) public void constructorNullKey() throws InvalidKeyException, NoSuchAlgorithmException { new EventHubSharedAccessKeyCredential(null, KEY_VALUE, TOKEN_DURATION); } @Test(expected = IllegalArgumentException.class) + public void constructorEmptyKey() throws InvalidKeyException, NoSuchAlgorithmException { + new EventHubSharedAccessKeyCredential("", KEY_VALUE, TOKEN_DURATION); + } + + @Test(expected = NullPointerException.class) public void constructorNullValue() throws InvalidKeyException, NoSuchAlgorithmException { new EventHubSharedAccessKeyCredential(KEY_NAME, null, TOKEN_DURATION); } + @Test(expected = IllegalArgumentException.class) + public void constructorEmptyValue() throws InvalidKeyException, NoSuchAlgorithmException { + new EventHubSharedAccessKeyCredential(KEY_NAME, "", TOKEN_DURATION); + } + @Test public void constructsToken() throws InvalidKeyException, NoSuchAlgorithmException, UnsupportedEncodingException { // Arrange @@ -76,7 +86,7 @@ public void constructsToken() throws InvalidKeyException, NoSuchAlgorithmExcepti // These are the values that are random, but we expect the expiration to be after this date. if (signatureExpires.equals(key)) { - final Instant instant = Instant.ofEpochSecond(Long.valueOf(value)); + final Instant instant = Instant.ofEpochSecond(Long.parseLong(value)); Assert.assertTrue(instant.isAfter(Instant.now())); } else if (expectedValue == null) { Assert.assertNotNull(value); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ConnectionStringPropertiesTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ConnectionStringPropertiesTest.java index ad08302d18f5..eb6ae91dee40 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ConnectionStringPropertiesTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ConnectionStringPropertiesTest.java @@ -5,14 +5,9 @@ import org.junit.Assert; import org.junit.Test; -import org.junit.experimental.theories.DataPoints; -import org.junit.experimental.theories.Theories; -import org.junit.experimental.theories.Theory; -import org.junit.runner.RunWith; import java.util.Locale; -@RunWith(Theories.class) public class ConnectionStringPropertiesTest { private static final String HOST = "foo.bar.windows.net"; private static final String HOSTNAME_URI = "sb://" + HOST; @@ -20,19 +15,14 @@ public class ConnectionStringPropertiesTest { private static final String SAS_KEY = "test-sas-key"; private static final String SAS_VALUE = "some-secret-value"; - @DataPoints - public static String[] getInvalidArguments() { - return new String[]{"", null}; + @Test(expected = NullPointerException.class) + public void nullConnectionString() { + new ConnectionStringProperties(null); } - @Theory - public void nullConnectionString(String argument) { - try { - new ConnectionStringProperties(argument); - Assert.fail("Expected an exception."); - } catch (IllegalArgumentException e) { - // This is what we expect. - } + @Test(expected = IllegalArgumentException.class) + public void emptyConnectionString() { + new ConnectionStringProperties(""); } @Test(expected = IllegalArgumentException.class) diff --git a/sdk/eventhubs/ci.data.yml b/sdk/eventhubs/ci.data.yml new file mode 100644 index 000000000000..efaf87c89109 --- /dev/null +++ b/sdk/eventhubs/ci.data.yml @@ -0,0 +1,49 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + +trigger: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventhubs/ + exclude: + - sdk/eventhubs/azure + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventhubs/ + exclude: + - sdk/eventhubs/azure + +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: eventhubs + Artifacts: + - name: azure-eventhubs + safeName: azureeventhubs + stagingProfileId: 534d15ee3800f4 + - name: azure-eventhubs-eph + safeName: azureeventhubseph + stagingProfileId: 534d15ee3800f4 + - name: azure-eventhubs-extensions + safeName: azureeventhubsextensions + stagingProfileId: 534d15ee3800f4 diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index 9ecb29dd5ea3..2a3a544fa8f3 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -17,6 +17,8 @@ trigger: paths: include: - sdk/eventhubs/ + exclude: + - sdk/eventhubs/microsoft-azure pr: branches: @@ -28,6 +30,8 @@ pr: paths: include: - sdk/eventhubs/ + exclude: + - sdk/eventhubs/microsoft-azure stages: - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -35,4 +39,5 @@ stages: ServiceDirectory: eventhubs Artifacts: - name: azure-messaging-eventhubs - safeName: azuremessagingeventhubs \ No newline at end of file + safeName: azuremessagingeventhubs + stagingProfileId: 88192f04117501 diff --git a/sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml b/sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml index 61dd300dd013..d289c9856ef2 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml +++ b/sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml @@ -5,10 +5,10 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - com.microsoft.azure - azure-eventhubs-clients - 3.0.0 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.1.0 + ../../../pom.data.xml 4.0.0 @@ -35,7 +35,7 @@ com.microsoft.azure azure-eventhubs - ${project.parent.version} + 3.0.0 com.microsoft.azure @@ -45,12 +45,42 @@ com.google.code.gson gson + + + junit + junit + test + + + org.slf4j + slf4j-simple + test + - com.microsoft.azure - msal4j - 0.4.0-preview - test + com.microsoft.azure + msal4j + 0.4.0-preview + test + + + com.microsoft.azure + adal4j + test + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + true + + + + diff --git a/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml b/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml index 9dcf397d18dd..c6c6e4526ba2 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml +++ b/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml @@ -5,15 +5,16 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - com.microsoft.azure - azure-eventhubs-clients - 3.0.0 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.1.0 + ../../../pom.data.xml 4.0.0 com.microsoft.azure azure-eventhubs-extensions + 3.0.0 Microsoft Azure SDK for Event Hubs Extensions Extensions built on Microsoft Azure Event Hubs @@ -34,8 +35,7 @@ com.microsoft.azure azure-eventhubs - ${project.parent.version} - compile + 3.0.0 org.apache.logging.log4j @@ -45,7 +45,43 @@ org.apache.logging.log4j log4j-core + + + junit + junit + test + + + org.slf4j + slf4j-simple + test + + + com.microsoft.azure + msal4j + 0.4.0-preview + test + + + com.microsoft.azure + adal4j + test + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + true + + + + diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml b/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml index 0be6b248879b..630338077859 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml +++ b/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml @@ -5,15 +5,16 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - com.microsoft.azure - azure-eventhubs-clients - 3.0.0 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.1.0 + ../../../pom.data.xml 4.0.0 com.microsoft.azure azure-eventhubs + 3.0.0 Microsoft Azure SDK for Event Hubs Libraries built on Microsoft Azure Event Hubs @@ -31,6 +32,20 @@ + + org.apache.qpid + proton-j + + + com.microsoft.azure + qpid-proton-j-extensions + + + org.slf4j + slf4j-api + + + com.microsoft.azure azure-client-authentication @@ -38,22 +53,46 @@ compile - com.microsoft.azure - msal4j - 0.4.0-preview - test + com.nimbusds + nimbus-jose-jwt + 6.0.1 + + + + junit + junit + test - com.microsoft.azure - adal4j - ${adal4j.version} - test + org.slf4j + slf4j-simple + test - com.nimbusds - nimbus-jose-jwt - 6.0.1 + com.microsoft.azure + msal4j + 0.4.0-preview + test + + + com.microsoft.azure + adal4j + test + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + true + + + + diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/sendrecv/AadBase.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/sendrecv/AadBase.java index 83870bcf4f11..f19d8bfaf98e 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/sendrecv/AadBase.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/sendrecv/AadBase.java @@ -67,10 +67,15 @@ protected void innerTest(final EventHubClient ehc) throws EventHubException, Int // Open a receiver final PartitionReceiver pReceiver = ehc.createReceiverSync("$Default", "0", EventPositionImpl.fromEndOfStream()); - // Open a sender and do a send. + // Do some sends via the EventHubClient + for (int i = 0; i < 50; i++) { + ehc.send(EventData.create(("blah" + i).getBytes())).get(); + } + + // Do a send via a sender final PartitionSender pSender = ehc.createPartitionSenderSync("0"); - final String testMessage = "somedata test"; - pSender.send(EventData.create(testMessage.getBytes())); + final String finalMessage = "final message"; + pSender.send(EventData.create(finalMessage.getBytes())); // Do some receives. int scanned = 0; @@ -80,7 +85,7 @@ protected void innerTest(final EventHubClient ehc) throws EventHubException, Int final Iterable events = pReceiver.receiveSync(100); for (EventData ed : events) { scanned++; - if ((new String(ed.getBytes())).equals(testMessage)) { + if ((new String(ed.getBytes())).equals(finalMessage)) { found = true; break; } diff --git a/sdk/eventhubs/pom.data.xml b/sdk/eventhubs/pom.data.xml deleted file mode 100644 index 29dd16eab970..000000000000 --- a/sdk/eventhubs/pom.data.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - com.azure - azure-data-sdk-parent - 1.1.0 - ../../pom.data.xml - - - 4.0.0 - com.microsoft.azure - azure-eventhubs-clients - pom - 3.0.0 - - Microsoft Azure Event Hubs SDK Parent - Java libraries for talking to Windows Azure Event Hubs - https://github.com/Azure/azure-sdk-for-java - - - - azure-java-build-docs - ${site.url}/site/${project.artifactId} - - - - - scm:git:https://github.com/Azure/azure-sdk-for-java - - - - - org.apache.qpid - proton-j - - - com.microsoft.azure - qpid-proton-j-extensions - - - org.slf4j - slf4j-api - - - - junit - junit - test - - - org.slf4j - slf4j-simple - test - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - true - true - - - - - - - microsoft-azure-eventhubs - microsoft-azure-eventhubs-eph - microsoft-azure-eventhubs-extensions - - - diff --git a/sdk/eventhubs/pom.service.xml b/sdk/eventhubs/pom.service.xml index f99125abb872..9c863056e145 100644 --- a/sdk/eventhubs/pom.service.xml +++ b/sdk/eventhubs/pom.service.xml @@ -1,20 +1,41 @@ - + 4.0.0 com.azure azure-eventhubs-service pom - 1.0.0 - - microsoft-azure-eventhubs - microsoft-azure-eventhubs-eph - microsoft-azure-eventhubs-extensions - ../core/azure-core - ../core/azure-core-test - ../core/azure-core-amqp - azure-messaging-eventhubs - + 1.0.0 + + + data + + + env.SDKTYPE + data + + + + microsoft-azure-eventhubs + microsoft-azure-eventhubs-eph + microsoft-azure-eventhubs-extensions + + + + client + + + env.SDKTYPE + !data + + + + ../core/azure-core + ../core/azure-core-test + ../core/azure-core-amqp + azure-messaging-eventhubs + + + diff --git a/sdk/identity/azure-identity/README.md b/sdk/identity/azure-identity/README.md index ee4d6ec67669..3728533b39aa 100644 --- a/sdk/identity/azure-identity/README.md +++ b/sdk/identity/azure-identity/README.md @@ -253,3 +253,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [secrets_client_library]: ../../keyvault/azure-keyvault-secrets [eventhubs_client_library]: ../../eventhubs/azure-messaging-eventhubs [azure_core_library]: ../../core + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/identity/azure-identity/README.png) diff --git a/sdk/identity/azure-identity/pom.xml b/sdk/identity/azure-identity/pom.xml index e2be2e9b861f..3c9a0e0cae5e 100644 --- a/sdk/identity/azure-identity/pom.xml +++ b/sdk/identity/azure-identity/pom.xml @@ -8,6 +8,10 @@ azure-identity 1.0.0-preview.3 + Microsoft Azure client library for Identity + This module contains client library for Microsoft Azure Identity. + https://github.com/Azure/azure-sdk-for-java + com.azure azure-client-sdk-parent @@ -15,6 +19,10 @@ ../../../pom.client.xml + + com.azure.identity + + com.azure @@ -30,6 +38,12 @@ oauth2-oidc-sdk + + + io.projectreactor.netty + reactor-netty + + junit junit diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredentialBuilderBase.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredentialBuilderBase.java index da06b7a55d55..06d14d6e8b10 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredentialBuilderBase.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredentialBuilderBase.java @@ -13,7 +13,7 @@ public abstract class AadCredentialBuilderBase} itself + * @return itself */ @SuppressWarnings("unchecked") public T authorityHost(String authorityHost) { @@ -24,7 +24,7 @@ public T authorityHost(String authorityHost) { /** * Sets the client ID of the application. * @param clientId the client ID of the application. - * @return {@link } itself + * @return itself */ @SuppressWarnings("unchecked") public T clientId(String clientId) { diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/CredentialBuilderBase.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/CredentialBuilderBase.java index 18c8f29e3773..5e1073df9d79 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/CredentialBuilderBase.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/CredentialBuilderBase.java @@ -22,7 +22,7 @@ public abstract class CredentialBuilderBase> /** * Specifies the max number of retries when an authentication request fails. * @param maxRetry the number of retries - * @return {@link } itself + * @return itself */ @SuppressWarnings("unchecked") public T maxRetry(int maxRetry) { @@ -33,7 +33,7 @@ public T maxRetry(int maxRetry) { /** * Specifies a Function to calculate seconds of timeout on every retried request. * @param retryTimeout the Function that returns a timeout in seconds given the number of retry - * @return {@link } itself + * @return itself */ @SuppressWarnings("unchecked") public T retryTimeout(Function retryTimeout) { @@ -44,7 +44,7 @@ public T retryTimeout(Function retryTimeout) { /** * Specifies he options for proxy configuration. * @param proxyOptions the options for proxy configuration - * @return {@link } itself + * @return itself */ @SuppressWarnings("unchecked") public T proxyOptions(ProxyOptions proxyOptions) { diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MSIToken.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MSIToken.java index 238b0596f389..44b9798b2a9c 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MSIToken.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MSIToken.java @@ -32,7 +32,7 @@ public final class MSIToken extends AccessToken { /** * Creates an access token instance. * - * @param token the token string. + * @param token the token string. * @param expiresOn the expiration time. */ public MSIToken(String token, OffsetDateTime expiresOn) { @@ -69,13 +69,13 @@ private static Long parseDateToEpochSeconds(String dateTime) { try { return Long.parseLong(dateTime); } catch (NumberFormatException e) { - System.err.println(e.getMessage()); + logger.error(e.getMessage()); } try { return Instant.from(dtf.parse(dateTime)).toEpochMilli() / 1000L; } catch (DateTimeParseException e) { - System.err.println(e.getMessage()); + logger.error(e.getMessage()); } throw logger.logExceptionAsError(new IllegalArgumentException("Unable to parse date time " + dateTime)); diff --git a/sdk/identity/ci.yml b/sdk/identity/ci.yml index afc37e6ac1b1..f2e9e254f211 100644 --- a/sdk/identity/ci.yml +++ b/sdk/identity/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: identity Artifacts: - name: azure-identity - safeName: azureidentity \ No newline at end of file + safeName: azureidentity + stagingProfileId: 88192f04117501 diff --git a/sdk/keyvault/azure-keyvault-keys/README.md b/sdk/keyvault/azure-keyvault-keys/README.md index 25205aa60b89..cb9e39c42900 100644 --- a/sdk/keyvault/azure-keyvault-keys/README.md +++ b/sdk/keyvault/azure-keyvault-keys/README.md @@ -446,3 +446,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope [sample_signVerifyAsync]: src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperationsAsync.java [sample_wrapUnwrap]: src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperations.java [sample_wrapUnwrapAsync]: src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperationsAsync.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/keyvault/azure-keyvault-keys/README.png) \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/pom.xml b/sdk/keyvault/azure-keyvault-keys/pom.xml index c1819383b7dc..be414428d0e6 100644 --- a/sdk/keyvault/azure-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-keyvault-keys/pom.xml @@ -15,7 +15,8 @@ azure-keyvault-keys 4.0.0-preview.3 - azure-keyvault-keys + Microsoft Azure client library for KeyVault Keys + This module contains client library for Microsoft Azure KeyVault Keys. https://github.com/Azure/azure-sdk-for-java @@ -31,6 +32,10 @@ HEAD + + com.azure.security.keyvault.keys + + @@ -62,6 +67,12 @@ 1.0.0-preview.4 test + + com.azure + azure-core-http-netty + 1.0.0-preview.4 + test + com.azure diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java index 3144c1feeb0d..c91ef62407f4 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java @@ -503,7 +503,6 @@ public Response deleteKeyWithResponse(String name, Context context) * returned in the response.

* //Assuming key is deleted on a soft-delete enabled key vault. * {@codesnippet com.azure.keyvault.keys.keyclient.getDeletedKey#string} - * * * @param name The name of the deleted key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java index ad0ff55cc413..2ab46793e7dc 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java @@ -17,6 +17,7 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.keys.implementation.AzureKeyVaultConfiguration; import java.net.MalformedURLException; @@ -55,13 +56,15 @@ */ @ServiceClientBuilder(serviceClients = KeyClient.class) public final class KeyClientBuilder { + private final ClientLogger logger = new ClientLogger(KeyClientBuilder.class); + private final List policies; private TokenCredential credential; private HttpPipeline pipeline; private URL endpoint; private HttpClient httpClient; private HttpLogDetailLevel httpLogDetailLevel; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -90,7 +93,7 @@ public KeyClientBuilder() { public KeyClient buildClient() { return new KeyClient(buildAsyncClient()); } - + /** * Creates a {@link KeyAsyncClient} based on options set in the builder. * Every time {@code buildAsyncClient()} is called, a new instance of {@link KeyAsyncClient} is created. @@ -110,7 +113,7 @@ public KeyAsyncClient buildAsyncClient() { URL buildEndpoint = getBuildEndpoint(buildConfiguration); if (buildEndpoint == null) { - throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); + throw logger.logExceptionAsError(new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED))); } if (pipeline != null) { @@ -118,7 +121,7 @@ public KeyAsyncClient buildAsyncClient() { } if (credential == null) { - throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED)); + throw logger.logExceptionAsError(new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED))); } // Closest to API goes first, closest to wire goes last. @@ -150,7 +153,7 @@ public KeyClientBuilder endpoint(String endpoint) { try { this.endpoint = new URL(endpoint); } catch (MalformedURLException e) { - throw new IllegalArgumentException("The Azure Key Vault endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Key Vault endpoint url is malformed.")); } return this; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricEncryptionAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricEncryptionAlgorithm.java index 53b576760d98..253ac34c0a40 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricEncryptionAlgorithm.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricEncryptionAlgorithm.java @@ -17,7 +17,7 @@ abstract class AsymmetricEncryptionAlgorithm extends LocalEncryptionAlgorithm { /** * Constructor. - * + * * @param name The name of the algorithm. */ protected AsymmetricEncryptionAlgorithm(String name) { @@ -29,10 +29,10 @@ protected AsymmetricEncryptionAlgorithm(String name) { * uses the specified {@link KeyPair} and the default {@link Provider} provider. * * @param keyPair The key pair to use. - * @return - * @throws InvalidKeyException - * @throws NoSuchAlgorithmException - * @throws NoSuchPaddingException + * @return abstract {@link ICryptoTransform} + * @throws InvalidKeyException when key is not valid + * @throws NoSuchAlgorithmException if algorithm is not found + * @throws NoSuchPaddingException if padding is set wrong */ public abstract ICryptoTransform createEncryptor(KeyPair keyPair) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; @@ -42,10 +42,10 @@ protected AsymmetricEncryptionAlgorithm(String name) { * * @param keyPair The key pair to use. * @param provider The provider to use. - * @return - * @throws InvalidKeyException - * @throws NoSuchAlgorithmException - * @throws NoSuchPaddingException + * @return abstract {@link ICryptoTransform} + * @throws InvalidKeyException when key is not valid + * @throws NoSuchAlgorithmException if algorithm is not found + * @throws NoSuchPaddingException if padding is set wrong */ public abstract ICryptoTransform createEncryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; @@ -54,10 +54,10 @@ protected AsymmetricEncryptionAlgorithm(String name) { * uses the specified {@link KeyPair} and the default {@link Provider} provider. * * @param keyPair The key pair to use. - * @return - * @throws InvalidKeyException - * @throws NoSuchAlgorithmException - * @throws NoSuchPaddingException + * @return abstract {@link ICryptoTransform} + * @throws InvalidKeyException when key is not valid + * @throws NoSuchAlgorithmException if algorithm is not found + * @throws NoSuchPaddingException if padding is set wrong */ public abstract ICryptoTransform createDecryptor(KeyPair keyPair) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; @@ -67,10 +67,10 @@ protected AsymmetricEncryptionAlgorithm(String name) { * * @param keyPair The key pair to use. * @param provider The provider to use. - * @return - * @throws InvalidKeyException - * @throws NoSuchAlgorithmException - * @throws NoSuchPaddingException + * @return abstract {@link ICryptoTransform} + * @throws InvalidKeyException when key is not valid + * @throws NoSuchAlgorithmException if algorithm is not found + * @throws NoSuchPaddingException if padding is set wrong */ public abstract ICryptoTransform createDecryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java index 053fb631ade8..cd6ef7e7cc3f 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java @@ -113,7 +113,7 @@ private void initializeCryptoClients() { localKeyCryptographyClient = new SymmetricKeyCryptographyClient(key, cryptographyServiceClient); break; default: - throw new IllegalArgumentException(String.format("The Json Web Key Type: %s is not supported.", key.kty().toString())); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format("The Json Web Key Type: %s is not supported.", key.kty().toString()))); } } @@ -164,7 +164,7 @@ Mono> getKeyWithResponse(Context context) { * *

Code Samples

*

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#asymmetric-encrypt} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte} * * @param algorithm The algorithm to be used for encryption. * @param plaintext The content to be encrypted. @@ -189,7 +189,7 @@ public Mono encrypt(EncryptionAlgorithm algorithm, byte[] plainte * *

Code Samples

*

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#symmetric-encrypt} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte-byte-byte} * * @param algorithm The algorithm to be used for encryption. * @param plaintext The content to be encrypted. @@ -231,7 +231,7 @@ Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, Con * *

Code Samples

*

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#asymmetric-decrypt} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte} * * @param algorithm The algorithm to be used for decryption. * @param cipherText The content to be decrypted. @@ -255,7 +255,7 @@ public Mono decrypt(EncryptionAlgorithm algorithm, byte[] cipherT * *

Code Samples

*

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#symmetric-decrypt} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte} * * @param algorithm The algorithm to be used for decryption. * @param cipherText The content to be decrypted. @@ -297,7 +297,7 @@ Mono decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, by * *

Code Samples

*

Sings the digest. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.sign#SignatureAlgorithm-byte} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature is to be created. @@ -337,7 +337,7 @@ Mono sign(SignatureAlgorithm algorithm, byte[] digest, Context conte * *

Code Samples

*

Verifies the signature against the specified digest. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verify#SignatureAlgorithm-byte-byte} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature is to be created. @@ -375,7 +375,7 @@ Mono verify(SignatureAlgorithm algorithm, byte[] digest, byte[] si * *

Code Samples

*

Wraps the key content. Subscribes to the call asynchronously and prints out the wrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.wrap-key} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.wrapKey#KeyWrapAlgorithm-byte} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param key The key content to be wrapped @@ -413,7 +413,7 @@ Mono wrapKey(KeyWrapAlgorithm algorithm, byte[] key, Context cont * *

Code Samples

*

Unwraps the key content. Subscribes to the call asynchronously and prints out the unwrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.unwrap-key} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.unwrapKey#KeyWrapAlgorithm-byte} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param encryptedKey The encrypted key content to unwrap. @@ -453,7 +453,7 @@ Mono unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, * *

Code Samples

*

Signs the raw data. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign-data} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.signData#SignatureAlgorithm-byte} * * @param algorithm The algorithm to use for signing. * @param data The content from which signature is to be created. @@ -493,7 +493,7 @@ Mono signData(SignatureAlgorithm algorithm, byte[] data, Context con * *

Code Samples

*

Verifies the signature against the raw data. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify-data} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verifyData#SignatureAlgorithm-byte-byte} * * @param algorithm The algorithm to use for signing. * @param data The raw content against which signature is to be verified. @@ -524,7 +524,7 @@ Mono verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] private void unpackAndValidateId(String keyId) { if (ImplUtils.isNullOrEmpty(keyId)) { - throw new IllegalArgumentException("Key Id is invalid"); + throw logger.logExceptionAsError(new IllegalArgumentException("Key Id is invalid")); } try { URL url = new URL(keyId); @@ -533,14 +533,14 @@ private void unpackAndValidateId(String keyId) { String keyName = (tokens.length >= 3 ? tokens[2] : null); String version = (tokens.length >= 4 ? tokens[3] : null); if (Strings.isNullOrEmpty(endpoint)) { - throw new IllegalArgumentException("Key endpoint in key id is invalid"); + throw logger.logExceptionAsError(new IllegalArgumentException("Key endpoint in key id is invalid")); } else if (Strings.isNullOrEmpty(keyName)) { - throw new IllegalArgumentException("Key name in key id is invalid"); + throw logger.logExceptionAsError(new IllegalArgumentException("Key name in key id is invalid")); } else if (Strings.isNullOrEmpty(version)) { - throw new IllegalArgumentException("Key version in key id is invalid"); + throw logger.logExceptionAsError(new IllegalArgumentException("Key version in key id is invalid")); } } catch (MalformedURLException e) { - throw new IllegalArgumentException("The key identifier is malformed", e); + throw logger.logExceptionAsError(new IllegalArgumentException("The key identifier is malformed", e)); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java index a81b0222a896..fc2a10904054 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java @@ -86,7 +86,7 @@ public Response getKeyWithResponse(Context context) { * *

Code Samples

*

Encrypts the content. Prints out the encrypted content details.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte} * * @param algorithm The algorithm to be used for encryption. * @param plaintext The content to be encrypted. @@ -113,7 +113,7 @@ public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, by * *

Code Samples

*

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt-Context} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte-Context} * * @param algorithm The algorithm to be used for encryption. * @param plaintext The content to be encrypted. @@ -141,7 +141,7 @@ public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, by * *

Code Samples

*

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#asymmetric-encrypt} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte} * * @param algorithm The algorithm to be used for encryption. * @param plaintext The content to be encrypted. @@ -165,7 +165,7 @@ public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext) { * *

Code Samples

*

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte} * * @param algorithm The algorithm to be used for decryption. * @param cipherText The content to be decrypted. @@ -192,7 +192,7 @@ public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, b * *

Code Samples

*

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt-Context} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte-Context} * * @param algorithm The algorithm to be used for decryption. * @param cipherText The content to be decrypted. @@ -220,7 +220,7 @@ public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, b * *

Code Samples

*

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#asymmetric-decrypt} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte} * * @param algorithm The algorithm to be used for decryption. * @param cipherText The content to be decrypted. @@ -244,7 +244,7 @@ public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] cipherText) { * *

Code Samples

*

Sings the digest. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-Context} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte-Context} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature is to be created. @@ -269,7 +269,7 @@ public SignResult sign(SignatureAlgorithm algorithm, byte[] digest, Context cont * *

Code Samples

*

Sings the digest. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature is to be created. @@ -293,7 +293,7 @@ public SignResult sign(SignatureAlgorithm algorithm, byte[] digest) { * *

Code Samples

*

Verifies the signature against the specified digest. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature was created. @@ -318,7 +318,7 @@ public VerifyResult verify(SignatureAlgorithm algorithm, byte[] digest, byte[] s * *

Code Samples

*

Verifies the signature against the specified digest. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-Context} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte-Context} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature is to be created. @@ -341,7 +341,7 @@ public VerifyResult verify(SignatureAlgorithm algorithm, byte[] digest, byte[] s * *

Code Samples

*

Wraps the key content. Subscribes to the call asynchronously and prints out the wrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param key The key content to be wrapped @@ -362,7 +362,7 @@ public KeyWrapResult wrapKey(KeyWrapAlgorithm algorithm, byte[] key) { * *

Code Samples

*

Wraps the key content. Subscribes to the call asynchronously and prints out the wrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key-Context} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte-Context} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param key The key content to be wrapped @@ -385,7 +385,7 @@ public KeyWrapResult wrapKey(KeyWrapAlgorithm algorithm, byte[] key, Context con * *

Code Samples

*

Unwraps the key content. Subscribes to the call asynchronously and prints out the unwrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param encryptedKey The encrypted key content to unwrap. @@ -407,7 +407,7 @@ public KeyUnwrapResult unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey * *

Code Samples

*

Unwraps the key content. Subscribes to the call asynchronously and prints out the unwrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key-Context} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte-Context} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param encryptedKey The encrypted key content to unwrap. @@ -432,7 +432,7 @@ public KeyUnwrapResult unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey * *

Code Samples

*

Signs the raw data. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte} * * @param algorithm The algorithm to use for signing. * @param data The content from which signature is to be created. @@ -456,7 +456,7 @@ public SignResult signData(SignatureAlgorithm algorithm, byte[] data) { * *

Code Samples

*

Signs the raw data. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data-Context} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte-Context} * * @param algorithm The algorithm to use for signing. * @param data The content from which signature is to be created. @@ -481,7 +481,7 @@ public SignResult signData(SignatureAlgorithm algorithm, byte[] data, Context co * *

Code Samples

*

Verifies the signature against the raw data. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte} * * @param algorithm The algorithm to use for signing. * @param data The raw content against which signature is to be verified. @@ -506,7 +506,7 @@ public VerifyResult verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] * *

Code Samples

*

Verifies the signature against the raw data. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data-Context} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte-Context} * * @param algorithm The algorithm to use for signing. * @param data The raw content against which signature is to be verified. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java index a73e91537de5..e212ba95cce1 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java @@ -16,6 +16,7 @@ import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.keys.KeyVaultCredentialPolicy; import com.azure.security.keyvault.keys.implementation.AzureKeyVaultConfiguration; import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; @@ -55,13 +56,15 @@ @ServiceClientBuilder(serviceClients = CryptographyClient.class) public final class CryptographyClientBuilder { private final List policies; + private final ClientLogger logger = new ClientLogger(CryptographyClientBuilder.class); + private TokenCredential credential; private HttpPipeline pipeline; private JsonWebKey jsonWebKey; private String keyId; private HttpClient httpClient; private HttpLogDetailLevel httpLogDetailLevel; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -110,7 +113,7 @@ public CryptographyAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; if (jsonWebKey == null && Strings.isNullOrEmpty(keyId)) { - throw new IllegalStateException("Json Web Key or jsonWebKey identifier are required to create cryptography client"); + throw logger.logExceptionAsError(new IllegalStateException("Json Web Key or jsonWebKey identifier are required to create cryptography client")); } if (pipeline != null) { @@ -122,7 +125,7 @@ public CryptographyAsyncClient buildAsyncClient() { } if (credential == null) { - throw new IllegalStateException("Key Vault credentials " + "are required to build the Cryptography async client"); + throw logger.logExceptionAsError(new IllegalStateException("Key Vault credentials " + "are required to build the Cryptography async client")); } // Closest to API goes first, closest to wire goes last. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/EcKeyCryptographyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/EcKeyCryptographyClient.java index 6ed03573e553..257d168a9c64 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/EcKeyCryptographyClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/EcKeyCryptographyClient.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.keys.cryptography; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.keys.cryptography.models.DecryptResult; import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; import com.azure.security.keyvault.keys.cryptography.models.EncryptResult; @@ -23,9 +24,11 @@ import java.security.MessageDigest; class EcKeyCryptographyClient extends LocalKeyCryptographyClient { + private final ClientLogger logger = new ClientLogger(EcKeyCryptographyClient.class); + private KeyPair keyPair; - private CryptographyServiceClient serviceClient; - private Provider provider; + private final CryptographyServiceClient serviceClient; + private final Provider provider; /** * Creates a EcKeyCryptographyClient that uses {@code service} to service requests @@ -35,6 +38,7 @@ class EcKeyCryptographyClient extends LocalKeyCryptographyClient { EcKeyCryptographyClient(CryptographyServiceClient serviceClient) { super(serviceClient); this.serviceClient = serviceClient; + this.provider = null; } EcKeyCryptographyClient(JsonWebKey key, CryptographyServiceClient serviceClient) { @@ -53,13 +57,12 @@ private KeyPair getKeyPair(JsonWebKey key) { @Override Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData, Context context, JsonWebKey key) { - throw new UnsupportedOperationException("Encrypt operation is not supported for EC key"); + throw logger.logExceptionAsError(new UnsupportedOperationException("Encrypt operation is not supported for EC key")); } @Override Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Context context, JsonWebKey key) { - - throw new UnsupportedOperationException("Decrypt operation is not supported for EC key"); + throw logger.logExceptionAsError(new UnsupportedOperationException("Decrypt operation is not supported for EC key")); } @Override @@ -143,14 +146,12 @@ Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte @Override Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context context, JsonWebKey webKey) { - return Mono.error(new UnsupportedOperationException("Wrap key operation is not supported for EC key")); } @Override Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, JsonWebKey key) { - - throw new UnsupportedOperationException("Unwrap key operation is not supported for Ec key"); + throw logger.logExceptionAsError(new UnsupportedOperationException("Unwrap key operation is not supported for Ec key")); } @Override diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Ecdsa.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Ecdsa.java index bd4ed3c0029c..6d091d1b4ad0 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Ecdsa.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Ecdsa.java @@ -3,12 +3,15 @@ package com.azure.security.keyvault.keys.cryptography; +import com.azure.core.util.logging.ClientLogger; + import java.security.GeneralSecurityException; import java.security.KeyPair; import java.security.Provider; import java.security.Signature; abstract class Ecdsa extends AsymmetricSignatureAlgorithm { + private final ClientLogger logger = new ClientLogger(Ecdsa.class); protected Ecdsa() { super("NONEwithECDSA"); @@ -54,7 +57,7 @@ public boolean verify(byte[] digest, byte[] signature) throws GeneralSecurityExc private void checkDigestLength(byte[] digest) { if (digest.length != getDigestLength()) { - throw new IllegalArgumentException("Invalid digest length."); + throw logger.logExceptionAsError(new IllegalArgumentException("Invalid digest length.")); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricKeyCryptographyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricKeyCryptographyClient.java index 1597cced6e73..0121a4b3e761 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricKeyCryptographyClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricKeyCryptographyClient.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.keys.cryptography; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.keys.cryptography.models.DecryptResult; import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; import com.azure.security.keyvault.keys.cryptography.models.EncryptResult; @@ -19,6 +20,8 @@ import java.security.NoSuchAlgorithmException; class SymmetricKeyCryptographyClient extends LocalKeyCryptographyClient { + private final ClientLogger logger = new ClientLogger(SymmetricKeyCryptographyClient.class); + private byte[] key; /* @@ -127,7 +130,7 @@ Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context this.key = getKey(jsonWebKey); if (key == null || key.length == 0) { - throw new IllegalArgumentException("key"); + throw logger.logExceptionAsError(new IllegalArgumentException("key")); } // Interpret the algorithm diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/DecryptResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/DecryptResult.java index d6eb0f8f75f3..8e41fb52b60f 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/DecryptResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/DecryptResult.java @@ -12,7 +12,7 @@ public final class DecryptResult { /** * The decrypted content. */ - private byte[] plainText; + private final byte[] plainText; /** * Creates the instance of Decrypt Result holding decrypted content. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java index 318004f05bb9..e0528e56ed39 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java @@ -25,17 +25,17 @@ public EncryptResult(byte[] cipherText, byte[] authenticationTag, EncryptionAlgo /** * THe encrypted content. */ - private byte[] cipherText; + private final byte[] cipherText; /** * The authentication tag. */ - private byte[] authenticationTag; + private final byte[] authenticationTag; /** * The encrypyion algorithm used for the encryption operation. */ - private EncryptionAlgorithm algorithm; + private final EncryptionAlgorithm algorithm; /** * Get the encrypted content. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyUnwrapResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyUnwrapResult.java index d839f72abf03..11c00568427c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyUnwrapResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyUnwrapResult.java @@ -12,7 +12,7 @@ public final class KeyUnwrapResult { /** * The unwrapped key content. */ - private byte[] key; + private final byte[] key; /** * Creates the instance of KeyUnwrap Result holding the unwrapped key content. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapResult.java index 23f660b13457..c84cccc40fcd 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapResult.java @@ -23,12 +23,12 @@ public KeyWrapResult(byte[] encryptedKey, KeyWrapAlgorithm algorithm) { /** * The encrypted key content */ - private byte[] encryptedKey; + private final byte[] encryptedKey; /** * The key wrap algorithm used to wrap the key content. */ - private KeyWrapAlgorithm algorithm; + private final KeyWrapAlgorithm algorithm; /** * Get the encrypted key content. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java index 34ea80ef373a..e895e1bac7a9 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java @@ -23,12 +23,12 @@ public SignResult(byte[] signature, SignatureAlgorithm algorithm) { /** * The signature created from the digest. */ - private byte[] signature; + private final byte[] signature; /** * The algorithm used to create the signature. */ - private SignatureAlgorithm algorithm; + private final SignatureAlgorithm algorithm; /** * Get the signature created from the digest. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java index e0c15a1ef131..9434a55a2e12 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java @@ -30,8 +30,7 @@ public enum SignatureAlgorithm { /** * Creates a custom value for SignatureAlgorithm. * - * @param value - * the custom value + * @param value the custom value */ SignatureAlgorithm(String value) { this.value = value; diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/VerifyResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/VerifyResult.java index aa92321c876d..cc600e5ff0df 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/VerifyResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/VerifyResult.java @@ -10,7 +10,7 @@ public final class VerifyResult { /** * THe verify operation result. */ - private Boolean isValid; + private final Boolean isValid; /** * Creates the instance of Verify Result holding the verification response information. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyImportOptions.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyImportOptions.java index fe715b88dbf4..800095c0531c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyImportOptions.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyImportOptions.java @@ -10,7 +10,7 @@ public class KeyImportOptions extends KeyBase { /** * The Key Material. */ - private JsonWebKey keyMaterial; + private final JsonWebKey keyMaterial; /** * The hsm indicator for the key. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/JsonWebKey.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/JsonWebKey.java index d287d522a03e..c2305af1945d 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/JsonWebKey.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/JsonWebKey.java @@ -3,6 +3,7 @@ package com.azure.security.keyvault.keys.models.webkey; +import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -50,6 +51,7 @@ */ @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY) public class JsonWebKey { + private final ClientLogger logger = new ClientLogger(JsonWebKey.class); /** * Key Identifier. @@ -448,11 +450,11 @@ public String toString() { try { return mapper.writeValueAsString(this); } catch (JsonGenerationException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } catch (JsonMappingException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } catch (IOException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } } @@ -559,7 +561,7 @@ private PublicKey getRSAPublicKey(Provider provider) { return factory.generatePublic(publicKeySpec); } catch (GeneralSecurityException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } } @@ -578,7 +580,7 @@ private PrivateKey getRSAPrivateKey(Provider provider) { return factory.generatePrivate(privateKeySpec); } catch (GeneralSecurityException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } } @@ -610,7 +612,7 @@ private static PrivateKey getECPrivateKey(byte[] d, ECParameterSpec curveSpec, P */ private void checkRSACompatible() { if (!KeyType.RSA.equals(kty) && !KeyType.RSA_HSM.equals(kty)) { - throw new UnsupportedOperationException("Not an RSA key"); + throw logger.logExceptionAsError(new UnsupportedOperationException("Not an RSA key")); } } @@ -746,7 +748,7 @@ public KeyPair toEC(boolean includePrivateParameters, Provider provider) { } if (!KeyType.EC.equals(kty) && !KeyType.EC_HSM.equals(kty)) { - throw new IllegalArgumentException("Not an EC key."); + throw logger.logExceptionAsError(new IllegalArgumentException("Not an EC key.")); } try { @@ -773,7 +775,7 @@ public KeyPair toEC(boolean includePrivateParameters, Provider provider) { return realKeyPair; } catch (GeneralSecurityException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java index 1d7141b1b621..a2825703065c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java @@ -118,7 +118,7 @@ public void encrypt() { (byte) 0x69, (byte) 0x70, (byte) 0x6c, (byte) 0x65, (byte) 0x20, (byte) 0x6f, (byte) 0x66, (byte) 0x20, (byte) 0x41, (byte) 0x75, (byte) 0x67, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x20, (byte) 0x4b, (byte) 0x65, (byte) 0x72, (byte) 0x63, (byte) 0x6b, (byte) 0x68, (byte) 0x6f, (byte) 0x66, (byte) 0x66, (byte) 0x73 }; - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#asymmetric-encrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); cryptographyAsyncClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText) @@ -126,16 +126,16 @@ public void encrypt() { .subscribe(encryptResult -> System.out.printf("Received encrypted content of length %d with algorithm %s \n", encryptResult.cipherText().length, encryptResult.algorithm().toString())); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#asymmetric-encrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#symmetric-encrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte-byte-byte cryptographyAsyncClient.encrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(encryptResult -> System.out.printf("Received encrypted content of length %d with algorithm %s \n", encryptResult.cipherText().length, encryptResult.algorithm().toString())); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#symmetric-encrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte-byte-byte } /** @@ -151,23 +151,23 @@ public void decrypt() { (byte) 0x4b, (byte) 0x65, (byte) 0x72, (byte) 0x63, (byte) 0x6b, (byte) 0x68, (byte) 0x6f, (byte) 0x66, (byte) 0x66, (byte) 0x73 }; byte[] authTag = {(byte) 0x65, (byte) 0x2c, (byte) 0x3f, (byte) 0xa3, (byte) 0x6b, (byte) 0x0a, (byte) 0x7c, (byte) 0x5b, (byte) 0x32, (byte) 0x19, (byte) 0xfa, (byte) 0xb3, (byte) 0xa3, (byte) 0x0b, (byte) 0xc1, (byte) 0xc4}; - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#asymmetric-decrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); cryptographyAsyncClient.decrypt(EncryptionAlgorithm.RSA_OAEP, plainText) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(decryptResult -> System.out.printf("Received decrypted content of length %d\n", decryptResult.plainText().length)); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#asymmetric-decrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#symmetric-decrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte cryptographyAsyncClient.decrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData, authTag) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(encryptResult -> System.out.printf("Received decrypted content of length %d with algorithm %s \n", encryptResult.plainText().length)); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#symmetric-decrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte } /** @@ -179,7 +179,7 @@ public void decrypt() { public void signVerify() throws NoSuchAlgorithmException { CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); byte[] signature = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.sign#SignatureAlgorithm-byte byte[] data = new byte[100]; new Random(0x1234567L).nextBytes(data); MessageDigest md = MessageDigest.getInstance("SHA-256"); @@ -189,14 +189,14 @@ public void signVerify() throws NoSuchAlgorithmException { .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(signResult -> System.out.printf("Received signature of length %d with algorithm %s", signResult.signature().length)); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.sign#SignatureAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verify#SignatureAlgorithm-byte-byte cryptographyAsyncClient.verify(SignatureAlgorithm.ES256, digest, signature) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(verifyResult -> System.out.printf("Verification status %s", verifyResult.isValid())); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verify#SignatureAlgorithm-byte-byte } @@ -209,31 +209,31 @@ public void signVerify() throws NoSuchAlgorithmException { public void signDataVerifyData() throws NoSuchAlgorithmException { CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); byte[] signature = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign-data + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.signData#SignatureAlgorithm-byte byte[] data = new byte[100]; new Random(0x1234567L).nextBytes(data); cryptographyAsyncClient.sign(SignatureAlgorithm.ES256, data) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(signResult -> System.out.printf("Received signature of length %d with algorithm %s", signResult.signature().length)); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign-data + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.signData#SignatureAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify-data + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verifyData#SignatureAlgorithm-byte-byte cryptographyAsyncClient.verify(SignatureAlgorithm.ES256, data, signature) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(verifyResult -> System.out.printf("Verification status %s", verifyResult.isValid())); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify-data + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verifyData#SignatureAlgorithm-byte-byte } /** * Generates a code sample for using {@link CryptographyAsyncClient#wrapKey(KeyWrapAlgorithm, byte[])} and - * {@link CryptographyAsyncClient#unwrapKey(KeyWrapAlgorithm, byte[]) + * {@link CryptographyAsyncClient#unwrapKey(KeyWrapAlgorithm, byte[])} */ public void wrapKeyUnwrapKey() { CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); byte[] encryptedKey = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.wrap-key + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.wrapKey#KeyWrapAlgorithm-byte byte[] key = new byte[100]; new Random(0x1234567L).nextBytes(key); cryptographyAsyncClient.wrapKey(KeyWrapAlgorithm.RSA_OAEP, key) @@ -241,14 +241,14 @@ public void wrapKeyUnwrapKey() { .subscribe(keyWrapResult -> System.out.printf("Received encypted key of length %d with algorithm %s", keyWrapResult.encryptedKey().length, keyWrapResult.algorithm().toString())); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.wrap-key + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.wrapKey#KeyWrapAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.unwrap-key + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.unwrapKey#KeyWrapAlgorithm-byte cryptographyAsyncClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, encryptedKey) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(keyUnwrapResult -> System.out.printf("Received key of length %d", keyUnwrapResult.key().length)); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.unwrap-key + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.unwrapKey#KeyWrapAlgorithm-byte } /** diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientJavaDocCodeSnippets.java index 086eee5c36f3..88cab358f41e 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientJavaDocCodeSnippets.java @@ -80,29 +80,29 @@ public void encrypt() { (byte) 0x69, (byte) 0x70, (byte) 0x6c, (byte) 0x65, (byte) 0x20, (byte) 0x6f, (byte) 0x66, (byte) 0x20, (byte) 0x41, (byte) 0x75, (byte) 0x67, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x20, (byte) 0x4b, (byte) 0x65, (byte) 0x72, (byte) 0x63, (byte) 0x6b, (byte) 0x68, (byte) 0x6f, (byte) 0x66, (byte) 0x66, (byte) 0x73 }; - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#asymmetric-encrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); EncryptResult encryptResult = cryptographyClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText); System.out.printf("Received encrypted content of length %d with algorithm %s \n", encryptResult.cipherText().length, encryptResult.algorithm().toString()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#asymmetric-encrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte EncryptResult encryptionResult = cryptographyClient.encrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData); System.out.printf("Received encrypted content of length %d with algorithm %s \n", encryptionResult.cipherText().length, encryptResult.algorithm().toString()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte-Context EncryptResult encryptionResponse = cryptographyClient.encrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData, new Context(key1, value1)); System.out.printf("Received encrypted content of length %d with algorithm %s \n", encryptionResponse.cipherText().length, encryptResult.algorithm().toString()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte-Context } /** @@ -118,26 +118,26 @@ public void decrypt() { (byte) 0x4b, (byte) 0x65, (byte) 0x72, (byte) 0x63, (byte) 0x6b, (byte) 0x68, (byte) 0x6f, (byte) 0x66, (byte) 0x66, (byte) 0x73 }; byte[] authTag = {(byte) 0x65, (byte) 0x2c, (byte) 0x3f, (byte) 0xa3, (byte) 0x6b, (byte) 0x0a, (byte) 0x7c, (byte) 0x5b, (byte) 0x32, (byte) 0x19, (byte) 0xfa, (byte) 0xb3, (byte) 0xa3, (byte) 0x0b, (byte) 0xc1, (byte) 0xc4}; - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#asymmetric-decrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); DecryptResult decryptResult = cryptographyClient.decrypt(EncryptionAlgorithm.RSA_OAEP, plainText); System.out.printf("Received decrypted content of length %d\n", decryptResult.plainText().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#asymmetric-decrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte DecryptResult decryptionResult = cryptographyClient.decrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData, authTag); System.out.printf("Received decrypted content of length %d with algorithm %s \n", decryptionResult.plainText().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte-Context DecryptResult decryptionResponse = cryptographyClient.decrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData, authTag, new Context(key2, value2)); System.out.printf("Received decrypted content of length %d with algorithm %s \n", decryptionResponse.plainText().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte-Context } /** @@ -149,7 +149,7 @@ public void decrypt() { public void signVerify() throws NoSuchAlgorithmException { CryptographyClient cryptographyClient = createClient(); byte[] signature = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte byte[] data = new byte[100]; new Random(0x1234567L).nextBytes(data); MessageDigest md = MessageDigest.getInstance("SHA-256"); @@ -158,9 +158,9 @@ public void signVerify() throws NoSuchAlgorithmException { SignResult signResult = cryptographyClient.sign(SignatureAlgorithm.ES256, digest); System.out.printf("Received signature of length %d with algorithm %s", signResult.signature().length, signResult.algorithm().toString()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte-Context byte[] plainTextData = new byte[100]; new Random(0x1234567L).nextBytes(plainTextData); MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); @@ -169,17 +169,17 @@ public void signVerify() throws NoSuchAlgorithmException { SignResult signResponse = cryptographyClient.sign(SignatureAlgorithm.ES256, digetContent); System.out.printf("Received signature of length %d with algorithm %s", signResponse.signature().length, signResponse.algorithm().toString(), new Context(key1, value1)); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte-Context - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte VerifyResult verifyResult = cryptographyClient.verify(SignatureAlgorithm.ES256, digest, signature); System.out.printf("Verification status %s", verifyResult.isValid()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte-Context VerifyResult verifyResponse = cryptographyClient.verify(SignatureAlgorithm.ES256, digest, signature); System.out.printf("Verification status %s", verifyResponse.isValid(), new Context(key2, value2)); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte-Context } @@ -192,65 +192,65 @@ public void signVerify() throws NoSuchAlgorithmException { public void signDataVerifyData() throws NoSuchAlgorithmException { CryptographyClient cryptographyClient = createClient(); byte[] signature = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte byte[] data = new byte[100]; new Random(0x1234567L).nextBytes(data); SignResult signResult = cryptographyClient.sign(SignatureAlgorithm.ES256, data); System.out.printf("Received signature of length %d with algorithm %s", signResult.signature().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte-Context byte[] plainTextData = new byte[100]; new Random(0x1234567L).nextBytes(plainTextData); SignResult signReponse = cryptographyClient.sign(SignatureAlgorithm.ES256, plainTextData); System.out.printf("Received signature of length %d with algorithm %s", signReponse.signature().length, new Context(key1, value1)); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte-Context - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte VerifyResult verifyResult = cryptographyClient.verify(SignatureAlgorithm.ES256, data, signature); System.out.printf("Verification status %s", verifyResult.isValid()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte-Context VerifyResult verifyResponse = cryptographyClient.verify(SignatureAlgorithm.ES256, data, signature); System.out.printf("Verification status %s", verifyResponse.isValid(), new Context(key2, value2)); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte-Context } /** * Generates a code sample for using {@link CryptographyClient#wrapKey(KeyWrapAlgorithm, byte[])} and - * {@link CryptographyClient#unwrapKey(KeyWrapAlgorithm, byte[]) + * {@link CryptographyClient#unwrapKey(KeyWrapAlgorithm, byte[])} */ public void wrapKeyUnwrapKey() { CryptographyClient cryptographyClient = createClient(); byte[] encryptedKey = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte byte[] key = new byte[100]; new Random(0x1234567L).nextBytes(key); KeyWrapResult keyWrapResult = cryptographyClient.wrapKey(KeyWrapAlgorithm.RSA_OAEP, key); System.out.printf("Received encypted key of length %d with algorithm %s", keyWrapResult.encryptedKey().length, keyWrapResult.algorithm().toString()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte-Context byte[] keyContent = new byte[100]; new Random(0x1234567L).nextBytes(keyContent); KeyWrapResult keyWrapResponse = cryptographyClient.wrapKey(KeyWrapAlgorithm.RSA_OAEP, keyContent); System.out.printf("Received encypted key of length %d with algorithm %s", keyWrapResponse.encryptedKey().length, keyWrapResponse.algorithm().toString(), new Context(key1, value1)); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte-Context - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte KeyUnwrapResult keyUnwrapResult = cryptographyClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, encryptedKey); System.out.printf("Received key of length %d", keyUnwrapResult.key().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte-Context KeyUnwrapResult keyUnwrapResponse = cryptographyClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, encryptedKey, new Context(key2, value2)); System.out.printf("Received key of length %d", keyUnwrapResponse.key().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte-Context } /** diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java index 639fb86f26f5..f42a323cc483 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java @@ -10,10 +10,10 @@ import com.azure.security.keyvault.keys.models.KeyBase; import com.azure.security.keyvault.keys.models.KeyCreateOptions; import com.azure.security.keyvault.keys.models.webkey.KeyType; -import io.netty.handler.codec.http.HttpResponseStatus; import org.junit.Assert; import reactor.test.StepVerifier; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.List; @@ -56,17 +56,19 @@ public void setKey() { */ public void setKeyEmptyName() { StepVerifier.create(client.createKey("", KeyType.RSA)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, - HttpResponseStatus.BAD_REQUEST.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST)); } /** * Tests that we can create keys when value is not null or an empty string. */ public void setKeyNullType() { - setKeyEmptyValueRunner((key) -> StepVerifier.create(client.createKey(key)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, - HttpResponseStatus.BAD_REQUEST.code()))); + setKeyEmptyValueRunner((key) -> { + + StepVerifier.create(client.createKey(key)) + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST)); + + }); } /** @@ -156,7 +158,7 @@ public void getKeySpecificVersion() { */ public void getKeyNotFound() { StepVerifier.create(client.getKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } @@ -178,15 +180,16 @@ public void deleteKey() { sleepInRecordMode(30000); StepVerifier.create(client.purgeDeletedKey(keyToDelete.name())) - .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), - voidResponse.statusCode())).verifyComplete(); + .assertNext(voidResponse -> { + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); + }).verifyComplete(); sleepInRecordMode(15000); }); } public void deleteKeyNotFound() { StepVerifier.create(client.deleteKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -194,7 +197,7 @@ public void deleteKeyNotFound() { */ public void getDeletedKeyNotFound() { StepVerifier.create(client.getDeletedKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -223,7 +226,7 @@ public void recoverDeletedKey() { */ public void recoverDeletedKeyNotFound() { StepVerifier.create(client.recoverDeletedKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -247,7 +250,7 @@ public void backupKey() { */ public void backupKeyNotFound() { StepVerifier.create(client.backupKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -264,8 +267,9 @@ public void restoreKey() { pollOnKeyDeletion(keyToBackupAndRestore.name()); StepVerifier.create(client.purgeDeletedKey(keyToBackupAndRestore.name())) - .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), - voidResponse.statusCode())).verifyComplete(); + .assertNext(voidResponse -> { + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); + }).verifyComplete(); pollOnKeyPurge(keyToBackupAndRestore.name()); sleepInRecordMode(60000); @@ -285,7 +289,7 @@ public void restoreKey() { public void restoreKeyFromMalformedBackup() { byte[] keyBackupBytes = "non-existing".getBytes(); StepVerifier.create(client.restoreKey(keyBackupBytes)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST)); } /** @@ -311,8 +315,9 @@ public void getDeletedKey() { }).verifyComplete(); StepVerifier.create(client.purgeDeletedKey(keyToDeleteAndGet.name())) - .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), - voidResponse.statusCode())).verifyComplete(); + .assertNext(voidResponse -> { + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); + }).verifyComplete(); pollOnKeyPurge(keyToDeleteAndGet.name()); sleepInRecordMode(15000); }); @@ -354,8 +359,9 @@ public void listDeletedKeys() { for (DeletedKey deletedKey : deletedKeys) { StepVerifier.create(client.purgeDeletedKey(deletedKey.name())) - .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), - voidResponse.statusCode())).verifyComplete(); + .assertNext(voidResponse -> { + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); + }).verifyComplete(); pollOnKeyPurge(deletedKey.name()); } }); @@ -386,8 +392,9 @@ public void listKeyVersions() { StepVerifier.create(client.purgeDeletedKey(keyName)) - .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), - voidResponse.statusCode())).verifyComplete(); + .assertNext(voidResponse -> { + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); + }).verifyComplete(); pollOnKeyPurge(keyName); }); diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java index fb52b12a36ea..eed62076cd22 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java @@ -10,8 +10,8 @@ import com.azure.security.keyvault.keys.models.KeyBase; import com.azure.security.keyvault.keys.models.KeyCreateOptions; import com.azure.security.keyvault.keys.models.webkey.KeyType; -import io.netty.handler.codec.http.HttpResponseStatus; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -52,7 +52,7 @@ public void setKey() { * Tests that an attempt to create a key with empty string name throws an error. */ public void setKeyEmptyName() { - assertRestException(() -> client.createKey("", KeyType.RSA), ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code()); + assertRestException(() -> client.createKey("", KeyType.RSA), ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST); } /** @@ -60,7 +60,7 @@ public void setKeyEmptyName() { */ public void setKeyNullType() { setKeyEmptyValueRunner((key) -> { - assertRestException(() -> client.createKey(key.name(), key.keyType()), ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code()); + assertRestException(() -> client.createKey(key.name(), key.keyType()), ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST); }); } @@ -121,7 +121,7 @@ public void getKeySpecificVersion() { * Tests that an attempt to get a non-existing key throws an error. */ public void getKeyNotFound() { - assertRestException(() -> client.getKey("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getKey("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -142,7 +142,7 @@ public void deleteKey() { } public void deleteKeyNotFound() { - assertRestException(() -> client.deleteKey("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.deleteKey("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } @@ -150,7 +150,7 @@ public void deleteKeyNotFound() { * Tests that an attempt to retrieve a non existing deleted key throws an error on a soft-delete enabled vault. */ public void getDeletedKeyNotFound() { - assertRestException(() -> client.getDeletedKey("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getDeletedKey("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } @@ -173,7 +173,7 @@ public void recoverDeletedKey() { * Tests that an attempt to recover a non existing deleted key throws an error on a soft-delete enabled vault. */ public void recoverDeletedKeyNotFound() { - assertRestException(() -> client.recoverDeletedKey("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.recoverDeletedKey("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -192,7 +192,7 @@ public void backupKey() { * Tests that an attempt to backup a non existing key throws an error. */ public void backupKeyNotFound() { - assertRestException(() -> client.backupKey("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.backupKey("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -220,7 +220,7 @@ public void restoreKey() { */ public void restoreKeyFromMalformedBackup() { byte[] keyBackupBytes = "non-existing".getBytes(); - assertRestException(() -> client.restoreKey(keyBackupBytes), ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code()); + assertRestException(() -> client.restoreKey(keyBackupBytes), ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST); } /** diff --git a/sdk/keyvault/azure-keyvault-secrets/README.md b/sdk/keyvault/azure-keyvault-secrets/README.md index 2268426828d9..b455abfa80d7 100644 --- a/sdk/keyvault/azure-keyvault-secrets/README.md +++ b/sdk/keyvault/azure-keyvault-secrets/README.md @@ -306,3 +306,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope [sample_BackupRestoreAsync]: src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java [sample_ManageDeleted]: src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java [sample_ManageDeletedAsync]: src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/keyvault/azure-keyvault-secrets/README.png) diff --git a/sdk/keyvault/azure-keyvault-secrets/pom.xml b/sdk/keyvault/azure-keyvault-secrets/pom.xml index 0c3cf6d4f518..5cdf6bcce2c1 100644 --- a/sdk/keyvault/azure-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-keyvault-secrets/pom.xml @@ -13,7 +13,8 @@ azure-keyvault-secrets 4.0.0-preview.3 - azure-keyvault-secrets + Microsoft Azure client library for KeyVault Secrets + This module contains client library for Microsoft Azure KeyVault Secrets. https://github.com/Azure/azure-sdk-for-java @@ -29,6 +30,10 @@ HEAD + + com.azure.security.keyvault.secrets + + @@ -60,6 +65,12 @@ 1.0.0-preview.4 test + + com.azure + azure-core-http-netty + 1.0.0-preview.4 + test + com.azure diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java index af394d45d880..ff6107644914 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java @@ -159,8 +159,7 @@ Mono> setSecretWithResponse(String name, String value, Context /** * Get the specified secret with specified version from the key vault. The get operation is - * applicable to any secret stored in Azure Key Vault. This operation requires the {@code - * secrets/get} permission. + * applicable to any secret stored in Azure Key Vault. This operation requires the {@code secrets/get} permission. * *

Code Samples

*

Gets a specific version of the secret in the key vault. Subscribes to the call @@ -185,8 +184,7 @@ public Mono getSecret(String name, String version) { /** * Get the specified secret with specified version from the key vault. The get operation is - * applicable to any secret stored in Azure Key Vault. This operation requires the {@code - * secrets/get} permission. + * applicable to any secret stored in Azure Key Vault. This operation requires the {@code secrets/get} permission. * *

Code Samples

*

Gets a specific version of the secret in the key vault. Subscribes to the call @@ -405,7 +403,7 @@ Mono> deleteSecretWithResponse(String name, Context cont *

Gets the deleted secret from the key vault enabled for soft-delete. Subscribes to the call * asynchronously and prints out the * deleted secret details when a response is received.

- *
+     *
      * //Assuming secret is deleted on a soft-delete enabled vault.
      * {@codesnippet com.azure.keyvault.secrets.secretclient.getDeletedSecret#string}
      *
@@ -428,7 +426,7 @@ public Mono getDeletedSecret(String name) {
      * 

Gets the deleted secret from the key vault enabled for soft-delete. Subscribes to the call * asynchronously and prints out the * deleted secret details when a response is received.

- *
+     *
      * //Assuming secret is deleted on a soft-delete enabled vault.
      * {@codesnippet com.azure.keyvault.secrets.secretclient.getDeletedSecretWithResponse#string}
      *
@@ -460,7 +458,7 @@ Mono> getDeletedSecretWithResponse(String name, Context
      * 

Purges the deleted secret from the key vault enabled for soft-delete. Subscribes to the call * asynchronously and prints out the * status code from the server response when a response is received.

- *
+     *
      * //Assuming secret is deleted on a soft-delete enabled vault.
      * {@codesnippet com.azure.keyvault.secrets.secretclient.purgeDeletedSecret#string}
      *
@@ -489,7 +487,7 @@ Mono purgeDeletedSecret(String name, Context context) {
      * 

Code Samples

*

Recovers the deleted secret from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the * recovered secret details when a response is received.

- *
+     *
      * //Assuming secret is deleted on a soft-delete enabled vault.
      * {@codesnippet com.azure.keyvault.secrets.secretclient.recoverDeletedSecret#string}
      *
@@ -510,7 +508,7 @@ public Mono recoverDeletedSecret(String name) {
      * 

Code Samples

*

Recovers the deleted secret from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the * recovered secret details when a response is received.

- *
+     *
      * //Assuming secret is deleted on a soft-delete enabled vault.
      * {@codesnippet com.azure.keyvault.secrets.secretclient.recoverDeletedSecretWithResponse#string}
      *
@@ -539,7 +537,7 @@ Mono> recoverDeletedSecretWithResponse(String name, Context con
      * 

Backs up the secret from the key vault. Subscribes to the call asynchronously and prints out * the * length of the secret's backup byte array returned in the response.

- *
+     *
      * {@codesnippet com.azure.keyvault.secrets.secretclient.backupSecret#string}
      *
      * @param name The name of the secret.
@@ -592,7 +590,7 @@ Mono> backupSecretWithResponse(String name, Context context) {
      * 

Restores the secret in the key vault from its backup. Subscribes to the call asynchronously * and prints out the * restored secret details when a response is received.

- *
+     *
      * //Pass the Secret Backup Byte array to the restore operation.
      * {@codesnippet com.azure.keyvault.secrets.secretclient.restoreSecret#byte}
      *
@@ -613,7 +611,7 @@ public Mono restoreSecret(byte[] backup) {
      * 

Restores the secret in the key vault from its backup. Subscribes to the call asynchronously * and prints out the * restored secret details when a response is received.

- *
+     *
      * //Pass the Secret Backup Byte array to the restore operation.
      * {@codesnippet com.azure.keyvault.secrets.secretclient.restoreSecretWithResponse#byte}
      *
@@ -714,7 +712,7 @@ PagedFlux listDeletedSecrets(Context context) {
      * {@link SecretAsyncClient#listDeletedSecrets()}.
      *
      * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the list operations.
-     * @return A {@link Mono} of {@link PagedResponse} from the next page of results.
+     * @return A {@link Mono} of {@link PagedResponse} that contains {@link DeletedSecret} from the next page of results.
      */
     private Mono> listDeletedSecretsNextPage(String continuationToken, Context context) {
         return service.getDeletedSecrets(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context)
diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java
index 86c25a17ba65..7e1805b0dfb0 100644
--- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java
+++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java
@@ -175,8 +175,7 @@ public Secret getSecret(String name) {
 
     /**
      * Get the specified secret with specified version from the key vault. The get operation is
-     * applicable to any secret stored in Azure Key Vault. This operation requires the {@code
-     * secrets/get} permission.
+     * applicable to any secret stored in Azure Key Vault. This operation requires the {@code secrets/get} permission.
      *
      * 

Code Samples

*

Gets a specific version of the secret in the key vault. Subscribes to the call diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java index ee0049745967..7f67fb75ba26 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java @@ -17,6 +17,7 @@ import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; import java.net.MalformedURLException; import java.net.URL; @@ -52,13 +53,15 @@ */ @ServiceClientBuilder(serviceClients = SecretClient.class) public final class SecretClientBuilder { + private final ClientLogger logger = new ClientLogger(SecretClientBuilder.class); + private final List policies; private TokenCredential credential; private HttpPipeline pipeline; private URL endpoint; private HttpClient httpClient; private HttpLogDetailLevel httpLogDetailLevel; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -108,7 +111,7 @@ public SecretAsyncClient buildAsyncClient() { URL buildEndpoint = getBuildEndpoint(buildConfiguration); if (buildEndpoint == null) { - throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); + throw logger.logExceptionAsError(new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED))); } if (pipeline != null) { @@ -116,7 +119,7 @@ public SecretAsyncClient buildAsyncClient() { } if (credential == null) { - throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED)); + throw logger.logExceptionAsError(new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED))); } // Closest to API goes first, closest to wire goes last. @@ -148,7 +151,7 @@ public SecretClientBuilder endpoint(String endpoint) { try { this.endpoint = new URL(endpoint); } catch (MalformedURLException e) { - throw new IllegalArgumentException("The Azure Key Vault endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Key Vault endpoint url is malformed.")); } return this; } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java b/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java index e06023231cb8..5e99b0b7c4b8 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java @@ -9,10 +9,10 @@ import com.azure.security.keyvault.secrets.models.DeletedSecret; import com.azure.security.keyvault.secrets.models.Secret; import com.azure.security.keyvault.secrets.models.SecretBase; -import io.netty.handler.codec.http.HttpResponseStatus; import org.junit.Assert; import reactor.test.StepVerifier; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -57,7 +57,7 @@ public void setSecret() { */ public void setSecretEmptyName() { StepVerifier.create(client.setSecret("", "A value")) - .verifyErrorSatisfies(ex -> assertRestException(ex, HttpResponseException.class, HttpResponseStatus.METHOD_NOT_ALLOWED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, HttpResponseException.class, HttpURLConnection.HTTP_BAD_METHOD)); } /** @@ -115,7 +115,7 @@ public void updateDisabledSecret() { .verifyComplete(); StepVerifier.create(client.getSecret(original.name())) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.FORBIDDEN.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_FORBIDDEN)); }); } @@ -155,7 +155,7 @@ public void getSecretSpecificVersion() { */ public void getSecretNotFound() { StepVerifier.create(client.getSecret("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } @@ -180,7 +180,7 @@ public void deleteSecret() { StepVerifier.create(client.purgeDeletedSecret(secretToDelete.name())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); }).verifyComplete(); sleepInRecordMode(15000); }); @@ -188,7 +188,7 @@ public void deleteSecret() { public void deleteSecretNotFound() { StepVerifier.create(client.deleteSecret("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -218,7 +218,7 @@ public void getDeletedSecret() { StepVerifier.create(client.purgeDeletedSecret(secretToDeleteAndGet.name())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); }).verifyComplete(); pollOnSecretPurge(secretToDeleteAndGet.name()); sleepInRecordMode(10000); @@ -230,7 +230,7 @@ public void getDeletedSecret() { */ public void getDeletedSecretNotFound() { StepVerifier.create(client.getDeletedSecret("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -261,7 +261,7 @@ public void recoverDeletedSecret() { */ public void recoverDeletedSecretNotFound() { StepVerifier.create(client.recoverDeletedSecret("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -288,7 +288,7 @@ public void backupSecret() { */ public void backupSecretNotFound() { StepVerifier.create(client.backupSecret("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -308,7 +308,7 @@ public void restoreSecret() { StepVerifier.create(client.purgeDeletedSecret(secretToBackupAndRestore.name())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); }).verifyComplete(); pollOnSecretPurge(secretToBackupAndRestore.name()); @@ -329,7 +329,7 @@ public void restoreSecret() { public void restoreSecretFromMalformedBackup() { byte[] secretBackupBytes = "non-existing".getBytes(); StepVerifier.create(client.restoreSecret(secretBackupBytes)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST)); } /** @@ -371,7 +371,7 @@ public void listDeletedSecrets() { for (DeletedSecret deletedSecret : deletedSecrets) { StepVerifier.create(client.purgeDeletedSecret(deletedSecret.name())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); }).verifyComplete(); pollOnSecretPurge(deletedSecret.name()); } @@ -404,7 +404,7 @@ public void listSecretVersions() { StepVerifier.create(client.purgeDeletedSecret(secretName)) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.statusCode()); }).verifyComplete(); pollOnSecretPurge(secretName); }); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java b/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java index 44aae7498858..425b2c8ce1b7 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java @@ -8,8 +8,8 @@ import com.azure.security.keyvault.secrets.models.DeletedSecret; import com.azure.security.keyvault.secrets.models.Secret; import com.azure.security.keyvault.secrets.models.SecretBase; -import io.netty.handler.codec.http.HttpResponseStatus; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.List; @@ -49,7 +49,7 @@ public void setSecret() { * Tests that we cannot create a secret when the secret is an empty string. */ public void setSecretEmptyName() { - assertRestException(() -> client.setSecret("", "A value"), HttpResponseStatus.METHOD_NOT_ALLOWED.code()); + assertRestException(() -> client.setSecret("", "A value"), HttpURLConnection.HTTP_BAD_METHOD); } /** @@ -87,7 +87,7 @@ public void updateSecret() { public void updateDisabledSecret() { updateDisabledSecretRunner((original, updated) -> { assertSecretEquals(original, client.setSecret(original)); - assertRestException(() -> client.getSecret(original.name()), ResourceModifiedException.class, HttpResponseStatus.FORBIDDEN.code()); + assertRestException(() -> client.getSecret(original.name()), ResourceModifiedException.class, HttpURLConnection.HTTP_FORBIDDEN); }); } @@ -117,7 +117,7 @@ public void getSecretSpecificVersion() { * Tests that an attempt to get a non-existing secret throws an error. */ public void getSecretNotFound() { - assertRestException(() -> client.getSecret("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getSecret("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -138,7 +138,7 @@ public void deleteSecret() { } public void deleteSecretNotFound() { - assertRestException(() -> client.deleteSecret("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.deleteSecret("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -165,7 +165,7 @@ public void getDeletedSecret() { * Tests that an attempt to retrieve a non existing deleted secret throws an error on a soft-delete enabled vault. */ public void getDeletedSecretNotFound() { - assertRestException(() -> client.getDeletedSecret("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getDeletedSecret("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } @@ -188,7 +188,7 @@ public void recoverDeletedSecret() { * Tests that an attempt to recover a non existing deleted secret throws an error on a soft-delete enabled vault. */ public void recoverDeletedSecretNotFound() { - assertRestException(() -> client.recoverDeletedSecret("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.recoverDeletedSecret("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -207,7 +207,7 @@ public void backupSecret() { * Tests that an attempt to backup a non existing secret throws an error. */ public void backupSecretNotFound() { - assertRestException(() -> client.backupSecret("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.backupSecret("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -235,7 +235,7 @@ public synchronized void restoreSecret() { */ public void restoreSecretFromMalformedBackup() { byte[] secretBackupBytes = "non-existing".getBytes(); - assertRestException(() -> client.restoreSecret(secretBackupBytes), ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code()); + assertRestException(() -> client.restoreSecret(secretBackupBytes), ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST); } /** diff --git a/sdk/keyvault/ci.data.yml b/sdk/keyvault/ci.data.yml index 9e4f39d24ea6..07c0110593dc 100644 --- a/sdk/keyvault/ci.data.yml +++ b/sdk/keyvault/ci.data.yml @@ -39,17 +39,18 @@ stages: parameters: ServiceDirectory: keyvault Artifacts: - - name: microsoft-azure-keyvault - safeName: microsoftazurekeyvault - - name: microsoft-azure-keyvault-complete - safeName: microsoftazurekeyvaultcomplete - - name: microsoft-azure-keyvault-core - safeName: microsoftazurekeyvaultcore - - name: microsoft-azure-keyvault-cryptography - safeName: microsoftazurekeyvaultcryptography - - name: microsoft-azure-keyvault-extensions - safeName: microsoftazurekeyvaultextensions - - name: microsoft-azure-keyvault-test - safeName: microsoftazurekeyvaulttest - - name: microsoft-azure-keyvault-webkey - safeName: microsoftazurekeyvaultwebkey \ No newline at end of file + - name: azure-keyvault + safeName: azurekeyvault + stagingProfileId: 534d15ee3800f4 + - name: azure-keyvault-core + safeName: azurekeyvaultcore + stagingProfileId: 534d15ee3800f4 + - name: azure-keyvault-cryptography + safeName: azurekeyvaultcryptography + stagingProfileId: 534d15ee3800f4 + - name: azure-keyvault-extensions + safeName: azurekeyvaultextensions + stagingProfileId: 534d15ee3800f4 + - name: azure-keyvault-webkey + safeName: azurekeyvaultwebkey + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/keyvault/ci.yml b/sdk/keyvault/ci.yml index e7f355a992a5..bae1f4b75825 100644 --- a/sdk/keyvault/ci.yml +++ b/sdk/keyvault/ci.yml @@ -40,5 +40,7 @@ stages: Artifacts: - name: azure-keyvault-keys safeName: azurekeyvaultkeys + stagingProfileId: 88192f04117501 - name: azure-keyvault-secrets - safeName: azurekeyvaultsecrets \ No newline at end of file + safeName: azurekeyvaultsecrets + stagingProfileId: 88192f04117501 diff --git a/sdk/keyvault/microsoft-azure-keyvault-complete/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-complete/pom.xml index 52b486d560c3..434d7b11e2c3 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-complete/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-complete/pom.xml @@ -7,13 +7,13 @@ the MIT License. See License.txt in the project root for license information. -- com.microsoft.azure azure-keyvault-parent - 1.2.1 + 1.2.2 ../pom.data.xml com.microsoft.azure azure-keyvault-complete - 1.2.1 + 1.2.2 pom Microsoft Azure Key Vault SDK Complete diff --git a/sdk/keyvault/microsoft-azure-keyvault-core/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-core/pom.xml index ac37e02c8f65..dfb744179298 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-core/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-core/pom.xml @@ -8,13 +8,13 @@ com.microsoft.azure azure-keyvault-parent - 1.2.1 + 1.2.2 ../pom.data.xml com.microsoft.azure azure-keyvault-core - 1.2.1 + 1.2.2 jar Microsoft Azure SDK for Key Vault Core diff --git a/sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml index b89291571a57..3399695e1662 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml @@ -7,13 +7,13 @@ com.microsoft.azure azure-keyvault-parent - 1.2.1 + 1.2.2 ../pom.data.xml com.microsoft.azure azure-keyvault-cryptography - 1.2.1 + 1.2.2 jar Microsoft Azure SDK for Key Vault Cryptography diff --git a/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/RsaKey.java b/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/RsaKey.java index b90257e04b85..d8226d502485 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/RsaKey.java +++ b/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/RsaKey.java @@ -88,7 +88,9 @@ public RsaKey(String kid, int keySize, Provider provider) throws NoSuchAlgorithm throw new IllegalArgumentException("kid"); } - final KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", provider); + final KeyPairGenerator generator; + + generator = provider == null ? KeyPairGenerator.getInstance("RSA") : KeyPairGenerator.getInstance("RSA", provider); generator.initialize(keySize); diff --git a/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/test/java/com/microsoft/azure/keyvault/cryptography/test/RsaKeyTest.java b/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/test/java/com/microsoft/azure/keyvault/cryptography/test/RsaKeyTest.java index 17d6c39a5f0c..5c46bf9c3a64 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/test/java/com/microsoft/azure/keyvault/cryptography/test/RsaKeyTest.java +++ b/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/test/java/com/microsoft/azure/keyvault/cryptography/test/RsaKeyTest.java @@ -19,6 +19,7 @@ import org.junit.Test; import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.security.Provider; import static org.junit.Assert.assertArrayEquals; @@ -56,6 +57,13 @@ protected void setProvider(Provider provider) { this.provider = provider; } + @Test + public void testRsaKeyEmptyConstructor() throws NoSuchAlgorithmException { + RsaKey key = new RsaKey(); + + assertNotNull(key); + } + @Test public void testRsa15() throws Exception { diff --git a/sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml index 40eb0fbb486a..2b830a09fab1 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml @@ -8,12 +8,12 @@ com.microsoft.azure azure-keyvault-parent - 1.2.1 + 1.2.2 ../pom.data.xml azure-keyvault-extensions - 1.2.1 + 1.2.2 jar Microsoft Azure SDK for Key Vault Extensions diff --git a/sdk/keyvault/microsoft-azure-keyvault-test/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-test/pom.xml index f8dd24695ff9..f844b102f633 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-test/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-test/pom.xml @@ -6,7 +6,7 @@ com.microsoft.azure azure-keyvault-parent - 1.2.1 + 1.2.2 ../pom.data.xml azure-keyvault-test diff --git a/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java b/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java index f508cfa07f74..b96b62d4a7ec 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java +++ b/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java @@ -23,6 +23,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -110,21 +111,25 @@ public void beforeMethod() throws Exception { } @Test + @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993") public void testSignVerifyIntegrationES256() throws Exception { validateSignVerifyInterop(importTestKey("itwkk-p256", P256TestKey()), JsonWebKeySignatureAlgorithm.ES256, "SHA-256"); } @Test + @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993") public void testSignVerifyIntegrationES256K() throws Exception { validateSignVerifyInterop(importTestKey("itwkk-p256k", P256KTestKey()), JsonWebKeySignatureAlgorithm.ES256K, "SHA-256"); } @Test + @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993") public void testSignVerifyIntegrationES384() throws Exception { validateSignVerifyInterop(importTestKey("itwkk-p384", P384TestKey()), JsonWebKeySignatureAlgorithm.ES384, "SHA-384"); } @Test + @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993") public void testSignVerifyIntegrationES521() throws Exception { validateSignVerifyInterop(importTestKey("itwkk-p521", P521TestKey()), JsonWebKeySignatureAlgorithm.ES512, "SHA-512"); } diff --git a/sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml index f79a9cda82ce..729d456ca0c9 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml @@ -6,12 +6,12 @@ com.microsoft.azure azure-keyvault-parent - 1.2.1 + 1.2.2 ../pom.data.xml azure-keyvault-webkey - 1.2.1 + 1.2.2 jar Microsoft Azure SDK for Key Vault WebKey diff --git a/sdk/keyvault/microsoft-azure-keyvault/pom.xml b/sdk/keyvault/microsoft-azure-keyvault/pom.xml index 482acf233fe3..b85b0f9a35c4 100644 --- a/sdk/keyvault/microsoft-azure-keyvault/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault/pom.xml @@ -6,13 +6,13 @@ the MIT License. See License.txt in the project root for license information. -- com.microsoft.azure azure-keyvault-parent - 1.2.1 + 1.2.2 ../pom.data.xml com.microsoft.azure azure-keyvault - 1.2.1 + 1.2.2 jar Microsoft Azure SDK for Key Vault diff --git a/sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java b/sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java index 116a5f9741b4..c16cdd53beaa 100644 --- a/sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java +++ b/sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java @@ -68,12 +68,15 @@ public Response intercept(Chain chain) throws IOException { // response response = chain.proceed(buildEmptyRequest(originalRequest)); - if (response.code() == 200) { + if (response.code() != 401) { return response; - } else if (response.code() != 401) { - throw new IOException("Unexpected unauthorized response."); } - authenticatedRequestPair = buildAuthenticatedRequest(originalRequest, response); + + try { + authenticatedRequestPair = buildAuthenticatedRequest(originalRequest, response); + } finally { + response.close(); + } } response = chain.proceed(authenticatedRequestPair.getLeft()); diff --git a/sdk/keyvault/pom.data.xml b/sdk/keyvault/pom.data.xml index 9c56b7e65079..06d5aa4892cc 100644 --- a/sdk/keyvault/pom.data.xml +++ b/sdk/keyvault/pom.data.xml @@ -13,7 +13,7 @@ ../../pom.data.xml - 1.2.1 + 1.2.2 com.microsoft.azure azure-keyvault-parent pom @@ -34,7 +34,7 @@ - 1.2.1 + 1.2.2 diff --git a/sdk/keyvault/pom.service.xml b/sdk/keyvault/pom.service.xml index 956a21dfe3d7..0c37ff936e38 100644 --- a/sdk/keyvault/pom.service.xml +++ b/sdk/keyvault/pom.service.xml @@ -1,30 +1,48 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.azure azure-keyvault-service pom - 1.0.0 - - - - microsoft-azure-keyvault - microsoft-azure-keyvault-core - microsoft-azure-keyvault-webkey - microsoft-azure-keyvault-cryptography - microsoft-azure-keyvault-extensions - microsoft-azure-keyvault-complete - - - ../core/azure-core - ../core/azure-core-test - ../identity/azure-identity - azure-keyvault-keys - azure-keyvault-secrets - - + 1.0.0 + + + data + + + env.SDKTYPE + data + + + + microsoft-azure-keyvault + microsoft-azure-keyvault-complete + microsoft-azure-keyvault-core + microsoft-azure-keyvault-cryptography + microsoft-azure-keyvault-extensions + microsoft-azure-keyvault-test + microsoft-azure-keyvault-webkey + + + + client + + + env.SDKTYPE + !data + + + + ../core/azure-core + ../core/azure-core-test + ../core/azure-core-http-netty + ../identity/azure-identity + azure-keyvault-keys + azure-keyvault-secrets + + + diff --git a/sdk/loganalytics/ci.yml b/sdk/loganalytics/ci.yml index a115776c40a5..dee0eac01eca 100644 --- a/sdk/loganalytics/ci.yml +++ b/sdk/loganalytics/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/loganalytics/ @@ -13,11 +22,18 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/loganalytics/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: loganalytics \ No newline at end of file + ServiceDirectory: loganalytics + Artifacts: + - name: azure-loganalytics + safeName: azureloganalytics + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/mediaservices/ci.yml b/sdk/mediaservices/ci.yml index 92324f882498..56f0e05424b5 100644 --- a/sdk/mediaservices/ci.yml +++ b/sdk/mediaservices/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/mediaservices/ @@ -13,11 +22,18 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/mediaservices/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: mediaservices \ No newline at end of file + ServiceDirectory: mediaservices + Artifacts: + - name: azure-media + safeName: azuremedia + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/servicebus/README.md b/sdk/servicebus/README.md index c580edc8dd09..5b8c0a7720f2 100644 --- a/sdk/servicebus/README.md +++ b/sdk/servicebus/README.md @@ -92,3 +92,5 @@ To use a proxy for unit tests, set an environment variable `RUN_WITH_PROXY` to ` 8. Go to environment and add above mentioned environment variable and the regarding connection string. 9. Click "Apply" and then "Run" 10. You should have a new view next to the package explorer called JUnit showing the running tests and see Console outputs depending on which test currently runs. If you do not see the JUnit tab go to Window > Show view > Other... > Java > JUnit + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/servicebus/README.png) \ No newline at end of file diff --git a/sdk/servicebus/ci.yml b/sdk/servicebus/ci.yml index 9b84c113c711..4e1fcf71ab73 100644 --- a/sdk/servicebus/ci.yml +++ b/sdk/servicebus/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: servicebus Artifacts: - name: azure-servicebus - safeName: azureservicebus \ No newline at end of file + safeName: azureservicebus + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/servicebus/microsoft-azure-servicebus/pom.xml b/sdk/servicebus/microsoft-azure-servicebus/pom.xml index cc730397c06e..209ca5425ffe 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/pom.xml +++ b/sdk/servicebus/microsoft-azure-servicebus/pom.xml @@ -6,7 +6,7 @@ 4.0.0 com.microsoft.azure azure-servicebus - 2.0.0 + 3.1.0 Microsoft Azure SDK for Service Bus Java library for Azure Service Bus diff --git a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/AzureActiveDirectoryTokenProvider.java b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/AzureActiveDirectoryTokenProvider.java index 5224bf034e99..eb65977e7431 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/AzureActiveDirectoryTokenProvider.java +++ b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/AzureActiveDirectoryTokenProvider.java @@ -3,6 +3,9 @@ package com.microsoft.azure.servicebus.security; +import java.text.ParseException; +import java.time.Instant; +import java.util.Date; import java.util.concurrent.CompletableFuture; /** @@ -24,7 +27,17 @@ public class AzureActiveDirectoryTokenProvider extends TokenProvider { @Override public CompletableFuture getSecurityTokenAsync(String audience) { - return this.authCallback.acquireTokenAsync(audience, this.authority, this.authCallbackState); + CompletableFuture tokenStringFuture = this.authCallback.acquireTokenAsync( + SecurityConstants.SERVICEBUS_AAD_AUDIENCE_RESOURCE_URL, this.authority, this.authCallbackState); + return tokenStringFuture.thenApply(tokenString -> { + Date expire; + try { + expire = SecurityToken.getExpirationDateTimeUtcFromToken(tokenString); + return new SecurityToken(SecurityTokenType.JWT, audience, tokenString, Instant.now(), expire == null ? null : expire.toInstant()); + } catch (ParseException e) { + throw new RuntimeException(e); + } + }); } @FunctionalInterface @@ -36,6 +49,6 @@ public interface AuthenticationCallback { * @param state Parameter that may be used as part of the custom acquireToken process. * @return A CompletableFuture which returns a valid security token. */ - CompletableFuture acquireTokenAsync(String audience, String authority, Object state); + CompletableFuture acquireTokenAsync(String audience, String authority, Object state); } } diff --git a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/ManagedIdentityTokenProvider.java b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/ManagedIdentityTokenProvider.java index 28040a714d68..c1fd698084af 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/ManagedIdentityTokenProvider.java +++ b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/ManagedIdentityTokenProvider.java @@ -14,9 +14,6 @@ import com.microsoft.azure.credentials.MSICredentials; import com.microsoft.azure.servicebus.primitives.MessagingFactory; -import com.nimbusds.jwt.JWT; -import com.nimbusds.jwt.JWTClaimsSet; -import com.nimbusds.jwt.JWTParser; /** * This is a token provider that obtains token using Managed Identity(MI). This token provider automatically detects MI settings. @@ -33,7 +30,7 @@ public CompletableFuture getSecurityTokenAsync(String audience) { try { MSICredentials credentials = new MSICredentials(); String rawToken = credentials.getToken(SecurityConstants.SERVICEBUS_AAD_AUDIENCE_RESOURCE_URL); - Date expiry = getExpirationDateTimeUtcFromToken(rawToken); + Date expiry = SecurityToken.getExpirationDateTimeUtcFromToken(rawToken); tokenGeneratingFuture.complete(new SecurityToken(SecurityTokenType.JWT, audience, rawToken, Instant.now(), expiry.toInstant())); } catch (IOException e) { TRACE_LOGGER.error("ManagedIdentity token generation failed.", e); @@ -46,10 +43,4 @@ public CompletableFuture getSecurityTokenAsync(String audience) { return tokenGeneratingFuture; } - - private static Date getExpirationDateTimeUtcFromToken(String token) throws ParseException { - JWT jwt = JWTParser.parse(token); - JWTClaimsSet claims = jwt.getJWTClaimsSet(); - return claims.getExpirationTime(); - } } diff --git a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/SecurityToken.java b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/SecurityToken.java index 094a0e071101..abedf0f3046b 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/SecurityToken.java +++ b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/SecurityToken.java @@ -3,7 +3,13 @@ package com.microsoft.azure.servicebus.security; +import java.text.ParseException; import java.time.Instant; +import java.util.Date; + +import com.nimbusds.jwt.JWT; +import com.nimbusds.jwt.JWTClaimsSet; +import com.nimbusds.jwt.JWTParser; /** * This class encapsulates the details of a security token. @@ -73,4 +79,10 @@ public Instant getValidFrom() { public Instant getValidUntil() { return this.validUntil; } + + static Date getExpirationDateTimeUtcFromToken(String token) throws ParseException { + JWT jwt = JWTParser.parse(token); + JWTClaimsSet claims = jwt.getJWTClaimsSet(); + return claims.getExpirationTime(); + } } diff --git a/sdk/servicebus/microsoft-azure-servicebus/src/test/java/com/microsoft/azure/servicebus/security/AadTokenProviderTests.java b/sdk/servicebus/microsoft-azure-servicebus/src/test/java/com/microsoft/azure/servicebus/security/AadTokenProviderTests.java index b4045686546b..713e930b3c22 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/src/test/java/com/microsoft/azure/servicebus/security/AadTokenProviderTests.java +++ b/sdk/servicebus/microsoft-azure-servicebus/src/test/java/com/microsoft/azure/servicebus/security/AadTokenProviderTests.java @@ -14,17 +14,26 @@ import com.microsoft.azure.servicebus.security.AzureActiveDirectoryTokenProvider.AuthenticationCallback; public class AadTokenProviderTests { - private static final SecurityToken TEST_TOKEN = new SecurityToken(SecurityTokenType.JWT, "testAudience", "tokenString", Instant.now(), Instant.MAX); - + @Test public void aadCallbackTokenProviderTest() { - AuthenticationCallback callback = (String audience, String authority, Object state) -> CompletableFuture.completedFuture(TEST_TOKEN); - TokenProvider tokenProvider = TokenProvider.createAzureActiveDirectoryTokenProvider(callback, "https://login.microsoftonline.com/common", null); - assertEquals(TEST_TOKEN, tokenProvider.getSecurityTokenAsync("testAudience").join()); + String TEST_TOKEN = "eyJhbGciOiJIUzI1NiJ9.e30.ZRrHA1JJJW8opsbCGfG_HACGpVUMN_a9IV7pAx_Zmeo"; + String TEST_AUDIENCE = "testAudience"; + String TEST_AUTHORITY = "https://login.microsoftonline.com/common"; + + AuthenticationCallback callback = (String audience, String authority, Object state) -> { + assertEquals(SecurityConstants.SERVICEBUS_AAD_AUDIENCE_RESOURCE_URL, audience); + assertEquals(TEST_AUTHORITY, authority); + return CompletableFuture.completedFuture(TEST_TOKEN); + }; + TokenProvider tokenProvider = TokenProvider.createAzureActiveDirectoryTokenProvider(callback, TEST_AUTHORITY, null); + SecurityToken token = tokenProvider.getSecurityTokenAsync(TEST_AUDIENCE).join(); + assertEquals(TEST_TOKEN, token.getTokenValue()); + assertEquals(TEST_AUDIENCE, token.getTokenAudience()); // Should throw when null callback is provided TestUtils.assertThrows(IllegalArgumentException.class, () -> { - TokenProvider.createAzureActiveDirectoryTokenProvider(null, "https://login.microsoftonline.com/common", null); + TokenProvider.createAzureActiveDirectoryTokenProvider(null, TEST_AUTHORITY, null); }); // Should throw when null authority is provided diff --git a/sdk/storage/azure-storage-blob/README.md b/sdk/storage/azure-storage-blob/README.md index d744b797d538..71e905516af8 100644 --- a/sdk/storage/azure-storage-blob/README.md +++ b/sdk/storage/azure-storage-blob/README.md @@ -283,3 +283,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ [coc_contact]: mailto:opencode@microsoft.com + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/storage/azure-storage-blob/README.png) diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml index 59e986439e6d..cb8eb97de5d1 100644 --- a/sdk/storage/azure-storage-blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -15,7 +15,8 @@ azure-storage-blob 12.0.0-preview.3 - azure-storage-blob + Microsoft Azure client library for Blob Storage + This module contains client library for Microsoft Azure Blob Storage. https://github.com/Azure/azure-sdk-for-java @@ -31,6 +32,10 @@ HEAD + + com.azure.storage.blob + + bintray @@ -79,13 +84,13 @@ com.azure - azure-identity - 1.0.0-preview.3 - test + azure-core-http-netty + 1.0.0-preview.4 - junit - junit + com.azure + azure-identity + 1.0.0-preview.3 test @@ -113,11 +118,6 @@ cglib-nodep test - - uk.org.lidalia - slf4j-test - test - diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java index 4af9f970ff64..cadb89defbd7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java @@ -40,8 +40,7 @@ public AccountSASPermission() { * Creates an {@code AccountSASPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString - * A {@code String} which represents the {@code SharedAccessAccountPermissions}. + * @param permString A {@code String} which represents the {@code SharedAccessAccountPermissions}. * * @return An {@code AccountSASPermission} object generated from the given {@code String}. * @throws IllegalArgumentException If {@code permString} contains a character other than r, w, d, l, a, c, u, or p. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java index a91abf917501..1d9f34352f66 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java @@ -30,8 +30,7 @@ public AccountSASResourceType() { * Creates an {@code AccountSASResourceType} from the specified resource types string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid resource type. * - * @param resourceTypesString - * A {@code String} which represents the {@code AccountSASResourceTypes}. + * @param resourceTypesString A {@code String} which represents the {@code AccountSASResourceTypes}. * * @return A {@code AccountSASResourceType} generated from the given {@code String}. * @throws IllegalArgumentException If {@code resourceTypesString} contains a character other than s, c, or o. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASService.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASService.java index 9fbb9137bcbd..d946fa0c1062 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASService.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASService.java @@ -32,8 +32,7 @@ public AccountSASService() { * Creates an {@code AccountSASService} from the specified services string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid service. * - * @param servicesString - * A {@code String} which represents the {@code SharedAccessAccountServices}. + * @param servicesString A {@code String} which represents the {@code SharedAccessAccountServices}. * * @return A {@code AccountSASService} generated from the given {@code String}. * @throws IllegalArgumentException If {@code servicesString} contains a character other than b, f, q, or t. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java index 50e00f0bfafc..7cb00c33f900 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java @@ -211,8 +211,7 @@ public AccountSASSignatureValues resourceTypes(String resourceTypes) { * Generates a {@link SASQueryParameters} object which contains all SAS query parameters needed to make an actual * REST request. * - * @param sharedKeyCredentials - * Credentials for the storage account and corresponding primary or secondary key. + * @param sharedKeyCredentials Credentials for the storage account and corresponding primary or secondary key. * * @return {@link SASQueryParameters} * @throws RuntimeException If the HMAC-SHA256 signature for {@code sharedKeyCredentials} fails to generate. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java index 9cf6c224c0d3..306f728d44a5 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java @@ -5,6 +5,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.AppendBlobAccessConditions; @@ -15,13 +16,14 @@ import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.common.Constants; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.URL; +import java.nio.ByteBuffer; import static com.azure.storage.blob.PostProcessor.postProcessResponse; +import static com.azure.core.implementation.util.FluxUtil.withContext; /** @@ -69,34 +71,31 @@ public final class AppendBlobAsyncClient extends BlobAsyncClient { /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * - * @return - * A reactive response containing the information of the created appended blob. + * @return A {@link Mono} containing the information of the created appended blob. */ - public Mono> create() { - return this.create(null, null, null); + public Mono create() { + return createWithResponse(null, null, null).flatMap(FluxUtil::toMono); } /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} * - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * - * @return - * A reactive response containing the information of the created appended blob. + * @return A {@link Mono} containing {@link Response} whose {@link Response#value() value} contains the created appended blob. */ - public Mono> create(BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions) { + public Mono> createWithResponse(BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions) { + return withContext(context -> createWithResponse(headers, metadata, accessConditions, context)); + } + + Mono> createWithResponse(BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Context context) { metadata = (metadata == null) ? new Metadata() : metadata; accessConditions = (accessConditions == null) ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.appendBlobs().createWithRestResponseAsync(null, - null, 0, null, metadata, null, null, - null, null, headers, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) + null, 0, null, metadata, null, headers, accessConditions.leaseAccessConditions(), null, + accessConditions.modifiedAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders()))); } @@ -105,19 +104,15 @@ public Mono> create(BlobHTTPHeaders headers, Metadata m *

* Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled + * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. + * @param length The exact length of the data. It is important that this value match precisely the length of the data + * emitted by the {@code Flux}. * - * @return - * A reactive response containing the information of the append blob operation. + * @return {@link Mono} containing the information of the append blob operation. */ - public Mono> appendBlock(Flux data, long length) { - return this.appendBlock(data, length, null); + public Mono appendBlock(Flux data, long length) { + return appendBlockWithResponse(data, length, null).flatMap(FluxUtil::toMono); } /** @@ -125,86 +120,81 @@ public Mono> appendBlock(Flux data, long lengt *

* Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled + * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param length The exact length of the data. It is important that this value match precisely the length of the data * emitted by the {@code Flux}. - * @param appendBlobAccessConditions - * {@link AppendBlobAccessConditions} + * @param appendBlobAccessConditions {@link AppendBlobAccessConditions} * - * @return - * A reactive response containing the information of the append blob operation. + * @return A {@link Mono} containing {@link Response} whose {@link Response#value() value} contains the append blob operation. */ - public Mono> appendBlock(Flux data, long length, - AppendBlobAccessConditions appendBlobAccessConditions) { + public Mono> appendBlockWithResponse(Flux data, long length, + AppendBlobAccessConditions appendBlobAccessConditions) { + return withContext(context -> appendBlockWithResponse(data, length, appendBlobAccessConditions, context)); + } + + Mono> appendBlockWithResponse(Flux data, long length, + AppendBlobAccessConditions appendBlobAccessConditions, Context context) { appendBlobAccessConditions = appendBlobAccessConditions == null ? new AppendBlobAccessConditions() : appendBlobAccessConditions; return postProcessResponse(this.azureBlobStorage.appendBlobs().appendBlockWithRestResponseAsync( - null, null, data, length, null, null, - null, null, null, null, + null, null, data, length, null, null, null, null, appendBlobAccessConditions.leaseAccessConditions(), - appendBlobAccessConditions.appendPositionAccessConditions(), - appendBlobAccessConditions.modifiedAccessConditions(), Context.NONE)) + appendBlobAccessConditions.appendPositionAccessConditions(), null, + appendBlobAccessConditions.modifiedAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders()))); + } /** * Commits a new block of data from another blob to the end of this append blob. - * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob * must either be public or must be authenticated via a shared access signature. If the source blob is * public, no authentication is required to perform the operation. - * @param sourceRange - * The source {@link BlobRange} to copy. + * @param sourceRange The source {@link BlobRange} to copy. * - * @return - * A reactive response containing the information of the append blob operation. + * @return {@link Mono} containing the information of the append blob operation. */ - public Mono> appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { - return this.appendBlockFromUrl(sourceURL, sourceRange, null, null, - null); + public Mono appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { + return appendBlockFromUrlWithResponse(sourceURL, sourceRange, null, null, null).flatMap(FluxUtil::toMono); } /** * Commits a new block of data from another blob to the end of this append blob. - * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob * must either be public or must be authenticated via a shared access signature. If the source blob is * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 + * @param sourceRange {@link BlobRange} + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link AppendBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} + * @param destAccessConditions {@link AppendBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} * - * @return - * A reactive response containing the information of the append blob operation. + * @return A {@link Mono} containing {@link Response} whose {@link Response#value() value} contains the append blob operation. */ - public Mono> appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, - byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions) { + public Mono> appendBlockFromUrlWithResponse(URL sourceURL, BlobRange sourceRange, + byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions) { + return withContext(context -> appendBlockFromUrlWithResponse(sourceURL, sourceRange, sourceContentMD5, + destAccessConditions, sourceAccessConditions, context)); + } + + Mono> appendBlockFromUrlWithResponse(URL sourceURL, BlobRange sourceRange, + byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions, Context context) { sourceRange = sourceRange == null ? new BlobRange(0) : sourceRange; destAccessConditions = destAccessConditions == null ? new AppendBlobAccessConditions() : destAccessConditions; return postProcessResponse( this.azureBlobStorage.appendBlobs().appendBlockFromUrlWithRestResponseAsync(null, null, - sourceURL, 0, sourceRange.toString(), sourceContentMD5, null, null, + sourceURL, 0, sourceRange.toString(), sourceContentMD5, null, null, null, null, null, destAccessConditions.leaseAccessConditions(), destAccessConditions.appendPositionAccessConditions(), - destAccessConditions.modifiedAccessConditions(), sourceAccessConditions, Context.NONE)) + destAccessConditions.modifiedAccessConditions(), sourceAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders()))); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java index cacb5e0c30ed..5945decda112 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java @@ -4,6 +4,7 @@ package com.azure.storage.blob; import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; import com.azure.storage.blob.models.AppendBlobAccessConditions; import com.azure.storage.blob.models.AppendBlobItem; import com.azure.storage.blob.models.BlobAccessConditions; @@ -11,15 +12,15 @@ import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.SourceModifiedAccessConditions; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.common.Utility; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import java.io.InputStream; import java.net.URL; +import java.nio.ByteBuffer; import java.time.Duration; @@ -39,7 +40,7 @@ * for more information. */ public final class AppendBlobClient extends BlobClient { - private AppendBlobAsyncClient appendBlobAsyncClient; + private final AppendBlobAsyncClient appendBlobAsyncClient; /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. @@ -66,8 +67,7 @@ public final class AppendBlobClient extends BlobClient { * * @return A {@link BlobOutputStream} object used to write data to the blob. * - * @throws StorageException - * If a storage service error occurred. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream() { return getBlobOutputStream(null); @@ -77,46 +77,54 @@ public BlobOutputStream getBlobOutputStream() { * Creates and opens an output stream to write data to the append blob. If the blob already exists on the service, * it will be overwritten. * - * @param accessConditions - * A {@link BlobAccessConditions} object that represents the access conditions for the blob. + * @param accessConditions A {@link BlobAccessConditions} object that represents the access conditions for the blob. * * @return A {@link BlobOutputStream} object used to write data to the blob. * - * @throws StorageException - * If a storage service error occurred. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream(AppendBlobAccessConditions accessConditions) { - return new BlobOutputStream(appendBlobAsyncClient, accessConditions); + return BlobOutputStream.appendBlobOutputStream(appendBlobAsyncClient, accessConditions); } /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * - * @return - * The information of the created appended blob. + * @return The information of the created appended blob. */ - public Response create() { - return this.create(null, null, null, null); + public AppendBlobItem create() { + return create(null, null, null, null); } /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the created appended blob. + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * + * @return The information of the created appended blob. */ - public Response create(BlobHTTPHeaders headers, Metadata metadata, + public AppendBlobItem create(BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = appendBlobAsyncClient.create(headers, metadata, accessConditions); + return createWithResponse(headers, metadata, accessConditions, timeout, Context.NONE).value(); + } + + /** + * Creates a 0-length append blob. Call appendBlock to append data to an append blob. + * + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return A {@link Response} whose {@link Response#value() value} contains the created appended blob. + */ + public Response createWithResponse(BlobHTTPHeaders headers, Metadata metadata, + BlobAccessConditions accessConditions, Duration timeout, Context context) { + Mono> response = appendBlobAsyncClient.createWithResponse(headers, metadata, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -126,17 +134,14 @@ public Response create(BlobHTTPHeaders headers, Metadata metadat * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @param data - * The data to write to the blob. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param data The data to write to the blob. + * @param length The exact length of the data. It is important that this value match precisely the length of the data * emitted by the {@code Flux}. * - * @return - * The information of the append blob operation. + * @return The information of the append blob operation. */ - public Response appendBlock(InputStream data, long length) { - return this.appendBlock(data, length, null, null); + public AppendBlobItem appendBlock(InputStream data, long length) { + return appendBlockWithResponse(data, length, null, null, Context.NONE).value(); } /** @@ -145,23 +150,19 @@ public Response appendBlock(InputStream data, long length) { * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled + * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param length The exact length of the data. It is important that this value match precisely the length of the data * emitted by the {@code Flux}. - * @param appendBlobAccessConditions - * {@link AppendBlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param appendBlobAccessConditions {@link AppendBlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * - * @return - * The information of the append blob operation. + * @return A {@link Response} whose {@link Response#value() value} contains the append blob operation. */ - public Response appendBlock(InputStream data, long length, - AppendBlobAccessConditions appendBlobAccessConditions, Duration timeout) { - Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) MAX_APPEND_BLOCK_BYTES)) + public Response appendBlockWithResponse(InputStream data, long length, + AppendBlobAccessConditions appendBlobAccessConditions, Duration timeout, Context context) { + Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) MAX_APPEND_BLOCK_BYTES)) .map(i -> i * MAX_APPEND_BLOCK_BYTES) .concatMap(pos -> Mono.fromCallable(() -> { long count = pos + MAX_APPEND_BLOCK_BYTES > length ? length - pos : MAX_APPEND_BLOCK_BYTES; @@ -171,59 +172,71 @@ public Response appendBlock(InputStream data, long length, read += data.read(cache, read, (int) count - read); } - return ByteBufAllocator.DEFAULT.buffer((int) count).writeBytes(cache); + return ByteBuffer.wrap(cache); })); - Mono> response = appendBlobAsyncClient.appendBlock(fbb.subscribeOn(Schedulers.elastic()), length, appendBlobAccessConditions); + Mono> response = appendBlobAsyncClient.appendBlockWithResponse(fbb.subscribeOn(Schedulers.elastic()), length, appendBlobAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * Commits a new block of data from another blob to the end of this append blob. * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob * must either be public or must be authenticated via a shared access signature. If the source blob is * public, no authentication is required to perform the operation. - * @param sourceRange - * The source {@link BlobRange} to copy. + * @param sourceRange The source {@link BlobRange} to copy. * - * @return - * The information of the append blob operation. + * @return The information of the append blob operation. */ - public Response appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { - return this.appendBlockFromUrl(sourceURL, sourceRange, null, null, - null, null); + public AppendBlobItem appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { + return appendBlockFromUrl(sourceURL, sourceRange, null, null, null, null); } /** * Commits a new block of data from another blob to the end of this append blob. * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob * must either be public or must be authenticated via a shared access signature. If the source blob is * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 + * @param sourceRange {@link BlobRange} + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link AppendBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the append blob operation. + * @param destAccessConditions {@link AppendBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * + * @return The information of the append blob operation. */ - public Response appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, + public AppendBlobItem appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, SourceModifiedAccessConditions sourceAccessConditions, Duration timeout) { - Mono> response = appendBlobAsyncClient.appendBlockFromUrl(sourceURL, sourceRange, sourceContentMD5, destAccessConditions, sourceAccessConditions); + return this.appendBlockFromUrlWithResponse(sourceURL, sourceRange, sourceContentMD5, destAccessConditions, sourceAccessConditions, timeout, Context.NONE).value(); + } + + /** + * Commits a new block of data from another blob to the end of this append blob. + * + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can + * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is + * public, no authentication is required to perform the operation. + * @param sourceRange {@link BlobRange} + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 + * of the received data and fail the request if it does not match the provided MD5. + * @param destAccessConditions {@link AppendBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return The information of the append blob operation. + */ + public Response appendBlockFromUrlWithResponse(URL sourceURL, BlobRange sourceRange, + byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions, Duration timeout, Context context) { + Mono> response = appendBlobAsyncClient.appendBlockFromUrlWithResponse(sourceURL, sourceRange, sourceContentMD5, destAccessConditions, sourceAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java index b4a5e38668c6..33df9e4c9371 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java @@ -10,9 +10,11 @@ import com.azure.core.implementation.http.UrlBuilder; import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.AccessTierRequired; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlobRange; @@ -24,13 +26,13 @@ import com.azure.storage.blob.models.ReliableDownloadOptions; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Constants; import com.azure.storage.common.IPRange; import com.azure.storage.common.SASProtocol; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SharedKeyCredential; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; @@ -49,6 +51,7 @@ import java.util.List; import static com.azure.storage.blob.PostProcessor.postProcessResponse; +import static com.azure.core.implementation.util.FluxUtil.withContext; /** * Client to a blob of any type: block, append, or page. It may only be instantiated through a {@link BlobClientBuilder} @@ -79,6 +82,8 @@ public class BlobAsyncClient { private static final int BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; private static final int BLOB_MAX_DOWNLOAD_BLOCK_SIZE = 100 * Constants.MB; + private final ClientLogger logger = new ClientLogger(BlobAsyncClient.class); + final AzureBlobStorageImpl azureBlobStorage; protected final String snapshot; @@ -173,7 +178,7 @@ public URL getBlobUrl() { } return urlBuilder.toURL(); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e)); } } @@ -186,8 +191,25 @@ public URL getBlobUrl() { * * @return true if the blob exists, false if it doesn't */ - public Mono> exists() { - return this.getProperties() + public Mono exists() { + return existsWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Determines if the blob this client represents exists in the cloud. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.existsWithResponse} + * + * @return true if the blob exists, false if it doesn't + */ + public Mono> existsWithResponse() { + return withContext(context -> existsWithResponse(context)); + } + + Mono> existsWithResponse(Context context) { + return this.getPropertiesWithResponse(null, context) .map(cp -> (Response) new SimpleResponse<>(cp, true)) .onErrorResume(t -> t instanceof StorageException && ((StorageException) t).statusCode() == 404, t -> { HttpResponse response = ((StorageException) t).response(); @@ -208,8 +230,8 @@ public Mono> exists() { * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @return A reactive response containing the copy ID for the long running operation. */ - public Mono> startCopyFromURL(URL sourceURL) { - return this.startCopyFromURL(sourceURL, null, null, null); + public Mono startCopyFromURL(URL sourceURL) { + return startCopyFromURLWithResponse(sourceURL, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -217,7 +239,7 @@ public Mono> startCopyFromURL(URL sourceURL) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.startCopyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -231,7 +253,11 @@ public Mono> startCopyFromURL(URL sourceURL) { * @param destAccessConditions {@link BlobAccessConditions} against the destination. * @return A reactive response containing the copy ID for the long running operation. */ - public Mono> startCopyFromURL(URL sourceURL, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { + public Mono> startCopyFromURLWithResponse(URL sourceURL, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { + return withContext(context -> startCopyFromURLWithResponse(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions, context)); + } + + Mono> startCopyFromURLWithResponse(URL sourceURL, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; sourceModifiedAccessConditions = sourceModifiedAccessConditions == null ? new ModifiedAccessConditions() : sourceModifiedAccessConditions; @@ -245,8 +271,8 @@ public Mono> startCopyFromURL(URL sourceURL, Metadata metadata, .sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch()); return postProcessResponse(this.azureBlobStorage.blobs().startCopyFromURLWithRestResponseAsync( - null, null, sourceURL, null, metadata, null, sourceConditions, - destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), Context.NONE)) + null, null, sourceURL, null, metadata, null, null, null, sourceConditions, + destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyId())); } @@ -264,8 +290,8 @@ public Mono> startCopyFromURL(URL sourceURL, Metadata metadata, * BlobStartCopyFromURLHeaders} object. * @return A reactive response signalling completion. */ - public Mono abortCopyFromURL(String copyId) { - return this.abortCopyFromURL(copyId, null); + public Mono abortCopyFromURL(String copyId) { + return abortCopyFromURLWithResponse(copyId, null).flatMap(FluxUtil::toMono); } /** @@ -273,7 +299,7 @@ public Mono abortCopyFromURL(String copyId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions} * *

For more information, see the * Azure Docs

@@ -284,9 +310,13 @@ public Mono abortCopyFromURL(String copyId) { * not match the active lease on the blob. * @return A reactive response signalling completion. */ - public Mono abortCopyFromURL(String copyId, LeaseAccessConditions leaseAccessConditions) { + public Mono abortCopyFromURLWithResponse(String copyId, LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> abortCopyFromURLWithResponse(copyId, leaseAccessConditions, context)); + } + + Mono abortCopyFromURLWithResponse(String copyId, LeaseAccessConditions leaseAccessConditions, Context context) { return postProcessResponse(this.azureBlobStorage.blobs().abortCopyFromURLWithRestResponseAsync( - null, null, copyId, null, null, leaseAccessConditions, Context.NONE)) + null, null, copyId, null, null, leaseAccessConditions, context)) .map(VoidResponse::new); } @@ -303,8 +333,8 @@ public Mono abortCopyFromURL(String copyId, LeaseAccessConditions * @param copySource The source URL to copy from. * @return A reactive response containing the copy ID for the long running operation. */ - public Mono> copyFromURL(URL copySource) { - return this.copyFromURL(copySource, null, null, null); + public Mono copyFromURL(URL copySource) { + return copyFromURLWithResponse(copySource, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -312,7 +342,7 @@ public Mono> copyFromURL(URL copySource) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.copyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -326,7 +356,11 @@ public Mono> copyFromURL(URL copySource) { * @param destAccessConditions {@link BlobAccessConditions} against the destination. * @return A reactive response containing the copy ID for the long running operation. */ - public Mono> copyFromURL(URL copySource, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { + public Mono> copyFromURLWithResponse(URL copySource, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { + return withContext(context -> copyFromURLWithResponse(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions, context)); + } + + Mono> copyFromURLWithResponse(URL copySource, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; sourceModifiedAccessConditions = sourceModifiedAccessConditions == null ? new ModifiedAccessConditions() : sourceModifiedAccessConditions; @@ -340,8 +374,8 @@ public Mono> copyFromURL(URL copySource, Metadata metadata, Mod .sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch()); return postProcessResponse(this.azureBlobStorage.blobs().copyFromURLWithRestResponseAsync( - null, null, copySource, null, metadata, null, sourceConditions, - destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), Context.NONE)) + null, null, copySource, null, metadata, null, null, sourceConditions, + destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyId())); } @@ -358,8 +392,8 @@ public Mono> copyFromURL(URL copySource, Metadata metadata, Mod * * @return A reactive response containing the blob data. */ - public Mono>> download() { - return this.download(null, null, null, false); + public Mono> download() { + return downloadWithResponse(null, null, null, false).flatMap(FluxUtil::toMono); } /** @@ -368,7 +402,7 @@ public Mono>> download() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.download#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.downloadWithResponse#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean} * *

For more information, see the * Azure Docs

@@ -379,11 +413,15 @@ public Mono>> download() { * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. * @return A reactive response containing the blob data. */ - public Mono>> download(BlobRange range, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { - return this.download(range, accessConditions, rangeGetContentMD5) + public Mono>> downloadWithResponse(BlobRange range, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { + return withContext(context -> downloadWithResponse(range, options, accessConditions, rangeGetContentMD5, context)); + } + + Mono>> downloadWithResponse(BlobRange range, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Context context) { + return download(range, accessConditions, rangeGetContentMD5, context) .map(response -> new SimpleResponse<>( response.rawResponse(), - response.body(options).map(ByteBuf::nioBuffer).switchIfEmpty(Flux.just(ByteBuffer.allocate(0))))); + response.body(options).switchIfEmpty(Flux.just(ByteBuffer.wrap(new byte[0]))))); } /** @@ -402,6 +440,10 @@ public Mono>> download(BlobRange range, ReliableDownlo * file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) */ Mono download(BlobRange range, BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { + return withContext(context -> download(range, accessConditions, rangeGetContentMD5, context)); + } + + Mono download(BlobRange range, BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Context context) { range = range == null ? new BlobRange(0) : range; Boolean getMD5 = rangeGetContentMD5 ? rangeGetContentMD5 : null; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; @@ -413,9 +455,8 @@ Mono download(BlobRange range, BlobAccessConditions acces // TODO: range is BlobRange but expected as String // TODO: figure out correct response return postProcessResponse(this.azureBlobStorage.blobs().downloadWithRestResponseAsync( - null, null, snapshot, null, null, range.toHeaderValue(), getMD5, - null, null, null, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) + null, null, snapshot, null, range.toHeaderValue(), getMD5, null, null, + accessConditions.leaseAccessConditions(), null, accessConditions.modifiedAccessConditions(), context)) // Convert the autorest response to a DownloadAsyncResponse, which enable reliable download. .map(response -> { // If there wasn't an etag originally specified, lock on the one returned. @@ -425,10 +466,11 @@ Mono download(BlobRange range, BlobAccessConditions acces newInfo -> this.download(new BlobRange(newInfo.offset(), newInfo.count()), new BlobAccessConditions().modifiedAccessConditions( - new ModifiedAccessConditions().ifMatch(info.eTag())), false)); + new ModifiedAccessConditions().ifMatch(info.eTag())), false, context)); }); } + /** * Downloads the entire blob into a file specified by the path. The file will be created if it doesn't exist. * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link @@ -448,7 +490,7 @@ Mono download(BlobRange range, BlobAccessConditions acces * @return An empty response */ public Mono downloadToFile(String filePath) { - return this.downloadToFile(filePath, null, BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE, null, null, false); + return downloadToFile(filePath, null, BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE, null, null, false); } /** @@ -478,17 +520,22 @@ public Mono downloadToFile(String filePath) { */ public Mono downloadToFile(String filePath, BlobRange range, Integer blockSize, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { + return withContext(context -> downloadToFile(filePath, range, blockSize, options, accessConditions, rangeGetContentMD5, context)); + } + + Mono downloadToFile(String filePath, BlobRange range, Integer blockSize, ReliableDownloadOptions options, + BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Context context) { if (blockSize < 0 || blockSize > BLOB_MAX_DOWNLOAD_BLOCK_SIZE) { - throw new IllegalArgumentException("Block size should not exceed 100MB"); + throw logger.logExceptionAsError(new IllegalArgumentException("Block size should not exceed 100MB")); } return Mono.using(() -> downloadToFileResourceSupplier(filePath), channel -> Mono.justOrEmpty(range) .switchIfEmpty(getFullBlobRange(accessConditions)) .flatMapMany(rg -> Flux.fromIterable(sliceBlobRange(rg, blockSize))) - .flatMap(chunk -> this.download(chunk, accessConditions, rangeGetContentMD5) + .flatMap(chunk -> this.download(chunk, accessConditions, rangeGetContentMD5, context) .subscribeOn(Schedulers.elastic()) - .flatMap(dar -> FluxUtil.bytebufStreamToFile(dar.body(options), channel, chunk.offset() - (range == null ? 0 : range.offset())))) + .flatMap(dar -> FluxUtil.writeFile(dar.body(options), channel, chunk.offset() - (range == null ? 0 : range.offset())))) .then(), this::downloadToFileCleanup); } @@ -496,7 +543,7 @@ private AsynchronousFileChannel downloadToFileResourceSupplier(String filePath) try { return AsynchronousFileChannel.open(Paths.get(filePath), StandardOpenOption.READ, StandardOpenOption.WRITE); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } @@ -504,12 +551,12 @@ private void downloadToFileCleanup(AsynchronousFileChannel channel) { try { channel.close(); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } private Mono getFullBlobRange(BlobAccessConditions accessConditions) { - return getProperties(accessConditions).map(rb -> new BlobRange(0, rb.value().blobSize())); + return getPropertiesWithResponse(accessConditions).map(rb -> new BlobRange(0, rb.value().blobSize())); } private List sliceBlobRange(BlobRange blobRange, Integer blockSize) { @@ -541,8 +588,8 @@ private List sliceBlobRange(BlobRange blobRange, Integer blockSize) { * * @return A reactive response signalling completion. */ - public Mono delete() { - return this.delete(null, null); + public Mono delete() { + return deleteWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -550,7 +597,7 @@ public Mono delete() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -561,13 +608,17 @@ public Mono delete() { * @param accessConditions {@link BlobAccessConditions} * @return A reactive response signalling completion. */ - public Mono delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, BlobAccessConditions accessConditions) { + public Mono deleteWithResponse(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, BlobAccessConditions accessConditions) { + return withContext(context -> deleteWithResponse(deleteBlobSnapshotOptions, accessConditions, context)); + } + + Mono deleteWithResponse(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, BlobAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blobs().deleteWithRestResponseAsync( - null, null, snapshot, null, null, deleteBlobSnapshotOptions, + null, null, snapshot, null, deleteBlobSnapshotOptions, null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - Context.NONE)) + context)) .map(VoidResponse::new); } @@ -583,8 +634,8 @@ public Mono delete(DeleteSnapshotsOptionType deleteBlobSnapshotOpt * * @return A reactive response containing the blob properties and metadata. */ - public Mono> getProperties() { - return this.getProperties(null); + public Mono getProperties() { + return getPropertiesWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -592,7 +643,7 @@ public Mono> getProperties() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getPropertiesWithResponse#BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -600,13 +651,16 @@ public Mono> getProperties() { * @param accessConditions {@link BlobAccessConditions} * @return A reactive response containing the blob properties and metadata. */ - public Mono> getProperties(BlobAccessConditions accessConditions) { + public Mono> getPropertiesWithResponse(BlobAccessConditions accessConditions) { + return withContext(context -> getPropertiesWithResponse(accessConditions, context)); + } + + Mono> getPropertiesWithResponse(BlobAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blobs().getPropertiesWithRestResponseAsync( - null, null, snapshot, null, null, null, - null, null, null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) + null, null, snapshot, null, null, accessConditions.leaseAccessConditions(), null, + accessConditions.modifiedAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, new BlobProperties(rb.deserializedHeaders()))); } @@ -624,8 +678,8 @@ public Mono> getProperties(BlobAccessConditions accessC * @param headers {@link BlobHTTPHeaders} * @return A reactive response signalling completion. */ - public Mono setHTTPHeaders(BlobHTTPHeaders headers) { - return this.setHTTPHeaders(headers, null); + public Mono setHTTPHeaders(BlobHTTPHeaders headers) { + return setHTTPHeadersWithResponse(headers, null).flatMap(FluxUtil::toMono); } /** @@ -634,7 +688,7 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -643,12 +697,16 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers) { * @param accessConditions {@link BlobAccessConditions} * @return A reactive response signalling completion. */ - public Mono setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions accessConditions) { + public Mono setHTTPHeadersWithResponse(BlobHTTPHeaders headers, BlobAccessConditions accessConditions) { + return withContext(context -> setHTTPHeadersWithResponse(headers, accessConditions, context)); + } + + Mono setHTTPHeadersWithResponse(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blobs().setHTTPHeadersWithRestResponseAsync( null, null, null, null, headers, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) + accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)) .map(VoidResponse::new); } @@ -666,8 +724,8 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessCond * @param metadata {@link Metadata} * @return A reactive response signalling completion. */ - public Mono setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null); + public Mono setMetadata(Metadata metadata) { + return setMetadataWithResponse(metadata, null).flatMap(FluxUtil::toMono); } /** @@ -676,7 +734,7 @@ public Mono setMetadata(Metadata metadata) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setMetadataWithResponse#Metadata-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -685,14 +743,17 @@ public Mono setMetadata(Metadata metadata) { * @param accessConditions {@link BlobAccessConditions} * @return A reactive response signalling completion. */ - public Mono setMetadata(Metadata metadata, BlobAccessConditions accessConditions) { + public Mono setMetadataWithResponse(Metadata metadata, BlobAccessConditions accessConditions) { + return withContext(context -> setMetadataWithResponse(metadata, accessConditions, context)); + } + + Mono setMetadataWithResponse(Metadata metadata, BlobAccessConditions accessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blobs().setMetadataWithRestResponseAsync( - null, null, null, metadata, null, null, - null, null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) + null, null, null, metadata, null, accessConditions.leaseAccessConditions(), null, + accessConditions.modifiedAccessConditions(), context)) .map(VoidResponse::new); } @@ -709,8 +770,8 @@ public Mono setMetadata(Metadata metadata, BlobAccessConditions ac * @return A response containing a {@link BlobAsyncClient} which is used to interact with the created snapshot, use * {@link BlobAsyncClient#getSnapshotId()} to get the identifier for the snapshot. */ - public Mono> createSnapshot() { - return this.createSnapshot(null, null); + public Mono createSnapshot() { + return createSnapshotWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -718,7 +779,7 @@ public Mono> createSnapshot() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.createSnapshotWithResponse#Metadata-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -728,14 +789,17 @@ public Mono> createSnapshot() { * @return A response containing a {@link BlobAsyncClient} which is used to interact with the created snapshot, use * {@link BlobAsyncClient#getSnapshotId()} to get the identifier for the snapshot. */ - public Mono> createSnapshot(Metadata metadata, BlobAccessConditions accessConditions) { + public Mono> createSnapshotWithResponse(Metadata metadata, BlobAccessConditions accessConditions) { + return withContext(context -> createSnapshotWithResponse(metadata, accessConditions, context)); + } + + Mono> createSnapshotWithResponse(Metadata metadata, BlobAccessConditions accessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blobs().createSnapshotWithRestResponseAsync( - null, null, null, metadata, null, null, - null, null, accessConditions.modifiedAccessConditions(), - accessConditions.leaseAccessConditions(), Context.NONE)) + null, null, null, metadata, null, null, accessConditions.modifiedAccessConditions(), + accessConditions.leaseAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, this.getSnapshotClient(rb.deserializedHeaders().snapshot()))); } @@ -755,8 +819,8 @@ public Mono> createSnapshot(Metadata metadata, BlobAcc * @param tier The new tier for the blob. * @return A reactive response signalling completion. */ - public Mono setTier(AccessTier tier) { - return this.setTier(tier, null); + public Mono setTier(AccessTier tier) { + return setTierWithResponse(tier, null).flatMap(FluxUtil::toMono); } /** @@ -767,7 +831,7 @@ public Mono setTier(AccessTier tier) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setTierWithResponse#AccessTier-LeaseAccessConditions} * *

For more information, see the * Azure Docs

@@ -777,11 +841,16 @@ public Mono setTier(AccessTier tier) { * not match the active lease on the blob. * @return A reactive response signalling completion. */ - public Mono setTier(AccessTier tier, LeaseAccessConditions leaseAccessConditions) { + public Mono setTierWithResponse(AccessTier tier, LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> setTierWithResponse(tier, leaseAccessConditions, context)); + } + + Mono setTierWithResponse(AccessTier tier, LeaseAccessConditions leaseAccessConditions, Context context) { Utility.assertNotNull("tier", tier); + AccessTierRequired accessTierRequired = AccessTierRequired.fromString(tier.toString()); return postProcessResponse(this.azureBlobStorage.blobs().setTierWithRestResponseAsync( - null, null, tier, null, null, leaseAccessConditions, Context.NONE)) + null, null, accessTierRequired, null, null, null, leaseAccessConditions, context)) .map(VoidResponse::new); } @@ -797,9 +866,29 @@ public Mono setTier(AccessTier tier, LeaseAccessConditions leaseAc * * @return A reactive response signalling completion. */ - public Mono undelete() { + public Mono undelete() { + return undeleteWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.undeleteWithResponse} + * + *

For more information, see the + * Azure Docs

+ * + * @return A reactive response signalling completion. + */ + public Mono undeleteWithResponse() { + return withContext(context -> undeleteWithResponse(context)); + } + + Mono undeleteWithResponse(Context context) { return postProcessResponse(this.azureBlobStorage.blobs().undeleteWithRestResponseAsync(null, - null, Context.NONE)) + null, context)) .map(VoidResponse::new); } @@ -819,8 +908,8 @@ public Mono undelete() { * non-infinite lease can be between 15 and 60 seconds. * @return A reactive response containing the lease ID. */ - public Mono> acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null); + public Mono acquireLease(String proposedId, int duration) { + return acquireLeaseWithResponse(proposedId, duration, null).flatMap(FluxUtil::toMono); } /** @@ -829,7 +918,7 @@ public Mono> acquireLease(String proposedId, int duration) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions} * *

For more information, see the * Azure Docs

@@ -843,16 +932,20 @@ public Mono> acquireLease(String proposedId, int duration) { * @return A reactive response containing the lease ID. * @throws IllegalArgumentException If {@code duration} is outside the bounds of 15 to 60 or isn't -1. */ - public Mono> acquireLease(String proposedId, int duration, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> acquireLeaseWithResponse(String proposedId, int duration, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> acquireLeaseWithResponse(proposedId, duration, modifiedAccessConditions, context)); + } + + Mono> acquireLeaseWithResponse(String proposedId, int duration, ModifiedAccessConditions modifiedAccessConditions, Context context) { if (!(duration == -1 || (duration >= 15 && duration <= 60))) { // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("Duration must be -1 or between 15 and 60."); + throw logger.logExceptionAsError(new IllegalArgumentException("Duration must be -1 or between 15 and 60.")); } return postProcessResponse(this.azureBlobStorage.blobs().acquireLeaseWithRestResponseAsync( null, null, null, duration, proposedId, null, - modifiedAccessConditions, Context.NONE)) + modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } @@ -869,8 +962,8 @@ public Mono> acquireLease(String proposedId, int duration, Modi * @param leaseId The leaseId of the active lease on the blob. * @return A reactive response containing the renewed lease ID. */ - public Mono> renewLease(String leaseId) { - return this.renewLease(leaseId, null); + public Mono renewLease(String leaseId) { + return renewLeaseWithResponse(leaseId, null).flatMap(FluxUtil::toMono); } /** @@ -878,7 +971,7 @@ public Mono> renewLease(String leaseId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions} * *

For more information, see the * Azure Docs

@@ -889,9 +982,13 @@ public Mono> renewLease(String leaseId) { * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the renewed lease ID. */ - public Mono> renewLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> renewLeaseWithResponse(String leaseId, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> renewLeaseWithResponse(leaseId, modifiedAccessConditions, context)); + } + + Mono> renewLeaseWithResponse(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Context context) { return postProcessResponse(this.azureBlobStorage.blobs().renewLeaseWithRestResponseAsync(null, - null, leaseId, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseId, null, null, modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } @@ -908,8 +1005,8 @@ public Mono> renewLease(String leaseId, ModifiedAccessCondition * @param leaseId The leaseId of the active lease on the blob. * @return A reactive response signalling completion. */ - public Mono releaseLease(String leaseId) { - return this.releaseLease(leaseId, null); + public Mono releaseLease(String leaseId) { + return releaseLeaseWithResponse(leaseId, null).flatMap(FluxUtil::toMono); } /** @@ -917,7 +1014,7 @@ public Mono releaseLease(String leaseId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.releaseLeaseWithResponse#String-ModifiedAccessConditions} * *

For more information, see the * Azure Docs

@@ -928,9 +1025,13 @@ public Mono releaseLease(String leaseId) { * request. The request will fail if the specified condition is not satisfied. * @return A reactive response signalling completion. */ - public Mono releaseLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions) { + public Mono releaseLeaseWithResponse(String leaseId, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> releaseLeaseWithResponse(leaseId, modifiedAccessConditions, context)); + } + + Mono releaseLeaseWithResponse(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Context context) { return postProcessResponse(this.azureBlobStorage.blobs().releaseLeaseWithRestResponseAsync(null, - null, leaseId, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseId, null, null, modifiedAccessConditions, context)) .map(VoidResponse::new); } @@ -947,8 +1048,8 @@ public Mono releaseLease(String leaseId, ModifiedAccessConditions * * @return A reactive response containing the remaining time in the broken lease in seconds. */ - public Mono> breakLease() { - return this.breakLease(null, null); + public Mono breakLease() { + return breakLeaseWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -957,7 +1058,7 @@ public Mono> breakLease() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions} * *

For more information, see the * Azure Docs

@@ -972,9 +1073,13 @@ public Mono> breakLease() { * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the remaining time in the broken lease in seconds. */ - public Mono> breakLease(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> breakLeaseWithResponse(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> breakLeaseWithResponse(breakPeriodInSeconds, modifiedAccessConditions, context)); + } + + Mono> breakLeaseWithResponse(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions, Context context) { return postProcessResponse(this.azureBlobStorage.blobs().breakLeaseWithRestResponseAsync(null, - null, null, breakPeriodInSeconds, null, modifiedAccessConditions, Context.NONE)) + null, null, breakPeriodInSeconds, null, modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseTime())); } @@ -992,8 +1097,8 @@ public Mono> breakLease(Integer breakPeriodInSeconds, Modified * @param proposedId A {@code String} in any valid GUID format. * @return A reactive response containing the new lease ID. */ - public Mono> changeLease(String leaseId, String proposedId) { - return this.changeLease(leaseId, proposedId, null); + public Mono changeLease(String leaseId, String proposedId) { + return changeLeaseWithResponse(leaseId, proposedId, null).flatMap(FluxUtil::toMono); } /** @@ -1001,7 +1106,7 @@ public Mono> changeLease(String leaseId, String proposedId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions} * *

For more information, see the * Azure Docs

@@ -1013,9 +1118,13 @@ public Mono> changeLease(String leaseId, String proposedId) { * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the new lease ID. */ - public Mono> changeLease(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> changeLeaseWithResponse(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> changeLeaseWithResponse(leaseId, proposedId, modifiedAccessConditions, context)); + } + + Mono> changeLeaseWithResponse(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions, Context context) { return postProcessResponse(this.azureBlobStorage.blobs().changeLeaseWithRestResponseAsync(null, - null, leaseId, proposedId, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseId, proposedId, null, null, modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } @@ -1031,9 +1140,29 @@ public Mono> changeLease(String leaseId, String proposedId, Mod * * @return a reactor response containing the sku name and account kind. */ - public Mono> getAccountInfo() { + public Mono getAccountInfo() { + return getAccountInfoWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Returns the sku name and account kind for the account. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getAccountInfoWithResponse} + * + *

For more information, see the + * Azure Docs

+ * + * @return a reactor response containing the sku name and account kind. + */ + public Mono> getAccountInfoWithResponse() { + return withContext(context -> getAccountInfoWithResponse(context)); + } + + Mono> getAccountInfoWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.blobs().getAccountInfoWithRestResponseAsync(null, null, Context.NONE)) + this.azureBlobStorage.blobs().getAccountInfoWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.deserializedHeaders()))); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java index 91ff5eb97dbc..09b9dd0b30cd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java @@ -6,6 +6,8 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.blob.models.BlobHTTPHeaders; @@ -17,6 +19,7 @@ import com.azure.storage.blob.models.ModifiedAccessConditions; import com.azure.storage.blob.models.ReliableDownloadOptions; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.IPRange; import com.azure.storage.common.SASProtocol; @@ -50,6 +53,8 @@ * Docs for more information. */ public class BlobClient { + private final ClientLogger logger = new ClientLogger(BlobClient.class); + private final BlobAsyncClient blobAsyncClient; /** @@ -155,8 +160,8 @@ public final BlobInputStream openInputStream(BlobRange range, BlobAccessConditio * * @return true if the container exists, false if it doesn't */ - public Response exists() { - return this.exists(null); + public Boolean exists() { + return existsWithResponse(null, Context.NONE).value(); } /** @@ -164,13 +169,14 @@ public Response exists() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.exists#Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.existsWithResponse#Duration-Context} * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return true if the container exists, false if it doesn't */ - public Response exists(Duration timeout) { - Mono> response = blobAsyncClient.exists(); + public Response existsWithResponse(Duration timeout, Context context) { + Mono> response = blobAsyncClient.existsWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -188,8 +194,8 @@ public Response exists(Duration timeout) { * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @return The copy ID for the long running operation. */ - public Response startCopyFromURL(URL sourceURL) { - return this.startCopyFromURL(sourceURL, null, null, null, null); + public String startCopyFromURL(URL sourceURL) { + return startCopyFromURLWithResponse(sourceURL, null, null, null, null, Context.NONE).value(); } /** @@ -197,7 +203,7 @@ public Response startCopyFromURL(URL sourceURL) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.startCopyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -210,12 +216,13 @@ public Response startCopyFromURL(URL sourceURL) { * condition is not satisfied. * @param destAccessConditions {@link BlobAccessConditions} against the destination. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return The copy ID for the long running operation. */ - public Response startCopyFromURL(URL sourceURL, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, - BlobAccessConditions destAccessConditions, Duration timeout) { + public Response startCopyFromURLWithResponse(URL sourceURL, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions, Duration timeout, Context context) { Mono> response = blobAsyncClient - .startCopyFromURL(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions); + .startCopyFromURLWithResponse(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -232,10 +239,9 @@ public Response startCopyFromURL(URL sourceURL, Metadata metadata, Modif * * @param copyId The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link * BlobStartCopyFromURLHeaders} object. - * @return A response containing status code and HTTP headers. */ - public VoidResponse abortCopyFromURL(String copyId) { - return this.abortCopyFromURL(copyId, null, null); + public void abortCopyFromURL(String copyId) { + abortCopyFromURLWithResponse(copyId, null, null, Context.NONE); } /** @@ -243,7 +249,7 @@ public VoidResponse abortCopyFromURL(String copyId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -253,11 +259,11 @@ public VoidResponse abortCopyFromURL(String copyId) { * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers. */ - public VoidResponse abortCopyFromURL(String copyId, LeaseAccessConditions leaseAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .abortCopyFromURL(copyId, leaseAccessConditions); + public VoidResponse abortCopyFromURLWithResponse(String copyId, LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) { + Mono response = blobAsyncClient.abortCopyFromURLWithResponse(copyId, leaseAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -275,8 +281,8 @@ public VoidResponse abortCopyFromURL(String copyId, LeaseAccessConditions leaseA * @param copySource The source URL to copy from. * @return The copy ID for the long running operation. */ - public Response copyFromURL(URL copySource) { - return this.copyFromURL(copySource, null, null, null, null); + public String copyFromURL(URL copySource) { + return copyFromURLWithResponse(copySource, null, null, null, null, Context.NONE).value(); } /** @@ -284,7 +290,7 @@ public Response copyFromURL(URL copySource) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.copyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -297,12 +303,13 @@ public Response copyFromURL(URL copySource) { * condition is not satisfied. * @param destAccessConditions {@link BlobAccessConditions} against the destination. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return The copy ID for the long running operation. */ - public Response copyFromURL(URL copySource, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, - BlobAccessConditions destAccessConditions, Duration timeout) { + public Response copyFromURLWithResponse(URL copySource, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions, Duration timeout, Context context) { Mono> response = blobAsyncClient - .copyFromURL(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions); + .copyFromURLWithResponse(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -319,11 +326,10 @@ public Response copyFromURL(URL copySource, Metadata metadata, ModifiedA * Azure Docs

* * @param stream A non-null {@link OutputStream} instance where the downloaded data will be written. - * @return A response containing status code and HTTP headers. * @throws UncheckedIOException If an I/O error occurs. */ - public VoidResponse download(OutputStream stream) { - return this.download(stream, null, null, null, false, null); + public void download(OutputStream stream) { + downloadWithResponse(stream, null, null, null, false, null, Context.NONE); } /** @@ -332,7 +338,7 @@ public VoidResponse download(OutputStream stream) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.downloadWithResponse#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context} * *

For more information, see the * Azure Docs

@@ -343,19 +349,20 @@ public VoidResponse download(OutputStream stream) { * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers. * @throws UncheckedIOException If an I/O error occurs. */ - public VoidResponse download(OutputStream stream, BlobRange range, ReliableDownloadOptions options, - BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) { + public VoidResponse downloadWithResponse(OutputStream stream, BlobRange range, ReliableDownloadOptions options, + BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout, Context context) { Mono download = blobAsyncClient - .download(range, options, accessConditions, rangeGetContentMD5) + .downloadWithResponse(range, options, accessConditions, rangeGetContentMD5, context) .flatMapMany(res -> res.value() .doOnNext(bf -> { try { stream.write(bf.array()); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } }).map(bf -> res)) .last() @@ -380,7 +387,7 @@ public VoidResponse download(OutputStream stream, BlobRange range, ReliableDownl * @throws UncheckedIOException If an I/O error occurs */ public void downloadToFile(String filePath) { - blobAsyncClient.downloadToFile(filePath); + downloadToFile(filePath, null, null, null, null, false, null, Context.NONE); } /** @@ -390,7 +397,7 @@ public void downloadToFile(String filePath) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context} * *

For more information, see the * Azure Docs

@@ -402,11 +409,12 @@ public void downloadToFile(String filePath) { * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws UncheckedIOException If an I/O error occurs */ public void downloadToFile(String filePath, BlobRange range, Integer blockSize, ReliableDownloadOptions options, - BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) { - Mono download = blobAsyncClient.downloadToFile(filePath, range, blockSize, options, accessConditions, rangeGetContentMD5); + BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout, Context context) { + Mono download = blobAsyncClient.downloadToFile(filePath, range, blockSize, options, accessConditions, rangeGetContentMD5, context); Utility.blockWithOptionalTimeout(download, timeout); } @@ -421,10 +429,9 @@ public void downloadToFile(String filePath, BlobRange range, Integer blockSize, *

For more information, see the * Azure Docs

* - * @return A response containing status code and HTTP headers. */ - public VoidResponse delete() { - return this.delete(null, null, null); + public void delete() { + deleteWithResponse(null, null, null, Context.NONE); } /** @@ -432,7 +439,7 @@ public VoidResponse delete() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -442,12 +449,13 @@ public VoidResponse delete() { * deleted, you must pass null. * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers. */ - public VoidResponse delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, - BlobAccessConditions accessConditions, Duration timeout) { + public VoidResponse deleteWithResponse(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, + BlobAccessConditions accessConditions, Duration timeout, Context context) { Mono response = blobAsyncClient - .delete(deleteBlobSnapshotOptions, accessConditions); + .deleteWithResponse(deleteBlobSnapshotOptions, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -464,8 +472,8 @@ public VoidResponse delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, * * @return The blob properties and metadata. */ - public Response getProperties() { - return this.getProperties(null, null); + public BlobProperties getProperties() { + return getPropertiesWithResponse(null, null, Context.NONE).value(); } /** @@ -473,18 +481,18 @@ public Response getProperties() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.getPropertiesWithResponse#BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

* * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return The blob properties and metadata. */ - public Response getProperties(BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = blobAsyncClient - .getProperties(accessConditions); + public Response getPropertiesWithResponse(BlobAccessConditions accessConditions, Duration timeout, Context context) { + Mono> response = blobAsyncClient.getPropertiesWithResponse(accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -501,10 +509,9 @@ public Response getProperties(BlobAccessConditions accessConditi * Azure Docs

* * @param headers {@link BlobHTTPHeaders} - * @return A response containing status code and HTTP headers. */ - public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers) { - return this.setHTTPHeaders(headers, null, null); + public void setHTTPHeaders(BlobHTTPHeaders headers) { + setHTTPHeadersWithResponse(headers, null, null, Context.NONE); } /** @@ -513,7 +520,7 @@ public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -521,12 +528,13 @@ public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers) { * @param headers {@link BlobHTTPHeaders} * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers. */ - public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, - Duration timeout) { + public VoidResponse setHTTPHeadersWithResponse(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, + Duration timeout, Context context) { Mono response = blobAsyncClient - .setHTTPHeaders(headers, accessConditions); + .setHTTPHeadersWithResponse(headers, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -543,10 +551,9 @@ public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions * Azure Docs

* * @param metadata {@link Metadata} - * @return A response containing status code and HTTP headers. */ - public VoidResponse setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null, null); + public void setMetadata(Metadata metadata) { + setMetadataWithResponse(metadata, null, null, Context.NONE); } /** @@ -555,7 +562,7 @@ public VoidResponse setMetadata(Metadata metadata) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.setMetadataWithResponse#Metadata-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -563,11 +570,11 @@ public VoidResponse setMetadata(Metadata metadata) { * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers. */ - public VoidResponse setMetadata(Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { - Mono response = blobAsyncClient - .setMetadata(metadata, accessConditions); + public VoidResponse setMetadataWithResponse(Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { + Mono response = blobAsyncClient.setMetadataWithResponse(metadata, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -585,16 +592,17 @@ public VoidResponse setMetadata(Metadata metadata, BlobAccessConditions accessCo * @return A response containing a {@link BlobClient} which is used to interact with the created snapshot, use * {@link BlobClient#getSnapshotId()} to get the identifier for the snapshot. */ - public Response createSnapshot() { - return this.createSnapshot(null, null, null); + public BlobClient createSnapshot() { + return createSnapshotWithResponse(null, null, null, Context.NONE).value(); } + /** * Creates a read-only snapshot of the blob. * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.createSnapshotWithResponse#Metadata-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -602,12 +610,13 @@ public Response createSnapshot() { * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing a {@link BlobClient} which is used to interact with the created snapshot, use * {@link BlobClient#getSnapshotId()} to get the identifier for the snapshot. */ - public Response createSnapshot(Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { + public Response createSnapshotWithResponse(Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { Mono> response = blobAsyncClient - .createSnapshot(metadata, accessConditions) + .createSnapshotWithResponse(metadata, accessConditions, context) .map(rb -> new SimpleResponse<>(rb, new BlobClient(rb.value()))); return Utility.blockWithOptionalTimeout(response, timeout); @@ -627,10 +636,9 @@ public Response createSnapshot(Metadata metadata, BlobAccessConditio * Azure Docs

* * @param tier The new tier for the blob. - * @return A response containing status code and HTTP headers. */ - public VoidResponse setTier(AccessTier tier) { - return this.setTier(tier, null, null); + public void setTier(AccessTier tier) { + setTierWithResponse(tier, null, null, Context.NONE); } /** @@ -641,7 +649,7 @@ public VoidResponse setTier(AccessTier tier) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.setTierWithResponse#AccessTier-LeaseAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -650,11 +658,11 @@ public VoidResponse setTier(AccessTier tier) { * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers. */ - public VoidResponse setTier(AccessTier tier, LeaseAccessConditions leaseAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .setTier(tier, leaseAccessConditions); + public VoidResponse setTierWithResponse(AccessTier tier, LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) { + Mono response = blobAsyncClient.setTierWithResponse(tier, leaseAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -669,10 +677,9 @@ public VoidResponse setTier(AccessTier tier, LeaseAccessConditions leaseAccessCo *

For more information, see the * Azure Docs

* - * @return A response containing status code and HTTP headers. */ - public VoidResponse undelete() { - return this.undelete(null); + public void undelete() { + undeleteWithResponse(null, Context.NONE); } /** @@ -680,17 +687,17 @@ public VoidResponse undelete() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.undelete#Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.undeleteWithResponse#Duration-Context} * *

For more information, see the * Azure Docs

* * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers. */ - public VoidResponse undelete(Duration timeout) { - Mono response = blobAsyncClient - .undelete(); + public VoidResponse undeleteWithResponse(Duration timeout, Context context) { + Mono response = blobAsyncClient.undeleteWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -711,8 +718,8 @@ public VoidResponse undelete(Duration timeout) { * non-infinite lease can be between 15 and 60 seconds. * @return The lease ID. */ - public Response acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); + public String acquireLease(String proposedId, int duration) { + return acquireLeaseWithResponse(proposedId, duration, null, null, Context.NONE).value(); } /** @@ -721,7 +728,7 @@ public Response acquireLease(String proposedId, int duration) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -733,12 +740,12 @@ public Response acquireLease(String proposedId, int duration) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return The lease ID. */ - public Response acquireLease(String proposedId, int duration, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono> response = blobAsyncClient - .acquireLease(proposedId, duration, modifiedAccessConditions); + public Response acquireLeaseWithResponse(String proposedId, int duration, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { + Mono> response = blobAsyncClient.acquireLeaseWithResponse(proposedId, duration, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -756,8 +763,8 @@ public Response acquireLease(String proposedId, int duration, * @param leaseId The leaseId of the active lease on the blob. * @return The renewed lease ID. */ - public Response renewLease(String leaseId) { - return this.renewLease(leaseId, null, null); + public String renewLease(String leaseId) { + return renewLeaseWithResponse(leaseId, null, null, Context.NONE).value(); } /** @@ -765,7 +772,7 @@ public Response renewLease(String leaseId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -775,11 +782,12 @@ public Response renewLease(String leaseId) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return The renewed lease ID. */ - public Response renewLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response renewLeaseWithResponse(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono> response = blobAsyncClient - .renewLease(leaseId, modifiedAccessConditions); + .renewLeaseWithResponse(leaseId, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -795,10 +803,9 @@ public Response renewLease(String leaseId, ModifiedAccessConditions modi * Azure Docs

* * @param leaseId The leaseId of the active lease on the blob. - * @return A response containing status code and HTTP headers. */ - public VoidResponse releaseLease(String leaseId) { - return this.releaseLease(leaseId, null, null); + public void releaseLease(String leaseId) { + releaseLeaseWithResponse(leaseId, null, null, Context.NONE); } /** @@ -806,7 +813,7 @@ public VoidResponse releaseLease(String leaseId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -816,10 +823,11 @@ public VoidResponse releaseLease(String leaseId) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers. */ - public VoidResponse releaseLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncClient.releaseLease(leaseId, modifiedAccessConditions); + public VoidResponse releaseLeaseWithResponse(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { + Mono response = blobAsyncClient.releaseLeaseWithResponse(leaseId, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -837,8 +845,8 @@ public VoidResponse releaseLease(String leaseId, ModifiedAccessConditions modifi * * @return The remaining time in the broken lease in seconds. */ - public Response breakLease() { - return this.breakLease(null, null, null); + public Integer breakLease() { + return breakLeaseWithResponse(null, null, null, Context.NONE).value(); } /** @@ -847,7 +855,7 @@ public Response breakLease() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -861,11 +869,12 @@ public Response breakLease() { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return The remaining time in the broken lease in seconds. */ - public Response breakLease(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response breakLeaseWithResponse(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono> response = blobAsyncClient - .breakLease(breakPeriodInSeconds, modifiedAccessConditions); + .breakLeaseWithResponse(breakPeriodInSeconds, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -884,8 +893,8 @@ public Response breakLease(Integer breakPeriodInSeconds, ModifiedAccess * @param proposedId A {@code String} in any valid GUID format. * @return The new lease ID. */ - public Response changeLease(String leaseId, String proposedId) { - return this.changeLease(leaseId, proposedId, null, null); + public String changeLease(String leaseId, String proposedId) { + return changeLeaseWithResponse(leaseId, proposedId, null, null, Context.NONE).value(); } /** @@ -893,7 +902,7 @@ public Response changeLease(String leaseId, String proposedId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -904,10 +913,11 @@ public Response changeLease(String leaseId, String proposedId) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return The new lease ID. */ - public Response changeLease(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono> response = blobAsyncClient.changeLease(leaseId, proposedId, modifiedAccessConditions); + public Response changeLeaseWithResponse(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { + Mono> response = blobAsyncClient.changeLeaseWithResponse(leaseId, proposedId, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -924,8 +934,8 @@ public Response changeLease(String leaseId, String proposedId, ModifiedA * * @return The sku name and account kind. */ - public Response getAccountInfo() { - return this.getAccountInfo(null); + public StorageAccountInfo getAccountInfo() { + return getAccountInfoWithResponse(null, Context.NONE).value(); } /** @@ -933,17 +943,17 @@ public Response getAccountInfo() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.getAccountInfo#Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.getAccountInfoWithResponse#Duration-Context} * *

For more information, see the * Azure Docs

* * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return The sku name and account kind. */ - public Response getAccountInfo(Duration timeout) { - Mono> response = blobAsyncClient - .getAccountInfo(); + public Response getAccountInfoWithResponse(Duration timeout, Context context) { + Mono> response = blobAsyncClient.getAccountInfoWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java index 3b3d24ba6078..b157a3ec84fc 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java @@ -14,11 +14,16 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.PageRange; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.common.policy.RequestRetryOptions; @@ -62,13 +67,18 @@ *
  • {@link BlobClientBuilder#buildPageBlobAsyncClient()} - {@link PageBlobAsyncClient}
  • * */ +@ServiceClientBuilder(serviceClients = {BlobClient.class, BlobAsyncClient.class, AppendBlobClient.class, + AppendBlobAsyncClient.class, BlockBlobClient.class, BlockBlobAsyncClient.class, PageBlobClient.class, + PageBlobAsyncClient.class}) public final class BlobClientBuilder { private static final String ACCOUNT_NAME = "accountname"; private static final String ACCOUNT_KEY = "accountkey"; private static final String ENDPOINT_PROTOCOL = "defaultendpointsprotocol"; private static final String ENDPOINT_SUFFIX = "endpointsuffix"; - private final List policies; + private final ClientLogger logger = new ClientLogger(BlobClientBuilder.class); + + private final List additionalPolicies; private String endpoint; private String containerName; @@ -88,10 +98,10 @@ public final class BlobClientBuilder { public BlobClientBuilder() { retryOptions = new RequestRetryOptions(); logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); + additionalPolicies = new ArrayList<>(); } - private AzureBlobStorageImpl buildImpl() { + private AzureBlobStorageImpl constructImpl() { Objects.requireNonNull(endpoint); Objects.requireNonNull(containerName); Objects.requireNonNull(blobName); @@ -113,10 +123,11 @@ private AzureBlobStorageImpl buildImpl() { } else if (sasTokenCredential != null) { policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); } - + HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(new RequestRetryPolicy(retryOptions)); - policies.addAll(this.policies); + policies.addAll(this.additionalPolicies); + HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(logLevel)); HttpPipeline pipeline = new HttpPipelineBuilder() @@ -151,7 +162,7 @@ public BlobClient buildBlobClient() { * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. */ public BlobAsyncClient buildBlobAsyncClient() { - return new BlobAsyncClient(buildImpl(), snapshot); + return new BlobAsyncClient(constructImpl(), snapshot); } /** @@ -175,7 +186,7 @@ public AppendBlobClient buildAppendBlobClient() { * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. */ public AppendBlobAsyncClient buildAppendBlobAsyncClient() { - return new AppendBlobAsyncClient(buildImpl(), snapshot); + return new AppendBlobAsyncClient(constructImpl(), snapshot); } /** @@ -194,7 +205,7 @@ public BlockBlobClient buildBlockBlobClient() { /** * Creates a {@link BlockBlobAsyncClient} based on options set in the Builder. BlockBlobAsyncClients are used to * perform generic upload operations such as {@link BlockBlobAsyncClient#uploadFromFile(String) upload from file} - * and block blob specific operations such as {@link BlockBlobAsyncClient#stageBlock(String, Flux, long) stage block} + * and block blob specific operations such as {@link BlockBlobAsyncClient#stageBlockWithResponse(String, Flux, long, LeaseAccessConditions) stage block} * and {@link BlockBlobAsyncClient#commitBlockList(List) commit block list}, only use this when the blob is known to * be a block blob. * @@ -202,7 +213,7 @@ public BlockBlobClient buildBlockBlobClient() { * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. */ public BlockBlobAsyncClient buildBlockBlobAsyncClient() { - return new BlockBlobAsyncClient(buildImpl(), snapshot); + return new BlockBlobAsyncClient(constructImpl(), snapshot); } /** @@ -227,7 +238,7 @@ public PageBlobClient buildPageBlobClient() { * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. */ public PageBlobAsyncClient buildPageBlobAsyncClient() { - return new PageBlobAsyncClient(buildImpl(), snapshot); + return new PageBlobAsyncClient(constructImpl(), snapshot); } /** @@ -252,7 +263,7 @@ public BlobClientBuilder endpoint(String endpoint) { this.sharedKeyCredential = null; } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed.")); } return this; @@ -362,7 +373,7 @@ public BlobClientBuilder connectionString(String connectionString) { String endpointSuffix = connectionKVPs.get(ENDPOINT_SUFFIX); if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); + throw logger.logExceptionAsError(new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'.")); } if (!ImplUtils.isNullOrEmpty(endpointProtocol) && !ImplUtils.isNullOrEmpty(endpointSuffix)) { @@ -392,7 +403,7 @@ public BlobClientBuilder httpClient(HttpClient httpClient) { * @throws NullPointerException If {@code pipelinePolicy} is {@code null} */ public BlobClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(Objects.requireNonNull(pipelinePolicy)); + this.additionalPolicies.add(Objects.requireNonNull(pipelinePolicy)); return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobInputStream.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobInputStream.java index 18ef656c3550..7a468607a460 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobInputStream.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobInputStream.java @@ -2,10 +2,12 @@ // Licensed under the MIT License. package com.azure.storage.blob; +import com.azure.core.implementation.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.blob.models.BlobRange; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.common.Constants; -import reactor.netty.ByteBufFlux; import java.io.IOException; import java.io.InputStream; @@ -15,6 +17,8 @@ * Provides an input stream to read a given blob resource. */ public final class BlobInputStream extends InputStream { + private final ClientLogger logger = new ClientLogger(BlobInputStream.class); + /** * Holds the reference to the blob this stream is associated with. */ @@ -33,7 +37,7 @@ public final class BlobInputStream extends InputStream { /** * Holds the stream length. */ - private long streamLength; + private final long streamLength; /** * Holds the stream read size for both block and page blobs. @@ -73,7 +77,7 @@ public final class BlobInputStream extends InputStream { /** * Holds the {@link BlobAccessConditions} object that represents the access conditions for the blob. */ - private BlobAccessConditions accessCondition; + private final BlobAccessConditions accessCondition; /** * Offset of the source blob this class is configured to stream from. @@ -83,13 +87,10 @@ public final class BlobInputStream extends InputStream { /** * Initializes a new instance of the BlobInputStream class. * - * @param blobClient - * A {@link BlobClient} object which represents the blob that this stream is associated with. - * @param accessCondition - * An {@link BlobAccessConditions} object which represents the access conditions for the blob. + * @param blobClient A {@link BlobClient} object which represents the blob that this stream is associated with. + * @param accessCondition An {@link BlobAccessConditions} object which represents the access conditions for the blob. * - * @throws StorageException - * An exception representing any error which occurred during the operation. + * @throws StorageException An exception representing any error which occurred during the operation. */ BlobInputStream(final BlobAsyncClient blobClient, final BlobAccessConditions accessCondition) throws StorageException { this(blobClient, 0, null, accessCondition); @@ -100,17 +101,12 @@ public final class BlobInputStream extends InputStream { * Note that if {@code blobRangeOffset} is not {@code 0} or {@code blobRangeLength} is not {@code null}, there will * be no content MD5 verification. * - * @param blobClient - * A {@link BlobClient} object which represents the blob that this stream is associated with. - * @param blobRangeOffset - * The offset of blob data to begin stream. - * @param blobRangeLength - * How much data the stream should return after blobRangeOffset. - * @param accessCondition - * An {@link BlobAccessConditions} object which represents the access conditions for the blob. - * - * @throws StorageException - * An exception representing any error which occurred during the operation. + * @param blobClient A {@link BlobClient} object which represents the blob that this stream is associated with. + * @param blobRangeOffset The offset of blob data to begin stream. + * @param blobRangeLength How much data the stream should return after blobRangeOffset. + * @param accessCondition An {@link BlobAccessConditions} object which represents the access conditions for the blob. + * + * @throws StorageException An exception representing any error which occurred during the operation. */ BlobInputStream(final BlobAsyncClient blobClient, long blobRangeOffset, Long blobRangeLength, final BlobAccessConditions accessCondition) @@ -127,7 +123,7 @@ public final class BlobInputStream extends InputStream { throw new IndexOutOfBoundsException(); } - BlobProperties properties = blobClient.getProperties().block().value(); + BlobProperties properties = blobClient.getProperties().block(); this.streamLength = blobRangeLength == null ? properties.blobSize() - this.blobRangeOffset : Math.min(properties.blobSize() - this.blobRangeOffset, blobRangeLength); @@ -144,8 +140,7 @@ public final class BlobInputStream extends InputStream { * over) * from this input stream without blocking, or 0 when it reaches the end of the input stream. * - * @throws IOException - * If an I/O error occurs. + * @throws IOException If an I/O error occurs. */ @Override public synchronized int available() throws IOException { @@ -155,8 +150,7 @@ public synchronized int available() throws IOException { /** * Helper function to check if the stream is faulted, if it is it surfaces the exception. * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been + * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been * closed. */ private synchronized void checkStreamState() throws IOException { @@ -168,8 +162,7 @@ private synchronized void checkStreamState() throws IOException { /** * Closes this input stream and releases any system resources associated with the stream. * - * @throws IOException - * If an I/O error occurs. + * @throws IOException If an I/O error occurs. */ @Override public synchronized void close() throws IOException { @@ -182,16 +175,14 @@ public synchronized void close() throws IOException { * Dispatches a read operation of N bytes. When using sparse page blobs, the page ranges are evaluated and zero * bytes may be generated on the client side for some ranges that do not exist. * - * @param readLength - * An int which represents the number of bytes to read. + * @param readLength An int which represents the number of bytes to read. * - * @throws IOException - * If an I/O error occurs. + * @throws IOException If an I/O error occurs. */ private synchronized void dispatchRead(final int readLength) throws IOException { try { this.currentBuffer = this.blobClient.download(new BlobRange(this.currentAbsoluteReadPosition, (long) readLength), this.accessCondition, false) - .flatMap(res -> ByteBufFlux.fromInbound(res.body(null)).aggregate().asByteBuffer()) + .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.body(null)).map(ByteBuffer::wrap)) .block(); this.bufferSize = readLength; @@ -207,8 +198,7 @@ private synchronized void dispatchRead(final int readLength) throws IOException * Marks the current position in this input stream. A subsequent call to the reset method repositions this stream at * the last marked position so that subsequent reads re-read the same bytes. * - * @param readlimit - * An int which represents the maximum limit of bytes that can be read before the mark + * @param readlimit An int which represents the maximum limit of bytes that can be read before the mark * position becomes invalid. */ @Override @@ -238,8 +228,7 @@ public boolean markSupported() { * @return An int which represents the total number of bytes read into the buffer, or -1 if * there is no more data because the end of the stream has been reached. * - * @throws IOException - * If an I/O error occurs. + * @throws IOException If an I/O error occurs. */ @Override public int read() throws IOException { @@ -275,14 +264,11 @@ public int read() throws IOException { * * read(b, 0, b.length) * - * @param b - * A byte array which represents the buffer into which the data is read. + * @param b A byte array which represents the buffer into which the data is read. * - * @throws IOException - * If the first byte cannot be read for any reason other than the end of the file, if the input stream + * @throws IOException If the first byte cannot be read for any reason other than the end of the file, if the input stream * has been closed, or if some other I/O error occurs. - * @throws NullPointerException - * If the byte array b is null. + * @throws NullPointerException If the byte array b is null. */ @Override public int read(final byte[] b) throws IOException { @@ -323,30 +309,24 @@ public int read(final byte[] b) throws IOException { * provide a * more efficient implementation of this method. * - * @param b - * A byte array which represents the buffer into which the data is read. - * @param off - * An int which represents the start offset in the byte array at which the data + * @param b A byte array which represents the buffer into which the data is read. + * @param off An int which represents the start offset in the byte array at which the data * is written. - * @param len - * An int which represents the maximum number of bytes to read. + * @param len An int which represents the maximum number of bytes to read. * * @return An int which represents the total number of bytes read into the buffer, or -1 if * there is no more data because the end of the stream has been reached. * - * @throws IOException - * If the first byte cannot be read for any reason other than end of file, or if the input stream has + * @throws IOException If the first byte cannot be read for any reason other than end of file, or if the input stream has * been closed, or if some other I/O error occurs. - * @throws NullPointerException - * If the byte array b is null. - * @throws IndexOutOfBoundsException - * If off is negative, len is negative, or len is greater than + * @throws NullPointerException If the byte array b is null. + * @throws IndexOutOfBoundsException If off is negative, len is negative, or len is greater than * b.length - off. */ @Override public int read(final byte[] b, final int off, final int len) throws IOException { if (off < 0 || len < 0 || len > b.length - off) { - throw new IndexOutOfBoundsException(); + throw logger.logExceptionAsError(new IndexOutOfBoundsException()); } return this.readInternal(b, off, len); @@ -355,19 +335,15 @@ public int read(final byte[] b, final int off, final int len) throws IOException /** * Performs internal read to the given byte buffer. * - * @param b - * A byte array which represents the buffer into which the data is read. - * @param off - * An int which represents the start offset in the byte array b at + * @param b A byte array which represents the buffer into which the data is read. + * @param off An int which represents the start offset in the byte array b at * which the data is written. - * @param len - * An int which represents the maximum number of bytes to read. + * @param len An int which represents the maximum number of bytes to read. * * @return An int which represents the total number of bytes read into the buffer, or -1 if * there is no more data because the end of the stream has been reached. * - * @throws IOException - * If the first byte cannot be read for any reason other than end of file, or if the input stream has + * @throws IOException If the first byte cannot be read for any reason other than end of file, or if the input stream has * been closed, or if some other I/O error occurs. */ private synchronized int readInternal(final byte[] b, final int off, int len) throws IOException { @@ -406,8 +382,7 @@ private synchronized int readInternal(final byte[] b, final int off, int len) th /** * Repositions the stream to the given absolute byte offset. * - * @param absolutePosition - * A long which represents the absolute byte offset withitn the stream reposition. + * @param absolutePosition A long which represents the absolute byte offset withitn the stream reposition. */ private synchronized void reposition(final long absolutePosition) { this.currentAbsoluteReadPosition = absolutePosition; @@ -419,8 +394,7 @@ private synchronized void reposition(final long absolutePosition) { * Repositions this stream to the position at the time the mark method was last called on this input stream. Note * repositioning the blob read stream will disable blob MD5 checking. * - * @throws IOException - * If this stream has not been marked or if the mark has been invalidated. + * @throws IOException If this stream has not been marked or if the mark has been invalidated. */ @Override public synchronized void reset() throws IOException { @@ -438,8 +412,7 @@ public synchronized void reset() throws IOException { * * Note repositioning the blob read stream will disable blob MD5 checking. * - * @param n - * A long which represents the number of bytes to skip. + * @param n A long which represents the number of bytes to skip. */ @Override public synchronized long skip(final long n) throws IOException { @@ -448,7 +421,7 @@ public synchronized long skip(final long n) throws IOException { } if (n < 0 || this.currentAbsoluteReadPosition + n > this.streamLength + this.blobRangeOffset) { - throw new IndexOutOfBoundsException(); + throw logger.logExceptionAsError(new IndexOutOfBoundsException()); } this.reposition(this.currentAbsoluteReadPosition + n); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobOutputStream.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobOutputStream.java index f002ee4d1bf9..8c7315b2c3d1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobOutputStream.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobOutputStream.java @@ -5,200 +5,164 @@ import com.azure.storage.blob.models.AppendBlobAccessConditions; import com.azure.storage.blob.models.AppendPositionAccessConditions; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.PageBlobAccessConditions; import com.azure.storage.blob.models.PageRange; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import org.reactivestreams.Subscriber; -import org.reactivestreams.Subscription; -import reactor.core.CoreSubscriber; +import com.azure.storage.blob.models.StorageException; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.core.publisher.Operators; +import reactor.core.scheduler.Schedulers; +import reactor.util.annotation.NonNull; import java.io.IOException; import java.io.OutputStream; -import java.nio.channels.CompletionHandler; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Base64; -import java.util.TreeMap; +import java.util.List; import java.util.UUID; -import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; -import java.util.concurrent.atomic.AtomicLongFieldUpdater; - -public final class BlobOutputStream extends OutputStream { - /** - * Holds the {@link BlobAccessConditions} object that represents the access conditions for the blob. - */ - private BlobAccessConditions accessCondition; - - private AppendPositionAccessConditions appendPositionAccessConditions; - - /** - * Used for block blobs, holds the block id prefix. - */ - private String blockIdPrefix; - - /** - * Used for block blobs, holds the block list. - */ - private TreeMap blockList; - - /** +public abstract class BlobOutputStream extends OutputStream { + /* * Holds the write threshold of number of bytes to buffer prior to dispatching a write. For block blob this is the * block size, for page blob this is the Page commit size. */ - private int internalWriteThreshold = -1; + int writeThreshold; - /** + /* * Holds the last exception this stream encountered. */ - private volatile IOException lastError = null; + volatile IOException lastError; + static BlobOutputStream appendBlobOutputStream(final AppendBlobAsyncClient client, final AppendBlobAccessConditions appendBlobAccessConditions) { + return new AppendBlobOutputStream(client, appendBlobAccessConditions); + } - private long initialBlobOffset; + static BlobOutputStream blockBlobOutputStream(final BlockBlobAsyncClient client, final BlobAccessConditions accessConditions) { + return new BlockBlobOutputStream(client, accessConditions); + } - /** - * Holds the reference to the blob this stream is associated with. - */ - private final BlobAsyncClient blobClient; + static BlobOutputStream pageBlobOutputStream(final PageBlobAsyncClient client, final long length, final BlobAccessConditions accessConditions) { + return new PageBlobOutputStream(client, length, accessConditions); + } + + abstract Mono dispatchWrite(byte[] data, int writeLength, long offset); + + abstract void commit(); /** - * Determines if this stream is used against a page blob or block blob. + * Writes the data to the buffer and triggers writes to the service as needed. + * + * @param data A byte array which represents the data to write. + * @param offset An int which represents the start offset in the data. + * @param length An int which represents the number of bytes to write. + * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has + * been closed. */ - private BlobType streamType = BlobType.BLOCK_BLOB; + private void writeInternal(final byte[] data, int offset, int length) { + int chunks = (int) (Math.ceil((double) length / (double) this.writeThreshold)); + Flux.range(0, chunks).map(c -> offset + c * this.writeThreshold) + .concatMap(pos -> processChunk(data, pos, offset, length)) + .then() + .block(); + } + + private Mono processChunk(byte[] data, int position, int offset, int length) { + int chunkLength = this.writeThreshold; + + if (position + chunkLength > offset + length) { + chunkLength = offset + length - position; + } + + // Flux chunkData = new ByteBufferStreamFromByteArray(data, writeThreshold, position, chunkLength); + return dispatchWrite(data, chunkLength, position - offset) + .doOnError(t -> { + if (t instanceof IOException) { + lastError = (IOException) t; + } else { + lastError = new IOException(t); + } + }); + } /** - * Initializes a new instance of the BlobOutputStream class. - * - * @param parentBlob - * A {@link BlobAsyncClient} object which represents the blob that this stream is associated with. + * Helper function to check if the stream is faulted, if it is it surfaces the exception. * - * @throws StorageException - * An exception representing any error which occurred during the operation. + * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has + * been closed. */ - private BlobOutputStream(final BlobAsyncClient parentBlob) throws StorageException { - this.blobClient = parentBlob; -// completion = Flux.defer(() -> { -// if (this.streamType == BlobType.APPEND_BLOB) { -// return writeProcessor.concatMap(b -> { -// long offset = currentOffset.getAndAdd(b.length); -// return dispatchWrite(b, offset); -// }); -// } else { -// return writeProcessor.map(b -> Tuples.of(b, currentOffset.getAndAdd(b.length))) -// .flatMap(chunk -> dispatchWrite(chunk.getT1(), chunk.getT2())); -// } -// }) -// .doOnError(t -> { -// if (t instanceof IOException) { -// lastError = (IOException) t; -// } else { -// lastError = new IOException(t); -// } -// completionSink.error(t); -// }) -// .doOnNext(length -> completionSink.next(length)) -// .doOnComplete(() -> completionSink.complete()); + private void checkStreamState() throws IOException { + if (this.lastError != null) { + throw this.lastError; + } } /** - * Initializes a new instance of the BlobOutputStream class for a CloudBlockBlob - * - * @param parentBlob - * A {@link BlobAsyncClient} object which represents the blob that this stream is associated with. - * @param accessCondition - * An {@link BlobAccessConditions} object which represents the access conditions for the blob. + * Flushes this output stream and forces any buffered output bytes to be written out. If any data remains in the + * buffer it is committed to the service. * - * @throws StorageException - * An exception representing any error which occurred during the operation. + * @throws IOException If an I/O error occurs. */ - BlobOutputStream(final BlockBlobAsyncClient parentBlob, final BlobAccessConditions accessCondition) throws StorageException { - this((BlobAsyncClient) parentBlob); - - this.accessCondition = accessCondition; - this.blockList = new TreeMap<>(); - this.blockIdPrefix = UUID.randomUUID().toString() + "-"; - - this.streamType = BlobType.BLOCK_BLOB; - this.internalWriteThreshold = (int) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; + @Override + public void flush() throws IOException { + this.checkStreamState(); } /** - * Initializes a new instance of the BlobOutputStream class for a CloudPageBlob - * - * @param parentBlob - * A {@link PageBlobClient} object which represents the blob that this stream is associated with. - * @param length - * A long which represents the length of the page blob in bytes, which must be a multiple of - * 512. - * @param accessCondition - * An {@link BlobAccessConditions} object which represents the access conditions for the blob. + * Writes b.length bytes from the specified byte array to this output stream. + *

    * - * @throws StorageException - * An exception representing any error which occurred during the operation. + * @param data A byte array which represents the data to write. + * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has + * been closed. */ - BlobOutputStream(final PageBlobAsyncClient parentBlob, final long length, final BlobAccessConditions accessCondition) - throws StorageException { - this((BlobAsyncClient) parentBlob); - this.streamType = BlobType.PAGE_BLOB; - this.accessCondition = accessCondition; - this.internalWriteThreshold = (int) Math.min(BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, length); + @Override + public void write(@NonNull final byte[] data) throws IOException { + this.write(data, 0, data.length); } /** - * Initializes a new instance of the BlobOutputStream class for a CloudAppendBlob - * - * @param parentBlob - * A {@link AppendBlobAsyncClient} object which represents the blob that this stream is associated with. - * @param accessCondition - * An {@link BlobAccessConditions} object which represents the access conditions for the blob. + * Writes length bytes from the specified byte array starting at offset to this output stream. + *

    * - * @throws StorageException - * An exception representing any error which occurred during the operation. + * @param data A byte array which represents the data to write. + * @param offset An int which represents the start offset in the data. + * @param length An int which represents the number of bytes to write. + * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has + * been closed. */ - BlobOutputStream(final AppendBlobAsyncClient parentBlob, final AppendBlobAccessConditions accessCondition) - throws StorageException { - this((BlobAsyncClient) parentBlob); - this.streamType = BlobType.APPEND_BLOB; - - this.accessCondition = new BlobAccessConditions(); - if (accessCondition != null) { - this.appendPositionAccessConditions = accessCondition.appendPositionAccessConditions(); - this.accessCondition = new BlobAccessConditions().modifiedAccessConditions(accessCondition.modifiedAccessConditions()).leaseAccessConditions(accessCondition.leaseAccessConditions()); - if (accessCondition.appendPositionAccessConditions().appendPosition() != null) { - this.initialBlobOffset = accessCondition.appendPositionAccessConditions().appendPosition(); - } else { - this.initialBlobOffset = parentBlob.getProperties().block().value().blobSize(); - } + @Override + public void write(@NonNull final byte[] data, final int offset, final int length) throws IOException { + if (offset < 0 || length < 0 || length > data.length - offset) { + throw new IndexOutOfBoundsException(); } - this.internalWriteThreshold = (int) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; + this.writeInternal(data, offset, length); } /** - * Helper function to check if the stream is faulted, if it is it surfaces the exception. + * Writes the specified byte to this output stream. The general contract for write is that one byte is written to + * the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits + * of b are ignored. + *

    + * true is acceptable for you. * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. + * @param byteVal An int which represents the bye value to write. + * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has + * been closed. + */ - private void checkStreamState() throws IOException { - if (this.lastError != null) { - throw this.lastError; - } + @Override + public void write(final int byteVal) throws IOException { + this.write(new byte[]{(byte) (byteVal & 0xFF)}); } /** * Closes this output stream and releases any system resources associated with this stream. If any data remains in * the buffer it is committed to the service. * - * @throws IOException - * If an I/O error occurs. + * @throws IOException If an I/O error occurs. */ @Override public synchronized void close() throws IOException { @@ -222,450 +186,174 @@ public synchronized void close() throws IOException { } } - /** - * Commits the blob, for block blob this uploads the block list. - * - * @throws StorageException - * An exception representing any error which occurred during the operation. - */ - private synchronized void commit() throws StorageException { - if (this.streamType == BlobType.BLOCK_BLOB) { - // wait for all blocks to finish - assert this.blobClient instanceof BlockBlobAsyncClient; - final BlockBlobAsyncClient blobRef = (BlockBlobAsyncClient) this.blobClient; - blobRef.commitBlockList(new ArrayList<>(this.blockList.values()), null, null, this.accessCondition).block(); - } - } + private static final class AppendBlobOutputStream extends BlobOutputStream { + private final AppendBlobAccessConditions appendBlobAccessConditions; + private final AppendPositionAccessConditions appendPositionAccessConditions; + private final long initialBlobOffset; + private final AppendBlobAsyncClient client; - /** - * Dispatches a write operation for a given length. - * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. - */ - private Mono dispatchWrite(Flux bufferRef, int writeLength, long offset) { - if (writeLength == 0) { - return Mono.empty(); + private AppendBlobOutputStream(final AppendBlobAsyncClient client, final AppendBlobAccessConditions appendBlobAccessConditions) { + this.client = client; + this.writeThreshold = BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; + this.appendBlobAccessConditions = appendBlobAccessConditions; + + if (appendBlobAccessConditions != null) { + this.appendPositionAccessConditions = appendBlobAccessConditions.appendPositionAccessConditions(); + + if (appendBlobAccessConditions.appendPositionAccessConditions().appendPosition() != null) { + this.initialBlobOffset = appendBlobAccessConditions.appendPositionAccessConditions().appendPosition(); + } else { + this.initialBlobOffset = client.getProperties().block().blobSize(); + } + } else { + this.initialBlobOffset = client.getProperties().block().blobSize(); + this.appendPositionAccessConditions = new AppendPositionAccessConditions(); + } } - if (this.streamType == BlobType.PAGE_BLOB && (writeLength % PageBlobAsyncClient.PAGE_BYTES != 0)) { - return Mono.error(new IOException(String.format(SR.INVALID_NUMBER_OF_BYTES_IN_THE_BUFFER, writeLength))); + private Mono appendBlock(Flux blockData, long offset, long writeLength) { + this.appendPositionAccessConditions.appendPosition(offset); + + return client.appendBlockWithResponse(blockData, writeLength, appendBlobAccessConditions) + .then() + .onErrorResume(t -> t instanceof IOException || t instanceof StorageException, e -> { + this.lastError = new IOException(e); + return null; + }); } - if (this.streamType == BlobType.BLOCK_BLOB) { - final String blockID = this.getCurrentBlockId(); - this.blockList.put(offset, blockID); - return BlobOutputStream.this.writeBlock(bufferRef, blockID, writeLength).then(Mono.just(writeLength)); - } else if (this.streamType == BlobType.PAGE_BLOB) { - return BlobOutputStream.this.writePages(bufferRef, offset, writeLength).then(Mono.just(writeLength)); - } else if (this.streamType == BlobType.APPEND_BLOB) { + @Override + Mono dispatchWrite(byte[] data, int writeLength, long offset) { + if (writeLength == 0) { + return Mono.empty(); + } + // We cannot differentiate between max size condition failing only in the retry versus failing in the // first attempt and retry even for a single writer scenario. So we will eliminate the latter and handle // the former in the append block method. - if (this.appendPositionAccessConditions != null && this.appendPositionAccessConditions.maxSize() != null + if (this.appendPositionAccessConditions != null + && this.appendPositionAccessConditions.maxSize() != null && this.initialBlobOffset > this.appendPositionAccessConditions.maxSize()) { this.lastError = new IOException(SR.INVALID_BLOCK_SIZE); return Mono.error(this.lastError); } - return BlobOutputStream.this.appendBlock(bufferRef, offset, writeLength).then(Mono.justOrEmpty(writeLength)); - } else { - return Mono.error(new RuntimeException("Unknown blob type " + this.streamType)); - } - } - - private Mono writeBlock(Flux blockData, String blockId, long writeLength) { - assert this.blobClient instanceof BlockBlobAsyncClient; - final BlockBlobAsyncClient blobRef = (BlockBlobAsyncClient) this.blobClient; - - LeaseAccessConditions leaseAccessConditions = accessCondition == null ? null : accessCondition.leaseAccessConditions(); - - return blobRef.stageBlock(blockId, blockData, writeLength, leaseAccessConditions) - .then() - .onErrorResume(t -> t instanceof StorageException, e -> { - this.lastError = new IOException(e); - return null; - }); - } - - private Mono writePages(Flux pageData, long offset, long writeLength) { - assert this.blobClient instanceof PageBlobAsyncClient; - final PageBlobAsyncClient blobRef = (PageBlobAsyncClient) this.blobClient; - - PageBlobAccessConditions pageBlobAccessConditions = accessCondition == null ? null : new PageBlobAccessConditions().leaseAccessConditions(accessCondition.leaseAccessConditions()).modifiedAccessConditions(accessCondition.modifiedAccessConditions()); - - return blobRef.uploadPages(new PageRange().start(offset).end(offset + writeLength - 1), pageData, pageBlobAccessConditions) - .then() - .onErrorResume(t -> t instanceof StorageException, e -> { - this.lastError = new IOException(e); - return null; - }); - } + Flux fbb = Flux.range(0, 1) + .concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength))); - private Mono appendBlock(Flux blockData, long offset, long writeLength) { - assert this.blobClient instanceof AppendBlobAsyncClient; - final AppendBlobAsyncClient blobRef = (AppendBlobAsyncClient) this.blobClient; - if (this.appendPositionAccessConditions == null) { - appendPositionAccessConditions = new AppendPositionAccessConditions(); + return this.appendBlock(fbb.subscribeOn(Schedulers.elastic()), offset, writeLength); } - this.appendPositionAccessConditions.appendPosition(offset); - AppendBlobAccessConditions appendBlobAccessConditions = accessCondition == null ? null : new AppendBlobAccessConditions().leaseAccessConditions(accessCondition.leaseAccessConditions()).modifiedAccessConditions(accessCondition.modifiedAccessConditions()); - return blobRef.appendBlock(blockData, writeLength, appendBlobAccessConditions) - .then() - .onErrorResume(t -> t instanceof IOException || t instanceof StorageException, e -> { - this.lastError = new IOException(e); - return null; - }); - } - - /** - * Flushes this output stream and forces any buffered output bytes to be written out. If any data remains in the - * buffer it is committed to the service. - * - * @throws IOException - * If an I/O error occurs. - */ - @Override - public void flush() throws IOException { - this.checkStreamState(); - } - - /** - * Generates a new block ID to be used for PutBlock. - * - * @return Base64 encoded block ID - */ - private String getCurrentBlockId() { - String blockIdSuffix = String.format("%06d", this.blockList.size()); - - byte[] blockIdInBytes; - blockIdInBytes = (this.blockIdPrefix + blockIdSuffix).getBytes(StandardCharsets.UTF_8); - - return Base64.getEncoder().encodeToString(blockIdInBytes); - } - - /** - * Writes b.length bytes from the specified byte array to this output stream. - *

    - * - * @param data - * A byte array which represents the data to write. - * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. - */ - @Override - public void write(final byte[] data) throws IOException { - this.write(data, 0, data.length); + @Override + void commit() { + // AppendBlob doesn't need to commit anything. + } } - /** - * Writes length bytes from the specified byte array starting at offset to this output stream. - *

    - * - * @param data - * A byte array which represents the data to write. - * @param offset - * An int which represents the start offset in the data. - * @param length - * An int which represents the number of bytes to write. - * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. - */ - @Override - public void write(final byte[] data, final int offset, final int length) throws IOException { - if (offset < 0 || length < 0 || length > data.length - offset) { - throw new IndexOutOfBoundsException(); + private static final class BlockBlobOutputStream extends BlobOutputStream { + private final BlobAccessConditions accessConditions; + private final String blockIdPrefix; + private final List blockList; + private final BlockBlobAsyncClient client; + + private BlockBlobOutputStream(final BlockBlobAsyncClient client, final BlobAccessConditions accessConditions) { + this.client = client; + this.accessConditions = accessConditions; + this.blockIdPrefix = UUID.randomUUID().toString() + '-'; + this.blockList = new ArrayList<>(); + this.writeThreshold = BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; } - this.writeInternal(data, offset, length); - } + /** + * Generates a new block ID to be used for PutBlock. + * + * @return Base64 encoded block ID + */ + private String getCurrentBlockId() { + String blockIdSuffix = String.format("%06d", this.blockList.size()); + return Base64.getEncoder().encodeToString((this.blockIdPrefix + blockIdSuffix).getBytes(StandardCharsets.UTF_8)); + } - /** - * Writes the specified byte to this output stream. The general contract for write is that one byte is written to - * the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits - * of b are ignored. - *

    - * true is acceptable for you. - * - * @param byteVal - * An int which represents the bye value to write. - * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. - */ - @Override - public void write(final int byteVal) throws IOException { - this.write(new byte[] { (byte) (byteVal & 0xFF) }); - } + private Mono writeBlock(Flux blockData, String blockId, long writeLength) { + LeaseAccessConditions leaseAccessConditions = (accessConditions == null) ? null : accessConditions.leaseAccessConditions(); - /** - * Writes the data to the buffer and triggers writes to the service as needed. - * - * @param data - * A byte array which represents the data to write. - * @param offset - * An int which represents the start offset in the data. - * @param length - * An int which represents the number of bytes to write. - * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. - */ - private void writeInternal(final byte[] data, int offset, int length) { - int chunks = (int) (Math.ceil((double) length / (double) this.internalWriteThreshold)); - Flux chunkPositions = Flux.range(0, chunks).map(c -> offset + c * this.internalWriteThreshold); - if (this.streamType == BlobType.APPEND_BLOB) { - chunkPositions.concatMap(pos -> processChunk(data, pos, offset, length)).then().block(); - } else { - chunkPositions.concatMap(pos -> processChunk(data, pos, offset, length)).then().block(); + return client.stageBlockWithResponse(blockId, blockData, writeLength, leaseAccessConditions) + .then() + .onErrorResume(t -> t instanceof StorageException, e -> { + this.lastError = new IOException(e); + return null; + }); } -// synchronized (outBufferLock) { -// while (length > 0) { -// this.checkStreamState(); -// -// final int availableBufferBytes = this.internalWriteThreshold - this.outBuffer.size(); -// final int nextWrite = Math.min(availableBufferBytes, length); -// -// this.outBuffer.write(data, offset, nextWrite); -// offset += nextWrite; -// length -= nextWrite; -// -// if (this.outBuffer.size() == this.internalWriteThreshold) { -// this.writeSink.next(outBuffer.toByteArray()); -// outBuffer.reset(); -// numInFlight.incrementAndGet(); -// } -// } -// } - } + @Override + Mono dispatchWrite(byte[] data, int writeLength, long offset) { + if (writeLength == 0) { + return Mono.empty(); + } - private Mono processChunk(byte[] data, int position, int offset, int length) { - int chunkLength = this.internalWriteThreshold; - if (position + chunkLength > offset + length) { - chunkLength = offset + length - position; - } - Flux chunkData = new ByteBufStreamFromByteArray(data, 64 * 1024, position, chunkLength); - return dispatchWrite(chunkData, chunkLength, position - offset) - .doOnError(t -> { - if (t instanceof IOException) { - lastError = (IOException) t; - } else { - lastError = new IOException(t); - } - }); - } + final String blockID = this.getCurrentBlockId(); + this.blockList.add(blockID); + + Flux fbb = Flux.range(0, 1) + .concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength))); - private static final class ByteBufStreamFromByteArray extends Flux { - private final ByteBufAllocator alloc; - private final byte[] bigByteArray; - private final int chunkSize; - private final int offset; - private final int length; - - ByteBufStreamFromByteArray(byte[] bigByteArray, int chunkSize, int offset, int length) { - this.alloc = ByteBufAllocator.DEFAULT; - this.bigByteArray = bigByteArray; - this.chunkSize = chunkSize; - this.offset = offset; - this.length = length; + return this.writeBlock(fbb.subscribeOn(Schedulers.elastic()), blockID, writeLength); } + /** + * Commits the blob, for block blob this uploads the block list. + */ @Override - public void subscribe(CoreSubscriber actual) { - ByteBufStreamFromByteArray.FileReadSubscription subscription = new ByteBufStreamFromByteArray.FileReadSubscription(actual, bigByteArray, alloc, chunkSize, offset, length); - actual.onSubscribe(subscription); + synchronized void commit() { + client.commitBlockListWithResponse(this.blockList, null, null, this.accessConditions).block(); } + } - static final class FileReadSubscription implements Subscription, CompletionHandler { - private static final int NOT_SET = -1; - private static final long serialVersionUID = -6831808726875304256L; - // - private final Subscriber subscriber; - private volatile int position; - // - private final byte[] bigByteArray; - private final ByteBufAllocator alloc; - private final int chunkSize; - private final int offset; - private final int length; - // - private volatile boolean done; - private Throwable error; - private volatile ByteBuf next; - private volatile boolean cancelled; - // - volatile int wip; - @SuppressWarnings("rawtypes") - static final AtomicIntegerFieldUpdater WIP = AtomicIntegerFieldUpdater.newUpdater(ByteBufStreamFromByteArray.FileReadSubscription.class, "wip"); - volatile long requested; - @SuppressWarnings("rawtypes") - static final AtomicLongFieldUpdater REQUESTED = AtomicLongFieldUpdater.newUpdater(ByteBufStreamFromByteArray.FileReadSubscription.class, "requested"); - // - - FileReadSubscription(Subscriber subscriber, byte[] bigByteArray, ByteBufAllocator alloc, int chunkSize, int offset, int length) { - this.subscriber = subscriber; - // - this.bigByteArray = bigByteArray; - this.alloc = alloc; - this.chunkSize = chunkSize; - this.offset = offset; - this.length = length; - // - this.position = NOT_SET; - } + private static final class PageBlobOutputStream extends BlobOutputStream { + private final PageBlobAsyncClient client; + private final PageBlobAccessConditions pageBlobAccessConditions; - //region Subscription implementation + private PageBlobOutputStream(final PageBlobAsyncClient client, final long length, final BlobAccessConditions blobAccessConditions) { + this.client = client; + this.writeThreshold = (int) Math.min(BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, length); - @Override - public void request(long n) { - if (Operators.validate(n)) { - Operators.addCap(REQUESTED, this, n); - drain(); - } + if (blobAccessConditions != null) { + this.pageBlobAccessConditions = new PageBlobAccessConditions() + .modifiedAccessConditions(blobAccessConditions.modifiedAccessConditions()) + .leaseAccessConditions(blobAccessConditions.leaseAccessConditions()); + } else { + this.pageBlobAccessConditions = null; } + } - @Override - public void cancel() { - this.cancelled = true; - } + private Mono writePages(Flux pageData, long offset, long writeLength) { + return client.uploadPagesWithResponse(new PageRange().start(offset).end(offset + writeLength - 1), pageData, pageBlobAccessConditions) + .then() + .onErrorResume(t -> t instanceof StorageException, e -> { + this.lastError = new IOException(e); + return null; + }); + } - //endregion - - //region CompletionHandler implementation - - @Override - public void completed(Integer bytesRead, ByteBuf buffer) { - if (!cancelled) { - if (bytesRead == -1) { - done = true; - } else { - // use local variable to perform fewer volatile reads - int pos = position; - // - int bytesWanted = (int) Math.min(bytesRead, maxRequired(pos)); - buffer.writerIndex(bytesWanted); - int position2 = pos + bytesWanted; - //noinspection NonAtomicOperationOnVolatileField - position = position2; - next = buffer; - if (position2 >= offset + length) { - done = true; - } - } - drain(); - } + @Override + Mono dispatchWrite(byte[] data, int writeLength, long offset) { + if (writeLength == 0) { + return Mono.empty(); } - @Override - public void failed(Throwable exc, ByteBuf attachment) { - if (!cancelled) { - // must set error before setting done to true - // so that is visible in drain loop - error = exc; - done = true; - drain(); - } + if (writeLength % PageBlobAsyncClient.PAGE_BYTES != 0) { + return Mono.error(new IOException(String.format(SR.INVALID_NUMBER_OF_BYTES_IN_THE_BUFFER, writeLength))); } - //endregion + Flux fbb = Flux.range(0, 1) + .concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength))); - private void drain() { - if (WIP.getAndIncrement(this) != 0) { - return; - } - // on first drain (first request) we initiate the first read - if (position == NOT_SET) { - position = offset; - doRead(); - } - int missed = 1; - for (;;) { - if (cancelled) { - return; - } - if (REQUESTED.get(this) > 0) { - boolean emitted = false; - // read d before next to avoid race - boolean d = done; - ByteBuf bb = next; - if (bb != null) { - next = null; - // - // try { - subscriber.onNext(bb); - // } finally { - // Note: Don't release here, we follow netty disposal pattern - // it's consumers responsiblity to release chunks after consumption. - // - // ReferenceCountUtil.release(bb); - // } - // - emitted = true; - } else { - emitted = false; - } - if (d) { - if (error != null) { - subscriber.onError(error); - // exit without reducing wip so that further drains will be NOOP - return; - } else { - subscriber.onComplete(); - // exit without reducing wip so that further drains will be NOOP - return; - } - } - if (emitted) { - // do this after checking d to avoid calling read - // when done - Operators.produced(REQUESTED, this, 1); - // - doRead(); - } - } - missed = WIP.addAndGet(this, -missed); - if (missed == 0) { - return; - } - } - } - - private void doRead() { - // use local variable to limit volatile reads - int pos = position; - int readSize = Math.min(chunkSize, maxRequired(pos)); - ByteBuf innerBuf = alloc.buffer(readSize, readSize); - try { - innerBuf.writeBytes(bigByteArray, pos, readSize); - completed(readSize, innerBuf); - } catch (Exception e) { - failed(e, innerBuf); - } - } + return this.writePages(fbb.subscribeOn(Schedulers.elastic()), offset, writeLength); + } - private int maxRequired(long pos) { - long maxRequired = offset + length - pos; - if (maxRequired <= 0) { - return 0; - } else { - int m = (int) (maxRequired); - // support really large files by checking for overflow - if (m < 0) { - return Integer.MAX_VALUE; - } else { - return m; - } - } - } + @Override + void commit() { + // PageBlob doesn't need to commit anything. } } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java index 24f4b0d0a96c..84dd7d2d0a9d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java @@ -34,8 +34,7 @@ public BlobSASPermission() { * Creates a {@code BlobSASPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString - * A {@code String} which represents the {@code BlobSASPermission}. + * @param permString A {@code String} which represents the {@code BlobSASPermission}. * * @return A {@code BlobSASPermission} generated from the given {@code String}. * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, c, w, or d. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index e009c5631b77..a407333bfe04 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -5,10 +5,15 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.util.FluxUtil; +import com.azure.core.implementation.http.PagedResponseBase; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.ContainerItem; @@ -25,19 +30,21 @@ import com.azure.storage.common.SASProtocol; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SharedKeyCredential; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.MalformedURLException; import java.net.URL; +import java.time.Duration; import java.time.OffsetDateTime; +import java.util.function.Function; import static com.azure.storage.blob.PostProcessor.postProcessResponse; +import static com.azure.core.implementation.util.FluxUtil.withContext; /** - * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does not - * hold any state about a particular storage account but is instead a convenient way of sending off appropriate requests - * to the resource on the service. It may also be used to construct URLs to blobs and containers. + * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does + * not hold any state about a particular storage account but is instead a convenient way of sending off appropriate + * requests to the resource on the service. It may also be used to construct URLs to blobs and containers. * *

    * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient} @@ -54,6 +61,8 @@ * responses to a {@link java.util.concurrent.CompletableFuture} object through {@link Mono#toFuture()}. */ public final class BlobServiceAsyncClient { + private final ClientLogger logger = new ClientLogger(BlobServiceAsyncClient.class); + private final AzureBlobStorageImpl azureBlobStorage; /** @@ -86,10 +95,10 @@ public ContainerAsyncClient getContainerAsyncClient(String containerName) { * Azure Docs. * * @param containerName Name of the container to create - * @return A response containing a {@link ContainerAsyncClient} used to interact with the container created. + * @return A {@link Mono} containing a {@link ContainerAsyncClient} used to interact with the container created. */ - public Mono> createContainer(String containerName) { - return createContainer(containerName, null, null); + public Mono createContainer(String containerName) { + return createContainerWithResponse(containerName, null, null).flatMap(FluxUtil::toMono); } /** @@ -101,24 +110,46 @@ public Mono> createContainer(String containerName * @param metadata {@link Metadata} * @param accessType Specifies how the data in this container is available to the public. See the * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. - * @return A response containing a {@link ContainerAsyncClient} used to interact with the container created. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains a {@link + * ContainerAsyncClient} used to interact with the container created. */ - public Mono> createContainer(String containerName, Metadata metadata, PublicAccessType accessType) { + public Mono> createContainerWithResponse(String containerName, Metadata metadata, PublicAccessType accessType) { + return withContext(context -> createContainerWithResponse(containerName, metadata, accessType, context)); + } + + Mono> createContainerWithResponse(String containerName, Metadata metadata, PublicAccessType accessType, Context context) { ContainerAsyncClient containerAsyncClient = getContainerAsyncClient(containerName); - return containerAsyncClient.create(metadata, accessType) + return containerAsyncClient.createWithResponse(metadata, accessType, context) .map(response -> new SimpleResponse<>(response, containerAsyncClient)); } /** * Deletes the specified container in the storage account. If the container doesn't exist the operation fails. For - * more information see the Azure Docs. + * more information see the Azure + * Docs. * * @param containerName Name of the container to delete - * @return A response containing status code and HTTP headers + * @return A {@link Mono} containing containing status code and HTTP headers */ - public Mono deleteContainer(String containerName) { - return getContainerAsyncClient(containerName).delete(); + public Mono deleteContainer(String containerName) { + return deleteContainerWithResponse(containerName).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the specified container in the storage account. If the container doesn't exist the operation fails. For + * more information see the Azure + * Docs. + * + * @param containerName Name of the container to delete + * @return A {@link Mono} containing containing status code and HTTP headers + */ + public Mono deleteContainerWithResponse(String containerName) { + return withContext(context -> deleteContainerWithResponse(containerName, context)); + } + + Mono deleteContainerWithResponse(String containerName, Context context) { + return getContainerAsyncClient(containerName).deleteWithResponse(null, context); } /** @@ -131,7 +162,7 @@ public URL getAccountUrl() { try { return new URL(azureBlobStorage.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e)); } } @@ -141,7 +172,7 @@ public URL getAccountUrl() { * * @return A reactive response emitting the list of containers. */ - public Flux listContainers() { + public PagedFlux listContainers() { return this.listContainers(new ListContainersOptions()); } @@ -152,9 +183,34 @@ public Flux listContainers() { * @param options A {@link ListContainersOptions} which specifies what data should be returned by the service. * @return A reactive response emitting the list of containers. */ - public Flux listContainers(ListContainersOptions options) { - return listContainersSegment(null, options) - .flatMapMany(response -> listContainersHelper(response.value().marker(), options, response)); + public PagedFlux listContainers(ListContainersOptions options) { + return listContainersWithOptionalTimeout(options, null); + } + + /* + * Implementation for this paged listing operation, supporting an optional timeout provided by the synchronous + * BlobServiceClient. Applies the given timeout to each Mono backing the + * PagedFlux. + * + * @param options A {@link ListContainersOptions} which specifies what data should be returned by the service. + * @param timeout An optional timeout to be applied to the network asynchronous operations. + * @return A reactive response emitting the list of containers. + */ + PagedFlux listContainersWithOptionalTimeout(ListContainersOptions options, Duration timeout) { + + Function>> func = + marker -> listContainersSegment(marker, options, timeout) + .map(response -> new PagedResponseBase<>( + response.request(), + response.statusCode(), + response.headers(), + response.value().containerItems(), + response.value().nextMarker(), + response.deserializedHeaders())); + + return new PagedFlux<>( + () -> func.apply(null), + marker -> func.apply(marker)); } /* @@ -178,37 +234,39 @@ public Flux listContainers(ListContainersOptions options) { * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list_helper "Helper code for ServiceURL.listContainersSegment")] \n * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) */ - private Mono listContainersSegment(String marker, ListContainersOptions options) { + private Mono listContainersSegment(String marker, ListContainersOptions options, Duration timeout) { options = options == null ? new ListContainersOptions() : options; - return postProcessResponse( + return postProcessResponse(Utility.applyOptionalTimeout( this.azureBlobStorage.services().listContainersSegmentWithRestResponseAsync( options.prefix(), marker, options.maxResults(), options.details().toIncludeType(), null, - null, Context.NONE)); + null, Context.NONE), timeout)); } - private Flux listContainersHelper(String marker, ListContainersOptions options, - ServicesListContainersSegmentResponse response) { - Flux result = Flux.fromIterable(response.value().containerItems()); - if (response.value().nextMarker() != null) { - // Recursively add the continuation items to the observable. - result = result.concatWith(listContainersSegment(marker, options) - .flatMapMany((r) -> - listContainersHelper(response.value().nextMarker(), options, r))); - } - - return result; + /** + * Gets the properties of a storage account’s Blob service. For more information, see the + * Azure Docs. + * + * @return A reactive response containing the storage account properties. + */ + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } /** * Gets the properties of a storage account’s Blob service. For more information, see the * Azure Docs. * - * @return A reactive response containing the storage account properties. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the storage + * account properties. */ - public Mono> getProperties() { + public Mono> getPropertiesWithResponse() { + return withContext(context -> getPropertiesWithResponse(context)); + } + + Mono> getPropertiesWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, Context.NONE)) + this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.value())); } @@ -219,11 +277,28 @@ public Mono> getProperties() { * sets the version header on each request, overriding the default. * * @param properties Configures the service. - * @return A reactive response containing the storage account properties. + * @return A {@link Mono} containing the storage account properties. + */ + public Mono setProperties(StorageServiceProperties properties) { + return setPropertiesWithReponse(properties).flatMap(FluxUtil::toMono); + } + + /** + * Sets properties for a storage account's Blob service endpoint. For more information, see the + * Azure Docs. + * Note that setting the default service version has no effect when using this client because this client explicitly + * sets the version header on each request, overriding the default. + * + * @param properties Configures the service. + * @return A {@link Mono} containing the storage account properties. */ - public Mono setProperties(StorageServiceProperties properties) { + public Mono setPropertiesWithReponse(StorageServiceProperties properties) { + return withContext(context -> setPropertiesWithReponse(properties, context)); + } + + Mono setPropertiesWithReponse(StorageServiceProperties properties, Context context) { return postProcessResponse( - this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, Context.NONE)) + this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context)) .map(VoidResponse::new); } @@ -233,13 +308,31 @@ public Mono setProperties(StorageServiceProperties properties) { * * @param start Start time for the key's validity. Null indicates immediate start. * @param expiry Expiration of the key's validity. - * @return A reactive response containing the user delegation key. + * @return A {@link Mono} containing the user delegation key. * @throws IllegalArgumentException If {@code start} isn't null and is after {@code expiry}. */ - public Mono> getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { + public Mono getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { + return withContext(context -> getUserDelegationKeyWithResponse(start, expiry, context)).flatMap(FluxUtil::toMono); + } + + /** + * Gets a user delegation key for use with this account's blob storage. Note: This method call is only valid when + * using {@link TokenCredential} in this object's {@link HttpPipeline}. + * + * @param start Start time for the key's validity. Null indicates immediate start. + * @param expiry Expiration of the key's validity. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} containing the user + * delegation key. + * @throws IllegalArgumentException If {@code start} isn't null and is after {@code expiry}. + */ + public Mono> getUserDelegationKeyWithResponse(OffsetDateTime start, OffsetDateTime expiry) { + return withContext(context -> getUserDelegationKeyWithResponse(start, expiry, context)); + } + + Mono> getUserDelegationKeyWithResponse(OffsetDateTime start, OffsetDateTime expiry, Context context) { Utility.assertNotNull("expiry", expiry); if (start != null && !start.isBefore(expiry)) { - throw new IllegalArgumentException("`start` must be null or a datetime before `expiry`."); + throw logger.logExceptionAsError(new IllegalArgumentException("`start` must be null or a datetime before `expiry`.")); } return postProcessResponse( @@ -247,7 +340,7 @@ public Mono> getUserDelegationKey(OffsetDateTime sta new KeyInfo() .start(start == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(start)) .expiry(Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiry)), - null, null, Context.NONE) + null, null, context) ).map(rb -> new SimpleResponse<>(rb, rb.value())); } @@ -257,11 +350,28 @@ public Mono> getUserDelegationKey(OffsetDateTime sta * the * Azure Docs. * - * @return A reactive response containing the storage account statistics. + * @return A {@link Mono} containing the storage account statistics. + */ + public Mono getStatistics() { + return getStatisticsWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location + * endpoint when read-access geo-redundant replication is enabled for the storage account. For more information, see + * the + * Azure Docs. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} containing the storage + * account statistics. */ - public Mono> getStatistics() { + public Mono> getStatisticsWithResponse() { + return withContext(context -> getStatisticsWithResponse(context)); + } + + Mono> getStatisticsWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.services().getStatisticsWithRestResponseAsync(null, null, Context.NONE)) + this.azureBlobStorage.services().getStatisticsWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.value())); } @@ -269,10 +379,25 @@ public Mono> getStatistics() { * Returns the sku name and account kind for the account. For more information, please see the * Azure Docs. * - * @return A reactive response containing the storage account info. + * @return A {@link Mono} containing containing the storage account info. */ - public Mono> getAccountInfo() { - return postProcessResponse(this.azureBlobStorage.services().getAccountInfoWithRestResponseAsync(Context.NONE)) + public Mono getAccountInfo() { + return getAccountInfoWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Returns the sku name and account kind for the account. For more information, please see the + * Azure Docs. + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} the storage account + * info. + */ + public Mono> getAccountInfoWithResponse() { + return withContext(context -> getAccountInfoWithResponse(context)); + } + + Mono> getAccountInfoWithResponse(Context context) { + return postProcessResponse(this.azureBlobStorage.services().getAccountInfoWithRestResponseAsync(context)) .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.deserializedHeaders()))); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 07fc7dc0c6bd..2f544afd9a2f 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -5,9 +5,11 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.blob.models.ContainerItem; import com.azure.storage.blob.models.ListContainersOptions; import com.azure.storage.blob.models.Metadata; @@ -19,7 +21,6 @@ import com.azure.storage.common.IPRange; import com.azure.storage.common.SASProtocol; import com.azure.storage.common.Utility; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.URL; @@ -68,10 +69,10 @@ public ContainerClient getContainerClient(String containerName) { * Azure Docs. * * @param containerName Name of the container to create - * @return A response containing a {@link ContainerClient} used to interact with the container created. + * @return The {@link ContainerClient} used to interact with the container created. */ - public Response createContainer(String containerName) { - return createContainer(containerName, null, null); + public ContainerClient createContainer(String containerName) { + return createContainerWithResponse(containerName, null, null, Context.NONE).value(); } /** @@ -83,12 +84,13 @@ public Response createContainer(String containerName) { * @param metadata {@link Metadata} * @param accessType Specifies how the data in this container is available to the public. See the * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. - * @return A response containing a {@link ContainerClient} used to interact with the container created. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link Response} whose {@link Response#value() value} contains the {@link ContainerClient} used to interact with the container created. */ - public Response createContainer(String containerName, Metadata metadata, PublicAccessType accessType) { + public Response createContainerWithResponse(String containerName, Metadata metadata, PublicAccessType accessType, Context context) { ContainerClient client = getContainerClient(containerName); - return new SimpleResponse<>(client.create(metadata, accessType, null), client); + return new SimpleResponse<>(client.createWithResponse(metadata, accessType, null, context), client); } /** @@ -96,10 +98,21 @@ public Response createContainer(String containerName, Metadata * more information see the Azure Docs. * * @param containerName Name of the container to delete + */ + public void deleteContainer(String containerName) { + deleteContainerWithResponse(containerName, Context.NONE); + } + + /** + * Deletes the specified container in the storage account. If the container doesn't exist the operation fails. For + * more information see the Azure Docs. + * + * @param containerName Name of the container to delete + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers */ - public VoidResponse deleteContainer(String containerName) { - return blobServiceAsyncClient.deleteContainer(containerName).block(); + public VoidResponse deleteContainerWithResponse(String containerName, Context context) { + return blobServiceAsyncClient.deleteContainerWithResponse(containerName).block(); } /** @@ -112,18 +125,18 @@ public URL getAccountUrl() { } /** - * Returns a lazy loaded list of containers in this account. The returned {@link Iterable} can be iterated through + * Returns a lazy loaded list of containers in this account. The returned {@link PagedIterable} can be consumed * while new items are automatically retrieved as needed. For more information, see the Azure Docs. * * @return The list of containers. */ - public Iterable listContainers() { + public PagedIterable listContainers() { return this.listContainers(new ListContainersOptions(), null); } /** - * Returns a lazy loaded list of containers in this account. The returned {@link Iterable} can be iterated through + * Returns a lazy loaded list of containers in this account. The returned {@link PagedIterable} can be consumed * while new items are automatically retrieved as needed. For more information, see the Azure Docs. * @@ -131,10 +144,8 @@ public Iterable listContainers() { * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The list of containers. */ - public Iterable listContainers(ListContainersOptions options, Duration timeout) { - Flux response = blobServiceAsyncClient.listContainers(options); - - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + public PagedIterable listContainers(ListContainersOptions options, Duration timeout) { + return new PagedIterable<>(blobServiceAsyncClient.listContainersWithOptionalTimeout(options, timeout)); } /** @@ -143,8 +154,8 @@ public Iterable listContainers(ListContainersOptions options, Dur * * @return The storage account properties. */ - public Response getProperties() { - return this.getProperties(null); + public StorageServiceProperties getProperties() { + return getPropertiesWithResponse(null, Context.NONE).value(); } /** @@ -152,11 +163,12 @@ public Response getProperties() { * Azure Docs. * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @return The storage account properties. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link Response} whose {@link Response#value() value} contains the storage account properties. */ - public Response getProperties(Duration timeout) { + public Response getPropertiesWithResponse(Duration timeout, Context context) { - Mono> response = blobServiceAsyncClient.getProperties(); + Mono> response = blobServiceAsyncClient.getPropertiesWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -168,10 +180,9 @@ public Response getProperties(Duration timeout) { * sets the version header on each request, overriding the default. * * @param properties Configures the service. - * @return The storage account properties. */ - public VoidResponse setProperties(StorageServiceProperties properties) { - return this.setProperties(properties, null); + public void setProperties(StorageServiceProperties properties) { + setPropertiesWithResponse(properties, null, Context.NONE); } /** @@ -182,10 +193,11 @@ public VoidResponse setProperties(StorageServiceProperties properties) { * * @param properties Configures the service. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return The storage account properties. */ - public VoidResponse setProperties(StorageServiceProperties properties, Duration timeout) { - Mono response = blobServiceAsyncClient.setProperties(properties); + public VoidResponse setPropertiesWithResponse(StorageServiceProperties properties, Duration timeout, Context context) { + Mono response = blobServiceAsyncClient.setPropertiesWithReponse(properties, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -198,8 +210,8 @@ public VoidResponse setProperties(StorageServiceProperties properties, Duration * @param expiry Expiration of the key's validity. * @return The user delegation key. */ - public Response getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { - return this.getUserDelegationKey(start, expiry, null); + public UserDelegationKey getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { + return getUserDelegationKeyWithResponse(start, expiry, null, Context.NONE).value(); } /** @@ -209,11 +221,12 @@ public Response getUserDelegationKey(OffsetDateTime start, Of * @param start Start time for the key's validity. Null indicates immediate start. * @param expiry Expiration of the key's validity. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @return The user delegation key. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link Response} whose {@link Response#value() value} contains the user delegation key. */ - public Response getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry, - Duration timeout) { - Mono> response = blobServiceAsyncClient.getUserDelegationKey(start, expiry); + public Response getUserDelegationKeyWithResponse(OffsetDateTime start, OffsetDateTime expiry, + Duration timeout, Context context) { + Mono> response = blobServiceAsyncClient.getUserDelegationKeyWithResponse(start, expiry, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -226,8 +239,8 @@ public Response getUserDelegationKey(OffsetDateTime start, Of * * @return The storage account statistics. */ - public Response getStatistics() { - return this.getStatistics(null); + public StorageServiceStats getStatistics() { + return getStatisticsWithResponse(null, Context.NONE).value(); } /** @@ -237,10 +250,11 @@ public Response getStatistics() { * Azure Docs. * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @return The storage account statistics. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link Response} whose {@link Response#value() value} the storage account statistics. */ - public Response getStatistics(Duration timeout) { - Mono> response = blobServiceAsyncClient.getStatistics(); + public Response getStatisticsWithResponse(Duration timeout, Context context) { + Mono> response = blobServiceAsyncClient.getStatisticsWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -251,8 +265,8 @@ public Response getStatistics(Duration timeout) { * * @return The storage account info. */ - public Response getAccountInfo() { - return this.getAccountInfo(null); + public StorageAccountInfo getAccountInfo() { + return getAccountInfoWithResponse(null, Context.NONE).value(); } /** @@ -260,10 +274,11 @@ public Response getAccountInfo() { * Azure Docs. * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @return The storage account info. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link Response} whose {@link Response#value() value} contains the storage account info. */ - public Response getAccountInfo(Duration timeout) { - Mono> response = blobServiceAsyncClient.getAccountInfo(); + public Response getAccountInfoWithResponse(Duration timeout, Context context) { + Mono> response = blobServiceAsyncClient.getAccountInfoWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java index 49aeb7536468..e8955361a3b1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java @@ -14,9 +14,12 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -50,13 +53,16 @@ * Once all the configurations are set on this builder, call {@code .buildClient()} to create a * {@link BlobServiceClient} or {@code .buildAsyncClient()} to create a {@link BlobServiceAsyncClient}. */ +@ServiceClientBuilder(serviceClients = {BlobServiceClient.class, BlobServiceAsyncClient.class}) public final class BlobServiceClientBuilder { private static final String ACCOUNT_NAME = "accountname"; private static final String ACCOUNT_KEY = "accountkey"; private static final String ENDPOINT_PROTOCOL = "defaultendpointsprotocol"; private static final String ENDPOINT_SUFFIX = "endpointsuffix"; - private final List policies; + private final ClientLogger logger = new ClientLogger(BlobServiceClientBuilder.class); + + private final List additionalPolicies; private String endpoint; private SharedKeyCredential sharedKeyCredential; @@ -74,7 +80,7 @@ public final class BlobServiceClientBuilder { public BlobServiceClientBuilder() { retryOptions = new RequestRetryOptions(); logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); + additionalPolicies = new ArrayList<>(); } /** @@ -107,10 +113,12 @@ public BlobServiceAsyncClient buildAsyncClient() { } else if (sasTokenCredential != null) { policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); } - + HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(new RequestRetryPolicy(retryOptions)); - policies.addAll(this.policies); + policies.addAll(this.additionalPolicies); + + HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(logLevel)); HttpPipeline pipeline = new HttpPipelineBuilder() @@ -141,7 +149,7 @@ public BlobServiceClientBuilder endpoint(String endpoint) { this.sharedKeyCredential = null; } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage endpoint url is malformed.")); } return this; @@ -222,7 +230,7 @@ public BlobServiceClientBuilder connectionString(String connectionString) { String endpointSuffix = connectionKVPs.get(ENDPOINT_SUFFIX); if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); + throw logger.logExceptionAsError(new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'.")); } if (!ImplUtils.isNullOrEmpty(endpointProtocol) && !ImplUtils.isNullOrEmpty(endpointSuffix)) { @@ -252,7 +260,7 @@ public BlobServiceClientBuilder httpClient(HttpClient httpClient) { * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. */ public BlobServiceClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(Objects.requireNonNull(pipelinePolicy)); + this.additionalPolicies.add(Objects.requireNonNull(pipelinePolicy)); return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java index 90a9c4892caa..ade0cf73fe2b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java @@ -161,8 +161,7 @@ public BlobURLParts unparsedParameters(Map unparsedParameters) * * @return A {@code java.net.URL} to the blob resource composed of all the elements in the object. * - * @throws MalformedURLException - * The fields present on the BlobURLParts object were insufficient to construct a valid URL or were + * @throws MalformedURLException The fields present on the BlobURLParts object were insufficient to construct a valid URL or were * ill-formatted. */ public URL toURL() throws MalformedURLException { diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java index 162bb1917b61..19f990ba1f00 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java @@ -4,24 +4,23 @@ package com.azure.storage.blob; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.BlockBlobItem; -import com.azure.storage.blob.models.BlockItem; +import com.azure.storage.blob.models.BlockList; import com.azure.storage.blob.models.BlockListType; import com.azure.storage.blob.models.BlockLookupList; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.common.Constants; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -29,6 +28,7 @@ import java.io.IOException; import java.io.UncheckedIOException; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; import java.nio.charset.StandardCharsets; import java.nio.file.Paths; @@ -40,6 +40,7 @@ import java.util.TreeMap; import java.util.UUID; +import static com.azure.core.implementation.util.FluxUtil.withContext; import static com.azure.storage.blob.PostProcessor.postProcessResponse; /** @@ -66,6 +67,8 @@ * object through {@link Mono#toFuture()}. */ public final class BlockBlobAsyncClient extends BlobAsyncClient { + private final ClientLogger logger = new ClientLogger(BlockBlobAsyncClient.class); + static final int BLOB_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constants.MB; static final int BLOB_MAX_UPLOAD_BLOCK_SIZE = 100 * Constants.MB; @@ -104,18 +107,15 @@ public final class BlockBlobAsyncClient extends BlobAsyncClient { * {@code Flux} must produce the same data each time it is subscribed to. *

    * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled + * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param length The exact length of the data. It is important that this value match precisely the length of the data * emitted by the {@code Flux}. * - * @return - * A reactive response containing the information of the uploaded block blob. + * @return A reactive response containing the information of the uploaded block blob. */ - public Mono> upload(Flux data, long length) { - return this.upload(data, length, null, null, null); + public Mono upload(Flux data, long length) { + return uploadWithResponse(data, length, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -130,52 +130,50 @@ public Mono> upload(Flux data, long length) { * {@code Flux} must produce the same data each time it is subscribed to. *

    * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled + * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param length The exact length of the data. It is important that this value match precisely the length of the data * emitted by the {@code Flux}. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} * - * @return - * A reactive response containing the information of the uploaded block blob. + * @return A reactive response containing the information of the uploaded block blob. */ - public Mono> upload(Flux data, long length, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions) { + public Mono> uploadWithResponse(Flux data, long length, BlobHTTPHeaders headers, + Metadata metadata, BlobAccessConditions accessConditions) { + return withContext(context -> uploadWithResponse(data, length, headers, metadata, accessConditions, context)); + } + + Mono> uploadWithResponse(Flux data, long length, BlobHTTPHeaders headers, + Metadata metadata, BlobAccessConditions accessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blockBlobs().uploadWithRestResponseAsync(null, - null, data, length, null, metadata, null, null, - null, null, headers, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) + null, data, length, null, metadata, null, null, headers, accessConditions.leaseAccessConditions(), null, + accessConditions.modifiedAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders()))); } /** * Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file. - * * @param filePath Path to the upload file + * * @return An empty response */ public Mono uploadFromFile(String filePath) { - return this.uploadFromFile(filePath, BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, null, null, null); + return uploadFromFile(filePath, BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, null, null, null); } /** * Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file. - * * @param filePath Path to the upload file * @param blockSize Size of the blocks to upload * @param headers {@link BlobHTTPHeaders} * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} + * * @return An empty response * @throws IllegalArgumentException If {@code blockSize} is less than 0 or greater than 100MB * @throws UncheckedIOException If an I/O error occurs @@ -183,7 +181,7 @@ public Mono uploadFromFile(String filePath) { public Mono uploadFromFile(String filePath, Integer blockSize, BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions) { if (blockSize < 0 || blockSize > BLOB_MAX_UPLOAD_BLOCK_SIZE) { - throw new IllegalArgumentException("Block size should not exceed 100MB"); + throw logger.logExceptionAsError(new IllegalArgumentException("Block size should not exceed 100MB")); } return Mono.using(() -> uploadFileResourceSupplier(filePath), @@ -193,25 +191,26 @@ public Mono uploadFromFile(String filePath, Integer blockSize, BlobHTTPHea .doOnNext(chunk -> blockIds.put(chunk.offset(), getBlockID())) .flatMap(chunk -> { String blockId = blockIds.get(chunk.offset()); - return stageBlock(blockId, FluxUtil.byteBufStreamFromFile(channel, chunk.offset(), chunk.count()), chunk.count(), null); + return stageBlockWithResponse(blockId, FluxUtil.readFile(channel, chunk.offset(), chunk.count()), chunk.count(), null); }) - .then(Mono.defer(() -> commitBlockList(new ArrayList<>(blockIds.values()), headers, metadata, accessConditions))) + .then(Mono.defer(() -> commitBlockListWithResponse(new ArrayList<>(blockIds.values()), headers, metadata, accessConditions))) .then() .doOnTerminate(() -> { try { channel.close(); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } }); }, this::uploadFileCleanup); } + private AsynchronousFileChannel uploadFileResourceSupplier(String filePath) { try { return AsynchronousFileChannel.open(Paths.get(filePath), StandardOpenOption.READ); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } @@ -219,7 +218,7 @@ private void uploadFileCleanup(AsynchronousFileChannel channel) { try { channel.close(); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } @@ -252,22 +251,17 @@ private List sliceFile(String path, Integer blockSize) { * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given + * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given * blob must be the same length. - * @param data - * The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled + * @param data The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param length The exact length of the data. It is important that this value match precisely the length of the data * emitted by the {@code Flux}. * - * @return - * A reactive response signalling completion. + * @return A reactive response signalling completion. */ - public Mono stageBlock(String base64BlockID, Flux data, - long length) { - return this.stageBlock(base64BlockID, data, length, null); + public Mono stageBlock(String base64BlockID, Flux data, long length) { + return stageBlockWithResponse(base64BlockID, data, length, null).flatMap(FluxUtil::toMono); } /** @@ -278,27 +272,26 @@ public Mono stageBlock(String base64BlockID, Flux data, * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given + * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given * blob must be the same length. - * @param data - * The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled + * @param data The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param length The exact length of the data. It is important that this value match precisely the length of the data * emitted by the {@code Flux}. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active + * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does not match the active * lease on the blob. * - * @return - * A reactive response signalling completion. + * @return A reactive response signalling completion. */ - public Mono stageBlock(String base64BlockID, Flux data, long length, - LeaseAccessConditions leaseAccessConditions) { + public Mono stageBlockWithResponse(String base64BlockID, Flux data, long length, + LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> stageBlockWithResponse(base64BlockID, data, length, leaseAccessConditions, context)); + } + + Mono stageBlockWithResponse(String base64BlockID, Flux data, long length, + LeaseAccessConditions leaseAccessConditions, Context context) { return postProcessResponse(this.azureBlobStorage.blockBlobs().stageBlockWithRestResponseAsync(null, - null, base64BlockID, length, data, null, null, null, - null, null, null, leaseAccessConditions, Context.NONE)) + null, base64BlockID, length, data, null, null, null, null, leaseAccessConditions, null, context)) .map(VoidResponse::new); } @@ -306,62 +299,55 @@ public Mono stageBlock(String base64BlockID, Flux data, l * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more * information, see the Azure Docs. * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given + * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can be * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must * either be public or must be authenticated via a shared access signature. If the source blob is public, no * authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} + * @param sourceRange {@link BlobRange} * - * @return - * A reactive response signalling completion. + * @return A reactive response signalling completion. */ - public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange) { - return this.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, null, - null, null); + public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, BlobRange sourceRange) { + return this.stageBlockFromURLWithResponse(base64BlockID, sourceURL, sourceRange, null, null, null) + .flatMap(FluxUtil::toMono); } /** * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more * information, see the Azure Docs. * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given + * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob * must either be public or must be authenticated via a shared access signature. If the source blob is * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 + * @param sourceRange {@link BlobRange} + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 * of the received data and fail the request if it does not match the provided MD5. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active + * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does not match the active * lease on the blob. - * @param sourceModifiedAccessConditions - * {@link SourceModifiedAccessConditions} + * @param sourceModifiedAccessConditions {@link SourceModifiedAccessConditions} * - * @return - * A reactive response signalling completion. + * @return A reactive response signalling completion. */ - public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, - SourceModifiedAccessConditions sourceModifiedAccessConditions) { + public Mono stageBlockFromURLWithResponse(String base64BlockID, URL sourceURL, + BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, + SourceModifiedAccessConditions sourceModifiedAccessConditions) { + return withContext(context -> stageBlockFromURLWithResponse(base64BlockID, sourceURL, sourceRange, sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions)); + } + + Mono stageBlockFromURLWithResponse(String base64BlockID, URL sourceURL, + BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, + SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { sourceRange = sourceRange == null ? new BlobRange(0) : sourceRange; return postProcessResponse( this.azureBlobStorage.blockBlobs().stageBlockFromURLWithRestResponseAsync(null, null, - base64BlockID, 0, sourceURL, sourceRange.toHeaderValue(), sourceContentMD5, null, - null, null, null, null, - leaseAccessConditions, sourceModifiedAccessConditions, Context.NONE)) + base64BlockID, 0, sourceURL, sourceRange.toHeaderValue(), sourceContentMD5, null, null, + null, null, leaseAccessConditions, sourceModifiedAccessConditions, context)) .map(VoidResponse::new); } @@ -370,44 +356,31 @@ public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, * For more information, see the * Azure Docs. * - * @param listType - * Specifies which type of blocks to return. + * @param listType Specifies which type of blocks to return. * - * @return - * A reactive response containing the list of blocks. + * @return A reactive response containing the list of blocks. */ - public Flux listBlocks(BlockListType listType) { - return this.listBlocks(listType, null); + public Mono listBlocks(BlockListType listType) { + return this.listBlocks(listType, null).map(Response::value); } /** - * * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. * For more information, see the * Azure Docs. * - * @param listType - * Specifies which type of blocks to return. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active + * @param listType Specifies which type of blocks to return. + * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does not match the active * lease on the blob. * - * @return - * A reactive response containing the list of blocks. + * @return A reactive response containing the list of blocks. */ - public Flux listBlocks(BlockListType listType, + public Mono> listBlocks(BlockListType listType, LeaseAccessConditions leaseAccessConditions) { + return postProcessResponse(this.azureBlobStorage.blockBlobs().getBlockListWithRestResponseAsync( - null, null, listType, snapshot, null, null, null, - leaseAccessConditions, Context.NONE)) - .map(ResponseBase::value) - .flatMapMany(bl -> { - Flux committed = Flux.fromIterable(bl.committedBlocks()) - .map(block -> new BlockItem(block, true)); - Flux uncommitted = Flux.fromIterable(bl.uncommittedBlocks()) - .map(block -> new BlockItem(block, false)); - return Flux.concat(committed, uncommitted); - }); + null, null, listType, snapshot, null, null, leaseAccessConditions, Context.NONE)) + .map(response -> new SimpleResponse<>(response, response.value())); } /** @@ -419,14 +392,12 @@ public Flux listBlocks(BlockListType listType, * For more information, see the * Azure Docs. * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. + * @param base64BlockIDs A list of base64 encode {@code String}s that specifies the block IDs to be committed. * - * @return - * A reactive response containing the information of the block blob. + * @return A reactive response containing the information of the block blob. */ - public Mono> commitBlockList(List base64BlockIDs) { - return this.commitBlockList(base64BlockIDs, null, null, null); + public Mono commitBlockList(List base64BlockIDs) { + return commitBlockListWithResponse(base64BlockIDs, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -438,27 +409,25 @@ public Mono> commitBlockList(List base64BlockIDs * For more information, see the * Azure Docs. * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} + * @param base64BlockIDs A list of base64 encode {@code String}s that specifies the block IDs to be committed. + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} * - * @return - * A reactive response containing the information of the block blob. + * @return A reactive response containing the information of the block blob. */ - public Mono> commitBlockList(List base64BlockIDs, - BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions) { + public Mono> commitBlockListWithResponse(List base64BlockIDs, + BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions) { + return withContext(context -> commitBlockListWithResponse(base64BlockIDs, headers, metadata, accessConditions, context)); + } + + Mono> commitBlockListWithResponse(List base64BlockIDs, + BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blockBlobs().commitBlockListWithRestResponseAsync( - null, null, new BlockLookupList().latest(base64BlockIDs), null, metadata, - null, null, null, null, headers, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders()))); - } + null, null, new BlockLookupList().latest(base64BlockIDs), null, null, null, metadata, null, null, headers, + accessConditions.leaseAccessConditions(), null, accessConditions.modifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders()))); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java index 5e2f7dbd346c..8e45ccf1b4cc 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java @@ -5,18 +5,18 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.BlockBlobItem; -import com.azure.storage.blob.models.BlockItem; +import com.azure.storage.blob.models.BlockList; import com.azure.storage.blob.models.BlockListType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.SourceModifiedAccessConditions; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.common.Utility; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; @@ -25,6 +25,7 @@ import java.io.InputStream; import java.io.UncheckedIOException; import java.net.URL; +import java.nio.ByteBuffer; import java.time.Duration; import java.util.List; @@ -73,11 +74,9 @@ public final class BlockBlobClient extends BlobClient { /** * Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, * it will be overwritten. - * * @return A {@link BlobOutputStream} object used to write data to the blob. * - * @throws StorageException - * If a storage service error occurred. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream() { return getBlobOutputStream(null); @@ -87,16 +86,14 @@ public BlobOutputStream getBlobOutputStream() { * Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, * it will be overwritten. * - * @param accessConditions - * A {@link BlobAccessConditions} object that represents the access conditions for the blob. + * @param accessConditions A {@link BlobAccessConditions} object that represents the access conditions for the blob. * * @return A {@link BlobOutputStream} object used to write data to the blob. * - * @throws StorageException - * If a storage service error occurred. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream(BlobAccessConditions accessConditions) { - return new BlobOutputStream(blockBlobAsyncClient, accessConditions); + return BlobOutputStream.blockBlobOutputStream(blockBlobAsyncClient, accessConditions); } /** @@ -107,18 +104,15 @@ public BlobOutputStream getBlobOutputStream(BlobAccessConditions accessCondition * For more information, see the * Azure Docs. * - * @param data - * The data to write to the blob. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param data The data to write to the blob. + * @param length The exact length of the data. It is important that this value match precisely the length of the data * provided in the {@link InputStream}. * - * @return - * The information of the uploaded block blob. + * @return The information of the uploaded block blob. * @throws IOException If an I/O error occurs */ - public Response upload(InputStream data, long length) throws IOException { - return this.upload(data, length, null, null, null, null); + public BlockBlobItem upload(InputStream data, long length) throws IOException { + return uploadWithResponse(data, length, null, null, null, null, Context.NONE).value(); } /** @@ -129,27 +123,21 @@ public Response upload(InputStream data, long length) throws IOEx * For more information, see the * Azure Docs. * - * @param data - * The data to write to the blob. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param data The data to write to the blob. + * @param length The exact length of the data. It is important that this value match precisely the length of the data * provided in the {@link InputStream}. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * - * @return - * The information of the uploaded block blob. + * @return The information of the uploaded block blob. * @throws IOException If an I/O error occurs */ - public Response upload(InputStream data, long length, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) throws IOException { - Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE)) + public Response uploadWithResponse(InputStream data, long length, BlobHTTPHeaders headers, + Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) throws IOException { + Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE)) .map(i -> i * BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) .concatMap(pos -> Mono.fromCallable(() -> { long count = pos + BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE > length ? length - pos : BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; @@ -158,11 +146,11 @@ public Response upload(InputStream data, long length, BlobHTTPHea while (read < count) { read += data.read(cache, read, (int) count - read); } - return ByteBufAllocator.DEFAULT.buffer((int) count).writeBytes(cache); + return ByteBuffer.wrap(cache); })); Mono> upload = blockBlobAsyncClient - .upload(fbb.subscribeOn(Schedulers.elastic()), length, headers, metadata, accessConditions); + .uploadWithResponse(fbb.subscribeOn(Schedulers.elastic()), length, headers, metadata, accessConditions, context); try { return Utility.blockWithOptionalTimeout(upload, timeout); @@ -173,26 +161,26 @@ public Response upload(InputStream data, long length, BlobHTTPHea /** * Creates a new block blob, or updates the content of an existing block blob. - * * @param filePath Path of the file to upload + * * @throws IOException If an I/O error occurs */ public void uploadFromFile(String filePath) throws IOException { - this.uploadFromFile(filePath, null, null, null, null); + uploadFromFile(filePath, null, null, null, null); } /** * Creates a new block blob, or updates the content of an existing block blob. - * * @param filePath Path of the file to upload * @param headers {@link BlobHTTPHeaders} * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * * @throws IOException If an I/O error occurs */ public void uploadFromFile(String filePath, BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions, Duration timeout) throws IOException { + BlobAccessConditions accessConditions, Duration timeout) throws IOException { Mono upload = this.blockBlobAsyncClient.uploadFromFile(filePath, BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, headers, metadata, accessConditions); try { @@ -207,18 +195,14 @@ public void uploadFromFile(String filePath, BlobHTTPHeaders headers, Metadata me * commitBlockList. For more information, see the * Azure Docs. * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given + * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given * blob must be the same length. - * @param data - * The data to write to the block. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param data The data to write to the block. + * @param length The exact length of the data. It is important that this value match precisely the length of the data * provided in the {@link InputStream}. - * @return A response containing status code and HTTP headers */ - public VoidResponse stageBlock(String base64BlockID, InputStream data, long length) { - return this.stageBlock(base64BlockID, data, length, null, null); + public void stageBlock(String base64BlockID, InputStream data, long length) { + stageBlockWithResponse(base64BlockID, data, length, null, null, Context.NONE); } /** @@ -226,25 +210,22 @@ public VoidResponse stageBlock(String base64BlockID, InputStream data, long leng * commitBlockList. For more information, see the * Azure Docs. * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given + * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given * blob must be the same length. - * @param data - * The data to write to the block. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data + * @param data The data to write to the block. + * @param length The exact length of the data. It is important that this value match precisely the length of the data * provided in the {@link InputStream}. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active + * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does not match the active * lease on the blob. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return A response containing status code and HTTP headers */ - public VoidResponse stageBlock(String base64BlockID, InputStream data, long length, - LeaseAccessConditions leaseAccessConditions, Duration timeout) { + public VoidResponse stageBlockWithResponse(String base64BlockID, InputStream data, long length, + LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) { - Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE)) + Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE)) .map(i -> i * BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) .concatMap(pos -> Mono.fromCallable(() -> { long count = pos + BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE > length ? length - pos : BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; @@ -253,11 +234,11 @@ public VoidResponse stageBlock(String base64BlockID, InputStream data, long leng while (read < count) { read += data.read(cache, read, (int) count - read); } - return ByteBufAllocator.DEFAULT.buffer((int) count).writeBytes(cache); + return ByteBuffer.wrap(cache); })); - Mono response = blockBlobAsyncClient.stageBlock(base64BlockID, - fbb.subscribeOn(Schedulers.elastic()), length, leaseAccessConditions); + Mono response = blockBlobAsyncClient.stageBlockWithResponse(base64BlockID, + fbb.subscribeOn(Schedulers.elastic()), length, leaseAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -265,54 +246,44 @@ public VoidResponse stageBlock(String base64BlockID, InputStream data, long leng * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more * information, see the Azure Docs. * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given + * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can be * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must * either be public or must be authenticated via a shared access signature. If the source blob is public, no * authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @return A response containing status code and HTTP headers + * @param sourceRange {@link BlobRange} */ - public VoidResponse stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange) { - return this.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, null, - null, null, null); + public void stageBlockFromURL(String base64BlockID, URL sourceURL, BlobRange sourceRange) { + stageBlockFromURLWithResponse(base64BlockID, sourceURL, sourceRange, null, null, null, null, Context.NONE); } /** * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more * information, see the Azure Docs. * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given + * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob * must either be public or must be authenticated via a shared access signature. If the source blob is * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 + * @param sourceRange {@link BlobRange} + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 * of the received data and fail the request if it does not match the provided MD5. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active + * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does not match the active * lease on the blob. - * @param sourceModifiedAccessConditions - * {@link SourceModifiedAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param sourceModifiedAccessConditions {@link SourceModifiedAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return A response containing status code and HTTP headers */ - public VoidResponse stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, - SourceModifiedAccessConditions sourceModifiedAccessConditions, Duration timeout) { - Mono response = blockBlobAsyncClient.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions); + public VoidResponse stageBlockFromURLWithResponse(String base64BlockID, URL sourceURL, BlobRange sourceRange, + byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, + SourceModifiedAccessConditions sourceModifiedAccessConditions, Duration timeout, Context context) { + Mono response = blockBlobAsyncClient.stageBlockFromURLWithResponse(base64BlockID, sourceURL, + sourceRange, sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -321,38 +292,31 @@ public VoidResponse stageBlockFromURL(String base64BlockID, URL sourceURL, * For more information, see the * Azure Docs. * - * @param listType - * Specifies which type of blocks to return. + * @param listType Specifies which type of blocks to return. * - * @return - * The list of blocks. + * @return The list of blocks. */ - public Iterable listBlocks(BlockListType listType) { - return this.listBlocks(listType, null, null); + public BlockList listBlocks(BlockListType listType) { + return this.listBlocksWithResponse(listType, null, null).value(); } /** - * * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. * For more information, see the * Azure Docs. * - * @param listType - * Specifies which type of blocks to return. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active + * @param listType Specifies which type of blocks to return. + * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does not match the active * lease on the blob. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * - * @return - * The list of blocks. + * @return The list of blocks. */ - public Iterable listBlocks(BlockListType listType, + public Response listBlocksWithResponse(BlockListType listType, LeaseAccessConditions leaseAccessConditions, Duration timeout) { - Flux response = blockBlobAsyncClient.listBlocks(listType, leaseAccessConditions); + Mono> response = blockBlobAsyncClient.listBlocks(listType, leaseAccessConditions); - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -364,14 +328,12 @@ public Iterable listBlocks(BlockListType listType, * For more information, see the * Azure Docs. * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. + * @param base64BlockIDs A list of base64 encode {@code String}s that specifies the block IDs to be committed. * - * @return - * The information of the block blob. + * @return The information of the block blob. */ - public Response commitBlockList(List base64BlockIDs) { - return this.commitBlockList(base64BlockIDs, null, null, null, null); + public BlockBlobItem commitBlockList(List base64BlockIDs) { + return commitBlockListWithResponse(base64BlockIDs, null, null, null, null, Context.NONE).value(); } /** @@ -383,23 +345,20 @@ public Response commitBlockList(List base64BlockIDs) { * For more information, see the * Azure Docs. * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param base64BlockIDs A list of base64 encode {@code String}s that specifies the block IDs to be committed. + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * - * @return - * The information of the block blob. + * @return The information of the block blob. */ - public Response commitBlockList(List base64BlockIDs, - BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = blockBlobAsyncClient.commitBlockList(base64BlockIDs, headers, metadata, accessConditions); + public Response commitBlockListWithResponse(List base64BlockIDs, + BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, + Context context) { + Mono> response = blockBlobAsyncClient.commitBlockListWithResponse( + base64BlockIDs, headers, metadata, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java index 99b1524507bf..57089d6b71bd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java @@ -4,16 +4,18 @@ package com.azure.storage.blob; import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.util.FluxUtil; +import com.azure.core.implementation.http.PagedResponseBase; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.BlobFlatListSegment; -import com.azure.storage.blob.models.BlobHierarchyListSegment; import com.azure.storage.blob.models.BlobItem; -import com.azure.storage.blob.models.BlobPrefix; import com.azure.storage.blob.models.ContainerAccessConditions; import com.azure.storage.blob.models.ContainerAccessPolicies; import com.azure.storage.blob.models.ContainersListBlobFlatSegmentResponse; @@ -25,13 +27,13 @@ import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.SignedIdentifier; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Constants; import com.azure.storage.common.IPRange; import com.azure.storage.common.SASProtocol; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SharedKeyCredential; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.MalformedURLException; @@ -39,15 +41,20 @@ import java.time.Duration; import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; +import java.util.ArrayList; import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import static com.azure.core.implementation.util.FluxUtil.withContext; import static com.azure.storage.blob.PostProcessor.postProcessResponse; /** * Client to a container. It may only be instantiated through a {@link ContainerClientBuilder} or via the method {@link - * BlobServiceAsyncClient#getContainerAsyncClient(String)}. This class does not hold any state about a particular blob but - * is instead a convenient way of sending off appropriate requests to the resource on the service. It may also be used - * to construct URLs to blobs. + * BlobServiceAsyncClient#getContainerAsyncClient(String)}. This class does not hold any state about a particular blob + * but is instead a convenient way of sending off appropriate requests to the resource on the service. It may also be + * used to construct URLs to blobs. * *

    * This client contains operations on a container. Operations on a blob are available on {@link BlobAsyncClient} through @@ -70,6 +77,7 @@ public final class ContainerAsyncClient { public static final String LOG_CONTAINER_NAME = "$logs"; + private final ClientLogger logger = new ClientLogger(ContainerAsyncClient.class); private final AzureBlobStorageImpl azureBlobStorage; /** @@ -235,7 +243,7 @@ public URL getContainerUrl() { try { return new URL(azureBlobStorage.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e)); } } @@ -244,8 +252,26 @@ public URL getContainerUrl() { * * @return true if the container exists, false if it doesn't */ - public Mono> exists() { - return this.getProperties(null) + public Mono exists() { + return existsWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Gets if the container this client represents exists in the cloud. + * + * @return true if the container exists, false if it doesn't + */ + public Mono> existsWithResponse() { + return withContext(context -> existsWithResponse(context)); + } + + /** + * Gets if the container this client represents exists in the cloud. + * + * @return true if the container exists, false if it doesn't + */ + Mono> existsWithResponse(Context context) { + return this.getPropertiesWithResponse(null, context) .map(cp -> (Response) new SimpleResponse<>(cp, true)) .onErrorResume(t -> t instanceof StorageException && ((StorageException) t).statusCode() == 404, t -> { HttpResponse response = ((StorageException) t).response(); @@ -260,8 +286,8 @@ public Mono> exists() { * * @return A reactive response signalling completion. */ - public Mono create() { - return this.create(null, null); + public Mono create() { + return createWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -274,12 +300,15 @@ public Mono create() { * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. * @return A reactive response signalling completion. */ - public Mono create(Metadata metadata, PublicAccessType accessType) { + public Mono createWithResponse(Metadata metadata, PublicAccessType accessType) { + return withContext(context -> createWithResponse(metadata, accessType, context)); + } + + Mono createWithResponse(Metadata metadata, PublicAccessType accessType, Context context) { metadata = metadata == null ? new Metadata() : metadata; return postProcessResponse(this.azureBlobStorage.containers().createWithRestResponseAsync( - null, null, metadata, accessType, null, Context.NONE)) - .map(VoidResponse::new); + null, null, metadata, accessType, null, context)).map(VoidResponse::new); } /** @@ -289,8 +318,8 @@ public Mono create(Metadata metadata, PublicAccessType accessType) * * @return A reactive response signalling completion. */ - public Mono delete() { - return this.delete(null); + public Mono delete() { + return deleteWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -303,18 +332,21 @@ public Mono delete() { * @throws UnsupportedOperationException If {@link ContainerAccessConditions#modifiedAccessConditions()} has either * {@link ModifiedAccessConditions#ifMatch()} or {@link ModifiedAccessConditions#ifNoneMatch()} set. */ - public Mono delete(ContainerAccessConditions accessConditions) { + public Mono deleteWithResponse(ContainerAccessConditions accessConditions) { + return withContext(context -> deleteWithResponse(accessConditions, context)); + } + + Mono deleteWithResponse(ContainerAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new ContainerAccessConditions() : accessConditions; if (!validateNoEtag(accessConditions.modifiedAccessConditions())) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException("ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException("ETag access conditions are not supported for this API.")); } - return postProcessResponse(this.azureBlobStorage.containers() - .deleteWithRestResponseAsync(null, null, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) + return postProcessResponse(this.azureBlobStorage.containers().deleteWithRestResponseAsync(null, null, null, + accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)) .map(VoidResponse::new); } @@ -322,10 +354,11 @@ public Mono delete(ContainerAccessConditions accessConditions) { * Returns the container's metadata and system properties. For more information, see the * Azure Docs. * - * @return A reactive response containing the container properties. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} containing the + * container properties. */ - public Mono> getProperties() { - return this.getProperties(null); + public Mono getProperties() { + return getPropertiesWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -336,10 +369,13 @@ public Mono> getProperties() { * not match the active lease on the blob. * @return A reactive response containing the container properties. */ - public Mono> getProperties(LeaseAccessConditions leaseAccessConditions) { - return postProcessResponse(this.azureBlobStorage.containers() - .getPropertiesWithRestResponseAsync(null, null, null, - leaseAccessConditions, Context.NONE)) + public Mono> getPropertiesWithResponse(LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> getPropertiesWithResponse(leaseAccessConditions, context)); + } + + Mono> getPropertiesWithResponse(LeaseAccessConditions leaseAccessConditions, Context context) { + return postProcessResponse(this.azureBlobStorage.containers().getPropertiesWithRestResponseAsync(null, null, null, + leaseAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, new ContainerProperties(rb.deserializedHeaders()))); } @@ -348,10 +384,11 @@ public Mono> getProperties(LeaseAccessConditions l * Azure Docs. * * @param metadata {@link Metadata} - * @return A reactive response signalling completion. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains signalling + * completion. */ - public Mono setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null); + public Mono setMetadata(Metadata metadata) { + return setMetadataWithResponse(metadata, null).flatMap(FluxUtil::toMono); } /** @@ -364,21 +401,24 @@ public Mono setMetadata(Metadata metadata) { * @throws UnsupportedOperationException If {@link ContainerAccessConditions#modifiedAccessConditions()} has * anything set other than {@link ModifiedAccessConditions#ifModifiedSince()}. */ - public Mono setMetadata(Metadata metadata, ContainerAccessConditions accessConditions) { + public Mono setMetadataWithResponse(Metadata metadata, ContainerAccessConditions accessConditions) { + return withContext(context -> setMetadataWithResponse(metadata, accessConditions, context)); + } + + Mono setMetadataWithResponse(Metadata metadata, ContainerAccessConditions accessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new ContainerAccessConditions() : accessConditions; if (!validateNoEtag(accessConditions.modifiedAccessConditions()) || accessConditions.modifiedAccessConditions().ifUnmodifiedSince() != null) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "If-Modified-Since is the only HTTP access condition supported for this API"); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "If-Modified-Since is the only HTTP access condition supported for this API")); } - return postProcessResponse(this.azureBlobStorage.containers() - .setMetadataWithRestResponseAsync(null, null, metadata, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(VoidResponse::new); + return postProcessResponse(this.azureBlobStorage.containers().setMetadataWithRestResponseAsync(null, null, + metadata, null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), + context)).map(VoidResponse::new); } /** @@ -388,8 +428,8 @@ public Mono setMetadata(Metadata metadata, ContainerAccessConditio * * @return A reactive response containing the container access policy. */ - public Mono> getAccessPolicy() { - return this.getAccessPolicy(null); + public Mono getAccessPolicy() { + return getAccessPolicyWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -401,9 +441,14 @@ public Mono> getAccessPolicy() { * not match the active lease on the blob. * @return A reactive response containing the container access policy. */ - public Mono> getAccessPolicy(LeaseAccessConditions leaseAccessConditions) { - return postProcessResponse(this.azureBlobStorage.containers().getAccessPolicyWithRestResponseAsync(null, null, null, leaseAccessConditions, Context.NONE) - .map(response -> new SimpleResponse<>(response, new ContainerAccessPolicies(response.deserializedHeaders().blobPublicAccess(), response.value())))); + public Mono> getAccessPolicyWithResponse(LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> getAccessPolicyWithResponse(leaseAccessConditions, context)); + } + + Mono> getAccessPolicyWithResponse(LeaseAccessConditions leaseAccessConditions, Context context) { + return postProcessResponse(this.azureBlobStorage.containers().getAccessPolicyWithRestResponseAsync(null, null, + null, leaseAccessConditions, context).map(response -> new SimpleResponse<>(response, + new ContainerAccessPolicies(response.deserializedHeaders().blobPublicAccess(), response.value())))); } /** @@ -420,9 +465,9 @@ public Mono> getAccessPolicy(LeaseAccessCondit * for more information. Passing null will clear all access policies. * @return A reactive response signalling completion. */ - public Mono setAccessPolicy(PublicAccessType accessType, - List identifiers) { - return this.setAccessPolicy(accessType, identifiers, null); + public Mono setAccessPolicy(PublicAccessType accessType, + List identifiers) { + return setAccessPolicyWithResponse(accessType, identifiers, null).flatMap(FluxUtil::toMono); } /** @@ -442,13 +487,17 @@ public Mono setAccessPolicy(PublicAccessType accessType, * @throws UnsupportedOperationException If {@link ContainerAccessConditions#modifiedAccessConditions()} has either * {@link ModifiedAccessConditions#ifMatch()} or {@link ModifiedAccessConditions#ifNoneMatch()} set. */ - public Mono setAccessPolicy(PublicAccessType accessType, List identifiers, ContainerAccessConditions accessConditions) { + public Mono setAccessPolicyWithResponse(PublicAccessType accessType, List identifiers, ContainerAccessConditions accessConditions) { + return withContext(context -> setAccessPolicyWithResponse(accessType, identifiers, accessConditions, context)); + } + + Mono setAccessPolicyWithResponse(PublicAccessType accessType, List identifiers, ContainerAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new ContainerAccessConditions() : accessConditions; if (!validateNoEtag(accessConditions.modifiedAccessConditions())) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException("ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException("ETag access conditions are not supported for this API.")); } /* @@ -470,11 +519,9 @@ OffsetDateTime.now will only give back milliseconds (more precise fields are zer } } - return postProcessResponse(this.azureBlobStorage.containers() - .setAccessPolicyWithRestResponseAsync(null, identifiers, null, accessType, - null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - Context.NONE)) - .map(VoidResponse::new); + return postProcessResponse(this.azureBlobStorage.containers().setAccessPolicyWithRestResponseAsync(null, identifiers, + null, accessType, null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), + context)).map(VoidResponse::new); } /** @@ -497,7 +544,7 @@ OffsetDateTime.now will only give back milliseconds (more precise fields are zer * * @return A reactive response emitting the flattened blobs. */ - public Flux listBlobsFlat() { + public PagedFlux listBlobsFlat() { return this.listBlobsFlat(new ListBlobsOptions()); } @@ -522,8 +569,39 @@ public Flux listBlobsFlat() { * @param options {@link ListBlobsOptions} * @return A reactive response emitting the listed blobs, flattened. */ - public Flux listBlobsFlat(ListBlobsOptions options) { - return listBlobsFlatSegment(null, options).flatMapMany(response -> listBlobsFlatHelper(options, response)); + public PagedFlux listBlobsFlat(ListBlobsOptions options) { + return listBlobsFlatWithOptionalTimeout(options, null); + } + + /* + * Implementation for this paged listing operation, supporting an optional timeout provided by the synchronous + * ContainerClient. Applies the given timeout to each Mono backing the + * PagedFlux. + * + * @param options {@link ListBlobsOptions}. + * @param timeout An optional timeout to be applied to the network asynchronous operations. + * @return A reactive response emitting the listed blobs, flattened. + */ + PagedFlux listBlobsFlatWithOptionalTimeout(ListBlobsOptions options, Duration timeout) { + Function>> func = + marker -> listBlobsFlatSegment(marker, options, timeout) + .map(response -> { + List value = response.value().segment() == null + ? new ArrayList<>(0) + : response.value().segment().blobItems(); + + return new PagedResponseBase<>( + response.request(), + response.statusCode(), + response.headers(), + value, + response.value().nextMarker(), + response.deserializedHeaders()); + }); + + return new PagedFlux<>( + () -> func.apply(null), + marker -> func.apply(marker)); } /* @@ -547,30 +625,13 @@ public Flux listBlobsFlat(ListBlobsOptions options) { * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat_helper "helper code for ContainerAsyncClient.listBlobsFlatSegment")] \n * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) */ - private Mono listBlobsFlatSegment(String marker, ListBlobsOptions options) { + private Mono listBlobsFlatSegment(String marker, ListBlobsOptions options, Duration timeout) { options = options == null ? new ListBlobsOptions() : options; - return postProcessResponse(this.azureBlobStorage.containers() - .listBlobFlatSegmentWithRestResponseAsync(null, options.prefix(), marker, - options.maxResults(), options.details().toList(), null, null, Context.NONE)); - } - - private Flux listBlobsFlatHelper(ListBlobsOptions options, ContainersListBlobFlatSegmentResponse response) { - Flux result; - BlobFlatListSegment segment = response.value().segment(); - if (segment != null && segment.blobItems() != null) { - result = Flux.fromIterable(segment.blobItems()); - } else { - result = Flux.empty(); - } - - if (response.value().nextMarker() != null) { - // Recursively add the continuation items to the observable. - result = result.concatWith(listBlobsFlatSegment(response.value().nextMarker(), options) - .flatMapMany(r -> listBlobsFlatHelper(options, r))); - } - - return result; + return postProcessResponse(Utility.applyOptionalTimeout( + this.azureBlobStorage.containers().listBlobFlatSegmentWithRestResponseAsync(null, options.prefix(), marker, + options.maxResults(), options.details().toList(), null, null, Context.NONE), + timeout)); } /** @@ -600,7 +661,7 @@ private Flux listBlobsFlatHelper(ListBlobsOptions options, ContainersL * @param directory The directory to list blobs underneath * @return A reactive response emitting the prefixes and blobs. */ - public Flux listBlobsHierarchy(String directory) { + public PagedFlux listBlobsHierarchy(String directory) { return this.listBlobsHierarchy("/", new ListBlobsOptions().prefix(directory)); } @@ -632,9 +693,44 @@ public Flux listBlobsHierarchy(String directory) { * @param options {@link ListBlobsOptions} * @return A reactive response emitting the prefixes and blobs. */ - public Flux listBlobsHierarchy(String delimiter, ListBlobsOptions options) { - return listBlobsHierarchySegment(null, delimiter, options) - .flatMapMany(response -> listBlobsHierarchyHelper(delimiter, options, Context.NONE, response)); + public PagedFlux listBlobsHierarchy(String delimiter, ListBlobsOptions options) { + return listBlobsHierarchyWithOptionalTimeout(delimiter, options, null); + } + + /* + * Implementation for this paged listing operation, supporting an optional timeout provided by the synchronous + * ContainerClient. Applies the given timeout to each Mono backing the + * PagedFlux. + * + * @param delimiter The delimiter for blob hierarchy, "/" for hierarchy based on directories + * @param options {@link ListBlobsOptions} + * @param timeout An optional timeout to be applied to the network asynchronous operations. + * @return A reactive response emitting the listed blobs, flattened. + */ + PagedFlux listBlobsHierarchyWithOptionalTimeout(String delimiter, ListBlobsOptions options, Duration timeout) { + Function>> func = + marker -> listBlobsHierarchySegment(marker, delimiter, options, timeout) + .map(response -> { + List value = response.value().segment() == null + ? new ArrayList<>(0) + : Stream.concat( + response.value().segment().blobItems().stream(), + response.value().segment().blobPrefixes().stream() + .map(blobPrefix -> new BlobItem().name(blobPrefix.name()).isPrefix(true)) + ).collect(Collectors.toList()); + + return new PagedResponseBase<>( + response.request(), + response.statusCode(), + response.headers(), + value, + response.value().nextMarker(), + response.deserializedHeaders()); + }); + + return new PagedFlux<>( + () -> func.apply(null), + marker -> func.apply(marker)); } /* @@ -664,112 +760,19 @@ public Flux listBlobsHierarchy(String delimiter, ListBlobsOptions opti * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) */ - private Mono listBlobsHierarchySegment(String marker, String delimiter, ListBlobsOptions options) { + private Mono listBlobsHierarchySegment(String marker, String delimiter, + ListBlobsOptions options, Duration timeout) { options = options == null ? new ListBlobsOptions() : options; if (options.details().snapshots()) { - throw new UnsupportedOperationException("Including snapshots in a hierarchical listing is not supported."); + throw logger.logExceptionAsError(new UnsupportedOperationException("Including snapshots in a hierarchical listing is not supported.")); } - return postProcessResponse(this.azureBlobStorage.containers() - .listBlobHierarchySegmentWithRestResponseAsync(null, delimiter, options.prefix(), marker, - options.maxResults(), options.details().toList(), null, null, Context.NONE)); - } - - private Flux listBlobsHierarchyHelper(String delimiter, ListBlobsOptions options, - Context context, ContainersListBlobHierarchySegmentResponse response) { - Flux blobs; - Flux prefixes; - BlobHierarchyListSegment segment = response.value().segment(); - if (segment != null && segment.blobItems() != null) { - blobs = Flux.fromIterable(segment.blobItems()); - } else { - blobs = Flux.empty(); - } - if (segment != null && segment.blobPrefixes() != null) { - prefixes = Flux.fromIterable(segment.blobPrefixes()); - } else { - prefixes = Flux.empty(); - } - Flux result = blobs.map(item -> item.isPrefix(false)) - .concatWith(prefixes.map(prefix -> new BlobItem().name(prefix.name()).isPrefix(true))); - - if (response.value().nextMarker() != null) { - // Recursively add the continuation items to the observable. - result = result.concatWith(listBlobsHierarchySegment(response.value().nextMarker(), delimiter, options) - .flatMapMany(r -> listBlobsHierarchyHelper(delimiter, options, context, r))); - } - - return result; + return postProcessResponse(Utility.applyOptionalTimeout( + this.azureBlobStorage.containers().listBlobHierarchySegmentWithRestResponseAsync(null, delimiter, + options.prefix(), marker, options.maxResults(), options.details().toList(), null, null, Context.NONE), + timeout)); } - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -// public Flux listBlobsHierarchySegment(String marker, String delimiter, -// ListBlobsOptions options) { -// return this.listBlobsHierarchySegment(marker, delimiter, options, null); -// } - - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -// public Flux listBlobsHierarchySegment(String marker, String delimiter, -// ListBlobsOptions options) { -// return containerAsyncRawClient -// .listBlobsHierarchySegment(null, delimiter, options) -// .flatMapMany(); -// } - /** * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). @@ -779,8 +782,8 @@ private Flux listBlobsHierarchyHelper(String delimiter, ListBlobsOptio * non-infinite lease can be between 15 and 60 seconds. * @return A reactive response containing the lease ID. */ - public Mono> acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null); + public Mono acquireLease(String proposedId, int duration) { + return acquireLeaseWithResponse(proposedId, duration, null).flatMap(FluxUtil::toMono); } /** @@ -797,17 +800,20 @@ public Mono> acquireLease(String proposedId, int duration) { * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link * ModifiedAccessConditions#ifNoneMatch()} is set. */ - public Mono> acquireLease(String proposedID, int duration, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> acquireLeaseWithResponse(String proposedID, int duration, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> acquireLeaseWithResponse(proposedID, duration, modifiedAccessConditions, context)); + } + + Mono> acquireLeaseWithResponse(String proposedID, int duration, ModifiedAccessConditions modifiedAccessConditions, Context context) { if (!this.validateNoEtag(modifiedAccessConditions)) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "ETag access conditions are not supported for this API.")); } - return postProcessResponse(this.azureBlobStorage.containers().acquireLeaseWithRestResponseAsync( - null, null, duration, proposedID, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); + return postProcessResponse(this.azureBlobStorage.containers().acquireLeaseWithRestResponseAsync(null, null, duration, proposedID, + null, modifiedAccessConditions, context)).map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } /** @@ -816,8 +822,8 @@ public Mono> acquireLease(String proposedID, int duration, Modi * @param leaseID The leaseId of the active lease on the blob. * @return A reactive response containing the renewed lease ID. */ - public Mono> renewLease(String leaseID) { - return this.renewLease(leaseID, null); + public Mono renewLease(String leaseID) { + return renewLeaseWithResponse(leaseID, null).flatMap(FluxUtil::toMono); } /** @@ -831,17 +837,20 @@ public Mono> renewLease(String leaseID) { * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link * ModifiedAccessConditions#ifNoneMatch()} is set. */ - public Mono> renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> renewLeaseWithResponse(String leaseID, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> renewLeaseWithResponse(leaseID, modifiedAccessConditions, context)); + } + + Mono> renewLeaseWithResponse(String leaseID, ModifiedAccessConditions modifiedAccessConditions, Context context) { if (!this.validateNoEtag(modifiedAccessConditions)) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "ETag access conditions are not supported for this API.")); } - return postProcessResponse(this.azureBlobStorage.containers().renewLeaseWithRestResponseAsync(null, - leaseID, null, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); + return postProcessResponse(this.azureBlobStorage.containers().renewLeaseWithRestResponseAsync(null, leaseID, null, null, + modifiedAccessConditions, context)).map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } /** @@ -850,8 +859,8 @@ public Mono> renewLease(String leaseID, ModifiedAccessCondition * @param leaseID The leaseId of the active lease on the blob. * @return A reactive response signalling completion. */ - public Mono releaseLease(String leaseID) { - return this.releaseLease(leaseID, null); + public Mono releaseLease(String leaseID) { + return releaseLeaseWithResponse(leaseID, null).flatMap(FluxUtil::toMono); } /** @@ -865,16 +874,20 @@ public Mono releaseLease(String leaseID) { * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link * ModifiedAccessConditions#ifNoneMatch()} is set. */ - public Mono releaseLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono releaseLeaseWithResponse(String leaseID, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> releaseLeaseWithResponse(leaseID, modifiedAccessConditions, context)); + } + + Mono releaseLeaseWithResponse(String leaseID, ModifiedAccessConditions modifiedAccessConditions, Context context) { if (!this.validateNoEtag(modifiedAccessConditions)) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "ETag access conditions are not supported for this API.")); } return postProcessResponse(this.azureBlobStorage.containers().releaseLeaseWithRestResponseAsync( - null, leaseID, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseID, null, null, modifiedAccessConditions, context)) .map(VoidResponse::new); } @@ -884,8 +897,8 @@ public Mono releaseLease(String leaseID, ModifiedAccessConditions * * @return A reactive response containing the remaining time in the broken lease. */ - public Mono> breakLease() { - return this.breakLease(null, null); + public Mono breakLease() { + return breakLeaseWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -904,16 +917,20 @@ public Mono> breakLease() { * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link * ModifiedAccessConditions#ifNoneMatch()} is set. */ - public Mono> breakLease(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> breakLeaseWithResponse(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> breakLeaseWithResponse(breakPeriodInSeconds, modifiedAccessConditions, context)); + } + + Mono> breakLeaseWithResponse(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions, Context context) { if (!this.validateNoEtag(modifiedAccessConditions)) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "ETag access conditions are not supported for this API.")); } return postProcessResponse(this.azureBlobStorage.containers().breakLeaseWithRestResponseAsync(null, - null, breakPeriodInSeconds, null, modifiedAccessConditions, Context.NONE)) + null, breakPeriodInSeconds, null, modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, Duration.ofSeconds(rb.deserializedHeaders().leaseTime()))); } @@ -924,8 +941,8 @@ public Mono> breakLease(Integer breakPeriodInSeconds, Modifie * @param proposedID A {@code String} in any valid GUID format. * @return A reactive response containing the new lease ID. */ - public Mono> changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null); + public Mono changeLease(String leaseId, String proposedID) { + return changeLeaseWithResponse(leaseId, proposedID, null).flatMap(FluxUtil::toMono); } /** @@ -941,16 +958,20 @@ public Mono> changeLease(String leaseId, String proposedID) { * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link * ModifiedAccessConditions#ifNoneMatch()} is set. */ - public Mono> changeLease(String leaseId, String proposedID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> changeLeaseWithResponse(String leaseId, String proposedID, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> changeLeaseWithResponse(leaseId, proposedID, modifiedAccessConditions, context)); + } + + Mono> changeLeaseWithResponse(String leaseId, String proposedID, ModifiedAccessConditions modifiedAccessConditions, Context context) { if (!this.validateNoEtag(modifiedAccessConditions)) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "ETag access conditions are not supported for this API.")); } return postProcessResponse(this.azureBlobStorage.containers().changeLeaseWithRestResponseAsync(null, - leaseId, proposedID, null, null, modifiedAccessConditions, Context.NONE)) + leaseId, proposedID, null, null, modifiedAccessConditions, context)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } @@ -960,12 +981,27 @@ public Mono> changeLease(String leaseId, String proposedID, Mod * * @return A reactive response containing the account info. */ - public Mono> getAccountInfo() { + public Mono getAccountInfo() { + return getAccountInfoWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Returns the sku name and account kind for the account. For more information, please see the + * Azure Docs. + * + * @return A reactive response containing the account info. + */ + public Mono> getAccountInfoWithResponse() { + return withContext(context -> getAccountInfoWithResponse(context)); + } + + Mono> getAccountInfoWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.containers().getAccountInfoWithRestResponseAsync(null, Context.NONE)) + this.azureBlobStorage.containers().getAccountInfoWithRestResponseAsync(null, context)) .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.deserializedHeaders()))); } + private boolean validateNoEtag(ModifiedAccessConditions modifiedAccessConditions) { if (modifiedAccessConditions == null) { return true; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClient.java index 566efd526a69..79038c2e09cd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClient.java @@ -3,8 +3,10 @@ package com.azure.storage.blob; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobItem; import com.azure.storage.blob.models.ContainerAccessConditions; import com.azure.storage.blob.models.ContainerAccessPolicies; @@ -19,7 +21,6 @@ import com.azure.storage.common.IPRange; import com.azure.storage.common.SASProtocol; import com.azure.storage.common.Utility; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.URL; @@ -42,7 +43,7 @@ * Docs for more information on containers. */ public final class ContainerClient { - private ContainerAsyncClient containerAsyncClient; + private final ContainerAsyncClient containerAsyncClient; public static final String ROOT_CONTAINER_NAME = ContainerAsyncClient.ROOT_CONTAINER_NAME; @@ -52,7 +53,6 @@ public final class ContainerClient { /** * Package-private constructor for use by {@link ContainerClientBuilder}. - * * @param containerAsyncClient the async container client */ ContainerClient(ContainerAsyncClient containerAsyncClient) { @@ -65,8 +65,8 @@ public final class ContainerClient { * pipeline, create the BlockBlobClient and then call its WithPipeline method passing in the desired pipeline * object. Or, call this package's NewBlockBlobAsyncClient instead of calling this object's NewBlockBlobAsyncClient * method. - * * @param blobName A {@code String} representing the name of the blob. + * * @return A new {@link BlockBlobClient} object which references the blob with the specified name in this container. */ public BlockBlobClient getBlockBlobClient(String blobName) { @@ -79,9 +79,9 @@ public BlockBlobClient getBlockBlobClient(String blobName) { * pipeline, create the BlockBlobClient and then call its WithPipeline method passing in the desired pipeline * object. Or, call this package's NewBlockBlobAsyncClient instead of calling this object's NewBlockBlobAsyncClient * method. - * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. + * * @return A new {@link BlockBlobClient} object which references the blob with the specified name in this container. */ public BlockBlobClient getBlockBlobClient(String blobName, String snapshot) { @@ -93,8 +93,8 @@ public BlockBlobClient getBlockBlobClient(String blobName, String snapshot) { * The new PageBlobClient uses the same request policy pipeline as the ContainerAsyncClient. To change the pipeline, * create the PageBlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call * this package's NewPageBlobAsyncClient instead of calling this object's NewPageBlobAsyncClient method. - * * @param blobName A {@code String} representing the name of the blob. + * * @return A new {@link PageBlobClient} object which references the blob with the specified name in this container. */ public PageBlobClient getPageBlobClient(String blobName) { @@ -106,9 +106,9 @@ public PageBlobClient getPageBlobClient(String blobName) { * The new PageBlobClient uses the same request policy pipeline as the ContainerAsyncClient. To change the pipeline, * create the PageBlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call * this package's NewPageBlobAsyncClient instead of calling this object's NewPageBlobAsyncClient method. - * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. + * * @return A new {@link PageBlobClient} object which references the blob with the specified name in this container. */ public PageBlobClient getPageBlobClient(String blobName, String snapshot) { @@ -121,8 +121,8 @@ public PageBlobClient getPageBlobClient(String blobName, String snapshot) { * pipeline, create the AppendBlobClient and then call its WithPipeline method passing in the desired pipeline * object. Or, call this package's NewAppendBlobAsyncClient instead of calling this object's * NewAppendBlobAsyncClient method. - * * @param blobName A {@code String} representing the name of the blob. + * * @return A new {@link AppendBlobClient} object which references the blob with the specified name in this * container. */ @@ -136,9 +136,9 @@ public AppendBlobClient getAppendBlobClient(String blobName) { * pipeline, create the AppendBlobClient and then call its WithPipeline method passing in the desired pipeline * object. Or, call this package's NewAppendBlobAsyncClient instead of calling this object's * NewAppendBlobAsyncClient method. - * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. + * * @return A new {@link AppendBlobClient} object which references the blob with the specified name in this * container. */ @@ -151,8 +151,8 @@ public AppendBlobClient getAppendBlobClient(String blobName, String snapshot) { * BlobClient uses the same request policy pipeline as the ContainerAsyncClient. To change the pipeline, create the * BlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's * getBlobAsyncClient instead of calling this object's getBlobAsyncClient method. - * * @param blobName A {@code String} representing the name of the blob. + * * @return A new {@link BlobClient} object which references the blob with the specified name in this container. */ public BlobClient getBlobClient(String blobName) { @@ -164,9 +164,9 @@ public BlobClient getBlobClient(String blobName) { * BlobClient uses the same request policy pipeline as the ContainerAsyncClient. To change the pipeline, create the * BlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's * getBlobAsyncClient instead of calling this object's getBlobAsyncClient method. - * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. + * * @return A new {@link BlobClient} object which references the blob with the specified name in this container. */ public BlobClient getBlobClient(String blobName, String snapshot) { @@ -175,7 +175,6 @@ public BlobClient getBlobClient(String blobName, String snapshot) { /** * Initializes a {@link BlobServiceClient} object pointing to the storage account this container is in. - * * @return A {@link BlobServiceClient} object pointing to the specified storage account */ public BlobServiceClient getBlobServiceClient() { @@ -184,7 +183,6 @@ public BlobServiceClient getBlobServiceClient() { /** * Gets the URL of the container represented by this client. - * * @return the URL. */ public URL getContainerUrl() { @@ -193,21 +191,21 @@ public URL getContainerUrl() { /** * Gets if the container this client represents exists in the cloud. - * * @return true if the container exists, false if it doesn't */ - public Response exists() { - return this.exists(null); + public Boolean exists() { + return existsWithResponse(null, Context.NONE).value(); } /** * Gets if the container this client represents exists in the cloud. - * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return true if the container exists, false if it doesn't */ - public Response exists(Duration timeout) { - Mono> response = containerAsyncClient.exists(); + public Response existsWithResponse(Duration timeout, Context context) { + Mono> response = containerAsyncClient.existsWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -216,26 +214,25 @@ public Response exists(Duration timeout) { * Creates a new container within a storage account. If a container with the same name already exists, the operation * fails. For more information, see the * Azure Docs. - * - * @return A response containing status code and HTTP headers */ - public VoidResponse create() { - return this.create(null, null, null); + public void create() { + createWithResponse(null, null, null, Context.NONE); } /** * Creates a new container within a storage account. If a container with the same name already exists, the operation * fails. For more information, see the * Azure Docs. - * * @param metadata {@link Metadata} * @param accessType Specifies how the data in this container is available to the public. See the - * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. + * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return A response containing status code and HTTP headers */ - public VoidResponse create(Metadata metadata, PublicAccessType accessType, Duration timeout) { - Mono response = containerAsyncClient.create(metadata, accessType); + public VoidResponse createWithResponse(Metadata metadata, PublicAccessType accessType, Duration timeout, Context context) { + Mono response = containerAsyncClient.createWithResponse(metadata, accessType, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -244,24 +241,23 @@ public VoidResponse create(Metadata metadata, PublicAccessType accessType, Durat * Marks the specified container for deletion. The container and any blobs contained within it are later deleted * during garbage collection. For more information, see the * Azure Docs. - * - * @return A response containing status code and HTTP headers */ - public VoidResponse delete() { - return this.delete(null, null); + public void delete() { + deleteWithResponse(null, null, Context.NONE); } /** * Marks the specified container for deletion. The container and any blobs contained within it are later deleted * during garbage collection. For more information, see the * Azure Docs. - * * @param accessConditions {@link ContainerAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return A response containing status code and HTTP headers */ - public VoidResponse delete(ContainerAccessConditions accessConditions, Duration timeout) { - Mono response = containerAsyncClient.delete(accessConditions); + public VoidResponse deleteWithResponse(ContainerAccessConditions accessConditions, Duration timeout, Context context) { + Mono response = containerAsyncClient.deleteWithResponse(accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -269,25 +265,25 @@ public VoidResponse delete(ContainerAccessConditions accessConditions, Duration /** * Returns the container's metadata and system properties. For more information, see the * Azure Docs. - * * @return The container properties. */ - public Response getProperties() { - return this.getProperties(null, null); + public ContainerProperties getProperties() { + return getPropertiesWithResponse(null, null, Context.NONE).value(); } /** * Returns the container's metadata and system properties. For more information, see the * Azure Docs. - * * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does - * not match the active lease on the blob. + * not match the active lease on the blob. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return The container properties. */ - public Response getProperties(LeaseAccessConditions leaseAccessConditions, - Duration timeout) { - Mono> response = containerAsyncClient.getProperties(leaseAccessConditions); + public Response getPropertiesWithResponse(LeaseAccessConditions leaseAccessConditions, + Duration timeout, Context context) { + Mono> response = containerAsyncClient.getPropertiesWithResponse(leaseAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -295,26 +291,26 @@ public Response getProperties(LeaseAccessConditions leaseAc /** * Sets the container's metadata. For more information, see the * Azure Docs. - * * @param metadata {@link Metadata} - * @return A response containing status code and HTTP headers + * */ - public VoidResponse setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null, null); + public void setMetadata(Metadata metadata) { + setMetadataWithResponse(metadata, null, null, Context.NONE); } /** * Sets the container's metadata. For more information, see the * Azure Docs. - * * @param metadata {@link Metadata} * @param accessConditions {@link ContainerAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return A response containing status code and HTTP headers */ - public VoidResponse setMetadata(Metadata metadata, - ContainerAccessConditions accessConditions, Duration timeout) { - Mono response = containerAsyncClient.setMetadata(metadata, accessConditions); + public VoidResponse setMetadataWithResponse(Metadata metadata, + ContainerAccessConditions accessConditions, Duration timeout, Context context) { + Mono response = containerAsyncClient.setMetadataWithResponse(metadata, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -323,26 +319,26 @@ public VoidResponse setMetadata(Metadata metadata, * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. * For more information, see the * Azure Docs. - * * @return The container access policy. */ - public Response getAccessPolicy() { - return this.getAccessPolicy(null, null); + public ContainerAccessPolicies getAccessPolicy() { + return getAccessPolicyWithResponse(null, null, Context.NONE).value(); } /** * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. * For more information, see the * Azure Docs. - * * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does - * not match the active lease on the blob. + * not match the active lease on the blob. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return The container access policy. */ - public Response getAccessPolicy(LeaseAccessConditions leaseAccessConditions, - Duration timeout) { - Mono> response = containerAsyncClient.getAccessPolicy(leaseAccessConditions); + public Response getAccessPolicyWithResponse(LeaseAccessConditions leaseAccessConditions, + Duration timeout, Context context) { + Mono> response = containerAsyncClient.getAccessPolicyWithResponse(leaseAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -352,18 +348,16 @@ public Response getAccessPolicy(LeaseAccessConditions l * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to * ensure the time formatting is compatible with the service. For more information, see the * Azure Docs. - * * @param accessType Specifies how the data in this container is available to the public. See the - * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. + * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. * @param identifiers A list of {@link SignedIdentifier} objects that specify the permissions for the container. - * Please see - * here - * for more information. Passing null will clear all access policies. - * @return A response containing status code and HTTP headers + * Please see + * here + * for more information. Passing null will clear all access policies. */ - public VoidResponse setAccessPolicy(PublicAccessType accessType, - List identifiers) { - return this.setAccessPolicy(accessType, identifiers, null, null); + public void setAccessPolicy(PublicAccessType accessType, + List identifiers) { + setAccessPolicyWithResponse(accessType, identifiers, null, null, Context.NONE); } /** @@ -371,28 +365,29 @@ public VoidResponse setAccessPolicy(PublicAccessType accessType, * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to * ensure the time formatting is compatible with the service. For more information, see the * Azure Docs. - * * @param accessType Specifies how the data in this container is available to the public. See the - * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. + * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. * @param identifiers A list of {@link SignedIdentifier} objects that specify the permissions for the container. - * Please see - * here - * for more information. Passing null will clear all access policies. + * Please see + * here + * for more information. Passing null will clear all access policies. * @param accessConditions {@link ContainerAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return A response containing status code and HTTP headers */ - public VoidResponse setAccessPolicy(PublicAccessType accessType, - List identifiers, ContainerAccessConditions accessConditions, - Duration timeout) { - Mono response = containerAsyncClient.setAccessPolicy(accessType, identifiers, accessConditions); + public VoidResponse setAccessPolicyWithResponse(PublicAccessType accessType, + List identifiers, ContainerAccessConditions accessConditions, + Duration timeout, Context context) { + Mono response = containerAsyncClient.setAccessPolicyWithResponse(accessType, identifiers, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * Returns a lazy loaded list of blobs in this container, with folder structures flattened. The returned {@link - * Iterable} can be iterated through while new items are automatically retrieved as needed. + * PagedIterable} can be consumed through while new items are automatically retrieved as needed. * *

    * Blob names are returned in lexicographic order. @@ -400,16 +395,15 @@ public VoidResponse setAccessPolicy(PublicAccessType accessType, *

    * For more information, see the * Azure Docs. - * * @return The listed blobs, flattened. */ - public Iterable listBlobsFlat() { + public PagedIterable listBlobsFlat() { return this.listBlobsFlat(new ListBlobsOptions(), null); } /** * Returns a lazy loaded list of blobs in this container, with folder structures flattened. The returned {@link - * Iterable} can be iterated through while new items are automatically retrieved as needed. + * PagedIterable} can be consumed through while new items are automatically retrieved as needed. * *

    * Blob names are returned in lexicographic order. @@ -417,15 +411,13 @@ public Iterable listBlobsFlat() { *

    * For more information, see the * Azure Docs. - * * @param options {@link ListBlobsOptions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * * @return The listed blobs, flattened. */ - public Iterable listBlobsFlat(ListBlobsOptions options, Duration timeout) { - Flux response = containerAsyncClient.listBlobsFlat(options); - - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + public PagedIterable listBlobsFlat(ListBlobsOptions options, Duration timeout) { + return new PagedIterable<>(containerAsyncClient.listBlobsFlatWithOptionalTimeout(options, timeout)); } /** @@ -451,11 +443,11 @@ public Iterable listBlobsFlat(ListBlobsOptions options, Duration timeo *

  • foo/foo1 (isPrefix = false) *
  • foo/foo2 (isPrefix = false) * - * * @param directory The directory to list blobs underneath + * * @return A reactive response emitting the prefixes and blobs. */ - public Iterable listBlobsHierarchy(String directory) { + public PagedIterable listBlobsHierarchy(String directory) { return this.listBlobsHierarchy("/", new ListBlobsOptions().prefix(directory), null); } @@ -482,104 +474,119 @@ public Iterable listBlobsHierarchy(String directory) { *
  • foo/foo1 (isPrefix = false) *
  • foo/foo2 (isPrefix = false) * - * * @param delimiter The delimiter for blob hierarchy, "/" for hierarchy based on directories * @param options {@link ListBlobsOptions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * * @return A reactive response emitting the prefixes and blobs. */ - public Iterable listBlobsHierarchy(String delimiter, ListBlobsOptions options, Duration timeout) { - Flux response = containerAsyncClient.listBlobsHierarchy(delimiter, options); - - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + public PagedIterable listBlobsHierarchy(String delimiter, ListBlobsOptions options, Duration timeout) { + return new PagedIterable<>(containerAsyncClient.listBlobsHierarchyWithOptionalTimeout(delimiter, options, timeout)); } /** * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). - * * @param proposedId A {@code String} in any valid GUID format. May be null. * @param duration The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A - * non-infinite lease can be between 15 and 60 seconds. + * non-infinite lease can be between 15 and 60 seconds. + * * @return The lease ID. */ - public Response acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); + public String acquireLease(String proposedId, int duration) { + return acquireLeaseWithResponse(proposedId, duration, null, null, Context.NONE).value(); } /** * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). - * * @param proposedID A {@code String} in any valid GUID format. May be null. * @param duration The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A - * non-infinite lease can be between 15 and 60 seconds. + * non-infinite lease can be between 15 and 60 seconds. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and - * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given - * request. The request will fail if the specified condition is not satisfied. + * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given + * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return The lease ID. */ - public Response acquireLease(String proposedID, int duration, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response acquireLeaseWithResponse(String proposedID, int duration, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono> response = containerAsyncClient - .acquireLease(proposedID, duration, modifiedAccessConditions); + .acquireLeaseWithResponse(proposedID, duration, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * Renews the blob's previously-acquired lease. - * * @param leaseID The leaseId of the active lease on the blob. + * * @return The renewed lease ID. */ - public Response renewLease(String leaseID) { - return this.renewLease(leaseID, null, null); + public String renewLease(String leaseID) { + return renewLease(leaseID, null, null); } /** * Renews the blob's previously-acquired lease. + * @param leaseID The leaseId of the active lease on the blob. + * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and + * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given + * request. The request will fail if the specified condition is not satisfied. + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * + * @return The renewed lease ID. + */ + public String renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, + Duration timeout) { + return renewLeaseWithResponse(leaseID, modifiedAccessConditions, timeout, Context.NONE).value(); + } + + /** + * Renews the blob's previously-acquired lease. * @param leaseID The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and - * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given - * request. The request will fail if the specified condition is not satisfied. + * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given + * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return The renewed lease ID. */ - public Response renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, - Duration timeout) { + public Response renewLeaseWithResponse(String leaseID, ModifiedAccessConditions modifiedAccessConditions, + Duration timeout, Context context) { Mono> response = containerAsyncClient - .renewLease(leaseID, modifiedAccessConditions); + .renewLeaseWithResponse(leaseID, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * Releases the blob's previously-acquired lease. - * * @param leaseID The leaseId of the active lease on the blob. - * @return A response containing status code and HTTP headers + * */ - public VoidResponse releaseLease(String leaseID) { - return this.releaseLease(leaseID, null, null); + public void releaseLease(String leaseID) { + releaseLeaseWithResponse(leaseID, null, null, Context.NONE); } /** * Releases the blob's previously-acquired lease. - * * @param leaseID The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and - * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given - * request. The request will fail if the specified condition is not satisfied. + * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given + * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return A response containing status code and HTTP headers. */ - public VoidResponse releaseLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public VoidResponse releaseLeaseWithResponse(String leaseID, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono response = containerAsyncClient - .releaseLease(leaseID, modifiedAccessConditions); + .releaseLeaseWithResponse(leaseID, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -587,63 +594,64 @@ public VoidResponse releaseLease(String leaseID, /** * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. - * * @return The remaining time in the broken lease. */ - public Response breakLease() { - return this.breakLease(null, null, null); + public Duration breakLease() { + return breakLeaseWithResponse(null, null, null, Context.NONE).value(); } /** * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. - * * @param breakPeriodInSeconds An optional {@code Integer} representing the proposed duration of seconds that the - * lease should continue before it is broken, between 0 and 60 seconds. This break period is only used if it is - * shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease - * will not be available before the break period has expired, but the lease may be held for longer than the break - * period. + * lease should continue before it is broken, between 0 and 60 seconds. This break period is only used if it is + * shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease + * will not be available before the break period has expired, but the lease may be held for longer than the break + * period. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and - * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given - * request. The request will fail if the specified condition is not satisfied. + * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given + * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return The remaining time in the broken lease. */ - public Response breakLease(Integer breakPeriodInSeconds, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response breakLeaseWithResponse(Integer breakPeriodInSeconds, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono> response = containerAsyncClient - .breakLease(breakPeriodInSeconds, modifiedAccessConditions); + .breakLeaseWithResponse(breakPeriodInSeconds, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * ChangeLease changes the blob's lease ID. - * * @param leaseId The leaseId of the active lease on the blob. * @param proposedID A {@code String} in any valid GUID format. + * * @return The new lease ID. */ - public Response changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null, null); + public String changeLease(String leaseId, String proposedID) { + return changeLeaseWithResponse(leaseId, proposedID, null, null, Context.NONE).value(); } /** * ChangeLease changes the blob's lease ID. For more information, see the Azure * Docs. - * * @param leaseId The leaseId of the active lease on the blob. * @param proposedID A {@code String} in any valid GUID format. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and - * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given - * request. The request will fail if the specified condition is not satisfied. + * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given + * request. The request will fail if the specified condition is not satisfied. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return The new lease ID. */ - public Response changeLease(String leaseId, String proposedID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response changeLeaseWithResponse(String leaseId, String proposedID, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono> response = containerAsyncClient - .changeLease(leaseId, proposedID, modifiedAccessConditions); + .changeLeaseWithResponse(leaseId, proposedID, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -651,23 +659,35 @@ public Response changeLease(String leaseId, String proposedID, /** * Returns the sku name and account kind for the account. For more information, please see the * Azure Docs. + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * + * @return The account info. + */ + public StorageAccountInfo getAccountInfo(Duration timeout) { + return getAccountInfoWithResponse(timeout, Context.NONE).value(); + } + + /** + * Returns the sku name and account kind for the account. For more information, please see the + * Azure Docs. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * * @return The account info. */ - public Response getAccountInfo(Duration timeout) { - Mono> response = containerAsyncClient.getAccountInfo(); + public Response getAccountInfoWithResponse(Duration timeout, Context context) { + Mono> response = containerAsyncClient.getAccountInfoWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * Generates a user delegation SAS token with the specified parameters - * * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS * @param accountName The {@code String} account name for the SAS * @param permissions The {@code ContainerSASPermissions} permission for the SAS * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, @@ -678,7 +698,6 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str /** * Generates a user delegation SAS token with the specified parameters - * * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS * @param accountName The {@code String} account name for the SAS * @param permissions The {@code ContainerSASPermissions} permission for the SAS @@ -687,6 +706,7 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @param version An optional {@code String} version for the SAS * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS * @param ipRange An optional {@code IPRange} ip address range for the SAS + * * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, @@ -698,7 +718,6 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str /** * Generates a user delegation SAS token with the specified parameters - * * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS * @param accountName The {@code String} account name for the SAS * @param permissions The {@code ContainerSASPermissions} permission for the SAS @@ -712,6 +731,7 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @param contentEncoding An optional {@code String} content-encoding header for the SAS. * @param contentLanguage An optional {@code String} content-language header for the SAS. * @param contentType An optional {@code String} content-type header for the SAS. + * * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, @@ -725,9 +745,9 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str /** * Generates a SAS token with the specified parameters - * * @param permissions The {@code ContainerSASPermissions} permission for the SAS * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS + * * @return A string that represents the SAS token */ public String generateSAS(ContainerSASPermission permissions, OffsetDateTime expiryTime) { @@ -736,8 +756,8 @@ public String generateSAS(ContainerSASPermission permissions, OffsetDateTime exp /** * Generates a SAS token with the specified parameters - * * @param identifier The {@code String} name of the access policy on the container this SAS references if any + * * @return A string that represents the SAS token */ public String generateSAS(String identifier) { @@ -746,7 +766,6 @@ public String generateSAS(String identifier) { /** * Generates a SAS token with the specified parameters - * * @param identifier The {@code String} name of the access policy on the container this SAS references if any * @param permissions The {@code ContainerSASPermissions} permission for the SAS * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS @@ -754,6 +773,7 @@ public String generateSAS(String identifier) { * @param version An optional {@code String} version for the SAS * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS * @param ipRange An optional {@code IPRange} ip address range for the SAS + * * @return A string that represents the SAS token */ public String generateSAS(String identifier, ContainerSASPermission permissions, OffsetDateTime expiryTime, @@ -764,7 +784,6 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, /** * Generates a SAS token with the specified parameters - * * @param identifier The {@code String} name of the access policy on the container this SAS references if any * @param permissions The {@code ContainerSASPermissions} permission for the SAS * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS @@ -777,6 +796,7 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, * @param contentEncoding An optional {@code String} content-encoding header for the SAS. * @param contentLanguage An optional {@code String} content-language header for the SAS. * @param contentType An optional {@code String} content-type header for the SAS. + * * @return A string that represents the SAS token */ public String generateSAS(String identifier, ContainerSASPermission permissions, OffsetDateTime expiryTime, diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java index 1c61dd618a46..2b24a87edcfa 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java @@ -14,9 +14,12 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -50,13 +53,16 @@ * Once all the configurations are set on this builder, call {@code .buildClient()} to create a * {@link ContainerClient} or {@code .buildAsyncClient()} to create a {@link ContainerAsyncClient}. */ +@ServiceClientBuilder(serviceClients = {ContainerClient.class, ContainerAsyncClient.class}) public final class ContainerClientBuilder { private static final String ACCOUNT_NAME = "accountname"; private static final String ACCOUNT_KEY = "accountkey"; private static final String ENDPOINT_PROTOCOL = "defaultendpointsprotocol"; private static final String ENDPOINT_SUFFIX = "endpointsuffix"; - private final List policies; + private final ClientLogger logger = new ClientLogger(ContainerClientBuilder.class); + + private final List additionalPolicies; private String endpoint; private String containerName; @@ -75,7 +81,7 @@ public final class ContainerClientBuilder { public ContainerClientBuilder() { retryOptions = new RequestRetryOptions(); logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); + additionalPolicies = new ArrayList<>(); } /** @@ -111,8 +117,11 @@ public ContainerAsyncClient buildAsyncClient() { } policies.add(new RequestRetryPolicy(retryOptions)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + + policies.addAll(this.additionalPolicies); - policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(logLevel)); HttpPipeline pipeline = new HttpPipelineBuilder() @@ -146,7 +155,7 @@ public ContainerClientBuilder endpoint(String endpoint) { this.sharedKeyCredential = null; } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed.")); } return this; @@ -237,7 +246,7 @@ public ContainerClientBuilder connectionString(String connectionString) { String endpointSuffix = connectionKVPs.get(ENDPOINT_SUFFIX); if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); + throw logger.logExceptionAsError(new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'.")); } if (!ImplUtils.isNullOrEmpty(endpointProtocol) && !ImplUtils.isNullOrEmpty(endpointSuffix)) { @@ -267,7 +276,7 @@ public ContainerClientBuilder httpClient(HttpClient httpClient) { * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. */ public ContainerClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(Objects.requireNonNull(pipelinePolicy)); + this.additionalPolicies.add(Objects.requireNonNull(pipelinePolicy)); return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java index c6031c9edd37..5016ac93a47b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java @@ -36,8 +36,7 @@ public ContainerSASPermission() { * Creates an {@code ContainerSASPermission} from the specified permissions string. This method will throw an * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. * - * @param permString - * A {@code String} which represents the {@code ContainerSASPermission}. + * @param permString A {@code String} which represents the {@code ContainerSASPermission}. * * @return A {@code ContainerSASPermission} generated from the given {@code String}. * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, c, w, d, or l. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java index 1daacb95051d..4743d8bb2d4c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java @@ -9,17 +9,17 @@ import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.ReliableDownloadOptions; import com.azure.storage.common.Utility; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.io.IOException; +import java.nio.ByteBuffer; import java.util.Map; import java.util.function.Function; /** - * {@code DownloadAsyncResponse} wraps the protocol-layer response from {@link BlobAsyncClient#download(BlobRange, - * ReliableDownloadOptions, BlobAccessConditions, boolean)} to automatically retry failed reads from the body as + * {@code DownloadAsyncResponse} wraps the protocol-layer response from {@link BlobAsyncClient#download(BlobRange, BlobAccessConditions, boolean)} + * to automatically retry failed reads from the body as * appropriate. If the download is interrupted, the {@code DownloadAsyncResponse} will make a request to resume the download * from where it left off, allowing the user to consume the data as one continuous stream, for any interruptions are * hidden. The retry behavior is defined by the options passed to the {@link #body(ReliableDownloadOptions)}. The @@ -34,13 +34,13 @@ public final class DownloadAsyncResponse { private final HTTPGetterInfo info; - private final ResponseBase> rawResponse; + private final ResponseBase> rawResponse; private final Function> getter; // The constructor is package-private because customers should not be creating their own responses. - DownloadAsyncResponse(ResponseBase> response, + DownloadAsyncResponse(ResponseBase> response, HTTPGetterInfo info, Function> getter) { Utility.assertNotNull("getter", getter); Utility.assertNotNull("info", info); @@ -56,9 +56,9 @@ public final class DownloadAsyncResponse { * will make additional requests to reestablish a connection and continue reading. * * @param options {@link ReliableDownloadOptions} - * @return A {@link Flux} which emits the data as {@link ByteBuf ByteBufs} + * @return A {@link Flux} which emits the data as {@link ByteBuffer ByteBuffers} */ - public Flux body(ReliableDownloadOptions options) { + public Flux body(ReliableDownloadOptions options) { ReliableDownloadOptions optionsReal = options == null ? new ReliableDownloadOptions() : options; if (optionsReal.maxRetryRequests() == 0) { return this.rawResponse.value(); @@ -72,7 +72,7 @@ retries as we have not actually retried yet, only made the initial try. Because return this.applyReliableDownload(this.rawResponse.value(), -1, optionsReal); } - private Flux tryContinueFlux(Throwable t, int retryCount, ReliableDownloadOptions options) { + private Flux tryContinueFlux(Throwable t, int retryCount, ReliableDownloadOptions options) { // If all the errors are exhausted, return this error to the user. if (retryCount > options.maxRetryRequests() || !(t instanceof IOException)) { return Flux.error(t); @@ -96,15 +96,15 @@ possible the method call that returns a Single is what throws (like how our apis } } - private Flux applyReliableDownload(Flux data, int currentRetryCount, ReliableDownloadOptions options) { + private Flux applyReliableDownload(Flux data, int currentRetryCount, ReliableDownloadOptions options) { return data.doOnNext(buffer -> { /* Update how much data we have received in case we need to retry and propagate to the user the data we have received. */ - this.info.offset(this.info.offset() + buffer.readableBytes()); // was `remaining()` in Rx world + this.info.offset(this.info.offset() + buffer.remaining()); if (this.info.count() != null) { - this.info.count(this.info.count() - buffer.readableBytes()); // was `remaining()` in Rx world + this.info.count(this.info.count() - buffer.remaining()); } }).onErrorResume(t2 -> { // Increment the retry count and try again with the new exception. @@ -136,7 +136,7 @@ public Map rawHeaders() { /** * @return the raw response */ - public ResponseBase> rawResponse() { + public ResponseBase> rawResponse() { return this.rawResponse; } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadResponse.java index 11e90ba09daf..2438a23e51c6 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadResponse.java @@ -4,10 +4,10 @@ package com.azure.storage.blob; import com.azure.storage.blob.models.ReliableDownloadOptions; -import io.netty.buffer.ByteBuf; import java.io.IOException; import java.io.OutputStream; +import java.nio.ByteBuffer; public class DownloadResponse { private final DownloadAsyncResponse asyncResponse; @@ -24,9 +24,10 @@ public class DownloadResponse { * @throws IOException If an I/O error occurs */ public void body(OutputStream outputStream, ReliableDownloadOptions options) throws IOException { - for (ByteBuf buffer : this.asyncResponse.body(options).toIterable()) { - buffer.readBytes(outputStream, buffer.readableBytes()); - buffer.release(); + for (ByteBuffer buffer : this.asyncResponse.body(options).toIterable()) { + if (buffer.hasArray()) { + outputStream.write(buffer.array()); + } } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java index 64dd6b5d997d..5ce568053bed 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java @@ -3,6 +3,7 @@ package com.azure.storage.blob; +import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.common.Utility; @@ -62,7 +63,7 @@ public HTTPGetterInfo count(Long count) { /** * @return the eTag used when creating If-Match header. eTag is returned with any operation that modifies the - * resource and when retrieving {@link BlobClient#getProperties(BlobAccessConditions, Duration) properties}. + * resource and when retrieving {@link BlobClient#getPropertiesWithResponse(BlobAccessConditions, Duration, Context) properties}. * Defaults to null. */ public String eTag() { @@ -71,7 +72,7 @@ public String eTag() { /** * Sets the eTag used when creating If-Match header. eTag is returned with any operation that modifies the - * resource and when retrieving {@link BlobClient#getProperties(BlobAccessConditions, Duration) properties}. + * resource and when retrieving {@link BlobClient#getPropertiesWithResponse(BlobAccessConditions, Duration, Context) properties}. * Defaults to null. * * @param eTag Resource's eTag diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java index 944bb4ef8ff6..adce2d5c3cdc 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java @@ -6,7 +6,9 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.implementation.http.UrlBuilder; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.blob.models.BlobHTTPHeaders; @@ -21,14 +23,15 @@ import com.azure.storage.blob.models.SequenceNumberActionType; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.common.Constants; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.MalformedURLException; import java.net.URL; +import java.nio.ByteBuffer; import static com.azure.storage.blob.PostProcessor.postProcessResponse; +import static com.azure.core.implementation.util.FluxUtil.withContext; /** * Client to a page blob. It may only be instantiated through a {@link BlobClientBuilder}, via @@ -64,6 +67,8 @@ public final class PageBlobAsyncClient extends BlobAsyncClient { */ public static final int MAX_PUT_PAGES_BYTES = 4 * Constants.MB; + private final ClientLogger logger = new ClientLogger(PageBlobAsyncClient.class); + /** * Package-private constructor for use by {@link BlobClientBuilder}. * @param azureBlobStorage the API client for blob storage @@ -77,15 +82,13 @@ public final class PageBlobAsyncClient extends BlobAsyncClient { * For more information, see the * Azure Docs. * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a + * @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a * 512-byte boundary. * - * @return - * A reactive response containing the information of the created page blob. + * @return A reactive response containing the information of the created page blob. */ - public Mono> create(long size) { - return this.create(size, null, null, null, null); + public Mono create(long size) { + return createWithResponse(size, null, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -93,43 +96,42 @@ public Mono> create(long size) { * For more information, see the * Azure Docs. * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a + * @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a * 512-byte boundary. - * @param sequenceNumber - * A user-controlled value that you can use to track requests. The value of the sequence number must be - * between 0 and 2^63 - 1.The default value is 0. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} + * @param sequenceNumber A user-controlled value that you can use to track requests. The value of the sequence + * number must be between 0 and 2^63 - 1.The default value is 0. + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} * * @return A reactive response containing the information of the created page blob. * @throws IllegalArgumentException If {@code size} isn't a multiple of {@link PageBlobAsyncClient#PAGE_BYTES} * or {@code sequenceNumber} isn't null and is less than 0. */ - public Mono> create(long size, Long sequenceNumber, BlobHTTPHeaders headers, + public Mono> createWithResponse(long size, Long sequenceNumber, BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions) { + return withContext(context -> createWithResponse(size, sequenceNumber, headers, metadata, accessConditions, context)); + } + + Mono> createWithResponse(long size, Long sequenceNumber, BlobHTTPHeaders headers, + Metadata metadata, BlobAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; if (size % PAGE_BYTES != 0) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("size must be a multiple of PageBlobAsyncClient.PAGE_BYTES."); + throw logger.logExceptionAsError(new IllegalArgumentException("size must be a multiple of PageBlobAsyncClient.PAGE_BYTES.")); } if (sequenceNumber != null && sequenceNumber < 0) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("SequenceNumber must be greater than or equal to 0."); + throw logger.logExceptionAsError(new IllegalArgumentException("SequenceNumber must be greater than or equal to 0.")); } metadata = metadata == null ? new Metadata() : metadata; return postProcessResponse(this.azureBlobStorage.pageBlobs().createWithRestResponseAsync(null, - null, 0, size, null, metadata, null, null, - null, sequenceNumber, null, headers, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) + null, 0, size, null, metadata, sequenceNumber, null, headers, accessConditions.leaseAccessConditions(), + null, accessConditions.modifiedAccessConditions(), context)) .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } @@ -141,19 +143,16 @@ public Mono> create(long size, Long sequenceNumber, BlobH * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset must - * be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are - * 0-511, 512-1023, etc. - * @param body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled + * @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start + * offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of + * valid byte ranges are 0-511, 512-1023, etc. + * @param body The data to upload. Note that this {@code Flux} must be replayable if retries are enabled * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. * - * @return - * A reactive response containing the information of the uploaded pages. + * @return A reactive response containing the information of the uploaded pages. */ - public Mono> uploadPages(PageRange pageRange, Flux body) { - return this.uploadPages(pageRange, body, null); + public Mono uploadPages(PageRange pageRange, Flux body) { + return uploadPagesWithResponse(pageRange, body, null).flatMap(FluxUtil::toMono); } /** @@ -164,36 +163,37 @@ public Mono> uploadPages(PageRange pageRange, Flux> uploadPages(PageRange pageRange, Flux body, + public Mono> uploadPagesWithResponse(PageRange pageRange, Flux body, PageBlobAccessConditions pageBlobAccessConditions) { + return withContext(context -> uploadPagesWithResponse(pageRange, body, pageBlobAccessConditions, context)); + } + + Mono> uploadPagesWithResponse(PageRange pageRange, Flux body, + PageBlobAccessConditions pageBlobAccessConditions, Context context) { pageBlobAccessConditions = pageBlobAccessConditions == null ? new PageBlobAccessConditions() : pageBlobAccessConditions; if (pageRange == null) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("pageRange cannot be null."); + throw logger.logExceptionAsError(new IllegalArgumentException("pageRange cannot be null.")); } String pageRangeStr = pageRangeToString(pageRange); return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesWithRestResponseAsync(null, - null, body, pageRange.end() - pageRange.start() + 1, null, - null, pageRangeStr, null, null, null, null, - pageBlobAccessConditions.leaseAccessConditions(), pageBlobAccessConditions.sequenceNumberAccessConditions(), - pageBlobAccessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + null, body, pageRange.end() - pageRange.start() + 1, null, null, null, pageRangeStr, null, + pageBlobAccessConditions.leaseAccessConditions(), null, pageBlobAccessConditions.sequenceNumberAccessConditions(), + pageBlobAccessConditions.modifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } /** @@ -203,24 +203,19 @@ public Mono> uploadPages(PageRange pageRange, FluxAzure Docs. *

    * - * @param range - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset + * @param range A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can be * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must * either be public or must be authenticated via a shared access signature. If the source blob is public, no * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob. + * @param sourceOffset The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob. * - * @return - * A reactive response containing the information of the uploaded pages. + * @return A reactive response containing the information of the uploaded pages. */ - public Mono> uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { - return this.uploadPagesFromURL(range, sourceURL, sourceOffset, null, null, - null); + public Mono uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { + return uploadPagesFromURLWithResponse(range, sourceURL, sourceOffset, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -230,35 +225,35 @@ public Mono> uploadPagesFromURL(PageRange range, URL sour * Azure Docs. *

    * - * @param range - * The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries, the start offset + * @param range The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries, the start offset * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can be * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must * either be public or must be authenticated via a shared access signature. If the source blob is public, no * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 + * @param sourceOffset The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link PageBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} + * @param destAccessConditions {@link PageBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} * * @return A reactive response containing the information of the uploaded pages. * @throws IllegalArgumentException If {@code range} is {@code null} */ - public Mono> uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset, + public Mono> uploadPagesFromURLWithResponse(PageRange range, URL sourceURL, Long sourceOffset, byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, SourceModifiedAccessConditions sourceAccessConditions) { + return withContext(context -> uploadPagesFromURLWithResponse(range, sourceURL, sourceOffset, sourceContentMD5, destAccessConditions, sourceAccessConditions, context)); + } + + Mono> uploadPagesFromURLWithResponse(PageRange range, URL sourceURL, Long sourceOffset, + byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions, Context context) { if (range == null) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("range cannot be null."); + throw logger.logExceptionAsError(new IllegalArgumentException("range cannot be null.")); } String rangeString = pageRangeToString(range); @@ -272,11 +267,11 @@ public Mono> uploadPagesFromURL(PageRange range, URL sour destAccessConditions = destAccessConditions == null ? new PageBlobAccessConditions() : destAccessConditions; return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesFromURLWithRestResponseAsync( - null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5, - null, null, destAccessConditions.leaseAccessConditions(), + null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5, null, + null, null, null, destAccessConditions.leaseAccessConditions(), destAccessConditions.sequenceNumberAccessConditions(), destAccessConditions.modifiedAccessConditions(), - sourceAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + sourceAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } /** @@ -284,16 +279,14 @@ public Mono> uploadPagesFromURL(PageRange range, URL sour * For more information, see the * Azure Docs. * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset + * @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges * are 0-511, 512-1023, etc. * - * @return - * A reactive response containing the information of the cleared pages. + * @return A reactive response containing the information of the cleared pages. */ - public Mono> clearPages(PageRange pageRange) { - return this.clearPages(pageRange, null); + public Mono clearPages(PageRange pageRange) { + return clearPagesWithResponse(pageRange, null).flatMap(FluxUtil::toMono); } /** @@ -301,116 +294,115 @@ public Mono> clearPages(PageRange pageRange) { * For more information, see the * Azure Docs. * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset + * @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges * are 0-511, 512-1023, etc. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} + * @param pageBlobAccessConditions {@link PageBlobAccessConditions} * * @return A reactive response containing the information of the cleared pages. * @throws IllegalArgumentException If {@code pageRange} is {@code null} */ - public Mono> clearPages(PageRange pageRange, + public Mono> clearPagesWithResponse(PageRange pageRange, PageBlobAccessConditions pageBlobAccessConditions) { + return withContext(context -> clearPagesWithResponse(pageRange, pageBlobAccessConditions, context)); + } + + Mono> clearPagesWithResponse(PageRange pageRange, + PageBlobAccessConditions pageBlobAccessConditions, Context context) { pageBlobAccessConditions = pageBlobAccessConditions == null ? new PageBlobAccessConditions() : pageBlobAccessConditions; if (pageRange == null) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("pageRange cannot be null."); + throw logger.logExceptionAsError(new IllegalArgumentException("pageRange cannot be null.")); } String pageRangeStr = pageRangeToString(pageRange); return postProcessResponse(this.azureBlobStorage.pageBlobs().clearPagesWithRestResponseAsync(null, null, 0, null, pageRangeStr, null, pageBlobAccessConditions.leaseAccessConditions(), pageBlobAccessConditions.sequenceNumberAccessConditions(), - pageBlobAccessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + pageBlobAccessConditions.modifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } /** * Returns the list of valid page ranges for a page blob or snapshot of a page blob. * For more information, see the Azure Docs. * - * @param blobRange - * {@link BlobRange} + * @param blobRange {@link BlobRange} * - * @return - * A reactive response containing the information of the cleared pages. + * @return A reactive response containing the information of the cleared pages. */ - public Mono> getPageRanges(BlobRange blobRange) { - return this.getPageRanges(blobRange, null); + public Mono getPageRanges(BlobRange blobRange) { + return getPageRangesWithResponse(blobRange, null).flatMap(FluxUtil::toMono); } /** * Returns the list of valid page ranges for a page blob or snapshot of a page blob. * For more information, see the Azure Docs. * - * @param blobRange - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} + * @param blobRange {@link BlobRange} + * @param accessConditions {@link BlobAccessConditions} * - * @return - * A reactive response emitting all the page ranges. + * @return A reactive response emitting all the page ranges. */ - public Mono> getPageRanges(BlobRange blobRange, BlobAccessConditions accessConditions) { + public Mono> getPageRangesWithResponse(BlobRange blobRange, BlobAccessConditions accessConditions) { + return withContext(context -> getPageRangesWithResponse(blobRange, accessConditions, context)); + } + + Mono> getPageRangesWithResponse(BlobRange blobRange, BlobAccessConditions accessConditions, Context context) { blobRange = blobRange == null ? new BlobRange(0) : blobRange; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.pageBlobs().getPageRangesWithRestResponseAsync( - null, null, snapshot, null, null, blobRange.toHeaderValue(), + null, null, snapshot, null, blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - Context.NONE)) - .map(response -> new SimpleResponse<>(response, response.value())); + context)).map(response -> new SimpleResponse<>(response, response.value())); } /** * Gets the collection of page ranges that differ between a specified snapshot and this page blob. * For more information, see the Azure Docs. * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous + * @param blobRange {@link BlobRange} + * @param prevSnapshot Specifies that the response will contain only pages that were changed between target blob and previous * snapshot. Changed pages include both updated and cleared pages. The target * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. * - * @return - * A reactive response emitting all the different page ranges. + * @return A reactive response emitting all the different page ranges. */ - public Mono> getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { - return this.getPageRangesDiff(blobRange, prevSnapshot, null); + public Mono getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { + return getPageRangesDiffWithResponse(blobRange, prevSnapshot, null).flatMap(FluxUtil::toMono); } /** * Gets the collection of page ranges that differ between a specified snapshot and this page blob. * For more information, see the Azure Docs. * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous + * @param blobRange {@link BlobRange} + * @param prevSnapshot Specifies that the response will contain only pages that were changed between target blob and previous * snapshot. Changed pages include both updated and cleared pages. The target * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * @param accessConditions - * {@link BlobAccessConditions} + * @param accessConditions {@link BlobAccessConditions} * * @return A reactive response emitting all the different page ranges. * @throws IllegalArgumentException If {@code prevSnapshot} is {@code null} */ - public Mono> getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions) { + public Mono> getPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions) { + return withContext(context -> getPageRangesDiffWithResponse(blobRange, prevSnapshot, accessConditions, context)); + } + + Mono> getPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions, Context context) { blobRange = blobRange == null ? new BlobRange(0) : blobRange; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; if (prevSnapshot == null) { - throw new IllegalArgumentException("prevSnapshot cannot be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("prevSnapshot cannot be null")); } return postProcessResponse(this.azureBlobStorage.pageBlobs().getPageRangesDiffWithRestResponseAsync( - null, null, snapshot, null, null, prevSnapshot, + null, null, snapshot, null, prevSnapshot, blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) + accessConditions.modifiedAccessConditions(), context)) .map(response -> new SimpleResponse<>(response, response.value())); } @@ -418,82 +410,78 @@ public Mono> getPageRangesDiff(BlobRange blobRange, String pr * Resizes the page blob to the specified size (which must be a multiple of 512). * For more information, see the Azure Docs. * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the + * @param size Resizes a page blob to the specified size. If the specified value is less than the current size of the * blob, then all pages above the specified value are cleared. * - * @return - * A reactive response emitting the resized page blob. + * @return A reactive response emitting the resized page blob. */ - public Mono> resize(long size) { - return this.resize(size, null); + public Mono resize(long size) { + return resizeWithResponse(size, null).flatMap(FluxUtil::toMono); } /** * Resizes the page blob to the specified size (which must be a multiple of 512). * For more information, see the Azure Docs. * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the + * @param size Resizes a page blob to the specified size. If the specified value is less than the current size of the * blob, then all pages above the specified value are cleared. - * @param accessConditions - * {@link BlobAccessConditions} + * @param accessConditions {@link BlobAccessConditions} * * @return A reactive response emitting the resized page blob. * @throws IllegalArgumentException If {@code size} isn't a multiple of {@link PageBlobAsyncClient#PAGE_BYTES} */ - public Mono> resize(long size, BlobAccessConditions accessConditions) { + public Mono> resizeWithResponse(long size, BlobAccessConditions accessConditions) { + return withContext(context -> resizeWithResponse(size, accessConditions, context)); + } + + Mono> resizeWithResponse(long size, BlobAccessConditions accessConditions, Context context) { if (size % PAGE_BYTES != 0) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("size must be a multiple of PageBlobAsyncClient.PAGE_BYTES."); + throw logger.logExceptionAsError(new IllegalArgumentException("size must be a multiple of PageBlobAsyncClient.PAGE_BYTES.")); } accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.pageBlobs().resizeWithRestResponseAsync(null, null, size, null, null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + accessConditions.modifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } - /** * Sets the page blob's sequence number. * For more information, see the Azure Docs. * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track + * @param action Indicates how the service should modify the blob's sequence number. + * @param sequenceNumber The blob's sequence number. The sequence number is a user-controlled property that you can use to track * requests and manage concurrency issues. * - * @return - * A reactive response emitting the updated page blob. + * @return A reactive response emitting the updated page blob. */ - public Mono> updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber) { - return this.updateSequenceNumber(action, sequenceNumber, null); + public Mono updateSequenceNumber(SequenceNumberActionType action, Long sequenceNumber) { + return updateSequenceNumberWithResponse(action, sequenceNumber, null).flatMap(FluxUtil::toMono); } /** * Sets the page blob's sequence number. * For more information, see the Azure Docs. * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track + * @param action Indicates how the service should modify the blob's sequence number. + * @param sequenceNumber The blob's sequence number. The sequence number is a user-controlled property that you can use to track * requests and manage concurrency issues. - * @param accessConditions - * {@link BlobAccessConditions} + * @param accessConditions {@link BlobAccessConditions} * * @return A reactive response emitting the updated page blob. * @throws IllegalArgumentException If {@code sequenceNumber} isn't null and is less than 0 */ - public Mono> updateSequenceNumber(SequenceNumberActionType action, Long sequenceNumber, BlobAccessConditions accessConditions) { + public Mono> updateSequenceNumberWithResponse(SequenceNumberActionType action, Long sequenceNumber, BlobAccessConditions accessConditions) { + return withContext(context -> updateSequenceNumberWithResponse(action, sequenceNumber, accessConditions, context)); + } + + Mono> updateSequenceNumberWithResponse(SequenceNumberActionType action, Long sequenceNumber, BlobAccessConditions accessConditions, Context context) { if (sequenceNumber != null && sequenceNumber < 0) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("SequenceNumber must be greater than or equal to 0."); + throw logger.logExceptionAsError(new IllegalArgumentException("SequenceNumber must be greater than or equal to 0.")); } accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; sequenceNumber = action == SequenceNumberActionType.INCREMENT ? null : sequenceNumber; @@ -501,8 +489,8 @@ public Mono> updateSequenceNumber(SequenceNumberActionTyp return postProcessResponse( this.azureBlobStorage.pageBlobs().updateSequenceNumberWithRestResponseAsync(null, null, action, null, sequenceNumber, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); } /** @@ -513,16 +501,13 @@ public Mono> updateSequenceNumber(SequenceNumberActionTyp * the Azure Docs here and * here. * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. + * @param source The source page blob. + * @param snapshot The snapshot on the copy source. * - * @return - * A reactive response emitting the copy status. + * @return A reactive response emitting the copy status. */ - public Mono> copyIncremental(URL source, String snapshot) { - return this.copyIncremental(source, snapshot, null); + public Mono copyIncremental(URL source, String snapshot) { + return copyIncrementalWithResponse(source, snapshot, null).flatMap(FluxUtil::toMono); } /** @@ -533,19 +518,20 @@ public Mono> copyIncremental(URL source, String snapsho * the Azure Docs here and * here. * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used + * @param source The source page blob. + * @param snapshot The snapshot on the copy source. + * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used * to construct conditions related to when the blob was changed relative to the given request. The request * will fail if the specified condition is not satisfied. * * @return A reactive response emitting the copy status. * @throws Error If {@code source} and {@code snapshot} form a malformed URL. */ - public Mono> copyIncremental(URL source, String snapshot, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> copyIncrementalWithResponse(URL source, String snapshot, ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> copyIncrementalWithResponse(source, snapshot, modifiedAccessConditions, context)); + } + + Mono> copyIncrementalWithResponse(URL source, String snapshot, ModifiedAccessConditions modifiedAccessConditions, Context context) { UrlBuilder builder = UrlBuilder.parse(source); builder.setQueryParameter(Constants.SNAPSHOT_QUERY_PARAMETER, snapshot); try { @@ -555,8 +541,8 @@ public Mono> copyIncremental(URL source, String snapsho throw new Error(e); } return postProcessResponse(this.azureBlobStorage.pageBlobs().copyIncrementalWithRestResponseAsync( - null, null, source, null, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyStatus())); + null, null, source, null, null, modifiedAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyStatus())); } private static String pageRangeToString(PageRange pageRange) { diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobClient.java index 9e683c7a8b8d..ede7126b082a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobClient.java @@ -4,6 +4,7 @@ package com.azure.storage.blob; import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlobRange; @@ -16,15 +17,15 @@ import com.azure.storage.blob.models.PageRange; import com.azure.storage.blob.models.SequenceNumberActionType; import com.azure.storage.blob.models.SourceModifiedAccessConditions; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.common.Utility; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import java.io.InputStream; import java.net.URL; +import java.nio.ByteBuffer; import java.time.Duration; /** @@ -68,14 +69,12 @@ public final class PageBlobClient extends BlobClient { * Creates and opens an output stream to write data to the page blob. If the blob already exists on the service, * it will be overwritten. * - * @param length - * A long which represents the length, in bytes, of the stream to create. This value must be + * @param length A long which represents the length, in bytes, of the stream to create. This value must be * a multiple of 512. * * @return A {@link BlobOutputStream} object used to write data to the blob. * - * @throws StorageException - * If a storage service error occurred. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream(long length) { return getBlobOutputStream(length, null); @@ -85,19 +84,16 @@ public BlobOutputStream getBlobOutputStream(long length) { * Creates and opens an output stream to write data to the page blob. If the blob already exists on the service, * it will be overwritten. * - * @param length - * A long which represents the length, in bytes, of the stream to create. This value must be + * @param length A long which represents the length, in bytes, of the stream to create. This value must be * a multiple of 512. - * @param accessConditions - * A {@link BlobAccessConditions} object that represents the access conditions for the blob. + * @param accessConditions A {@link BlobAccessConditions} object that represents the access conditions for the blob. * * @return A {@link BlobOutputStream} object used to write data to the blob. * - * @throws StorageException - * If a storage service error occurred. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream(long length, BlobAccessConditions accessConditions) { - return new BlobOutputStream(pageBlobAsyncClient, length, accessConditions); + return BlobOutputStream.pageBlobOutputStream(pageBlobAsyncClient, length, accessConditions); } /** @@ -105,43 +101,36 @@ public BlobOutputStream getBlobOutputStream(long length, BlobAccessConditions ac * For more information, see the * Azure Docs. * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a + * @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a * 512-byte boundary. * - * @return - * The information of the created page blob. + * @return The information of the created page blob. */ - public Response create(long size) { - return this.create(size, null, null, null, null, null); + public PageBlobItem create(long size) { + return createWithResponse(size, null, null, null, null, null, Context.NONE).value(); } + /** * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. * For more information, see the * Azure Docs. * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a + * @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a * 512-byte boundary. - * @param sequenceNumber - * A user-controlled value that you can use to track requests. The value of the sequence number must be + * @param sequenceNumber A user-controlled value that you can use to track requests. The value of the sequence number must be * between 0 and 2^63 - 1.The default value is 0. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the created page blob. + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return The information of the created page blob. */ - public Response create(long size, Long sequenceNumber, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = pageBlobAsyncClient.create(size, sequenceNumber, headers, metadata, accessConditions); + public Response createWithResponse(long size, Long sequenceNumber, BlobHTTPHeaders headers, + Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { + Mono> response = pageBlobAsyncClient.createWithResponse(size, sequenceNumber, headers, metadata, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -153,18 +142,15 @@ public Response create(long size, Long sequenceNumber, BlobHTTPHea * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset must + * @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset must * be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are * 0-511, 512-1023, etc. - * @param body - * The data to upload. + * @param body The data to upload. * - * @return - * The information of the uploaded pages. + * @return The information of the uploaded pages. */ - public Response uploadPages(PageRange pageRange, InputStream body) { - return this.uploadPages(pageRange, body, null, null); + public PageBlobItem uploadPages(PageRange pageRange, InputStream body) { + return uploadPagesWithResponse(pageRange, body, null, null, Context.NONE).value(); } /** @@ -175,24 +161,20 @@ public Response uploadPages(PageRange pageRange, InputStream body) * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset + * @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges * are 0-511, 512-1023, etc. - * @param body - * The data to upload. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the uploaded pages. + * @param body The data to upload. + * @param pageBlobAccessConditions {@link PageBlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return The information of the uploaded pages. */ - public Response uploadPages(PageRange pageRange, InputStream body, - PageBlobAccessConditions pageBlobAccessConditions, Duration timeout) { + public Response uploadPagesWithResponse(PageRange pageRange, InputStream body, + PageBlobAccessConditions pageBlobAccessConditions, Duration timeout, Context context) { long length = pageRange.end() - pageRange.start(); - Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) PAGE_BYTES)) + Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) PAGE_BYTES)) .map(i -> i * PAGE_BYTES) .concatMap(pos -> Mono.fromCallable(() -> { byte[] cache = new byte[PAGE_BYTES]; @@ -201,12 +183,12 @@ public Response uploadPages(PageRange pageRange, InputStream body, read += body.read(cache, read, PAGE_BYTES - read); } - return ByteBufAllocator.DEFAULT.buffer(read).writeBytes(cache); + return ByteBuffer.wrap(cache); })); - Mono> response = pageBlobAsyncClient.uploadPages(pageRange, + Mono> response = pageBlobAsyncClient.uploadPagesWithResponse(pageRange, fbb.subscribeOn(Schedulers.elastic()), - pageBlobAccessConditions); + pageBlobAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -217,24 +199,19 @@ public Response uploadPages(PageRange pageRange, InputStream body, * Azure Docs. *

    * - * @param range - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset + * @param range A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can be * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must * either be public or must be authenticated via a shared access signature. If the source blob is public, no * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob. + * @param sourceOffset The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob. * - * @return - * The information of the uploaded pages. + * @return The information of the uploaded pages. */ - public Response uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { - return this.uploadPagesFromURL(range, sourceURL, sourceOffset, null, null, - null, null); + public PageBlobItem uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { + return uploadPagesFromURLWithResponse(range, sourceURL, sourceOffset, null, null, null, null, Context.NONE).value(); } /** @@ -244,35 +221,28 @@ public Response uploadPagesFromURL(PageRange range, URL sourceURL, * Azure Docs. *

    * - * @param range - * The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries, the start offset + * @param range The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries, the start offset * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can be * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must * either be public or must be authenticated via a shared access signature. If the source blob is public, no * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 + * @param sourceOffset The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link PageBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the uploaded pages. + * @param destAccessConditions {@link PageBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. + * + * @return The information of the uploaded pages. */ - public Response uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset, + public Response uploadPagesFromURLWithResponse(PageRange range, URL sourceURL, Long sourceOffset, byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Duration timeout) { + SourceModifiedAccessConditions sourceAccessConditions, Duration timeout, Context context) { - Mono> response = pageBlobAsyncClient.uploadPagesFromURL(range, sourceURL, sourceOffset, sourceContentMD5, destAccessConditions, sourceAccessConditions); + Mono> response = pageBlobAsyncClient.uploadPagesFromURLWithResponse(range, sourceURL, sourceOffset, sourceContentMD5, destAccessConditions, sourceAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -281,16 +251,14 @@ public Response uploadPagesFromURL(PageRange range, URL sourceURL, * For more information, see the * Azure Docs. * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset + * @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges * are 0-511, 512-1023, etc. * - * @return - * The information of the cleared pages. + * @return The information of the cleared pages. */ - public Response clearPages(PageRange pageRange) { - return this.clearPages(pageRange, null, null); + public PageBlobItem clearPages(PageRange pageRange) { + return clearPagesWithResponse(pageRange, null, null, Context.NONE).value(); } /** @@ -298,21 +266,18 @@ public Response clearPages(PageRange pageRange) { * For more information, see the * Azure Docs. * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset + * @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges * are 0-511, 512-1023, etc. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param pageBlobAccessConditions {@link PageBlobAccessConditions} + * @param context Additional context that is passed through the Http pipeline during the service call. * - * @return - * The information of the cleared pages. + * @return The information of the cleared pages. */ - public Response clearPages(PageRange pageRange, - PageBlobAccessConditions pageBlobAccessConditions, Duration timeout) { - Mono> response = pageBlobAsyncClient.clearPages(pageRange, pageBlobAccessConditions); + public Response clearPagesWithResponse(PageRange pageRange, + PageBlobAccessConditions pageBlobAccessConditions, Duration timeout, Context context) { + Mono> response = pageBlobAsyncClient.clearPagesWithResponse(pageRange, pageBlobAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -321,106 +286,89 @@ public Response clearPages(PageRange pageRange, * Returns the list of valid page ranges for a page blob or snapshot of a page blob. * For more information, see the Azure Docs. * - * @param blobRange - * {@link BlobRange} + * @param blobRange {@link BlobRange} * - * @return - * The information of the cleared pages. + * @return The information of the cleared pages. */ - public Response getPageRanges(BlobRange blobRange) { - return this.getPageRanges(blobRange, null, null); + public PageList getPageRanges(BlobRange blobRange) { + return getPageRangesWithResponse(blobRange, null, null, Context.NONE).value(); } /** * Returns the list of valid page ranges for a page blob or snapshot of a page blob. * For more information, see the Azure Docs. * - * @param blobRange - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param blobRange {@link BlobRange} + * @param accessConditions {@link BlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * - * @return - * All the page ranges. + * @return All the page ranges. */ - public Response getPageRanges(BlobRange blobRange, BlobAccessConditions accessConditions, Duration timeout) { - return Utility.blockWithOptionalTimeout(pageBlobAsyncClient.getPageRanges(blobRange, accessConditions), timeout); + public Response getPageRangesWithResponse(BlobRange blobRange, BlobAccessConditions accessConditions, Duration timeout, Context context) { + return Utility.blockWithOptionalTimeout(pageBlobAsyncClient.getPageRangesWithResponse(blobRange, accessConditions, context), timeout); } /** * Gets the collection of page ranges that differ between a specified snapshot and this page blob. * For more information, see the Azure Docs. * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous + * @param blobRange {@link BlobRange} + * @param prevSnapshot Specifies that the response will contain only pages that were changed between target blob and previous * snapshot. Changed pages include both updated and cleared pages. The target * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. * - * @return - * All the different page ranges. + * @return All the different page ranges. */ - public Response getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { - return this.getPageRangesDiff(blobRange, prevSnapshot, null, null); + public PageList getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { + return getPageRangesDiffWithResponse(blobRange, prevSnapshot, null, null, Context.NONE).value(); } /** * Gets the collection of page ranges that differ between a specified snapshot and this page blob. * For more information, see the Azure Docs. * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous + * @param blobRange {@link BlobRange} + * @param prevSnapshot Specifies that the response will contain only pages that were changed between target blob and previous * snapshot. Changed pages include both updated and cleared pages. The target * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param accessConditions {@link BlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * - * @return - * All the different page ranges. + * @return All the different page ranges. */ - public Response getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions, Duration timeout) { - return Utility.blockWithOptionalTimeout(pageBlobAsyncClient.getPageRangesDiff(blobRange, prevSnapshot, accessConditions), timeout); + public Response getPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions, Duration timeout, Context context) { + return Utility.blockWithOptionalTimeout(pageBlobAsyncClient.getPageRangesDiffWithResponse(blobRange, prevSnapshot, accessConditions, context), timeout); } /** * Resizes the page blob to the specified size (which must be a multiple of 512). * For more information, see the Azure Docs. * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the + * @param size Resizes a page blob to the specified size. If the specified value is less than the current size of the * blob, then all pages above the specified value are cleared. * - * @return - * The resized page blob. + * @return The resized page blob. */ - public Response resize(long size) { - return this.resize(size, null, null); + public PageBlobItem resize(long size) { + return resizeWithResponse(size, null, null, Context.NONE).value(); } /** * Resizes the page blob to the specified size (which must be a multiple of 512). * For more information, see the Azure Docs. * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the + * @param size Resizes a page blob to the specified size. If the specified value is less than the current size of the * blob, then all pages above the specified value are cleared. - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param accessConditions {@link BlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * - * @return - * The resized page blob. + * @return The resized page blob. */ - public Response resize(long size, BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = pageBlobAsyncClient.resize(size, accessConditions); + public Response resizeWithResponse(long size, BlobAccessConditions accessConditions, Duration timeout, Context context) { + Mono> response = pageBlobAsyncClient.resizeWithResponse(size, accessConditions); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -428,40 +376,33 @@ public Response resize(long size, BlobAccessConditions accessCondi * Sets the page blob's sequence number. * For more information, see the Azure Docs. * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track + * @param action Indicates how the service should modify the blob's sequence number. + * @param sequenceNumber The blob's sequence number. The sequence number is a user-controlled property that you can use to track * requests and manage concurrency issues. * - * @return - * The updated page blob. + * @return The updated page blob. */ - public Response updateSequenceNumber(SequenceNumberActionType action, + public PageBlobItem updateSequenceNumber(SequenceNumberActionType action, Long sequenceNumber) { - return this.updateSequenceNumber(action, sequenceNumber, null, null); + return updateSequenceNumberWithResponse(action, sequenceNumber, null, null, Context.NONE).value(); } /** * Sets the page blob's sequence number. * For more information, see the Azure Docs. * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track + * @param action Indicates how the service should modify the blob's sequence number. + * @param sequenceNumber The blob's sequence number. The sequence number is a user-controlled property that you can use to track * requests and manage concurrency issues. - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param accessConditions {@link BlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * - * @return - * The updated page blob. + * @return The updated page blob. */ - public Response updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber, BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = pageBlobAsyncClient.updateSequenceNumber(action, sequenceNumber, accessConditions); + public Response updateSequenceNumberWithResponse(SequenceNumberActionType action, + Long sequenceNumber, BlobAccessConditions accessConditions, Duration timeout, Context context) { + Mono> response = pageBlobAsyncClient.updateSequenceNumberWithResponse(action, sequenceNumber, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -473,16 +414,13 @@ public Response updateSequenceNumber(SequenceNumberActionType acti * the Azure Docs here and * here. * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. + * @param source The source page blob. + * @param snapshot The snapshot on the copy source. * - * @return - * The copy status. + * @return The copy status. */ - public Response copyIncremental(URL source, String snapshot) { - return this.copyIncremental(source, snapshot, null, null); + public CopyStatusType copyIncremental(URL source, String snapshot) { + return copyIncrementalWithResponse(source, snapshot, null, null, Context.NONE).value(); } /** @@ -493,23 +431,19 @@ public Response copyIncremental(URL source, String snapshot) { * the Azure Docs here and * here. * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used + * @param source The source page blob. + * @param snapshot The snapshot on the copy source. + * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used * to construct conditions related to when the blob was changed relative to the given request. The request * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param context Additional context that is passed through the Http pipeline during the service call. * - * @return - * The copy status. + * @return The copy status. */ - public Response copyIncremental(URL source, String snapshot, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono> response = pageBlobAsyncClient.copyIncremental(source, snapshot, modifiedAccessConditions); + public Response copyIncrementalWithResponse(URL source, String snapshot, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { + Mono> response = pageBlobAsyncClient.copyIncrementalWithResponse(source, snapshot, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PostProcessor.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PostProcessor.java index 28e6e541cd79..632ebb90fdaa 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PostProcessor.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PostProcessor.java @@ -4,6 +4,7 @@ package com.azure.storage.blob; import com.azure.storage.blob.models.StorageErrorException; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.common.Utility; import reactor.core.publisher.Mono; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ProgressReporter.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ProgressReporter.java index 4ac0ce9cda2f..c4c5e9760228 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ProgressReporter.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ProgressReporter.java @@ -86,7 +86,7 @@ private static class ParallelProgressReporter extends ProgressReporterImpl { We need an AtomicLong to be able to update the value referenced. Because we are already synchronizing with the lock, we don't incur any additional performance hit here by the synchronization. */ - private AtomicLong totalProgress; + private final AtomicLong totalProgress; ParallelProgressReporter(IProgressReceiver progressReceiver, Lock lock, AtomicLong totalProgress) { super(progressReceiver); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASQueryParameters.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASQueryParameters.java index 139fd8179f93..46573fec9996 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASQueryParameters.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASQueryParameters.java @@ -128,8 +128,7 @@ private T getQueryParameter(Map parameters, String name, B * @param protocol A {@code String} representing the allowed HTTP protocol(s) or {@code null}. * @param startTime A {@code java.util.Date} representing the start time for this SAS token or {@code null}. * @param expiryTime A {@code java.util.Date} representing the expiry time for this SAS token. - * @param ipRange A {@link IPRange} representing the range of valid IP addresses for this SAS token or {@code - * null}. + * @param ipRange A {@link IPRange} representing the range of valid IP addresses for this SAS token or {@code null}. * @param identifier A {@code String} representing the signed identifier (only for Service SAS) or {@code null}. * @param resource A {@code String} representing the storage container or blob (only for Service SAS). * @param permissions A {@code String} representing the storage permissions or {@code null}. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java index a62f85d78643..92dfe6c16203 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java @@ -3,6 +3,7 @@ package com.azure.storage.blob; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Constants; import com.azure.storage.common.IPRange; @@ -32,6 +33,7 @@ * for additional samples.

    */ final class ServiceSASSignatureValues { + private final ClientLogger logger = new ClientLogger(ServiceSASSignatureValues.class); private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; @@ -270,7 +272,7 @@ public ServiceSASSignatureValues canonicalName(String urlString, String accountN try { url = new URL(urlString); } catch (MalformedURLException e) { - throw new RuntimeException(e); + throw logger.logExceptionAsError(new RuntimeException(e)); } this.canonicalName = String.format("/blob/%s%s", accountName, url.getPath()); @@ -467,7 +469,7 @@ private void assertGenerateOK(boolean usingUserDelegation) { } if (Constants.UrlConstants.SAS_CONTAINER_CONSTANT.equals(this.resource) && this.snapshotId != null) { - throw new IllegalArgumentException("Cannot set a snapshotId without resource being a blob."); + throw logger.logExceptionAsError(new IllegalArgumentException("Cannot set a snapshotId without resource being a blob.")); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/StorageException.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/StorageException.java deleted file mode 100644 index cff087ff1b52..000000000000 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/StorageException.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.exception.HttpResponseException; -import com.azure.storage.blob.models.StorageErrorCode; -import com.azure.storage.blob.models.StorageErrorException; -import com.azure.storage.common.Constants; - -/** - * A {@code StorageException} 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 StorageException}. 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 StorageException extends HttpResponseException { - - private final String message; - - StorageException(StorageErrorException e, String responseBody) { - super(e.getMessage(), e.response(), e); - this.message = responseBody; - } - - /** - * @return The error code returned by the service. - */ - public StorageErrorCode errorCode() { - return StorageErrorCode.fromString(super.response().headers().value(Constants.HeaderConstants.ERROR_CODE)); - } - - /** - * @return The message returned by the service. - */ - public String message() { - return this.message; - } - - /** - * @return The status code on the response. - */ - public int statusCode() { - return super.response().statusCode(); - } -} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/URLParser.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/URLParser.java index 4ec53cd475c4..8d485163051a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/URLParser.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/URLParser.java @@ -22,8 +22,7 @@ final class URLParser { * Any other query parameters remain in the UnparsedParams field. This method overwrites all fields in the * BlobURLParts object. * - * @param url - * The {@code URL} to be parsed. + * @param url The {@code URL} to be parsed. * * @return A {@link BlobURLParts} object containing all the components of a BlobURL. */ @@ -77,8 +76,7 @@ public static BlobURLParts parse(URL url) { /** * Parses a query string into a one to many hashmap. * - * @param queryParams - * The string of query params to parse. + * @param queryParams The string of query params to parse. * * @return A {@code HashMap} of the key values. */ diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java index 3439bb917017..ad2c5b432efc 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java @@ -25,13 +25,14 @@ import com.azure.storage.blob.models.AppendBlobsCreateResponse; import com.azure.storage.blob.models.AppendPositionAccessConditions; import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageErrorException; -import io.netty.buffer.ByteBuf; import java.net.URL; +import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.Map; import reactor.core.publisher.Flux; @@ -72,17 +73,17 @@ private interface AppendBlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono appendBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono appendBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono appendBlockFromUrl(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); + Mono appendBlockFromUrl(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); } /** @@ -99,9 +100,6 @@ private interface AppendBlobsService { public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String blobType = "AppendBlob"; final String blobContentType = null; @@ -110,12 +108,15 @@ public Mono createWithRestResponseAsync(String contai final String blobCacheControl = null; final String blobContentDisposition = null; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -126,19 +127,17 @@ public Mono createWithRestResponseAsync(String contai * @param contentLength The length of the request. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param blobHTTPHeaders Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, Map metadata, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String blobType = "AppendBlob"; String blobContentType = null; if (blobHTTPHeaders != null) { @@ -168,6 +167,18 @@ public Mono createWithRestResponseAsync(String contai if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -187,7 +198,7 @@ public Mono createWithRestResponseAsync(String contai String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -202,22 +213,23 @@ public Mono createWithRestResponseAsync(String contai * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { + public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { final Integer timeout = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "appendblock"; final String leaseId = null; final Long maxSize = null; final Long appendPosition = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; String transactionalContentMD5Converted = null; + String transactionalContentCrc64Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -229,19 +241,18 @@ public Mono appendBlockWithRestResponseAsync(Str * @param contentLength The length of the request. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. * @param appendPositionAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, byte[] transactionalContentMD5, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "appendblock"; String leaseId = null; if (leaseAccessConditions != null) { @@ -255,6 +266,18 @@ public Mono appendBlockWithRestResponseAsync(Str if (appendPositionAccessConditions != null) { appendPosition = appendPositionAccessConditions.appendPosition(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -272,9 +295,10 @@ public Mono appendBlockWithRestResponseAsync(Str ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); } String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -294,6 +318,9 @@ public Mono appendBlockFromUrlWithRestRes final Integer timeout = null; final String requestId = null; final String comp = "appendblock"; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String leaseId = null; final Long maxSize = null; final Long appendPosition = null; @@ -302,11 +329,13 @@ public Mono appendBlockFromUrlWithRestRes final String sourceIfMatch = null; final String sourceIfNoneMatch = null; String sourceContentMD5Converted = null; + String sourceContentcrc64Converted = null; + String transactionalContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, contentLength, transactionalContentMD5Converted, this.client.getVersion(), requestId, comp, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -318,8 +347,11 @@ public Mono appendBlockFromUrlWithRestRes * @param contentLength The length of the request. * @param sourceRange Bytes of source data in the specified range. * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy source. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param cpkInfo Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. * @param appendPositionAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. @@ -329,8 +361,20 @@ public Mono appendBlockFromUrlWithRestRes * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono appendBlockFromUrlWithRestResponseAsync(String containerName, String blob, URL sourceUrl, long contentLength, String sourceRange, byte[] sourceContentMD5, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + public Mono appendBlockFromUrlWithRestResponseAsync(String containerName, String blob, URL sourceUrl, long contentLength, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, byte[] transactionalContentMD5, String requestId, CpkInfo cpkInfo, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { final String comp = "appendblock"; + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); @@ -376,10 +420,12 @@ public Mono appendBlockFromUrlWithRestRes sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); } String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, contentLength, transactionalContentMD5Converted, this.client.getVersion(), requestId, comp, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java index fa28f6e26d0e..43cefc32c81b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.implementation.RestProxy; import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.storage.blob.models.PathRenameMode; /** * A builder for creating a new instance of the AzureBlobStorage type. @@ -45,6 +46,22 @@ public AzureBlobStorageBuilder version(String version) { return this; } + /* + * Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix' + */ + private PathRenameMode pathRenameMode; + + /** + * Sets Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'. + * + * @param pathRenameMode the pathRenameMode value. + * @return the AzureBlobStorageBuilder. + */ + public AzureBlobStorageBuilder pathRenameMode(PathRenameMode pathRenameMode) { + this.pathRenameMode = pathRenameMode; + return this; + } + /* * The HTTP pipeline to send requests through */ @@ -77,7 +94,10 @@ public AzureBlobStorageImpl build() { if (this.version != null) { client.setVersion(this.version); } else { - client.setVersion("2018-11-09"); + client.setVersion("2019-02-02"); + } + if (this.pathRenameMode != null) { + client.setPathRenameMode(this.pathRenameMode); } return client; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java index 5fc9bc8ae273..6f17d64bb019 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java @@ -6,6 +6,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.implementation.RestProxy; +import com.azure.storage.blob.models.PathRenameMode; /** * Initializes a new instance of the AzureBlobStorage type. @@ -57,6 +58,29 @@ void setVersion(String version) { this.version = version; } + /** + * Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'. + */ + private PathRenameMode pathRenameMode; + + /** + * Gets Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'. + * + * @return the pathRenameMode value. + */ + public PathRenameMode getPathRenameMode() { + return this.pathRenameMode; + } + + /** + * Sets Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'. + * + * @param pathRenameMode the pathRenameMode value. + */ + void setPathRenameMode(PathRenameMode pathRenameMode) { + this.pathRenameMode = pathRenameMode; + } + /** * The HTTP pipeline to send requests through. */ @@ -99,6 +123,20 @@ public ContainersImpl containers() { return this.containers; } + /** + * The DirectorysImpl object to access its operations. + */ + private DirectorysImpl directorys; + + /** + * Gets the DirectorysImpl object to access its operations. + * + * @return the DirectorysImpl object. + */ + public DirectorysImpl directorys() { + return this.directorys; + } + /** * The BlobsImpl object to access its operations. */ @@ -171,6 +209,7 @@ public AzureBlobStorageImpl(HttpPipeline httpPipeline) { this.httpPipeline = httpPipeline; this.services = new ServicesImpl(this); this.containers = new ContainersImpl(this); + this.directorys = new DirectorysImpl(this); this.blobs = new BlobsImpl(this); this.pageBlobs = new PageBlobsImpl(this); this.appendBlobs = new AppendBlobsImpl(this); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java index eba1efa297e4..2da23bc9dff7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java @@ -13,6 +13,7 @@ import com.azure.core.implementation.annotation.HeaderParam; import com.azure.core.implementation.annotation.Host; import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.Patch; import com.azure.core.implementation.annotation.PathParam; import com.azure.core.implementation.annotation.Put; import com.azure.core.implementation.annotation.QueryParam; @@ -22,7 +23,8 @@ import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; import com.azure.core.implementation.util.Base64Util; import com.azure.core.util.Context; -import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.AccessTierOptional; +import com.azure.storage.blob.models.AccessTierRequired; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlobsAbortCopyFromURLResponse; import com.azure.storage.blob.models.BlobsAcquireLeaseResponse; @@ -32,19 +34,27 @@ import com.azure.storage.blob.models.BlobsCreateSnapshotResponse; import com.azure.storage.blob.models.BlobsDeleteResponse; import com.azure.storage.blob.models.BlobsDownloadResponse; +import com.azure.storage.blob.models.BlobsGetAccessControlResponse; import com.azure.storage.blob.models.BlobsGetAccountInfoResponse; import com.azure.storage.blob.models.BlobsGetPropertiesResponse; import com.azure.storage.blob.models.BlobsReleaseLeaseResponse; +import com.azure.storage.blob.models.BlobsRenameResponse; import com.azure.storage.blob.models.BlobsRenewLeaseResponse; +import com.azure.storage.blob.models.BlobsSetAccessControlResponse; import com.azure.storage.blob.models.BlobsSetHTTPHeadersResponse; import com.azure.storage.blob.models.BlobsSetMetadataResponse; import com.azure.storage.blob.models.BlobsSetTierResponse; import com.azure.storage.blob.models.BlobsStartCopyFromURLResponse; import com.azure.storage.blob.models.BlobsUndeleteResponse; +import com.azure.storage.blob.models.CpkInfo; +import com.azure.storage.blob.models.DataLakeStorageErrorException; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; +import com.azure.storage.blob.models.DirectoryHttpHeaders; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.PathRenameMode; +import com.azure.storage.blob.models.RehydratePriority; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageErrorException; import java.net.URL; @@ -87,17 +97,32 @@ private interface BlobsService { @Get("{containerName}/{blob}") @ExpectedResponses({200, 206}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono download(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono download(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, @HeaderParam("x-ms-range-get-content-crc64") Boolean rangeGetContentCRC64, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Head("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getProperties(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono getProperties(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Delete("{containerName}/{blob}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono delete(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + + @Patch("{filesystem}/{path}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono setAccessControl(@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 posixPermissions, @HeaderParam("x-ms-acl") String posixAcl, @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(DataLakeStorageErrorException.class) + Mono getAccessControl(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("upn") Boolean upn, @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); + + @Put("{filesystem}/{path}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono rename(@PathParam("filesystem") String filesystem, @PathParam("path") String path, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("mode") PathRenameMode pathRenameMode, @HeaderParam("x-ms-rename-source") String renameSource, @HeaderParam("x-ms-properties") String directoryProperties, @HeaderParam("x-ms-permissions") String posixPermissions, @HeaderParam("x-ms-umask") String posixUmask, @HeaderParam("x-ms-source-lease-id") String sourceLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-cache-control") String cacheControl, @HeaderParam("x-ms-content-type") String contentType, @HeaderParam("x-ms-content-encoding") String contentEncoding, @HeaderParam("x-ms-content-language") String contentLanguage, @HeaderParam("x-ms-content-disposition") String contentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({200}) @@ -112,7 +137,7 @@ private interface BlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setMetadata(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono setMetadata(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({201}) @@ -142,17 +167,17 @@ private interface BlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono createSnapshot(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono createSnapshot(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono startCopyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono startCopyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTierOptional tier, @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono copyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono copyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTierOptional tier, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({204}) @@ -162,7 +187,7 @@ private interface BlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setTier(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-access-tier") AccessTier tier, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono setTier(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-access-tier") AccessTierRequired tier, @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context); @Get("{containerName}/{blob}") @ExpectedResponses({200}) @@ -171,7 +196,7 @@ private interface BlobsService { } /** - * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or verison. + * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or version. * * @param containerName The container name. * @param blob The blob name. @@ -182,48 +207,58 @@ private interface BlobsService { @ServiceMethod(returns = ReturnType.SINGLE) public Mono downloadWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; final String range = null; final Boolean rangeGetContentMD5 = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; + final Boolean rangeGetContentCRC64 = null; final String requestId = null; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.download(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.download(containerName, blob, this.client.getUrl(), snapshot, timeout, range, rangeGetContentMD5, rangeGetContentCRC64, this.client.getVersion(), requestId, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** - * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or verison. + * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or version. * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param range Return only the bytes of the blob in the specified range. * @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. + * @param rangeGetContentCRC64 When set to true and specified together with the Range, the service returns the CRC64 hash for the range, as long as the range is less than or equal to 4 MB in size. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono downloadWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String range, Boolean rangeGetContentMD5, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono downloadWithRestResponseAsync(String containerName, String blob, String snapshot, Integer timeout, String range, Boolean rangeGetContentMD5, Boolean rangeGetContentCRC64, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -242,7 +277,7 @@ public Mono downloadWithRestResponseAsync(String containe } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.download(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.download(containerName, blob, this.client.getUrl(), snapshot, timeout, range, rangeGetContentMD5, rangeGetContentCRC64, this.client.getVersion(), requestId, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -257,18 +292,17 @@ public Mono downloadWithRestResponseAsync(String containe @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, timeout, this.client.getVersion(), requestId, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -277,24 +311,33 @@ public Mono getPropertiesWithRestResponseAsync(Strin * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPropertiesWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono getPropertiesWithRestResponseAsync(String containerName, String blob, String snapshot, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -313,7 +356,7 @@ public Mono getPropertiesWithRestResponseAsync(Strin } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, timeout, this.client.getVersion(), requestId, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -328,7 +371,6 @@ public Mono getPropertiesWithRestResponseAsync(Strin @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; final DeleteSnapshotsOptionType deleteSnapshots = null; final String requestId = null; @@ -337,7 +379,7 @@ public Mono deleteWithRestResponseAsync(String containerNam final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.delete(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.delete(containerName, blob, this.client.getUrl(), snapshot, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -346,7 +388,6 @@ public Mono deleteWithRestResponseAsync(String containerNam * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param deleteSnapshots Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself. Possible values include: 'include', 'only'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -357,7 +398,7 @@ public Mono deleteWithRestResponseAsync(String containerNam * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono deleteWithRestResponseAsync(String containerName, String blob, String snapshot, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); @@ -380,7 +421,255 @@ public Mono deleteWithRestResponseAsync(String containerNam } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.delete(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.delete(containerName, blob, this.client.getUrl(), snapshot, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + } + + /** + * Set the owner, group, permissions, or access control list for a blob. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setAccessControlWithRestResponseAsync(Context context) { + final Integer timeout = null; + final String owner = null; + final String group = null; + final String posixPermissions = null; + final String posixAcl = null; + final String requestId = null; + final String action = "setAccessControl"; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.setAccessControl(this.client.getUrl(), timeout, owner, group, posixPermissions, posixAcl, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Set the owner, group, permissions, or access control list for a blob. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param owner Optional. The owner of the blob or directory. + * @param group Optional. The owning group of the blob or directory. + * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + * @param posixAcl Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setAccessControlWithRestResponseAsync(Integer timeout, String owner, String group, String posixPermissions, String posixAcl, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + final String action = "setAccessControl"; + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.setAccessControl(this.client.getUrl(), timeout, owner, group, posixPermissions, posixAcl, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Get the owner, group, permissions, or access control list for a blob. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAccessControlWithRestResponseAsync(Context context) { + final Integer timeout = null; + final Boolean upn = null; + final String requestId = null; + final String action = "getAccessControl"; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.getAccessControl(this.client.getUrl(), timeout, upn, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Get the owner, group, permissions, or access control list for a blob. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param upn Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response headers will be transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be returned as Azure Active Directory Object IDs. The default value is false. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAccessControlWithRestResponseAsync(Integer timeout, Boolean upn, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + final String action = "getAccessControl"; + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.getAccessControl(this.client.getUrl(), timeout, upn, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Rename a blob/file. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param renameSource The file or directory to be renamed. The value must have the following format: "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renameWithRestResponseAsync(String filesystem, String path, String renameSource, Context context) { + final Integer timeout = null; + final String directoryProperties = null; + final String posixPermissions = null; + final String posixUmask = null; + final String sourceLeaseId = null; + final String requestId = null; + final String cacheControl = null; + final String contentType = null; + final String contentEncoding = null; + final String contentLanguage = null; + final String contentDisposition = null; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + final String sourceIfMatch = null; + final String sourceIfNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + DateTimeRfc1123 sourceIfModifiedSinceConverted = null; + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; + return service.rename(filesystem, path, this.client.getUrl(), timeout, this.client.getPathRenameMode(), renameSource, directoryProperties, posixPermissions, posixUmask, sourceLeaseId, this.client.getVersion(), requestId, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + } + + /** + * Rename a blob/file. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param renameSource The file or directory to be renamed. The value must have the following format: "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param directoryProperties Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is base64 encoded. + * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + * @param posixUmask Only valid if Hierarchical Namespace is enabled for the account. This umask restricts permission settings for file and directory, and will only be applied when default Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be disabled. Otherwise the corresponding permission will be determined by the permission. A 4-digit octal notation (e.g. 0022) is supported here. If no umask was specified, a default umask - 0027 will be used. + * @param sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and the leaase ID must match. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param directoryHttpHeaders Additional parameters for the operation. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param sourceModifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renameWithRestResponseAsync(String filesystem, String path, String renameSource, Integer timeout, String directoryProperties, String posixPermissions, String posixUmask, String sourceLeaseId, String requestId, DirectoryHttpHeaders directoryHttpHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + String cacheControl = null; + if (directoryHttpHeaders != null) { + cacheControl = directoryHttpHeaders.cacheControl(); + } + String contentType = null; + if (directoryHttpHeaders != null) { + contentType = directoryHttpHeaders.contentType(); + } + String contentEncoding = null; + if (directoryHttpHeaders != null) { + contentEncoding = directoryHttpHeaders.contentEncoding(); + } + String contentLanguage = null; + if (directoryHttpHeaders != null) { + contentLanguage = directoryHttpHeaders.contentLanguage(); + } + String contentDisposition = null; + if (directoryHttpHeaders != null) { + contentDisposition = directoryHttpHeaders.contentDisposition(); + } + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime sourceIfModifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); + } + OffsetDateTime sourceIfUnmodifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); + } + String sourceIfMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); + } + String sourceIfNoneMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + return service.rename(filesystem, path, this.client.getUrl(), timeout, this.client.getPathRenameMode(), renameSource, directoryProperties, posixPermissions, posixUmask, sourceLeaseId, this.client.getVersion(), requestId, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -525,17 +814,17 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str public Mono setMetadataWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "metadata"; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, comp, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -545,23 +834,33 @@ public Mono setMetadataWithRestResponseAsync(String co * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setMetadataWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono setMetadataWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "metadata"; String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -580,7 +879,7 @@ public Mono setMetadataWithRestResponseAsync(String co } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, comp, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -905,17 +1204,17 @@ public Mono breakLeaseWithRestResponseAsync(String cont public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "snapshot"; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; final String leaseId = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, comp, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -925,10 +1224,8 @@ public Mono createSnapshotWithRestResponseAsync(Str * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. @@ -936,8 +1233,20 @@ public Mono createSnapshotWithRestResponseAsync(Str * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String requestId, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { final String comp = "snapshot"; + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -960,7 +1269,7 @@ public Mono createSnapshotWithRestResponseAsync(Str } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, comp, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -977,6 +1286,8 @@ public Mono createSnapshotWithRestResponseAsync(Str public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final Map metadata = null; + final AccessTierOptional tier = null; + final RehydratePriority rehydratePriority = null; final String requestId = null; final String sourceIfMatch = null; final String sourceIfNoneMatch = null; @@ -987,7 +1298,7 @@ public Mono startCopyFromURLWithRestResponseAsync DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tier, rehydratePriority, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -998,6 +1309,8 @@ public Mono startCopyFromURLWithRestResponseAsync * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. + * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. Possible values include: 'High', 'Standard'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param sourceModifiedAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. @@ -1007,7 +1320,7 @@ public Mono startCopyFromURLWithRestResponseAsync * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, AccessTierOptional tier, RehydratePriority rehydratePriority, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); @@ -1048,7 +1361,7 @@ public Mono startCopyFromURLWithRestResponseAsync DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tier, rehydratePriority, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -1065,6 +1378,7 @@ public Mono startCopyFromURLWithRestResponseAsync public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final Map metadata = null; + final AccessTierOptional tier = null; final String requestId = null; final String xMsRequiresSync = "true"; final String sourceIfMatch = null; @@ -1076,7 +1390,7 @@ public Mono copyFromURLWithRestResponseAsync(String co DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tier, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -1087,6 +1401,7 @@ public Mono copyFromURLWithRestResponseAsync(String co * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. + * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param sourceModifiedAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. @@ -1096,7 +1411,7 @@ public Mono copyFromURLWithRestResponseAsync(String co * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, AccessTierOptional tier, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { final String xMsRequiresSync = "true"; OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { @@ -1138,7 +1453,7 @@ public Mono copyFromURLWithRestResponseAsync(String co DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tier, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -1190,18 +1505,19 @@ public Mono abortCopyFromURLWithRestResponseAsync * * @param containerName The container name. * @param blob The blob name. - * @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. + * @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTier tier, Context context) { + public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTierRequired tier, Context context) { final Integer timeout = null; + final RehydratePriority rehydratePriority = null; final String requestId = null; final String comp = "tier"; final String leaseId = null; - return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, this.client.getVersion(), requestId, comp, leaseId, context); + return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, rehydratePriority, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -1209,8 +1525,9 @@ public Mono setTierWithRestResponseAsync(String containerN * * @param containerName The container name. * @param blob The blob name. - * @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. + * @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. Possible values include: 'High', 'Standard'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. @@ -1218,13 +1535,13 @@ public Mono setTierWithRestResponseAsync(String containerN * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTier tier, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTierRequired tier, Integer timeout, RehydratePriority rehydratePriority, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String comp = "tier"; String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, this.client.getVersion(), requestId, comp, leaseId, context); + return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, rehydratePriority, this.client.getVersion(), requestId, comp, leaseId, context); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java index 390c2436de9a..a577c097cead 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java @@ -21,6 +21,7 @@ import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; import com.azure.core.implementation.util.Base64Util; import com.azure.core.util.Context; +import com.azure.storage.blob.models.AccessTierOptional; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlockBlobsCommitBlockListResponse; import com.azure.storage.blob.models.BlockBlobsGetBlockListResponse; @@ -29,13 +30,14 @@ import com.azure.storage.blob.models.BlockBlobsUploadResponse; import com.azure.storage.blob.models.BlockListType; import com.azure.storage.blob.models.BlockLookupList; +import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageErrorException; -import io.netty.buffer.ByteBuf; import java.net.URL; +import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.Map; import reactor.core.publisher.Flux; @@ -76,27 +78,27 @@ private interface BlockBlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono upload(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono upload(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTierOptional tier, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono stageBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono stageBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono stageBlockFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); + Mono stageBlockFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono commitBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @BodyParam("application/xml; charset=utf-8") BlockLookupList blocks, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono commitBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTierOptional tier, @BodyParam("application/xml; charset=utf-8") BlockLookupList blocks, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Get("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("blocklisttype") BlockListType listType, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono getBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("blocklisttype") BlockListType listType, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context); } /** @@ -111,12 +113,10 @@ private interface BlockBlobsService { * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { + public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; + final AccessTierOptional tier = null; final String requestId = null; final String blobType = "BlockBlob"; final String blobContentType = null; @@ -125,12 +125,15 @@ public Mono uploadWithRestResponseAsync(String contain final String blobCacheControl = null; final String blobContentDisposition = null; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, tier, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -142,19 +145,18 @@ public Mono uploadWithRestResponseAsync(String contain * @param contentLength The length of the request. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. + * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param blobHTTPHeaders Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, Map metadata, AccessTierOptional tier, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String blobType = "BlockBlob"; String blobContentType = null; if (blobHTTPHeaders != null) { @@ -184,6 +186,18 @@ public Mono uploadWithRestResponseAsync(String contain if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -203,7 +217,7 @@ public Mono uploadWithRestResponseAsync(String contain String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, tier, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -219,16 +233,17 @@ public Mono uploadWithRestResponseAsync(String contain * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, Context context) { + public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, Context context) { final Integer timeout = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "block"; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; String transactionalContentMD5Converted = null; - return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, context); + String transactionalContentCrc64Converted = null; + return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, body, timeout, this.client.getVersion(), requestId, comp, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, context); } /** @@ -240,25 +255,37 @@ public Mono stageBlockWithRestResponseAsync(String * @param contentLength The length of the request. * @param body Initial data. * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, byte[] transactionalContentMD5, Integer timeout, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, Context context) { final String comp = "block"; String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); - return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, context); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, body, timeout, this.client.getVersion(), requestId, comp, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, context); } /** @@ -277,18 +304,19 @@ public Mono stageBlockWithRestResponseAsync(String public Mono stageBlockFromURLWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, Context context) { final String sourceRange = null; final Integer timeout = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "block"; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String leaseId = null; final String sourceIfMatch = null; final String sourceIfNoneMatch = null; String sourceContentMD5Converted = null; + String sourceContentcrc64Converted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, this.client.getVersion(), requestId, comp, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -301,11 +329,10 @@ public Mono stageBlockFromURLWithRestRespon * @param sourceUrl Specify a URL to the copy source. * @param sourceRange Bytes of source data in the specified range. * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy source. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param cpkInfo Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. * @param sourceModifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. @@ -313,8 +340,20 @@ public Mono stageBlockFromURLWithRestRespon * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono stageBlockFromURLWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, String sourceRange, byte[] sourceContentMD5, Integer timeout, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + public Mono stageBlockFromURLWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String requestId, CpkInfo cpkInfo, LeaseAccessConditions leaseAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { final String comp = "block"; + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); @@ -336,9 +375,10 @@ public Mono stageBlockFromURLWithRestRespon sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); } String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, this.client.getVersion(), requestId, comp, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -355,9 +395,7 @@ public Mono stageBlockFromURLWithRestRespon public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; + final AccessTierOptional tier = null; final String requestId = null; final String comp = "blocklist"; final String blobCacheControl = null; @@ -366,12 +404,17 @@ public Mono commitBlockListWithRestResponseAs final String blobContentLanguage = null; final String blobContentDisposition = null; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; + String transactionalContentMD5Converted = null; + String transactionalContentCrc64Converted = null; String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.commitBlockList(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blocks, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.commitBlockList(containerName, blob, this.client.getUrl(), timeout, transactionalContentMD5Converted, transactionalContentCrc64Converted, metadata, tier, blocks, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -381,20 +424,21 @@ public Mono commitBlockListWithRestResponseAs * @param blob The blob name. * @param blocks the BlockLookupList value. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. + * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param blobHTTPHeaders Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, AccessTierOptional tier, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "blocklist"; String blobCacheControl = null; if (blobHTTPHeaders != null) { @@ -424,6 +468,18 @@ public Mono commitBlockListWithRestResponseAs if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -440,10 +496,12 @@ public Mono commitBlockListWithRestResponseAs if (modifiedAccessConditions != null) { ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); } + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.commitBlockList(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blocks, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.commitBlockList(containerName, blob, this.client.getUrl(), timeout, transactionalContentMD5Converted, transactionalContentCrc64Converted, metadata, tier, blocks, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -459,12 +517,11 @@ public Mono commitBlockListWithRestResponseAs @ServiceMethod(returns = ReturnType.SINGLE) public Mono getBlockListWithRestResponseAsync(String containerName, String blob, BlockListType listType, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; final String requestId = null; final String comp = "blocklist"; final String leaseId = null; - return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, versionId, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); + return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -474,7 +531,6 @@ public Mono getBlockListWithRestResponseAsync(St * @param blob The blob name. * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. Possible values include: 'committed', 'uncommitted', 'all'. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. @@ -483,12 +539,12 @@ public Mono getBlockListWithRestResponseAsync(St * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getBlockListWithRestResponseAsync(String containerName, String blob, BlockListType listType, String snapshot, String versionId, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono getBlockListWithRestResponseAsync(String containerName, String blob, BlockListType listType, String snapshot, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String comp = "blocklist"; String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, versionId, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); + return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java index efb3b64cdf8b..dcbc7f4413df 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java @@ -138,12 +138,12 @@ private interface ContainersService { @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listBlobFlatSegment(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono listBlobFlatSegment(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listBlobHierarchySegment(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("delimiter") String delimiter, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono listBlobHierarchySegment(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("delimiter") String delimiter, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("{containerName}") @ExpectedResponses({200}) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java new file mode 100644 index 000000000000..79b09abd022f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.implementation; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.Delete; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.Patch; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.Put; +import com.azure.core.implementation.annotation.QueryParam; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; +import com.azure.core.util.Context; +import com.azure.storage.blob.models.DataLakeStorageErrorException; +import com.azure.storage.blob.models.DirectoryHttpHeaders; +import com.azure.storage.blob.models.DirectorysCreateResponse; +import com.azure.storage.blob.models.DirectorysDeleteResponse; +import com.azure.storage.blob.models.DirectorysGetAccessControlResponse; +import com.azure.storage.blob.models.DirectorysRenameResponse; +import com.azure.storage.blob.models.DirectorysSetAccessControlResponse; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.PathRenameMode; +import com.azure.storage.blob.models.SourceModifiedAccessConditions; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * Directorys. + */ +public final class DirectorysImpl { + /** + * The proxy service used to perform REST calls. + */ + private DirectorysService service; + + /** + * The service client containing this operation class. + */ + private AzureBlobStorageImpl client; + + /** + * Initializes an instance of DirectorysImpl. + * + * @param client the instance of the service client containing this operation class. + */ + public DirectorysImpl(AzureBlobStorageImpl client) { + this.service = RestProxy.create(DirectorysService.class, client.getHttpPipeline()); + this.client = client; + } + + /** + * The interface defining all the services for AzureBlobStorageDirectorys + * to be used by the proxy service to perform REST calls. + */ + @Host("{url}") + @ServiceInterface(name = "AzureBlobStorageDirectorys") + private interface DirectorysService { + @Put("{filesystem}/{path}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono create(@PathParam("filesystem") String filesystem, @PathParam("path") String path, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-properties") String directoryProperties, @HeaderParam("x-ms-permissions") String posixPermissions, @HeaderParam("x-ms-umask") String posixUmask, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("resource") String resource, @HeaderParam("x-ms-cache-control") String cacheControl, @HeaderParam("x-ms-content-type") String contentType, @HeaderParam("x-ms-content-encoding") String contentEncoding, @HeaderParam("x-ms-content-language") String contentLanguage, @HeaderParam("x-ms-content-disposition") String contentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + + @Put("{filesystem}/{path}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono rename(@PathParam("filesystem") String filesystem, @PathParam("path") String path, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("continuation") String marker, @QueryParam("mode") PathRenameMode pathRenameMode, @HeaderParam("x-ms-rename-source") String renameSource, @HeaderParam("x-ms-properties") String directoryProperties, @HeaderParam("x-ms-permissions") String posixPermissions, @HeaderParam("x-ms-umask") String posixUmask, @HeaderParam("x-ms-source-lease-id") String sourceLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-cache-control") String cacheControl, @HeaderParam("x-ms-content-type") String contentType, @HeaderParam("x-ms-content-encoding") String contentEncoding, @HeaderParam("x-ms-content-language") String contentLanguage, @HeaderParam("x-ms-content-disposition") String contentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); + + @Delete("{filesystem}/{path}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono delete(@PathParam("filesystem") String filesystem, @PathParam("path") String path, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("recursive") boolean recursiveDirectoryDelete, @QueryParam("continuation") String marker, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + + @Patch("{filesystem}/{path}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono setAccessControl(@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 posixPermissions, @HeaderParam("x-ms-acl") String posixAcl, @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(DataLakeStorageErrorException.class) + Mono getAccessControl(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("upn") Boolean upn, @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); + } + + /** + * Create a directory. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createWithRestResponseAsync(String filesystem, String path, Context context) { + final Integer timeout = null; + final String directoryProperties = null; + final String posixPermissions = null; + final String posixUmask = null; + final String requestId = null; + final String resource = "directory"; + final String cacheControl = null; + final String contentType = null; + final String contentEncoding = null; + final String contentLanguage = null; + final String contentDisposition = null; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.create(filesystem, path, this.client.getUrl(), timeout, directoryProperties, posixPermissions, posixUmask, this.client.getVersion(), requestId, resource, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + } + + /** + * Create a directory. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param directoryProperties Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is base64 encoded. + * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + * @param posixUmask Only valid if Hierarchical Namespace is enabled for the account. This umask restricts permission settings for file and directory, and will only be applied when default Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be disabled. Otherwise the corresponding permission will be determined by the permission. A 4-digit octal notation (e.g. 0022) is supported here. If no umask was specified, a default umask - 0027 will be used. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param directoryHttpHeaders Additional parameters for the operation. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createWithRestResponseAsync(String filesystem, String path, Integer timeout, String directoryProperties, String posixPermissions, String posixUmask, String requestId, DirectoryHttpHeaders directoryHttpHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + final String resource = "directory"; + String cacheControl = null; + if (directoryHttpHeaders != null) { + cacheControl = directoryHttpHeaders.cacheControl(); + } + String contentType = null; + if (directoryHttpHeaders != null) { + contentType = directoryHttpHeaders.contentType(); + } + String contentEncoding = null; + if (directoryHttpHeaders != null) { + contentEncoding = directoryHttpHeaders.contentEncoding(); + } + String contentLanguage = null; + if (directoryHttpHeaders != null) { + contentLanguage = directoryHttpHeaders.contentLanguage(); + } + String contentDisposition = null; + if (directoryHttpHeaders != null) { + contentDisposition = directoryHttpHeaders.contentDisposition(); + } + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.create(filesystem, path, this.client.getUrl(), timeout, directoryProperties, posixPermissions, posixUmask, this.client.getVersion(), requestId, resource, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + } + + /** + * Rename a directory. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param renameSource The file or directory to be renamed. The value must have the following format: "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renameWithRestResponseAsync(String filesystem, String path, String renameSource, Context context) { + final Integer timeout = null; + final String marker = null; + final String directoryProperties = null; + final String posixPermissions = null; + final String posixUmask = null; + final String sourceLeaseId = null; + final String requestId = null; + final String cacheControl = null; + final String contentType = null; + final String contentEncoding = null; + final String contentLanguage = null; + final String contentDisposition = null; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + final String sourceIfMatch = null; + final String sourceIfNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + DateTimeRfc1123 sourceIfModifiedSinceConverted = null; + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; + return service.rename(filesystem, path, this.client.getUrl(), timeout, marker, this.client.getPathRenameMode(), renameSource, directoryProperties, posixPermissions, posixUmask, sourceLeaseId, this.client.getVersion(), requestId, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + } + + /** + * Rename a directory. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param renameSource The file or directory to be renamed. The value must have the following format: "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param marker When renaming a directory, the number of paths that are renamed with each invocation is limited. If the number of paths to be renamed exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the rename operation to continue renaming the directory. + * @param directoryProperties Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is base64 encoded. + * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + * @param posixUmask Only valid if Hierarchical Namespace is enabled for the account. This umask restricts permission settings for file and directory, and will only be applied when default Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be disabled. Otherwise the corresponding permission will be determined by the permission. A 4-digit octal notation (e.g. 0022) is supported here. If no umask was specified, a default umask - 0027 will be used. + * @param sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and the leaase ID must match. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param directoryHttpHeaders Additional parameters for the operation. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param sourceModifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renameWithRestResponseAsync(String filesystem, String path, String renameSource, Integer timeout, String marker, String directoryProperties, String posixPermissions, String posixUmask, String sourceLeaseId, String requestId, DirectoryHttpHeaders directoryHttpHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + String cacheControl = null; + if (directoryHttpHeaders != null) { + cacheControl = directoryHttpHeaders.cacheControl(); + } + String contentType = null; + if (directoryHttpHeaders != null) { + contentType = directoryHttpHeaders.contentType(); + } + String contentEncoding = null; + if (directoryHttpHeaders != null) { + contentEncoding = directoryHttpHeaders.contentEncoding(); + } + String contentLanguage = null; + if (directoryHttpHeaders != null) { + contentLanguage = directoryHttpHeaders.contentLanguage(); + } + String contentDisposition = null; + if (directoryHttpHeaders != null) { + contentDisposition = directoryHttpHeaders.contentDisposition(); + } + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime sourceIfModifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); + } + OffsetDateTime sourceIfUnmodifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); + } + String sourceIfMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); + } + String sourceIfNoneMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + return service.rename(filesystem, path, this.client.getUrl(), timeout, marker, this.client.getPathRenameMode(), renameSource, directoryProperties, posixPermissions, posixUmask, sourceLeaseId, this.client.getVersion(), requestId, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + } + + /** + * Deletes the directory. + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param recursiveDirectoryDelete If "true", all paths beneath the directory will be deleted. If "false" and the directory is non-empty, an error occurs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteWithRestResponseAsync(String filesystem, String path, boolean recursiveDirectoryDelete, Context context) { + final Integer timeout = null; + final String marker = null; + final String requestId = null; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.delete(filesystem, path, this.client.getUrl(), timeout, recursiveDirectoryDelete, marker, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + } + + /** + * Deletes the directory. + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param recursiveDirectoryDelete If "true", all paths beneath the directory will be deleted. If "false" and the directory is non-empty, an error occurs. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param marker When renaming a directory, the number of paths that are renamed with each invocation is limited. If the number of paths to be renamed exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the rename operation to continue renaming the directory. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteWithRestResponseAsync(String filesystem, String path, boolean recursiveDirectoryDelete, Integer timeout, String marker, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.delete(filesystem, path, this.client.getUrl(), timeout, recursiveDirectoryDelete, marker, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + } + + /** + * Set the owner, group, permissions, or access control list for a directory. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setAccessControlWithRestResponseAsync(Context context) { + final Integer timeout = null; + final String owner = null; + final String group = null; + final String posixPermissions = null; + final String posixAcl = null; + final String requestId = null; + final String action = "setAccessControl"; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.setAccessControl(this.client.getUrl(), timeout, owner, group, posixPermissions, posixAcl, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Set the owner, group, permissions, or access control list for a directory. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param owner Optional. The owner of the blob or directory. + * @param group Optional. The owning group of the blob or directory. + * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + * @param posixAcl Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setAccessControlWithRestResponseAsync(Integer timeout, String owner, String group, String posixPermissions, String posixAcl, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + final String action = "setAccessControl"; + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.setAccessControl(this.client.getUrl(), timeout, owner, group, posixPermissions, posixAcl, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Get the owner, group, permissions, or access control list for a directory. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAccessControlWithRestResponseAsync(Context context) { + final Integer timeout = null; + final Boolean upn = null; + final String requestId = null; + final String action = "getAccessControl"; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.getAccessControl(this.client.getUrl(), timeout, upn, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Get the owner, group, permissions, or access control list for a directory. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param upn Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response headers will be transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be returned as Azure Active Directory Object IDs. The default value is false. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAccessControlWithRestResponseAsync(Integer timeout, Boolean upn, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + final String action = "getAccessControl"; + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.leaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.ifMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.getAccessControl(this.client.getUrl(), timeout, upn, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java index 97dd44b22bc5..9af03a0c7474 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java @@ -22,6 +22,7 @@ import com.azure.core.implementation.util.Base64Util; import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; @@ -38,8 +39,8 @@ import com.azure.storage.blob.models.SequenceNumberActionType; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageErrorException; -import io.netty.buffer.ByteBuf; import java.net.URL; +import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.Map; import reactor.core.publisher.Flux; @@ -80,12 +81,12 @@ private interface PageBlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-blob-content-length") long blobContentLength, @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-blob-content-length") long blobContentLength, @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono uploadPages(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono uploadPages(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({201}) @@ -95,17 +96,17 @@ private interface PageBlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono uploadPagesFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); + Mono uploadPagesFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, @QueryParam("x-ms-encryption-key") String xMsEncryptionKey, @QueryParam("x-ms-encryption-key-sha256") String xMsEncryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType xMsEncryptionAlgorithm, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); @Get("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getPageRanges(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono getPageRanges(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Get("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getPageRangesDiff(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono getPageRangesDiff(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({200}) @@ -138,9 +139,6 @@ private interface PageBlobsService { public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, long blobContentLength, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final Long blobSequenceNumber = 0L; final String requestId = null; final String blobType = "PageBlob"; @@ -150,12 +148,15 @@ public Mono createWithRestResponseAsync(String containe final String blobCacheControl = null; final String blobContentDisposition = null; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -167,20 +168,18 @@ public Mono createWithRestResponseAsync(String containe * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param blobHTTPHeaders Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, long blobContentLength, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, Long blobSequenceNumber, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, long blobContentLength, Integer timeout, Map metadata, Long blobSequenceNumber, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String blobType = "PageBlob"; String blobContentType = null; if (blobHTTPHeaders != null) { @@ -210,6 +209,18 @@ public Mono createWithRestResponseAsync(String containe if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); @@ -229,7 +240,7 @@ public Mono createWithRestResponseAsync(String containe String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -244,25 +255,26 @@ public Mono createWithRestResponseAsync(String containe * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { + public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { final Integer timeout = null; final String range = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "page"; final String pageWrite = "update"; final String leaseId = null; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final Long ifSequenceNumberLessThanOrEqualTo = null; final Long ifSequenceNumberLessThan = null; final Long ifSequenceNumberEqualTo = null; final String ifMatch = null; final String ifNoneMatch = null; String transactionalContentMD5Converted = null; + String transactionalContentCrc64Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.uploadPages(containerName, blob, this.client.getUrl(), body, contentLength, transactionalContentMD5Converted, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.uploadPages(containerName, blob, this.client.getUrl(), body, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -273,13 +285,12 @@ public Mono uploadPagesWithRestResponseAsync(Strin * @param body Initial data. * @param contentLength The length of the request. * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param range Return only the bytes of the blob in the specified range. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param sequenceNumberAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. @@ -287,13 +298,25 @@ public Mono uploadPagesWithRestResponseAsync(Strin * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, byte[] transactionalContentMD5, Integer timeout, String range, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "page"; final String pageWrite = "update"; String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } Long ifSequenceNumberLessThanOrEqualTo = null; if (sequenceNumberAccessConditions != null) { ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.ifSequenceNumberLessThanOrEqualTo(); @@ -323,9 +346,10 @@ public Mono uploadPagesWithRestResponseAsync(Strin ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); } String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.uploadPages(containerName, blob, this.client.getUrl(), body, contentLength, transactionalContentMD5Converted, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.uploadPages(containerName, blob, this.client.getUrl(), body, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -432,6 +456,9 @@ public Mono uploadPagesFromURLWithRestRespo final String requestId = null; final String comp = "page"; final String pageWrite = "update"; + final String xMsEncryptionKey = null; + final String xMsEncryptionKeySha256 = null; + final EncryptionAlgorithmType xMsEncryptionAlgorithm = null; final String leaseId = null; final Long ifSequenceNumberLessThanOrEqualTo = null; final Long ifSequenceNumberLessThan = null; @@ -441,11 +468,12 @@ public Mono uploadPagesFromURLWithRestRespo final String sourceIfMatch = null; final String sourceIfNoneMatch = null; String sourceContentMD5Converted = null; + String sourceContentcrc64Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.uploadPagesFromURL(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.uploadPagesFromURL(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -458,8 +486,10 @@ public Mono uploadPagesFromURLWithRestRespo * @param contentLength The length of the request. * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and range-end is required. * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy source. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param cpkInfo Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. * @param sequenceNumberAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. @@ -469,9 +499,21 @@ public Mono uploadPagesFromURLWithRestRespo * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadPagesFromURLWithRestResponseAsync(String containerName, String blob, URL sourceUrl, String sourceRange, long contentLength, String range, byte[] sourceContentMD5, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + public Mono uploadPagesFromURLWithRestResponseAsync(String containerName, String blob, URL sourceUrl, String sourceRange, long contentLength, String range, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String requestId, CpkInfo cpkInfo, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { final String comp = "page"; final String pageWrite = "update"; + String xMsEncryptionKey = null; + if (cpkInfo != null) { + xMsEncryptionKey = cpkInfo.xMsEncryptionKey(); + } + String xMsEncryptionKeySha256 = null; + if (cpkInfo != null) { + xMsEncryptionKeySha256 = cpkInfo.xMsEncryptionKeySha256(); + } + EncryptionAlgorithmType xMsEncryptionAlgorithm = null; + if (cpkInfo != null) { + xMsEncryptionAlgorithm = cpkInfo.xMsEncryptionAlgorithm(); + } String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); @@ -521,11 +563,12 @@ public Mono uploadPagesFromURLWithRestRespo sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); } String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.uploadPagesFromURL(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.uploadPagesFromURL(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, xMsEncryptionKey, xMsEncryptionKeySha256, xMsEncryptionAlgorithm, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -540,7 +583,6 @@ public Mono uploadPagesFromURLWithRestRespo @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPageRangesWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; final String range = null; final String requestId = null; @@ -550,7 +592,7 @@ public Mono getPageRangesWithRestResponseAsync(S final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -559,7 +601,6 @@ public Mono getPageRangesWithRestResponseAsync(S * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param range Return only the bytes of the blob in the specified range. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -570,7 +611,7 @@ public Mono getPageRangesWithRestResponseAsync(S * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPageRangesWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono getPageRangesWithRestResponseAsync(String containerName, String blob, String snapshot, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "pagelist"; String leaseId = null; if (leaseAccessConditions != null) { @@ -594,7 +635,7 @@ public Mono getPageRangesWithRestResponseAsync(S } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -609,7 +650,6 @@ public Mono getPageRangesWithRestResponseAsync(S @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPageRangesDiffWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; final String prevsnapshot = null; final String range = null; @@ -620,7 +660,7 @@ public Mono getPageRangesDiffWithRestRespons final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -629,7 +669,6 @@ public Mono getPageRangesDiffWithRestRespons * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param prevsnapshot Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs created on or after January 1, 2016. * @param range Return only the bytes of the blob in the specified range. @@ -641,7 +680,7 @@ public Mono getPageRangesDiffWithRestRespons * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPageRangesDiffWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String prevsnapshot, String range, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono getPageRangesDiffWithRestResponseAsync(String containerName, String blob, String snapshot, Integer timeout, String prevsnapshot, String range, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "pagelist"; String leaseId = null; if (leaseAccessConditions != null) { @@ -665,7 +704,7 @@ public Mono getPageRangesDiffWithRestRespons } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 5d77ec9bcee0..95cf89ced15d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -27,8 +27,11 @@ import com.azure.storage.blob.models.ServicesGetUserDelegationKeyResponse; import com.azure.storage.blob.models.ServicesListContainersSegmentResponse; import com.azure.storage.blob.models.ServicesSetPropertiesResponse; +import com.azure.storage.blob.models.ServicesSubmitBatchResponse; import com.azure.storage.blob.models.StorageErrorException; import com.azure.storage.blob.models.StorageServiceProperties; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** @@ -81,7 +84,7 @@ private interface ServicesService { @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); + Mono listContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); @Post("") @ExpectedResponses({200}) @@ -92,6 +95,11 @@ private interface ServicesService { @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getAccountInfo(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + + @Get("") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono submitBatch(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") Flux body, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-Type") String multipartContentType, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); } /** @@ -231,7 +239,7 @@ public Mono listContainersSegmentWithRest } /** - * Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication. + * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token authentication. * * @param keyInfo the KeyInfo value. * @param context The context to associate with this operation. @@ -248,7 +256,7 @@ public Mono getUserDelegationKeyWithRestRe } /** - * Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication. + * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token authentication. * * @param keyInfo the KeyInfo value. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. @@ -277,4 +285,40 @@ public Mono getAccountInfoWithRestResponseAsync( final String comp = "properties"; return service.getAccountInfo(this.client.getUrl(), this.client.getVersion(), restype, comp, context); } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param body Initial data. + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono submitBatchWithRestResponseAsync(Flux body, long contentLength, String multipartContentType, Context context) { + final Integer timeout = null; + final String requestId = null; + final String comp = "batch"; + return service.submitBatch(this.client.getUrl(), body, contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, comp, context); + } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param body Initial data. + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono submitBatchWithRestResponseAsync(Flux body, long contentLength, String multipartContentType, Integer timeout, String requestId, Context context) { + final String comp = "batch"; + return service.submitBatch(this.client.getUrl(), body, contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, comp, context); + } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTier.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTier.java index d916bd851ce4..fafe6d2eb7ef 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTier.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTier.java @@ -27,6 +27,11 @@ public final class AccessTier extends ExpandableStringEnum { */ public static final AccessTier P10 = fromString("P10"); + /** + * Static value P15 for AccessTier. + */ + public static final AccessTier P15 = fromString("P15"); + /** * Static value P20 for AccessTier. */ @@ -47,6 +52,21 @@ public final class AccessTier extends ExpandableStringEnum { */ public static final AccessTier P50 = fromString("P50"); + /** + * Static value P60 for AccessTier. + */ + public static final AccessTier P60 = fromString("P60"); + + /** + * Static value P70 for AccessTier. + */ + public static final AccessTier P70 = fromString("P70"); + + /** + * Static value P80 for AccessTier. + */ + public static final AccessTier P80 = fromString("P80"); + /** * Static value Hot for AccessTier. */ diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierOptional.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierOptional.java new file mode 100644 index 000000000000..ce8e818b1d48 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierOptional.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Defines values for AccessTierOptional. + */ +public final class AccessTierOptional extends ExpandableStringEnum { + /** + * Static value P4 for AccessTierOptional. + */ + public static final AccessTierOptional P4 = fromString("P4"); + + /** + * Static value P6 for AccessTierOptional. + */ + public static final AccessTierOptional P6 = fromString("P6"); + + /** + * Static value P10 for AccessTierOptional. + */ + public static final AccessTierOptional P10 = fromString("P10"); + + /** + * Static value P15 for AccessTierOptional. + */ + public static final AccessTierOptional P15 = fromString("P15"); + + /** + * Static value P20 for AccessTierOptional. + */ + public static final AccessTierOptional P20 = fromString("P20"); + + /** + * Static value P30 for AccessTierOptional. + */ + public static final AccessTierOptional P30 = fromString("P30"); + + /** + * Static value P40 for AccessTierOptional. + */ + public static final AccessTierOptional P40 = fromString("P40"); + + /** + * Static value P50 for AccessTierOptional. + */ + public static final AccessTierOptional P50 = fromString("P50"); + + /** + * Static value P60 for AccessTierOptional. + */ + public static final AccessTierOptional P60 = fromString("P60"); + + /** + * Static value P70 for AccessTierOptional. + */ + public static final AccessTierOptional P70 = fromString("P70"); + + /** + * Static value P80 for AccessTierOptional. + */ + public static final AccessTierOptional P80 = fromString("P80"); + + /** + * Static value Hot for AccessTierOptional. + */ + public static final AccessTierOptional HOT = fromString("Hot"); + + /** + * Static value Cool for AccessTierOptional. + */ + public static final AccessTierOptional COOL = fromString("Cool"); + + /** + * Static value Archive for AccessTierOptional. + */ + public static final AccessTierOptional ARCHIVE = fromString("Archive"); + + /** + * Creates or finds a AccessTierOptional from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessTierOptional. + */ + @JsonCreator + public static AccessTierOptional fromString(String name) { + return fromString(name, AccessTierOptional.class); + } + + /** + * @return known AccessTierOptional values. + */ + public static Collection values() { + return values(AccessTierOptional.class); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierRequired.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierRequired.java new file mode 100644 index 000000000000..82401f54ff9e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierRequired.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Defines values for AccessTierRequired. + */ +public final class AccessTierRequired extends ExpandableStringEnum { + /** + * Static value P4 for AccessTierRequired. + */ + public static final AccessTierRequired P4 = fromString("P4"); + + /** + * Static value P6 for AccessTierRequired. + */ + public static final AccessTierRequired P6 = fromString("P6"); + + /** + * Static value P10 for AccessTierRequired. + */ + public static final AccessTierRequired P10 = fromString("P10"); + + /** + * Static value P15 for AccessTierRequired. + */ + public static final AccessTierRequired P15 = fromString("P15"); + + /** + * Static value P20 for AccessTierRequired. + */ + public static final AccessTierRequired P20 = fromString("P20"); + + /** + * Static value P30 for AccessTierRequired. + */ + public static final AccessTierRequired P30 = fromString("P30"); + + /** + * Static value P40 for AccessTierRequired. + */ + public static final AccessTierRequired P40 = fromString("P40"); + + /** + * Static value P50 for AccessTierRequired. + */ + public static final AccessTierRequired P50 = fromString("P50"); + + /** + * Static value P60 for AccessTierRequired. + */ + public static final AccessTierRequired P60 = fromString("P60"); + + /** + * Static value P70 for AccessTierRequired. + */ + public static final AccessTierRequired P70 = fromString("P70"); + + /** + * Static value P80 for AccessTierRequired. + */ + public static final AccessTierRequired P80 = fromString("P80"); + + /** + * Static value Hot for AccessTierRequired. + */ + public static final AccessTierRequired HOT = fromString("Hot"); + + /** + * Static value Cool for AccessTierRequired. + */ + public static final AccessTierRequired COOL = fromString("Cool"); + + /** + * Static value Archive for AccessTierRequired. + */ + public static final AccessTierRequired ARCHIVE = fromString("Archive"); + + /** + * Creates or finds a AccessTierRequired from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessTierRequired. + */ + @JsonCreator + public static AccessTierRequired fromString(String name) { + return fromString(name, AccessTierRequired.class); + } + + /** + * @return known AccessTierRequired values. + */ + public static Collection values() { + return values(AccessTierRequired.class); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java index 8dcea49cd76c..fbd83ff10cb3 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java @@ -41,6 +41,14 @@ public final class AppendBlobAppendBlockFromUrlHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -77,6 +85,14 @@ public final class AppendBlobAppendBlockFromUrlHeaders { @JsonProperty(value = "x-ms-blob-committed-block-count") private Integer blobCommittedBlockCount; + /* + * The SHA-256 hash of the encryption key used to encrypt the block. This + * header is only returned when the block was encrypted with a + * customer-provided key. + */ + @JsonProperty(value = "x-ms-encryption-key-sha256") + private String encryptionKeySha256; + /* * The errorCode property. */ @@ -164,6 +180,32 @@ public AppendBlobAppendBlockFromUrlHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] xMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the AppendBlobAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobAppendBlockFromUrlHeaders xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. @@ -285,6 +327,30 @@ public AppendBlobAppendBlockFromUrlHeaders blobCommittedBlockCount(Integer blobC return this; } + /** + * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption + * key used to encrypt the block. This header is only returned when the + * block was encrypted with a customer-provided key. + * + * @return the encryptionKeySha256 value. + */ + public String encryptionKeySha256() { + return this.encryptionKeySha256; + } + + /** + * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption + * key used to encrypt the block. This header is only returned when the + * block was encrypted with a customer-provided key. + * + * @param encryptionKeySha256 the encryptionKeySha256 value to set. + * @return the AppendBlobAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobAppendBlockFromUrlHeaders encryptionKeySha256(String encryptionKeySha256) { + this.encryptionKeySha256 = encryptionKeySha256; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java index a12cefa924e6..8c29bb0c0d8e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java @@ -41,6 +41,21 @@ public final class AppendBlobAppendBlockHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -180,6 +195,56 @@ public AppendBlobAppendBlockHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] xMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the AppendBlobAppendBlockHeaders object itself. + */ + public AppendBlobAppendBlockHeaders xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the AppendBlobAppendBlockHeaders object itself. + */ + public AppendBlobAppendBlockHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java index c2e5a3e0929e..69595e124b35 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java @@ -41,6 +41,13 @@ public final class AppendBlobCreateHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -56,14 +63,6 @@ public final class AppendBlobCreateHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -174,6 +173,30 @@ public AppendBlobCreateHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the AppendBlobCreateHeaders object itself. + */ + public AppendBlobCreateHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. @@ -220,30 +243,6 @@ public AppendBlobCreateHeaders version(String version) { return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java index c27f9fcac790..0dc5cbb43392 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Blob-AbortCopyFromURL-Headers") @Fluent public final class BlobAbortCopyFromURLHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,6 +51,30 @@ public final class BlobAbortCopyFromURLHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobAbortCopyFromURLHeaders object itself. + */ + public BlobAbortCopyFromURLHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java index d4649062bc60..0d986bc95d22 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java @@ -38,6 +38,13 @@ public final class BlobAcquireLeaseHeaders { @JsonProperty(value = "x-ms-lease-id") private String leaseId; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -143,6 +150,30 @@ public BlobAcquireLeaseHeaders leaseId(String leaseId) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobAcquireLeaseHeaders object itself. + */ + public BlobAcquireLeaseHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java index 504b7201befe..ba1ba989e108 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java @@ -38,6 +38,13 @@ public final class BlobBreakLeaseHeaders { @JsonProperty(value = "x-ms-lease-time") private Integer leaseTime; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -145,6 +152,30 @@ public BlobBreakLeaseHeaders leaseTime(Integer leaseTime) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobBreakLeaseHeaders object itself. + */ + public BlobBreakLeaseHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java index 67d6971d9ff3..e8ffbec32efd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java @@ -32,6 +32,13 @@ public final class BlobChangeLeaseHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -123,6 +130,30 @@ public BlobChangeLeaseHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobChangeLeaseHeaders object itself. + */ + public BlobChangeLeaseHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java index 140b771f8cd6..17707531d500 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java @@ -32,6 +32,13 @@ public final class BlobCopyFromURLHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -47,14 +54,6 @@ public final class BlobCopyFromURLHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies the version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -75,6 +74,14 @@ public final class BlobCopyFromURLHeaders { @JsonProperty(value = "x-ms-copy-status") private SyncCopyStatusType copyStatus; + /* + * UTC date/time value generated by the service that identifies the version + * of the blob. This header is returned for requests made against version + * 2018-11-09 and above. + */ + @JsonProperty(value = "x-ms-version-id") + private String versionId; + /* * The errorCode property. */ @@ -138,6 +145,30 @@ public BlobCopyFromURLHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobCopyFromURLHeaders object itself. + */ + public BlobCopyFromURLHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. @@ -184,30 +215,6 @@ public BlobCopyFromURLHeaders version(String version) { return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. @@ -279,6 +286,30 @@ public BlobCopyFromURLHeaders copyStatus(SyncCopyStatusType copyStatus) { return this; } + /** + * Get the versionId property: UTC date/time value generated by the service + * that identifies the version of the blob. This header is returned for + * requests made against version 2018-11-09 and above. + * + * @return the versionId value. + */ + public String versionId() { + return this.versionId; + } + + /** + * Set the versionId property: UTC date/time value generated by the service + * that identifies the version of the blob. This header is returned for + * requests made against version 2018-11-09 and above. + * + * @param versionId the versionId value to set. + * @return the BlobCopyFromURLHeaders object itself. + */ + public BlobCopyFromURLHeaders versionId(String versionId) { + this.versionId = versionId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java index e27c4fde4964..626cb4e5de5f 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java @@ -39,6 +39,13 @@ public final class BlobCreateSnapshotHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -54,14 +61,6 @@ public final class BlobCreateSnapshotHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies the version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -173,6 +172,30 @@ public BlobCreateSnapshotHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobCreateSnapshotHeaders object itself. + */ + public BlobCreateSnapshotHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. @@ -219,30 +242,6 @@ public BlobCreateSnapshotHeaders version(String version) { return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java index 95e6289c3e40..0e4c48ffc536 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Blob-Delete-Headers") @Fluent public final class BlobDeleteHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,6 +51,30 @@ public final class BlobDeleteHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobDeleteHeaders object itself. + */ + public BlobDeleteHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java index 4e9e2997ebab..db3eb31f648e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java @@ -196,6 +196,13 @@ public final class BlobDownloadHeaders { @JsonProperty(value = "x-ms-lease-status") private LeaseStatusType leaseStatus; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -258,6 +265,16 @@ public final class BlobDownloadHeaders { @JsonProperty(value = "x-ms-blob-content-md5") private byte[] blobContentMD5; + /* + * If the request is to read a specified range and the + * x-ms-range-get-content-crc64 is set to true, then the request returns a + * crc64 for the range, as long as the range size is less than or equal to + * 4 MB. If both x-ms-range-get-content-crc64 & x-ms-range-get-content-md5 + * is specified in the same request, it will fail with 400(Bad Request) + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] contentCrc64; + /* * The errorCode property. */ @@ -824,6 +841,30 @@ public BlobDownloadHeaders leaseStatus(LeaseStatusType leaseStatus) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobDownloadHeaders object itself. + */ + public BlobDownloadHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. @@ -1023,6 +1064,36 @@ public BlobDownloadHeaders blobContentMD5(byte[] blobContentMD5) { return this; } + /** + * Get the contentCrc64 property: If the request is to read a specified + * range and the x-ms-range-get-content-crc64 is set to true, then the + * request returns a crc64 for the range, as long as the range size is less + * than or equal to 4 MB. If both x-ms-range-get-content-crc64 & + * x-ms-range-get-content-md5 is specified in the same request, it will + * fail with 400(Bad Request). + * + * @return the contentCrc64 value. + */ + public byte[] contentCrc64() { + return ImplUtils.clone(this.contentCrc64); + } + + /** + * Set the contentCrc64 property: If the request is to read a specified + * range and the x-ms-range-get-content-crc64 is set to true, then the + * request returns a crc64 for the range, as long as the range size is less + * than or equal to 4 MB. If both x-ms-range-get-content-crc64 & + * x-ms-range-get-content-md5 is specified in the same request, it will + * fail with 400(Bad Request). + * + * @param contentCrc64 the contentCrc64 value to set. + * @return the BlobDownloadHeaders object itself. + */ + public BlobDownloadHeaders contentCrc64(byte[] contentCrc64) { + this.contentCrc64 = ImplUtils.clone(contentCrc64); + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccessControlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccessControlHeaders.java new file mode 100644 index 000000000000..1ac3c605414e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccessControlHeaders.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for GetAccessControl operation. + */ +@JacksonXmlRootElement(localName = "Blob-GetAccessControl-Headers") +@Fluent +public final class BlobGetAccessControlHeaders { + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * The owner of the file or directory. Included in the response if + * Hierarchical Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-owner") + private String xMsOwner; + + /* + * The owning group of the file or directory. Included in the response if + * Hierarchical Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-group") + private String xMsGroup; + + /* + * The POSIX access permissions for the file owner, the file owning group, + * and others. Included in the response if Hierarchical Namespace is + * enabled for the account. + */ + @JsonProperty(value = "x-ms-permissions") + private String xMsPermissions; + + /* + * The POSIX access control list for the file or directory. Included in + * the response only if the action is "getAccessControl" and Hierarchical + * Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-acl") + private String xMsAcl; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders eTag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsOwner property: The owner of the file or directory. Included + * in the response if Hierarchical Namespace is enabled for the account. + * + * @return the xMsOwner value. + */ + public String xMsOwner() { + return this.xMsOwner; + } + + /** + * Set the xMsOwner property: The owner of the file or directory. Included + * in the response if Hierarchical Namespace is enabled for the account. + * + * @param xMsOwner the xMsOwner value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders xMsOwner(String xMsOwner) { + this.xMsOwner = xMsOwner; + return this; + } + + /** + * Get the xMsGroup property: The owning group of the file or directory. + * Included in the response if Hierarchical Namespace is enabled for the + * account. + * + * @return the xMsGroup value. + */ + public String xMsGroup() { + return this.xMsGroup; + } + + /** + * Set the xMsGroup property: The owning group of the file or directory. + * Included in the response if Hierarchical Namespace is enabled for the + * account. + * + * @param xMsGroup the xMsGroup value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders xMsGroup(String xMsGroup) { + this.xMsGroup = xMsGroup; + return this; + } + + /** + * Get the xMsPermissions property: The POSIX access permissions for the + * file owner, the file owning group, and others. Included in the response + * if Hierarchical Namespace is enabled for the account. + * + * @return the xMsPermissions value. + */ + public String xMsPermissions() { + return this.xMsPermissions; + } + + /** + * Set the xMsPermissions property: The POSIX access permissions for the + * file owner, the file owning group, and others. Included in the response + * if Hierarchical Namespace is enabled for the account. + * + * @param xMsPermissions the xMsPermissions value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders xMsPermissions(String xMsPermissions) { + this.xMsPermissions = xMsPermissions; + return this; + } + + /** + * Get the xMsAcl property: The POSIX access control list for the file or + * directory. Included in the response only if the action is + * "getAccessControl" and Hierarchical Namespace is enabled for the + * account. + * + * @return the xMsAcl value. + */ + public String xMsAcl() { + return this.xMsAcl; + } + + /** + * Set the xMsAcl property: The POSIX access control list for the file or + * directory. Included in the response only if the action is + * "getAccessControl" and Hierarchical Namespace is enabled for the + * account. + * + * @param xMsAcl the xMsAcl value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders xMsAcl(String xMsAcl) { + this.xMsAcl = xMsAcl; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java index 21243aaac732..61acd7944cc9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Blob-GetAccountInfo-Headers") @Fluent public final class BlobGetAccountInfoHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -59,6 +66,30 @@ public final class BlobGetAccountInfoHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobGetAccountInfoHeaders object itself. + */ + public BlobGetAccountInfoHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java index 728ae5fd9e1e..b53a00fd5dda 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java @@ -209,6 +209,13 @@ public final class BlobGetPropertiesHeaders { @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -914,6 +921,30 @@ public BlobGetPropertiesHeaders blobSequenceNumber(Long blobSequenceNumber) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobGetPropertiesHeaders object itself. + */ + public BlobGetPropertiesHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetTagsHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetTagsHeaders.java new file mode 100644 index 000000000000..62de1e897127 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetTagsHeaders.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for GetTags operation. + */ +@JacksonXmlRootElement(localName = "Blob-GetTags-Headers") +@Fluent +public final class BlobGetTagsHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the Blob service used to execute the request. + * This header is returned for requests made against version 2009-09-19 and + * above. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * UTC date/time value generated by the service that indicates the time at + * which the response was initiated + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobGetTagsHeaders object itself. + */ + public BlobGetTagsHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the BlobGetTagsHeaders object itself. + */ + public BlobGetTagsHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @param version the version value to set. + * @return the BlobGetTagsHeaders object itself. + */ + public BlobGetTagsHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the BlobGetTagsHeaders object itself. + */ + public BlobGetTagsHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the BlobGetTagsHeaders object itself. + */ + public BlobGetTagsHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java index c1885f617481..d9eb4ef87da8 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - import java.util.ArrayList; import java.util.List; @@ -16,8 +15,8 @@ * The BlobHierarchyListSegment model. */ @JacksonXmlRootElement(localName = "Blobs") -@JsonDeserialize(using = CustomHierarchicalListingDeserializer.class) @Fluent +@JsonDeserialize(using = CustomHierarchicalListingDeserializer.class) public final class BlobHierarchyListSegment { /* * The blobPrefixes property. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobItem.java index 3d777a4b2e38..5c6c8eb58472 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobItem.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobItem.java @@ -33,12 +33,6 @@ public final class BlobItem { @JsonProperty(value = "Snapshot", required = true) private String snapshot; - /* - * The versionId property. - */ - @JsonProperty(value = "VersionId", required = true) - private String versionId; - /* * The properties property. */ @@ -51,6 +45,12 @@ public final class BlobItem { @JsonProperty(value = "Metadata") private Map metadata; + /* + * The versionId property. + */ + @JsonProperty(value = "VersionId", required = true) + private String versionId; + /* * The isPrefix property. */ @@ -117,26 +117,6 @@ public BlobItem snapshot(String snapshot) { return this; } - /** - * Get the versionId property: The versionId property. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: The versionId property. - * - * @param versionId the versionId value to set. - * @return the BlobItem object itself. - */ - public BlobItem versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the properties property: The properties property. * @@ -177,6 +157,26 @@ public BlobItem metadata(Map metadata) { return this; } + /** + * Get the versionId property: The versionId property. + * + * @return the versionId value. + */ + public String versionId() { + return this.versionId; + } + + /** + * Set the versionId property: The versionId property. + * + * @param versionId the versionId value to set. + * @return the BlobItem object itself. + */ + public BlobItem versionId(String versionId) { + this.versionId = versionId; + return this; + } + /** * Get the isPrefix property: The isPrefix property. * diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java index d5bad7b9996e..2bd5a467109f 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java @@ -175,8 +175,8 @@ public final class BlobProperties { private Integer remainingRetentionDays; /* - * Possible values include: 'P4', 'P6', 'P10', 'P20', 'P30', 'P40', 'P50', - * 'Hot', 'Cool', 'Archive' + * Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', + * 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive' */ @JsonProperty(value = "AccessTier") private AccessTier accessTier; @@ -770,7 +770,8 @@ public BlobProperties remainingRetentionDays(Integer remainingRetentionDays) { /** * Get the accessTier property: Possible values include: 'P4', 'P6', 'P10', - * 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. + * 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', + * 'Archive'. * * @return the accessTier value. */ @@ -780,7 +781,8 @@ public AccessTier accessTier() { /** * Set the accessTier property: Possible values include: 'P4', 'P6', 'P10', - * 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. + * 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', + * 'Archive'. * * @param accessTier the accessTier value to set. * @return the BlobProperties object itself. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java index f503b9ab6d30..d90443f43ec1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java @@ -32,6 +32,13 @@ public final class BlobReleaseLeaseHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -117,6 +124,30 @@ public BlobReleaseLeaseHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobReleaseLeaseHeaders object itself. + */ + public BlobReleaseLeaseHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenameHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenameHeaders.java new file mode 100644 index 000000000000..7c293db887cd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenameHeaders.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for Rename operation. + */ +@JacksonXmlRootElement(localName = "Blob-Rename-Headers") +@Fluent +public final class BlobRenameHeaders { + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * The size of the resource in bytes. + */ + @JsonProperty(value = "Content-Length") + private Long contentLength; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders eTag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the contentLength property: The size of the resource in bytes. + * + * @return the contentLength value. + */ + public Long contentLength() { + return this.contentLength; + } + + /** + * Set the contentLength property: The size of the resource in bytes. + * + * @param contentLength the contentLength value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders contentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java index 863157cf8a42..f7115f510628 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java @@ -38,6 +38,13 @@ public final class BlobRenewLeaseHeaders { @JsonProperty(value = "x-ms-lease-id") private String leaseId; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -143,6 +150,30 @@ public BlobRenewLeaseHeaders leaseId(String leaseId) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobRenewLeaseHeaders object itself. + */ + public BlobRenewLeaseHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetAccessControlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetAccessControlHeaders.java new file mode 100644 index 000000000000..672499292f00 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetAccessControlHeaders.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for SetAccessControl operation. + */ +@JacksonXmlRootElement(localName = "Blob-SetAccessControl-Headers") +@Fluent +public final class BlobSetAccessControlHeaders { + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders eTag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java index ed539d644bc1..b926fb245980 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java @@ -39,6 +39,13 @@ public final class BlobSetHTTPHeadersHeaders { @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -146,6 +153,30 @@ public BlobSetHTTPHeadersHeaders blobSequenceNumber(Long blobSequenceNumber) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobSetHTTPHeadersHeaders object itself. + */ + public BlobSetHTTPHeadersHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java index 5b3898194287..8ea439e47fce 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java @@ -32,6 +32,13 @@ public final class BlobSetMetadataHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -133,6 +140,30 @@ public BlobSetMetadataHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobSetMetadataHeaders object itself. + */ + public BlobSetMetadataHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTagsHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTagsHeaders.java new file mode 100644 index 000000000000..58da7c6edbfb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTagsHeaders.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for SetTags operation. + */ +@JacksonXmlRootElement(localName = "Blob-SetTags-Headers") +@Fluent +public final class BlobSetTagsHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the Blob service used to execute the request. + * This header is returned for requests made against version 2009-09-19 and + * above. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * UTC date/time value generated by the service that indicates the time at + * which the response was initiated + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobSetTagsHeaders object itself. + */ + public BlobSetTagsHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the BlobSetTagsHeaders object itself. + */ + public BlobSetTagsHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @param version the version value to set. + * @return the BlobSetTagsHeaders object itself. + */ + public BlobSetTagsHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the BlobSetTagsHeaders object itself. + */ + public BlobSetTagsHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the BlobSetTagsHeaders object itself. + */ + public BlobSetTagsHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java index 372b1a09ebc0..0ec7d69471c5 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java @@ -14,6 +14,13 @@ @JacksonXmlRootElement(localName = "Blob-SetTier-Headers") @Fluent public final class BlobSetTierHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -35,6 +42,30 @@ public final class BlobSetTierHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobSetTierHeaders object itself. + */ + public BlobSetTierHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java index a6b195a6e6dc..be551c15c68f 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java @@ -32,6 +32,13 @@ public final class BlobStartCopyFromURLHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -47,14 +54,6 @@ public final class BlobStartCopyFromURLHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies the version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -77,6 +76,14 @@ public final class BlobStartCopyFromURLHeaders { @JsonProperty(value = "x-ms-copy-status") private CopyStatusType copyStatus; + /* + * UTC date/time value generated by the service that identifies the version + * of the blob. This header is returned for requests made against version + * 2018-11-09 and above. + */ + @JsonProperty(value = "x-ms-version-id") + private String versionId; + /* * The errorCode property. */ @@ -140,6 +147,30 @@ public BlobStartCopyFromURLHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobStartCopyFromURLHeaders object itself. + */ + public BlobStartCopyFromURLHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. @@ -186,30 +217,6 @@ public BlobStartCopyFromURLHeaders version(String version) { return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. @@ -287,6 +294,30 @@ public BlobStartCopyFromURLHeaders copyStatus(CopyStatusType copyStatus) { return this; } + /** + * Get the versionId property: UTC date/time value generated by the service + * that identifies the version of the blob. This header is returned for + * requests made against version 2018-11-09 and above. + * + * @return the versionId value. + */ + public String versionId() { + return this.versionId; + } + + /** + * Set the versionId property: UTC date/time value generated by the service + * that identifies the version of the blob. This header is returned for + * requests made against version 2018-11-09 and above. + * + * @param versionId the versionId value to set. + * @return the BlobStartCopyFromURLHeaders object itself. + */ + public BlobStartCopyFromURLHeaders versionId(String versionId) { + this.versionId = versionId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobTags.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobTags.java new file mode 100644 index 000000000000..511b4202d2b6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobTags.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.util.ArrayList; +import java.util.List; + +/** + * XML containing key/value pairs representing the tags for the blob. + */ +@JacksonXmlRootElement(localName = "Tags") +@Fluent +public final class BlobTags { + private static final class TagSetWrapper { + @JacksonXmlProperty(localName = "Tag") + private final List items; + + @JsonCreator + private TagSetWrapper(@JacksonXmlProperty(localName = "Tag") List items) { + this.items = items; + } + } + + /* + * The tagSet property. + */ + @JsonProperty(value = "TagSet") + private TagSetWrapper tagSet; + + /** + * Get the tagSet property: The tagSet property. + * + * @return the tagSet value. + */ + public List tagSet() { + if (this.tagSet == null) { + this.tagSet = new TagSetWrapper(new ArrayList()); + } + return this.tagSet.items; + } + + /** + * Set the tagSet property: The tagSet property. + * + * @param tagSet the tagSet value to set. + * @return the BlobTags object itself. + */ + public BlobTags tagSet(List tagSet) { + this.tagSet = new TagSetWrapper(tagSet); + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java index cd1ea6a55d13..3b11e7dd6632 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Blob-Undelete-Headers") @Fluent public final class BlobUndeleteHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,6 +51,30 @@ public final class BlobUndeleteHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobUndeleteHeaders object itself. + */ + public BlobUndeleteHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java index 1101ca18c80e..9ed09112e596 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java @@ -7,14 +7,14 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; -import io.netty.buffer.ByteBuf; import java.io.Closeable; +import java.nio.ByteBuffer; import reactor.core.publisher.Flux; /** * Contains all response data for the download operation. */ -public final class BlobsDownloadResponse extends ResponseBase> implements Closeable { +public final class BlobsDownloadResponse extends ResponseBase> implements Closeable { /** * Creates an instance of BlobsDownloadResponse. * @@ -24,7 +24,7 @@ public final class BlobsDownloadResponse extends ResponseBase value, BlobDownloadHeaders headers) { + public BlobsDownloadResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Flux value, BlobDownloadHeaders headers) { super(request, statusCode, rawHeaders, value, headers); } @@ -32,7 +32,7 @@ public BlobsDownloadResponse(HttpRequest request, int statusCode, HttpHeaders ra * @return the response content stream. */ @Override - public Flux value() { + public Flux value() { return super.value(); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetAccessControlResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetAccessControlResponse.java new file mode 100644 index 000000000000..22d187baf2be --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetAccessControlResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the getAccessControl operation. + */ +public final class BlobsGetAccessControlResponse extends ResponseBase { + /** + * Creates an instance of BlobsGetAccessControlResponse. + * + * @param request the request which resulted in this BlobsGetAccessControlResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BlobsGetAccessControlResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobGetAccessControlHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetTagsResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetTagsResponse.java new file mode 100644 index 000000000000..e97f1ca848f5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetTagsResponse.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the getTags operation. + */ +public final class BlobsGetTagsResponse extends ResponseBase { + /** + * Creates an instance of BlobsGetTagsResponse. + * + * @param request the request which resulted in this BlobsGetTagsResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BlobsGetTagsResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, BlobTags value, BlobGetTagsHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * @return the deserialized response body. + */ + @Override + public BlobTags value() { + return super.value(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsRenameResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsRenameResponse.java new file mode 100644 index 000000000000..1be4db789caa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsRenameResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the rename operation. + */ +public final class BlobsRenameResponse extends ResponseBase { + /** + * Creates an instance of BlobsRenameResponse. + * + * @param request the request which resulted in this BlobsRenameResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BlobsRenameResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobRenameHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetAccessControlResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetAccessControlResponse.java new file mode 100644 index 000000000000..0f59a40bdfda --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetAccessControlResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the setAccessControl operation. + */ +public final class BlobsSetAccessControlResponse extends ResponseBase { + /** + * Creates an instance of BlobsSetAccessControlResponse. + * + * @param request the request which resulted in this BlobsSetAccessControlResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BlobsSetAccessControlResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobSetAccessControlHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetTagsResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetTagsResponse.java new file mode 100644 index 000000000000..58946c96cbb3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetTagsResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the setTags operation. + */ +public final class BlobsSetTagsResponse extends ResponseBase { + /** + * Creates an instance of BlobsSetTagsResponse. + * + * @param request the request which resulted in this BlobsSetTagsResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BlobsSetTagsResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobSetTagsHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java index 6bec949d7180..80cc2bf9b8cc 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java @@ -34,13 +34,28 @@ public final class BlockBlobCommitBlockListHeaders { private DateTimeRfc1123 lastModified; /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. + * This header is returned so that the client can check for message content + * integrity. This header refers to the content of the request, meaning, in + * this case, the list of blocks, and not the content of the blob itself. */ @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. This header refers to the content of the request, meaning, in + * this case, the list of blocks, and not the content of the blob itself. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -56,14 +71,6 @@ public final class BlockBlobCommitBlockListHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -151,9 +158,10 @@ public BlockBlobCommitBlockListHeaders lastModified(OffsetDateTime lastModified) } /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Get the contentMD5 property: This header is returned so that the client + * can check for message content integrity. This header refers to the + * content of the request, meaning, in this case, the list of blocks, and + * not the content of the blob itself. * * @return the contentMD5 value. */ @@ -162,9 +170,10 @@ public byte[] contentMD5() { } /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Set the contentMD5 property: This header is returned so that the client + * can check for message content integrity. This header refers to the + * content of the request, meaning, in this case, the list of blocks, and + * not the content of the blob itself. * * @param contentMD5 the contentMD5 value to set. * @return the BlockBlobCommitBlockListHeaders object itself. @@ -174,6 +183,56 @@ public BlockBlobCommitBlockListHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. This header refers to + * the content of the request, meaning, in this case, the list of blocks, + * and not the content of the blob itself. + * + * @return the xMsContentCrc64 value. + */ + public byte[] xMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. This header refers to + * the content of the request, meaning, in this case, the list of blocks, + * and not the content of the blob itself. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlockBlobCommitBlockListHeaders object itself. + */ + public BlockBlobCommitBlockListHeaders xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlockBlobCommitBlockListHeaders object itself. + */ + public BlockBlobCommitBlockListHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. @@ -220,30 +279,6 @@ public BlockBlobCommitBlockListHeaders version(String version) { return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java index fa50d846ebef..102d7229c0f1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java @@ -45,6 +45,13 @@ public final class BlockBlobGetBlockListHeaders { @JsonProperty(value = "x-ms-blob-content-length") private Long blobContentLength; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -172,6 +179,30 @@ public BlockBlobGetBlockListHeaders blobContentLength(Long blobContentLength) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlockBlobGetBlockListHeaders object itself. + */ + public BlockBlobGetBlockListHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java index 88dd3c6346ed..52b9584e0e18 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java @@ -18,13 +18,28 @@ @Fluent public final class BlockBlobStageBlockFromURLHeaders { /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. */ @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -70,9 +85,10 @@ public final class BlockBlobStageBlockFromURLHeaders { private String errorCode; /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Get the contentMD5 property: This header is returned so that the client + * can check for message content integrity. The value of this header is + * computed by the Blob service; it is not necessarily the same value + * specified in the request headers. * * @return the contentMD5 value. */ @@ -81,9 +97,10 @@ public byte[] contentMD5() { } /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Set the contentMD5 property: This header is returned so that the client + * can check for message content integrity. The value of this header is + * computed by the Blob service; it is not necessarily the same value + * specified in the request headers. * * @param contentMD5 the contentMD5 value to set. * @return the BlockBlobStageBlockFromURLHeaders object itself. @@ -93,6 +110,56 @@ public BlockBlobStageBlockFromURLHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] xMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlockBlobStageBlockFromURLHeaders object itself. + */ + public BlockBlobStageBlockFromURLHeaders xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlockBlobStageBlockFromURLHeaders object itself. + */ + public BlockBlobStageBlockFromURLHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java index 56ffdfe93700..479bfa430565 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java @@ -18,13 +18,20 @@ @Fluent public final class BlockBlobStageBlockHeaders { /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. */ @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -47,6 +54,14 @@ public final class BlockBlobStageBlockHeaders { @JsonProperty(value = "Date") private DateTimeRfc1123 dateProperty; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + /* * The value of this header is set to true if the contents of the request * are successfully encrypted using the specified algorithm, and false @@ -70,9 +85,10 @@ public final class BlockBlobStageBlockHeaders { private String errorCode; /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Get the contentMD5 property: This header is returned so that the client + * can check for message content integrity. The value of this header is + * computed by the Blob service; it is not necessarily the same value + * specified in the request headers. * * @return the contentMD5 value. */ @@ -81,9 +97,10 @@ public byte[] contentMD5() { } /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Set the contentMD5 property: This header is returned so that the client + * can check for message content integrity. The value of this header is + * computed by the Blob service; it is not necessarily the same value + * specified in the request headers. * * @param contentMD5 the contentMD5 value to set. * @return the BlockBlobStageBlockHeaders object itself. @@ -93,6 +110,30 @@ public BlockBlobStageBlockHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlockBlobStageBlockHeaders object itself. + */ + public BlockBlobStageBlockHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. @@ -168,6 +209,32 @@ public BlockBlobStageBlockHeaders dateProperty(OffsetDateTime dateProperty) { return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] xMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlockBlobStageBlockHeaders object itself. + */ + public BlockBlobStageBlockHeaders xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the isServerEncrypted property: The value of this header is set to * true if the contents of the request are successfully encrypted using the diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java index 76c59b2f74d9..2a4f06825cfa 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java @@ -41,6 +41,13 @@ public final class BlockBlobUploadHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -56,14 +63,6 @@ public final class BlockBlobUploadHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -174,6 +173,30 @@ public BlockBlobUploadHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlockBlobUploadHeaders object itself. + */ + public BlockBlobUploadHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. @@ -220,30 +243,6 @@ public BlockBlobUploadHeaders version(String version) { return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java index bd6d0580bdcf..15f4938ad8ee 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java @@ -38,6 +38,13 @@ public final class ContainerAcquireLeaseHeaders { @JsonProperty(value = "x-ms-lease-id") private String leaseId; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -143,6 +150,30 @@ public ContainerAcquireLeaseHeaders leaseId(String leaseId) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerAcquireLeaseHeaders object itself. + */ + public ContainerAcquireLeaseHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java index 4df2a5f3ddef..bea7906493fb 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java @@ -38,6 +38,13 @@ public final class ContainerBreakLeaseHeaders { @JsonProperty(value = "x-ms-lease-time") private Integer leaseTime; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -145,6 +152,30 @@ public ContainerBreakLeaseHeaders leaseTime(Integer leaseTime) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerBreakLeaseHeaders object itself. + */ + public ContainerBreakLeaseHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java index 8c5371a5121f..dd16b934a42a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java @@ -38,6 +38,13 @@ public final class ContainerChangeLeaseHeaders { @JsonProperty(value = "x-ms-lease-id") private String leaseId; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -143,6 +150,30 @@ public ContainerChangeLeaseHeaders leaseId(String leaseId) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerChangeLeaseHeaders object itself. + */ + public ContainerChangeLeaseHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java index 9a22e560ca72..c52bf1b9a1e5 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java @@ -32,6 +32,13 @@ public final class ContainerCreateHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -117,6 +124,30 @@ public ContainerCreateHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerCreateHeaders object itself. + */ + public ContainerCreateHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java index 64af976e0367..4308de71d186 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Container-Delete-Headers") @Fluent public final class ContainerDeleteHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,6 +51,30 @@ public final class ContainerDeleteHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerDeleteHeaders object itself. + */ + public ContainerDeleteHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java index a1a76b2f57ba..779ffb797e73 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java @@ -39,6 +39,13 @@ public final class ContainerGetAccessPolicyHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -148,6 +155,30 @@ public ContainerGetAccessPolicyHeaders lastModified(OffsetDateTime lastModified) return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerGetAccessPolicyHeaders object itself. + */ + public ContainerGetAccessPolicyHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java index 692c4a71fc52..368acb2e4cc4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Container-GetAccountInfo-Headers") @Fluent public final class ContainerGetAccountInfoHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -59,6 +66,30 @@ public final class ContainerGetAccountInfoHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerGetAccountInfoHeaders object itself. + */ + public ContainerGetAccountInfoHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java index df2d12bbcdb6..28209621cc29 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java @@ -61,6 +61,13 @@ public final class ContainerGetPropertiesHeaders { @JsonProperty(value = "x-ms-lease-status") private LeaseStatusType leaseStatus; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -253,6 +260,30 @@ public ContainerGetPropertiesHeaders leaseStatus(LeaseStatusType leaseStatus) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerGetPropertiesHeaders object itself. + */ + public ContainerGetPropertiesHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java index ef1252a5a8d4..a17ee04d84c1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java @@ -23,6 +23,13 @@ public final class ContainerListBlobFlatSegmentHeaders { @JsonProperty(value = "Content-Type") private String contentType; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -73,6 +80,30 @@ public ContainerListBlobFlatSegmentHeaders contentType(String contentType) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerListBlobFlatSegmentHeaders object itself. + */ + public ContainerListBlobFlatSegmentHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java index d1a671cf7550..44bf89808b3a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java @@ -23,6 +23,13 @@ public final class ContainerListBlobHierarchySegmentHeaders { @JsonProperty(value = "Content-Type") private String contentType; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -73,6 +80,30 @@ public ContainerListBlobHierarchySegmentHeaders contentType(String contentType) return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerListBlobHierarchySegmentHeaders object itself. + */ + public ContainerListBlobHierarchySegmentHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java index 7a8766ab2424..0a33b2b26cbc 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java @@ -32,6 +32,13 @@ public final class ContainerReleaseLeaseHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -117,6 +124,30 @@ public ContainerReleaseLeaseHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerReleaseLeaseHeaders object itself. + */ + public ContainerReleaseLeaseHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java index a192e95a96c8..5fbbfb2a286b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java @@ -38,6 +38,13 @@ public final class ContainerRenewLeaseHeaders { @JsonProperty(value = "x-ms-lease-id") private String leaseId; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -143,6 +150,30 @@ public ContainerRenewLeaseHeaders leaseId(String leaseId) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerRenewLeaseHeaders object itself. + */ + public ContainerRenewLeaseHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java index 763e75291800..a38fbf929c42 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java @@ -32,6 +32,13 @@ public final class ContainerSetAccessPolicyHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -117,6 +124,30 @@ public ContainerSetAccessPolicyHeaders lastModified(OffsetDateTime lastModified) return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerSetAccessPolicyHeaders object itself. + */ + public ContainerSetAccessPolicyHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java index e685322b83ff..ee483bfdde40 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java @@ -32,6 +32,13 @@ public final class ContainerSetMetadataHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -117,6 +124,30 @@ public ContainerSetMetadataHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerSetMetadataHeaders object itself. + */ + public ContainerSetMetadataHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CpkInfo.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CpkInfo.java new file mode 100644 index 000000000000..676d20cc6ca7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CpkInfo.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Additional parameters for a set of operations. + */ +@JacksonXmlRootElement(localName = "cpk-info") +@Fluent +public final class CpkInfo { + /* + * Optional. Specifies the encryption key to use to encrypt the data + * provided in the request. If not specified, encryption is performed with + * the root account encryption key. For more information, see Encryption + * at Rest for Azure Storage Services. + */ + @JsonProperty(value = "xMsEncryptionKey") + private String xMsEncryptionKey; + + /* + * The SHA-256 hash of the provided encryption key. Must be provided if the + * x-ms-encryption-key header is provided. + */ + @JsonProperty(value = "xMsEncryptionKeySha256") + private String xMsEncryptionKeySha256; + + /* + * The algorithm used to produce the encryption key hash. Currently, the + * only accepted value is "AES256". Must be provided if the + * x-ms-encryption-key header is provided. Possible values include: + * 'AES256' + */ + @JsonProperty(value = "xMsEncryptionAlgorithm") + private EncryptionAlgorithmType xMsEncryptionAlgorithm; + + /** + * Get the xMsEncryptionKey property: Optional. Specifies the encryption + * key to use to encrypt the data provided in the request. If not + * specified, encryption is performed with the root account encryption key. + * For more information, see Encryption at Rest for Azure Storage Services. + * + * @return the xMsEncryptionKey value. + */ + public String xMsEncryptionKey() { + return this.xMsEncryptionKey; + } + + /** + * Set the xMsEncryptionKey property: Optional. Specifies the encryption + * key to use to encrypt the data provided in the request. If not + * specified, encryption is performed with the root account encryption key. + * For more information, see Encryption at Rest for Azure Storage Services. + * + * @param xMsEncryptionKey the xMsEncryptionKey value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo xMsEncryptionKey(String xMsEncryptionKey) { + this.xMsEncryptionKey = xMsEncryptionKey; + return this; + } + + /** + * Get the xMsEncryptionKeySha256 property: The SHA-256 hash of the + * provided encryption key. Must be provided if the x-ms-encryption-key + * header is provided. + * + * @return the xMsEncryptionKeySha256 value. + */ + public String xMsEncryptionKeySha256() { + return this.xMsEncryptionKeySha256; + } + + /** + * Set the xMsEncryptionKeySha256 property: The SHA-256 hash of the + * provided encryption key. Must be provided if the x-ms-encryption-key + * header is provided. + * + * @param xMsEncryptionKeySha256 the xMsEncryptionKeySha256 value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo xMsEncryptionKeySha256(String xMsEncryptionKeySha256) { + this.xMsEncryptionKeySha256 = xMsEncryptionKeySha256; + return this; + } + + /** + * Get the xMsEncryptionAlgorithm property: The algorithm used to produce + * the encryption key hash. Currently, the only accepted value is "AES256". + * Must be provided if the x-ms-encryption-key header is provided. Possible + * values include: 'AES256'. + * + * @return the xMsEncryptionAlgorithm value. + */ + public EncryptionAlgorithmType xMsEncryptionAlgorithm() { + return this.xMsEncryptionAlgorithm; + } + + /** + * Set the xMsEncryptionAlgorithm property: The algorithm used to produce + * the encryption key hash. Currently, the only accepted value is "AES256". + * Must be provided if the x-ms-encryption-key header is provided. Possible + * values include: 'AES256'. + * + * @param xMsEncryptionAlgorithm the xMsEncryptionAlgorithm value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo xMsEncryptionAlgorithm(EncryptionAlgorithmType xMsEncryptionAlgorithm) { + this.xMsEncryptionAlgorithm = xMsEncryptionAlgorithm; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomerProvidedKeyInfo.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomerProvidedKeyInfo.java new file mode 100644 index 000000000000..3c033adb0ccc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomerProvidedKeyInfo.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Additional parameters for a set of operations. + */ +@JacksonXmlRootElement(localName = "customer-provided-key-info") +@Fluent +public final class CustomerProvidedKeyInfo { + /* + * Optional. Specifies the encryption scope to use to encrypt the data + * provided in the request. If not specified, encryption is performed with + * the root account encryption key. For more information, see Encryption + * at Rest for Azure Storage Services. + */ + @JsonProperty(value = "encryptionScope") + private String encryptionScope; + + /** + * Get the encryptionScope property: Optional. Specifies the encryption + * scope to use to encrypt the data provided in the request. If not + * specified, encryption is performed with the root account encryption key. + * For more information, see Encryption at Rest for Azure Storage Services. + * + * @return the encryptionScope value. + */ + public String encryptionScope() { + return this.encryptionScope; + } + + /** + * Set the encryptionScope property: Optional. Specifies the encryption + * scope to use to encrypt the data provided in the request. If not + * specified, encryption is performed with the root account encryption key. + * For more information, see Encryption at Rest for Azure Storage Services. + * + * @param encryptionScope the encryptionScope value to set. + * @return the CustomerProvidedKeyInfo object itself. + */ + public CustomerProvidedKeyInfo encryptionScope(String encryptionScope) { + this.encryptionScope = encryptionScope; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageError.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageError.java new file mode 100644 index 000000000000..d481a91fead8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageError.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * The DataLakeStorageError model. + */ +@JacksonXmlRootElement(localName = "DataLakeStorageError") +@Fluent +public final class DataLakeStorageError { + /* + * The service error response object. + */ + @JsonProperty(value = "error") + private DataLakeStorageErrorError error; + + /** + * Get the error property: The service error response object. + * + * @return the error value. + */ + public DataLakeStorageErrorError error() { + return this.error; + } + + /** + * Set the error property: The service error response object. + * + * @param error the error value to set. + * @return the DataLakeStorageError object itself. + */ + public DataLakeStorageError error(DataLakeStorageErrorError error) { + this.error = error; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorError.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorError.java new file mode 100644 index 000000000000..8f6d191f3e37 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorError.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * The service error response object. + */ +@JacksonXmlRootElement(localName = "DataLakeStorageError_error") +@Fluent +public final class DataLakeStorageErrorError { + /* + * The service error code. + */ + @JsonProperty(value = "Code") + private String code; + + /* + * The service error message. + */ + @JsonProperty(value = "Message") + private String message; + + /** + * Get the code property: The service error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: The service error code. + * + * @param code the code value to set. + * @return the DataLakeStorageErrorError object itself. + */ + public DataLakeStorageErrorError code(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: The service error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The service error message. + * + * @param message the message value to set. + * @return the DataLakeStorageErrorError object itself. + */ + public DataLakeStorageErrorError message(String message) { + this.message = message; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorException.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorException.java new file mode 100644 index 000000000000..da3d592a3e0d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorException.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpResponse; + +/** + * Exception thrown for an invalid response with DataLakeStorageError information. + */ +public final class DataLakeStorageErrorException extends HttpResponseException { + /** + * Initializes a new instance of the DataLakeStorageErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public DataLakeStorageErrorException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the DataLakeStorageErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public DataLakeStorageErrorException(String message, HttpResponse response, DataLakeStorageError value) { + super(message, response, value); + } + + @Override + public DataLakeStorageError value() { + return (DataLakeStorageError) super.value(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryCreateHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryCreateHeaders.java new file mode 100644 index 000000000000..fc9f5eeaf9d2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryCreateHeaders.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for Create operation. + */ +@JacksonXmlRootElement(localName = "Directory-Create-Headers") +@Fluent +public final class DirectoryCreateHeaders { + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * The size of the resource in bytes. + */ + @JsonProperty(value = "Content-Length") + private Long contentLength; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders eTag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the contentLength property: The size of the resource in bytes. + * + * @return the contentLength value. + */ + public Long contentLength() { + return this.contentLength; + } + + /** + * Set the contentLength property: The size of the resource in bytes. + * + * @param contentLength the contentLength value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders contentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryDeleteHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryDeleteHeaders.java new file mode 100644 index 000000000000..921df9072945 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryDeleteHeaders.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for Delete operation. + */ +@JacksonXmlRootElement(localName = "Directory-Delete-Headers") +@Fluent +public final class DirectoryDeleteHeaders { + /* + * When renaming a directory, the number of paths that are renamed with + * each invocation is limited. If the number of paths to be renamed exceeds + * this limit, a continuation token is returned in this response header. + * When a continuation token is returned in the response, it must be + * specified in a subsequent invocation of the rename operation to continue + * renaming the directory. + */ + @JsonProperty(value = "x-ms-continuation") + private String marker; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /** + * Get the marker property: When renaming a directory, the number of paths + * that are renamed with each invocation is limited. If the number of paths + * to be renamed exceeds this limit, a continuation token is returned in + * this response header. When a continuation token is returned in the + * response, it must be specified in a subsequent invocation of the rename + * operation to continue renaming the directory. + * + * @return the marker value. + */ + public String marker() { + return this.marker; + } + + /** + * Set the marker property: When renaming a directory, the number of paths + * that are renamed with each invocation is limited. If the number of paths + * to be renamed exceeds this limit, a continuation token is returned in + * this response header. When a continuation token is returned in the + * response, it must be specified in a subsequent invocation of the rename + * operation to continue renaming the directory. + * + * @param marker the marker value to set. + * @return the DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders marker(String marker) { + this.marker = marker; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryGetAccessControlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryGetAccessControlHeaders.java new file mode 100644 index 000000000000..140df9c04696 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryGetAccessControlHeaders.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for GetAccessControl operation. + */ +@JacksonXmlRootElement(localName = "Directory-GetAccessControl-Headers") +@Fluent +public final class DirectoryGetAccessControlHeaders { + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * The owner of the file or directory. Included in the response if + * Hierarchical Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-owner") + private String xMsOwner; + + /* + * The owning group of the file or directory. Included in the response if + * Hierarchical Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-group") + private String xMsGroup; + + /* + * The POSIX access permissions for the file owner, the file owning group, + * and others. Included in the response if Hierarchical Namespace is + * enabled for the account. + */ + @JsonProperty(value = "x-ms-permissions") + private String xMsPermissions; + + /* + * The POSIX access control list for the file or directory. Included in + * the response only if the action is "getAccessControl" and Hierarchical + * Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-acl") + private String xMsAcl; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders eTag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsOwner property: The owner of the file or directory. Included + * in the response if Hierarchical Namespace is enabled for the account. + * + * @return the xMsOwner value. + */ + public String xMsOwner() { + return this.xMsOwner; + } + + /** + * Set the xMsOwner property: The owner of the file or directory. Included + * in the response if Hierarchical Namespace is enabled for the account. + * + * @param xMsOwner the xMsOwner value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders xMsOwner(String xMsOwner) { + this.xMsOwner = xMsOwner; + return this; + } + + /** + * Get the xMsGroup property: The owning group of the file or directory. + * Included in the response if Hierarchical Namespace is enabled for the + * account. + * + * @return the xMsGroup value. + */ + public String xMsGroup() { + return this.xMsGroup; + } + + /** + * Set the xMsGroup property: The owning group of the file or directory. + * Included in the response if Hierarchical Namespace is enabled for the + * account. + * + * @param xMsGroup the xMsGroup value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders xMsGroup(String xMsGroup) { + this.xMsGroup = xMsGroup; + return this; + } + + /** + * Get the xMsPermissions property: The POSIX access permissions for the + * file owner, the file owning group, and others. Included in the response + * if Hierarchical Namespace is enabled for the account. + * + * @return the xMsPermissions value. + */ + public String xMsPermissions() { + return this.xMsPermissions; + } + + /** + * Set the xMsPermissions property: The POSIX access permissions for the + * file owner, the file owning group, and others. Included in the response + * if Hierarchical Namespace is enabled for the account. + * + * @param xMsPermissions the xMsPermissions value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders xMsPermissions(String xMsPermissions) { + this.xMsPermissions = xMsPermissions; + return this; + } + + /** + * Get the xMsAcl property: The POSIX access control list for the file or + * directory. Included in the response only if the action is + * "getAccessControl" and Hierarchical Namespace is enabled for the + * account. + * + * @return the xMsAcl value. + */ + public String xMsAcl() { + return this.xMsAcl; + } + + /** + * Set the xMsAcl property: The POSIX access control list for the file or + * directory. Included in the response only if the action is + * "getAccessControl" and Hierarchical Namespace is enabled for the + * account. + * + * @param xMsAcl the xMsAcl value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders xMsAcl(String xMsAcl) { + this.xMsAcl = xMsAcl; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryHttpHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryHttpHeaders.java new file mode 100644 index 000000000000..ae0dd3997576 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryHttpHeaders.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Additional parameters for a set of operations, such as: Directorys_create, + * Directorys_rename, Blobs_rename. + */ +@JacksonXmlRootElement(localName = "directory-http-headers") +@Fluent +public final class DirectoryHttpHeaders { + /* + * Cache control for given resource + */ + @JsonProperty(value = "cacheControl") + private String cacheControl; + + /* + * Content type for given resource + */ + @JsonProperty(value = "contentType") + private String contentType; + + /* + * Content encoding for given resource + */ + @JsonProperty(value = "contentEncoding") + private String contentEncoding; + + /* + * Content language for given resource + */ + @JsonProperty(value = "contentLanguage") + private String contentLanguage; + + /* + * Content disposition for given resource + */ + @JsonProperty(value = "contentDisposition") + private String contentDisposition; + + /** + * Get the cacheControl property: Cache control for given resource. + * + * @return the cacheControl value. + */ + public String cacheControl() { + return this.cacheControl; + } + + /** + * Set the cacheControl property: Cache control for given resource. + * + * @param cacheControl the cacheControl value to set. + * @return the DirectoryHttpHeaders object itself. + */ + public DirectoryHttpHeaders cacheControl(String cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get the contentType property: Content type for given resource. + * + * @return the contentType value. + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType property: Content type for given resource. + * + * @param contentType the contentType value to set. + * @return the DirectoryHttpHeaders object itself. + */ + public DirectoryHttpHeaders contentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the contentEncoding property: Content encoding for given resource. + * + * @return the contentEncoding value. + */ + public String contentEncoding() { + return this.contentEncoding; + } + + /** + * Set the contentEncoding property: Content encoding for given resource. + * + * @param contentEncoding the contentEncoding value to set. + * @return the DirectoryHttpHeaders object itself. + */ + public DirectoryHttpHeaders contentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + + /** + * Get the contentLanguage property: Content language for given resource. + * + * @return the contentLanguage value. + */ + public String contentLanguage() { + return this.contentLanguage; + } + + /** + * Set the contentLanguage property: Content language for given resource. + * + * @param contentLanguage the contentLanguage value to set. + * @return the DirectoryHttpHeaders object itself. + */ + public DirectoryHttpHeaders contentLanguage(String contentLanguage) { + this.contentLanguage = contentLanguage; + return this; + } + + /** + * Get the contentDisposition property: Content disposition for given + * resource. + * + * @return the contentDisposition value. + */ + public String contentDisposition() { + return this.contentDisposition; + } + + /** + * Set the contentDisposition property: Content disposition for given + * resource. + * + * @param contentDisposition the contentDisposition value to set. + * @return the DirectoryHttpHeaders object itself. + */ + public DirectoryHttpHeaders contentDisposition(String contentDisposition) { + this.contentDisposition = contentDisposition; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryRenameHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryRenameHeaders.java new file mode 100644 index 000000000000..365780542a9c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryRenameHeaders.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for Rename operation. + */ +@JacksonXmlRootElement(localName = "Directory-Rename-Headers") +@Fluent +public final class DirectoryRenameHeaders { + /* + * When renaming a directory, the number of paths that are renamed with + * each invocation is limited. If the number of paths to be renamed exceeds + * this limit, a continuation token is returned in this response header. + * When a continuation token is returned in the response, it must be + * specified in a subsequent invocation of the rename operation to continue + * renaming the directory. + */ + @JsonProperty(value = "x-ms-continuation") + private String marker; + + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * The size of the resource in bytes. + */ + @JsonProperty(value = "Content-Length") + private Long contentLength; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /** + * Get the marker property: When renaming a directory, the number of paths + * that are renamed with each invocation is limited. If the number of paths + * to be renamed exceeds this limit, a continuation token is returned in + * this response header. When a continuation token is returned in the + * response, it must be specified in a subsequent invocation of the rename + * operation to continue renaming the directory. + * + * @return the marker value. + */ + public String marker() { + return this.marker; + } + + /** + * Set the marker property: When renaming a directory, the number of paths + * that are renamed with each invocation is limited. If the number of paths + * to be renamed exceeds this limit, a continuation token is returned in + * this response header. When a continuation token is returned in the + * response, it must be specified in a subsequent invocation of the rename + * operation to continue renaming the directory. + * + * @param marker the marker value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders marker(String marker) { + this.marker = marker; + return this; + } + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders eTag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the contentLength property: The size of the resource in bytes. + * + * @return the contentLength value. + */ + public Long contentLength() { + return this.contentLength; + } + + /** + * Set the contentLength property: The size of the resource in bytes. + * + * @param contentLength the contentLength value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders contentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorySetAccessControlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorySetAccessControlHeaders.java new file mode 100644 index 000000000000..0441781e4bba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorySetAccessControlHeaders.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for SetAccessControl operation. + */ +@JacksonXmlRootElement(localName = "Directory-SetAccessControl-Headers") +@Fluent +public final class DirectorySetAccessControlHeaders { + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders eTag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysCreateResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysCreateResponse.java new file mode 100644 index 000000000000..884c526dda38 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysCreateResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the create operation. + */ +public final class DirectorysCreateResponse extends ResponseBase { + /** + * Creates an instance of DirectorysCreateResponse. + * + * @param request the request which resulted in this DirectorysCreateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysCreateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryCreateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysDeleteResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysDeleteResponse.java new file mode 100644 index 000000000000..6e3c9d532875 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysDeleteResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the delete operation. + */ +public final class DirectorysDeleteResponse extends ResponseBase { + /** + * Creates an instance of DirectorysDeleteResponse. + * + * @param request the request which resulted in this DirectorysDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysDeleteResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysGetAccessControlResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysGetAccessControlResponse.java new file mode 100644 index 000000000000..6104b8c9afa7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysGetAccessControlResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the getAccessControl operation. + */ +public final class DirectorysGetAccessControlResponse extends ResponseBase { + /** + * Creates an instance of DirectorysGetAccessControlResponse. + * + * @param request the request which resulted in this DirectorysGetAccessControlResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysGetAccessControlResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryGetAccessControlHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysRenameResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysRenameResponse.java new file mode 100644 index 000000000000..afea46a8180b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysRenameResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the rename operation. + */ +public final class DirectorysRenameResponse extends ResponseBase { + /** + * Creates an instance of DirectorysRenameResponse. + * + * @param request the request which resulted in this DirectorysRenameResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysRenameResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryRenameHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysSetAccessControlResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysSetAccessControlResponse.java new file mode 100644 index 000000000000..3395f9a2a10b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysSetAccessControlResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the setAccessControl operation. + */ +public final class DirectorysSetAccessControlResponse extends ResponseBase { + /** + * Creates an instance of DirectorysSetAccessControlResponse. + * + * @param request the request which resulted in this DirectorysSetAccessControlResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysSetAccessControlResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectorySetAccessControlHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsItem.java new file mode 100644 index 000000000000..477c3efb3f87 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsItem.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * The FilterBlobsItem model. + */ +@JacksonXmlRootElement(localName = "Blob") +@Fluent +public final class FilterBlobsItem { + /* + * The name property. + */ + @JsonProperty(value = "Name") + private String name; + + /* + * The containerName property. + */ + @JsonProperty(value = "ContainerName") + private String containerName; + + /* + * The tagValue property. + */ + @JsonProperty(value = "TagValue") + private String tagValue; + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the FilterBlobsItem object itself. + */ + public FilterBlobsItem name(String name) { + this.name = name; + return this; + } + + /** + * Get the containerName property: The containerName property. + * + * @return the containerName value. + */ + public String containerName() { + return this.containerName; + } + + /** + * Set the containerName property: The containerName property. + * + * @param containerName the containerName value to set. + * @return the FilterBlobsItem object itself. + */ + public FilterBlobsItem containerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the tagValue property: The tagValue property. + * + * @return the tagValue value. + */ + public String tagValue() { + return this.tagValue; + } + + /** + * Set the tagValue property: The tagValue property. + * + * @param tagValue the tagValue value to set. + * @return the FilterBlobsItem object itself. + */ + public FilterBlobsItem tagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsResponse.java new file mode 100644 index 000000000000..df691b96b781 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsResponse.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * An enumeration of blobs which matched the filter. + */ +@JacksonXmlRootElement(localName = "EnumerationResults") +@Fluent +public final class FilterBlobsResponse { + /* + * The serviceEndpoint property. + */ + @JacksonXmlProperty(localName = "ServiceEndpoint", isAttribute = true) + private String serviceEndpoint; + + /* + * The filter property. + */ + @JsonProperty(value = "Filter", required = true) + private String filter; + + /* + * The marker property. + */ + @JsonProperty(value = "Marker") + private String marker; + + /* + * The maxResults property. + */ + @JsonProperty(value = "MaxResults") + private Integer maxResults; + + /* + * The segment property. + */ + @JsonProperty(value = "Blobs", required = true) + private FilterBlobsSegment segment; + + /* + * The nextMarker property. + */ + @JsonProperty(value = "NextMarker", required = true) + private String nextMarker; + + /** + * Get the serviceEndpoint property: The serviceEndpoint property. + * + * @return the serviceEndpoint value. + */ + public String serviceEndpoint() { + return this.serviceEndpoint; + } + + /** + * Set the serviceEndpoint property: The serviceEndpoint property. + * + * @param serviceEndpoint the serviceEndpoint value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse serviceEndpoint(String serviceEndpoint) { + this.serviceEndpoint = serviceEndpoint; + return this; + } + + /** + * Get the filter property: The filter property. + * + * @return the filter value. + */ + public String filter() { + return this.filter; + } + + /** + * Set the filter property: The filter property. + * + * @param filter the filter value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse filter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the marker property: The marker property. + * + * @return the marker value. + */ + public String marker() { + return this.marker; + } + + /** + * Set the marker property: The marker property. + * + * @param marker the marker value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse marker(String marker) { + this.marker = marker; + return this; + } + + /** + * Get the maxResults property: The maxResults property. + * + * @return the maxResults value. + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maxResults property: The maxResults property. + * + * @param maxResults the maxResults value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse maxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the segment property: The segment property. + * + * @return the segment value. + */ + public FilterBlobsSegment segment() { + return this.segment; + } + + /** + * Set the segment property: The segment property. + * + * @param segment the segment value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse segment(FilterBlobsSegment segment) { + this.segment = segment; + return this; + } + + /** + * Get the nextMarker property: The nextMarker property. + * + * @return the nextMarker value. + */ + public String nextMarker() { + return this.nextMarker; + } + + /** + * Set the nextMarker property: The nextMarker property. + * + * @param nextMarker the nextMarker value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse nextMarker(String nextMarker) { + this.nextMarker = nextMarker; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsSegment.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsSegment.java new file mode 100644 index 000000000000..c4daa8b128f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsSegment.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.util.ArrayList; +import java.util.List; + +/** + * The FilterBlobsSegment model. + */ +@JacksonXmlRootElement(localName = "Blobs") +@Fluent +public final class FilterBlobsSegment { + /* + * The blobItems property. + */ + @JsonProperty("Blob") + private List blobItems = new ArrayList<>(); + + /** + * Get the blobItems property: The blobItems property. + * + * @return the blobItems value. + */ + public List blobItems() { + return this.blobItems; + } + + /** + * Set the blobItems property: The blobItems property. + * + * @param blobItems the blobItems value to set. + * @return the FilterBlobsSegment object itself. + */ + public FilterBlobsSegment blobItems(List blobItems) { + this.blobItems = blobItems; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java index 543c829bf271..c5c125eda749 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java @@ -41,12 +41,27 @@ public final class PageBlobClearPagesHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + /* * The current sequence number for the page blob. */ @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -156,6 +171,32 @@ public PageBlobClearPagesHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] xMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the PageBlobClearPagesHeaders object itself. + */ + public PageBlobClearPagesHeaders xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the blobSequenceNumber property: The current sequence number for the * page blob. @@ -178,6 +219,30 @@ public PageBlobClearPagesHeaders blobSequenceNumber(Long blobSequenceNumber) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobClearPagesHeaders object itself. + */ + public PageBlobClearPagesHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java index 7e9aa95c1ff3..2447b0c346b0 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java @@ -32,6 +32,13 @@ public final class PageBlobCopyIncrementalHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -132,6 +139,30 @@ public PageBlobCopyIncrementalHeaders lastModified(OffsetDateTime lastModified) return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobCopyIncrementalHeaders object itself. + */ + public PageBlobCopyIncrementalHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java index 6c4192fe4806..e328ff04f5d8 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java @@ -41,6 +41,13 @@ public final class PageBlobCreateHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -56,14 +63,6 @@ public final class PageBlobCreateHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -174,6 +173,30 @@ public PageBlobCreateHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobCreateHeaders object itself. + */ + public PageBlobCreateHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. @@ -220,30 +243,6 @@ public PageBlobCreateHeaders version(String version) { return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java index c1d14635bf44..da04c9aff1b9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java @@ -38,6 +38,13 @@ public final class PageBlobGetPageRangesDiffHeaders { @JsonProperty(value = "x-ms-blob-content-length") private Long blobContentLength; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -143,6 +150,30 @@ public PageBlobGetPageRangesDiffHeaders blobContentLength(Long blobContentLength return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobGetPageRangesDiffHeaders object itself. + */ + public PageBlobGetPageRangesDiffHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java index 32b37ef1452c..90a9a9add17d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java @@ -38,6 +38,13 @@ public final class PageBlobGetPageRangesHeaders { @JsonProperty(value = "x-ms-blob-content-length") private Long blobContentLength; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -143,6 +150,30 @@ public PageBlobGetPageRangesHeaders blobContentLength(Long blobContentLength) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobGetPageRangesHeaders object itself. + */ + public PageBlobGetPageRangesHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java index e03c8720d2b6..43470469598d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java @@ -39,6 +39,13 @@ public final class PageBlobResizeHeaders { @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -146,6 +153,30 @@ public PageBlobResizeHeaders blobSequenceNumber(Long blobSequenceNumber) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobResizeHeaders object itself. + */ + public PageBlobResizeHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java index 5f606b24c262..52a2b49532c9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java @@ -39,6 +39,13 @@ public final class PageBlobUpdateSequenceNumberHeaders { @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -146,6 +153,30 @@ public PageBlobUpdateSequenceNumberHeaders blobSequenceNumber(Long blobSequenceN return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobUpdateSequenceNumberHeaders object itself. + */ + public PageBlobUpdateSequenceNumberHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java index cebeb20842e3..d80a0eb276cd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java @@ -41,6 +41,14 @@ public final class PageBlobUploadPagesFromURLHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + /* * The current sequence number for the page blob. */ @@ -164,6 +172,32 @@ public PageBlobUploadPagesFromURLHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] xMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the PageBlobUploadPagesFromURLHeaders object itself. + */ + public PageBlobUploadPagesFromURLHeaders xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the blobSequenceNumber property: The current sequence number for the * page blob. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java index 7dd8eb12ae72..ba8fd9bb8a86 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java @@ -41,12 +41,27 @@ public final class PageBlobUploadPagesHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + /* * The current sequence number for the page blob. */ @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -172,6 +187,32 @@ public PageBlobUploadPagesHeaders contentMD5(byte[] contentMD5) { return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] xMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the PageBlobUploadPagesHeaders object itself. + */ + public PageBlobUploadPagesHeaders xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the blobSequenceNumber property: The current sequence number for the * page blob. @@ -194,6 +235,30 @@ public PageBlobUploadPagesHeaders blobSequenceNumber(Long blobSequenceNumber) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobUploadPagesHeaders object itself. + */ + public PageBlobUploadPagesHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PathRenameMode.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PathRenameMode.java new file mode 100644 index 000000000000..a63e11af27c3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PathRenameMode.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PathRenameMode. + */ +public enum PathRenameMode { + /** + * Enum value legacy. + */ + LEGACY("legacy"), + + /** + * Enum value posix. + */ + POSIX("posix"); + + /** + * The actual serialized value for a PathRenameMode instance. + */ + private final String value; + + PathRenameMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PathRenameMode instance. + * + * @param value the serialized value to parse. + * @return the parsed PathRenameMode object, or null if unable to parse. + */ + @JsonCreator + public static PathRenameMode fromString(String value) { + PathRenameMode[] items = PathRenameMode.values(); + for (PathRenameMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RehydratePriority.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RehydratePriority.java new file mode 100644 index 000000000000..8fc928767f37 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RehydratePriority.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Defines values for RehydratePriority. + */ +public final class RehydratePriority extends ExpandableStringEnum { + /** + * Static value High for RehydratePriority. + */ + public static final RehydratePriority HIGH = fromString("High"); + + /** + * Static value Standard for RehydratePriority. + */ + public static final RehydratePriority STANDARD = fromString("Standard"); + + /** + * Creates or finds a RehydratePriority from its string representation. + * + * @param name a name to look for. + * @return the corresponding RehydratePriority. + */ + @JsonCreator + public static RehydratePriority fromString(String name) { + return fromString(name, RehydratePriority.class); + } + + /** + * @return known RehydratePriority values. + */ + public static Collection values() { + return values(RehydratePriority.class); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceFilterBlobsHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceFilterBlobsHeaders.java new file mode 100644 index 000000000000..ca07c5d37ffb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceFilterBlobsHeaders.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for FilterBlobs operation. + */ +@JacksonXmlRootElement(localName = "Service-FilterBlobs-Headers") +@Fluent +public final class ServiceFilterBlobsHeaders { + /* + * The media type of the body of the response. For Filter Blobs this is + * 'application/xml' + */ + @JsonProperty(value = "Content-Type") + private String contentType; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the Blob service used to execute the request. + * This header is returned for requests made against version 2009-09-19 and + * above. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * UTC date/time value generated by the service that indicates the time at + * which the response was initiated + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the contentType property: The media type of the body of the + * response. For Filter Blobs this is 'application/xml'. + * + * @return the contentType value. + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType property: The media type of the body of the + * response. For Filter Blobs this is 'application/xml'. + * + * @param contentType the contentType value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders contentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @param version the version value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java index 88fa50830518..aab5284aa123 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Service-GetAccountInfo-Headers") @Fluent public final class ServiceGetAccountInfoHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -59,6 +66,30 @@ public final class ServiceGetAccountInfoHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceGetAccountInfoHeaders object itself. + */ + public ServiceGetAccountInfoHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java index 3b5b06ab3259..4fec9f3c872d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java @@ -14,6 +14,13 @@ @JacksonXmlRootElement(localName = "Service-GetProperties-Headers") @Fluent public final class ServiceGetPropertiesHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -35,6 +42,30 @@ public final class ServiceGetPropertiesHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceGetPropertiesHeaders object itself. + */ + public ServiceGetPropertiesHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java index 55dda9cc8ddb..a10d852f62cd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Service-GetStatistics-Headers") @Fluent public final class ServiceGetStatisticsHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,6 +51,30 @@ public final class ServiceGetStatisticsHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceGetStatisticsHeaders object itself. + */ + public ServiceGetStatisticsHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java index 4a74086587af..f10866c90c55 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Service-GetUserDelegationKey-Headers") @Fluent public final class ServiceGetUserDelegationKeyHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,6 +51,30 @@ public final class ServiceGetUserDelegationKeyHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceGetUserDelegationKeyHeaders object itself. + */ + public ServiceGetUserDelegationKeyHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java index 94908506ede7..93e1c98ec97a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java @@ -14,6 +14,13 @@ @JacksonXmlRootElement(localName = "Service-ListContainersSegment-Headers") @Fluent public final class ServiceListContainersSegmentHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -35,6 +42,30 @@ public final class ServiceListContainersSegmentHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceListContainersSegmentHeaders object itself. + */ + public ServiceListContainersSegmentHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java index df15cc766400..b7ea86bc9fdb 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java @@ -14,6 +14,13 @@ @JacksonXmlRootElement(localName = "Service-SetProperties-Headers") @Fluent public final class ServiceSetPropertiesHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -35,6 +42,30 @@ public final class ServiceSetPropertiesHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceSetPropertiesHeaders object itself. + */ + public ServiceSetPropertiesHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSubmitBatchHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSubmitBatchHeaders.java new file mode 100644 index 000000000000..3272610cb688 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSubmitBatchHeaders.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Defines headers for SubmitBatch operation. + */ +@JacksonXmlRootElement(localName = "Service-SubmitBatch-Headers") +@Fluent +public final class ServiceSubmitBatchHeaders { + /* + * The media type of the body of the response. For batch requests, this is + * ' multipart/mixed; boundary=batchresponse_' + */ + @JsonProperty(value = "Content-Type") + private String contentType; + + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the Blob service used to execute the request. + * This header is returned for requests made against version 2009-09-19 and + * above. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the contentType property: The media type of the body of the + * response. For batch requests, this is ' multipart/mixed; + * boundary=batchresponse_<GUID>'. + * + * @return the contentType value. + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType property: The media type of the body of the + * response. For batch requests, this is ' multipart/mixed; + * boundary=batchresponse_<GUID>'. + * + * @param contentType the contentType value to set. + * @return the ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders contentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @param version the version value to set. + * @return the ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesFilterBlobsResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesFilterBlobsResponse.java new file mode 100644 index 000000000000..1ab8de38f430 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesFilterBlobsResponse.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the filterBlobs operation. + */ +public final class ServicesFilterBlobsResponse extends ResponseBase { + /** + * Creates an instance of ServicesFilterBlobsResponse. + * + * @param request the request which resulted in this ServicesFilterBlobsResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ServicesFilterBlobsResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, FilterBlobsResponse value, ServiceFilterBlobsHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * @return the deserialized response body. + */ + @Override + public FilterBlobsResponse value() { + return super.value(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesSubmitBatchResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesSubmitBatchResponse.java new file mode 100644 index 000000000000..0174e9e0a467 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesSubmitBatchResponse.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import java.io.Closeable; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; + +/** + * Contains all response data for the submitBatch operation. + */ +public final class ServicesSubmitBatchResponse extends ResponseBase> implements Closeable { + /** + * Creates an instance of ServicesSubmitBatchResponse. + * + * @param request the request which resulted in this ServicesSubmitBatchResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the content stream. + * @param headers the deserialized headers of the HTTP response. + */ + public ServicesSubmitBatchResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Flux value, ServiceSubmitBatchHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * @return the response content stream. + */ + @Override + public Flux value() { + return super.value(); + } + + /** + * Disposes of the connection associated with this stream response. + */ + @Override + public void close() { + value().subscribe(bb -> { }, t -> { }).dispose(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageError.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageError.java index 2f8f01f4f6f9..34b97f155d7d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageError.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageError.java @@ -14,38 +14,12 @@ @JacksonXmlRootElement(localName = "StorageError") @Fluent public final class StorageError { - /* - * The code property. - */ - @JsonProperty(value = "Code") - private String code; - /* * The message property. */ @JsonProperty(value = "Message") private String message; - /** - * Get the code property: The code property. - * - * @return the code value. - */ - public String code() { - return this.code; - } - - /** - * Set the code property: The code property. - * - * @param code the code value to set. - * @return the StorageError object itself. - */ - public StorageError code(String code) { - this.code = code; - return this; - } - /** * Get the message property: The message property. * diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageException.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageException.java new file mode 100644 index 000000000000..d444af92d6e8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageException.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.models; + +import com.azure.core.exception.HttpResponseException; + +/** + * A {@code StorageException} 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 StorageException}. 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 StorageException extends HttpResponseException { + private static final String ERROR_CODE = "x-ms-error-code"; + + private final StorageErrorCode errorCode; + private final String message; + + public StorageException(StorageErrorException e, String responseBody) { + super(e.getMessage(), e.response(), e); + this.errorCode = StorageErrorCode.fromString(e.response().headers().value(ERROR_CODE)); + this.message = responseBody; + } + + /** + * @return The error code returned by the service. + */ + public StorageErrorCode errorCode() { + return this.errorCode; + } + + /** + * @return The message returned by the service. + */ + public String serviceMessage() { + return this.message; + } + + /** + * @return The status code on the response. + */ + public int statusCode() { + return super.response().statusCode(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Tag.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Tag.java new file mode 100644 index 000000000000..121da3ef84ba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Tag.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Represents a single user-provided tag. + */ +@JacksonXmlRootElement(localName = "Tag") +@Fluent +public final class Tag { + /* + * The tag name. + */ + @JsonProperty(value = "Key", required = true) + private String key; + + /* + * The tag value. + */ + @JsonProperty(value = "Value", required = true) + private String value; + + /** + * Get the key property: The tag name. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: The tag name. + * + * @param key the key value to set. + * @return the Tag object itself. + */ + public Tag key(String key) { + this.key = key; + return this; + } + + /** + * Get the value property: The tag value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The tag value. + * + * @param value the value value to set. + * @return the Tag object itself. + */ + public Tag value(String value) { + this.value = value; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java index 40794a0b9c6f..032fb01a62b6 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java @@ -36,7 +36,7 @@ public static void main(String[] args) { .buildClient(); System.out.println("Successfully setup client using the Azure Identity, please check the service version: " - + storageClient.getProperties().value().defaultServiceVersion()); + + storageClient.getProperties().defaultServiceVersion()); } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java index c47e753b3f07..b8292104ffa5 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Locale; /** @@ -72,7 +72,7 @@ public static void main(String[] args) throws IOException { BlockBlobClient blobClient = containerClient.getBlockBlobClient("HelloWorld.txt"); String data = "Hello world!"; - InputStream dataStream = new ByteArrayInputStream(data.getBytes()); + InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)); /* * Create the blob with string (plain text) content. @@ -84,15 +84,15 @@ public static void main(String[] args) throws IOException { /* * Download the blob's content to output stream. */ - int dataSize = (int) blobClient.getProperties().value().blobSize(); - OutputStream outputStream = new ByteArrayOutputStream(dataSize); + int dataSize = (int) blobClient.getProperties().blobSize(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(dataSize); blobClient.download(outputStream); outputStream.close(); /* * Verify that the blob data round-tripped correctly. */ - if (!data.equals(outputStream.toString())) { + if (!data.equals(new String(outputStream.toByteArray(), StandardCharsets.UTF_8))) { throw new RuntimeException("The downloaded data does not match the uploaded data."); } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java index 54d5bc091850..bbb950166186 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java @@ -36,81 +36,47 @@ public class BlobAsyncClientJavaDocCodeSnippets { */ public void existsCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.exists - client.exists().subscribe(response -> System.out.printf("Exists? %b%n", response.value())); + client.exists().subscribe(response -> System.out.printf("Exists? %b%n", response)); // END: com.azure.storage.blob.BlobAsyncClient.exists } /** - * Code snippets for {@link BlobAsyncClient#startCopyFromURL(URL)} and - * {@link BlobAsyncClient#startCopyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#startCopyFromURL(URL)} */ - public void startCopyFromURL() { + public void startCopyFromURLCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL client.startCopyFromURL(url) - .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions - Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); - BlobAccessConditions blobAccessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.startCopyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions) - .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#abortCopyFromURL(String)} and - * {@link BlobAsyncClient#abortCopyFromURL(String, LeaseAccessConditions)} + * Code snippets for {@link BlobAsyncClient#abortCopyFromURL(String)} */ - public void abortCopyFromURL() { + public void abortCopyFromURLCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String - client.abortCopyFromURL(copyId) - .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.statusCode())); + client.abortCopyFromURL(copyId).doOnSuccess(response -> System.out.println("Aborted copy from URL")); // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions - LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().leaseId(leaseId); - client.abortCopyFromURL(copyId, leaseAccessConditions) - .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#copyFromURL(URL)} and - * {@link BlobAsyncClient#copyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#copyFromURL(URL)} */ - public void copyFromURL() { + public void copyFromURLCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL - client.copyFromURL(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + client.copyFromURL(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); // END: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions - Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); - BlobAccessConditions blobAccessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.copyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions) - .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#download()} and - * {@link BlobAsyncClient#download(BlobRange, ReliableDownloadOptions, BlobAccessConditions, boolean)} - * + * Code snippets for {@link BlobAsyncClient#download()} * @throws UncheckedIOException If an I/O error occurs */ - public void download() { + public void downloadCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.download client.download().subscribe(response -> { ByteArrayOutputStream downloadData = new ByteArrayOutputStream(); - response.value().subscribe(piece -> { + response.subscribe(piece -> { try { downloadData.write(piece.array()); } catch (IOException ex) { @@ -124,7 +90,7 @@ public void download() { BlobRange range = new BlobRange(1024, 2048L); ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); - client.download(range, options, null, false).subscribe(response -> { + client.downloadWithResponse(range, options, null, false).subscribe(response -> { ByteArrayOutputStream downloadData = new ByteArrayOutputStream(); response.value().subscribe(piece -> { try { @@ -141,7 +107,7 @@ public void download() { * Code snippets for {@link BlobAsyncClient#downloadToFile(String)} and * {@link BlobAsyncClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean)} */ - public void downloadToFile() { + public void downloadToFileCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String client.downloadToFile(file).subscribe(response -> System.out.println("Completed download to file")); // END: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String @@ -156,237 +122,390 @@ public void downloadToFile() { } /** - * Code snippets for {@link BlobAsyncClient#delete()} and - * {@link BlobAsyncClient#delete(DeleteSnapshotsOptionType, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#delete()} */ - public void delete() { + public void deleteCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.delete - client.delete() - .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.statusCode())); + client.delete().doOnSuccess(response -> System.out.println("Completed delete")); // END: com.azure.storage.blob.BlobAsyncClient.delete - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions - client.delete(DeleteSnapshotsOptionType.INCLUDE, null) - .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#getProperties()} and - * {@link BlobAsyncClient#getProperties(BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#getProperties()} */ - public void getProperties() { + public void getPropertiesCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.getProperties client.getProperties().subscribe(response -> - System.out.printf("Type: %s, Size: %d%n", response.value().blobType(), response.value().blobSize())); + System.out.printf("Type: %s, Size: %d%n", response.blobType(), response.blobSize())); // END: com.azure.storage.blob.BlobAsyncClient.getProperties - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.getProperties(accessConditions).subscribe(response -> - System.out.printf("Type: %s, Size: %d%n", response.value().blobType(), response.value().blobSize())); - // END: com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders)} and - * {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders)} */ - public void setHTTPHeaders() { + public void setHTTPHeadersCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders client.setHTTPHeaders(new BlobHTTPHeaders() .blobContentLanguage("en-US") - .blobContentType("binary")).subscribe(response -> - System.out.printf("Set HTTP headers completed with status %d%n", response.statusCode())); + .blobContentType("binary")); // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.setHTTPHeaders(new BlobHTTPHeaders() - .blobContentLanguage("en-US") - .blobContentType("binary"), accessConditions).subscribe(response -> - System.out.printf("Set HTTP headers completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#setMetadata(Metadata)} and - * {@link BlobAsyncClient#setMetadata(Metadata, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#setMetadata(Metadata)} */ - public void setMetadata() { + public void setMetadataCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata - client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))) - .subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.statusCode())); + client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))); // END: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value")), accessConditions) - .subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#createSnapshot()} and - * {@link BlobAsyncClient#createSnapshot(Metadata, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#createSnapshot()} */ - public void createSnapshot() { + public void createSnapshotCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshot client.createSnapshot() .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", - response.value().getSnapshotId())); + response.getSnapshotId())); // END: com.azure.storage.blob.BlobAsyncClient.createSnapshot - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions - Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.createSnapshot(snapshotMetadata, accessConditions) - .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", - response.value().getSnapshotId())); - // END: com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#setTier(AccessTier)} and - * {@link BlobAsyncClient#setTier(AccessTier, LeaseAccessConditions)} + * Code snippets for {@link BlobAsyncClient#setTier(AccessTier)} */ - public void setTier() { + public void setTierCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier - client.setTier(AccessTier.HOT) - .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", response.statusCode())); + client.setTier(AccessTier.HOT); // END: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions - LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId); - - client.setTier(AccessTier.HOT, accessConditions) - .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions } /** * Code snippet for {@link BlobAsyncClient#undelete()} */ - public void undelete() { + public void undeleteCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.undelete - client.undelete() - .subscribe(response -> System.out.printf("Undelete completed with status %d%n", response.statusCode())); + client.undelete().doOnSuccess(response -> System.out.println("Completed undelete")); // END: com.azure.storage.blob.BlobAsyncClient.undelete } /** - * Code snippets for {@link BlobAsyncClient#acquireLease(String, int)} and - * {@link BlobAsyncClient#acquireLease(String, int, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#acquireLease(String, int)} */ - public void acquireLease() { + public void acquireLeaseCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int client.acquireLease("proposedId", 60) - .subscribe(response -> System.out.printf("Lease ID is %s%n", response.value())); + .subscribe(response -> System.out.printf("Lease ID is %s%n", response)); // END: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int + } + + /** + * Code snippets for {@link BlobAsyncClient#renewLease(String)} + */ + public void renewLeaseCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String + client.renewLease(leaseId) + .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response)); + // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String + } + + /** + * Code snippets for {@link BlobAsyncClient#releaseLease(String)} + */ + public void releaseLeaseCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String + client.releaseLease(leaseId).doOnSuccess(response -> System.out.println("Completed release lease")); + // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String + } + + /** + * Code snippets for {@link BlobAsyncClient#breakLease()} + */ + public void breakLeaseCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease + client.breakLease() + .subscribe(response -> + System.out.printf("The broken lease has %d seconds remaining on the lease", response)); + // END: com.azure.storage.blob.BlobAsyncClient.breakLease + } + + /** + * Code snippets for {@link BlobAsyncClient#changeLease(String, String)} + */ + public void changeLeaseCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String + client.changeLease(leaseId, "proposedId") + .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response)); + // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String + } - // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions + /** + * Code snippet for {@link BlobAsyncClient#getAccountInfo()} + */ + public void getAccountInfoCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + client.getAccountInfo().subscribe(response -> System.out.printf("Account Kind: %s, SKU: %s%n", + response.accountKind(), response.skuName())); + // END: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + } + + /** + * Code snippet for {@link BlobAsyncClient#existsWithResponse()} + */ + public void existsWithResponseCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.existsWithResponse + client.existsWithResponse().subscribe(response -> System.out.printf("Exists? %b%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.existsWithResponse + } + + /** + * Code snippets for {@link BlobAsyncClient#startCopyFromURLWithResponse(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + */ + public void startCopyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions() + .leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + client.startCopyFromURLWithResponse(url, metadata, modifiedAccessConditions, blobAccessConditions) + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#abortCopyFromURLWithResponse(String, LeaseAccessConditions)} + */ + public void abortCopyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions + LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().leaseId(leaseId); + client.abortCopyFromURLWithResponse(copyId, leaseAccessConditions) + .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#copyFromURLWithResponse(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + */ + public void copyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions() + .leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + client.copyFromURLWithResponse(url, metadata, modifiedAccessConditions, blobAccessConditions) + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); + // END: com.azure.storage.blob.BlobAsyncClient.copyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#downloadWithResponse(BlobRange, ReliableDownloadOptions, BlobAccessConditions, boolean)} + * @throws UncheckedIOException If an I/O error occurs + */ + public void downloadWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.downloadWithResponse#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean + BlobRange range = new BlobRange(1024, (long) 2048); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); + + client.downloadWithResponse(range, options, null, false).subscribe(response -> { + ByteArrayOutputStream downloadData = new ByteArrayOutputStream(); + response.value().subscribe(piece -> { + try { + downloadData.write(piece.array()); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + }); + }); + // END: com.azure.storage.blob.BlobAsyncClient.downloadWithResponse#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean + } + + /** + * Code snippets for {@link BlobAsyncClient#deleteWithResponse(DeleteSnapshotsOptionType, BlobAccessConditions)} + */ + public void deleteWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions + client.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, null) + .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#getPropertiesWithResponse(BlobAccessConditions)} + */ + public void getPropertiesWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getPropertiesWithResponse#BlobAccessConditions + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + client.getPropertiesWithResponse(accessConditions).subscribe( + response -> System.out.printf("Type: %s, Size: %d%n", response.value().blobType(), + response.value().blobSize())); + // END: com.azure.storage.blob.BlobAsyncClient.getPropertiesWithResponse#BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#setHTTPHeadersWithResponse(BlobHTTPHeaders, BlobAccessConditions)} + */ + public void setHTTPHeadersWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + client.setHTTPHeadersWithResponse(new BlobHTTPHeaders() + .blobContentLanguage("en-US") + .blobContentType("binary"), accessConditions).subscribe( + response -> + System.out.printf("Set HTTP headers completed with status %d%n", + response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#setMetadataWithResponse(Metadata, BlobAccessConditions)} + */ + public void setMetadataWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setMetadataWithResponse#Metadata-BlobAccessConditions + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + client.setMetadataWithResponse(new Metadata(Collections.singletonMap("metadata", "value")), accessConditions) + .subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setMetadataWithResponse#Metadata-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#createSnapshotWithResponse(Metadata, BlobAccessConditions)} + */ + public void createSnapshotWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshotWithResponse#Metadata-BlobAccessConditions + Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions().leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + client.createSnapshotWithResponse(snapshotMetadata, accessConditions) + .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.createSnapshotWithResponse#Metadata-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#setTierWithResponse(AccessTier, LeaseAccessConditions)} + */ + public void setTierWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTierWithResponse#AccessTier-LeaseAccessConditions + LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId); + + client.setTierWithResponse(AccessTier.HOT, accessConditions) + .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", + response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setTierWithResponse#AccessTier-LeaseAccessConditions + } + + /** + * Code snippet for {@link BlobAsyncClient#undeleteWithResponse()} + */ + public void undeleteWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.undeleteWithResponse + client.undeleteWithResponse() + .subscribe(response -> System.out.printf("Undelete completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.undeleteWithResponse + } + + /** + * Code snippets for {@link BlobAsyncClient#acquireLeaseWithResponse(String, int, ModifiedAccessConditions)} + */ + public void acquireLeaseWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifModifiedSince(OffsetDateTime.now().minusDays(3)); - client.acquireLease("proposedId", 60, modifiedAccessConditions) + client.acquireLeaseWithResponse("proposedId", 60, modifiedAccessConditions) .subscribe(response -> System.out.printf("Lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions + // END: com.azure.storage.blob.BlobAsyncClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#renewLease(String)} and - * {@link BlobAsyncClient#renewLease(String, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#renewLeaseWithResponse(String, ModifiedAccessConditions)} */ - public void renewLease() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String - client.renewLease(leaseId) - .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String + public void renewLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions + // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - client.renewLease(leaseId, modifiedAccessConditions) + client.renewLeaseWithResponse(leaseId, modifiedAccessConditions) .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions + // END: com.azure.storage.blob.BlobAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#releaseLease(String)} and - * {@link BlobAsyncClient#releaseLease(String, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#releaseLeaseWithResponse(String, ModifiedAccessConditions)} */ - public void releaseLease() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String - client.releaseLease(leaseId) - .subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions + public void releaseLeaseWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLeaseWithResponse#String-ModifiedAccessConditions ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - client.releaseLease(leaseId, modifiedAccessConditions) - .subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions + client.releaseLeaseWithResponse(leaseId, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Release lease completed with status %d%n", + response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.releaseLeaseWithResponse#String-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#breakLease()} and - * {@link BlobAsyncClient#breakLease(Integer, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#breakLeaseWithResponse(Integer, ModifiedAccessConditions)} */ - public void breakLease() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease - client.breakLease() - .subscribe(response -> - System.out.printf("The broken lease has %d seconds remaining on the lease", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.breakLease + public void breakLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions + // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions Integer retainLeaseInSeconds = 5; ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - client.breakLease(retainLeaseInSeconds, modifiedAccessConditions) + client.breakLeaseWithResponse(retainLeaseInSeconds, modifiedAccessConditions) .subscribe(response -> - System.out.printf("The broken lease has %d seconds remaining on the lease", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions + System.out.printf("The broken lease has %d seconds remaining on the lease", + response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#changeLease(String, String)} and - * {@link BlobAsyncClient#changeLease(String, String, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#changeLeaseWithResponse(String, String, ModifiedAccessConditions)} */ - public void changeLease() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String - client.changeLease(leaseId, "proposedId") - .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String + public void changeLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions + // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - client.changeLease(leaseId, "proposedId", modifiedAccessConditions) + client.changeLeaseWithResponse(leaseId, "proposedId", modifiedAccessConditions) .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions + // END: com.azure.storage.blob.BlobAsyncClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions } /** - * Code snippet for {@link BlobAsyncClient#getAccountInfo()} + * Code snippet for {@link BlobAsyncClient#getAccountInfoWithResponse()} */ - public void getAccountInfo() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.getAccountInfo - client.getAccountInfo().subscribe(response -> System.out.printf("Account Kind: %s, SKU: %s%n", + public void getAccountInfoWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getAccountInfoWithResponse + client.getAccountInfoWithResponse().subscribe(response -> System.out.printf("Account Kind: %s, SKU: %s%n", response.value().accountKind(), response.value().skuName())); - // END: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + // END: com.azure.storage.blob.BlobAsyncClient.getAccountInfoWithResponse } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java index 90a64765f384..5df4837bbfa7 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java @@ -3,6 +3,7 @@ package com.azure.storage.blob; +import com.azure.core.util.Context; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.blob.models.BlobHTTPHeaders; @@ -13,9 +14,11 @@ import com.azure.storage.blob.models.ModifiedAccessConditions; import com.azure.storage.blob.models.ReliableDownloadOptions; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.common.Constants; import java.io.ByteArrayOutputStream; import java.io.OutputStream; +import java.io.UncheckedIOException; import java.net.URL; import java.time.Duration; import java.time.OffsetDateTime; @@ -32,100 +35,61 @@ public class BlobClientJavaDocCodeSnippets { private URL url = JavaDocCodeSnippetsHelpers.generateURL("https://sample.com"); private String file = "file"; private Duration timeout = Duration.ofSeconds(30); + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; /** - * Code snippets for {@link BlobClient#exists()} and {@link BlobClient#exists(Duration)} + * Code snippets for {@link BlobClient#exists()} */ public void existsCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobClient.exists - System.out.printf("Exists? %b%n", client.exists().value()); + System.out.printf("Exists? %b%n", client.exists()); // END: com.azure.storage.blob.BlobClient.exists - - // BEGIN: com.azure.storage.blob.BlobClient.exists#Duration - System.out.printf("Exists? %b%n", client.exists(timeout).value()); - // END: com.azure.storage.blob.BlobClient.exists#Duration } /** - * Code snippets for {@link BlobClient#startCopyFromURL(URL)} and - * {@link BlobClient#startCopyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#startCopyFromURL(URL)} */ public void startCopyFromURL() { // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURL#URL - System.out.printf("Copy identifier: %s%n", client.startCopyFromURL(url).value()); + System.out.printf("Copy identifier: %s%n", client.startCopyFromURL(url)); // END: com.azure.storage.blob.BlobClient.startCopyFromURL#URL - - // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration - Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); - BlobAccessConditions blobAccessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - System.out.printf("Copy identifier: %s%n", - client.startCopyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout)); - // END: com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#abortCopyFromURL(String)} and - * {@link BlobClient#abortCopyFromURL(String, LeaseAccessConditions, Duration)} + * Code snippets for {@link BlobClient#abortCopyFromURL(String)} */ public void abortCopyFromURL() { // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURL#String - System.out.printf("Aborted copy completed with status %d%n", client.abortCopyFromURL(copyId).statusCode()); + client.abortCopyFromURL(copyId); + System.out.println("Aborted copy completed."); // END: com.azure.storage.blob.BlobClient.abortCopyFromURL#String - - // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration - LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().leaseId(leaseId); - System.out.printf("Aborted copy completed with status %d%n", - client.abortCopyFromURL(copyId, leaseAccessConditions, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#copyFromURL(URL)} and - * {@link BlobClient#copyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#copyFromURL(URL)} */ public void copyFromURL() { // BEGIN: com.azure.storage.blob.BlobClient.copyFromURL#URL - System.out.printf("Copy identifier: %s%n", client.copyFromURL(url).value()); + System.out.printf("Copy identifier: %s%n", client.copyFromURL(url)); // END: com.azure.storage.blob.BlobClient.copyFromURL#URL - - // BEGIN: com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration - Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); - BlobAccessConditions blobAccessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - System.out.printf("Copy identifier: %s%n", - client.copyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout).value()); - // END: com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#download(OutputStream)} and - * {@link BlobClient#download(OutputStream, BlobRange, ReliableDownloadOptions, BlobAccessConditions, boolean, Duration)} + * Code snippets for {@link BlobClient#download(OutputStream)} */ public void download() { // BEGIN: com.azure.storage.blob.BlobClient.download#OutputStream - System.out.printf("Download completed with status %d%n", - client.download(new ByteArrayOutputStream()).statusCode()); + client.download(new ByteArrayOutputStream()); + System.out.println("Download completed."); // END: com.azure.storage.blob.BlobClient.download#OutputStream - - // BEGIN: com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration - BlobRange range = new BlobRange(1024, 2048L); - ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); - - System.out.printf("Download completed with status %d%n", - client.download(new ByteArrayOutputStream(), range, options, null, false, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration } /** * Code snippets for {@link BlobClient#downloadToFile(String)} and - * {@link BlobClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean, Duration)} + * {@link BlobClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean, Duration, Context)} */ public void downloadToFile() { // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String @@ -133,28 +97,23 @@ public void downloadToFile() { System.out.println("Completed download to file"); // END: com.azure.storage.blob.BlobClient.downloadToFile#String - // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration + // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context BlobRange range = new BlobRange(1024, 2048L); ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); - client.downloadToFile(file, range, null, options, null, false, timeout); + client.downloadToFile(file, range, 4 * Constants.MB, options, null, false, timeout, new Context(key2, value2)); System.out.println("Completed download to file"); - // END: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration + // END: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context } /** - * Code snippets for {@link BlobClient#delete()} and - * {@link BlobClient#delete(DeleteSnapshotsOptionType, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#delete()} */ public void delete() { // BEGIN: com.azure.storage.blob.BlobClient.delete - System.out.printf("Delete completed with status %d%n", client.delete().statusCode()); + client.delete(); + System.out.println("Delete completed."); // END: com.azure.storage.blob.BlobClient.delete - - // BEGIN: com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration - System.out.printf("Delete completed with status %d%n", - client.delete(DeleteSnapshotsOptionType.INCLUDE, null, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration } /** @@ -162,226 +121,379 @@ public void delete() { */ public void getProperties() { // BEGIN: com.azure.storage.blob.BlobClient.getProperties - BlobProperties properties = client.getProperties().value(); + BlobProperties properties = client.getProperties(); System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize()); // END: com.azure.storage.blob.BlobClient.getProperties } /** - * Code snippet for {@link BlobClient#getProperties(BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders)} + */ + public void setHTTPHeaders() { + // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders + client.setHTTPHeaders(new BlobHTTPHeaders() + .blobContentLanguage("en-US") + .blobContentType("binary")); + System.out.println("Set HTTP headers completed"); + // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders + } + + /** + * Code snippets for {@link BlobClient#setMetadata(Metadata)} + */ + public void setMetadata() { + // BEGIN: com.azure.storage.blob.BlobClient.setMetadata#Metadata + client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))); + System.out.println("Set metadata completed"); + // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata + } + + /** + * Code snippets for {@link BlobClient#createSnapshot()} + */ + public void createSnapshot() { + // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot + System.out.printf("Identifier for the snapshot is %s%n", client.createSnapshot().getSnapshotId()); + // END: com.azure.storage.blob.BlobClient.createSnapshot + } + + /** + * Code snippets for {@link BlobClient#setTier(AccessTier)} and + * {@link BlobClient#setTierWithResponse(AccessTier, LeaseAccessConditions, Duration, Context)} + */ + public void setTier() { + // BEGIN: com.azure.storage.blob.BlobClient.setTier#AccessTier + System.out.printf("Set tier completed with status code %d%n", + client.setTierWithResponse(AccessTier.HOT, null, null, null).statusCode()); + // END: com.azure.storage.blob.BlobClient.setTier#AccessTier + + + } + + /** + * Code snippets for {@link BlobClient#undelete()} + */ + public void undelete() { + // BEGIN: com.azure.storage.blob.BlobClient.undelete + client.undelete(); + System.out.printf("Undelete completed"); + // END: com.azure.storage.blob.BlobClient.undelete + } + + /** + * Code snippets for {@link BlobClient#acquireLease(String, int)} + */ + public void acquireLease() { + // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int + System.out.printf("Lease ID is %s%n", client.acquireLease("proposedId", 60)); + // END: com.azure.storage.blob.BlobClient.acquireLease#String-int + } + + /** + * Code snippets for {@link BlobClient#renewLease(String)} + */ + public void renewLease() { + // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String + System.out.printf("Renewed lease ID is %s%n", client.renewLease(leaseId)); + // END: com.azure.storage.blob.BlobClient.renewLease#String + } + + /** + * Code snippets for {@link BlobClient#releaseLease(String)} + */ + public void releaseLease() { + // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String + client.releaseLease(leaseId); + System.out.printf("Release lease completed"); + // END: com.azure.storage.blob.BlobClient.releaseLease#String + + + } + + /** + * Code snippets for {@link BlobClient#breakLease()} */ - public void getPropertiesWithTimeout() { - // BEGIN: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration + public void breakLease() { + // BEGIN: com.azure.storage.blob.BlobClient.breakLease + System.out.printf("The broken lease has %d seconds remaining on the lease", client.breakLease()); + // END: com.azure.storage.blob.BlobClient.breakLease + + + } + + /** + * Code snippets for {@link BlobClient#changeLease(String, String)} + */ + public void changeLease() { + // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String + System.out.printf("Changed lease ID is %s%n", client.changeLease(leaseId, "proposedId")); + // END: com.azure.storage.blob.BlobClient.changeLease#String-String + + } + + /** + * Code snippet for {@link BlobClient#getAccountInfo()} + */ + public void getAccountInfo() { + // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo + StorageAccountInfo accountInfo = client.getAccountInfo(); + System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName()); + // END: com.azure.storage.blob.BlobClient.getAccountInfo + } + + /** + * Code snippet for {@link BlobClient#existsWithResponse(Duration, Context)} + */ + public void existsWithResponseCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobClient.existsWithResponse#Duration-Context + System.out.printf("Exists? %b%n", client.existsWithResponse(timeout, new Context(key2, value2)).value()); + // END: com.azure.storage.blob.BlobClient.existsWithResponse#Duration-Context + } + + /** + * Code snippets for {@link BlobClient#startCopyFromURLWithResponse(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration, Context)} + */ + public void startCopyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions().leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + System.out.printf("Copy identifier: %s%n", + client.startCopyFromURLWithResponse(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout, + new Context(key2, value2))); + // END: com.azure.storage.blob.BlobClient.startCopyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#abortCopyFromURLWithResponse(String, LeaseAccessConditions, Duration, Context)} + */ + public void abortCopyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context + LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().leaseId(leaseId); + System.out.printf("Aborted copy completed with status %d%n", + client.abortCopyFromURLWithResponse(copyId, leaseAccessConditions, timeout, + new Context(key2, value2)).statusCode()); + // END: com.azure.storage.blob.BlobClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#copyFromURLWithResponse(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration, Context)} + */ + public void copyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.copyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions().leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); + + System.out.printf("Copy identifier: %s%n", + client.copyFromURLWithResponse(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.copyFromURLWithResponse#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#downloadWithResponse(OutputStream, BlobRange, ReliableDownloadOptions, BlobAccessConditions, boolean, Duration, Context)} + * @throws UncheckedIOException If an I/O error occurs + */ + public void downloadWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.downloadWithResponse#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context + BlobRange range = new BlobRange(1024, 2048L); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); + + System.out.printf("Download completed with status %d%n", + client.downloadWithResponse(new ByteArrayOutputStream(), range, options, null, false, + timeout, new Context(key2, value2)).statusCode()); + // END: com.azure.storage.blob.BlobClient.downloadWithResponse#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context + + } + + /** + * Code snippets for {@link BlobClient#deleteWithResponse(DeleteSnapshotsOptionType, BlobAccessConditions, Duration, Context)} + */ + public void deleteWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions-Duration-Context + System.out.printf("Delete completed with status %d%n", + client.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, null, timeout, + new Context(key1, value1)).statusCode()); + // END: com.azure.storage.blob.BlobClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#getPropertiesWithResponse(BlobAccessConditions, Duration, Context)} + */ + public void getPropertiesWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.getPropertiesWithResponse#BlobAccessConditions-Duration-Context BlobAccessConditions accessConditions = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - BlobProperties properties = client.getProperties(accessConditions, timeout).value(); + BlobProperties properties = client.getPropertiesWithResponse(accessConditions, timeout, + new Context(key2, value2)).value(); System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize()); - // END: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration + // END: com.azure.storage.blob.BlobClient.getPropertiesWithResponse#BlobAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders)} and - * {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#setHTTPHeadersWithResponse(BlobHTTPHeaders, BlobAccessConditions, Duration, Context)} */ - public void setHTTPHeaders() { - // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders - System.out.printf("Set HTTP headers completed with status %d%n", - client.setHTTPHeaders(new BlobHTTPHeaders() - .blobContentLanguage("en-US") - .blobContentType("binary")) - .statusCode()); - // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders - - // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration + public void setHTTPHeadersWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context BlobAccessConditions accessConditions = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); System.out.printf("Set HTTP headers completed with status %d%n", - client.setHTTPHeaders(new BlobHTTPHeaders() + client.setHTTPHeadersWithResponse(new BlobHTTPHeaders() .blobContentLanguage("en-US") - .blobContentType("binary"), accessConditions, timeout) + .blobContentType("binary"), accessConditions, timeout, new Context(key1, value1)) .statusCode()); - // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration + // END: com.azure.storage.blob.BlobClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#setMetadata(Metadata)} and - * {@link BlobClient#setMetadata(Metadata, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#setMetadataWithResponse(Metadata, BlobAccessConditions, Duration, Context)} */ - public void setMetadata() { - // BEGIN: com.azure.storage.blob.BlobClient.setMetadata#Metadata - System.out.printf("Set metadata completed with status %d%n", - client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))).statusCode()); - // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata - - // BEGIN: com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + public void setMetadataWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.setMetadataWithResponse#Metadata-BlobAccessConditions-Duration-Context + BlobAccessConditions accessConditions = new BlobAccessConditions().leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); System.out.printf("Set metadata completed with status %d%n", - client.setMetadata( - new Metadata(Collections.singletonMap("metadata", "value")), accessConditions, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration + client.setMetadataWithResponse( + new Metadata(Collections.singletonMap("metadata", "value")), accessConditions, timeout, + new Context(key1, value1)).statusCode()); + // END: com.azure.storage.blob.BlobClient.setMetadataWithResponse#Metadata-BlobAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#createSnapshot()} and - * {@link BlobClient#createSnapshot(Metadata, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#createSnapshotWithResponse(Metadata, BlobAccessConditions, Duration, Context)} */ - public void createSnapshot() { - // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot - System.out.printf("Identifier for the snapshot is %s%n", client.createSnapshot().value().getSnapshotId()); - // END: com.azure.storage.blob.BlobClient.createSnapshot + public void createSnapshotWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration + // BEGIN: com.azure.storage.blob.BlobClient.createSnapshotWithResponse#Metadata-BlobAccessConditions-Duration-Context Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + BlobAccessConditions accessConditions = new BlobAccessConditions().leaseAccessConditions( + new LeaseAccessConditions().leaseId(leaseId)); System.out.printf("Identifier for the snapshot is %s%n", - client.createSnapshot(snapshotMetadata, accessConditions, timeout).value().getSnapshotId()); - // END: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration + client.createSnapshotWithResponse(snapshotMetadata, accessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.createSnapshotWithResponse#Metadata-BlobAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#setTier(AccessTier)} and - * {@link BlobClient#setTier(AccessTier, LeaseAccessConditions, Duration)} + * Code snippets for {@link BlobClient#setTierWithResponse(AccessTier, LeaseAccessConditions, Duration, Context)} */ - public void setTier() { - // BEGIN: com.azure.storage.blob.BlobClient.setTier#AccessTier - System.out.printf("Set tier completed with status code %d%n", client.setTier(AccessTier.HOT).statusCode()); - // END: com.azure.storage.blob.BlobClient.setTier#AccessTier - - // BEGIN: com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration + public void setTierWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.setTierWithResponse#AccessTier-LeaseAccessConditions-Duration-Context LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId); System.out.printf("Set tier completed with status code %d%n", - client.setTier(AccessTier.HOT, accessConditions, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration + client.setTierWithResponse(AccessTier.HOT, accessConditions, timeout, new Context(key2, value2)).statusCode()); + // END: com.azure.storage.blob.BlobClient.setTierWithResponse#AccessTier-LeaseAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#undelete()} and {@link BlobClient#undelete(Duration)} + * Code snippet for {@link BlobClient#undeleteWithResponse(Duration, Context)} */ - public void undelete() { - // BEGIN: com.azure.storage.blob.BlobClient.undelete - System.out.printf("Undelete completed with status %d%n", client.undelete().statusCode()); - // END: com.azure.storage.blob.BlobClient.undelete - - // BEGIN: com.azure.storage.blob.BlobClient.undelete#Duration - System.out.printf("Undelete completed with status %d%n", client.undelete(timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.undelete#Duration + public void undeleteWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.undeleteWithResponse#Duration-Context + System.out.printf("Undelete completed with status %d%n", client.undeleteWithResponse(timeout, + new Context(key1, value1)).statusCode()); + // END: com.azure.storage.blob.BlobClient.undeleteWithResponse#Duration-Context } /** - * Code snippets for {@link BlobClient#acquireLease(String, int)} and - * {@link BlobClient#acquireLease(String, int, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#acquireLeaseWithResponse(String, int, ModifiedAccessConditions, Duration, Context)} */ - public void acquireLease() { - // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int - System.out.printf("Lease ID is %s%n", client.acquireLease("proposedId", 60).value()); - // END: com.azure.storage.blob.BlobClient.acquireLease#String-int + public void acquireLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration + // BEGIN: com.azure.storage.blob.BlobClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifModifiedSince(OffsetDateTime.now().minusDays(3)); System.out.printf("Lease ID is %s%n", - client.acquireLease("proposedId", 60, modifiedAccessConditions, timeout).value()); - // END: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration + client.acquireLeaseWithResponse("proposedId", 60, modifiedAccessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#renewLease(String)} and - * {@link BlobClient#renewLease(String, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#renewLeaseWithResponse(String, ModifiedAccessConditions, Duration, Context)} */ - public void renewLease() { - // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String - System.out.printf("Renewed lease ID is %s%n", client.renewLease(leaseId).value()); - // END: com.azure.storage.blob.BlobClient.renewLease#String + public void renewLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration + // BEGIN: com.azure.storage.blob.BlobClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); System.out.printf("Renewed lease ID is %s%n", - client.renewLease(leaseId, modifiedAccessConditions, timeout).value()); - // END: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration + client.renewLeaseWithResponse(leaseId, modifiedAccessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#releaseLease(String)} and - * {@link BlobClient#releaseLease(String, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#releaseLeaseWithResponse(String, ModifiedAccessConditions, Duration, Context)} */ - public void releaseLease() { - // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String - System.out.printf("Release lease completed with status %d%n", client.releaseLease(leaseId).statusCode()); - // END: com.azure.storage.blob.BlobClient.releaseLease#String - - // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration + public void releaseLeaseWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); System.out.printf("Release lease completed with status %d%n", - client.releaseLease(leaseId, modifiedAccessConditions, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration + client.releaseLeaseWithResponse(leaseId, modifiedAccessConditions, timeout, + new Context(key2, value2)).statusCode()); + // END: com.azure.storage.blob.BlobClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#breakLease()} and - * {@link BlobClient#breakLease(Integer, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#breakLeaseWithResponse(Integer, ModifiedAccessConditions, Duration, Context)} */ - public void breakLease() { - // BEGIN: com.azure.storage.blob.BlobClient.breakLease - System.out.printf("The broken lease has %d seconds remaining on the lease", client.breakLease().value()); - // END: com.azure.storage.blob.BlobClient.breakLease + public void breakLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration + // BEGIN: com.azure.storage.blob.BlobClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context Integer retainLeaseInSeconds = 5; ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); System.out.printf("The broken lease has %d seconds remaining on the lease", - client.breakLease(retainLeaseInSeconds, modifiedAccessConditions, timeout).value()); - // END: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration + client.breakLeaseWithResponse(retainLeaseInSeconds, modifiedAccessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#changeLease(String, String)} and - * {@link BlobClient#changeLease(String, String, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#changeLeaseWithResponse(String, String, ModifiedAccessConditions, Duration, Context)} */ - public void changeLease() { - // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String - System.out.printf("Changed lease ID is %s%n", client.changeLease(leaseId, "proposedId").value()); - // END: com.azure.storage.blob.BlobClient.changeLease#String-String + public void changeLeaseWithResponseCodeSnippets() { + - // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration + // BEGIN: com.azure.storage.blob.BlobClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); System.out.printf("Changed lease ID is %s%n", - client.changeLease(leaseId, "proposedId", modifiedAccessConditions, timeout).value()); - // END: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration - } - - /** - * Code snippet for {@link BlobClient#getAccountInfo()} - */ - public void getAccountInfo() { - // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo - StorageAccountInfo accountInfo = client.getAccountInfo().value(); - System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName()); - // END: com.azure.storage.blob.BlobClient.getAccountInfo + client.changeLeaseWithResponse(leaseId, "proposedId", modifiedAccessConditions, timeout, + new Context(key1, value1)).value()); + // END: com.azure.storage.blob.BlobClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context } /** - * Code snippet for {@link BlobClient#getAccountInfo(Duration)} + * Code snippet for {@link BlobClient#getAccountInfoWithResponse(Duration, Context)} */ - public void getAccountInfoWithTimeout() { - // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo#Duration - StorageAccountInfo accountInfo = client.getAccountInfo(timeout).value(); + public void getAccountInfoWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfoWithResponse#Duration-Context + StorageAccountInfo accountInfo = client.getAccountInfoWithResponse(timeout, new Context(key1, value1)).value(); System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName()); - // END: com.azure.storage.blob.BlobClient.getAccountInfo#Duration + // END: com.azure.storage.blob.BlobClient.getAccountInfoWithResponse#Duration-Context } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java index 33886cd10750..6d462368bba7 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java @@ -9,9 +9,9 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.RandomAccessFile; -import java.net.URL; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -121,16 +121,17 @@ public static void main(String[] args) throws IOException, NoSuchAlgorithmExcept } private static File createTempEmptyFile(String fileName) throws IOException { - URL folderUrl = FileTransferExample.class.getClassLoader().getResource("."); + String pathName = "./folderPath/" + LARGE_TEST_FOLDER; - File dirPath = new File(folderUrl.getPath() + LARGE_TEST_FOLDER); + File dirPath = new File(pathName); if (dirPath.exists() || dirPath.mkdir()) { - File f = new File(folderUrl.getPath() + LARGE_TEST_FOLDER + fileName); - if (!f.exists()) { - f.createNewFile(); + File f = new File(pathName + fileName); + if (f.exists() || f.createNewFile()) { + return f; + } else { + throw new RuntimeException("Failed to create the large file."); } - return f; } else { throw new RuntimeException("Failed to create the large file dir."); } @@ -164,9 +165,8 @@ private static String getFileChecksum(File file) throws IOException, NoSuchAlgor buf.clear(); b = ch.read(buf); } - ch.close(); - fis.close(); - return new String(md.digest()); + + return new String(md.digest(), StandardCharsets.UTF_8); } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java index 591e78141f70..46629d4a717c 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java @@ -3,6 +3,7 @@ package com.azure.storage.blob; +import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.Metadata; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -10,6 +11,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.Locale; @@ -22,6 +24,7 @@ public class SetMetadataAndHTTPHeadersExample { /** * Entry point into the setting metadata examples for Storage blobs. * @param args Unused. Arguments to the program. + * * @throws IOException If an I/O error occurs */ public static void main(String[] args) throws IOException { @@ -57,7 +60,7 @@ public static void main(String[] args) throws IOException { /* * Create a container with the containerMetadata above. */ - containerClient.create(containerMetadata, null, null); + containerClient.createWithResponse(containerMetadata, null, null, new Context("key1", "value1")); /* * Create a blob client. @@ -75,8 +78,8 @@ public static void main(String[] args) throws IOException { * Data which will upload to block blob. */ String data = "Hello world!"; - InputStream dataStream = new ByteArrayInputStream(data.getBytes()); - blobClient.upload(dataStream, data.length(), blobHTTPHeaders, blobMetadata, null, null); + InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)); + blobClient.uploadWithResponse(dataStream, data.length(), blobHTTPHeaders, blobMetadata, null, null, null); /* * Clean up the container and blob. diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java index 3a84d7026f7b..d462c47034a1 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java @@ -5,6 +5,7 @@ import com.azure.core.http.HttpResponse; import com.azure.storage.blob.models.StorageErrorCode; +import com.azure.storage.blob.models.StorageException; /** * This example shows how to handle errors thrown by various XxxURL methods. Any client-side error will be @@ -39,7 +40,7 @@ public static void main(String[] args) { /* * Log more detailed information. */ - System.out.println("Extended details: " + e.getMessage()); + System.out.println("Extended details: " + e.serviceMessage()); /* * Examine the raw response. @@ -51,7 +52,7 @@ public static void main(String[] args) { /* * Log more detailed information. */ - System.out.println("Extended details: " + e.getMessage()); + System.out.println("Extended details: " + e.serviceMessage()); } else if (e.errorCode() == StorageErrorCode.CONTAINER_ALREADY_EXISTS) { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy index 20d03a45a55c..85a90fd7af1c 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy @@ -14,19 +14,22 @@ import com.azure.core.http.ProxyOptions import com.azure.core.http.policy.HttpLogDetailLevel import com.azure.core.http.policy.HttpPipelinePolicy import com.azure.core.http.rest.Response +import com.azure.core.test.InterceptorManager +import com.azure.core.test.TestMode +import com.azure.core.test.utils.TestResourceNamer import com.azure.core.util.configuration.ConfigurationManager +import com.azure.core.util.logging.ClientLogger import com.azure.identity.credential.EnvironmentCredentialBuilder import com.azure.storage.blob.models.ContainerItem import com.azure.storage.blob.models.CopyStatusType import com.azure.storage.blob.models.LeaseStateType +import com.azure.storage.blob.models.ListContainersOptions import com.azure.storage.blob.models.Metadata import com.azure.storage.blob.models.RetentionPolicy import com.azure.storage.blob.models.StorageServiceProperties import com.azure.storage.common.Constants +import com.azure.storage.common.credentials.SASTokenCredential import com.azure.storage.common.credentials.SharedKeyCredential -import io.netty.buffer.ByteBuf -import org.junit.Assume -import org.spockframework.lang.ISpecificationContext import reactor.core.publisher.Flux import reactor.core.publisher.Mono import spock.lang.Shared @@ -35,19 +38,21 @@ import spock.lang.Specification import java.nio.ByteBuffer import java.nio.charset.Charset import java.nio.charset.StandardCharsets +import java.time.Duration import java.time.OffsetDateTime import java.util.function.Supplier class APISpec extends Specification { - static final String RECORD_MODE = "RECORD" - @Shared - Integer iterationNo = 0 // Used to generate stable container names for recording tests with multiple iterations. + private ClientLogger logger = new ClientLogger(APISpec.class) Integer entityNo = 0 // Used to generate stable container names for recording tests requiring multiple containers. + // both sync and async clients point to same container + @Shared + ContainerClient cc @Shared - ContainerClient cu + ContainerAsyncClient ccAsync // Fields used for conveniently creating blobs with data. static final String defaultText = "default" @@ -61,15 +66,12 @@ class APISpec extends Specification { } } - static defaultDataSize = defaultData.remaining() - - // If debugging is enabled, recordings cannot run as there can only be one proxy at a time. - static boolean enableDebugging = false + static int defaultDataSize = defaultData.remaining() // Prefixes for blobs and containers - static String containerPrefix = "jtc" // java test container + String containerPrefix = "jtc" // java test container - static String blobPrefix = "javablob" + String blobPrefix = "javablob" /* The values below are used to create data-driven tests for access conditions. @@ -94,220 +96,363 @@ class APISpec extends Specification { static final String garbageLeaseID = UUID.randomUUID().toString() - /* - credential for various kinds of accounts. - */ - @Shared - static SharedKeyCredential primaryCreds + static def AZURE_TEST_MODE = "AZURE_TEST_MODE" + static def PRIMARY_STORAGE = "PRIMARY_STORAGE_" + static def SECONDARY_STORAGE = "SECONDARY_STORAGE_" + static def BLOB_STORAGE = "BLOB_STORAGE_" + static def PREMIUM_STORAGE = "PREMIUM_STORAGE_" - @Shared - static SharedKeyCredential alternateCreds + static SharedKeyCredential primaryCredential + static SharedKeyCredential alternateCredential + static SharedKeyCredential blobCredential + static SharedKeyCredential premiumCredential + static TestMode testMode - /* - URLs to various kinds of accounts. - */ - BlobServiceClient primaryServiceURL + BlobServiceClient primaryBlobServiceClient + BlobServiceAsyncClient primaryBlobServiceAsyncClient + BlobServiceClient alternateBlobServiceClient + BlobServiceClient blobServiceClient + BlobServiceClient premiumBlobServiceClient - @Shared - static BlobServiceClient alternateServiceURL + private InterceptorManager interceptorManager + private TestResourceNamer resourceNamer + private String testName - @Shared - static BlobServiceClient blobStorageServiceURL + def setupSpec() { + testMode = setupTestMode() + primaryCredential = getCredential(PRIMARY_STORAGE) + alternateCredential = getCredential(SECONDARY_STORAGE) + blobCredential = getCredential(BLOB_STORAGE) + premiumCredential = getCredential(PREMIUM_STORAGE) + } - @Shared - static BlobServiceClient premiumServiceURL + def setup() { + String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase() + String className = specificationContext.getCurrentSpec().getName() - /* - Constants for testing that the context parameter is properly passed to the pipeline. - */ - static final String defaultContextKey = "Key" + int iterationIndex = fullTestName.lastIndexOf("[") + int substringIndex = (int) Math.min((iterationIndex != -1) ? iterationIndex : fullTestName.length(), 50) + this.testName = fullTestName.substring(0, substringIndex) + this.interceptorManager = new InterceptorManager(className + fullTestName, testMode) + this.resourceNamer = new TestResourceNamer(className + testName, testMode, interceptorManager.getRecordedData()) - static String getTestName(ISpecificationContext ctx) { - return ctx.getCurrentFeature().name.replace(' ', '').toLowerCase() - } + primaryBlobServiceClient = setClient(primaryCredential) + primaryBlobServiceAsyncClient = getServiceAsyncClient(primaryCredential) + alternateBlobServiceClient = setClient(alternateCredential) + blobServiceClient = setClient(blobCredential) + premiumBlobServiceClient = setClient(premiumCredential) - def generateContainerName() { - generateContainerName(specificationContext, iterationNo, entityNo++) + def containerName = generateContainerName() + cc = primaryBlobServiceClient.getContainerClient(containerName) + ccAsync = primaryBlobServiceAsyncClient.getContainerAsyncClient(containerName) + cc.create() } - def generateBlobName() { - generateBlobName(specificationContext, iterationNo, entityNo++) - } + def cleanup() { + def options = new ListContainersOptions().prefix(containerPrefix + testName) + for (ContainerItem container : primaryBlobServiceClient.listContainers(options, Duration.ofSeconds(120))) { + ContainerClient containerClient = primaryBlobServiceClient.getContainerClient(container.name()) - /** - * This function generates an entity name by concatenating the passed prefix, the name of the test requesting the - * entity name, and some unique suffix. This ensures that the entity name is unique for each test so there are - * no conflicts on the service. If we are not recording, we can just use the time. If we are recording, the suffix - * must always be the same so we can match requests. To solve this, we use the entityNo for how many entities have - * already been created by this test so far. This would sufficiently distinguish entities within a recording, but - * could still yield duplicates on the service for data-driven tests. Therefore, we also add the iteration number - * of the data driven tests. - * - * @param specificationContext - * Used to obtain the name of the test running. - * @param prefix - * Used to group all entities created by these tests under common prefixes. Useful for listing. - * @param iterationNo - * Indicates which iteration of a data-driven test is being executed. - * @param entityNo - * Indicates how man entities have been created by the test so far. This distinguishes multiple containers - * or multiple blobs created by the same test. Only used when dealing with recordings. - * @return - */ - static String generateResourceName(ISpecificationContext specificationContext, String prefix, int iterationNo, - int entityNo) { - String suffix = "" - suffix += System.currentTimeMillis() // For uniqueness between runs. - suffix += entityNo // For easy identification of which call created this resource. - return prefix + getTestName(specificationContext).take(63 - suffix.length() - prefix.length()) + suffix - } + if (container.properties().leaseState() == LeaseStateType.LEASED) { + containerClient.breakLeaseWithResponse(0, null, null, null) + } - static int updateIterationNo(ISpecificationContext specificationContext, int iterationNo) { - if (specificationContext.currentIteration.estimatedNumIterations > 1) { - return iterationNo + 1 - } else { - return 0 + containerClient.delete() } + + interceptorManager.close() } - static String generateContainerName(ISpecificationContext specificationContext, int iterationNo, int entityNo) { - return generateResourceName(specificationContext, containerPrefix, iterationNo, entityNo) + static TestMode setupTestMode() { + String testMode = ConfigurationManager.getConfiguration().get(AZURE_TEST_MODE) + + if (testMode != null) { + try { + return TestMode.valueOf(testMode.toUpperCase(Locale.US)) + } catch (IllegalArgumentException ex) { + return TestMode.PLAYBACK + } + } + + return TestMode.PLAYBACK } - static String generateBlobName(ISpecificationContext specificationContext, int iterationNo, int entityNo) { - return generateResourceName(specificationContext, blobPrefix, iterationNo, entityNo) + static boolean liveMode() { + return setupTestMode() == TestMode.RECORD } - static getGenericCreds(String accountType) { - String accountName = ConfigurationManager.getConfiguration().get(accountType + "ACCOUNT_NAME") - String accountKey = ConfigurationManager.getConfiguration().get(accountType + "ACCOUNT_KEY") + private SharedKeyCredential getCredential(String accountType) { + String accountName + String accountKey + + if (testMode == TestMode.RECORD) { + accountName = ConfigurationManager.getConfiguration().get(accountType + "ACCOUNT_NAME") + accountKey = ConfigurationManager.getConfiguration().get(accountType + "ACCOUNT_KEY") + } else { + accountName = "storageaccount" + accountKey = "astorageaccountkey" + } if (accountName == null || accountKey == null) { - System.out.println("Account name or key for the " + accountType + " account was null. Test's requiring " + - "these credential will fail.") + logger.warning("Account name or key for the {} account was null. Test's requiring these credentials will fail.", accountType) return null } + return new SharedKeyCredential(accountName, accountKey) } - static HttpClient getHttpClient() { - if (enableDebugging) { - return HttpClient.createDefault().proxy(new Supplier() { - @Override - ProxyOptions get() { - return new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)) - } - }) + BlobServiceClient setClient(SharedKeyCredential credential) { + try { + return getServiceClient(credential) + } catch (Exception ex) { + return null + } + } + + def getOAuthServiceClient() { + BlobServiceClientBuilder builder = new BlobServiceClientBuilder() + .endpoint(String.format("https://%s.blob.core.windows.net/", primaryCredential.accountName())) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + + // AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET + return builder.credential(new EnvironmentCredentialBuilder().build()).buildClient() } else { - return HttpClient.createDefault() + // Running in playback, we don't have access to the AAD environment variables, just use SharedKeyCredential. + return builder.credential(primaryCredential).buildClient() } } - static BlobServiceClient getGenericServiceURL(SharedKeyCredential creds) { - // TODO: logging? + BlobServiceClient getServiceClient(String endpoint) { + return getServiceClient(null, endpoint, null) + } + + BlobServiceClient getServiceClient(SharedKeyCredential credential) { + return getServiceClient(credential, String.format("https://%s.blob.core.windows.net", credential.accountName()), null) + } + + BlobServiceClient getServiceClient(SharedKeyCredential credential, String endpoint) { + return getServiceClient(credential, endpoint, null) + } - return new BlobServiceClientBuilder() - .endpoint("https://" + creds.accountName() + ".blob.core.windows.net") + BlobServiceClient getServiceClient(SharedKeyCredential credential, String endpoint, HttpPipelinePolicy... policies) { + BlobServiceClientBuilder builder = new BlobServiceClientBuilder() + .endpoint(endpoint) .httpClient(getHttpClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .credential(creds) - .buildClient() - } - - static void cleanupContainers() throws MalformedURLException { - BlobServiceClient serviceURL = new BlobServiceClientBuilder() - .endpoint("http://" + primaryCreds.accountName() + ".blob.core.windows.net") - .credential(primaryCreds) - .buildClient() - // There should not be more than 5000 containers from these tests - for (ContainerItem c : serviceURL.listContainers()) { - ContainerClient containerURL = serviceURL.getContainerClient(c.name()) - if (c.properties().leaseState() == LeaseStateType.LEASED) { - containerURL.breakLease(0, null, null) - } - containerURL.delete() + + for (HttpPipelinePolicy policy : policies) { + builder.addPolicy(policy) + } + + if (testMode == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) } + + if (credential != null) { + builder.credential(credential) + } + + return builder.buildClient() } - static byte[] getRandomByteArray(int size) { - Random rand = new Random(getRandomSeed()) - byte[] data = new byte[size] - rand.nextBytes(data) - return data + BlobServiceClient getServiceClient(SASTokenCredential credential, String endpoint) { + BlobServiceClientBuilder builder = new BlobServiceClientBuilder() + .endpoint(endpoint) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + } + + return builder.credential(credential).buildClient() } - /* - Size must be an int because ByteBuffer sizes can only be an int. Long is not supported. - */ - static ByteBuffer getRandomData(int size) { - return ByteBuffer.wrap(getRandomByteArray(size)) + BlobServiceAsyncClient getServiceAsyncClient(SharedKeyCredential credential) { + BlobServiceClientBuilder builder = new BlobServiceClientBuilder() + .credential(credential) + .endpoint(String.format("https://%s.blob.core.windows.net", credential.accountName())) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + } + + return builder.buildAsyncClient() } - /* - We only allow int because anything larger than 2GB (which would require a long) is left to stress/perf. - */ - static File getRandomFile(int size) { - File file = File.createTempFile(UUID.randomUUID().toString(), ".txt") - file.deleteOnExit() - FileOutputStream fos = new FileOutputStream(file) - fos.write(getRandomData(size).array()) - fos.close() - return file + ContainerClient getContainerClient(SASTokenCredential credential, String endpoint) { + ContainerClientBuilder builder = new ContainerClientBuilder() + .endpoint(endpoint) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + } + + builder.credential(credential).buildClient() + } + + BlobAsyncClient getBlobAsyncClient(SharedKeyCredential credential, String endpoint, String blobName) { + BlobClientBuilder builder = new BlobClientBuilder() + .endpoint(endpoint) + .blobName(blobName) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + } + + builder.credential(credential).buildBlobAsyncClient() } - static long getRandomSeed() { - return System.currentTimeMillis() + BlobClient getBlobClient(SASTokenCredential credential, String endpoint, String blobName) { + return getBlobClient(credential, endpoint, blobName, null) } - def setupSpec() { - /* - We'll let primary creds throw and crash if there are no credential specified because everything else will fail. - */ - primaryCreds = getGenericCreds("PRIMARY_STORAGE_") - - /* - It's feasible someone wants to test a specific subset of tests, so we'll still attempt to create each of the - ServiceURLs separately. We don't really need to take any action here, as we've already reported to the user, - so we just swallow the exception and let the relevant tests fail later. Perhaps we can add annotations or - something in the future. - */ - try { - alternateCreds = getGenericCreds("SECONDARY_STORAGE_") - alternateServiceURL = getGenericServiceURL(alternateCreds) + BlobClient getBlobClient(SASTokenCredential credential, String endpoint, String blobName, String snapshotId) { + BlobClientBuilder builder = new BlobClientBuilder() + .endpoint(endpoint) + .blobName(blobName) + .snapshot(snapshotId) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + } + + return builder.credential(credential).buildBlobClient() + } + + BlobClient getBlobClient(SharedKeyCredential credential, String endpoint, HttpPipelinePolicy... policies) { + BlobClientBuilder builder = new BlobClientBuilder() + .endpoint(endpoint) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + for (HttpPipelinePolicy policy : policies) { + builder.addPolicy(policy) } - catch (Exception e) { + + if (testMode == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) } - try { - blobStorageServiceURL = getGenericServiceURL(getGenericCreds("BLOB_STORAGE_")) + return builder.credential(credential).buildBlobClient() + } + + BlobClient getBlobClient(SharedKeyCredential credential, String endpoint, String blobName) { + BlobClientBuilder builder = new BlobClientBuilder() + .endpoint(endpoint) + .blobName(blobName) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) } - catch (Exception e) { + + return builder.credential(credential).buildBlobClient() + } + + BlobClient getBlobClient(String endpoint, SASTokenCredential credential) { + BlobClientBuilder builder = new BlobClientBuilder() + .endpoint(endpoint) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (credential != null) { + builder.credential(credential) } - try { - premiumServiceURL = getGenericServiceURL(getGenericCreds("PREMIUM_STORAGE_")) + if (testMode == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) } - catch (Exception e) { + + return builder.buildBlobClient() + } + + private HttpClient getHttpClient() { + HttpClient client + if (testMode == TestMode.RECORD) { + client = HttpClient.createDefault().wiretap(true) + } else { + client = interceptorManager.getPlaybackClient() + } + + if (Boolean.parseBoolean(ConfigurationManager.getConfiguration().get("AZURE_TEST_DEBUGGING"))) { + return client.proxy(PROXY_OPTIONS) + } else { + return client } } - def cleanupSpec() { - Assume.assumeTrue("The test only runs in Live mode.", getTestMode().equalsIgnoreCase(RECORD_MODE)) - cleanupContainers() + private Supplier PROXY_OPTIONS = new Supplier() { + @Override + ProxyOptions get() { + return new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)) + } } - def setup() { - Assume.assumeTrue("The test only runs in Live mode.", getTestMode().equalsIgnoreCase(RECORD_MODE)) - String containerName = generateContainerName() + def generateContainerName() { + generateResourceName(containerPrefix, entityNo++) + } - primaryServiceURL = getGenericServiceURL(primaryCreds) - cu = primaryServiceURL.getContainerClient(containerName) - cu.create() + def generateBlobName() { + generateResourceName(blobPrefix, entityNo++) } - def cleanup() { - // TODO: Scrub auth header here? - iterationNo = updateIterationNo(specificationContext, iterationNo) + private String generateResourceName(String prefix, int entityNo) { + return resourceNamer.randomName(prefix + testName + entityNo, 63) + } + + String getRandomUUID() { + return resourceNamer.randomUuid() + } + + String getBlockID() { + return Base64.encoder.encodeToString(resourceNamer.randomUuid().getBytes(StandardCharsets.UTF_8)) + } + + OffsetDateTime getUTCNow() { + return resourceNamer.now() + } + + byte[] getRandomByteArray(int size) { + long seed = UUID.fromString(resourceNamer.randomUuid()).getMostSignificantBits() & Long.MAX_VALUE + Random rand = new Random(seed) + byte[] data = new byte[size] + rand.nextBytes(data) + return data + } + + /* + Size must be an int because ByteBuffer sizes can only be an int. Long is not supported. + */ + + ByteBuffer getRandomData(int size) { + return ByteBuffer.wrap(getRandomByteArray(size)) + } + + /* + We only allow int because anything larger than 2GB (which would require a long) is left to stress/perf. + */ + + File getRandomFile(int size) { + File file = File.createTempFile(UUID.randomUUID().toString(), ".txt") + file.deleteOnExit() + FileOutputStream fos = new FileOutputStream(file) + fos.write(getRandomData(size).array()) + fos.close() + return file } /** @@ -324,7 +469,7 @@ class APISpec extends Specification { */ def setupBlobMatchCondition(BlobClient bu, String match) { if (match == receivedEtag) { - return bu.getProperties().headers().value("ETag") + bu.getPropertiesWithResponse(null, null, null).headers().value("ETag") } else { return match } @@ -347,18 +492,15 @@ class APISpec extends Specification { def setupBlobLeaseCondition(BlobClient bu, String leaseID) { String responseLeaseId = null if (leaseID == receivedLeaseID || leaseID == garbageLeaseID) { - responseLeaseId = bu.acquireLease(null, -1, null, null).value() - } - if (leaseID == receivedLeaseID) { - return responseLeaseId - } else { - return leaseID + responseLeaseId = bu.acquireLease(null, -1) } + + return (leaseID == receivedLeaseID) ? responseLeaseId : leaseID } def setupContainerMatchCondition(ContainerClient cu, String match) { if (match == receivedEtag) { - return cu.getProperties().headers().value("ETag") + return cu.getPropertiesWithResponse(null, null, null).headers().value("ETag") } else { return match } @@ -366,7 +508,7 @@ class APISpec extends Specification { def setupContainerLeaseCondition(ContainerClient cu, String leaseID) { if (leaseID == receivedLeaseID) { - return cu.acquireLease(null, -1).value() + return cu.acquireLeaseWithResponse(null, -1, null, null, null).value() } else { return leaseID } @@ -383,12 +525,12 @@ class APISpec extends Specification { def waitForCopy(ContainerClient bu, String status) { OffsetDateTime start = OffsetDateTime.now() while (status != CopyStatusType.SUCCESS.toString()) { - status = bu.getProperties().headers().value("x-ms-copy-status") + status = bu.getPropertiesWithResponse(null, null, null).headers().value("x-ms-copy-status") OffsetDateTime currentTime = OffsetDateTime.now() if (status == CopyStatusType.FAILED.toString() || currentTime.minusMinutes(1) == start) { throw new Exception("Copy failed or took too long") } - sleep(1000) + sleepIfRecord(1000) } } @@ -411,7 +553,7 @@ class APISpec extends Specification { } def validateBlobProperties(Response response, String cacheControl, String contentDisposition, String contentEncoding, - String contentLanguage, byte[] contentMD5, String contentType) { + String contentLanguage, byte[] contentMD5, String contentType) { return response.value().cacheControl() == cacheControl && response.value().contentDisposition() == contentDisposition && response.value().contentEncoding() == contentEncoding && @@ -420,7 +562,7 @@ class APISpec extends Specification { response.headers().value("Content-Type") == contentType } - static Metadata getMetadataFromHeaders(HttpHeaders headers) { + Metadata getMetadataFromHeaders(HttpHeaders headers) { Metadata metadata = new Metadata() for (Map.Entry header : headers.toMap()) { @@ -434,75 +576,38 @@ class APISpec extends Specification { } def enableSoftDelete() { - primaryServiceURL.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new StorageServiceProperties() .deleteRetentionPolicy(new RetentionPolicy().enabled(true).days(2))) - sleep(30000) // Wait for the policy to take effect. + + sleepIfRecord(30000) } def disableSoftDelete() { - primaryServiceURL.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new StorageServiceProperties() .deleteRetentionPolicy(new RetentionPolicy().enabled(false))) - sleep(30000) // Wait for the policy to take effect. + sleepIfRecord(30000) } - - - /* - This method returns a stub of an HttpResponse. This is for when we want to test policies in isolation but don't care - about the status code, so we stub a response that always returns a given value for the status code. We never care - about the number or nature of interactions with this stub. - */ - - def getStubResponse(int code) { - return Stub(HttpResponse) { - statusCode() >> code + // Only sleep if test is running in live mode + def sleepIfRecord(long milliseconds) { + if (testMode == TestMode.RECORD) { + sleep(milliseconds) } } - /* - This is for stubbing responses that will actually go through the pipeline and autorest code. Autorest does not seem - to play too nicely with mocked objects and the complex reflection stuff on both ends made it more difficult to work - with than was worth it. - */ - def getStubResponse(int code, HttpRequest request) { - return new HttpResponse() { - - @Override - int statusCode() { - return code - } - - @Override - String headerValue(String s) { - return null - } - - @Override - HttpHeaders headers() { - return new HttpHeaders() - } - - @Override - Flux body() { - return Flux.empty() - } - - @Override - Mono bodyAsByteArray() { - return Mono.just(new byte[0]) - } - - @Override - Mono bodyAsString() { - return Mono.just("") - } - - @Override - Mono bodyAsString(Charset charset) { - return Mono.just("") + class MockRetryRangeResponsePolicy implements HttpPipelinePolicy { + @Override + Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + return next.process().flatMap { HttpResponse response -> + if (response.request().headers().value("x-ms-range") != "bytes=2-6") { + return Mono. error(new IllegalArgumentException("The range header was not set correctly on retry.")) + } else { + // ETag can be a dummy value. It's not validated, but DownloadResponse requires one + return Mono. just(new MockDownloadHttpResponse(response, 206, Flux.error(new IOException()))) + } } - }.request(request) + } } /* @@ -510,12 +615,13 @@ class APISpec extends Specification { to play too nicely with mocked objects and the complex reflection stuff on both ends made it more difficult to work with than was worth it. Because this type is just for BlobDownload, we don't need to accept a header type. */ - static class MockDownloadHttpResponse extends HttpResponse { + + class MockDownloadHttpResponse extends HttpResponse { private final int statusCode private final HttpHeaders headers - private final Flux body + private final Flux body - MockDownloadHttpResponse(HttpResponse response, int statusCode, Flux body) { + MockDownloadHttpResponse(HttpResponse response, int statusCode, Flux body) { this.request(response.request()) this.statusCode = statusCode this.headers = response.headers() @@ -538,7 +644,7 @@ class APISpec extends Specification { } @Override - Flux body() { + Flux body() { return body } @@ -557,33 +663,4 @@ class APISpec extends Specification { return Mono.error(new IOException()) } } - - def getContextStubPolicy(int successCode, Class responseHeadersType) { - return Mock(HttpPipelinePolicy) { - process(_ as HttpPipelineCallContext, _ as HttpPipelineNextPolicy) >> { - HttpPipelineCallContext context, HttpPipelineNextPolicy next -> - if (!context.getData(defaultContextKey).isPresent()) { - return Mono.error(new RuntimeException("Context key not present.")) - } else { - return Mono.just(getStubResponse(successCode, context.httpRequest())) - } - } - } - } - - def getOAuthServiceURL() { - return new BlobServiceClientBuilder() - .endpoint(String.format("https://%s.blob.core.windows.net/", primaryCreds.accountName())) - .credential(new EnvironmentCredentialBuilder().build()) // AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient() - } - - def getTestMode(){ - String testMode = System.getenv("AZURE_TEST_MODE") - if(testMode == null){ - testMode = "PLAYBACK" - } - return testMode - } } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/AppendBlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/AppendBlobAPITest.groovy index 5d6f364f7e5e..7fa6e6f5a73a 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/AppendBlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/AppendBlobAPITest.groovy @@ -4,22 +4,33 @@ package com.azure.storage.blob import com.azure.core.http.rest.Response -import com.azure.storage.blob.models.* +import com.azure.storage.blob.models.AppendBlobAccessConditions +import com.azure.storage.blob.models.AppendBlobItem +import com.azure.storage.blob.models.AppendPositionAccessConditions +import com.azure.storage.blob.models.BlobAccessConditions +import com.azure.storage.blob.models.BlobHTTPHeaders +import com.azure.storage.blob.models.BlobRange +import com.azure.storage.blob.models.LeaseAccessConditions +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.ModifiedAccessConditions +import com.azure.storage.blob.models.PublicAccessType +import com.azure.storage.blob.models.SourceModifiedAccessConditions +import com.azure.storage.blob.models.StorageException import spock.lang.Unroll import java.security.MessageDigest class AppendBlobAPITest extends APISpec { - AppendBlobClient bu + AppendBlobClient bc def setup() { - bu = cu.getAppendBlobClient(generateBlobName()) - bu.create() + bc = cc.getAppendBlobClient(generateBlobName()) + bc.create() } def "Create defaults"() { when: - Response createResponse = bu.create() + Response createResponse = bc.createWithResponse(null, null, null, null, null) then: createResponse.statusCode() == 201 @@ -30,12 +41,12 @@ class AppendBlobAPITest extends APISpec { def "Create min"() { expect: - bu.create().statusCode() == 201 + bc.createWithResponse(null, null, null, null, null).statusCode() == 201 } def "Create error"() { when: - bu.create(null, null, + bc.create(null, null, new BlobAccessConditions().modifiedAccessConditions(new ModifiedAccessConditions().ifMatch("garbage")), null) @@ -47,15 +58,15 @@ class AppendBlobAPITest extends APISpec { def "Create headers"() { setup: BlobHTTPHeaders headers = new BlobHTTPHeaders().blobCacheControl(cacheControl) - .blobContentDisposition(contentDisposition) - .blobContentEncoding(contentEncoding) - .blobContentLanguage(contentLanguage) - .blobContentMD5(contentMD5) - .blobContentType(contentType) + .blobContentDisposition(contentDisposition) + .blobContentEncoding(contentEncoding) + .blobContentLanguage(contentLanguage) + .blobContentMD5(contentMD5) + .blobContentType(contentType) when: - bu.create(headers, null, null, null) - Response response = bu.getProperties() + bc.createWithResponse(headers, null, null, null, null) + Response response = bc.getPropertiesWithResponse(null, null, null) // If the value isn't set the service will automatically set it contentType = (contentType == null) ? "application/octet-stream" : contentType @@ -64,15 +75,15 @@ class AppendBlobAPITest extends APISpec { validateBlobProperties(response, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentMD5, contentType) where: - cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType - null | null | null | null | null | null - "control" | "disposition" | "encoding" | "language" | Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultText.getBytes())) | "type" + cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType + null | null | null | null | null | null + "control" | "disposition" | "encoding" | "language" | Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultText.getBytes())) | "type" } @Unroll def "Create metadata"() { setup: - Metadata metadata = new Metadata() + def metadata = new Metadata() if (key1 != null) { metadata.put(key1, value1) } @@ -81,11 +92,11 @@ class AppendBlobAPITest extends APISpec { } when: - bu.create(null, metadata, null, null) - Response response = bu.getProperties(null, null) + bc.create(null, metadata, null, null) + def response = bc.getProperties() then: - response.value().metadata() == metadata + response.metadata() == metadata where: key1 | value1 | key2 | value2 @@ -96,8 +107,8 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Create AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions().ifModifiedSince(modified) @@ -106,9 +117,8 @@ class AppendBlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) - expect: - bu.create(null, null, bac, null).statusCode() == 201 + bc.createWithResponse(null, null, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -123,8 +133,8 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Create AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions().ifModifiedSince(modified) @@ -133,7 +143,7 @@ class AppendBlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.create(null, null, bac, null) + bc.create(null, null, bac, null) then: thrown(StorageException) @@ -149,45 +159,47 @@ class AppendBlobAPITest extends APISpec { def "Append block defaults"() { setup: - Response appendResponse = bu.appendBlock(defaultInputStream.get(), defaultDataSize) + Response appendResponse = bc.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null) - expect: + when: ByteArrayOutputStream downloadStream = new ByteArrayOutputStream() - bu.download(downloadStream) + bc.download(downloadStream) + then: downloadStream.toByteArray() == defaultData.array() validateBasicHeaders(appendResponse.headers()) - appendResponse.value().contentMD5() != null + appendResponse.headers().value("x-ms-content-crc64") != null appendResponse.value().blobAppendOffset() != null appendResponse.value().blobCommittedBlockCount() != null - Integer.parseInt(bu.getProperties().headers().value("x-ms-blob-committed-block-count")) == 1 + + expect: + Integer.parseInt(bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-blob-committed-block-count")) == 1 } def "Append block min"() { - expect: - bu.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() == 201 + bc.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).statusCode() == 201 } @Unroll def "Append block IA"() { when: - bu.appendBlock(data, dataSize) + bc.appendBlock(data, dataSize) then: def e = thrown(Exception) exceptionType.isInstance(e) where: - data | dataSize | exceptionType - null | defaultDataSize | NullPointerException - defaultInputStream.get() | defaultDataSize + 1 | IndexOutOfBoundsException + data | dataSize | exceptionType + null | defaultDataSize | NullPointerException + defaultInputStream.get() | defaultDataSize + 1 | IndexOutOfBoundsException // TODO (alzimmer): This doesn't throw an error as the stream is larger than the stated size //defaultInputStream.get() | defaultDataSize - 1 | StorageException } def "Append block empty body"() { when: - bu.appendBlock(new ByteArrayInputStream(new byte[0]), 0) + bc.appendBlock(new ByteArrayInputStream(new byte[0]), 0) then: thrown(StorageException) @@ -195,7 +207,7 @@ class AppendBlobAPITest extends APISpec { def "Append block null body"() { when: - bu.appendBlock(new ByteArrayInputStream(null), 0) + bc.appendBlock(new ByteArrayInputStream(null), 0) then: thrown(NullPointerException) @@ -204,8 +216,8 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) AppendBlobAccessConditions bac = new AppendBlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .appendPositionAccessConditions(new AppendPositionAccessConditions() @@ -218,9 +230,8 @@ class AppendBlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) - expect: - bu.appendBlock(defaultInputStream.get(), defaultDataSize, bac, null).statusCode() == 201 + bc.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | appendPosE | maxSizeLTE @@ -237,8 +248,8 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) AppendBlobAccessConditions bac = new AppendBlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) @@ -252,7 +263,7 @@ class AppendBlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.appendBlock(defaultInputStream.get(), defaultDataSize, bac, null) + bc.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, bac, null, null) then: thrown(StorageException) @@ -270,10 +281,10 @@ class AppendBlobAPITest extends APISpec { def "Append block error"() { setup: - bu = cu.getAppendBlobClient(generateBlobName()) + bc = cc.getAppendBlobClient(generateBlobName()) when: - bu.appendBlock(defaultInputStream.get(), defaultDataSize) + bc.appendBlock(defaultInputStream.get(), defaultDataSize) then: thrown(StorageException) @@ -281,17 +292,17 @@ class AppendBlobAPITest extends APISpec { def "Append block from URL min"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) byte[] data = getRandomByteArray(1024) - bu.appendBlock(new ByteArrayInputStream(data), data.length) + bc.appendBlock(new ByteArrayInputStream(data), data.length) - AppendBlobClient destURL = cu.getAppendBlobClient(generateBlobName()) + AppendBlobClient destURL = cc.getAppendBlobClient(generateBlobName()) destURL.create() BlobRange blobRange = new BlobRange(0, (long) PageBlobClient.PAGE_BYTES) when: - Response response = destURL.appendBlockFromUrl(bu.getBlobUrl(), blobRange) + Response response = destURL.appendBlockFromUrlWithResponse(bc.getBlobUrl(), blobRange, null, null, null, null, null) then: response.statusCode() == 201 @@ -300,15 +311,15 @@ class AppendBlobAPITest extends APISpec { def "Append block from URL range"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) byte[] data = getRandomByteArray(4 * 1024) - bu.appendBlock(new ByteArrayInputStream(data), data.length) + bc.appendBlock(new ByteArrayInputStream(data), data.length) - AppendBlobClient destURL = cu.getAppendBlobClient(generateBlobName()) + AppendBlobClient destURL = cc.getAppendBlobClient(generateBlobName()) destURL.create() when: - destURL.appendBlockFromUrl(bu.getBlobUrl(), new BlobRange(2 * 1024, 1024)) + destURL.appendBlockFromUrl(bc.getBlobUrl(), new BlobRange(2 * 1024, 1024)) then: ByteArrayOutputStream downloadStream = new ByteArrayOutputStream(1024) @@ -318,15 +329,15 @@ class AppendBlobAPITest extends APISpec { def "Append block from URL MD5"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) byte[] data = getRandomByteArray(1024) - bu.appendBlock(new ByteArrayInputStream(data), data.length) + bc.appendBlock(new ByteArrayInputStream(data), data.length) - AppendBlobClient destURL = cu.getAppendBlobClient(generateBlobName()) + AppendBlobClient destURL = cc.getAppendBlobClient(generateBlobName()) destURL.create() when: - destURL.appendBlockFromUrl(bu.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest(data), + destURL.appendBlockFromUrl(bc.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest(data), null, null, null) then: @@ -335,15 +346,15 @@ class AppendBlobAPITest extends APISpec { def "Append block from URL MD5 fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) byte[] data = getRandomByteArray(1024) - bu.appendBlock(new ByteArrayInputStream(data), data.length) + bc.appendBlock(new ByteArrayInputStream(data), data.length) - def destURL = cu.getAppendBlobClient(generateBlobName()) + def destURL = cc.getAppendBlobClient(generateBlobName()) destURL.create() when: - destURL.appendBlockFromUrl(bu.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest("garbage".getBytes()), + destURL.appendBlockFromUrl(bc.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest("garbage".getBytes()), null, null, null) then: @@ -353,9 +364,9 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block from URL destination AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) def bac = new AppendBlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .appendPositionAccessConditions(new AppendPositionAccessConditions() @@ -367,12 +378,12 @@ class AppendBlobAPITest extends APISpec { .ifMatch(match) .ifNoneMatch(noneMatch)) - def sourceURL = cu.getAppendBlobClient(generateBlobName()) + def sourceURL = cc.getAppendBlobClient(generateBlobName()) sourceURL.create() - sourceURL.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() + sourceURL.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).statusCode() expect: - bu.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, bac, null, null).statusCode() == 201 + bc.appendBlockFromUrlWithResponse(sourceURL.getBlobUrl(), null, null, bac, null, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | appendPosE | maxSizeLTE @@ -389,9 +400,9 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block from URL AC destination fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) def bac = new AppendBlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) @@ -404,12 +415,12 @@ class AppendBlobAPITest extends APISpec { .ifMatch(match) .ifNoneMatch(noneMatch)) - def sourceURL = cu.getAppendBlobClient(generateBlobName()) + def sourceURL = cc.getAppendBlobClient(generateBlobName()) sourceURL.create() - sourceURL.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() + sourceURL.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).statusCode() when: - bu.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, bac, null, null) + bc.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, bac, null, null) then: thrown(StorageException) @@ -428,20 +439,20 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block from URL source AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) - def sourceURL = cu.getAppendBlobClient(generateBlobName()) + def sourceURL = cc.getAppendBlobClient(generateBlobName()) sourceURL.create() - sourceURL.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() + sourceURL.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).statusCode() def smac = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceIfModifiedSince) - .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) - .sourceIfMatch(setupBlobMatchCondition(sourceURL, sourceIfMatch)) - .sourceIfNoneMatch(sourceIfNoneMatch) + .sourceIfModifiedSince(sourceIfModifiedSince) + .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) + .sourceIfMatch(setupBlobMatchCondition(sourceURL, sourceIfMatch)) + .sourceIfNoneMatch(sourceIfNoneMatch) expect: - bu.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, null, smac, null).statusCode() == 201 + bc.appendBlockFromUrlWithResponse(sourceURL.getBlobUrl(), null, null, null, smac, null, null).statusCode() == 201 where: sourceIfModifiedSince | sourceIfUnmodifiedSince | sourceIfMatch | sourceIfNoneMatch @@ -455,20 +466,20 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block from URL AC source fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) - def sourceURL = cu.getAppendBlobClient(generateBlobName()) + def sourceURL = cc.getAppendBlobClient(generateBlobName()) sourceURL.create() - sourceURL.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() + sourceURL.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).statusCode() def smac = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceIfModifiedSince) - .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) - .sourceIfMatch(sourceIfMatch) - .sourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) + .sourceIfModifiedSince(sourceIfModifiedSince) + .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) + .sourceIfMatch(sourceIfMatch) + .sourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) when: - bu.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, null, smac, null) + bc.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, null, smac, null) then: thrown(StorageException) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy index 4ad895869cba..7bce3ee57d93 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy @@ -4,15 +4,29 @@ package com.azure.storage.blob import com.azure.core.http.HttpHeaders -import com.azure.core.http.HttpPipelineCallContext -import com.azure.core.http.HttpPipelineNextPolicy -import com.azure.core.http.policy.HttpPipelinePolicy import com.azure.core.http.rest.Response import com.azure.core.http.rest.VoidResponse import com.azure.core.implementation.util.ImplUtils -import com.azure.storage.blob.models.* -import reactor.core.publisher.Flux -import reactor.core.publisher.Mono +import com.azure.storage.blob.models.AccessTier +import com.azure.storage.blob.models.ArchiveStatus +import com.azure.storage.blob.models.BlobAccessConditions +import com.azure.storage.blob.models.BlobHTTPHeaders +import com.azure.storage.blob.models.BlobRange +import com.azure.storage.blob.models.BlobType +import com.azure.storage.blob.models.CopyStatusType +import com.azure.storage.blob.models.DeleteSnapshotsOptionType +import com.azure.storage.blob.models.LeaseAccessConditions +import com.azure.storage.blob.models.LeaseDurationType +import com.azure.storage.blob.models.LeaseStateType +import com.azure.storage.blob.models.LeaseStatusType +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.ModifiedAccessConditions +import com.azure.storage.blob.models.PublicAccessType +import com.azure.storage.blob.models.ReliableDownloadOptions +import com.azure.storage.blob.models.StorageAccountInfo +import com.azure.storage.blob.models.StorageErrorCode +import com.azure.storage.blob.models.StorageException +import com.azure.storage.blob.models.SyncCopyStatusType import spock.lang.Unroll import java.nio.ByteBuffer @@ -20,17 +34,17 @@ import java.security.MessageDigest import java.time.OffsetDateTime class BlobAPITest extends APISpec { - BlobClient bu + BlobClient bc def setup() { - bu = cu.getBlockBlobClient(generateBlobName()) - bu.upload(defaultInputStream.get(), defaultDataSize) + bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) } def "Download all null"() { when: ByteArrayOutputStream stream = new ByteArrayOutputStream() - VoidResponse response = bu.download(stream) + VoidResponse response = bc.downloadWithResponse(stream, null, null, null, false, null, null) ByteBuffer body = ByteBuffer.wrap(stream.toByteArray()) HttpHeaders headers = response.headers() @@ -64,12 +78,12 @@ class BlobAPITest extends APISpec { def "Download empty file"() { setup: - bu = cu.getAppendBlobClient("emptyAppendBlob") - bu.create() + bc = cc.getAppendBlobClient("emptyAppendBlob") + bc.create() when: def outStream = new ByteArrayOutputStream() - bu.download(outStream) + bc.download(outStream) def result = outStream.toByteArray() then: @@ -91,31 +105,12 @@ class BlobAPITest extends APISpec { constructed in BlobClient.download(). */ setup: - HttpPipelinePolicy mockPolicy = Mock(HttpPipelinePolicy) { - process(_ as HttpPipelineCallContext, _ as HttpPipelineNextPolicy) >> { - HttpPipelineCallContext context, HttpPipelineNextPolicy next -> - return next.process() - .flatMap { - if (it.request().headers().value("x-ms-range") != "bytes=2-6") { - return Mono.error(new IllegalArgumentException("The range header was not set correctly on retry.")) - } else { - // ETag can be a dummy value. It's not validated, but DownloadResponse requires one - return Mono.just(new MockDownloadHttpResponse(it, 206, Flux.error(new IOException()))) - } - } - } - } - - BlobClient bu2 = new BlobClientBuilder() - .endpoint(bu.getBlobUrl().toString()) - .credential(primaryCreds) - .addPolicy(mockPolicy) - .buildBlobClient() + BlobClient bu2 = getBlobClient(primaryCredential, bc.getBlobUrl().toString(), new MockRetryRangeResponsePolicy()) when: BlobRange range = new BlobRange(2, 5L) ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(3) - bu2.download(new ByteArrayOutputStream(), range, options, null, false, null) + bu2.downloadWithResponse(new ByteArrayOutputStream(), range, options, null, false, null, null) then: /* @@ -129,7 +124,7 @@ class BlobAPITest extends APISpec { def "Download min"() { when: def outStream = new ByteArrayOutputStream() - bu.download(outStream) + bc.download(outStream) byte[] result = outStream.toByteArray() then: @@ -143,7 +138,7 @@ class BlobAPITest extends APISpec { when: def outStream = new ByteArrayOutputStream() - bu.download(outStream, range, null, null, false, null) + bc.downloadWithResponse(outStream, range, null, null, false, null, null) String bodyStr = outStream.toString() then: @@ -152,15 +147,15 @@ class BlobAPITest extends APISpec { where: offset | count || expectedData 0 | null || defaultText - 0 | 5L || defaultText.substring(0, 5) + 0 | 5L || defaultText.substring(0, 5) 3 | 2L || defaultText.substring(3, 3 + 2) } @Unroll def "Download AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions().ifModifiedSince(modified) @@ -169,7 +164,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - def response = bu.download(new ByteArrayOutputStream(), null, null, bac, false, null) + def response = bc.downloadWithResponse(new ByteArrayOutputStream(), null, null, bac, false, null, null) then: response.statusCode() == 200 @@ -187,17 +182,17 @@ class BlobAPITest extends APISpec { @Unroll def "Download AC fail"() { setup: - setupBlobLeaseCondition(bu, leaseID) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.download(new ByteArrayOutputStream(), null, null, bac, false, null).statusCode() == 206 + bc.downloadWithResponse(new ByteArrayOutputStream(), null, null, bac, false, null, null).statusCode() then: thrown(StorageException) @@ -213,7 +208,7 @@ class BlobAPITest extends APISpec { def "Download md5"() { when: - VoidResponse response = bu.download(new ByteArrayOutputStream(), new BlobRange(0 ,3), null, null, true, null) + VoidResponse response = bc.downloadWithResponse(new ByteArrayOutputStream(), new BlobRange(0, 3), null, null, true, null, null) byte[] contentMD5 = response.headers().value("content-md5").getBytes() then: @@ -222,10 +217,10 @@ class BlobAPITest extends APISpec { def "Download error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.download(null, null, null, null, false, null) + bc.download(null) then: thrown(StorageException) @@ -234,22 +229,20 @@ class BlobAPITest extends APISpec { def "Download snapshot"() { when: ByteArrayOutputStream originalStream = new ByteArrayOutputStream() - bu.download(originalStream) + bc.download(originalStream) - BlockBlobClient bu2 = bu.asBlockBlobClient() - BlobClient bu3 = bu.createSnapshot().value() - bu2.upload(new ByteArrayInputStream("ABC".getBytes()), 3) + def bc2 = bc.createSnapshot() + bc.asBlockBlobClient().upload(new ByteArrayInputStream("ABC".getBytes()), 3) then: ByteArrayOutputStream snapshotStream = new ByteArrayOutputStream() - bu3.download(snapshotStream) + bc2.download(snapshotStream) snapshotStream.toByteArray() == originalStream.toByteArray() } def "Get properties default"() { when: - Response response = bu.getProperties(null, null) - HttpHeaders headers = response.headers() + def headers = bc.getPropertiesWithResponse(null, null, null).headers() then: validateBasicHeaders(headers) @@ -285,22 +278,22 @@ class BlobAPITest extends APISpec { def "Get properties min"() { expect: - bu.getProperties().statusCode() == 200 + bc.getPropertiesWithResponse(null, null, null).statusCode() == 200 } @Unroll def "Get properties AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) expect: - bu.getProperties(bac, null).statusCode() == 200 + bc.getPropertiesWithResponse(bac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -316,15 +309,15 @@ class BlobAPITest extends APISpec { def "Get properties AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.getProperties(bac, null) + bc.getPropertiesWithResponse(bac, null, null) then: thrown(StorageException) @@ -340,10 +333,10 @@ class BlobAPITest extends APISpec { def "Get properties error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.getProperties(null, null) + bc.getProperties() then: thrown(StorageException) @@ -351,7 +344,7 @@ class BlobAPITest extends APISpec { def "Set HTTP headers null"() { setup: - VoidResponse response = bu.setHTTPHeaders(null) + VoidResponse response = bc.setHTTPHeadersWithResponse(null, null, null, null) expect: response.statusCode() == 200 @@ -359,8 +352,8 @@ class BlobAPITest extends APISpec { } def "Set HTTP headers min"() { - when: - BlobProperties properties = bu.getProperties().value() + setup: + BlobProperties properties = bc.getProperties() BlobHTTPHeaders headers = new BlobHTTPHeaders() .blobContentEncoding(properties.contentEncoding()) .blobContentDisposition(properties.contentDisposition()) @@ -369,10 +362,10 @@ class BlobAPITest extends APISpec { .blobContentLanguage(properties.contentLanguage()) .blobContentMD5(Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultData.array()))) - bu.setHTTPHeaders(headers) + bc.setHTTPHeaders(headers) - then: - bu.getProperties().headers().value("Content-Type") == "type" + expect: + bc.getPropertiesWithResponse(null, null, null).headers().value("Content-Type") == "type" } @Unroll @@ -385,12 +378,12 @@ class BlobAPITest extends APISpec { .blobContentMD5(contentMD5) .blobContentType(contentType) - bu.setHTTPHeaders(putHeaders) - - Response response = bu.getProperties() + bc.setHTTPHeaders(putHeaders) expect: - validateBlobProperties(response, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentMD5, contentType) + validateBlobProperties( + bc.getPropertiesWithResponse(null, null, null), + cacheControl, contentDisposition, contentEncoding, contentLanguage, contentMD5, contentType) where: cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType @@ -402,8 +395,8 @@ class BlobAPITest extends APISpec { @Unroll def "Set HTTP headers AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -413,7 +406,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) expect: - bu.setHTTPHeaders(null, bac, null).statusCode() == 200 + bc.setHTTPHeadersWithResponse(null, bac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -428,8 +421,8 @@ class BlobAPITest extends APISpec { @Unroll def "Set HTTP headers AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -439,7 +432,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.setHTTPHeaders(null, bac, null) + bc.setHTTPHeadersWithResponse(null, bac, null, null) then: thrown(StorageException) @@ -455,21 +448,21 @@ class BlobAPITest extends APISpec { def "Set HTTP headers error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.setHTTPHeaders(null, null, null) + bc.setHTTPHeaders(null) then: thrown(StorageException) } def "Set metadata all null"() { - setup: - VoidResponse response = bu.setMetadata(null, null, null) + when: + def response = bc.setMetadataWithResponse(null, null, null, null) - expect: - bu.getProperties(null, null).value().metadata().size() == 0 + then: + bc.getProperties().metadata().size() == 0 response.statusCode() == 200 validateBasicHeaders(response.headers()) Boolean.parseBoolean(response.headers().value("x-ms-request-server-encrypted")) @@ -477,14 +470,14 @@ class BlobAPITest extends APISpec { def "Set metadata min"() { setup: - Metadata metadata = new Metadata() + def metadata = new Metadata() metadata.put("foo", "bar") when: - bu.setMetadata(metadata) + bc.setMetadata(metadata) then: - bu.getProperties().value().metadata() == metadata + bc.getProperties().metadata() == metadata } @Unroll @@ -499,8 +492,8 @@ class BlobAPITest extends APISpec { } expect: - bu.setMetadata(metadata, null, null).statusCode() == statusCode - bu.getProperties(null, null).value().metadata() == metadata + bc.setMetadataWithResponse(metadata, null, null, null).statusCode() == statusCode + bc.getPropertiesWithResponse(null, null, null).value().metadata() == metadata where: key1 | value1 | key2 | value2 || statusCode @@ -511,8 +504,8 @@ class BlobAPITest extends APISpec { @Unroll def "Set metadata AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -522,7 +515,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) expect: - bu.setMetadata(null, bac, null).statusCode() == 200 + bc.setMetadataWithResponse(null, bac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -537,8 +530,8 @@ class BlobAPITest extends APISpec { @Unroll def "Set metadata AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) @@ -549,7 +542,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.setMetadata(null, bac, null) + bc.setMetadataWithResponse(null, bac, null, null) then: thrown(StorageException) @@ -565,10 +558,10 @@ class BlobAPITest extends APISpec { def "Set metadata error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.setMetadata(null, null, null) + bc.setMetadata(null) then: thrown(StorageException) @@ -576,16 +569,18 @@ class BlobAPITest extends APISpec { @Unroll def "Acquire lease"() { - setup: - String leaseId = bu.acquireLease(proposedID, leaseTime, null, null).value() + when: + def leaseId = bc.acquireLease(proposedID, leaseTime) + + then: + leaseId != null when: - HttpHeaders headers = bu.getProperties(null, null).headers() + def headers = bc.getPropertiesWithResponse(null, null, null).headers() then: headers.value("x-ms-lease-state") == leaseState.toString() headers.value("x-ms-lease-duration") == leaseDuration.toString() - leaseId != null validateBasicHeaders(headers) where: @@ -596,14 +591,14 @@ class BlobAPITest extends APISpec { } def "Acquire lease min"() { - setup: - bu.acquireLease(null, -1).statusCode() == 201 + expect: + bc.acquireLeaseWithResponse(null, -1, null, null, null).statusCode() == 201 } @Unroll def "Acquire lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) + match = setupBlobMatchCondition(bc, match) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -611,7 +606,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu.acquireLease(null, -1, mac, null).statusCode() == 201 + bc.acquireLeaseWithResponse(null, -1, mac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch @@ -625,7 +620,7 @@ class BlobAPITest extends APISpec { @Unroll def "Acquire lease AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) + noneMatch = setupBlobMatchCondition(bc, noneMatch) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -633,7 +628,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu.acquireLease(null, -1, mac, null) + bc.acquireLeaseWithResponse(null, -1, mac, null, null) then: thrown(StorageException) @@ -648,10 +643,10 @@ class BlobAPITest extends APISpec { def "Acquire lease error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.acquireLease(null, 20, null, null) + bc.acquireLease(null, 20) then: thrown(StorageException) @@ -659,30 +654,31 @@ class BlobAPITest extends APISpec { def "Renew lease"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) - Thread.sleep(16000) // Wait for the lease to expire to ensure we are actually renewing it - Response renewLeaseResponse = bu.renewLease(leaseID, null, null) + // If running in live mode wait for the lease to expire to ensure we are actually renewing it + sleepIfRecord(16000) + Response renewLeaseResponse = bc.renewLeaseWithResponse(leaseID, null, null, null) expect: - bu.getProperties(null, null).headers().value("x-ms-lease-state") == LeaseStateType.LEASED.toString() + bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state") == LeaseStateType.LEASED.toString() validateBasicHeaders(renewLeaseResponse.headers()) renewLeaseResponse.value() != null } def "Renew lease min"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) expect: - bu.renewLease(leaseID).statusCode() == 200 + bc.renewLeaseWithResponse(leaseID, null, null, null).statusCode() == 200 } @Unroll def "Renew lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + match = setupBlobMatchCondition(bc, match) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -690,7 +686,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu.renewLease(leaseID, mac, null).statusCode() == 200 + bc.renewLeaseWithResponse(leaseID, mac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch @@ -703,8 +699,8 @@ class BlobAPITest extends APISpec { @Unroll def "Renew lease AC fail"() { - noneMatch = setupBlobMatchCondition(bu, noneMatch) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -712,7 +708,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu.renewLease(leaseID, mac, null) + bc.renewLeaseWithResponse(leaseID, mac, null, null) then: thrown(StorageException) @@ -727,10 +723,10 @@ class BlobAPITest extends APISpec { def "Renew lease error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.renewLease("id", null, null) + bc.renewLease("id") then: thrown(StorageException) @@ -738,28 +734,27 @@ class BlobAPITest extends APISpec { def "Release lease"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) - - HttpHeaders headers = bu.releaseLease(leaseID, null, null).headers() + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) + HttpHeaders headers = bc.releaseLeaseWithResponse(leaseID, null, null, null).headers() expect: - bu.getProperties(null, null).headers().value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() + bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() validateBasicHeaders(headers) } def "Release lease min"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) expect: - bu.releaseLease(leaseID).statusCode() == 200 + bc.releaseLeaseWithResponse(leaseID, null, null, null).statusCode() == 200 } @Unroll def "Release lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + match = setupBlobMatchCondition(bc, match) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -767,7 +762,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu.releaseLease(leaseID, mac, null).statusCode() == 200 + bc.releaseLeaseWithResponse(leaseID, mac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch @@ -781,8 +776,8 @@ class BlobAPITest extends APISpec { @Unroll def "Release lease AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -790,7 +785,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu.releaseLease(leaseID, mac, null) + bc.releaseLeaseWithResponse(leaseID, mac, null, null) then: thrown(StorageException) @@ -805,10 +800,10 @@ class BlobAPITest extends APISpec { def "Release lease error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.releaseLease("id", null, null) + bc.releaseLease("id") then: thrown(StorageException) @@ -817,10 +812,10 @@ class BlobAPITest extends APISpec { @Unroll def "Break lease"() { setup: - bu.acquireLease(UUID.randomUUID().toString(), leaseTime, null, null) + bc.acquireLeaseWithResponse(getRandomUUID(), leaseTime, null, null, null) - Response breakLeaseResponse = bu.breakLease(breakPeriod, null, null) - String leaseState = bu.getProperties(null, null).headers().value("x-ms-lease-state") + Response breakLeaseResponse = bc.breakLeaseWithResponse(breakPeriod, null, null, null) + String leaseState = bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state") expect: leaseState == LeaseStateType.BROKEN.toString() || leaseState == LeaseStateType.BREAKING.toString() @@ -829,24 +824,24 @@ class BlobAPITest extends APISpec { where: leaseTime | breakPeriod | remainingTime - -1 | null | 0 - -1 | 20 | 25 - 20 | 15 | 16 + -1 | null | 0 + -1 | 20 | 25 + 20 | 15 | 16 } def "Break lease min"() { setup: - setupBlobLeaseCondition(bu, receivedLeaseID) + setupBlobLeaseCondition(bc, receivedLeaseID) expect: - bu.breakLease().statusCode() == 202 + bc.breakLeaseWithResponse(null, null, null, null).statusCode() == 202 } @Unroll def "Break lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) - setupBlobLeaseCondition(bu, receivedLeaseID) + match = setupBlobMatchCondition(bc, match) + setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -854,7 +849,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu.breakLease(null, mac, null).statusCode() == 202 + bc.breakLeaseWithResponse(null, mac, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch @@ -868,8 +863,8 @@ class BlobAPITest extends APISpec { @Unroll def "Break lease AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, receivedLeaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -877,7 +872,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu.breakLease(null, mac, null) + bc.breakLeaseWithResponse(null, mac, null, null) then: thrown(StorageException) @@ -892,10 +887,10 @@ class BlobAPITest extends APISpec { def "Break lease error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.breakLease(null, null, null) + bc.breakLease() then: thrown(StorageException) @@ -903,27 +898,27 @@ class BlobAPITest extends APISpec { def "Change lease"() { setup: - Response acquireLeaseResponse = bu.acquireLease(UUID.randomUUID().toString(), 15) - Response changeLeaseResponse = bu.changeLease(acquireLeaseResponse.value(), UUID.randomUUID().toString()) + String acquireLease = bc.acquireLease(getRandomUUID(), 15) + Response changeLeaseResponse = bc.changeLeaseWithResponse(acquireLease, getRandomUUID(), null, null, null) expect: - bu.releaseLease(changeLeaseResponse.value(), null, null).statusCode() == 200 + bc.releaseLeaseWithResponse(changeLeaseResponse.value(), null, null, null).statusCode() == 200 validateBasicHeaders(changeLeaseResponse.headers()) } def "Change lease min"() { setup: - def leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + def leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) expect: - bu.changeLease(leaseID, UUID.randomUUID().toString()).statusCode() == 200 + bc.changeLeaseWithResponse(leaseID, getRandomUUID(), null, null, null).statusCode() == 200 } @Unroll def "Change lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + match = setupBlobMatchCondition(bc, match) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -931,7 +926,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null).statusCode() == 200 + bc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch @@ -945,8 +940,8 @@ class BlobAPITest extends APISpec { @Unroll def "Change lease AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -954,7 +949,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null) + bc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null) then: thrown(StorageException) @@ -969,10 +964,10 @@ class BlobAPITest extends APISpec { def "Change lease error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.changeLease("id", "id", null, null) + bc.changeLease("id", "id") then: thrown(StorageException) @@ -980,17 +975,15 @@ class BlobAPITest extends APISpec { def "Snapshot"() { when: - Response snapshotResponse = bu.createSnapshot() - BlobClient bu2 = snapshotResponse.value() + def response = bc.createSnapshotWithResponse(null, null, null, null) then: - bu2.getProperties().statusCode() == 200 - validateBasicHeaders(snapshotResponse.headers()) + response.value().exists() + validateBasicHeaders(response.headers()) } def "Snapshot min"() { - expect: - bu.createSnapshot().statusCode() == 201 + bc.createSnapshotWithResponse(null, null, null, null).statusCode() == 201 } @Unroll @@ -1004,12 +997,12 @@ class BlobAPITest extends APISpec { metadata.put(key2, value2) } - Response response = bu.createSnapshot(metadata, null, null) - BlobClient bu2 = response.value() + def response = bc.createSnapshotWithResponse(metadata, null, null, null) + def bcSnap = response.value() expect: response.statusCode() == 201 - bu2.getProperties().value().metadata() == metadata + bcSnap.getProperties().metadata() == metadata where: key1 | value1 | key2 | value2 @@ -1020,8 +1013,8 @@ class BlobAPITest extends APISpec { @Unroll def "Snapshot AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -1031,7 +1024,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) expect: - bu.createSnapshot(null, bac, null).statusCode() == 201 + bc.createSnapshotWithResponse(null, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -1046,8 +1039,8 @@ class BlobAPITest extends APISpec { @Unroll def "Snapshot AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -1058,7 +1051,7 @@ class BlobAPITest extends APISpec { when: - bu.createSnapshot(null, bac, null) + bc.createSnapshotWithResponse(null, bac, null, null) then: thrown(StorageException) @@ -1074,10 +1067,10 @@ class BlobAPITest extends APISpec { def "Snapshot error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.createSnapshot(null, null, null) + bc.createSnapshot() then: thrown(StorageException) @@ -1085,15 +1078,15 @@ class BlobAPITest extends APISpec { def "Copy"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - HttpHeaders headers = - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, null, null).headers() + def copyDestBlob = cc.getBlockBlobClient(generateBlobName()) + def headers = + copyDestBlob.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null).headers() when: - while (bu2.getProperties(null, null).headers().value("x-ms-copy-status") == CopyStatusType.PENDING.toString()) { - sleep(1000) + while (copyDestBlob.getPropertiesWithResponse(null, null, null).headers().value("x-ms-copy-status") == CopyStatusType.PENDING.toString()) { + sleepIfRecord(1000) } - HttpHeaders headers2 = bu2.getProperties(null, null).headers() + def headers2 = copyDestBlob.getPropertiesWithResponse(null, null, null).headers() then: headers2.value("x-ms-copy-status") == CopyStatusType.SUCCESS.toString() @@ -1106,13 +1099,13 @@ class BlobAPITest extends APISpec { def "Copy min"() { expect: - bu.startCopyFromURL(bu.getBlobUrl()).statusCode() == 202 + bc.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null).statusCode() == 202 } @Unroll def "Copy metadata"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) Metadata metadata = new Metadata() if (key1 != null && value1 != null) { metadata.put(key1, value1) @@ -1121,14 +1114,13 @@ class BlobAPITest extends APISpec { metadata.put(key2, value2) } - String status = - bu2.startCopyFromURL(bu.getBlobUrl(), metadata, null, null, null) - .headers().value("x-ms-copy-status") + def status = bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), metadata, null, null, null, null) + .headers().value("x-ms-copy-status") OffsetDateTime start = OffsetDateTime.now() while (status != CopyStatusType.SUCCESS.toString()) { - sleep(1000) - status = bu2.getProperties().headers().value("x-ms-copy-status") + sleepIfRecord(1000) + status = bu2.getPropertiesWithResponse(null, null, null).headers().value("x-ms-copy-status") OffsetDateTime currentTime = OffsetDateTime.now() if (status == CopyStatusType.FAILED.toString() || currentTime.minusMinutes(1) == start) { throw new Exception("Copy failed or took too long") @@ -1136,7 +1128,7 @@ class BlobAPITest extends APISpec { } expect: - getMetadataFromHeaders(bu2.getProperties().headers()) == metadata + bu2.getProperties().metadata() == metadata where: key1 | value1 | key2 | value2 @@ -1147,8 +1139,8 @@ class BlobAPITest extends APISpec { @Unroll def "Copy source AC"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - match = setupBlobMatchCondition(bu, match) + BlobClient copyDestBlob = cc.getBlockBlobClient(generateBlobName()) + match = setupBlobMatchCondition(bc, match) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -1156,7 +1148,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu2.startCopyFromURL(bu.getBlobUrl(), null, mac, null, null).statusCode() == 202 + copyDestBlob.startCopyFromURLWithResponse(bc.getBlobUrl(), null, mac, null, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch @@ -1170,8 +1162,8 @@ class BlobAPITest extends APISpec { @Unroll def "Copy source AC fail"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - noneMatch = setupBlobMatchCondition(bu, noneMatch) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) + noneMatch = setupBlobMatchCondition(bc, noneMatch) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -1179,7 +1171,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu2.startCopyFromURL(bu.getBlobUrl(), null, mac, null, null) + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, mac, null, null, null) then: thrown(StorageException) @@ -1195,7 +1187,7 @@ class BlobAPITest extends APISpec { @Unroll def "Copy dest AC"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) match = setupBlobMatchCondition(bu2, match) leaseID = setupBlobLeaseCondition(bu2, leaseID) @@ -1209,7 +1201,7 @@ class BlobAPITest extends APISpec { expect: - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, bac, null).statusCode() == 202 + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, bac, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -1224,7 +1216,7 @@ class BlobAPITest extends APISpec { @Unroll def "Copy dest AC fail"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) noneMatch = setupBlobMatchCondition(bu2, noneMatch) setupBlobLeaseCondition(bu2, leaseID) @@ -1237,7 +1229,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, bac, null) + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, bac, null, null) then: thrown(StorageException) @@ -1252,13 +1244,14 @@ class BlobAPITest extends APISpec { } def "Abort copy lease fail"() { + setup: // Data has to be large enough and copied between accounts to give us enough time to abort - bu.asBlockBlobClient() + bc.asBlockBlobClient() .upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) // So we don't have to create a SAS. - cu.setAccessPolicy(PublicAccessType.BLOB, null) + cc.setAccessPolicy(PublicAccessType.BLOB, null) - ContainerClient cu2 = alternateServiceURL.getContainerClient(generateBlobName()) + ContainerClient cu2 = alternateBlobServiceClient.getContainerClient(generateBlobName()) cu2.create() BlockBlobClient bu2 = cu2.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) @@ -1266,30 +1259,32 @@ class BlobAPITest extends APISpec { when: String copyID = - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, - new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)), null).value() - bu2.abortCopyFromURL(copyID, new LeaseAccessConditions().leaseId(garbageLeaseID), null) + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, + new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)), null, null).value() + bu2.abortCopyFromURLWithResponse(copyID, new LeaseAccessConditions().leaseId(garbageLeaseID), null, null) then: def e = thrown(StorageException) e.statusCode() == 412 + + cleanup: cu2.delete() } def "Abort copy"() { setup: // Data has to be large enough and copied between accounts to give us enough time to abort - bu.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) + bc.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) // So we don't have to create a SAS. - cu.setAccessPolicy(PublicAccessType.BLOB, null) + cc.setAccessPolicy(PublicAccessType.BLOB, null) - ContainerClient cu2 = alternateServiceURL.getContainerClient(generateBlobName()) + ContainerClient cu2 = alternateBlobServiceClient.getContainerClient(generateBlobName()) cu2.create() BlobClient bu2 = cu2.getBlobClient(generateBlobName()) when: - String copyID = bu2.startCopyFromURL(bu.getBlobUrl()).value() - VoidResponse response = bu2.abortCopyFromURL(copyID) + String copyID = bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null).value() + VoidResponse response = bu2.abortCopyFromURLWithResponse(copyID, null, null, null) HttpHeaders headers = response.headers() then: @@ -1298,36 +1293,35 @@ class BlobAPITest extends APISpec { headers.value("x-ms-version") != null headers.value("Date") != null // Normal test cleanup will not clean up containers in the alternate account. - cu2.delete().statusCode() == 202 + cu2.deleteWithResponse(null, null, null).statusCode() == 202 } def "Abort copy min"() { setup: // Data has to be large enough and copied between accounts to give us enough time to abort - bu.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) + bc.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) // So we don't have to create a SAS. - cu.setAccessPolicy(PublicAccessType.BLOB, null) + cc.setAccessPolicy(PublicAccessType.BLOB, null) - ContainerClient cu2 = alternateServiceURL.getContainerClient(generateBlobName()) + ContainerClient cu2 = alternateBlobServiceClient.getContainerClient(generateBlobName()) cu2.create() BlobClient bu2 = cu2.getBlobClient(generateBlobName()) when: - String copyID = - bu2.startCopyFromURL(bu.getBlobUrl()).value() + String copyID = bu2.startCopyFromURL(bc.getBlobUrl()) then: - bu2.abortCopyFromURL(copyID).statusCode() == 204 + bu2.abortCopyFromURLWithResponse(copyID, null, null, null).statusCode() == 204 } def "Abort copy lease"() { setup: // Data has to be large enough and copied between accounts to give us enough time to abort - bu.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) + bc.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) // So we don't have to create a SAS. - cu.setAccessPolicy(PublicAccessType.BLOB, null) + cc.setAccessPolicy(PublicAccessType.BLOB, null) - ContainerClient cu2 = alternateServiceURL.getContainerClient(generateContainerName()) + ContainerClient cu2 = alternateBlobServiceClient.getContainerClient(generateContainerName()) cu2.create() BlockBlobClient bu2 = cu2.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) @@ -1335,21 +1329,21 @@ class BlobAPITest extends APISpec { when: String copyID = - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, - new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)), null).value() + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, + new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)), null, null).value() then: - bu2.abortCopyFromURL(copyID, new LeaseAccessConditions().leaseId(leaseID), null).statusCode() == 204 + bu2.abortCopyFromURLWithResponse(copyID, new LeaseAccessConditions().leaseId(leaseID), null, null).statusCode() == 204 // Normal test cleanup will not clean up containers in the alternate account. cu2.delete() } def "Copy error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.startCopyFromURL(new URL("http://www.error.com")) + bc.startCopyFromURL(new URL("http://www.error.com")) then: thrown(StorageException) @@ -1357,10 +1351,10 @@ class BlobAPITest extends APISpec { def "Abort copy error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.abortCopyFromURL("id") + bc.abortCopyFromURL("id") then: thrown(StorageException) @@ -1369,11 +1363,13 @@ class BlobAPITest extends APISpec { def "Sync copy"() { setup: // Sync copy is a deep copy, which requires either sas or public access. - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - HttpHeaders headers = bu2.copyFromURL(bu.getBlobUrl(), null, null,null, null).headers() + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) - expect: + when: + HttpHeaders headers = bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null).headers() + + then: headers.value("x-ms-copy-status") == SyncCopyStatusType.SUCCESS.toString() headers.value("x-ms-copy-id") != null validateBasicHeaders(headers) @@ -1381,18 +1377,18 @@ class BlobAPITest extends APISpec { def "Sync copy min"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) expect: - bu2.copyFromURL(bu.getBlobUrl()).statusCode() == 202 + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null).statusCode() == 202 } @Unroll def "Sync copy metadata"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) Metadata metadata = new Metadata() if (key1 != null && value1 != null) { metadata.put(key1, value1) @@ -1402,10 +1398,10 @@ class BlobAPITest extends APISpec { } when: - bu2.copyFromURL(bu.getBlobUrl(), metadata, null, null, null) + bu2.copyFromURLWithResponse(bc.getBlobUrl(), metadata, null, null, null, null) then: - getMetadataFromHeaders(bu2.getProperties().headers()) == metadata + bu2.getProperties().metadata() == metadata where: key1 | value1 | key2 | value2 @@ -1416,9 +1412,9 @@ class BlobAPITest extends APISpec { @Unroll def "Sync copy source AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - match = setupBlobMatchCondition(bu, match) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) + match = setupBlobMatchCondition(bc, match) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -1426,7 +1422,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu2.copyFromURL(bu.getBlobUrl(), null, mac, null, null).statusCode() == 202 + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, mac, null, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch @@ -1440,9 +1436,9 @@ class BlobAPITest extends APISpec { @Unroll def "Sync copy source AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - noneMatch = setupBlobMatchCondition(bu, noneMatch) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) + noneMatch = setupBlobMatchCondition(bc, noneMatch) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) @@ -1450,7 +1446,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu2.copyFromURL(bu.getBlobUrl(), null, mac, null, null) + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, mac, null, null, null) then: thrown(StorageException) @@ -1466,8 +1462,8 @@ class BlobAPITest extends APISpec { @Unroll def "Sync copy dest AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) match = setupBlobMatchCondition(bu2, match) leaseID = setupBlobLeaseCondition(bu2, leaseID) @@ -1480,7 +1476,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) expect: - bu2.copyFromURL(bu.getBlobUrl(), null, null, bac, null).statusCode() == 202 + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, bac, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -1495,8 +1491,8 @@ class BlobAPITest extends APISpec { @Unroll def "Sync copy dest AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) noneMatch = setupBlobMatchCondition(bu2, noneMatch) setupBlobLeaseCondition(bu2, leaseID) @@ -1509,7 +1505,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu2.copyFromURL(bu.getBlobUrl(), null, null, bac, null) + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, bac, null, null) then: thrown(StorageException) @@ -1525,10 +1521,10 @@ class BlobAPITest extends APISpec { def "Sync copy error"() { setup: - def bu2 = cu.getBlockBlobClient(generateBlobName()) + def bu2 = cc.getBlockBlobClient(generateBlobName()) when: - bu2.copyFromURL(bu.getBlobUrl()) + bu2.copyFromURL(bc.getBlobUrl()) then: thrown(StorageException) @@ -1536,7 +1532,7 @@ class BlobAPITest extends APISpec { def "Delete"() { when: - VoidResponse response = bu.delete() + VoidResponse response = bc.deleteWithResponse(null, null, null, null) HttpHeaders headers = response.headers() then: @@ -1548,28 +1544,22 @@ class BlobAPITest extends APISpec { def "Delete min"() { expect: - bu.delete().statusCode() == 202 + bc.deleteWithResponse(null, null, null, null).statusCode() == 202 } @Unroll def "Delete options"() { setup: - bu.createSnapshot() + bc.createSnapshot() // Create an extra blob so the list isn't empty (null) when we delete base blob, too - BlockBlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + BlockBlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) when: - bu.delete(option, null, null) + bc.deleteWithResponse(option, null, null, null) then: - Iterator blobs = cu.listBlobsFlat().iterator() - - int blobCount = 0 - for ( ; blobs.hasNext(); blobCount++ ) - blobs.next() - - blobCount == blobsRemaining + cc.listBlobsFlat().stream().count() == blobsRemaining where: option | blobsRemaining @@ -1580,8 +1570,8 @@ class BlobAPITest extends APISpec { @Unroll def "Delete AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -1591,7 +1581,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) expect: - bu.delete(DeleteSnapshotsOptionType.INCLUDE, bac, null).statusCode() == 202 + bc.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, bac, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -1606,8 +1596,8 @@ class BlobAPITest extends APISpec { @Unroll def "Delete AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -1617,7 +1607,7 @@ class BlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.delete(DeleteSnapshotsOptionType.INCLUDE, bac, null) + bc.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, bac, null, null) then: thrown(StorageException) @@ -1633,10 +1623,10 @@ class BlobAPITest extends APISpec { def "Blob delete error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.delete(null, null, null) + bc.delete() then: thrown(StorageException) @@ -1645,21 +1635,23 @@ class BlobAPITest extends APISpec { @Unroll def "Set tier block blob"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateContainerName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultData.remaining()) + ContainerClient cc = blobServiceClient.createContainer(generateContainerName()) + BlockBlobClient bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultData.remaining()) when: - VoidResponse initialResponse = bu.setTier(tier) + VoidResponse initialResponse = bc.setTierWithResponse(tier, null, null, null) HttpHeaders headers = initialResponse.headers() then: initialResponse.statusCode() == 200 || initialResponse.statusCode() == 202 headers.value("x-ms-version") != null headers.value("x-ms-request-id") != null - bu.getProperties().headers().value("x-ms-access-tier") == tier.toString() - cu.listBlobsFlat().iterator().next().properties().accessTier() == tier + bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-access-tier") == tier.toString() + cc.listBlobsFlat().iterator().next().properties().accessTier() == tier + + cleanup: + cc.delete() where: tier | _ @@ -1671,19 +1663,20 @@ class BlobAPITest extends APISpec { @Unroll def "Set tier page blob"() { setup: - ContainerClient cu = premiumServiceURL.getContainerClient(generateContainerName()) - cu.create() + ContainerClient cc = premiumBlobServiceClient.createContainer(generateContainerName()) - PageBlobClient bu = cu.getPageBlobClient(generateBlobName()) - bu.create(512) + def bc = cc.getPageBlobClient(generateBlobName()) + bc.create(512) when: - bu.setTier(tier, null, null) + bc.setTierWithResponse(tier, null, null, null) then: - bu.getProperties().headers().value("x-ms-access-tier") == tier.toString() - cu.listBlobsFlat().iterator().next().properties().accessTier() == tier - cu.delete() + bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-access-tier") == tier.toString() + cc.listBlobsFlat().iterator().next().properties().accessTier() == tier + + cleanup: + cc.delete() where: tier | _ @@ -1698,33 +1691,34 @@ class BlobAPITest extends APISpec { def "Set tier min"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateContainerName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() + ContainerClient cc = blobServiceClient.createContainer(generateContainerName()) + BlockBlobClient bu = cc.getBlockBlobClient(generateBlobName()) bu.upload(defaultInputStream.get(), defaultData.remaining()) when: - int statusCode = bu.setTier(AccessTier.HOT).statusCode() + int statusCode = bc.setTierWithResponse(AccessTier.HOT, null, null, null).statusCode() then: statusCode == 200 || statusCode == 202 + + cleanup: + cc.delete() } def "Set tier inferred"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateBlobName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultDataSize) + def cc = blobServiceClient.createContainer(generateBlobName()) + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) when: - boolean inferred1 = Boolean.parseBoolean(bu.getProperties().headers().value("x-ms-access-tier-inferred")) - Boolean inferredList1 = cu.listBlobsFlat().iterator().next().properties().accessTierInferred() + boolean inferred1 = Boolean.parseBoolean(bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-access-tier-inferred")) + Boolean inferredList1 = cc.listBlobsFlat().iterator().next().properties().accessTierInferred() - bu.setTier(AccessTier.HOT) + bc.setTier(AccessTier.HOT) - boolean inferred2 = Boolean.parseBoolean(bu.getProperties().headers().value("x-ms-access-tier-inferred")) - Boolean inferredList2 = cu.listBlobsFlat().iterator().next().properties().accessTierInferred() + boolean inferred2 = Boolean.parseBoolean(bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-access-tier-inferred")) + Boolean inferredList2 = cc.listBlobsFlat().iterator().next().properties().accessTierInferred() then: inferred1 @@ -1736,18 +1730,17 @@ class BlobAPITest extends APISpec { @Unroll def "Set tier archive status"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateBlobName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultDataSize) + def cc = blobServiceClient.createContainer(generateBlobName()) + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) when: - bu.setTier(sourceTier) - bu.setTier(destTier) + bc.setTier(sourceTier) + bc.setTier(destTier) then: - bu.getProperties().headers().value("x-ms-archive-status") == status.toString() - cu.listBlobsFlat().iterator().next().properties().archiveStatus() == status + bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-archive-status") == status.toString() + cc.listBlobsFlat().iterator().next().properties().archiveStatus() == status where: sourceTier | destTier | status @@ -1757,22 +1750,24 @@ class BlobAPITest extends APISpec { def "Set tier error"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateBlobName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultDataSize) + def cc = blobServiceClient.createContainer(generateContainerName()) + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) when: - bu.setTier(AccessTier.fromString("garbage")) + bc.setTier(AccessTier.fromString("garbage")) then: def e = thrown(StorageException) e.errorCode() == StorageErrorCode.INVALID_HEADER_VALUE + + cleanup: + cc.delete() } def "Set tier illegal argument"() { when: - bu.setTier(null) + bc.setTier(null) then: thrown(IllegalArgumentException) @@ -1780,28 +1775,30 @@ class BlobAPITest extends APISpec { def "Set tier lease"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateBlobName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultDataSize) - def leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + + def cc = blobServiceClient.createContainer(generateContainerName()) + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) + def leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) when: - bu.setTier(AccessTier.HOT, new LeaseAccessConditions().leaseId(leaseID), null) + bc.setTierWithResponse(AccessTier.HOT, new LeaseAccessConditions().leaseId(leaseID), null, null) then: notThrown(StorageException) + + cleanup: + cc.delete() } def "Set tier lease fail"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateBlobName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultDataSize) + def cc = blobServiceClient.createContainer(generateContainerName()) + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) when: - bu.setTier(AccessTier.HOT, new LeaseAccessConditions().leaseId("garbage"), null) + bc.setTierWithResponse(AccessTier.HOT, new LeaseAccessConditions().leaseId("garbage"), null, null) then: thrown(StorageException) @@ -1810,17 +1807,17 @@ class BlobAPITest extends APISpec { def "Undelete"() { setup: enableSoftDelete() - bu.delete() + bc.delete() when: - HttpHeaders headers = bu.undelete().headers() - bu.getProperties() + def undeleteHeaders = bc.undeleteWithResponse(null, null).headers() + bc.getProperties() then: notThrown(StorageException) - headers.value("x-ms-request-id") != null - headers.value("x-ms-version") != null - headers.value("Date") != null + undeleteHeaders.value("x-ms-request-id") != null + undeleteHeaders.value("x-ms-version") != null + undeleteHeaders.value("Date") != null disableSoftDelete() == null } @@ -1828,17 +1825,17 @@ class BlobAPITest extends APISpec { def "Undelete min"() { setup: enableSoftDelete() - bu.delete() + bc.delete() expect: - bu.undelete().statusCode() == 200 + bc.undeleteWithResponse(null, null).statusCode() == 200 } def "Undelete error"() { - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.undelete() + bc.undelete() then: thrown(StorageException) @@ -1846,7 +1843,7 @@ class BlobAPITest extends APISpec { def "Get account info"() { when: - Response response = primaryServiceURL.getAccountInfo() + Response response = primaryBlobServiceClient.getAccountInfoWithResponse(null, null) then: response.headers().value("Date") != null @@ -1858,16 +1855,14 @@ class BlobAPITest extends APISpec { def "Get account info min"() { expect: - bu.getAccountInfo().statusCode() == 200 + bc.getAccountInfoWithResponse(null, null).statusCode() == 200 } def "Get account info error"() { when: - BlobServiceClient serviceURL = new BlobServiceClientBuilder() - .endpoint(primaryServiceURL.getAccountUrl().toString()) - .buildClient() - serviceURL.getContainerClient(generateContainerName()).getBlobClient(generateBlobName()) - .getAccountInfo(null) + BlobServiceClient serviceURL = getServiceClient(primaryBlobServiceClient.getAccountUrl().toString()) + + serviceURL.getContainerClient(generateContainerName()).getBlobClient(generateBlobName()).getAccountInfo() then: thrown(StorageException) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy new file mode 100644 index 000000000000..7d4ab2b816b7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy @@ -0,0 +1,74 @@ +package com.azure.storage.blob + +import com.azure.storage.common.Constants +import spock.lang.Ignore + +class BlobOutputStreamTest extends APISpec { + private static int FOUR_MB = 4 * Constants.MB + + @Ignore + def "BlockBlob output stream"() { + setup: + byte[] data = getRandomByteArray(100 * Constants.MB) + BlockBlobClient blockBlobClient = cu.getBlockBlobClient(generateBlobName()) + + when: + BlobOutputStream outputStream = blockBlobClient.getBlobOutputStream() + outputStream.write(data) + outputStream.close() + + then: + blockBlobClient.getProperties().blobSize() == data.length + convertInputStreamToByteArray(blockBlobClient.openInputStream()) == data + } + + @Ignore + def "PageBlob output stream"() { + setup: + byte[] data = getRandomByteArray(1024 * Constants.MB - 512) + PageBlobClient pageBlobClient = cu.getPageBlobClient(generateBlobName()) + pageBlobClient.create(data.length) + + + when: + BlobOutputStream outputStream = pageBlobClient.getBlobOutputStream(data.length) + outputStream.write(data) + outputStream.close() + + then: + convertInputStreamToByteArray(pageBlobClient.openInputStream()) == data + } + + @Ignore + def "AppendBlob output stream"() { + setup: + byte[] data = getRandomByteArray(64 * FOUR_MB) + AppendBlobClient appendBlobClient = cu.getAppendBlobClient(generateBlobName()) + appendBlobClient.create() + + when: + BlobOutputStream outputStream = appendBlobClient.getBlobOutputStream() + for (int i = 0; i != 64; i++) { + outputStream.write(Arrays.copyOfRange(data, i * FOUR_MB, ((i + 1) * FOUR_MB) - 1)) + } + outputStream.close() + + then: + appendBlobClient.getProperties().blobSize() == data.length + convertInputStreamToByteArray(appendBlobClient.openInputStream()) == data + } + + private static byte[] convertInputStreamToByteArray(InputStream inputStream) { + int b + ByteArrayOutputStream outputStream = new ByteArrayOutputStream() + try { + while ((b = inputStream.read()) != -1) { + outputStream.write(b) + } + } catch (IOException ex) { + throw new UncheckedIOException(ex) + } + + return outputStream.toByteArray() + } +} diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java deleted file mode 100644 index 899d0f2b6595..000000000000 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.common.Constants; -import com.azure.storage.common.credentials.SharedKeyCredential; -import org.junit.Assert; -import org.junit.BeforeClass; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UncheckedIOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -public class BlobOutputStreamTest { - private static final Random RANDOM = new Random(); - private static BlobServiceClient storageClient; - private static ContainerClient containerClient; - - @BeforeClass - public static void setup() { - storageClient = new BlobServiceClientBuilder() - .endpoint("https://" + System.getenv("ACCOUNT_NAME") + ".blob.core.windows.net") - .credential(new SharedKeyCredential(System.getenv("ACCOUNT_NAME"), System.getenv("ACCOUNT_KEY"))) -// .httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))) - .buildClient(); - String containerName = "testcontainer" + RANDOM.nextInt(1000); - containerClient = storageClient.getContainerClient(containerName); - if (!containerClient.exists().value()) { - containerClient.create(); - } - } - -// @Test - public void testBlockBlobOutputStream() throws Exception { - String blobName = "testblob" + RANDOM.nextInt(1000); - int length = 100 * Constants.MB; - byte[] randomBytes = new byte[length]; - RANDOM.nextBytes(randomBytes); - - BlockBlobClient blockBlobClient = containerClient.getBlockBlobClient(blobName); - BlobOutputStream outStream = blockBlobClient.getBlobOutputStream(); - outStream.write(randomBytes); - outStream.close(); - - Assert.assertEquals(length, blockBlobClient.getProperties().value().blobSize()); - BlobInputStream blobInputStream = blockBlobClient.openInputStream(); - byte[] downloaded = convertInputStreamToByteArray(blobInputStream); - Assert.assertArrayEquals(randomBytes, downloaded); - } - -// @Test - public void testPageBlobOutputStream() throws Exception { - int length = 1024 * Constants.MB - 512; - String blobName = "testblob" + RANDOM.nextInt(1000); - byte[] randomBytes = new byte[length]; - RANDOM.nextBytes(randomBytes); - - PageBlobClient pageBlobClient = containerClient.getPageBlobClient(blobName); - pageBlobClient.create(length); - BlobOutputStream outStream = pageBlobClient.getBlobOutputStream(length); - outStream.write(randomBytes); - outStream.close(); - - BlobInputStream blobInputStream = pageBlobClient.openInputStream(); - byte[] downloaded = convertInputStreamToByteArray(blobInputStream); - Assert.assertArrayEquals(randomBytes, downloaded); - } - -// @Test - public void testAppendBlobOutputStream() throws Exception { - int length = 0; - String blobName = "testblob" + RANDOM.nextInt(1000); - List randomBytes = new ArrayList<>(); - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - for (int i = 0; i != 64; ++i) { - int subLength = RANDOM.nextInt(4 * Constants.MB); - length += subLength; - byte[] bytes = new byte[subLength]; - RANDOM.nextBytes(bytes); - randomBytes.add(bytes); - stream.write(bytes); - } - - byte[] uploaded = stream.toByteArray(); - - AppendBlobClient appendBlobClient = containerClient.getAppendBlobClient(blobName); - appendBlobClient.create(); - BlobOutputStream outStream = appendBlobClient.getBlobOutputStream(); - for (int i = 0; i != 64; i++) { - outStream.write(randomBytes.get(i)); - } - outStream.close(); - - Assert.assertEquals(length, appendBlobClient.getProperties().value().blobSize()); - BlobInputStream blobInputStream = appendBlobClient.openInputStream(); - byte[] downloaded = convertInputStreamToByteArray(blobInputStream); - Assert.assertArrayEquals(uploaded, downloaded); - } - - private byte[] convertInputStreamToByteArray(InputStream inputStream) { - int b; - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - try { - while ((b = inputStream.read()) != -1) { - outputStream.write(b); - } - } catch (IOException ex) { - throw new UncheckedIOException(ex); - } - - return outputStream.toByteArray(); - } -} diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobAPITest.groovy index d5aaa8a65dcd..e57df8ab1301 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobAPITest.groovy @@ -1,12 +1,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + package com.azure.storage.blob import com.azure.core.http.HttpHeaders -import com.azure.core.http.rest.Response -import com.azure.core.http.rest.VoidResponse -import com.azure.storage.blob.models.* +import com.azure.storage.blob.models.BlobAccessConditions +import com.azure.storage.blob.models.BlobHTTPHeaders +import com.azure.storage.blob.models.BlobRange +import com.azure.storage.blob.models.BlockItem +import com.azure.storage.blob.models.BlockListType +import com.azure.storage.blob.models.LeaseAccessConditions +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.ModifiedAccessConditions +import com.azure.storage.blob.models.PublicAccessType +import com.azure.storage.blob.models.SourceModifiedAccessConditions +import com.azure.storage.blob.models.StorageErrorCode +import com.azure.storage.blob.models.StorageErrorException +import com.azure.storage.blob.models.StorageException import spock.lang.Unroll import java.nio.ByteBuffer @@ -14,25 +25,21 @@ import java.nio.charset.StandardCharsets import java.security.MessageDigest class BlockBlobAPITest extends APISpec { - BlockBlobClient bu + BlockBlobClient bc def setup() { - bu = cu.getBlockBlobClient(generateBlobName()) - bu.upload(defaultInputStream.get(), defaultDataSize) - } - - def getBlockID() { - return Base64.encoder.encodeToString(UUID.randomUUID().toString().getBytes(StandardCharsets.UTF_8)) + bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) } def "Stage block"() { setup: - VoidResponse response = bu.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize) + def response = bc.stageBlockWithResponse(getBlockID(), defaultInputStream.get(), defaultDataSize, null, null, null) HttpHeaders headers = response.headers() expect: response.statusCode() == 201 - headers.value("Content-MD5") != null + headers.value("x-ms-content-crc64") != null headers.value("x-ms-request-id") != null headers.value("x-ms-version") != null headers.value("Date") != null @@ -41,30 +48,31 @@ class BlockBlobAPITest extends APISpec { def "Stage block min"() { expect: - bu.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize).statusCode() == 201 + bc.stageBlockWithResponse(getBlockID(), defaultInputStream.get(), defaultDataSize, null, null, null).statusCode() == 201 } @Unroll def "Stage block illegal arguments"() { when: - bu.stageBlock(blockID, data == null ? null : data.get(), dataSize) + String blockID = (getBlockId) ? getBlockID() : null + bc.stageBlock(blockID, data == null ? null : data.get(), dataSize) then: def e = thrown(Exception) exceptionType.isInstance(e) where: - blockID | data | dataSize | exceptionType - null | defaultInputStream | defaultDataSize | StorageException - getBlockID() | null | defaultDataSize | NullPointerException - getBlockID() | defaultInputStream | defaultDataSize + 1 | IndexOutOfBoundsException + getBlockId | data | dataSize | exceptionType + false | defaultInputStream | defaultDataSize | StorageException + true | null | defaultDataSize | NullPointerException + true | defaultInputStream | defaultDataSize + 1 | IndexOutOfBoundsException // TODO (alzimmer): This doesn't throw an error as the stream is larger than the stated size - //getBlockID() | defaultInputStream | defaultDataSize - 1 | IllegalArgumentException + //true | defaultInputStream | defaultDataSize - 1 | IllegalArgumentException } def "Stage block empty body"() { when: - bu.stageBlock(getBlockID(), new ByteArrayInputStream(new byte[0]), 0) + bc.stageBlock(getBlockID(), new ByteArrayInputStream(new byte[0]), 0) then: thrown(StorageException) @@ -72,7 +80,7 @@ class BlockBlobAPITest extends APISpec { def "Stage block null body"() { when: - bu.stageBlock(getBlockID(), null, 0) + bc.stageBlock(getBlockID(), null, 0) then: thrown(StorageException) @@ -80,20 +88,20 @@ class BlockBlobAPITest extends APISpec { def "Stage block lease"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) expect: - bu.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize, new LeaseAccessConditions().leaseId(leaseID), - null).statusCode() == 201 + bc.stageBlockWithResponse(getBlockID(), defaultInputStream.get(), defaultDataSize, new LeaseAccessConditions().leaseId(leaseID), + null, null).statusCode() == 201 } def "Stage block lease fail"() { setup: - setupBlobLeaseCondition(bu, receivedLeaseID) + setupBlobLeaseCondition(bc, receivedLeaseID) when: - bu.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize, new LeaseAccessConditions() - .leaseId(garbageLeaseID), null) + bc.stageBlockWithResponse(getBlockID(), defaultInputStream.get(), defaultDataSize, new LeaseAccessConditions() + .leaseId(garbageLeaseID), null, null) then: def e = thrown(StorageException) @@ -102,10 +110,10 @@ class BlockBlobAPITest extends APISpec { def "Stage block error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.stageBlock("id", defaultInputStream.get(), defaultDataSize) + bc.stageBlock("id", defaultInputStream.get(), defaultDataSize) then: thrown(StorageException) @@ -113,63 +121,65 @@ class BlockBlobAPITest extends APISpec { def "Stage block from url"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def bu2 = cc.getBlockBlobClient(generateBlobName()) def blockID = getBlockID() when: - HttpHeaders headers = bu2.stageBlockFromURL(blockID, bu.getBlobUrl(), null).headers() - Iterator listResponse = bu2.listBlocks(BlockListType.ALL).iterator() - BlockItem block = listResponse.next() - bu2.commitBlockList(Arrays.asList(blockID)) - ByteArrayOutputStream outputStream = new ByteArrayOutputStream() - bu2.download(outputStream) + def headers = bu2.stageBlockFromURLWithResponse(blockID, bc.getBlobUrl(), null, null, null, null, null, null).headers() then: headers.value("x-ms-request-id") != null headers.value("x-ms-version") != null - headers.value("Content-MD5") != null + headers.value("x-ms-content-crc64") != null headers.value("x-ms-request-server-encrypted") != null + def response = bu2.listBlocks(BlockListType.ALL) + response.uncommittedBlocks().size() == 1 + response.committedBlocks().size() == 0 + response.uncommittedBlocks().first().name() == blockID - block.name() == blockID - !block.isCommitted() - !listResponse.hasNext() + when: + bu2.commitBlockList(Arrays.asList(blockID)) + def outputStream = new ByteArrayOutputStream() + bu2.download(outputStream) + then: ByteBuffer.wrap(outputStream.toByteArray()) == defaultData } def "Stage block from url min"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def bu2 = cc.getBlockBlobClient(generateBlobName()) def blockID = getBlockID() expect: - bu2.stageBlockFromURL(blockID, bu.getBlobUrl(), null).statusCode() == 201 + bu2.stageBlockFromURLWithResponse(blockID, bc.getBlobUrl(), null, null, null, null, null, null).statusCode() == 201 } @Unroll def "Stage block from URL IA"() { when: - bu.stageBlockFromURL(blockID, sourceURL, null) + String blockID = (getBlockId) ? getBlockID() : null + bc.stageBlockFromURL(blockID, sourceURL, null) then: thrown(StorageException) where: - blockID | sourceURL - null | new URL("http://www.example.com") - getBlockID() | null + getBlockId | sourceURL + false | new URL("http://www.example.com") + true | null } def "Stage block from URL range"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def destURL = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getBlockBlobClient(generateBlobName()) when: - destURL.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), new BlobRange(2, 3)) + destURL.stageBlockFromURL(getBlockID(), bc.getBlobUrl(), new BlobRange(2, 3)) Iterator uncommittedBlock = destURL.listBlocks(BlockListType.UNCOMMITTED).iterator() then: @@ -180,12 +190,12 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL MD5"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def destURL = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getBlockBlobClient(generateBlobName()) when: - destURL.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), null, - MessageDigest.getInstance("MD5").digest(defaultData.array()), null, null, null) + destURL.stageBlockFromURLWithResponse(getBlockID(), bc.getBlobUrl(), null, + MessageDigest.getInstance("MD5").digest(defaultData.array()), null, null, null, null) then: notThrown(StorageException) @@ -193,12 +203,12 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL MD5 fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def destURL = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getBlockBlobClient(generateBlobName()) when: - destURL.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), null, "garbage".getBytes(), - null, null, null) + destURL.stageBlockFromURLWithResponse(getBlockID(), bc.getBlobUrl(), null, "garbage".getBytes(), + null, null, null, null) then: thrown(StorageException) @@ -206,11 +216,11 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL lease"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def lease = new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, receivedLeaseID)) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def lease = new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, receivedLeaseID)) when: - bu.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), null, null, lease, null, null) + bc.stageBlockFromURLWithResponse(getBlockID(), bc.getBlobUrl(), null, null, lease, null, null, null) then: notThrown(StorageException) @@ -218,11 +228,11 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL lease fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) def lease = new LeaseAccessConditions().leaseId("garbage") when: - bu.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), null, null, lease, null, null) + bc.stageBlockFromURLWithResponse(getBlockID(), bc.getBlobUrl(), null, null, lease, null, null, null) then: thrown(StorageException) @@ -230,11 +240,10 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) - bu = cu.getBlockBlobClient(generateBlobName()) + bc = primaryBlobServiceClient.getContainerClient(generateContainerName()).getBlockBlobClient(generateBlobName()) when: - bu.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), null) + bc.stageBlockFromURL(getBlockID(), bc.getBlobUrl(), null) then: thrown(StorageException) @@ -243,10 +252,10 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Stage block from URL source AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) def blockID = getBlockID() - def sourceURL = cu.getBlockBlobClient(generateBlobName()) + def sourceURL = cc.getBlockBlobClient(generateBlobName()) sourceURL.upload(defaultInputStream.get(), defaultDataSize) sourceIfMatch = setupBlobMatchCondition(sourceURL, sourceIfMatch) @@ -257,7 +266,7 @@ class BlockBlobAPITest extends APISpec { .sourceIfNoneMatch(sourceIfNoneMatch) expect: - bu.stageBlockFromURL(blockID, sourceURL.getBlobUrl(), null, null, null, smac, null).statusCode() == 201 + bc.stageBlockFromURLWithResponse(blockID, sourceURL.getBlobUrl(), null, null, null, smac, null, null).statusCode() == 201 where: sourceIfModifiedSince | sourceIfUnmodifiedSince | sourceIfMatch | sourceIfNoneMatch @@ -271,10 +280,10 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Stage block from URL source AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) def blockID = getBlockID() - def sourceURL = cu.getBlockBlobClient(generateBlobName()) + def sourceURL = cc.getBlockBlobClient(generateBlobName()) sourceURL.upload(defaultInputStream.get(), defaultDataSize) def smac = new SourceModifiedAccessConditions() @@ -284,7 +293,7 @@ class BlockBlobAPITest extends APISpec { .sourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) when: - bu.stageBlockFromURL(blockID, sourceURL.getBlobUrl(), null, null, null, smac, null).statusCode() == 201 + bc.stageBlockFromURLWithResponse(blockID, sourceURL.getBlobUrl(), null, null, null, smac, null, null).statusCode() == 201 then: thrown(StorageException) @@ -300,42 +309,42 @@ class BlockBlobAPITest extends APISpec { def "Commit block list"() { setup: String blockID = getBlockID() - bu.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) + bc.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) ArrayList ids = new ArrayList<>() ids.add(blockID) when: - Response response = bu.commitBlockList(ids) - HttpHeaders headers = response.headers() + def response = bc.commitBlockListWithResponse(ids, null, null, null, null, null) + def headers = response.headers() then: response.statusCode() == 201 validateBasicHeaders(headers) - headers.value("Content-MD5") + headers.value("x-ms-content-crc64") Boolean.parseBoolean(headers.value("x-ms-request-server-encrypted")) } def "Commit block list min"() { setup: String blockID = getBlockID() - bu.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) + bc.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) ArrayList ids = new ArrayList<>() ids.add(blockID) expect: - bu.commitBlockList(ids).value() != null + bc.commitBlockList(ids) != null } def "Commit block list null"() { expect: - bu.commitBlockList(null).statusCode() == 201 + bc.commitBlockListWithResponse(null, null, null, null, null, null).statusCode() == 201 } @Unroll def "Commit block list headers"() { setup: String blockID = getBlockID() - bu.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) + bc.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) ArrayList ids = new ArrayList<>() ids.add(blockID) BlobHTTPHeaders headers = new BlobHTTPHeaders().blobCacheControl(cacheControl) @@ -346,8 +355,8 @@ class BlockBlobAPITest extends APISpec { .blobContentType(contentType) when: - bu.commitBlockList(ids, headers, null, null, null) - Response response = bu.getProperties() + bc.commitBlockListWithResponse(ids, headers, null, null, null, null) + def response = bc.getPropertiesWithResponse(null, null, null) // If the value isn't set the service will automatically set it contentType = (contentType == null) ? "application/octet-stream" : contentType @@ -373,12 +382,12 @@ class BlockBlobAPITest extends APISpec { } when: - bu.commitBlockList(null, null, metadata, null, null) - Response response = bu.getProperties() + bc.commitBlockListWithResponse(null, null, metadata, null, null, null) + def response = bc.getPropertiesWithResponse(null, null, null) then: response.statusCode() == 200 - getMetadataFromHeaders(response.headers()) == metadata + response.value().metadata() == metadata where: key1 | value1 | key2 | value2 @@ -389,8 +398,8 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Commit block list AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -401,7 +410,7 @@ class BlockBlobAPITest extends APISpec { expect: - bu.commitBlockList(null, null, null, bac, null).statusCode() == 201 + bc.commitBlockListWithResponse(null, null, null, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -416,8 +425,8 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Commit block list AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -427,8 +436,7 @@ class BlockBlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.commitBlockList(null, null, null, bac, null) - + bc.commitBlockListWithResponse(null, null, null, bac, null, null) then: def e = thrown(StorageException) e.errorCode() == StorageErrorCode.CONDITION_NOT_MET || @@ -445,11 +453,11 @@ class BlockBlobAPITest extends APISpec { def "Commit block list error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.commitBlockList(new ArrayList(), null, null, - new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("garbage")), null) + bc.commitBlockListWithResponse(new ArrayList(), null, null, + new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("garbage")), null, null) then: thrown(StorageException) @@ -457,38 +465,30 @@ class BlockBlobAPITest extends APISpec { def "Get block list"() { setup: - List committedBlocks = Arrays.asList(getBlockID(), getBlockID()) - bu.stageBlock(committedBlocks.get(0), defaultInputStream.get(), defaultDataSize) - bu.stageBlock(committedBlocks.get(1), defaultInputStream.get(), defaultDataSize) - bu.commitBlockList(committedBlocks) - - List uncommittedBlocks = Arrays.asList(getBlockID(), getBlockID()) - bu.stageBlock(uncommittedBlocks.get(0), defaultInputStream.get(), defaultDataSize) - bu.stageBlock(uncommittedBlocks.get(1), defaultInputStream.get(), defaultDataSize) + def committedBlocks = [getBlockID(), getBlockID()] + bc.stageBlock(committedBlocks.get(0), defaultInputStream.get(), defaultDataSize) + bc.stageBlock(committedBlocks.get(1), defaultInputStream.get(), defaultDataSize) + bc.commitBlockList(committedBlocks) + + def uncommittedBlocks = [getBlockID(), getBlockID()] + bc.stageBlock(uncommittedBlocks.get(0), defaultInputStream.get(), defaultDataSize) + bc.stageBlock(uncommittedBlocks.get(1), defaultInputStream.get(), defaultDataSize) uncommittedBlocks.sort(true) when: - Iterable response = bu.listBlocks(BlockListType.ALL) + def blockList = bc.listBlocks(BlockListType.ALL) then: - for (BlockItem block : response) { - assert committedBlocks.contains(block.name()) || uncommittedBlocks.contains(block.name()) - assert block.size() == defaultDataSize - } -// for (int i = 0; i < committedBlocks.size(); i++) { -// assert response.body().committedBlocks().get(i).name() == committedBlocks.get(i) -// assert response.body().committedBlocks().get(i).size() == defaultDataSize -// assert response.body().uncommittedBlocks().get(i).name() == uncommittedBlocks.get(i) -// assert response.body().uncommittedBlocks().get(i).size() == defaultDataSize -// } -// validateBasicHeaders(response.headers()) -// response.headers().contentType() != null -// response.headers().blobContentLength() == defaultDataSize * 2L + blockList.committedBlocks().collect { it.name() } as Set == committedBlocks as Set + blockList.uncommittedBlocks().collect { it.name() } as Set == uncommittedBlocks as Set + + (blockList.committedBlocks() + blockList.uncommittedBlocks()) + .each { assert it.size() == defaultDataSize } } def "Get block list min"() { when: - bu.listBlocks(BlockListType.ALL) + bc.listBlocks(BlockListType.ALL) then: notThrown(StorageErrorException) @@ -497,29 +497,17 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Get block list type"() { setup: - String blockID = getBlockID() - bu.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) - ArrayList ids = new ArrayList<>() - ids.add(blockID) - bu.commitBlockList(ids) - blockID = new String(getBlockID()) - bu.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) + def blockID = getBlockID() + bc.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) + bc.commitBlockList([blockID]) + bc.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize) when: - Iterable response = bu.listBlocks(type) + def response = bc.listBlocks(type) then: - int committed = 0 - int uncommitted = 0 - for (BlockItem item : response) { - if (item.isCommitted()) { - committed ++ - } else { - uncommitted ++ - } - } - committed == committedCount - uncommitted == uncommittedCount + response.committedBlocks().size() == committedCount + response.uncommittedBlocks().size() == uncommittedCount where: type | committedCount | uncommittedCount @@ -530,7 +518,7 @@ class BlockBlobAPITest extends APISpec { def "Get block list type null"() { when: - bu.listBlocks(null).iterator().hasNext() + bc.listBlocks(null).iterator().hasNext() then: notThrown(IllegalArgumentException) @@ -538,10 +526,10 @@ class BlockBlobAPITest extends APISpec { def "Get block list lease"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) when: - bu.listBlocks(BlockListType.ALL, new LeaseAccessConditions().leaseId(leaseID), null).iterator().hasNext() + bc.listBlocksWithResponse(BlockListType.ALL, new LeaseAccessConditions().leaseId(leaseID), null) then: notThrown(StorageException) @@ -549,10 +537,10 @@ class BlockBlobAPITest extends APISpec { def "Get block list lease fail"() { setup: - setupBlobLeaseCondition(bu, garbageLeaseID) + setupBlobLeaseCondition(bc, garbageLeaseID) when: - bu.listBlocks(BlockListType.ALL, new LeaseAccessConditions().leaseId(garbageLeaseID), null).iterator().hasNext() + bc.listBlocksWithResponse(BlockListType.ALL, new LeaseAccessConditions().leaseId(garbageLeaseID), null) then: def e = thrown(StorageException) @@ -561,10 +549,10 @@ class BlockBlobAPITest extends APISpec { def "Get block list error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.listBlocks(BlockListType.ALL).iterator().hasNext() + bc.listBlocks(BlockListType.ALL).iterator().hasNext() then: thrown(StorageException) @@ -572,36 +560,35 @@ class BlockBlobAPITest extends APISpec { def "Upload"() { when: - Response response = bu.upload(defaultInputStream.get(), defaultDataSize) - HttpHeaders headers = response.headers() + def response = bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null, null, null) then: response.statusCode() == 201 def outStream = new ByteArrayOutputStream() - bu.download(outStream) + bc.download(outStream) outStream.toByteArray() == "default".getBytes(StandardCharsets.UTF_8) - validateBasicHeaders(headers) - headers.value("Content-MD5") != null - Boolean.parseBoolean(headers.value("x-ms-request-server-encrypted")) + validateBasicHeaders(response.headers()) + response.headers().value("Content-MD5") != null + Boolean.parseBoolean(response.headers().value("x-ms-request-server-encrypted")) } def "Upload min"() { expect: - bu.upload(defaultInputStream.get(), defaultDataSize).statusCode() == 201 + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null, null, null).statusCode() == 201 } @Unroll def "Upload illegal argument"() { when: - bu.upload(data, dataSize) + bc.upload(data, dataSize) then: def e = thrown(Exception) exceptionType.isInstance(e) where: - data | dataSize | exceptionType - null | defaultDataSize | NullPointerException + data | dataSize | exceptionType + null | defaultDataSize | NullPointerException defaultInputStream.get() | defaultDataSize + 1 | IndexOutOfBoundsException // This doesn't error as it isn't reading the entire stream which is valid in the new client // defaultInputStream.get() | defaultDataSize - 1 | StorageErrorException @@ -609,12 +596,12 @@ class BlockBlobAPITest extends APISpec { def "Upload empty body"() { expect: - bu.upload(new ByteArrayInputStream(new byte[0]), 0).statusCode() == 201 + bc.uploadWithResponse(new ByteArrayInputStream(new byte[0]), 0, null, null, null, null, null).statusCode() == 201 } def "Upload null body"() { expect: - bu.upload(null, 0).statusCode() == 201 + bc.uploadWithResponse(null, 0, null, null, null, null, null).statusCode() == 201 } @Unroll @@ -628,8 +615,8 @@ class BlockBlobAPITest extends APISpec { .blobContentType(contentType) when: - bu.upload(defaultInputStream.get(), defaultDataSize, headers, null, null, null) - Response response = bu.getProperties() + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, headers, null, null, null, null) + def response = bc.getPropertiesWithResponse(null, null, null) // If the value isn't set the service will automatically set it contentMD5 = (contentMD5 == null) ? MessageDigest.getInstance("MD5").digest(defaultData.array()) : contentMD5 @@ -639,9 +626,9 @@ class BlockBlobAPITest extends APISpec { validateBlobProperties(response, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentMD5, contentType) where: - cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType - null | null | null | null | null | null - "control" | "disposition" | "encoding" | "language" | MessageDigest.getInstance("MD5").digest(defaultData.array()) | "type" + cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType + null | null | null | null | null | null + "control" | "disposition" | "encoding" | "language" | MessageDigest.getInstance("MD5").digest(defaultData.array()) | "type" } @Unroll @@ -656,8 +643,8 @@ class BlockBlobAPITest extends APISpec { } when: - bu.upload(defaultInputStream.get(), defaultDataSize, null, metadata, null, null) - Response response = bu.getProperties() + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, metadata, null, null, null) + def response = bc.getPropertiesWithResponse(null, null, null) then: response.statusCode() == 200 @@ -672,8 +659,8 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Upload AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -684,7 +671,7 @@ class BlockBlobAPITest extends APISpec { expect: - bu.upload(defaultInputStream.get(), defaultDataSize, null, null, bac, null).statusCode() == 201 + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -699,8 +686,8 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Upload AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -710,7 +697,7 @@ class BlockBlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.upload(defaultInputStream.get(), defaultDataSize, null, null, bac, null) + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, bac, null, null) then: def e = thrown(StorageException) @@ -728,12 +715,12 @@ class BlockBlobAPITest extends APISpec { def "Upload error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.upload(defaultInputStream.get(), defaultDataSize, null, null, + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("id")), - null) + null, null) then: thrown(StorageException) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobInputOutputStreamTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobInputOutputStreamTest.groovy index 71396829fb10..a11adbd4d104 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobInputOutputStreamTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobInputOutputStreamTest.groovy @@ -1,26 +1,28 @@ package com.azure.storage.blob import com.azure.storage.common.Constants +import spock.lang.Requires class BlockBlobInputOutputStreamTest extends APISpec { - BlockBlobClient bu + BlockBlobClient bc def setup() { - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) } + // Only run this test in live mode as BlobOutputStream dynamically assigns blocks + @Requires({ APISpec.liveMode() }) def "Upload download"() { when: int length = 30 * Constants.MB - byte[] randomBytes = new byte[length] - (new Random()).nextBytes(randomBytes) + byte[] randomBytes = getRandomByteArray(length) - BlobOutputStream outStream = bu.getBlobOutputStream() + BlobOutputStream outStream = bc.getBlobOutputStream() outStream.write(randomBytes) outStream.close() then: - BlobInputStream inputStream = bu.openInputStream() + BlobInputStream inputStream = bc.openInputStream() int b ByteArrayOutputStream outputStream = new ByteArrayOutputStream() try { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy index d0027bffbb83..918a9d55b3fe 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy @@ -3,25 +3,44 @@ package com.azure.storage.blob - import com.azure.core.http.rest.Response import com.azure.core.http.rest.VoidResponse -import com.azure.storage.blob.models.* +import com.azure.storage.blob.models.AccessPolicy +import com.azure.storage.blob.models.AccessTier +import com.azure.storage.blob.models.AppendBlobItem +import com.azure.storage.blob.models.BlobItem +import com.azure.storage.blob.models.BlobListDetails +import com.azure.storage.blob.models.BlobType +import com.azure.storage.blob.models.ContainerAccessConditions +import com.azure.storage.blob.models.ContainerAccessPolicies +import com.azure.storage.blob.models.CopyStatusType +import com.azure.storage.blob.models.LeaseAccessConditions +import com.azure.storage.blob.models.LeaseDurationType +import com.azure.storage.blob.models.LeaseStateType +import com.azure.storage.blob.models.LeaseStatusType +import com.azure.storage.blob.models.ListBlobsOptions +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.ModifiedAccessConditions +import com.azure.storage.blob.models.PublicAccessType +import com.azure.storage.blob.models.SignedIdentifier +import com.azure.storage.blob.models.StorageErrorCode +import com.azure.storage.blob.models.StorageException import spock.lang.Unroll import java.time.Duration import java.time.OffsetDateTime import java.time.ZoneId +import java.util.stream.Collectors class ContainerAPITest extends APISpec { def "Create all null"() { setup: - // Overwrite the existing cu, which has already been created - cu = primaryServiceURL.getContainerClient(generateContainerName()) + // Overwrite the existing cc, which has already been created + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - VoidResponse response = cu.create() + def response = cc.createWithResponse(null, null, null, null) then: response.statusCode() == 201 @@ -30,13 +49,13 @@ class ContainerAPITest extends APISpec { def "Create min"() { expect: - primaryServiceURL.createContainer(generateContainerName()).statusCode() == 201 + primaryBlobServiceClient.createContainerWithResponse(generateContainerName(), null, null, null).statusCode() == 201 } @Unroll def "Create metadata"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) Metadata metadata = new Metadata() if (key1 != null) { metadata.put(key1, value1) @@ -46,8 +65,8 @@ class ContainerAPITest extends APISpec { } when: - cu.create(metadata, null, null) - Response response = cu.getProperties() + cc.createWithResponse(metadata, null, null, null) + Response response = cc.getPropertiesWithResponse(null, null, null) then: getMetadataFromHeaders(response.headers()) == metadata @@ -61,11 +80,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Create publicAccess"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.create(null, publicAccess, null) - PublicAccessType access = cu.getProperties().value().blobPublicAccess() + cc.createWithResponse(null, publicAccess, null, null) + def access = cc.getProperties().blobPublicAccess() then: access.toString() == publicAccess.toString() @@ -79,18 +98,18 @@ class ContainerAPITest extends APISpec { def "Create error"() { when: - cu.create() + cc.create() then: def e = thrown(StorageException) e.response().statusCode() == 409 e.errorCode() == StorageErrorCode.CONTAINER_ALREADY_EXISTS - e.message().contains("The specified container already exists.") + e.serviceMessage().contains("The specified container already exists.") } def "Get properties null"() { when: - Response response = cu.getProperties() + def response = cc.getPropertiesWithResponse(null, null, null) then: validateBasicHeaders(response.headers()) @@ -105,20 +124,20 @@ class ContainerAPITest extends APISpec { def "Get properties min"() { expect: - cu.getProperties().statusCode() == 200 + cc.getPropertiesWithResponse(null, null, null).statusCode() == 200 } def "Get properties lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.getProperties(new LeaseAccessConditions().leaseId(leaseID), null).statusCode() == 200 + cc.getPropertiesWithResponse(new LeaseAccessConditions().leaseId(leaseID), null, null).statusCode() == 200 } def "Get properties lease fail"() { when: - cu.getProperties(new LeaseAccessConditions().leaseId("garbage"), null) + cc.getPropertiesWithResponse(new LeaseAccessConditions().leaseId("garbage"), null, null) then: thrown(StorageException) @@ -126,10 +145,10 @@ class ContainerAPITest extends APISpec { def "Get properties error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.getProperties(null, null) + cc.getProperties() then: thrown(StorageException) @@ -137,16 +156,18 @@ class ContainerAPITest extends APISpec { def "Set metadata"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) Metadata metadata = new Metadata() metadata.put("key", "value") - cu.create(metadata, null, null) - VoidResponse response = cu.setMetadata(null) + cc.createWithResponse(metadata, null, null, null) - expect: + when: + def response = cc.setMetadataWithResponse(null, null, null, null) + + then: response.statusCode() == 200 validateBasicHeaders(response.headers()) - getMetadataFromHeaders(cu.getProperties().headers()).size() == 0 + getMetadataFromHeaders(cc.getPropertiesWithResponse(null, null, null).headers()).size() == 0 } def "Set metadata min"() { @@ -155,10 +176,10 @@ class ContainerAPITest extends APISpec { metadata.put("foo", "bar") when: - cu.setMetadata(metadata) + cc.setMetadata(metadata) then: - getMetadataFromHeaders(cu.getProperties().headers()) == metadata + getMetadataFromHeaders(cc.getPropertiesWithResponse(null, null, null).headers()) == metadata } @Unroll @@ -173,8 +194,8 @@ class ContainerAPITest extends APISpec { } expect: - cu.setMetadata(metadata).statusCode() == 200 - getMetadataFromHeaders(cu.getProperties().headers()) == metadata + cc.setMetadataWithResponse(metadata, null, null, null).statusCode() == 200 + getMetadataFromHeaders(cc.getPropertiesWithResponse(null, null, null).headers()) == metadata where: key1 | value1 | key2 | value2 @@ -185,14 +206,14 @@ class ContainerAPITest extends APISpec { @Unroll def "Set metadata AC"() { setup: - leaseID = setupContainerLeaseCondition(cu, leaseID) + leaseID = setupContainerLeaseCondition(cc, leaseID) ContainerAccessConditions cac = new ContainerAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified)) expect: - cu.setMetadata(null, cac, null).statusCode() == 200 + cc.setMetadataWithResponse(null, cac, null, null).statusCode() == 200 where: modified | leaseID @@ -210,7 +231,7 @@ class ContainerAPITest extends APISpec { .ifModifiedSince(modified)) when: - cu.setMetadata(null, cac, null) + cc.setMetadataWithResponse(null, cac, null, null) then: thrown(StorageException) @@ -230,7 +251,7 @@ class ContainerAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - cu.setMetadata(null, new ContainerAccessConditions().modifiedAccessConditions(mac), null) + cc.setMetadataWithResponse(null, new ContainerAccessConditions().modifiedAccessConditions(mac), null, null) then: thrown(UnsupportedOperationException) @@ -244,10 +265,10 @@ class ContainerAPITest extends APISpec { def "Set metadata error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.setMetadata(null) + cc.setMetadata(null) then: thrown(StorageException) @@ -256,11 +277,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Set access policy"() { setup: - def response = cu.setAccessPolicy(access, null, null, null) + def response = cc.setAccessPolicyWithResponse(access, null, null, null, null) expect: validateBasicHeaders(response.headers()) - cu.getProperties().value().blobPublicAccess() == access + cc.getPropertiesWithResponse(null, null, null).value().blobPublicAccess() == access where: access | _ @@ -271,55 +292,53 @@ class ContainerAPITest extends APISpec { def "Set access policy min access"() { when: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) then: - cu.getProperties().value().blobPublicAccess() == PublicAccessType.CONTAINER + cc.getProperties().blobPublicAccess() == PublicAccessType.CONTAINER } def "Set access policy min ids"() { setup: SignedIdentifier identifier = new SignedIdentifier() - .id("0000") - .accessPolicy(new AccessPolicy() - .start(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) - .expiry(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() - .plusDays(1)) - .permission("r")) + .id("0000") + .accessPolicy(new AccessPolicy() + .start(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) + .expiry(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() + .plusDays(1)) + .permission("r")) - List ids = new ArrayList<>() + def ids = [] ids.push(identifier) when: - cu.setAccessPolicy(null, ids) + cc.setAccessPolicy(null, ids) then: - cu.getAccessPolicy().value().getIdentifiers().get(0).id() == "0000" + cc.getAccessPolicy().getIdentifiers().get(0).id() == "0000" } def "Set access policy ids"() { setup: SignedIdentifier identifier = new SignedIdentifier() - .id("0000") - .accessPolicy(new AccessPolicy() - .start(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) - .expiry(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() - .plusDays(1)) + .id("0000") + .accessPolicy(new AccessPolicy() + .start(getUTCNow()) + .expiry(getUTCNow().plusDays(1)) .permission("r")) SignedIdentifier identifier2 = new SignedIdentifier() - .id("0001") - .accessPolicy(new AccessPolicy() - .start(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) - .expiry(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() - .plusDays(2)) + .id("0001") + .accessPolicy(new AccessPolicy() + .start(getUTCNow()) + .expiry(getUTCNow().plusDays(2)) .permission("w")) List ids = new ArrayList<>() ids.push(identifier) ids.push(identifier2) when: - VoidResponse response = cu.setAccessPolicy(null, ids, null, null) - List receivedIdentifiers = cu.getAccessPolicy().value().getIdentifiers() + def response = cc.setAccessPolicyWithResponse(null, ids, null, null, null) + def receivedIdentifiers = cc.getAccessPolicyWithResponse(null, null, null).value().getIdentifiers() then: response.statusCode() == 200 @@ -335,7 +354,7 @@ class ContainerAPITest extends APISpec { @Unroll def "Set access policy AC"() { setup: - leaseID = setupContainerLeaseCondition(cu, leaseID) + leaseID = setupContainerLeaseCondition(cc, leaseID) ContainerAccessConditions cac = new ContainerAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -343,7 +362,7 @@ class ContainerAPITest extends APISpec { .ifUnmodifiedSince(unmodified)) expect: - cu.setAccessPolicy(null, null, cac, null).statusCode() == 200 + cc.setAccessPolicyWithResponse(null, null, cac, null, null).statusCode() == 200 where: modified | unmodified | leaseID @@ -363,7 +382,7 @@ class ContainerAPITest extends APISpec { .ifUnmodifiedSince(unmodified)) when: - cu.setAccessPolicy(null, null, cac, null) + cc.setAccessPolicyWithResponse(null, null, cac, null, null) then: thrown(StorageException) @@ -381,7 +400,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.setAccessPolicy(null, null, new ContainerAccessConditions().modifiedAccessConditions(mac), null) + cc.setAccessPolicyWithResponse(null, null, new ContainerAccessConditions().modifiedAccessConditions(mac), null, null) then: thrown(UnsupportedOperationException) @@ -394,10 +413,10 @@ class ContainerAPITest extends APISpec { def "Set access policy error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.setAccessPolicy(null, null, null, null) + cc.setAccessPolicy(null, null) then: thrown(StorageException) @@ -406,16 +425,15 @@ class ContainerAPITest extends APISpec { def "Get access policy"() { setup: SignedIdentifier identifier = new SignedIdentifier() - .id("0000") - .accessPolicy(new AccessPolicy() - .start(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) - .expiry(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() - .plusDays(1)) + .id("0000") + .accessPolicy(new AccessPolicy() + .start(getUTCNow()) + .expiry(getUTCNow().plusDays(1)) .permission("r")) List ids = new ArrayList<>() ids.push(identifier) - cu.setAccessPolicy(PublicAccessType.BLOB, ids) - Response response = cu.getAccessPolicy() + cc.setAccessPolicy(PublicAccessType.BLOB, ids) + Response response = cc.getAccessPolicyWithResponse(null, null, null) expect: response.statusCode() == 200 @@ -428,15 +446,15 @@ class ContainerAPITest extends APISpec { def "Get access policy lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.getAccessPolicy(new LeaseAccessConditions().leaseId(leaseID), null).statusCode() == 200 + cc.getAccessPolicyWithResponse(new LeaseAccessConditions().leaseId(leaseID), null, null).statusCode() == 200 } def "Get access policy lease fail"() { when: - cu.getAccessPolicy(new LeaseAccessConditions().leaseId(garbageLeaseID), null) + cc.getAccessPolicyWithResponse(new LeaseAccessConditions().leaseId(garbageLeaseID), null, null) then: thrown(StorageException) @@ -444,10 +462,10 @@ class ContainerAPITest extends APISpec { def "Get access policy error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.getAccessPolicy() + cc.getAccessPolicy() then: thrown(StorageException) @@ -455,7 +473,7 @@ class ContainerAPITest extends APISpec { def "Delete"() { when: - VoidResponse response = cu.delete() + VoidResponse response = cc.deleteWithResponse(null, null, null) then: response.statusCode() == 202 @@ -466,13 +484,13 @@ class ContainerAPITest extends APISpec { def "Delete min"() { expect: - cu.delete().statusCode() == 202 + cc.deleteWithResponse(null, null, null).statusCode() == 202 } @Unroll def "Delete AC"() { setup: - leaseID = setupContainerLeaseCondition(cu, leaseID) + leaseID = setupContainerLeaseCondition(cc, leaseID) ContainerAccessConditions cac = new ContainerAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -480,7 +498,7 @@ class ContainerAPITest extends APISpec { .ifUnmodifiedSince(unmodified)) expect: - cu.delete(cac, null).statusCode() == 202 + cc.deleteWithResponse(cac, null, null).statusCode() == 202 where: modified | unmodified | leaseID @@ -500,7 +518,7 @@ class ContainerAPITest extends APISpec { .ifUnmodifiedSince(unmodified)) when: - cu.delete(cac, null) + cc.deleteWithResponse(cac, null, null) then: thrown(StorageException) @@ -518,7 +536,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.delete(new ContainerAccessConditions().modifiedAccessConditions(mac), null) + cc.deleteWithResponse(new ContainerAccessConditions().modifiedAccessConditions(mac), null, null) then: thrown(UnsupportedOperationException) @@ -531,10 +549,10 @@ class ContainerAPITest extends APISpec { def "Delete error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.delete(null, null) + cc.delete() then: thrown(StorageException) @@ -543,11 +561,11 @@ class ContainerAPITest extends APISpec { def "List blobs flat"() { setup: String name = generateBlobName() - PageBlobClient bu = cu.getPageBlobClient(name) + PageBlobClient bu = cc.getPageBlobClient(name) bu.create(512) when: - Iterator blobs = cu.listBlobsFlat().iterator() + Iterator blobs = cc.listBlobsFlat().iterator() //ContainerListBlobFlatSegmentHeaders headers = response.headers() //List blobs = responseiterator()() @@ -590,37 +608,37 @@ class ContainerAPITest extends APISpec { def "List blobs flat min"() { when: - cu.listBlobsFlat().iterator().hasNext() + cc.listBlobsFlat().iterator().hasNext() then: notThrown(StorageException) } def setupListBlobsTest(String normalName, String copyName, String metadataName, String uncommittedName) { - PageBlobClient normal = cu.getPageBlobClient(normalName) + PageBlobClient normal = cc.getPageBlobClient(normalName) normal.create(512) - PageBlobClient copyBlob = cu.getPageBlobClient(copyName) + PageBlobClient copyBlob = cc.getPageBlobClient(copyName) - String status = copyBlob.startCopyFromURL(normal.getBlobUrl()).value() + String status = copyBlob.startCopyFromURL(normal.getBlobUrl()) OffsetDateTime start = OffsetDateTime.now() while (status != CopyStatusType.SUCCESS.toString()) { - status = copyBlob.getProperties().headers().value("x-ms-copy-status") + status = copyBlob.getPropertiesWithResponse(null, null, null).headers().value("x-ms-copy-status") OffsetDateTime currentTime = OffsetDateTime.now() if (status == CopyStatusType.FAILED.toString() || currentTime.minusMinutes(1) == start) { throw new Exception("Copy failed or took too long") } - sleep(1000) + sleepIfRecord(1000) } - PageBlobClient metadataBlob = cu.getPageBlobClient(metadataName) + PageBlobClient metadataBlob = cc.getPageBlobClient(metadataName) Metadata values = new Metadata() values.put("foo", "bar") - metadataBlob.create(512, null, null, values, null, null) + metadataBlob.createWithResponse(512, null, null, values, null, null, null) - String snapshotTime = normal.createSnapshot().value().getSnapshotId() + String snapshotTime = normal.createSnapshot().getSnapshotId() - BlockBlobClient uncommittedBlob = cu.getBlockBlobClient(uncommittedName) + BlockBlobClient uncommittedBlob = cc.getBlockBlobClient(uncommittedName) uncommittedBlob.stageBlock("0000", defaultInputStream.get(), defaultData.remaining()) @@ -646,7 +664,7 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsFlat(options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsFlat(options, null).iterator()) then: blobs.get(0).name() == normalName @@ -670,7 +688,7 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsFlat(options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsFlat(options, null).iterator()) then: blobs.get(0).name() == normalName @@ -691,7 +709,7 @@ class ContainerAPITest extends APISpec { String snapshotTime = setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsFlat(options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsFlat(options, null).iterator()) then: blobs.get(0).name() == normalName @@ -710,7 +728,7 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsFlat(options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsFlat(options, null).iterator()) then: blobs.get(0).name() == normalName @@ -722,13 +740,13 @@ class ContainerAPITest extends APISpec { setup: enableSoftDelete() String name = generateBlobName() - AppendBlobClient bu = cu.getAppendBlobClient(name) + AppendBlobClient bu = cc.getAppendBlobClient(name) bu.create() bu.delete() when: ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().deletedBlobs(true)) - Iterator blobs = cu.listBlobsFlat(options, null).iterator() + Iterator blobs = cc.listBlobsFlat(options, null).iterator() then: blobs.next().name() == name @@ -747,30 +765,28 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - Iterator blobs = cu.listBlobsFlat(options, null).iterator() + Iterator blobs = cc.listBlobsFlat(options, null).iterator() then: blobs.next().name() == normalName !blobs.hasNext() // Normal } - // TODO (alzimmer): Turn this on once paged responses are available - /*def "List blobs flat options maxResults"() { + def "List blobs flat options maxResults"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().copy(true) - .snapshots(true).uncommittedBlobs(true)).maxResults(2) - String normalName = "a" + generateBlobName() - String copyName = "c" + generateBlobName() - String metadataName = "m" + generateBlobName() - String uncommittedName = "u" + generateBlobName() + def PAGE_SIZE = 2 + def options = new ListBlobsOptions().details(new BlobListDetails().copy(true) + .snapshots(true).uncommittedBlobs(true)).maxResults(PAGE_SIZE) + def normalName = "a" + generateBlobName() + def copyName = "c" + generateBlobName() + def metadataName = "m" + generateBlobName() + def uncommittedName = "u" + generateBlobName() setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) - when: - Iterator blobs = cu.listBlobsFlat(options, null).iterator() - - then: - blobs.size() == 2 - }*/ + expect: "Get first page of blob listings (sync and async)" + cc.listBlobsFlat(options, null).iterableByPage().iterator().next().value().size() == PAGE_SIZE + ccAsync.listBlobsFlat(options).byPage().blockFirst().value().size() == PAGE_SIZE + } def "List blobs flat options fail"() { when: @@ -780,45 +796,94 @@ class ContainerAPITest extends APISpec { thrown(IllegalArgumentException) } - // TODO (alzimmer): Turn this on once paged responses are available - /*def "List blobs flat marker"() { + def "List blobs flat marker"() { setup: - for (int i = 0; i < 10; i++) { - PageBlobClient bu = cu.getPageBlobClient(generateBlobName()) - bu.create(512) + def NUM_BLOBS = 10 + def PAGE_SIZE = 6 + for (int i = 0; i < NUM_BLOBS ; i++) { + PageBlobClient bc = cc.getPageBlobClient(generateBlobName()) + bc.create(512) } - Iterator response = cu.listBlobsFlat(new ListBlobsOptions().maxResults(6), null) + when: "list blobs with sync client" + def pagedIterable = cc.listBlobsFlat(new ListBlobsOptions().maxResults(PAGE_SIZE), null) + def pagedSyncResponse1 = pagedIterable.iterableByPage().iterator().next() + def pagedSyncResponse2 = pagedIterable.iterableByPage(pagedSyncResponse1.nextLink()).iterator().next() - String marker = response.body().nextMarker() - int firstSegmentSize = response.iterator().size() - response = cu.listBlobsFlat(marker, null, null) + then: + pagedSyncResponse1.value().size() == PAGE_SIZE + pagedSyncResponse2.value().size() == NUM_BLOBS - PAGE_SIZE + pagedSyncResponse2.nextLink() == null - expect: - firstSegmentSize == 6 - response.body().nextMarker() == null - responseiterator()().size() == 4 - }*/ + + when: "list blobs with async client" + def pagedFlux = ccAsync.listBlobsFlat(new ListBlobsOptions().maxResults(PAGE_SIZE)) + def pagedResponse1 = pagedFlux.byPage().blockFirst() + def pagedResponse2 = pagedFlux.byPage(pagedResponse1.nextLink()).blockFirst() + + then: + pagedResponse1.value().size() == PAGE_SIZE + pagedResponse2.value().size() == NUM_BLOBS - PAGE_SIZE + pagedResponse2.nextLink() == null + } def "List blobs flat error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.listBlobsFlat().iterator().hasNext() + cc.listBlobsFlat().iterator().hasNext() then: thrown(StorageException) } + def "List blobs flat with timeout still backed by PagedFlux"() { + setup: + def NUM_BLOBS = 5 + def PAGE_RESULTS = 3 + + def blobs = [] as Collection + for (i in (1..NUM_BLOBS)) { + def blob = cc.getBlockBlobClient(generateBlobName()) + blob.upload(defaultInputStream.get(), defaultDataSize) + blobs << blob + } + + when: "Consume results by page" + cc.listBlobsFlat(new ListBlobsOptions().maxResults(PAGE_RESULTS), Duration.ofSeconds(10)).streamByPage().count() + + then: "Still have paging functionality" + notThrown(Exception) + } + + def "List blobs hier with timeout still backed by PagedFlux"() { + setup: + def NUM_BLOBS = 5 + def PAGE_RESULTS = 3 + + def blobs = [] as Collection + for (i in (1..NUM_BLOBS)) { + def blob = cc.getBlockBlobClient(generateBlobName()) + blob.upload(defaultInputStream.get(), defaultDataSize) + blobs << blob + } + + when: "Consume results by page" + cc.listBlobsHierarchy("/", new ListBlobsOptions().maxResults(PAGE_RESULTS), Duration.ofSeconds(10)).streamByPage().count() + + then: "Still have paging functionality" + notThrown(Exception) + } + def "List blobs hierarchy"() { setup: String name = generateBlobName() - PageBlobClient bu = cu.getPageBlobClient(name) + PageBlobClient bu = cc.getPageBlobClient(name) bu.create(512) when: - Iterator blobs = cu.listBlobsHierarchy(null).iterator() + Iterator blobs = cc.listBlobsHierarchy(null).iterator() then: // response.statusCode() == 200 @@ -832,7 +897,7 @@ class ContainerAPITest extends APISpec { def "List blobs hierarchy min"() { when: - cu.listBlobsHierarchy("/").iterator().hasNext() + cc.listBlobsHierarchy("/").iterator().hasNext() then: notThrown(StorageException) @@ -848,7 +913,7 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsHierarchy("", options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsHierarchy("", options, null).iterator()) then: blobs.get(0).name() == normalName @@ -872,7 +937,7 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsHierarchy("", options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsHierarchy("", options, null).iterator()) then: blobs.get(0).name() == normalName @@ -893,7 +958,7 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsHierarchy("", options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsHierarchy("", options, null).iterator()) then: blobs.get(0).name() == normalName @@ -904,14 +969,14 @@ class ContainerAPITest extends APISpec { def "List blobs hier options deleted"() { setup: enableSoftDelete() - String name = generateBlobName() - AppendBlobClient bu = cu.getAppendBlobClient(name) - bu.create() - bu.delete() + def name = generateBlobName() + def bc = cc.getAppendBlobClient(name) + bc.create() + bc.delete() when: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().deletedBlobs(true)) - Iterator blobs = cu.listBlobsHierarchy("", options, null).iterator() + def options = new ListBlobsOptions().details(new BlobListDetails().deletedBlobs(true)) + def blobs = cc.listBlobsHierarchy("", options, null).iterator() then: blobs.next().name() == name @@ -930,37 +995,38 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - Iterator blobs = cu.listBlobsHierarchy("", options, null).iterator() + Iterator blobs = cc.listBlobsHierarchy("", options, null).iterator() then: blobs.next().name() == normalName !blobs.hasNext() // Normal } - // TODO (alzimmer): Turn this on when paged responses becomes available - /*def "List blobs hier options maxResults"() { + + def "List blobs hier options maxResults"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().copy(true) + def options = new ListBlobsOptions().details(new BlobListDetails().copy(true) .uncommittedBlobs(true)).maxResults(1) - String normalName = "a" + generateBlobName() - String copyName = "c" + generateBlobName() - String metadataName = "m" + generateBlobName() - String uncommittedName = "u" + generateBlobName() + def normalName = "a" + generateBlobName() + def copyName = "c" + generateBlobName() + def metadataName = "m" + generateBlobName() + def uncommittedName = "u" + generateBlobName() setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - Iterator blobs = cu.listBlobsHierarchy("", options, null).iterator() + // use async client, as there is no paging functionality for sync yet + def blobs = ccAsync.listBlobsHierarchy("", options).byPage().blockFirst() then: - blobs.size() == 1 - }*/ + blobs.value().size() == 1 + } @Unroll def "List blobs hier options fail"() { when: def options = new ListBlobsOptions().details(new BlobListDetails().snapshots(snapshots)) .maxResults(maxResults) - cu.listBlobsHierarchy(null, options, null).iterator().hasNext() + cc.listBlobsHierarchy(null, options, null).iterator().hasNext() then: def e = thrown(Exception) @@ -974,86 +1040,79 @@ class ContainerAPITest extends APISpec { def "List blobs hier delim"() { setup: - def blobNames = Arrays.asList("a", "b/a", "c", "d/a", "e", "f", "g/a") - for (String blobName : blobNames) { - def bu = cu.getAppendBlobClient(blobName) + def blobNames = ["a", "b/a", "c", "d/a", "e", "f", "g/a"] + for (def blobName : blobNames) { + def bu = cc.getAppendBlobClient(blobName) bu.create() } when: - Iterator blobs = cu.listBlobsHierarchy(null).iterator() + def foundBlobs = [] as Set + def foundPrefixes = [] as Set + cc.listBlobsHierarchy(null).stream().collect(Collectors.toList()) + .forEach { blobItem -> + if (blobItem.isPrefix()) { + foundPrefixes << blobItem.name() + } + else { + foundBlobs << blobItem.name() + } + } and: - ArrayDeque expectedBlobs = new ArrayDeque<>() - expectedBlobs.add("a") - expectedBlobs.add("c") - expectedBlobs.add("e") - expectedBlobs.add("f") - - ArrayDeque expectedPrefixes = new ArrayDeque<>() - expectedPrefixes.add("b/") - expectedPrefixes.add("d/") - expectedPrefixes.add("g/") + def expectedBlobs = ["a", "c", "e", "f"] as Set + def expectedPrefixes = ["b/", "d/", "g/"] as Set then: - while (blobs.hasNext()) { - BlobItem blob = blobs.next() - - if (blob.isPrefix()) { - blob.name() == expectedPrefixes.pop() - } else { - blob.name() == expectedBlobs.pop() - } - } - - expectedPrefixes.isEmpty() - expectedBlobs.isEmpty() + expectedBlobs == foundBlobs + expectedPrefixes == foundPrefixes } - // TODO (alzimmer): Turn this on when paged response become available - /*def "List blobs hier marker"() { + def "List blobs hier marker"() { setup: - for (int i = 0; i < 10; i++) { - PageBlobClient bu = cu.getPageBlobClient(generateBlobName()) - bu.create(512) + def NUM_BLOBS = 10 + def PAGE_SIZE = 6 + for (int i = 0; i < NUM_BLOBS; i++) { + PageBlobClient bc = cc.getPageBlobClient(generateBlobName()) + bc.create(512) } - ContainerListBlobHierarchySegmentResponse response = cu.listBlobsHierarchySegment(null, "/", - new ListBlobsOptions().maxResults(6), null) + def blobs = cc.listBlobsHierarchy("/", new ListBlobsOptions().maxResults(PAGE_SIZE), null) - String marker = response.body().nextMarker() - int firstSegmentSize = responseiterator()().size() - response = cu.listBlobsHierarchySegment(marker, "/", null, null) + when: + def firstPage = blobs.iterableByPage().iterator().next() - expect: - firstSegmentSize == 6 - response.body().nextMarker() == null - response.iterator().size() == 4 - }*/ + then: + firstPage.value().size() == PAGE_SIZE + firstPage.nextLink() != null + + when: + def secondPage = blobs.iterableByPage(firstPage.nextLink()).iterator().next() + + then: + secondPage.value().size() == NUM_BLOBS - PAGE_SIZE + secondPage.nextLink() == null + } def "List blobs flat simple"() { - setup: - // Create 10 page blobs in the container - for (int i = 0; i < 10; i++) { - PageBlobClient bu = cu.getPageBlobClient(generateBlobName()) - bu.create(512) + setup: "Create 10 page blobs in the container" + def NUM_BLOBS = 10 + def PAGE_SIZE = 3 + for (int i = 0; i < NUM_BLOBS; i++) { + def bc = cc.getPageBlobClient(generateBlobName()) + bc.create(512) } - // Setting maxResult limits the number of items per page, this way we validate - // that blob.size() make multiple calls - one call per page to retrieve all 10 blobs. - // - Iterable blobs = cu.listBlobsFlat(new ListBlobsOptions().maxResults(3), null) - int size = blobs.size() - expect: - size == 10 + expect: "listing operation will fetch all 10 blobs, despite page size being smaller than 10" + cc.listBlobsFlat(new ListBlobsOptions().maxResults(PAGE_SIZE), null).stream().count() == NUM_BLOBS } def "List blobs hier error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.listBlobsHierarchy(".").iterator().hasNext() + cc.listBlobsHierarchy(".").iterator().hasNext() then: thrown(StorageException) @@ -1062,10 +1121,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Acquire lease"() { setup: - Response leaseResponse = cu.acquireLease(proposedID, leaseTime) + def leaseResponse = cc.acquireLeaseWithResponse(proposedID, leaseTime, null, null, null) when: - Response propertiesResponse = cu.getProperties() + def propertiesResponse = cc.getPropertiesWithResponse(null, null, null) then: leaseResponse.value() != null @@ -1082,7 +1141,7 @@ class ContainerAPITest extends APISpec { def "Acquire lease min"() { expect: - cu.acquireLease(null, -1).statusCode() == 201 + cc.acquireLeaseWithResponse(null, -1, null, null, null).statusCode() == 201 } @Unroll @@ -1091,7 +1150,7 @@ class ContainerAPITest extends APISpec { def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) expect: - cu.acquireLease(null, -1, mac, null).statusCode() == 201 + cc.acquireLeaseWithResponse(null, -1, mac, null, null).statusCode() == 201 where: modified | unmodified @@ -1106,7 +1165,7 @@ class ContainerAPITest extends APISpec { def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) when: - cu.acquireLease(null, -1, mac, null) + cc.acquireLeaseWithResponse(null, -1, mac, null, null) then: thrown(StorageException) @@ -1120,10 +1179,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Acquire lease AC illegal"() { setup: - ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) + def mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.acquireLease(null, -1, mac, null) + cc.acquireLeaseWithResponse(null, -1, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1136,10 +1195,10 @@ class ContainerAPITest extends APISpec { def "Acquire lease error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.acquireLease(null, 50, null, null) + cc.acquireLease(null, 50) then: thrown(StorageException) @@ -1147,33 +1206,34 @@ class ContainerAPITest extends APISpec { def "Renew lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) - Thread.sleep(16000) // Wait for the lease to expire to ensure we are actually renewing it - Response renewLeaseResponse = cu.renewLease(leaseID) + // If running in live mode wait for the lease to expire to ensure we are actually renewing it + sleepIfRecord(16000) + Response renewLeaseResponse = cc.renewLeaseWithResponse(leaseID, null, null, null) expect: renewLeaseResponse.value() != null - cu.getProperties().headers().value("x-ms-lease-state") == LeaseStateType.LEASED.toString() + cc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state") == LeaseStateType.LEASED.toString() validateBasicHeaders(renewLeaseResponse.headers()) } def "Renew lease min"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.renewLease(leaseID).statusCode() == 200 + cc.renewLeaseWithResponse(leaseID, null, null, null).statusCode() == 200 } @Unroll def "Renew lease AC"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) expect: - cu.renewLease(leaseID, mac, null).statusCode() == 200 + cc.renewLeaseWithResponse(leaseID, mac, null, null).statusCode() == 200 where: modified | unmodified @@ -1185,11 +1245,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Renew lease AC fail"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) when: - cu.renewLease(leaseID, mac, null) + cc.renewLease(leaseID, mac, null) then: thrown(StorageException) @@ -1206,7 +1266,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.renewLease(receivedLeaseID, mac, null) + cc.renewLease(receivedLeaseID, mac, null) then: thrown(UnsupportedOperationException) @@ -1219,10 +1279,10 @@ class ContainerAPITest extends APISpec { def "Renew lease error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.renewLease("id") + cc.renewLease("id") then: thrown(StorageException) @@ -1230,31 +1290,31 @@ class ContainerAPITest extends APISpec { def "Release lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + def leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) - VoidResponse releaseLeaseResponse = cu.releaseLease(leaseID) + def releaseLeaseResponse = cc.releaseLeaseWithResponse(leaseID, null, null, null) expect: - cu.getProperties().headers().value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() + cc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() validateBasicHeaders(releaseLeaseResponse.headers()) } def "Release lease min"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.releaseLease(leaseID).statusCode() == 200 + cc.releaseLeaseWithResponse(leaseID, null, null, null).statusCode() == 200 } @Unroll def "Release lease AC"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) expect: - cu.releaseLease(leaseID, mac, null).statusCode() == 200 + cc.releaseLeaseWithResponse(leaseID, mac, null, null).statusCode() == 200 where: modified | unmodified @@ -1266,11 +1326,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Release lease AC fail"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) when: - cu.releaseLease(leaseID, mac, null) + cc.releaseLeaseWithResponse(leaseID, mac, null, null) then: thrown(StorageException) @@ -1287,7 +1347,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.releaseLease(receivedLeaseID, mac, null) + cc.releaseLeaseWithResponse(receivedLeaseID, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1300,10 +1360,10 @@ class ContainerAPITest extends APISpec { def "Release lease error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.releaseLease("id") + cc.releaseLease("id") then: thrown(StorageException) @@ -1312,17 +1372,18 @@ class ContainerAPITest extends APISpec { @Unroll def "Break lease"() { setup: - cu.acquireLease(UUID.randomUUID().toString(), leaseTime) + cc.acquireLease(getRandomUUID(), leaseTime) - Response breakLeaseResponse = cu.breakLease(breakPeriod, null, null) - LeaseStateType state = LeaseStateType.fromString(cu.getProperties().headers().value("x-ms-lease-state")) + def breakLeaseResponse = cc.breakLeaseWithResponse(breakPeriod, null, null, null) + def state = LeaseStateType.fromString(cc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-lease-state")) expect: state == LeaseStateType.BROKEN || state == LeaseStateType.BREAKING breakLeaseResponse.value().getSeconds() <= remainingTime validateBasicHeaders(breakLeaseResponse.headers()) if (breakPeriod != null) { - sleep(breakPeriod * 1000) // so we can delete the container after the test completes + // If running in live mode wait for the lease to break so we can delete the container after the test completes + sleepIfRecord(breakPeriod * 1000) } where: @@ -1335,20 +1396,20 @@ class ContainerAPITest extends APISpec { def "Break lease min"() { setup: - setupContainerLeaseCondition(cu, receivedLeaseID) + setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.breakLease().statusCode() == 202 + cc.breakLeaseWithResponse(null, null, null, null).statusCode() == 202 } @Unroll def "Break lease AC"() { setup: - setupContainerLeaseCondition(cu, receivedLeaseID) + setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) expect: - cu.breakLease(null, mac, null).statusCode() == 202 + cc.breakLeaseWithResponse(null, mac, null, null).statusCode() == 202 where: modified | unmodified @@ -1360,11 +1421,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Break lease AC fail"() { setup: - setupContainerLeaseCondition(cu, receivedLeaseID) + setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) when: - cu.breakLease(null, mac, null) + cc.breakLeaseWithResponse(null, mac, null, null) then: thrown(StorageException) @@ -1381,7 +1442,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.breakLease(null, mac, null) + cc.breakLeaseWithResponse(null, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1394,10 +1455,10 @@ class ContainerAPITest extends APISpec { def "Break lease error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.breakLease() + cc.breakLease() then: thrown(StorageException) @@ -1405,31 +1466,31 @@ class ContainerAPITest extends APISpec { def "Change lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) - Response changeLeaseResponse = cu.changeLease(leaseID, UUID.randomUUID().toString()) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) + Response changeLeaseResponse = cc.changeLeaseWithResponse(leaseID, getRandomUUID(), null, null, null) leaseID = changeLeaseResponse.value() expect: - cu.releaseLease(leaseID).statusCode() == 200 + cc.releaseLeaseWithResponse(leaseID, null, null, null).statusCode() == 200 validateBasicHeaders(changeLeaseResponse.headers()) } def "Change lease min"() { setup: - def leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + def leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.changeLease(leaseID, UUID.randomUUID().toString()).statusCode() == 200 + cc.changeLeaseWithResponse(leaseID, getRandomUUID(), null, null, null).statusCode() == 200 } @Unroll def "Change lease AC"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) expect: - cu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null).statusCode() == 200 + cc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null).statusCode() == 200 where: modified | unmodified @@ -1441,11 +1502,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Change lease AC fail"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) when: - cu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null) + cc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null) then: thrown(StorageException) @@ -1462,7 +1523,7 @@ class ContainerAPITest extends APISpec { ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) when: - cu.changeLease(receivedLeaseID, garbageLeaseID, mac, null) + cc.changeLeaseWithResponse(receivedLeaseID, garbageLeaseID, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1475,10 +1536,10 @@ class ContainerAPITest extends APISpec { def "Change lease error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.changeLease("id", "id") + cc.changeLease("id", "id") then: thrown(StorageException) @@ -1488,19 +1549,19 @@ class ContainerAPITest extends APISpec { def "Create URL special chars"() { // This test checks that we encode special characters in blob names correctly. setup: - AppendBlobClient bu2 = cu.getAppendBlobClient(name) - PageBlobClient bu3 = cu.getPageBlobClient(name + "2") - BlockBlobClient bu4 = cu.getBlockBlobClient(name + "3") - BlockBlobClient bu5 = cu.getBlockBlobClient(name) + AppendBlobClient bu2 = cc.getAppendBlobClient(name) + PageBlobClient bu3 = cc.getPageBlobClient(name + "2") + BlockBlobClient bu4 = cc.getBlockBlobClient(name + "3") + BlockBlobClient bu5 = cc.getBlockBlobClient(name) expect: - bu2.create().statusCode() == 201 - bu5.getProperties().statusCode() == 200 - bu3.create(512).statusCode() == 201 - bu4.upload(defaultInputStream.get(), defaultDataSize).statusCode() == 201 + bu2.createWithResponse(null, null, null, null, null).statusCode() == 201 + bu5.getPropertiesWithResponse(null, null, null).statusCode() == 200 + bu3.createWithResponse(512, null, null, null, null, null, null).statusCode() == 201 + bu4.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null, null, null).statusCode() == 201 when: - Iterator blobs = cu.listBlobsFlat().iterator() + Iterator blobs = cc.listBlobsFlat().iterator() then: blobs.next().name() == name @@ -1508,47 +1569,45 @@ class ContainerAPITest extends APISpec { blobs.next().name() == name + "3" where: - name | _ + name | _ // "中文" | _ TODO: requires blob name to be url encoded, deferred for post preview-1, storage team to decide on encoding story across SDKS - "az[]" | _ + "az[]" | _ // "hello world" | _ TODO: see previous TODO - "hello/world" | _ - "hello&world" | _ + "hello/world" | _ + "hello&world" | _ // "!*'();:@&=+\$,/?#[]" | _ TODO: see previous TODO } def "Root explicit"() { setup: - cu = primaryServiceURL.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) + cc = primaryBlobServiceClient.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) // Create root container if not exist. - if (!cu.exists().value()) { - cu.create() + if (!cc.exists()) { + cc.create() } - AppendBlobClient bu = cu.getAppendBlobClient("rootblob") + AppendBlobClient bu = cc.getAppendBlobClient("rootblob") expect: - bu.create().statusCode() == 201 + bu.createWithResponse(null, null, null, null, null).statusCode() == 201 } def "Root explicit in endpoint"() { setup: - cu = primaryServiceURL.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) + cc = primaryBlobServiceClient.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) // Create root container if not exist. - if (!cu.exists().value()) { - cu.create() + if (!cc.exists()) { + cc.create() } - AppendBlobClient bu = new BlobClientBuilder() - .credential(primaryCreds) - .endpoint("http://" + primaryCreds.accountName() + ".blob.core.windows.net/\$root/rootblob") - .httpClient(getHttpClient()) - .buildAppendBlobClient() + AppendBlobClient bu = getBlobClient(primaryCredential, + String.format("http://%s.blob.core.windows.net/%s/rootblob", primaryCredential.accountName(), ContainerClient.ROOT_CONTAINER_NAME)) + .asAppendBlobClient() when: - Response createResponse = bu.create() + Response createResponse = bu.createWithResponse(null, null, null, null, null) - Response propsResponse = bu.getProperties() + Response propsResponse = bu.getPropertiesWithResponse(null, null, null) then: createResponse.statusCode() == 201 @@ -1559,22 +1618,22 @@ class ContainerAPITest extends APISpec { /* def "Root implicit"() { setup: - cu = primaryServiceURL.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) + cc = primaryBlobServiceClient.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) // Create root container if not exist. - if (!cu.exists().value()) { - cu.create() + if (!cc.exists().value()) { + cc.create() } - AppendBlobClient bu = new BlobClientBuilder() + AppendBlobClient bc = new BlobClientBuilder() .credential(primaryCreds) .endpoint("http://" + primaryCreds.accountName() + ".blob.core.windows.net/rootblob") .httpClient(getHttpClient()) .buildAppendBlobClient() when: - Response createResponse = bu.create() + Response createResponse = bc.create() - Response propsResponse = bu.getProperties() + Response propsResponse = bc.getProperties() then: createResponse.statusCode() == 201 @@ -1585,17 +1644,17 @@ class ContainerAPITest extends APISpec { def "Web container"() { setup: - cu = primaryServiceURL.getContainerClient(ContainerClient.STATIC_WEBSITE_CONTAINER_NAME) + cc = primaryBlobServiceClient.getContainerClient(ContainerClient.STATIC_WEBSITE_CONTAINER_NAME) // Create root container if not exist. try { - cu.create(null, null, null) + cc.create() } catch (StorageException se) { if (se.errorCode() != StorageErrorCode.CONTAINER_ALREADY_EXISTS) { throw se } } - def webContainer = primaryServiceURL.getContainerClient(ContainerClient.STATIC_WEBSITE_CONTAINER_NAME) + def webContainer = primaryBlobServiceClient.getContainerClient(ContainerClient.STATIC_WEBSITE_CONTAINER_NAME) when: // Validate some basic operation. @@ -1607,7 +1666,7 @@ class ContainerAPITest extends APISpec { def "Get account info"() { when: - Response response = primaryServiceURL.getAccountInfo() + def response = primaryBlobServiceClient.getAccountInfoWithResponse(null, null) then: response.headers().value("Date") != null @@ -1619,14 +1678,12 @@ class ContainerAPITest extends APISpec { def "Get account info min"() { expect: - primaryServiceURL.getAccountInfo().statusCode() == 200 + primaryBlobServiceClient.getAccountInfoWithResponse(null, null).statusCode() == 200 } def "Get account info error"() { when: - BlobServiceClient serviceURL = new BlobServiceClientBuilder() - .endpoint(primaryServiceURL.getAccountUrl().toString()) - .buildClient() + BlobServiceClient serviceURL = getServiceClient(primaryBlobServiceClient.getAccountUrl().toString()) serviceURL.getContainerClient(generateContainerName()).getAccountInfo() diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseMockFlux.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseMockFlux.java index 864e23a7a082..9134d3a840da 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseMockFlux.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseMockFlux.java @@ -8,8 +8,6 @@ import com.azure.storage.blob.models.BlobDownloadHeaders; import com.azure.storage.blob.models.BlobsDownloadResponse; import com.azure.storage.blob.models.StorageErrorException; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -19,7 +17,7 @@ import java.nio.ByteBuffer; import java.nio.charset.Charset; -class DownloadResponseMockFlux extends Flux { +class DownloadResponseMockFlux extends Flux { static final int DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK = 0; static final int DR_TEST_SCENARIO_SUCCESSFUL_MULTI_CHUNK = 1; static final int DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES = 2; @@ -33,15 +31,16 @@ class DownloadResponseMockFlux extends Flux { private HTTPGetterInfo info; private ByteBuffer scenarioData; - DownloadResponseMockFlux(int scenario) { + DownloadResponseMockFlux(int scenario, APISpec apiSpec) { this.scenario = scenario; + switch (this.scenario) { case DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK: - this.scenarioData = APISpec.getRandomData(512 * 1024); + this.scenarioData = apiSpec.getRandomData(512 * 1024); break; case DR_TEST_SCENARIO_SUCCESSFUL_MULTI_CHUNK: case DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES: - this.scenarioData = APISpec.getRandomData(1024); + this.scenarioData = apiSpec.getRandomData(1024); break; case DR_TEST_SCENARIO_MAX_RETRIES_EXCEEDED: case DR_TEST_SCENARIO_NON_RETRYABLE_ERROR: @@ -62,10 +61,10 @@ int getTryNumber() { } @Override - public void subscribe(CoreSubscriber subscriber) { + public void subscribe(CoreSubscriber subscriber) { switch (this.scenario) { case DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK: - subscriber.onNext(Unpooled.wrappedBuffer(this.scenarioData.duplicate())); + subscriber.onNext(this.scenarioData.duplicate()); Operators.complete(subscriber); break; @@ -74,7 +73,7 @@ public void subscribe(CoreSubscriber subscriber) { ByteBuffer toSend = this.scenarioData.duplicate(); toSend.position(i * 256); toSend.limit((i + 1) * 256); - subscriber.onNext(Unpooled.wrappedBuffer(toSend)); + subscriber.onNext(toSend); } Operators.complete(subscriber); break; @@ -90,7 +89,7 @@ public void subscribe(CoreSubscriber subscriber) { ByteBuffer toSend = this.scenarioData.duplicate(); toSend.position((this.tryNumber - 1) * 256); toSend.limit(this.tryNumber * 256); - subscriber.onNext(Unpooled.wrappedBuffer(toSend)); + subscriber.onNext(toSend); Operators.error(subscriber, new IOException()); break; } @@ -102,7 +101,7 @@ public void subscribe(CoreSubscriber subscriber) { ByteBuffer toSend = this.scenarioData.duplicate(); toSend.position((this.tryNumber - 1) * 256); toSend.limit(this.tryNumber * 256); - subscriber.onNext(Unpooled.wrappedBuffer(toSend)); + subscriber.onNext(toSend); Operators.complete(subscriber); break; @@ -179,7 +178,7 @@ public HttpHeaders headers() { } @Override - public Flux body() { + public Flux body() { return null; } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy index f784283d4de6..778d3334104a 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy @@ -13,7 +13,7 @@ class DownloadResponseTest extends APISpec { BlockBlobClient bu def setup() { - bu = cu.getBlockBlobClient(generateBlobName()) + bu = cc.getBlockBlobClient(generateBlobName()) bu.upload(defaultInputStream.get(), defaultText.length()) } @@ -32,7 +32,7 @@ class DownloadResponseTest extends APISpec { @Unroll def "Successful"() { setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario) + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario, this) HTTPGetterInfo info = new HTTPGetterInfo() .offset(0) @@ -45,7 +45,7 @@ class DownloadResponseTest extends APISpec { DownloadAsyncResponse response = flux.getter(info).block() then: - FluxUtil.collectByteBufStream(response.body(options), false).block().nioBuffer() == flux.getScenarioData() + FluxUtil.collectBytesInByteBufferStream(response.body(options)).block() == flux.getScenarioData().array() flux.getTryNumber() == tryNumber @@ -59,7 +59,7 @@ class DownloadResponseTest extends APISpec { @Unroll def "Failure"() { setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario) + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario, this) ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5) HTTPGetterInfo info = new HTTPGetterInfo().eTag("etag") @@ -89,7 +89,7 @@ class DownloadResponseTest extends APISpec { @Unroll def "Info null IA"() { setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK) + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK, this) when: new DownloadAsyncResponse(flux.getter(info).block().rawResponse(), info, { HTTPGetterInfo newInfo -> flux.getter(newInfo) }) @@ -113,7 +113,7 @@ class DownloadResponseTest extends APISpec { def "Getter IA"() { setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK) + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK, this) when: DownloadAsyncResponse response = new DownloadAsyncResponse(flux.getter(new HTTPGetterInfo()).block() @@ -126,7 +126,7 @@ class DownloadResponseTest extends APISpec { def "Info"() { setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_INFO_TEST) + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_INFO_TEST, this) HTTPGetterInfo info = new HTTPGetterInfo() .offset(20) .count(10) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy index 01000a486529..bf79c9f316ec 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy @@ -4,8 +4,8 @@ package com.azure.storage.blob import com.azure.core.http.rest.Response -import com.azure.core.http.rest.VoidResponse import com.azure.storage.blob.models.BlobRange +import com.azure.storage.blob.models.StorageException import com.azure.storage.blob.models.UserDelegationKey import com.azure.storage.common.Constants import com.azure.storage.common.IPRange @@ -24,14 +24,14 @@ class HelperTest extends APISpec { // TODO (alzimmer): Turn this on when nextPageLink can be passed into listing /*def "responseError"() { when: - cu.listBlobsFlat().iterator().hasNext() + cc.listBlobsFlat().iterator().hasNext() then: def e = thrown(StorageException) e.errorCode() == StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE e.statusCode() == 400 e.message().contains("Value for one of the query parameters specified in the request URI is invalid.") - e.getMessage().contains(" properties = bsu.getProperties() + Response properties = bsu.getPropertiesWithResponse(null, null, null) then: properties.value().cacheControl() == "cache" @@ -170,7 +166,7 @@ class HelperTest extends APISpec { } v.startTime(startTime) - .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCreds.accountName())) + .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCredential.accountName())) .snapshotId(snapId) if (expiryTime == null) { @@ -191,21 +187,21 @@ class HelperTest extends APISpec { .contentLanguage(language) .contentType(type) - SASQueryParameters token = v.generateSASQueryParameters(primaryCreds) + SASQueryParameters token = v.generateSASQueryParameters(primaryCredential) if (startTime != null) { expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(startTime), Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiryTime), - primaryCreds.accountName()) + primaryCredential.accountName()) } else { expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiryTime), - primaryCreds.accountName()) + primaryCredential.accountName()) } then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.signature() == primaryCredential.computeHmac256(expectedStringToSign) /* We don't test the blob or containerName properties because canonicalized resource is always added as at least @@ -240,7 +236,7 @@ class HelperTest extends APISpec { } v.startTime(startTime) - .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCreds.accountName())) + .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCredential.accountName())) .snapshotId(snapId) if (expiryTime == null) { @@ -277,7 +273,7 @@ class HelperTest extends APISpec { SASQueryParameters token = v.generateSASQueryParameters(key) - expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(v.expiryTime()), primaryCreds.accountName()) + expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(v.expiryTime()), primaryCredential.accountName()) then: token.signature() == Utility.computeHMac256(key.value(), expectedStringToSign) @@ -313,7 +309,7 @@ class HelperTest extends APISpec { .expiryTime(expiryTime) .permissions(new BlobSASPermission().toString()) .resource(expectedResource) - .canonicalName(String.format("/blob/%s/%s", primaryCreds.accountName(), containerName)) + .canonicalName(String.format("/blob/%s/%s", primaryCredential.accountName(), containerName)) .snapshotId(snapId) if (blobName != null) { @@ -322,13 +318,13 @@ class HelperTest extends APISpec { expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiryTime), - primaryCreds.accountName()) + primaryCredential.accountName()) when: - SASQueryParameters token = v.generateSASQueryParameters(primaryCreds) + SASQueryParameters token = v.generateSASQueryParameters(primaryCredential) then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.signature() == primaryCredential.computeHmac256(expectedStringToSign) token.resource() == expectedResource where: @@ -358,10 +354,10 @@ class HelperTest extends APISpec { e.getMessage().contains(parameter) where: - containerName | version | creds | blobName || parameter - "c" | null | primaryCreds | "b" | "version" - "c" | "v" | null | "b" | "sharedKeyCredentials" - "c" | "v" | primaryCreds | null | "canonicalName" + containerName | version | creds | blobName || parameter + "c" | null | primaryCredential | "b" | "version" + "c" | "v" | null | "b" | "sharedKeyCredentials" + "c" | "v" | primaryCredential | null | "canonicalName" } @Unroll @@ -541,12 +537,12 @@ class HelperTest extends APISpec { v.ipRange(new IPRange().ipMin("ip")) } - def token = v.generateSASQueryParameters(primaryCreds) + def token = v.generateSASQueryParameters(primaryCredential) - expectedStringToSign = String.format(expectedStringToSign, primaryCreds.accountName()) + expectedStringToSign = String.format(expectedStringToSign, primaryCredential.accountName()) then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.signature() == primaryCredential.computeHmac256(expectedStringToSign) where: startTime | ipRange | protocol || expectedStringToSign @@ -573,13 +569,13 @@ class HelperTest extends APISpec { e.getMessage().contains(parameter) where: - permissions | service | resourceType | expiryTime | version | creds || parameter - null | "b" | "c" | OffsetDateTime.now() | "v" | primaryCreds || "permissions" - "c" | null | "c" | OffsetDateTime.now() | "v" | primaryCreds || "services" - "c" | "b" | null | OffsetDateTime.now() | "v" | primaryCreds || "resourceTypes" - "c" | "b" | "c" | null | "v" | primaryCreds || "expiryTime" - "c" | "b" | "c" | OffsetDateTime.now() | null | primaryCreds || "version" - "c" | "b" | "c" | OffsetDateTime.now() | "v" | null || "SharedKeyCredential" + permissions | service | resourceType | expiryTime | version | creds || parameter + null | "b" | "c" | OffsetDateTime.now() | "v" | primaryCredential || "permissions" + "c" | null | "c" | OffsetDateTime.now() | "v" | primaryCredential || "services" + "c" | "b" | null | OffsetDateTime.now() | "v" | primaryCredential || "resourceTypes" + "c" | "b" | "c" | null | "v" | primaryCredential || "expiryTime" + "c" | "b" | "c" | OffsetDateTime.now() | null | primaryCredential || "version" + "c" | "b" | "c" | OffsetDateTime.now() | "v" | null || "SharedKeyCredential" } @Unroll @@ -706,10 +702,10 @@ class HelperTest extends APISpec { ServiceSASSignatureValues sasValues = new ServiceSASSignatureValues() .expiryTime(OffsetDateTime.now(ZoneOffset.UTC).plusDays(1)) .permissions("r") - .canonicalName(String.format("/blob/%s/container/blob", primaryCreds.accountName())) + .canonicalName(String.format("/blob/%s/container/blob", primaryCredential.accountName())) .resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) - parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCreds)) + parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCredential)) when: String[] splitParts = parts.toURL().toString().split("\\?") diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/PageBlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/PageBlobAPITest.groovy index 26e8ce24a9a0..61cd27c9577a 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/PageBlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/PageBlobAPITest.groovy @@ -4,26 +4,43 @@ package com.azure.storage.blob import com.azure.core.http.rest.Response -import com.azure.storage.blob.models.* +import com.azure.storage.blob.models.BlobAccessConditions +import com.azure.storage.blob.models.BlobHTTPHeaders +import com.azure.storage.blob.models.BlobRange +import com.azure.storage.blob.models.CopyStatusType +import com.azure.storage.blob.models.LeaseAccessConditions +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.ModifiedAccessConditions +import com.azure.storage.blob.models.PageBlobAccessConditions +import com.azure.storage.blob.models.PageBlobItem +import com.azure.storage.blob.models.PageRange +import com.azure.storage.blob.models.PublicAccessType +import com.azure.storage.blob.models.SequenceNumberAccessConditions +import com.azure.storage.blob.models.SequenceNumberActionType +import com.azure.storage.blob.models.SourceModifiedAccessConditions +import com.azure.storage.blob.models.StorageException import spock.lang.Unroll import java.security.MessageDigest import java.time.OffsetDateTime class PageBlobAPITest extends APISpec { - PageBlobClient bu + PageBlobClient bc + PageBlobAsyncClient bcAsync def setup() { - bu = cu.getPageBlobClient(generateBlobName()) - bu.create(PageBlobClient.PAGE_BYTES) + def name = generateBlobName() + bc = cc.getPageBlobClient(name) + bcAsync = ccAsync.getPageBlobAsyncClient(name) + bc.create(PageBlobClient.PAGE_BYTES) } def "Create all null"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - Response response = bu.create(PageBlobClient.PAGE_BYTES) + def response = bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, null, null, null) then: response.statusCode() == 201 @@ -34,16 +51,15 @@ class PageBlobAPITest extends APISpec { def "Create min"() { expect: - bu.create(PageBlobClient.PAGE_BYTES).statusCode() == 201 + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, null, null, null).statusCode() == 201 } def "Create sequence number"() { when: - bu.create(PageBlobClient.PAGE_BYTES, 2, null, null, - null, null) + bc.createWithResponse(PageBlobClient.PAGE_BYTES, 2, null, null, null, null, null) then: - Integer.parseInt(bu.getProperties().headers().value("x-ms-blob-sequence-number")) == 2 + Integer.parseInt(bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-blob-sequence-number")) == 2 } @Unroll @@ -57,9 +73,9 @@ class PageBlobAPITest extends APISpec { .blobContentType(contentType) when: - bu.create(PageBlobClient.PAGE_BYTES, null, headers, null, null, null) + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, headers, null, null, null, null) - Response response = bu.getProperties(null, null) + def response = bc.getPropertiesWithResponse(null, null, null) // If the value isn't set the service will automatically set it contentType = (contentType == null) ? "application/octet-stream" : contentType @@ -85,9 +101,9 @@ class PageBlobAPITest extends APISpec { } when: - bu.create(PageBlobClient.PAGE_BYTES, null, null, metadata, null, null) + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, metadata, null, null, null) - Response response = bu.getProperties(null, null) + def response = bc.getPropertiesWithResponse(null, null, null) then: response.statusCode() == 200 @@ -103,16 +119,16 @@ class PageBlobAPITest extends APISpec { def "Create AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) expect: - bu.create(PageBlobClient.PAGE_BYTES, null, null, null, bac, null) - .statusCode() == 201 + + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, bac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -128,15 +144,15 @@ class PageBlobAPITest extends APISpec { def "Create AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.create(PageBlobClient.PAGE_BYTES, null, null, null, bac, null) + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, bac, null, null) then: thrown(StorageException) @@ -152,8 +168,8 @@ class PageBlobAPITest extends APISpec { def "Create error"() { when: - bu.create(PageBlobClient.PAGE_BYTES, null, null, null, - new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("id")), null) + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, + new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("id")), null, null) then: thrown(StorageException) @@ -161,48 +177,49 @@ class PageBlobAPITest extends APISpec { def "Upload page"() { when: - Response response = bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) + def response = bc.uploadPagesWithResponse(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null, null) then: response.statusCode() == 201 validateBasicHeaders(response.headers()) - response.value().contentMD5() != null + response.headers().value("x-ms-content-crc64") != null response.value().blobSequenceNumber() == 0 response.value().isServerEncrypted() } def "Upload page min"() { expect: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))).statusCode() == 201 + bc.uploadPagesWithResponse(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null, null).statusCode() == 201 } @Unroll def "Upload page IA"() { when: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES * 2 - 1), data) + def data = (dataSize == null) ? null : new ByteArrayInputStream(getRandomByteArray(dataSize)) + bc.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES * 2 - 1), data) then: def e = thrown(Exception) exceptionType.isInstance(e) where: - data | exceptionType - null | NullPointerException - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)) | IndexOutOfBoundsException - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES * 3)) | StorageException + dataSize | exceptionType + null | NullPointerException + PageBlobClient.PAGE_BYTES | IndexOutOfBoundsException + PageBlobClient.PAGE_BYTES * 3 | StorageException } @Unroll def "Upload page AC"() { setup: PageBlobAccessConditions pac = new PageBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) .sequenceNumberAccessConditions(new SequenceNumberAccessConditions() .ifSequenceNumberLessThan(sequenceNumberLT) @@ -210,8 +227,8 @@ class PageBlobAPITest extends APISpec { .ifSequenceNumberEqualTo(sequenceNumberEqual)) expect: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), pac, null).statusCode() == 201 + bc.uploadPagesWithResponse(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), pac, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | sequenceNumberLT | sequenceNumberLTE | sequenceNumberEqual @@ -229,8 +246,8 @@ class PageBlobAPITest extends APISpec { @Unroll def "Upload page AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) PageBlobAccessConditions pac = new PageBlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -244,8 +261,8 @@ class PageBlobAPITest extends APISpec { .ifSequenceNumberEqualTo(sequenceNumberEqual)) when: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), pac, null) + bc.uploadPagesWithResponse(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), pac, null, null) then: thrown(StorageException) @@ -264,13 +281,13 @@ class PageBlobAPITest extends APISpec { def "Upload page error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + bc.uploadPagesWithResponse(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), new PageBlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("id")), - null) + null, null) then: thrown(StorageException) @@ -278,15 +295,15 @@ class PageBlobAPITest extends APISpec { def "Upload page from URL min"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def destURL = cu.getPageBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getPageBlobClient(generateBlobName()) destURL.create(PageBlobClient.PAGE_BYTES) destURL.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) when: - Response response = bu.uploadPagesFromURL(pageRange, destURL.getBlobUrl(), null) + Response response = bc.uploadPagesFromURLWithResponse(pageRange, destURL.getBlobUrl(), null, null, null, null, null, null) then: response.statusCode() == 201 @@ -295,16 +312,16 @@ class PageBlobAPITest extends APISpec { def "Upload page from URL range"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) byte[] data = getRandomByteArray(PageBlobClient.PAGE_BYTES * 4) - def sourceURL = cu.getPageBlobClient(generateBlobName()) + def sourceURL = cc.getPageBlobClient(generateBlobName()) sourceURL.create(PageBlobClient.PAGE_BYTES * 4) sourceURL.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES * 4 - 1), new ByteArrayInputStream(data)) - def destURL = cu.getPageBlobClient(generateBlobName()) + def destURL = cc.getPageBlobClient(generateBlobName()) destURL.create(PageBlobClient.PAGE_BYTES * 2) when: @@ -317,31 +334,26 @@ class PageBlobAPITest extends APISpec { outputStream.toByteArray() == Arrays.copyOfRange(data, PageBlobClient.PAGE_BYTES * 2, PageBlobClient.PAGE_BYTES * 4) } - @Unroll def "Upload page from URL IA"() { when: - bu.uploadPagesFromURL(range, bu.getBlobUrl(), sourceOffset) + bc.uploadPagesFromURL(null, bc.getBlobUrl(), (Long) PageBlobClient.PAGE_BYTES) then: thrown(IllegalArgumentException) - - where: - sourceOffset | range - (Long) PageBlobClient.PAGE_BYTES | null } def "Upload page from URL MD5"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) - def destURL = cu.getPageBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getPageBlobClient(generateBlobName()) destURL.create(PageBlobClient.PAGE_BYTES) def data = getRandomByteArray(PageBlobClient.PAGE_BYTES) def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) - bu.uploadPages(pageRange, new ByteArrayInputStream(data)) + bc.uploadPages(pageRange, new ByteArrayInputStream(data)) when: - destURL.uploadPagesFromURL(pageRange, bu.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest(data), - null, null, null) + destURL.uploadPagesFromURLWithResponse(pageRange, bc.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest(data), + null, null, null, null) then: notThrown(StorageException) @@ -349,15 +361,15 @@ class PageBlobAPITest extends APISpec { def "Upload page from URL MD5 fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) - def destURL = cu.getPageBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getPageBlobClient(generateBlobName()) destURL.create(PageBlobClient.PAGE_BYTES) def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) - bu.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) + bc.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) when: - destURL.uploadPagesFromURL(pageRange, bu.getBlobUrl(), null, - MessageDigest.getInstance("MD5").digest("garbage".getBytes()), null, null, null) + destURL.uploadPagesFromURLWithResponse(pageRange, bc.getBlobUrl(), null, + MessageDigest.getInstance("MD5").digest("garbage".getBytes()), null, null, null, null) then: thrown(StorageException) @@ -366,18 +378,18 @@ class PageBlobAPITest extends APISpec { @Unroll def "Upload page from URL destination AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) - def sourceURL = cu.getPageBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def sourceURL = cc.getPageBlobClient(generateBlobName()) sourceURL.create(PageBlobClient.PAGE_BYTES) def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) def pac = new PageBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) .sequenceNumberAccessConditions(new SequenceNumberAccessConditions() .ifSequenceNumberLessThan(sequenceNumberLT) @@ -385,7 +397,7 @@ class PageBlobAPITest extends APISpec { .ifSequenceNumberEqualTo(sequenceNumberEqual)) expect: - bu.uploadPagesFromURL(pageRange, sourceURL.getBlobUrl(), null, null, pac, null, null).statusCode() == 201 + bc.uploadPagesFromURLWithResponse(pageRange, sourceURL.getBlobUrl(), null, null, pac, null, null, null).statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | sequenceNumberLT | sequenceNumberLTE | sequenceNumberEqual @@ -403,14 +415,14 @@ class PageBlobAPITest extends APISpec { @Unroll def "Upload page from URL destination AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) - def sourceURL = cu.getPageBlobClient(generateBlobName()) + def sourceURL = cc.getPageBlobClient(generateBlobName()) sourceURL.create(PageBlobClient.PAGE_BYTES) def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - noneMatch = setupBlobMatchCondition(bu, noneMatch) + noneMatch = setupBlobMatchCondition(bc, noneMatch) def pac = new PageBlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -424,7 +436,7 @@ class PageBlobAPITest extends APISpec { .ifSequenceNumberEqualTo(sequenceNumberEqual)) when: - bu.uploadPagesFromURL(pageRange, sourceURL.getBlobUrl(), null, null, pac, null, null) + bc.uploadPagesFromURLWithResponse(pageRange, sourceURL.getBlobUrl(), null, null, pac, null, null, null) then: thrown(StorageException) @@ -444,8 +456,8 @@ class PageBlobAPITest extends APISpec { @Unroll def "Upload page from URL source AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) - def sourceURL = cu.getPageBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def sourceURL = cc.getPageBlobClient(generateBlobName()) sourceURL.create(PageBlobClient.PAGE_BYTES) def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) @@ -458,7 +470,7 @@ class PageBlobAPITest extends APISpec { .sourceIfNoneMatch(sourceIfNoneMatch) expect: - bu.uploadPagesFromURL(pageRange, sourceURL.getBlobUrl(), null, null, null, smac, null).statusCode() == 201 + bc.uploadPagesFromURLWithResponse(pageRange, sourceURL.getBlobUrl(), null, null, null, smac, null, null).statusCode() == 201 where: sourceIfModifiedSince | sourceIfUnmodifiedSince | sourceIfMatch | sourceIfNoneMatch @@ -472,8 +484,8 @@ class PageBlobAPITest extends APISpec { @Unroll def "Upload page from URL source AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) - def sourceURL = cu.getPageBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def sourceURL = cc.getPageBlobClient(generateBlobName()) sourceURL.create(PageBlobClient.PAGE_BYTES) def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) @@ -485,8 +497,7 @@ class PageBlobAPITest extends APISpec { .sourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) when: - bu.uploadPagesFromURL(pageRange, sourceURL.getBlobUrl(), null, null, null, smac, null) - + bc.uploadPagesFromURLWithResponse(pageRange, sourceURL.getBlobUrl(), null, null, null, smac, null, null) then: thrown(StorageException) @@ -500,14 +511,14 @@ class PageBlobAPITest extends APISpec { def "Clear page"() { setup: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null) + bc.uploadPagesWithResponse(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null, null) when: - Response response = bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1)) + Response response = bc.clearPagesWithResponse(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), null, null, null) then: - bu.getPageRanges(new BlobRange(0)).value().pageRange().size() == 0 + bc.getPageRanges(new BlobRange(0)).pageRange().size() == 0 validateBasicHeaders(response.headers()) response.value().contentMD5() == null response.value().blobSequenceNumber() == 0 @@ -515,16 +526,16 @@ class PageBlobAPITest extends APISpec { def "Clear page min"() { expect: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1)) + bc.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1)) } @Unroll def "Clear pages AC"() { setup: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + bc.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) def pac = new PageBlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -538,7 +549,7 @@ class PageBlobAPITest extends APISpec { .ifSequenceNumberEqualTo(sequenceNumberEqual)) expect: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), pac, null) + bc.clearPagesWithResponse(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), pac, null, null) .statusCode() == 201 where: @@ -557,10 +568,10 @@ class PageBlobAPITest extends APISpec { @Unroll def "Clear pages AC fail"() { setup: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + bc.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) def pac = new PageBlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -575,7 +586,7 @@ class PageBlobAPITest extends APISpec { when: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), pac, null) + bc.clearPagesWithResponse(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), pac, null, null) then: thrown(StorageException) @@ -594,10 +605,10 @@ class PageBlobAPITest extends APISpec { def "Clear page error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1)) + bc.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1)) then: thrown(StorageException) @@ -605,22 +616,22 @@ class PageBlobAPITest extends APISpec { def "Get page ranges"() { setup: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + bc.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) when: - Response response = bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES)) + def response = bc.getPageRangesWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES), null, null, null) then: response.statusCode() == 200 response.value().pageRange().size() == 1 validateBasicHeaders(response.headers()) - Integer.parseInt(response.headers().value("x-ms-blob-content-length")) == PageBlobClient.PAGE_BYTES + Long.parseLong(response.headers().get("x-ms-blob-content-length").value()) == (long) PageBlobClient.PAGE_BYTES } def "Get page ranges min"() { when: - bu.getPageRanges(null) + bc.getPageRanges(null) then: notThrown(StorageException) @@ -629,8 +640,8 @@ class PageBlobAPITest extends APISpec { @Unroll def "Get page ranges AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -641,7 +652,7 @@ class PageBlobAPITest extends APISpec { when: - bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null) + bc.getPageRangesWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null, null) then: notThrown(StorageException) @@ -660,15 +671,15 @@ class PageBlobAPITest extends APISpec { def "Get page ranges AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null) + bc.getPageRangesWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null, null) then: thrown(StorageException) @@ -684,10 +695,10 @@ class PageBlobAPITest extends APISpec { def "Get page ranges error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.getPageRanges(null) + bc.getPageRanges(null) then: thrown(StorageException) @@ -695,20 +706,20 @@ class PageBlobAPITest extends APISpec { def "Get page ranges diff"() { setup: - bu.create(PageBlobClient.PAGE_BYTES * 2) + bc.create(PageBlobClient.PAGE_BYTES * 2) - bu.uploadPages(new PageRange().start(PageBlobClient.PAGE_BYTES).end(PageBlobClient.PAGE_BYTES * 2 - 1), + bc.uploadPages(new PageRange().start(PageBlobClient.PAGE_BYTES).end(PageBlobClient.PAGE_BYTES * 2 - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - String snapshot = bu.createSnapshot(null, null, null).value().getSnapshotId() + def snapId = bc.createSnapshot().getSnapshotId() - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + bc.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - bu.clearPages(new PageRange().start(PageBlobClient.PAGE_BYTES).end(PageBlobClient.PAGE_BYTES * 2 - 1)) + bc.clearPages(new PageRange().start(PageBlobClient.PAGE_BYTES).end(PageBlobClient.PAGE_BYTES * 2 - 1)) when: - Response response = bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES * 2), snapshot) + def response = bc.getPageRangesDiffWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES * 2), snapId, null, null, null) then: response.value().pageRange().size() == 1 @@ -723,10 +734,10 @@ class PageBlobAPITest extends APISpec { def "Get page ranges diff min"() { setup: - String snapshot = bu.createSnapshot().value().getSnapshotId() + def snapId = bc.createSnapshot().getSnapshotId() when: - bu.getPageRangesDiff(null, snapshot).iterator().hasNext() + bc.getPageRangesDiff(null, snapId).iterator().hasNext() then: notThrown(StorageException) @@ -735,17 +746,17 @@ class PageBlobAPITest extends APISpec { @Unroll def "Get page ranges diff AC"() { setup: - String snapshot = bu.createSnapshot().value().getSnapshotId() + def snapId = bc.createSnapshot().getSnapshotId() BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) when: - bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapshot, bac, null) + bc.getPageRangesDiffWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapId, bac, null, null) then: notThrown(StorageException) @@ -763,18 +774,18 @@ class PageBlobAPITest extends APISpec { @Unroll def "Get page ranges diff AC fail"() { setup: - String snapshot = bu.createSnapshot().value() + def snapId = bc.createSnapshot().getSnapshotId() BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapshot, bac, null) + bc.getPageRangesDiffWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapId, bac, null, null) then: thrown(StorageException) @@ -790,10 +801,10 @@ class PageBlobAPITest extends APISpec { def "Get page ranges diff error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.getPageRangesDiff(null, "snapshot") + bc.getPageRangesDiff(null, "snapshot") then: thrown(StorageException) @@ -805,7 +816,7 @@ class PageBlobAPITest extends APISpec { def range = new PageRange().start(start).end(end) when: - bu.clearPages(range) + bc.clearPages(range) then: thrown(IllegalArgumentException) @@ -822,32 +833,32 @@ class PageBlobAPITest extends APISpec { def "Resize"() { setup: - Response response = bu.resize(PageBlobClient.PAGE_BYTES * 2) + def response = bc.resizeWithResponse(PageBlobClient.PAGE_BYTES * 2, null, null, null) expect: - Integer.parseInt(bu.getProperties().headers().value("Content-Length")) == PageBlobClient.PAGE_BYTES * 2 + Integer.parseInt(bc.getPropertiesWithResponse(null, null, null).headers().value("Content-Length")) == PageBlobClient.PAGE_BYTES * 2 validateBasicHeaders(response.headers()) response.value().blobSequenceNumber() != null } def "Resize min"() { expect: - bu.resize(PageBlobClient.PAGE_BYTES).statusCode() == 200 + bc.resizeWithResponse(PageBlobClient.PAGE_BYTES, null, null, null).statusCode() == 200 } @Unroll def "Resize AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) expect: - bu.resize(PageBlobClient.PAGE_BYTES * 2, bac, null).statusCode() == 200 + bc.resizeWithResponse(PageBlobClient.PAGE_BYTES * 2, bac, null, null).statusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -863,15 +874,15 @@ class PageBlobAPITest extends APISpec { def "Resize AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.resize(PageBlobClient.PAGE_BYTES * 2, bac, null) + bc.resizeWithResponse(PageBlobClient.PAGE_BYTES * 2, bac, null, null) then: thrown(StorageException) @@ -887,10 +898,10 @@ class PageBlobAPITest extends APISpec { def "Resize error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.resize(0) + bc.resize(0) then: thrown(StorageException) @@ -899,10 +910,10 @@ class PageBlobAPITest extends APISpec { @Unroll def "Sequence number"() { setup: - Response response = bu.updateSequenceNumber(action, number) + Response response = bc.updateSequenceNumberWithResponse(action, number, null, null, null) expect: - Integer.parseInt(bu.getProperties().headers().value("x-ms-blob-sequence-number")) == result + Integer.parseInt(bc.getPropertiesWithResponse(null, null, null).headers().value("x-ms-blob-sequence-number")) == result validateBasicHeaders(response.headers()) response.value().blobSequenceNumber() == result @@ -915,22 +926,22 @@ class PageBlobAPITest extends APISpec { def "Sequence number min"() { expect: - bu.updateSequenceNumber(SequenceNumberActionType.INCREMENT, null).statusCode() == 200 + bc.updateSequenceNumberWithResponse(SequenceNumberActionType.INCREMENT, null, null, null, null).statusCode() == 200 } @Unroll def "Sequence number AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) + .ifMatch(setupBlobMatchCondition(bc, match)) .ifNoneMatch(noneMatch)) expect: - bu.updateSequenceNumber(SequenceNumberActionType.UPDATE, 1, bac, null) + bc.updateSequenceNumberWithResponse(SequenceNumberActionType.UPDATE, 1, bac, null, null) .statusCode() == 200 where: @@ -947,15 +958,15 @@ class PageBlobAPITest extends APISpec { def "Sequence number AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) + .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bc, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() .ifModifiedSince(modified) .ifUnmodifiedSince(unmodified) .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .ifNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.updateSequenceNumber(SequenceNumberActionType.UPDATE, 1, bac, null) + bc.updateSequenceNumberWithResponse(SequenceNumberActionType.UPDATE, 1, bac, null, null) then: thrown(StorageException) @@ -971,10 +982,10 @@ class PageBlobAPITest extends APISpec { def "Sequence number error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.updateSequenceNumber(SequenceNumberActionType.UPDATE, 0) + bc.updateSequenceNumber(SequenceNumberActionType.UPDATE, 0) then: thrown(StorageException) @@ -982,25 +993,25 @@ class PageBlobAPITest extends APISpec { def "Start incremental copy"() { setup: - cu.setAccessPolicy(PublicAccessType.BLOB, null) - PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value().getSnapshotId() + cc.setAccessPolicy(PublicAccessType.BLOB, null) + def bc2 = cc.getPageBlobClient(generateBlobName()) + def snapId = bc.createSnapshot().getSnapshotId() - Response copyResponse = bu2.copyIncremental(bu.getBlobUrl(), snapshot) - String status = copyResponse.value().toString() + def copyResponse = bc2.copyIncrementalWithResponse(bc.getBlobUrl(), snapId, null, null, null) + def status = copyResponse.value().toString() OffsetDateTime start = OffsetDateTime.now() while (status != CopyStatusType.SUCCESS.toString()) { - status = bu2.getProperties().headers().value("x-ms-copy-status") + status = bc2.getPropertiesWithResponse(null, null, null).headers().value("x-ms-copy-status") OffsetDateTime currentTime = OffsetDateTime.now() if (status == CopyStatusType.FAILED.toString() || currentTime.minusMinutes(1) == start) { throw new Exception("Copy failed or took too long") } - sleep(1000) + sleepIfRecord(1000) } expect: - Response propertiesResponse = bu2.getProperties() + Response propertiesResponse = bc2.getPropertiesWithResponse(null, null, null) Boolean.parseBoolean(propertiesResponse.headers().value("x-ms-incremental-copy")) propertiesResponse.headers().value("x-ms-copy-destination-snapshot") != null validateBasicHeaders(copyResponse.headers()) @@ -1010,35 +1021,35 @@ class PageBlobAPITest extends APISpec { def "Start incremental copy min"() { setup: - cu.setAccessPolicy(PublicAccessType.BLOB, null) - PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value().getSnapshotId() + cc.setAccessPolicy(PublicAccessType.BLOB, null) + def bc2 = cc.getPageBlobClient(generateBlobName()) + String snapshot = bc.createSnapshot().getSnapshotId() expect: - bu2.copyIncremental(bu.getBlobUrl(), snapshot).statusCode() == 202 + bc2.copyIncrementalWithResponse(bc.getBlobUrl(), snapshot, null, null, null).statusCode() == 202 } @Unroll def "Start incremental copy AC"() { setup: - cu.setAccessPolicy(PublicAccessType.BLOB, null) - PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value().getSnapshotId() + cc.setAccessPolicy(PublicAccessType.BLOB, null) + PageBlobClient bu2 = cc.getPageBlobClient(generateBlobName()) + String snapshot = bc.createSnapshot().getSnapshotId() - Response copyResponse = bu2.copyIncremental(bu.getBlobUrl(), snapshot) - String status = copyResponse.value().toString() + def copyResponse = bu2.copyIncrementalWithResponse(bc.getBlobUrl(), snapshot, null, null, null) + def status = copyResponse.value().toString() OffsetDateTime start = OffsetDateTime.now() while (status != CopyStatusType.SUCCESS.toString()) { - status = bu2.getProperties().headers().value("x-ms-copy-status") + status = bu2.getPropertiesWithResponse(null, null, null).headers().value("x-ms-copy-status") OffsetDateTime currentTime = OffsetDateTime.now() if (status == CopyStatusType.FAILED.toString() || currentTime.minusMinutes(1) == start) { throw new Exception("Copy failed or took too long") } - sleep(1000) + sleepIfRecord(1000) } - snapshot = bu.createSnapshot().value().getSnapshotId() + snapshot = bc.createSnapshot().getSnapshotId() match = setupBlobMatchCondition(bu2, match) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) @@ -1047,7 +1058,7 @@ class PageBlobAPITest extends APISpec { .ifNoneMatch(noneMatch) expect: - bu2.copyIncremental(bu.getBlobUrl(), snapshot, mac, null).statusCode() == 202 + bu2.copyIncrementalWithResponse(bc.getBlobUrl(), snapshot, mac, null, null).statusCode() == 202 where: modified | unmodified | match | noneMatch @@ -1061,11 +1072,11 @@ class PageBlobAPITest extends APISpec { @Unroll def "Start incremental copy AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.BLOB, null) - PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value().getSnapshotId() - bu2.copyIncremental(bu.getBlobUrl(), snapshot) - snapshot = bu.createSnapshot().value().getSnapshotId() + cc.setAccessPolicy(PublicAccessType.BLOB, null) + PageBlobClient bu2 = cc.getPageBlobClient(generateBlobName()) + String snapshot = bc.createSnapshot().getSnapshotId() + bu2.copyIncremental(bc.getBlobUrl(), snapshot) + snapshot = bc.createSnapshot().getSnapshotId() noneMatch = setupBlobMatchCondition(bu2, noneMatch) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) @@ -1074,7 +1085,7 @@ class PageBlobAPITest extends APISpec { .ifNoneMatch(noneMatch) when: - bu2.copyIncremental(bu.getBlobUrl(), snapshot, mac, null).statusCode() + bu2.copyIncrementalWithResponse(bc.getBlobUrl(), snapshot, mac, null, null) then: thrown(StorageException) @@ -1089,10 +1100,10 @@ class PageBlobAPITest extends APISpec { def "Start incremental copy error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.copyIncremental(new URL("https://www.error.com"), "snapshot") + bc.copyIncremental(new URL("https://www.error.com"), "snapshot") then: thrown(StorageException) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy index 773d552ea319..3363d431ca82 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy @@ -3,9 +3,9 @@ package com.azure.storage.blob -import io.netty.buffer.ByteBuf -import io.netty.buffer.Unpooled + import reactor.core.publisher.Flux +import spock.lang.Requires import java.nio.ByteBuffer import java.util.concurrent.atomic.AtomicLong @@ -32,23 +32,21 @@ class ProgressReporterTest extends APISpec { 2 * mockReceiver.reportProgress(10) 2 * mockReceiver.reportProgress(25) 2 * mockReceiver.reportProgress(30) - 0 * mockReceiver.reportProgress({it > 30}) + 0 * mockReceiver.reportProgress({ it > 30 }) } + @Requires({ APISpec.liveMode() }) def "Report progress sequential network test"() { setup: IProgressReceiver mockReceiver = Mock(IProgressReceiver) ByteBuffer buffer = getRandomData(1 * 1024 * 1024) - Flux data = ProgressReporter.addProgressReporting(Flux.just(buffer), mockReceiver) - .map({ it -> Unpooled.wrappedBuffer(it) }) + Flux data = ProgressReporter.addProgressReporting(Flux.just(buffer), mockReceiver) when: - BlockBlobAsyncClient bu = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(generateBlobName()) - .credential(primaryCreds) - .buildBlockBlobAsyncClient() + BlockBlobAsyncClient bu = getBlobAsyncClient(primaryCredential, cc.getContainerUrl().toString(), generateBlobName()) + .asBlockBlobAsyncClient() + bu.upload(data, buffer.remaining()).block() then: @@ -102,7 +100,7 @@ class ProgressReporterTest extends APISpec { We should never report more progress than the 60 total (30 from each Flux--Resubscribing is a retry and therefore rewinds). */ - 0 * mockReceiver.reportProgress({it > 60}) + 0 * mockReceiver.reportProgress({ it > 60 }) } // See TransferManagerTest for network tests of the parallel ProgressReporter. diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java index a0b3c2d69e84..c9d625953362 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java @@ -13,15 +13,16 @@ import com.azure.core.implementation.http.UrlBuilder; import com.azure.storage.common.policy.RequestRetryOptions; import com.azure.storage.common.policy.RequestRetryPolicy; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.Disposable; +import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.time.Duration; import java.time.OffsetDateTime; @@ -55,7 +56,7 @@ class RequestRetryTestFactory { static final String RETRY_TEST_PRIMARY_HOST = "PrimaryDC"; static final String RETRY_TEST_SECONDARY_HOST = "SecondaryDC"; - static final ByteBuf RETRY_TEST_DEFAULT_DATA = Unpooled.wrappedBuffer("Default data".getBytes()); + static final ByteBuffer RETRY_TEST_DEFAULT_DATA = ByteBuffer.wrap("Default data".getBytes()); private static final String RETRY_TEST_HEADER = "TestHeader"; private static final String RETRY_TEST_QUERY_PARAM = "TestQueryParam"; private static final Mono RETRY_TEST_OK_RESPONSE = Mono.just(new RetryTestResponse(200)); @@ -126,7 +127,7 @@ public HttpHeaders headers() { } @Override - public Flux body() { + public Flux body() { return null; } @@ -192,12 +193,18 @@ public Mono send(HttpRequest request) { } // Subscribe and block until all information is read to prevent a blocking on another thread exception from Reactor. - ByteBuf buf = Unpooled.buffer(); - Disposable disposable = request.body().subscribe(buf::writeBytes); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + Disposable disposable = request.body().subscribe(data -> { + try { + outputStream.write(data.array()); + } catch (IOException ex) { + throw Exceptions.propagate(ex); + } + }); while (!disposable.isDisposed()) { System.out.println("Waiting for Flux to finish to prevent blocking on another thread exception"); } - if (RETRY_TEST_DEFAULT_DATA.compareTo(buf) != 0) { + if (RETRY_TEST_DEFAULT_DATA.compareTo(ByteBuffer.wrap(outputStream.toByteArray())) != 0) { throw new IllegalArgumentException(("Body not reset.")); } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTest.groovy index ab5f9aabd872..d32a2d1caaa9 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTest.groovy @@ -3,11 +3,11 @@ package com.azure.storage.blob - import com.azure.core.http.HttpResponse import com.azure.storage.common.policy.RequestRetryOptions import com.azure.storage.common.policy.RetryPolicyType import spock.lang.Unroll + // Tests for package-private functionality. class RetryTest extends APISpec { static URL retryTestURL = new URL("https://" + RequestRetryTestFactory.RETRY_TEST_PRIMARY_HOST) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SASTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SASTest.groovy index 39f2ce4e5d11..12183c2e3b7b 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SASTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SASTest.groovy @@ -3,10 +3,10 @@ package com.azure.storage.blob -import com.azure.core.http.policy.HttpLogDetailLevel import com.azure.storage.blob.models.AccessPolicy import com.azure.storage.blob.models.BlobRange import com.azure.storage.blob.models.SignedIdentifier +import com.azure.storage.blob.models.StorageException import com.azure.storage.blob.models.UserDelegationKey import com.azure.storage.common.Constants import com.azure.storage.common.IPRange @@ -14,6 +14,7 @@ import com.azure.storage.common.SASProtocol import com.azure.storage.common.Utility import com.azure.storage.common.credentials.SASTokenCredential import com.azure.storage.common.credentials.SharedKeyCredential +import spock.lang.Ignore import spock.lang.Unroll import java.time.LocalDateTime @@ -25,9 +26,10 @@ class SASTest extends APISpec { This test is to validate the workaround for the autorest bug that forgets to set the request property on the response. */ + def "Request property"() { when: - def response = cu.delete() + def response = cc.deleteWithResponse(null, null, null) then: response.request() != null @@ -68,12 +70,12 @@ class SASTest extends APISpec { setup: def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) - def snapshotId = bu.createSnapshot().value().getSnapshotId() + def snapshotId = bu.createSnapshot().getSnapshotId() when: - def snapshotBlob = cu.getBlockBlobClient(blobName, snapshotId) + def snapshotBlob = cc.getBlockBlobClient(blobName, snapshotId) then: snapshotBlob.getSnapshotId() == snapshotId @@ -84,12 +86,12 @@ class SASTest extends APISpec { setup: def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) - def snapshotId = bu.createSnapshot().value().getSnapshotId() + def snapshotId = bu.createSnapshot().getSnapshotId() when: - def snapshotBlob = cu.getBlockBlobClient(blobName, snapshotId) + def snapshotBlob = cc.getBlockBlobClient(blobName, snapshotId) then: snapshotBlob.isSnapshot() @@ -101,7 +103,7 @@ class SASTest extends APISpec { setup: def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = getBlobClient(primaryCredential, cc.getContainerUrl().toString(), blobName).asBlockBlobClient() bu.upload(new ByteArrayInputStream(data), data.length) def permissions = new BlobSASPermission() @@ -110,8 +112,8 @@ class SASTest extends APISpec { .create(true) .delete(true) .add(true) - def startTime = OffsetDateTime.now().minusDays(1) - def expiryTime = OffsetDateTime.now().plusDays(1) + def startTime = getUTCNow().minusDays(1) + def expiryTime = getUTCNow().plusDays(1) def ipRange = new IPRange() .ipMin("0.0.0.0") .ipMax("255.255.255.255") @@ -125,16 +127,11 @@ class SASTest extends APISpec { when: def sas = bu.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) - def client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + def client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName).asBlockBlobClient() def os = new ByteArrayOutputStream() client.download(os) - def properties = client.getProperties().value() + def properties = client.getProperties() then: os.toString() == new String(data) @@ -150,11 +147,11 @@ class SASTest extends APISpec { def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = getBlobClient(primaryCredential, cc.getContainerUrl().toString(), blobName).asBlockBlobClient() bu.upload(new ByteArrayInputStream(data), data.length) - String snapshotId = bu.createSnapshot().value().getSnapshotId() + String snapshotId = bu.createSnapshot().getSnapshotId() - def snapshotBlob = cu.getBlockBlobClient(blobName, snapshotId) + def snapshotBlob = cc.getBlockBlobClient(blobName, snapshotId) def permissions = new BlobSASPermission() .read(true) @@ -162,8 +159,8 @@ class SASTest extends APISpec { .create(true) .delete(true) .add(true) - def startTime = OffsetDateTime.now().minusDays(1) - def expiryTime = OffsetDateTime.now().plusDays(1) + def startTime = getUTCNow().minusDays(1) + def expiryTime = getUTCNow().plusDays(1) def ipRange = new IPRange() .ipMin("0.0.0.0") .ipMax("255.255.255.255") @@ -177,17 +174,11 @@ class SASTest extends APISpec { when: def sas = snapshotBlob.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) - def client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .snapshot(snapshotId) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + def client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName, snapshotId).asBlockBlobClient() def os = new ByteArrayOutputStream() client.download(os) - def properties = client.getProperties().value() + def properties = client.getProperties() then: os.toString() == new String(data) @@ -197,42 +188,36 @@ class SASTest extends APISpec { properties.contentLanguage() == "language" } + @Ignore def "serviceSASSignatureValues network test container"() { setup: - SignedIdentifier identifier = new SignedIdentifier() + def identifier = new SignedIdentifier() .id("0000") .accessPolicy(new AccessPolicy().permission("racwdl") - .expiry(OffsetDateTime.now().plusDays(1))) - cu.setAccessPolicy(null, Arrays.asList(identifier), null, null) + .expiry(getUTCNow().plusDays(1))) + cc.setAccessPolicy(null, Arrays.asList(identifier)) // Check containerSASPermissions ContainerSASPermission permissions = new ContainerSASPermission() .read(true) .write(true) + .list(true) .create(true) .delete(true) .add(true) - OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1) + OffsetDateTime expiryTime = getUTCNow().plusDays(1) when: - String sasWithId = cu.generateSAS(identifier.id()) + String sasWithId = cc.generateSAS(identifier.id()) - ContainerClient client1 = new ContainerClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .credential(SASTokenCredential.fromSASTokenString(sasWithId)) - .httpClient(getHttpClient()) - .buildClient() + ContainerClient client1 = getContainerClient(SASTokenCredential.fromSASTokenString(sasWithId), cc.getContainerUrl().toString()) client1.listBlobsFlat().iterator().hasNext() - String sasWithPermissions = cu.generateSAS(permissions, expiryTime) + String sasWithPermissions = cc.generateSAS(permissions, expiryTime) - ContainerClient client2 = new ContainerClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .credential(SASTokenCredential.fromSASTokenString(sasWithPermissions)) - .httpClient(getHttpClient()) - .buildClient() + ContainerClient client2 = getContainerClient(SASTokenCredential.fromSASTokenString(sasWithPermissions), cc.getContainerUrl().toString()) client2.listBlobsFlat().iterator().hasNext() @@ -241,11 +226,12 @@ class SASTest extends APISpec { } + @Ignore def "serviceSASSignatureValues network test blob user delegation"() { setup: byte[] data = "test".getBytes() String blobName = generateBlobName() - BlockBlobClient bu = cu.getBlockBlobClient(blobName) + BlockBlobClient bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) BlobSASPermission permissions = new BlobSASPermission() @@ -255,8 +241,8 @@ class SASTest extends APISpec { .delete(true) .add(true) - OffsetDateTime startTime = OffsetDateTime.now().minusDays(1) - OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1) + OffsetDateTime startTime = getUTCNow().minusDays(1) + OffsetDateTime expiryTime = getUTCNow().plusDays(1) IPRange ipRange = new IPRange() .ipMin("0.0.0.0") @@ -269,21 +255,16 @@ class SASTest extends APISpec { String contentLanguage = "language" String contentType = "type" - UserDelegationKey key = getOAuthServiceURL().getUserDelegationKey(null, OffsetDateTime.now().plusDays(1)).value() + UserDelegationKey key = getOAuthServiceClient().getUserDelegationKey(null, getUTCNow().plusDays(1)) when: - String sas = bu.generateUserDelegationSAS(key, primaryCreds.accountName(), permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) + String sas = bu.generateUserDelegationSAS(key, primaryCredential.accountName(), permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) - BlockBlobClient client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + BlockBlobClient client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName).asBlockBlobClient() OutputStream os = new ByteArrayOutputStream() client.download(os) - BlobProperties properties = client.getProperties().value() + BlobProperties properties = client.getProperties() then: os.toString() == new String(data) @@ -294,11 +275,12 @@ class SASTest extends APISpec { notThrown(StorageException) } + @Ignore def "serviceSASSignatureValues network test blob snapshot user delegation"() { setup: byte[] data = "test".getBytes() String blobName = generateBlobName() - BlockBlobClient bu = cu.getBlockBlobClient(blobName) + BlockBlobClient bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) BlockBlobClient snapshotBlob = bu.createSnapshot().value().asBlockBlobClient() String snapshotId = snapshotBlob.getSnapshotId() @@ -310,8 +292,8 @@ class SASTest extends APISpec { .delete(true) .add(true) - OffsetDateTime startTime = OffsetDateTime.now().minusDays(1) - OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1) + OffsetDateTime startTime = getUTCNow().minusDays(1) + OffsetDateTime expiryTime = getUTCNow().plusDays(1) IPRange ipRange = new IPRange() .ipMin("0.0.0.0") @@ -324,20 +306,14 @@ class SASTest extends APISpec { String contentLanguage = "language" String contentType = "type" - UserDelegationKey key = getOAuthServiceURL().getUserDelegationKey(startTime, expiryTime).value() + UserDelegationKey key = getOAuthServiceClient().getUserDelegationKey(startTime, expiryTime) when: - String sas = snapshotBlob.generateUserDelegationSAS(key, primaryCreds.accountName(), permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) + String sas = snapshotBlob.generateUserDelegationSAS(key, primaryCredential.accountName(), permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) // base blob with snapshot SAS - BlockBlobClient client1 = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildBlockBlobClient() + BlockBlobClient client1 = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName).asBlockBlobClient() client1.download(new ByteArrayOutputStream()) then: @@ -346,15 +322,7 @@ class SASTest extends APISpec { when: // blob snapshot with snapshot SAS - BlockBlobClient client2 = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .snapshot(snapshotId) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildBlockBlobClient() - + BlockBlobClient client2 = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName, snapshotId).asBlockBlobClient() OutputStream os = new ByteArrayOutputStream() client2.download(os) @@ -363,7 +331,7 @@ class SASTest extends APISpec { os.toString() == new String(data) and: - def properties = client2.getProperties().value() + def properties = client2.getProperties() then: properties.cacheControl() == "cache" @@ -372,6 +340,7 @@ class SASTest extends APISpec { properties.contentLanguage() == "language" } + @Ignore def "serviceSASSignatureValues network test container user delegation"() { setup: ContainerSASPermission permissions = new ContainerSASPermission() @@ -381,20 +350,14 @@ class SASTest extends APISpec { .delete(true) .add(true) - OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1) + OffsetDateTime expiryTime = getUTCNow().plusDays(1) - UserDelegationKey key = getOAuthServiceURL().getUserDelegationKey(null, OffsetDateTime.now().plusDays(1)).value() + UserDelegationKey key = getOAuthServiceClient().getUserDelegationKey(null, getUTCNow().plusDays(1)) when: + String sasWithPermissions = cc.generateUserDelegationSAS(key, primaryCredential.accountName(), permissions, expiryTime) - String sasWithPermissions = cu.generateUserDelegationSAS(key, primaryCreds.accountName(), permissions, expiryTime) - - ContainerClient client = new ContainerClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .credential(SASTokenCredential.fromSASTokenString(sasWithPermissions)) - .httpClient(getHttpClient()) - .buildClient() - + ContainerClient client = getContainerClient(SASTokenCredential.fromSASTokenString(sasWithPermissions), cc.getContainerUrl().toString()) client.listBlobsFlat().iterator().hasNext() then: @@ -405,7 +368,7 @@ class SASTest extends APISpec { setup: def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) def service = new AccountSASService() @@ -416,18 +379,12 @@ class SASTest extends APISpec { .object(true) def permissions = new AccountSASPermission() .read(true) - def expiryTime = OffsetDateTime.now().plusDays(1) + def expiryTime = getUTCNow().plusDays(1) when: - def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) - - def client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + def client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName).asBlockBlobClient() def os = new ByteArrayOutputStream() client.download(os) @@ -439,7 +396,7 @@ class SASTest extends APISpec { setup: def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) def service = new AccountSASService() @@ -450,17 +407,12 @@ class SASTest extends APISpec { .object(true) def permissions = new AccountSASPermission() .read(true) - def expiryTime = OffsetDateTime.now().plusDays(1) + def expiryTime = getUTCNow().plusDays(1) when: - def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) - - def client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + + def client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName).asBlockBlobClient() client.delete() then: @@ -478,17 +430,13 @@ class SASTest extends APISpec { def permissions = new AccountSASPermission() .read(true) .create(false) - def expiryTime = OffsetDateTime.now().plusDays(1) + def expiryTime = getUTCNow().plusDays(1) when: - def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) - def scBuilder = new BlobServiceClientBuilder() - scBuilder.endpoint(primaryServiceURL.getAccountUrl().toString()) - .httpClient(getHttpClient()) - .credential(SASTokenCredential.fromSASTokenString(sas)) - def sc = scBuilder.buildClient() - sc.createContainer("container") + def sc = getServiceClient(SASTokenCredential.fromSASTokenString(sas), primaryBlobServiceClient.getAccountUrl().toString()) + sc.createContainer(generateContainerName()) then: thrown(StorageException) @@ -505,17 +453,13 @@ class SASTest extends APISpec { def permissions = new AccountSASPermission() .read(true) .create(true) - def expiryTime = OffsetDateTime.now().plusDays(1) + def expiryTime = getUTCNow().plusDays(1) when: - def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) - def scBuilder = new BlobServiceClientBuilder() - scBuilder.endpoint(primaryServiceURL.getAccountUrl().toString()) - .httpClient(getHttpClient()) - .credential(SASTokenCredential.fromSASTokenString(sas)) - def sc = scBuilder.buildClient() - sc.createContainer("container") + def sc = getServiceClient(SASTokenCredential.fromSASTokenString(sas), primaryBlobServiceClient.getAccountUrl().toString()) + sc.createContainer(generateContainerName()) then: notThrown(StorageException) @@ -530,7 +474,7 @@ class SASTest extends APISpec { @Unroll def "serviceSasSignatures string to sign"() { when: - def v = new ServiceSASSignatureValues() + ServiceSASSignatureValues v = new ServiceSASSignatureValues() def p = new BlobSASPermission() p.read(true) v.permissions(p.toString()) @@ -554,9 +498,9 @@ class SASTest extends APISpec { .contentLanguage(language) .contentType(type) - def token = v.generateSASQueryParameters(primaryCreds) + def token = v.generateSASQueryParameters(primaryCredential) then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.signature() == primaryCredential.computeHmac256(expectedStringToSign) /* We don't test the blob or containerName properties because canonicalized resource is always added as at least @@ -639,18 +583,17 @@ class SASTest extends APISpec { null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | "type" || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n\n\n\n\n\n\ntype" } - @Unroll def "serviceSASSignatureValues canonicalizedResource"() { setup: def blobName = generateBlobName() def accountName = "account" - def bu = cu.getBlockBlobClient(blobName) + def bu = cc.getBlockBlobClient(blobName) when: def serviceSASSignatureValues = bu.blockBlobAsyncClient.configureServiceSASSignatureValues(new ServiceSASSignatureValues(), accountName) then: - serviceSASSignatureValues.canonicalName() == "/blob/" + accountName + cu.containerUrl.path + "/" + blobName + serviceSASSignatureValues.canonicalName() == "/blob/" + accountName + cc.containerUrl.path + "/" + blobName } @Unroll @@ -668,9 +611,9 @@ class SASTest extends APISpec { e.getMessage().contains(parameter) where: - version | creds || parameter - null | primaryCreds | "version" - "v" | null | "sharedKeyCredentials" + version | creds || parameter + null | primaryCredential || "version" + "v" | null || "sharedKeyCredentials" } @Unroll @@ -832,7 +775,7 @@ class SASTest extends APISpec { @Unroll def "ServiceSASSignatureValues assertGenerateOk"() { when: - def serviceSASSignatureValues = new ServiceSASSignatureValues() + ServiceSASSignatureValues serviceSASSignatureValues = new ServiceSASSignatureValues() serviceSASSignatureValues.version(version) serviceSASSignatureValues.canonicalName(canonicalName) serviceSASSignatureValues.expiryTime(expiryTime) @@ -853,11 +796,11 @@ class SASTest extends APISpec { where: usingUserDelegation | version | canonicalName | expiryTime | permissions | identifier | resource | snapshotId - false | null | null | null | null | null | null | null - false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | null | null | null | null | null | null - false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | null | null | null | null | null - false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null | null | null - false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | null | new BlobSASPermission().read(true).toString() | null | null | null + false | null | null | null | null | null | null | null + false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | null | null | null | null | null | null + false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | null | null | null | null | null + false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null | null | null + false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | null | new BlobSASPermission().read(true).toString() | null | null | null false | null | null | null | null | "0000" | "c" | "id" } @@ -885,10 +828,10 @@ class SASTest extends APISpec { } v.protocol(protocol) - def token = v.generateSASQueryParameters(primaryCreds) + def token = v.generateSASQueryParameters(primaryCredential) then: - token.signature() == primaryCreds.computeHmac256(String.format(expectedStringToSign, primaryCreds.accountName())) + token.signature() == primaryCredential.computeHmac256(String.format(expectedStringToSign, primaryCredential.accountName())) where: startTime | ipRange | protocol || expectedStringToSign @@ -915,13 +858,13 @@ class SASTest extends APISpec { e.getMessage().contains(parameter) where: - permissions | service | resourceType | expiryTime | version | creds || parameter - null | "b" | "c" | OffsetDateTime.now() | "v" | primaryCreds || "permissions" - "c" | null | "c" | OffsetDateTime.now() | "v" | primaryCreds || "services" - "c" | "b" | null | OffsetDateTime.now() | "v" | primaryCreds || "resourceTypes" - "c" | "b" | "c" | null | "v" | primaryCreds || "expiryTime" - "c" | "b" | "c" | OffsetDateTime.now() | null | primaryCreds || "version" - "c" | "b" | "c" | OffsetDateTime.now() | "v" | null || "SharedKeyCredential" + permissions | service | resourceType | expiryTime | version | creds || parameter + null | "b" | "c" | OffsetDateTime.now() | "v" | primaryCredential || "permissions" + "c" | null | "c" | OffsetDateTime.now() | "v" | primaryCredential || "services" + "c" | "b" | null | OffsetDateTime.now() | "v" | primaryCredential || "resourceTypes" + "c" | "b" | "c" | null | "v" | primaryCredential || "expiryTime" + "c" | "b" | "c" | OffsetDateTime.now() | null | primaryCredential || "version" + "c" | "b" | "c" | OffsetDateTime.now() | "v" | null || "SharedKeyCredential" } @Unroll @@ -1048,7 +991,7 @@ class SASTest extends APISpec { .permissions("r") .canonicalName("/containerName/blobName") .expiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) - parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCreds)) + parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCredential)) when: def splitParts = parts.toURL().toString().split("\\?") diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/Sample.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/Sample.java deleted file mode 100644 index d5955365880a..000000000000 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/Sample.java +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.Response; -import com.azure.storage.blob.models.BlobItem; -import com.azure.storage.blob.models.ContainerItem; -import com.azure.storage.common.credentials.SharedKeyCredential; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.UUID; - -public class Sample { - - private static final String ACCOUNT_ENDPOINT = ""; - private static final String ACCOUNT_NAME = ""; - private static final String ACCOUNT_KEY = ""; - - //@Test - public void sample() throws IOException { - // get service client - BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) - .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) - .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) - .buildClient(); - - // create 5 containers - ContainerClient containerClient = null; - for (int i = 0; i < 5; i++) { - String name = "uxtesting" + UUID.randomUUID(); - containerClient = serviceClient.getContainerClient(name); - containerClient.create(); - System.out.println("Created container: " + name); - } - System.out.println(); - - // list containers in account - System.out.println("Listing containers in account:"); - for (ContainerItem item : serviceClient.listContainers()) { - System.out.println(item.name()); - } - System.out.println(); - - // in the last container, create 5 blobs - for (int i = 0; i < 5; i++) { - BlockBlobClient blobClient = containerClient.getBlockBlobClient("testblob-" + i); - ByteArrayInputStream testdata = new ByteArrayInputStream(("test data" + i).getBytes(StandardCharsets.UTF_8)); - - blobClient.upload(testdata, testdata.available()); - System.out.println("Uploaded blob."); - } - System.out.println(); - - // list blobs and download results - System.out.println("Listing/downloading blobs:"); - for (BlobItem item : containerClient.listBlobsFlat()) { - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - containerClient.getBlobClient(item.name()).download(stream); - System.out.println(item.name() + ": " + new String(stream.toByteArray())); - } - System.out.println(); - - // cleanup - for (ContainerItem item : serviceClient.listContainers()) { - containerClient = serviceClient.getContainerClient(item.name()); - containerClient.delete(); - System.out.println("Deleted container: " + item.name()); - } - } - - //@Test - public void asyncSample() throws IOException { - // get service client - BlobServiceAsyncClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) - .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) - .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) - .buildAsyncClient(); - - // create 5 containers - ContainerAsyncClient containerClient = null; - Mono createContainerTask = Mono.empty(); - for (int i = 0; i < 5; i++) { - String name = "uxtesting" + UUID.randomUUID(); - containerClient = serviceClient.getContainerAsyncClient(name); - - createContainerTask = createContainerTask.and(containerClient.create().then(Mono.defer(() -> { - System.out.println("Created container: " + name); - return Mono.empty(); - }))); - } - ContainerAsyncClient finalContainerClient = containerClient; // final variable for lambda usage - - createContainerTask - // list containers - .thenMany(Flux.defer(() -> { - System.out.println("Listing containers in account:"); - return serviceClient.listContainers() - .flatMap(containerItem -> { - System.out.println(containerItem.name()); - return Mono.empty(); - }); - })) - // in the last container, create 5 blobs - .then(Mono.defer(() -> { - Mono finished = Mono.empty(); - for (int i = 0; i < 5; i++) { - BlockBlobAsyncClient blobClient = finalContainerClient.getBlockBlobAsyncClient("testblob-" + i); - byte[] message = ("test data" + i).getBytes(StandardCharsets.UTF_8); - Flux testdata = Flux.just(ByteBufAllocator.DEFAULT.buffer(message.length).writeBytes(message)); - - finished = finished.and(blobClient.upload(testdata, message.length) - .then(Mono.defer(() -> { - System.out.println("Uploaded blob."); - return Mono.empty(); - }))); - } - - return finished; - })) - // list blobs - .thenMany(Flux.defer(() -> { - System.out.println(); - System.out.println("Listing/downloading blobs:"); - return finalContainerClient.listBlobsFlat(); - })) - // download results - .flatMap(listItem -> - finalContainerClient.getBlobAsyncClient(listItem.name()) - .download() - .flatMapMany(Response::value) - .map(buffer -> new String(buffer.array())) - .doOnNext(string -> System.out.println(listItem.name() + ": " + string))) - // cleanup - .thenMany(serviceClient.listContainers()) - .flatMap(containerItem -> serviceClient - .getContainerAsyncClient(containerItem.name()) - .delete()) - .blockLast(); - } - - //@Test - public void uploadDownloadFromFile() throws IOException { - final String data = "TEST DATA" + UUID.randomUUID(); - final String folderPath = "C:/Users/jaschrep/Desktop/temp"; - - // make start file - File startFile = new File(folderPath, "startFile" + UUID.randomUUID()); - FileOutputStream fstream = new FileOutputStream(startFile); - fstream.write(data.getBytes()); - fstream.close(); - - // get service client - BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) - .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) - .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) - .buildClient(); - - // make container - ContainerClient containerClient = serviceClient.getContainerClient("uxstudy" + UUID.randomUUID()); - containerClient.create(); - - // upload data - BlockBlobClient blobClient = containerClient.getBlockBlobClient("testblob_" + UUID.randomUUID()); - blobClient.uploadFromFile(startFile.getAbsolutePath()); - - // download data - File endFile = new File(folderPath, "endFile" + UUID.randomUUID()); - blobClient.downloadToFile(endFile.getAbsolutePath()); - } - - //@Test - public void uploadDownloadFromFileAsync() throws IOException { - final String data = "TEST DATA" + UUID.randomUUID(); - final String folderPath = "C:/Users/jaschrep/Desktop/temp"; - - // make start file - File startFile = new File(folderPath, "startFile" + UUID.randomUUID()); - FileOutputStream fstream = new FileOutputStream(startFile); - fstream.write(data.getBytes()); - fstream.close(); - - // get service client - BlobServiceAsyncClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) - .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) - .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) - .buildAsyncClient(); - - // make container - ContainerAsyncClient containerClient = serviceClient.getContainerAsyncClient("uxstudy" + UUID.randomUUID()); - containerClient.create() - - // upload data - .then(Mono.defer(() -> { - BlockBlobAsyncClient blobClient = containerClient.getBlockBlobAsyncClient("testblob_" + UUID.randomUUID()); - return blobClient.uploadFromFile(startFile.getAbsolutePath()) - .then(Mono.just(blobClient)); - })) - - // download data - .flatMap(blobClient -> - blobClient.downloadToFile(new File(folderPath, "endFile" + UUID.randomUUID()).getAbsolutePath())) - - .block(); - - } -} diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy index 830dd34c2203..5aaea46dc722 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy @@ -3,19 +3,33 @@ package com.azure.storage.blob - import com.azure.core.http.HttpHeaders import com.azure.core.http.rest.Response -import com.azure.storage.blob.models.* +import com.azure.storage.blob.models.ContainerItem +import com.azure.storage.blob.models.ContainerListDetails +import com.azure.storage.blob.models.CorsRule +import com.azure.storage.blob.models.ListContainersOptions +import com.azure.storage.blob.models.Logging +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.Metrics +import com.azure.storage.blob.models.RetentionPolicy +import com.azure.storage.blob.models.StaticWebsite +import com.azure.storage.blob.models.StorageAccountInfo +import com.azure.storage.blob.models.StorageException +import com.azure.storage.blob.models.StorageServiceProperties +import com.azure.storage.blob.models.StorageServiceStats +import com.azure.storage.blob.models.UserDelegationKey +import com.azure.storage.common.credentials.SharedKeyCredential import com.azure.storage.common.policy.RequestRetryOptions -import org.junit.Assume +import com.azure.storage.common.policy.RequestRetryPolicy +import java.time.Duration import java.time.OffsetDateTime class ServiceAPITest extends APISpec { def setup() { RetentionPolicy disabled = new RetentionPolicy().enabled(false) - primaryServiceURL.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new StorageServiceProperties() .staticWebsite(new StaticWebsite().enabled(false)) .deleteRetentionPolicy(disabled) .cors(null) @@ -25,29 +39,28 @@ class ServiceAPITest extends APISpec { .retentionPolicy(disabled)) .logging(new Logging().version("1.0") .retentionPolicy(disabled)) - .defaultServiceVersion("2018-03-28"), null) + .defaultServiceVersion("2018-03-28")) } def cleanup() { - Assume.assumeTrue("The test only runs in Live mode.", testMode.equalsIgnoreCase("RECORD")) RetentionPolicy disabled = new RetentionPolicy().enabled(false) - primaryServiceURL.setProperties(new StorageServiceProperties() - .staticWebsite(new StaticWebsite().enabled(false)) - .deleteRetentionPolicy(disabled) - .cors(null) - .hourMetrics(new Metrics().version("1.0").enabled(false) + primaryBlobServiceClient.setProperties(new StorageServiceProperties() + .staticWebsite(new StaticWebsite().enabled(false)) + .deleteRetentionPolicy(disabled) + .cors(null) + .hourMetrics(new Metrics().version("1.0").enabled(false) .retentionPolicy(disabled)) - .minuteMetrics(new Metrics().version("1.0").enabled(false) + .minuteMetrics(new Metrics().version("1.0").enabled(false) .retentionPolicy(disabled)) - .logging(new Logging().version("1.0") + .logging(new Logging().version("1.0") .retentionPolicy(disabled)) - .defaultServiceVersion("2018-03-28"), null) + .defaultServiceVersion("2018-03-28")) } def "List containers"() { when: - Iterable response = - primaryServiceURL.listContainers(new ListContainersOptions().prefix(containerPrefix), null) + def response = + primaryBlobServiceClient.listContainers(new ListContainersOptions().prefix(containerPrefix), null) then: for (ContainerItem c : response) { @@ -65,7 +78,7 @@ class ServiceAPITest extends APISpec { def "List containers min"() { when: - primaryServiceURL.listContainers().iterator().hasNext() + primaryBlobServiceClient.listContainers().iterator().hasNext() then: notThrown(StorageException) @@ -74,10 +87,10 @@ class ServiceAPITest extends APISpec { def "List containers marker"() { setup: for (int i = 0; i < 10; i++) { - primaryServiceURL.createContainer(generateContainerName()) + primaryBlobServiceClient.createContainer(generateContainerName()) } - Iterator listResponse = primaryServiceURL.listContainers().iterator() + Iterator listResponse = primaryBlobServiceClient.listContainers().iterator() String firstContainerName = listResponse.next().name() expect: @@ -89,110 +102,133 @@ class ServiceAPITest extends APISpec { setup: Metadata metadata = new Metadata() metadata.put("foo", "bar") - cu = primaryServiceURL.createContainer("aaa" + generateContainerName(), metadata, null).value() + cc = primaryBlobServiceClient.createContainerWithResponse("aaa" + generateContainerName(), metadata, null, null).value() expect: - primaryServiceURL.listContainers(new ListContainersOptions() - .details(new ContainerListDetails().metadata(true)) - .prefix("aaa" + containerPrefix), null) + primaryBlobServiceClient.listContainers(new ListContainersOptions() + .details(new ContainerListDetails().metadata(true)) + .prefix("aaa" + containerPrefix), null) .iterator().next().metadata() == metadata // Container with prefix "aaa" will not be cleaned up by normal test cleanup. - cu.delete().statusCode() == 202 + cc.deleteWithResponse(null, null, null).statusCode() == 202 } - // TODO (alzimmer): Turn this test back on when listing by page is implemented - /*def "List containers maxResults"() { + def "List containers maxResults"() { setup: - for (int i = 0; i < 11; i++) { - primaryServiceURL.createContainer(generateContainerName()) + def NUM_CONTAINERS = 5 + def PAGE_RESULTS = 3 + + def containers = [] as Collection + for (i in (1..NUM_CONTAINERS)) { + containers << primaryBlobServiceClient.createContainer(generateContainerName()) } expect: + primaryBlobServiceClient.listContainers(new ListContainersOptions().maxResults(PAGE_RESULTS), null) + .iterableByPage().iterator().next().value().size() == PAGE_RESULTS - primaryServiceURL.listContainersSegment(null, - new ListContainersOptions().maxResults(10), null) - .blockingGet().body().containerItems().size() == 10 - }*/ + cleanup: + containers.each { container -> container.delete() } + } - // TODO (alzimmer): Turn this test back on when listing by page is implemented as this requires being able to set a marker - /*def "List containers error"() { + def "List containers error"() { when: - primaryServiceURL.listContainers("garbage", null, null).blockingGet() + primaryBlobServiceClient.listContainers().streamByPage("garbage continuation token").count() then: thrown(StorageException) - }*/ + } + + def "List containers with timeout still backed by PagedFlux"() { + setup: + def NUM_CONTAINERS = 5 + def PAGE_RESULTS = 3 + + def containers = [] as Collection + for (i in (1..NUM_CONTAINERS)) { + containers << primaryBlobServiceClient.createContainer(generateContainerName()) + } + + when: "Consume results by page" + primaryBlobServiceClient.listContainers(new ListContainersOptions().maxResults(PAGE_RESULTS), Duration.ofSeconds(10)).streamByPage().count() + + then: "Still have paging functionality" + notThrown(Exception) + + cleanup: + containers.each { container -> container.delete() } + } def validatePropsSet(StorageServiceProperties sent, StorageServiceProperties received) { return received.logging().read() == sent.logging().read() && - received.logging().delete() == sent.logging().delete() && - received.logging().write() == sent.logging().write() && - received.logging().version() == sent.logging().version() && - received.logging().retentionPolicy().days() == sent.logging().retentionPolicy().days() && - received.logging().retentionPolicy().enabled() == sent.logging().retentionPolicy().enabled() && - - received.cors().size() == sent.cors().size() && - received.cors().get(0).allowedMethods() == sent.cors().get(0).allowedMethods() && - received.cors().get(0).allowedHeaders() == sent.cors().get(0).allowedHeaders() && - received.cors().get(0).allowedOrigins() == sent.cors().get(0).allowedOrigins() && - received.cors().get(0).exposedHeaders() == sent.cors().get(0).exposedHeaders() && - received.cors().get(0).maxAgeInSeconds() == sent.cors().get(0).maxAgeInSeconds() && - - received.defaultServiceVersion() == sent.defaultServiceVersion() && - - received.hourMetrics().enabled() == sent.hourMetrics().enabled() && - received.hourMetrics().includeAPIs() == sent.hourMetrics().includeAPIs() && - received.hourMetrics().retentionPolicy().enabled() == sent.hourMetrics().retentionPolicy().enabled() && - received.hourMetrics().retentionPolicy().days() == sent.hourMetrics().retentionPolicy().days() && - received.hourMetrics().version() == sent.hourMetrics().version() && - - received.minuteMetrics().enabled() == sent.minuteMetrics().enabled() && - received.minuteMetrics().includeAPIs() == sent.minuteMetrics().includeAPIs() && - received.minuteMetrics().retentionPolicy().enabled() == sent.minuteMetrics().retentionPolicy().enabled() && - received.minuteMetrics().retentionPolicy().days() == sent.minuteMetrics().retentionPolicy().days() && - received.minuteMetrics().version() == sent.minuteMetrics().version() && - - received.deleteRetentionPolicy().enabled() == sent.deleteRetentionPolicy().enabled() && - received.deleteRetentionPolicy().days() == sent.deleteRetentionPolicy().days() && - - received.staticWebsite().enabled() == sent.staticWebsite().enabled() && - received.staticWebsite().indexDocument() == sent.staticWebsite().indexDocument() && - received.staticWebsite().errorDocument404Path() == sent.staticWebsite().errorDocument404Path() + received.logging().delete() == sent.logging().delete() && + received.logging().write() == sent.logging().write() && + received.logging().version() == sent.logging().version() && + received.logging().retentionPolicy().days() == sent.logging().retentionPolicy().days() && + received.logging().retentionPolicy().enabled() == sent.logging().retentionPolicy().enabled() && + + received.cors().size() == sent.cors().size() && + received.cors().get(0).allowedMethods() == sent.cors().get(0).allowedMethods() && + received.cors().get(0).allowedHeaders() == sent.cors().get(0).allowedHeaders() && + received.cors().get(0).allowedOrigins() == sent.cors().get(0).allowedOrigins() && + received.cors().get(0).exposedHeaders() == sent.cors().get(0).exposedHeaders() && + received.cors().get(0).maxAgeInSeconds() == sent.cors().get(0).maxAgeInSeconds() && + + received.defaultServiceVersion() == sent.defaultServiceVersion() && + + received.hourMetrics().enabled() == sent.hourMetrics().enabled() && + received.hourMetrics().includeAPIs() == sent.hourMetrics().includeAPIs() && + received.hourMetrics().retentionPolicy().enabled() == sent.hourMetrics().retentionPolicy().enabled() && + received.hourMetrics().retentionPolicy().days() == sent.hourMetrics().retentionPolicy().days() && + received.hourMetrics().version() == sent.hourMetrics().version() && + + received.minuteMetrics().enabled() == sent.minuteMetrics().enabled() && + received.minuteMetrics().includeAPIs() == sent.minuteMetrics().includeAPIs() && + received.minuteMetrics().retentionPolicy().enabled() == sent.minuteMetrics().retentionPolicy().enabled() && + received.minuteMetrics().retentionPolicy().days() == sent.minuteMetrics().retentionPolicy().days() && + received.minuteMetrics().version() == sent.minuteMetrics().version() && + + received.deleteRetentionPolicy().enabled() == sent.deleteRetentionPolicy().enabled() && + received.deleteRetentionPolicy().days() == sent.deleteRetentionPolicy().days() && + + received.staticWebsite().enabled() == sent.staticWebsite().enabled() && + received.staticWebsite().indexDocument() == sent.staticWebsite().indexDocument() && + received.staticWebsite().errorDocument404Path() == sent.staticWebsite().errorDocument404Path() } def "Set get properties"() { when: RetentionPolicy retentionPolicy = new RetentionPolicy().days(5).enabled(true) Logging logging = new Logging().read(true).version("1.0") - .retentionPolicy(retentionPolicy) + .retentionPolicy(retentionPolicy) ArrayList corsRules = new ArrayList<>() corsRules.add(new CorsRule().allowedMethods("GET,PUT,HEAD") - .allowedOrigins("*") - .allowedHeaders("x-ms-version") - .exposedHeaders("x-ms-client-request-id") - .maxAgeInSeconds(10)) + .allowedOrigins("*") + .allowedHeaders("x-ms-version") + .exposedHeaders("x-ms-client-request-id") + .maxAgeInSeconds(10)) String defaultServiceVersion = "2016-05-31" Metrics hourMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) + .retentionPolicy(retentionPolicy).includeAPIs(true) Metrics minuteMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) + .retentionPolicy(retentionPolicy).includeAPIs(true) StaticWebsite website = new StaticWebsite().enabled(true) - .indexDocument("myIndex.html") - .errorDocument404Path("custom/error/path.html") + .indexDocument("myIndex.html") + .errorDocument404Path("custom/error/path.html") StorageServiceProperties sentProperties = new StorageServiceProperties() - .logging(logging).cors(corsRules).defaultServiceVersion(defaultServiceVersion) - .minuteMetrics(minuteMetrics).hourMetrics(hourMetrics) - .deleteRetentionPolicy(retentionPolicy) - .staticWebsite(website) + .logging(logging).cors(corsRules).defaultServiceVersion(defaultServiceVersion) + .minuteMetrics(minuteMetrics).hourMetrics(hourMetrics) + .deleteRetentionPolicy(retentionPolicy) + .staticWebsite(website) - HttpHeaders headers = primaryServiceURL.setProperties(sentProperties).headers() + HttpHeaders headers = primaryBlobServiceClient.setPropertiesWithResponse(sentProperties, null, null).headers() // Service properties may take up to 30s to take effect. If they weren't already in place, wait. - sleep(30 * 1000) + sleepIfRecord(30 * 1000) - StorageServiceProperties receivedProperties = primaryServiceURL.getProperties().value() + StorageServiceProperties receivedProperties = primaryBlobServiceClient.getProperties() then: headers.value("x-ms-request-id") != null @@ -206,38 +242,35 @@ class ServiceAPITest extends APISpec { setup: RetentionPolicy retentionPolicy = new RetentionPolicy().days(5).enabled(true) Logging logging = new Logging().read(true).version("1.0") - .retentionPolicy(retentionPolicy) + .retentionPolicy(retentionPolicy) ArrayList corsRules = new ArrayList<>() corsRules.add(new CorsRule().allowedMethods("GET,PUT,HEAD") - .allowedOrigins("*") - .allowedHeaders("x-ms-version") - .exposedHeaders("x-ms-client-request-id") - .maxAgeInSeconds(10)) + .allowedOrigins("*") + .allowedHeaders("x-ms-version") + .exposedHeaders("x-ms-client-request-id") + .maxAgeInSeconds(10)) String defaultServiceVersion = "2016-05-31" Metrics hourMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) + .retentionPolicy(retentionPolicy).includeAPIs(true) Metrics minuteMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) + .retentionPolicy(retentionPolicy).includeAPIs(true) StaticWebsite website = new StaticWebsite().enabled(true) - .indexDocument("myIndex.html") - .errorDocument404Path("custom/error/path.html") + .indexDocument("myIndex.html") + .errorDocument404Path("custom/error/path.html") StorageServiceProperties sentProperties = new StorageServiceProperties() - .logging(logging).cors(corsRules).defaultServiceVersion(defaultServiceVersion) - .minuteMetrics(minuteMetrics).hourMetrics(hourMetrics) - .deleteRetentionPolicy(retentionPolicy) - .staticWebsite(website) + .logging(logging).cors(corsRules).defaultServiceVersion(defaultServiceVersion) + .minuteMetrics(minuteMetrics).hourMetrics(hourMetrics) + .deleteRetentionPolicy(retentionPolicy) + .staticWebsite(website) expect: - primaryServiceURL.setProperties(sentProperties).statusCode() == 202 + primaryBlobServiceClient.setPropertiesWithResponse(sentProperties, null, null).statusCode() == 202 } def "Set props error"() { when: - new BlobServiceClientBuilder() - .endpoint("https://error.blob.core.windows.net") - .credential(primaryCreds) - .buildClient() + getServiceClient(primaryCredential, "https://error.blob.core.windows.net") .setProperties(new StorageServiceProperties()) then: @@ -246,15 +279,12 @@ class ServiceAPITest extends APISpec { def "Get props min"() { expect: - primaryServiceURL.getProperties().statusCode() == 200 + primaryBlobServiceClient.getPropertiesWithResponse(null, null).statusCode() == 200 } def "Get props error"() { when: - new BlobServiceClientBuilder() - .endpoint("https://error.blob.core.windows.net") - .credential(primaryCreds) - .buildClient() + getServiceClient(primaryCredential, "https://error.blob.core.windows.net") .getProperties() then: @@ -266,7 +296,7 @@ class ServiceAPITest extends APISpec { def start = OffsetDateTime.now() def expiry = start.plusDays(1) - Response response = getOAuthServiceURL().getUserDelegationKey(start, expiry, null) + Response response = getOAuthServiceClient().getUserDelegationKeyWithResponse(start, expiry, null, null) expect: response.statusCode() == 200 @@ -284,7 +314,7 @@ class ServiceAPITest extends APISpec { setup: def expiry = OffsetDateTime.now().plusDays(1) - def response = getOAuthServiceURL().getUserDelegationKey(null, expiry) + def response = getOAuthServiceClient().getUserDelegationKeyWithResponse(null, expiry, null, null) expect: response.statusCode() == 200 @@ -292,7 +322,7 @@ class ServiceAPITest extends APISpec { def "Get UserDelegationKey error"() { when: - getOAuthServiceURL().getUserDelegationKey(start, expiry) + getOAuthServiceClient().getUserDelegationKey(start, expiry) then: thrown(exception) @@ -305,10 +335,9 @@ class ServiceAPITest extends APISpec { def "Get stats"() { setup: - String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCreds.accountName()) - BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(secondaryEndpoint) - .credential(primaryCreds).buildClient() - Response response = serviceClient.getStatistics() + String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCredential.accountName()) + BlobServiceClient serviceClient = getServiceClient(primaryCredential, secondaryEndpoint) + Response response = serviceClient.getStatisticsWithResponse(null, null) expect: response.headers().value("x-ms-version") != null @@ -320,16 +349,16 @@ class ServiceAPITest extends APISpec { def "Get stats min"() { setup: - String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCreds.accountName()) - BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(secondaryEndpoint) - .credential(primaryCreds).buildClient() + String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCredential.accountName()) + BlobServiceClient serviceClient = getServiceClient(primaryCredential, secondaryEndpoint) + expect: - serviceClient.getStatistics().statusCode() == 200 + serviceClient.getStatisticsWithResponse(null, null).statusCode() == 200 } def "Get stats error"() { when: - primaryServiceURL.getStatistics() + primaryBlobServiceClient.getStatistics() then: thrown(StorageException) @@ -337,7 +366,7 @@ class ServiceAPITest extends APISpec { def "Get account info"() { when: - Response response = primaryServiceURL.getAccountInfo() + Response response = primaryBlobServiceClient.getAccountInfoWithResponse(null, null) then: response.headers().value("Date") != null @@ -349,14 +378,12 @@ class ServiceAPITest extends APISpec { def "Get account info min"() { expect: - primaryServiceURL.getAccountInfo().statusCode() == 200 + primaryBlobServiceClient.getAccountInfoWithResponse(null, null).statusCode() == 200 } def "Get account info error"() { when: - BlobServiceClient serviceURL = new BlobServiceClientBuilder() - .endpoint(primaryServiceURL.getAccountUrl().toString()) - .buildClient() + BlobServiceClient serviceURL = getServiceClient((SharedKeyCredential) null, primaryBlobServiceClient.getAccountUrl().toString()) serviceURL.getAccountInfo() then: @@ -368,11 +395,8 @@ class ServiceAPITest extends APISpec { def "Invalid account name"() { setup: URL badURL = new URL("http://fake.blobfake.core.windows.net") - BlobServiceClient client = new BlobServiceClientBuilder() - .endpoint(badURL.toString()) - .credential(primaryCreds) - .retryOptions(new RequestRetryOptions(null, 2, null, null, null, null)) - .buildClient() + BlobServiceClient client = getServiceClient(primaryCredential, badURL.toString(), + new RequestRetryPolicy(new RequestRetryOptions(null, 2, null, null, null, null))) when: client.getProperties() diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[0].json new file mode 100644 index 000000000000..385e69884ce7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[0].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacf1352828cc2e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BC70EB69\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfbbb-201e-00c4-0efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "98dbd902-e22a-4442-b95f-70a9f5a11c3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacf1352828cc2e/javablobappendblockac1appendblobapitestappendblockacf13558413", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BC7867AC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfbde-201e-00c4-27fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "486d43d0-68dc-4b99-a3d2-3a4ae082c00e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacf1352828cc2e/javablobappendblockac1appendblobapitestappendblockacf13558413?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "ETag" : "\"0x8D72812BC811C5E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51dfc03-201e-00c4-47fb-594fb0000000", + "x-ms-client-request-id" : "db1d9c8d-f692-46cc-ad84-80934ccdf14d", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfc1a-201e-00c4-57fb-594fb0000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockacf1352828cc2eFri, 23 Aug 2019 21:42:03 GMT\"0x8D72812BC70EB69\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "2fa56e43-9788-408f-8279-c0acdb74415e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacf1352828cc2e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfc26-201e-00c4-62fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "90143aab-c05c-433d-8c6b-10e148c742ec" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockacf1352828cc2e", "javablobappendblockac1appendblobapitestappendblockacf13558413" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[1].json new file mode 100644 index 000000000000..83a4475bae3e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[1].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacbf691513648b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BC936FF6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfc38-201e-00c4-70fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "36dab8fa-5c36-4ad8-8ece-428c0a8d426e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacbf691513648b/javablobappendblockac1appendblobapitestappendblockacbf630615c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BC99B37E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfc55-201e-00c4-06fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "3cb39255-56e9-44da-83e4-dd9ed058e57e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacbf691513648b/javablobappendblockac1appendblobapitestappendblockacbf630615c?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "ETag" : "\"0x8D72812BCA01DB2\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51dfc66-201e-00c4-17fb-594fb0000000", + "x-ms-client-request-id" : "ac1cbc80-7a32-430c-9218-32d6496af6ef", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfc79-201e-00c4-29fb-594fb0000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockacbf691513648bFri, 23 Aug 2019 21:42:03 GMT\"0x8D72812BC936FF6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "d783a9d2-57e1-4344-9efc-0d283625f75b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacbf691513648b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfc8f-201e-00c4-3cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "692889c7-95c5-43a3-a383-0f5264f85615" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockacbf691513648b", "javablobappendblockac1appendblobapitestappendblockacbf630615c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[2].json new file mode 100644 index 000000000000..21c3dee72d94 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[2].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac86f38198845f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BCB494A0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfcc6-201e-00c4-6dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "7636894a-53c6-4fce-93ba-ca0fb06d738b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac86f38198845f/javablobappendblockac1appendblobapitestappendblockac86f459260", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BCBB2662\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfce5-201e-00c4-09fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "c1e10946-38c9-42ab-a922-2bb05278171b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac86f38198845f/javablobappendblockac1appendblobapitestappendblockac86f459260?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "ETag" : "\"0x8D72812BCC0F42C\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51dfcf7-201e-00c4-1bfb-594fb0000000", + "x-ms-client-request-id" : "c5b1f835-cdd3-459d-9b3c-4a71c87b64ab", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfd0b-201e-00c4-2dfb-594fb0000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac86f38198845fFri, 23 Aug 2019 21:42:03 GMT\"0x8D72812BCB494A0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "05cae1cb-2b9b-421d-be58-9b4db18b21ff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac86f38198845f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfd22-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "14977a45-8c32-486d-819c-4d6dc626ba4e" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac86f38198845f", "javablobappendblockac1appendblobapitestappendblockac86f459260" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[3].json new file mode 100644 index 000000000000..f3f766b6fd80 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[3].json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac5d504103fcad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BCD14B5E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfd37-201e-00c4-52fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "1d485bc4-072a-48e8-bd69-b193ca15aa0b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac5d504103fcad/javablobappendblockac1appendblobapitestappendblockac5d5015501", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BCD78EFC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfd64-201e-00c4-77fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "07b82134-d2b8-425d-8570-f73f28a2cd9b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac5d504103fcad/javablobappendblockac1appendblobapitestappendblockac5d5015501", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812BCD78EFC\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:03 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "d51dfd86-201e-00c4-16fb-594fb0000000", + "x-ms-client-request-id" : "f0f6339a-ebe0-4e24-8a37-78d672de4b8d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac5d504103fcad/javablobappendblockac1appendblobapitestappendblockac5d5015501?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "ETag" : "\"0x8D72812BCE1F1CF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51dfdaa-201e-00c4-35fb-594fb0000000", + "x-ms-client-request-id" : "2ec410c3-eeec-4759-9095-fa79e73bb588", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfdb9-201e-00c4-41fb-594fb0000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac5d504103fcadFri, 23 Aug 2019 21:42:03 GMT\"0x8D72812BCD14B5E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "a7a321c2-1657-4a5c-827c-8eb0d0e45ed4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac5d504103fcad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfdc8-201e-00c4-50fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "9c7a9dd0-3b11-4fae-a4b4-94ac8056bc63" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac5d504103fcad", "javablobappendblockac1appendblobapitestappendblockac5d5015501" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[4].json new file mode 100644 index 000000000000..32c400780210 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[4].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacb15466637006?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BCF381C2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfde9-201e-00c4-6cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "d1c894d4-8084-4ef0-9da0-e5b9c4d585b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacb15466637006/javablobappendblockac1appendblobapitestappendblockacb1539244f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BCF928FD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfe05-201e-00c4-80fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "042a5bed-3b66-4942-b04d-f2c01bd289a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacb15466637006/javablobappendblockac1appendblobapitestappendblockacb1539244f?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "ETag" : "\"0x8D72812BD02EF6E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51dfe2a-201e-00c4-20fb-594fb0000000", + "x-ms-client-request-id" : "9084930e-2e1e-46d2-91d7-e8d12e2fcef1", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfe3d-201e-00c4-32fb-594fb0000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockacb15466637006Fri, 23 Aug 2019 21:42:04 GMT\"0x8D72812BCF381C2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "1d39e738-e5b2-4112-a463-b201f56a46ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacb15466637006?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfe50-201e-00c4-40fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "effb315e-53bd-46f8-868d-ce74360c69a5" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockacb15466637006", "javablobappendblockac1appendblobapitestappendblockacb1539244f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[5].json new file mode 100644 index 000000000000..b785bd1283fa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[5].json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac0c67483507b7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD1717F7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfe6d-201e-00c4-57fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "028cdb4e-81da-498a-b50b-884d0cfda053" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac0c67483507b7/javablobappendblockac1appendblobapitestappendblockac0c617717f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD1DF815\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfe81-201e-00c4-67fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "3daa421f-b379-4a29-ac03-3170c77c2f9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac0c67483507b7/javablobappendblockac1appendblobapitestappendblockac0c617717f?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD1DF815\"", + "x-ms-lease-id" : "21fcc5cb-20c1-4941-9242-68cba7309e1b", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfe9f-201e-00c4-01fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "52434120-dd77-40a6-9ad8-267f9d4a176f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac0c67483507b7/javablobappendblockac1appendblobapitestappendblockac0c617717f?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "ETag" : "\"0x8D72812BD294578\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51dfeaf-201e-00c4-10fb-594fb0000000", + "x-ms-client-request-id" : "4f6eddc1-afa8-4088-9d78-5157a3d3c535", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfec3-201e-00c4-21fb-594fb0000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac0c67483507b7Fri, 23 Aug 2019 21:42:04 GMT\"0x8D72812BD1717F7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "4d1041c4-4344-4ed2-afd1-371c48f8da40", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac0c67483507b7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfed6-201e-00c4-31fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "87afdb5c-2204-408c-87a9-9148c7a2cbe5" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac0c67483507b7", "javablobappendblockac1appendblobapitestappendblockac0c617717f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[6].json new file mode 100644 index 000000000000..d33690610092 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[6].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockace54314906721?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD3CF8B6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfef2-201e-00c4-4cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "639ca640-c548-430f-bd4b-e14e9eb1f780" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockace54314906721/javablobappendblockac1appendblobapitestappendblockace5418699a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD4251E7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfeff-201e-00c4-58fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "b2921f35-e252-4544-a2bb-5b2f6663e144" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockace54314906721/javablobappendblockac1appendblobapitestappendblockace5418699a?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "ETag" : "\"0x8D72812BD47F894\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51dff13-201e-00c4-69fb-594fb0000000", + "x-ms-client-request-id" : "415fc12b-1423-4683-a268-32751930254f", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dff22-201e-00c4-76fb-594fb0000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockace54314906721Fri, 23 Aug 2019 21:42:04 GMT\"0x8D72812BD3CF8B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "a1a0d09f-d304-4be3-a260-52cbbd9cf315", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockace54314906721?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dff39-201e-00c4-09fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "4366792e-0a05-4743-8c9b-4513d96e6bdd" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockace54314906721", "javablobappendblockac1appendblobapitestappendblockace5418699a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[7].json new file mode 100644 index 000000000000..49e009fe2b5f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[7].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac865350906c62?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD59D695\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dff58-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "355f03d1-ba9a-471d-88dd-b3965e650b04" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac865350906c62/javablobappendblockac1appendblobapitestappendblockac865286263", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD5FA511\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dff79-201e-00c4-47fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "92ae0b4b-3d31-4f0c-92a4-d019a7f96651" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac865350906c62/javablobappendblockac1appendblobapitestappendblockac865286263?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "ETag" : "\"0x8D72812BD64FD99\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51dff87-201e-00c4-55fb-594fb0000000", + "x-ms-client-request-id" : "76065e1a-7c5b-40ec-9c02-459a244b2aaa", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dff9c-201e-00c4-67fb-594fb0000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac865350906c62Fri, 23 Aug 2019 21:42:04 GMT\"0x8D72812BD59D695\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "28cea2ff-99d6-48f5-a527-ce11ffd016fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac865350906c62?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dffb3-201e-00c4-7dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "818ebf7f-fa86-499f-8f66-cb3d7629e191" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac865350906c62", "javablobappendblockac1appendblobapitestappendblockac865286263" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[0].json new file mode 100644 index 000000000000..d721d2e842f1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[0].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0112297783b98d84524acb9e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD75065D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dffc8-201e-00c4-11fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:03 GMT", + "x-ms-client-request-id" : "e49562e9-10c1-4eb8-9e34-3088c918a9aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0112297783b98d84524acb9e/javablobappendblockacfail1891355b7dff58b6de40a5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD7B231F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dffda-201e-00c4-1ffb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "8dbb3f74-6a94-4045-9463-57c7068f01fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0112297783b98d84524acb9e/javablobappendblockacfail1891355b7dff58b6de40a5?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51dfff0-201e-00c4-35fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51dfff0-201e-00c4-35fb-594fb0000000\nTime:2019-08-23T21:42:05.0080810Z", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "eb34d8d3-2dbf-4da0-bab8-fc55efc3887e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfffe-201e-00c4-41fb-594fb0000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail0112297783b98d84524acb9eFri, 23 Aug 2019 21:42:04 GMT\"0x8D72812BD75065D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "13672463-c5b1-4ff6-9d2e-1c9ceb48fbe1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0112297783b98d84524acb9e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0017-201e-00c4-58fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "a9635692-0e61-4af0-ab04-eacb8bdbfd76" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail0112297783b98d84524acb9e", "javablobappendblockacfail1891355b7dff58b6de40a5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[1].json new file mode 100644 index 000000000000..51f9c26ae4e0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[1].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail02066791f999eb0a8c47a488?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD936B32\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e003b-201e-00c4-79fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "d3811927-7b7c-453e-b6aa-ca6acd38ada1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail02066791f999eb0a8c47a488/javablobappendblockacfail161260b08f4d9af1bf4294", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BD9960E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0055-201e-00c4-10fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "2d4117f7-d2bf-4bdd-8627-4975a46344e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail02066791f999eb0a8c47a488/javablobappendblockacfail161260b08f4d9af1bf4294?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e0072-201e-00c4-27fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e0072-201e-00c4-27fb-594fb0000000\nTime:2019-08-23T21:42:05.2072703Z", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "041ffb3c-ba5d-496b-86af-eac82738e8f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e007e-201e-00c4-31fb-594fb0000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail02066791f999eb0a8c47a488Fri, 23 Aug 2019 21:42:05 GMT\"0x8D72812BD936B32\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "3fb0d277-8c0c-4ea9-8872-471ffc20c528", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail02066791f999eb0a8c47a488?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e008d-201e-00c4-40fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "aa8b642d-b9c4-4e4f-9dfd-250dcf8bcd71" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail02066791f999eb0a8c47a488", "javablobappendblockacfail161260b08f4d9af1bf4294" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[2].json new file mode 100644 index 000000000000..ecdd376d5a8f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[2].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0217138579a74f456c408abf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BDB133A9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e00a1-201e-00c4-51fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "472c9531-5e74-40db-b4f7-ff208dfb3fbc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0217138579a74f456c408abf/javablobappendblockacfail17860325b0070589b84803", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BDB7507D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e00c0-201e-00c4-69fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "88cd52f9-b802-4613-b07f-09092e68076b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0217138579a74f456c408abf/javablobappendblockacfail17860325b0070589b84803?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e00d0-201e-00c4-79fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e00d0-201e-00c4-79fb-594fb0000000\nTime:2019-08-23T21:42:05.3984524Z", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "c69a5945-5538-4693-8e10-19ca1322a04a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e00e5-201e-00c4-0bfb-594fb0000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail0217138579a74f456c408abfFri, 23 Aug 2019 21:42:05 GMT\"0x8D72812BDB133A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "0392bb8c-3c34-4b62-be32-a9f93e490246", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail0217138579a74f456c408abf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e00f2-201e-00c4-16fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "fb9c7294-57a5-4f68-b0f3-1119b71aad92" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail0217138579a74f456c408abf", "javablobappendblockacfail17860325b0070589b84803" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[3].json new file mode 100644 index 000000000000..6e3e3e450f95 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[3].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail078395c6df0fc48b9d4e5ea3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BDCD4E06\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0103-201e-00c4-25fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "dcec7276-f6b1-4348-8f53-26be6ccd472a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail078395c6df0fc48b9d4e5ea3/javablobappendblockacfail1174090c57e44a22f94f3c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BDD343CD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0116-201e-00c4-36fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "e35a6732-27e6-4288-8c92-e8e2a59fc171" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail078395c6df0fc48b9d4e5ea3/javablobappendblockacfail1174090c57e44a22f94f3c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812BDD343CD\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:05 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0129-201e-00c4-47fb-594fb0000000", + "x-ms-client-request-id" : "e54cc21f-0c63-43ce-a2f1-7b5d103dd552", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail078395c6df0fc48b9d4e5ea3/javablobappendblockacfail1174090c57e44a22f94f3c?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e014c-201e-00c4-60fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e014c-201e-00c4-60fb-594fb0000000\nTime:2019-08-23T21:42:05.6196636Z", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "70377ba5-ee71-48c4-8784-8cd5700f0dec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e015d-201e-00c4-6ffb-594fb0000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail078395c6df0fc48b9d4e5ea3Fri, 23 Aug 2019 21:42:05 GMT\"0x8D72812BDCD4E06\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "bd32b487-c94a-4533-80a1-3aca64d675d0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail078395c6df0fc48b9d4e5ea3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e016a-201e-00c4-79fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "d5e4122e-a7e9-4642-b51e-46cef8e1c5fc" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail078395c6df0fc48b9d4e5ea3", "javablobappendblockacfail1174090c57e44a22f94f3c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[4].json new file mode 100644 index 000000000000..02e5b375cdef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[4].json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail088592e3b9e8335bb4424287?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BDEF362D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e018a-201e-00c4-14fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "bf565d80-cd47-41d0-b460-981bda3b0c39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail088592e3b9e8335bb4424287/javablobappendblockacfail1857423ade8109748a4cd6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BDF5A14B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e01a5-201e-00c4-2dfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "41774422-5a18-469c-a08e-ff1d0c29f52c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail088592e3b9e8335bb4424287/javablobappendblockacfail1857423ade8109748a4cd6?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BDF5A14B\"", + "x-ms-lease-id" : "28321e44-5e9b-4281-a878-75722a3c1ac6", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e01b6-201e-00c4-3efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "e564aa03-f408-48a9-8de0-aacb70fd5917" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail088592e3b9e8335bb4424287/javablobappendblockacfail1857423ade8109748a4cd6?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "d51e01cd-201e-00c4-51fb-594fb0000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:d51e01cd-201e-00c4-51fb-594fb0000000\nTime:2019-08-23T21:42:05.8448782Z", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "929681b9-cab3-4f91-bf06-c9c2ceb71072", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e01de-201e-00c4-61fb-594fb0000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail088592e3b9e8335bb4424287Fri, 23 Aug 2019 21:42:05 GMT\"0x8D72812BDEF362D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "89b958e6-7a7e-45d7-b7cb-0628ae66dfe0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail088592e3b9e8335bb4424287?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e01ef-201e-00c4-70fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:04 GMT", + "x-ms-client-request-id" : "5790e548-e6a9-4f2f-af27-14616ad8ca1c" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail088592e3b9e8335bb4424287", "javablobappendblockacfail1857423ade8109748a4cd6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[5].json new file mode 100644 index 000000000000..582c2f24101f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[5].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail000610489b68c82206437e9e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BE0FE58D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e020d-201e-00c4-06fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "4242c99e-7140-4ecd-8bb8-e88e6b942702" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail000610489b68c82206437e9e/javablobappendblockacfail10226792cf6bfe7ff946ba", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BE1650B7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0231-201e-00c4-26fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "a9f7bd77-ab1e-4a2c-b59c-13b34f17716d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail000610489b68c82206437e9e/javablobappendblockacfail10226792cf6bfe7ff946ba?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AppendPositionConditionNotMet", + "retry-after" : "0", + "Content-Length" : "250", + "StatusCode" : "412", + "x-ms-request-id" : "d51e024e-201e-00c4-41fb-594fb0000000", + "Body" : "AppendPositionConditionNotMetThe append position condition specified was not met.\nRequestId:d51e024e-201e-00c4-41fb-594fb0000000\nTime:2019-08-23T21:42:06.0270524Z", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "5ee5295a-3d39-4750-b3ec-6ba2ef4a8947", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e025f-201e-00c4-4ffb-594fb0000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail000610489b68c82206437e9eFri, 23 Aug 2019 21:42:05 GMT\"0x8D72812BE0FE58D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "1cc61c8a-1e64-47de-bfc4-3575aba53fc8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail000610489b68c82206437e9e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0279-201e-00c4-68fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "c3783b3d-0e79-4962-93d4-2b87cec76877" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail000610489b68c82206437e9e", "javablobappendblockacfail10226792cf6bfe7ff946ba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[6].json new file mode 100644 index 000000000000..a4052a4160dc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[6].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail025173a86ffc4a89fc4a96b7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BE30E31B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0293-201e-00c4-01fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "560a0155-a8d4-4ce4-8241-e1757a176439" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail025173a86ffc4a89fc4a96b7/javablobappendblockacfail1740079e125a7683134a1d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BE36B1EF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e02b1-201e-00c4-15fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "fec65acb-8c1d-4e03-973d-3fb99978989f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail025173a86ffc4a89fc4a96b7/javablobappendblockacfail1740079e125a7683134a1d?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MaxBlobSizeConditionNotMet", + "retry-after" : "0", + "Content-Length" : "245", + "StatusCode" : "412", + "x-ms-request-id" : "d51e02cb-201e-00c4-2efb-594fb0000000", + "Body" : "MaxBlobSizeConditionNotMetThe max blob size condition specified was not met.\nRequestId:d51e02cb-201e-00c4-2efb-594fb0000000\nTime:2019-08-23T21:42:06.2362517Z", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "add10084-9ebb-4f85-85f5-aefe61bf1a15", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e02da-201e-00c4-39fb-594fb0000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail025173a86ffc4a89fc4a96b7Fri, 23 Aug 2019 21:42:06 GMT\"0x8D72812BE30E31B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "19ec7b3f-62a5-4388-8881-205042ae3617", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockacfail025173a86ffc4a89fc4a96b7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e02ec-201e-00c4-48fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "c6c9506f-1cce-4eb8-bf5a-a1e93faa5718" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail025173a86ffc4a89fc4a96b7", "javablobappendblockacfail1740079e125a7683134a1d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockdefaults.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockdefaults.json new file mode 100644 index 000000000000..28daf89575c0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockdefaults.json @@ -0,0 +1,169 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults0532279036b18b1be5435e8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BB9F94DE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d799136-601e-0129-2bfb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "ff2a3237-a831-4558-b15f-2cdb7e87fe5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults0532279036b18b1be5435e8/javablobappendblockdefaults1145319c64495711f6478", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BBB13D47\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d799198-601e-0129-7ffb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "fba6dce5-2ae5-4762-9962-809d1f92faba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults0532279036b18b1be5435e8/javablobappendblockdefaults1145319c64495711f6478?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "ETag" : "\"0x8D72812BBBA191A\"", + "Content-Length" : "0", + "x-ms-request-id" : "6d7991af-601e-0129-16fb-590061000000", + "x-ms-client-request-id" : "cb73836b-08e5-4258-9c3e-3212e37db5fc", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults0532279036b18b1be5435e8/javablobappendblockdefaults1145319c64495711f6478", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:02 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812BBBA191A\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:01 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "6d799221-601e-0129-7dfb-590061000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "c4bd2543-6759-46d5-b715-1f879102f947", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults0532279036b18b1be5435e8/javablobappendblockdefaults1145319c64495711f6478", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:02 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812BBBA191A\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:01 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "6d799251-601e-0129-29fb-590061000000", + "x-ms-client-request-id" : "95b541aa-06c3-4e2c-9116-558293586d5c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockdefaults&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d799282-601e-0129-52fb-590061000000", + "Body" : "jtcappendblockdefaultsjtcappendblockdefaults0532279036b18b1be5435e8Fri, 23 Aug 2019 21:42:01 GMT\"0x8D72812BB9F94DE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "402a5c48-b2a7-4546-82f2-feca9780c9ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockdefaults0532279036b18b1be5435e8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d7992a5-601e-0129-70fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "63fbd608-a7e0-4526-9120-749415405d93" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockdefaults0532279036b18b1be5435e8", "javablobappendblockdefaults1145319c64495711f6478" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockemptybody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockemptybody.json new file mode 100644 index 000000000000..7543623c9fe5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockemptybody.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockemptybody06277848fcaabf516840538?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BC3D99DD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfadc-201e-00c4-49fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "7cac4723-0eb5-4a3a-9a1c-0097eef79927" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockemptybody06277848fcaabf516840538/javablobappendblockemptybody199600407ab1d47e384a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BC4479B0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfafb-201e-00c4-65fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "dc7e1030-1a97-4dac-8f57-12097f39bb41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockemptybody06277848fcaabf516840538/javablobappendblockemptybody199600407ab1d47e384a?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "d51dfb23-201e-00c4-07fb-594fb0000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:d51dfb23-201e-00c4-07fb-594fb0000000\nTime:2019-08-23T21:42:02.9731395ZContent-Length0", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "1b14a4d6-5f6e-4495-9cb9-8920f0d8de40", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockemptybody&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfb35-201e-00c4-14fb-594fb0000000", + "Body" : "jtcappendblockemptybodyjtcappendblockemptybody06277848fcaabf516840538Fri, 23 Aug 2019 21:42:02 GMT\"0x8D72812BC3D99DD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "20ea52c8-f2b4-4874-b281-9c4357f5e14b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockemptybody06277848fcaabf516840538?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfb40-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "700f5ee6-fdc1-41cd-92bf-f8a4e03380bc" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockemptybody06277848fcaabf516840538", "javablobappendblockemptybody199600407ab1d47e384a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockerror.json new file mode 100644 index 000000000000..5251ecae0def --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockerror.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerrord5b826373?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BE4BC4A6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e030b-201e-00c4-62fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "ab949fd3-aff9-4fbb-b07c-894f917fe39c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerrord5b826373/javablobappendblockerror144847589112203b9d40be", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BE51937B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e032b-201e-00c4-7bfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "28d6370b-ec87-4e0a-b9a0-1774dfa1ef3e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerrord5b826373/javablobappendblockerror2047269f686eda7f7a4d97?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "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" : "d51e0341-201e-00c4-11fb-594fb0000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:d51e0341-201e-00c4-11fb-594fb0000000\nTime:2019-08-23T21:42:06.4154223Z", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "4f9ba23e-38e7-44a4-b26b-3e34825a2e06", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0363-201e-00c4-2efb-594fb0000000", + "Body" : "jtcappendblockerrorjtcappendblockerror0appendblobapitestappendblockerrord5b826373Fri, 23 Aug 2019 21:42:06 GMT\"0x8D72812BE4BC4A6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "558960cb-98f0-44a1-b9e0-d201f374a38d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerrord5b826373?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0372-201e-00c4-3cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "5603ce96-845e-4685-8877-673662a649db" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockerror0appendblobapitestappendblockerrord5b826373", "javablobappendblockerror144847589112203b9d40be", "javablobappendblockerror2047269f686eda7f7a4d97" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[0].json new file mode 100644 index 000000000000..7831fa26c857 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[0].json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail041171a315880e8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1054D63\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0e42-201e-00c4-45fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "8425bc01-6a08-49c6-98cd-f568af1166c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail041171a315880e8/javablobappendblockfromurlacdestinationfail1868655d1122d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C10ACF0E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0e68-201e-00c4-5dfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "62e08270-ece9-4dac-8492-65d79f30bd7e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail041171a315880e8?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C10FAB91\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e0e85-201e-00c4-71fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "1dcf56ec-de2b-42db-aafd-dc37f10f6a26" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail041171a315880e8/javablobappendblockfromurlacdestinationfail269315e6ff4df", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C114E3B6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0e90-201e-00c4-7afb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "ca34d4e3-28f1-4acf-bcd8-7da1d8dbc6cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail041171a315880e8/javablobappendblockfromurlacdestinationfail269315e6ff4df?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "ETag" : "\"0x8D72812C11A1520\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0ea2-201e-00c4-0afb-594fb0000000", + "x-ms-client-request-id" : "45543dca-af44-4dd7-b8a6-f355e63501ed", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail041171a315880e8/javablobappendblockfromurlacdestinationfail1868655d1122d?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "d51e0ebf-201e-00c4-21fb-594fb0000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e0ebf-201e-00c4-21fb-594fb0000000\nTime:2019-08-23T21:42:11.0918829Z", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "1d3ffc0b-5db2-4b5f-ac06-e018ee7788e4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0ee5-201e-00c4-3afb-594fb0000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail041171a315880e8Fri, 23 Aug 2019 21:42:10 GMT\"0x8D72812C10FAB91\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "b7a38fb7-3b64-4bfe-9429-06bbb6aa7623", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail041171a315880e8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0efe-201e-00c4-4bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "4331b0fa-6402-4d74-a923-b2099e695bcf" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail041171a315880e8", "javablobappendblockfromurlacdestinationfail1868655d1122d", "javablobappendblockfromurlacdestinationfail269315e6ff4df" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[1].json new file mode 100644 index 000000000000..9b92c2ac8e59 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[1].json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0643292c3a1ded6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C130386F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0f24-201e-00c4-65fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "aaf3e9f6-a5a0-497d-83db-6ae412ab07ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0643292c3a1ded6/javablobappendblockfromurlacdestinationfail136240e01dabb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C13F80A8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0f36-201e-00c4-74fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "26c81da4-b7e3-4314-949d-af54b86eff5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0643292c3a1ded6?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C144D20F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e0f6c-201e-00c4-19fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "7f28f586-2da7-41cc-a8ed-5c3f5f0aafd1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0643292c3a1ded6/javablobappendblockfromurlacdestinationfail25503751bc87a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C14A31B2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0f7e-201e-00c4-29fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "0069497a-ee19-48b4-9c11-e8ccfc8609e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0643292c3a1ded6/javablobappendblockfromurlacdestinationfail25503751bc87a?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "ETag" : "\"0x8D72812C14FFF7D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0f97-201e-00c4-3afb-594fb0000000", + "x-ms-client-request-id" : "f11a9160-748b-4014-830b-1b62382e635c", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0643292c3a1ded6/javablobappendblockfromurlacdestinationfail136240e01dabb?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "d51e0fb8-201e-00c4-57fb-594fb0000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e0fb8-201e-00c4-57fb-594fb0000000\nTime:2019-08-23T21:42:11.4442184Z", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "d74030bb-80a0-4c03-b6f9-028aaf996909", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0fd2-201e-00c4-6efb-594fb0000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail0643292c3a1ded6Fri, 23 Aug 2019 21:42:11 GMT\"0x8D72812C144D20F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "14f2050a-9687-4738-a352-14efaa5e9744", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0643292c3a1ded6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0fde-201e-00c4-79fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "10581740-a0c3-419b-8f63-3a9a04e3b129" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail0643292c3a1ded6", "javablobappendblockfromurlacdestinationfail136240e01dabb", "javablobappendblockfromurlacdestinationfail25503751bc87a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[2].json new file mode 100644 index 000000000000..ca20a96ce184 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[2].json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02105938d269725?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C166E62E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0fff-201e-00c4-11fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "60089d08-ec84-42d6-9924-a31678dc259b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02105938d269725/javablobappendblockfromurlacdestinationfail162665523c600", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C16CB656\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1018-201e-00c4-23fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "18903f33-9677-494e-9d80-b3ab04b9b6b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02105938d269725?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1716AF3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e102b-201e-00c4-30fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "af10233f-482c-4f4f-90ad-ece0438b0f1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02105938d269725/javablobappendblockfromurlacdestinationfail215808a31a4d9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1767CC0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1038-201e-00c4-3dfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "d2fe2270-ed82-4d34-8995-1a5d0fe9c454" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02105938d269725/javablobappendblockfromurlacdestinationfail215808a31a4d9?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "ETag" : "\"0x8D72812C17B5FF7\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1048-201e-00c4-49fb-594fb0000000", + "x-ms-client-request-id" : "45f71921-22a9-4f6f-a55e-46eeba112733", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02105938d269725/javablobappendblockfromurlacdestinationfail162665523c600?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "d51e1060-201e-00c4-5ffb-594fb0000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e1060-201e-00c4-5ffb-594fb0000000\nTime:2019-08-23T21:42:11.7184795Z", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "f000f513-bdc3-4905-adb5-c7e3246e9a4c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e106e-201e-00c4-6cfb-594fb0000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail02105938d269725Fri, 23 Aug 2019 21:42:11 GMT\"0x8D72812C1716AF3\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "87069959-b209-4a97-b122-7336d11a3a6b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail02105938d269725?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1087-201e-00c4-01fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "153720dc-24b8-48b9-9710-543cd1a6700e" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail02105938d269725", "javablobappendblockfromurlacdestinationfail162665523c600", "javablobappendblockfromurlacdestinationfail215808a31a4d9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[3].json new file mode 100644 index 000000000000..92d51dbf3917 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[3].json @@ -0,0 +1,202 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail048819ad0b2cca1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C191AA1A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1097-201e-00c4-10fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "9c5da7cc-34ec-44b9-93ca-239bc0b4c7a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail048819ad0b2cca1/javablobappendblockfromurlacdestinationfail112761630e8db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C197051D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e10ae-201e-00c4-23fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "f7119b5c-6fc3-4100-9966-54b2e77217d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail048819ad0b2cca1?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C19BE07E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e10cc-201e-00c4-37fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-client-request-id" : "79e5c53a-91b5-45fd-8a96-eaebdd6879bf" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail048819ad0b2cca1/javablobappendblockfromurlacdestinationfail112761630e8db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:10 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C197051D\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:11 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "d51e10df-201e-00c4-45fb-594fb0000000", + "x-ms-client-request-id" : "72385fd8-ad75-4871-a581-35d28894f4b7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail048819ad0b2cca1/javablobappendblockfromurlacdestinationfail2495052b58e5b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1A5396C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e10f2-201e-00c4-54fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "b6fdcfc7-2b08-413e-a238-a4740537ed68" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail048819ad0b2cca1/javablobappendblockfromurlacdestinationfail2495052b58e5b?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "ETag" : "\"0x8D72812C1AC671E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1100-201e-00c4-61fb-594fb0000000", + "x-ms-client-request-id" : "c6db363f-67d8-4aad-8156-5130f7ee3e2b", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail048819ad0b2cca1/javablobappendblockfromurlacdestinationfail112761630e8db?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "d51e1114-201e-00c4-72fb-594fb0000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e1114-201e-00c4-72fb-594fb0000000\nTime:2019-08-23T21:42:12.0507969Z", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "968b16b9-862a-41dd-ac44-5480c14b4ef6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1146-201e-00c4-1bfb-594fb0000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail048819ad0b2cca1Fri, 23 Aug 2019 21:42:11 GMT\"0x8D72812C19BE07E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "ab3f2a00-6792-42a9-b965-6c6766a0e222", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail048819ad0b2cca1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1162-201e-00c4-32fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "2805cf7f-e7b6-49d2-ad57-f971cfc73d43" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail048819ad0b2cca1", "javablobappendblockfromurlacdestinationfail112761630e8db", "javablobappendblockfromurlacdestinationfail2495052b58e5b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[4].json new file mode 100644 index 000000000000..8ead4bae3ce9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[4].json @@ -0,0 +1,192 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0810246ea6fcada?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1C2B125\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1180-201e-00c4-4cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "615ca785-d762-40cd-8eae-8a5536bd86c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0810246ea6fcada/javablobappendblockfromurlacdestinationfail1634749b4987b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1C85A68\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1194-201e-00c4-5bfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "deb5ea3e-be74-4dc2-b327-fe7a4a04d6e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0810246ea6fcada?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1CE6E3D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e11b8-201e-00c4-7cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "063be648-eac4-4084-9fa5-a5556a31ce3f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0810246ea6fcada/javablobappendblockfromurlacdestinationfail1634749b4987b?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1C85A68\"", + "x-ms-lease-id" : "07cda507-185a-4e23-a7e4-22119300891c", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e11c8-201e-00c4-0bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "8f40f271-0d44-46fe-96b1-a3d40442cec0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0810246ea6fcada/javablobappendblockfromurlacdestinationfail241571bd03e4a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1D83CCF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e11da-201e-00c4-1bfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "cfe22d0e-30bf-4778-afc8-966dcac29cb9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0810246ea6fcada/javablobappendblockfromurlacdestinationfail241571bd03e4a?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "ETag" : "\"0x8D72812C1DD2003\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e11f5-201e-00c4-30fb-594fb0000000", + "x-ms-client-request-id" : "c617cb57-ea6e-4df5-a43b-bccc557366f8", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0810246ea6fcada/javablobappendblockfromurlacdestinationfail1634749b4987b?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51e1200-201e-00c4-39fb-594fb0000000", + "Body" : "\nLeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:d51e1200-201e-00c4-39fb-594fb0000000\nTime:2019-08-23T21:42:12.3691010Z", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "6737d184-8de2-4066-b2c8-b287056e9016", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1217-201e-00c4-4bfb-594fb0000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail0810246ea6fcadaFri, 23 Aug 2019 21:42:12 GMT\"0x8D72812C1CE6E3D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "69c93902-87cf-4574-90bf-67f71e929a61", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0810246ea6fcada?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1230-201e-00c4-60fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "6eeadd29-aacc-42da-9b1e-481a3f4de8bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail0810246ea6fcada", "javablobappendblockfromurlacdestinationfail1634749b4987b", "javablobappendblockfromurlacdestinationfail241571bd03e4a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[5].json new file mode 100644 index 000000000000..957a0043e7ea --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[5].json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail077332330ccc8c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1F2F4A9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1244-201e-00c4-73fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "da5312ec-6e6e-4f0a-ba7d-57e0ca1a0d3f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail077332330ccc8c4/javablobappendblockfromurlacdestinationfail104458398b3aa", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C1F8EC3A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e125f-201e-00c4-07fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "88ad32f9-d62a-435c-aa63-f3ef288c9058" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail077332330ccc8c4?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C200FC05\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e128f-201e-00c4-2cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "23193af8-584a-4b08-9384-68c4a705de0f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail077332330ccc8c4/javablobappendblockfromurlacdestinationfail224636d006d9c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C2060ECB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e12b1-201e-00c4-44fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "267c6c1c-1087-451d-b015-d3e594365599" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail077332330ccc8c4/javablobappendblockfromurlacdestinationfail224636d006d9c?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "ETag" : "\"0x8D72812C20B404A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e12d7-201e-00c4-67fb-594fb0000000", + "x-ms-client-request-id" : "7de7fccf-15e0-429d-8ea3-1672566679be", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail077332330ccc8c4/javablobappendblockfromurlacdestinationfail104458398b3aa?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AppendPositionConditionNotMet", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "d51e12f3-201e-00c4-7ffb-594fb0000000", + "Body" : "\nAppendPositionConditionNotMetThe append position condition specified was not met.\nRequestId:d51e12f3-201e-00c4-7ffb-594fb0000000\nTime:2019-08-23T21:42:12.6643828Z", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "b17c267d-0645-40e7-85e5-6cb74d540481", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e130f-201e-00c4-15fb-594fb0000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail077332330ccc8c4Fri, 23 Aug 2019 21:42:12 GMT\"0x8D72812C200FC05\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "b2f34715-0784-4615-90cc-cceffb441047", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail077332330ccc8c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e132b-201e-00c4-30fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "ff1745c3-9280-4091-bec7-ef40c649aacf" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail077332330ccc8c4", "javablobappendblockfromurlacdestinationfail104458398b3aa", "javablobappendblockfromurlacdestinationfail224636d006d9c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[6].json new file mode 100644 index 000000000000..73e1b6ec973b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[6].json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0374521e066a888?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C220C6A2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1343-201e-00c4-46fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "dd86b47a-b0eb-4609-9447-8a92fbd7b3c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0374521e066a888/javablobappendblockfromurlacdestinationfail192599fead09e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C22621D5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1357-201e-00c4-55fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "5ce911ba-0066-48bf-a7e2-ba9e0faa3b90" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0374521e066a888?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C22B2354\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e1363-201e-00c4-5ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "f79d5d67-afc6-413e-9c1e-0e0202ac3a50" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0374521e066a888/javablobappendblockfromurlacdestinationfail284506b9fe166", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C230366A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1371-201e-00c4-6bfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "93c6858c-26f3-4de6-9ca3-963bcab0c255" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0374521e066a888/javablobappendblockfromurlacdestinationfail284506b9fe166?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "ETag" : "\"0x8D72812C23540B5\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e138a-201e-00c4-01fb-594fb0000000", + "x-ms-client-request-id" : "ab5d4f36-2d6c-43dc-9c88-0770ad1cce56", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0374521e066a888/javablobappendblockfromurlacdestinationfail192599fead09e?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MaxBlobSizeConditionNotMet", + "retry-after" : "0", + "Content-Length" : "246", + "StatusCode" : "412", + "x-ms-request-id" : "d51e1396-201e-00c4-0cfb-594fb0000000", + "Body" : "\nMaxBlobSizeConditionNotMetThe max blob size condition specified was not met.\nRequestId:d51e1396-201e-00c4-0cfb-594fb0000000\nTime:2019-08-23T21:42:12.9416470Z", + "Date" : "Fri, 23 Aug 2019 21:42:11 GMT", + "x-ms-client-request-id" : "aa63ae69-76bc-4fa5-89ad-3bb77759771e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e13ad-201e-00c4-1ffb-594fb0000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail0374521e066a888Fri, 23 Aug 2019 21:42:12 GMT\"0x8D72812C22B2354\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "41e41b8f-94c8-4cf6-9074-2e575eb9a3a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0374521e066a888?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e13b8-201e-00c4-29fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "f0ca6c90-2a5a-463b-8da8-f02b6bb69bf4" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail0374521e066a888", "javablobappendblockfromurlacdestinationfail192599fead09e", "javablobappendblockfromurlacdestinationfail284506b9fe166" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[0].json new file mode 100644 index 000000000000..3d2fb88f0b31 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[0].json @@ -0,0 +1,168 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail082769641bc139181a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C335876B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e16fc-201e-00c4-62fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "a75dcc85-32a4-43bb-9cd7-2ce533f8d50a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail082769641bc139181a/javablobappendblockfromurlacsourcefail15424556c2150db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C33AE30C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1709-201e-00c4-6bfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "78a9bb55-0b46-492f-a81c-6bba5a3e1494" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail082769641bc139181a?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C33FBBAD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e1722-201e-00c4-7ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "fc39f8e7-d913-4321-86e6-1d2c88dc9773" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail082769641bc139181a/javablobappendblockfromurlacsourcefail237792c09abdb86", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C34853D4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1737-201e-00c4-11fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "7b63d56a-7a8b-49f8-aa74-27abc0d25fc1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail082769641bc139181a/javablobappendblockfromurlacsourcefail237792c09abdb86?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "ETag" : "\"0x8D72812C34EE525\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1757-201e-00c4-2dfb-594fb0000000", + "x-ms-client-request-id" : "a19d87d2-0578-4631-a5eb-22d366501f05", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail082769641bc139181a/javablobappendblockfromurlacsourcefail15424556c2150db?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "d51e1767-201e-00c4-38fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "27b42f9e-0196-4009-b080-2a0273303838" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacsourcefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1776-201e-00c4-46fb-594fb0000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail082769641bc139181aFri, 23 Aug 2019 21:42:14 GMT\"0x8D72812C33FBBAD\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "574826a0-0857-46db-9b71-63af146fccc5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail082769641bc139181a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e178b-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "657e5147-e964-4030-be18-502e539996c6" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail082769641bc139181a", "javablobappendblockfromurlacsourcefail15424556c2150db", "javablobappendblockfromurlacsourcefail237792c09abdb86" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[1].json new file mode 100644 index 000000000000..10cc85b2d28d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[1].json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01880898ab080d8c1f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C3652E92\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e17a5-201e-00c4-6ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "5b781a0d-77ac-45e4-9306-c91bc8c4b53f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01880898ab080d8c1f/javablobappendblockfromurlacsourcefail135678d8c0bb4f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C36A8A3B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e17b8-201e-00c4-7ffb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "6ebda43a-acaa-4023-bba9-0d66f7eb1395" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01880898ab080d8c1f?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C36F1450\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e17ca-201e-00c4-11fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "909c974a-f777-49b7-b1b7-5d96cd43b6eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01880898ab080d8c1f/javablobappendblockfromurlacsourcefail276371927b7df09", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C374026F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e17e5-201e-00c4-27fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "97ba687e-951a-4dbb-81b9-c02681e2a45f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01880898ab080d8c1f/javablobappendblockfromurlacsourcefail276371927b7df09?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "ETag" : "\"0x8D72812C37933DF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1802-201e-00c4-41fb-594fb0000000", + "x-ms-client-request-id" : "cb11a488-62be-4b6d-aff1-c1cee6d4ddef", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01880898ab080d8c1f/javablobappendblockfromurlacsourcefail135678d8c0bb4f8?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "d51e1812-201e-00c4-4efb-594fb0000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:d51e1812-201e-00c4-4efb-594fb0000000\nTime:2019-08-23T21:42:15.0616685Z", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "a0df28a5-82e4-44e2-aa1f-713e65d19bbd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacsourcefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e182d-201e-00c4-67fb-594fb0000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail01880898ab080d8c1fFri, 23 Aug 2019 21:42:14 GMT\"0x8D72812C36F1450\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "6c1db9e9-968b-4f82-be7f-628e4a9c6091", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail01880898ab080d8c1f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e184b-201e-00c4-80fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "d20c397b-ea1f-4b0e-9410-63172affecba" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail01880898ab080d8c1f", "javablobappendblockfromurlacsourcefail135678d8c0bb4f8", "javablobappendblockfromurlacsourcefail276371927b7df09" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[2].json new file mode 100644 index 000000000000..b8669c024fc6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[2].json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail077695d098fca54921?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C38FA450\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e186b-201e-00c4-1afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "ce4c129c-35e8-4f0a-8162-7198d080fb7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail077695d098fca54921/javablobappendblockfromurlacsourcefail14682591bd97d8a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C3957558\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1889-201e-00c4-30fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "1f0b5c2a-ae13-4a0d-9b77-5fcbdec3a1f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail077695d098fca54921?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C39A2641\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e189d-201e-00c4-40fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "d152363a-5f8d-4364-88ef-18b2bcbd1e3f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail077695d098fca54921/javablobappendblockfromurlacsourcefail272259f804c848d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C39F62D6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e18aa-201e-00c4-4cfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "4f6517c3-a926-40c0-98fc-663e0a993995" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail077695d098fca54921/javablobappendblockfromurlacsourcefail272259f804c848d?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "ETag" : "\"0x8D72812C3A49442\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e18bd-201e-00c4-5dfb-594fb0000000", + "x-ms-client-request-id" : "11b1876e-407d-4bc6-8fc2-74a27ab631a7", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail077695d098fca54921/javablobappendblockfromurlacsourcefail14682591bd97d8a?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "d51e18ce-201e-00c4-6dfb-594fb0000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:d51e18ce-201e-00c4-6dfb-594fb0000000\nTime:2019-08-23T21:42:15.3429376Z", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "afd8e598-2fe9-4ee9-8c63-c14ce32e6790", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacsourcefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e18e4-201e-00c4-7ffb-594fb0000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail077695d098fca54921Fri, 23 Aug 2019 21:42:15 GMT\"0x8D72812C39A2641\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "b3302dbc-fa13-46a4-ad4a-48d9ae341e3f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail077695d098fca54921?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e18ed-201e-00c4-08fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "413c4bac-b305-427c-949f-8e92e94f7765" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail077695d098fca54921", "javablobappendblockfromurlacsourcefail14682591bd97d8a", "javablobappendblockfromurlacsourcefail272259f804c848d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[3].json new file mode 100644 index 000000000000..f0d25620385f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[3].json @@ -0,0 +1,199 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail0544760875fa096419?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C3B92F86\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1904-201e-00c4-1dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "45034e62-f103-42ca-ba8c-97cc8dbf847e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail0544760875fa096419/javablobappendblockfromurlacsourcefail1129889fabf2414", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C3BE6425\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1910-201e-00c4-27fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "e575c662-726f-46f2-aac3-56596d837d13" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail0544760875fa096419?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C3C314D7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e192b-201e-00c4-3ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "005018f0-e41d-4cc2-91c9-69763e3c98be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail0544760875fa096419/javablobappendblockfromurlacsourcefail299939b94d4a17a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C3C8036B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e193a-201e-00c4-4bfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "ca30f48b-9fdd-4f96-83ef-8986d630a12c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail0544760875fa096419/javablobappendblockfromurlacsourcefail299939b94d4a17a?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "ETag" : "\"0x8D72812C3CCE6A0\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e194d-201e-00c4-5dfb-594fb0000000", + "x-ms-client-request-id" : "fa83343a-da56-4b03-8131-e9216dc211f9", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail0544760875fa096419/javablobappendblockfromurlacsourcefail299939b94d4a17a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C3CCE6A0\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e1963-201e-00c4-6ffb-594fb0000000", + "x-ms-client-request-id" : "e2a7d269-fae4-4f49-b257-3725300ce0ec", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail0544760875fa096419/javablobappendblockfromurlacsourcefail1129889fabf2414?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "d51e1983-201e-00c4-0afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "e3ffab75-3f9f-4132-abf1-123cea504554" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlacsourcefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e199d-201e-00c4-1dfb-594fb0000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail0544760875fa096419Fri, 23 Aug 2019 21:42:15 GMT\"0x8D72812C3C314D7\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "71a1b4ed-0b0b-43cf-bb96-735ba564391a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlacsourcefail0544760875fa096419?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e19ad-201e-00c4-2bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "70ff9556-39a3-41f6-8b1a-4a678e5a3106" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail0544760875fa096419", "javablobappendblockfromurlacsourcefail1129889fabf2414", "javablobappendblockfromurlacsourcefail299939b94d4a17a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[0].json new file mode 100644 index 000000000000..360e70ee29fe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[0].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac09914546a4ab2d913?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF6BF9F7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0785-201e-00c4-6afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "523c09b4-8ad8-4b03-a856-17fe46cc5889" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac09914546a4ab2d913/javablobappendblockfromurldestinationac144761e8763df94", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF71F051\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e07a7-201e-00c4-05fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "750887e2-c648-4671-9063-17b7f48031ab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac09914546a4ab2d913?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF76CF8D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e07bd-201e-00c4-18fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "4b616c03-3608-4975-a7ef-a51e11b5a1a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac09914546a4ab2d913/javablobappendblockfromurldestinationac274602b47e7befa", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF7CC864\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e07d1-201e-00c4-2afb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "348634c3-117b-4883-8307-2f2b7cd1a0e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac09914546a4ab2d913/javablobappendblockfromurldestinationac274602b47e7befa?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "ETag" : "\"0x8D72812BF81F9D9\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e07ec-201e-00c4-40fb-594fb0000000", + "x-ms-client-request-id" : "3e466b41-a7af-4654-8db8-f48be8dd6e87", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac09914546a4ab2d913/javablobappendblockfromurldestinationac144761e8763df94?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812BF8BC049\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0801-201e-00c4-52fb-594fb0000000", + "x-ms-client-request-id" : "0402d9ab-dd98-40da-b493-1fe5a53dfa60", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0828-201e-00c4-75fb-594fb0000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac09914546a4ab2d913Fri, 23 Aug 2019 21:42:08 GMT\"0x8D72812BF76CF8D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "bcdebb5c-66c1-4c0c-bfe6-0b7778f12bc1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac09914546a4ab2d913?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0834-201e-00c4-80fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "9e604f4a-bcc3-4b9d-944e-f19331cce9e6" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac09914546a4ab2d913", "javablobappendblockfromurldestinationac144761e8763df94", "javablobappendblockfromurldestinationac274602b47e7befa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[1].json new file mode 100644 index 000000000000..0b29790d010a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[1].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac030101d8a74465bb9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BFA2597D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0855-201e-00c4-1dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "33593b8a-5489-49d6-8a7f-28391dc99c8c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac030101d8a74465bb9/javablobappendblockfromurldestinationac1117956a547b1f9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BFA7DAA1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0862-201e-00c4-27fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "702c1c39-34fa-4c11-854d-7c217a26ff94" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac030101d8a74465bb9?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BFACB97E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e0873-201e-00c4-35fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "dd88cc91-8f20-458b-8f02-9bfed331d816" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac030101d8a74465bb9/javablobappendblockfromurldestinationac2182717306356ad", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BFB28B9C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0887-201e-00c4-47fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "b4aa8e89-196a-429a-a07d-49d9bf290f86" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac030101d8a74465bb9/javablobappendblockfromurldestinationac2182717306356ad?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "ETag" : "\"0x8D72812BFB8808B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e08a2-201e-00c4-62fb-594fb0000000", + "x-ms-client-request-id" : "9226f921-b9a0-4442-979a-791563afcbbf", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac030101d8a74465bb9/javablobappendblockfromurldestinationac1117956a547b1f9?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812BFC57C04\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e08bb-201e-00c4-7afb-594fb0000000", + "x-ms-client-request-id" : "e2fac55b-8aa4-490d-9caa-a6eb3fa1282a", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e08e4-201e-00c4-1dfb-594fb0000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac030101d8a74465bb9Fri, 23 Aug 2019 21:42:08 GMT\"0x8D72812BFACB97E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "496982b8-087a-45f0-be30-091ab282dcbd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac030101d8a74465bb9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e08f1-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "0a312817-1f3f-4fbf-a8ed-fad4ba90f0b2" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac030101d8a74465bb9", "javablobappendblockfromurldestinationac1117956a547b1f9", "javablobappendblockfromurldestinationac2182717306356ad" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[2].json new file mode 100644 index 000000000000..62aa8eab2736 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[2].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0538115fe179332c2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BFD78041\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e090f-201e-00c4-44fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "abb7f58d-4c0d-4474-8789-36a0dc6e14ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0538115fe179332c2/javablobappendblockfromurldestinationac10313987ba391cb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BFDD9DDE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e093b-201e-00c4-69fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "d56157dd-9675-4fd5-b793-fe48aa620c6c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0538115fe179332c2?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BFE33FDD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e094f-201e-00c4-7cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "9e6208b2-e66d-40b9-a223-d398c686d1ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0538115fe179332c2/javablobappendblockfromurldestinationac2373616bfccb781", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BFE9124E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0968-201e-00c4-14fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "2da5e2dd-d367-45a5-86c4-c250021ad93a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0538115fe179332c2/javablobappendblockfromurldestinationac2373616bfccb781?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "ETag" : "\"0x8D72812BFEE6AD2\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0983-201e-00c4-2afb-594fb0000000", + "x-ms-client-request-id" : "073938fb-6a4c-466f-b020-6316124cca88", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0538115fe179332c2/javablobappendblockfromurldestinationac10313987ba391cb?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812BFF76DBF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e09ae-201e-00c4-50fb-594fb0000000", + "x-ms-client-request-id" : "370ca0fa-105c-4fc8-9d0d-170d985e4ea8", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e09cb-201e-00c4-6bfb-594fb0000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac0538115fe179332c2Fri, 23 Aug 2019 21:42:09 GMT\"0x8D72812BFE33FDD\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "1c452d47-cd89-4f4c-8d72-0d8de8db9b69", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0538115fe179332c2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e09da-201e-00c4-79fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "2b2bf721-b0ea-4aa3-9361-a80d368cd2c5" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac0538115fe179332c2", "javablobappendblockfromurldestinationac10313987ba391cb", "javablobappendblockfromurldestinationac2373616bfccb781" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[3].json new file mode 100644 index 000000000000..2e75bcc4c7b2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[3].json @@ -0,0 +1,205 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac008834033f6c2f827?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C007003E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e09f0-201e-00c4-0dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "4f6e8544-82e6-4c51-905f-f356e151abae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac008834033f6c2f827/javablobappendblockfromurldestinationac179932748f485f6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C00C8187\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0a00-201e-00c4-1bfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "33e4f133-7e77-4358-baea-be3c3ae47f00" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac008834033f6c2f827?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C01138A8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e0a0b-201e-00c4-25fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "9a85fd91-b257-4ed6-9370-8ba36b8cfe4b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac008834033f6c2f827/javablobappendblockfromurldestinationac179932748f485f6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C00C8187\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:09 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0a14-201e-00c4-2cfb-594fb0000000", + "x-ms-client-request-id" : "b8533a38-7c24-41ce-ba09-5824d48bac58", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac008834033f6c2f827/javablobappendblockfromurldestinationac25572822b62e809", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C01AB5D6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0a21-201e-00c4-39fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "f4e20a27-7f45-42f8-8835-e8b29eef5cd9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac008834033f6c2f827/javablobappendblockfromurldestinationac25572822b62e809?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "ETag" : "\"0x8D72812C022A706\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0a49-201e-00c4-5cfb-594fb0000000", + "x-ms-client-request-id" : "a0db3ce8-8646-407e-9b8a-f7286567e0f7", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac008834033f6c2f827/javablobappendblockfromurldestinationac179932748f485f6?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C028EA2B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0a5f-201e-00c4-6efb-594fb0000000", + "x-ms-client-request-id" : "128cbe77-5a24-41c6-89db-7a28abf0b07d", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0a80-201e-00c4-0bfb-594fb0000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac008834033f6c2f827Fri, 23 Aug 2019 21:42:09 GMT\"0x8D72812C01138A8\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "a99e49a1-6b81-4cbb-80ca-0ceb54bd19c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac008834033f6c2f827?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0a94-201e-00c4-1cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "fe76c559-bfe3-43a6-8f71-4d152c4150f4" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac008834033f6c2f827", "javablobappendblockfromurldestinationac179932748f485f6", "javablobappendblockfromurldestinationac25572822b62e809" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[4].json new file mode 100644 index 000000000000..3ad39599ef9b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[4].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0648294789e002b85?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C038F1DE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0ab5-201e-00c4-39fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "3e82f626-d5ac-449c-a0a6-0214b9172a64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0648294789e002b85/javablobappendblockfromurldestinationac13752422528dee5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C03E250A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0ad1-201e-00c4-51fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "671c7b96-208f-4f65-9f61-0928cd5b007f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0648294789e002b85?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C042DBD3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e0ae1-201e-00c4-60fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "1021732c-60c3-48c6-a361-4af3fe9ad5f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0648294789e002b85/javablobappendblockfromurldestinationac2388515adbf0109", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C049C0A3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0aee-201e-00c4-6cfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "bd22a002-8ab1-4dd6-abc5-f87599e2fc33" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0648294789e002b85/javablobappendblockfromurldestinationac2388515adbf0109?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "ETag" : "\"0x8D72812C0513C89\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0b0a-201e-00c4-07fb-594fb0000000", + "x-ms-client-request-id" : "a0a9a4be-56a8-43ff-abfb-bd69fbd04535", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0648294789e002b85/javablobappendblockfromurldestinationac13752422528dee5?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C057A6C1\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0b2d-201e-00c4-27fb-594fb0000000", + "x-ms-client-request-id" : "4da7a7bc-c904-463d-913f-1c8041aedcb3", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0b45-201e-00c4-3dfb-594fb0000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac0648294789e002b85Fri, 23 Aug 2019 21:42:09 GMT\"0x8D72812C042DBD3\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "58f4491e-40a3-4d55-9ec2-7a5e7c1f22b2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac0648294789e002b85?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0b50-201e-00c4-47fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "37321e27-28e0-4876-8967-bce935689c51" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac0648294789e002b85", "javablobappendblockfromurldestinationac13752422528dee5", "javablobappendblockfromurldestinationac2388515adbf0109" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[5].json new file mode 100644 index 000000000000..c63ced91828c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[5].json @@ -0,0 +1,195 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068734c8c721ada0b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C069356B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0b72-201e-00c4-63fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "e087e8c4-3b43-4e62-8ee5-8dd9bb631d4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068734c8c721ada0b/javablobappendblockfromurldestinationac1885591b741adbc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C06EB6D3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0b88-201e-00c4-77fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:08 GMT", + "x-ms-client-request-id" : "fbd52947-6db7-442f-9d96-c039aa3bee1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068734c8c721ada0b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C0739462\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e0ba9-201e-00c4-14fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "fad9c942-b700-4df1-a948-a5023d4e1046" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068734c8c721ada0b/javablobappendblockfromurldestinationac1885591b741adbc?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C06EB6D3\"", + "x-ms-lease-id" : "a7b888fc-144e-4c80-b543-7763fd87cf5d", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0bbf-201e-00c4-27fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "6f602676-5c4f-408e-8579-305252e450d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068734c8c721ada0b/javablobappendblockfromurldestinationac249062e72b7a1c1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C07DFCD3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0bd6-201e-00c4-3dfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "4599c921-fa79-45e9-af15-25ca35a54b1c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068734c8c721ada0b/javablobappendblockfromurldestinationac249062e72b7a1c1?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "ETag" : "\"0x8D72812C08551A5\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0c07-201e-00c4-6bfb-594fb0000000", + "x-ms-client-request-id" : "c90b1d84-c698-4505-8555-2f72f6a7782f", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068734c8c721ada0b/javablobappendblockfromurldestinationac1885591b741adbc?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C09A8C85\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0c2f-201e-00c4-10fb-594fb0000000", + "x-ms-client-request-id" : "e207b6a9-cfa3-4bfb-bca3-4fdb76477ce4", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0c82-201e-00c4-5bfb-594fb0000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac068734c8c721ada0bFri, 23 Aug 2019 21:42:09 GMT\"0x8D72812C0739462\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "d0a43818-6305-4ecc-8bc5-9a9b283d0b70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac068734c8c721ada0b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0c98-201e-00c4-71fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "eb21509f-df68-4208-a77f-2d524c4a85cf" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac068734c8c721ada0b", "javablobappendblockfromurldestinationac1885591b741adbc", "javablobappendblockfromurldestinationac249062e72b7a1c1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[6].json new file mode 100644 index 000000000000..aa3498c1d156 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[6].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac006913616eae33bea?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C0AB0970\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0cb4-201e-00c4-0cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "e1cf81dc-b00c-4e27-84b6-bfa6045234dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac006913616eae33bea/javablobappendblockfromurldestinationac1652834c76f9204", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C0B12756\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0cc6-201e-00c4-1bfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "c33b70d9-7bfc-42c3-a3b0-52d32376b3ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac006913616eae33bea?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C0B6047F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e0cdd-201e-00c4-2cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "2321ecb6-1d49-415d-99ff-09ae7d3f6155" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac006913616eae33bea/javablobappendblockfromurldestinationac2221781ac3333a5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C0BB3BF4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0cef-201e-00c4-3bfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "f16b412b-d62b-4737-9648-2ec30939c93c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac006913616eae33bea/javablobappendblockfromurldestinationac2221781ac3333a5?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "ETag" : "\"0x8D72812C0C06D57\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0d01-201e-00c4-4cfb-594fb0000000", + "x-ms-client-request-id" : "25865cee-8709-463f-81a4-9ff8f50ec5c2", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac006913616eae33bea/javablobappendblockfromurldestinationac1652834c76f9204?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C0C725BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0d14-201e-00c4-5efb-594fb0000000", + "x-ms-client-request-id" : "3d8459a3-85ee-49cf-a0ae-e715887af58f", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0d35-201e-00c4-7cfb-594fb0000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac006913616eae33beaFri, 23 Aug 2019 21:42:10 GMT\"0x8D72812C0B6047F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "7b431c28-0564-4af6-9547-5e7baf77b03a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac006913616eae33bea?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0d43-201e-00c4-09fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "25dffe16-ea15-4e9e-960f-afbc59870e3a" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac006913616eae33bea", "javablobappendblockfromurldestinationac1652834c76f9204", "javablobappendblockfromurldestinationac2221781ac3333a5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[7].json new file mode 100644 index 000000000000..78f0477ccc97 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[7].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac083608579a2f968a8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C0D669C2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0d57-201e-00c4-1bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "204d8a00-9127-435c-bdf8-8dae52137079" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac083608579a2f968a8/javablobappendblockfromurldestinationac12216055988f00b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C0DC398E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0d6d-201e-00c4-30fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "5a1e8f52-2918-498f-811f-5bce58089ca0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac083608579a2f968a8?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C0E11666\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e0d78-201e-00c4-3afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "d71a5179-8cd1-41e3-9f88-db732d2c6dc4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac083608579a2f968a8/javablobappendblockfromurldestinationac217128096ec7148", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C0E62708\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0d87-201e-00c4-49fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "9716b29d-727d-4e05-b1fe-8698adb28498" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac083608579a2f968a8/javablobappendblockfromurldestinationac217128096ec7148?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "ETag" : "\"0x8D72812C0ECB853\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0dbc-201e-00c4-65fb-594fb0000000", + "x-ms-client-request-id" : "fcc359e8-6c60-463b-811d-c1182aa662af", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac083608579a2f968a8/javablobappendblockfromurldestinationac12216055988f00b?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C0F4F7BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0dcf-201e-00c4-74fb-594fb0000000", + "x-ms-client-request-id" : "083844bd-d631-4e27-9247-fe56e7247d92", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0dfc-201e-00c4-14fb-594fb0000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac083608579a2f968a8Fri, 23 Aug 2019 21:42:10 GMT\"0x8D72812C0E11666\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "5968b0fe-7ac8-4115-88f9-25a830f1918e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurldestinationac083608579a2f968a8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0e1d-201e-00c4-2cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:09 GMT", + "x-ms-client-request-id" : "868ac213-442d-4717-a8c3-9b9f0dcdda2e" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac083608579a2f968a8", "javablobappendblockfromurldestinationac12216055988f00b", "javablobappendblockfromurldestinationac217128096ec7148" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5.json new file mode 100644 index 000000000000..e6e4c8614161 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5.json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5081948f3d380efc0c742a6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF122B45\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e063a-201e-00c4-44fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "a1ec52b8-274a-42b2-96b4-5f7617a3c721" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5081948f3d380efc0c742a6/javablobappendblockfromurlmd5190621ac71abdcd71d4d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF175E0A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0652-201e-00c4-56fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "1bb6c660-b427-4e69-8e1b-827b980e6873" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5081948f3d380efc0c742a6?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF1C16B9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e065c-201e-00c4-5efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "14d54473-0bd0-4429-8c82-a2dda8a50f24" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5081948f3d380efc0c742a6/javablobappendblockfromurlmd5190621ac71abdcd71d4d?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Yj/zAeBd1Ow=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "ETag" : "\"0x8D72812BF21C0D3\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0669-201e-00c4-6bfb-594fb0000000", + "x-ms-client-request-id" : "dc4cdaf5-4b95-49ca-88fb-6ebcdc2c7059", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5081948f3d380efc0c742a6/javablobappendblockfromurlmd52386819a41ce668f124e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF276788\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0683-201e-00c4-01fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "e5f35f33-ca12-4b42-bb97-2ca7eee33394" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5081948f3d380efc0c742a6/javablobappendblockfromurlmd52386819a41ce668f124e?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "Content-MD5" : "zKKfiH1sdrtrpbQ2qhVACQ==", + "ETag" : "\"0x8D72812BF2DD1BC\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0697-201e-00c4-14fb-594fb0000000", + "x-ms-client-request-id" : "8f6c7114-f8a2-4831-810f-7fd27b4d9d4c", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlmd5&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e06b2-201e-00c4-2efb-594fb0000000", + "Body" : "jtcappendblockfromurlmd5jtcappendblockfromurlmd5081948f3d380efc0c742a6Fri, 23 Aug 2019 21:42:07 GMT\"0x8D72812BF1C16B9\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "0a928b48-847e-4d80-9769-011727c87313", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5081948f3d380efc0c742a6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e06c9-201e-00c4-43fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "ef54f59d-2c19-4b93-9759-129c432badfd" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlmd5081948f3d380efc0c742a6", "javablobappendblockfromurlmd5190621ac71abdcd71d4d", "5bb94217-41a1-48c3-ba94-689ea3939cb2", "javablobappendblockfromurlmd52386819a41ce668f124e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5fail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5fail.json new file mode 100644 index 000000000000..76c5390b786e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5fail.json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail0936762ce66247e2e549?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF3DD9CF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e06e0-201e-00c4-58fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "bc9e49d7-8359-46b6-9c96-42bfe4425878" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail0936762ce66247e2e549/javablobappendblockfromurlmd5fail135212e3798218e7a9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF435AD3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e06f1-201e-00c4-68fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "283257a4-64e6-4ed5-be9b-f50401c6b0d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail0936762ce66247e2e549?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF481341\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e06ff-201e-00c4-75fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "7ab00b00-1964-401e-907f-961c4f1b5a01" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail0936762ce66247e2e549/javablobappendblockfromurlmd5fail135212e3798218e7a9?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "NQeVCpVA6yM=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "ETag" : "\"0x8D72812BF4CFA1E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e070e-201e-00c4-01fb-594fb0000000", + "x-ms-client-request-id" : "1e59a75a-eb7e-4b74-a4b1-b9cb72dfa30a", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail0936762ce66247e2e549/javablobappendblockfromurlmd5fail270285c836106ce992", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BF5252A9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0721-201e-00c4-11fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "ff8b3c86-bd89-4256-905d-34b338fe506d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail0936762ce66247e2e549/javablobappendblockfromurlmd5fail270285c836106ce992?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "Md5Mismatch", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "d51e0740-201e-00c4-2efb-594fb0000000", + "Body" : "\nMd5MismatchThe MD5 value specified in the request did not match with the MD5 value calculated by the server.\nRequestId:d51e0740-201e-00c4-2efb-594fb0000000\nTime:2019-08-23T21:42:08.1170452Z", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "2c2f0715-0176-4639-9b06-33214ac13df4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlmd5fail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0759-201e-00c4-45fb-594fb0000000", + "Body" : "jtcappendblockfromurlmd5failjtcappendblockfromurlmd5fail0936762ce66247e2e549Fri, 23 Aug 2019 21:42:07 GMT\"0x8D72812BF481341\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "c8827966-bdc9-423a-8a5c-0f0c9a64779a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmd5fail0936762ce66247e2e549?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0763-201e-00c4-4cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:07 GMT", + "x-ms-client-request-id" : "9fa97e3f-cb1f-4890-ad52-c5951bfa2041" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlmd5fail0936762ce66247e2e549", "javablobappendblockfromurlmd5fail135212e3798218e7a9", "197bfc37-2c0a-4d58-b1eb-b6c8ad6a1cf4", "javablobappendblockfromurlmd5fail270285c836106ce992" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmin.json new file mode 100644 index 000000000000..ddcc5af0f784 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmin.json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin085817dab08a4d55004f91?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BE69B448\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e038f-201e-00c4-55fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "5ef47973-a246-410b-b4d0-524115402ce8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin085817dab08a4d55004f91/javablobappendblockfromurlmin132123b883c0edb0124f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BE6F5C03\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e039f-201e-00c4-64fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "cb805eca-2d97-473e-a051-c757e2aa6ee1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin085817dab08a4d55004f91?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BE7883AD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e03b8-201e-00c4-7cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "f7e85a38-f5a2-4021-bd97-951453b1bc51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin085817dab08a4d55004f91/javablobappendblockfromurlmin132123b883c0edb0124f?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6MASCbUMJ/U=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "ETag" : "\"0x8D72812BE7F3E6A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e03c8-201e-00c4-0afb-594fb0000000", + "x-ms-client-request-id" : "b16d8403-c4d6-4f5a-88a2-5b24934c3304", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin085817dab08a4d55004f91/javablobappendblockfromurlmin25501558a255b7d4494f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BE85F6D0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e03e0-201e-00c4-21fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:05 GMT", + "x-ms-client-request-id" : "d602dd31-d3ec-4a52-829b-f0f28f0b96be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin085817dab08a4d55004f91/javablobappendblockfromurlmin25501558a255b7d4494f?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "Content-MD5" : "kjTiztM2IqeeTL5UfVmaXA==", + "ETag" : "\"0x8D72812BEA93EF2\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0415-201e-00c4-51fb-594fb0000000", + "x-ms-client-request-id" : "85eb16e0-9a42-4225-a9ca-fcd6123a5bc7", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0502-201e-00c4-29fb-594fb0000000", + "Body" : "jtcappendblockfromurlminjtcappendblockfromurlmin085817dab08a4d55004f91Fri, 23 Aug 2019 21:42:06 GMT\"0x8D72812BE7883AD\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "432068e7-beeb-4011-9ffd-505f6492245d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlmin085817dab08a4d55004f91?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e051e-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "ab0bd0de-b150-4616-9d33-9bfbfdedac36" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlmin085817dab08a4d55004f91", "javablobappendblockfromurlmin132123b883c0edb0124f", "8104f593-9d73-47e5-8e51-16decc674cbd", "javablobappendblockfromurlmin25501558a255b7d4494f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlrange.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlrange.json new file mode 100644 index 000000000000..1a9ea855b95b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlrange.json @@ -0,0 +1,204 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange0127097cb0f6e7e2af4e6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BECD9779\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0536-201e-00c4-57fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "08f63057-9b00-43aa-b599-bd4b30c097aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange0127097cb0f6e7e2af4e6/javablobappendblockfromurlrange1662772ca2ab14f3324", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BED49F4A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0556-201e-00c4-74fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "2f22a3d1-c54c-439a-b2b1-581d21d85376" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange0127097cb0f6e7e2af4e6?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BED9A6A9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e0569-201e-00c4-05fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "e6721153-2334-485e-bc69-e4876534a910" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange0127097cb0f6e7e2af4e6/javablobappendblockfromurlrange1662772ca2ab14f3324?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "NdDf45blxaU=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "ETag" : "\"0x8D72812BEDF2938\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e0583-201e-00c4-1cfb-594fb0000000", + "x-ms-client-request-id" : "2629231f-2c64-428c-943e-d4233ee2fd8f", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange0127097cb0f6e7e2af4e6/javablobappendblockfromurlrange215562565e7708e4434", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BEE4F700\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e0598-201e-00c4-30fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "5091ad0f-0efc-4f78-b4ad-0c79cab2ae91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange0127097cb0f6e7e2af4e6/javablobappendblockfromurlrange215562565e7708e4434?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "Content-MD5" : "8/Tbpgav/nXFAq2xZ27WTQ==", + "ETag" : "\"0x8D72812BEEF0B96\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e05ac-201e-00c4-41fb-594fb0000000", + "x-ms-client-request-id" : "53260968-e51b-4541-961c-973d7d093be5", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange0127097cb0f6e7e2af4e6/javablobappendblockfromurlrange215562565e7708e4434", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:07 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812BEEF0B96\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:07 GMT", + "Content-Length" : "1024", + "x-ms-request-id" : "d51e05c9-201e-00c4-5dfb-594fb0000000", + "Body" : "[-124, 6, 77, -78, 26, -9, 61, -76, 97, -100, -111, -13, -96, 6, -122, 84, -93, 115, -66, 13, -13, 87, 30, -79, 1, -11, 69, 45, -110, -63, 39, -91, 1, 13, -121, -41, -38, 102, -45, -35, 75, -126, 90, 74, 30, 27, -74, 9, 19, 58, -122, 82, 56, 2, -57, 87, 101, -59, 44, 5, 17, -8, -32, -93, 27, -10, -18, -81, -15, 119, -115, 108, -67, -40, -65, 37, -98, -99, -46, -92, -87, -40, 52, 17, -112, -67, 40, -77, 41, 22, -54, -113, -71, -58, 115, -19, 100, -94, -94, 113, -62, 119, 74, -128, 80, 123, 116, -116, -91, 58, 75, -83, 10, 82, 70, 85, 8, -123, 106, 83, 71, 112, -127, 115, -52, -72, -89, -107, -75, 5, 27, 123, -88, -1, -82, -11, 126, -44, -58, -86, -50, 77, 92, -30, 95, 44, 25, -112, -28, -22, -3, 97, -35, 117, 65, 27, -37, 101, 68, -67, -89, -53, 89, -12, 110, -1, 95, -82, 41, 86, -58, 102, 69, 48, 70, 15, -44, -35, 1, 3, 26, 75, 95, 69, -84, 98, -72, -86, 80, 40, -33, 45, 26, 12, 119, 53, -43, -105, -125, -15, 21, -126, 111, -87, 76, -41, -81, -104, 28, 73, -81, -86, -43, -51, -71, -24, -100, 28, 104, 39, -26, 35, 57, 20, -78, 15, -127, -104, 17, -59, -110, -8, 105, -126, 32, -31, -70, -62, 78, 95, -21, 73, -14, 126, -13, 57, 25, -78, 54, -44, -5, 28, 43, -100, -25, -36, 85, 36, -32, 104, 76, -39, -59, 115, 50, 82, -40, -57, 118, 59, 46, 61, 123, 81, 58, 106, -120, -105, 19, 29, 40, 53, -127, -83, 5, -101, 64, 52, -82, -127, -80, -10, 34, -57, -91, 48, -32, 117, 2, -122, 1, -30, 47, -12, 8, 19, 89, -76, 89, -94, 20, 3, -59, 38, 103, -80, 42, -25, -59, -113, -83, 61, -60, 112, 36, 60, -116, 20, -56, 67, -47, -32, -22, -116, -97, -35, 84, 64, 95, -68, 98, 12, -75, -43, -125, 28, 100, 61, -90, 74, -120, 116, 5, 81, 63, 12, 85, -117, 28, 76, -96, -68, 104, 65, 87, 119, -12, 11, 36, 86, -92, -59, 81, -112, -57, 114, 123, -10, -91, -62, 89, 41, 61, -29, -83, -85, -1, 44, -80, 103, -1, -25, 5, -12, 91, 8, -126, -65, 25, -39, -64, 120, 75, 76, 8, -44, 5, -59, -20, 113, -19, -113, 118, 103, 0, -16, 96, 89, 67, -74, -97, 110, 107, 30, -8, 8, 63, -49, 58, 53, -40, 12, 119, 96, -41, -51, 31, 27, -121, 23, -72, 41, 119, -110, 6, -96, -4, -112, 29, -74, 62, 103, -123, -126, 68, 16, 93, -82, 79, -16, 94, 120, 59, -32, 25, 86, -97, 50, 95, -55, 106, -35, -27, 38, -44, -41, 99, -85, 115, 28, -89, -78, -108, 43, 54, -11, -37, 63, 123, 67, 118, -22, 102, 103, 12, 36, 123, 63, 55, 13, 72, -75, 96, -78, 29, 1, 20, 80, -67, 117, -31, -61, 5, 41, -29, -109, 122, -126, -101, -34, 127, 124, 33, -2, -38, -35, -70, -71, -9, -69, 28, -75, -116, 74, -7, -125, 46, -113, -30, 49, -104, 37, 51, -105, 3, 65, -43, 62, -114, 26, 37, -74, -8, -102, -66, -83, -40, -62, 80, 95, -23, 80, 59, -38, -110, 124, -25, 38, -117, 39, 123, 85, 76, -110, 76, 64, -80, -28, 109, -41, -94, 124, -79, -72, 92, 54, -48, -94, -110, 103, 72, -120, 51, -90, 25, -113, -12, -120, -98, 22, -54, 112, -109, -43, -124, 10, 86, -76, -34, 68, 124, 113, 91, -95, -73, 51, -126, -108, -27, -42, -50, 53, 96, -98, -71, -46, -63, -17, 1, -118, -11, -64, 36, -62, -97, 71, -64, 106, -116, -115, -90, 109, 108, 121, 83, -11, 38, 55, 38, -110, -12, -59, 100, -82, -59, -114, -26, -72, -74, 123, 59, -39, -70, -118, -7, 19, 19, -25, -45, -125, -115, -99, -31, -22, -27, 32, -108, 99, -66, 2, 105, 27, -40, -35, -60, -73, 49, -7, 38, 115, -120, -15, -38, 65, 97, -83, 73, -128, 124, 33, 101, -47, 90, -115, -81, 124, -22, 45, 33, 48, 74, 50, 78, 52, -11, 84, 109, 60, -48, -81, 106, -48, -39, -6, 72, 3, 49, 41, 59, 83, -92, 11, 114, -128, -116, 13, -12, -37, 102, 86, 110, -94, -46, -16, 62, -111, 72, 16, 119, 25, 13, 120, -89, -32, -24, 63, -93, -93, -90, 74, -102, -85, 10, 106, -56, -59, 110, 46, -42, -114, 103, -34, -30, 127, 5, -78, -123, -65, 94, 71, 10, 93, -96, 37, 86, -111, -20, -119, 63, -110, -23, -84, 82, -85, 105, 33, -115, -124, 3, -11, 65, -51, 99, 3, 92, 86, 100, -48, -45, -35, -8, 34, -27, -44, 115, 58, -10, 89, -39, 115, 33, -102, -124, 54, -8, 55, 29, 22, -72, 68, 34, 39, 99, 117, 80, -37, -85, -106, 1, -10, -69, -28, 95, -87, -40, -20, 59, 47, -122, -8, 94, -55, -123, 36, -54, 72, 64, 75, -110, -69, -109, 121, 48, -106, 48, 16, 109, -78, 21, 127, -42, 100, 55, 127, -88, -23, 74, -35, -35, 105, 11, 62, 49, 28, 88, 75, -114, 61, -124, -45, 31, -41, 64, 24, 44, -27, -33, -27, -4, -98, -47, -43, -5, 10, 34, 115, 105, 125, -77, 41, -3, -81, 16, -21, -19, 71, -66, -69, 32, 90, 68, 36, -21, 67, 48, 126, 2, -28, 106, 34, 94, -10, -115, 115, 79, -50, -68, -103, -90, 38, 35, 111, 74, -107, 33, -100, 49, -107, -115, 104, -80, -111, -96, -10, -71, -41, -83, -89, 109, 31, 18, 10, 49, -117, -24, -99, 80, -94, 42, 104, -14, -123, -70, -126, 109, -2, 79, -58, -83, -20, -47, 12, -125, -52, -32, -7, -45, -30, 81, -74, -47, 49, -38, 61, -127, 32, -7, 49, 61, -54, -12, 7, 8, -93, 46, -32, -92, 82, -81, -61, 81, 19, 70, 126, -86, -20, -19, -13, 85, 39, -115, -57, -44, -74]", + "x-ms-client-request-id" : "a0d013db-1590-4aec-83c9-832d97d3a150", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e0622-201e-00c4-2dfb-594fb0000000", + "Body" : "jtcappendblockfromurlrangejtcappendblockfromurlrange0127097cb0f6e7e2af4e6Fri, 23 Aug 2019 21:42:07 GMT\"0x8D72812BED9A6A9\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "c42a4fd6-564a-4aab-84d9-8163b800b301", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlrange0127097cb0f6e7e2af4e6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e062e-201e-00c4-39fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:06 GMT", + "x-ms-client-request-id" : "bf505990-3ffa-4119-89f4-6e0e638a35a6" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlrange0127097cb0f6e7e2af4e6", "javablobappendblockfromurlrange1662772ca2ab14f3324", "f508448f-87f5-4bfc-98fb-bce818ef9832", "javablobappendblockfromurlrange215562565e7708e4434" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[0].json new file mode 100644 index 000000000000..4c73ab71987b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[0].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac0565101dd0ed4cf6cf4d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C24AC711\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e13d2-201e-00c4-42fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "37d4cde9-6c04-42b2-aac9-1d06c329721f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac0565101dd0ed4cf6cf4d/javablobappendblockfromurlsourceac179374015d4603780", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C250979D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e13f4-201e-00c4-5ffb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "dffd1d53-277c-4824-9e2b-2365990fafc7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac0565101dd0ed4cf6cf4d?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C25571C3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e1409-201e-00c4-6ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "38859b02-698d-4f52-b397-f35986cce9ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac0565101dd0ed4cf6cf4d/javablobappendblockfromurlsourceac291446d2f4cb97dd1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C25A8520\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1418-201e-00c4-7cfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "887e37d0-fa7f-4269-a102-81e5c59b407d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac0565101dd0ed4cf6cf4d/javablobappendblockfromurlsourceac291446d2f4cb97dd1?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "ETag" : "\"0x8D72812C25F8F70\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1426-201e-00c4-09fb-594fb0000000", + "x-ms-client-request-id" : "f20bc5db-551d-403a-9738-fbbf19779dd1", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac0565101dd0ed4cf6cf4d/javablobappendblockfromurlsourceac179374015d4603780?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C26BA054\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1439-201e-00c4-17fb-594fb0000000", + "x-ms-client-request-id" : "a67d9635-79b0-4870-820e-9d76410b6dbf", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e145e-201e-00c4-35fb-594fb0000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac0565101dd0ed4cf6cf4dFri, 23 Aug 2019 21:42:13 GMT\"0x8D72812C25571C3\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "e4a181ae-fb73-4ba2-b3e9-47f80d30fb56", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac0565101dd0ed4cf6cf4d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1468-201e-00c4-3efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "5a65343b-fda8-42ac-8ca7-94305a10fed3" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac0565101dd0ed4cf6cf4d", "javablobappendblockfromurlsourceac179374015d4603780", "javablobappendblockfromurlsourceac291446d2f4cb97dd1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[1].json new file mode 100644 index 000000000000..9212868c25af --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[1].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac076465129c57aeb56a41?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C27D06E8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1480-201e-00c4-4ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "966c387d-4ea8-4d9a-ada0-dd67bdc745d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac076465129c57aeb56a41/javablobappendblockfromurlsourceac125357b1658b4cc64", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C2826238\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1490-201e-00c4-5afb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "a81878f1-93e4-46d4-8465-0d35d494aa9e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac076465129c57aeb56a41?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C28714F7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e149e-201e-00c4-67fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "d57c42c8-5113-403e-a8d0-f91ca7dd3f42" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac076465129c57aeb56a41/javablobappendblockfromurlsourceac288161a09c755a357", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C28C28AC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e14ae-201e-00c4-74fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "bfb68311-fbb9-408b-bcec-f4c7173eb272" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac076465129c57aeb56a41/javablobappendblockfromurlsourceac288161a09c755a357?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "ETag" : "\"0x8D72812C29132EF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e14bf-201e-00c4-7efb-594fb0000000", + "x-ms-client-request-id" : "ae081570-6fff-4798-a967-113eb63152d5", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac076465129c57aeb56a41/javablobappendblockfromurlsourceac125357b1658b4cc64?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C29A840B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e14d4-201e-00c4-0dfb-594fb0000000", + "x-ms-client-request-id" : "302a5ea8-cd29-4dac-ae7f-9f31ffcd5e36", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e14f7-201e-00c4-28fb-594fb0000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac076465129c57aeb56a41Fri, 23 Aug 2019 21:42:13 GMT\"0x8D72812C28714F7\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "da96f238-8f4b-4ee1-a2ac-0f80640569d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac076465129c57aeb56a41?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e150a-201e-00c4-37fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "03092aa9-9403-4378-8055-b6ce757973c1" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac076465129c57aeb56a41", "javablobappendblockfromurlsourceac125357b1658b4cc64", "javablobappendblockfromurlsourceac288161a09c755a357" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[2].json new file mode 100644 index 000000000000..7ee09850b41f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[2].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac02298895310b3c99c84b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C2AAB1B3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e151d-201e-00c4-48fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "b2358a74-5508-4ca1-bc55-514998147967" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac02298895310b3c99c84b/javablobappendblockfromurlsourceac1536709920f85d9b9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C2B00D26\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1530-201e-00c4-59fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "794b3b83-e487-4d3f-922e-1b1c099a9e0e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac02298895310b3c99c84b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C2B4E6A6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e1539-201e-00c4-62fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "f0fdef81-c475-4988-98b0-35b4cc352d2c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac02298895310b3c99c84b/javablobappendblockfromurlsourceac24493674faee56293", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C2B9D383\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1548-201e-00c4-6ffb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "e5a1e391-87bc-49c7-9a0f-36f92e275233" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac02298895310b3c99c84b/javablobappendblockfromurlsourceac24493674faee56293?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "ETag" : "\"0x8D72812C2BF04EF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1553-201e-00c4-78fb-594fb0000000", + "x-ms-client-request-id" : "f0c458c3-86e3-4acd-81b5-bc083d63bf55", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac02298895310b3c99c84b/javablobappendblockfromurlsourceac1536709920f85d9b9?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C2C6F627\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e155f-201e-00c4-03fb-594fb0000000", + "x-ms-client-request-id" : "b8783f86-b281-4dcd-8838-9c24ebbdd5ae", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1575-201e-00c4-15fb-594fb0000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac02298895310b3c99c84bFri, 23 Aug 2019 21:42:13 GMT\"0x8D72812C2B4E6A6\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "044b6fec-2f16-4105-80f4-2f95e920f2aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac02298895310b3c99c84b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1586-201e-00c4-24fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:12 GMT", + "x-ms-client-request-id" : "fc85aa81-f849-49c0-90cd-b330874fbed7" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac02298895310b3c99c84b", "javablobappendblockfromurlsourceac1536709920f85d9b9", "javablobappendblockfromurlsourceac24493674faee56293" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[3].json new file mode 100644 index 000000000000..297721a35320 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[3].json @@ -0,0 +1,205 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac07433322cce97bdd494c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C2D6D591\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e159f-201e-00c4-3bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "97675b9e-0049-4f4a-af88-c1616e5efb91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac07433322cce97bdd494c/javablobappendblockfromurlsourceac1192262ed501118a4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C2DC581D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e15b8-201e-00c4-4efb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "01d69a05-e936-4bcd-a9d4-6caaaef979f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac07433322cce97bdd494c?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C2E10A46\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e15cc-201e-00c4-5efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "590c1e81-b41b-42ae-bd7a-f80c34d955e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac07433322cce97bdd494c/javablobappendblockfromurlsourceac2448571746a49130b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C2E61E88\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e15ed-201e-00c4-7bfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "820aa9cb-ecf8-40c5-8e04-ae44ad5b9b67" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac07433322cce97bdd494c/javablobappendblockfromurlsourceac2448571746a49130b?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "ETag" : "\"0x8D72812C2EC136E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1614-201e-00c4-1efb-594fb0000000", + "x-ms-client-request-id" : "c54fbc7c-d075-445f-9b78-6e3cf56a4092", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac07433322cce97bdd494c/javablobappendblockfromurlsourceac2448571746a49130b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C2EC136E\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e1625-201e-00c4-2cfb-594fb0000000", + "x-ms-client-request-id" : "c8b93f42-4396-4b27-89f9-ff105b93e9f5", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac07433322cce97bdd494c/javablobappendblockfromurlsourceac1192262ed501118a4?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C2F6763B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1637-201e-00c4-3afb-594fb0000000", + "x-ms-client-request-id" : "1c1bc676-9abf-470e-8f61-ea8187b72001", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1650-201e-00c4-4dfb-594fb0000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac07433322cce97bdd494cFri, 23 Aug 2019 21:42:14 GMT\"0x8D72812C2E10A46\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "db7ac78e-9c55-4dcd-a16e-f50ed4714472", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac07433322cce97bdd494c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e165c-201e-00c4-58fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "ce466797-1e07-4fd2-8bdc-e3e7eaefd715" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac07433322cce97bdd494c", "javablobappendblockfromurlsourceac1192262ed501118a4", "javablobappendblockfromurlsourceac2448571746a49130b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[4].json new file mode 100644 index 000000000000..69b0ca5ba604 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[4].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac09899932983928dca046?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C3074031\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1674-201e-00c4-6bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "fe60063f-b30f-407f-bf35-9adaf929b2e3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac09899932983928dca046/javablobappendblockfromurlsourceac1652897691421885b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C30C9BC6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1684-201e-00c4-78fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "01cb1320-68b9-48bd-8c8a-2ae908865b73" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac09899932983928dca046?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C31174A2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e1692-201e-00c4-03fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "305dbfc1-6196-40ca-b8e9-a53187866e5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac09899932983928dca046/javablobappendblockfromurlsourceac219758e60ded28888", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C316893A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1699-201e-00c4-09fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "450d953f-f7f7-4d54-aefc-2b4eadee4c27" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac09899932983928dca046/javablobappendblockfromurlsourceac219758e60ded28888?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "ETag" : "\"0x8D72812C31BBAA2\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e16a7-201e-00c4-17fb-594fb0000000", + "x-ms-client-request-id" : "92d92081-be8f-44ff-938a-a8bfd6afdf37", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac09899932983928dca046/javablobappendblockfromurlsourceac1652897691421885b?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C3258108\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e16ba-201e-00c4-27fb-594fb0000000", + "x-ms-client-request-id" : "e04eee7a-3f63-4742-860a-2e2a8a489a41", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockfromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e16db-201e-00c4-44fb-594fb0000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac09899932983928dca046Fri, 23 Aug 2019 21:42:14 GMT\"0x8D72812C31174A2\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "8b56191c-7e19-4c29-94b0-7b98684e0163", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockfromurlsourceac09899932983928dca046?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e16e6-201e-00c4-4ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:13 GMT", + "x-ms-client-request-id" : "553f4b1e-4db7-4c57-a365-47e57176d749" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac09899932983928dca046", "javablobappendblockfromurlsourceac1652897691421885b", "javablobappendblockfromurlsourceac219758e60ded28888" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[0].json new file mode 100644 index 000000000000..e4ba3521b4bf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[0].json @@ -0,0 +1,588 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia4af37022318f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BBE401D7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7992cd-601e-0129-13fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "26744750-2232-4dc0-953b-85ee9875d487" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia4af37022318f/javablobappendblockia1appendblobapitestappendblockia4af157646", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BBEA5CA5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7992f0-601e-0129-35fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "b292d5fe-bad0-4171-8579-70a04d8d6e06" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia4af37022318f/javablobappendblockia1appendblobapitestappendblockia4af157646?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "lambda$null$1", + "fileName" : "AppendBlobClient.java", + "lineNumber" : 172, + "className" : "com.azure.storage.blob.AppendBlobClient", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "MonoCallable.java", + "lineNumber" : 91, + "className" : "reactor.core.publisher.MonoCallable", + "nativeMethod" : false + }, { + "methodName" : "drain", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 402, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 244, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxJust.java", + "lineNumber" : 99, + "className" : "reactor.core.publisher.FluxJust$WeakScalarSubscription", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 162, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 229, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 90, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxJust.java", + "lineNumber" : 70, + "className" : "reactor.core.publisher.FluxJust", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 63, + "className" : "reactor.core.publisher.FluxMapFuseable", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxConcatMap", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "Flux.java", + "lineNumber" : 7921, + "className" : "reactor.core.publisher.Flux", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FluxSubscribeOn.java", + "lineNumber" : 194, + "className" : "reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 84, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 37, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FutureTask.java", + "lineNumber" : 266, + "className" : "java.util.concurrent.FutureTask", + "nativeMethod" : false + }, { + "methodName" : "access$201", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 180, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 293, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "runWorker", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 1149, + "className" : "java.util.concurrent.ThreadPoolExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 624, + "className" : "java.util.concurrent.ThreadPoolExecutor$Worker", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : null, + "localizedMessage" : null, + "suppressed" : [ { + "cause" : null, + "stackTrace" : [ { + "methodName" : "blockingGet", + "fileName" : "BlockingSingleSubscriber.java", + "lineNumber" : 93, + "className" : "reactor.core.publisher.BlockingSingleSubscriber", + "nativeMethod" : false + }, { + "methodName" : "block", + "fileName" : "Mono.java", + "lineNumber" : 1494, + "className" : "reactor.core.publisher.Mono", + "nativeMethod" : false + }, { + "methodName" : "blockWithOptionalTimeout", + "fileName" : "Utility.java", + "lineNumber" : 235, + "className" : "com.azure.storage.common.Utility", + "nativeMethod" : false + }, { + "methodName" : "appendBlockWithResponse", + "fileName" : "AppendBlobClient.java", + "lineNumber" : 179, + "className" : "com.azure.storage.blob.AppendBlobClient", + "nativeMethod" : false + }, { + "methodName" : "appendBlock", + "fileName" : "AppendBlobClient.java", + "lineNumber" : 144, + "className" : "com.azure.storage.blob.AppendBlobClient", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 213, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 56, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite", + "nativeMethod" : false + }, { + "methodName" : "defaultCall", + "fileName" : "CallSiteArray.java", + "lineNumber" : 48, + "className" : "org.codehaus.groovy.runtime.callsite.CallSiteArray", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "AbstractCallSite.java", + "lineNumber" : 113, + "className" : "org.codehaus.groovy.runtime.callsite.AbstractCallSite", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "AbstractCallSite.java", + "lineNumber" : 133, + "className" : "org.codehaus.groovy.runtime.callsite.AbstractCallSite", + "nativeMethod" : false + }, { + "methodName" : "$spock_feature_1_8", + "fileName" : "AppendBlobAPITest.groovy", + "lineNumber" : 186, + "className" : "com.azure.storage.blob.AppendBlobAPITest", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invokeMethod", + "fileName" : "ReflectionUtil.java", + "lineNumber" : 188, + "className" : "org.spockframework.util.ReflectionUtil", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "MethodInfo.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.model.MethodInfo", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatureMethod", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 406, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 324, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 309, + "className" : "org.spockframework.runtime.BaseSpecRunner$6", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 288, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "initializeAndRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 278, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIterations", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 139, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runParameterizedFeature", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 41, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 262, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 246, + "className" : "org.spockframework.runtime.BaseSpecRunner$5", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 238, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatures", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 188, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 98, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.BaseSpecRunner$1", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 76, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 67, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Sputnik.java", + "lineNumber" : 63, + "className" : "org.spockframework.runtime.Sputnik", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 128, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 27, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 290, + "className" : "org.junit.runners.ParentRunner$3", + "nativeMethod" : false + }, { + "methodName" : "schedule", + "fileName" : "ParentRunner.java", + "lineNumber" : 71, + "className" : "org.junit.runners.ParentRunner$1", + "nativeMethod" : false + }, { + "methodName" : "runChildren", + "fileName" : "ParentRunner.java", + "lineNumber" : 288, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "ParentRunner.java", + "lineNumber" : 58, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "evaluate", + "fileName" : "ParentRunner.java", + "lineNumber" : 268, + "className" : "org.junit.runners.ParentRunner$2", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 363, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "JUnitCore.java", + "lineNumber" : 137, + "className" : "org.junit.runner.JUnitCore", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "JUnit4IdeaTestRunner.java", + "lineNumber" : 68, + "className" : "com.intellij.junit4.JUnit4IdeaTestRunner", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "IdeaTestRunner.java", + "lineNumber" : 47, + "className" : "com.intellij.rt.execution.junit.IdeaTestRunner$Repeater", + "nativeMethod" : false + }, { + "methodName" : "prepareStreamsAndStart", + "fileName" : "JUnitStarter.java", + "lineNumber" : 242, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + }, { + "methodName" : "main", + "fileName" : "JUnitStarter.java", + "lineNumber" : 70, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + } ], + "message" : "#block terminated with an error", + "localizedMessage" : "#block terminated with an error", + "suppressed" : [ ] + } ] + }, + "ClassName" : "java.lang.NullPointerException" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6baa9caf-201e-00e6-46fb-592186000000", + "Body" : "jtcappendblockiajtcappendblockia0appendblobapitestappendblockia4af37022318fFri, 23 Aug 2019 21:42:02 GMT\"0x8D72812BBE401D7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "7a36b96d-49ea-4b1a-b857-2ca34a284dd6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia4af37022318f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6baa9ccc-201e-00e6-5afb-592186000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "780e02d9-c53f-424e-bf9b-a4f97e4dd8d1" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockia0appendblobapitestappendblockia4af37022318f", "javablobappendblockia1appendblobapitestappendblockia4af157646" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[1].json new file mode 100644 index 000000000000..8c6622558c46 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[1].json @@ -0,0 +1,594 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia7ca414448f80?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BC13BAFE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6baa9ce9-201e-00e6-72fb-592186000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "0ae57179-a9b0-4cf9-a361-29838e2d97f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia7ca414448f80/javablobappendblockia1appendblobapitestappendblockia7ca63356c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BC19B5B8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6baa9cfa-201e-00e6-80fb-592186000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "74918ef5-6b1b-4551-b99d-ef7a0c415e0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia7ca414448f80/javablobappendblockia1appendblobapitestappendblockia7ca63356c?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "read", + "fileName" : "ByteArrayInputStream.java", + "lineNumber" : 180, + "className" : "java.io.ByteArrayInputStream", + "nativeMethod" : false + }, { + "methodName" : "lambda$null$1", + "fileName" : "AppendBlobClient.java", + "lineNumber" : 172, + "className" : "com.azure.storage.blob.AppendBlobClient", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "MonoCallable.java", + "lineNumber" : 91, + "className" : "reactor.core.publisher.MonoCallable", + "nativeMethod" : false + }, { + "methodName" : "drain", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 402, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 244, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxJust.java", + "lineNumber" : 99, + "className" : "reactor.core.publisher.FluxJust$WeakScalarSubscription", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 162, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 229, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 90, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxJust.java", + "lineNumber" : 70, + "className" : "reactor.core.publisher.FluxJust", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 63, + "className" : "reactor.core.publisher.FluxMapFuseable", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxConcatMap", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "Flux.java", + "lineNumber" : 7921, + "className" : "reactor.core.publisher.Flux", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FluxSubscribeOn.java", + "lineNumber" : 194, + "className" : "reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 84, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 37, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FutureTask.java", + "lineNumber" : 266, + "className" : "java.util.concurrent.FutureTask", + "nativeMethod" : false + }, { + "methodName" : "access$201", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 180, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 293, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "runWorker", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 1149, + "className" : "java.util.concurrent.ThreadPoolExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 624, + "className" : "java.util.concurrent.ThreadPoolExecutor$Worker", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : null, + "localizedMessage" : null, + "suppressed" : [ { + "cause" : null, + "stackTrace" : [ { + "methodName" : "blockingGet", + "fileName" : "BlockingSingleSubscriber.java", + "lineNumber" : 93, + "className" : "reactor.core.publisher.BlockingSingleSubscriber", + "nativeMethod" : false + }, { + "methodName" : "block", + "fileName" : "Mono.java", + "lineNumber" : 1494, + "className" : "reactor.core.publisher.Mono", + "nativeMethod" : false + }, { + "methodName" : "blockWithOptionalTimeout", + "fileName" : "Utility.java", + "lineNumber" : 235, + "className" : "com.azure.storage.common.Utility", + "nativeMethod" : false + }, { + "methodName" : "appendBlockWithResponse", + "fileName" : "AppendBlobClient.java", + "lineNumber" : 179, + "className" : "com.azure.storage.blob.AppendBlobClient", + "nativeMethod" : false + }, { + "methodName" : "appendBlock", + "fileName" : "AppendBlobClient.java", + "lineNumber" : 144, + "className" : "com.azure.storage.blob.AppendBlobClient", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 213, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 56, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite", + "nativeMethod" : false + }, { + "methodName" : "defaultCall", + "fileName" : "CallSiteArray.java", + "lineNumber" : 48, + "className" : "org.codehaus.groovy.runtime.callsite.CallSiteArray", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 58, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "AbstractCallSite.java", + "lineNumber" : 133, + "className" : "org.codehaus.groovy.runtime.callsite.AbstractCallSite", + "nativeMethod" : false + }, { + "methodName" : "$spock_feature_1_8", + "fileName" : "AppendBlobAPITest.groovy", + "lineNumber" : 186, + "className" : "com.azure.storage.blob.AppendBlobAPITest", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invokeMethod", + "fileName" : "ReflectionUtil.java", + "lineNumber" : 188, + "className" : "org.spockframework.util.ReflectionUtil", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "MethodInfo.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.model.MethodInfo", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatureMethod", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 406, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 324, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 309, + "className" : "org.spockframework.runtime.BaseSpecRunner$6", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 288, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "initializeAndRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 278, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIterations", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 139, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runParameterizedFeature", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 41, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 262, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 246, + "className" : "org.spockframework.runtime.BaseSpecRunner$5", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 238, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatures", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 188, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 98, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.BaseSpecRunner$1", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 76, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 67, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Sputnik.java", + "lineNumber" : 63, + "className" : "org.spockframework.runtime.Sputnik", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 128, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 27, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 290, + "className" : "org.junit.runners.ParentRunner$3", + "nativeMethod" : false + }, { + "methodName" : "schedule", + "fileName" : "ParentRunner.java", + "lineNumber" : 71, + "className" : "org.junit.runners.ParentRunner$1", + "nativeMethod" : false + }, { + "methodName" : "runChildren", + "fileName" : "ParentRunner.java", + "lineNumber" : 288, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "ParentRunner.java", + "lineNumber" : 58, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "evaluate", + "fileName" : "ParentRunner.java", + "lineNumber" : 268, + "className" : "org.junit.runners.ParentRunner$2", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 363, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "JUnitCore.java", + "lineNumber" : 137, + "className" : "org.junit.runner.JUnitCore", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "JUnit4IdeaTestRunner.java", + "lineNumber" : 68, + "className" : "com.intellij.junit4.JUnit4IdeaTestRunner", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "IdeaTestRunner.java", + "lineNumber" : 47, + "className" : "com.intellij.rt.execution.junit.IdeaTestRunner$Repeater", + "nativeMethod" : false + }, { + "methodName" : "prepareStreamsAndStart", + "fileName" : "JUnitStarter.java", + "lineNumber" : 242, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + }, { + "methodName" : "main", + "fileName" : "JUnitStarter.java", + "lineNumber" : 70, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + } ], + "message" : "#block terminated with an error", + "localizedMessage" : "#block terminated with an error", + "suppressed" : [ ] + } ] + }, + "ClassName" : "java.lang.IndexOutOfBoundsException" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfaad-201e-00c4-1efb-594fb0000000", + "Body" : "jtcappendblockiajtcappendblockia0appendblobapitestappendblockia7ca414448f80Fri, 23 Aug 2019 21:42:02 GMT\"0x8D72812BC13BAFE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "93d86c22-9188-44e9-b171-b82b63e08163", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia7ca414448f80?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfac7-201e-00c4-36fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "f5c973de-64e9-4869-8cc0-9cb7ba6b280c" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockia0appendblobapitestappendblockia7ca414448f80", "javablobappendblockia1appendblobapitestappendblockia7ca63356c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockmin.json new file mode 100644 index 000000000000..e799173da01b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockmin.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockmin0appendblobapitestappendblockmine3a16335851?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72740128BCBCA\"", + "Last-Modified" : "Thu, 22 Aug 2019 20:34:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec04d2bf-101e-00c7-8028-594cb7000000", + "Date" : "Thu, 22 Aug 2019 20:34:02 GMT", + "x-ms-client-request-id" : "ff23cdf3-3769-4bdb-88c5-3e6a5ceb0b62" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockmin0appendblobapitestappendblockmine3a16335851/javablobappendblockmin1appendblobapitestappendblockmine3a65767", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72740129253C8\"", + "Last-Modified" : "Thu, 22 Aug 2019 20:34:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec04d2d8-101e-00c7-1228-594cb7000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 22 Aug 2019 20:34:03 GMT", + "x-ms-client-request-id" : "d1f2b9d4-d398-4e88-854c-4e8c7d40e2b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockmin0appendblobapitestappendblockmine3a16335851/javablobappendblockmin1appendblobapitestappendblockmine3a65767?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Thu, 22 Aug 2019 20:34:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 22 Aug 2019 20:34:03 GMT", + "ETag" : "\"0x8D7274012A1246F\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec04d30b-101e-00c7-3928-594cb7000000", + "x-ms-client-request-id" : "ea0e33c8-285c-43c0-9ed5-37a16da1057d", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ec04d31b-101e-00c7-4728-594cb7000000", + "Body" : "jtcappendblockminjtcappendblockmin0appendblobapitestappendblockmine3a16335851Thu, 22 Aug 2019 20:34:03 GMT\"0x8D72740128BCBCA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Thu, 22 Aug 2019 20:34:03 GMT", + "x-ms-client-request-id" : "780a8629-0384-4bf9-b64e-c86151495212", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockmin0appendblobapitestappendblockmine3a16335851?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ec04d368-101e-00c7-0928-594cb7000000", + "Date" : "Thu, 22 Aug 2019 20:34:03 GMT", + "x-ms-client-request-id" : "4f5b9840-65f1-477b-a806-ddd82c25ac07" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockmin0appendblobapitestappendblockmine3a16335851", "javablobappendblockmin1appendblobapitestappendblockmine3a65767" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblocknullbody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblocknullbody.json new file mode 100644 index 000000000000..58425c88b98f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblocknullbody.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblocknullbody030833b463d023d9ae44008?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BC5A2988\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfb65-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "6766c8c2-8486-433d-a023-6bb05e777252" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblocknullbody030833b463d023d9ae44008/javablobappendblocknullbody18522523a60a05727841d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BC5FF7B0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51dfb78-201e-00c4-51fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "8fc6047a-f610-4800-b196-ed9d9a7b45d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblocknullbody&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfb8e-201e-00c4-66fb-594fb0000000", + "Body" : "jtcappendblocknullbodyjtcappendblocknullbody030833b463d023d9ae44008Fri, 23 Aug 2019 21:42:03 GMT\"0x8D72812BC5A2988\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "568f8d8c-9021-468e-b636-54f17ca7ee00", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblocknullbody030833b463d023d9ae44008?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51dfba5-201e-00c4-79fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:02 GMT", + "x-ms-client-request-id" : "4364d693-8f74-453f-a8b4-0313ec7f7c0b" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblocknullbody030833b463d023d9ae44008", "javablobappendblocknullbody18522523a60a05727841d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[0].json new file mode 100644 index 000000000000..cb45668840f1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacd9660941813224e73?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA0554DD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798816-601e-0129-0cfb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "9171fa0c-ae15-46cb-9518-78b447e84bad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacd9660941813224e73/javablobcreateac1appendblobapitestcreateacd9657732b3677e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA0BB0F6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798840-601e-0129-2dfb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "b5165348-7af1-4fde-be91-424ce5486b0c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacd9660941813224e73/javablobcreateac1appendblobapitestcreateacd9657732b3677e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA137B20\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798872-601e-0129-5bfb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "50a38dce-57f8-44e1-93dd-8ea60816bb0d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798893-601e-0129-78fb-590061000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateacd9660941813224e73Fri, 23 Aug 2019 21:41:59 GMT\"0x8D72812BA0554DD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "1e452790-f38c-4a97-b60c-9ff339eb188a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacd9660941813224e73?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d7988ab-601e-0129-0ffb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "e4e85e2f-9a56-4079-97c8-c0e13d8a48bb" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateacd9660941813224e73", "javablobcreateac1appendblobapitestcreateacd9657732b3677e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[1].json new file mode 100644 index 000000000000..3696752dd479 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac95277866c0c9b9d04?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA293970\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7988d6-601e-0129-35fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "61b32c7f-60d6-4a12-afc1-1c1c11c0f50f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac95277866c0c9b9d04/javablobcreateac1appendblobapitestcreateac952869130328c7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA2F6E70\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d79890c-601e-0129-67fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "4b3b1b9e-35ee-49e8-8fcb-fdb94fc527a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac95277866c0c9b9d04/javablobcreateac1appendblobapitestcreateac952869130328c7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA34EE05\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798933-601e-0129-08fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "64a01ddd-d03a-431c-b57d-a7c107f38538" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798947-601e-0129-1bfb-590061000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac95277866c0c9b9d04Fri, 23 Aug 2019 21:41:59 GMT\"0x8D72812BA293970\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "678051be-edf8-4351-b86b-34b51c8ee7c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac95277866c0c9b9d04?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798967-601e-0129-39fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "c81ef295-b8d0-49c6-abd8-d1f28c99f5df" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac95277866c0c9b9d04", "javablobcreateac1appendblobapitestcreateac952869130328c7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[2].json new file mode 100644 index 000000000000..0fbd721c2137 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacae404882b1359c5a1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA45F05F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798997-601e-0129-63fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "e444f6df-f494-4d33-a58c-1303a05fa85f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacae404882b1359c5a1/javablobcreateac1appendblobapitestcreateacae4548721111ed", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA4D36F2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7989bd-601e-0129-06fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "c7082010-2f67-41c6-aaa9-e0f84e12c165" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacae404882b1359c5a1/javablobcreateac1appendblobapitestcreateacae4548721111ed", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA541662\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7989e4-601e-0129-29fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "ed35d18f-ee35-4fd4-9d1e-887b7e664538" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798a02-601e-0129-42fb-590061000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateacae404882b1359c5a1Fri, 23 Aug 2019 21:41:59 GMT\"0x8D72812BA45F05F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "c1ee50e6-60ad-43fb-8173-62f3b00862ff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateacae404882b1359c5a1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798a1e-601e-0129-5cfb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "84f2bdba-1fe7-4234-948d-f8ed2b54e0fd" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateacae404882b1359c5a1", "javablobcreateac1appendblobapitestcreateacae4548721111ed" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[3].json new file mode 100644 index 000000000000..9beca5c4261c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[3].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac69d65816af3448177?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA6518E9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798a48-601e-0129-04fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "1fa42c01-1e86-403e-a0e8-b90bfc07b7e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac69d65816af3448177/javablobcreateac1appendblobapitestcreateac69d478637c9f8f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA6B74AD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798a68-601e-0129-1dfb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "71b8a283-4339-4efc-bdbc-c0b1807fd611" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac69d65816af3448177/javablobcreateac1appendblobapitestcreateac69d478637c9f8f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812BA6B74AD\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:41:59 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "6d798a9b-601e-0129-50fb-590061000000", + "x-ms-client-request-id" : "8c859797-1174-44a5-99b1-249487e36bd7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac69d65816af3448177/javablobcreateac1appendblobapitestcreateac69d478637c9f8f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA782201\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798ab3-601e-0129-66fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "1823f424-a2c5-4e58-afaa-354c3266f7c2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798aca-601e-0129-7afb-590061000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac69d65816af3448177Fri, 23 Aug 2019 21:41:59 GMT\"0x8D72812BA6518E9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "9d50b2dc-c209-4492-ad68-55f9da60dc3a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac69d65816af3448177?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798ae3-601e-0129-10fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "06e6d007-0a96-4b4d-b42a-c87263183ab7" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac69d65816af3448177", "javablobcreateac1appendblobapitestcreateac69d478637c9f8f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[4].json new file mode 100644 index 000000000000..31fd04582122 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[4].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac5e7154570f4222afe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA8AD2C5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798b0e-601e-0129-39fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "8dd656b5-80f0-4ff9-897d-3ee183d4eef0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac5e7154570f4222afe/javablobcreateac1appendblobapitestcreateac5e7733849ec12e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA917C9B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798b41-601e-0129-63fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "ba16a696-5cd0-4a7b-a3bc-c0522c887980" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac5e7154570f4222afe/javablobcreateac1appendblobapitestcreateac5e7733849ec12e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BA974A71\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798b62-601e-0129-03fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "13639a6f-5d9c-4ed3-ac1b-26209d7612a6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798b7d-601e-0129-1bfb-590061000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac5e7154570f4222afeFri, 23 Aug 2019 21:42:00 GMT\"0x8D72812BA8AD2C5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "f10b13c7-e16f-4d7e-8806-d074da190806", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac5e7154570f4222afe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798b95-601e-0129-32fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "ebc58a48-373c-4a21-94a5-91e59fafe1f4" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac5e7154570f4222afe", "javablobcreateac1appendblobapitestcreateac5e7733849ec12e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[5].json new file mode 100644 index 000000000000..92e54bf6397b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[5].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac81234402fe49e13ff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BAA9D433\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798bb9-601e-0129-52fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "6ba3f75a-794f-4fbc-a938-c9625cc9395c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac81234402fe49e13ff/javablobcreateac1appendblobapitestcreateac8122206812db51", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BAC2F907\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798c55-601e-0129-59fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "7be00a42-cd7e-4022-87e3-581c0f30808b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac81234402fe49e13ff/javablobcreateac1appendblobapitestcreateac8122206812db51?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BAC2F907\"", + "x-ms-lease-id" : "50824915-4540-411e-899a-556c05bcd695", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798c77-601e-0129-76fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "29d5392e-e223-4bd2-bc1e-3e1e4516d1a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac81234402fe49e13ff/javablobcreateac1appendblobapitestcreateac8122206812db51", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BACE9497\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798c97-601e-0129-12fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "415e4b9b-4009-4011-9d34-3066358fa213" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798cc2-601e-0129-38fb-590061000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac81234402fe49e13ffFri, 23 Aug 2019 21:42:00 GMT\"0x8D72812BAA9D433\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "3f742003-2624-439b-b1d2-2e6f010aa302", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0appendblobapitestcreateac81234402fe49e13ff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798cd9-601e-0129-4efb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "f5e49546-b19d-417f-b5b9-d9d5b7fef6cb" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac81234402fe49e13ff", "javablobcreateac1appendblobapitestcreateac8122206812db51" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[0].json new file mode 100644 index 000000000000..aca65ac3a554 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail2b63445034d5e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BAE05B22\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798cfb-601e-0129-70fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "e0cf5b1e-b3b0-4387-bd7d-21f869da94bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail2b63445034d5e/javablobcreateacfail1appendblobapitestcreateacfail2b61107586", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BAE66831\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798d22-601e-0129-0ffb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "df900ae7-b53e-4877-a870-ae76c9fb36b3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail2b63445034d5e/javablobcreateacfail1appendblobapitestcreateacfail2b61107586", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "6d798d3c-601e-0129-27fb-590061000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:6d798d3c-601e-0129-27fb-590061000000\nTime:2019-08-23T21:42:00.6763199Z", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "d2ae49cf-9cc5-4f80-a683-4f93a906608d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798d66-601e-0129-4bfb-590061000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfail2b63445034d5eFri, 23 Aug 2019 21:42:00 GMT\"0x8D72812BAE05B22\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:59 GMT", + "x-ms-client-request-id" : "e6aac312-2ab3-42ad-a2ba-b1f3b33b8dbe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail2b63445034d5e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798d76-601e-0129-5bfb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "74be1295-74dc-49b1-885d-4f8ca1578980" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfail2b63445034d5e", "javablobcreateacfail1appendblobapitestcreateacfail2b61107586" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[1].json new file mode 100644 index 000000000000..503c3c67a083 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfaile9413821bc4e3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BB197AB1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798e2c-601e-0129-80fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "3a6f1c5e-6940-4e14-a0be-dad751d8418a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfaile9413821bc4e3/javablobcreateacfail1appendblobapitestcreateacfaile94989715d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BB252E5C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798e64-601e-0129-31fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "1be68cbc-d6c3-4ed3-98f3-abaaf7284817" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfaile9413821bc4e3/javablobcreateacfail1appendblobapitestcreateacfaile94989715d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "6d798e93-601e-0129-5bfb-590061000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:6d798e93-601e-0129-5bfb-590061000000\nTime:2019-08-23T21:42:01.0867185Z", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "7e404773-00d4-4017-928d-f95577714430", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798eb6-601e-0129-7efb-590061000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfaile9413821bc4e3Fri, 23 Aug 2019 21:42:00 GMT\"0x8D72812BB197AB1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "c9355a1e-74fa-4047-a516-bc8b6c6753f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfaile9413821bc4e3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798edc-601e-0129-20fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "c52a0d3d-1620-4f11-a196-a7a1d542e7be" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfaile9413821bc4e3", "javablobcreateacfail1appendblobapitestcreateacfaile94989715d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[2].json new file mode 100644 index 000000000000..55d37d6fdafa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail181285762ba23?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BB3BB12B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798f0e-601e-0129-4cfb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "90ae30c5-caf3-490e-af50-d6e50d2fc70a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail181285762ba23/javablobcreateacfail1appendblobapitestcreateacfail181194454d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BB42336E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798f3a-601e-0129-74fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "305d7ad3-8d27-430a-b755-761b67ed7155" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail181285762ba23/javablobcreateacfail1appendblobapitestcreateacfail181194454d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "6d798f73-601e-0129-24fb-590061000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:6d798f73-601e-0129-24fb-590061000000\nTime:2019-08-23T21:42:01.2919173Z", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "c5b4e47c-05d6-47b5-82fc-f17f2d9d5959", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798f8c-601e-0129-3afb-590061000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfail181285762ba23Fri, 23 Aug 2019 21:42:01 GMT\"0x8D72812BB3BB12B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "6e56edb5-a9c0-42a0-b11d-c6030719b86c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail181285762ba23?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798fa3-601e-0129-4ffb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "90f40576-d24c-4483-8ed8-7ee06570bca2" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfail181285762ba23", "javablobcreateacfail1appendblobapitestcreateacfail181194454d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[3].json new file mode 100644 index 000000000000..968c9d0bec4e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[3].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail60180758cc15d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BB5A3D41\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798fc2-601e-0129-6afb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "c420c0ab-6636-4d11-a34a-4fdd92d2ffd4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail60180758cc15d/javablobcreateacfail1appendblobapitestcreateacfail6010415535", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BB6442BE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d799005-601e-0129-20fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "43fd546d-76e5-4360-843a-b7b9ea8d9449" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail60180758cc15d/javablobcreateacfail1appendblobapitestcreateacfail6010415535", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812BB6442BE\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:01 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "6d799025-601e-0129-3dfb-590061000000", + "x-ms-client-request-id" : "8312edc8-6010-4367-b67b-352981672595", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail60180758cc15d/javablobcreateacfail1appendblobapitestcreateacfail6010415535", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "6d799046-601e-0129-5afb-590061000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:6d799046-601e-0129-5afb-590061000000\nTime:2019-08-23T21:42:01.5371554Z", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "dbb16a7b-c7a7-48a7-9cc8-0f28c9919447", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d79905c-601e-0129-6dfb-590061000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfail60180758cc15dFri, 23 Aug 2019 21:42:01 GMT\"0x8D72812BB5A3D41\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "4bdd48b8-0945-4321-b892-14aaeeba4aac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail60180758cc15d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d799075-601e-0129-01fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "6f782788-a7e8-4fde-bc5b-63bdd7a26b9c" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfail60180758cc15d", "javablobcreateacfail1appendblobapitestcreateacfail6010415535" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[4].json new file mode 100644 index 000000000000..ad403068236c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[4].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailc1921082feafd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BB806C5D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d79909e-601e-0129-24fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "277ab02c-67bd-43d4-8466-ff723e4b4785" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailc1921082feafd/javablobcreateacfail1appendblobapitestcreateacfailc197637765", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BB862B05\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7990b9-601e-0129-3cfb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "87e6f78a-ded3-4b4d-bc70-9c3b4dd270ab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailc1921082feafd/javablobcreateacfail1appendblobapitestcreateacfailc197637765?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812BB862B05\"", + "x-ms-lease-id" : "33882a5e-2ed0-4ba2-8f7b-1aa6f0718503", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7990d0-601e-0129-50fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:00 GMT", + "x-ms-client-request-id" : "343ac19a-cea5-4558-889c-ff41e68c931e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailc1921082feafd/javablobcreateacfail1appendblobapitestcreateacfailc197637765", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "6d7990e9-601e-0129-67fb-590061000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:6d7990e9-601e-0129-67fb-590061000000\nTime:2019-08-23T21:42:01.7523644Z", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "77098749-09e3-4510-b73d-b4efcc799ef6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d7990f9-601e-0129-76fb-590061000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfailc1921082feafdFri, 23 Aug 2019 21:42:01 GMT\"0x8D72812BB806C5D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "b9fc7d67-103e-47b0-885c-d68dcb05bd6f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfailc1921082feafd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d79910f-601e-0129-0bfb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:42:01 GMT", + "x-ms-client-request-id" : "09177c85-450f-42c4-b632-bcea96489f6b" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfailc1921082feafd", "javablobcreateacfail1appendblobapitestcreateacfailc197637765" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatedefaults.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatedefaults.json new file mode 100644 index 000000000000..9ca7f9ebe783 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatedefaults.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaults519946763c5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B8BA8130\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d797f1f-601e-0129-22fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:56 GMT", + "x-ms-client-request-id" : "bc4bdfdb-c2e2-4440-81e8-6f6ea2858084" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaults519946763c5/javablobcreatedefaults1appendblobapitestcreatedefaults51901065", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B8DB98DF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d797fe2-601e-0129-4ffb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:56 GMT", + "x-ms-client-request-id" : "fd5c02c8-bd05-47f9-9a5f-c0735de6c247" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaults519946763c5/javablobcreatedefaults1appendblobapitestcreatedefaults51901065", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B8E49BC3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d79801b-601e-0129-04fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:56 GMT", + "x-ms-client-request-id" : "92d664f2-fa7d-47ee-9f7b-749c315581a0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatedefaults&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798072-601e-0129-53fb-590061000000", + "Body" : "jtccreatedefaultsjtccreatedefaults0appendblobapitestcreatedefaults519946763c5Fri, 23 Aug 2019 21:41:56 GMT\"0x8D72812B8BA8130\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:56 GMT", + "x-ms-client-request-id" : "c40e9677-4b7a-46b6-ad2e-9ba53ff3940a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaults519946763c5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d7980f8-601e-0129-49fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:56 GMT", + "x-ms-client-request-id" : "cd139530-a882-4d45-9802-b90aa15940c0" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatedefaults0appendblobapitestcreatedefaults519946763c5", "javablobcreatedefaults1appendblobapitestcreatedefaults51901065" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateerror.json new file mode 100644 index 000000000000..70cfccd63a97 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateerror.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror2d6647750748a7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9391F95\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798299-601e-0129-32fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "b3399829-5ee5-4a9b-b78a-aa0a6926984b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror2d6647750748a7/javablobcreateerror1appendblobapitestcreateerror2d6654263e2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9403FC0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7982d4-601e-0129-64fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "870453e1-b575-4f4c-b033-c4aaf2f77429" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror2d6647750748a7/javablobcreateerror1appendblobapitestcreateerror2d6654263e2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "6d79830d-601e-0129-1afb-590061000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:6d79830d-601e-0129-1afb-590061000000\nTime:2019-08-23T21:41:57.9206415Z", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "767ebe50-a4fe-4d79-b29e-79e5e865770a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798344-601e-0129-4cfb-590061000000", + "Body" : "jtccreateerrorjtccreateerror0appendblobapitestcreateerror2d6647750748a7Fri, 23 Aug 2019 21:41:57 GMT\"0x8D72812B9391F95\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "63dbdc2e-cc27-480d-86ce-2d16bcec424e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror2d6647750748a7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d79835f-601e-0129-64fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "53b3e54a-4972-4fb2-97ea-c1038d19e3b9" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateerror0appendblobapitestcreateerror2d6647750748a7", "javablobcreateerror1appendblobapitestcreateerror2d6654263e2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[0].json new file mode 100644 index 000000000000..6dfdf74fb3f4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[0].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders198607973c3b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B95DC7B4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7983ca-601e-0129-3cfb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "b5edd7e3-28d1-4853-bf0d-a28f67c9ef36" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders198607973c3b/javablobcreateheaders1appendblobapitestcreateheaders19865364e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9689227\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7983fe-601e-0129-65fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "6561fbaa-b202-4d69-bd35-30dadc156fce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders198607973c3b/javablobcreateheaders1appendblobapitestcreateheaders19865364e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B970AA7B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798448-601e-0129-26fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "710147d7-bf86-47d4-8ef3-0110612ae213" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders198607973c3b/javablobcreateheaders1appendblobapitestcreateheaders19865364e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812B970AA7B\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:41:58 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "6d798483-601e-0129-5afb-590061000000", + "x-ms-client-request-id" : "ba012168-928d-4a8f-a885-913ae9036d1b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d7984bf-601e-0129-10fb-590061000000", + "Body" : "jtccreateheadersjtccreateheaders0appendblobapitestcreateheaders198607973c3bFri, 23 Aug 2019 21:41:58 GMT\"0x8D72812B95DC7B4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "3ba32c09-2032-4f0e-b291-058163975a73", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders198607973c3b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d7984f0-601e-0129-3dfb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "561978e7-177e-42f0-9926-659fac7971b4" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0appendblobapitestcreateheaders198607973c3b", "javablobcreateheaders1appendblobapitestcreateheaders19865364e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[1].json new file mode 100644 index 000000000000..13e851866ce5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[1].json @@ -0,0 +1,140 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders59e45422b63f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9982008\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d79856b-601e-0129-2dfb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "55f47d7a-ceb2-4c01-abb7-6b8dd94b3228" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders59e45422b63f/javablobcreateheaders1appendblobapitestcreateheaders59e18224a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B99EA39C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798598-601e-0129-55fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "cdda618d-62ac-4c55-9757-36ad354cdbed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders59e45422b63f/javablobcreateheaders1appendblobapitestcreateheaders59e18224a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9A44A44\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7985b3-601e-0129-6dfb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "aa7b8d18-6dea-4ddd-bf1a-8f8824683d49" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders59e45422b63f/javablobcreateheaders1appendblobapitestcreateheaders59e18224a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "AppendBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:41:58 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "6d7985d9-601e-0129-0efb-590061000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "x-ms-blob-committed-block-count" : "0", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D72812B9A44A44\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "41b2e34d-3b8b-4bb0-abf6-7b2bfebe0713", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798604-601e-0129-30fb-590061000000", + "Body" : "jtccreateheadersjtccreateheaders0appendblobapitestcreateheaders59e45422b63fFri, 23 Aug 2019 21:41:58 GMT\"0x8D72812B9982008\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "687a559c-6d90-44a0-912d-54b78db9d1f7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders59e45422b63f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798621-601e-0129-4afb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "04466ad6-da23-4404-ab15-be6520f83c04" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0appendblobapitestcreateheaders59e45422b63f", "javablobcreateheaders1appendblobapitestcreateheaders59e18224a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[0].json new file mode 100644 index 000000000000..f7bff8481f2f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[0].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadataee744119272?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9BB683D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798648-601e-0129-6bfb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "955aa9ff-4f55-45bc-ae13-c68f527910d1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadataee744119272/javablobcreatemetadata1appendblobapitestcreatemetadataee713374", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9C19D7C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798674-601e-0129-13fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "a49a1d4a-a49d-4929-9c7a-caffc119d2c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadataee744119272/javablobcreatemetadata1appendblobapitestcreatemetadataee713374", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9C855EC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d79869e-601e-0129-3bfb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "79440e83-bcc4-4d14-af9a-8996a38395b0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadataee744119272/javablobcreatemetadata1appendblobapitestcreatemetadataee713374", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812B9C855EC\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:41:58 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "6d7986c9-601e-0129-64fb-590061000000", + "x-ms-client-request-id" : "b66fb255-11e8-4eca-b3b8-ee8d475b2145", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatemetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d7986e9-601e-0129-03fb-590061000000", + "Body" : "jtccreatemetadatajtccreatemetadata0appendblobapitestcreatemetadataee744119272Fri, 23 Aug 2019 21:41:58 GMT\"0x8D72812B9BB683D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "dd5e1423-6fed-45a0-ba1d-956b0ae3c730", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadataee744119272?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d798705-601e-0129-1efb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "66dd505c-5e28-48d1-b8e3-06441bde76d1" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0appendblobapitestcreatemetadataee744119272", "javablobcreatemetadata1appendblobapitestcreatemetadataee713374" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[1].json new file mode 100644 index 000000000000..ef845475fa10 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[1].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata1c198476679?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9E34571\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798744-601e-0129-54fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "08952c17-b501-4050-be8b-637aad671894" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata1c198476679/javablobcreatemetadata1appendblobapitestcreatemetadata1c110304", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9E97A94\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d79876b-601e-0129-78fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "82fefe82-22b5-4b8c-b058-54a5d59d24b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata1c198476679/javablobcreatemetadata1appendblobapitestcreatemetadata1c110304", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9EEABFA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798780-601e-0129-0dfb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "58d5a5d5-b83a-40ef-9b4b-57fdcb6c031e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata1c198476679/javablobcreatemetadata1appendblobapitestcreatemetadata1c110304", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812B9EEABFA\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:41:58 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "6d7987ac-601e-0129-2ffb-590061000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "5fa92194-1287-451a-88a7-6e160dcdc2a1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatemetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d7987d1-601e-0129-4dfb-590061000000", + "Body" : "jtccreatemetadatajtccreatemetadata0appendblobapitestcreatemetadata1c198476679Fri, 23 Aug 2019 21:41:58 GMT\"0x8D72812B9E34571\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "978af2df-1ebd-4aea-b8e1-46538dc2ff95", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata1c198476679?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d7987ee-601e-0129-68fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:58 GMT", + "x-ms-client-request-id" : "e36be220-86d9-4baa-beba-335745416127" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0appendblobapitestcreatemetadata1c198476679", "javablobcreatemetadata1appendblobapitestcreatemetadata1c110304" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemin.json new file mode 100644 index 000000000000..266ec16e3097 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemin.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin560913496b26c71a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B91673C7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d79817a-601e-0129-31fb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:56 GMT", + "x-ms-client-request-id" : "df7d4ea7-9e93-4eab-918f-ea1e1330032b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin560913496b26c71a/javablobcreatemin1appendblobapitestcreatemin5608721101651", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B9211759\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d7981cf-601e-0129-7bfb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:56 GMT", + "x-ms-client-request-id" : "a0b847a6-3f9a-4749-91a9-7f4afa6fbb05" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin560913496b26c71a/javablobcreatemin1appendblobapitestcreatemin5608721101651", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812B92696F7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:41:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d798202-601e-0129-28fb-590061000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:41:56 GMT", + "x-ms-client-request-id" : "de66fa04-b6ed-4ce9-99c9-9254cdfcd3df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d79822a-601e-0129-4dfb-590061000000", + "Body" : "jtccreateminjtccreatemin0appendblobapitestcreatemin560913496b26c71aFri, 23 Aug 2019 21:41:57 GMT\"0x8D72812B91673C7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "e99b69ee-05c0-4300-a1b6-573b03c9b08f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin560913496b26c71a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "6d79824a-601e-0129-6afb-590061000000", + "Date" : "Fri, 23 Aug 2019 21:41:57 GMT", + "x-ms-client-request-id" : "47645bdc-1f6d-4f00-9713-f5df44a14cdc" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemin0appendblobapitestcreatemin560913496b26c71a", "javablobcreatemin1appendblobapitestcreatemin5608721101651" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopy.json new file mode 100644 index 000000000000..d7881a2b966b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopy.json @@ -0,0 +1,209 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopy0blobapitestabortcopya4935034722a2924024?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E4CF2E61\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e9a5c-201e-00c4-26fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:10 GMT", + "x-ms-client-request-id" : "b4a4b1a1-0999-4fd9-8e6b-265ac6a9fa0e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopy0blobapitestabortcopya4935034722a2924024/javablobabortcopy1blobapitestabortcopya49652744ef48667", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E4D5F690\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9a74-201e-00c4-38fb-594fb0000000", + "x-ms-client-request-id" : "2fb605d1-11a7-4053-a6b7-122ef7863b15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopy0blobapitestabortcopya4935034722a2924024/javablobabortcopy1blobapitestabortcopya49652744ef48667", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "h1rQvAqGnCI=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:11 GMT", + "Content-MD5" : "+NsM7W99GzoH97577yyB3w==", + "ETag" : "\"0x8D72812E51978D8\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9a99-201e-00c4-50fb-594fb0000000", + "x-ms-client-request-id" : "22e4b6be-dc00-4551-9754-619732902fe1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopy0blobapitestabortcopya4935034722a2924024?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E54CD44E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e9c63-201e-00c4-3ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:11 GMT", + "x-ms-client-request-id" : "392300fa-3b96-4a19-b29a-5edbd0c55178" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopy2blobapitestabortcopya495152493b4d1d9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E55199AE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d06e875-f01e-0012-03fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:10 GMT", + "x-ms-client-request-id" : "ad2166fc-3c45-4986-91e0-6b4bdae74703" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopy2blobapitestabortcopya495152493b4d1d9/javablobabortcopy3blobapitestabortcopya4992047d15ad1a6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "56e8696d-b5bb-498b-82b0-097555ac7b74", + "ETag" : "\"0x8D72812E5585BDB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "1d06e87e-f01e-0012-0afb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:10 GMT", + "x-ms-client-request-id" : "04980a15-5591-42a2-bdea-68b33b68930b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopy2blobapitestabortcopya495152493b4d1d9/javablobabortcopy3blobapitestabortcopya4992047d15ad1a6?copyid=56e8696d-b5bb-498b-82b0-097555ac7b74&comp=copy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "1d06e895-f01e-0012-1efb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:10 GMT", + "x-ms-client-request-id" : "ad212636-6f0a-45c9-8c29-1963e4efa4d1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopy2blobapitestabortcopya495152493b4d1d9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d06e8ab-f01e-0012-31fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:10 GMT", + "x-ms-client-request-id" : "3cd7cb8e-fdef-4f9b-9989-9dcfc6f41690" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcabortcopy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9cc4-201e-00c4-09fb-594fb0000000", + "Body" : "jtcabortcopyjtcabortcopy0blobapitestabortcopya4935034722a2924024Fri, 23 Aug 2019 21:43:11 GMT\"0x8D72812E54CD44E\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:11 GMT", + "x-ms-client-request-id" : "e3cad0c1-cf9a-4ba9-8baa-92e7a42399c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopy0blobapitestabortcopya4935034722a2924024?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9cce-201e-00c4-12fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:11 GMT", + "x-ms-client-request-id" : "50028a44-e828-4181-b024-591984ec673a" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopy0blobapitestabortcopya4935034722a2924024", "javablobabortcopy1blobapitestabortcopya49652744ef48667", "70fdb11b-668d-4f1b-9c07-4c48ec7215f5", "javablobabortcopy2blobapitestabortcopya495152493b4d1d9", "javablobabortcopy3blobapitestabortcopya4992047d15ad1a6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyerror.json new file mode 100644 index 000000000000..2ceaaef24a48 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerrorc8575987042cfe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E6A7480F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea0e1-201e-00c4-51fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "3d59f750-dd28-49f4-8cee-f07b782d4be5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerrorc8575987042cfe/javablobabortcopyerror1blobapitestabortcopyerrorc8555796d24", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E6AE5F19\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea106-201e-00c4-72fb-594fb0000000", + "x-ms-client-request-id" : "8b9b6563-a613-414f-981e-ebbd2e24b6e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerrorc8575987042cfe/javablobabortcopyerror2blobapitestabortcopyerrorc8541929234?copyid=id&comp=copy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "412", + "StatusCode" : "400", + "x-ms-request-id" : "d51ea127-201e-00c4-0afb-594fb0000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:d51ea127-201e-00c4-0afb-594fb0000000\nTime:2019-08-23T21:43:14.1310353Zcopyididcopyid needs to be valid Guid.", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "b1a3e364-79aa-4d66-8060-e28e080f0e05", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcabortcopyerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea138-201e-00c4-18fb-594fb0000000", + "Body" : "jtcabortcopyerrorjtcabortcopyerror0blobapitestabortcopyerrorc8575987042cfeFri, 23 Aug 2019 21:43:14 GMT\"0x8D72812E6A7480F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "cb7f5ae5-7ab6-4e29-b068-2c8fcdb8f6ec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerrorc8575987042cfe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea14a-201e-00c4-23fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "0e3cb31f-be85-4860-9dd2-6c5ce14cb330" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopyerror0blobapitestabortcopyerrorc8575987042cfe", "javablobabortcopyerror1blobapitestabortcopyerrorc8555796d24", "javablobabortcopyerror2blobapitestabortcopyerrorc8541929234" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopylease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopylease.json new file mode 100644 index 000000000000..0c071354dcf9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopylease.json @@ -0,0 +1,254 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopylease9e5285223c4999?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E604296C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e9eea-201e-00c4-3cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "x-ms-client-request-id" : "f61c822d-5889-4a2f-a498-dd62bd6be4cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopylease9e5285223c4999/javablobabortcopylease1blobapitestabortcopylease9e58265702e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E6099237\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9f04-201e-00c4-4ffb-594fb0000000", + "x-ms-client-request-id" : "a66f8a37-a276-43b6-86a5-d1f03765c725" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopylease9e5285223c4999/javablobabortcopylease1blobapitestabortcopylease9e58265702e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "ittLQiuwPhc=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:13 GMT", + "Content-MD5" : "nIdceyCZT6GEieUlrMT16w==", + "ETag" : "\"0x8D72812E64D1470\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9f34-201e-00c4-74fb-594fb0000000", + "x-ms-client-request-id" : "a4eff794-9f32-40b7-b58f-f6db359ff07a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopylease9e5285223c4999?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E6597B7D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e9ff6-201e-00c4-12fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:13 GMT", + "x-ms-client-request-id" : "0e934008-f252-4e3d-ad79-281fcd63e990" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease9e5595849d2e3a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E65E1B87\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d06ed40-f01e-0012-42fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "x-ms-client-request-id" : "a481ac14-0d2b-420f-ae7c-8e245790d278" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease9e5595849d2e3a/javablobabortcopylease3blobapitestabortcopylease9e563408086", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E663A4D4\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d06ed55-f01e-0012-53fb-59fb37000000", + "x-ms-client-request-id" : "f4cdc0c0-32a8-43d7-b9a4-2965f6e18113" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease9e5595849d2e3a/javablobabortcopylease3blobapitestabortcopylease9e563408086?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E663A4D4\"", + "x-ms-lease-id" : "9c7fb76a-1d94-4835-9eb4-8c5f7adc8a23", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d06ed74-f01e-0012-6efb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "x-ms-client-request-id" : "91027cfb-6a62-43e1-82ee-4d06f326a9e3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease9e5595849d2e3a/javablobabortcopylease3blobapitestabortcopylease9e563408086", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "f55384be-4b8b-41d0-b880-19e6582a82c6", + "ETag" : "\"0x8D72812E672C3BA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "1d06ed91-f01e-0012-07fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "x-ms-client-request-id" : "790e518c-ffc0-4216-8076-cc403585375e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease9e5595849d2e3a/javablobabortcopylease3blobapitestabortcopylease9e563408086?copyid=f55384be-4b8b-41d0-b880-19e6582a82c6&comp=copy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "1d06edb3-f01e-0012-22fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "x-ms-client-request-id" : "3986f883-9ceb-461d-92b7-dee92bfc59b6" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease9e5595849d2e3a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d06edc4-f01e-0012-32fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "x-ms-client-request-id" : "f0204d0e-7a2e-4c7c-91fa-3cede214e8fe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcabortcopylease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea077-201e-00c4-78fb-594fb0000000", + "Body" : "jtcabortcopyleasejtcabortcopylease0blobapitestabortcopylease9e5285223c4999Fri, 23 Aug 2019 21:43:13 GMT\"0x8D72812E6597B7D\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:13 GMT", + "x-ms-client-request-id" : "bce01c37-a404-48e2-a82a-28f693adffbc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopylease9e5285223c4999?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea083-201e-00c4-03fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:13 GMT", + "x-ms-client-request-id" : "3ec44c33-c599-40b5-ace9-65230cd636af" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopylease0blobapitestabortcopylease9e5285223c4999", "javablobabortcopylease1blobapitestabortcopylease9e58265702e", "a9da6487-54a0-40c1-90a8-fde06106d82b", "jtcabortcopylease2blobapitestabortcopylease9e5595849d2e3a", "javablobabortcopylease3blobapitestabortcopylease9e563408086" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyleasefail.json new file mode 100644 index 000000000000..8ef7708e900a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyleasefail.json @@ -0,0 +1,257 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailc84743271a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E3D044DB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e96d6-201e-00c4-2cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "e68bd503-ebf1-46be-8439-84930563921c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailc84743271a/javablobabortcopyleasefail102383a3f8fbaf6124442", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E3D5D3D1\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e96ed-201e-00c4-3ffb-594fb0000000", + "x-ms-client-request-id" : "ccaa86d8-d3a1-43f5-8b5a-4c205f90c33a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailc84743271a/javablobabortcopyleasefail102383a3f8fbaf6124442", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "MblHV1a5das=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "Content-MD5" : "j8JRMZfVP1hT2G3e7yRrvQ==", + "ETag" : "\"0x8D72812E41BA07F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9724-201e-00c4-6ffb-594fb0000000", + "x-ms-client-request-id" : "c2ec4d02-3d34-4bc0-917b-2b99af171c54" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailc84743271a?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E4208FB1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e9827-201e-00c4-5efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "180d8a9e-d88b-4e41-b938-8b60d424298b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail260532e01166b803dd42a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E43A66DA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d06e3f6-f01e-0012-7cfb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "8090df8f-975f-4aa7-891d-71b0ef731478" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail260532e01166b803dd42a/javablobabortcopyleasefail347215ea337870cebb465", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E44FD2BF\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d06e440-f01e-0012-41fb-59fb37000000", + "x-ms-client-request-id" : "7b786cf6-0808-41d2-afdc-d33b1903462e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail260532e01166b803dd42a/javablobabortcopyleasefail347215ea337870cebb465?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E44FD2BF\"", + "x-ms-lease-id" : "d39387c4-4663-4663-80e8-77fac9387beb", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d06e455-f01e-0012-54fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "51b4e60d-81d9-4b6a-a3ee-99112ca8470e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail260532e01166b803dd42a/javablobabortcopyleasefail347215ea337870cebb465", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "44b028d7-4125-464b-961f-69748100d74c", + "ETag" : "\"0x8D72812E4A95353\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "1d06e462-f01e-0012-60fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "7869a851-a8a2-40ba-aff6-ddb0acd6942e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail260532e01166b803dd42a/javablobabortcopyleasefail347215ea337870cebb465?copyid=44b028d7-4125-464b-961f-69748100d74c&comp=copy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "1d06e54f-f01e-0012-34fb-59fb37000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:1d06e54f-f01e-0012-34fb-59fb37000000\nTime:2019-08-23T21:43:10.7436918Z", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "a36c44de-46f5-4948-aa16-4ded3c4e1531", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopyleasefail260532e01166b803dd42a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d06e55f-f01e-0012-43fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "d8a7bee8-17e1-4340-a8e2-2bf79283dd58" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcabortcopyleasefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9a0a-201e-00c4-6ffb-594fb0000000", + "Body" : "jtcabortcopyleasefailjtcabortcopyleasefail0blobapitestabortcopyleasefailc84743271aFri, 23 Aug 2019 21:43:09 GMT\"0x8D72812E4208FB1\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:10 GMT", + "x-ms-client-request-id" : "5f187f00-7a7b-4b35-a205-9e50129f6320", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailc84743271a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9a15-201e-00c4-76fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:10 GMT", + "x-ms-client-request-id" : "530443ba-a884-4bff-b2cd-07009f84df34" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopyleasefail0blobapitestabortcopyleasefailc84743271a", "javablobabortcopyleasefail102383a3f8fbaf6124442", "f28e5a2a-14cf-4ced-8750-5dd485730955", "javablobabortcopyleasefail260532e01166b803dd42a", "javablobabortcopyleasefail347215ea337870cebb465" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopymin.json new file mode 100644 index 000000000000..397cefb12915 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopymin.json @@ -0,0 +1,191 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopymindbd12404f55859c2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E571625B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e9ce8-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "x-ms-client-request-id" : "5e04d109-7cef-4bff-b0b5-4af92767720d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopymindbd12404f55859c2/javablobabortcopymin1blobapitestabortcopymindbd70449390b9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E576F230\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9cef-201e-00c4-2cfb-594fb0000000", + "x-ms-client-request-id" : "153e52c9-a4f4-45b2-8de0-305617ab9ec8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopymindbd12404f55859c2/javablobabortcopymin1blobapitestabortcopymindbd70449390b9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "HFYNvJ7oO/U=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "Content-MD5" : "hqLQ96XkCqMzmCA0DHGo2Q==", + "ETag" : "\"0x8D72812E5D220E7\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9d21-201e-00c4-50fb-594fb0000000", + "x-ms-client-request-id" : "a047fd76-7e71-4a75-ad41-6fa0a6366b1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopymindbd12404f55859c2?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E5D81E9E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e9e74-201e-00c4-57fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "x-ms-client-request-id" : "aca6926b-5cf4-455b-be15-84af3bbed01c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopymin2blobapitestabortcopymindbd95286e023c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E5E06832\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d06eafd-f01e-0012-4afb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:11 GMT", + "x-ms-client-request-id" : "d734cecf-0f49-424b-9236-8bdcb50da1e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopymin2blobapitestabortcopymindbd95286e023c/javablobabortcopymin3blobapitestabortcopymindbd04915f1cb7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "442dfc3d-fd32-4bd4-b64f-c545c9a4ff95", + "ETag" : "\"0x8D72812E5EF69BD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "1d06eb0a-f01e-0012-53fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:11 GMT", + "x-ms-client-request-id" : "96988cd9-7497-41a7-9fcd-aac1197159f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobabortcopymin2blobapitestabortcopymindbd95286e023c/javablobabortcopymin3blobapitestabortcopymindbd04915f1cb7?copyid=442dfc3d-fd32-4bd4-b64f-c545c9a4ff95&comp=copy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "1d06eb40-f01e-0012-80fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:11 GMT", + "x-ms-client-request-id" : "eff82d68-8e97-47f1-8ac8-ad13761c198a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcabortcopymin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9ec0-201e-00c4-1bfb-594fb0000000", + "Body" : "jtcabortcopyminjtcabortcopymin0blobapitestabortcopymindbd12404f55859c2Fri, 23 Aug 2019 21:43:12 GMT\"0x8D72812E5D81E9E\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "x-ms-client-request-id" : "7bda2991-348f-4d8f-a64a-6cf43203516c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopymindbd12404f55859c2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9ed0-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:12 GMT", + "x-ms-client-request-id" : "f99578cd-11d6-4c1d-87df-b75b5c9294ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopymin0blobapitestabortcopymindbd12404f55859c2", "javablobabortcopymin1blobapitestabortcopymindbd70449390b9", "86db8229-5319-4210-9f21-394ca5b5084d", "javablobabortcopymin2blobapitestabortcopymindbd95286e023c", "javablobabortcopymin3blobapitestabortcopymindbd04915f1cb7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[0].json new file mode 100644 index 000000000000..ca8b4bae509d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[0].json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease85579462454876ae?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CC32C44E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3cf9-201e-00c4-51fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "5bf30fd0-d0a8-40a4-82e6-455e88d88bb1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease85579462454876ae/javablobacquirelease1blobapitestacquirelease855869620435b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CC382318\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3d14-201e-00c4-66fb-594fb0000000", + "x-ms-client-request-id" : "ac2aa2ee-043e-4abd-8f2c-0b317b311bf7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease85579462454876ae/javablobacquirelease1blobapitestacquirelease855869620435b?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CC382318\"", + "x-ms-lease-id" : "6ce1e19d-5839-4a9d-a9cd-aab389b2a248", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3d24-201e-00c4-73fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "e34d83ca-29b5-4587-8a05-1db555e823fc" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease85579462454876ae/javablobacquirelease1blobapitestacquirelease855869620435b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CC382318\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "d51e3d38-201e-00c4-04fb-594fb0000000", + "x-ms-client-request-id" : "576a1a22-5021-420c-8946-21cf12e33313", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquirelease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3d4f-201e-00c4-18fb-594fb0000000", + "Body" : "jtcacquireleasejtcacquirelease0blobapitestacquirelease85579462454876aeFri, 23 Aug 2019 21:42:29 GMT\"0x8D72812CC32C44E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "dcee8de8-d0f1-4486-9261-f170ca551f2f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease85579462454876ae?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3d62-201e-00c4-29fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "e5854c3a-dc9b-440f-bfd3-3b5dab885ae7" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0blobapitestacquirelease85579462454876ae", "javablobacquirelease1blobapitestacquirelease855869620435b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[1].json new file mode 100644 index 000000000000..0c701cd8ece3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[1].json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease38b95758d135b5d1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CC5065B6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3d76-201e-00c4-3afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "57d074e4-ecdc-40f1-b662-900b49481042" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease38b95758d135b5d1/javablobacquirelease1blobapitestacquirelease38b37510790de", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CC55EB9F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3d8e-201e-00c4-4dfb-594fb0000000", + "x-ms-client-request-id" : "22901a63-6116-4e40-8753-05755df7fdb6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease38b95758d135b5d1/javablobacquirelease1blobapitestacquirelease38b37510790de?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CC55EB9F\"", + "x-ms-lease-id" : "665a5a5f-f62f-42da-b145-40dbc713ce4d", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3da3-201e-00c4-61fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "c05483a1-17fd-4130-ace8-4f31e867fd51" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease38b95758d135b5d1/javablobacquirelease1blobapitestacquirelease38b37510790de", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CC55EB9F\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-lease-duration" : "fixed", + "Content-Length" : "7", + "x-ms-request-id" : "d51e3dbc-201e-00c4-75fb-594fb0000000", + "x-ms-client-request-id" : "cf58c688-e5a2-4522-9f48-a5de7c4a04bf", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquirelease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3dca-201e-00c4-01fb-594fb0000000", + "Body" : "jtcacquireleasejtcacquirelease0blobapitestacquirelease38b95758d135b5d1Fri, 23 Aug 2019 21:42:29 GMT\"0x8D72812CC5065B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "9b880185-8f46-4bb8-bb06-56ff87b73692", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease38b95758d135b5d1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3ddc-201e-00c4-0ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "3c468796-af17-48c1-9fe6-904e4688e71d" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0blobapitestacquirelease38b95758d135b5d1", "javablobacquirelease1blobapitestacquirelease38b37510790de" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[2].json new file mode 100644 index 000000000000..1466ea3b0012 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[2].json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasea6005710afb21033?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CC709FD4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3e15-201e-00c4-40fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "93cdd403-1b56-4c09-92d6-d5e1c3b00a99" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasea6005710afb21033/javablobacquirelease1blobapitestacquireleasea604772846ef9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CC7673EA\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3e3a-201e-00c4-5dfb-594fb0000000", + "x-ms-client-request-id" : "6ba4d971-128b-4d70-80a6-fce567b2d0d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasea6005710afb21033/javablobacquirelease1blobapitestacquireleasea604772846ef9?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CC7673EA\"", + "x-ms-lease-id" : "4b763d9f-2164-46af-a857-589bb9c96f72", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3e5a-201e-00c4-77fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "ae1a11e9-d2ab-4e97-b142-5191541932be" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasea6005710afb21033/javablobacquirelease1blobapitestacquireleasea604772846ef9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CC7673EA\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "d51e3e72-201e-00c4-0dfb-594fb0000000", + "x-ms-client-request-id" : "c218a1e7-f083-4182-9078-7fce538ae0c2", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquirelease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3e7f-201e-00c4-19fb-594fb0000000", + "Body" : "jtcacquireleasejtcacquirelease0blobapitestacquireleasea6005710afb21033Fri, 23 Aug 2019 21:42:30 GMT\"0x8D72812CC709FD4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "9c52dded-6caf-448b-bd22-b08faa44d903", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasea6005710afb21033?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3e98-201e-00c4-2ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "deb3b7bd-d32e-411e-995d-c003e85e6da6" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0blobapitestacquireleasea6005710afb21033", "javablobacquirelease1blobapitestacquireleasea604772846ef9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[0].json new file mode 100644 index 000000000000..00b5e40c3f70 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[0].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacfd55508419ecc3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CCB97A76\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3f5a-201e-00c4-5cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "283a8e0d-5617-4266-9c93-b9bdca6331d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacfd55508419ecc3/javablobacquireleaseac1blobapitestacquireleaseacfd530989054", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CCBF2785\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3f82-201e-00c4-7efb-594fb0000000", + "x-ms-client-request-id" : "18b9112c-e6e4-42e7-804b-044e7acdaad4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacfd55508419ecc3/javablobacquireleaseac1blobapitestacquireleaseacfd530989054?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CCBF2785\"", + "x-ms-lease-id" : "6dea3a21-b439-49dc-a295-ef946c5583e6", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3fa4-201e-00c4-1cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "2e6a04b6-7fa4-43fd-80d0-71bd6b4c4523" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3fb6-201e-00c4-2bfb-594fb0000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseacfd55508419ecc3Fri, 23 Aug 2019 21:42:30 GMT\"0x8D72812CCB97A76\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "0806d701-c790-4e79-ab5e-f45cfd5dcc75", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseacfd55508419ecc3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3fcc-201e-00c4-3efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "c8cdc8d6-6e92-4faf-8c76-1efc46b90130" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseacfd55508419ecc3", "javablobacquireleaseac1blobapitestacquireleaseacfd530989054" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[1].json new file mode 100644 index 000000000000..2f90b446a7d5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac51d452346d166b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CCD434EB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3fe7-201e-00c4-58fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "f10b2be2-4bae-4770-b413-4f714b16cfa2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac51d452346d166b/javablobacquireleaseac1blobapitestacquireleaseac51d0223214c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CCEAFD49\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e4031-201e-00c4-10fb-594fb0000000", + "x-ms-client-request-id" : "f9beb8ac-cdfc-47a4-a8e4-0d8b1d3b1e10" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac51d452346d166b/javablobacquireleaseac1blobapitestacquireleaseac51d0223214c?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CCEAFD49\"", + "x-ms-lease-id" : "80e1841a-2405-4d30-b5bd-48fdcc4a705c", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e4053-201e-00c4-2dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "f4e4c496-f50a-4add-bd92-69c8a0c64c89" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e4071-201e-00c4-46fb-594fb0000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac51d452346d166bFri, 23 Aug 2019 21:42:30 GMT\"0x8D72812CCD434EB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "47f070f8-3b91-4647-b340-903d16836eb8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac51d452346d166b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e4087-201e-00c4-57fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "a4d20627-214b-4230-b0a9-ea3a90046cf2" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac51d452346d166b", "javablobacquireleaseac1blobapitestacquireleaseac51d0223214c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[2].json new file mode 100644 index 000000000000..b8f3e7e73da8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[2].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseaccc571792bf5e8e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CD02A345\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e40b3-201e-00c4-7cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "ebc63839-b69c-4eb1-b4d4-3c4e57125fab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseaccc571792bf5e8e/javablobacquireleaseac1blobapitestacquireleaseaccc504244e37", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CD0A25BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e40d6-201e-00c4-19fb-594fb0000000", + "x-ms-client-request-id" : "b4fb3d64-8068-4a83-9bf4-e9045a58b3eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseaccc571792bf5e8e/javablobacquireleaseac1blobapitestacquireleaseaccc504244e37?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CD0A25BE\"", + "x-ms-lease-id" : "27293376-d536-486c-9ee7-bdde1982bd3c", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e40f5-201e-00c4-33fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "6fae056f-b6af-4390-b761-8fb22bbb95c4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e4119-201e-00c4-50fb-594fb0000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseaccc571792bf5e8eFri, 23 Aug 2019 21:42:31 GMT\"0x8D72812CD02A345\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "3dfcad3f-fb3d-45fd-917f-fc5b68bd37b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseaccc571792bf5e8e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e4144-201e-00c4-76fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "a63a7f6e-b724-4417-98fd-bddb245c58e6" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseaccc571792bf5e8e", "javablobacquireleaseac1blobapitestacquireleaseaccc504244e37" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[3].json new file mode 100644 index 000000000000..dfea126941ca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[3].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac96d83855a71f01?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CD1FF66E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e4166-201e-00c4-14fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "a94dc5e8-3588-49aa-a4fc-ba2d73e180f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac96d83855a71f01/javablobacquireleaseac1blobapitestacquireleaseac96d41702219", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CD255584\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e4187-201e-00c4-32fb-594fb0000000", + "x-ms-client-request-id" : "8e264940-181e-4c97-a4d2-14e9c4136a62" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac96d83855a71f01/javablobacquireleaseac1blobapitestacquireleaseac96d41702219", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CD255584\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:31 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e41b7-201e-00c4-5bfb-594fb0000000", + "x-ms-client-request-id" : "04ec3333-e7a5-4bf4-990a-4419f47bc3cd", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac96d83855a71f01/javablobacquireleaseac1blobapitestacquireleaseac96d41702219?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CD255584\"", + "x-ms-lease-id" : "936f8985-512e-460f-a443-befb5f970b1c", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e41d6-201e-00c4-75fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "b0e30e67-15f1-471a-b7cc-6c1a9cde1b5d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e41f1-201e-00c4-0efb-594fb0000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac96d83855a71f01Fri, 23 Aug 2019 21:42:31 GMT\"0x8D72812CD1FF66E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "c584366f-79c2-4980-a6c0-7a0043a827dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac96d83855a71f01?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e420b-201e-00c4-26fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "1a6f4aff-cd5f-4ea3-8a42-3217f13dfcf7" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac96d83855a71f01", "javablobacquireleaseac1blobapitestacquireleaseac96d41702219" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[4].json new file mode 100644 index 000000000000..e430c7c46046 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[4].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac940259972a026d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CD42C92A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e4240-201e-00c4-57fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "cacaf6f7-dc07-4c6f-8780-c92ad6c926d3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac940259972a026d/javablobacquireleaseac1blobapitestacquireleaseac9401957317a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CD482869\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e4257-201e-00c4-6cfb-594fb0000000", + "x-ms-client-request-id" : "957118a3-979d-4374-ab77-f2bf2c9df818" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac940259972a026d/javablobacquireleaseac1blobapitestacquireleaseac9401957317a?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CD482869\"", + "x-ms-lease-id" : "89b0cb1f-9eb1-4ef2-8bd8-412692d35f20", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e4270-201e-00c4-03fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "592f67ed-730b-4d7f-9a5a-7b88d415b172" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e4282-201e-00c4-12fb-594fb0000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac940259972a026dFri, 23 Aug 2019 21:42:31 GMT\"0x8D72812CD42C92A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "6daa959f-3b62-4cf5-9331-75cc3ef19079", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac940259972a026d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e4292-201e-00c4-22fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "be8bc96a-9c24-45af-9699-e11412742dfa" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac940259972a026d", "javablobacquireleaseac1blobapitestacquireleaseac9401957317a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[0].json new file mode 100644 index 000000000000..d4296000e57d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[0].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailbff174771a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CD5B8763\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e42ae-201e-00c4-3afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "edc043c8-ff7f-4422-8136-d492609a0434" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailbff174771a/javablobacquireleaseacfail1354168905dcd705ff43d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CD624687\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e42c4-201e-00c4-4efb-594fb0000000", + "x-ms-client-request-id" : "0784dff9-224a-4321-8ab7-dc78b797a8bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailbff174771a/javablobacquireleaseacfail1354168905dcd705ff43d?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e42de-201e-00c4-62fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e42de-201e-00c4-62fb-594fb0000000\nTime:2019-08-23T21:42:31.6835339Z", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "63e9b687-931f-42dd-95d9-6b69d48668b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e42ec-201e-00c4-70fb-594fb0000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfailbff174771aFri, 23 Aug 2019 21:42:31 GMT\"0x8D72812CD5B8763\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "a1dc2d19-df5a-4d05-8d59-16d7bf4b8c29", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailbff174771a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e42f7-201e-00c4-7bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "0850d33b-dab5-4b43-a31d-22033a0d4ff7" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfailbff174771a", "javablobacquireleaseacfail1354168905dcd705ff43d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[1].json new file mode 100644 index 000000000000..f07843548ab8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailba7411827b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CD75CC83\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e430a-201e-00c4-0cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "4c691ae5-a0cb-4d02-b16c-235fdbebee0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailba7411827b/javablobacquireleaseacfail10171250bae8d4e78542c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CD7B52FE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e4325-201e-00c4-22fb-594fb0000000", + "x-ms-client-request-id" : "59884a4d-3f7b-43a3-bd48-739f7f1ea249" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailba7411827b/javablobacquireleaseacfail10171250bae8d4e78542c?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e4342-201e-00c4-39fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e4342-201e-00c4-39fb-594fb0000000\nTime:2019-08-23T21:42:31.8486912Z", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "81e31f21-8554-4296-9221-d723e25fe4be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e434f-201e-00c4-43fb-594fb0000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfailba7411827bFri, 23 Aug 2019 21:42:31 GMT\"0x8D72812CD75CC83\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "1345951d-f36f-4576-9d53-d911337f2c25", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailba7411827b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e4360-201e-00c4-52fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "c52027a7-9526-45f9-b341-559694613ae4" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfailba7411827b", "javablobacquireleaseacfail10171250bae8d4e78542c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[2].json new file mode 100644 index 000000000000..7a077b67c290 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[2].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfaild0c444592e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CD8EB1CA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e437b-201e-00c4-6cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:30 GMT", + "x-ms-client-request-id" : "964c4306-8bc4-4398-b67e-1d80a7d90756" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfaild0c444592e/javablobacquireleaseacfail1649534b2e3822f04e4f6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CD941135\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e4396-201e-00c4-04fb-594fb0000000", + "x-ms-client-request-id" : "a9f186d5-ac26-4cc1-b1e5-dd8c7b2ac423" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfaild0c444592e/javablobacquireleaseacfail1649534b2e3822f04e4f6?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e43ba-201e-00c4-21fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e43ba-201e-00c4-21fb-594fb0000000\nTime:2019-08-23T21:42:32.0048405Z", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "aef54ed5-2207-48ef-b047-25c38a37f7ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e43d3-201e-00c4-33fb-594fb0000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfaild0c444592eFri, 23 Aug 2019 21:42:31 GMT\"0x8D72812CD8EB1CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "c24c1f7f-0a34-4bab-8dfe-0e956f47e0b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfaild0c444592e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e43e6-201e-00c4-43fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "55f533b7-1f81-4f79-93a2-f926073a4e92" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfaild0c444592e", "javablobacquireleaseacfail1649534b2e3822f04e4f6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[3].json new file mode 100644 index 000000000000..be08736e07ad --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[3].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailb3170711b0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CDA721C6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e4403-201e-00c4-5bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "68b811cc-8bf3-4262-aa29-ea3b16798ac0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailb3170711b0/javablobacquireleaseacfail144762c491b73d335445f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CDAD1D97\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e4415-201e-00c4-68fb-594fb0000000", + "x-ms-client-request-id" : "cfc88282-8bc1-419c-9d14-e5241f302435" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailb3170711b0/javablobacquireleaseacfail144762c491b73d335445f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CDAD1D97\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:32 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e4431-201e-00c4-80fb-594fb0000000", + "x-ms-client-request-id" : "52535656-ab2c-40fd-a9b3-172aa697e8f8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailb3170711b0/javablobacquireleaseacfail144762c491b73d335445f?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e444b-201e-00c4-1afb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e444b-201e-00c4-1afb-594fb0000000\nTime:2019-08-23T21:42:32.2010272Z", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "c9977e93-2b88-4cd4-baaa-be97cf445373", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e4461-201e-00c4-2ffb-594fb0000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfailb3170711b0Fri, 23 Aug 2019 21:42:32 GMT\"0x8D72812CDA721C6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "51e71f3f-3513-42e4-98ac-f6183545a387", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailb3170711b0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e4473-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "e9dcdb01-1066-4a47-ae11-62dad2e6b41e" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfailb3170711b0", "javablobacquireleaseacfail144762c491b73d335445f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseerror.json new file mode 100644 index 000000000000..1196fab54828 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerrorb43019734e2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CDC4EA30\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e449a-201e-00c4-66fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "e10622cb-eb18-447c-949d-3dea2f4b7b6d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerrorb43019734e2/javablobacquireleaseerror1blobapitestacquireleaseerrorb4358406", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CDCA70CF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e44b5-201e-00c4-7dfb-594fb0000000", + "x-ms-client-request-id" : "4d66b108-ca0a-4da7-9f0f-af71da672aa4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerrorb43019734e2/javablobacquireleaseerror2blobapitestacquireleaseerrorb4352986?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e44e1-201e-00c4-22fb-594fb0000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:d51e44e1-201e-00c4-22fb-594fb0000000\nTime:2019-08-23T21:42:32.3952124Z", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "291d46ec-8e42-4617-ad56-6f27256851ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e44f2-201e-00c4-33fb-594fb0000000", + "Body" : "jtcacquireleaseerrorjtcacquireleaseerror0blobapitestacquireleaseerrorb43019734e2Fri, 23 Aug 2019 21:42:32 GMT\"0x8D72812CDC4EA30\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "4eef1114-9169-4d1f-bad0-9e0dd1bf56e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerrorb43019734e2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e4503-201e-00c4-44fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "5902c758-e532-4e57-9a1f-30158d7d8445" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseerror0blobapitestacquireleaseerrorb43019734e2", "javablobacquireleaseerror1blobapitestacquireleaseerrorb4358406", "javablobacquireleaseerror2blobapitestacquireleaseerrorb4352986" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleasemin.json new file mode 100644 index 000000000000..531722099e4d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleasemin.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleasemin2b40585344f53?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CC94F99A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3ec6-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "075bdbd1-8488-4f61-8531-0fad266279f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleasemin2b40585344f53/javablobacquireleasemin1blobapitestacquireleasemin2b4048313f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CCA3D0A1\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3f13-201e-00c4-19fb-594fb0000000", + "x-ms-client-request-id" : "5c0a2e68-b996-4de2-a8b5-94529d0d4f21" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleasemin2b40585344f53/javablobacquireleasemin1blobapitestacquireleasemin2b4048313f?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CCA3D0A1\"", + "x-ms-lease-id" : "70da0f51-b20d-4e36-a6f3-9d08c882fc8f", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3f2a-201e-00c4-2ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "b62a63cd-7dc4-4582-9c5f-c0ee5e70efc2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleasemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3f39-201e-00c4-3efb-594fb0000000", + "Body" : "jtcacquireleaseminjtcacquireleasemin0blobapitestacquireleasemin2b40585344f53Fri, 23 Aug 2019 21:42:30 GMT\"0x8D72812CC94F99A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "0c16fc77-5a39-4d58-b382-c8f2b1ae26f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleasemin2b40585344f53?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3f4e-201e-00c4-50fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:29 GMT", + "x-ms-client-request-id" : "128b2375-1133-472d-afc6-56eeb9bfbdef" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleasemin0blobapitestacquireleasemin2b40585344f53", "javablobacquireleasemin1blobapitestacquireleasemin2b4048313f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestblobdeleteerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestblobdeleteerror.json new file mode 100644 index 000000000000..37c4e8e4891d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestblobdeleteerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrore4f7201752027?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ED718ACE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb7b5-201e-00c4-60fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "16d22e92-cee1-4719-9426-b35df82488a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrore4f7201752027/javablobblobdeleteerror1blobapitestblobdeleteerrore4f9522209", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812ED78565E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb7c8-201e-00c4-72fb-594fb0000000", + "x-ms-client-request-id" : "98360cf8-6d01-465a-9716-c57d32d66687" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrore4f7201752027/javablobblobdeleteerror2blobapitestblobdeleteerrore4f6111107", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb7e1-201e-00c4-08fb-594fb0000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:d51eb7e1-201e-00c4-08fb-594fb0000000\nTime:2019-08-23T21:43:25.5168941Z", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "1e96fcc9-45ff-4dd7-b7c8-158318c5f6ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobdeleteerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb7eb-201e-00c4-12fb-594fb0000000", + "Body" : "jtcblobdeleteerrorjtcblobdeleteerror0blobapitestblobdeleteerrore4f7201752027Fri, 23 Aug 2019 21:43:25 GMT\"0x8D72812ED718ACE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "1db553d5-1367-4c29-bccb-9d8e12e9e5f6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrore4f7201752027?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb7f8-201e-00c4-1efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "d4cb61d1-673d-4630-a1b6-6ee05027c798" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobdeleteerror0blobapitestblobdeleteerrore4f7201752027", "javablobblobdeleteerror1blobapitestblobdeleteerrore4f9522209", "javablobblobdeleteerror2blobapitestblobdeleteerrore4f6111107" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[0].json new file mode 100644 index 000000000000..f8aa991ec309 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[0].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease66493738f83692565c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DA8AF0F6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7543-201e-00c4-64fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "50302840-a412-44d0-8ed7-6c50fbcfb582" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease66493738f83692565c/javablobbreaklease1blobapitestbreaklease66458790cf335de", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DA90A39B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7559-201e-00c4-77fb-594fb0000000", + "x-ms-client-request-id" : "702e0702-f1bd-4f71-829d-f20576aeabe4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease66493738f83692565c/javablobbreaklease1blobapitestbreaklease66458790cf335de?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DA90A39B\"", + "x-ms-lease-id" : "4d4873f6-a085-4ab2-9403-35bbfdb1350d", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e756c-201e-00c4-06fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "c3cc7abf-c667-49ba-9d03-2d9671a57a41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease66493738f83692565c/javablobbreaklease1blobapitestbreaklease66458790cf335de?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DA90A39B\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51e757a-201e-00c4-13fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "72d38bba-846b-43ba-8307-da908e31ec65" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease66493738f83692565c/javablobbreaklease1blobapitestbreaklease66458790cf335de", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "broken", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DA90A39B\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:53 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e7580-201e-00c4-19fb-594fb0000000", + "x-ms-client-request-id" : "31536ea1-9e11-4ebb-901c-80884a249092", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreaklease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7591-201e-00c4-27fb-594fb0000000", + "Body" : "jtcbreakleasejtcbreaklease0blobapitestbreaklease66493738f83692565cFri, 23 Aug 2019 21:42:53 GMT\"0x8D72812DA8AF0F6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "1b4f6293-ca99-4134-b0f0-2aca3566c036", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease66493738f83692565c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e759b-201e-00c4-31fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "df521209-bdad-46e6-a27e-f0606d91a129" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0blobapitestbreaklease66493738f83692565c", "javablobbreaklease1blobapitestbreaklease66458790cf335de", "4d4873f6-a085-4ab2-9403-35bbfdb1350d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[1].json new file mode 100644 index 000000000000..0e83eac58105 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[1].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb1110847b6fc9e39a5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DAAE6013\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e75a3-201e-00c4-38fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "622e0633-5999-4a0f-967b-7a3096280c11" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb1110847b6fc9e39a5/javablobbreaklease1blobapitestbreakleaseb1152559e5eec6e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DAB4881D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e75ab-201e-00c4-3ffb-594fb0000000", + "x-ms-client-request-id" : "132549d0-64c3-4e7c-9769-984ec8878931" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb1110847b6fc9e39a5/javablobbreaklease1blobapitestbreakleaseb1152559e5eec6e?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DAB4881D\"", + "x-ms-lease-id" : "92cafa1f-1e92-4228-a36e-d5ef70432487", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e75c5-201e-00c4-55fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "68c1d98b-8bc1-4c71-8c4f-30e5726c5e8b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb1110847b6fc9e39a5/javablobbreaklease1blobapitestbreakleaseb1152559e5eec6e?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DAB4881D\"", + "x-ms-lease-time" : "20", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51e75db-201e-00c4-68fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "d212ddfd-f4da-4d9f-96e3-b393092e480b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb1110847b6fc9e39a5/javablobbreaklease1blobapitestbreakleaseb1152559e5eec6e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "breaking", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DAB4881D\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:54 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e75f3-201e-00c4-7dfb-594fb0000000", + "x-ms-client-request-id" : "2745ebcc-6272-4f4e-b479-abf82412c8fb", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreaklease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7602-201e-00c4-0afb-594fb0000000", + "Body" : "jtcbreakleasejtcbreaklease0blobapitestbreakleaseb1110847b6fc9e39a5Fri, 23 Aug 2019 21:42:53 GMT\"0x8D72812DAAE6013\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "881d940f-8941-4718-8591-edd6266aa9c5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleaseb1110847b6fc9e39a5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e760f-201e-00c4-16fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "d303495a-cfba-4da2-835b-effddf15f82a" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0blobapitestbreakleaseb1110847b6fc9e39a5", "javablobbreaklease1blobapitestbreakleaseb1152559e5eec6e", "92cafa1f-1e92-4228-a36e-d5ef70432487" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[2].json new file mode 100644 index 000000000000..b9fbbc7ce16f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[2].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasef0f320645c09a3c667?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DAD10BC6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7626-201e-00c4-29fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "68cb7021-3ca4-4552-bafe-05a3c29d64c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasef0f320645c09a3c667/javablobbreaklease1blobapitestbreakleasef0f4374709bb320", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DAD6BE84\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7633-201e-00c4-33fb-594fb0000000", + "x-ms-client-request-id" : "878ff518-d111-4c33-9036-f6cee0e6cce2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasef0f320645c09a3c667/javablobbreaklease1blobapitestbreakleasef0f4374709bb320?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DAD6BE84\"", + "x-ms-lease-id" : "899a8dca-5cb6-48dd-9114-5549418c3918", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e763e-201e-00c4-3cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "b4d1bd75-f9fb-42aa-a681-dcb130201db8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasef0f320645c09a3c667/javablobbreaklease1blobapitestbreakleasef0f4374709bb320?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DAD6BE84\"", + "x-ms-lease-time" : "15", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51e764b-201e-00c4-47fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "f0c3bb60-da93-41b4-93c9-1c4398679e44" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasef0f320645c09a3c667/javablobbreaklease1blobapitestbreakleasef0f4374709bb320", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "breaking", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DAD6BE84\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:54 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e765c-201e-00c4-57fb-594fb0000000", + "x-ms-client-request-id" : "f0b2471e-61f8-40c9-bfb1-7e848fa34b21", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreaklease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7667-201e-00c4-60fb-594fb0000000", + "Body" : "jtcbreakleasejtcbreaklease0blobapitestbreakleasef0f320645c09a3c667Fri, 23 Aug 2019 21:42:54 GMT\"0x8D72812DAD10BC6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "bc03341a-6036-4d9b-94db-ff99e69719de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0blobapitestbreakleasef0f320645c09a3c667?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e766d-201e-00c4-65fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "3c420700-d9ee-48e9-a1db-ed92a8064b1b" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0blobapitestbreakleasef0f320645c09a3c667", "javablobbreaklease1blobapitestbreakleasef0f4374709bb320", "899a8dca-5cb6-48dd-9114-5549418c3918" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[0].json new file mode 100644 index 000000000000..bcb4649b34c2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[0].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac35f31111c780d138?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DB152A43\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e76c7-201e-00c4-38fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "7da71b90-c560-4389-9c07-47c97462a8b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac35f31111c780d138/javablobbreakleaseac1blobapitestbreakleaseac35f53343b1cea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DB1BA09D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e76d4-201e-00c4-42fb-594fb0000000", + "x-ms-client-request-id" : "d236b30f-1600-4f6a-bdac-157ed70f3c5b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac35f31111c780d138/javablobbreakleaseac1blobapitestbreakleaseac35f53343b1cea?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DB1BA09D\"", + "x-ms-lease-id" : "f1710955-1aa9-4cc6-9a75-de2e2620df60", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e76dc-201e-00c4-4afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "fdac5a7b-b46a-4bd5-b475-61c293e08c3a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac35f31111c780d138/javablobbreakleaseac1blobapitestbreakleaseac35f53343b1cea?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DB1BA09D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51e76e1-201e-00c4-4ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "fc287136-164a-432d-b5c6-861d291fd09c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e76e7-201e-00c4-55fb-594fb0000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseac35f31111c780d138Fri, 23 Aug 2019 21:42:54 GMT\"0x8D72812DB152A43\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "701378a9-05f4-461c-b6ba-e9336a3b4cd8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac35f31111c780d138?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e76f1-201e-00c4-5dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "b70279c3-d2bd-4d66-acdd-c7fcfb16dc76" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseac35f31111c780d138", "javablobbreakleaseac1blobapitestbreakleaseac35f53343b1cea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[1].json new file mode 100644 index 000000000000..89beae35ac25 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseace851746088e7e79f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DB4B147F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7732-201e-00c4-18fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "0dca7dc1-a3c3-47da-b29d-cade1423376b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseace851746088e7e79f/javablobbreakleaseac1blobapitestbreakleaseace8556603a4400", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DB520037\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7748-201e-00c4-29fb-594fb0000000", + "x-ms-client-request-id" : "707233bf-e3a9-4a85-99cc-d37af7ab5ece" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseace851746088e7e79f/javablobbreakleaseac1blobapitestbreakleaseace8556603a4400?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DB520037\"", + "x-ms-lease-id" : "e37b7ad2-05e4-4230-b474-cb238ed867de", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7766-201e-00c4-45fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "eebda213-becb-425c-922b-f518966b6885" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseace851746088e7e79f/javablobbreakleaseac1blobapitestbreakleaseace8556603a4400?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DB520037\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51e7797-201e-00c4-6efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "f1748161-4df1-474d-90c7-cfbf61f929a0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e77a4-201e-00c4-7afb-594fb0000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseace851746088e7e79fFri, 23 Aug 2019 21:42:54 GMT\"0x8D72812DB4B147F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "68acb37f-8f0e-4baf-973e-9cf8acb7e032", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseace851746088e7e79f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e77ac-201e-00c4-01fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "5ce2bb15-7845-4d85-a9db-813f99930543" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseace851746088e7e79f", "javablobbreakleaseac1blobapitestbreakleaseace8556603a4400" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[2].json new file mode 100644 index 000000000000..e98cfdfa3f8e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseaca6b2232901baaeef?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DB74033E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e77c6-201e-00c4-16fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "b1c0a8d6-930c-4e69-8352-a2016f1e75b9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseaca6b2232901baaeef/javablobbreakleaseac1blobapitestbreakleaseaca6b6902787eaa", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DB79B638\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e77da-201e-00c4-24fb-594fb0000000", + "x-ms-client-request-id" : "66f2c859-421d-47e8-8a9d-fe3a4b563b7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseaca6b2232901baaeef/javablobbreakleaseac1blobapitestbreakleaseaca6b6902787eaa?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DB79B638\"", + "x-ms-lease-id" : "8ff74604-369c-4eb2-8d8f-6992f4f02cf7", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e77e7-201e-00c4-30fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "5d30fc51-0c60-434b-98c1-34b725a8991e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseaca6b2232901baaeef/javablobbreakleaseac1blobapitestbreakleaseaca6b6902787eaa?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DB79B638\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51e77ff-201e-00c4-43fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "74df1882-4899-4d19-b46d-9efdc3d54d5e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7818-201e-00c4-54fb-594fb0000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseaca6b2232901baaeefFri, 23 Aug 2019 21:42:55 GMT\"0x8D72812DB74033E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "11786fa6-ee94-449f-8d99-86fe7a7e7417", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseaca6b2232901baaeef?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e781d-201e-00c4-59fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "a2dff09c-5d99-47b9-947e-2ede3cd807ba" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseaca6b2232901baaeef", "javablobbreakleaseac1blobapitestbreakleaseaca6b6902787eaa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[3].json new file mode 100644 index 000000000000..109ddeb60708 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[3].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfca6082567e2b25c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DB9F155D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7854-201e-00c4-06fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "e73b4686-5557-43dd-987a-243b28e5e4b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfca6082567e2b25c/javablobbreakleaseac1blobapitestbreakleaseacfca721495f014", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DBA4532A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7864-201e-00c4-13fb-594fb0000000", + "x-ms-client-request-id" : "19e6ecdd-6f03-4989-8963-8c0aa715a977" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfca6082567e2b25c/javablobbreakleaseac1blobapitestbreakleaseacfca721495f014", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DBA4532A\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:55 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e7870-201e-00c4-1cfb-594fb0000000", + "x-ms-client-request-id" : "0057f368-b290-45ed-8ffb-1e6d425108b7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfca6082567e2b25c/javablobbreakleaseac1blobapitestbreakleaseacfca721495f014?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DBA4532A\"", + "x-ms-lease-id" : "48ed948b-1a9d-45e0-b04b-3078596c7dfd", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e787c-201e-00c4-27fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "7dce2d27-be6c-41d6-9c38-a76a6376cfca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfca6082567e2b25c/javablobbreakleaseac1blobapitestbreakleaseacfca721495f014?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DBA4532A\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51e788b-201e-00c4-35fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "f0a15c8d-28c3-4a08-9bf8-0882b8cf65c3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7896-201e-00c4-3dfb-594fb0000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseacfca6082567e2b25cFri, 23 Aug 2019 21:42:55 GMT\"0x8D72812DB9F155D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "01193186-58e0-4a3e-9586-7409ebe55586", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseacfca6082567e2b25c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e789d-201e-00c4-43fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "59804776-f8aa-439e-84e6-0df1e9b39a79" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseacfca6082567e2b25c", "javablobbreakleaseac1blobapitestbreakleaseacfca721495f014" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[4].json new file mode 100644 index 000000000000..4d76e63133ca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[4].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac39008963a874fa92?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DBC0D66D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e78b5-201e-00c4-55fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "01099999-dfbd-47bf-a245-3bba965538a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac39008963a874fa92/javablobbreakleaseac1blobapitestbreakleaseac390514953d89e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DBC61439\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e78c3-201e-00c4-5ffb-594fb0000000", + "x-ms-client-request-id" : "2648e3f2-80e8-48ac-ab42-5687ea8fb45c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac39008963a874fa92/javablobbreakleaseac1blobapitestbreakleaseac390514953d89e?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DBC61439\"", + "x-ms-lease-id" : "04588e7d-d10b-4ed0-80a9-62128896eb01", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e78dc-201e-00c4-71fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "d9368eb0-4945-4f80-b64e-22a1d845a517" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac39008963a874fa92/javablobbreakleaseac1blobapitestbreakleaseac390514953d89e?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DBC61439\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51e78f6-201e-00c4-02fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "96afa079-bc85-4c07-8673-7339ec1e39b6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7918-201e-00c4-1efb-594fb0000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseac39008963a874fa92Fri, 23 Aug 2019 21:42:55 GMT\"0x8D72812DBC0D66D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "849b1bc4-3ce8-41dc-9ebd-629bf65ea9b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac39008963a874fa92?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e792a-201e-00c4-2cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "c91bf77f-98fd-4c25-ae5c-f9d047f95f85" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseac39008963a874fa92", "javablobbreakleaseac1blobapitestbreakleaseac390514953d89e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[0].json new file mode 100644 index 000000000000..b74e6e33aaa4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[0].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail03a87436e44e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DBDF1439\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7945-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:54 GMT", + "x-ms-client-request-id" : "2bc86cbc-2a3a-4975-9b89-d8c879bc8743" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail03a87436e44e/javablobbreakleaseacfail1blobapitestbreakleaseacfail03a249080", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DBE4791D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7955-201e-00c4-4efb-594fb0000000", + "x-ms-client-request-id" : "19ab81d6-4b64-441a-859f-d289fb88c938" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail03a87436e44e/javablobbreakleaseacfail1blobapitestbreakleaseacfail03a249080?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DBE4791D\"", + "x-ms-lease-id" : "f7f06f6e-98ec-4da2-a12b-55c0b6e5df7e", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e796b-201e-00c4-5dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "571df0ee-f2d2-41ab-af96-7164cbb6a465" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail03a87436e44e/javablobbreakleaseacfail1blobapitestbreakleaseacfail03a249080?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e7988-201e-00c4-75fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e7988-201e-00c4-75fb-594fb0000000\nTime:2019-08-23T21:42:56.0587869Z", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "ca3ca592-c447-43ac-acbb-e7c76f5c25ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e79a5-201e-00c4-06fb-594fb0000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfail03a87436e44eFri, 23 Aug 2019 21:42:55 GMT\"0x8D72812DBDF1439\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "086da072-4493-4621-8006-0a70b0c11f7a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail03a87436e44e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e79b3-201e-00c4-10fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "45867f70-0a1e-4294-94f5-f338da891472" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfail03a87436e44e", "javablobbreakleaseacfail1blobapitestbreakleaseacfail03a249080" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[1].json new file mode 100644 index 000000000000..bd575bc24677 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailfbc93079d1e6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DBFDEE58\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e79d4-201e-00c4-29fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "b8efdfcd-8e00-4d8c-acec-17e4571a8c8b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailfbc93079d1e6/javablobbreakleaseacfail1blobapitestbreakleaseacfailfbc304180", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DC037A6D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e79ef-201e-00c4-39fb-594fb0000000", + "x-ms-client-request-id" : "bfa7b2b8-8f72-455e-a8dc-265bef09a75b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailfbc93079d1e6/javablobbreakleaseacfail1blobapitestbreakleaseacfailfbc304180?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC037A6D\"", + "x-ms-lease-id" : "c626c763-9867-4d1d-99ed-205e6f042dd9", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7a0d-201e-00c4-4bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "999960c6-8674-46d7-8ee5-ed305063ad8e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailfbc93079d1e6/javablobbreakleaseacfail1blobapitestbreakleaseacfailfbc304180?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e7a1e-201e-00c4-57fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e7a1e-201e-00c4-57fb-594fb0000000\nTime:2019-08-23T21:42:56.2669855Z", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "d81afe59-bb3a-4654-8e57-0e1b0de0ffcc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7a31-201e-00c4-65fb-594fb0000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfailfbc93079d1e6Fri, 23 Aug 2019 21:42:56 GMT\"0x8D72812DBFDEE58\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "2e936170-79f2-48cf-83e9-5f8790cd45d6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailfbc93079d1e6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7a47-201e-00c4-75fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "5bd73ef5-6315-4223-a47b-8e8d36d6bf03" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfailfbc93079d1e6", "javablobbreakleaseacfail1blobapitestbreakleaseacfailfbc304180" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[2].json new file mode 100644 index 000000000000..2b1e618a8430 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfaild73818101dbf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC1CA169\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7a5f-201e-00c4-05fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "f6e2c050-8338-47e9-aa2d-79da2ca29284" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfaild73818101dbf/javablobbreakleaseacfail1blobapitestbreakleaseacfaild7307452e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DC22066E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7a76-201e-00c4-16fb-594fb0000000", + "x-ms-client-request-id" : "11c69a70-8abf-4065-86bc-a548e9d3e41b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfaild73818101dbf/javablobbreakleaseacfail1blobapitestbreakleaseacfaild7307452e?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC22066E\"", + "x-ms-lease-id" : "bd5f0af4-0abf-4d86-abcc-bccef3d8671d", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7a89-201e-00c4-29fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "c458b4fd-be30-4817-aa0c-ac8c051796bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfaild73818101dbf/javablobbreakleaseacfail1blobapitestbreakleaseacfaild7307452e?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e7a9e-201e-00c4-3bfb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e7a9e-201e-00c4-3bfb-594fb0000000\nTime:2019-08-23T21:42:56.4601700Z", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "4db0471b-6510-4e04-989f-0f63f8a57af6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7aac-201e-00c4-47fb-594fb0000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfaild73818101dbfFri, 23 Aug 2019 21:42:56 GMT\"0x8D72812DC1CA169\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "6e7d9d6e-164d-477e-a70a-98d3ad85299f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfaild73818101dbf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7abc-201e-00c4-52fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "3682751f-4649-4b0c-93e6-b24e0e9974ba" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfaild73818101dbf", "javablobbreakleaseacfail1blobapitestbreakleaseacfaild7307452e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[3].json new file mode 100644 index 000000000000..68f85b559e9f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[3].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailbb4896095297?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC39F48D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7ade-201e-00c4-6bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "297a828b-e625-4204-9df2-13e80531abef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailbb4896095297/javablobbreakleaseacfail1blobapitestbreakleaseacfailbb4388895", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DC3FCEEC\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7af7-201e-00c4-7efb-594fb0000000", + "x-ms-client-request-id" : "12293cf3-461d-4d10-aa10-e71770134a9c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailbb4896095297/javablobbreakleaseacfail1blobapitestbreakleaseacfailbb4388895", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DC3FCEEC\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:56 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e7b00-201e-00c4-04fb-594fb0000000", + "x-ms-client-request-id" : "8878537c-6a8b-4fcf-bfc1-bcc98e2f0b9b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailbb4896095297/javablobbreakleaseacfail1blobapitestbreakleaseacfailbb4388895?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC3FCEEC\"", + "x-ms-lease-id" : "dd37cfbb-6b14-434b-a175-0bd1d8ef8f3c", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7b13-201e-00c4-10fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "4b197af8-f54d-4639-8266-797d81335970" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailbb4896095297/javablobbreakleaseacfail1blobapitestbreakleaseacfailbb4388895?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e7b1a-201e-00c4-16fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e7b1a-201e-00c4-16fb-594fb0000000\nTime:2019-08-23T21:42:56.6803800Z", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "40a48cf1-fd34-4b2a-847b-1ea51060b805", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7b23-201e-00c4-1cfb-594fb0000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfailbb4896095297Fri, 23 Aug 2019 21:42:56 GMT\"0x8D72812DC39F48D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "47c874d7-0387-48e2-9d70-d54437913631", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfailbb4896095297?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7b2c-201e-00c4-25fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "776a8299-079a-4456-bb2d-fc46e7b417da" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfailbb4896095297", "javablobbreakleaseacfail1blobapitestbreakleaseacfailbb4388895" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseerror.json new file mode 100644 index 000000000000..3a47bf84c7a5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerror3dd30237eeb24?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC5D63C2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7b48-201e-00c4-3ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "82ac3f01-70e0-4d13-a946-f0fdc6beccfa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerror3dd30237eeb24/javablobbreakleaseerror1blobapitestbreakleaseerror3dd856841d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DC62C8DA\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7b57-201e-00c4-4afb-594fb0000000", + "x-ms-client-request-id" : "05cbddfe-cb74-4dd3-912f-ae67fb70b616" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerror3dd30237eeb24/javablobbreakleaseerror2blobapitestbreakleaseerror3dd70615e6?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7b68-201e-00c4-59fb-594fb0000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:d51e7b68-201e-00c4-59fb-594fb0000000\nTime:2019-08-23T21:42:56.8515430Z", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "47812b5c-10ab-48f5-8061-66644554a6d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7b84-201e-00c4-6dfb-594fb0000000", + "Body" : "jtcbreakleaseerrorjtcbreakleaseerror0blobapitestbreakleaseerror3dd30237eeb24Fri, 23 Aug 2019 21:42:56 GMT\"0x8D72812DC5D63C2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "6bc00f08-4cdf-4df4-9f55-dc96badf5965", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerror3dd30237eeb24?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7b99-201e-00c4-7dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "aecd5d25-fefa-4ff4-8125-6cfebc2ce70e" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseerror0blobapitestbreakleaseerror3dd30237eeb24", "javablobbreakleaseerror1blobapitestbreakleaseerror3dd856841d", "javablobbreakleaseerror2blobapitestbreakleaseerror3dd70615e6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleasemin.json new file mode 100644 index 000000000000..1f895a2481dd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleasemin.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleaseminb81955105102bfe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DAF761D0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e767a-201e-00c4-72fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "24fda4a2-8dd1-4bed-813d-e3400d1adbce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleaseminb81955105102bfe/javablobbreakleasemin1blobapitestbreakleaseminb8173397cb82", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DAFCED85\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e768b-201e-00c4-80fb-594fb0000000", + "x-ms-client-request-id" : "4ac70d23-fb50-498d-9533-a322999f746a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleaseminb81955105102bfe/javablobbreakleasemin1blobapitestbreakleaseminb8173397cb82?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DAFCED85\"", + "x-ms-lease-id" : "58cfed97-a7bf-41db-bbdc-9d76d137acc1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7692-201e-00c4-07fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "5c909438-6ba7-4035-bd0a-665eded52809" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleaseminb81955105102bfe/javablobbreakleasemin1blobapitestbreakleaseminb8173397cb82?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DAFCED85\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51e76a6-201e-00c4-19fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "236c5f21-270e-4fd4-b57c-3c84a9bad99b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleasemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e76ad-201e-00c4-20fb-594fb0000000", + "Body" : "jtcbreakleaseminjtcbreakleasemin0blobapitestbreakleaseminb81955105102bfeFri, 23 Aug 2019 21:42:54 GMT\"0x8D72812DAF761D0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "802ff6ef-a71d-4426-9aab-7152936b0230", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleaseminb81955105102bfe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e76b7-201e-00c4-2afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:53 GMT", + "x-ms-client-request-id" : "9cfe5d73-d2f9-40db-9e25-0e8aad6d3054" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleasemin0blobapitestbreakleaseminb81955105102bfe", "javablobbreakleasemin1blobapitestbreakleaseminb8173397cb82" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangelease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangelease.json new file mode 100644 index 000000000000..da5c2c7bae0d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangelease.json @@ -0,0 +1,148 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleasec3c23454fd010080b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC758586\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7ba2-201e-00c4-06fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "x-ms-client-request-id" : "43274394-19f5-4d27-a00a-d1d648115d56" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleasec3c23454fd010080b/javablobchangelease1blobapitestchangeleasec3c84087b45e92", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DC7AC38B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7bc8-201e-00c4-25fb-594fb0000000", + "x-ms-client-request-id" : "d13d9b8f-1183-4c49-978e-cb42b5f16b9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleasec3c23454fd010080b/javablobchangelease1blobapitestchangeleasec3c84087b45e92?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC7AC38B\"", + "x-ms-lease-id" : "c938f896-5b28-46fa-a590-90132d3bd066", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7bdc-201e-00c4-38fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "0740fd85-c1b1-491f-a930-0fb30e775c96" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleasec3c23454fd010080b/javablobchangelease1blobapitestchangeleasec3c84087b45e92?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC7AC38B\"", + "x-ms-lease-id" : "fa8d231b-19d7-43cf-bc66-a902a9250e2e", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7bf5-201e-00c4-4bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "4d148442-f19b-41c7-be28-cff50673d59a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleasec3c23454fd010080b/javablobchangelease1blobapitestchangeleasec3c84087b45e92?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC7AC38B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7c14-201e-00c4-62fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "10bcb655-256c-462a-a160-d273d00afc7d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangelease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7c29-201e-00c4-74fb-594fb0000000", + "Body" : "jtcchangeleasejtcchangelease0blobapitestchangeleasec3c23454fd010080bFri, 23 Aug 2019 21:42:56 GMT\"0x8D72812DC758586\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "c58dc285-7c0f-44e1-b445-c1369320d4ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0blobapitestchangeleasec3c23454fd010080b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7c4c-201e-00c4-0efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "68f9647b-c5e6-4962-8c03-eb491da53694" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangelease0blobapitestchangeleasec3c23454fd010080b", "javablobchangelease1blobapitestchangeleasec3c84087b45e92", "c938f896-5b28-46fa-a590-90132d3bd066", "fa8d231b-19d7-43cf-bc66-a902a9250e2e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[0].json new file mode 100644 index 000000000000..3d5bc138b5f5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[0].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacd8428479a88ed30?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DCC27FC4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7d0e-201e-00c4-3bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "2d8e08ee-1a60-4038-89f2-5d550d9d8bc9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacd8428479a88ed30/javablobchangeleaseac1blobapitestchangeleaseacd845077741f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DCC7E50E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7d2f-201e-00c4-55fb-594fb0000000", + "x-ms-client-request-id" : "eace583e-1e82-4ca8-8a96-ab4c16ac923c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacd8428479a88ed30/javablobchangeleaseac1blobapitestchangeleaseacd845077741f8?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DCC7E50E\"", + "x-ms-lease-id" : "55307e44-1290-40e0-a5ee-b1539361c055", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7d51-201e-00c4-71fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "22e658fb-ee89-4b36-9034-fc84fcc6c1a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacd8428479a88ed30/javablobchangeleaseac1blobapitestchangeleaseacd845077741f8?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DCC7E50E\"", + "x-ms-lease-id" : "13612a81-9560-4755-8d47-30a15f5905a9", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7d65-201e-00c4-02fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "d5455d00-8581-4217-83e0-52a395c03fc8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7d76-201e-00c4-12fb-594fb0000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseacd8428479a88ed30Fri, 23 Aug 2019 21:42:57 GMT\"0x8D72812DCC27FC4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "eb01b0ca-9549-4858-bed7-9977170bb2f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacd8428479a88ed30?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7d80-201e-00c4-1afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "abfcb3de-ff65-408c-86c8-88eb53f28f37" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseacd8428479a88ed30", "javablobchangeleaseac1blobapitestchangeleaseacd845077741f8", "13612a81-9560-4755-8d47-30a15f5905a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[1].json new file mode 100644 index 000000000000..66e4fe5c9d45 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacb3b54000b8f96da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DCDF84BE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7d95-201e-00c4-2efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "71d12a0d-9fe1-4c29-b8b9-1e27e0aadb26" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacb3b54000b8f96da/javablobchangeleaseac1blobapitestchangeleaseacb3b5255785f0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DCE53839\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7da8-201e-00c4-3efb-594fb0000000", + "x-ms-client-request-id" : "5f8f0648-0b1b-40a3-b9fe-fdb6476e106b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacb3b54000b8f96da/javablobchangeleaseac1blobapitestchangeleaseacb3b5255785f0?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DCE53839\"", + "x-ms-lease-id" : "f02e8cad-6b05-4c3e-aa91-32a2ed943a50", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7db7-201e-00c4-4bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "5aff1b58-e73b-4d7a-a665-6ecd2a4cc9ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacb3b54000b8f96da/javablobchangeleaseac1blobapitestchangeleaseacb3b5255785f0?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DCE53839\"", + "x-ms-lease-id" : "7727a458-2a0b-4d9b-9053-eb4466a7284c", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7dc2-201e-00c4-55fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "5cc91d74-4159-41cb-a21e-dda3e9625ad9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7dd2-201e-00c4-61fb-594fb0000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseacb3b54000b8f96daFri, 23 Aug 2019 21:42:57 GMT\"0x8D72812DCDF84BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "a914dde2-bee6-419a-971b-9e80bfcc8066", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacb3b54000b8f96da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7de0-201e-00c4-6bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "75e29ffe-8372-4481-8d1a-803d87a6e9b4" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseacb3b54000b8f96da", "javablobchangeleaseac1blobapitestchangeleaseacb3b5255785f0", "7727a458-2a0b-4d9b-9053-eb4466a7284c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[2].json new file mode 100644 index 000000000000..3bd9359844db --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac3c628843727b3ba?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD008247\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7dfd-201e-00c4-02fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "9032e53a-4d4b-4019-8c5f-dc1999d08b37" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac3c628843727b3ba/javablobchangeleaseac1blobapitestchangeleaseac3c6722415efd", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DD05E7A4\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7e0b-201e-00c4-0ffb-594fb0000000", + "x-ms-client-request-id" : "852498cc-a569-47bc-8c2d-f9023e6b0015" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac3c628843727b3ba/javablobchangeleaseac1blobapitestchangeleaseac3c6722415efd?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD05E7A4\"", + "x-ms-lease-id" : "a4e58dc5-6b9e-40b2-b98b-31e987498242", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7e19-201e-00c4-1cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "086176fa-e2c4-4592-9c5f-2efc046cd2c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac3c628843727b3ba/javablobchangeleaseac1blobapitestchangeleaseac3c6722415efd?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD05E7A4\"", + "x-ms-lease-id" : "3b62c1ec-acfd-4226-a801-792fc138158e", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7e27-201e-00c4-29fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "5604069a-e4d3-4b3e-9f3c-e38b4a32d30f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7e2e-201e-00c4-30fb-594fb0000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseac3c628843727b3baFri, 23 Aug 2019 21:42:57 GMT\"0x8D72812DD008247\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "0aa4b892-311e-4e2b-b6ef-f70ef37fac8f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac3c628843727b3ba?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7e3c-201e-00c4-3dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "3d673710-bb82-49d2-bed6-8c5a93e71aff" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseac3c628843727b3ba", "javablobchangeleaseac1blobapitestchangeleaseac3c6722415efd", "3b62c1ec-acfd-4226-a801-792fc138158e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[3].json new file mode 100644 index 000000000000..07d071c4b09f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[3].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac976693539768c69?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD1E4ABF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7e49-201e-00c4-48fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "51b4e661-86f9-43d6-aadc-0a0a8bc0a247" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac976693539768c69/javablobchangeleaseac1blobapitestchangeleaseac976332301de9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DD244C89\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7e7b-201e-00c4-6cfb-594fb0000000", + "x-ms-client-request-id" : "6c6b880b-ba64-4526-96f8-7bee34d38c58" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac976693539768c69/javablobchangeleaseac1blobapitestchangeleaseac976332301de9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DD244C89\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:58 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e7e91-201e-00c4-80fb-594fb0000000", + "x-ms-client-request-id" : "9727fdfd-230c-45d6-8ddf-726fbaa5ea8f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac976693539768c69/javablobchangeleaseac1blobapitestchangeleaseac976332301de9?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD244C89\"", + "x-ms-lease-id" : "2bf7d3ad-4362-4161-8321-abc55ea4d7c7", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7ea2-201e-00c4-0ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "d512657f-b8ec-4127-b8f0-e61ffa5aee74" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac976693539768c69/javablobchangeleaseac1blobapitestchangeleaseac976332301de9?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD244C89\"", + "x-ms-lease-id" : "ffcee0b1-a52e-43a9-b2cc-70f792e01284", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7eb6-201e-00c4-1dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "c70dd6c7-d8a0-4cbc-9c32-0ace88357600" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7ec3-201e-00c4-27fb-594fb0000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseac976693539768c69Fri, 23 Aug 2019 21:42:58 GMT\"0x8D72812DD1E4ABF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "a35d2d7c-a27c-4475-912f-84c505cb18f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac976693539768c69?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7ed3-201e-00c4-32fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "974cfe1d-b411-4a81-9e97-51a689c1e0fc" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseac976693539768c69", "javablobchangeleaseac1blobapitestchangeleaseac976332301de9", "ffcee0b1-a52e-43a9-b2cc-70f792e01284" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[4].json new file mode 100644 index 000000000000..3c51dd87ef40 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[4].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacdaf89315ddbb131?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD40CF4D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7ee2-201e-00c4-3ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "a74bbd65-deb9-4d55-b35f-b8b46970610d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacdaf89315ddbb131/javablobchangeleaseac1blobapitestchangeleaseacdaf55853e53f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DD465BDD\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7ef1-201e-00c4-4afb-594fb0000000", + "x-ms-client-request-id" : "7168d908-239d-4bfe-97af-37e11ba1b0c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacdaf89315ddbb131/javablobchangeleaseac1blobapitestchangeleaseacdaf55853e53f?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD465BDD\"", + "x-ms-lease-id" : "0e3505e0-7fc8-4b28-9085-b6a6b0517bff", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7f03-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "dbfcb3d6-5194-4fa0-bf4f-9c4ba7deee38" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacdaf89315ddbb131/javablobchangeleaseac1blobapitestchangeleaseacdaf55853e53f?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD465BDD\"", + "x-ms-lease-id" : "7b176c86-f394-4d8c-8aa4-904f5647c99a", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7f12-201e-00c4-62fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "c2486ec0-87c6-43dd-99a1-79b2b50c37c3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7f20-201e-00c4-6dfb-594fb0000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseacdaf89315ddbb131Fri, 23 Aug 2019 21:42:58 GMT\"0x8D72812DD40CF4D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "dcba8bdb-40d5-45a7-acb0-4b30113dd876", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacdaf89315ddbb131?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7f2f-201e-00c4-7afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "a12b0907-661d-4d2d-b539-da4b7069f2fb" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseacdaf89315ddbb131", "javablobchangeleaseac1blobapitestchangeleaseacdaf55853e53f", "7b176c86-f394-4d8c-8aa4-904f5647c99a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[0].json new file mode 100644 index 000000000000..bdd29333655f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[0].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailcfb119934f1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD5F3431\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7f45-201e-00c4-0cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "c6d56054-0937-4d31-8d42-09d64b51f5dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailcfb119934f1/javablobchangeleaseacfail1blobapitestchangeleaseacfailcfb46970", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DD647285\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7f62-201e-00c4-21fb-594fb0000000", + "x-ms-client-request-id" : "8acd9139-4dcf-484c-abd1-45172d0284c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailcfb119934f1/javablobchangeleaseacfail1blobapitestchangeleaseacfailcfb46970?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD647285\"", + "x-ms-lease-id" : "9ad34831-be60-4d09-9698-8231ff458cd4", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7f73-201e-00c4-31fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "449b5cad-5b47-4cbd-bfe0-46cec31660ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailcfb119934f1/javablobchangeleaseacfail1blobapitestchangeleaseacfailcfb46970?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e7f87-201e-00c4-43fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e7f87-201e-00c4-43fb-594fb0000000\nTime:2019-08-23T21:42:58.5691833Z", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "86fe392d-fbf3-41f8-ab32-872b2cf7848a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7f97-201e-00c4-4ffb-594fb0000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfailcfb119934f1Fri, 23 Aug 2019 21:42:58 GMT\"0x8D72812DD5F3431\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "83bbe626-291f-48c1-9ac7-061667697f5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailcfb119934f1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7fa1-201e-00c4-57fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "e2c67fd3-5226-41fa-a853-b20cadc9e588" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfailcfb119934f1", "javablobchangeleaseacfail1blobapitestchangeleaseacfailcfb46970", "b09692ff-f063-4f29-a887-23166c8856d1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[1].json new file mode 100644 index 000000000000..18570d47971a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail0873590189a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD7BEB04\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7fbf-201e-00c4-6efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "4b0c8d46-4789-406a-9adb-611c626138eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail0873590189a/javablobchangeleaseacfail1blobapitestchangeleaseacfail08721426", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DD812957\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7fd2-201e-00c4-7ffb-594fb0000000", + "x-ms-client-request-id" : "cdd34e19-670f-4fbc-b359-82ef621d31e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail0873590189a/javablobchangeleaseacfail1blobapitestchangeleaseacfail08721426?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD812957\"", + "x-ms-lease-id" : "f95f88d6-5ec4-4058-b2b6-0aceaac252fe", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7fea-201e-00c4-13fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "181d83b9-8504-4c01-b9a4-085128ea5a16" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail0873590189a/javablobchangeleaseacfail1blobapitestchangeleaseacfail08721426?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e7ff8-201e-00c4-1ffb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e7ff8-201e-00c4-1ffb-594fb0000000\nTime:2019-08-23T21:42:58.7603666Z", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "74492290-d4a9-4ff2-a259-9044255de197", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8005-201e-00c4-29fb-594fb0000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfail0873590189aFri, 23 Aug 2019 21:42:58 GMT\"0x8D72812DD7BEB04\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "04e4ab3e-92bd-4e49-ae28-05b9741e5696", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail0873590189a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8012-201e-00c4-36fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "0811cd86-4455-432e-bde3-6e6e8ca0ada2" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfail0873590189a", "javablobchangeleaseacfail1blobapitestchangeleaseacfail08721426", "e932759c-67d3-45c7-9c5c-854c063f78b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[2].json new file mode 100644 index 000000000000..7db079baf23c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail4f9448142d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DD996550\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e801d-201e-00c4-40fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "x-ms-client-request-id" : "3a3e52c6-326d-4cd0-9f4d-4ec53e70e32d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail4f9448142d4/javablobchangeleaseacfail1blobapitestchangeleaseacfail4f936364", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DDA694D5\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8053-201e-00c4-6bfb-594fb0000000", + "x-ms-client-request-id" : "5eaa5e9d-7693-4945-820c-809ca8b02ce2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail4f9448142d4/javablobchangeleaseacfail1blobapitestchangeleaseacfail4f936364?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DDA694D5\"", + "x-ms-lease-id" : "751aae25-2b75-46fc-bbf7-05f20dff0ca0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8062-201e-00c4-76fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "9cbff398-d6e7-46cf-9ee4-4a309a38992a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail4f9448142d4/javablobchangeleaseacfail1blobapitestchangeleaseacfail4f936364?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e807b-201e-00c4-08fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e807b-201e-00c4-08fb-594fb0000000\nTime:2019-08-23T21:42:59.0216171Z", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "4fa0d208-2353-47a5-ba6b-1875c97330b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e808f-201e-00c4-19fb-594fb0000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfail4f9448142d4Fri, 23 Aug 2019 21:42:58 GMT\"0x8D72812DD996550\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "081fd11b-c1d8-4944-82e2-c782c628c1f1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail4f9448142d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e80b3-201e-00c4-3bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "32c21271-bcc2-4cd0-9330-de33fbd973bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfail4f9448142d4", "javablobchangeleaseacfail1blobapitestchangeleaseacfail4f936364", "06b7b968-f27b-4a7e-812d-5c736a5f41a0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[3].json new file mode 100644 index 000000000000..3654e98323bc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[3].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail03a07760695?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DDC1426E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e80d5-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "2ffa8347-88ec-4fce-95bd-87a2641c807b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail03a07760695/javablobchangeleaseacfail1blobapitestchangeleaseacfail03a66051", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DDC680C3\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e80ec-201e-00c4-6bfb-594fb0000000", + "x-ms-client-request-id" : "d274fbd5-f800-461a-a507-f259950d5e6e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail03a07760695/javablobchangeleaseacfail1blobapitestchangeleaseacfail03a66051", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DDC680C3\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:59 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e8120-201e-00c4-19fb-594fb0000000", + "x-ms-client-request-id" : "941d6f8c-169b-4c81-9cd9-7f9154f8e5e0", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail03a07760695/javablobchangeleaseacfail1blobapitestchangeleaseacfail03a66051?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DDC680C3\"", + "x-ms-lease-id" : "dda04556-2cba-4ecf-a740-1db7b37d22b2", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8131-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "31f9e4a4-0ad3-42b0-8af6-153062264c9b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail03a07760695/javablobchangeleaseacfail1blobapitestchangeleaseacfail03a66051?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e814a-201e-00c4-3ffb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e814a-201e-00c4-3ffb-594fb0000000\nTime:2019-08-23T21:42:59.2688546Z", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "74e581df-e4aa-4141-a56f-87fd4a5e6c55", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8160-201e-00c4-52fb-594fb0000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfail03a07760695Fri, 23 Aug 2019 21:42:59 GMT\"0x8D72812DDC1426E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "9e9d36f4-5dbd-44e9-8ee3-b73215801af4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail03a07760695?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8178-201e-00c4-66fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "925866e4-c20d-4a23-9ebb-905bee531e2f" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfail03a07760695", "javablobchangeleaseacfail1blobapitestchangeleaseacfail03a66051", "840e4a68-7fb2-41cf-a90c-ce38b62828b2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseerror.json new file mode 100644 index 000000000000..b320b482c290 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror9f4489730a5c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DDE686CD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e818e-201e-00c4-7afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "b05a1013-05b8-4446-bdcf-33b122af925a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror9f4489730a5c/javablobchangeleaseerror1blobapitestchangeleaseerror9f409854d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DDEC3A75\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e81a6-201e-00c4-0afb-594fb0000000", + "x-ms-client-request-id" : "1ed6642b-3695-421b-a96d-b234f6fa06df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror9f4489730a5c/javablobchangeleaseerror2blobapitestchangeleaseerror9f482509a?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "d51e81b6-201e-00c4-16fb-594fb0000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:d51e81b6-201e-00c4-16fb-594fb0000000\nTime:2019-08-23T21:42:59.4270051Zx-ms-lease-idid", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "d34122f8-62b5-47f5-9d38-87cba5ab803f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e81c2-201e-00c4-22fb-594fb0000000", + "Body" : "jtcchangeleaseerrorjtcchangeleaseerror0blobapitestchangeleaseerror9f4489730a5cFri, 23 Aug 2019 21:42:59 GMT\"0x8D72812DDE686CD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "5b99a16b-9837-4b19-8074-b278695d8b19", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror9f4489730a5c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e81d1-201e-00c4-2ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "1cd15974-564c-4837-a855-736f03a412e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseerror0blobapitestchangeleaseerror9f4489730a5c", "javablobchangeleaseerror1blobapitestchangeleaseerror9f409854d", "javablobchangeleaseerror2blobapitestchangeleaseerror9f482509a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleasemin.json new file mode 100644 index 000000000000..f651f093a27d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleasemin.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleaseminf33762356b3a60?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DC9AF0F2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7c79-201e-00c4-38fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "7be70fc0-746d-45e8-a5c6-05c173a17cd5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleaseminf33762356b3a60/javablobchangeleasemin1blobapitestchangeleaseminf33759088cc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DCA8E3BF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7c8a-201e-00c4-45fb-594fb0000000", + "x-ms-client-request-id" : "4ce6d954-7c94-49d8-8cea-62d9da3294ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleaseminf33762356b3a60/javablobchangeleasemin1blobapitestchangeleaseminf33759088cc?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DCA8E3BF\"", + "x-ms-lease-id" : "f5d32903-d505-49ce-a47d-37b6a91e799e", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7cc5-201e-00c4-78fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "081e3d91-f347-43a1-8562-3838a390eeb2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleaseminf33762356b3a60/javablobchangeleasemin1blobapitestchangeleaseminf33759088cc?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DCA8E3BF\"", + "x-ms-lease-id" : "2e1eb4f5-df3c-4d24-b3d4-bf33622025fb", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7cda-201e-00c4-0cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "47e01149-93f4-43d6-8cf6-907e48ac230d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleasemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7ce8-201e-00c4-1afb-594fb0000000", + "Body" : "jtcchangeleaseminjtcchangeleasemin0blobapitestchangeleaseminf33762356b3a60Fri, 23 Aug 2019 21:42:57 GMT\"0x8D72812DC9AF0F2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "430135b4-c3b8-4d60-a551-a70febe92e3a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleaseminf33762356b3a60?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7cf9-201e-00c4-29fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:56 GMT", + "x-ms-client-request-id" : "ae1acdf8-109c-4fed-94fc-552ec4efd000" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleasemin0blobapitestchangeleaseminf33762356b3a60", "javablobchangeleasemin1blobapitestchangeleaseminf33759088cc", "2e1eb4f5-df3c-4d24-b3d4-bf33622025fb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopy.json new file mode 100644 index 000000000000..e1a8ee0c0071 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopy.json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy644037372b023d188f464ba3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DFEE204F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e88a0-201e-00c4-7cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "e02de813-ccba-4640-a2a6-eb0839d2e779" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy644037372b023d188f464ba3/javablobcopy1blobapitestcopy64495624c21a943d31344", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DFF5D140\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e88be-201e-00c4-15fb-594fb0000000", + "x-ms-client-request-id" : "224facc2-93b5-4768-a970-ca890235d6cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy644037372b023d188f464ba3/javablobcopy2blobapitestcopy64454016587a18c9c3af4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "3434b4fb-dc8c-435c-89c5-191d3492d2c2", + "ETag" : "\"0x8D72812DFFE37C7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e88db-201e-00c4-2cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "7a2cf3ae-b143-478d-8f29-b4e80422dbbc" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy644037372b023d188f464ba3/javablobcopy2blobapitestcopy64454016587a18c9c3af4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e88f7-201e-00c4-46fb-594fb0000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "3434b4fb-dc8c-435c-89c5-191d3492d2c2", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy644037372b023d188f464ba3/javablobcopy1blobapitestcopy64495624c21a943d31344", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812DFFE37C7\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "f9e02d58-ce70-49d8-86f8-f894698089ec" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy644037372b023d188f464ba3/javablobcopy2blobapitestcopy64454016587a18c9c3af4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e8911-201e-00c4-5efb-594fb0000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "3434b4fb-dc8c-435c-89c5-191d3492d2c2", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy644037372b023d188f464ba3/javablobcopy1blobapitestcopy64495624c21a943d31344", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812DFFE37C7\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "458d69a8-a02b-4ec8-8b90-8b57ceea29e0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8934-201e-00c4-7efb-594fb0000000", + "Body" : "jtccopyjtccopy0blobapitestcopy644037372b023d188f464ba3Fri, 23 Aug 2019 21:43:02 GMT\"0x8D72812DFEE204F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "43001fff-ac4b-4a7d-9d6f-5c653c1e8ac2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopy0blobapitestcopy644037372b023d188f464ba3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8940-201e-00c4-0afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "b1943d3e-efdd-4613-b72b-932f541f308f" + }, + "Exception" : null + } ], + "variables" : [ "jtccopy0blobapitestcopy644037372b023d188f464ba3", "javablobcopy1blobapitestcopy64495624c21a943d31344", "javablobcopy2blobapitestcopy64454016587a18c9c3af4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[0].json new file mode 100644 index 000000000000..f4cc68ab3c88 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[0].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf05344540564946f6b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E1B285DE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8f29-201e-00c4-1cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "fa9692a6-f2f6-48eb-a616-2b9b6c931b1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf05344540564946f6b/javablobcopydestac1blobapitestcopydestacf0520623dd8beb3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E1B8B07A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8f3a-201e-00c4-2afb-594fb0000000", + "x-ms-client-request-id" : "98dea5f2-514f-4fc4-a5f3-adf8e19dd5f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf05344540564946f6b/javablobcopydestac2blobapitestcopydestacf0535922b348f4d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E1C18C47\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8f50-201e-00c4-3efb-594fb0000000", + "x-ms-client-request-id" : "fd1141e7-b7d0-4138-bdef-749567b0f574" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf05344540564946f6b/javablobcopydestac2blobapitestcopydestacf0535922b348f4d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "75f9c6eb-0055-428d-ac30-b95759287a93", + "ETag" : "\"0x8D72812E1C7CF68\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e8f5c-201e-00c4-47fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "440fef1e-c737-4e79-8c2c-99861124af23" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8f6c-201e-00c4-53fb-594fb0000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestacf05344540564946f6bFri, 23 Aug 2019 21:43:05 GMT\"0x8D72812E1B285DE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "1796d6a2-aeaf-4dbd-a5d7-17f3f8293024", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacf05344540564946f6b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8f76-201e-00c4-5afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "da00abaa-9c7b-4f0f-8bc3-d94e2ac83515" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestacf05344540564946f6b", "javablobcopydestac1blobapitestcopydestacf0520623dd8beb3", "javablobcopydestac2blobapitestcopydestacf0535922b348f4d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[1].json new file mode 100644 index 000000000000..09c941878603 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[1].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac77762468988884db61?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E1D77C09\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8f89-201e-00c4-6bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "28e16705-85f9-40f2-ac2f-fc09b841986e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac77762468988884db61/javablobcopydestac1blobapitestcopydestac77714165d6ee57e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E1DE6A35\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8fa6-201e-00c4-02fb-594fb0000000", + "x-ms-client-request-id" : "4c9baac4-4cb1-4bec-b407-2202a71dd14c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac77762468988884db61/javablobcopydestac2blobapitestcopydestac777355164fabf1b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E1E410E1\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8fb9-201e-00c4-13fb-594fb0000000", + "x-ms-client-request-id" : "4ef086b1-4a80-4df1-8123-df52b296a099" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac77762468988884db61/javablobcopydestac2blobapitestcopydestac777355164fabf1b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "ed694d4a-8d8f-4116-80cb-0f8f8db3b9c1", + "ETag" : "\"0x8D72812E1F09710\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e8fd1-201e-00c4-2afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "f23aa601-8888-433e-9d11-6434b7b2040b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9002-201e-00c4-51fb-594fb0000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestac77762468988884db61Fri, 23 Aug 2019 21:43:05 GMT\"0x8D72812E1D77C09\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "6fea53a9-bb55-4ca5-a4ac-523af444b8e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac77762468988884db61?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9014-201e-00c4-5efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "b63419bf-3bfe-44ef-8327-c787b7847833" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestac77762468988884db61", "javablobcopydestac1blobapitestcopydestac77714165d6ee57e", "javablobcopydestac2blobapitestcopydestac777355164fabf1b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[2].json new file mode 100644 index 000000000000..4f8bcd6e38f0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[2].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac28e60586516e9f9aad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E1FFF574\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e902d-201e-00c4-6ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "eaa5f7f2-d0d7-45b8-a44b-0aec1c994439" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac28e60586516e9f9aad/javablobcopydestac1blobapitestcopydestac28e119430394c8a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E205D1F9\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e904a-201e-00c4-09fb-594fb0000000", + "x-ms-client-request-id" : "278f38ba-1e97-408b-877a-ab57ed7f7ff3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac28e60586516e9f9aad/javablobcopydestac2blobapitestcopydestac28e007673b6ef6c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E20CFFAF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e905c-201e-00c4-19fb-594fb0000000", + "x-ms-client-request-id" : "d0ac7e3c-99fe-4097-8dcf-dc3114f41289" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac28e60586516e9f9aad/javablobcopydestac2blobapitestcopydestac28e007673b6ef6c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "4198e6da-d20f-4f1b-b721-a653a8c00381", + "ETag" : "\"0x8D72812E212F497\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e9070-201e-00c4-2afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "326bb727-637f-46b9-ac5b-feb7ba618fc3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e90ac-201e-00c4-5efb-594fb0000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestac28e60586516e9f9aadFri, 23 Aug 2019 21:43:06 GMT\"0x8D72812E1FFF574\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "9b1a1364-cafb-474e-a69d-9aba0e4720d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac28e60586516e9f9aad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e90b8-201e-00c4-6afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "3d944a10-82f6-4ce7-8d6a-27315406faf2" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestac28e60586516e9f9aad", "javablobcopydestac1blobapitestcopydestac28e119430394c8a", "javablobcopydestac2blobapitestcopydestac28e007673b6ef6c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[3].json new file mode 100644 index 000000000000..74f3b5b9d18a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[3].json @@ -0,0 +1,163 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac0f570039e7183f2b26?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E22DC772\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e90d0-201e-00c4-7ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "c34d3528-1a6c-401f-b589-5cc9c5156be1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac0f570039e7183f2b26/javablobcopydestac1blobapitestcopydestac0f596746239378f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E23355C6\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e90e6-201e-00c4-13fb-594fb0000000", + "x-ms-client-request-id" : "10c4b41e-309b-4359-9377-457fc2e84016" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac0f570039e7183f2b26/javablobcopydestac2blobapitestcopydestac0f540728c7e94be", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E2392393\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e90fb-201e-00c4-27fb-594fb0000000", + "x-ms-client-request-id" : "29d0371a-3348-427b-912e-a17f523c7c02" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac0f570039e7183f2b26/javablobcopydestac2blobapitestcopydestac0f540728c7e94be", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812E2392393\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:06 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e910d-201e-00c4-38fb-594fb0000000", + "x-ms-client-request-id" : "84e2e461-45e1-4abd-8d0f-5821ad2cef2f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac0f570039e7183f2b26/javablobcopydestac2blobapitestcopydestac0f540728c7e94be", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "0de6c3b5-a365-4a65-84e8-9f1949c57533", + "ETag" : "\"0x8D72812E2593698\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e9123-201e-00c4-4cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "54aef301-0bef-42e3-9958-f3b7fdc83323" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9175-201e-00c4-14fb-594fb0000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestac0f570039e7183f2b26Fri, 23 Aug 2019 21:43:06 GMT\"0x8D72812E22DC772\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "2c4c1ded-c75d-43b7-b6a4-3b5f11f20619", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac0f570039e7183f2b26?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e917f-201e-00c4-1efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "54a0aa17-fe5b-4d2f-a7cd-367c38dc98c9" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestac0f570039e7183f2b26", "javablobcopydestac1blobapitestcopydestac0f596746239378f", "javablobcopydestac2blobapitestcopydestac0f540728c7e94be" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[4].json new file mode 100644 index 000000000000..5d901b865b0a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[4].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacdaf9694068ee1c4594?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E2697F6B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e919a-201e-00c4-34fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "x-ms-client-request-id" : "436a5336-7267-48a6-8a6f-aae46b3cd633" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacdaf9694068ee1c4594/javablobcopydestac1blobapitestcopydestacdaf569612150898", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E26FAA45\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e91af-201e-00c4-46fb-594fb0000000", + "x-ms-client-request-id" : "35dde9d1-0da0-414a-b5c7-12c8d50e6452" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacdaf9694068ee1c4594/javablobcopydestac2blobapitestcopydestacdaf900288d5d547", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E27550FB\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e91c9-201e-00c4-5dfb-594fb0000000", + "x-ms-client-request-id" : "9ddb8c60-13fd-44c0-87a4-4a6252023d64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacdaf9694068ee1c4594/javablobcopydestac2blobapitestcopydestacdaf900288d5d547", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "ff82dec3-6169-4943-b155-e131c3fdb79e", + "ETag" : "\"0x8D72812E28C12E4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e91d9-201e-00c4-6bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "3838bde0-d72a-457b-8093-f41964dedaf3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9249-201e-00c4-4efb-594fb0000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestacdaf9694068ee1c4594Fri, 23 Aug 2019 21:43:06 GMT\"0x8D72812E2697F6B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "803d2af4-365c-4db7-a453-32b05df598a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestacdaf9694068ee1c4594?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9256-201e-00c4-59fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "b11cbce4-63a1-460b-b7d9-cc11346366c0" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestacdaf9694068ee1c4594", "javablobcopydestac1blobapitestcopydestacdaf569612150898", "javablobcopydestac2blobapitestcopydestacdaf900288d5d547" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[5].json new file mode 100644 index 000000000000..1c09a6584e34 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[5].json @@ -0,0 +1,153 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac501742370bd9a61f2f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E29ECD41\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e9265-201e-00c4-68fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "a82cc541-834c-4886-8904-6f749d0e4440" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac501742370bd9a61f2f/javablobcopydestac1blobapitestcopydestac50155971d1e8576", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E2A5BBAC\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e928a-201e-00c4-03fb-594fb0000000", + "x-ms-client-request-id" : "4d2807fe-b6c5-45f9-bff0-54da00b0aa24" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac501742370bd9a61f2f/javablobcopydestac2blobapitestcopydestac50133499b472ec1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E2AAED1C\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e929f-201e-00c4-14fb-594fb0000000", + "x-ms-client-request-id" : "06c024eb-d972-4ca9-b4de-9f00f9c2d8db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac501742370bd9a61f2f/javablobcopydestac2blobapitestcopydestac50133499b472ec1?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E2AAED1C\"", + "x-ms-lease-id" : "92411295-9330-4dfe-860c-93a1cbfdb545", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e92b1-201e-00c4-23fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "06f887c5-7c9b-482a-8af1-80525cc87f72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac501742370bd9a61f2f/javablobcopydestac2blobapitestcopydestac50133499b472ec1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "1f1bd02a-6cae-4448-aab8-c607387f5481", + "ETag" : "\"0x8D72812E2B63A7E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e92c0-201e-00c4-2ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "36cf13ed-a06f-4132-bc7b-0ae62080d546" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e92d8-201e-00c4-46fb-594fb0000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestac501742370bd9a61f2fFri, 23 Aug 2019 21:43:07 GMT\"0x8D72812E29ECD41\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "6aca7206-96bb-4042-92f5-c3f8f2f33d58", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestac0blobapitestcopydestac501742370bd9a61f2f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e92ee-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "141f7927-974d-4fa4-b5f7-351420ec6144" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestac501742370bd9a61f2f", "javablobcopydestac1blobapitestcopydestac50155971d1e8576", "javablobcopydestac2blobapitestcopydestac50133499b472ec1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[0].json new file mode 100644 index 000000000000..06b8fe76e44e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[0].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail81a02906a5de06?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E2EED590\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e9382-201e-00c4-55fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "f56f75a3-a55f-4924-a646-53f6daf8ebc2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail81a02906a5de06/javablobcopydestacfail1blobapitestcopydestacfail81a03069efc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E2F46434\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9396-201e-00c4-64fb-594fb0000000", + "x-ms-client-request-id" : "0d3e0007-4756-4f9e-a923-70cf35857f2e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail81a02906a5de06/javablobcopydestacfail2blobapitestcopydestacfail81a253514e4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E2FA31FD\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e93af-201e-00c4-78fb-594fb0000000", + "x-ms-client-request-id" : "5c8fb535-3862-4def-938e-1670fb95351a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail81a02906a5de06/javablobcopydestacfail2blobapitestcopydestacfail81a253514e4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51e93c5-201e-00c4-0dfb-594fb0000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e93c5-201e-00c4-0dfb-594fb0000000\nTime:2019-08-23T21:43:07.9571410Z", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "20a0839b-8189-4d49-9e70-d24b290112d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e93f8-201e-00c4-36fb-594fb0000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail81a02906a5de06Fri, 23 Aug 2019 21:43:07 GMT\"0x8D72812E2EED590\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:07 GMT", + "x-ms-client-request-id" : "0a7b0c39-5f5f-4565-8a87-16bb41aa433e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail81a02906a5de06?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e940b-201e-00c4-45fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "c009a771-7c60-4982-b5ed-a302550b586e" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail81a02906a5de06", "javablobcopydestacfail1blobapitestcopydestacfail81a03069efc", "javablobcopydestacfail2blobapitestcopydestacfail81a253514e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[1].json new file mode 100644 index 000000000000..51b5efe572f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[1].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaileaa076898b3446?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E31579CD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e9423-201e-00c4-57fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "ba7cbf6f-15cc-4e63-910f-99a94863e98a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaileaa076898b3446/javablobcopydestacfail1blobapitestcopydestacfaileaa33297d8a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E31C1A35\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e943f-201e-00c4-6ffb-594fb0000000", + "x-ms-client-request-id" : "740ff74e-fe02-4f95-9ce8-0ef59bd7bd1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaileaa076898b3446/javablobcopydestacfail2blobapitestcopydestacfaileaa993258ea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E32172B3\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9447-201e-00c4-76fb-594fb0000000", + "x-ms-client-request-id" : "8ae30993-ef1d-43ac-8e02-da0b776ab5ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaileaa076898b3446/javablobcopydestacfail2blobapitestcopydestacfaileaa993258ea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51e9454-201e-00c4-02fb-594fb0000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e9454-201e-00c4-02fb-594fb0000000\nTime:2019-08-23T21:43:08.1763499Z", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "eabe36d5-f716-4d59-b142-bc96855ddb5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e946a-201e-00c4-14fb-594fb0000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfaileaa076898b3446Fri, 23 Aug 2019 21:43:08 GMT\"0x8D72812E31579CD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "3c13b3e4-856c-4caa-8352-9a12f03ca192", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaileaa076898b3446?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9475-201e-00c4-1efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "2921637c-4a52-414a-ae7c-13615dd284fb" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfaileaa076898b3446", "javablobcopydestacfail1blobapitestcopydestacfaileaa33297d8a", "javablobcopydestacfail2blobapitestcopydestacfaileaa993258ea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[2].json new file mode 100644 index 000000000000..3e074e64a735 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[2].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaila1670664a96ce9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E3369E72\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e9491-201e-00c4-33fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "10fd5c92-d0fe-44c9-bcfe-3e96b1d1354f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaila1670664a96ce9/javablobcopydestacfail1blobapitestcopydestacfaila1604072f2d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E33C2D31\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e94a2-201e-00c4-41fb-594fb0000000", + "x-ms-client-request-id" : "e1c4b33b-41d0-4ae7-9909-2223219a83f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaila1670664a96ce9/javablobcopydestacfail2blobapitestcopydestacfaila1658505b35", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E34185AF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e94b9-201e-00c4-54fb-594fb0000000", + "x-ms-client-request-id" : "a9b37cab-5ca9-4755-9911-f13d1e8c22e1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaila1670664a96ce9/javablobcopydestacfail2blobapitestcopydestacfaila1658505b35", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51e94d8-201e-00c4-6efb-594fb0000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e94d8-201e-00c4-6efb-594fb0000000\nTime:2019-08-23T21:43:08.3975611Z", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "d1b8d7ee-805b-41ad-b770-6b6bd82198ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e94e9-201e-00c4-7bfb-594fb0000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfaila1670664a96ce9Fri, 23 Aug 2019 21:43:08 GMT\"0x8D72812E3369E72\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "20824fcc-3209-467b-985b-d305f06c8d26", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfaila1670664a96ce9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e94fc-201e-00c4-0cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "a3c0bec3-efee-4b46-a0a3-e31a80dfcb41" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfaila1670664a96ce9", "javablobcopydestacfail1blobapitestcopydestacfaila1604072f2d", "javablobcopydestacfail2blobapitestcopydestacfaila1658505b35" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[3].json new file mode 100644 index 000000000000..accfea2f0923 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[3].json @@ -0,0 +1,162 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail65885493c31a11?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E3574DD2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e950b-201e-00c4-1afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "f3c26adb-b49b-4d6e-b540-c0798a2d39f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail65885493c31a11/javablobcopydestacfail1blobapitestcopydestacfail6585283489a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E3804BDA\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e95a2-201e-00c4-1ffb-594fb0000000", + "x-ms-client-request-id" : "7671d226-5c0a-4093-838b-4b0820cc0041" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail65885493c31a11/javablobcopydestacfail2blobapitestcopydestacfail65880859f1f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E385A453\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e95b4-201e-00c4-2ffb-594fb0000000", + "x-ms-client-request-id" : "b816ed7f-1b6a-46c3-83c3-acbbc6c661e0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail65885493c31a11/javablobcopydestacfail2blobapitestcopydestacfail65880859f1f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812E385A453\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:08 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e95be-201e-00c4-37fb-594fb0000000", + "x-ms-client-request-id" : "65360435-8510-40d3-841c-2f6308e81454", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail65885493c31a11/javablobcopydestacfail2blobapitestcopydestacfail65880859f1f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51e95ca-201e-00c4-42fb-594fb0000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e95ca-201e-00c4-42fb-594fb0000000\nTime:2019-08-23T21:43:08.8690105Z", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "47f04129-9126-4cbf-844a-abdb59ec7ce0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e95da-201e-00c4-4ffb-594fb0000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail65885493c31a11Fri, 23 Aug 2019 21:43:08 GMT\"0x8D72812E3574DD2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "5e3136b3-eb93-43f9-9fa5-7000d5dfe215", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail65885493c31a11?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e95e1-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "43e91bb9-ee9d-4f51-b60f-0dc8c99e592d" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail65885493c31a11", "javablobcopydestacfail1blobapitestcopydestacfail6585283489a", "javablobcopydestacfail2blobapitestcopydestacfail65880859f1f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[4].json new file mode 100644 index 000000000000..58a2778961ab --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[4].json @@ -0,0 +1,152 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail19f781578958bd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E39F3DD9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e95ef-201e-00c4-64fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:08 GMT", + "x-ms-client-request-id" : "51269222-ef41-4a8b-9d84-dd114f5b468d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail19f781578958bd/javablobcopydestacfail1blobapitestcopydestacfail19f58689f43", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E3A4A599\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9600-201e-00c4-71fb-594fb0000000", + "x-ms-client-request-id" : "bfc2b2ed-9a71-432c-b123-a94c39ab5f30" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail19f781578958bd/javablobcopydestacfail2blobapitestcopydestacfail19f76465cc7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E3AD0C1B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e9624-201e-00c4-13fb-594fb0000000", + "x-ms-client-request-id" : "583c8844-3bb4-4688-8e16-220cf013c723" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail19f781578958bd/javablobcopydestacfail2blobapitestcopydestacfail19f76465cc7?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E3AD0C1B\"", + "x-ms-lease-id" : "55b5ce06-587b-405d-9051-13f7f0d3ad46", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e9641-201e-00c4-2ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "4d3f964c-cbd0-4469-8ffe-12460dc73fc2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail19f781578958bd/javablobcopydestacfail2blobapitestcopydestacfail19f76465cc7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "d51e9660-201e-00c4-4cfb-594fb0000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:d51e9660-201e-00c4-4cfb-594fb0000000\nTime:2019-08-23T21:43:09.1232534Z", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "1ec98b03-0b65-4394-b5ee-db97f03dd4d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopydestacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e9673-201e-00c4-5ffb-594fb0000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail19f781578958bdFri, 23 Aug 2019 21:43:08 GMT\"0x8D72812E39F3DD9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "343da8de-b545-4761-9ed8-eca1ce8ab17f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail19f781578958bd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e968c-201e-00c4-73fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:09 GMT", + "x-ms-client-request-id" : "563a6324-c571-456b-805b-00452b0c4867" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail19f781578958bd", "javablobcopydestacfail1blobapitestcopydestacfail19f58689f43", "javablobcopydestacfail2blobapitestcopydestacfail19f76465cc7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopyerror.json new file mode 100644 index 000000000000..1b18b504b7a0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopyerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopyerror0blobapitestcopyerrorcd251410586b6aca30f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E68ADF88\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea093-201e-00c4-11fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:13 GMT", + "x-ms-client-request-id" : "814f1436-9a1a-4d20-962e-d0d4ecfe86b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopyerror0blobapitestcopyerrorcd251410586b6aca30f/javablobcopyerror1blobapitestcopyerrorcd20797646b68acc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E692B9FD\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea0a4-201e-00c4-1ffb-594fb0000000", + "x-ms-client-request-id" : "e1dccd78-638a-45df-8f78-8e7ba8391fea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopyerror0blobapitestcopyerrorcd251410586b6aca30f/javablobcopyerror2blobapitestcopyerrorcd22580012ca7ea3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "229", + "StatusCode" : "404", + "x-ms-request-id" : "d51ea0b7-201e-00c4-30fb-594fb0000000", + "Body" : "CannotVerifyCopySourceThe specified resource does not exist.\nRequestId:d51ea0b7-201e-00c4-30fb-594fb0000000\nTime:2019-08-23T21:43:13.9478609Z", + "Date" : "Fri, 23 Aug 2019 21:43:13 GMT", + "x-ms-client-request-id" : "1bc9ef8d-5a14-4cd6-bcb5-b644d337dbc7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopyerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea0ca-201e-00c4-3dfb-594fb0000000", + "Body" : "jtccopyerrorjtccopyerror0blobapitestcopyerrorcd251410586b6aca30fFri, 23 Aug 2019 21:43:13 GMT\"0x8D72812E68ADF88\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:13 GMT", + "x-ms-client-request-id" : "94c96970-c10e-4177-920e-57d649df3e37", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopyerror0blobapitestcopyerrorcd251410586b6aca30f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea0ce-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:13 GMT", + "x-ms-client-request-id" : "54f47e37-394a-4c5c-a83e-b9a31c634a96" + }, + "Exception" : null + } ], + "variables" : [ "jtccopyerror0blobapitestcopyerrorcd251410586b6aca30f", "javablobcopyerror1blobapitestcopyerrorcd20797646b68acc", "javablobcopyerror2blobapitestcopyerrorcd22580012ca7ea3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[0].json new file mode 100644 index 000000000000..144b9b551c33 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[0].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae3c8456926436abf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E0323ED0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e89bb-201e-00c4-78fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "aaa5e8bf-fd42-49c8-8c0f-7a15b50ad60f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae3c8456926436abf/javablobcopymetadata1blobapitestcopymetadatae3c41042ebe8d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E0390541\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e89d3-201e-00c4-0ffb-594fb0000000", + "x-ms-client-request-id" : "74743a37-8a2d-4ea8-9dcf-7846dccc559f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae3c8456926436abf/javablobcopymetadata2blobapitestcopymetadatae3c60857aa81b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "79bd32ab-bada-46b9-83d5-c404e4138a19", + "ETag" : "\"0x8D72812E0467609\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e89df-201e-00c4-1afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "07792ce3-94a2-4ad2-82fd-289eb0a6cee8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae3c8456926436abf/javablobcopymetadata2blobapitestcopymetadatae3c60857aa81b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:03 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e8a07-201e-00c4-3afb-594fb0000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "79bd32ab-bada-46b9-83d5-c404e4138a19", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae3c8456926436abf/javablobcopymetadata1blobapitestcopymetadatae3c41042ebe8d", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:43:03 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812E0467609\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "9a4d0bf9-bb12-4e2b-8727-bddf950e4608" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopymetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8a13-201e-00c4-46fb-594fb0000000", + "Body" : "jtccopymetadatajtccopymetadata0blobapitestcopymetadatae3c8456926436abfFri, 23 Aug 2019 21:43:03 GMT\"0x8D72812E0323ED0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "8e61a256-7a14-4f76-be38-3d26e027d313", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae3c8456926436abf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8a25-201e-00c4-55fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "d068fed3-1e15-42df-88f6-386a2aaa120e" + }, + "Exception" : null + } ], + "variables" : [ "jtccopymetadata0blobapitestcopymetadatae3c8456926436abf", "javablobcopymetadata1blobapitestcopymetadatae3c41042ebe8d", "javablobcopymetadata2blobapitestcopymetadatae3c60857aa81b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[1].json new file mode 100644 index 000000000000..4f01446084df --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[1].json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadataab108326a735e1cd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E0597F78\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8a3c-201e-00c4-68fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "b6de64a9-b5c2-43a0-a0d0-9c512a49a845" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadataab108326a735e1cd/javablobcopymetadata1blobapitestcopymetadataab183156403f2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E05FA98C\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8a47-201e-00c4-72fb-594fb0000000", + "x-ms-client-request-id" : "dcb730ed-7e30-4892-95f9-f3497662dac6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadataab108326a735e1cd/javablobcopymetadata2blobapitestcopymetadataab1348097e80d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "6f6d9249-df36-45bc-9e32-bb3d5ae188ba", + "ETag" : "\"0x8D72812E06613BF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e8a5e-201e-00c4-07fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "60071d78-61fc-475b-ae63-1ebfd173af2d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadataab108326a735e1cd/javablobcopymetadata2blobapitestcopymetadataab1348097e80d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:03 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e8a76-201e-00c4-1cfb-594fb0000000", + "x-ms-meta-fizz" : "buzz", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "6f6d9249-df36-45bc-9e32-bb3d5ae188ba", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadataab108326a735e1cd/javablobcopymetadata1blobapitestcopymetadataab183156403f2", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-meta-foo" : "bar", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:43:03 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812E06613BF\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "b5077856-df15-46de-bcf3-b0ff31333e55" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopymetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8a82-201e-00c4-26fb-594fb0000000", + "Body" : "jtccopymetadatajtccopymetadata0blobapitestcopymetadataab108326a735e1cdFri, 23 Aug 2019 21:43:03 GMT\"0x8D72812E0597F78\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "0a5c01f2-d617-40f9-b614-2ce112605485", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadataab108326a735e1cd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8a8c-201e-00c4-2efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "ff49085b-8f19-4e20-8d5a-30e4a88a8874" + }, + "Exception" : null + } ], + "variables" : [ "jtccopymetadata0blobapitestcopymetadataab108326a735e1cd", "javablobcopymetadata1blobapitestcopymetadataab183156403f2", "javablobcopymetadata2blobapitestcopymetadataab1348097e80d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymin.json new file mode 100644 index 000000000000..95fc38b6d9d1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymin.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymin0blobapitestcopymin09d0880413e48ec419454?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E01699C7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e894f-201e-00c4-18fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "14c9e6f3-a5dc-4c34-a301-0613539eab77" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymin0blobapitestcopymin09d0880413e48ec419454/javablobcopymin1blobapitestcopymin09d415751ecc378f6f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E01D390D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8966-201e-00c4-2cfb-594fb0000000", + "x-ms-client-request-id" : "c3022e73-aade-4d05-b352-03d18eaade69" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymin0blobapitestcopymin09d0880413e48ec419454/javablobcopymin1blobapitestcopymin09d415751ecc378f6f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "84705f0c-e9e1-4337-a4a7-4b05b1c4a2ed", + "ETag" : "\"0x8D72812E0232DFB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e8985-201e-00c4-47fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "55df1bfb-5c29-486e-b0f1-23c673af1851" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopymin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8996-201e-00c4-55fb-594fb0000000", + "Body" : "jtccopyminjtccopymin0blobapitestcopymin09d0880413e48ec419454Fri, 23 Aug 2019 21:43:03 GMT\"0x8D72812E01699C7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "9e4625c9-0e13-48bd-b52e-02603c485385", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopymin0blobapitestcopymin09d0880413e48ec419454?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e89ab-201e-00c4-69fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "6fe6d543-ffc9-4a63-82c1-d8ce4e6ab075" + }, + "Exception" : null + } ], + "variables" : [ "jtccopymin0blobapitestcopymin09d0880413e48ec419454", "javablobcopymin1blobapitestcopymin09d415751ecc378f6f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[0].json new file mode 100644 index 000000000000..a9c85bb4961c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[0].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacc2d494917cde68aa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E089EA18\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8aca-201e-00c4-5efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "5a8bb24d-c745-4ef0-8d40-728a979a8387" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacc2d494917cde68aa/javablobcopysourceac1blobapitestcopysourceacc2d39211ccc8b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E090627F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8aea-201e-00c4-75fb-594fb0000000", + "x-ms-client-request-id" : "fdc894d5-b3c7-4a03-9045-f96827e932c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacc2d494917cde68aa/javablobcopysourceac2blobapitestcopysourceacc2d323348a797", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "8e9c3d8f-d714-487c-a724-69a6924f34e6", + "ETag" : "\"0x8D72812E0967E7F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e8afc-201e-00c4-03fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "73dcf8a6-5cd2-40d7-b456-cd6d94eb88bf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopysourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8b0e-201e-00c4-14fb-594fb0000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceacc2d494917cde68aaFri, 23 Aug 2019 21:43:03 GMT\"0x8D72812E089EA18\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "4e05d77b-226e-47ca-86c7-9abd76c9beba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacc2d494917cde68aa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8b1d-201e-00c4-21fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "85199bc4-e565-4fcb-85fc-f2a673e169b3" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceacc2d494917cde68aa", "javablobcopysourceac1blobapitestcopysourceacc2d39211ccc8b", "javablobcopysourceac2blobapitestcopysourceacc2d323348a797" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[1].json new file mode 100644 index 000000000000..9aa33fcd1a14 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[1].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac5cd52512a5f3ff0e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E0A7B299\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8b2b-201e-00c4-2dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:03 GMT", + "x-ms-client-request-id" : "8835dfa9-0be4-4723-8d79-62ec5267b2ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac5cd52512a5f3ff0e/javablobcopysourceac1blobapitestcopysourceac5cd59664f0db3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E0ACF227\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8b42-201e-00c4-42fb-594fb0000000", + "x-ms-client-request-id" : "986fdc60-e354-4a60-89bf-3bd70c5dbc98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac5cd52512a5f3ff0e/javablobcopysourceac2blobapitestcopysourceac5cd64460aa276", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "bceeb8f6-6a2e-4c47-83f3-f29fa5393863", + "ETag" : "\"0x8D72812E0B33548\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e8b5d-201e-00c4-58fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "7c0588f1-5ca5-49e9-be81-6379239bba02" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopysourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8b89-201e-00c4-7cfb-594fb0000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceac5cd52512a5f3ff0eFri, 23 Aug 2019 21:43:03 GMT\"0x8D72812E0A7B299\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "2dba4dd9-a4d7-4ce4-af48-337e3288ec43", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac5cd52512a5f3ff0e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8b96-201e-00c4-06fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "909cea93-097d-4b07-bcfd-9dc432cb61f2" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceac5cd52512a5f3ff0e", "javablobcopysourceac1blobapitestcopysourceac5cd59664f0db3", "javablobcopysourceac2blobapitestcopysourceac5cd64460aa276" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[2].json new file mode 100644 index 000000000000..73357334c926 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[2].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaccf4085146edff460?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E0C553E7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8baf-201e-00c4-1afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "5ce6dd5a-91e7-4470-8668-af942e830a7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaccf4085146edff460/javablobcopysourceac1blobapitestcopysourceaccf490687ccbad", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E0D51D72\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8bf1-201e-00c4-52fb-594fb0000000", + "x-ms-client-request-id" : "c668dcc4-b8d8-4aa4-9038-b67db5103772" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaccf4085146edff460/javablobcopysourceac2blobapitestcopysourceaccf483346e4c24", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "51eb5e95-9ca5-4f92-8d26-1c3df01e2953", + "ETag" : "\"0x8D72812E0DB608E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e8c00-201e-00c4-5dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "eb0e83b9-3618-4385-8760-0e0383519f59" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopysourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8c1a-201e-00c4-73fb-594fb0000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceaccf4085146edff460Fri, 23 Aug 2019 21:43:04 GMT\"0x8D72812E0C553E7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "82cf8eeb-026a-40fc-bf74-78d72232d64d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaccf4085146edff460?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8c37-201e-00c4-0bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "f2339aa7-c615-4d70-a0bc-e0560fa5716f" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceaccf4085146edff460", "javablobcopysourceac1blobapitestcopysourceaccf490687ccbad", "javablobcopysourceac2blobapitestcopysourceaccf483346e4c24" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[3].json new file mode 100644 index 000000000000..1f60a2a239e0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[3].json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac5ba5231009d95b17?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E0F2B088\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8c54-201e-00c4-23fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "4daa9da2-07e0-45dc-9e25-322203f8de83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac5ba5231009d95b17/javablobcopysourceac1blobapitestcopysourceac5ba51047614f2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E0F8B3C2\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8c6c-201e-00c4-34fb-594fb0000000", + "x-ms-client-request-id" : "d5a1a9ff-578d-45f8-a14e-87d53328fc33" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac5ba5231009d95b17/javablobcopysourceac1blobapitestcopysourceac5ba51047614f2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812E0F8B3C2\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:04 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e8c7b-201e-00c4-41fb-594fb0000000", + "x-ms-client-request-id" : "5021479a-b422-4934-8bde-03f2322798a3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac5ba5231009d95b17/javablobcopysourceac2blobapitestcopysourceac5ba3961631c05", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "e9f097e9-07b3-41d2-a84e-42ebc44586e5", + "ETag" : "\"0x8D72812E104EBBD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e8c8f-201e-00c4-54fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "4fa4e86e-9069-4bf3-8a9c-4947c3dae5c5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopysourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8ca8-201e-00c4-6dfb-594fb0000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceac5ba5231009d95b17Fri, 23 Aug 2019 21:43:04 GMT\"0x8D72812E0F2B088\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "3e286a84-7778-4165-b321-469b86f86385", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac5ba5231009d95b17?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8cb2-201e-00c4-77fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "3e132d48-3d6a-455b-abf2-5bb8b50b0911" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceac5ba5231009d95b17", "javablobcopysourceac1blobapitestcopysourceac5ba51047614f2", "javablobcopysourceac2blobapitestcopysourceac5ba3961631c05" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[4].json new file mode 100644 index 000000000000..1a25d0e4cc06 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[4].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac9f328180ce997258?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E116E336\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8cd0-201e-00c4-11fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "5cb268fb-e2df-475c-9d8e-6926ef9e2bc7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac9f328180ce997258/javablobcopysourceac1blobapitestcopysourceac9f3842566259d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E11C984E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8ce2-201e-00c4-20fb-594fb0000000", + "x-ms-client-request-id" : "414e28f3-8a42-49e2-865e-218692622328" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac9f328180ce997258/javablobcopysourceac2blobapitestcopysourceac9f3239125887d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "f336de78-fb3a-4755-8893-9bc6fa71a711", + "ETag" : "\"0x8D72812E1243B40\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "d51e8cf8-201e-00c4-33fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "23a2a2f3-6f0f-40ce-9413-74c1ad56f048" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopysourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8d12-201e-00c4-49fb-594fb0000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceac9f328180ce997258Fri, 23 Aug 2019 21:43:04 GMT\"0x8D72812E116E336\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "5b367b00-490e-413e-816b-88689be03b20", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac9f328180ce997258?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8d21-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "92e54e69-741b-499e-8c76-a799d838207a" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceac9f328180ce997258", "javablobcopysourceac1blobapitestcopysourceac9f3842566259d", "javablobcopysourceac2blobapitestcopysourceac9f3239125887d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[0].json new file mode 100644 index 000000000000..bd275c0cb52e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[0].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail9ac460171f27?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E13520F8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8d36-201e-00c4-6afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "45717c43-278b-490d-b61d-0caec9a5aee6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail9ac460171f27/javablobcopysourceacfail1blobapitestcopysourceacfail9ac485666", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E13CAB45\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8d4b-201e-00c4-7bfb-594fb0000000", + "x-ms-client-request-id" : "5ee7335e-faa0-42d2-88f4-d965915fbbcc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail9ac460171f27/javablobcopysourceacfail2blobapitestcopysourceacfail9ac263080", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51e8d5d-201e-00c4-0cfb-594fb0000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e8d5d-201e-00c4-0cfb-594fb0000000\nTime:2019-08-23T21:43:04.9943153Z", + "Date" : "Fri, 23 Aug 2019 21:43:04 GMT", + "x-ms-client-request-id" : "d11653c5-1f0b-4b58-bc0b-ac0945c0e098", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopysourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8d6a-201e-00c4-18fb-594fb0000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfail9ac460171f27Fri, 23 Aug 2019 21:43:04 GMT\"0x8D72812E13520F8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "bb3a1e5c-b660-4fdb-a649-c6dd0c2ca964", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail9ac460171f27?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8d78-201e-00c4-25fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "3523ed28-9c59-4e44-872f-451578f9d9a0" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfail9ac460171f27", "javablobcopysourceacfail1blobapitestcopysourceacfail9ac485666", "javablobcopysourceacfail2blobapitestcopysourceacfail9ac263080" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[1].json new file mode 100644 index 000000000000..90c598966a22 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail41571417a44b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E1509EE9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8d9d-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "71127bd0-5c0a-4fc7-b18b-dd1fa96e2713" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail41571417a44b/javablobcopysourceacfail1blobapitestcopysourceacfail415991392", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E1562CF6\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8db0-201e-00c4-52fb-594fb0000000", + "x-ms-client-request-id" : "d4554c19-396f-43a2-a761-4ba26742f798" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail41571417a44b/javablobcopysourceacfail2blobapitestcopysourceacfail415804952", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51e8dc3-201e-00c4-61fb-594fb0000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e8dc3-201e-00c4-61fb-594fb0000000\nTime:2019-08-23T21:43:05.1594730Z", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "0650310d-d313-4181-9e48-5d50ea3c188e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopysourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8dd4-201e-00c4-6efb-594fb0000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfail41571417a44bFri, 23 Aug 2019 21:43:05 GMT\"0x8D72812E1509EE9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "ca8b53f5-17de-48e1-ae53-f260960627c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail41571417a44b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8de1-201e-00c4-7afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "0214a7bd-fc72-4620-9307-f16621fc6fea" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfail41571417a44b", "javablobcopysourceacfail1blobapitestcopysourceacfail415991392", "javablobcopysourceacfail2blobapitestcopysourceacfail415804952" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[2].json new file mode 100644 index 000000000000..416f632252d8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[2].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail13c359304b43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E16C1CE4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8e03-201e-00c4-19fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "0f61c03f-60d0-4a9e-b327-d80a5b628c16" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail13c359304b43/javablobcopysourceacfail1blobapitestcopysourceacfail13c074591", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E172BCA8\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8e21-201e-00c4-34fb-594fb0000000", + "x-ms-client-request-id" : "07f4e235-cc6e-4cc1-bcb6-33cd0c74ba02" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail13c359304b43/javablobcopysourceacfail2blobapitestcopysourceacfail13c84424e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51e8e39-201e-00c4-49fb-594fb0000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e8e39-201e-00c4-49fb-594fb0000000\nTime:2019-08-23T21:43:05.3436487Z", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "94b5d4f8-1eb8-4690-ab89-1305edd70038", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopysourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8e45-201e-00c4-55fb-594fb0000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfail13c359304b43Fri, 23 Aug 2019 21:43:05 GMT\"0x8D72812E16C1CE4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "d7028dfd-d2bd-433d-81f0-8313a9b49fb3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail13c359304b43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8e50-201e-00c4-5ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "c22d9433-963c-40e4-800d-d26b590adbbb" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfail13c359304b43", "javablobcopysourceacfail1blobapitestcopysourceacfail13c074591", "javablobcopysourceacfail2blobapitestcopysourceacfail13c84424e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[3].json new file mode 100644 index 000000000000..45e9c3eaf86a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[3].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailac9663520715?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E1859E91\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8e65-201e-00c4-71fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "4e5b3d6c-da78-4bc4-88d2-bcadcf6c9236" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailac9663520715/javablobcopysourceacfail1blobapitestcopysourceacfailac948179e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E18BA1F7\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8e76-201e-00c4-01fb-594fb0000000", + "x-ms-client-request-id" : "3691aa47-28b8-4ae6-a100-5c56003b4df9" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailac9663520715/javablobcopysourceacfail1blobapitestcopysourceacfailac948179e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:05 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812E18BA1F7\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:05 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e8e92-201e-00c4-17fb-594fb0000000", + "x-ms-client-request-id" : "e396c382-a12b-494d-bcde-e5fc0864e864", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailac9663520715/javablobcopysourceacfail2blobapitestcopysourceacfailac9965497", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51e8eab-201e-00c4-2efb-594fb0000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e8eab-201e-00c4-2efb-594fb0000000\nTime:2019-08-23T21:43:05.5428384Z", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "5298cd5b-4ed5-4779-9411-ef673ab00116", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccopysourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8ec5-201e-00c4-43fb-594fb0000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfailac9663520715Fri, 23 Aug 2019 21:43:05 GMT\"0x8D72812E1859E91\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "49748d11-5616-4db2-b584-aca3f89531be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailac9663520715?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8edf-201e-00c4-5bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:05 GMT", + "x-ms-client-request-id" : "72a39196-976d-4f78-a9b3-f0125c22a7be" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfailac9663520715", "javablobcopysourceacfail1blobapitestcopysourceacfailac948179e", "javablobcopysourceacfail2blobapitestcopysourceacfailac9965497" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdelete.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdelete.json new file mode 100644 index 000000000000..6ae1b6dadd46 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdelete.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0blobapitestdelete80850759cca95a4219cd43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EB716D32\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb149-201e-00c4-53fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "8b5f1d59-f092-4047-8bea-a5ecd3a61b10" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0blobapitestdelete80850759cca95a4219cd43/javablobdelete1blobapitestdelete8080600024329eb36d0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EB76FF3F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb15c-201e-00c4-62fb-594fb0000000", + "x-ms-client-request-id" : "84164585-c459-4d76-970a-97197606c118" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0blobapitestdelete80850759cca95a4219cd43/javablobdelete1blobapitestdelete8080600024329eb36d0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51eb171-201e-00c4-73fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "bddae29d-b7c9-4468-97e6-fc36b910d266" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdelete&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb17a-201e-00c4-7afb-594fb0000000", + "Body" : "jtcdeletejtcdelete0blobapitestdelete80850759cca95a4219cd43Fri, 23 Aug 2019 21:43:22 GMT\"0x8D72812EB716D32\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "feee9876-66b0-4ebd-a47c-f3ebde9e5db5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0blobapitestdelete80850759cca95a4219cd43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb18a-201e-00c4-0afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "6e3a8339-5ca0-4afc-89fe-b5819d82463d" + }, + "Exception" : null + } ], + "variables" : [ "jtcdelete0blobapitestdelete80850759cca95a4219cd43", "javablobdelete1blobapitestdelete8080600024329eb36d0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[0].json new file mode 100644 index 000000000000..331c517d99ce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[0].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacdfe46153a5c872e7a9d7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EC0B88E5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb340-201e-00c4-0efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "f3da0975-d011-408b-8f49-e617d98c1ad5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacdfe46153a5c872e7a9d7/javablobdeleteac1blobapitestdeleteacdfe196744eb840fce", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EC111B2A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb353-201e-00c4-1bfb-594fb0000000", + "x-ms-client-request-id" : "32878e3b-6821-4ae4-aebc-59a2b3811ff1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacdfe46153a5c872e7a9d7/javablobdeleteac1blobapitestdeleteacdfe196744eb840fce", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51eb363-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "ab61f7c6-a502-4a80-be82-df0b5f1aaca3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb36a-201e-00c4-2ffb-594fb0000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteacdfe46153a5c872e7a9d7Fri, 23 Aug 2019 21:43:23 GMT\"0x8D72812EC0B88E5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "f9b6d31e-bc99-45ae-8ef3-8ab22424f2a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacdfe46153a5c872e7a9d7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb372-201e-00c4-36fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "d29d40db-9218-47dc-a848-74eec5f423bd" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteacdfe46153a5c872e7a9d7", "javablobdeleteac1blobapitestdeleteacdfe196744eb840fce" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[1].json new file mode 100644 index 000000000000..ef83afb742d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[1].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac020644102668e8049b63?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EC257FDC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb380-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "04d270cb-025b-47de-bf53-88aa0f6e91b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac020644102668e8049b63/javablobdeleteac1blobapitestdeleteac020276032fdc676f7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EC2B1221\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb390-201e-00c4-4dfb-594fb0000000", + "x-ms-client-request-id" : "2b303c3d-3acf-4b21-9a08-c3e5309671b5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac020644102668e8049b63/javablobdeleteac1blobapitestdeleteac020276032fdc676f7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51eb39a-201e-00c4-55fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "875e14b5-0008-4c5d-a2c7-905266cca227" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb3ac-201e-00c4-62fb-594fb0000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteac020644102668e8049b63Fri, 23 Aug 2019 21:43:23 GMT\"0x8D72812EC257FDC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "649309d3-b577-4b89-876e-2eaaf5cf3d68", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac020644102668e8049b63?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb3bf-201e-00c4-6ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "a7585729-1404-4c3c-b58c-4d24e629ca78" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteac020644102668e8049b63", "javablobdeleteac1blobapitestdeleteac020276032fdc676f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[2].json new file mode 100644 index 000000000000..48a42e72cdd0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[2].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac3d740539ff1a19d824c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EC3F289F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb3cd-201e-00c4-7cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "fc33d8b8-44eb-4a6b-8817-168659726055" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac3d740539ff1a19d824c4/javablobdeleteac1blobapitestdeleteac3d762032edb2900b2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EC44BAFC\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb3de-201e-00c4-09fb-594fb0000000", + "x-ms-client-request-id" : "0699271b-5187-4ce7-958a-70d21c4839dd" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac3d740539ff1a19d824c4/javablobdeleteac1blobapitestdeleteac3d762032edb2900b2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51eb3f2-201e-00c4-18fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "ce2c4d4a-95c8-4150-b276-46a7e8dda23c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb3fa-201e-00c4-1ffb-594fb0000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteac3d740539ff1a19d824c4Fri, 23 Aug 2019 21:43:23 GMT\"0x8D72812EC3F289F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "90c9a7b5-72d2-4866-bcbe-b45615e808c6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac3d740539ff1a19d824c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb403-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "bff3e87e-e4d4-44da-879e-ec2fcea30696" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteac3d740539ff1a19d824c4", "javablobdeleteac1blobapitestdeleteac3d762032edb2900b2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[3].json new file mode 100644 index 000000000000..9b38761b5c87 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[3].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac471243566a84dead5f5f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EC58D168\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb413-201e-00c4-35fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "8b013252-1bae-4a6e-a7f3-ad1849de1f9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac471243566a84dead5f5f/javablobdeleteac1blobapitestdeleteac4719791288f179f23", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EC7105F3\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb44a-201e-00c4-61fb-594fb0000000", + "x-ms-client-request-id" : "d693d14b-96db-4a95-8f97-dd7be220e95e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac471243566a84dead5f5f/javablobdeleteac1blobapitestdeleteac4719791288f179f23", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812EC7105F3\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51eb457-201e-00c4-6efb-594fb0000000", + "x-ms-client-request-id" : "250b8287-495e-460b-b8c5-d1954e65f818", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac471243566a84dead5f5f/javablobdeleteac1blobapitestdeleteac4719791288f179f23", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51eb466-201e-00c4-7cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "ed2cc332-e82e-4c83-a790-adc5d47bb487" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb479-201e-00c4-0efb-594fb0000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteac471243566a84dead5f5fFri, 23 Aug 2019 21:43:23 GMT\"0x8D72812EC58D168\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "de540d69-10b1-42f8-a058-35be002fa776", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac471243566a84dead5f5f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb486-201e-00c4-1bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "85cc4fcb-a3a5-4247-ad17-39e3391e4427" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteac471243566a84dead5f5f", "javablobdeleteac1blobapitestdeleteac4719791288f179f23" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[4].json new file mode 100644 index 000000000000..d08cd424e485 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[4].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac00534189ac53a2ffee72?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EC89D86E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb493-201e-00c4-26fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "9a7fddd2-b5ce-4cc2-9a09-f6f0bf235a81" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac00534189ac53a2ffee72/javablobdeleteac1blobapitestdeleteac005580764d6c57b8d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EC8F91EF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb4a3-201e-00c4-34fb-594fb0000000", + "x-ms-client-request-id" : "4df1efa2-b48a-41f3-ab90-739a9c085b8c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac00534189ac53a2ffee72/javablobdeleteac1blobapitestdeleteac005580764d6c57b8d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51eb4ac-201e-00c4-3dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "5830c1bf-353d-4720-9798-c00c7ba98d35" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb4bf-201e-00c4-4dfb-594fb0000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteac00534189ac53a2ffee72Fri, 23 Aug 2019 21:43:23 GMT\"0x8D72812EC89D86E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "29ae09d6-184d-4fc9-9950-b59fd614e609", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac00534189ac53a2ffee72?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb4cb-201e-00c4-59fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "6a50e702-a6a3-43ca-b558-01573486037b" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteac00534189ac53a2ffee72", "javablobdeleteac1blobapitestdeleteac005580764d6c57b8d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[5].json new file mode 100644 index 000000000000..0823a9aa3310 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[5].json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac7d75373426ae964d5a2f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ECA3812D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb4e7-201e-00c4-73fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "f69797d8-bde9-4319-948a-340c5be1762d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac7d75373426ae964d5a2f/javablobdeleteac1blobapitestdeleteac7d79443220105478c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812ECA913A5\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb4f9-201e-00c4-03fb-594fb0000000", + "x-ms-client-request-id" : "3b53d15b-c060-464b-90eb-7d00a85b422e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac7d75373426ae964d5a2f/javablobdeleteac1blobapitestdeleteac7d79443220105478c?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ECA913A5\"", + "x-ms-lease-id" : "883e882d-c4ba-4b64-a44a-a71c6d20fcf9", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb505-201e-00c4-0dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "cd5a0b36-97ad-4d0b-9d85-9be3c3017ab7" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac7d75373426ae964d5a2f/javablobdeleteac1blobapitestdeleteac7d79443220105478c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51eb516-201e-00c4-1dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "43aa7868-d9aa-4f35-a50a-d020416d36dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb533-201e-00c4-36fb-594fb0000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteac7d75373426ae964d5a2fFri, 23 Aug 2019 21:43:24 GMT\"0x8D72812ECA3812D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "4e991eb2-1129-4243-b8c7-2007d80b6eec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac7d75373426ae964d5a2f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb542-201e-00c4-42fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "4f8184c3-33eb-44f4-bc89-c881bd11aa2c" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteac7d75373426ae964d5a2f", "javablobdeleteac1blobapitestdeleteac7d79443220105478c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[0].json new file mode 100644 index 000000000000..28c2e5e5d36a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[0].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail291932186e7efa7f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ECC8C586\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb555-201e-00c4-53fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "5e287581-eb18-43da-bbe4-052f08497431" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail291932186e7efa7f/javablobdeleteacfail1blobapitestdeleteacfail29165690f05d8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812ECCE09E2\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb569-201e-00c4-63fb-594fb0000000", + "x-ms-client-request-id" : "e24d2ae0-e3eb-4a8d-b03c-ae890065a781" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail291932186e7efa7f/javablobdeleteacfail1blobapitestdeleteacfail29165690f05d8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51eb57b-201e-00c4-75fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51eb57b-201e-00c4-75fb-594fb0000000\nTime:2019-08-23T21:43:24.4028319Z", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "5694d768-05ba-4981-8e4d-722f84cf56fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb584-201e-00c4-7efb-594fb0000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfail291932186e7efa7fFri, 23 Aug 2019 21:43:24 GMT\"0x8D72812ECC8C586\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "e8db4cac-aa1a-409e-8bd5-b149f0634657", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail291932186e7efa7f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb597-201e-00c4-0dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "7a3d05c0-c0a2-4dca-b3fc-09f67ccfed8e" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfail291932186e7efa7f", "javablobdeleteacfail1blobapitestdeleteacfail29165690f05d8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[1].json new file mode 100644 index 000000000000..1ef00a194bec --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail0bf33997d92abeda?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ECE22020\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb5ab-201e-00c4-1efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "860bd898-17fa-4e54-83b4-f024751aeb54" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail0bf33997d92abeda/javablobdeleteacfail1blobapitestdeleteacfail0bf33926b78a7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812ECE78B8F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb5b8-201e-00c4-2afb-594fb0000000", + "x-ms-client-request-id" : "6243ebee-6d46-4557-805e-c63d4eae0a70" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail0bf33997d92abeda/javablobdeleteacfail1blobapitestdeleteacfail0bf33926b78a7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51eb5c3-201e-00c4-35fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51eb5c3-201e-00c4-35fb-594fb0000000\nTime:2019-08-23T21:43:24.5669889Z", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "1c45dfd5-97aa-47f4-97e5-6153a54ce849", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb5d1-201e-00c4-3ffb-594fb0000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfail0bf33997d92abedaFri, 23 Aug 2019 21:43:24 GMT\"0x8D72812ECE22020\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "cbe3cf28-65fe-4c6f-b9f8-b31c39a8e726", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail0bf33997d92abeda?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb5e1-201e-00c4-4cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "4c582ff7-8754-4df6-bc37-f3e042c1323c" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfail0bf33997d92abeda", "javablobdeleteacfail1blobapitestdeleteacfail0bf33926b78a7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[2].json new file mode 100644 index 000000000000..26f35992615e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[2].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail42438325210b9201?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ED1EC2B7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb67e-201e-00c4-4ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "3568de07-9a05-445f-8dce-c7c51b8ade78" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail42438325210b9201/javablobdeleteacfail1blobapitestdeleteacfail4248271839654", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812ED240737\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb68c-201e-00c4-5cfb-594fb0000000", + "x-ms-client-request-id" : "59d00194-ce06-4539-abf1-bfa3e6cf783f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail42438325210b9201/javablobdeleteacfail1blobapitestdeleteacfail4248271839654", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51eb694-201e-00c4-64fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51eb694-201e-00c4-64fb-594fb0000000\nTime:2019-08-23T21:43:24.9583619Z", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "ddab9fa8-bf47-4750-a948-5f346f095518", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb69f-201e-00c4-6efb-594fb0000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfail42438325210b9201Fri, 23 Aug 2019 21:43:24 GMT\"0x8D72812ED1EC2B7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "fceef87f-7d93-4da1-ae53-c0c0239f4685", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail42438325210b9201?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb6a6-201e-00c4-75fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:24 GMT", + "x-ms-client-request-id" : "4a6dbf0e-649c-4925-8209-238769880919" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfail42438325210b9201", "javablobdeleteacfail1blobapitestdeleteacfail4248271839654" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[3].json new file mode 100644 index 000000000000..8e22147df313 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[3].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail35f141930fa6556a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ED366F2D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb6be-201e-00c4-07fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "1423b3e9-3de1-4b2a-87fb-4ae608ed34c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail35f141930fa6556a/javablobdeleteacfail1blobapitestdeleteacfail35f90376a2204", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812ED3C28F6\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb6e1-201e-00c4-27fb-594fb0000000", + "x-ms-client-request-id" : "8de60f41-89ef-4e5f-99e9-36aa3c86106d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail35f141930fa6556a/javablobdeleteacfail1blobapitestdeleteacfail35f90376a2204", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812ED3C28F6\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:25 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51eb6f3-201e-00c4-36fb-594fb0000000", + "x-ms-client-request-id" : "a967cb55-6e87-4282-b35c-fefe9cbe458f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail35f141930fa6556a/javablobdeleteacfail1blobapitestdeleteacfail35f90376a2204", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51eb702-201e-00c4-43fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51eb702-201e-00c4-43fb-594fb0000000\nTime:2019-08-23T21:43:25.1475416Z", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "bbdde9d3-e04f-49c1-81e1-976bec039593", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb710-201e-00c4-4efb-594fb0000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfail35f141930fa6556aFri, 23 Aug 2019 21:43:25 GMT\"0x8D72812ED366F2D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "00d0793a-af46-41ae-841a-9b7a2bc32c64", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail35f141930fa6556a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb723-201e-00c4-5efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "b35aeafc-eff2-4dd4-aeb1-1ca645ad2655" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfail35f141930fa6556a", "javablobdeleteacfail1blobapitestdeleteacfail35f90376a2204" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[4].json new file mode 100644 index 000000000000..1d06a14af674 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[4].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail4283360417b902a5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ED541089\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb742-201e-00c4-7cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "cfbb2d82-d27f-4ac0-81d9-c273e8c6c947" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail4283360417b902a5/javablobdeleteacfail1blobapitestdeleteacfail42890440660ad", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812ED597C2A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb754-201e-00c4-0afb-594fb0000000", + "x-ms-client-request-id" : "9d1d917b-8a4f-4264-878e-a75cb4907562" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail4283360417b902a5/javablobdeleteacfail1blobapitestdeleteacfail42890440660ad?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ED597C2A\"", + "x-ms-lease-id" : "249277b8-16c3-4a95-b1d4-2cecf1d7cb98", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb769-201e-00c4-1dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "efaed133-015e-460b-8399-3779f2916d5c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail4283360417b902a5/javablobdeleteacfail1blobapitestdeleteacfail42890440660ad", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "d51eb77d-201e-00c4-31fb-594fb0000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:d51eb77d-201e-00c4-31fb-594fb0000000\nTime:2019-08-23T21:43:25.3407261Z", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "16685631-0924-4dd1-81de-6f0615edbdd4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb78a-201e-00c4-3cfb-594fb0000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfail4283360417b902a5Fri, 23 Aug 2019 21:43:25 GMT\"0x8D72812ED541089\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "fae77bab-c6e0-461c-bc6a-7434ed80ca6e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail4283360417b902a5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb79d-201e-00c4-4afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "56c70c1a-acfb-4965-9719-0a776e7c0b82" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfail4283360417b902a5", "javablobdeleteacfail1blobapitestdeleteacfail42890440660ad" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeletemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeletemin.json new file mode 100644 index 000000000000..91253616b80c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeletemin.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0blobapitestdeleteminee8339679852f76a513?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EB8AA0A7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb19b-201e-00c4-19fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "b3ba79f0-a07c-442e-83ce-a84c8c4c5053" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0blobapitestdeleteminee8339679852f76a513/javablobdeletemin1blobapitestdeleteminee852989ebd30c17", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EB900B9C\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb1a8-201e-00c4-24fb-594fb0000000", + "x-ms-client-request-id" : "38550081-5263-48d0-865c-7f0612951a8f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0blobapitestdeleteminee8339679852f76a513/javablobdeletemin1blobapitestdeleteminee852989ebd30c17", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51eb1be-201e-00c4-37fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "deec3c9e-b939-4d72-91d9-98a19fb8d3e2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeletemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb1d6-201e-00c4-4bfb-594fb0000000", + "Body" : "jtcdeleteminjtcdeletemin0blobapitestdeleteminee8339679852f76a513Fri, 23 Aug 2019 21:43:22 GMT\"0x8D72812EB8AA0A7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "988c5f0d-fa95-4707-8b2b-a6719217f619", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0blobapitestdeleteminee8339679852f76a513?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb1df-201e-00c4-53fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "7d78a57b-571f-4a21-8bea-54552e01366b" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeletemin0blobapitestdeleteminee8339679852f76a513", "javablobdeletemin1blobapitestdeleteminee852989ebd30c17" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[0].json new file mode 100644 index 000000000000..cd46f5e2f1df --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[0].json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions98073583cf25923?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EBA497A2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb1f7-201e-00c4-69fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "b34dc5cb-a726-46e5-9994-0149b3c1b9ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions98073583cf25923/javablobdeleteoptions1blobapitestdeleteoptions98092441afcd", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EBA9DB93\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb20b-201e-00c4-79fb-594fb0000000", + "x-ms-client-request-id" : "9f6a94dc-af27-4237-8b1d-cfac467f0591" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions98073583cf25923/javablobdeleteoptions1blobapitestdeleteoptions98092441afcd?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:43:22.4844756Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EBA9DB93\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb221-201e-00c4-0efb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "3ea507d1-755c-4139-9178-4d1bab988405" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions98073583cf25923/javablobdeleteoptions2blobapitestdeleteoptions980370031dfe", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EBB43E60\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb232-201e-00c4-1dfb-594fb0000000", + "x-ms-client-request-id" : "14721c10-b666-4c6b-b81d-a4107eb55366" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions98073583cf25923/javablobdeleteoptions1blobapitestdeleteoptions98092441afcd", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51eb240-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "3260c003-f1ad-417f-971f-f30e7eb13d7d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions98073583cf25923?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb254-201e-00c4-37fb-594fb0000000", + "Body" : "javablobdeleteoptions2blobapitestdeleteoptions980370031dfeFri, 23 Aug 2019 21:43:22 GMTFri, 23 Aug 2019 21:43:22 GMT0x8D72812EBB43E607application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "2ed8111f-372d-4673-ba9b-349855304ca6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteoptions&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb25e-201e-00c4-41fb-594fb0000000", + "Body" : "jtcdeleteoptionsjtcdeleteoptions0blobapitestdeleteoptions98073583cf25923Fri, 23 Aug 2019 21:43:22 GMT\"0x8D72812EBA497A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "0c7036a5-1f6b-412d-b7d0-192efe16fa3a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions98073583cf25923?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb261-201e-00c4-44fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "eb0b17fe-6c3a-4e85-8ea6-7b1a75ba5c00" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteoptions0blobapitestdeleteoptions98073583cf25923", "javablobdeleteoptions1blobapitestdeleteoptions98092441afcd", "javablobdeleteoptions2blobapitestdeleteoptions980370031dfe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[1].json new file mode 100644 index 000000000000..3d95855b71e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[1].json @@ -0,0 +1,171 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68089261206d897?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EBCF0D60\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb275-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "d701ea4b-71ea-47e7-8ca9-c200b75f125e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68089261206d897/javablobdeleteoptions1blobapitestdeleteoptions68084426f542", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EBD64D9D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb291-201e-00c4-6efb-594fb0000000", + "x-ms-client-request-id" : "113d17a7-1eb8-4706-bc6e-acaa5bdef7f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68089261206d897/javablobdeleteoptions1blobapitestdeleteoptions68084426f542?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:43:22.7767560Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EBD64D9D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb29f-201e-00c4-7cfb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "18360adf-ee55-4107-a7f7-9cefb328c1e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68089261206d897/javablobdeleteoptions2blobapitestdeleteoptions6801085197bc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EBF379C7\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb2f0-201e-00c4-43fb-594fb0000000", + "x-ms-client-request-id" : "c0a27207-4cd4-4aa6-86fd-6542c1292b04" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68089261206d897/javablobdeleteoptions1blobapitestdeleteoptions68084426f542", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51eb301-201e-00c4-52fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "04374d47-25e4-40a7-8aee-0c9d6c8f8e28" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68089261206d897?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb30e-201e-00c4-5ffb-594fb0000000", + "Body" : "javablobdeleteoptions1blobapitestdeleteoptions68084426f542Fri, 23 Aug 2019 21:43:22 GMTFri, 23 Aug 2019 21:43:22 GMT0x8D72812EBD64D9D7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javablobdeleteoptions2blobapitestdeleteoptions6801085197bcFri, 23 Aug 2019 21:43:22 GMTFri, 23 Aug 2019 21:43:22 GMT0x8D72812EBF379C77application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "335beb81-b60e-4a02-92b9-0af0b79de3c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteoptions&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb31c-201e-00c4-6cfb-594fb0000000", + "Body" : "jtcdeleteoptionsjtcdeleteoptions0blobapitestdeleteoptions68089261206d897Fri, 23 Aug 2019 21:43:22 GMT\"0x8D72812EBCF0D60\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "ae9268c1-f0ea-43ee-9073-d50bd5b01d6a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68089261206d897?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb328-201e-00c4-78fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:23 GMT", + "x-ms-client-request-id" : "860f2f53-e44d-4cb7-8306-c39b5dfd33d9" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteoptions0blobapitestdeleteoptions68089261206d897", "javablobdeleteoptions1blobapitestdeleteoptions68084426f542", "javablobdeleteoptions2blobapitestdeleteoptions6801085197bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[0].json new file mode 100644 index 000000000000..48b6a0117ddf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[0].json @@ -0,0 +1,116 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacf9138300435f5a10c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C4F4468D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1df0-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "c4eff12f-f85d-4c99-b4df-10eddc84861f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacf9138300435f5a10c4/javablobdownloadac1blobapitestdownloadacf916685628cfdb2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C4FA17E0\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1e17-201e-00c4-75fb-594fb0000000", + "x-ms-client-request-id" : "5d6503a2-374b-4871-a8a9-083b3e180996" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacf9138300435f5a10c4/javablobdownloadac1blobapitestdownloadacf916685628cfdb2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C4FA17E0\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:17 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e1e4e-201e-00c4-27fb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "dbcefd1f-e66c-48ed-894d-625676089b23", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1e5d-201e-00c4-36fb-594fb0000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadacf9138300435f5a10c4Fri, 23 Aug 2019 21:42:17 GMT\"0x8D72812C4F4468D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "7fe83902-3744-4818-a400-055937ceb927", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacf9138300435f5a10c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1e6b-201e-00c4-42fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "df9e82ab-f851-4a5f-b008-0ce74ee3e8d2" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadacf9138300435f5a10c4", "javablobdownloadac1blobapitestdownloadacf916685628cfdb2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[1].json new file mode 100644 index 000000000000..0f963d0e25fa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[1].json @@ -0,0 +1,116 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacae359610a6a1c973e7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C512AB6B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1e7e-201e-00c4-53fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "0a099121-54b3-46a7-9be8-377764bbdf94" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacae359610a6a1c973e7/javablobdownloadac1blobapitestdownloadacae330309d4c175b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C518F213\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1e98-201e-00c4-6afb-594fb0000000", + "x-ms-client-request-id" : "ffe6ae87-8fad-4df1-b9db-c185d29989b6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacae359610a6a1c973e7/javablobdownloadac1blobapitestdownloadacae330309d4c175b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C518F213\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:17 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e1eb6-201e-00c4-7cfb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "11350f29-53f8-4cf9-8ad3-fe7aa1873f29", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1ecc-201e-00c4-11fb-594fb0000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadacae359610a6a1c973e7Fri, 23 Aug 2019 21:42:17 GMT\"0x8D72812C512AB6B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "5ff6d21d-e9b7-4d01-b782-c85485af360b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacae359610a6a1c973e7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1ed6-201e-00c4-1bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "9360ee6b-649e-418f-a2e3-5f039e71f4cd" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadacae359610a6a1c973e7", "javablobdownloadac1blobapitestdownloadacae330309d4c175b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[2].json new file mode 100644 index 000000000000..7c356e1fef78 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[2].json @@ -0,0 +1,116 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacb4e18131944ad3f732?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C52DDB2E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1ef3-201e-00c4-35fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "61dce065-8e3f-4328-844e-597f4e97d96a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacb4e18131944ad3f732/javablobdownloadac1blobapitestdownloadacb4e524493a9cc17", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C5335E5A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1f01-201e-00c4-42fb-594fb0000000", + "x-ms-client-request-id" : "0e38e3f7-79c1-47c6-b794-4a6b5b3206df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacb4e18131944ad3f732/javablobdownloadac1blobapitestdownloadacb4e524493a9cc17", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C5335E5A\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:17 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e1f1c-201e-00c4-5bfb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "6f70c9af-a428-46ca-a059-ed25ab27a4cb", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1f37-201e-00c4-70fb-594fb0000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadacb4e18131944ad3f732Fri, 23 Aug 2019 21:42:17 GMT\"0x8D72812C52DDB2E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "dd32ea1b-41b2-44cf-b6ef-5815a3403436", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacb4e18131944ad3f732?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1f4b-201e-00c4-01fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "78b1b732-70f8-4967-a165-2fe5dda6668a" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadacb4e18131944ad3f732", "javablobdownloadac1blobapitestdownloadacb4e524493a9cc17" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[3].json new file mode 100644 index 000000000000..c0be5187676a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[3].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacc36297804e935bafcb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C547D225\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1f68-201e-00c4-1cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "2f3ff0f9-5088-42b4-9f7e-881625943280" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacc36297804e935bafcb/javablobdownloadac1blobapitestdownloadacc3606342d627736", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C54DA389\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1f8b-201e-00c4-3bfb-594fb0000000", + "x-ms-client-request-id" : "7ff21c2e-f1f9-4f6c-a978-b27f6f570cfd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacc36297804e935bafcb/javablobdownloadac1blobapitestdownloadacc3606342d627736", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C54DA389\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:18 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e1fa8-201e-00c4-56fb-594fb0000000", + "x-ms-client-request-id" : "42efad3a-1095-4470-8c31-951cd6cc5d0b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacc36297804e935bafcb/javablobdownloadac1blobapitestdownloadacc3606342d627736", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C54DA389\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:18 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e1fba-201e-00c4-64fb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "ca2dfdb0-6b3a-465d-81ef-3c2b0e33e5b8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1fd1-201e-00c4-77fb-594fb0000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadacc36297804e935bafcbFri, 23 Aug 2019 21:42:18 GMT\"0x8D72812C547D225\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "0390e0db-9bac-42e7-91a3-7caa50fa6b69", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacc36297804e935bafcb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1fdf-201e-00c4-02fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "9bbbe2d0-d1cc-40be-a59b-33ee5b64add0" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadacc36297804e935bafcb", "javablobdownloadac1blobapitestdownloadacc3606342d627736" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[4].json new file mode 100644 index 000000000000..572609afffde --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[4].json @@ -0,0 +1,116 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacbd469332b74a4a3386?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C585FBC0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2056-201e-00c4-69fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "12273fec-7176-4687-81c4-fb7c2d908752" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacbd469332b74a4a3386/javablobdownloadac1blobapitestdownloadacbd457158182403f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C58D2D2C\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e206f-201e-00c4-7efb-594fb0000000", + "x-ms-client-request-id" : "872d96e6-6d5c-4b64-9fc1-17a3c51448a0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacbd469332b74a4a3386/javablobdownloadac1blobapitestdownloadacbd457158182403f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C58D2D2C\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:18 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e207f-201e-00c4-0cfb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "e51f43c6-189e-46ab-9253-9cfe7cb55cc5", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2099-201e-00c4-22fb-594fb0000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadacbd469332b74a4a3386Fri, 23 Aug 2019 21:42:18 GMT\"0x8D72812C585FBC0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "922dd4d6-6070-4926-8a31-20f07fadf380", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacbd469332b74a4a3386?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e20b2-201e-00c4-35fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "6a0d74ae-9b8c-4a2f-8540-ff618152cac3" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadacbd469332b74a4a3386", "javablobdownloadac1blobapitestdownloadacbd457158182403f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[5].json new file mode 100644 index 000000000000..fac4fd17b221 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[5].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac252710172a9449630c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C5A179BB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e20c7-201e-00c4-46fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "67de886b-228f-41eb-a036-0673df9b2dcd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac252710172a9449630c/javablobdownloadac1blobapitestdownloadac252868972bd083b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C5A6D5F5\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e20d7-201e-00c4-52fb-594fb0000000", + "x-ms-client-request-id" : "523eefd3-4781-4352-997f-3c2fc2731f1f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac252710172a9449630c/javablobdownloadac1blobapitestdownloadac252868972bd083b?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C5A6D5F5\"", + "x-ms-lease-id" : "c26b9f82-a765-4f7c-befd-066a275d827e", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e20e5-201e-00c4-5ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "bedae72b-4526-42ce-94c2-e76bae9034d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac252710172a9449630c/javablobdownloadac1blobapitestdownloadac252868972bd083b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C5A6D5F5\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "d51e20f7-201e-00c4-6ffb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "d77ab947-8283-4b50-a6e4-dba3548378f6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e210a-201e-00c4-02fb-594fb0000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadac252710172a9449630cFri, 23 Aug 2019 21:42:18 GMT\"0x8D72812C5A179BB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "2723d63c-51c8-4e47-9680-4b89949d9868", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac252710172a9449630c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2119-201e-00c4-0dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "3acdaa66-fd74-46a7-a2eb-3a8b01158620" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadac252710172a9449630c", "javablobdownloadac1blobapitestdownloadac252868972bd083b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[0].json new file mode 100644 index 000000000000..427c7c08edf9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail9299867463fbc9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C5C005AC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e213c-201e-00c4-2bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:17 GMT", + "x-ms-client-request-id" : "e7b31323-794c-4729-9d01-732cc5fd769f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail9299867463fbc9/javablobdownloadacfail1blobapitestdownloadacfail92915034c6a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C5D0AF65\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e217c-201e-00c4-5dfb-594fb0000000", + "x-ms-client-request-id" : "1867b5d7-fd70-4dc7-847e-e63546feb44a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail9299867463fbc9/javablobdownloadacfail1blobapitestdownloadacfail92915034c6a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "d51e2192-201e-00c4-6ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "a6b8ddf8-871a-4074-bce2-12663bee4b9f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e21a8-201e-00c4-03fb-594fb0000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfail9299867463fbc9Fri, 23 Aug 2019 21:42:18 GMT\"0x8D72812C5C005AC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "d92050c6-93f7-4a56-8b2d-440767290982", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail9299867463fbc9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e21b6-201e-00c4-10fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "1f8b619a-3b3b-43b5-a8e1-4c8ee6c9f5aa" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfail9299867463fbc9", "javablobdownloadacfail1blobapitestdownloadacfail92915034c6a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[1].json new file mode 100644 index 000000000000..039ff142c4a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailff381106dc3e3e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C5F7C51B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e222e-201e-00c4-7afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "91574983-2640-4ec5-8bd2-9794c75d9169" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailff381106dc3e3e/javablobdownloadacfail1blobapitestdownloadacfailff331313a19", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C5FDBDDF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e224d-201e-00c4-10fb-594fb0000000", + "x-ms-client-request-id" : "005bd621-bf69-483c-b88e-44dd9997c66d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailff381106dc3e3e/javablobdownloadacfail1blobapitestdownloadacfailff331313a19", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e225c-201e-00c4-1efb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e225c-201e-00c4-1efb-594fb0000000\nTime:2019-08-23T21:42:19.2827005Z", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "eaec6f50-56e9-41ee-a69c-0ce4cadf8176", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e226a-201e-00c4-2cfb-594fb0000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfailff381106dc3e3eFri, 23 Aug 2019 21:42:19 GMT\"0x8D72812C5F7C51B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "aa0dc860-f121-4663-add3-53f774ea7d54", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailff381106dc3e3e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2272-201e-00c4-34fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "b943b554-3190-426c-bfba-6576e93ed494" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfailff381106dc3e3e", "javablobdownloadacfail1blobapitestdownloadacfailff331313a19" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[2].json new file mode 100644 index 000000000000..05f251fb815b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[2].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailafe066866ad60c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C611E329\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2286-201e-00c4-47fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "ff3ca728-84fc-495b-9b0c-0897e02051e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailafe066866ad60c/javablobdownloadacfail1blobapitestdownloadacfailafe85163cf8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C61766B5\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e229c-201e-00c4-57fb-594fb0000000", + "x-ms-client-request-id" : "64b75c13-6f25-4ddc-869f-906097793c21" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailafe066866ad60c/javablobdownloadacfail1blobapitestdownloadacfailafe85163cf8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e22ae-201e-00c4-69fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e22ae-201e-00c4-69fb-594fb0000000\nTime:2019-08-23T21:42:19.4448552Z", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "7e00fe0a-3516-4e38-a7c9-2cb3c6672243", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e22b9-201e-00c4-73fb-594fb0000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfailafe066866ad60cFri, 23 Aug 2019 21:42:19 GMT\"0x8D72812C611E329\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "b10b5b7a-d1d3-4479-80a9-0ad397e01001", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailafe066866ad60c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e22c7-201e-00c4-80fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "1fe5e4b3-eabc-41b4-8e5b-7c0c43a7942e" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfailafe066866ad60c", "javablobdownloadacfail1blobapitestdownloadacfailafe85163cf8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[3].json new file mode 100644 index 000000000000..79f1e3eac2c7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[3].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailcfe0559054de82?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C62AC86F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e22e4-201e-00c4-16fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "ffe30a49-e32f-4ad7-ac96-55c338fd1d3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailcfe0559054de82/javablobdownloadacfail1blobapitestdownloadacfailcfe327275ff", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C6304C00\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e22f7-201e-00c4-27fb-594fb0000000", + "x-ms-client-request-id" : "1957919b-fc37-4b8b-a580-dcde5ed9ded8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailcfe0559054de82/javablobdownloadacfail1blobapitestdownloadacfailcfe327275ff", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C6304C00\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:19 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e2310-201e-00c4-3cfb-594fb0000000", + "x-ms-client-request-id" : "fab576c1-0d1a-4134-b494-44a7237be734", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailcfe0559054de82/javablobdownloadacfail1blobapitestdownloadacfailcfe327275ff", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "d51e2323-201e-00c4-4ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "0813a23d-2900-48b6-b716-0cc5883d2f0e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e232f-201e-00c4-5bfb-594fb0000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfailcfe0559054de82Fri, 23 Aug 2019 21:42:19 GMT\"0x8D72812C62AC86F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "00348fb6-d909-41d8-b185-ef44d930fe4e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailcfe0559054de82?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2342-201e-00c4-6afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "2d0ded5e-5f59-4a06-b6f8-6b5711d7e976" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfailcfe0559054de82", "javablobdownloadacfail1blobapitestdownloadacfailcfe327275ff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[4].json new file mode 100644 index 000000000000..55d21ef8995c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[4].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailcbb829946cc992?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C649A298\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2356-201e-00c4-7afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "51011069-fcf5-4605-9f1b-440398d3d41d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailcbb829946cc992/javablobdownloadacfail1blobapitestdownloadacfailcbb07208192", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C64F4D4B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e236e-201e-00c4-0ffb-594fb0000000", + "x-ms-client-request-id" : "2d294c7e-d78b-43e5-9139-7935337ffca1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailcbb829946cc992/javablobdownloadacfail1blobapitestdownloadacfailcbb07208192?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C64F4D4B\"", + "x-ms-lease-id" : "e9273279-b2ec-43a0-b07a-ccfb4b23d88f", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e237c-201e-00c4-1bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "9bad0a36-d77b-4011-8b35-d3ff9a1b4695" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailcbb829946cc992/javablobdownloadacfail1blobapitestdownloadacfailcbb07208192", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "d51e238f-201e-00c4-2dfb-594fb0000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:d51e238f-201e-00c4-2dfb-594fb0000000\nTime:2019-08-23T21:42:19.8472389Z", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "ae637d00-e39a-42ad-be1c-798be291afa0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2399-201e-00c4-37fb-594fb0000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfailcbb829946cc992Fri, 23 Aug 2019 21:42:19 GMT\"0x8D72812C649A298\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "60af9ac6-4d0f-4513-87e9-dd44813e434d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailcbb829946cc992?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e23a9-201e-00c4-47fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "e1624268-45dd-4b83-8153-9def4c261ff4" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfailcbb829946cc992", "javablobdownloadacfail1blobapitestdownloadacfailcbb07208192" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadallnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadallnull.json new file mode 100644 index 000000000000..7b9dc24d0fb2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadallnull.json @@ -0,0 +1,116 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnullb37403211703e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C3EC0BD2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e19c4-201e-00c4-3dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-client-request-id" : "ee1310eb-9eac-4b40-b3c2-9bf9e8466c5b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnullb37403211703e/javablobdownloadallnull1blobapitestdownloadallnullb37130277d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C3F2793D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e19de-201e-00c4-51fb-594fb0000000", + "x-ms-client-request-id" : "724b9152-02f0-4838-bccf-aa630db46ff5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnullb37403211703e/javablobdownloadallnull1blobapitestdownloadallnullb37130277d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:14 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C3F2793D\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e1a10-201e-00c4-7dfb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "32b249d8-2635-4897-bef5-b964b292716e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadallnull&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1a29-201e-00c4-10fb-594fb0000000", + "Body" : "jtcdownloadallnulljtcdownloadallnull0blobapitestdownloadallnullb37403211703eFri, 23 Aug 2019 21:42:15 GMT\"0x8D72812C3EC0BD2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "8793d82e-cca6-43dc-80df-ea857a159ce4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnullb37403211703e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1a38-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "c956f78c-762c-4c8a-953d-4efd1c356bcc" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadallnull0blobapitestdownloadallnullb37403211703e", "javablobdownloadallnull1blobapitestdownloadallnullb37130277d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloademptyfile.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloademptyfile.json new file mode 100644 index 000000000000..9254f23429e0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloademptyfile.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfileb0d25342768?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C41AA14E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1a69-201e-00c4-4afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "1a72bea8-31cc-4110-97ef-ec4d66cd8ded" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfileb0d25342768/javablobdownloademptyfile1blobapitestdownloademptyfileb0d68836", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C4215CF8\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1a95-201e-00c4-6dfb-594fb0000000", + "x-ms-client-request-id" : "967f22e2-632a-4972-b1d2-b5d697cbc6f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfileb0d25342768/emptyAppendBlob", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C4272AC1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1aa2-201e-00c4-79fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "944f4a67-754b-4c87-a609-862b97906375" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfileb0d25342768/emptyAppendBlob", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C4272AC1\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1ab0-201e-00c4-05fb-594fb0000000", + "x-ms-client-request-id" : "01ff5b69-dc3d-4aef-bc87-0c244085da77", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloademptyfile&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1abf-201e-00c4-10fb-594fb0000000", + "Body" : "jtcdownloademptyfilejtcdownloademptyfile0blobapitestdownloademptyfileb0d25342768Fri, 23 Aug 2019 21:42:16 GMT\"0x8D72812C41AA14E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "a55e9494-4dab-47af-8d7d-e336b6e8711e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfileb0d25342768?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1ad0-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "db56b434-33c2-43f2-8c7e-5d65cf4e5c58" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloademptyfile0blobapitestdownloademptyfileb0d25342768", "javablobdownloademptyfile1blobapitestdownloademptyfileb0d68836" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloaderror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloaderror.json new file mode 100644 index 000000000000..d82274ef6efe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloaderror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderrorcea57812517c309?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C6829AD3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e242e-201e-00c4-3dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "a9c44dd5-634f-4e52-b5b9-cd0a4a0930aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderrorcea57812517c309/javablobdownloaderror1blobapitestdownloaderrorcea298144fbf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C68893CA\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e244d-201e-00c4-58fb-594fb0000000", + "x-ms-client-request-id" : "c2052168-f9e1-4174-a410-c832667a7fcc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderrorcea57812517c309/javablobdownloaderror2blobapitestdownloaderrorcea54550b144", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2467-201e-00c4-6ffb-594fb0000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:d51e2467-201e-00c4-6ffb-594fb0000000\nTime:2019-08-23T21:42:20.1915669Z", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "aef9e633-b5fb-4df2-b771-4dfeb5c080d6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloaderror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e247b-201e-00c4-01fb-594fb0000000", + "Body" : "jtcdownloaderrorjtcdownloaderror0blobapitestdownloaderrorcea57812517c309Fri, 23 Aug 2019 21:42:20 GMT\"0x8D72812C6829AD3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "302623be-9795-4d72-9c67-131af6f1a2ec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderrorcea57812517c309?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e248b-201e-00c4-0dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "642b2f19-8be0-4fb6-8b1d-8da1282ec150" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloaderror0blobapitestdownloaderrorcea57812517c309", "javablobdownloaderror1blobapitestdownloaderrorcea298144fbf", "javablobdownloaderror2blobapitestdownloaderrorcea54550b144" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmd5.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmd5.json new file mode 100644 index 000000000000..64bd134c2e51 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmd5.json @@ -0,0 +1,118 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd589647025f30e1848c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C667E055\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e23b7-201e-00c4-55fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:18 GMT", + "x-ms-client-request-id" : "2b8b6eb6-d60b-47b0-b931-0aa9212ce910" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd589647025f30e1848c/javablobdownloadmd51blobapitestdownloadmd58961342770dce5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C66D63FD\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e23d0-201e-00c4-69fb-594fb0000000", + "x-ms-client-request-id" : "135e15d3-bbbb-46ee-9928-d3615ffd6c61" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd589647025f30e1848c/javablobdownloadmd51blobapitestdownloadmd58961342770dce5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Content-Range" : "bytes 0-2/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:19 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "TtlAdjDrEADA9rY4Qt76fQ==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C66D63FD\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:19 GMT", + "Content-Length" : "3", + "x-ms-request-id" : "d51e23e6-201e-00c4-7dfb-594fb0000000", + "Body" : "[100, 101, 102]", + "x-ms-client-request-id" : "26903bd3-389a-4441-8f96-d9499205c8b1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadmd5&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e23f5-201e-00c4-0cfb-594fb0000000", + "Body" : "jtcdownloadmd5jtcdownloadmd50blobapitestdownloadmd589647025f30e1848cFri, 23 Aug 2019 21:42:19 GMT\"0x8D72812C667E055\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "dd6e5e00-cf20-4a29-99ee-fed623482472", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd589647025f30e1848c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e240a-201e-00c4-20fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "4e349e41-f9ec-4fef-8447-8057a6422ae0" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadmd50blobapitestdownloadmd589647025f30e1848c", "javablobdownloadmd51blobapitestdownloadmd58961342770dce5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmin.json new file mode 100644 index 000000000000..aae326e65510 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmin.json @@ -0,0 +1,116 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmine48066266e0b9ab9a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C474972A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1bea-201e-00c4-0afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "6b6c75a0-fb86-47b6-8c6d-a63ab38608db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmine48066266e0b9ab9a/javablobdownloadmin1blobapitestdownloadmine482867319bf74", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C47A683B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1bfa-201e-00c4-16fb-594fb0000000", + "x-ms-client-request-id" : "feb43692-eeb1-4337-88cf-80abd3fd51a3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmine48066266e0b9ab9a/javablobdownloadmin1blobapitestdownloadmine482867319bf74", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C47A683B\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e1c12-201e-00c4-2afb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "0d3127d2-da25-46e3-a20c-dc2a69e200c1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1c25-201e-00c4-39fb-594fb0000000", + "Body" : "jtcdownloadminjtcdownloadmin0blobapitestdownloadmine48066266e0b9ab9aFri, 23 Aug 2019 21:42:16 GMT\"0x8D72812C474972A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "3df00031-1ae3-4609-85c4-4f0911bd7c30", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmine48066266e0b9ab9a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1c3f-201e-00c4-4ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "844c6265-429a-49a4-b077-8bc7ae47576a" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadmin0blobapitestdownloadmine48066266e0b9ab9a", "javablobdownloadmin1blobapitestdownloadmine482867319bf74" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[0].json new file mode 100644 index 000000000000..72da27af2d96 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[0].json @@ -0,0 +1,116 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange9ba37040761a829?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C49434CB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1c50-201e-00c4-5ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "b8781a30-6ec3-45d1-bf77-19c568c55e1d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange9ba37040761a829/javablobdownloadrange1blobapitestdownloadrange9ba050349468", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C49A5424\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1c5d-201e-00c4-6bfb-594fb0000000", + "x-ms-client-request-id" : "3f87a736-1f89-4576-b679-76a476427963" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange9ba37040761a829/javablobdownloadrange1blobapitestdownloadrange9ba050349468", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C49A5424\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e1c6f-201e-00c4-7dfb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "ef567a63-5143-45fd-a296-f0a4f4fb9dba", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1c88-201e-00c4-11fb-594fb0000000", + "Body" : "jtcdownloadrangejtcdownloadrange0blobapitestdownloadrange9ba37040761a829Fri, 23 Aug 2019 21:42:16 GMT\"0x8D72812C49434CB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "eba74168-5118-4c1c-adff-219f008d8826", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange9ba37040761a829?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1c97-201e-00c4-20fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "8eba9a1e-72e9-4836-bc75-c9f686fdb7ba" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadrange0blobapitestdownloadrange9ba37040761a829", "javablobdownloadrange1blobapitestdownloadrange9ba050349468" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[1].json new file mode 100644 index 000000000000..393d80772e27 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[1].json @@ -0,0 +1,117 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange13b4527398a4550?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C4AF3D77\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1cb7-201e-00c4-3cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "2b992775-8b10-43b1-8191-c3c0e2646f15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange13b4527398a4550/javablobdownloadrange1blobapitestdownloadrange13b910962453", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C4B4C078\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1cd9-201e-00c4-5cfb-594fb0000000", + "x-ms-client-request-id" : "7e0f54e1-5a02-40ca-9549-00f6dc4ea1da" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange13b4527398a4550/javablobdownloadrange1blobapitestdownloadrange13b910962453", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Content-Range" : "bytes 0-4/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C4B4C078\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:17 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "d51e1cec-201e-00c4-6dfb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117]", + "x-ms-client-request-id" : "ba034169-5201-412a-ad6a-eb48eaacd073", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1d0a-201e-00c4-09fb-594fb0000000", + "Body" : "jtcdownloadrangejtcdownloadrange0blobapitestdownloadrange13b4527398a4550Fri, 23 Aug 2019 21:42:17 GMT\"0x8D72812C4AF3D77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "a2f07ab0-e730-4a04-9239-6e003666291d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange13b4527398a4550?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1d3e-201e-00c4-37fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "693aa933-a78d-4bd6-86d8-9966bf73446b" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadrange0blobapitestdownloadrange13b4527398a4550", "javablobdownloadrange1blobapitestdownloadrange13b910962453" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[2].json new file mode 100644 index 000000000000..08627431919a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[2].json @@ -0,0 +1,117 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange845639144a88031?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C4D4A8E7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1d5f-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "f30a4afd-b87b-448a-be6f-e4517def6fad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange845639144a88031/javablobdownloadrange1blobapitestdownloadrange8452017799f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C4DFD2A7\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1d8e-201e-00c4-7dfb-594fb0000000", + "x-ms-client-request-id" : "7c0d887e-2936-4069-8a4b-5bea0d4c7c3f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange845639144a88031/javablobdownloadrange1blobapitestdownloadrange8452017799f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Content-Range" : "bytes 3-4/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:17 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C4DFD2A7\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:17 GMT", + "Content-Length" : "2", + "x-ms-request-id" : "d51e1da4-201e-00c4-12fb-594fb0000000", + "Body" : "[97, 117]", + "x-ms-client-request-id" : "bee5b4a8-3343-4235-8f09-3e69ef451f88", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1dbc-201e-00c4-27fb-594fb0000000", + "Body" : "jtcdownloadrangejtcdownloadrange0blobapitestdownloadrange845639144a88031Fri, 23 Aug 2019 21:42:17 GMT\"0x8D72812C4D4A8E7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "e6260be4-5b29-4e03-9b6b-96a16c6f441a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange845639144a88031?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1dcc-201e-00c4-35fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:16 GMT", + "x-ms-client-request-id" : "9577c0ed-befa-4e60-8425-3693bdb540c1" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadrange0blobapitestdownloadrange845639144a88031", "javablobdownloadrange1blobapitestdownloadrange8452017799f8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadsnapshot.json new file mode 100644 index 000000000000..18c995aadcaf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadsnapshot.json @@ -0,0 +1,191 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotae4125081a36?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C69C91C5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e24a1-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "ab3d552f-657a-4ede-b2ca-3db02309412e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotae4125081a36/javablobdownloadsnapshot1blobapitestdownloadsnapshotae4663841", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C6A1EE5F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e24b3-201e-00c4-30fb-594fb0000000", + "x-ms-client-request-id" : "c3f7684f-11fa-4b22-8f9a-f2c784e7be0c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotae4125081a36/javablobdownloadsnapshot1blobapitestdownloadsnapshotae4663841", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C6A1EE5F\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e24bb-201e-00c4-37fb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "4c31193e-52ce-433e-ba4c-66b4f07a8d97", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotae4125081a36/javablobdownloadsnapshot1blobapitestdownloadsnapshotae4663841?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:42:20.3938655Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C6A1EE5F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e24d5-201e-00c4-4cfb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "41300f29-048f-4665-945d-515ad53f426b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotae4125081a36/javablobdownloadsnapshot1blobapitestdownloadsnapshotae4663841", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Ky/Mhvo/J+s=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "Content-MD5" : "kC+90rHfDE9wtKXSNSXpMg==", + "ETag" : "\"0x8D72812C6B37EEB\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e24e5-201e-00c4-5bfb-594fb0000000", + "x-ms-client-request-id" : "cf1d821f-0bc0-4d69-a28a-5c255f8e0b0e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotae4125081a36/javablobdownloadsnapshot1blobapitestdownloadsnapshotae4663841?snapshot=2019-08-23T21%3a42%3a20.3938655Z", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-snapshot" : "2019-08-23T21:42:20.3938655Z", + "ETag" : "\"0x8D72812C6A1EE5F\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e24ed-201e-00c4-63fb-594fb0000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "549ebf16-842b-4e45-b57f-d38f10d40efc", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadsnapshot&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e24fa-201e-00c4-6efb-594fb0000000", + "Body" : "jtcdownloadsnapshotjtcdownloadsnapshot0blobapitestdownloadsnapshotae4125081a36Fri, 23 Aug 2019 21:42:20 GMT\"0x8D72812C69C91C5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "5f06219b-80f3-421a-a66f-c060cf2ea21e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotae4125081a36?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e250a-201e-00c4-7cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "ed0b3b2a-9267-4e0e-9e39-0c0a63606ce7" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadsnapshot0blobapitestdownloadsnapshotae4125081a36", "javablobdownloadsnapshot1blobapitestdownloadsnapshotae4663841" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadwithretryrange.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadwithretryrange.json new file mode 100644 index 000000000000..cd73df946f2d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadwithretryrange.json @@ -0,0 +1,241 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange028037c9cf705b5e46436e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C43ADB6C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e1af5-201e-00c4-3efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "88e102fb-dad8-40f9-975f-983143f14fa0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange028037c9cf705b5e46436e/javablobdownloadwithretryrange1456751b1ded7634a14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C4401007\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e1b0a-201e-00c4-4ffb-594fb0000000", + "x-ms-client-request-id" : "8171063a-b54c-4c9a-8f3b-1d5a9ca1bdd8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange028037c9cf705b5e46436e/javablobdownloadwithretryrange1456751b1ded7634a14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Content-Range" : "bytes 2-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C4401007\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "d51e1b43-201e-00c4-05fb-594fb0000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "d251ea47-79e6-4dbf-97ac-c9086d91a8d3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange028037c9cf705b5e46436e/javablobdownloadwithretryrange1456751b1ded7634a14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Content-Range" : "bytes 2-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C4401007\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "d51e1b8b-201e-00c4-3bfb-594fb0000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "10f91972-1f18-46a0-9cdb-4b662ae1a50b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange028037c9cf705b5e46436e/javablobdownloadwithretryrange1456751b1ded7634a14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Content-Range" : "bytes 2-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C4401007\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "d51e1b9d-201e-00c4-4afb-594fb0000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "c48db860-b1fe-4d77-ae3e-566526f8f97e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange028037c9cf705b5e46436e/javablobdownloadwithretryrange1456751b1ded7634a14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Content-Range" : "bytes 2-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C4401007\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "d51e1bae-201e-00c4-59fb-594fb0000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "4716a148-7466-4e4d-829b-e42f60cc2a2a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange028037c9cf705b5e46436e/javablobdownloadwithretryrange1456751b1ded7634a14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Content-Range" : "bytes 2-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:16 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812C4401007\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:16 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "d51e1bbc-201e-00c4-65fb-594fb0000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "f9a94561-494c-4f2f-973c-05c194edc4ed", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdownloadwithretryrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1bcb-201e-00c4-72fb-594fb0000000", + "Body" : "jtcdownloadwithretryrangejtcdownloadwithretryrange028037c9cf705b5e46436eFri, 23 Aug 2019 21:42:16 GMT\"0x8D72812C43ADB6C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "15a6c2fa-12fd-4584-ae28-281e347d51b0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdownloadwithretryrange028037c9cf705b5e46436e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e1bd4-201e-00c4-78fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:15 GMT", + "x-ms-client-request-id" : "829da7fe-1050-450a-89dd-78f537d1188a" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadwithretryrange028037c9cf705b5e46436e", "javablobdownloadwithretryrange1456751b1ded7634a14" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfo.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfo.json new file mode 100644 index 000000000000..1bb574231037 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfo.json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0blobapitestgetaccountinfoe7726558703d07?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281327495F5E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f82a2-201e-00c4-48fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "cabe4bec-a964-4a0b-9ded-9f1ded583e56" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0blobapitestgetaccountinfoe7726558703d07/javablobgetaccountinfo1blobapitestgetaccountinfoe7780230160", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813274EB9FA\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51f82b9-201e-00c4-5dfc-594fb0000000", + "x-ms-client-request-id" : "fbc4c96d-3119-4e2c-af60-e06b36e464e6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=account&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "d51f82cf-201e-00c4-71fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "383cf519-2a54-43a6-b3b2-1849dc419d19" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccountinfo&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f82e0-201e-00c4-80fc-594fb0000000", + "Body" : "jtcgetaccountinfojtcgetaccountinfo0blobapitestgetaccountinfoe7726558703d07Fri, 23 Aug 2019 21:45:02 GMT\"0x8D7281327495F5E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "4ae93e76-a51f-4d9a-94b4-e66be5991621", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0blobapitestgetaccountinfoe7726558703d07?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f82eb-201e-00c4-0bfc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "f8716928-ae6d-47fc-8bf1-46990e07e1d2" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfo0blobapitestgetaccountinfoe7726558703d07", "javablobgetaccountinfo1blobapitestgetaccountinfoe7780230160" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfoerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfoerror.json new file mode 100644 index 000000000000..fef29c3dbaab --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfoerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror0blobapitestgetaccountinfoerrorb3e062843?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813277A8D80\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f835d-201e-00c4-63fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "a674f180-8026-4dcf-9193-5bdfeb075435" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror0blobapitestgetaccountinfoerrorb3e062843/javablobgetaccountinfoerror112485e565bafb2ad1481", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813277FE833\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51f8372-201e-00c4-73fc-594fb0000000", + "x-ms-client-request-id" : "e436a90d-c7c9-4837-9548-f902a6bef238" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror2blobapitestgetaccountinfoerrorb3e358900/javablobgetaccountinfoerror349923f73bdd41966d40a?restype=account&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "d51f8382-201e-00c4-02fc-594fb0000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:d51f8382-201e-00c4-02fc-594fb0000000\nTime:2019-08-23T21:45:02.8697874Z", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "9ce09366-3ed4-4de3-acec-d9b203ac2aeb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccountinfoerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f838d-201e-00c4-0afc-594fb0000000", + "Body" : "jtcgetaccountinfoerrorjtcgetaccountinfoerror0blobapitestgetaccountinfoerrorb3e062843Fri, 23 Aug 2019 21:45:02 GMT\"0x8D72813277A8D80\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "ef13c73b-0895-4ed9-8250-912d90bbdcc8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror0blobapitestgetaccountinfoerrorb3e062843?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f8394-201e-00c4-10fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "4ea7dbcf-5356-4447-943b-afe8d95610ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfoerror0blobapitestgetaccountinfoerrorb3e062843", "javablobgetaccountinfoerror112485e565bafb2ad1481", "jtcgetaccountinfoerror2blobapitestgetaccountinfoerrorb3e358900", "javablobgetaccountinfoerror349923f73bdd41966d40a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfomin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfomin.json new file mode 100644 index 000000000000..6422849f0b7f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfomin.json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfomin8204275986b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813276244A0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f830a-201e-00c4-1efc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "570e1d43-aacf-4131-8439-d9768a6c44dd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfomin8204275986b/javablobgetaccountinfomin1blobapitestgetaccountinfomin82076343", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132767ED7D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51f8318-201e-00c4-29fc-594fb0000000", + "x-ms-client-request-id" : "bfe02d97-c5a9-41c7-b614-ef22ec054d87" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfomin8204275986b/javablobgetaccountinfomin1blobapitestgetaccountinfomin82076343?restype=account&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "d51f8335-201e-00c4-42fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "d591cb5c-204d-4d8c-9e60-2d5ed8d09eee" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccountinfomin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f8349-201e-00c4-52fc-594fb0000000", + "Body" : "jtcgetaccountinfominjtcgetaccountinfomin0blobapitestgetaccountinfomin8204275986bFri, 23 Aug 2019 21:45:02 GMT\"0x8D72813276244A0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "8d952d4a-9689-4e70-a35c-5ca2edf51184", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfomin8204275986b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f834e-201e-00c4-56fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "6bd4c17a-57d3-46fa-918e-25432a49bf07" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfomin0blobapitestgetaccountinfomin8204275986b", "javablobgetaccountinfomin1blobapitestgetaccountinfomin82076343" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[0].json new file mode 100644 index 000000000000..cb70dac44ea6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[0].json @@ -0,0 +1,117 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac15825164f93ea?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C7075484\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e25d1-201e-00c4-2bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "6519b27f-32c4-4ece-8e31-b4f03e676d51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac15825164f93ea/javablobgetpropertiesac1blobapitestgetpropertiesac15854062cc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C70D9BEE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e25db-201e-00c4-34fb-594fb0000000", + "x-ms-client-request-id" : "1ececa29-d993-4e20-a792-afe8f7894445" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac15825164f93ea/javablobgetpropertiesac1blobapitestgetpropertiesac15854062cc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C70D9BEE\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e25f0-201e-00c4-47fb-594fb0000000", + "x-ms-client-request-id" : "765040c4-e884-405e-b3b4-5b824b4e5e56", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2606-201e-00c4-5cfb-594fb0000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac15825164f93eaFri, 23 Aug 2019 21:42:20 GMT\"0x8D72812C7075484\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "39f341c8-efe7-4eb3-b4c5-c3f0d367c844", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac15825164f93ea?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e261a-201e-00c4-6dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "a35d2359-1e7a-4b1d-93ac-81efd8744eef" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac15825164f93ea", "javablobgetpropertiesac1blobapitestgetpropertiesac15854062cc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[1].json new file mode 100644 index 000000000000..a32c6dc3c3cf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[1].json @@ -0,0 +1,117 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac3ea42431541c8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C726CB12\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2634-201e-00c4-01fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "2ac2e606-4a27-407b-a59b-d6246199fd5f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac3ea42431541c8/javablobgetpropertiesac1blobapitestgetpropertiesac3ea29256e2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C72C9D50\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2649-201e-00c4-12fb-594fb0000000", + "x-ms-client-request-id" : "d8e3faec-8b65-4a64-9f07-de0d5ea86e51" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac3ea42431541c8/javablobgetpropertiesac1blobapitestgetpropertiesac3ea29256e2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C72C9D50\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e2659-201e-00c4-21fb-594fb0000000", + "x-ms-client-request-id" : "744b9509-9183-4d18-89ad-e40854580ca1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e265e-201e-00c4-26fb-594fb0000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac3ea42431541c8Fri, 23 Aug 2019 21:42:21 GMT\"0x8D72812C726CB12\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "e22b4ef5-5284-4023-9b24-448d23ecbc13", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac3ea42431541c8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2678-201e-00c4-39fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "ba087bd2-1ef6-4b94-a6e8-bb43502f9cde" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac3ea42431541c8", "javablobgetpropertiesac1blobapitestgetpropertiesac3ea29256e2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[2].json new file mode 100644 index 000000000000..6a01ab936131 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[2].json @@ -0,0 +1,117 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac47f183971fd56?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C7413758\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2691-201e-00c4-4bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "f724093a-f7f8-4c0b-88f9-0283141b5247" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac47f183971fd56/javablobgetpropertiesac1blobapitestgetpropertiesac47f8984022", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C7466D3B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e26a4-201e-00c4-59fb-594fb0000000", + "x-ms-client-request-id" : "32c088a9-b61a-470f-9f51-97e942c28694" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac47f183971fd56/javablobgetpropertiesac1blobapitestgetpropertiesac47f8984022", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C7466D3B\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e26ae-201e-00c4-62fb-594fb0000000", + "x-ms-client-request-id" : "772b4569-f5bc-42b6-a821-62802a288b79", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e26bd-201e-00c4-70fb-594fb0000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac47f183971fd56Fri, 23 Aug 2019 21:42:21 GMT\"0x8D72812C7413758\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "0f84e42c-10b4-4ccc-ab52-87e91b0e79cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac47f183971fd56?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e26c9-201e-00c4-79fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "640b922b-8e72-4f6f-89a4-b8138fb021a2" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac47f183971fd56", "javablobgetpropertiesac1blobapitestgetpropertiesac47f8984022" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[3].json new file mode 100644 index 000000000000..65c5f2d60d95 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[3].json @@ -0,0 +1,148 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesaca352376763a8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C75AB900\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e26e3-201e-00c4-10fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "98c7e335-1ecf-467d-bfbc-72a3fa33bdaf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesaca352376763a8a/javablobgetpropertiesac1blobapitestgetpropertiesaca353275118", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C7608B62\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e26fc-201e-00c4-24fb-594fb0000000", + "x-ms-client-request-id" : "e3f74e11-922e-424c-9aed-d7663ddf8e3b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesaca352376763a8a/javablobgetpropertiesac1blobapitestgetpropertiesaca353275118", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C7608B62\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e2709-201e-00c4-30fb-594fb0000000", + "x-ms-client-request-id" : "5f9d49d3-4f34-45c4-b066-d458a77ec31f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesaca352376763a8a/javablobgetpropertiesac1blobapitestgetpropertiesaca353275118", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C7608B62\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e271c-201e-00c4-3ffb-594fb0000000", + "x-ms-client-request-id" : "979a5962-8e7a-45b3-8031-d8ac36be922c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2732-201e-00c4-4efb-594fb0000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesaca352376763a8aFri, 23 Aug 2019 21:42:21 GMT\"0x8D72812C75AB900\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "a388e8c4-60ff-4ed2-87d4-186a74241d93", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesaca352376763a8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e273f-201e-00c4-58fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "6820fa05-3874-40b0-a9d2-74e9029169d2" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesaca352376763a8a", "javablobgetpropertiesac1blobapitestgetpropertiesaca353275118" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[4].json new file mode 100644 index 000000000000..3150e8abffe4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[4].json @@ -0,0 +1,117 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac156805168d827?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C7785A61\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2751-201e-00c4-68fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "e94aa701-bbac-469e-ae92-5e0ca7c118da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac156805168d827/javablobgetpropertiesac1blobapitestgetpropertiesac1560445692", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C77E05BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2768-201e-00c4-79fb-594fb0000000", + "x-ms-client-request-id" : "e3f2a5d9-45e3-4122-81a7-17b6e798169a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac156805168d827/javablobgetpropertiesac1blobapitestgetpropertiesac1560445692", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C77E05BE\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e277f-201e-00c4-10fb-594fb0000000", + "x-ms-client-request-id" : "f03e2dc1-0cb0-45d5-a3e1-ea327fc12e02", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e278a-201e-00c4-1afb-594fb0000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac156805168d827Fri, 23 Aug 2019 21:42:21 GMT\"0x8D72812C7785A61\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "c7bfdb8d-3f3a-4eb9-a171-b05e59518b25", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac156805168d827?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2796-201e-00c4-26fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "5cd07a14-f298-4f16-928b-5743f0f89725" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac156805168d827", "javablobgetpropertiesac1blobapitestgetpropertiesac1560445692" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[5].json new file mode 100644 index 000000000000..5a8c63d36a63 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[5].json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac64f551536c63d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C79166BE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e27aa-201e-00c4-36fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "x-ms-client-request-id" : "be802606-e46b-4976-8930-3a6ecccbe6d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac64f551536c63d/javablobgetpropertiesac1blobapitestgetpropertiesac64f434962c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C797122B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e27b8-201e-00c4-43fb-594fb0000000", + "x-ms-client-request-id" : "cfc7027b-4934-4717-a657-d31562292b58" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac64f551536c63d/javablobgetpropertiesac1blobapitestgetpropertiesac64f434962c?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C797122B\"", + "x-ms-lease-id" : "18649a46-7349-4808-b890-de26447e7fa1", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e27c6-201e-00c4-51fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "06622738-352c-46b0-839c-0b11b629c13c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac64f551536c63d/javablobgetpropertiesac1blobapitestgetpropertiesac64f434962c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C797122B\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "d51e27e2-201e-00c4-68fb-594fb0000000", + "x-ms-client-request-id" : "69b18701-13a1-4572-a094-83b9d0687bd8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e27ee-201e-00c4-74fb-594fb0000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac64f551536c63dFri, 23 Aug 2019 21:42:21 GMT\"0x8D72812C79166BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "671a7252-ec82-41f1-9b3b-bf28fb5579a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac64f551536c63d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e280b-201e-00c4-0efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "c19dcc34-63cb-406b-8011-1f59728d271b" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac64f551536c63d", "javablobgetpropertiesac1blobapitestgetpropertiesac64f434962c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[0].json new file mode 100644 index 000000000000..3f0115ca691a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail95a854458?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C7B5C083\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2829-201e-00c4-29fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "877b0e9c-6d5d-4163-86b7-87c70cb62e64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail95a854458/javablobgetpropertiesacfail191736f8b8c56e448e4f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C7BB6BEF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2848-201e-00c4-40fb-594fb0000000", + "x-ms-client-request-id" : "f2e974bf-47ae-4ca2-b7ff-903c7463f44e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail95a854458/javablobgetpropertiesacfail191736f8b8c56e448e4f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "d51e2858-201e-00c4-4ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "0122e243-c811-48c2-bf0a-6cc788a1f573" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2866-201e-00c4-5cfb-594fb0000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfail95a854458Fri, 23 Aug 2019 21:42:22 GMT\"0x8D72812C7B5C083\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "7082935e-b881-4526-8271-9ea4e23b483c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail95a854458?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2873-201e-00c4-68fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "5035779b-824e-4c43-866c-419841c7e57a" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfail95a854458", "javablobgetpropertiesacfail191736f8b8c56e448e4f8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[1].json new file mode 100644 index 000000000000..10fa0a6a6a3c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail6db03280d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C7CFDE91\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2884-201e-00c4-77fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "7647c205-6e60-449c-96fe-b23aa1b0992e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail6db03280d/javablobgetpropertiesacfail145319ae41ecc9055142e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C7D58A0B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2897-201e-00c4-06fb-594fb0000000", + "x-ms-client-request-id" : "b4726816-9512-4947-acac-7390dccb4cd5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail6db03280d/javablobgetpropertiesacfail145319ae41ecc9055142e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "412", + "x-ms-request-id" : "d51e28a7-201e-00c4-11fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "0a22b9fe-c7b4-4257-8711-ff6924f6b3df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e28b2-201e-00c4-1cfb-594fb0000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfail6db03280dFri, 23 Aug 2019 21:42:22 GMT\"0x8D72812C7CFDE91\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "7a9eaad3-9207-4e70-8a84-376efe50ab0c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail6db03280d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e28bb-201e-00c4-24fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "bfcd16a0-5ed6-462a-9fd0-b725b1f7793c" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfail6db03280d", "javablobgetpropertiesacfail145319ae41ecc9055142e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[2].json new file mode 100644 index 000000000000..0cbced56d603 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaild3053045f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C7E98750\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e28ca-201e-00c4-31fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "7f66ce28-5b81-4e7e-9f48-8f48cdcf6379" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaild3053045f/javablobgetpropertiesacfail13267087354cc7e9584d4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C7EF0BC6\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e28e1-201e-00c4-42fb-594fb0000000", + "x-ms-client-request-id" : "dc4f3697-6c44-4640-8ef5-1e36793424c5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaild3053045f/javablobgetpropertiesacfail13267087354cc7e9584d4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "412", + "x-ms-request-id" : "d51e28f0-201e-00c4-50fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "29e20819-0477-49cd-836b-c2ee0ae2d421" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e28fa-201e-00c4-58fb-594fb0000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfaild3053045fFri, 23 Aug 2019 21:42:22 GMT\"0x8D72812C7E98750\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "9d398a0a-15e3-4fc2-9744-f13c1ca36246", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaild3053045f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2907-201e-00c4-61fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "2269153f-38f4-4de0-b61d-809f7e4584bf" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfaild3053045f", "javablobgetpropertiesacfail13267087354cc7e9584d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[3].json new file mode 100644 index 000000000000..5fa24848495d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[3].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail02b443447?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C8035730\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e292c-201e-00c4-7ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "10796bcc-e821-49e6-ba07-a063d203242e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail02b443447/javablobgetpropertiesacfail1955117fdf3b711e5f441", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C80950F5\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2948-201e-00c4-13fb-594fb0000000", + "x-ms-client-request-id" : "f71cb7ba-27f4-41c0-b4ea-9246f5654ffd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail02b443447/javablobgetpropertiesacfail1955117fdf3b711e5f441", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C80950F5\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:22 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e2954-201e-00c4-1ffb-594fb0000000", + "x-ms-client-request-id" : "12bb4df8-6aa8-498b-82ca-ea12d6a26b81", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail02b443447/javablobgetpropertiesacfail1955117fdf3b711e5f441", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "d51e295d-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "7588c656-9edc-4ae4-b14b-b9053308c41f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2967-201e-00c4-31fb-594fb0000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfail02b443447Fri, 23 Aug 2019 21:42:22 GMT\"0x8D72812C8035730\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "5a8b8b28-0f14-4a27-bd0b-3c751f243825", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail02b443447?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2976-201e-00c4-3dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "6188cfec-2076-4a9e-b2f7-ede47da59459" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfail02b443447", "javablobgetpropertiesacfail1955117fdf3b711e5f441" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[4].json new file mode 100644 index 000000000000..27abdb118031 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[4].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail571301463?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C8211FA3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2982-201e-00c4-48fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "4e084c7a-2713-4447-b29e-42d555c329f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail571301463/javablobgetpropertiesacfail160253bb9f5123f69b4db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C826CB49\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2997-201e-00c4-58fb-594fb0000000", + "x-ms-client-request-id" : "46459d55-1fbf-4bce-a836-dce1e6a9f822" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail571301463/javablobgetpropertiesacfail160253bb9f5123f69b4db?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C826CB49\"", + "x-ms-lease-id" : "ba75a0c7-1122-4088-a4cc-584c51398e53", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e29af-201e-00c4-6efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "71f15d90-4046-4578-b8dd-81545602054b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail571301463/javablobgetpropertiesacfail160253bb9f5123f69b4db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "StatusCode" : "412", + "x-ms-request-id" : "d51e29b8-201e-00c4-77fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:21 GMT", + "x-ms-client-request-id" : "cfe9559d-9669-4cda-8f40-b6a29df9dc55" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e29c2-201e-00c4-80fb-594fb0000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfail571301463Fri, 23 Aug 2019 21:42:22 GMT\"0x8D72812C8211FA3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "3e1e8770-06b7-4cbe-b73d-9e5605411726", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail571301463?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e29ce-201e-00c4-0bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "59375bf9-f5c4-4b62-8feb-fa0d261622a3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfail571301463", "javablobgetpropertiesacfail160253bb9f5123f69b4db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesdefault.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesdefault.json new file mode 100644 index 000000000000..78ef594810ea --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesdefault.json @@ -0,0 +1,117 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesdefault019504306fc01e2fbf4fb4b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C6C88E8C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e251b-201e-00c4-0dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "2c54c341-e9c8-45c8-b59c-71fd10ebe503" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesdefault019504306fc01e2fbf4fb4b/javablobgetpropertiesdefault179937b103b74354554c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C6CDEB31\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2529-201e-00c4-1afb-594fb0000000", + "x-ms-client-request-id" : "d14823ea-e023-460a-b5da-89790cef71c3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesdefault019504306fc01e2fbf4fb4b/javablobgetpropertiesdefault179937b103b74354554c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C6CDEB31\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e2540-201e-00c4-2afb-594fb0000000", + "x-ms-client-request-id" : "27a05b0a-fab3-4ac2-b31f-c2b9b8ba6fe3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesdefault&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e254f-201e-00c4-37fb-594fb0000000", + "Body" : "jtcgetpropertiesdefaultjtcgetpropertiesdefault019504306fc01e2fbf4fb4bFri, 23 Aug 2019 21:42:20 GMT\"0x8D72812C6C88E8C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "bce680a5-db4c-4e50-add7-39db2f8d7e10", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesdefault019504306fc01e2fbf4fb4b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e255b-201e-00c4-42fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "33966e31-2cdf-458a-ae92-65a40f5c2ab1" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesdefault019504306fc01e2fbf4fb4b", "javablobgetpropertiesdefault179937b103b74354554c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertieserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertieserror.json new file mode 100644 index 000000000000..36688949852e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertieserror.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserror5d359398a0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C8421D3A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e29e7-201e-00c4-22fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "428c344d-2908-4e63-9df1-3b6e04b6f9bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserror5d359398a0/javablobgetpropertieserror10382331a225a0c7cd491", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C847C8DA\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2a08-201e-00c4-3ffb-594fb0000000", + "x-ms-client-request-id" : "7c5ced3a-75d8-433d-9355-e85c7c431cfc" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserror5d359398a0/javablobgetpropertieserror2925306c7737f2e5ce44e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2a25-201e-00c4-59fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "544d6aa2-d65a-4464-a3ed-4691a4d29b34" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertieserror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2a3a-201e-00c4-6efb-594fb0000000", + "Body" : "jtcgetpropertieserrorjtcgetpropertieserror0blobapitestgetpropertieserror5d359398a0Fri, 23 Aug 2019 21:42:23 GMT\"0x8D72812C8421D3A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "adb350c4-6643-4309-9c43-e810e7342973", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserror5d359398a0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2a50-201e-00c4-80fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "b22d8eaf-ccd8-4340-926d-5f64942b776e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertieserror0blobapitestgetpropertieserror5d359398a0", "javablobgetpropertieserror10382331a225a0c7cd491", "javablobgetpropertieserror2925306c7737f2e5ce44e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesmin.json new file mode 100644 index 000000000000..161bcb6f7485 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesmin.json @@ -0,0 +1,117 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesmin4be8243619c9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C6E62FE3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e256f-201e-00c4-54fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "b23ff4de-99f6-4af9-807c-8c3d03fb3610" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesmin4be8243619c9/javablobgetpropertiesmin1blobapitestgetpropertiesmin4be11839d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C6F356B0\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2591-201e-00c4-71fb-594fb0000000", + "x-ms-client-request-id" : "d129e7b3-aa88-4294-b1da-4947cec86f9c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesmin4be8243619c9/javablobgetpropertiesmin1blobapitestgetpropertiesmin4be11839d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C6F356B0\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:20 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e259a-201e-00c4-7afb-594fb0000000", + "x-ms-client-request-id" : "db065fd4-04b2-4c2b-8557-1c7f1436003f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e25a5-201e-00c4-04fb-594fb0000000", + "Body" : "jtcgetpropertiesminjtcgetpropertiesmin0blobapitestgetpropertiesmin4be8243619c9Fri, 23 Aug 2019 21:42:20 GMT\"0x8D72812C6E62FE3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "c59bba7b-c4f1-4b07-b09f-72510dc67add", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesmin4be8243619c9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e25b3-201e-00c4-10fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:19 GMT", + "x-ms-client-request-id" : "033d3ed6-22eb-4367-8b33-11f21f8d59c4" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesmin0blobapitestgetpropertiesmin4be8243619c9", "javablobgetpropertiesmin1blobapitestgetpropertiesmin4be11839d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaselease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaselease.json new file mode 100644 index 000000000000..000d421df3c8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaselease.json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaseleasee1899975b97151ed?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9100263\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6fd1-201e-00c4-45fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "e1404dab-a70c-4f0d-83cb-d187577b5ed3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaseleasee1899975b97151ed/javablobreleaselease1blobapitestreleaseleasee18929945236e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D9158D36\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6fdd-201e-00c4-4ffb-594fb0000000", + "x-ms-client-request-id" : "0d46ef92-770f-4f78-b1e5-60d723d16770" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaseleasee1899975b97151ed/javablobreleaselease1blobapitestreleaseleasee18929945236e?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9158D36\"", + "x-ms-lease-id" : "ee5964c2-27fa-4fbf-beff-a62818854c4b", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6ff8-201e-00c4-64fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "bccf1467-b343-4e39-bedf-8afd3c76a5bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaseleasee1899975b97151ed/javablobreleaselease1blobapitestreleaseleasee18929945236e?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9158D36\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e700d-201e-00c4-77fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "0ae67341-958c-46c0-9636-7bb61e117f3d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaseleasee1899975b97151ed/javablobreleaselease1blobapitestreleaseleasee18929945236e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812D9158D36\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:51 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e701c-201e-00c4-06fb-594fb0000000", + "x-ms-client-request-id" : "0e438c6d-1130-4248-a065-e50273d1a01f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaselease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e702f-201e-00c4-15fb-594fb0000000", + "Body" : "jtcreleaseleasejtcreleaselease0blobapitestreleaseleasee1899975b97151edFri, 23 Aug 2019 21:42:51 GMT\"0x8D72812D9100263\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "01470cb8-1677-43c6-b6ac-7f4678f4a0fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0blobapitestreleaseleasee1899975b97151ed?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7043-201e-00c4-26fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "eeaeb7e2-a302-413d-8508-84f3d11c3d1d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaselease0blobapitestreleaseleasee1899975b97151ed", "javablobreleaselease1blobapitestreleaseleasee18929945236e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[0].json new file mode 100644 index 000000000000..cbe3c8bbc598 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[0].json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseace1806588bd6902?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D951882C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e70dd-201e-00c4-2afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "b2927d8a-3938-47da-b9be-95da9cc499b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseace1806588bd6902/javablobreleaseleaseac1blobapitestreleaseleaseace187276018a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D956C508\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e70f4-201e-00c4-3efb-594fb0000000", + "x-ms-client-request-id" : "f21117ca-a22d-4449-b8b7-71a7a30b134a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseace1806588bd6902/javablobreleaseleaseac1blobapitestreleaseleaseace187276018a?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D956C508\"", + "x-ms-lease-id" : "5392309e-2c05-491e-95ff-a26435acc4b2", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7104-201e-00c4-4cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "f4675144-55f1-4066-b679-100d1b532ed7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseace1806588bd6902/javablobreleaseleaseac1blobapitestreleaseleaseace187276018a?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D956C508\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7118-201e-00c4-5cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "e2359bd3-419b-4319-baee-906f125214a2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7141-201e-00c4-80fb-594fb0000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseace1806588bd6902Fri, 23 Aug 2019 21:42:51 GMT\"0x8D72812D951882C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "2ead5573-e6e7-406b-80b6-6a39316f8eac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseace1806588bd6902?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e714a-201e-00c4-09fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "7419c096-81d1-4193-9217-bb970f3ee35f" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseace1806588bd6902", "javablobreleaseleaseac1blobapitestreleaseleaseace187276018a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[1].json new file mode 100644 index 000000000000..228235d9ed7c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[1].json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac587645943d5e69?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D97A76F8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7159-201e-00c4-17fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "e1893b63-f526-4a51-9172-313a16ac39df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac587645943d5e69/javablobreleaseleaseac1blobapitestreleaseleaseac58783450d53", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D97FB3DC\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7169-201e-00c4-25fb-594fb0000000", + "x-ms-client-request-id" : "b9a9e815-c934-44d0-b98d-17532c4eae1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac587645943d5e69/javablobreleaseleaseac1blobapitestreleaseleaseac58783450d53?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D97FB3DC\"", + "x-ms-lease-id" : "4a3bd33c-6807-4c09-9e78-ee197b8fcf0b", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7182-201e-00c4-36fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "f3526f76-0b0b-4362-a265-aab7ab2c56e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac587645943d5e69/javablobreleaseleaseac1blobapitestreleaseleaseac58783450d53?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D97FB3DC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e719a-201e-00c4-49fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "dcf43667-fd93-4e00-8087-eeb26f0c21fa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e71b0-201e-00c4-5dfb-594fb0000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseac587645943d5e69Fri, 23 Aug 2019 21:42:51 GMT\"0x8D72812D97A76F8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "ef76ae02-1cc6-488b-838e-620145e71483", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac587645943d5e69?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e71ce-201e-00c4-78fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "fe1f1e25-c07e-4da6-a91a-c20c3e5f56ed" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseac587645943d5e69", "javablobreleaseleaseac1blobapitestreleaseleaseac58783450d53" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[2].json new file mode 100644 index 000000000000..a6461e829770 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[2].json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac77c73093b34a97?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D998184B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e71e0-201e-00c4-05fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "5ad826ac-f1da-4c88-b95a-6622d98fdfe4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac77c73093b34a97/javablobreleaseleaseac1blobapitestreleaseleaseac77c64378583", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D99DA380\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e71ef-201e-00c4-10fb-594fb0000000", + "x-ms-client-request-id" : "97364265-a643-452a-8ec5-88ea6fd61194" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac77c73093b34a97/javablobreleaseleaseac1blobapitestreleaseleaseac77c64378583?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D99DA380\"", + "x-ms-lease-id" : "8362fdce-0520-4736-be2a-fc70dcd0abdf", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e71f9-201e-00c4-19fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "791f887d-b2f3-48c0-8cc3-369158d635af" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac77c73093b34a97/javablobreleaseleaseac1blobapitestreleaseleaseac77c64378583?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D99DA380\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7203-201e-00c4-22fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "db5783e7-c1fd-46d7-a78e-774963401664" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7211-201e-00c4-30fb-594fb0000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseac77c73093b34a97Fri, 23 Aug 2019 21:42:52 GMT\"0x8D72812D998184B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "4abcd9c6-eca4-4595-9d2b-ccb72026d165", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac77c73093b34a97?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e721d-201e-00c4-3afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "b237e259-6939-4ddd-a0bc-4a7ad1edf13d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseac77c73093b34a97", "javablobreleaseleaseac1blobapitestreleaseleaseac77c64378583" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[3].json new file mode 100644 index 000000000000..b44d89a5f588 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[3].json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac103337231a3afd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9B607DA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e723c-201e-00c4-54fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "bdc61dfd-fd66-4224-95a3-17cc9e79e56f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac103337231a3afd/javablobreleaseleaseac1blobapitestreleaseleaseac103939347f9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D9BB6BFE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7253-201e-00c4-68fb-594fb0000000", + "x-ms-client-request-id" : "ddf539d5-90b5-4733-9254-197cf60857a8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac103337231a3afd/javablobreleaseleaseac1blobapitestreleaseleaseac103939347f9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812D9BB6BFE\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:52 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e7275-201e-00c4-03fb-594fb0000000", + "x-ms-client-request-id" : "d2c0a566-2d07-4067-bb0d-e161bc769190", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac103337231a3afd/javablobreleaseleaseac1blobapitestreleaseleaseac103939347f9?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9BB6BFE\"", + "x-ms-lease-id" : "3fbcd843-18f2-4c56-959a-263d6ec0b154", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7285-201e-00c4-0efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "13abe264-92df-4f0f-aaee-0a9e5b162ef1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac103337231a3afd/javablobreleaseleaseac1blobapitestreleaseleaseac103939347f9?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9BB6BFE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e7298-201e-00c4-20fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "682f5de6-3ce6-4663-93fd-282fd9be1012" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e72a9-201e-00c4-2ffb-594fb0000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseac103337231a3afdFri, 23 Aug 2019 21:42:52 GMT\"0x8D72812D9B607DA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "a63e381b-9f1f-44a1-9e60-2997dd4112b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac103337231a3afd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e72bf-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "1df8740c-d1d2-43ce-bf04-fcc72a3066e2" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseac103337231a3afd", "javablobreleaseleaseac1blobapitestreleaseleaseac103939347f9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[4].json new file mode 100644 index 000000000000..a6dd7dea9140 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[4].json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacfd2666820aae2d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9D75397\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e72d6-201e-00c4-54fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "66124419-1b89-494d-9a27-36eb4140289a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacfd2666820aae2d/javablobreleaseleaseac1blobapitestreleaseleaseacfd24695070d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D9DCB7CB\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e72e4-201e-00c4-61fb-594fb0000000", + "x-ms-client-request-id" : "51d48ee3-cfbb-4ac0-a2fe-7c3e1e769816" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacfd2666820aae2d/javablobreleaseleaseac1blobapitestreleaseleaseacfd24695070d?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9DCB7CB\"", + "x-ms-lease-id" : "a15aa375-8a45-4e55-8775-af67e7a0193c", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e72ed-201e-00c4-69fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "0b656f78-754e-425e-bfb0-1ab6d5811f2b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacfd2666820aae2d/javablobreleaseleaseac1blobapitestreleaseleaseacfd24695070d?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9DCB7CB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e72f5-201e-00c4-70fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "86b3e0dc-a638-49ca-b78c-87d72f8322a0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7306-201e-00c4-7ffb-594fb0000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseacfd2666820aae2dFri, 23 Aug 2019 21:42:52 GMT\"0x8D72812D9D75397\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "478deaf5-80e5-41f5-a3b8-c9f44da9c36a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacfd2666820aae2d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e731c-201e-00c4-0ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "31ef6bd9-4e83-47b3-bef7-82383cd25ef9" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseacfd2666820aae2d", "javablobreleaseleaseac1blobapitestreleaseleaseacfd24695070d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[0].json new file mode 100644 index 000000000000..86d7de6df352 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[0].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfaildbf1662084?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9F4A6CD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e732c-201e-00c4-1efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "7552f025-2a80-4231-b353-85537626bc0a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfaildbf1662084/javablobreleaseleaseacfail143369bc46d82cb6394d9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D9FA3216\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7340-201e-00c4-2ffb-594fb0000000", + "x-ms-client-request-id" : "c820d8b0-44bf-4cfe-87cc-e3218b54977a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfaildbf1662084/javablobreleaseleaseacfail143369bc46d82cb6394d9?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D9FA3216\"", + "x-ms-lease-id" : "5ce9ae2d-081d-455c-a495-3de002605bb2", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e734f-201e-00c4-3cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "cf12a638-87cd-4f1f-b363-b1316a4cbb47" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfaildbf1662084/javablobreleaseleaseacfail143369bc46d82cb6394d9?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e7355-201e-00c4-41fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e7355-201e-00c4-41fb-594fb0000000\nTime:2019-08-23T21:42:52.8387161Z", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "852a07d6-fedf-4c0b-a136-e2c5063e2200", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e736f-201e-00c4-56fb-594fb0000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfaildbf1662084Fri, 23 Aug 2019 21:42:52 GMT\"0x8D72812D9F4A6CD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "39f5b887-e146-41ea-a370-5a31e49706fb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfaildbf1662084?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7384-201e-00c4-6bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "95fabe6d-8df2-475b-97be-76ef179f0513" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfaildbf1662084", "javablobreleaseleaseacfail143369bc46d82cb6394d9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[1].json new file mode 100644 index 000000000000..140d30d854e3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail75058720ce?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DA11ABBA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e739d-201e-00c4-01fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "x-ms-client-request-id" : "b81d71f6-6ddc-4ac3-8474-3586d997a2d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail75058720ce/javablobreleaseleaseacfail1623784e2d8461eda94fc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DA17D382\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e73b5-201e-00c4-15fb-594fb0000000", + "x-ms-client-request-id" : "a380ad6e-127d-4a3c-91b7-3c5abbd41c9b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail75058720ce/javablobreleaseleaseacfail1623784e2d8461eda94fc?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DA17D382\"", + "x-ms-lease-id" : "06f6bf3b-3b9d-472f-bbbd-ccf18fcf8166", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e73c3-201e-00c4-20fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "778ffb79-7a57-4a2a-a79f-3b1ee50deb49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail75058720ce/javablobreleaseleaseacfail1623784e2d8461eda94fc?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e73ce-201e-00c4-2afb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e73ce-201e-00c4-2afb-594fb0000000\nTime:2019-08-23T21:42:53.0339024Z", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "8992901b-fa9c-47d9-acc3-d0e5109b42fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e73dd-201e-00c4-39fb-594fb0000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfail75058720ceFri, 23 Aug 2019 21:42:52 GMT\"0x8D72812DA11ABBA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "7ea1e679-1087-46aa-bf7b-514871f4c25b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail75058720ce?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e73f0-201e-00c4-4afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "771ad770-7dd1-4691-b078-3e6e12590e90" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfail75058720ce", "javablobreleaseleaseacfail1623784e2d8461eda94fc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[2].json new file mode 100644 index 000000000000..b1cd505a5e2a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail24730208b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DA2F2603\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7407-201e-00c4-5efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "3aef1279-4947-439e-a7ee-607e1e223b11" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail24730208b5/javablobreleaseleaseacfail135245dbdf1963ab1c4b3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DA34B166\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e7414-201e-00c4-69fb-594fb0000000", + "x-ms-client-request-id" : "6b987a60-46b2-4acd-84a4-33f3c9dc5151" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail24730208b5/javablobreleaseleaseacfail135245dbdf1963ab1c4b3?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DA34B166\"", + "x-ms-lease-id" : "2e5a2980-fb6e-4c48-9d9b-7ff5727d8bdb", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e741f-201e-00c4-72fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "6064a82e-e947-4d6d-8132-d65039d6ea78" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail24730208b5/javablobreleaseleaseacfail135245dbdf1963ab1c4b3?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e743f-201e-00c4-0bfb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e743f-201e-00c4-0bfb-594fb0000000\nTime:2019-08-23T21:42:53.2220819Z", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "3264d8ab-2058-49a9-a763-1273cbe7c277", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7450-201e-00c4-19fb-594fb0000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfail24730208b5Fri, 23 Aug 2019 21:42:53 GMT\"0x8D72812DA2F2603\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "378cdece-c47e-4377-ab0c-5c5ecdb8fc4b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail24730208b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e7463-201e-00c4-2afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "491516da-7e37-490a-9c77-865de015751a" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfail24730208b5", "javablobreleaseleaseacfail135245dbdf1963ab1c4b3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[3].json new file mode 100644 index 000000000000..52ea71d10aa3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[3].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8898802633?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DA4C520C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7474-201e-00c4-37fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "b53a0845-8842-4f4d-a74f-b400288278b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8898802633/javablobreleaseleaseacfail1244484222a6d661a9422", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DA51B666\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e747b-201e-00c4-3cfb-594fb0000000", + "x-ms-client-request-id" : "52d44645-e684-4f2d-87b9-89714a5b4b8f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8898802633/javablobreleaseleaseacfail1244484222a6d661a9422", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DA51B666\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:53 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e7492-201e-00c4-4ffb-594fb0000000", + "x-ms-client-request-id" : "b367ad3d-e191-4e45-a69d-c7669fb09799", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8898802633/javablobreleaseleaseacfail1244484222a6d661a9422?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DA51B666\"", + "x-ms-lease-id" : "e4507511-c51c-4052-889d-6454288586a2", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e749b-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "6c30798a-a42c-4d9d-bb05-b81071d5a3e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8898802633/javablobreleaseleaseacfail1244484222a6d661a9422?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e74a9-201e-00c4-64fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e74a9-201e-00c4-64fb-594fb0000000\nTime:2019-08-23T21:42:53.4432927Z", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "9f42ffa6-7232-4ace-ab6e-3e9d304e320f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e74b6-201e-00c4-6dfb-594fb0000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfail8898802633Fri, 23 Aug 2019 21:42:53 GMT\"0x8D72812DA4C520C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "278138e1-89d9-410d-8f83-4ee8a02d813b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8898802633?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e74c3-201e-00c4-78fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "9d3388f0-393a-40e1-aa20-156c2093c39d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8898802633", "javablobreleaseleaseacfail1244484222a6d661a9422" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseerror.json new file mode 100644 index 000000000000..f18fb7a5488d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerror7f5420277c1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DA6E1325\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e74de-201e-00c4-0efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "34ebb5ea-8f84-4f5f-970e-1b40a8798421" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerror7f5420277c1/javablobreleaseleaseerror1blobapitestreleaseleaseerror7f531886", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DA73ECD2\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e74f8-201e-00c4-22fb-594fb0000000", + "x-ms-client-request-id" : "92ae1983-334f-40db-b418-4fb7738f1de4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerror7f5420277c1/javablobreleaseleaseerror2blobapitestreleaseleaseerror7f569905?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "d51e750b-201e-00c4-32fb-594fb0000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:d51e750b-201e-00c4-32fb-594fb0000000\nTime:2019-08-23T21:42:53.6124538Zx-ms-lease-idid", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "bbec1a28-c788-48bf-add8-f79e99800633", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e751a-201e-00c4-40fb-594fb0000000", + "Body" : "jtcreleaseleaseerrorjtcreleaseleaseerror0blobapitestreleaseleaseerror7f5420277c1Fri, 23 Aug 2019 21:42:53 GMT\"0x8D72812DA6E1325\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "54c39b1f-5e28-4ff7-a2e9-acf7b639b305", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerror7f5420277c1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e752b-201e-00c4-4ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:52 GMT", + "x-ms-client-request-id" : "d233e4e9-f95d-4121-b7a2-c27c33d4e71c" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseerror0blobapitestreleaseleaseerror7f5420277c1", "javablobreleaseleaseerror1blobapitestreleaseleaseerror7f531886", "javablobreleaseleaseerror2blobapitestreleaseleaseerror7f569905" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleasemin.json new file mode 100644 index 000000000000..54ff8e4ab959 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleasemin.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleasemin34311256218ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D93238B9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7059-201e-00c4-3bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "d142e577-1efa-4039-9b82-cb2baf9519e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleasemin34311256218ad/javablobreleaseleasemin1blobapitestreleaseleasemin3434032637", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D93811DE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e707a-201e-00c4-57fb-594fb0000000", + "x-ms-client-request-id" : "0f858ef3-7447-47a4-ac49-7b863c932b9b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleasemin34311256218ad/javablobreleaseleasemin1blobapitestreleaseleasemin3434032637?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D93811DE\"", + "x-ms-lease-id" : "fec0029e-4567-4cd5-bded-0be6c757f178", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e7090-201e-00c4-6afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "1cc7a9ba-fdc6-4f85-8979-a0bc8c9457a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleasemin34311256218ad/javablobreleaseleasemin1blobapitestreleaseleasemin3434032637?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D93811DE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e70a1-201e-00c4-79fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "add231bc-0ceb-462c-9926-71eba3ba0d28" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleasemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e70af-201e-00c4-06fb-594fb0000000", + "Body" : "jtcreleaseleaseminjtcreleaseleasemin0blobapitestreleaseleasemin34311256218adFri, 23 Aug 2019 21:42:51 GMT\"0x8D72812D93238B9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "1f1b85ef-bf98-4c77-ac40-126f880d8201", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleasemin34311256218ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e70bb-201e-00c4-12fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "e2e42aaf-9bfc-4ee4-93c7-1d34e0ccf72f" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleasemin0blobapitestreleaseleasemin34311256218ad", "javablobreleaseleasemin1blobapitestreleaseleasemin3434032637" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewlease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewlease.json new file mode 100644 index 000000000000..55e7bf284d57 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewlease.json @@ -0,0 +1,160 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewleasefab97752ee580258d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CDE2B2A8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e452b-201e-00c4-67fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "81d4f153-d17c-4b6a-8943-ac1c4e9cdd4b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewleasefab97752ee580258d4/javablobrenewlease1blobapitestrenewleasefab9604054cc766", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CDE7EB23\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e454c-201e-00c4-05fb-594fb0000000", + "x-ms-client-request-id" : "25cd7340-6017-43a2-9380-ad6d6bfe4c54" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewleasefab97752ee580258d4/javablobrenewlease1blobapitestrenewleasefab9604054cc766?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CDE7EB23\"", + "x-ms-lease-id" : "5ee7a180-20d8-4bf8-900d-1745c347d522", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e4563-201e-00c4-17fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:31 GMT", + "x-ms-client-request-id" : "ad5a1d32-88f0-4398-9426-7d7f93e6fec3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewleasefab97752ee580258d4/javablobrenewlease1blobapitestrenewleasefab9604054cc766?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CDE7EB23\"", + "x-ms-lease-id" : "5ee7a180-20d8-4bf8-900d-1745c347d522", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e69ba-201e-00c4-7dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "x-ms-client-request-id" : "7aa74914-faf1-42ab-9c5d-04d2a95fe640" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewleasefab97752ee580258d4/javablobrenewlease1blobapitestrenewleasefab9604054cc766", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CDE7EB23\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:32 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "d51e69dd-201e-00c4-1afb-594fb0000000", + "x-ms-client-request-id" : "17ce799d-72c8-46fd-88c8-bbcb5690e729", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewlease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e69f3-201e-00c4-2dfb-594fb0000000", + "Body" : "jtcrenewleasejtcrenewlease0blobapitestrenewleasefab97752ee580258d4Fri, 23 Aug 2019 21:42:32 GMT\"0x8D72812CDE2B2A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "x-ms-client-request-id" : "9ac1a655-e867-49a3-bd04-99c980081c40", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0blobapitestrenewleasefab97752ee580258d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6a06-201e-00c4-3efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "x-ms-client-request-id" : "8cee1285-130b-434c-be3b-7ba15d419be0" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewlease0blobapitestrenewleasefab97752ee580258d4", "javablobrenewlease1blobapitestrenewleasefab9604054cc766" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[0].json new file mode 100644 index 000000000000..2d7d2a2c64c1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[0].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacef87340495df881c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7B12E24\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6aa4-201e-00c4-4cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "x-ms-client-request-id" : "d31d431a-7cd3-4c43-afc2-d435a3d56f4b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacef87340495df881c/javablobrenewleaseac1blobapitestrenewleaseacef8644200dc3c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D7B86681\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6abd-201e-00c4-61fb-594fb0000000", + "x-ms-client-request-id" : "4e52631e-08f3-4f6b-8d81-fa423706423f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacef87340495df881c/javablobrenewleaseac1blobapitestrenewleaseacef8644200dc3c?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7B86681\"", + "x-ms-lease-id" : "afea1dfe-756b-4147-b642-3eeb8e14dddf", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6adf-201e-00c4-7cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "0f6921c3-ecfa-4fd0-b0c3-36ef421ce0c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacef87340495df881c/javablobrenewleaseac1blobapitestrenewleaseacef8644200dc3c?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7B86681\"", + "x-ms-lease-id" : "afea1dfe-756b-4147-b642-3eeb8e14dddf", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e6af5-201e-00c4-11fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "52aa0286-86a1-4715-a9b5-b26c087b1d71" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6b07-201e-00c4-20fb-594fb0000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseacef87340495df881cFri, 23 Aug 2019 21:42:48 GMT\"0x8D72812D7B12E24\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "47590fad-a88e-402f-83cb-b95a001ab650", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacef87340495df881c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6b19-201e-00c4-2ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "1d92e6c4-ddf0-466d-b237-51afcb2cf2e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseacef87340495df881c", "javablobrenewleaseac1blobapitestrenewleaseacef8644200dc3c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[1].json new file mode 100644 index 000000000000..d237ca6da412 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacdb5667232a559203?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7D0CBEB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6b37-201e-00c4-49fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "7df5315d-709a-4b6f-833e-600ad627e35a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacdb5667232a559203/javablobrenewleaseac1blobapitestrenewleaseacdb5316571da60", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D7D62F17\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6b48-201e-00c4-55fb-594fb0000000", + "x-ms-client-request-id" : "5f2ed2f9-002e-4d56-85a8-4a50fb2f0e2e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacdb5667232a559203/javablobrenewleaseac1blobapitestrenewleaseacdb5316571da60?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7D62F17\"", + "x-ms-lease-id" : "9109587d-f46e-4177-ae6c-51b27a8f33db", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6b5b-201e-00c4-64fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "1d272b5a-7a15-4453-85b9-b64b5e55e8bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacdb5667232a559203/javablobrenewleaseac1blobapitestrenewleaseacdb5316571da60?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7D62F17\"", + "x-ms-lease-id" : "9109587d-f46e-4177-ae6c-51b27a8f33db", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e6b71-201e-00c4-74fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "ead58132-baf8-4325-8d2a-b76182632ff9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6b7e-201e-00c4-7efb-594fb0000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseacdb5667232a559203Fri, 23 Aug 2019 21:42:49 GMT\"0x8D72812D7D0CBEB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "68ad5c9a-5388-4d24-b9af-8fa5e303980a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacdb5667232a559203?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6b8a-201e-00c4-08fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "4bc7ac97-645f-457d-ac69-b5bb001ac854" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseacdb5667232a559203", "javablobrenewleaseac1blobapitestrenewleaseacdb5316571da60" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[2].json new file mode 100644 index 000000000000..be832291eaba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc8e23259813da9d9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7EE4618\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6b9a-201e-00c4-16fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "a2a9a562-8d82-4c9d-afb0-5cd64b6b5a76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc8e23259813da9d9/javablobrenewleaseac1blobapitestrenewleaseacc8e36429fb002", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D7F41E9E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6bb3-201e-00c4-2dfb-594fb0000000", + "x-ms-client-request-id" : "3434a8d7-b93b-45d0-b976-2d6690d74e32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc8e23259813da9d9/javablobrenewleaseac1blobapitestrenewleaseacc8e36429fb002?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7F41E9E\"", + "x-ms-lease-id" : "2b553f93-f80e-407c-8d5b-99be11891c53", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6bce-201e-00c4-46fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "545a161e-2dc7-476f-ac28-25a0705fbff2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc8e23259813da9d9/javablobrenewleaseac1blobapitestrenewleaseacc8e36429fb002?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7F41E9E\"", + "x-ms-lease-id" : "2b553f93-f80e-407c-8d5b-99be11891c53", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e6be3-201e-00c4-5bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "3a1b3f88-4066-4e65-a838-774b034e7d22" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6bf0-201e-00c4-67fb-594fb0000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseacc8e23259813da9d9Fri, 23 Aug 2019 21:42:49 GMT\"0x8D72812D7EE4618\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "386d2bb5-11cb-4d5e-9ea1-7525eea5036f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc8e23259813da9d9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6bfb-201e-00c4-72fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "24842431-5dc3-4c25-94fe-5e1fd39a2d37" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseacc8e23259813da9d9", "javablobrenewleaseac1blobapitestrenewleaseacc8e36429fb002" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[3].json new file mode 100644 index 000000000000..4b0d8256a46e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[3].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc7c68906ab9f01ec?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D80DBCAB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6c10-201e-00c4-03fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "079c6ccf-e726-44a2-893d-ae4ac209b4a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc7c68906ab9f01ec/javablobrenewleaseac1blobapitestrenewleaseacc7c13041f63cf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D813470A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6c2a-201e-00c4-16fb-594fb0000000", + "x-ms-client-request-id" : "d7743819-1f05-418f-b185-a64f2f905caa" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc7c68906ab9f01ec/javablobrenewleaseac1blobapitestrenewleaseacc7c13041f63cf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812D813470A\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:49 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e6c35-201e-00c4-1ffb-594fb0000000", + "x-ms-client-request-id" : "709baddf-4ffe-4958-a02f-db2e132a40a0", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc7c68906ab9f01ec/javablobrenewleaseac1blobapitestrenewleaseacc7c13041f63cf?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D813470A\"", + "x-ms-lease-id" : "627a789b-2a9d-485b-ac15-ff806bb7c3db", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6c3e-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "5f437855-0d67-46c4-b612-3b3395f1fa24" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc7c68906ab9f01ec/javablobrenewleaseac1blobapitestrenewleaseacc7c13041f63cf?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D813470A\"", + "x-ms-lease-id" : "627a789b-2a9d-485b-ac15-ff806bb7c3db", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e6c5f-201e-00c4-49fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "5688e1d5-b403-42b5-b248-41ffa29dbdee" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6c66-201e-00c4-50fb-594fb0000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseacc7c68906ab9f01ecFri, 23 Aug 2019 21:42:49 GMT\"0x8D72812D80DBCAB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "3829e7d4-5d95-46d6-adce-6a99d3d70c94", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacc7c68906ab9f01ec?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6c75-201e-00c4-5dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "09062b8e-51b1-4264-8d41-59a94d2ce7d2" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseacc7c68906ab9f01ec", "javablobrenewleaseac1blobapitestrenewleaseacc7c13041f63cf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[4].json new file mode 100644 index 000000000000..a771ef453b57 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[4].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac34e74059c72f7bd6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D837BD1A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6c89-201e-00c4-6ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "3efe1e23-5dd9-4958-a73a-ff38c500619c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac34e74059c72f7bd6/javablobrenewleaseac1blobapitestrenewleaseac34e50689c5abb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D83CF950\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6c96-201e-00c4-7afb-594fb0000000", + "x-ms-client-request-id" : "ca619e4d-d63d-447e-afae-7a2e4985a702" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac34e74059c72f7bd6/javablobrenewleaseac1blobapitestrenewleaseac34e50689c5abb?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D83CF950\"", + "x-ms-lease-id" : "c8b30c70-652a-4c4a-b624-f29e2e217182", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6caa-201e-00c4-0cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "c8df8895-3244-45d9-958b-fdc514a014fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac34e74059c72f7bd6/javablobrenewleaseac1blobapitestrenewleaseac34e50689c5abb?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D83CF950\"", + "x-ms-lease-id" : "c8b30c70-652a-4c4a-b624-f29e2e217182", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e6cc1-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "47ec5f17-4b43-4377-868a-d88f7b8a1d36" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6cd3-201e-00c4-2cfb-594fb0000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseac34e74059c72f7bd6Fri, 23 Aug 2019 21:42:49 GMT\"0x8D72812D837BD1A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "188a0718-d0bd-4e66-ac79-fd6d353cfef3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac34e74059c72f7bd6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6ce8-201e-00c4-3ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:48 GMT", + "x-ms-client-request-id" : "28da9467-3d2a-4af1-b112-388eaa91caeb" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseac34e74059c72f7bd6", "javablobrenewleaseac1blobapitestrenewleaseac34e50689c5abb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[0].json new file mode 100644 index 000000000000..f1a4431810d5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[0].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail07046248639d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D8544CC1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6cff-201e-00c4-55fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "d1a8912b-82ad-4001-99f6-3012e0ee5b2f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail07046248639d/javablobrenewleaseacfail1blobapitestrenewleaseacfail07048322c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D859B019\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6d15-201e-00c4-68fb-594fb0000000", + "x-ms-client-request-id" : "4c5ef373-b698-4cfa-aecb-78a6e3640c9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail07046248639d/javablobrenewleaseacfail1blobapitestrenewleaseacfail07048322c?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D859B019\"", + "x-ms-lease-id" : "d13fd1af-3ebb-411b-bdf8-c6c402056bc3", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6d40-201e-00c4-0dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "6133ca46-f3e5-4611-a37c-3579178aece3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail07046248639d/javablobrenewleaseacfail1blobapitestrenewleaseacfail07048322c?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e6d51-201e-00c4-1dfb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e6d51-201e-00c4-1dfb-594fb0000000\nTime:2019-08-23T21:42:50.1111149Z", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "621e7a0c-8b53-44ba-9910-b70e07507c17", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6d60-201e-00c4-2bfb-594fb0000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfail07046248639dFri, 23 Aug 2019 21:42:50 GMT\"0x8D72812D8544CC1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "a6f51ee0-f6ac-4d35-9099-6eb87f2538b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail07046248639d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6d71-201e-00c4-38fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "a5fb42ab-e5ca-4866-a104-4ede5452b109" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfail07046248639d", "javablobrenewleaseacfail1blobapitestrenewleaseacfail07048322c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[1].json new file mode 100644 index 000000000000..7fba4dd3eb74 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfailff4494211f62?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D8719FE5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6d89-201e-00c4-4afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "45bdfc5a-f4dd-4ccb-80bd-d9f79dda0304" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfailff4494211f62/javablobrenewleaseacfail1blobapitestrenewleaseacfailff4107816", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D877518E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6d98-201e-00c4-56fb-594fb0000000", + "x-ms-client-request-id" : "fbe53617-c21b-4450-a8b2-6bac86789b98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfailff4494211f62/javablobrenewleaseacfail1blobapitestrenewleaseacfailff4107816?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D877518E\"", + "x-ms-lease-id" : "f9d5f2ba-a284-40c5-9900-380ca3ccd9cd", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6da6-201e-00c4-62fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "08814318-0efa-4af7-9dcd-733cdb9c76a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfailff4494211f62/javablobrenewleaseacfail1blobapitestrenewleaseacfailff4107816?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e6dbd-201e-00c4-76fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e6dbd-201e-00c4-76fb-594fb0000000\nTime:2019-08-23T21:42:50.3053001Z", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "e4cd3db2-7c0b-4380-ac3e-a593ff773600", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6dd1-201e-00c4-07fb-594fb0000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfailff4494211f62Fri, 23 Aug 2019 21:42:50 GMT\"0x8D72812D8719FE5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "b1c35a74-e64b-4ccd-8cc3-bf3b19336132", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfailff4494211f62?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6de2-201e-00c4-18fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "04410f96-bbeb-44df-9180-582a1da9c454" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfailff4494211f62", "javablobrenewleaseacfail1blobapitestrenewleaseacfailff4107816" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[2].json new file mode 100644 index 000000000000..98d55a9d79d4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail9fe584252224?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D88F8F75\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6dfb-201e-00c4-31fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "263894af-e1de-4297-a568-3f45988696a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail9fe584252224/javablobrenewleaseacfail1blobapitestrenewleaseacfail9fe73496a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D895411E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6e0c-201e-00c4-40fb-594fb0000000", + "x-ms-client-request-id" : "7805e60f-cf15-43b5-96b2-70cb002ee4ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail9fe584252224/javablobrenewleaseacfail1blobapitestrenewleaseacfail9fe73496a?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D895411E\"", + "x-ms-lease-id" : "0a2c964f-1f0c-4fdf-a528-2ce38d9dbd61", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6e1c-201e-00c4-4ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "6547995f-b0d1-49eb-9d6b-e4683d8eb0eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail9fe584252224/javablobrenewleaseacfail1blobapitestrenewleaseacfail9fe73496a?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e6e39-201e-00c4-67fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e6e39-201e-00c4-67fb-594fb0000000\nTime:2019-08-23T21:42:50.5155006Z", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "74e94224-a5f2-4501-a1e2-540a194c645f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6e45-201e-00c4-71fb-594fb0000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfail9fe584252224Fri, 23 Aug 2019 21:42:50 GMT\"0x8D72812D88F8F75\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "f72b76ce-7a25-497d-80c3-458e116925b7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail9fe584252224?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6e4f-201e-00c4-7bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "54adf08c-c647-4fa5-972c-30c7920aa1f9" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfail9fe584252224", "javablobrenewleaseacfail1blobapitestrenewleaseacfail9fe73496a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[3].json new file mode 100644 index 000000000000..460ff893f63e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[3].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail691544268063?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D8AFF09C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6e60-201e-00c4-0cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "b0a51023-f6e6-4d4e-8338-1505c758490d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail691544268063/javablobrenewleaseacfail1blobapitestrenewleaseacfail691860464", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D8B57B36\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6e83-201e-00c4-28fb-594fb0000000", + "x-ms-client-request-id" : "6c3de30d-645f-4377-96dd-260aa75eebb1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail691544268063/javablobrenewleaseacfail1blobapitestrenewleaseacfail691860464", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812D8B57B36\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:50 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e6e97-201e-00c4-3bfb-594fb0000000", + "x-ms-client-request-id" : "59f00378-93f6-456c-9981-acb94b9126ce", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail691544268063/javablobrenewleaseacfail1blobapitestrenewleaseacfail691860464?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D8B57B36\"", + "x-ms-lease-id" : "b5c989e8-766a-453e-af90-b1441729f0e3", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6ea9-201e-00c4-4dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "ab1f1231-01e1-468c-a071-a23085b82360" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail691544268063/javablobrenewleaseacfail1blobapitestrenewleaseacfail691860464?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e6ebf-201e-00c4-60fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e6ebf-201e-00c4-60fb-594fb0000000\nTime:2019-08-23T21:42:50.7387132Z", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "0a2aa5b6-ab59-48b6-9454-854fc8d3f440", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6ec8-201e-00c4-68fb-594fb0000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfail691544268063Fri, 23 Aug 2019 21:42:50 GMT\"0x8D72812D8AFF09C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "45ed5a79-da45-46b9-8a60-2751885abaf1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail691544268063?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6ed7-201e-00c4-73fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:49 GMT", + "x-ms-client-request-id" : "e1fe59a6-a479-4f67-9d53-4155a724ea74" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfail691544268063", "javablobrenewleaseacfail1blobapitestrenewleaseacfail691860464" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseerror.json new file mode 100644 index 000000000000..870e6f39b108 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerrorf397286340359?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D8E8C1C0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6f26-201e-00c4-33fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "fec681c6-f0da-42d1-9a47-4aa671b88a43" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerrorf397286340359/javablobrenewleaseerror1blobapitestrenewleaseerrorf394026863", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D8EE4C6F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6f41-201e-00c4-49fb-594fb0000000", + "x-ms-client-request-id" : "cad5dc7f-6e82-4452-b8d1-274474582615" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerrorf397286340359/javablobrenewleaseerror2blobapitestrenewleaseerrorf39092788b?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "d51e6f50-201e-00c4-57fb-594fb0000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:d51e6f50-201e-00c4-57fb-594fb0000000\nTime:2019-08-23T21:42:51.1430989Zx-ms-lease-idid", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "477814a1-01a7-4178-b61b-b5f3ce5cad04", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6fa6-201e-00c4-22fb-594fb0000000", + "Body" : "jtcrenewleaseerrorjtcrenewleaseerror0blobapitestrenewleaseerrorf397286340359Fri, 23 Aug 2019 21:42:50 GMT\"0x8D72812D8E8C1C0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "85f63780-85de-4363-a267-83b3b7febfa5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerrorf397286340359?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6fbd-201e-00c4-33fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:50 GMT", + "x-ms-client-request-id" : "397e3516-1bb0-466d-9e0b-3ed161254697" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseerror0blobapitestrenewleaseerrorf397286340359", "javablobrenewleaseerror1blobapitestrenewleaseerrorf394026863", "javablobrenewleaseerror2blobapitestrenewleaseerrorf39092788b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleasemin.json new file mode 100644 index 000000000000..9dd6277dd9e2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleasemin.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin82628055043d9f6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7914247\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6a21-201e-00c4-59fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "x-ms-client-request-id" : "06c23d9b-9ac8-4c24-9a2d-ee1d49190469" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin82628055043d9f6/javablobrenewleasemin1blobapitestrenewleasemin82640500c8f6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812D7967E52\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e6a3b-201e-00c4-6bfb-594fb0000000", + "x-ms-client-request-id" : "0194f02b-b3f9-4b5a-94a7-16d07a7ae10a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin82628055043d9f6/javablobrenewleasemin1blobapitestrenewleasemin82640500c8f6?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7967E52\"", + "x-ms-lease-id" : "cccc4930-3a4d-4b7b-b38b-c498f8f703a8", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e6a4f-201e-00c4-7dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "x-ms-client-request-id" : "c0fe91b4-52fc-498d-8a17-71c1dbb0ecdc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin82628055043d9f6/javablobrenewleasemin1blobapitestrenewleasemin82640500c8f6?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812D7967E52\"", + "x-ms-lease-id" : "cccc4930-3a4d-4b7b-b38b-c498f8f703a8", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e6a6a-201e-00c4-16fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "x-ms-client-request-id" : "5da657ed-29ca-4587-aa5b-28d8f9e8903d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleasemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6a80-201e-00c4-29fb-594fb0000000", + "Body" : "jtcrenewleaseminjtcrenewleasemin0blobapitestrenewleasemin82628055043d9f6Fri, 23 Aug 2019 21:42:48 GMT\"0x8D72812D7914247\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "x-ms-client-request-id" : "495c7ae2-2d1d-4e8e-8a58-a858715b1767", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin82628055043d9f6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e6a94-201e-00c4-3cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:47 GMT", + "x-ms-client-request-id" : "ac398914-2105-40cd-b050-f353939c9f1a" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleasemin0blobapitestrenewleasemin82628055043d9f6", "javablobrenewleasemin1blobapitestrenewleasemin82640500c8f6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[0].json new file mode 100644 index 000000000000..42efc19515c7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[0].json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacd6703284b103?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C8F7B6FB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2c73-201e-00c4-53fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "cd5fdf1f-8d39-44a6-895f-6846546ed531" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacd6703284b103/javablobsethttpheadersac1blobapitestsethttpheadersacd67038194", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C8FD3BAA\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2c89-201e-00c4-63fb-594fb0000000", + "x-ms-client-request-id" : "53118310-26ad-4281-82c8-637a63f6362a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacd6703284b103/javablobsethttpheadersac1blobapitestsethttpheadersacd67038194?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C9029427\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e2c9c-201e-00c4-74fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "b4e49051-439b-43da-b4bc-18e6da102d63" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2cb7-201e-00c4-0bfb-594fb0000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersacd6703284b103Fri, 23 Aug 2019 21:42:24 GMT\"0x8D72812C8F7B6FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "0e73b1e7-3b63-4fcf-bedd-8bf969b89358", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacd6703284b103?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2cc8-201e-00c4-18fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "e52aed33-1dbe-42d0-9b40-40561dc0fc13" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersacd6703284b103", "javablobsethttpheadersac1blobapitestsethttpheadersacd67038194" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[1].json new file mode 100644 index 000000000000..480edd7dc33d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[1].json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc60087845951?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C9127153\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2ce0-201e-00c4-2ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "37f456fc-6f8b-49f0-b977-397fd2efea29" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc60087845951/javablobsethttpheadersac1blobapitestsethttpheadersacc60213933", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C917CF10\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2cf3-201e-00c4-3ffb-594fb0000000", + "x-ms-client-request-id" : "c280d516-658b-476f-9fba-f6f89f31f84e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc60087845951/javablobsethttpheadersac1blobapitestsethttpheadersacc60213933?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C91D0077\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e2d06-201e-00c4-50fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "599faf67-57dc-4e79-8e02-ddfc63fee58a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2d1f-201e-00c4-66fb-594fb0000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersacc60087845951Fri, 23 Aug 2019 21:42:24 GMT\"0x8D72812C9127153\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "d2e2f1bd-0da8-4c41-9fa8-06c8d0e33040", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacc60087845951?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2d3d-201e-00c4-7ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "eda3792b-21c9-4061-9c55-7c51de2011c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersacc60087845951", "javablobsethttpheadersac1blobapitestsethttpheadersacc60213933" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[2].json new file mode 100644 index 000000000000..18e9ba7876f7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[2].json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacf0b78366dd42?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C92C8F61\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2d5d-201e-00c4-1bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "660c1819-e201-4dcf-90c9-c5d258a8a96d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacf0b78366dd42/javablobsethttpheadersac1blobapitestsethttpheadersacf0b92657b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C932B0AF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2d7d-201e-00c4-35fb-594fb0000000", + "x-ms-client-request-id" : "62ac3963-a418-4142-9fb5-b564014150c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacf0b78366dd42/javablobsethttpheadersac1blobapitestsethttpheadersacf0b92657b?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C9380928\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e2d8f-201e-00c4-43fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "fad26e1c-ad42-4129-a94c-e2c33e13f727" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2da3-201e-00c4-55fb-594fb0000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersacf0b78366dd42Fri, 23 Aug 2019 21:42:24 GMT\"0x8D72812C92C8F61\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "b9cf53d7-be7e-4452-8e71-421e63154f2d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacf0b78366dd42?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2db6-201e-00c4-65fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "8a6293a1-e23a-4c75-ba43-0b38b36d7e99" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersacf0b78366dd42", "javablobsethttpheadersac1blobapitestsethttpheadersacf0b92657b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[3].json new file mode 100644 index 000000000000..de7522e12328 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[3].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac80a536804e39?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C94770F1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2dcb-201e-00c4-76fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "1b60814a-e6bf-4cd6-a812-b7c59c1c48fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac80a536804e39/javablobsethttpheadersac1blobapitestsethttpheadersac80a53136a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C94CF5E3\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2de3-201e-00c4-06fb-594fb0000000", + "x-ms-client-request-id" : "d48c1cc0-f5e7-499e-86ce-08f8da6c0e1f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac80a536804e39/javablobsethttpheadersac1blobapitestsethttpheadersac80a53136a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C94CF5E3\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:24 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e2dff-201e-00c4-1ffb-594fb0000000", + "x-ms-client-request-id" : "c9e7e265-87a8-4e86-9669-a60145b610d4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac80a536804e39/javablobsethttpheadersac1blobapitestsethttpheadersac80a53136a?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C959F161\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e2e15-201e-00c4-30fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "6c8a15a5-45d7-4dd8-b536-f27cc4bf4c2e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2e22-201e-00c4-3bfb-594fb0000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersac80a536804e39Fri, 23 Aug 2019 21:42:24 GMT\"0x8D72812C94770F1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "ee09d452-4618-494b-a6f6-c63e2e4b438e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac80a536804e39?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2e2f-201e-00c4-44fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "53b59ca5-1d69-4f42-b99c-d8234a18500f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersac80a536804e39", "javablobsethttpheadersac1blobapitestsethttpheadersac80a53136a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[4].json new file mode 100644 index 000000000000..6052ecf49fad --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[4].json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac65e27651a101?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C96A91EA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2e4b-201e-00c4-5dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "e8fbdcea-ce45-4319-93e2-292e1867a6d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac65e27651a101/javablobsethttpheadersac1blobapitestsethttpheadersac65e85081f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C9703DF6\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2e5e-201e-00c4-6bfb-594fb0000000", + "x-ms-client-request-id" : "91a41542-f12c-4a01-8857-0ad9c30d251e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac65e27651a101/javablobsethttpheadersac1blobapitestsethttpheadersac65e85081f?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C9754845\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e2e79-201e-00c4-01fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "da8f4fc4-2e32-4c86-bb81-0c4d504fe0e1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2e89-201e-00c4-10fb-594fb0000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersac65e27651a101Fri, 23 Aug 2019 21:42:24 GMT\"0x8D72812C96A91EA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "b71c8d49-7535-4d21-8b91-aab4773dcd79", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac65e27651a101?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2e9c-201e-00c4-20fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "c9a649c0-ad6c-4649-af31-4af45c46f2dd" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersac65e27651a101", "javablobsethttpheadersac1blobapitestsethttpheadersac65e85081f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[5].json new file mode 100644 index 000000000000..c122c154e38d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[5].json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac89789179d6f4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C984FE2B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2eb4-201e-00c4-33fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "07a35bc9-9e23-44a5-9c10-7bab48227a12" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac89789179d6f4/javablobsethttpheadersac1blobapitestsethttpheadersac89791596b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C98A5C12\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2ecb-201e-00c4-47fb-594fb0000000", + "x-ms-client-request-id" : "e92d6b5c-da76-42c8-b7e0-b624477125fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac89789179d6f4/javablobsethttpheadersac1blobapitestsethttpheadersac89791596b?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C98A5C12\"", + "x-ms-lease-id" : "0fc7938c-53ec-4f15-8c9d-e54703b686d7", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2ee4-201e-00c4-5dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "77750865-46da-4281-a0f3-05eb42617582" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac89789179d6f4/javablobsethttpheadersac1blobapitestsethttpheadersac89791596b?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C993D445\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e2efa-201e-00c4-71fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "685cab20-a96a-4b96-8e25-b79740af3edb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2f0a-201e-00c4-7ffb-594fb0000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersac89789179d6f4Fri, 23 Aug 2019 21:42:25 GMT\"0x8D72812C984FE2B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "4204215c-2cbd-41fc-9519-3f65024940cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac89789179d6f4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2f23-201e-00c4-17fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "cdcd7330-02b4-42b8-8cf0-188905d6ebff" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersac89789179d6f4", "javablobsethttpheadersac1blobapitestsethttpheadersac89791596b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[0].json new file mode 100644 index 000000000000..70642563ea5c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[0].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0273860306c66bf47c40e8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C9A36304\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2f43-201e-00c4-34fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "0c9884ff-b4dd-447c-990e-d5ee0e8decf1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0273860306c66bf47c40e8a/javablobsethttpheadersacfail188313d604961307074e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C9A90F33\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2f5b-201e-00c4-47fb-594fb0000000", + "x-ms-client-request-id" : "e89e5bae-cff6-4da0-991f-3486210b647d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0273860306c66bf47c40e8a/javablobsethttpheadersacfail188313d604961307074e?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e2f6a-201e-00c4-53fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e2f6a-201e-00c4-53fb-594fb0000000\nTime:2019-08-23T21:42:25.4375704Z", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "af2cbdcd-7cee-4d48-a849-673ed5bb96b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2f77-201e-00c4-60fb-594fb0000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail0273860306c66bf47c40e8aFri, 23 Aug 2019 21:42:25 GMT\"0x8D72812C9A36304\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "c5c1d07a-a8d6-472b-817f-4bf182c8313d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0273860306c66bf47c40e8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2f8a-201e-00c4-6efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "657b49fe-0ee8-4236-b8ad-55eec2bc792a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail0273860306c66bf47c40e8a", "javablobsethttpheadersacfail188313d604961307074e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[1].json new file mode 100644 index 000000000000..437543f81360 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0191653287a2eecd6e4cf5a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C9BCBD9A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2fa2-201e-00c4-80fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "7a22ee5c-d272-4b93-a89a-e5cf90c59b53" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0191653287a2eecd6e4cf5a/javablobsethttpheadersacfail10280464ee2546b6534b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C9C21B95\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2fb8-201e-00c4-14fb-594fb0000000", + "x-ms-client-request-id" : "0085dfb9-ab26-4e74-9027-77c944d70220" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0191653287a2eecd6e4cf5a/javablobsethttpheadersacfail10280464ee2546b6534b?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e2fcd-201e-00c4-25fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e2fcd-201e-00c4-25fb-594fb0000000\nTime:2019-08-23T21:42:25.6037289Z", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "9d80ac02-f740-406b-b70c-8ecbbacb0b18", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2fe0-201e-00c4-38fb-594fb0000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail0191653287a2eecd6e4cf5aFri, 23 Aug 2019 21:42:25 GMT\"0x8D72812C9BCBD9A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "b372fbf1-71a1-4269-b342-784fd5fac887", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0191653287a2eecd6e4cf5a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2ff4-201e-00c4-49fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "3f0ab91d-277c-4970-b508-405f4c0ed7ef" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail0191653287a2eecd6e4cf5a", "javablobsethttpheadersacfail10280464ee2546b6534b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[2].json new file mode 100644 index 000000000000..7447356abc79 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[2].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail03338706715f8a283c4eab9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C9D7ED54\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3010-201e-00c4-5efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "6271da95-fe91-42e1-a9d7-0a4604000078" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail03338706715f8a283c4eab9/javablobsethttpheadersacfail13119854b5378794a648", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C9E22E9F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e302c-201e-00c4-70fb-594fb0000000", + "x-ms-client-request-id" : "d649c3ee-f023-4356-b222-ceae0e93d26c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail03338706715f8a283c4eab9/javablobsethttpheadersacfail13119854b5378794a648?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e3058-201e-00c4-0dfb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e3058-201e-00c4-0dfb-594fb0000000\nTime:2019-08-23T21:42:25.8069229Z", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "f03831b4-f80d-4709-99c5-3973dcacb726", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e306b-201e-00c4-1cfb-594fb0000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail03338706715f8a283c4eab9Fri, 23 Aug 2019 21:42:25 GMT\"0x8D72812C9D7ED54\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "4e75ebb6-c9a7-4b1f-a087-ffa938242a7d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail03338706715f8a283c4eab9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e307d-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "39b69fca-025b-4287-ac5b-ba0fb076afef" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail03338706715f8a283c4eab9", "javablobsethttpheadersacfail13119854b5378794a648" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[3].json new file mode 100644 index 000000000000..ca43b14bff6e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[3].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0138814be1b1e37d974acdb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C9F9D580\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e30c5-201e-00c4-61fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:24 GMT", + "x-ms-client-request-id" : "48d49a49-662c-40c8-a248-ec265fc77b64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0138814be1b1e37d974acdb/javablobsethttpheadersacfail1537460bde2c4271d749", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C9FF5AAE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e30e3-201e-00c4-7cfb-594fb0000000", + "x-ms-client-request-id" : "b10766eb-f601-4f06-9989-3fc2cac55f8d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0138814be1b1e37d974acdb/javablobsethttpheadersacfail1537460bde2c4271d749", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:25 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C9FF5AAE\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:25 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e30fe-201e-00c4-0dfb-594fb0000000", + "x-ms-client-request-id" : "c0c8edfc-0a92-4117-b7a5-0e650effbae4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0138814be1b1e37d974acdb/javablobsethttpheadersacfail1537460bde2c4271d749?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e3114-201e-00c4-1efb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e3114-201e-00c4-1efb-594fb0000000\nTime:2019-08-23T21:42:26.0291348Z", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "983159e0-f771-4000-87d7-a0febf967998", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3122-201e-00c4-2bfb-594fb0000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail0138814be1b1e37d974acdbFri, 23 Aug 2019 21:42:25 GMT\"0x8D72812C9F9D580\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "89df8120-d556-483a-a9fc-e5d3a515ca39", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0138814be1b1e37d974acdb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e314b-201e-00c4-48fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "59af8597-d2d4-4a50-8200-6a709faefb87" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail0138814be1b1e37d974acdb", "javablobsethttpheadersacfail1537460bde2c4271d749" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[4].json new file mode 100644 index 000000000000..aa058e5bd993 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[4].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0610753e26870918c4471b9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CA181342\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3179-201e-00c4-6afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "ccddb373-4b32-40bd-ac99-4999e7306b7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0610753e26870918c4471b9/javablobsethttpheadersacfail1872528bad178505384d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CA1EF864\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e31ae-201e-00c4-14fb-594fb0000000", + "x-ms-client-request-id" : "9b482d55-87b4-4e34-b6f6-e0bb53077125" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0610753e26870918c4471b9/javablobsethttpheadersacfail1872528bad178505384d?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CA1EF864\"", + "x-ms-lease-id" : "2d4d95a4-5540-49f2-a907-e51be079513d", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e31de-201e-00c4-3bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "5fcb8491-82a2-4ef6-a2e9-32803aa8ef3c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0610753e26870918c4471b9/javablobsethttpheadersacfail1872528bad178505384d?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "d51e31f9-201e-00c4-52fb-594fb0000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:d51e31f9-201e-00c4-52fb-594fb0000000\nTime:2019-08-23T21:42:26.2413372Z", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "01d80d10-afe4-49ab-990d-5f8027ab9e81", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3209-201e-00c4-5ffb-594fb0000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail0610753e26870918c4471b9Fri, 23 Aug 2019 21:42:26 GMT\"0x8D72812CA181342\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "c2fc4ea9-e2ca-472f-a384-9b566acc6779", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersacfail0610753e26870918c4471b9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e321f-201e-00c4-72fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "d54f3069-82ea-4bcd-9bba-5c2ed5f42cfa" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail0610753e26870918c4471b9", "javablobsethttpheadersacfail1872528bad178505384d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheaderserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheaderserror.json new file mode 100644 index 000000000000..983ac85decac --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheaderserror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserrorbcc403830?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CA37FF1F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e323c-201e-00c4-09fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "8e44121d-ba6a-411e-9bff-d8af4583edd9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserrorbcc403830/javablobsethttpheaderserror18821208832faedde2467", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CA3D845F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3257-201e-00c4-1efb-594fb0000000", + "x-ms-client-request-id" : "b4f5d0e2-d9c5-43a2-885b-8f170775ff43" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserrorbcc403830/javablobsethttpheaderserror297096a284fb6cde124a7?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3269-201e-00c4-2bfb-594fb0000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:d51e3269-201e-00c4-2bfb-594fb0000000\nTime:2019-08-23T21:42:26.4104988Z", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "06ee53f7-d56b-4b35-b589-5ac8a5000004", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheaderserror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e327a-201e-00c4-36fb-594fb0000000", + "Body" : "jtcsethttpheaderserrorjtcsethttpheaderserror0blobapitestsethttpheaderserrorbcc403830Fri, 23 Aug 2019 21:42:26 GMT\"0x8D72812CA37FF1F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "db324574-c20a-411e-9891-2491750d8c2d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserrorbcc403830?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e328f-201e-00c4-49fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "58f2fbb3-db65-4bdb-a074-e20ee0e1d5d5" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheaderserror0blobapitestsethttpheaderserrorbcc403830", "javablobsethttpheaderserror18821208832faedde2467", "javablobsethttpheaderserror297096a284fb6cde124a7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[0].json new file mode 100644 index 000000000000..d444f3544f5a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[0].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders067109801059e01bce438f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C8BAED1E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2bb0-201e-00c4-29fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "e9213c15-b9d8-4450-8f98-8f6d790942c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders067109801059e01bce438f/javablobsethttpheadersheaders11165061d5078448e74a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C8C098F8\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2bbd-201e-00c4-34fb-594fb0000000", + "x-ms-client-request-id" : "f0908ead-4b5a-47e4-b142-db73044fecc6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders067109801059e01bce438f/javablobsethttpheadersheaders11165061d5078448e74a?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C8C5A347\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e2bc5-201e-00c4-3bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "9b04e9b7-b48f-4a68-8cf9-27f309ecf4e6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders067109801059e01bce438f/javablobsethttpheadersheaders11165061d5078448e74a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C8C5A347\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e2bd1-201e-00c4-47fb-594fb0000000", + "x-ms-client-request-id" : "d87d72cf-bc1b-4558-9067-4f52ceb69ecd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2bd8-201e-00c4-4dfb-594fb0000000", + "Body" : "jtcsethttpheadersheadersjtcsethttpheadersheaders067109801059e01bce438fFri, 23 Aug 2019 21:42:23 GMT\"0x8D72812C8BAED1E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "f5cc830e-0fc9-40c0-95f4-d48fd66b74ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders067109801059e01bce438f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2be0-201e-00c4-54fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "73f44770-163a-4fc3-b719-e35b780f4080" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersheaders067109801059e01bce438f", "javablobsethttpheadersheaders11165061d5078448e74a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[1].json new file mode 100644 index 000000000000..b20fb2569666 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[1].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders0132750591f92243eb413b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C8D86763\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2bef-201e-00c4-61fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "4f29f4de-ad73-4aed-940a-08ee5a2cedf9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders0132750591f92243eb413b/javablobsethttpheadersheaders1654991670f556784541", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C8DE1347\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2c0e-201e-00c4-7afb-594fb0000000", + "x-ms-client-request-id" : "73c40034-64ee-4139-b54b-7792081e2eee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders0132750591f92243eb413b/javablobsethttpheadersheaders1654991670f556784541?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C8E31D92\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e2c24-201e-00c4-0cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "9d0b538d-767c-4c74-8c05-7bb757bc27fd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders0132750591f92243eb413b/javablobsethttpheadersheaders1654991670f556784541", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:24 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e2c35-201e-00c4-1afb-594fb0000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D72812C8E31D92\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "ed617983-432d-4a9f-b1b6-7a9b03bab290", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2c4c-201e-00c4-2efb-594fb0000000", + "Body" : "jtcsethttpheadersheadersjtcsethttpheadersheaders0132750591f92243eb413bFri, 23 Aug 2019 21:42:24 GMT\"0x8D72812C8D86763\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "1e0b3423-6e68-42cc-b0cc-e70582cf264c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersheaders0132750591f92243eb413b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2c5b-201e-00c4-3dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:23 GMT", + "x-ms-client-request-id" : "24c63182-237e-4990-9d8f-37214152ed5c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersheaders0132750591f92243eb413b", "javablobsethttpheadersheaders1654991670f556784541" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersmin.json new file mode 100644 index 000000000000..2728fb4de96d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersmin.json @@ -0,0 +1,169 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin6e09982421a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C87BB1E0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2add-201e-00c4-75fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "75ac7e1c-ae02-4f8b-9615-8f66fa475e2c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin6e09982421a/javablobsethttpheadersmin1blobapitestsethttpheadersmin6e007772", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C881ABC8\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2af8-201e-00c4-08fb-594fb0000000", + "x-ms-client-request-id" : "8b6bb924-f495-4694-94f5-51ba49953298" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin6e09982421a/javablobsethttpheadersmin1blobapitestsethttpheadersmin6e007772", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C881ABC8\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e2b0f-201e-00c4-1cfb-594fb0000000", + "x-ms-client-request-id" : "495f08e2-0b02-43b1-8ed8-802260144d64", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin6e09982421a/javablobsethttpheadersmin1blobapitestsethttpheadersmin6e007772?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C88C83DB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e2b2a-201e-00c4-33fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "6aeb1e9f-1a1f-415d-b994-3ff47da6d00b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin6e09982421a/javablobsethttpheadersmin1blobapitestsethttpheadersmin6e007772", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812C88C83DB\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e2b3f-201e-00c4-44fb-594fb0000000", + "Body" : "", + "x-ms-client-request-id" : "7f159acd-5091-4308-bc3c-397fac9eb649", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2b4a-201e-00c4-4ffb-594fb0000000", + "Body" : "jtcsethttpheadersminjtcsethttpheadersmin0blobapitestsethttpheadersmin6e09982421aFri, 23 Aug 2019 21:42:23 GMT\"0x8D72812C87BB1E0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "cfe2fa3e-9a84-49dd-96e9-2b7e07ff8460", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin6e09982421a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2b56-201e-00c4-5bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "49ad7122-9ade-4cd2-833a-d4975af2b1e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersmin0blobapitestsethttpheadersmin6e09982421a", "javablobsethttpheadersmin1blobapitestsethttpheadersmin6e007772" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersnull.json new file mode 100644 index 000000000000..6b57dedf4eee --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersnull.json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnull85a4555620?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C85B77C7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e2a6e-201e-00c4-1bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "8f4373fa-9152-4852-be39-268dbe1c59a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnull85a4555620/javablobsethttpheadersnull1516419c605372d0ff4b4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812C860FC5D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e2a82-201e-00c4-2efb-594fb0000000", + "x-ms-client-request-id" : "999fa4a9-1c0f-4751-bc20-ea3450b71df6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnull85a4555620/javablobsethttpheadersnull1516419c605372d0ff4b4?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812C86654DF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e2a8f-201e-00c4-3bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "008dc6c9-9338-4a1e-a460-29397c7ce5be" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsethttpheadersnull&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2ab7-201e-00c4-58fb-594fb0000000", + "Body" : "jtcsethttpheadersnulljtcsethttpheadersnull0blobapitestsethttpheadersnull85a4555620Fri, 23 Aug 2019 21:42:23 GMT\"0x8D72812C85B77C7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "b2a53796-dcfc-4eba-a942-af8282a5cadf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnull85a4555620?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e2ac6-201e-00c4-65fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:22 GMT", + "x-ms-client-request-id" : "f5027599-b0d7-4d81-b313-d53396ebc0d7" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersnull0blobapitestsethttpheadersnull85a4555620", "javablobsethttpheadersnull1516419c605372d0ff4b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[0].json new file mode 100644 index 000000000000..ae56aea876b1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[0].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac476161534ca9a2f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CADA5A3A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e35bd-201e-00c4-70fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "264cd550-5632-4148-9b66-463acf7b4f4a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac476161534ca9a2f/javablobsetmetadataac1blobapitestsetmetadataac47663615b56e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CADFB89A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e35cf-201e-00c4-7efb-594fb0000000", + "x-ms-client-request-id" : "1d8094ea-8731-4e8f-bc7d-58f10aad8b32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac476161534ca9a2f/javablobsetmetadataac1blobapitestsetmetadataac47663615b56e?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CAE4C2E4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e35df-201e-00c4-0dfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "01585872-dc1d-4123-9475-151947ddf56d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e35ee-201e-00c4-17fb-594fb0000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac476161534ca9a2fFri, 23 Aug 2019 21:42:27 GMT\"0x8D72812CADA5A3A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "82816ded-0659-4059-80fa-362c67cab2b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac476161534ca9a2f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3606-201e-00c4-27fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "d0d47528-c681-4e77-b812-e95501cff924" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac476161534ca9a2f", "javablobsetmetadataac1blobapitestsetmetadataac47663615b56e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[1].json new file mode 100644 index 000000000000..be1825e5c695 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacf0577090835a8ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CAF3DBE2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e362c-201e-00c4-44fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "1e28d28b-8e3b-42e8-93a2-4940d35f59e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacf0577090835a8ad/javablobsetmetadataac1blobapitestsetmetadataacf0562357cfa7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CAFA4C00\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e364d-201e-00c4-5ffb-594fb0000000", + "x-ms-client-request-id" : "7e26033d-0eb4-4166-836d-6e81e3cded0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacf0577090835a8ad/javablobsetmetadataac1blobapitestsetmetadataacf0562357cfa7?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CAFF5659\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e365d-201e-00c4-6cfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "0f1cb682-e63b-45d5-a78a-11881dab0fc6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3673-201e-00c4-7bfb-594fb0000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataacf0577090835a8adFri, 23 Aug 2019 21:42:27 GMT\"0x8D72812CAF3DBE2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "9927f215-0677-43f2-9c34-97ea29575855", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacf0577090835a8ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3688-201e-00c4-0afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "49a1760e-3578-4341-95ce-f15071ce3614" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataacf0577090835a8ad", "javablobsetmetadataac1blobapitestsetmetadataacf0562357cfa7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[2].json new file mode 100644 index 000000000000..cd95516ede97 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[2].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac9d84378356d5d8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CB0F80EB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e36af-201e-00c4-2bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "64f9a100-1372-4da8-97ea-d3220dfd6827" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac9d84378356d5d8a/javablobsetmetadataac1blobapitestsetmetadataac9d876025ef0f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CB14DF6C\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e36ce-201e-00c4-42fb-594fb0000000", + "x-ms-client-request-id" : "30e4510b-93ad-4f71-8d37-8ba3c8820726" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac9d84378356d5d8a/javablobsetmetadataac1blobapitestsetmetadataac9d876025ef0f?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CB1A37E5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e36e8-201e-00c4-57fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "9de94a70-5694-48e8-b1ff-7c89e5eed9c2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e370b-201e-00c4-73fb-594fb0000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac9d84378356d5d8aFri, 23 Aug 2019 21:42:27 GMT\"0x8D72812CB0F80EB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "2ce2226a-b744-4f50-bd0b-0e19476eb08b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac9d84378356d5d8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e371f-201e-00c4-04fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "45aa3986-3788-46e3-9c8a-ee9525a7bf09" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac9d84378356d5d8a", "javablobsetmetadataac1blobapitestsetmetadataac9d876025ef0f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[3].json new file mode 100644 index 000000000000..1a82f071c8dd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[3].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac313370997001a9a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CB353A8F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e377c-201e-00c4-53fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "e9ddd8df-5448-46e0-846d-1b88ef86bc02" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac313370997001a9a/javablobsetmetadataac1blobapitestsetmetadataac3131018009da", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CB3AC035\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3796-201e-00c4-6afb-594fb0000000", + "x-ms-client-request-id" : "64b45f92-fa52-48b4-aa32-ce1b3444c644" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac313370997001a9a/javablobsetmetadataac1blobapitestsetmetadataac3131018009da", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CB3AC035\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:28 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e37b7-201e-00c4-04fb-594fb0000000", + "x-ms-client-request-id" : "87c09468-ca13-4afe-b16f-1dcfdb19fba6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac313370997001a9a/javablobsetmetadataac1blobapitestsetmetadataac3131018009da?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CB441151\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e37d0-201e-00c4-16fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "362ab076-b6cc-45fa-a762-a9a09f6befed" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e37e5-201e-00c4-2afb-594fb0000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac313370997001a9aFri, 23 Aug 2019 21:42:28 GMT\"0x8D72812CB353A8F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "19ee5816-8d59-4730-b11c-edba652a6a34", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac313370997001a9a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e37f8-201e-00c4-39fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "096c17d7-04a7-46a0-b2d9-3d6320162327" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac313370997001a9a", "javablobsetmetadataac1blobapitestsetmetadataac3131018009da" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[4].json new file mode 100644 index 000000000000..8c701d11fb53 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[4].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacf7f90675faef4bc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CB5414B7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e380d-201e-00c4-49fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "2edaff66-4649-4a2d-a9d9-fb4618e735bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacf7f90675faef4bc/javablobsetmetadataac1blobapitestsetmetadataacf7f30687277f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CB59E89C\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e382c-201e-00c4-64fb-594fb0000000", + "x-ms-client-request-id" : "d4375849-4de8-4d1f-a4ea-80d7006435f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacf7f90675faef4bc/javablobsetmetadataac1blobapitestsetmetadataacf7f30687277f?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CB5F411E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e3847-201e-00c4-79fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "832ca67d-f419-4a54-a50d-a9c005a7432f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3864-201e-00c4-12fb-594fb0000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataacf7f90675faef4bcFri, 23 Aug 2019 21:42:28 GMT\"0x8D72812CB5414B7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "78ba75db-dfcd-4f39-bc64-7bfdef6f9316", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacf7f90675faef4bc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e387e-201e-00c4-26fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "08734924-b979-4ff1-878b-e72f0c7a45b2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataacf7f90675faef4bc", "javablobsetmetadataac1blobapitestsetmetadataacf7f30687277f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[5].json new file mode 100644 index 000000000000..f62f0e129719 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[5].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac4ab009163001b34?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CB6E32C5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e38a4-201e-00c4-43fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "bffc1c07-7403-4c3b-9a1d-542785501b56" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac4ab009163001b34/javablobsetmetadataac1blobapitestsetmetadataac4ab58548c8a3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CB73B88E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e38c6-201e-00c4-5ffb-594fb0000000", + "x-ms-client-request-id" : "03105acd-8fce-4ff7-8c9f-88f2049aec45" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac4ab009163001b34/javablobsetmetadataac1blobapitestsetmetadataac4ab58548c8a3?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CB73B88E\"", + "x-ms-lease-id" : "97a2ee77-732a-4d33-ad03-84b6cb8bb615", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e38ec-201e-00c4-79fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "f8007286-bf5a-47e0-87e4-8e905a230545" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac4ab009163001b34/javablobsetmetadataac1blobapitestsetmetadataac4ab58548c8a3?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CB7E1B56\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e3901-201e-00c4-08fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "582844d1-96e3-4d79-9b66-784cbf129084" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e391f-201e-00c4-1dfb-594fb0000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac4ab009163001b34Fri, 23 Aug 2019 21:42:28 GMT\"0x8D72812CB6E32C5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "1914cca1-bdb6-4c05-8223-fc40b8442536", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac4ab009163001b34?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e392e-201e-00c4-29fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "f8c191df-6799-45c3-a168-11bc56463d05" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac4ab009163001b34", "javablobsetmetadataac1blobapitestsetmetadataac4ab58548c8a3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[0].json new file mode 100644 index 000000000000..06af4feccd36 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[0].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaile9a6532540a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CB8E93F2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3953-201e-00c4-47fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "504878a0-0ce5-41a4-9cda-bd0e8e384b18" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaile9a6532540a/javablobsetmetadataacfail1blobapitestsetmetadataacfaile9a00561", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CB9419B8\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e397a-201e-00c4-64fb-594fb0000000", + "x-ms-client-request-id" : "2d8d75d1-372f-49b6-a238-446f399a23ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaile9a6532540a/javablobsetmetadataacfail1blobapitestsetmetadataacfaile9a00561?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e39a3-201e-00c4-04fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e39a3-201e-00c4-04fb-594fb0000000\nTime:2019-08-23T21:42:28.6596431Z", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "46ea354b-6fb1-45aa-869f-a7c0d6d6c20d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e39be-201e-00c4-18fb-594fb0000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfaile9a6532540aFri, 23 Aug 2019 21:42:28 GMT\"0x8D72812CB8E93F2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "ca9a6435-88ce-48b1-8ccf-9e60c68d47f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaile9a6532540a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e39d8-201e-00c4-2dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "8f5a530e-3695-4c24-91cd-79f1db292c66" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfaile9a6532540a", "javablobsetmetadataacfail1blobapitestsetmetadataacfaile9a00561" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[1].json new file mode 100644 index 000000000000..2ebaab754ea2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb97370784dd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CBA8159A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e39f8-201e-00c4-4bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "ddfb1990-3176-43ca-b5eb-6c1a18882ef7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb97370784dd/javablobsetmetadataacfail1blobapitestsetmetadataacfailb9719719", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CBAED436\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3a27-201e-00c4-73fb-594fb0000000", + "x-ms-client-request-id" : "e87447dc-8352-4275-8679-176833f3df05" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb97370784dd/javablobsetmetadataacfail1blobapitestsetmetadataacfailb9719719?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e3a3f-201e-00c4-05fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e3a3f-201e-00c4-05fb-594fb0000000\nTime:2019-08-23T21:42:28.8308066Z", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "f304877c-c8f7-4588-8336-0588726e5a59", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3a56-201e-00c4-19fb-594fb0000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfailb97370784ddFri, 23 Aug 2019 21:42:28 GMT\"0x8D72812CBA8159A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "68ce5905-4e36-4053-90af-e3c6ea1ae89d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb97370784dd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3a71-201e-00c4-2ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "9a5897b3-e60b-4627-890d-9ef612fa39e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfailb97370784dd", "javablobsetmetadataacfail1blobapitestsetmetadataacfailb9719719" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[2].json new file mode 100644 index 000000000000..edbfac67419f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[2].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailfa9337591e3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CBC36C79\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3a91-201e-00c4-4cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:27 GMT", + "x-ms-client-request-id" : "91b81b19-8293-45ad-bdf4-258ce549aed5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailfa9337591e3/javablobsetmetadataacfail1blobapitestsetmetadataacfailfa966108", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CBC8CB37\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3ac3-201e-00c4-76fb-594fb0000000", + "x-ms-client-request-id" : "81b9d339-240a-4b9a-90a8-ae26577c9ee0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailfa9337591e3/javablobsetmetadataacfail1blobapitestsetmetadataacfailfa966108?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e3ad5-201e-00c4-05fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e3ad5-201e-00c4-05fb-594fb0000000\nTime:2019-08-23T21:42:28.9959644Z", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "fb2fc92e-e859-4369-ac69-22a7dcf14525", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3ae9-201e-00c4-15fb-594fb0000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfailfa9337591e3Fri, 23 Aug 2019 21:42:28 GMT\"0x8D72812CBC36C79\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "8790e3de-f4ed-4f66-bbab-f3813f2d04ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailfa9337591e3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3af0-201e-00c4-1cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "cdd12d8c-f7ca-4568-9a2b-530a68eff955" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfailfa9337591e3", "javablobsetmetadataacfail1blobapitestsetmetadataacfailfa966108" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[3].json new file mode 100644 index 000000000000..1c39514c5cb9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[3].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail3a401377f4e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CBDBB550\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3b1a-201e-00c4-3ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "df2862e2-f8d4-4e78-bad8-0b97c48a4308" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail3a401377f4e/javablobsetmetadataacfail1blobapitestsetmetadataacfail3a452056", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CBE11420\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3b48-201e-00c4-66fb-594fb0000000", + "x-ms-client-request-id" : "2c3319e9-92c3-458e-a268-6cee7b2b4d1d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail3a401377f4e/javablobsetmetadataacfail1blobapitestsetmetadataacfail3a452056", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CBE11420\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:29 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e3b7a-201e-00c4-0ffb-594fb0000000", + "x-ms-client-request-id" : "67678a4b-63b7-41ee-87de-75d50ece4da7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail3a401377f4e/javablobsetmetadataacfail1blobapitestsetmetadataacfail3a452056?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e3b95-201e-00c4-26fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e3b95-201e-00c4-26fb-594fb0000000\nTime:2019-08-23T21:42:29.2071651Z", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "85007bf7-b723-4da2-a411-3bfe9bc01212", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3bb0-201e-00c4-3bfb-594fb0000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfail3a401377f4eFri, 23 Aug 2019 21:42:29 GMT\"0x8D72812CBDBB550\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "463a60d3-1713-47fe-9685-a7787a90b61b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail3a401377f4e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3bcd-201e-00c4-51fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "ffe60e90-e377-49b1-a122-a8b2fff538d4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfail3a401377f4e", "javablobsetmetadataacfail1blobapitestsetmetadataacfail3a452056" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[4].json new file mode 100644 index 000000000000..eba5afec34c1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[4].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail4b135001f50?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CBFBEF63\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3be1-201e-00c4-64fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "94263645-5861-4f62-908c-7224958f2826" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail4b135001f50/javablobsetmetadataacfail1blobapitestsetmetadataacfail4b112844", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CC019C70\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3c00-201e-00c4-7efb-594fb0000000", + "x-ms-client-request-id" : "4c36dfc7-094b-4e68-94bd-bdf4929d531d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail4b135001f50/javablobsetmetadataacfail1blobapitestsetmetadataacfail4b112844?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CC019C70\"", + "x-ms-lease-id" : "28fe99b1-4e8a-4792-b857-7e227842cbab", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3c10-201e-00c4-0dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "edbd0643-dfd2-401a-9393-69d321094cd1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail4b135001f50/javablobsetmetadataacfail1blobapitestsetmetadataacfail4b112844?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "d51e3c2f-201e-00c4-29fb-594fb0000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:d51e3c2f-201e-00c4-29fb-594fb0000000\nTime:2019-08-23T21:42:29.4023529Z", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "d65aba89-3da8-47be-ba07-29b4dba98ee7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3c3e-201e-00c4-38fb-594fb0000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfail4b135001f50Fri, 23 Aug 2019 21:42:29 GMT\"0x8D72812CBFBEF63\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "6f818b6a-1379-4b0f-b548-c7867efc5631", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail4b135001f50?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3c51-201e-00c4-46fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "fe869577-6c95-4260-90ac-f6186e4ff24c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfail4b135001f50", "javablobsetmetadataacfail1blobapitestsetmetadataacfail4b112844" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataallnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataallnull.json new file mode 100644 index 000000000000..79a02f6e87ac --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataallnull.json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull52f3526511?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CA513294\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e32b3-201e-00c4-65fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "1fb3962d-4c9a-4300-ae85-0bbfe6bde33f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull52f3526511/javablobsetmetadataallnull1956795ce8e3f57b8b403", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CA56B7F0\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e32d1-201e-00c4-7efb-594fb0000000", + "x-ms-client-request-id" : "dcafcc48-e1c4-4644-b487-a9747b66997b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull52f3526511/javablobsetmetadataallnull1956795ce8e3f57b8b403?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CA5BE952\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e32ed-201e-00c4-17fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "86219d25-a529-47f0-bbab-2821069a4661" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull52f3526511/javablobsetmetadataallnull1956795ce8e3f57b8b403", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CA5BE952\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:26 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e3328-201e-00c4-4afb-594fb0000000", + "x-ms-client-request-id" : "f786560a-3837-4d4d-b607-efc2dd0f176b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataallnull&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e334d-201e-00c4-67fb-594fb0000000", + "Body" : "jtcsetmetadataallnulljtcsetmetadataallnull0blobapitestsetmetadataallnull52f3526511Fri, 23 Aug 2019 21:42:26 GMT\"0x8D72812CA513294\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "42005669-abdf-4ac0-8f91-09390933c319", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull52f3526511?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3369-201e-00c4-7dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "50614d24-85e6-4df2-af66-09655e1b77e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataallnull0blobapitestsetmetadataallnull52f3526511", "javablobsetmetadataallnull1956795ce8e3f57b8b403" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataerror.json new file mode 100644 index 000000000000..50f8271e2d8d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrorc74592698259?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CC1969B4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3c78-201e-00c4-63fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "8c965616-adf7-4ded-9eb3-8f2e01eb3a25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrorc74592698259/javablobsetmetadataerror1blobapitestsetmetadataerrorc7482363c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CC1EC883\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3c8d-201e-00c4-75fb-594fb0000000", + "x-ms-client-request-id" : "8eed38e8-13f1-4b08-873f-7b87038e9bfd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrorc74592698259/javablobsetmetadataerror2blobapitestsetmetadataerrorc74385731?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3ca1-201e-00c4-07fb-594fb0000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:d51e3ca1-201e-00c4-07fb-594fb0000000\nTime:2019-08-23T21:42:29.5635078Z", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "1d49b3b7-ee1e-42f7-8f38-4b5e1219d637", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3cb9-201e-00c4-1efb-594fb0000000", + "Body" : "jtcsetmetadataerrorjtcsetmetadataerror0blobapitestsetmetadataerrorc74592698259Fri, 23 Aug 2019 21:42:29 GMT\"0x8D72812CC1969B4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "d781d417-4dbc-4986-adb1-aed5a0251158", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrorc74592698259?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3cd2-201e-00c4-31fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:28 GMT", + "x-ms-client-request-id" : "5a488cf3-b430-4f01-8dab-bcf2385b3b2a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataerror0blobapitestsetmetadataerrorc74592698259", "javablobsetmetadataerror1blobapitestsetmetadataerrorc7482363c", "javablobsetmetadataerror2blobapitestsetmetadataerrorc74385731" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[0].json new file mode 100644 index 000000000000..4d1084b93529 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[0].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatacb5134150?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CA924317\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e341a-201e-00c4-16fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "83847172-b0d9-457a-99d1-f7d8e89183fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatacb5134150/javablobsetmetadatametadata167890702b963204814b0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CA97C881\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e343d-201e-00c4-33fb-594fb0000000", + "x-ms-client-request-id" : "5cf4168b-cd06-4f25-b9a5-92a047bf8744" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatacb5134150/javablobsetmetadatametadata167890702b963204814b0?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CA9CABB5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e345b-201e-00c4-4cfb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "1f4f0084-8476-4831-ba28-17b8e8e263e8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatacb5134150/javablobsetmetadatametadata167890702b963204814b0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CA9CABB5\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:26 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e3480-201e-00c4-68fb-594fb0000000", + "x-ms-client-request-id" : "c37b33d7-9bed-47ea-97b8-bf5f864e7e6b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadatametadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3492-201e-00c4-76fb-594fb0000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata0blobapitestsetmetadatametadatacb5134150Fri, 23 Aug 2019 21:42:26 GMT\"0x8D72812CA924317\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "107225c4-d27a-496b-92e0-74b512fe26fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatacb5134150?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e34b4-201e-00c4-0ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "54b13328-4def-4fb7-88e1-1f0ebc210097" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata0blobapitestsetmetadatametadatacb5134150", "javablobsetmetadatametadata167890702b963204814b0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[1].json new file mode 100644 index 000000000000..3f51b9b10fe4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[1].json @@ -0,0 +1,140 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadataba0842718?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CABB0ABE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e34e9-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "9ba71fcf-647a-49bc-ac2c-4c695df0f5a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadataba0842718/javablobsetmetadatametadata10656564026f3811554ba", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CAC09033\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e353e-201e-00c4-80fb-594fb0000000", + "x-ms-client-request-id" : "89d01989-8f80-4db8-a82a-28995ba2a8b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadataba0842718/javablobsetmetadatametadata10656564026f3811554ba?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CAC5C1A3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e3553-201e-00c4-13fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "b667f7f6-1c71-4055-8532-cea3fb99e3bc" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadataba0842718/javablobsetmetadatametadata10656564026f3811554ba", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CAC5C1A3\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:27 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e356c-201e-00c4-2afb-594fb0000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "4215c883-c289-42b5-a5e2-7b3e963ce65d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadatametadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e3587-201e-00c4-40fb-594fb0000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata0blobapitestsetmetadatametadataba0842718Fri, 23 Aug 2019 21:42:27 GMT\"0x8D72812CABB0ABE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "951a1d8b-d65b-4e4b-934e-57b88edc7567", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadataba0842718?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e359c-201e-00c4-51fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:26 GMT", + "x-ms-client-request-id" : "9a91ac91-9d02-45e5-bf2f-4ebd3f15bbe4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata0blobapitestsetmetadatametadataba0842718", "javablobsetmetadatametadata10656564026f3811554ba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatamin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatamin.json new file mode 100644 index 000000000000..4e40268fa9b3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatamin.json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadataminede7779503cab7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CA747AA4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e3382-201e-00c4-10fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "f627b62f-d011-4798-8284-60558dadc974" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadataminede7779503cab7/javablobsetmetadatamin1blobapitestsetmetadataminede61004002", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812CA79FFFF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e3397-201e-00c4-23fb-594fb0000000", + "x-ms-client-request-id" : "fb699cf9-eabb-4976-aa0a-3a2146672cac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadataminede7779503cab7/javablobsetmetadatamin1blobapitestsetmetadataminede61004002?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812CA7F0A49\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51e33ac-201e-00c4-36fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "21e77642-19da-419f-b353-f11f8acf0c07" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadataminede7779503cab7/javablobsetmetadatamin1blobapitestsetmetadataminede61004002", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812CA7F0A49\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:26 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e33c1-201e-00c4-47fb-594fb0000000", + "x-ms-client-request-id" : "86c2c45f-d2c4-44a5-9bcd-17c7b5dd135d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadatamin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e33dd-201e-00c4-61fb-594fb0000000", + "Body" : "jtcsetmetadataminjtcsetmetadatamin0blobapitestsetmetadataminede7779503cab7Fri, 23 Aug 2019 21:42:26 GMT\"0x8D72812CA747AA4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "6999bb95-48fe-48c7-9c4d-4f9796d754f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadataminede7779503cab7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e33f4-201e-00c4-75fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:25 GMT", + "x-ms-client-request-id" : "63d6e281-442e-451f-9dc8-998acd4024cb" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatamin0blobapitestsetmetadataminede7779503cab7", "javablobsetmetadatamin1blobapitestsetmetadataminede61004002" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[0].json new file mode 100644 index 000000000000..27986f5602c5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[0].json @@ -0,0 +1,218 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus010291b8d25aa1d494412ea?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F001AFBE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ec26b-201e-00c4-17fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "1eac22cc-e775-4346-8c6b-c1b815dde58b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus010291b8d25aa1d494412ea/javablobsettierarchivestatus1961457bcbe78d6c7b4f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F006A6CE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ec280-201e-00c4-27fb-594fb0000000", + "x-ms-client-request-id" : "821f274c-d4a2-40a2-8216-84eeaf16fca0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus26084232005895fc7c44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F00B4E6E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d071109-f01e-0012-64fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "61477f3b-baba-4ad2-a6a4-c67f0d87f766" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus26084232005895fc7c44/javablobsettierarchivestatus3042079129fcea63194c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F0123756\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d071124-f01e-0012-7cfb-59fb37000000", + "x-ms-client-request-id" : "69fbebb4-7464-4fa1-a1a7-dcedf974d4d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus26084232005895fc7c44/javablobsettierarchivestatus3042079129fcea63194c?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1d071149-f01e-0012-1bfb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "ea2ddd95-37a4-4c87-9a82-6ca477c65f8d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus26084232005895fc7c44/javablobsettierarchivestatus3042079129fcea63194c?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d07115a-f01e-0012-2cfb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "d9feacda-2783-4b97-8b4a-079ee85e3cfa" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus26084232005895fc7c44/javablobsettierarchivestatus3042079129fcea63194c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 23 Aug 2019 21:43:29 GMT", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Archive", + "ETag" : "\"0x8D72812F0123756\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:29 GMT", + "Content-Length" : "7", + "x-ms-archive-status" : "rehydrate-pending-to-cool", + "x-ms-request-id" : "1d07117a-f01e-0012-4cfb-59fb37000000", + "x-ms-client-request-id" : "0092fbe5-3c48-4d3f-892e-28f3f1e41163", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus26084232005895fc7c44?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d071184-f01e-0012-56fb-59fb37000000", + "Body" : "javablobsettierarchivestatus3042079129fcea63194cFri, 23 Aug 2019 21:43:29 GMTFri, 23 Aug 2019 21:43:29 GMT0x8D72812F01237567application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiverehydrate-pending-to-coolFri, 23 Aug 2019 21:43:29 GMTunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "d292b57c-4759-4d3e-86a3-2035d28eed2b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierarchivestatus&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec31c-201e-00c4-2cfb-594fb0000000", + "Body" : "jtcsettierarchivestatusjtcsettierarchivestatus010291b8d25aa1d494412eaFri, 23 Aug 2019 21:43:29 GMT\"0x8D72812F001AFBE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "1aee7fba-f438-40fc-9d77-a7f34df09b4b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus010291b8d25aa1d494412ea?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec332-201e-00c4-40fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "4bcc29cb-0b34-46a3-a42f-22e4eca69926" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierarchivestatus010291b8d25aa1d494412ea", "javablobsettierarchivestatus1961457bcbe78d6c7b4f", "javablobsettierarchivestatus26084232005895fc7c44", "javablobsettierarchivestatus3042079129fcea63194c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[1].json new file mode 100644 index 000000000000..d03e6fa16939 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[1].json @@ -0,0 +1,218 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus0366975c285121095b47188?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F033532A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ec34c-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "91beb647-fb52-43ef-b84c-497e3a32e086" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus0366975c285121095b47188/javablobsettierarchivestatus19986701d675d588724d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F038BF97\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ec378-201e-00c4-77fb-594fb0000000", + "x-ms-client-request-id" : "744f219f-c1c6-455e-9d76-e406938829c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus25883906bb6edf2ab249?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F03D8E56\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d0711ea-f01e-0012-31fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "8de55f09-5016-4b36-b820-295793470ab6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus25883906bb6edf2ab249/javablobsettierarchivestatus391706fd5802210aa74b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F042C91C\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d071202-f01e-0012-48fb-59fb37000000", + "x-ms-client-request-id" : "3f5a665e-a1f1-4031-924d-3b06e9d67b58" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus25883906bb6edf2ab249/javablobsettierarchivestatus391706fd5802210aa74b?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1d07121d-f01e-0012-63fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "8b577b22-7cc3-4825-819d-a3bce1814e49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus25883906bb6edf2ab249/javablobsettierarchivestatus391706fd5802210aa74b?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d071235-f01e-0012-7afb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "da0a4365-da43-4f4b-94a8-2cb8305a11ab" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus25883906bb6edf2ab249/javablobsettierarchivestatus391706fd5802210aa74b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 23 Aug 2019 21:43:30 GMT", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Archive", + "ETag" : "\"0x8D72812F042C91C\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:30 GMT", + "Content-Length" : "7", + "x-ms-archive-status" : "rehydrate-pending-to-hot", + "x-ms-request-id" : "1d071245-f01e-0012-09fb-59fb37000000", + "x-ms-client-request-id" : "4fbddd39-bd06-4afe-a497-e4045f179a0c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierarchivestatus25883906bb6edf2ab249?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d071251-f01e-0012-14fb-59fb37000000", + "Body" : "javablobsettierarchivestatus391706fd5802210aa74bFri, 23 Aug 2019 21:43:30 GMTFri, 23 Aug 2019 21:43:30 GMT0x8D72812F042C91C7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiverehydrate-pending-to-hotFri, 23 Aug 2019 21:43:30 GMTunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "94b0040f-5eea-462b-b7ea-3f3cd95a985f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierarchivestatus&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec424-201e-00c4-06fb-594fb0000000", + "Body" : "jtcsettierarchivestatusjtcsettierarchivestatus0366975c285121095b47188Fri, 23 Aug 2019 21:43:30 GMT\"0x8D72812F033532A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "6bbc71b8-472b-4a1c-b265-36f52f8e1976", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierarchivestatus0366975c285121095b47188?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec436-201e-00c4-18fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "05af874a-a47c-4220-a821-d2fd05486ffa" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierarchivestatus0366975c285121095b47188", "javablobsettierarchivestatus19986701d675d588724d", "javablobsettierarchivestatus25883906bb6edf2ab249", "javablobsettierarchivestatus391706fd5802210aa74b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[0].json new file mode 100644 index 000000000000..0ab6e14c16b4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[0].json @@ -0,0 +1,217 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob80a70970397c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ED8C6C62\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb806-201e-00c4-2afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "c437af59-6d2c-4752-b1ec-6fbb2c5490e3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob80a70970397c/javablobsettierblockblob1blobapitestsettierblockblob80a806219", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812ED91FF2B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb81a-201e-00c4-3afb-594fb0000000", + "x-ms-client-request-id" : "d5a5c874-92d0-445e-a8fb-755868f26f3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob80a123613faa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812ED96A6C7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d0707b1-f01e-0012-1dfb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "0ea778d4-e194-4488-bd70-8770a107a22e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob80a123613faa/javablobsettierblockblob3blobapitestsettierblockblob80a739119", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EDA4BD93\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d0707d7-f01e-0012-40fb-59fb37000000", + "x-ms-client-request-id" : "c8be2a31-a8c9-4b03-98c7-6f80b877a29b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob80a123613faa/javablobsettierblockblob3blobapitestsettierblockblob80a739119?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1d0707f2-f01e-0012-58fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "47a03fec-8c16-423a-ac9f-47ac3780caf1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob80a123613faa/javablobsettierblockblob3blobapitestsettierblockblob80a739119", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 23 Aug 2019 21:43:25 GMT", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812EDA4BD93\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:25 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "1d070802-f01e-0012-67fb-59fb37000000", + "x-ms-client-request-id" : "941865b2-2219-4cd6-891d-156c9a746c76", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob80a123613faa?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d070812-f01e-0012-77fb-59fb37000000", + "Body" : "javablobsettierblockblob3blobapitestsettierblockblob80a739119Fri, 23 Aug 2019 21:43:25 GMTFri, 23 Aug 2019 21:43:25 GMT0x8D72812EDA4BD937application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHotFri, 23 Aug 2019 21:43:25 GMTunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "1d15596d-09d7-4019-a24e-44a12a811efd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob80a123613faa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d07081d-f01e-0012-02fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "60a4055d-3921-41da-b4f1-9ea3976d8f1f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierblockblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb8b5-201e-00c4-24fb-594fb0000000", + "Body" : "jtcsettierblockblobjtcsettierblockblob0blobapitestsettierblockblob80a70970397cFri, 23 Aug 2019 21:43:25 GMT\"0x8D72812ED8C6C62\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "9921f904-e40e-459b-8e9a-7f76b86b47e4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob80a70970397c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb8c4-201e-00c4-30fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "53f51dc8-c56f-46fc-958b-d3ac8c1e8aa2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierblockblob0blobapitestsettierblockblob80a70970397c", "javablobsettierblockblob1blobapitestsettierblockblob80a806219", "jtcsettierblockblob2blobapitestsettierblockblob80a123613faa", "javablobsettierblockblob3blobapitestsettierblockblob80a739119" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[1].json new file mode 100644 index 000000000000..8c2bb6f47b99 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[1].json @@ -0,0 +1,217 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobba674986367e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EDC64F32\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb8da-201e-00c4-43fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:25 GMT", + "x-ms-client-request-id" : "54752729-45aa-4ac9-9dfc-a414e79535b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobba674986367e/javablobsettierblockblob1blobapitestsettierblockblobba6842619", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EDCCCCAE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb8e7-201e-00c4-4efb-594fb0000000", + "x-ms-client-request-id" : "d8262233-5de3-466b-b2b6-7032256c75aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobba6706853ba7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EDD17444\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d07085f-f01e-0012-3afb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "73ae3f4e-6197-4645-8ca2-13dc09521fc9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobba6706853ba7/javablobsettierblockblob3blobapitestsettierblockblobba629639f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EDD6D65D\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d070877-f01e-0012-50fb-59fb37000000", + "x-ms-client-request-id" : "79509c95-5d43-4c9e-a657-7e4418db817b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobba6706853ba7/javablobsettierblockblob3blobapitestsettierblockblobba629639f?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1d070886-f01e-0012-5dfb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "16bbd555-b60d-4cfd-91ba-03bedafa7da7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobba6706853ba7/javablobsettierblockblob3blobapitestsettierblockblobba629639f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 23 Aug 2019 21:43:26 GMT", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Cool", + "ETag" : "\"0x8D72812EDD6D65D\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:26 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "1d07089d-f01e-0012-6ffb-59fb37000000", + "x-ms-client-request-id" : "9630ae1c-948a-4a8d-af29-c472a43cf1cc", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobba6706853ba7?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d0708aa-f01e-0012-78fb-59fb37000000", + "Body" : "javablobsettierblockblob3blobapitestsettierblockblobba629639fFri, 23 Aug 2019 21:43:26 GMTFri, 23 Aug 2019 21:43:26 GMT0x8D72812EDD6D65D7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobCoolFri, 23 Aug 2019 21:43:26 GMTunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "a2c2257a-e0a9-42dc-b1ee-36fc5b7634ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobba6706853ba7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d0708b6-f01e-0012-02fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "3e4957ee-78fe-464e-9567-ab1c8bb248ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierblockblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb961-201e-00c4-20fb-594fb0000000", + "Body" : "jtcsettierblockblobjtcsettierblockblob0blobapitestsettierblockblobba674986367eFri, 23 Aug 2019 21:43:25 GMT\"0x8D72812EDC64F32\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "8fbcf9d2-3db2-479a-989e-54891fb31e19", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobba674986367e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb970-201e-00c4-2cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "c05f93c8-a041-431e-9a39-054192939604" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierblockblob0blobapitestsettierblockblobba674986367e", "javablobsettierblockblob1blobapitestsettierblockblobba6842619", "jtcsettierblockblob2blobapitestsettierblockblobba6706853ba7", "javablobsettierblockblob3blobapitestsettierblockblobba629639f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[2].json new file mode 100644 index 000000000000..46a08652d41a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[2].json @@ -0,0 +1,217 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob83e01420edd1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EDF88F00\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb98b-201e-00c4-40fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "bda6006a-3a77-42bf-87da-8e16822885bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob83e01420edd1/javablobsettierblockblob1blobapitestsettierblockblob83e792714", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EDFDFADD\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb99a-201e-00c4-49fb-594fb0000000", + "x-ms-client-request-id" : "f96202a3-1667-4ca2-82eb-62347dc1b461" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob83e352583625?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EE02A279\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d070906-f01e-0012-46fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "58492ec9-08c2-4995-a976-9176ac020047" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob83e352583625/javablobsettierblockblob3blobapitestsettierblockblob83e830835", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EE078F3C\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d070911-f01e-0012-4ffb-59fb37000000", + "x-ms-client-request-id" : "ca01776d-4e73-4585-8923-c12c0a9877b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob83e352583625/javablobsettierblockblob3blobapitestsettierblockblob83e830835?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1d07091f-f01e-0012-5bfb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "d50c5a9a-31d8-441a-ae63-2da492112f57" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob83e352583625/javablobsettierblockblob3blobapitestsettierblockblob83e830835", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 23 Aug 2019 21:43:26 GMT", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Archive", + "ETag" : "\"0x8D72812EE078F3C\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:26 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "1d07092f-f01e-0012-69fb-59fb37000000", + "x-ms-client-request-id" : "a556cd30-80f0-4fc4-a656-e943051c2193", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob83e352583625?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d070937-f01e-0012-71fb-59fb37000000", + "Body" : "javablobsettierblockblob3blobapitestsettierblockblob83e830835Fri, 23 Aug 2019 21:43:26 GMTFri, 23 Aug 2019 21:43:26 GMT0x8D72812EE078F3C7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiveFri, 23 Aug 2019 21:43:26 GMTunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "82ef122e-37e1-4609-a9f7-5a709287c0ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob83e352583625?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d070941-f01e-0012-7afb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "36a7c9e7-918a-4dd2-a46e-66e6b4d1c3c9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierblockblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eba05-201e-00c4-16fb-594fb0000000", + "Body" : "jtcsettierblockblobjtcsettierblockblob0blobapitestsettierblockblob83e01420edd1Fri, 23 Aug 2019 21:43:26 GMT\"0x8D72812EDF88F00\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "b3b68205-1845-4f82-9b6d-1d611623ad8f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob83e01420edd1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eba15-201e-00c4-21fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "99b0e05f-4ab7-4159-8772-98c372353ba5" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierblockblob0blobapitestsettierblockblob83e01420edd1", "javablobsettierblockblob1blobapitestsettierblockblob83e792714", "jtcsettierblockblob2blobapitestsettierblockblob83e352583625", "javablobsettierblockblob3blobapitestsettierblockblob83e830835" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiererror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiererror.json new file mode 100644 index 000000000000..27c131c7671d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiererror.json @@ -0,0 +1,169 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiererror0blobapitestsettiererror8f220374134882c5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F061C185\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ec45b-201e-00c4-38fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "928291d4-06b1-4417-9545-f1f42e4682c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiererror0blobapitestsettiererror8f220374134882c5/javablobsettiererror1blobapitestsettiererror8f255434762d6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F066DFCF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ec477-201e-00c4-50fb-594fb0000000", + "x-ms-client-request-id" : "00b0c93f-0824-45a4-bc98-dc637967c798" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror8f2379413a667f01?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F06BAE8F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d07129e-f01e-0012-58fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "e017782d-e905-43ca-aedc-886d395b18a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror8f2379413a667f01/javablobsettiererror3blobapitestsettiererror8f2138953ba14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F077C8CC\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d0712ac-f01e-0012-64fb-59fb37000000", + "x-ms-client-request-id" : "8eac773b-a72a-4e92-b146-8cea06e4ab9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror8f2379413a667f01/javablobsettiererror3blobapitestsettiererror8f2138953ba14?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "329", + "StatusCode" : "400", + "x-ms-request-id" : "1d0712d0-f01e-0012-7efb-59fb37000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:1d0712d0-f01e-0012-7efb-59fb37000000\nTime:2019-08-23T21:43:30.5406808Zx-ms-access-tiergarbage", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "1b1281f6-65f1-4fe4-9290-503b26bfc440", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror8f2379413a667f01?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d0712dd-f01e-0012-0bfb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "41c1f036-9278-4a4c-98b0-2ba00d5c472a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettiererror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec50f-201e-00c4-5bfb-594fb0000000", + "Body" : "jtcsettiererrorjtcsettiererror0blobapitestsettiererror8f220374134882c5Fri, 23 Aug 2019 21:43:30 GMT\"0x8D72812F061C185\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "a769d5b4-3cc5-445a-b47b-be69e83bdf70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiererror0blobapitestsettiererror8f220374134882c5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec51c-201e-00c4-67fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "04a74590-bc62-4ac3-961b-9a72a2713441" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettiererror0blobapitestsettiererror8f220374134882c5", "javablobsettiererror1blobapitestsettiererror8f255434762d6", "jtcsettiererror2blobapitestsettiererror8f2379413a667f01", "javablobsettiererror3blobapitestsettiererror8f2138953ba14" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierillegalargument.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierillegalargument.json new file mode 100644 index 000000000000..e578670686ad --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierillegalargument.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierillegalargument042057180e6565ecd84e54?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F08F1E26\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ec535-201e-00c4-7efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "1fc21f92-78b6-4364-a5ae-c4aceaf93fe3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierillegalargument042057180e6565ecd84e54/javablobsettierillegalargument103737acd5e9b7520f4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F0943C81\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ec544-201e-00c4-0cfb-594fb0000000", + "x-ms-client-request-id" : "6ed22391-7b5f-4887-9524-26806a54dd93" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierillegalargument&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec554-201e-00c4-1bfb-594fb0000000", + "Body" : "jtcsettierillegalargumentjtcsettierillegalargument042057180e6565ecd84e54Fri, 23 Aug 2019 21:43:30 GMT\"0x8D72812F08F1E26\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "ea573e81-4830-469f-aed5-23a5c824ef57", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierillegalargument042057180e6565ecd84e54?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec566-201e-00c4-2bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "28941d62-443b-4e8a-97bf-785aff5e69e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierillegalargument042057180e6565ecd84e54", "javablobsettierillegalargument103737acd5e9b7520f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierinferred.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierinferred.json new file mode 100644 index 000000000000..1844df4dfc86 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierinferred.json @@ -0,0 +1,250 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierinferred0blobapitestsettierinferred0df11266b5e1d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EFC61ED2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ec171-201e-00c4-42fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "5916e4d6-7631-41e5-a1dd-3241bd022277" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierinferred0blobapitestsettierinferred0df11266b5e1d/javablobsettierinferred1blobapitestsettierinferred0df02552d6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EFCB6400\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ec191-201e-00c4-5bfb-594fb0000000", + "x-ms-client-request-id" : "44e9afb4-200c-420d-9c8d-f54fb3107296" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred0df857671a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EFD032B9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d071041-f01e-0012-2afb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "a2455a59-a758-4aac-a3f6-d96cd3229958" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred0df857671a/javablobsettierinferred3blobapitestsettierinferred0df05508ea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EFDF0CD9\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d071056-f01e-0012-39fb-59fb37000000", + "x-ms-client-request-id" : "1be308a3-e442-4b62-adc2-77a45c58c2d0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred0df857671a/javablobsettierinferred3blobapitestsettierinferred0df05508ea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812EFDF0CD9\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:29 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "1d071081-f01e-0012-63fb-59fb37000000", + "x-ms-client-request-id" : "fa71f373-af33-44f8-a183-3f89532c4771", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred0df857671a?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d071090-f01e-0012-72fb-59fb37000000", + "Body" : "javablobsettierinferred3blobapitestsettierinferred0df05508eaFri, 23 Aug 2019 21:43:29 GMTFri, 23 Aug 2019 21:43:29 GMT0x8D72812EFDF0CD97application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "896423d0-9c6b-4ffe-bcbe-b9ee2e231d88", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred0df857671a/javablobsettierinferred3blobapitestsettierinferred0df05508ea?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1d07109d-f01e-0012-7ffb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "28c49131-eba4-4cf0-bc10-3d77a95c3fae" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred0df857671a/javablobsettierinferred3blobapitestsettierinferred0df05508ea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Fri, 23 Aug 2019 21:43:29 GMT", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812EFDF0CD9\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:29 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "1d0710af-f01e-0012-10fb-59fb37000000", + "x-ms-client-request-id" : "5346ba18-df1b-49f9-acae-544d8490bbdf", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferred0df857671a?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d0710b7-f01e-0012-18fb-59fb37000000", + "Body" : "javablobsettierinferred3blobapitestsettierinferred0df05508eaFri, 23 Aug 2019 21:43:29 GMTFri, 23 Aug 2019 21:43:29 GMT0x8D72812EFDF0CD97application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHotFri, 23 Aug 2019 21:43:29 GMTunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "7f1f2f16-59df-4102-908a-04dc5baea2d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierinferred&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec245-201e-00c4-73fb-594fb0000000", + "Body" : "jtcsettierinferredjtcsettierinferred0blobapitestsettierinferred0df11266b5e1dFri, 23 Aug 2019 21:43:29 GMT\"0x8D72812EFC61ED2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "d55f4740-882b-4a48-8017-a4f3d0d8d4a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierinferred0blobapitestsettierinferred0df11266b5e1d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec256-201e-00c4-02fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "4f4c2537-434f-4e28-a7f8-cddab16df7c2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierinferred0blobapitestsettierinferred0df11266b5e1d", "javablobsettierinferred1blobapitestsettierinferred0df02552d6", "javablobsettierinferred2blobapitestsettierinferred0df857671a", "javablobsettierinferred3blobapitestsettierinferred0df05508ea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierlease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierlease.json new file mode 100644 index 000000000000..b7630719d441 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierlease.json @@ -0,0 +1,187 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierlease0blobapitestsettierlease27e036003d4f2bf7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F0B350CA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ec5be-201e-00c4-76fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "d0c7fcce-a89b-49b1-b48d-0e19ecb4b35d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierlease0blobapitestsettierlease27e036003d4f2bf7/javablobsettierlease1blobapitestsettierlease27e82407d75aa", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F0B8964E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ec5cc-201e-00c4-03fb-594fb0000000", + "x-ms-client-request-id" : "31ae4122-c925-48f6-8c96-b3adf72249cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease27e6348167ff5a65?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F0C10F73\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d0713e6-f01e-0012-7bfb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:30 GMT", + "x-ms-client-request-id" : "76367c71-778f-4e93-a7df-3cbed816ade6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease27e6348167ff5a65/javablobsettierlease3blobapitestsettierlease27e13766f0bb5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F0C64A2A\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d071403-f01e-0012-10fb-59fb37000000", + "x-ms-client-request-id" : "1dc8d408-7fdb-4b9b-af1f-30f550e8e484" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease27e6348167ff5a65/javablobsettierlease3blobapitestsettierlease27e13766f0bb5?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F0C64A2A\"", + "x-ms-lease-id" : "49aee0fe-7ded-4576-9b11-0d65f2c0bb5f", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d07140b-f01e-0012-18fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "8cf8dfe8-3e38-429f-9997-e33f541d35c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease27e6348167ff5a65/javablobsettierlease3blobapitestsettierlease27e13766f0bb5?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1d07142c-f01e-0012-37fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "84b1a704-6aa6-43d4-86ce-1bd01c2bf8d3" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease27e6348167ff5a65?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d07143e-f01e-0012-45fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "5fee6c43-9a7a-4d55-9310-915d23115f46" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierlease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec64e-201e-00c4-73fb-594fb0000000", + "Body" : "jtcsettierleasejtcsettierlease0blobapitestsettierlease27e036003d4f2bf7Fri, 23 Aug 2019 21:43:30 GMT\"0x8D72812F0B350CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "2c836cff-461b-4ccb-9e06-2032643e9537", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierlease0blobapitestsettierlease27e036003d4f2bf7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec65b-201e-00c4-7efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "98944c8f-d88d-49ec-bbe2-fbe8700aa9be" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierlease0blobapitestsettierlease27e036003d4f2bf7", "javablobsettierlease1blobapitestsettierlease27e82407d75aa", "jtcsettierlease2blobapitestsettierlease27e6348167ff5a65", "javablobsettierlease3blobapitestsettierlease27e13766f0bb5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierleasefail.json new file mode 100644 index 000000000000..86fa9bcd3069 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierleasefail.json @@ -0,0 +1,151 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierleasefail0blobapitestsettierleasefailb3e20659b097?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F0E1E637\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ec66f-201e-00c4-10fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "9557761c-b07b-4841-806e-40c0b09eab77" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierleasefail0blobapitestsettierleasefailb3e20659b097/javablobsettierleasefail1blobapitestsettierleasefailb3e557649", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F0E752FC\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ec67b-201e-00c4-1afb-594fb0000000", + "x-ms-client-request-id" : "17359787-61a5-43e3-99d6-146abc4207be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierleasefail2blobapitestsettierleasefailb3e43148f224?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F0EBFA8A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d071475-f01e-0012-78fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "d4e4dcab-e569-4b41-bdf6-ecc5cc0ef97b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierleasefail2blobapitestsettierleasefailb3e43148f224/javablobsettierleasefail3blobapitestsettierleasefailb3e057790", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F0F13546\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d07147f-f01e-0012-80fb-59fb37000000", + "x-ms-client-request-id" : "7dabe70d-a8e0-44ca-b5d5-aa977d86f5f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettierleasefail2blobapitestsettierleasefailb3e43148f224/javablobsettierleasefail3blobapitestsettierleasefailb3e057790?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "1d071484-f01e-0012-05fb-59fb37000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:1d071484-f01e-0012-05fb-59fb37000000\nTime:2019-08-23T21:43:31.3344420Zx-ms-lease-idgarbage", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "03eca2eb-d14b-4fc7-9e51-ee62c1a873ff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierleasefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec6c9-201e-00c4-5dfb-594fb0000000", + "Body" : "jtcsettierleasefailjtcsettierleasefail0blobapitestsettierleasefailb3e20659b097Fri, 23 Aug 2019 21:43:31 GMT\"0x8D72812F0E1E637\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "6c7bd549-7c20-42d6-bb8c-c5a43e4fc6bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierleasefail0blobapitestsettierleasefailb3e20659b097?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec6dd-201e-00c4-6dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "1ea54ac0-3f73-42d5-a67e-5e5d3cca4c32" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierleasefail0blobapitestsettierleasefailb3e20659b097", "javablobsettierleasefail1blobapitestsettierleasefailb3e557649", "jtcsettierleasefail2blobapitestsettierleasefailb3e43148f224", "javablobsettierleasefail3blobapitestsettierleasefailb3e057790" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiermin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiermin.json new file mode 100644 index 000000000000..f670eeaaf40c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiermin.json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiermin0blobapitestsettiermindfc82199bf26c02544?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF9230E0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ec069-201e-00c4-62fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "5ef01554-25f4-467a-83b1-8c658cbfa6c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiermin0blobapitestsettiermindfc82199bf26c02544/javablobsettiermin1blobapitestsettiermindfc16255fdbce1e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EF97EB4A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ec080-201e-00c4-76fb-594fb0000000", + "x-ms-client-request-id" : "7fadfaec-8390-4476-8746-d3d9e0106012" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiermin2blobapitestsettiermindfc431323674eaad2f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF9CBA0D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1d070f46-f01e-0012-46fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "3507607e-44e7-432c-8407-7905327f92cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiermin2blobapitestsettiermindfc431323674eaad2f/javablobsettiermin3blobapitestsettiermindfc73636679b7da", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EFADB78B\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d070f61-f01e-0012-5efb-59fb37000000", + "x-ms-client-request-id" : "cbf3cf27-46ce-4b6b-8f34-7958ad5fec54" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiermin0blobapitestsettiermindfc82199bf26c02544/javablobsettiermin1blobapitestsettiermindfc16255fdbce1e?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ec126-201e-00c4-04fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "7581fab1-ff4f-4326-8d99-afebe65f0068" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkblobaccount.blob.core.windows.net/jtcsettiermin2blobapitestsettiermindfc431323674eaad2f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "1d070fc0-f01e-0012-38fb-59fb37000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "0ef090bb-1a8f-49ca-adea-d275698f5399" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettiermin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec149-201e-00c4-21fb-594fb0000000", + "Body" : "jtcsettierminjtcsettiermin0blobapitestsettiermindfc82199bf26c02544Fri, 23 Aug 2019 21:43:29 GMT\"0x8D72812EF9230E0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "3c0f29c0-ab93-4970-96ad-81a4952f25d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettiermin0blobapitestsettiermindfc82199bf26c02544?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec155-201e-00c4-2bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:29 GMT", + "x-ms-client-request-id" : "2f73022a-62ee-4adf-b05a-8b82026963e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettiermin0blobapitestsettiermindfc82199bf26c02544", "javablobsettiermin1blobapitestsettiermindfc16255fdbce1e", "jtcsettiermin2blobapitestsettiermindfc431323674eaad2f", "javablobsettiermin3blobapitestsettiermindfc73636679b7da" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[0].json new file mode 100644 index 000000000000..8a21a5581203 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[0].json @@ -0,0 +1,212 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobad692669c1200?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EE26AF28\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eba30-201e-00c4-37fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "872c426b-2421-48a3-a696-8fb7af7d3ce5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobad692669c1200/javablobsettierpageblob1blobapitestsettierpageblobad65218520", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EE2D2CC7\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eba4c-201e-00c4-48fb-594fb0000000", + "x-ms-client-request-id" : "3a2be56b-98b3-4934-8484-f5b88a2299e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobad615577c553e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EE542918\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ef1aa1b3-501c-00c0-7ffb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "49f4b59a-af19-4935-9671-5f4762b998a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobad615577c553e/javablobsettierpageblob3blobapitestsettierpageblobad6661133c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EE59CB94\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "ef1aa1d5-501c-00c0-21fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "66466f22-afbf-44e0-b0ef-29e7b5a3ac76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobad615577c553e/javablobsettierpageblob3blobapitestsettierpageblobad6661133c?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ef1aa1eb-501c-00c0-37fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "62167e68-d4d4-43ac-bd4a-5763e817dc03" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobad615577c553e/javablobsettierpageblob3blobapitestsettierpageblobad6661133c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P4", + "ETag" : "\"0x8D72812EE59CB94\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:26 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ef1aa207-501c-00c0-53fb-59b1a4000000", + "x-ms-client-request-id" : "f7dd24cc-fa9a-422c-a2ac-71ba6e6fb9cd", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobad615577c553e?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa21c-501c-00c0-68fb-59b1a4000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobad6661133cFri, 23 Aug 2019 21:43:26 GMTFri, 23 Aug 2019 21:43:26 GMT0x8D72812EE59CB94512application/octet-stream0PageBlobP4unlockedavailabletrue", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "f4f21e30-b901-48a6-8354-990fd48f465b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobad615577c553e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa23b-501c-00c0-07fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "8f3efedc-0932-4db8-88da-64cbefbf5b93" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierpageblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebb7c-201e-00c4-37fb-594fb0000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobad692669c1200Fri, 23 Aug 2019 21:43:26 GMT\"0x8D72812EE26AF28\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "b516b86d-b07d-4ada-970d-eee47394195a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobad692669c1200?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebb8f-201e-00c4-47fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "6f562141-b21b-4a39-ad02-03fcb0e7fc87" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobad692669c1200", "javablobsettierpageblob1blobapitestsettierpageblobad65218520", "jtcsettierpageblob2blobapitestsettierpageblobad615577c553e", "javablobsettierpageblob3blobapitestsettierpageblobad6661133c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[1].json new file mode 100644 index 000000000000..6b0c6ed89a75 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[1].json @@ -0,0 +1,212 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobd5a475745cff1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EE7AFE39\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ebbbe-201e-00c4-67fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "dacfaaf3-fea8-4baa-8168-59208f8d7196" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobd5a475745cff1/javablobsettierpageblob1blobapitestsettierpageblobd5a9418164", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EE80B87E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ebbd1-201e-00c4-76fb-594fb0000000", + "x-ms-client-request-id" : "86e93889-359d-40ab-a210-3277c74ed3cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd5a796119c97a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EE85064D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ef1aa2d7-501c-00c0-23fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "113b5420-4c3f-4187-ab60-7fa1f575deda" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd5a796119c97a/javablobsettierpageblob3blobapitestsettierpageblobd5a7730906", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EE899707\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "ef1aa2f5-501c-00c0-41fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "0fd80ecf-09a3-4224-9bc3-8a4cbd378fa7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd5a796119c97a/javablobsettierpageblob3blobapitestsettierpageblobd5a7730906?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ef1aa31c-501c-00c0-68fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "0a244e86-7dec-4b76-9bd4-599cc47a55f5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd5a796119c97a/javablobsettierpageblob3blobapitestsettierpageblobd5a7730906", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P6", + "ETag" : "\"0x8D72812EE899707\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:27 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ef1aa33a-501c-00c0-06fb-59b1a4000000", + "x-ms-client-request-id" : "aa5b2c07-284c-4ad2-ba8c-3c36beae9eaf", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd5a796119c97a?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa350-501c-00c0-1cfb-59b1a4000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobd5a7730906Fri, 23 Aug 2019 21:43:27 GMTFri, 23 Aug 2019 21:43:27 GMT0x8D72812EE899707512application/octet-stream0PageBlobP6unlockedavailabletrue", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "0df7cbb5-e6ba-47a1-a2ad-b4a40ffc03a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobd5a796119c97a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa370-501c-00c0-3cfb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:26 GMT", + "x-ms-client-request-id" : "62d58054-5fbf-4b96-a3b8-5e7a3f0ec63b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierpageblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebc4d-201e-00c4-64fb-594fb0000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobd5a475745cff1Fri, 23 Aug 2019 21:43:27 GMT\"0x8D72812EE7AFE39\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "506b20ca-c83c-4ae4-90dd-e215c7be875c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobd5a475745cff1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebc6d-201e-00c4-03fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "58787ac5-693a-4083-b37c-292fc626726a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobd5a475745cff1", "javablobsettierpageblob1blobapitestsettierpageblobd5a9418164", "jtcsettierpageblob2blobapitestsettierpageblobd5a796119c97a", "javablobsettierpageblob3blobapitestsettierpageblobd5a7730906" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[2].json new file mode 100644 index 000000000000..62badfcfc271 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[2].json @@ -0,0 +1,212 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf1e98735d534d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EEAA5740\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ebc8d-201e-00c4-1efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "fb7073a0-80bc-47fb-adfb-d57cfa5b23c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf1e98735d534d/javablobsettierpageblob1blobapitestsettierpageblobf1e1230275", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EEAF750F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ebca8-201e-00c4-35fb-594fb0000000", + "x-ms-client-request-id" : "28265af6-e2b7-4c4d-89c1-d0e41202b62e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf1e214270de61?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EEB3C031\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ef1aa3d9-501c-00c0-25fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "54d0ee80-c44b-4323-b0ff-6c2b6f0fc77d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf1e214270de61/javablobsettierpageblob3blobapitestsettierpageblobf1e05117db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EEB829BA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "ef1aa3f1-501c-00c0-3dfb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "be381de9-2a22-4d9c-8fe7-51affbfe9879" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf1e214270de61/javablobsettierpageblob3blobapitestsettierpageblobf1e05117db?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ef1aa402-501c-00c0-4efb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "6e21454d-4ede-4abe-9838-8d13baea3390" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf1e214270de61/javablobsettierpageblob3blobapitestsettierpageblobf1e05117db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P10", + "ETag" : "\"0x8D72812EEB829BA\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:27 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ef1aa411-501c-00c0-5dfb-59b1a4000000", + "x-ms-client-request-id" : "e2f06679-4869-4345-a011-5a5fe2dc0ea9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf1e214270de61?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa419-501c-00c0-65fb-59b1a4000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobf1e05117dbFri, 23 Aug 2019 21:43:27 GMTFri, 23 Aug 2019 21:43:27 GMT0x8D72812EEB829BA512application/octet-stream0PageBlobP10unlockedavailabletrue", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "71555fce-9e3a-4ed2-be94-12cccc497a09", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf1e214270de61?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa423-501c-00c0-6ffb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "637d3026-e9a1-4193-9442-9f17b2cc5017" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierpageblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebd1c-201e-00c4-18fb-594fb0000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobf1e98735d534dFri, 23 Aug 2019 21:43:27 GMT\"0x8D72812EEAA5740\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "e37f4d6b-0ac1-4f4b-a87d-6ab04e489f74", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf1e98735d534d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebd2e-201e-00c4-25fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "bd1df6ba-04aa-4474-a992-0719eaf99247" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobf1e98735d534d", "javablobsettierpageblob1blobapitestsettierpageblobf1e1230275", "jtcsettierpageblob2blobapitestsettierpageblobf1e214270de61", "javablobsettierpageblob3blobapitestsettierpageblobf1e05117db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[3].json new file mode 100644 index 000000000000..e28b02636a3e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[3].json @@ -0,0 +1,212 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob64e67452fe4e7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EED78CD3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ebd53-201e-00c4-42fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "4af461c7-c760-4178-b36a-6a062f10baf4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob64e67452fe4e7/javablobsettierpageblob1blobapitestsettierpageblob64e9143211", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EEDCF8E1\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ebd6c-201e-00c4-58fb-594fb0000000", + "x-ms-client-request-id" : "df8e2da5-c6d3-41e3-8e83-bc590be6857c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob64e61729e4c5a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EEE16864\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ef1aa46e-501c-00c0-3afb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "c3fec4cb-067c-4ac5-8e11-b28deb6c2787" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob64e61729e4c5a/javablobsettierpageblob3blobapitestsettierpageblob64e2652962", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EEE5F904\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "ef1aa48d-501c-00c0-59fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "749473be-6e71-4417-9a0e-28c1fa61579c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob64e61729e4c5a/javablobsettierpageblob3blobapitestsettierpageblob64e2652962?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ef1aa4a6-501c-00c0-72fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "ad629528-b459-4b0c-b680-bd87785a6dfe" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob64e61729e4c5a/javablobsettierpageblob3blobapitestsettierpageblob64e2652962", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P20", + "ETag" : "\"0x8D72812EEE5F904\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:27 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ef1aa4c1-501c-00c0-0dfb-59b1a4000000", + "x-ms-client-request-id" : "1c2c1a2c-f4a8-445b-8d82-d4699167e505", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob64e61729e4c5a?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa4cc-501c-00c0-18fb-59b1a4000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblob64e2652962Fri, 23 Aug 2019 21:43:27 GMTFri, 23 Aug 2019 21:43:27 GMT0x8D72812EEE5F904512application/octet-stream0PageBlobP20unlockedavailabletrue", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "caf0e5ab-0d5f-42f6-8cb2-1c32d0c0bd52", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob64e61729e4c5a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa4dd-501c-00c0-29fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "3aa7a7da-a889-40a7-803f-63cf57e26939" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierpageblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebde5-201e-00c4-43fb-594fb0000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblob64e67452fe4e7Fri, 23 Aug 2019 21:43:27 GMT\"0x8D72812EED78CD3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "60c5e970-3a65-40fc-92cd-30f0d8f81131", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob64e67452fe4e7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebdfb-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "71ad7a34-0e82-4c42-b6ca-6d2666fc65d5" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblob64e67452fe4e7", "javablobsettierpageblob1blobapitestsettierpageblob64e9143211", "jtcsettierpageblob2blobapitestsettierpageblob64e61729e4c5a", "javablobsettierpageblob3blobapitestsettierpageblob64e2652962" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[4].json new file mode 100644 index 000000000000..f7dd546b4903 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[4].json @@ -0,0 +1,212 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpagebloba4a7968727d7f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF0697A2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ebe1d-201e-00c4-71fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "c8eba3d0-59a2-48a2-b19d-027bfd395150" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpagebloba4a7968727d7f/javablobsettierpageblob1blobapitestsettierpagebloba4a591900f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EF0DD8E1\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ebe32-201e-00c4-03fb-594fb0000000", + "x-ms-client-request-id" : "ff632b19-a3cd-4d88-961c-d56d6bf0b70f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpagebloba4a37359a6f25?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF11F756\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ef1aa532-501c-00c0-7efb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "98e8b6e8-f3e5-43bb-9722-2697ec49313c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpagebloba4a37359a6f25/javablobsettierpageblob3blobapitestsettierpagebloba4a85709db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF1687D7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "ef1aa542-501c-00c0-0efb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "17d7ddbd-66fc-40e3-9538-70fc32969d1f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpagebloba4a37359a6f25/javablobsettierpageblob3blobapitestsettierpagebloba4a85709db?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ef1aa556-501c-00c0-22fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "534c019c-2901-4eaf-9bb2-ab13ab7a08a5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpagebloba4a37359a6f25/javablobsettierpageblob3blobapitestsettierpagebloba4a85709db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P30", + "ETag" : "\"0x8D72812EF1687D7\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:28 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ef1aa562-501c-00c0-2efb-59b1a4000000", + "x-ms-client-request-id" : "98a5a66e-6bde-4696-9466-d40ac6c36a66", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpagebloba4a37359a6f25?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa570-501c-00c0-3cfb-59b1a4000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpagebloba4a85709dbFri, 23 Aug 2019 21:43:28 GMTFri, 23 Aug 2019 21:43:28 GMT0x8D72812EF1687D7512application/octet-stream0PageBlobP30unlockedavailabletrue", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "199a33c3-5a65-4985-b5d5-80fdb3a78e82", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpagebloba4a37359a6f25?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa580-501c-00c0-4cfb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "9835a41b-5446-4d14-9aef-3594dd3be7d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierpageblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebe9e-201e-00c4-57fb-594fb0000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpagebloba4a7968727d7fFri, 23 Aug 2019 21:43:28 GMT\"0x8D72812EF0697A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "11a7f7b6-fb43-4719-9cc4-201fef10f112", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpagebloba4a7968727d7f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebeb0-201e-00c4-69fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "ac4b2ff0-631a-412d-a4fa-0253e5feddab" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpagebloba4a7968727d7f", "javablobsettierpageblob1blobapitestsettierpagebloba4a591900f", "jtcsettierpageblob2blobapitestsettierpagebloba4a37359a6f25", "javablobsettierpageblob3blobapitestsettierpagebloba4a85709db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[5].json new file mode 100644 index 000000000000..f6efa63c179b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[5].json @@ -0,0 +1,212 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob8fb63689de8f9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF3665EE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ebec5-201e-00c4-7dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "989aadc8-f345-4fec-af6d-25178b386c9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob8fb63689de8f9/javablobsettierpageblob1blobapitestsettierpageblob8fb3683088", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EF3BD1F9\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ebeed-201e-00c4-1cfb-594fb0000000", + "x-ms-client-request-id" : "2226d875-c770-487d-83d7-431030df3718" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob8fb02228ca08c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF40630C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ef1aa5eb-501c-00c0-37fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "76b04c00-13f0-4e99-a45d-cde34e0e1137" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob8fb02228ca08c/javablobsettierpageblob3blobapitestsettierpageblob8fb486545f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF44CC61\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "ef1aa600-501c-00c0-4cfb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "f5659dbe-cd4b-4eba-8af4-4486c2133354" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob8fb02228ca08c/javablobsettierpageblob3blobapitestsettierpageblob8fb486545f?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ef1aa615-501c-00c0-61fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:27 GMT", + "x-ms-client-request-id" : "b24af586-806d-42a7-8770-94c3875e7076" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob8fb02228ca08c/javablobsettierpageblob3blobapitestsettierpageblob8fb486545f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P40", + "ETag" : "\"0x8D72812EF44CC61\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:28 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ef1aa630-501c-00c0-7cfb-59b1a4000000", + "x-ms-client-request-id" : "e3e1e140-11a1-46ca-b85d-3ea199bb28db", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob8fb02228ca08c?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa63f-501c-00c0-0bfb-59b1a4000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblob8fb486545fFri, 23 Aug 2019 21:43:28 GMTFri, 23 Aug 2019 21:43:28 GMT0x8D72812EF44CC61512application/octet-stream0PageBlobP40unlockedavailabletrue", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "4a28f3e9-460f-4bbb-b68f-e88de92dc444", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob8fb02228ca08c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa653-501c-00c0-1ffb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "c56b6148-e3be-4b9b-a116-4a72695b89d7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierpageblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebf68-201e-00c4-02fb-594fb0000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblob8fb63689de8f9Fri, 23 Aug 2019 21:43:28 GMT\"0x8D72812EF3665EE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "c0b3545c-d4d9-4e77-8c56-1abefe8270dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob8fb63689de8f9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ebf77-201e-00c4-0efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "76d14ec8-f3ee-4a46-b77d-79f4f59e0037" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblob8fb63689de8f9", "javablobsettierpageblob1blobapitestsettierpageblob8fb3683088", "jtcsettierpageblob2blobapitestsettierpageblob8fb02228ca08c", "javablobsettierpageblob3blobapitestsettierpageblob8fb486545f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[6].json new file mode 100644 index 000000000000..ffb76806fecc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[6].json @@ -0,0 +1,212 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobc8801556e2586?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF63E9AF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ebf9a-201e-00c4-28fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "818b7eb7-04fe-45f8-96c8-053a4712e7ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobc8801556e2586/javablobsettierpageblob1blobapitestsettierpageblobc88478191d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EF697CE3\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ebfb0-201e-00c4-3bfb-594fb0000000", + "x-ms-client-request-id" : "ac87ad5c-2e26-46de-91fb-3da31602ec8f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobc886017299b13?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF6DBD10\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ef1aa6c1-501c-00c0-0dfb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "a636d8ad-6094-4654-9724-3eca00c1d998" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobc886017299b13/javablobsettierpageblob3blobapitestsettierpageblobc8804269a9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EF724D6D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "ef1aa6d3-501c-00c0-1ffb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "ec2264d8-9753-48d9-90c5-8aff438c0721" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobc886017299b13/javablobsettierpageblob3blobapitestsettierpageblobc8804269a9?comp=tier", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ef1aa6e9-501c-00c0-35fb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "5052d610-4a09-4207-82e9-a4aaef461e3c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobc886017299b13/javablobsettierpageblob3blobapitestsettierpageblobc8804269a9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P50", + "ETag" : "\"0x8D72812EF724D6D\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:28 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "ef1aa708-501c-00c0-54fb-59b1a4000000", + "x-ms-client-request-id" : "acf0a607-0deb-49d8-9538-99a5a9cf0a52", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobc886017299b13?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa718-501c-00c0-64fb-59b1a4000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobc8804269a9Fri, 23 Aug 2019 21:43:28 GMTFri, 23 Aug 2019 21:43:28 GMT0x8D72812EF724D6D512application/octet-stream0PageBlobP50unlockedavailabletrue", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "f85938d7-f6d0-4cd3-8f2f-1f908f45f87a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkpremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobc886017299b13?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ef1aa723-501c-00c0-6ffb-59b1a4000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "8843ed43-1e8f-435d-b262-02effc158c61" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsettierpageblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec02b-201e-00c4-26fb-594fb0000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobc8801556e2586Fri, 23 Aug 2019 21:43:28 GMT\"0x8D72812EF63E9AF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "44e90a73-151c-4976-8da2-64690ba73d7e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobc8801556e2586?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ec04a-201e-00c4-43fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:28 GMT", + "x-ms-client-request-id" : "d28f1364-1103-4459-8255-6d8f008182ef" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobc8801556e2586", "javablobsettierpageblob1blobapitestsettierpageblobc88478191d", "jtcsettierpageblob2blobapitestsettierpageblobc886017299b13", "javablobsettierpageblob3blobapitestsettierpageblobc8804269a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshot.json new file mode 100644 index 000000000000..30cfa85be688 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshot.json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshot0blobapitestsnapshotb01534873304a7247314?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DDFEA896\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e81e5-201e-00c4-40fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "d39cda40-2843-4356-9fe2-f429a56ef158" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshot0blobapitestsnapshotb01534873304a7247314/javablobsnapshot1blobapitestsnapshotb01339537817194b3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DE074326\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8206-201e-00c4-58fb-594fb0000000", + "x-ms-client-request-id" : "7e48e3e4-154d-4897-8775-dd324b6670dd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshot0blobapitestsnapshotb01534873304a7247314/javablobsnapshot1blobapitestsnapshotb01339537817194b3?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:42:59.6075102Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DE074326\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8217-201e-00c4-64fb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "61992148-3e50-4fc3-9770-c55d53be1da0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshot0blobapitestsnapshotb01534873304a7247314/javablobsnapshot1blobapitestsnapshotb01339537817194b3?snapshot=2019-08-23T21%3a42%3a59.6075102Z", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-snapshot" : "2019-08-23T21:42:59.6075102Z", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DE074326\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:59 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e8231-201e-00c4-7cfb-594fb0000000", + "x-ms-client-request-id" : "414d7a14-99ac-4f76-aa5a-143a1218a682", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshot&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8239-201e-00c4-03fb-594fb0000000", + "Body" : "jtcsnapshotjtcsnapshot0blobapitestsnapshotb01534873304a7247314Fri, 23 Aug 2019 21:42:59 GMT\"0x8D72812DDFEA896\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "b3994c01-f15b-456a-a10e-8f6867ffdb71", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshot0blobapitestsnapshotb01534873304a7247314?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8242-201e-00c4-08fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "eb67eb12-c4db-44a8-94f7-fef7417cfaa3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshot0blobapitestsnapshotb01534873304a7247314", "javablobsnapshot1blobapitestsnapshotb01339537817194b3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[0].json new file mode 100644 index 000000000000..5a4766e2a322 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[0].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac56951465944e0b0a6c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DE5C48C4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e831d-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "3c2cea71-e20f-4427-b8fe-d2a409616f71" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac56951465944e0b0a6c/javablobsnapshotac1blobapitestsnapshotac569990732909968", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DE61AE5F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8332-201e-00c4-52fb-594fb0000000", + "x-ms-client-request-id" : "84c4987d-d2d1-4c5a-aa1f-503a66750978" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac56951465944e0b0a6c/javablobsnapshotac1blobapitestsnapshotac569990732909968?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:43:00.2000786Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DE61AE5F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8347-201e-00c4-64fb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "220dc7e6-f4fc-4639-840f-29f6e5a0e3a6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8363-201e-00c4-7dfb-594fb0000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac56951465944e0b0a6cFri, 23 Aug 2019 21:43:00 GMT\"0x8D72812DE5C48C4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "f86fd7ed-c6ad-4cb6-b89c-b9a32d0dc7c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac56951465944e0b0a6c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8370-201e-00c4-0afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "125678ed-accb-43c1-a67d-9e3c27fb74e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac56951465944e0b0a6c", "javablobsnapshotac1blobapitestsnapshotac569990732909968" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[1].json new file mode 100644 index 000000000000..93ca85c562d2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[1].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac99634122330704014e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DE757C3E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e838f-201e-00c4-20fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "173742fa-22a0-4f8a-b8d0-58f1bee45230" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac99634122330704014e/javablobsnapshotac1blobapitestsnapshotac99602523e0b464d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DE7A93AF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e83a7-201e-00c4-35fb-594fb0000000", + "x-ms-client-request-id" : "d37ae26e-3ff3-4394-90e4-3a698e4d25b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac99634122330704014e/javablobsnapshotac1blobapitestsnapshotac99602523e0b464d?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:43:00.3652364Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DE7A93AF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e83c4-201e-00c4-4afb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "e9285156-8c37-411f-bd3a-32cc3ed6673d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e83dd-201e-00c4-5ffb-594fb0000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac99634122330704014eFri, 23 Aug 2019 21:43:00 GMT\"0x8D72812DE757C3E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "de37c975-2962-41a8-89c5-813fc3a04ef7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac99634122330704014e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e83f3-201e-00c4-74fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "4bfe2310-9c3e-4ce2-bd4b-7213d9717c49" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac99634122330704014e", "javablobsnapshotac1blobapitestsnapshotac99602523e0b464d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[2].json new file mode 100644 index 000000000000..47fbdb119424 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[2].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacd875962737a9b5e2ed?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DE9AC092\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e842c-201e-00c4-24fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "8c7b1c5f-0e02-493d-9ae5-24599724fee7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacd875962737a9b5e2ed/javablobsnapshotac1blobapitestsnapshotacd8785264556ca10", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DEA445FE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8451-201e-00c4-44fb-594fb0000000", + "x-ms-client-request-id" : "913d734c-bcbf-449f-a36d-4e525bbf9e4a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacd875962737a9b5e2ed/javablobsnapshotac1blobapitestsnapshotacd8785264556ca10?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:43:00.6415019Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DEA445FE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8462-201e-00c4-53fb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "c5a1c903-bce8-4c0d-8c42-f7edb9c389a5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8499-201e-00c4-7efb-594fb0000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotacd875962737a9b5e2edFri, 23 Aug 2019 21:43:00 GMT\"0x8D72812DE9AC092\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "86d24b95-f7f9-4fd5-846b-54615210d15d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacd875962737a9b5e2ed?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e84a3-201e-00c4-07fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "579d8bce-703d-4c49-9cad-f47cf07fdfc6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotacd875962737a9b5e2ed", "javablobsnapshotac1blobapitestsnapshotacd8785264556ca10" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[3].json new file mode 100644 index 000000000000..370bd77c7d0d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[3].json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac993981651100f8c67f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DEDD30F9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e84ea-201e-00c4-44fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "38f7354f-aa09-4075-af26-ca1e19b35998" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac993981651100f8c67f/javablobsnapshotac1blobapitestsnapshotac99318216d2c7187", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DEE26FB8\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e84f8-201e-00c4-50fb-594fb0000000", + "x-ms-client-request-id" : "4edda1b9-8d10-46c3-b0d6-507c76da266a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac993981651100f8c67f/javablobsnapshotac1blobapitestsnapshotac99318216d2c7187", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DEE26FB8\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:01 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e8505-201e-00c4-5bfb-594fb0000000", + "x-ms-client-request-id" : "2eb4061f-6c2d-4202-97a6-583e11d554aa", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac993981651100f8c67f/javablobsnapshotac1blobapitestsnapshotac99318216d2c7187?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:43:01.0749190Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DEE26FB8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e851b-201e-00c4-6ffb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "db4097bb-ff6b-4879-9ea7-9ebdee044fdd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e852b-201e-00c4-7bfb-594fb0000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac993981651100f8c67fFri, 23 Aug 2019 21:43:00 GMT\"0x8D72812DEDD30F9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "79145415-2cbf-491b-95b3-ac6d7b706705", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac993981651100f8c67f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8530-201e-00c4-80fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "55d0c6e0-703d-49b7-bc8f-9b91393dcc25" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac993981651100f8c67f", "javablobsnapshotac1blobapitestsnapshotac99318216d2c7187" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[4].json new file mode 100644 index 000000000000..0b1e8b491bda --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[4].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac4fb51105456b875fda?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DEFF8E6A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8551-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "63cd8186-eed5-4632-a3f1-54e4147188aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac4fb51105456b875fda/javablobsnapshotac1blobapitestsnapshotac4fb25035cb659d5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DF04CD40\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e856b-201e-00c4-34fb-594fb0000000", + "x-ms-client-request-id" : "21fb6799-8b54-4ea5-813a-d2853721d5cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac4fb51105456b875fda/javablobsnapshotac1blobapitestsnapshotac4fb25035cb659d5?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:43:01.2711085Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DF04CD40\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e857c-201e-00c4-3ffb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "27cc7c78-84fe-4939-86ec-d225eeebd98a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8592-201e-00c4-52fb-594fb0000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac4fb51105456b875fdaFri, 23 Aug 2019 21:43:01 GMT\"0x8D72812DEFF8E6A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "409635eb-cf4d-4c81-b772-e711cf0aaac6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac4fb51105456b875fda?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8596-201e-00c4-55fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "03050b2b-1ad4-4c5c-a00c-dfac85cda7fd" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac4fb51105456b875fda", "javablobsnapshotac1blobapitestsnapshotac4fb25035cb659d5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[5].json new file mode 100644 index 000000000000..a13b0a38769c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[5].json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac5b92095851bdad8e5e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DF193733\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e85a8-201e-00c4-64fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "722236a6-7357-44b2-9496-3445378f2741" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac5b92095851bdad8e5e/javablobsnapshotac1blobapitestsnapshotac5b956554184e1d2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DF1FAEEA\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e85b6-201e-00c4-71fb-594fb0000000", + "x-ms-client-request-id" : "af23c5f0-4efa-4159-befa-6dc031fb9036" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac5b92095851bdad8e5e/javablobsnapshotac1blobapitestsnapshotac5b956554184e1d2?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DF1FAEEA\"", + "x-ms-lease-id" : "c62be825-0927-4e5f-af6a-56609c0181f8", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e85c1-201e-00c4-7afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "880e6e8d-e288-4d71-8de4-3ed9e450c787" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac5b92095851bdad8e5e/javablobsnapshotac1blobapitestsnapshotac5b956554184e1d2?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:43:01.4993285Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DF1FAEEA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e85e1-201e-00c4-16fb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "9f730776-ca14-43c4-98a8-c8a7495a8ec3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e85f8-201e-00c4-2afb-594fb0000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac5b92095851bdad8e5eFri, 23 Aug 2019 21:43:01 GMT\"0x8D72812DF193733\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "10b05664-82a4-4059-ba5d-51d16521fea9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac5b92095851bdad8e5e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8606-201e-00c4-37fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "4c67fa0f-b944-441a-836f-394d29aad986" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac5b92095851bdad8e5e", "javablobsnapshotac1blobapitestsnapshotac5b956554184e1d2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[0].json new file mode 100644 index 000000000000..b9e08b5102c6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[0].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail6f299593461ae2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DF3BE2D8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8613-201e-00c4-42fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "34e64530-0dd2-4fcc-96e0-ef0ad7c58911" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail6f299593461ae2/javablobsnapshotacfail1blobapitestsnapshotacfail6f281470618", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DF4148F9\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e862a-201e-00c4-54fb-594fb0000000", + "x-ms-client-request-id" : "8c4b96c8-0ab4-47bf-b346-11da9fc058ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail6f299593461ae2/javablobsnapshotacfail1blobapitestsnapshotacfail6f281470618?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e8637-201e-00c4-60fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e8637-201e-00c4-60fb-594fb0000000\nTime:2019-08-23T21:43:01.6671421Z", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "1cf1e8aa-60f7-4a1f-b454-76dfd3a5a44e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8646-201e-00c4-6dfb-594fb0000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfail6f299593461ae2Fri, 23 Aug 2019 21:43:01 GMT\"0x8D72812DF3BE2D8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "c43b60ff-37ff-47a4-bcf0-30b2e6475eac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail6f299593461ae2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e864f-201e-00c4-76fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "5861beb8-326e-4410-aefe-b5130a989252" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfail6f299593461ae2", "javablobsnapshotacfail1blobapitestsnapshotacfail6f281470618" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[1].json new file mode 100644 index 000000000000..7b2d24e2fd95 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail88c73084221979?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DF54A107\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8663-201e-00c4-08fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "d5472370-2cc7-42b7-bf67-58a7c5529141" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail88c73084221979/javablobsnapshotacfail1blobapitestsnapshotacfail88c14271f42", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DF59E01B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e866e-201e-00c4-12fb-594fb0000000", + "x-ms-client-request-id" : "1d191348-0235-440c-94ac-c39aeb92455c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail88c73084221979/javablobsnapshotacfail1blobapitestsnapshotacfail88c14271f42?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e867d-201e-00c4-20fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e867d-201e-00c4-20fb-594fb0000000\nTime:2019-08-23T21:43:01.8282955Z", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "bc4e8047-ca87-4e84-942f-cbf980591330", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8685-201e-00c4-27fb-594fb0000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfail88c73084221979Fri, 23 Aug 2019 21:43:01 GMT\"0x8D72812DF54A107\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "df333200-db6c-4df3-9dd7-79aadb9300bf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail88c73084221979?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e868d-201e-00c4-2ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "5b8bdaa0-d043-45f6-9c3d-c2d612a0a88e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfail88c73084221979", "javablobsnapshotacfail1blobapitestsnapshotacfail88c14271f42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[2].json new file mode 100644 index 000000000000..17fd18152968 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[2].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail98d72217713174?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DF6D3811\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8698-201e-00c4-38fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "2a87223d-2330-4cf0-a35a-4b9661fc0beb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail98d72217713174/javablobsnapshotacfail1blobapitestsnapshotacfail98d56268ac3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DF729E55\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e86a7-201e-00c4-44fb-594fb0000000", + "x-ms-client-request-id" : "2504850f-6c97-4f2b-b490-0ba4d7c42864" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail98d72217713174/javablobsnapshotacfail1blobapitestsnapshotacfail98d56268ac3?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e86b3-201e-00c4-50fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e86b3-201e-00c4-50fb-594fb0000000\nTime:2019-08-23T21:43:01.9864464Z", + "Date" : "Fri, 23 Aug 2019 21:43:00 GMT", + "x-ms-client-request-id" : "24060e21-8356-419f-a0f5-21116629c46a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e86c2-201e-00c4-5cfb-594fb0000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfail98d72217713174Fri, 23 Aug 2019 21:43:01 GMT\"0x8D72812DF6D3811\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "dfb1e90a-121b-4392-9bd4-9572d5d79274", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail98d72217713174?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e86d4-201e-00c4-69fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "730637f5-eaf6-4256-a35e-29de412eef85" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfail98d72217713174", "javablobsnapshotacfail1blobapitestsnapshotacfail98d56268ac3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[3].json new file mode 100644 index 000000000000..55a3bdfe852c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[3].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaila0605904614787?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DF956356\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e872f-201e-00c4-39fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "9199021a-355f-4263-8e6c-48ce4d48cff7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaila0605904614787/javablobsnapshotacfail1blobapitestsnapshotacfaila0642865aba", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DF9AC9A0\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8742-201e-00c4-4afb-594fb0000000", + "x-ms-client-request-id" : "4fb81372-5072-479f-a5e5-010fd0b723cb" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaila0605904614787/javablobsnapshotacfail1blobapitestsnapshotacfaila0642865aba", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DF9AC9A0\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e8769-201e-00c4-6dfb-594fb0000000", + "x-ms-client-request-id" : "dbb25117-0ebd-4645-91e8-6ab9df95bbbc", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaila0605904614787/javablobsnapshotacfail1blobapitestsnapshotacfaila0642865aba?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51e877e-201e-00c4-7ffb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51e877e-201e-00c4-7ffb-594fb0000000\nTime:2019-08-23T21:43:02.3107557Z", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "71014be9-d9d4-40bd-b191-6e713273e484", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e878f-201e-00c4-0dfb-594fb0000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfaila0605904614787Fri, 23 Aug 2019 21:43:02 GMT\"0x8D72812DF956356\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "46344eab-a5cd-4861-8789-0131ef678df0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaila0605904614787?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e879a-201e-00c4-18fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "5a7833bf-5a1c-4ccc-9d83-3af225757c67" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfaila0605904614787", "javablobsnapshotacfail1blobapitestsnapshotacfaila0642865aba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[4].json new file mode 100644 index 000000000000..0ee5e63f3883 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[4].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail14108510791e59?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DFB6FD46\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e87b0-201e-00c4-2cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "60caf598-edfc-4945-8a7a-685053c119cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail14108510791e59/javablobsnapshotacfail1blobapitestsnapshotacfail14191718369", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DFBCB1D9\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e87cd-201e-00c4-42fb-594fb0000000", + "x-ms-client-request-id" : "63dcfb73-bf58-43a9-9441-aa63ae3b9341" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail14108510791e59/javablobsnapshotacfail1blobapitestsnapshotacfail14191718369?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DFBCB1D9\"", + "x-ms-lease-id" : "d8f07ae2-1e02-4461-9fb4-5d86a39e77c8", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e87de-201e-00c4-52fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "ce15c141-2e96-4b41-b858-7b165d2a8c20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail14108510791e59/javablobsnapshotacfail1blobapitestsnapshotacfail14191718369?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "d51e87f1-201e-00c4-64fb-594fb0000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:d51e87f1-201e-00c4-64fb-594fb0000000\nTime:2019-08-23T21:43:02.5089451Z", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "be16d632-d865-48f4-b4cf-9b993c69bc89", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8809-201e-00c4-79fb-594fb0000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfail14108510791e59Fri, 23 Aug 2019 21:43:02 GMT\"0x8D72812DFB6FD46\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "2ad0f235-1149-42f1-a5f4-c6dce47823f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail14108510791e59?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8819-201e-00c4-08fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "51e84a0a-9d65-4687-97b6-3fc4f9908458" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfail14108510791e59", "javablobsnapshotacfail1blobapitestsnapshotacfail14191718369" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshoterror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshoterror.json new file mode 100644 index 000000000000..91f6aad8e2c2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshoterror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterrora9752495c764ac8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DFD53B0D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e8836-201e-00c4-22fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "630bf7e5-042f-4cf4-bfcf-a3e005d05239" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterrora9752495c764ac8/javablobsnapshoterror1blobapitestsnapshoterrora9795806869f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DFDAC885\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e8852-201e-00c4-38fb-594fb0000000", + "x-ms-client-request-id" : "e448758e-0d6d-4051-9fb6-5f490a6457dd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterrora9752495c764ac8/javablobsnapshoterror2blobapitestsnapshoterrora9775453b5a6?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e886e-201e-00c4-51fb-594fb0000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:d51e886e-201e-00c4-51fb-594fb0000000\nTime:2019-08-23T21:43:02.6741020Z", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "4282887c-3edd-4dfb-a4f3-407a70b901d0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshoterror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8881-201e-00c4-60fb-594fb0000000", + "Body" : "jtcsnapshoterrorjtcsnapshoterror0blobapitestsnapshoterrora9752495c764ac8Fri, 23 Aug 2019 21:43:02 GMT\"0x8D72812DFD53B0D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "34b1e42c-01c9-41fe-8f05-c32b6b1eef51", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterrora9752495c764ac8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8895-201e-00c4-71fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:02 GMT", + "x-ms-client-request-id" : "05cd0c96-4394-45e7-9448-eda754916838" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshoterror0blobapitestsnapshoterrora9752495c764ac8", "javablobsnapshoterror1blobapitestsnapshoterrora9795806869f", "javablobsnapshoterror2blobapitestsnapshoterrora9775453b5a6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[0].json new file mode 100644 index 000000000000..47b9c9fc596d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[0].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata2f24987344a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DE204286\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e824d-201e-00c4-13fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "7671b36e-5a6e-485f-a973-899bdbff1bbb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata2f24987344a4/javablobsnapshotmetadata1blobapitestsnapshotmetadata2f2325570", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DE25A814\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e825d-201e-00c4-21fb-594fb0000000", + "x-ms-client-request-id" : "95a76a28-0ce3-444c-bae7-860867ca8a82" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata2f24987344a4/javablobsnapshotmetadata1blobapitestsnapshotmetadata2f2325570?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:42:59.8097041Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DE25A814\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e826d-201e-00c4-30fb-594fb0000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "ab7bb168-5a79-4d8c-993c-7d3c5169d508" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata2f24987344a4/javablobsnapshotmetadata1blobapitestsnapshotmetadata2f2325570?snapshot=2019-08-23T21%3a42%3a59.8097041Z", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-snapshot" : "2019-08-23T21:42:59.8097041Z", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DE25A814\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:59 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e827d-201e-00c4-3efb-594fb0000000", + "x-ms-client-request-id" : "a6cb5823-01dc-4e4b-b806-44d36642a2d9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e8295-201e-00c4-53fb-594fb0000000", + "Body" : "jtcsnapshotmetadatajtcsnapshotmetadata0blobapitestsnapshotmetadata2f24987344a4Fri, 23 Aug 2019 21:42:59 GMT\"0x8D72812DE204286\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "76f769c0-1e2a-4e56-8c3b-a374c70caf13", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata2f24987344a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e82a2-201e-00c4-5dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "a3f1e918-f83f-4c41-9eb5-00753235b8d1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotmetadata0blobapitestsnapshotmetadata2f24987344a4", "javablobsnapshotmetadata1blobapitestsnapshotmetadata2f2325570" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[1].json new file mode 100644 index 000000000000..a304fdc0f226 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[1].json @@ -0,0 +1,140 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata695774381e58?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DE3E3219\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e82aa-201e-00c4-64fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "x-ms-client-request-id" : "f6bd0c25-b87e-406b-be00-3faf28dd00ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata695774381e58/javablobsnapshotmetadata1blobapitestsnapshotmetadata69579876d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:42:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812DE4397A9\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51e82c0-201e-00c4-74fb-594fb0000000", + "x-ms-client-request-id" : "c022c6f6-fe95-4af7-99c6-e1f7c70a81a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata695774381e58/javablobsnapshotmetadata1blobapitestsnapshotmetadata69579876d?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:43:00.0048912Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812DE48C910\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51e82d2-201e-00c4-01fb-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "e401a26a-7172-47bf-abf2-3ec674dc5ea9" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata695774381e58/javablobsnapshotmetadata1blobapitestsnapshotmetadata69579876d?snapshot=2019-08-23T21%3a43%3a00.0048912Z", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-snapshot" : "2019-08-23T21:43:00.0048912Z", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812DE48C910\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:42:59 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51e82e2-201e-00c4-0efb-594fb0000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "ebe5dad6-1962-4400-9321-bd09eb94b614", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e82f5-201e-00c4-20fb-594fb0000000", + "Body" : "jtcsnapshotmetadatajtcsnapshotmetadata0blobapitestsnapshotmetadata695774381e58Fri, 23 Aug 2019 21:42:59 GMT\"0x8D72812DE3E3219\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "c542be16-f2ee-4820-a9ff-df20527df9c6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata695774381e58?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51e830a-201e-00c4-31fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:42:59 GMT", + "x-ms-client-request-id" : "c90cfaab-1d78-4cf1-b6ca-2dd53d9ff47e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotmetadata0blobapitestsnapshotmetadata695774381e58", "javablobsnapshotmetadata1blobapitestsnapshotmetadata69579876d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmin.json new file mode 100644 index 000000000000..ae62b3728335 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmin.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7274039EE2189\"", + "Last-Modified" : "Thu, 22 Aug 2019 20:35:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "25b246a2-f01e-012c-4229-59f41e000000", + "Date" : "Thu, 22 Aug 2019 20:35:09 GMT", + "x-ms-client-request-id" : "3aa1df2f-7795-4925-8b5d-b75046e5258e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006/javablobsnapshotmin1blobapitestsnapshotminaa617559a367db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Thu, 22 Aug 2019 20:35:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 22 Aug 2019 20:35:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7274039F46B09\"", + "Content-Length" : "0", + "x-ms-request-id" : "25b246ea-f01e-012c-0629-59f41e000000", + "x-ms-client-request-id" : "f8e59c2b-ce4c-48f9-868f-289ef08b5e22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006/javablobsnapshotmin1blobapitestsnapshotminaa617559a367db?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-22T20:35:10.0564843Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7274039F46B09\"", + "Last-Modified" : "Thu, 22 Aug 2019 20:35:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "25b24760-f01e-012c-7529-59f41e000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Thu, 22 Aug 2019 20:35:09 GMT", + "x-ms-client-request-id" : "f67f3a12-978b-4f85-bfa8-8aa5c6d43c00" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "25b247a3-f01e-012c-3429-59f41e000000", + "Body" : "jtcsnapshotminjtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006Thu, 22 Aug 2019 20:35:09 GMT\"0x8D7274039EE2189\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Thu, 22 Aug 2019 20:35:09 GMT", + "x-ms-client-request-id" : "d40323ea-6729-4ded-95da-08637c44a2a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "25b247cc-f01e-012c-5c29-59f41e000000", + "Date" : "Thu, 22 Aug 2019 20:35:09 GMT", + "x-ms-client-request-id" : "85570c32-fc9c-4909-b8f8-7ef462d9dc2c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006", "javablobsnapshotmin1blobapitestsnapshotminaa617559a367db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopy.json new file mode 100644 index 000000000000..6d6d473a5ff8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopy.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy6e9865329f5352261584?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E6C36270\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea15c-201e-00c4-31fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "0c399cb6-05f5-46f2-93b3-aecca85f20b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy6e9865329f5352261584/javablobsynccopy1blobapitestsynccopy6e9763764652c34d8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E6C87D31\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea17d-201e-00c4-48fb-594fb0000000", + "x-ms-client-request-id" : "48d6d963-fd15-44b4-98a5-15487b1f6a83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy6e9865329f5352261584?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E6CD4084\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea194-201e-00c4-5bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "abe9cd8e-a711-4ba8-b7d1-6b86a8bed776" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy6e9865329f5352261584/javablobsynccopy2blobapitestsynccopy6e961801aa88707e4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "47b9ed5d-0291-4c52-ac2d-609c76165a0d", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "ETag" : "\"0x8D72812E6E34E4D\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea1a8-201e-00c4-6afb-594fb0000000", + "x-ms-client-request-id" : "a74fb15a-4c23-4bda-a784-c42550d4e81a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea1da-201e-00c4-14fb-594fb0000000", + "Body" : "jtcsynccopyjtcsynccopy0blobapitestsynccopy6e9865329f5352261584Fri, 23 Aug 2019 21:43:14 GMT\"0x8D72812E6CD4084\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "78d1c9f7-1a81-466b-8f04-83c3c40b46da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy6e9865329f5352261584?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea1ea-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "ff84ebc3-04de-4788-8bd6-f3d5c3383a3f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopy0blobapitestsynccopy6e9865329f5352261584", "javablobsynccopy1blobapitestsynccopy6e9763764652c34d8", "javablobsynccopy2blobapitestsynccopy6e961801aa88707e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[0].json new file mode 100644 index 000000000000..95aeacd2505f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[0].json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac2f585030c34a3e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E8CD1F5C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea7c6-201e-00c4-18fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "c1d4f9c1-dd2e-49b8-9f7c-dc1e23ff404f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac2f585030c34a3e/javablobsynccopydestac1blobapitestsynccopydestac2f553105096", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E8F75822\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea843-201e-00c4-01fb-594fb0000000", + "x-ms-client-request-id" : "6e4c9877-99fc-4463-9573-32ba0a6c67c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac2f585030c34a3e?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E8FBC999\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea84f-201e-00c4-0bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "52a33089-1e93-43cb-8499-d1159b16a276" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac2f585030c34a3e/javablobsynccopydestac2blobapitestsynccopydestac2f540618eb9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E900F771\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea85d-201e-00c4-19fb-594fb0000000", + "x-ms-client-request-id" : "69397928-1a23-47b6-9202-5b2345e14258" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac2f585030c34a3e/javablobsynccopydestac2blobapitestsynccopydestac2f540618eb9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "1a159bf6-0058-457a-a9a3-5d5e097eef64", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "ETag" : "\"0x8D72812E908B03E\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea871-201e-00c4-2afb-594fb0000000", + "x-ms-client-request-id" : "8655be17-09e2-451d-ada2-28992606f35a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea881-201e-00c4-3afb-594fb0000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac2f585030c34a3eFri, 23 Aug 2019 21:43:17 GMT\"0x8D72812E8FBC999\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "cfa6e2f6-56ea-42e4-b3bf-ec2a86401fa1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac2f585030c34a3e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea891-201e-00c4-46fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "1f490b0a-ff09-411f-9043-841454dd4cd9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac2f585030c34a3e", "javablobsynccopydestac1blobapitestsynccopydestac2f553105096", "javablobsynccopydestac2blobapitestsynccopydestac2f540618eb9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[1].json new file mode 100644 index 000000000000..04526e45c514 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[1].json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac1fe111129e767b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E919561C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea8a1-201e-00c4-53fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "21aa6d3e-2bf9-4087-8ba4-ed34030f0c69" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac1fe111129e767b/javablobsynccopydestac1blobapitestsynccopydestac1fe37821e35", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E91E98D4\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea8a9-201e-00c4-5afb-594fb0000000", + "x-ms-client-request-id" : "0005ca71-2b67-44e7-a713-0edf5712fa8d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac1fe111129e767b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E9235837\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea8b8-201e-00c4-69fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "13da7d42-71d1-42c6-97fb-6c586cdba2f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac1fe111129e767b/javablobsynccopydestac2blobapitestsynccopydestac1fe93917d40", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E948C080\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea92d-201e-00c4-4ffb-594fb0000000", + "x-ms-client-request-id" : "c4a0953a-64cd-4f28-9d76-5bbd7251e6cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac1fe111129e767b/javablobsynccopydestac2blobapitestsynccopydestac1fe93917d40", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "efdf961d-3f4f-4105-9eb0-5742b793b3db", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "ETag" : "\"0x8D72812E95DE9ED\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea93b-201e-00c4-5cfb-594fb0000000", + "x-ms-client-request-id" : "dd9987b1-8643-4a03-9afd-dc8fd14228b7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea98e-201e-00c4-1afb-594fb0000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac1fe111129e767bFri, 23 Aug 2019 21:43:18 GMT\"0x8D72812E9235837\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "8264b4b5-be97-485c-acf4-4fb84e9f7a5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac1fe111129e767b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea9a8-201e-00c4-2dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "901e7a91-322c-409b-9f32-de29e5aa4369" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac1fe111129e767b", "javablobsynccopydestac1blobapitestsynccopydestac1fe37821e35", "javablobsynccopydestac2blobapitestsynccopydestac1fe93917d40" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[2].json new file mode 100644 index 000000000000..0f78b970416e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[2].json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac43d44709a120bc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E96D08D0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea9c4-201e-00c4-44fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "6680ddd5-ca71-45c6-ba50-c05f22820fc4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac43d44709a120bc/javablobsynccopydestac1blobapitestsynccopydestac43d78178cbb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E97299DA\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea9df-201e-00c4-5cfb-594fb0000000", + "x-ms-client-request-id" : "b0c94bc7-017b-4732-a5c7-1c738f31b7fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac43d44709a120bc?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E977CDFA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea9f6-201e-00c4-71fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "39b383f7-9bf3-4815-ba3f-530d92689d7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac43d44709a120bc/javablobsynccopydestac2blobapitestsynccopydestac43d1543984b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E97CAE6A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eaa04-201e-00c4-7efb-594fb0000000", + "x-ms-client-request-id" : "53b225f9-c78a-4fb5-8f1f-01ab7382f6ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac43d44709a120bc/javablobsynccopydestac2blobapitestsynccopydestac43d1543984b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "fa564b01-2b21-48f7-bb07-48152ffad908", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "ETag" : "\"0x8D72812E9848E33\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51eaa1d-201e-00c4-16fb-594fb0000000", + "x-ms-client-request-id" : "d09e7482-b118-40d1-853b-8fa219bd2080" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eaa40-201e-00c4-35fb-594fb0000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac43d44709a120bcFri, 23 Aug 2019 21:43:18 GMT\"0x8D72812E977CDFA\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "8cc6378a-4c94-45a9-ba85-72d4f5a9f2a0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac43d44709a120bc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eaa55-201e-00c4-49fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "fe515e2b-04e5-4024-b627-af50fbf8ada2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac43d44709a120bc", "javablobsynccopydestac1blobapitestsynccopydestac43d78178cbb", "javablobsynccopydestac2blobapitestsynccopydestac43d1543984b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[3].json new file mode 100644 index 000000000000..64c4b9d26753 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[3].json @@ -0,0 +1,185 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac0b07136318fffd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E9950CF0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eaa69-201e-00c4-57fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "x-ms-client-request-id" : "25532225-d0a6-4b24-8b3d-0e8720fa083e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac0b07136318fffd/javablobsynccopydestac1blobapitestsynccopydestac0b051708913", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E99A9E09\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eaa74-201e-00c4-60fb-594fb0000000", + "x-ms-client-request-id" : "035ecbdd-7f62-4294-bf2f-5ac8e9678e40" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac0b07136318fffd?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E9A0956B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51eaa8e-201e-00c4-7afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-client-request-id" : "e8784bdc-7785-4ca6-8c35-16d0153e90a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac0b07136318fffd/javablobsynccopydestac2blobapitestsynccopydestac0b028095e1b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E9B09C74\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eaad2-201e-00c4-33fb-594fb0000000", + "x-ms-client-request-id" : "1ece4ba3-d86a-4a9a-ac4c-ee1b910bbd5b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac0b07136318fffd/javablobsynccopydestac2blobapitestsynccopydestac0b028095e1b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812E9B09C74\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:19 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51eaaec-201e-00c4-46fb-594fb0000000", + "x-ms-client-request-id" : "4a658f43-84ea-4521-a260-3bdac37169e3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac0b07136318fffd/javablobsynccopydestac2blobapitestsynccopydestac0b028095e1b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "951f39cc-e3b7-41ac-8a4b-f51ec9b062e7", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "ETag" : "\"0x8D72812E9BD8665\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51eaaff-201e-00c4-57fb-594fb0000000", + "x-ms-client-request-id" : "f3260f0b-45ba-41af-be30-f88e0ba421d9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eab22-201e-00c4-74fb-594fb0000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac0b07136318fffdFri, 23 Aug 2019 21:43:19 GMT\"0x8D72812E9A0956B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-client-request-id" : "aa104e52-f014-4545-8d64-9dab5a17aa73", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac0b07136318fffd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eab2e-201e-00c4-7ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-client-request-id" : "3ff61436-5085-401b-992b-d6d3a1f921e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac0b07136318fffd", "javablobsynccopydestac1blobapitestsynccopydestac0b051708913", "javablobsynccopydestac2blobapitestsynccopydestac0b028095e1b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[4].json new file mode 100644 index 000000000000..a376e7201a4d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[4].json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacf9d49945189752?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E9CF3DF8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eab54-201e-00c4-1dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-client-request-id" : "19c67000-ca23-4188-8349-89a71970eefe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacf9d49945189752/javablobsynccopydestac1blobapitestsynccopydestacf9d96821b2e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E9D62F0A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eab75-201e-00c4-3afb-594fb0000000", + "x-ms-client-request-id" : "8ba286c3-4412-407c-961d-6f44e3053c3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacf9d49945189752?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E9DB1459\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51eab8e-201e-00c4-4cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-client-request-id" : "e47f53b4-4fa9-45ec-80ef-1c182571ad24" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacf9d49945189752/javablobsynccopydestac2blobapitestsynccopydestacf9d41744160", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E9EEED46\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eabc4-201e-00c4-7bfb-594fb0000000", + "x-ms-client-request-id" : "30b4c81c-7755-478e-a436-f01a15cd3b81" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacf9d49945189752/javablobsynccopydestac2blobapitestsynccopydestacf9d41744160", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d3ea36ac-427b-4c19-8cb6-3074ce826772", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "ETag" : "\"0x8D72812EA0B9265\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51eabd1-201e-00c4-08fb-594fb0000000", + "x-ms-client-request-id" : "2d67cffc-0e8a-4167-ae80-e9bf218f9d0d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eac31-201e-00c4-5efb-594fb0000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestacf9d49945189752Fri, 23 Aug 2019 21:43:19 GMT\"0x8D72812E9DB1459\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-client-request-id" : "73f5c9df-ad98-4698-bf5a-f583a5b3d282", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacf9d49945189752?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eac4a-201e-00c4-71fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-client-request-id" : "f66472c5-ef7b-44b6-afff-48119fcc24cf" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestacf9d49945189752", "javablobsynccopydestac1blobapitestsynccopydestacf9d96821b2e", "javablobsynccopydestac2blobapitestsynccopydestacf9d41744160" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[5].json new file mode 100644 index 000000000000..57a66c7f2831 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[5].json @@ -0,0 +1,175 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacd421393168e207?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EA1AFF77\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eac5c-201e-00c4-03fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-client-request-id" : "6c948cd9-dab3-4917-8823-0baacd2744d3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacd421393168e207/javablobsynccopydestac1blobapitestsynccopydestacd4256928240", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EA21A276\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eac74-201e-00c4-17fb-594fb0000000", + "x-ms-client-request-id" : "ae0644be-e6b0-48e0-8ec4-c2e576af36ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacd421393168e207?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EA268742\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51eac8a-201e-00c4-2afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-client-request-id" : "68cde8a2-ee8c-4718-ac1b-efede2a64a95" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacd421393168e207/javablobsynccopydestac2blobapitestsynccopydestacd4264544e67", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EA2B8FEF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eac9d-201e-00c4-3dfb-594fb0000000", + "x-ms-client-request-id" : "7cb79df1-046d-4106-b696-73b050224142" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacd421393168e207/javablobsynccopydestac2blobapitestsynccopydestacd4264544e67?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EA2B8FEF\"", + "x-ms-lease-id" : "fd5aea77-d5a0-4e7c-ba36-604577b7dec6", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eacb9-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:19 GMT", + "x-ms-client-request-id" : "ba851a96-1204-411a-8aa8-ba7d3e2d01a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacd421393168e207/javablobsynccopydestac2blobapitestsynccopydestacd4264544e67", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "75f3e509-648e-4641-a646-23eafb93a633", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "ETag" : "\"0x8D72812EA38A0D3\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51eacd3-201e-00c4-6dfb-594fb0000000", + "x-ms-client-request-id" : "cf9f906c-412d-4a1e-a56c-bbefd1a8bb59" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eacf0-201e-00c4-04fb-594fb0000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestacd421393168e207Fri, 23 Aug 2019 21:43:19 GMT\"0x8D72812EA268742\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "8d9ef702-8a47-4ad6-b60d-141aac1e4495", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacd421393168e207?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ead0c-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "46d0eec6-674e-44e1-820f-22e5985d7d45" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestacd421393168e207", "javablobsynccopydestac1blobapitestsynccopydestacd4256928240", "javablobsynccopydestac2blobapitestsynccopydestacd4264544e67" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[0].json new file mode 100644 index 000000000000..5375606faddb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[0].json @@ -0,0 +1,152 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailee798377b1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EA488334\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ead1f-201e-00c4-2efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "64d3b5ce-d252-45a0-8cd1-afadf433c9eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailee798377b1/javablobsynccopydestacfail101824fd066ed06d8c45d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EA4DC65B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ead2b-201e-00c4-37fb-594fb0000000", + "x-ms-client-request-id" : "173e7299-26b3-4854-9162-49fb0ae3c84b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailee798377b1?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EA525CA6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ead31-201e-00c4-3dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "26323e57-b750-4f3a-b42e-5c09cbdbcc30" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailee798377b1/javablobsynccopydestacfail283963738964b2eb094fb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EA573E93\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ead42-201e-00c4-4cfb-594fb0000000", + "x-ms-client-request-id" : "c8868368-3265-4252-9e74-1c38e5ce4b9a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailee798377b1/javablobsynccopydestacfail283963738964b2eb094fb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51ead50-201e-00c4-57fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51ead50-201e-00c4-57fb-594fb0000000\nTime:2019-08-23T21:43:20.4140274Z", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "782f9762-b754-4265-a5a5-87e45b56f1a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eadae-201e-00c4-2afb-594fb0000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfailee798377b1Fri, 23 Aug 2019 21:43:20 GMT\"0x8D72812EA525CA6\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "d89af49d-f11a-4ed6-a308-9f8190e1f799", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailee798377b1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eadb6-201e-00c4-31fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "74601c77-340c-4d79-b537-edb029bf43b1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfailee798377b1", "javablobsynccopydestacfail101824fd066ed06d8c45d", "javablobsynccopydestacfail283963738964b2eb094fb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[1].json new file mode 100644 index 000000000000..d1f1a91e4fa3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[1].json @@ -0,0 +1,152 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail549663498b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EA81C9A2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eadcf-201e-00c4-47fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "4d3c95fd-d380-4623-bfd9-46e903d46eb1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail549663498b/javablobsynccopydestacfail1508559f8389f44ac349c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EA8845A6\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eade7-201e-00c4-5cfb-594fb0000000", + "x-ms-client-request-id" : "02a965e4-0ab4-45a2-99bf-ed2cbcf79b13" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail549663498b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EA8CDB93\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51eadfa-201e-00c4-6dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "89467be6-848c-4db0-bb1c-bfdf44b11977" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail549663498b/javablobsynccopydestacfail230793839fb6a92e9f428", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EA91BDEC\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eae0a-201e-00c4-7cfb-594fb0000000", + "x-ms-client-request-id" : "25f38551-bd93-4242-8771-79b655fc2366" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail549663498b/javablobsynccopydestacfail230793839fb6a92e9f428", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51eae19-201e-00c4-08fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51eae19-201e-00c4-08fb-594fb0000000\nTime:2019-08-23T21:43:20.6722737Z", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "0ef9439c-6ad7-4a13-965a-c9798a5dfc0f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eae2b-201e-00c4-1afb-594fb0000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail549663498bFri, 23 Aug 2019 21:43:20 GMT\"0x8D72812EA8CDB93\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "91197094-daf2-44a4-9822-fae884ae3db7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail549663498b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eae41-201e-00c4-2efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "b3dbeebc-8413-4a3a-a3e3-9f3622f2d07b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail549663498b", "javablobsynccopydestacfail1508559f8389f44ac349c", "javablobsynccopydestacfail230793839fb6a92e9f428" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[2].json new file mode 100644 index 000000000000..c84e4b6899b1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[2].json @@ -0,0 +1,152 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail21b9076157?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EAAA9145\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eae6a-201e-00c4-50fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "c14044c4-c908-4b27-a499-b3d00e899708" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail21b9076157/javablobsynccopydestacfail174206cce719156e404cb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EABB9745\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eaeb8-201e-00c4-0ffb-594fb0000000", + "x-ms-client-request-id" : "c334258d-f298-462c-8d60-8a98bc76f405" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail21b9076157?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EAC053F3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51eaec5-201e-00c4-1cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "271c65cc-e5d4-4131-9efb-d5472f3ae127" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail21b9076157/javablobsynccopydestacfail201925dfc12db8cc8d4df", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EAC5ABE0\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eaed7-201e-00c4-2dfb-594fb0000000", + "x-ms-client-request-id" : "e7e91e2e-8d18-4eef-a838-dd9a06055ec6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail21b9076157/javablobsynccopydestacfail201925dfc12db8cc8d4df", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51eaeeb-201e-00c4-40fb-594fb0000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:d51eaeeb-201e-00c4-40fb-594fb0000000\nTime:2019-08-23T21:43:20.9855727Z", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "dd862e08-bc7b-40b4-a9c7-7b4b962799ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eaefe-201e-00c4-50fb-594fb0000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail21b9076157Fri, 23 Aug 2019 21:43:20 GMT\"0x8D72812EAC053F3\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:20 GMT", + "x-ms-client-request-id" : "c87c510d-66fa-4fb3-b2a5-be81982ce9ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail21b9076157?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eaf08-201e-00c4-59fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "c793917c-e937-4029-90db-4e64976e3749" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail21b9076157", "javablobsynccopydestacfail174206cce719156e404cb", "javablobsynccopydestacfail201925dfc12db8cc8d4df" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[3].json new file mode 100644 index 000000000000..0398c9baca32 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[3].json @@ -0,0 +1,183 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailec96044070?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EAD86335\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eaf2a-201e-00c4-78fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "ccf72bca-79e6-4b7c-9c16-3aafa33b0ae5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailec96044070/javablobsynccopydestacfail101876cfaa41ed297e44f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EADDF4CF\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eaf3e-201e-00c4-08fb-594fb0000000", + "x-ms-client-request-id" : "26576898-d1f7-4b9c-9bec-a29d65324dab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailec96044070?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EAE2B138\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51eaf45-201e-00c4-0efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "a3d57315-030b-4e40-9227-d32c5ae09923" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailec96044070/javablobsynccopydestacfail212309df27b0dc7dac47a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EAE7BB39\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eaf51-201e-00c4-19fb-594fb0000000", + "x-ms-client-request-id" : "e6b6b48b-0ad3-4396-9e5d-4cbc31b1086e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailec96044070/javablobsynccopydestacfail212309df27b0dc7dac47a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812EAE7BB39\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51eaf63-201e-00c4-29fb-594fb0000000", + "x-ms-client-request-id" : "47223c98-a240-42f9-87ec-f8b370a1453e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailec96044070/javablobsynccopydestacfail212309df27b0dc7dac47a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "d51eaf76-201e-00c4-37fb-594fb0000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51eaf76-201e-00c4-37fb-594fb0000000\nTime:2019-08-23T21:43:21.2568316Z", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "fca312ef-adb3-4271-8d9a-f64863a5a383", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eaf8c-201e-00c4-4bfb-594fb0000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfailec96044070Fri, 23 Aug 2019 21:43:21 GMT\"0x8D72812EAE2B138\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "f77beb66-efc4-44b8-9111-56f8143ca168", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailec96044070?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eaf97-201e-00c4-53fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "3935bde0-2d61-417a-906e-4af5e93085dd" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfailec96044070", "javablobsynccopydestacfail101876cfaa41ed297e44f", "javablobsynccopydestacfail212309df27b0dc7dac47a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[4].json new file mode 100644 index 000000000000..be735746856c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[4].json @@ -0,0 +1,173 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailf65350020a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EB155408\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eaff1-201e-00c4-20fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "86744a3b-091d-4d17-9cc8-b0a12a565776" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailf65350020a/javablobsynccopydestacfail116761d851e35b0b6a404", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EB1AE5D2\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb00a-201e-00c4-36fb-594fb0000000", + "x-ms-client-request-id" : "8935ba88-780b-491c-a17b-ad684d08b443" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailf65350020a?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EB1FA1BB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51eb023-201e-00c4-49fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "db519602-5e4e-4ffa-b75c-325713eaf60d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailf65350020a/javablobsynccopydestacfail218232970e15f0b13841d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EB24FA70\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb040-201e-00c4-64fb-594fb0000000", + "x-ms-client-request-id" : "c65be763-3f1e-4b18-91bb-67b14393c69c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailf65350020a/javablobsynccopydestacfail218232970e15f0b13841d?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EB24FA70\"", + "x-ms-lease-id" : "7940afdb-bfb6-4a0b-ad71-348568759fac", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb053-201e-00c4-76fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "41e1d348-4775-4c02-b3df-3520f51c724d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailf65350020a/javablobsynccopydestacfail218232970e15f0b13841d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "d51eb09f-201e-00c4-39fb-594fb0000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:d51eb09f-201e-00c4-39fb-594fb0000000\nTime:2019-08-23T21:43:21.7913410Z", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "7972e275-9698-49c9-8ab9-6e9ab978f0e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopydestacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb0c1-201e-00c4-59fb-594fb0000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfailf65350020aFri, 23 Aug 2019 21:43:21 GMT\"0x8D72812EB1FA1BB\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "4c9bd4e6-2edc-4a72-97b3-1a8b702928b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfailf65350020a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb0ce-201e-00c4-65fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "390887a6-3eb9-4fad-b039-514917032058" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfailf65350020a", "javablobsynccopydestacfail116761d851e35b0b6a404", "javablobsynccopydestacfail218232970e15f0b13841d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopyerror.json new file mode 100644 index 000000000000..c6f623e35dcb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopyerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerror68465174f019ee1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812EB53CBE9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51eb0e1-201e-00c4-75fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "ed545584-cdfa-4da2-a762-577728069902" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerror68465174f019ee1/javablobsynccopyerror1blobapitestsynccopyerror684728242ad6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812EB59AC0F\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51eb0f4-201e-00c4-07fb-594fb0000000", + "x-ms-client-request-id" : "0a5deec2-b206-4a96-b32b-5a78e4cafbc4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerror68465174f019ee1/javablobsynccopyerror2blobapitestsynccopyerror68472576912f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "229", + "StatusCode" : "404", + "x-ms-request-id" : "d51eb110-201e-00c4-21fb-594fb0000000", + "Body" : "CannotVerifyCopySourceThe specified resource does not exist.\nRequestId:d51eb110-201e-00c4-21fb-594fb0000000\nTime:2019-08-23T21:43:21.9885288Z", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "864fc399-93ad-4145-9ace-968125d4eb64", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopyerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb122-201e-00c4-32fb-594fb0000000", + "Body" : "jtcsynccopyerrorjtcsynccopyerror0blobapitestsynccopyerror68465174f019ee1Fri, 23 Aug 2019 21:43:21 GMT\"0x8D72812EB53CBE9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:21 GMT", + "x-ms-client-request-id" : "4af64b92-cd2e-44f2-b1f8-0a16c34196e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerror68465174f019ee1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51eb12c-201e-00c4-3cfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:22 GMT", + "x-ms-client-request-id" : "ef680594-9d56-42ed-912b-f3c5d60fcb09" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopyerror0blobapitestsynccopyerror68465174f019ee1", "javablobsynccopyerror1blobapitestsynccopyerror684728242ad6", "javablobsynccopyerror2blobapitestsynccopyerror68472576912f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[0].json new file mode 100644 index 000000000000..82df345273ce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[0].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadatad5a81869b0f9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E719388A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea26c-201e-00c4-0bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "779e15b4-842b-45fd-87f1-4b086d258abe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadatad5a81869b0f9/javablobsynccopymetadata1blobapitestsynccopymetadatad5a405931", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E71E536A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea278-201e-00c4-16fb-594fb0000000", + "x-ms-client-request-id" : "52e94b5e-4ade-4cdc-9355-e9163933b52b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadatad5a81869b0f9?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E722EF08\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea281-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "21a9a0aa-90aa-485f-8ecc-1db79cc390ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadatad5a81869b0f9/javablobsynccopymetadata2blobapitestsynccopymetadatad5a534068", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "50bb1c77-63d8-4c9a-9fe9-7747986901a7", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "ETag" : "\"0x8D72812E72AA1E5\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea28e-201e-00c4-28fb-594fb0000000", + "x-ms-client-request-id" : "acc6f9ff-54e1-4888-a568-18ae191d2e12" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadatad5a81869b0f9/javablobsynccopymetadata2blobapitestsynccopymetadatad5a534068", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51ea2ad-201e-00c4-43fb-594fb0000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "50bb1c77-63d8-4c9a-9fe9-7747986901a7", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadatad5a81869b0f9/javablobsynccopymetadata1blobapitestsynccopymetadatad5a405931", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:43:14 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812E72AA1E5\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "2cc5c20d-3918-4717-8255-1e77958c8fb7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopymetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea2bb-201e-00c4-50fb-594fb0000000", + "Body" : "jtcsynccopymetadatajtcsynccopymetadata0blobapitestsynccopymetadatad5a81869b0f9Fri, 23 Aug 2019 21:43:14 GMT\"0x8D72812E722EF08\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "87f695b9-19fe-4d51-a2e6-0696e9064c9f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadatad5a81869b0f9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea2c7-201e-00c4-5bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "0893f8c6-e326-4ee5-9ece-c791b7193efa" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopymetadata0blobapitestsynccopymetadatad5a81869b0f9", "javablobsynccopymetadata1blobapitestsynccopymetadatad5a405931", "javablobsynccopymetadata2blobapitestsynccopymetadatad5a534068" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[1].json new file mode 100644 index 000000000000..d6867c1bc7e3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[1].json @@ -0,0 +1,168 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata011752214fba?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E73DB961\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea2dc-201e-00c4-6efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "2178a0da-fd2e-4b25-8f31-6caf4d5f3b0e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata011752214fba/javablobsynccopymetadata1blobapitestsynccopymetadata011940408", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E743499E\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea2f1-201e-00c4-7efb-594fb0000000", + "x-ms-client-request-id" : "3079eeac-27bb-4b93-9122-4e70332aa7f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata011752214fba?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E748A884\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea300-201e-00c4-0dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "f8f7ce67-34f4-469c-9f02-d6188fe85f9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata011752214fba/javablobsynccopymetadata2blobapitestsynccopymetadata011590396", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "8cd2d3fe-2f4d-4ff1-84d4-82ca7afb5557", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "ETag" : "\"0x8D72812E75E8FDC\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea30a-201e-00c4-17fb-594fb0000000", + "x-ms-client-request-id" : "30194873-25c1-4b6b-8ba9-5922dc1c5c4d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata011752214fba/javablobsynccopymetadata2blobapitestsynccopymetadata011590396", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51ea351-201e-00c4-55fb-594fb0000000", + "x-ms-meta-fizz" : "buzz", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "8cd2d3fe-2f4d-4ff1-84d4-82ca7afb5557", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata011752214fba/javablobsynccopymetadata1blobapitestsynccopymetadata011940408", + "x-ms-copy-progress" : "7/7", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-meta-foo" : "bar", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:43:15 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72812E75E8FDC\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "4c371dc9-e3d8-429d-9e3f-35a7917d88b1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopymetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea35d-201e-00c4-5efb-594fb0000000", + "Body" : "jtcsynccopymetadatajtcsynccopymetadata0blobapitestsynccopymetadata011752214fbaFri, 23 Aug 2019 21:43:15 GMT\"0x8D72812E748A884\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "cb4f2488-14dc-4729-af9e-081083f48364", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata011752214fba?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea366-201e-00c4-66fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "dbacfee8-5d89-478d-8e5a-5f5b675a985b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopymetadata0blobapitestsynccopymetadata011752214fba", "javablobsynccopymetadata1blobapitestsynccopymetadata011940408", "javablobsynccopymetadata2blobapitestsynccopymetadata011590396" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymin.json new file mode 100644 index 000000000000..8e10098fdf0a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymin.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymin6b2525050da244835?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E6F44263\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea1f4-201e-00c4-27fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "f47f9841-d41f-41d5-9251-551f091d3d24" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymin6b2525050da244835/javablobsynccopymin1blobapitestsynccopymin6b222181f03a44", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E6F9F99D\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea209-201e-00c4-3afb-594fb0000000", + "x-ms-client-request-id" : "84094363-1048-4574-8f39-23e2c27ab680" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymin6b2525050da244835?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E6FE957D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea212-201e-00c4-41fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "d7aa7425-1a05-40f2-8aff-92a5d501ba72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymin6b2525050da244835/javablobsynccopymin2blobapitestsynccopymin6b244212869148", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "eee85955-3fb2-47b5-8241-c568fd08f1a2", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:14 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "ETag" : "\"0x8D72812E709A457\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea21a-201e-00c4-48fb-594fb0000000", + "x-ms-client-request-id" : "cdc838bb-ae8d-48c5-a27b-863a3abd0b30" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopymin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea24d-201e-00c4-73fb-594fb0000000", + "Body" : "jtcsynccopyminjtcsynccopymin0blobapitestsynccopymin6b2525050da244835Fri, 23 Aug 2019 21:43:14 GMT\"0x8D72812E6FE957D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "a1d94150-7fa9-42be-b2bc-554745152a97", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymin6b2525050da244835?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea25e-201e-00c4-7efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:14 GMT", + "x-ms-client-request-id" : "a1d121f4-846e-4cb2-ae12-470cf4ee6051" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopymin0blobapitestsynccopymin6b2525050da244835", "javablobsynccopymin1blobapitestsynccopymin6b222181f03a44", "javablobsynccopymin2blobapitestsynccopymin6b244212869148" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[0].json new file mode 100644 index 000000000000..f900fe42e89f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[0].json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacc3c473191cd4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E772B8FB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea382-201e-00c4-7afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "bbcd2752-54a9-40f3-b7f7-5d300ee54cc2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacc3c473191cd4/javablobsynccopysourceac1blobapitestsynccopysourceacc3c80285f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E777D40A\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea39a-201e-00c4-10fb-594fb0000000", + "x-ms-client-request-id" : "df59a017-afb7-4376-874e-f81207b9dbc2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacc3c473191cd4?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E77C9632\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea3ac-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "3b61d087-1e39-45f6-bd6e-e3fadb995b3c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacc3c473191cd4/javablobsynccopysourceac2blobapitestsynccopysourceacc3c30594c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "791cee38-8b21-4cf3-82a1-50d60c60c42f", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "ETag" : "\"0x8D72812E7842264\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea3bc-201e-00c4-2cfb-594fb0000000", + "x-ms-client-request-id" : "ac65c589-ac2c-4749-99b1-7cb615dd2b76" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopysourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea3cf-201e-00c4-3dfb-594fb0000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceacc3c473191cd4Fri, 23 Aug 2019 21:43:15 GMT\"0x8D72812E77C9632\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "37aa0a30-7476-4838-9d1a-e468a5f1ef50", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacc3c473191cd4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea3d6-201e-00c4-42fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "d3099301-865e-4c68-bc73-cb37c9ff7c02" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceacc3c473191cd4", "javablobsynccopysourceac1blobapitestsynccopysourceacc3c80285f", "javablobsynccopysourceac2blobapitestsynccopysourceacc3c30594c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[1].json new file mode 100644 index 000000000000..b951c16f0123 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[1].json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac5f50404313c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E7934148\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea3eb-201e-00c4-56fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "820f8c5a-c2cc-4077-ad18-2246bc81f57a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac5f50404313c6/javablobsynccopysourceac1blobapitestsynccopysourceac5f508584f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E798AA83\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea3fe-201e-00c4-65fb-594fb0000000", + "x-ms-client-request-id" : "5df3e798-6fcd-42f8-92e4-6fa5aec8b657" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac5f50404313c6?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E79D6C7E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea40f-201e-00c4-76fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "552e44da-634c-40c6-b91f-cf7767a85159" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac5f50404313c6/javablobsynccopysourceac2blobapitestsynccopysourceac5f5321021", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d0166ba7-8f99-4d47-9fd6-af202f425a6d", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "ETag" : "\"0x8D72812E7A79182\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea41c-201e-00c4-03fb-594fb0000000", + "x-ms-client-request-id" : "c87c24a8-75e5-48e7-9848-9afff7acdbfa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopysourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea445-201e-00c4-2afb-594fb0000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceac5f50404313c6Fri, 23 Aug 2019 21:43:15 GMT\"0x8D72812E79D6C7E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "eb1a35d7-94c6-4f53-8d94-34093494fea0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac5f50404313c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea44d-201e-00c4-31fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "f8484175-65bf-4636-8e03-bcf92a600dbf" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceac5f50404313c6", "javablobsynccopysourceac1blobapitestsynccopysourceac5f508584f", "javablobsynccopysourceac2blobapitestsynccopysourceac5f5321021" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[2].json new file mode 100644 index 000000000000..99dc284a34ec --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[2].json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac695084869a31?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E7B773E7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea45b-201e-00c4-3dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "4876ac1e-6548-4ffc-8c3b-3452c9eb1194" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac695084869a31/javablobsynccopysourceac1blobapitestsynccopysourceac69520517c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E7BD0451\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea46b-201e-00c4-49fb-594fb0000000", + "x-ms-client-request-id" : "2d3fbfe4-37e0-4cf5-ad80-2261cbaf4711" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac695084869a31?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E7C19EEE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea481-201e-00c4-5efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "f64cd53f-1601-47e9-b1d7-6b6becbe0477" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac695084869a31/javablobsynccopysourceac2blobapitestsynccopysourceac695614202", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "dfb68b64-c9bb-4ed4-a5e3-9e81a4952b70", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:15 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "ETag" : "\"0x8D72812E7C95296\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea48b-201e-00c4-68fb-594fb0000000", + "x-ms-client-request-id" : "9a7ce81a-c601-431b-814a-2d3c48f8b51d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopysourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea49c-201e-00c4-77fb-594fb0000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceac695084869a31Fri, 23 Aug 2019 21:43:15 GMT\"0x8D72812E7C19EEE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "aae5a880-7af2-4896-88bf-9476cc8d14f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac695084869a31?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea4ad-201e-00c4-06fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:15 GMT", + "x-ms-client-request-id" : "822a1038-7074-45f4-8fe9-cf232438f4ce" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceac695084869a31", "javablobsynccopysourceac1blobapitestsynccopysourceac69520517c", "javablobsynccopysourceac2blobapitestsynccopysourceac695614202" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[3].json new file mode 100644 index 000000000000..70d56c03f8ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[3].json @@ -0,0 +1,161 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac89e29644999d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E7D8E6C9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea4b9-201e-00c4-11fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "ec6ba3e4-0f04-4179-915b-a9bafc4e2b0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac89e29644999d/javablobsynccopysourceac1blobapitestsynccopysourceac89e077997", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E7DEC568\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea4cf-201e-00c4-23fb-594fb0000000", + "x-ms-client-request-id" : "523627f9-c0d0-4242-8983-a865d1e6f210" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac89e29644999d?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E7E534FD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea4db-201e-00c4-2efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "076ed50f-e018-4baf-a101-c07366f878e6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac89e29644999d/javablobsynccopysourceac1blobapitestsynccopysourceac89e077997", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812E7DEC568\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:16 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51ea4f3-201e-00c4-42fb-594fb0000000", + "x-ms-client-request-id" : "b7782507-9ed9-4f0e-a48d-87a83948779f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac89e29644999d/javablobsynccopysourceac2blobapitestsynccopysourceac89e088314", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "aaed4433-ba90-40cc-bb99-3b5c570d9c60", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "ETag" : "\"0x8D72812E7F0BA55\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea503-201e-00c4-51fb-594fb0000000", + "x-ms-client-request-id" : "45430fec-1772-4f19-83b1-dec707338f4e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopysourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea520-201e-00c4-6cfb-594fb0000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceac89e29644999dFri, 23 Aug 2019 21:43:16 GMT\"0x8D72812E7E534FD\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "d9037a12-8519-41b0-b566-81be9217fe5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac89e29644999d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea531-201e-00c4-7afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "9331f4ab-510c-46e6-8710-caac6a9bdd21" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceac89e29644999d", "javablobsynccopysourceac1blobapitestsynccopysourceac89e077997", "javablobsynccopysourceac2blobapitestsynccopysourceac89e088314" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[4].json new file mode 100644 index 000000000000..d6248afe35a5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[4].json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacde6192891b94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E8009CB6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea545-201e-00c4-0dfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "9b889299-75d1-4e72-a81e-7bd6b8782f69" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacde6192891b94/javablobsynccopysourceac1blobapitestsynccopysourceacde6407534", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E805DEFE\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea55a-201e-00c4-1bfb-594fb0000000", + "x-ms-client-request-id" : "d2183b19-0bd3-44d5-8a91-a27ffe022b9d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacde6192891b94?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E80A7926\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea564-201e-00c4-23fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "2a4643a0-13f1-4655-9cb3-d312b72dfffc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacde6192891b94/javablobsynccopysourceac2blobapitestsynccopysourceacde621837a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "75deca9c-58c4-4671-b2e0-b1ed8f9e5a0a", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "ETag" : "\"0x8D72812E830B928\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "d51ea570-201e-00c4-2dfb-594fb0000000", + "x-ms-client-request-id" : "1564055e-f160-46f9-b455-63b3776585c4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopysourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea5da-201e-00c4-07fb-594fb0000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceacde6192891b94Fri, 23 Aug 2019 21:43:16 GMT\"0x8D72812E80A7926\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "246c2e64-a042-4820-a53f-94974520f3e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacde6192891b94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea5e7-201e-00c4-11fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "718bc92a-7db0-4a52-811b-7f12f6c8c877" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceacde6192891b94", "javablobsynccopysourceac1blobapitestsynccopysourceacde6407534", "javablobsynccopysourceac2blobapitestsynccopysourceacde621837a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[0].json new file mode 100644 index 000000000000..6a32192de787 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[0].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail079788ee2801c9ba7747da9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E83FD802\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea5ff-201e-00c4-25fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "3bbdeae1-f1e7-4f07-ab1a-a7ba437dce37" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail079788ee2801c9ba7747da9/javablobsynccopysourceacfail1110088d8ee882d5c441", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E8451A73\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea608-201e-00c4-2dfb-594fb0000000", + "x-ms-client-request-id" : "4cb56c37-6627-49af-8503-852e9748b6f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail079788ee2801c9ba7747da9?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E849DB43\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea618-201e-00c4-3bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "0433340a-a753-4a8f-bb4d-241930b77ee6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail079788ee2801c9ba7747da9/javablobsynccopysourceacfail2085072e86b080f77e49", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "d51ea629-201e-00c4-4afb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "4c76a5a5-b1bb-4a46-9d83-b8c939651bb1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopysourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea636-201e-00c4-56fb-594fb0000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail079788ee2801c9ba7747da9Fri, 23 Aug 2019 21:43:16 GMT\"0x8D72812E849DB43\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "c63d4bd7-b205-4dc1-84e9-ced18be712d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail079788ee2801c9ba7747da9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea645-201e-00c4-60fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "19d9d2cb-23dd-481f-851e-206e24a48215" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail079788ee2801c9ba7747da9", "javablobsynccopysourceacfail1110088d8ee882d5c441", "javablobsynccopysourceacfail2085072e86b080f77e49" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[1].json new file mode 100644 index 000000000000..6220c55e658f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail05577536efae65e8ac4517b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E85FC3DF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea654-201e-00c4-6bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "5ddc0d99-2e48-4887-8231-3275da6ae48d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail05577536efae65e8ac4517b/javablobsynccopysourceacfail181572d810c7c882aa4c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E8652D74\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea661-201e-00c4-75fb-594fb0000000", + "x-ms-client-request-id" : "130418b9-5193-49fa-854e-7186397ab44b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail05577536efae65e8ac4517b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E869C6EE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea66d-201e-00c4-7efb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:16 GMT", + "x-ms-client-request-id" : "e0cf6a68-d77e-4763-aed3-d06b26ae80da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail05577536efae65e8ac4517b/javablobsynccopysourceacfail288311ee8200da9a354e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "259", + "StatusCode" : "412", + "x-ms-request-id" : "d51ea680-201e-00c4-0dfb-594fb0000000", + "Body" : "CannotVerifyCopySourceThe condition specified using HTTP conditional header(s) is not met.\nRequestId:d51ea680-201e-00c4-0dfb-594fb0000000\nTime:2019-08-23T21:43:17.0358057Z", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "cf864282-5111-432a-9a24-8a3aa4cdaaf7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopysourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea698-201e-00c4-21fb-594fb0000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail05577536efae65e8ac4517bFri, 23 Aug 2019 21:43:16 GMT\"0x8D72812E869C6EE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "42a1e8d9-1866-4cfa-911a-b3be7c7150c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail05577536efae65e8ac4517b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea6ad-201e-00c4-34fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "dab5cdfc-0a3f-4f7d-bd19-082175244d34" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail05577536efae65e8ac4517b", "javablobsynccopysourceacfail181572d810c7c882aa4c", "javablobsynccopysourceacfail288311ee8200da9a354e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[2].json new file mode 100644 index 000000000000..e5847a9a8420 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail00636371ba313329ee4a809?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E87EC524\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea6ba-201e-00c4-3ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "daa89718-63e6-417a-a357-e1a6b6607f86" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail00636371ba313329ee4a809/javablobsynccopysourceacfail149285a8314f26172345", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E88407A7\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea6d0-201e-00c4-50fb-594fb0000000", + "x-ms-client-request-id" : "95556454-4403-4c99-89ba-a718178a29a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail00636371ba313329ee4a809?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E888C805\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea6e6-201e-00c4-61fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "24a21e85-41af-49ea-adfc-defc731102d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail00636371ba313329ee4a809/javablobsynccopysourceacfail2085045ba3a0a0533d4e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "d51ea6f4-201e-00c4-6dfb-594fb0000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:d51ea6f4-201e-00c4-6dfb-594fb0000000\nTime:2019-08-23T21:43:17.2289906Z", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "54b192b5-d7a5-4a12-acce-fd67f738f7a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopysourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea6fd-201e-00c4-74fb-594fb0000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail00636371ba313329ee4a809Fri, 23 Aug 2019 21:43:17 GMT\"0x8D72812E888C805\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "7d508eb5-b276-424f-9462-6a8d64488085", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail00636371ba313329ee4a809?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea718-201e-00c4-0bfb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "ad33e3a8-dcf0-4172-a702-efcfb9c313d8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail00636371ba313329ee4a809", "javablobsynccopysourceacfail149285a8314f26172345", "javablobsynccopysourceacfail2085045ba3a0a0533d4e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[3].json new file mode 100644 index 000000000000..b67f340cc8ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[3].json @@ -0,0 +1,156 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail057516e1e1a70f97794529a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E8A010F3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ea734-201e-00c4-1ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "2a12efd0-a787-4156-8346-defb568874af" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail057516e1e1a70f97794529a/javablobsynccopysourceacfail15067922201a736af049", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812E8A5536B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ea74b-201e-00c4-31fb-594fb0000000", + "x-ms-client-request-id" : "a4bb7588-fc57-48f6-8196-f42f86a15e26" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail057516e1e1a70f97794529a?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812E8AA139F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51ea761-201e-00c4-44fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "42d42b5e-bcc2-4dcb-b251-ccf4e7a53789" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail057516e1e1a70f97794529a/javablobsynccopysourceacfail15067922201a736af049", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812E8A5536B\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:17 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51ea78f-201e-00c4-69fb-594fb0000000", + "x-ms-client-request-id" : "406e753d-3f2b-4486-9fa1-7a4722b9843a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail057516e1e1a70f97794529a/javablobsynccopysourceacfail2682742bb745584ac54d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "d51ea79d-201e-00c4-75fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "c697c529-ff12-413f-b807-9b34387e4e22" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsynccopysourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea7a7-201e-00c4-7dfb-594fb0000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail057516e1e1a70f97794529aFri, 23 Aug 2019 21:43:17 GMT\"0x8D72812E8AA139F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "ec2d0205-c5c4-4ad8-8783-957f9900c807", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsynccopysourceacfail057516e1e1a70f97794529a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51ea7b3-201e-00c4-06fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:17 GMT", + "x-ms-client-request-id" : "bca39367-cfa2-413e-9ddf-e60ca020531f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail057516e1e1a70f97794529a", "javablobsynccopysourceacfail15067922201a736af049", "javablobsynccopysourceacfail2682742bb745584ac54d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundelete.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundelete.json new file mode 100644 index 000000000000..1740c5cace12 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundelete.json @@ -0,0 +1,192 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete26288862f498b9a1e85c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72812F104E00F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51ec6f7-201e-00c4-03fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "5ef83930-e38e-462e-88e3-e819419c2ba9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete26288862f498b9a1e85c/javablobundelete1blobapitestundelete26291852f6e9fd26a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72812F10AE95B\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51ec70a-201e-00c4-15fb-594fb0000000", + "x-ms-client-request-id" : "17b0b53e-489c-4db9-b3d3-13b5651de9ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "d51ec72f-201e-00c4-39fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:43:31 GMT", + "x-ms-client-request-id" : "7f32ffce-09ca-42e2-a225-bd6ab336490a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete26288862f498b9a1e85c/javablobundelete1blobapitestundelete26291852f6e9fd26a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "false", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51f0668-201e-00c4-57fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:44:01 GMT", + "x-ms-client-request-id" : "fdc46208-6282-4c32-ad98-3cd7e009f3ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete26288862f498b9a1e85c/javablobundelete1blobapitestundelete26291852f6e9fd26a?comp=undelete", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51f0685-201e-00c4-6ffb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:44:01 GMT", + "x-ms-client-request-id" : "6d0c17b5-252c-49f6-9b66-b832798de5d2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete26288862f498b9a1e85c/javablobundelete1blobapitestundelete26291852f6e9fd26a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:43:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:44:01 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72812F10AE95B\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:43:31 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d51f06ae-201e-00c4-0dfb-594fb0000000", + "x-ms-client-request-id" : "205f623b-c068-4324-9974-9d91aa8b1baf", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "d51f06b9-201e-00c4-17fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:44:01 GMT", + "x-ms-client-request-id" : "0d68e8ac-d771-48d5-a61c-292871347333" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcundelete&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f4792-201e-00c4-64fb-594fb0000000", + "Body" : "jtcundeletejtcundelete0blobapitestundelete26288862f498b9a1e85cFri, 23 Aug 2019 21:43:31 GMT\"0x8D72812F104E00F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:44:31 GMT", + "x-ms-client-request-id" : "de9773cf-29b7-4cab-8967-4d507c0a218f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundelete0blobapitestundelete26288862f498b9a1e85c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f47ab-201e-00c4-78fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:44:31 GMT", + "x-ms-client-request-id" : "f400be3a-77f4-4262-9821-96d6884e6f1c" + }, + "Exception" : null + } ], + "variables" : [ "jtcundelete0blobapitestundelete26288862f498b9a1e85c", "javablobundelete1blobapitestundelete26291852f6e9fd26a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeleteerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeleteerror.json new file mode 100644 index 000000000000..f2cb4313330c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeleteerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrord87106115f01ea3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813272FB69F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f8241-201e-00c4-6ffc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "63e6203c-1dc1-4338-ba75-fd42a4f3f768" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrord87106115f01ea3/javablobundeleteerror1blobapitestundeleteerrord8759561fb6e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132735867C\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51f8253-201e-00c4-7ffc-594fb0000000", + "x-ms-client-request-id" : "5515c428-3595-48a5-94fb-1964142a82d1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrord87106115f01ea3/javablobundeleteerror2blobapitestundeleteerrord8715978a32f?comp=undelete", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f825e-201e-00c4-09fc-594fb0000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:d51f825e-201e-00c4-09fc-594fb0000000\nTime:2019-08-23T21:45:02.3863242Z", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "e5791ed0-139d-4762-8c66-6d297cd7c76c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcundeleteerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f8273-201e-00c4-1dfc-594fb0000000", + "Body" : "jtcundeleteerrorjtcundeleteerror0blobapitestundeleteerrord87106115f01ea3Fri, 23 Aug 2019 21:45:02 GMT\"0x8D72813272FB69F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "6df12121-14ed-497d-ab18-ea9e710668dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrord87106115f01ea3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f8287-201e-00c4-2dfc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "3f6db4e1-8c8c-4fc6-b146-f0acf481ab4f" + }, + "Exception" : null + } ], + "variables" : [ "jtcundeleteerror0blobapitestundeleteerrord87106115f01ea3", "javablobundeleteerror1blobapitestundeleteerrord8759561fb6e", "javablobundeleteerror2blobapitestundeleteerrord8715978a32f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeletemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeletemin.json new file mode 100644 index 000000000000..340970760c2a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeletemin.json @@ -0,0 +1,142 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeletemin0blobapitestundeleteminaba3631391824b377?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813151B461C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:44:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f47cb-201e-00c4-15fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:44:31 GMT", + "x-ms-client-request-id" : "68a3986f-ecb7-46a4-abb8-499c3649fa70" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeletemin0blobapitestundeleteminaba3631391824b377/javablobundeletemin1blobapitestundeleteminaba02152f18585", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:44:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:44:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728131520E7F9\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51f47e1-201e-00c4-2afb-594fb0000000", + "x-ms-client-request-id" : "2a4da3cc-904d-4fe7-b635-d1bd7ea1250c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "d51f47ff-201e-00c4-43fb-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:44:31 GMT", + "x-ms-client-request-id" : "b65820b5-275d-455a-bb42-de701d3cb5e1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeletemin0blobapitestundeleteminaba3631391824b377/javablobundeletemin1blobapitestundeleteminaba02152f18585", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "false", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d51f81b0-201e-00c4-73fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "66e7f9b5-11bc-4e30-998a-de1bb22cd996" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeletemin0blobapitestundeleteminaba3631391824b377/javablobundeletemin1blobapitestundeleteminaba02152f18585?comp=undelete", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d51f8204-201e-00c4-3bfc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "3fa5877a-400e-4583-8e51-8607ccefdc5a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcundeletemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f821a-201e-00c4-4efc-594fb0000000", + "Body" : "jtcundeleteminjtcundeletemin0blobapitestundeleteminaba3631391824b377Fri, 23 Aug 2019 21:44:31 GMT\"0x8D72813151B461C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "95f1c122-14ba-4a53-b861-4aa069399643", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcundeletemin0blobapitestundeleteminaba3631391824b377?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f8226-201e-00c4-5afc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "db33562e-8993-41f4-9a0d-e6fee68176f4" + }, + "Exception" : null + } ], + "variables" : [ "jtcundeletemin0blobapitestundeleteminaba3631391824b377", "javablobundeletemin1blobapitestundeleteminaba02152f18585" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklist.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklist.json new file mode 100644 index 000000000000..59fb3c4ad027 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklist.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist6ca1212931?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132CEA1AC3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b3a6-801e-0123-15fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "97c2d60f-6046-4173-87a7-e18091487cfb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist6ca1212931/javablobcommitblocklist125623ccb230d120d64de1b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132CF08A5B\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b3ba-801e-0123-24fc-5919e8000000", + "x-ms-client-request-id" : "2f4e6f84-dbfa-4c0a-ad89-0028a2c68f76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist6ca1212931/javablobcommitblocklist125623ccb230d120d64de1b?blockid=ZTY0ZmQ3MzItMTAyNS00OGJkLThiODgtMTJlODY4MWRiMjMx&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b3cc-801e-0123-35fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "cc44dbe1-cf1b-4cd5-973e-11003550c520" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist6ca1212931/javablobcommitblocklist125623ccb230d120d64de1b?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132CFB626E\"", + "x-ms-content-crc64" : "JKucbA5LDtc=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b3ea-801e-0123-4dfc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "e8494d92-e916-4629-be35-c080022ab7ff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklist&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b3fc-801e-0123-5efc-5919e8000000", + "Body" : "jtccommitblocklistjtccommitblocklist0blockblobapitestcommitblocklist6ca1212931Fri, 23 Aug 2019 21:45:11 GMT\"0x8D728132CEA1AC3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "00348368-92b2-4cf4-b649-f370b5734a52", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist6ca1212931?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b40c-801e-0123-67fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "e4c3e81c-ddca-44ce-97f1-7e1f01d71189" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklist0blockblobapitestcommitblocklist6ca1212931", "javablobcommitblocklist125623ccb230d120d64de1b", "e64fd732-1025-48bd-8b88-12e8681db231" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[0].json new file mode 100644 index 000000000000..62ce0c897437 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac4f405092?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132DF0CB29\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b650-801e-0123-4cfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "f6d36b43-6bb7-4866-be3f-bff4f23ccae2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac4f405092/javablobcommitblocklistac1277302e56605f1b844191", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132DF6A1F8\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b65d-801e-0123-58fc-5919e8000000", + "x-ms-client-request-id" : "d284909f-107c-4292-bd3e-b22b71914b62" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac4f405092/javablobcommitblocklistac1277302e56605f1b844191?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132DFBFA76\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b665-801e-0123-60fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "2736e342-82a5-48b9-90e1-339254b657ad" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b66a-801e-0123-64fc-5919e8000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac4f405092Fri, 23 Aug 2019 21:45:13 GMT\"0x8D728132DF0CB29\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "3d8a4eb5-bfdd-427c-bd10-ed3b74516707", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac4f405092?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b66f-801e-0123-69fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "0753fd17-e87a-4a18-843b-1d003f1751e2" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac4f405092", "javablobcommitblocklistac1277302e56605f1b844191" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[1].json new file mode 100644 index 000000000000..4ce8a505b026 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac5b124149?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132E1ACB0A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b682-801e-0123-78fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "03f3b523-31df-43a7-aeed-69d9f6ad232e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac5b124149/javablobcommitblocklistac187679ec5f025030bd4a14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132E20C985\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b68e-801e-0123-02fc-5919e8000000", + "x-ms-client-request-id" : "bda9ebef-f3f1-4c1c-a926-87477c719813" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac5b124149/javablobcommitblocklistac187679ec5f025030bd4a14?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132E26703A\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b69b-801e-0123-0afc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "2018a291-1180-47cf-b87f-a6921825f626" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b6b0-801e-0123-1bfc-5919e8000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac5b124149Fri, 23 Aug 2019 21:45:13 GMT\"0x8D728132E1ACB0A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "1ff0b436-9107-4b57-bddf-c19b2fea232b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac5b124149?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b6b7-801e-0123-22fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "588d9249-f2a3-407f-aefc-054ec3d96313" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac5b124149", "javablobcommitblocklistac187679ec5f025030bd4a14" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[2].json new file mode 100644 index 000000000000..b595c09f443b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac47979406?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132E44CAF4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b6c1-801e-0123-2cfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "41ce1a4a-e0e4-4e35-a224-11b5e2bd6fe5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac47979406/javablobcommitblocklistac1122549b5d296f9fca4745", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132E4AF12D\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b6c8-801e-0123-31fc-5919e8000000", + "x-ms-client-request-id" : "c8de8a1f-7107-4757-8995-771fb0110d5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac47979406/javablobcommitblocklistac1122549b5d296f9fca4745?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132E515B57\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b6cc-801e-0123-35fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "38617e1e-54ab-4b19-b1e2-84bac8c54ccc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b6d0-801e-0123-39fc-5919e8000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac47979406Fri, 23 Aug 2019 21:45:14 GMT\"0x8D728132E44CAF4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "da0c104d-ee49-410d-bd61-e617dd932c7e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac47979406?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b6d7-801e-0123-3ffc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "042c3bee-99d3-4e5a-90c1-679ce4b1c243" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac47979406", "javablobcommitblocklistac1122549b5d296f9fca4745" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[3].json new file mode 100644 index 000000000000..0ac13937da7b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[3].json @@ -0,0 +1,140 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacd4999530?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132E632F62\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b6e2-801e-0123-45fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "95e462a3-3eea-4448-bff4-d96bcced9701" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacd4999530/javablobcommitblocklistac1129141d89ca8f536a4db9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132E68E0C2\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b6ed-801e-0123-4efc-5919e8000000", + "x-ms-client-request-id" : "92d36f11-b01b-4dc6-93bd-5a33b7dfb515" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacd4999530/javablobcommitblocklistac1129141d89ca8f536a4db9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D728132E68E0C2\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ad97b6f5-801e-0123-54fc-5919e8000000", + "x-ms-client-request-id" : "85fb0f17-4bb4-4071-bb92-785222c426f8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacd4999530/javablobcommitblocklistac1129141d89ca8f536a4db9?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132E747C57\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b6f7-801e-0123-56fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "8f708134-552b-405a-be91-161c323090ad" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b6fe-801e-0123-5afc-5919e8000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistacd4999530Fri, 23 Aug 2019 21:45:14 GMT\"0x8D728132E632F62\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "822998da-3884-4fbd-81be-4c8877311189", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacd4999530?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b703-801e-0123-5dfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "3e6a7ee2-36ac-497d-b33e-bee5048b69a4" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistacd4999530", "javablobcommitblocklistac1129141d89ca8f536a4db9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[4].json new file mode 100644 index 000000000000..98c5148509d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[4].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac29d40089?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132E84539C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b708-801e-0123-62fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "397ad32b-a001-4c6f-aeca-8015107966d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac29d40089/javablobcommitblocklistac122216bf2bf72f59c14f65", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132E8A2C8B\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b713-801e-0123-6afc-5919e8000000", + "x-ms-client-request-id" : "207c0e1f-5952-4e34-ab3b-37e107b4116c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac29d40089/javablobcommitblocklistac122216bf2bf72f59c14f65?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132E8F8509\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b717-801e-0123-6efc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "0859f5c8-2a76-49ff-91f7-dbab7c0c0dc7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b722-801e-0123-75fc-5919e8000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac29d40089Fri, 23 Aug 2019 21:45:14 GMT\"0x8D728132E84539C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "121d7fe0-6925-40e0-a9fd-4113550a60e4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac29d40089?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b727-801e-0123-7afc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:13 GMT", + "x-ms-client-request-id" : "5e1852da-5ef7-4660-b6bf-bbee874f61ed" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac29d40089", "javablobcommitblocklistac122216bf2bf72f59c14f65" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[5].json new file mode 100644 index 000000000000..ce65bc50849b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[5].json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac62425802?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132E9EBF88\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b72d-801e-0123-7ffc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:14 GMT", + "x-ms-client-request-id" : "b4ec5794-9b53-4245-837b-b9f07c525f7b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac62425802/javablobcommitblocklistac186456512d10f4e9b94fa4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132EA44AA7\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b736-801e-0123-05fc-5919e8000000", + "x-ms-client-request-id" : "83997fd0-5907-4f93-9a1f-ac118c94bddc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac62425802/javablobcommitblocklistac186456512d10f4e9b94fa4?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132EA44AA7\"", + "x-ms-lease-id" : "6e8712b9-951c-438c-943e-8dc310491143", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b744-801e-0123-11fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:14 GMT", + "x-ms-client-request-id" : "cfaac227-6da5-462d-810f-0b2351134c39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac62425802/javablobcommitblocklistac186456512d10f4e9b94fa4?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132EAF70F2\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b74e-801e-0123-1bfc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:14 GMT", + "x-ms-client-request-id" : "83c648c4-cb63-41e2-ba78-55ce1e699ca9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b773-801e-0123-3efc-5919e8000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac62425802Fri, 23 Aug 2019 21:45:14 GMT\"0x8D728132E9EBF88\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:14 GMT", + "x-ms-client-request-id" : "e9adb6e0-f353-40f0-abb2-1c88b1f728d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac62425802?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b776-801e-0123-41fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:14 GMT", + "x-ms-client-request-id" : "a3b199d5-20ae-4b1e-b337-7a1f8ed39ca8" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac62425802", "javablobcommitblocklistac186456512d10f4e9b94fa4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[0].json new file mode 100644 index 000000000000..a3c06f0ece65 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail003025eb0b648886a64740?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132ED8EFC6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b785-801e-0123-4cfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:14 GMT", + "x-ms-client-request-id" : "f8fdc7c5-08d7-41b3-98d2-611976467572" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail003025eb0b648886a64740/javablobcommitblocklistacfail17266225f8860f999148", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132EDF8D7A\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b78d-801e-0123-52fc-5919e8000000", + "x-ms-client-request-id" : "5edc0dbb-f36b-4220-8b63-742f6cacce21" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail003025eb0b648886a64740/javablobcommitblocklistacfail17266225f8860f999148?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "ad97b797-801e-0123-5cfc-5919e8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ad97b797-801e-0123-5cfc-5919e8000000\nTime:2019-08-23T21:45:15.2534058Z", + "Date" : "Fri, 23 Aug 2019 21:45:14 GMT", + "x-ms-client-request-id" : "c24419c7-29df-46c1-95cc-343edb7a406a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca225-301e-0118-1cfc-595bb6000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail003025eb0b648886a64740Fri, 23 Aug 2019 21:45:15 GMT\"0x8D728132ED8EFC6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "d1ca7e80-32a2-4d95-8358-89fd17755878", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail003025eb0b648886a64740?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca23c-301e-0118-30fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "b717092e-b578-4465-8892-1ffd05035820" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail003025eb0b648886a64740", "javablobcommitblocklistacfail17266225f8860f999148" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[1].json new file mode 100644 index 000000000000..369cba85e467 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[1].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail017164ec39fa61c94e4499?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132F023A83\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca252-301e-0118-43fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "5b00599c-d638-442f-ae78-adbb554c87dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail017164ec39fa61c94e4499/javablobcommitblocklistacfail15606791f9844609b34a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132F0791A9\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3ca26f-301e-0118-57fc-595bb6000000", + "x-ms-client-request-id" : "95a25653-6a1d-4b73-bb27-04e583363961" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail017164ec39fa61c94e4499/javablobcommitblocklistacfail15606791f9844609b34a?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "0a3ca284-301e-0118-6afc-595bb6000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:0a3ca284-301e-0118-6afc-595bb6000000\nTime:2019-08-23T21:45:15.5090070Z", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "c27ae265-a604-441f-961c-16685b748921", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca299-301e-0118-7efc-595bb6000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail017164ec39fa61c94e4499Fri, 23 Aug 2019 21:45:15 GMT\"0x8D728132F023A83\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "fa10386c-a6bc-422c-a99e-5c597da6dca6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail017164ec39fa61c94e4499?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca2a9-301e-0118-0cfc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "e25029e5-a83d-4391-8be1-2d94eaa5fa82" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail017164ec39fa61c94e4499", "javablobcommitblocklistacfail15606791f9844609b34a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[2].json new file mode 100644 index 000000000000..3d7972cd62a1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[2].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail041781ba2a0ef8c4134c31?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132F1CA6D4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca2bb-301e-0118-1cfc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "9aa77b39-12e7-4b48-b35f-f934846d9519" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail041781ba2a0ef8c4134c31/javablobcommitblocklistacfail1102745c1629ed17a946", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132F21D6DC\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3ca2d1-301e-0118-2ffc-595bb6000000", + "x-ms-client-request-id" : "a8443dac-8886-40f0-9f09-353ea45550c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail041781ba2a0ef8c4134c31/javablobcommitblocklistacfail1102745c1629ed17a946?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "0a3ca2db-301e-0118-38fc-595bb6000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:0a3ca2db-301e-0118-38fc-595bb6000000\nTime:2019-08-23T21:45:15.6771698Z", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "10a88a0a-800a-403a-9d5f-cbcde343c53c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca2e9-301e-0118-44fc-595bb6000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail041781ba2a0ef8c4134c31Fri, 23 Aug 2019 21:45:15 GMT\"0x8D728132F1CA6D4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "7f2e12db-77f1-44f3-bae7-759ff962b930", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail041781ba2a0ef8c4134c31?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca2fc-301e-0118-53fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "dd6b8222-fee8-43a4-a37f-64aafd570f47" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail041781ba2a0ef8c4134c31", "javablobcommitblocklistacfail1102745c1629ed17a946" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[3].json new file mode 100644 index 000000000000..4479ec82c3d9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[3].json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail0562821c8b9b1954264793?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132F360181\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca30c-301e-0118-61fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "581c6907-6c6d-44bc-9112-c41d723b4846" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail0562821c8b9b1954264793/javablobcommitblocklistacfail1471745d532b7145a041", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132F3B0A5F\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3ca326-301e-0118-7afc-595bb6000000", + "x-ms-client-request-id" : "3f59ba41-bc38-4ba8-8381-50855dd6748a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail0562821c8b9b1954264793/javablobcommitblocklistacfail1471745d532b7145a041", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D728132F3B0A5F\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:15 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "0a3ca346-301e-0118-17fc-595bb6000000", + "x-ms-client-request-id" : "fa9ace47-a841-4772-a0e2-61c6e193a17a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail0562821c8b9b1954264793/javablobcommitblocklistacfail1471745d532b7145a041?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "0a3ca364-301e-0118-32fc-595bb6000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:0a3ca364-301e-0118-32fc-595bb6000000\nTime:2019-08-23T21:45:15.8963812Z", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "b908441c-14b2-4117-945e-d01cbb15cff4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca375-301e-0118-41fc-595bb6000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail0562821c8b9b1954264793Fri, 23 Aug 2019 21:45:15 GMT\"0x8D728132F360181\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "4acd8dc1-2329-4ec8-8de5-088c5635b600", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail0562821c8b9b1954264793?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca385-301e-0118-4dfc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "96b8d9c9-d511-45e1-ae5a-12c7210c816a" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail0562821c8b9b1954264793", "javablobcommitblocklistacfail1471745d532b7145a041" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[4].json new file mode 100644 index 000000000000..7f456823763b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[4].json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail04001752373c1ab3cc402d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132F5689CD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca39e-301e-0118-62fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "1df3bf16-4e56-41a4-a6b1-bdff911d14b8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail04001752373c1ab3cc402d/javablobcommitblocklistacfail18967083e0655402444d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132F5BE0E2\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3ca3b9-301e-0118-7bfc-595bb6000000", + "x-ms-client-request-id" : "3a4b5cd3-32ba-4bf6-b53c-dfb96518ec34" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail04001752373c1ab3cc402d/javablobcommitblocklistacfail18967083e0655402444d?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132F5BE0E2\"", + "x-ms-lease-id" : "bde21cf4-aa14-43f1-9e31-7c718aba87bf", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca3d2-301e-0118-12fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "e7c48aad-6621-465a-b31d-be261195c72b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail04001752373c1ab3cc402d/javablobcommitblocklistacfail18967083e0655402444d?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "0a3ca3ec-301e-0118-2bfc-595bb6000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:0a3ca3ec-301e-0118-2bfc-595bb6000000\nTime:2019-08-23T21:45:16.0935722Z", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "62385797-54a4-4e03-b036-d661d6e77a7c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca3fa-301e-0118-36fc-595bb6000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail04001752373c1ab3cc402dFri, 23 Aug 2019 21:45:15 GMT\"0x8D728132F5689CD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "8ba17367-9932-4ab1-95d6-d99c024d7457", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistacfail04001752373c1ab3cc402d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca40b-301e-0118-46fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "443968cb-bf0a-4dd6-9096-60ab9c7a812d" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail04001752373c1ab3cc402d", "javablobcommitblocklistacfail18967083e0655402444d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklisterror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklisterror.json new file mode 100644 index 000000000000..b801f10ef838 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklisterror.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklisterror052615630f3125713245fcb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132F898D63\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca474-301e-0118-21fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:15 GMT", + "x-ms-client-request-id" : "2d9d78be-d130-41a7-89dd-c0e1dd00ac2c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklisterror052615630f3125713245fcb/javablobcommitblocklisterror1474947be8f295f1b641", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132F8F0B5C\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3ca48b-301e-0118-35fc-595bb6000000", + "x-ms-client-request-id" : "09f72a49-e854-45a7-892d-ac43347065b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklisterror052615630f3125713245fcb/javablobcommitblocklisterror262343a3d1ef2b66e042?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "0a3ca4a4-301e-0118-4bfc-595bb6000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:0a3ca4a4-301e-0118-4bfc-595bb6000000\nTime:2019-08-23T21:45:18.6240211Zx-ms-lease-idgarbage", + "Date" : "Fri, 23 Aug 2019 21:45:18 GMT", + "x-ms-client-request-id" : "a5c5cabe-7d6d-4e3a-a992-717c6f014910", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklisterror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca685-301e-0118-4dfc-595bb6000000", + "Body" : "jtccommitblocklisterrorjtccommitblocklisterror052615630f3125713245fcbFri, 23 Aug 2019 21:45:16 GMT\"0x8D728132F898D63\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:18 GMT", + "x-ms-client-request-id" : "90217f9d-a2db-4456-abb3-7cfcae662b84", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklisterror052615630f3125713245fcb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca703-301e-0118-18fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:18 GMT", + "x-ms-client-request-id" : "c9475162-a41f-4a49-bbff-874732cc3f6b" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklisterror052615630f3125713245fcb", "javablobcommitblocklisterror1474947be8f295f1b641", "javablobcommitblocklisterror262343a3d1ef2b66e042" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[0].json new file mode 100644 index 000000000000..4a6c0de160e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[0].json @@ -0,0 +1,160 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders048061f27e72b2a8784dde?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132D4C9CDC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b4fb-801e-0123-35fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "5c9f4a7b-15b6-4348-9c00-068c8dbf2a57" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders048061f27e72b2a8784dde/javablobcommitblocklistheaders139386309c38aa6e154", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132D557F6F\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b511-801e-0123-48fc-5919e8000000", + "x-ms-client-request-id" : "054b1a8d-039f-45db-b543-213e4113980f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders048061f27e72b2a8784dde/javablobcommitblocklistheaders139386309c38aa6e154?blockid=MGVmOGU2OWYtODk3NS00NWRmLTgxZWMtMmQ4N2UyYzdjYjg4&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b51d-801e-0123-52fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "2fcfc9f0-97cc-4be3-96d2-67fde29f00ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders048061f27e72b2a8784dde/javablobcommitblocklistheaders139386309c38aa6e154?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132D5FE237\"", + "x-ms-content-crc64" : "QVqhYw2U7Bo=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b52f-801e-0123-62fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "9ea0d2ef-8213-47b5-aaba-753b790cad74" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders048061f27e72b2a8784dde/javablobcommitblocklistheaders139386309c38aa6e154", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D728132D5FE237\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:12 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ad97b542-801e-0123-72fc-5919e8000000", + "x-ms-client-request-id" : "e0c0c380-57c4-4e08-8ad7-75b6c55e571e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b54d-801e-0123-7bfc-5919e8000000", + "Body" : "jtccommitblocklistheadersjtccommitblocklistheaders048061f27e72b2a8784ddeFri, 23 Aug 2019 21:45:12 GMT\"0x8D728132D4C9CDC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "be6e6603-1aba-4f37-a4d2-33e03371c8b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders048061f27e72b2a8784dde?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b552-801e-0123-7ffc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "2f656c14-20d8-49e5-be40-b26fcb18e85c" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistheaders048061f27e72b2a8784dde", "javablobcommitblocklistheaders139386309c38aa6e154", "0ef8e69f-8975-45df-81ec-2d87e2c7cb88" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[1].json new file mode 100644 index 000000000000..60eb58704bb1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[1].json @@ -0,0 +1,165 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0031472720cdc7fa6a4130?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132D76006E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b55f-801e-0123-0afc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "1b2e6067-45e2-4e18-b915-bc6d7a220e03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0031472720cdc7fa6a4130/javablobcommitblocklistheaders190175a022c2fa52334", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132D7E9558\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b577-801e-0123-1efc-5919e8000000", + "x-ms-client-request-id" : "4cb69909-c160-4c99-b6d2-fdd1c39e71a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0031472720cdc7fa6a4130/javablobcommitblocklistheaders190175a022c2fa52334?blockid=NDA2ZmVhM2ItY2ExNS00Y2RmLWFkMTAtZjQyZDQ1NjJmZjM1&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b586-801e-0123-2cfc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "af340903-fe7a-4c15-9def-209de6196898" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0031472720cdc7fa6a4130/javablobcommitblocklistheaders190175a022c2fa52334?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132D8A30E9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b590-801e-0123-35fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "70a70992-18d4-461e-a8a0-4f1583748598", + "Content-MD5" : "nIgsZLgp7L1zP0bYT2lTVw==" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0031472720cdc7fa6a4130/javablobcommitblocklistheaders190175a022c2fa52334", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:12 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ad97b5a2-801e-0123-43fc-5919e8000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D728132D8A30E9\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "9df656ab-32c1-41eb-a7bc-f375221f5536", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b5ab-801e-0123-4afc-5919e8000000", + "Body" : "jtccommitblocklistheadersjtccommitblocklistheaders0031472720cdc7fa6a4130Fri, 23 Aug 2019 21:45:12 GMT\"0x8D728132D76006E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "2c4fd59e-5aa6-4b33-8d02-e1d551da8517", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistheaders0031472720cdc7fa6a4130?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b5bc-801e-0123-59fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "688b7fe2-c2c4-4985-91be-205e58ff8e2c" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistheaders0031472720cdc7fa6a4130", "javablobcommitblocklistheaders190175a022c2fa52334", "406fea3b-ca15-4cdf-ad10-f42d4562ff35" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[0].json new file mode 100644 index 000000000000..a8739f22a5df --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[0].json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata063865453ddcef92e3483?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132DA531E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b5cd-801e-0123-69fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "20e3a0f6-f9a3-4345-bbef-faaebc588b36" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata063865453ddcef92e3483/javablobcommitblocklistmetadata171869565b0886af234", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132DAB559F\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b5ec-801e-0123-02fc-5919e8000000", + "x-ms-client-request-id" : "7d31de2f-cc37-499d-b52d-9362369c6405" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata063865453ddcef92e3483/javablobcommitblocklistmetadata171869565b0886af234?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132DB0FC54\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b5f9-801e-0123-0cfc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "b950fb70-7a99-4e09-8d62-e45c8c7b5998" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata063865453ddcef92e3483/javablobcommitblocklistmetadata171869565b0886af234", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D728132DB0FC54\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:13 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b609-801e-0123-1bfc-5919e8000000", + "x-ms-client-request-id" : "14078953-b492-4721-9af2-f574681b9cab", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b611-801e-0123-22fc-5919e8000000", + "Body" : "jtccommitblocklistmetadatajtccommitblocklistmetadata063865453ddcef92e3483Fri, 23 Aug 2019 21:45:13 GMT\"0x8D728132DA531E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "72d54392-f2b1-47d4-96f9-817285ad82e7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata063865453ddcef92e3483?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b618-801e-0123-26fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "f2cf8e21-ec8e-4db9-9aee-bd8f1825d584" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistmetadata063865453ddcef92e3483", "javablobcommitblocklistmetadata171869565b0886af234" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[1].json new file mode 100644 index 000000000000..0645209c173c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[1].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata0266177a0a00df996f432?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132DD0DFBD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b625-801e-0123-2efc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "7337183e-a969-455f-a016-62d3ddba1ae6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata0266177a0a00df996f432/javablobcommitblocklistmetadata1917945dfed9261dbc4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132DD667D7\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b62e-801e-0123-34fc-5919e8000000", + "x-ms-client-request-id" : "49ede8a2-6d1c-4841-b7f3-1280361c3f84" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata0266177a0a00df996f432/javablobcommitblocklistmetadata1917945dfed9261dbc4?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132DDC0E8D\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b635-801e-0123-3afc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "9f8e6f2f-0bf0-477b-9418-ca1e7c9d1a2b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata0266177a0a00df996f432/javablobcommitblocklistmetadata1917945dfed9261dbc4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:13 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D728132DDC0E8D\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:13 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b639-801e-0123-3dfc-5919e8000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "99cc8a2f-a3be-41f8-8ad0-121e9d706dca", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b63b-801e-0123-3efc-5919e8000000", + "Body" : "jtccommitblocklistmetadatajtccommitblocklistmetadata0266177a0a00df996f432Fri, 23 Aug 2019 21:45:13 GMT\"0x8D728132DD0DFBD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "0bd28a5a-111c-4155-9c9c-b340e009ac8a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmetadata0266177a0a00df996f432?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b647-801e-0123-44fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:12 GMT", + "x-ms-client-request-id" : "c7049d59-6d21-4c7e-972a-7955df31dc3c" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistmetadata0266177a0a00df996f432", "javablobcommitblocklistmetadata1917945dfed9261dbc4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmin.json new file mode 100644 index 000000000000..f3dbe311563a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmin.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmin0180569be37710ba844d909e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132D0AC9AF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b420-801e-0123-76fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "a15943a8-1e4b-468c-b7f2-04293ca4b202" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmin0180569be37710ba844d909e/javablobcommitblocklistmin1958582021c7d5b600474", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132D104F1F\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b43b-801e-0123-0ffc-5919e8000000", + "x-ms-client-request-id" : "c76ab6c9-7fbe-4048-9a9a-1a75ae56bd12" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmin0180569be37710ba844d909e/javablobcommitblocklistmin1958582021c7d5b600474?blockid=YzM0MzExOWItNWQxNC00OGVmLWJhNjEtZWQxYjY4NjYwYWYz&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b44d-801e-0123-1ffc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "50671939-922f-4576-bf2c-dfb2fbaf46a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmin0180569be37710ba844d909e/javablobcommitblocklistmin1958582021c7d5b600474?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132D1D98D0\"", + "x-ms-content-crc64" : "0TvXpb3pSZs=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b472-801e-0123-3ffc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "9877a246-b54d-462b-90dd-8294242c591c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b494-801e-0123-5bfc-5919e8000000", + "Body" : "jtccommitblocklistminjtccommitblocklistmin0180569be37710ba844d909eFri, 23 Aug 2019 21:45:12 GMT\"0x8D728132D0AC9AF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "8d3463db-b1ce-4c79-957e-0efdb5b11aaf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistmin0180569be37710ba844d909e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b4a5-801e-0123-68fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "2f0400ff-f266-4957-99a6-15b9c866a6ab" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistmin0180569be37710ba844d909e", "javablobcommitblocklistmin1958582021c7d5b600474", "c343119b-5d14-48ef-ba61-ed1b68660af3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistnull.json new file mode 100644 index 000000000000..1f8058324ebd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistnull.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistnull08120185f88d8185074e8eb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132D31E2B8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b4af-801e-0123-72fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "274cc756-ff0a-4037-b96d-c878be77d3ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistnull08120185f88d8185074e8eb/javablobcommitblocklistnull19360137aac4decaa9434", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132D378FD0\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b4c0-801e-0123-02fc-5919e8000000", + "x-ms-client-request-id" : "d4f59958-3945-4c5e-bced-a65180617da5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistnull08120185f88d8185074e8eb/javablobcommitblocklistnull19360137aac4decaa9434?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132D3D368B\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b4cc-801e-0123-0dfc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "6229adbf-4331-471e-af0c-b4d47897ddf7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccommitblocklistnull&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b4d8-801e-0123-17fc-5919e8000000", + "Body" : "jtccommitblocklistnulljtccommitblocklistnull08120185f88d8185074e8ebFri, 23 Aug 2019 21:45:12 GMT\"0x8D728132D31E2B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "b9cb2e62-90f1-4d7f-9f1f-a2f34c9da495", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccommitblocklistnull08120185f88d8185074e8eb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b4e3-801e-0123-20fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "8be69fa8-7b1d-4591-abcb-e8511d238116" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistnull08120185f88d8185074e8eb", "javablobcommitblocklistnull19360137aac4decaa9434" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklist.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklist.json new file mode 100644 index 000000000000..65c4bdff140f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklist.json @@ -0,0 +1,216 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist68a18125967d3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133135D2B3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca845-301e-0118-3cfc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:18 GMT", + "x-ms-client-request-id" : "5c5b1661-ecff-4a11-8d51-6aba704b2403" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist68a18125967d3/javablobgetblocklist1blockblobapitestgetblocklist68a39081256", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813313B4FD2\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3ca863-301e-0118-58fc-595bb6000000", + "x-ms-client-request-id" : "279949b2-2c6e-4b43-a1b3-e33bf369461f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist68a18125967d3/javablobgetblocklist1blockblobapitestgetblocklist68a39081256?blockid=MmEzYWE1NWEtZWQzNS00ODBhLTk3MjctNDA0YjE4OWYxYWYz&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca882-301e-0118-73fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:18 GMT", + "x-ms-client-request-id" : "dfd2d8b6-789b-452a-874b-dc3cb6358663" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist68a18125967d3/javablobgetblocklist1blockblobapitestgetblocklist68a39081256?blockid=YTg0YjZlYTQtZjkxNy00OTdlLWE2OGUtZDQxYjhiNThmYmMx&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca894-301e-0118-02fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:18 GMT", + "x-ms-client-request-id" : "4bb13bdb-8d88-41c4-bcad-fbed8f1c790e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist68a18125967d3/javablobgetblocklist1blockblobapitestgetblocklist68a39081256?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813314A4796\"", + "x-ms-content-crc64" : "dRLtaZzjCKM=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca8ac-301e-0118-14fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:18 GMT", + "x-ms-client-request-id" : "ae2b1477-1e13-4e2e-9b83-408234b5efb8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist68a18125967d3/javablobgetblocklist1blockblobapitestgetblocklist68a39081256?blockid=MDlkOGQwYzYtZjhmNy00OWM1LWJiMmItMjJjZGM5YWQxNTY2&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca8c4-301e-0118-28fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:18 GMT", + "x-ms-client-request-id" : "61c7e0e4-6a77-4412-b7eb-e0d850b7967c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist68a18125967d3/javablobgetblocklist1blockblobapitestgetblocklist68a39081256?blockid=ODkxZGExNTEtOWM2MS00MGZhLTlkZjctODA3YzBlNWI2ZTkw&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3ca8d5-301e-0118-38fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:18 GMT", + "x-ms-client-request-id" : "5a4d77e4-7b62-4820-a266-4253c234204a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist68a18125967d3/javablobgetblocklist1blockblobapitestgetblocklist68a39081256?blocklisttype=all&comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "14", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:19 GMT", + "ETag" : "\"0x8D72813314A4796\"", + "x-ms-request-id" : "0a3ca8eb-301e-0118-4bfc-595bb6000000", + "Body" : "MmEzYWE1NWEtZWQzNS00ODBhLTk3MjctNDA0YjE4OWYxYWYz7YTg0YjZlYTQtZjkxNy00OTdlLWE2OGUtZDQxYjhiNThmYmMx7MDlkOGQwYzYtZjhmNy00OWM1LWJiMmItMjJjZGM5YWQxNTY27ODkxZGExNTEtOWM2MS00MGZhLTlkZjctODA3YzBlNWI2ZTkw7", + "x-ms-client-request-id" : "cf14b931-4320-4fa1-a54c-131ce9b06d7b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetblocklist&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca90a-301e-0118-67fc-595bb6000000", + "Body" : "jtcgetblocklistjtcgetblocklist0blockblobapitestgetblocklist68a18125967d3Fri, 23 Aug 2019 21:45:19 GMT\"0x8D728133135D2B3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:19 GMT", + "x-ms-client-request-id" : "2f5c0e4c-62e8-4f17-9279-c4ee654b8ae4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist68a18125967d3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3ca91c-301e-0118-76fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:19 GMT", + "x-ms-client-request-id" : "f08f02ab-edeb-4fa1-8217-0b71709e8bd1" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklist0blockblobapitestgetblocklist68a18125967d3", "javablobgetblocklist1blockblobapitestgetblocklist68a39081256", "2a3aa55a-ed35-480a-9727-404b189f1af3", "a84b6ea4-f917-497e-a68e-d41b8b58fbc1", "09d8d0c6-f8f7-49c5-bb2b-22cdc9ad1566", "891da151-9c61-40fa-9df7-807c0e5b6e90" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisterror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisterror.json new file mode 100644 index 000000000000..859d6688a4e2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisterror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterror3ce06272?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281332CE1617\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cae5e-301e-0118-25fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "f2571154-466b-4824-b9a5-b0d410342a35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterror3ce06272/javablobgetblocklisterror1099597fb2f24b9e764e0d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281332D3925B\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3cae7f-301e-0118-45fc-595bb6000000", + "x-ms-client-request-id" : "c63b7a14-85cd-4376-ad05-247ff226cf84" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterror3ce06272/javablobgetblocklisterror252195ba8b0a62d5ba4d29?blocklisttype=all&comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cae9c-301e-0118-60fc-595bb6000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:0a3cae9c-301e-0118-60fc-595bb6000000\nTime:2019-08-23T21:45:21.8761732Z", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "702a84e6-4854-449f-8257-c29d7edf652a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetblocklisterror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3caeb0-301e-0118-73fc-595bb6000000", + "Body" : "jtcgetblocklisterrorjtcgetblocklisterror0blockblobapitestgetblocklisterror3ce06272Fri, 23 Aug 2019 21:45:21 GMT\"0x8D7281332CE1617\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "525bfd39-8d5f-4ca0-b337-a3e24a94f643", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterror3ce06272?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3caebc-301e-0118-7ffc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "20346976-8a63-444f-bb45-8f75d466c6eb" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisterror0blockblobapitestgetblocklisterror3ce06272", "javablobgetblocklisterror1099597fb2f24b9e764e0d", "javablobgetblocklisterror252195ba8b0a62d5ba4d29" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistlease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistlease.json new file mode 100644 index 000000000000..5ba68fae03f9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistlease.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistlease89583003?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813328B08F2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cad5c-301e-0118-34fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "5351f0d8-bc8b-4ca8-8245-162804e5e217" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistlease89583003/javablobgetblocklistlease181550cdfd6d8ef3424f1d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728133290857A\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3cad76-301e-0118-4cfc-595bb6000000", + "x-ms-client-request-id" : "8af66ec1-23b4-4b18-9533-5b8f09043bdf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistlease89583003/javablobgetblocklistlease181550cdfd6d8ef3424f1d?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133290857A\"", + "x-ms-lease-id" : "b57c0039-5699-4c1f-9c6a-1593502991fb", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cad9b-301e-0118-6efc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "25ace144-7f6f-4e90-80dd-4ac9f1240b1f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistlease89583003/javablobgetblocklistlease181550cdfd6d8ef3424f1d?blocklisttype=all&comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "ETag" : "\"0x8D728133290857A\"", + "x-ms-request-id" : "0a3cada7-301e-0118-78fc-595bb6000000", + "Body" : "", + "x-ms-client-request-id" : "54f556db-3eaa-4433-a1ad-590bea6b859f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetblocklistlease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cadac-301e-0118-7dfc-595bb6000000", + "Body" : "jtcgetblocklistleasejtcgetblocklistlease0blockblobapitestgetblocklistlease89583003Fri, 23 Aug 2019 21:45:21 GMT\"0x8D72813328B08F2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "b58590c8-b55d-4d37-865e-a0da2da9ef8a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistlease89583003?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cadba-301e-0118-0bfc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "10e4504d-750e-4b50-9aee-a6dc3453342f" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklistlease0blockblobapitestgetblocklistlease89583003", "javablobgetblocklistlease181550cdfd6d8ef3424f1d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistleasefail.json new file mode 100644 index 000000000000..c9422647f45b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistleasefail.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistleasefail026280202f25009e414aa0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281332AF89F4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cadd0-301e-0118-1ffc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "4a851bef-7101-40f5-9fab-20b3dfd4f952" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistleasefail026280202f25009e414aa0/javablobgetblocklistleasefail104606ccf05ada9f2a4b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281332B55497\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3cadeb-301e-0118-36fc-595bb6000000", + "x-ms-client-request-id" : "d14f4eb6-ba43-4542-9028-d890343fa5f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistleasefail026280202f25009e414aa0/javablobgetblocklistleasefail104606ccf05ada9f2a4b?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281332B55497\"", + "x-ms-lease-id" : "7dd204b6-e982-49ca-8c7d-b2f60b318752", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cae07-301e-0118-52fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "07c1feb1-1545-474d-9ee5-80db36c313df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistleasefail026280202f25009e414aa0/javablobgetblocklistleasefail104606ccf05ada9f2a4b?blocklisttype=all&comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "0a3cae20-301e-0118-6bfc-595bb6000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:0a3cae20-301e-0118-6bfc-595bb6000000\nTime:2019-08-23T21:45:21.7110120Z", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "8f86cf75-9f8e-4c4a-b920-170ec09df055", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetblocklistleasefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cae39-301e-0118-03fc-595bb6000000", + "Body" : "jtcgetblocklistleasefailjtcgetblocklistleasefail026280202f25009e414aa0Fri, 23 Aug 2019 21:45:21 GMT\"0x8D7281332AF89F4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "d2adf788-c7f9-43ff-8cc7-01137ca9e443", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistleasefail026280202f25009e414aa0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cae46-301e-0118-0efc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "8b66f4c9-ee3d-4ced-86f1-aad8dfb59eb2" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklistleasefail026280202f25009e414aa0", "javablobgetblocklistleasefail104606ccf05ada9f2a4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistmin.json new file mode 100644 index 000000000000..b6abfbd9c471 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistmin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistmind0415123da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281331CC92D8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3caa90-301e-0118-3dfc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:19 GMT", + "x-ms-client-request-id" : "2f75aa36-31f4-49a0-a977-020af5cdb572" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistmind0415123da/javablobgetblocklistmin142078501ffd61796944c9a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281331D1E86B\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3caaa2-301e-0118-4efc-595bb6000000", + "x-ms-client-request-id" : "9270ef47-4462-438d-89b5-3ba3290c3780" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistmind0415123da/javablobgetblocklistmin142078501ffd61796944c9a?blocklisttype=all&comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:19 GMT", + "ETag" : "\"0x8D7281331D1E86B\"", + "x-ms-request-id" : "0a3caab0-301e-0118-5afc-595bb6000000", + "Body" : "", + "x-ms-client-request-id" : "01cbd5f1-ae22-4a51-a507-18fb7266d0db", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetblocklistmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3caac3-301e-0118-68fc-595bb6000000", + "Body" : "jtcgetblocklistminjtcgetblocklistmin0blockblobapitestgetblocklistmind0415123daFri, 23 Aug 2019 21:45:20 GMT\"0x8D7281331CC92D8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:19 GMT", + "x-ms-client-request-id" : "7184a733-3369-42db-ae0b-aa0d963ef6fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistmind0415123da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3caad9-301e-0118-7cfc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:19 GMT", + "x-ms-client-request-id" : "05a9ad42-8f2c-4e7c-b9ab-5437f9281bdb" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklistmin0blockblobapitestgetblocklistmind0415123da", "javablobgetblocklistmin142078501ffd61796944c9a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[0].json new file mode 100644 index 000000000000..28232c55bded --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[0].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype678924903?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281331E79B94\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3caafe-301e-0118-1cfc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:19 GMT", + "x-ms-client-request-id" : "5b776ac7-6765-4f98-9415-fc744eeede58" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype678924903/javablobgetblocklisttype1046607da3c96416034844", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281331ECCA15\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3cab1c-301e-0118-36fc-595bb6000000", + "x-ms-client-request-id" : "95310a94-f7c6-488e-8361-82af5c623e93" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype678924903/javablobgetblocklisttype1046607da3c96416034844?blockid=OGMzMjgyY2QtZTUwNy00ZDk1LTkzNGItNDZiNDllZmZlMDk0&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cab37-301e-0118-4cfc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "4314537d-ade2-420f-8adb-319e142390b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype678924903/javablobgetblocklisttype1046607da3c96416034844?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281331F753FE\"", + "x-ms-content-crc64" : "QgvG5WiakHU=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cab4d-301e-0118-61fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "6a73ed5a-021b-471c-a28b-07823775be6d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype678924903/javablobgetblocklisttype1046607da3c96416034844?blockid=MmM0ODcyYjctMGVhZi00YTUxLTljYjktOGM2MDI3MWUxODNk&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cab73-301e-0118-04fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "83372ad8-7814-4a09-b3b6-519a6ace91aa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype678924903/javablobgetblocklisttype1046607da3c96416034844?blocklisttype=all&comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "ETag" : "\"0x8D7281331F753FE\"", + "x-ms-request-id" : "0a3cab8b-301e-0118-1bfc-595bb6000000", + "Body" : "OGMzMjgyY2QtZTUwNy00ZDk1LTkzNGItNDZiNDllZmZlMDk07MmM0ODcyYjctMGVhZi00YTUxLTljYjktOGM2MDI3MWUxODNk7", + "x-ms-client-request-id" : "84b24b53-8480-439f-81dd-8b78124f8bf8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetblocklisttype&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cabc1-301e-0118-4afc-595bb6000000", + "Body" : "jtcgetblocklisttypejtcgetblocklisttype0blockblobapitestgetblocklisttype678924903Fri, 23 Aug 2019 21:45:20 GMT\"0x8D7281331E79B94\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "f593ce4d-0d6f-432b-b8ac-1bd2394352cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype678924903?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cabd1-301e-0118-58fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "8864bb0e-b3fa-4ded-ad40-ec4a1ece1d3c" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttype0blockblobapitestgetblocklisttype678924903", "javablobgetblocklisttype1046607da3c96416034844", "8c3282cd-e507-4d95-934b-46b49effe094", "2c4872b7-0eaf-4a51-9cb9-8c60271e183d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[1].json new file mode 100644 index 000000000000..1a0063df9176 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[1].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype619493539?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281332165841\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cabef-301e-0118-71fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "02406b51-928d-4791-9b67-03c95f10ad7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype619493539/javablobgetblocklisttype107843b639cba29f7b4665", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813321BD4F2\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3cac02-301e-0118-01fc-595bb6000000", + "x-ms-client-request-id" : "3b041113-4a32-4b26-936e-eb00a3afc6db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype619493539/javablobgetblocklisttype107843b639cba29f7b4665?blockid=NmRlM2I4MDAtZTk3ZS00NjM1LWFhYmItNTMxOTJhNTQ2N2Ex&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cac0b-301e-0118-09fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "362fb65c-790f-446c-a36b-37ae355fd52f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype619493539/javablobgetblocklisttype107843b639cba29f7b4665?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133226AD13\"", + "x-ms-content-crc64" : "9nG6WJG9ON4=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cac18-301e-0118-16fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "488e5036-f4db-4135-8028-fa03b14ceb91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype619493539/javablobgetblocklisttype107843b639cba29f7b4665?blockid=MjU2NmMyMmYtZDA0OC00ZDc4LWExZDYtZGQyZTA5OTE5MTM3&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cac2b-301e-0118-25fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "9c2a3a31-e1ca-4893-bf09-74191744700e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype619493539/javablobgetblocklisttype107843b639cba29f7b4665?blocklisttype=committed&comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "ETag" : "\"0x8D728133226AD13\"", + "x-ms-request-id" : "0a3cac38-301e-0118-31fc-595bb6000000", + "Body" : "NmRlM2I4MDAtZTk3ZS00NjM1LWFhYmItNTMxOTJhNTQ2N2Ex7", + "x-ms-client-request-id" : "cacab2ce-b172-4b60-8ff9-2461a16f13de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetblocklisttype&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cac40-301e-0118-39fc-595bb6000000", + "Body" : "jtcgetblocklisttypejtcgetblocklisttype0blockblobapitestgetblocklisttype619493539Fri, 23 Aug 2019 21:45:20 GMT\"0x8D7281332165841\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "84860b46-305c-4164-a04d-8b89cc1c69c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype619493539?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cac4c-301e-0118-45fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "fe9b8fce-7855-48f4-aaca-0a1339a99095" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttype0blockblobapitestgetblocklisttype619493539", "javablobgetblocklisttype107843b639cba29f7b4665", "6de3b800-e97e-4635-aabb-53192a5467a1", "2566c22f-d048-4d78-a1d6-dd2e09919137" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[2].json new file mode 100644 index 000000000000..9d69327273c1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[2].json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypebcd452580?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281332478688\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cac6b-301e-0118-5ffc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "a7b0881c-7cb2-4b19-9d42-9d295904d8e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypebcd452580/javablobgetblocklisttype170603e3a77048d0654a9f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813324CDC24\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3cac7d-301e-0118-6efc-595bb6000000", + "x-ms-client-request-id" : "95537b86-042c-4a43-8623-9266e38d2de7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypebcd452580/javablobgetblocklisttype170603e3a77048d0654a9f?blockid=ZDNlNGY3NWYtMzg3NS00MTgzLTg0ODgtMzUyMDczYmM0ODUy&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cac8d-301e-0118-7bfc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "199829da-29fa-4c0a-bd21-0c8abdb51a79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypebcd452580/javablobgetblocklisttype170603e3a77048d0654a9f?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281332576611\"", + "x-ms-content-crc64" : "7iN06OPlQ7E=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cac9a-301e-0118-08fc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "4fae3742-770c-441b-a581-239953478040" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypebcd452580/javablobgetblocklisttype170603e3a77048d0654a9f?blockid=ZWVjYWJiMGUtNTQwNS00ZWNlLWE1MmMtZWQyYTEzNzQ0ZDI0&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cacb0-301e-0118-1bfc-595bb6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "754a2809-71c0-4c16-ac1f-f8dc2ef9c5ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypebcd452580/javablobgetblocklisttype170603e3a77048d0654a9f?blocklisttype=uncommitted&comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "ETag" : "\"0x8D7281332576611\"", + "x-ms-request-id" : "0a3cacca-301e-0118-32fc-595bb6000000", + "Body" : "ZWVjYWJiMGUtNTQwNS00ZWNlLWE1MmMtZWQyYTEzNzQ0ZDI07", + "x-ms-client-request-id" : "c13ecb26-3a5a-4a8a-a25d-44a0c8f4f200", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetblocklisttype&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cacda-301e-0118-42fc-595bb6000000", + "Body" : "jtcgetblocklisttypejtcgetblocklisttype0blockblobapitestgetblocklisttypebcd452580Fri, 23 Aug 2019 21:45:20 GMT\"0x8D7281332478688\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "b3ad525e-d3c0-4fc1-86d3-4bf625597cd9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypebcd452580?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cacee-301e-0118-52fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "57f84e55-ec91-40d6-82dd-3a9a018aec2d" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttype0blockblobapitestgetblocklisttypebcd452580", "javablobgetblocklisttype170603e3a77048d0654a9f", "d3e4f75f-3875-4183-8488-352073bc4852", "eecabb0e-5405-4ece-a52c-ed2a13744d24" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttypenull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttypenull.json new file mode 100644 index 000000000000..36c28a6a5975 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttypenull.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttypenull078453c00189d1f7054b1c9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281332718727\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3cad04-301e-0118-67fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "1b3966e3-2077-486a-8328-23a94154b2aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttypenull078453c00189d1f7054b1c9/javablobgetblocklisttypenull118353b1b5a1fb1fba49", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813327703C4\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3cad17-301e-0118-77fc-595bb6000000", + "x-ms-client-request-id" : "76fc12e7-23c9-416e-8caf-f03a510a16c5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttypenull078453c00189d1f7054b1c9/javablobgetblocklisttypenull118353b1b5a1fb1fba49?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "ETag" : "\"0x8D72813327703C4\"", + "x-ms-request-id" : "0a3cad2b-301e-0118-06fc-595bb6000000", + "Body" : "", + "x-ms-client-request-id" : "31fb98dd-9f62-4280-acd4-0b961f2db575", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetblocklisttypenull&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cad3a-301e-0118-15fc-595bb6000000", + "Body" : "jtcgetblocklisttypenulljtcgetblocklisttypenull078453c00189d1f7054b1c9Fri, 23 Aug 2019 21:45:21 GMT\"0x8D7281332718727\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "6f5daae3-b53a-4637-a621-9779f2ea52b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetblocklisttypenull078453c00189d1f7054b1c9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cad4c-301e-0118-24fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:20 GMT", + "x-ms-client-request-id" : "f6b81583-d65d-44c8-b7b6-b870a18aff51" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttypenull078453c00189d1f7054b1c9", "javablobgetblocklisttypenull118353b1b5a1fb1fba49" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblock.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblock.json new file mode 100644 index 000000000000..0949967c57cd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblock.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblock0blockblobapiteststageblock83117100a2317a8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132794AB9C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f83a6-201e-00c4-21fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "489f7143-e45c-4bba-831e-16d870e6efe9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblock0blockblobapiteststageblock83117100a2317a8/javablobstageblock1blockblobapiteststageblock831232025d686", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813279A2D66\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51f83b5-201e-00c4-2efc-594fb0000000", + "x-ms-client-request-id" : "63b3dcd2-56c6-490b-bc93-7f8e151eb997" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblock0blockblobapiteststageblock83117100a2317a8/javablobstageblock1blockblobapiteststageblock831232025d686?blockid=YjM1OWM2M2UtMDBkNC00NjU4LWIzODItMjU0ZDQzZDc2MmFm&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f83c7-201e-00c4-3efc-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "4c259994-da83-4f82-83b4-bbf32d6a0b06" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblock&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f83dc-201e-00c4-50fc-594fb0000000", + "Body" : "jtcstageblockjtcstageblock0blockblobapiteststageblock83117100a2317a8Fri, 23 Aug 2019 21:45:02 GMT\"0x8D728132794AB9C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "cf406642-8d6b-4940-a44b-f0a8ce942c82", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblock0blockblobapiteststageblock83117100a2317a8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f83ef-201e-00c4-61fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "687a52a6-76fe-4b2f-adb4-dbb6443ea471" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblock0blockblobapiteststageblock83117100a2317a8", "javablobstageblock1blockblobapiteststageblock831232025d686", "b359c63e-00d4-4658-b382-254d43d762af" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockemptybody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockemptybody.json new file mode 100644 index 000000000000..cbe3f0732178 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockemptybody.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockemptybody046146cd3a52249237425cb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281328406621\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a38d-801e-0123-41fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "b93b985f-20d4-4b7e-91c3-2a7b130f29f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockemptybody046146cd3a52249237425cb/javablobstageblockemptybody159949e5efa626f59b4a3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281328469D4D\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a3a9-801e-0123-59fc-5919e8000000", + "x-ms-client-request-id" : "eb40323b-fbbf-4567-bd96-256362ca1b1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockemptybody046146cd3a52249237425cb/javablobstageblockemptybody159949e5efa626f59b4a3?blockid=YjZhZmFmYTAtOGQyMC00ZGM2LWFjNzMtODU1NWE5NzZlZTBm&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "ad97a3bc-801e-0123-6afc-5919e8000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ad97a3bc-801e-0123-6afc-5919e8000000\nTime:2019-08-23T21:45:04.1743938ZContent-Length0", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "9b09e3c6-1768-46cd-a1d5-f9f7fa14c039", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockemptybody&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a3c9-801e-0123-76fc-5919e8000000", + "Body" : "jtcstageblockemptybodyjtcstageblockemptybody046146cd3a52249237425cbFri, 23 Aug 2019 21:45:04 GMT\"0x8D7281328406621\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "919a2fd4-f8c5-4a97-a7f0-50037a3edf51", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockemptybody046146cd3a52249237425cb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a3df-801e-0123-09fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "c119f0e0-a6c8-489e-a959-fbd51158cad7" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockemptybody046146cd3a52249237425cb", "javablobstageblockemptybody159949e5efa626f59b4a3", "b6afafa0-8d20-4dc6-ac73-8555a976ee0f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockerror.json new file mode 100644 index 000000000000..8405e7b62444 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockerror.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerror84f8942695?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281328D59CCB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a5a0-801e-0123-32fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "9ebbe668-bd1b-4d0a-824a-264c09ac85cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerror84f8942695/javablobstageblockerror1421721336d06b260446d09", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281328DCC09F\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a5bf-801e-0123-4dfc-5919e8000000", + "x-ms-client-request-id" : "2e270180-7a81-47a3-8ade-cee244c1fc07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerror84f8942695/javablobstageblockerror21973213605bc5613c40789?blockid=id&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "409", + "StatusCode" : "400", + "x-ms-request-id" : "ad97a5d2-801e-0123-60fc-5919e8000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:ad97a5d2-801e-0123-60fc-5919e8000000\nTime:2019-08-23T21:45:05.1632907ZblockididNot a valid base64 string.", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "6862c978-c0be-497a-ac41-f9a547a0e024", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a5e7-801e-0123-72fc-5919e8000000", + "Body" : "jtcstageblockerrorjtcstageblockerror0blockblobapiteststageblockerror84f8942695Fri, 23 Aug 2019 21:45:05 GMT\"0x8D7281328D59CCB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "fc3cedae-3156-4c8e-8a08-00682bef8719", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerror84f8942695?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a5fb-801e-0123-04fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "1cfe504d-bbba-4cb1-87c5-728eba92dd45" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockerror0blockblobapiteststageblockerror84f8942695", "javablobstageblockerror1421721336d06b260446d09", "javablobstageblockerror21973213605bc5613c40789" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurl.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurl.json new file mode 100644 index 000000000000..81bcd4a3249e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurl.json @@ -0,0 +1,199 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurl39979515?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281328F2EF9C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a61b-801e-0123-21fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "7b4c148d-cdb0-4da9-8313-0702896b4cb7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurl39979515/javablobstageblockfromurl1793409889c9e92f254b05", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281328F9021D\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a62f-801e-0123-33fc-5919e8000000", + "x-ms-client-request-id" : "e0ef6d1c-82d1-4a9c-8103-a4748992488b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurl39979515?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281328FDE061\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97a648-801e-0123-4cfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "2ae07584-b22c-4950-b046-ccfcd6c9c1d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurl39979515/javablobstageblockfromurl214235fb2c06fff17a4139?blockid=MDViMzRkNzgtMjg1OS00MTQwLWExZTUtYzYzZGI4ZjUxNTg5&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a662-801e-0123-66fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "0e34bf3b-8f69-45cf-9968-45b0841461e3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurl39979515/javablobstageblockfromurl214235fb2c06fff17a4139?blocklisttype=all&comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a6ab-801e-0123-2cfc-5919e8000000", + "Body" : "MDViMzRkNzgtMjg1OS00MTQwLWExZTUtYzYzZGI4ZjUxNTg57", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "0ebf543d-d36e-4a06-a6f1-59a24e1a252e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurl39979515/javablobstageblockfromurl214235fb2c06fff17a4139?comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132919634C\"", + "x-ms-content-crc64" : "1MDujj4vwvE=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a6d7-801e-0123-50fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "4a3e10a5-288a-4157-a026-0214c48300e4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurl39979515/javablobstageblockfromurl214235fb2c06fff17a4139", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D728132919634C\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:05 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ad97a6ee-801e-0123-64fc-5919e8000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "4b62f0d0-3891-44f5-98ed-3a07014bbb76", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurl&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a707-801e-0123-7bfc-5919e8000000", + "Body" : "jtcstageblockfromurljtcstageblockfromurl0blockblobapiteststageblockfromurl39979515Fri, 23 Aug 2019 21:45:05 GMT\"0x8D7281328FDE061\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "6b8641d2-71f3-44d2-b668-71113b8ed8ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurl39979515?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a719-801e-0123-0bfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "feff32ba-562d-4771-a492-40d045e913f9" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurl0blockblobapiteststageblockfromurl39979515", "javablobstageblockfromurl1793409889c9e92f254b05", "javablobstageblockfromurl214235fb2c06fff17a4139", "05b34d78-2859-4140-a1e5-c63db8f51589" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlerror.json new file mode 100644 index 000000000000..02b3de1bad15 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlerror032360cbdf1822858447aa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132B2B61B4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97ae87-801e-0123-7ffc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "f47f011e-13a3-4436-bc16-5836c5152fe2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlerror032360cbdf1822858447aa/javablobstageblockfromurlerror112528ed28fb106cef4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132B31553D\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97aea1-801e-0123-15fc-5919e8000000", + "x-ms-client-request-id" : "10eba623-7485-416a-96b7-16f02821e982" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlerror257341ce638586517f4cac/javablobstageblockfromurlerror3035275e30e898ccf04?blockid=MTFkZjNkODEtODNmOC00ZmQ1LTkzYmMtNjcxYzQ0MTIzZTNh&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "229", + "StatusCode" : "404", + "x-ms-request-id" : "ad97aeb3-801e-0123-27fc-5919e8000000", + "Body" : "CannotVerifyCopySourceThe specified resource does not exist.\nRequestId:ad97aeb3-801e-0123-27fc-5919e8000000\nTime:2019-08-23T21:45:09.0728226Z", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "3fffb4f4-e70b-41df-a5ea-74e3999b4244", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97aec0-801e-0123-32fc-5919e8000000", + "Body" : "jtcstageblockfromurlerrorjtcstageblockfromurlerror032360cbdf1822858447aaFri, 23 Aug 2019 21:45:08 GMT\"0x8D728132B2B61B4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "0a3e35a1-f324-4ab8-9775-bbd3844405e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlerror032360cbdf1822858447aa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97aed4-801e-0123-45fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "f7ee75b0-c85b-4bb7-8faa-5a5a28549cfa" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlerror032360cbdf1822858447aa", "javablobstageblockfromurlerror112528ed28fb106cef4", "jtcstageblockfromurlerror257341ce638586517f4cac", "javablobstageblockfromurlerror3035275e30e898ccf04", "11df3d81-83f8-4fd5-93bc-671c44123e3a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[0].json new file mode 100644 index 000000000000..65a15cec2fd2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[0].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia010578ad63fe35944847dcb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281329508E8E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a7bc-801e-0123-1efc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "16cdb6c2-8e4e-41c4-8d1d-d1a8e7309717" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia010578ad63fe35944847dcb/javablobstageblockfromurlia19341612b141db05ad416", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281329562D19\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a7cf-801e-0123-2efc-5919e8000000", + "x-ms-client-request-id" : "f0fdc77d-7272-4f8e-bbf7-060d0109fae9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia010578ad63fe35944847dcb/javablobstageblockfromurlia19341612b141db05ad416?comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MissingRequiredQueryParameter", + "retry-after" : "0", + "Content-Length" : "315", + "StatusCode" : "400", + "x-ms-request-id" : "ad97a7e4-801e-0123-41fc-5919e8000000", + "Body" : "MissingRequiredQueryParameterA query parameter that's mandatory for this request is not specified.\nRequestId:ad97a7e4-801e-0123-41fc-5919e8000000\nTime:2019-08-23T21:45:05.9500012Zblockid", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "94c81f29-e1b4-4999-b07a-e76616d840c9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a7f4-801e-0123-51fc-5919e8000000", + "Body" : "jtcstageblockfromurliajtcstageblockfromurlia010578ad63fe35944847dcbFri, 23 Aug 2019 21:45:05 GMT\"0x8D7281329508E8E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "a95bd807-ccf1-4389-b56f-ff36a6061abb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia010578ad63fe35944847dcb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a809-801e-0123-65fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "b7c68c1a-3305-4c96-9469-40cb205fabe7" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlia010578ad63fe35944847dcb", "javablobstageblockfromurlia19341612b141db05ad416" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[1].json new file mode 100644 index 000000000000..caa84b4c9f6d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia092773d0fd443e5d3a474b9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132969254F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a81c-801e-0123-76fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "abfdbc6d-e758-4e60-aea5-b983a368b01c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia092773d0fd443e5d3a474b9/javablobstageblockfromurlia152624ad217fa8bf23483", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132971840C\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a836-801e-0123-0ffc-5919e8000000", + "x-ms-client-request-id" : "640fbe6a-7671-4a1d-b47b-a526f2c5bca6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia092773d0fd443e5d3a474b9/javablobstageblockfromurlia152624ad217fa8bf23483?blockid=MTRiMDAzYTktNWI4MC00ZjNlLTg0MWMtZmMzYTAxZDgyNzlj&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "ad97a84b-801e-0123-22fc-5919e8000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ad97a84b-801e-0123-22fc-5919e8000000\nTime:2019-08-23T21:45:06.1321655ZContent-Length0", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "07a01df7-8d34-4c49-bf81-68db2278c406", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a857-801e-0123-2efc-5919e8000000", + "Body" : "jtcstageblockfromurliajtcstageblockfromurlia092773d0fd443e5d3a474b9Fri, 23 Aug 2019 21:45:06 GMT\"0x8D728132969254F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "d4a8fa33-7861-4e7b-b3d5-c2aed641af81", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlia092773d0fd443e5d3a474b9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a865-801e-0123-3cfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "2b2d3352-d8cc-4808-9736-192e82b702f2" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlia092773d0fd443e5d3a474b9", "javablobstageblockfromurlia152624ad217fa8bf23483", "14b003a9-5b80-4f3e-841c-fc3a01d8279c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurllease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurllease.json new file mode 100644 index 000000000000..9b266314f6e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurllease.json @@ -0,0 +1,148 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease09369333dd25f2262341d5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132A0450A4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97aa89-801e-0123-46fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "fffeda31-40f3-472f-92a8-e435a6c4e016" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease09369333dd25f2262341d5/javablobstageblockfromurllease181617df3679d3eec34", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132A0AB554\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97aa9a-801e-0123-54fc-5919e8000000", + "x-ms-client-request-id" : "5806d773-3ff6-443f-9942-6fb4c218c6b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease09369333dd25f2262341d5?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132A0F91D2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97aaaa-801e-0123-62fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "1c63a87c-acd8-4deb-99eb-d61a1cd8d496" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease09369333dd25f2262341d5/javablobstageblockfromurllease181617df3679d3eec34?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132A0AB554\"", + "x-ms-lease-id" : "88853321-63b6-4ec5-b04b-6b2cecea4bfa", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97aaba-801e-0123-71fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "78ddc977-f896-4807-818a-bca888859071" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease09369333dd25f2262341d5/javablobstageblockfromurllease181617df3679d3eec34?blockid=OWRlOGZkNWMtMjY5Mi00ZTFkLWI3MDktOTAxZjMzMTYxNzk2&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97aacb-801e-0123-80fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "3aac02d9-0203-4913-aeea-3305da295104" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurllease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97ab3a-801e-0123-67fc-5919e8000000", + "Body" : "jtcstageblockfromurlleasejtcstageblockfromurllease09369333dd25f2262341d5Fri, 23 Aug 2019 21:45:07 GMT\"0x8D728132A0F91D2\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "1b40dde1-1fe5-41fe-bb5c-57725ca76724", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurllease09369333dd25f2262341d5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97ab54-801e-0123-7efc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "b127ed03-9203-458f-a4ba-c8a63557388a" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurllease09369333dd25f2262341d5", "javablobstageblockfromurllease181617df3679d3eec34", "9de8fd5c-2692-4e1d-b709-901f33161796" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlleasefail.json new file mode 100644 index 000000000000..707b5599b65f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlleasefail.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlleasefail071561b4557ae9ced643?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132A438B23\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97ab67-801e-0123-10fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "36568c59-b729-4960-b188-bdaf8e9f7b20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlleasefail071561b4557ae9ced643/javablobstageblockfromurlleasefail14303804971a837fd", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132A4A3EEF\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97ab77-801e-0123-1dfc-5919e8000000", + "x-ms-client-request-id" : "bc406f80-df30-4ba5-a660-67b498311e8e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlleasefail071561b4557ae9ced643?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132A4FB762\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97ab8e-801e-0123-32fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "c341ae81-7248-431d-9dc0-a82a17473c9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlleasefail071561b4557ae9ced643/javablobstageblockfromurlleasefail14303804971a837fd?blockid=ZTlkZTM3NWQtZjc0OC00NTRjLWE0OWEtNTg0MzFlMzkzOWEx&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "ad97abac-801e-0123-4efc-5919e8000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ad97abac-801e-0123-4efc-5919e8000000\nTime:2019-08-23T21:45:08.9026681Zx-ms-lease-idgarbage", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "0ca5575f-c5be-4261-be23-d350d5cc2c90", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlleasefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97ae69-801e-0123-63fc-5919e8000000", + "Body" : "jtcstageblockfromurlleasefailjtcstageblockfromurlleasefail071561b4557ae9ced643Fri, 23 Aug 2019 21:45:07 GMT\"0x8D728132A4FB762\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "c582ae6c-be12-4be3-9e91-a6aee2a1f4b0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlleasefail071561b4557ae9ced643?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97ae73-801e-0123-6bfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "e87b12fc-9059-417f-8203-aa03ea393fd0" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlleasefail071561b4557ae9ced643", "javablobstageblockfromurlleasefail14303804971a837fd", "e9de375d-f748-454c-a49a-58431e3939a1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5.json new file mode 100644 index 000000000000..7e63f0a3949d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5092803a2908d67392c4a959?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281329C27D83\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a969-801e-0123-2efc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "ed4a1407-6026-4148-a517-4c17336a45db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5092803a2908d67392c4a959/javablobstageblockfromurlmd51979664b5c5c97ffbf45", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281329C844D5\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a989-801e-0123-49fc-5919e8000000", + "x-ms-client-request-id" : "6e53f077-96fc-46f6-8d54-1af4f9da1af8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5092803a2908d67392c4a959?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281329CD6FF1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97a9a4-801e-0123-64fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "9beb581e-40c7-4fad-8223-7eb3598a315c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5092803a2908d67392c4a959/javablobstageblockfromurlmd5259533a8d9e6ec7c8044?blockid=NjU2NjYyMjktZmFmZS00ODlmLThmM2YtZjIxM2NjOGI0OTg0&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a9bc-801e-0123-7cfc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "b673547d-a40b-43a7-acd8-ba7848c3cc89", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlmd5&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a9d9-801e-0123-19fc-5919e8000000", + "Body" : "jtcstageblockfromurlmd5jtcstageblockfromurlmd5092803a2908d67392c4a959Fri, 23 Aug 2019 21:45:06 GMT\"0x8D7281329CD6FF1\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "c86757c3-3eda-4ca5-a249-867865b18d07", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5092803a2908d67392c4a959?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a9e8-801e-0123-28fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "3004780e-064c-4a61-b672-c438a0e3f14f" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlmd5092803a2908d67392c4a959", "javablobstageblockfromurlmd51979664b5c5c97ffbf45", "javablobstageblockfromurlmd5259533a8d9e6ec7c8044", "65666229-fafe-489f-8f3f-f213cc8b4984" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5fail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5fail.json new file mode 100644 index 000000000000..bbfec31e0c65 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5fail.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5fail006776d4e62711b38748d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281329E48C4E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97aa09-801e-0123-48fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "2e7e3b2c-c95b-42fa-9929-8adc4c3b4e1e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5fail006776d4e62711b38748d/javablobstageblockfromurlmd5fail10802099067495e552", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281329EA2D09\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97aa26-801e-0123-64fc-5919e8000000", + "x-ms-client-request-id" : "fef53283-7836-465b-ac24-dcae1dfe06a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5fail006776d4e62711b38748d?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281329EFA61E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97aa3e-801e-0123-7cfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "bd75ed23-b188-4fd3-910c-1067904aa8ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5fail006776d4e62711b38748d/javablobstageblockfromurlmd5fail283334768a6e2d69b6?blockid=Mjk2MTE0MDAtNWM3MC00ZGQ4LWJkNTQtZWY2NDI2MmM4MTFj&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMd5", + "retry-after" : "0", + "Content-Length" : "276", + "StatusCode" : "400", + "x-ms-request-id" : "ad97aa52-801e-0123-10fc-5919e8000000", + "Body" : "InvalidMd5The MD5 value specified in the request is invalid. MD5 value must be 128 bits and base64 encoded.\nRequestId:ad97aa52-801e-0123-10fc-5919e8000000\nTime:2019-08-23T21:45:06.9669190Z", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "c3e7b733-dd7b-4d9d-8b9c-7be8966f3387", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlmd5fail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97aa6e-801e-0123-2bfc-5919e8000000", + "Body" : "jtcstageblockfromurlmd5failjtcstageblockfromurlmd5fail006776d4e62711b38748dFri, 23 Aug 2019 21:45:06 GMT\"0x8D7281329EFA61E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "3ae2f5d3-ef96-4805-9a39-4ff35139b753", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmd5fail006776d4e62711b38748d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97aa79-801e-0123-36fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:06 GMT", + "x-ms-client-request-id" : "63baa5ac-62ee-4afc-81db-b5e62c57a38c" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlmd5fail006776d4e62711b38748d", "javablobstageblockfromurlmd5fail10802099067495e552", "javablobstageblockfromurlmd5fail283334768a6e2d69b6", "29611400-5c70-4dd8-bd54-ef64262c811c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmin.json new file mode 100644 index 000000000000..b0c435780fb9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmin.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmin004513cd1d152a867043d9a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813292EF511\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a730-801e-0123-22fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "72127d1e-9add-456a-b611-75beaaf49e9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmin004513cd1d152a867043d9a/javablobstageblockfromurlmin114603240a679a69f341", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281329357DBC\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a748-801e-0123-35fc-5919e8000000", + "x-ms-client-request-id" : "91622bd5-af96-4524-845f-57bca13879dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmin004513cd1d152a867043d9a?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813293A5B9B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97a760-801e-0123-4cfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "5918b58b-0f89-4954-b0c7-70dcca2cb7c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmin004513cd1d152a867043d9a/javablobstageblockfromurlmin207031b58a8f35e84548?blockid=ZTA0ZmZlMGItOWYyYy00YzJmLThkNzMtYjUxZDRlMzllMjVk&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a772-801e-0123-5dfc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "5b749331-ed1c-46c5-9bf4-d7215f35fe7a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a78d-801e-0123-75fc-5919e8000000", + "Body" : "jtcstageblockfromurlminjtcstageblockfromurlmin004513cd1d152a867043d9aFri, 23 Aug 2019 21:45:05 GMT\"0x8D72813293A5B9B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "e5c8b83b-3aa4-435c-8eaa-1a1eece4d3cc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlmin004513cd1d152a867043d9a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a79e-801e-0123-04fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "78d422f1-fd5c-4b36-bed3-8ccea9d5ec1e" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlmin004513cd1d152a867043d9a", "javablobstageblockfromurlmin114603240a679a69f341", "javablobstageblockfromurlmin207031b58a8f35e84548", "e04ffe0b-9f2c-4c2f-8d73-b51d4e39e25d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlrange.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlrange.json new file mode 100644 index 000000000000..1003a36c8720 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlrange.json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange01700560fd056eb8ed45e6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132987D7F8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a87d-801e-0123-52fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "f122d6cb-8756-4a17-b20c-b7ebf6e7be33" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange01700560fd056eb8ed45e6/javablobstageblockfromurlrange127600dc70ffce963b4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813299C20E7\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a8d9-801e-0123-23fc-5919e8000000", + "x-ms-client-request-id" : "3e901a6f-bee7-4866-acef-1e9b47e4edd6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange01700560fd056eb8ed45e6?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281329A65698\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97a8ff-801e-0123-47fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "1c2ddec6-445b-4b66-90c8-25448035daf5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange01700560fd056eb8ed45e6/javablobstageblockfromurlrange24867177f8e64242f84?blockid=MmY3ZTM1NGQtOGEyNy00MDViLWIxZWQtNjRhZDc5Njk0YjJk&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "K07r2U1KQWI=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a90c-801e-0123-54fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "d3a130f7-d3e0-4f77-a132-07ebc8dd4efa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange01700560fd056eb8ed45e6/javablobstageblockfromurlrange24867177f8e64242f84?blocklisttype=uncommitted&comp=blocklist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a927-801e-0123-6ffc-5919e8000000", + "Body" : "MmY3ZTM1NGQtOGEyNy00MDViLWIxZWQtNjRhZDc5Njk0YjJk3", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "4407cc83-c7de-48ea-ba8d-8a195960d289", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a941-801e-0123-08fc-5919e8000000", + "Body" : "jtcstageblockfromurlrangejtcstageblockfromurlrange01700560fd056eb8ed45e6Fri, 23 Aug 2019 21:45:06 GMT\"0x8D7281329A65698\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "bef712a4-4063-4380-b025-7349bb8c027d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlrange01700560fd056eb8ed45e6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a957-801e-0123-1efc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:05 GMT", + "x-ms-client-request-id" : "d43a215c-86b4-4ac8-88eb-dde31c95364a" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlrange01700560fd056eb8ed45e6", "javablobstageblockfromurlrange127600dc70ffce963b4", "javablobstageblockfromurlrange24867177f8e64242f84", "2f7e354d-8a27-405b-b1ed-64ad79694b2d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[0].json new file mode 100644 index 000000000000..eef5f4b1fd01 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[0].json @@ -0,0 +1,151 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac02191555bf2374509c4f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132B469121\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97aeea-801e-0123-59fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "a3a617a7-e7d7-4367-aacd-1e30708ec208" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac02191555bf2374509c4f/javablobstageblockfromurlsourceac151590c3e38a259ed4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132B4C850F\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97aefd-801e-0123-6bfc-5919e8000000", + "x-ms-client-request-id" : "9eda1b22-c4b8-42b9-a93f-76173d0894e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac02191555bf2374509c4f?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132B518683\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97af11-801e-0123-7ffc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "fb086c4e-6256-45b3-8a56-d741c462562b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac02191555bf2374509c4f/javablobstageblockfromurlsourceac2933557ad17a619466", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132B5699A8\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97af29-801e-0123-10fc-5919e8000000", + "x-ms-client-request-id" : "cf06770f-b6f4-41e8-ac74-11a05da3b472" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac02191555bf2374509c4f/javablobstageblockfromurlsourceac151590c3e38a259ed4?blockid=YTgzNDVhYmUtNDY2My00NmFkLWIxOWItY2E2ZDdmZTkzOTYw&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97af42-801e-0123-28fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "faa94720-5e6a-4ef4-ad75-3244183a623d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97af59-801e-0123-3efc-5919e8000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac02191555bf2374509c4fFri, 23 Aug 2019 21:45:09 GMT\"0x8D728132B518683\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "89ae9a9b-8151-4eba-a1d9-6c15b2779a2e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac02191555bf2374509c4f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97af6c-801e-0123-50fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "2d3fae4f-c96e-4de8-9ddb-a9a48190c35e" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac02191555bf2374509c4f", "javablobstageblockfromurlsourceac151590c3e38a259ed4", "a8345abe-4663-46ad-b19b-ca6d7fe93960", "javablobstageblockfromurlsourceac2933557ad17a619466" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[1].json new file mode 100644 index 000000000000..e96d5eae2f53 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[1].json @@ -0,0 +1,151 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac062254bafa99290f794e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132B6D5C02\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97af7f-801e-0123-63fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "09b1b800-2c5c-42c9-afc2-2e8a98f56fb4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac062254bafa99290f794e/javablobstageblockfromurlsourceac197071562917d478ff", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132B824843\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97afbd-801e-0123-1dfc-5919e8000000", + "x-ms-client-request-id" : "74f83c41-d726-415d-b909-39e9a47dd247" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac062254bafa99290f794e?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132B87495D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97afce-801e-0123-2dfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "88c3e736-6362-4ad4-a406-d92b16e70f64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac062254bafa99290f794e/javablobstageblockfromurlsourceac218971a921263112ed", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132B8D6E8D\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97afe7-801e-0123-41fc-5919e8000000", + "x-ms-client-request-id" : "64a176a7-1da3-45ec-8052-cbee36576e89" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac062254bafa99290f794e/javablobstageblockfromurlsourceac197071562917d478ff?blockid=ZmMyZmE3YWEtMTQ3NS00OWVhLWIyY2YtNmJlYzdlMWY0ZTVk&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97aff9-801e-0123-53fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "3aab1e42-da4b-4b5d-8fa8-8948a63eb567" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b009-801e-0123-60fc-5919e8000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac062254bafa99290f794eFri, 23 Aug 2019 21:45:09 GMT\"0x8D728132B87495D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:08 GMT", + "x-ms-client-request-id" : "dea9753c-aa36-451e-98db-e747dbc139a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac062254bafa99290f794e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b00b-801e-0123-62fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "8d3f2514-5ef0-4edb-a295-85cd8a9f6799" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac062254bafa99290f794e", "javablobstageblockfromurlsourceac197071562917d478ff", "fc2fa7aa-1475-49ea-b2cf-6bec7e1f4e5d", "javablobstageblockfromurlsourceac218971a921263112ed" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[2].json new file mode 100644 index 000000000000..4dd2145548ff --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[2].json @@ -0,0 +1,151 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0561481d0d1948bf3946?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132BA84FC4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b010-801e-0123-66fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "fbfadc20-1e39-42ad-ac44-dcbfad483930" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0561481d0d1948bf3946/javablobstageblockfromurlsourceac1799753e31f1d2ba2f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132BAEE176\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b014-801e-0123-69fc-5919e8000000", + "x-ms-client-request-id" : "015c0e89-6533-4788-b05e-8b1fa6b19b07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0561481d0d1948bf3946?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132BB4A5CB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97b01f-801e-0123-74fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "055b4e25-fbfc-4bd4-bd7b-4f79de35958f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0561481d0d1948bf3946/javablobstageblockfromurlsourceac212201590758a385c9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132BBACB43\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b02a-801e-0123-7ffc-5919e8000000", + "x-ms-client-request-id" : "8ec2a228-0472-46a8-a92d-29c7e617231c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0561481d0d1948bf3946/javablobstageblockfromurlsourceac1799753e31f1d2ba2f?blockid=OGQxYjVkM2YtMTAyYy00M2QyLWE0NmItMDBlNDkxZjQyYThi&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b045-801e-0123-18fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "d57e80e3-81df-4490-895a-24e24872c8ab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b067-801e-0123-39fc-5919e8000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac0561481d0d1948bf3946Fri, 23 Aug 2019 21:45:09 GMT\"0x8D728132BB4A5CB\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "d7ff8802-52f4-47f8-a0d9-629fb8f5d195", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0561481d0d1948bf3946?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b076-801e-0123-46fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "96cbcdfb-447b-405e-a94c-4a0ecfacd4a3" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac0561481d0d1948bf3946", "javablobstageblockfromurlsourceac1799753e31f1d2ba2f", "8d1b5d3f-102c-43d2-a46b-00e491f42a8b", "javablobstageblockfromurlsourceac212201590758a385c9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[3].json new file mode 100644 index 000000000000..647a6143b20e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[3].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0976157cad9d53116446?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132BD95629\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b08a-801e-0123-5afc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "0acd0d2d-06b9-4ccb-88f1-a1e82df7737d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0976157cad9d53116446/javablobstageblockfromurlsourceac112234bc09acae1dfd", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132BDF7351\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b09f-801e-0123-6cfc-5919e8000000", + "x-ms-client-request-id" : "a86f8b86-f6a8-4fcc-b8cd-c3c8bcf1cac9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0976157cad9d53116446?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132BE6E55C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97b0ab-801e-0123-76fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "b778c5ae-50bd-45d5-b83a-4c5ce7985af0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0976157cad9d53116446/javablobstageblockfromurlsourceac2388641b1d72e57f99", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132BED3253\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b0bc-801e-0123-07fc-5919e8000000", + "x-ms-client-request-id" : "b5475c3e-5e71-4777-a49f-e486034db40c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0976157cad9d53116446/javablobstageblockfromurlsourceac2388641b1d72e57f99", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D728132BED3253\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:10 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ad97b0cd-801e-0123-17fc-5919e8000000", + "x-ms-client-request-id" : "0ff7ef08-63dd-4264-b32e-f05dc174ff20", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0976157cad9d53116446/javablobstageblockfromurlsourceac112234bc09acae1dfd?blockid=Zjc0MDg5ZWYtOWYwZS00ZmI5LThlMjUtM2M1M2Q5YzA1Y2I2&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b0d8-801e-0123-22fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "76b1aee8-cdc4-4366-88b5-151cfda6bf48" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b0ec-801e-0123-34fc-5919e8000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac0976157cad9d53116446Fri, 23 Aug 2019 21:45:10 GMT\"0x8D728132BE6E55C\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "fc6c39b9-bb9c-4dde-bd84-a677889eb4a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0976157cad9d53116446?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b0fb-801e-0123-43fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "15884ce7-a0d1-4f4e-a557-1b16c2d0a595" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac0976157cad9d53116446", "javablobstageblockfromurlsourceac112234bc09acae1dfd", "f74089ef-9f0e-4fb9-8e25-3c53d9c05cb6", "javablobstageblockfromurlsourceac2388641b1d72e57f99" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[4].json new file mode 100644 index 000000000000..e2c4c9389a53 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[4].json @@ -0,0 +1,151 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0575406ba739c6378d49?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132C09E73C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b10c-801e-0123-54fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "ec8c9b98-dea8-428f-a0ec-2db20d069056" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0575406ba739c6378d49/javablobstageblockfromurlsourceac17446319078ca6305b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132C102C46\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b12a-801e-0123-6ffc-5919e8000000", + "x-ms-client-request-id" : "76c90a78-07cc-4380-8962-dcc66a7a43fd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0575406ba739c6378d49?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132C155375\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97b133-801e-0123-78fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "d5f7332f-7e4a-41d7-9247-d263e2dcc961" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0575406ba739c6378d49/javablobstageblockfromurlsourceac207277a0c9d5bd71a7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132C1AB634\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b142-801e-0123-06fc-5919e8000000", + "x-ms-client-request-id" : "2b38f5fa-dd11-4fae-a60b-456d2b473b27" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0575406ba739c6378d49/javablobstageblockfromurlsourceac17446319078ca6305b?blockid=Y2NiZDA0ZWMtMmVkOC00Yzk1LTljYjQtNzgzODY1ZDc4Y2Jh&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b14d-801e-0123-11fc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "24a972a9-578b-4a68-9e00-fc0070d0fd22" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b167-801e-0123-29fc-5919e8000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac0575406ba739c6378d49Fri, 23 Aug 2019 21:45:10 GMT\"0x8D728132C155375\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "b39fce5f-c6c1-4a99-9d9e-a63374ab71c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceac0575406ba739c6378d49?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b171-801e-0123-33fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "2c0d89a0-df83-40d3-8a00-cad218d99c5b" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac0575406ba739c6378d49", "javablobstageblockfromurlsourceac17446319078ca6305b", "ccbd04ec-2ed8-4c95-9cb4-783865d78cba", "javablobstageblockfromurlsourceac207277a0c9d5bd71a7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[0].json new file mode 100644 index 000000000000..1e4775818e57 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[0].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail058349d53891b78f23?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132C343553\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b181-801e-0123-43fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "x-ms-client-request-id" : "5f9dd5c3-da3e-4439-a283-43f1ee09be1c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail058349d53891b78f23/javablobstageblockfromurlsourceacfail10421716dfbc0ab2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132C399070\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b190-801e-0123-4ffc-5919e8000000", + "x-ms-client-request-id" : "8702b383-4977-46ee-844d-74eb276027a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail058349d53891b78f23?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132C3E6910\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97b19d-801e-0123-5cfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "ec8785d8-0962-4c29-8b7b-ff2e5c43b1e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail058349d53891b78f23/javablobstageblockfromurlsourceacfail261225138db30d25", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132C437DF7\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b1ac-801e-0123-69fc-5919e8000000", + "x-ms-client-request-id" : "446c5e0c-0565-460b-bf8a-d9e7f1287074" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail058349d53891b78f23/javablobstageblockfromurlsourceacfail10421716dfbc0ab2?blockid=MzcwMTQzYmYtMGJjZS00MjEwLWJlYWItZjdjNzdmODZmYmI4&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "ad97b1bc-801e-0123-74fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "e2ea2925-e9c8-4dc7-a3a7-a1e41b87a551" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlsourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b1c7-801e-0123-7dfc-5919e8000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail058349d53891b78f23Fri, 23 Aug 2019 21:45:10 GMT\"0x8D728132C3E6910\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "f1620c7e-2556-40e8-b56e-30e4fb4d0485", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail058349d53891b78f23?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b1d5-801e-0123-09fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "e7d35b4a-d6a9-4498-9300-d28799ef93f8" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail058349d53891b78f23", "javablobstageblockfromurlsourceacfail10421716dfbc0ab2", "370143bf-0bce-4210-beab-f7c77f86fbb8", "javablobstageblockfromurlsourceacfail261225138db30d25" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[1].json new file mode 100644 index 000000000000..07a89748919c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[1].json @@ -0,0 +1,152 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail0404426ccd0e0cf86b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132C58194F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b1ef-801e-0123-1dfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "dd5a43e6-555a-4ec7-964c-2d3882edcdf6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail0404426ccd0e0cf86b/javablobstageblockfromurlsourceacfail1319658930e4c973", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132C5E1172\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b209-801e-0123-31fc-5919e8000000", + "x-ms-client-request-id" : "482c7c3e-e76a-4851-8562-bfac60bbc2bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail0404426ccd0e0cf86b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132C6337EF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97b219-801e-0123-3cfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "5fb0c432-a95a-4c8c-9673-79222e9416de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail0404426ccd0e0cf86b/javablobstageblockfromurlsourceacfail2331223b70921533", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132C68743D\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b228-801e-0123-4bfc-5919e8000000", + "x-ms-client-request-id" : "70ed6ac9-af27-4b16-b6a2-abc89be50c0f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail0404426ccd0e0cf86b/javablobstageblockfromurlsourceacfail1319658930e4c973?blockid=MTNhNjg5M2YtNmM5NC00MGE2LTllZmItNGY1ZWE4Y2I4NTdk&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "259", + "StatusCode" : "412", + "x-ms-request-id" : "ad97b237-801e-0123-55fc-5919e8000000", + "Body" : "CannotVerifyCopySourceThe condition specified using HTTP conditional header(s) is not met.\nRequestId:ad97b237-801e-0123-55fc-5919e8000000\nTime:2019-08-23T21:45:11.1376873Z", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "76f1669a-dcf1-400c-8dd6-be092ae95748", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlsourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b24f-801e-0123-6cfc-5919e8000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail0404426ccd0e0cf86bFri, 23 Aug 2019 21:45:11 GMT\"0x8D728132C6337EF\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "6b2a615b-89d6-4414-bd24-adadf6b2d6e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail0404426ccd0e0cf86b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b264-801e-0123-7ffc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "4c8f8a4d-ed15-434a-b019-cc4705b6d890" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail0404426ccd0e0cf86b", "javablobstageblockfromurlsourceacfail1319658930e4c973", "13a6893f-6c94-40a6-9efb-4f5ea8cb857d", "javablobstageblockfromurlsourceacfail2331223b70921533" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[2].json new file mode 100644 index 000000000000..a1b9a771ce63 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[2].json @@ -0,0 +1,152 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail062506a166c0e48d43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132C988C8D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b2c1-801e-0123-4ffc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "0630af38-d971-47c8-b8eb-7ddfa9481753" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail062506a166c0e48d43/javablobstageblockfromurlsourceacfail113560ef229a6306", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132C9F220A\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b2cf-801e-0123-59fc-5919e8000000", + "x-ms-client-request-id" : "b81b6c1e-e6c1-41e9-9f5e-8d30b6c16c72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail062506a166c0e48d43?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132CA49658\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97b2e1-801e-0123-69fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "581781af-319e-41ec-a0f2-f8c3dffce42a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail062506a166c0e48d43/javablobstageblockfromurlsourceacfail277227d12ac265c5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132CA9ABEA\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b2ed-801e-0123-73fc-5919e8000000", + "x-ms-client-request-id" : "962c1a41-d583-401d-8b49-537b4206ce57" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail062506a166c0e48d43/javablobstageblockfromurlsourceacfail113560ef229a6306?blockid=NmNlNGE0MWYtMGViNC00ZDA5LWIzYzAtYTQ5YmQ4OTEwY2M0&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "ad97b2fc-801e-0123-01fc-5919e8000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:ad97b2fc-801e-0123-01fc-5919e8000000\nTime:2019-08-23T21:45:11.5340454Z", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "e3750bd0-9456-4533-a717-a5263c00a63b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlsourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b30b-801e-0123-0ffc-5919e8000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail062506a166c0e48d43Fri, 23 Aug 2019 21:45:11 GMT\"0x8D728132CA49658\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "516f7b71-9736-423a-b875-a181cd0246bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail062506a166c0e48d43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b311-801e-0123-15fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "bc2277a3-a010-489b-ad5a-2604486a2b46" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail062506a166c0e48d43", "javablobstageblockfromurlsourceacfail113560ef229a6306", "6ce4a41f-0eb4-4d09-b3c0-a49bd8910cc4", "javablobstageblockfromurlsourceacfail277227d12ac265c5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[3].json new file mode 100644 index 000000000000..5f0bc8b39d42 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[3].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail099330c3e4b0eead36?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132CBDD068\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97b323-801e-0123-24fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "676bf837-193a-46f5-83e8-4f3ff674c8e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail099330c3e4b0eead36/javablobstageblockfromurlsourceacfail18601394fd03523e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132CC3CA0B\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b337-801e-0123-37fc-5919e8000000", + "x-ms-client-request-id" : "a800195b-f347-438c-865c-4990f93c5a17" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail099330c3e4b0eead36?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728132CC8A1B1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ad97b346-801e-0123-43fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "x-ms-client-request-id" : "e1f50f0a-1790-4098-aa10-17ae7df4aed9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail099330c3e4b0eead36/javablobstageblockfromurlsourceacfail298689b0627100f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132CCE7B14\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97b354-801e-0123-50fc-5919e8000000", + "x-ms-client-request-id" : "4511b7ce-f3b6-49e1-88a0-4a5a1c968d57" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail099330c3e4b0eead36/javablobstageblockfromurlsourceacfail298689b0627100f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D728132CCE7B14\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:11 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "ad97b361-801e-0123-5dfc-5919e8000000", + "x-ms-client-request-id" : "3d4b1e0a-cbbd-440d-9510-d6692a3b4b0e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail099330c3e4b0eead36/javablobstageblockfromurlsourceacfail18601394fd03523e?blockid=N2NjODIyZjQtNGNjNC00YjRhLTliMzEtZDczOWExZTQ2MmUw&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "ad97b370-801e-0123-6afc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "cd2f76aa-a3dc-45d7-9c85-31ec5927c87e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockfromurlsourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b380-801e-0123-76fc-5919e8000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail099330c3e4b0eead36Fri, 23 Aug 2019 21:45:11 GMT\"0x8D728132CC8A1B1\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "c7008019-ee18-4c88-85d5-6980ab6ab73c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockfromurlsourceacfail099330c3e4b0eead36?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97b38d-801e-0123-80fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:11 GMT", + "x-ms-client-request-id" : "e8acbffc-1dee-4b00-ba12-41ddab522180" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail099330c3e4b0eead36", "javablobstageblockfromurlsourceacfail18601394fd03523e", "7cc822f4-4cc4-4b4a-9b31-d739a1e462e0", "javablobstageblockfromurlsourceacfail298689b0627100f8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[0].json new file mode 100644 index 000000000000..9c9a5a8b845b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[0].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments070081464c1ef347c842?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281327C82432\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f845d-201e-00c4-40fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "860c86bf-2935-4726-b4c7-75f6c562fe6d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments070081464c1ef347c842/javablobstageblockillegalarguments118207fe4ad367287", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281327CDA621\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51f846b-201e-00c4-4bfc-594fb0000000", + "x-ms-client-request-id" : "364f64ad-9505-431c-b329-de5ad71fe74b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments070081464c1ef347c842/javablobstageblockillegalarguments118207fe4ad367287?comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MissingRequiredQueryParameter", + "retry-after" : "0", + "Content-Length" : "315", + "StatusCode" : "400", + "x-ms-request-id" : "d51f847e-201e-00c4-5bfc-594fb0000000", + "Body" : "MissingRequiredQueryParameterA query parameter that's mandatory for this request is not specified.\nRequestId:d51f847e-201e-00c4-5bfc-594fb0000000\nTime:2019-08-23T21:45:03.3802724Zblockid", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "ea9185b2-2c64-4e14-a83b-92fbb09c0861", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockillegalarguments&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f8488-201e-00c4-65fc-594fb0000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments070081464c1ef347c842Fri, 23 Aug 2019 21:45:03 GMT\"0x8D7281327C82432\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "90793cee-1beb-4b67-a116-cf386b79474a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments070081464c1ef347c842?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f849a-201e-00c4-74fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "1cf20c35-ab94-454e-bb01-1d3abbe53741" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments070081464c1ef347c842", "javablobstageblockillegalarguments118207fe4ad367287" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[1].json new file mode 100644 index 000000000000..dfee3af27840 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[1].json @@ -0,0 +1,591 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments05987332379d57c9d948?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281327E43E8A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f84af-201e-00c4-03fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "56665d90-cf50-44ea-b5cf-753e93ec2cf9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments05987332379d57c9d948/javablobstageblockillegalarguments126478c6703e48549", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281327E9E7A0\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51f84bd-201e-00c4-0ffc-594fb0000000", + "x-ms-client-request-id" : "14a53439-555a-46cc-b55a-7f45190df121" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments05987332379d57c9d948/javablobstageblockillegalarguments126478c6703e48549?blockid=Y2JiNDkwYzctODY3OC00MjQ4LWJmYzUtMjA3YzY2YWI2NThk&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "lambda$null$4", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 235, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "MonoCallable.java", + "lineNumber" : 91, + "className" : "reactor.core.publisher.MonoCallable", + "nativeMethod" : false + }, { + "methodName" : "drain", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 402, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 244, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxJust.java", + "lineNumber" : 99, + "className" : "reactor.core.publisher.FluxJust$WeakScalarSubscription", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 162, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 229, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 90, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxJust.java", + "lineNumber" : 70, + "className" : "reactor.core.publisher.FluxJust", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 63, + "className" : "reactor.core.publisher.FluxMapFuseable", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxConcatMap", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "Flux.java", + "lineNumber" : 7921, + "className" : "reactor.core.publisher.Flux", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FluxSubscribeOn.java", + "lineNumber" : 194, + "className" : "reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 84, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 37, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FutureTask.java", + "lineNumber" : 266, + "className" : "java.util.concurrent.FutureTask", + "nativeMethod" : false + }, { + "methodName" : "access$201", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 180, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 293, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "runWorker", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 1149, + "className" : "java.util.concurrent.ThreadPoolExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 624, + "className" : "java.util.concurrent.ThreadPoolExecutor$Worker", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : null, + "localizedMessage" : null, + "suppressed" : [ { + "cause" : null, + "stackTrace" : [ { + "methodName" : "blockingGet", + "fileName" : "BlockingSingleSubscriber.java", + "lineNumber" : 93, + "className" : "reactor.core.publisher.BlockingSingleSubscriber", + "nativeMethod" : false + }, { + "methodName" : "block", + "fileName" : "Mono.java", + "lineNumber" : 1494, + "className" : "reactor.core.publisher.Mono", + "nativeMethod" : false + }, { + "methodName" : "blockWithOptionalTimeout", + "fileName" : "Utility.java", + "lineNumber" : 235, + "className" : "com.azure.storage.common.Utility", + "nativeMethod" : false + }, { + "methodName" : "stageBlockWithResponse", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 242, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "stageBlock", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 205, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 213, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 56, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite", + "nativeMethod" : false + }, { + "methodName" : "defaultCall", + "fileName" : "CallSiteArray.java", + "lineNumber" : 48, + "className" : "org.codehaus.groovy.runtime.callsite.CallSiteArray", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 58, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "AbstractCallSite.java", + "lineNumber" : 141, + "className" : "org.codehaus.groovy.runtime.callsite.AbstractCallSite", + "nativeMethod" : false + }, { + "methodName" : "$spock_feature_1_2", + "fileName" : "BlockBlobAPITest.groovy", + "lineNumber" : 58, + "className" : "com.azure.storage.blob.BlockBlobAPITest", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invokeMethod", + "fileName" : "ReflectionUtil.java", + "lineNumber" : 188, + "className" : "org.spockframework.util.ReflectionUtil", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "MethodInfo.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.model.MethodInfo", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatureMethod", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 406, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 324, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 309, + "className" : "org.spockframework.runtime.BaseSpecRunner$6", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 288, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "initializeAndRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 278, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIterations", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 139, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runParameterizedFeature", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 41, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 262, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 246, + "className" : "org.spockframework.runtime.BaseSpecRunner$5", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 238, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatures", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 188, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 98, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.BaseSpecRunner$1", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 76, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 67, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Sputnik.java", + "lineNumber" : 63, + "className" : "org.spockframework.runtime.Sputnik", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 128, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 27, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 290, + "className" : "org.junit.runners.ParentRunner$3", + "nativeMethod" : false + }, { + "methodName" : "schedule", + "fileName" : "ParentRunner.java", + "lineNumber" : 71, + "className" : "org.junit.runners.ParentRunner$1", + "nativeMethod" : false + }, { + "methodName" : "runChildren", + "fileName" : "ParentRunner.java", + "lineNumber" : 288, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "ParentRunner.java", + "lineNumber" : 58, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "evaluate", + "fileName" : "ParentRunner.java", + "lineNumber" : 268, + "className" : "org.junit.runners.ParentRunner$2", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 363, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "JUnitCore.java", + "lineNumber" : 137, + "className" : "org.junit.runner.JUnitCore", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "JUnit4IdeaTestRunner.java", + "lineNumber" : 68, + "className" : "com.intellij.junit4.JUnit4IdeaTestRunner", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "IdeaTestRunner.java", + "lineNumber" : 47, + "className" : "com.intellij.rt.execution.junit.IdeaTestRunner$Repeater", + "nativeMethod" : false + }, { + "methodName" : "prepareStreamsAndStart", + "fileName" : "JUnitStarter.java", + "lineNumber" : 242, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + }, { + "methodName" : "main", + "fileName" : "JUnitStarter.java", + "lineNumber" : 70, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + } ], + "message" : "#block terminated with an error", + "localizedMessage" : "#block terminated with an error", + "suppressed" : [ ] + } ] + }, + "ClassName" : "java.lang.NullPointerException" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockillegalarguments&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "4a536bfc-101e-004f-4bfc-59f46e000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments05987332379d57c9d948Fri, 23 Aug 2019 21:45:03 GMT\"0x8D7281327E43E8A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "957bd219-8504-4f27-b5ee-d9c48e9a17c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments05987332379d57c9d948?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "4a536c0e-101e-004f-5bfc-59f46e000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "784dacf3-0731-415a-afe0-e667f2ce6f9d" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments05987332379d57c9d948", "javablobstageblockillegalarguments126478c6703e48549", "cbb490c7-8678-4248-bfc5-207c66ab658d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[2].json new file mode 100644 index 000000000000..65b60a2333ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[2].json @@ -0,0 +1,597 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments0215444474213c8c604c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813281C9E8C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4a536c3b-101e-004f-02fc-59f46e000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "b746c638-a4f0-42bf-a41f-a5c33d7bd1e1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments0215444474213c8c604c/javablobstageblockillegalarguments166963259ada2a711", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728132821F551\"", + "Content-Length" : "0", + "x-ms-request-id" : "4a536c4e-101e-004f-0efc-59f46e000000", + "x-ms-client-request-id" : "d7bd2fcf-ed08-458c-b543-1873bcaca353" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments0215444474213c8c604c/javablobstageblockillegalarguments166963259ada2a711?blockid=MjdmMDY1OWEtMmMwYi00Njg0LThkMTMtNzFmYzlhZjc1YzQz&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "read", + "fileName" : "ByteArrayInputStream.java", + "lineNumber" : 180, + "className" : "java.io.ByteArrayInputStream", + "nativeMethod" : false + }, { + "methodName" : "lambda$null$4", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 235, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "MonoCallable.java", + "lineNumber" : 91, + "className" : "reactor.core.publisher.MonoCallable", + "nativeMethod" : false + }, { + "methodName" : "drain", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 402, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 244, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxJust.java", + "lineNumber" : 99, + "className" : "reactor.core.publisher.FluxJust$WeakScalarSubscription", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 162, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 229, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 90, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxJust.java", + "lineNumber" : 70, + "className" : "reactor.core.publisher.FluxJust", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 63, + "className" : "reactor.core.publisher.FluxMapFuseable", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxConcatMap", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "Flux.java", + "lineNumber" : 7921, + "className" : "reactor.core.publisher.Flux", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FluxSubscribeOn.java", + "lineNumber" : 194, + "className" : "reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 84, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 37, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FutureTask.java", + "lineNumber" : 266, + "className" : "java.util.concurrent.FutureTask", + "nativeMethod" : false + }, { + "methodName" : "access$201", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 180, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 293, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "runWorker", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 1149, + "className" : "java.util.concurrent.ThreadPoolExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 624, + "className" : "java.util.concurrent.ThreadPoolExecutor$Worker", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : null, + "localizedMessage" : null, + "suppressed" : [ { + "cause" : null, + "stackTrace" : [ { + "methodName" : "blockingGet", + "fileName" : "BlockingSingleSubscriber.java", + "lineNumber" : 93, + "className" : "reactor.core.publisher.BlockingSingleSubscriber", + "nativeMethod" : false + }, { + "methodName" : "block", + "fileName" : "Mono.java", + "lineNumber" : 1494, + "className" : "reactor.core.publisher.Mono", + "nativeMethod" : false + }, { + "methodName" : "blockWithOptionalTimeout", + "fileName" : "Utility.java", + "lineNumber" : 235, + "className" : "com.azure.storage.common.Utility", + "nativeMethod" : false + }, { + "methodName" : "stageBlockWithResponse", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 242, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "stageBlock", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 205, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 213, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 56, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite", + "nativeMethod" : false + }, { + "methodName" : "defaultCall", + "fileName" : "CallSiteArray.java", + "lineNumber" : 48, + "className" : "org.codehaus.groovy.runtime.callsite.CallSiteArray", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 58, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "AbstractCallSite.java", + "lineNumber" : 141, + "className" : "org.codehaus.groovy.runtime.callsite.AbstractCallSite", + "nativeMethod" : false + }, { + "methodName" : "$spock_feature_1_2", + "fileName" : "BlockBlobAPITest.groovy", + "lineNumber" : 58, + "className" : "com.azure.storage.blob.BlockBlobAPITest", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invokeMethod", + "fileName" : "ReflectionUtil.java", + "lineNumber" : 188, + "className" : "org.spockframework.util.ReflectionUtil", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "MethodInfo.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.model.MethodInfo", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatureMethod", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 406, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 324, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 309, + "className" : "org.spockframework.runtime.BaseSpecRunner$6", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 288, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "initializeAndRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 278, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIterations", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 139, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runParameterizedFeature", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 41, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 262, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 246, + "className" : "org.spockframework.runtime.BaseSpecRunner$5", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 238, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatures", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 188, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 98, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.BaseSpecRunner$1", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 76, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 67, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Sputnik.java", + "lineNumber" : 63, + "className" : "org.spockframework.runtime.Sputnik", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 128, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 27, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 290, + "className" : "org.junit.runners.ParentRunner$3", + "nativeMethod" : false + }, { + "methodName" : "schedule", + "fileName" : "ParentRunner.java", + "lineNumber" : 71, + "className" : "org.junit.runners.ParentRunner$1", + "nativeMethod" : false + }, { + "methodName" : "runChildren", + "fileName" : "ParentRunner.java", + "lineNumber" : 288, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "ParentRunner.java", + "lineNumber" : 58, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "evaluate", + "fileName" : "ParentRunner.java", + "lineNumber" : 268, + "className" : "org.junit.runners.ParentRunner$2", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 363, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "JUnitCore.java", + "lineNumber" : 137, + "className" : "org.junit.runner.JUnitCore", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "JUnit4IdeaTestRunner.java", + "lineNumber" : 68, + "className" : "com.intellij.junit4.JUnit4IdeaTestRunner", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "IdeaTestRunner.java", + "lineNumber" : 47, + "className" : "com.intellij.rt.execution.junit.IdeaTestRunner$Repeater", + "nativeMethod" : false + }, { + "methodName" : "prepareStreamsAndStart", + "fileName" : "JUnitStarter.java", + "lineNumber" : 242, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + }, { + "methodName" : "main", + "fileName" : "JUnitStarter.java", + "lineNumber" : 70, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + } ], + "message" : "#block terminated with an error", + "localizedMessage" : "#block terminated with an error", + "suppressed" : [ ] + } ] + }, + "ClassName" : "java.lang.IndexOutOfBoundsException" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockillegalarguments&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a363-801e-0123-1efc-5919e8000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments0215444474213c8c604cFri, 23 Aug 2019 21:45:03 GMT\"0x8D72813281C9E8C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "7ce37b87-5e49-4b07-bc33-fedb0faddaf1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockillegalarguments0215444474213c8c604c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a379-801e-0123-30fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "d2acc367-f0b8-44ff-952d-11cc1a0303c2" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments0215444474213c8c604c", "javablobstageblockillegalarguments166963259ada2a711", "27f0659a-2c0b-4684-8d13-71fc9af75c43" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocklease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocklease.json new file mode 100644 index 000000000000..feaed2cc793f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocklease.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblocklease14d3102541?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813287BCF2A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a459-801e-0123-7ffc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "f875c6d4-f84d-44fa-8f47-3c76874dea26" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblocklease14d3102541/javablobstageblocklease17065345e653301cfd40c98", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813288BCD99\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a48b-801e-0123-2ffc-5919e8000000", + "x-ms-client-request-id" : "359a445b-2fdd-45a3-966e-410f75a9cdb0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblocklease14d3102541/javablobstageblocklease17065345e653301cfd40c98?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813288BCD99\"", + "x-ms-lease-id" : "d1bd6816-f4a1-4c6c-be22-fe1e2e8b950f", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a4a2-801e-0123-42fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "3ac4fde8-7983-406b-8e37-597d4f3ce553" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblocklease14d3102541/javablobstageblocklease17065345e653301cfd40c98?blockid=NzFjYmVkNDctMDlhNi00MDM3LTk3YjktNjQ3MzUzMWYyNzNl&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a4be-801e-0123-5efc-5919e8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "69d5186b-06a4-44ce-ab78-30dfbbdac69e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblocklease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a4da-801e-0123-78fc-5919e8000000", + "Body" : "jtcstageblockleasejtcstageblocklease0blockblobapiteststageblocklease14d3102541Fri, 23 Aug 2019 21:45:04 GMT\"0x8D72813287BCF2A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "2e35aa41-e9c0-4384-bfe9-7fb4ea18fe50", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblocklease14d3102541?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a4e7-801e-0123-05fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "114c3688-8bdc-4e98-9eea-895b4e09bdd2" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblocklease0blockblobapiteststageblocklease14d3102541", "javablobstageblocklease17065345e653301cfd40c98", "71cbed47-09a6-4037-97b9-6473531f273e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockleasefail.json new file mode 100644 index 000000000000..da1ebf887add --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockleasefail.json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockleasefail08281212a884a2b06944e28?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281328ABC3F1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a502-801e-0123-1ffc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "1fb0391b-5ef9-4c5b-95ac-9baca5acaacf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockleasefail08281212a884a2b06944e28/javablobstageblockleasefail1327293d7f6f05dd53446", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281328B77C38\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a526-801e-0123-42fc-5919e8000000", + "x-ms-client-request-id" : "d1d266c8-3c79-4c43-80e4-812e23d24fb2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockleasefail08281212a884a2b06944e28/javablobstageblockleasefail1327293d7f6f05dd53446?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281328B77C38\"", + "x-ms-lease-id" : "7b81e23a-1756-4adb-b96e-4e2ffa983135", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a53d-801e-0123-58fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "0599afcc-63a0-4414-9755-17ae2e32494b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockleasefail08281212a884a2b06944e28/javablobstageblockleasefail1327293d7f6f05dd53446?blockid=YWM0NmViMTUtNGU1MS00NjBlLWFmZGQtYjY0YTFmMjM3OGYy&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "ad97a559-801e-0123-73fc-5919e8000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:ad97a559-801e-0123-73fc-5919e8000000\nTime:2019-08-23T21:45:04.9480946Z", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "60829348-54bb-42ac-90d8-0089a3a73e36", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockleasefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a573-801e-0123-0afc-5919e8000000", + "Body" : "jtcstageblockleasefailjtcstageblockleasefail08281212a884a2b06944e28Fri, 23 Aug 2019 21:45:04 GMT\"0x8D7281328ABC3F1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "9bd89bea-a782-47f4-9c30-60f72ef5bb66", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockleasefail08281212a884a2b06944e28?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a585-801e-0123-18fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:04 GMT", + "x-ms-client-request-id" : "9014a50b-ad1d-4fa3-85f5-18d5c20f92d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockleasefail08281212a884a2b06944e28", "javablobstageblockleasefail1327293d7f6f05dd53446", "ac46eb15-4e51-460e-afdd-b64a1f2378f2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockmin.json new file mode 100644 index 000000000000..e9688e0a8e0c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockmin.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockminc0b2967121a0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281327AEF0BD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f8409-201e-00c4-79fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:02 GMT", + "x-ms-client-request-id" : "456883d4-297b-4745-b2a8-ed3a4cdefb0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockminc0b2967121a0/javablobstageblockmin1blockblobapiteststageblockminc0b073741d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281327B47291\"", + "Content-Length" : "0", + "x-ms-request-id" : "d51f8420-201e-00c4-0bfc-594fb0000000", + "x-ms-client-request-id" : "f6f01600-ecb4-4a35-98a7-803d69c0167d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockminc0b2967121a0/javablobstageblockmin1blockblobapiteststageblockminc0b073741d?blockid=NzAwYmY1YjUtNjc5ZS00NjhkLWFhNTYtMjNiOGZiMDI1MDlm&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d51f842f-201e-00c4-18fc-594fb0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "5bc4e6db-6a56-415b-b93c-5cadc013c3b8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblockmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f843c-201e-00c4-24fc-594fb0000000", + "Body" : "jtcstageblockminjtcstageblockmin0blockblobapiteststageblockminc0b2967121a0Fri, 23 Aug 2019 21:45:03 GMT\"0x8D7281327AEF0BD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "c1a6a4e7-7be5-4257-b7af-8386b467b723", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockminc0b2967121a0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "d51f8449-201e-00c4-31fc-594fb0000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "c0435dd4-5579-4976-b4ae-990deb439ba7" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockmin0blockblobapiteststageblockminc0b2967121a0", "javablobstageblockmin1blockblobapiteststageblockminc0b073741d", "700bf5b5-679e-468d-aa56-23b8fb02509f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocknullbody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocknullbody.json new file mode 100644 index 000000000000..0f9fd2ecb74e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocknullbody.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocknullbody0768594ca52eb9bf1b4e8c80?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813285FDC45\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ad97a3f1-801e-0123-1bfc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "88ec0426-f822-4857-8645-1f038a442a07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocknullbody0768594ca52eb9bf1b4e8c80/javablobstageblocknullbody12540728693b10f1854b8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281328666216\"", + "Content-Length" : "0", + "x-ms-request-id" : "ad97a408-801e-0123-30fc-5919e8000000", + "x-ms-client-request-id" : "fd693dd6-6956-4a75-ac1a-e3131dfa75c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocknullbody0768594ca52eb9bf1b4e8c80/javablobstageblocknullbody12540728693b10f1854b8?blockid=ZTNjNzhhZDEtZTU2NS00MGIzLWJjNGQtM2U0ZWZlZmMxZjk0&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "ad97a421-801e-0123-49fc-5919e8000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ad97a421-801e-0123-49fc-5919e8000000\nTime:2019-08-23T21:45:04.3815806ZContent-Length0", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "92b7354a-0d2b-41d8-bd6e-c8c0391b55b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstageblocknullbody&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a430-801e-0123-58fc-5919e8000000", + "Body" : "jtcstageblocknullbodyjtcstageblocknullbody0768594ca52eb9bf1b4e8c80Fri, 23 Aug 2019 21:45:04 GMT\"0x8D72813285FDC45\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "f1e294bf-1b36-4396-8c16-5aaf2298d529", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstageblocknullbody0768594ca52eb9bf1b4e8c80?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "ad97a442-801e-0123-69fc-5919e8000000", + "Date" : "Fri, 23 Aug 2019 21:45:03 GMT", + "x-ms-client-request-id" : "416a254a-f0e3-448b-aa5c-f12bae8c4df8" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblocknullbody0768594ca52eb9bf1b4e8c80", "javablobstageblocknullbody12540728693b10f1854b8", "e3c78ad1-e565-40b3-bc4d-3e4efefc1f94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestupload.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestupload.json new file mode 100644 index 000000000000..d60ab81e3a8c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestupload.json @@ -0,0 +1,140 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcupload0blockblobapitestuploade4a758427fd49c60c59?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281332E945F0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3caedc-301e-0118-1bfc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "dc738663-d096-4f95-bb02-13d33ec2670d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcupload0blockblobapitestuploade4a758427fd49c60c59/javablobupload1blockblobapitestuploade4a47146f807a807f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281332EEE944\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3caef8-301e-0118-33fc-595bb6000000", + "x-ms-client-request-id" : "a741d105-49c1-4f90-85c8-708a0d6e5494" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcupload0blockblobapitestuploade4a758427fd49c60c59/javablobupload1blockblobapitestuploade4a47146f807a807f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281332F41AAF\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3caf06-301e-0118-41fc-595bb6000000", + "x-ms-client-request-id" : "f55d13da-38f5-4fca-8854-35c3d71fb079" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcupload0blockblobapitestuploade4a758427fd49c60c59/javablobupload1blockblobapitestuploade4a47146f807a807f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7281332F41AAF\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "0a3caf29-301e-0118-5efc-595bb6000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "0fda6d76-d8f2-4567-847f-d164adddc723", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcupload&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3caf53-301e-0118-7ffc-595bb6000000", + "Body" : "jtcuploadjtcupload0blockblobapitestuploade4a758427fd49c60c59Fri, 23 Aug 2019 21:45:21 GMT\"0x8D7281332E945F0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "f13a4dd0-bb22-4f21-9f34-076d6bb2cf40", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcupload0blockblobapitestuploade4a758427fd49c60c59?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3caf6a-301e-0118-12fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "d5e405c6-87e2-44fe-935f-c87572cbd4c4" + }, + "Exception" : null + } ], + "variables" : [ "jtcupload0blockblobapitestuploade4a758427fd49c60c59", "javablobupload1blockblobapitestuploade4a47146f807a807f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[0].json new file mode 100644 index 000000000000..bf025df21d12 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[0].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac6a379924cd22c7b4f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281334354A13\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de3a97-001e-00f1-6afc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "526ac0b8-f727-4a22-97cc-27bad240598d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac6a379924cd22c7b4f/javablobuploadac1blockblobapitestuploadac6a3798478d76cee", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813343AF4AF\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3add-001e-00f1-2afc-59e1e5000000", + "x-ms-client-request-id" : "17ccb70e-bbb7-4bef-90fa-8592c477ed63" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac6a379924cd22c7b4f/javablobuploadac1blockblobapitestuploadac6a3798478d76cee", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728133440C281\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3b26-001e-00f1-70fc-59e1e5000000", + "x-ms-client-request-id" : "ce34cf05-8c3b-4275-b268-21c64d6bf834" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3b69-001e-00f1-2efc-59e1e5000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac6a379924cd22c7b4fFri, 23 Aug 2019 21:45:24 GMT\"0x8D7281334354A13\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "db5a14c2-969e-438c-99ba-10a0bc0fd08f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac6a379924cd22c7b4f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3b92-001e-00f1-57fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "8f791d2f-1580-4ce1-989e-9a3abafb77a2" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac6a379924cd22c7b4f", "javablobuploadac1blockblobapitestuploadac6a3798478d76cee" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[1].json new file mode 100644 index 000000000000..a4248a418d38 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[1].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac04f8691947caa8067?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133450049C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de3bf1-001e-00f1-2efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "31672dbe-9307-4d18-bdb6-937faed529f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac04f8691947caa8067/javablobuploadac1blockblobapitestuploadac04f13306285cc75", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728133455FD6E\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3c44-001e-00f1-7afc-59e1e5000000", + "x-ms-client-request-id" : "41466df8-2590-4a04-90bf-7526b49a0b94" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac04f8691947caa8067/javablobuploadac1blockblobapitestuploadac04f13306285cc75", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813345AE09D\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3c80-001e-00f1-36fc-59e1e5000000", + "x-ms-client-request-id" : "da1ba2c2-5666-494d-8130-d719425b16e4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3cb3-001e-00f1-69fc-59e1e5000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac04f8691947caa8067Fri, 23 Aug 2019 21:45:24 GMT\"0x8D728133450049C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "ee7bc220-ce49-49d3-a21b-30f1cee1cd8b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac04f8691947caa8067?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3ce9-001e-00f1-1bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "0f7b885f-6a22-4b1f-9b51-8cc858311425" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac04f8691947caa8067", "javablobuploadac1blockblobapitestuploadac04f13306285cc75" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[2].json new file mode 100644 index 000000000000..8aeaf9059bae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[2].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac1583128133c7c41e0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813346A22BD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de3d40-001e-00f1-70fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "de3e4313-826e-4167-928c-be9cc9341a2f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac1583128133c7c41e0/javablobuploadac1blockblobapitestuploadac158038446e81f0e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813346FA632\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3d8b-001e-00f1-37fc-59e1e5000000", + "x-ms-client-request-id" : "c3f3f772-ef82-4e0b-90dc-8a88c573a91e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac1583128133c7c41e0/javablobuploadac1blockblobapitestuploadac158038446e81f0e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281334746258\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3dcf-001e-00f1-79fc-59e1e5000000", + "x-ms-client-request-id" : "0ddc0a37-f81b-4599-830a-688b53b9eb40" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3e18-001e-00f1-3dfc-59e1e5000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac1583128133c7c41e0Fri, 23 Aug 2019 21:45:24 GMT\"0x8D72813346A22BD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "a3d558b4-b348-4a73-b6ee-f11d16224545", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac1583128133c7c41e0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3e7a-001e-00f1-1afc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "6c9ce6c5-38d6-4dff-870f-abb3fb0674f7" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac1583128133c7c41e0", "javablobuploadac1blockblobapitestuploadac158038446e81f0e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[3].json new file mode 100644 index 000000000000..9093cd9f9276 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac4ca927683ee0a7e57?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813348A5CCD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de3ec1-001e-00f1-5cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "56168e6c-5d8c-4772-a843-11d14102c0de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac4ca927683ee0a7e57/javablobuploadac1blockblobapitestuploadac4ca216009ce9fb3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813348FB933\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3f1c-001e-00f1-2bfc-59e1e5000000", + "x-ms-client-request-id" : "5742d933-0c80-4e9b-b6bb-4cbfb25e3306" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac4ca927683ee0a7e57/javablobuploadac1blockblobapitestuploadac4ca216009ce9fb3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813348FB933\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:24 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b1de3f4f-001e-00f1-5dfc-59e1e5000000", + "x-ms-client-request-id" : "19284277-2610-4007-8dd3-bdea9ab0aa0e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac4ca927683ee0a7e57/javablobuploadac1blockblobapitestuploadac4ca216009ce9fb3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813349894FB\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3f80-001e-00f1-0dfc-59e1e5000000", + "x-ms-client-request-id" : "dd2ee01d-6723-4e86-bcff-8dffbe0e9868" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3fba-001e-00f1-47fc-59e1e5000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac4ca927683ee0a7e57Fri, 23 Aug 2019 21:45:24 GMT\"0x8D72813348A5CCD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "b0d134ca-76aa-4a70-8251-7762c884f677", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac4ca927683ee0a7e57?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3fe1-001e-00f1-6efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "17b544c7-6a49-4241-b722-41088ba705cc" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac4ca927683ee0a7e57", "javablobuploadac1blockblobapitestuploadac4ca216009ce9fb3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[4].json new file mode 100644 index 000000000000..3e077b409c44 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[4].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac9640278652e45da53?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281334A73AB7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de403e-001e-00f1-45fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "084b9f63-9585-4ef2-9e96-e25b18a21cb5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac9640278652e45da53/javablobuploadac1blockblobapitestuploadac96411417073390e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281334AC9721\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de408e-001e-00f1-11fc-59e1e5000000", + "x-ms-client-request-id" : "8fc2e8dc-2296-45f7-8354-106950d8eb19" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac9640278652e45da53/javablobuploadac1blockblobapitestuploadac96411417073390e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281334B17A4F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de40dc-001e-00f1-5bfc-59e1e5000000", + "x-ms-client-request-id" : "e4c132d2-480f-46e6-adfe-a92ae94cd8da" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de411f-001e-00f1-19fc-59e1e5000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac9640278652e45da53Fri, 23 Aug 2019 21:45:24 GMT\"0x8D7281334A73AB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "9a3016a4-3cb2-43cf-90cb-0181bfa024eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac9640278652e45da53?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de4145-001e-00f1-3efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "75839b3c-a54b-4306-82eb-5f2f1bd6403c" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac9640278652e45da53", "javablobuploadac1blockblobapitestuploadac96411417073390e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[5].json new file mode 100644 index 000000000000..e2c931050920 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[5].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac8cb90711ab7098786?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281334C0471A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de4198-001e-00f1-0efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "9e19fa92-8ad6-4a70-a0c8-fe1910672e14" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac8cb90711ab7098786/javablobuploadac1blockblobapitestuploadac8cb66487b881fc8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281334C5A383\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de41f5-001e-00f1-65fc-59e1e5000000", + "x-ms-client-request-id" : "a687b94b-7478-4c77-9ee4-07ac1271fad5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac8cb90711ab7098786/javablobuploadac1blockblobapitestuploadac8cb66487b881fc8?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281334C5A383\"", + "x-ms-lease-id" : "c86fd891-fb2e-4bc7-a6b1-55607fea3005", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de423c-001e-00f1-28fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "d8c1e2d1-b50b-44a0-9cd4-d8c72d0ea679" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac8cb90711ab7098786/javablobuploadac1blockblobapitestuploadac8cb66487b881fc8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281334CF9101\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de426d-001e-00f1-57fc-59e1e5000000", + "x-ms-client-request-id" : "f0617f67-2f33-49a9-8cda-1c55bbf4e168" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de42b2-001e-00f1-18fc-59e1e5000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac8cb90711ab7098786Fri, 23 Aug 2019 21:45:25 GMT\"0x8D7281334C0471A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "182c7fdf-886d-4125-bd16-f6da085c0ebf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac8cb90711ab7098786?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de42da-001e-00f1-3efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "882ad95f-4e8e-4c60-aa1c-7ec8123a463a" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac8cb90711ab7098786", "javablobuploadac1blockblobapitestuploadac8cb66487b881fc8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[0].json new file mode 100644 index 000000000000..72e0ce0e11ec --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[0].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail213303531633d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281334DED320\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de4341-001e-00f1-1cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "3eb4906d-75ae-4b5d-9cfb-ebf23b4008a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail213303531633d/javablobuploadacfail1blockblobapitestuploadacfail213351052c6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281334F0DCCE\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de441f-001e-00f1-68fc-59e1e5000000", + "x-ms-client-request-id" : "43699c02-b888-4029-a5b5-24f9eb7d9657" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail213303531633d/javablobuploadacfail1blockblobapitestuploadacfail213351052c6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "b1de445e-001e-00f1-26fc-59e1e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b1de445e-001e-00f1-26fc-59e1e5000000\nTime:2019-08-23T21:45:25.4293974Z", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "ea967c88-4e70-4354-9c03-f59aa51396fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de448a-001e-00f1-52fc-59e1e5000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfail213303531633dFri, 23 Aug 2019 21:45:25 GMT\"0x8D7281334DED320\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "0bc42ac5-d716-40ac-9472-4a7272dda19d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail213303531633d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de44b3-001e-00f1-76fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "56331b90-3678-4523-ab5c-852d718af09d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfail213303531633d", "javablobuploadacfail1blockblobapitestuploadacfail213351052c6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[1].json new file mode 100644 index 000000000000..7c3844f93250 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[1].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail8bd10045916f3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281335052947\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de44ea-001e-00f1-2dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "x-ms-client-request-id" : "c88b2556-f5b9-484d-9e3b-923fbd412b03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail8bd10045916f3/javablobuploadacfail1blockblobapitestuploadacfail8bd243611d7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813350AD3CE\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de452c-001e-00f1-69fc-59e1e5000000", + "x-ms-client-request-id" : "4c765bf2-ec6b-46ac-9db4-c2bcfc000759" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail8bd10045916f3/javablobuploadacfail1blockblobapitestuploadacfail8bd243611d7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "b1de456e-001e-00f1-28fc-59e1e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b1de456e-001e-00f1-28fc-59e1e5000000\nTime:2019-08-23T21:45:25.5955569Z", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "8968ff48-b6c3-4418-b6d2-e217334f8afc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de45a9-001e-00f1-61fc-59e1e5000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfail8bd10045916f3Fri, 23 Aug 2019 21:45:25 GMT\"0x8D7281335052947\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "e67cbba0-f246-45aa-8929-fcd31e68616c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail8bd10045916f3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de45d3-001e-00f1-09fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "c5e324a7-2ef1-499c-b2e3-a096442bdc3c" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfail8bd10045916f3", "javablobuploadacfail1blockblobapitestuploadacfail8bd243611d7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[2].json new file mode 100644 index 000000000000..b81ceecb3307 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[2].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailf234332713cd2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813351EAAEB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de4613-001e-00f1-47fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "c045c216-9265-4529-9d42-cf1c431eacaa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailf234332713cd2/javablobuploadacfail1blockblobapitestuploadacfailf239727472c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281335242E6D\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de464d-001e-00f1-7efc-59e1e5000000", + "x-ms-client-request-id" : "2876c8af-b561-47b5-b709-bc47544125f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailf234332713cd2/javablobuploadacfail1blockblobapitestuploadacfailf239727472c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "b1de4679-001e-00f1-24fc-59e1e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b1de4679-001e-00f1-24fc-59e1e5000000\nTime:2019-08-23T21:45:25.7567128Z", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "5ae7c0a9-3810-4e67-9116-555fb33b8f77", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de469e-001e-00f1-44fc-59e1e5000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfailf234332713cd2Fri, 23 Aug 2019 21:45:25 GMT\"0x8D72813351EAAEB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "c088a11d-ac0c-4311-883c-4da4d82f7c32", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailf234332713cd2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de46d1-001e-00f1-69fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "531b753d-4dd4-49ec-a151-4472f543231e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfailf234332713cd2", "javablobuploadacfail1blockblobapitestuploadacfailf239727472c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[3].json new file mode 100644 index 000000000000..f219eb8b26c2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[3].json @@ -0,0 +1,139 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaild660308559dc1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133537DE6E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de4723-001e-00f1-2dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "18a72003-d2f6-4347-a684-0d4e10bf66a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaild660308559dc1/javablobuploadacfail1blockblobapitestuploadacfaild6616517bfb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813353CC585\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de475c-001e-00f1-59fc-59e1e5000000", + "x-ms-client-request-id" : "e0121f72-4da1-49ee-93c2-4e611b754325" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaild660308559dc1/javablobuploadacfail1blockblobapitestuploadacfaild6616517bfb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:25 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813353CC585\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:25 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b1de4799-001e-00f1-0efc-59e1e5000000", + "x-ms-client-request-id" : "0eb013c8-8c0a-44a8-a607-d8f6fdb02d46", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaild660308559dc1/javablobuploadacfail1blockblobapitestuploadacfaild6616517bfb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "b1de47ce-001e-00f1-37fc-59e1e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b1de47ce-001e-00f1-37fc-59e1e5000000\nTime:2019-08-23T21:45:25.9478951Z", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "1231344f-fbd0-43ba-a36c-578499e2b5ee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de47ff-001e-00f1-61fc-59e1e5000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfaild660308559dc1Fri, 23 Aug 2019 21:45:25 GMT\"0x8D728133537DE6E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "92fdaa10-44f0-4d1b-b071-659ab70c4ba4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaild660308559dc1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de4828-001e-00f1-03fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "54dd293e-a493-43b9-8c18-b82dce6d41b4" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfaild660308559dc1", "javablobuploadacfail1blockblobapitestuploadacfaild6616517bfb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[4].json new file mode 100644 index 000000000000..40d5c88cb8a9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[4].json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailb2b779694fb50?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133553D1BA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de4871-001e-00f1-3ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "42eb4292-64e9-403e-9c63-e2041e47e5bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailb2b779694fb50/javablobuploadacfail1blockblobapitestuploadacfailb2b60147ad2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813355906FE\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de48a4-001e-00f1-69fc-59e1e5000000", + "x-ms-client-request-id" : "02c9a0c2-eebe-4450-919c-1dd9fb437acf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailb2b779694fb50/javablobuploadacfail1blockblobapitestuploadacfailb2b60147ad2?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813355906FE\"", + "x-ms-lease-id" : "647b4c06-9226-446a-a4e1-cd539f8af5d8", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de48f3-001e-00f1-29fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "cd5abf6e-8d0c-4520-9b89-317a5a70cc15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailb2b779694fb50/javablobuploadacfail1blockblobapitestuploadacfailb2b60147ad2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "b1de4937-001e-00f1-65fc-59e1e5000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:b1de4937-001e-00f1-65fc-59e1e5000000\nTime:2019-08-23T21:45:26.1390779Z", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "0a9ca887-cb51-481a-9a57-5b8c636e9bb3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de496c-001e-00f1-13fc-59e1e5000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfailb2b779694fb50Fri, 23 Aug 2019 21:45:26 GMT\"0x8D728133553D1BA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "42e7fa02-75c5-440a-a0e9-2636b3e1e49b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailb2b779694fb50?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de49cd-001e-00f1-68fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "9608b8c2-4d5e-402e-92c4-abf9c664323f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfailb2b779694fb50", "javablobuploadacfail1blockblobapitestuploadacfailb2b60147ad2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploademptybody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploademptybody.json new file mode 100644 index 000000000000..2da30245d74a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploademptybody.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybodyb2a3806431?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813336D0DEE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de306e-001e-00f1-47fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "9d6d3186-b077-43cf-9a19-6194257af343" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybodyb2a3806431/javablobuploademptybody1451389d2ea735a09f48e59", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728133372434A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de30aa-001e-00f1-7ffc-59e1e5000000", + "x-ms-client-request-id" : "69f79e23-a1ea-4c7b-a524-cca46cb8fad6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybodyb2a3806431/javablobuploademptybody1451389d2ea735a09f48e59", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "\"0x8D728133376FF66\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de30df-001e-00f1-32fc-59e1e5000000", + "x-ms-client-request-id" : "86dd47b6-8efc-4cdd-99ba-e933091b751d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploademptybody&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de312a-001e-00f1-7bfc-59e1e5000000", + "Body" : "jtcuploademptybodyjtcuploademptybody0blockblobapitestuploademptybodyb2a3806431Fri, 23 Aug 2019 21:45:22 GMT\"0x8D72813336D0DEE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "6cbfef90-2e00-478a-85b5-81c1a6943ae4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybodyb2a3806431?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de315f-001e-00f1-30fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "0938ed53-db27-4a13-a91b-25e4ab181c76" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploademptybody0blockblobapitestuploademptybodyb2a3806431", "javablobuploademptybody1451389d2ea735a09f48e59" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploaderror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploaderror.json new file mode 100644 index 000000000000..6480d4920e50 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploaderror.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderroraee087398438bb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813357544A9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de4a36-001e-00f1-3ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "fbc6c2af-09fc-4537-b2c9-c86441a44d91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderroraee087398438bb/javablobuploaderror1blockblobapitestuploaderroraee681093858", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813357A79E7\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de4a7c-001e-00f1-7bfc-59e1e5000000", + "x-ms-client-request-id" : "cec43924-8550-451c-b55b-fd6684dd1101" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderroraee087398438bb/javablobuploaderror2blockblobapitestuploaderroraee299465371", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "b1de4ac0-001e-00f1-38fc-59e1e5000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:b1de4ac0-001e-00f1-38fc-59e1e5000000\nTime:2019-08-23T21:45:26.3232551Zx-ms-lease-idid", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "7d04d0cd-b20e-4414-96bd-a33e9078a1e4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploaderror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de4afb-001e-00f1-6efc-59e1e5000000", + "Body" : "jtcuploaderrorjtcuploaderror0blockblobapitestuploaderroraee087398438bbFri, 23 Aug 2019 21:45:26 GMT\"0x8D72813357544A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "2f55201c-14ff-432a-bf46-1800194bbde3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderroraee087398438bb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de4b2d-001e-00f1-1dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:25 GMT", + "x-ms-client-request-id" : "9eb24512-0ed9-42b1-bbb4-e9035e885378" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploaderror0blockblobapitestuploaderroraee087398438bb", "javablobuploaderror1blockblobapitestuploaderroraee681093858", "javablobuploaderror2blockblobapitestuploaderroraee299465371" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[0].json new file mode 100644 index 000000000000..59534091519a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[0].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders090709876112?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281333AEE212\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de33ba-001e-00f1-69fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "81528682-4720-4d4d-90e2-e7621206709b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders090709876112/javablobuploadheaders1blockblobapitestuploadheaders09015856f3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281333B4176C\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de33ff-001e-00f1-2afc-59e1e5000000", + "x-ms-client-request-id" : "034bdab0-1359-4b91-817f-874cda542491" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders090709876112/javablobuploadheaders1blockblobapitestuploadheaders09015856f3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281333B8D37A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de343b-001e-00f1-63fc-59e1e5000000", + "x-ms-client-request-id" : "5c30ba78-fe8d-4648-91bf-ed41ac6f2536" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders090709876112/javablobuploadheaders1blockblobapitestuploadheaders09015856f3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7281333B8D37A\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b1de3483-001e-00f1-26fc-59e1e5000000", + "x-ms-client-request-id" : "18a566fe-b455-4803-b789-d16fbb8ef50d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de34bf-001e-00f1-60fc-59e1e5000000", + "Body" : "jtcuploadheadersjtcuploadheaders0blockblobapitestuploadheaders090709876112Fri, 23 Aug 2019 21:45:23 GMT\"0x8D7281333AEE212\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "158c738e-2f4f-4399-b85c-92d702562983", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders090709876112?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de34fd-001e-00f1-1afc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "742c4a90-3f50-4aaf-b897-1d933242ff91" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadheaders0blockblobapitestuploadheaders090709876112", "javablobuploadheaders1blockblobapitestuploadheaders09015856f3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[1].json new file mode 100644 index 000000000000..81bd006395bc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[1].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersd9454081a1ff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281333CB98E5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de354b-001e-00f1-5ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "205f1678-ea29-4859-9d1f-99c9b07cf7db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersd9454081a1ff/javablobuploadheaders1blockblobapitestuploadheadersd9498528fb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281333D191B2\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3586-001e-00f1-17fc-59e1e5000000", + "x-ms-client-request-id" : "7f1e2feb-8702-4882-8080-3c422d506069" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersd9454081a1ff/javablobuploadheaders1blockblobapitestuploadheadersd9498528fb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281333D64DCA\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de35bf-001e-00f1-4efc-59e1e5000000", + "x-ms-client-request-id" : "57b9e25e-0827-4afb-a5f8-6e31d152b376" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersd9454081a1ff/javablobuploadheaders1blockblobapitestuploadheadersd9498528fb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b1de360f-001e-00f1-1dfc-59e1e5000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D7281333D64DCA\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "77656b59-c4de-4c9a-bfdb-6b3c65c1f58d", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3647-001e-00f1-52fc-59e1e5000000", + "Body" : "jtcuploadheadersjtcuploadheaders0blockblobapitestuploadheadersd9454081a1ffFri, 23 Aug 2019 21:45:23 GMT\"0x8D7281333CB98E5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "b0cb6541-48f8-45c9-b5f0-9cf7ee52cf7f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersd9454081a1ff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3680-001e-00f1-04fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "d1189a2c-446f-4d17-b9f7-78b199b4610e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadheaders0blockblobapitestuploadheadersd9454081a1ff", "javablobuploadheaders1blockblobapitestuploadheadersd9498528fb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[0].json new file mode 100644 index 000000000000..c1850d5532a5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[0].json @@ -0,0 +1,585 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument01194916250bb935144ece?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281333296C22\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3caff1-301e-0118-0afc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "d1e3b487-6a6b-4b7d-b14e-8ee2f1ddabb5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument01194916250bb935144ece/javablobuploadillegalargument16061627597d63ddfb4f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813332EC116\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3cafff-301e-0118-16fc-595bb6000000", + "x-ms-client-request-id" : "804cb461-c027-4207-9b1d-84546dbd5dfc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument01194916250bb935144ece/javablobuploadillegalargument16061627597d63ddfb4f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "lambda$null$1", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 147, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "MonoCallable.java", + "lineNumber" : 91, + "className" : "reactor.core.publisher.MonoCallable", + "nativeMethod" : false + }, { + "methodName" : "drain", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 402, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 244, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxJust.java", + "lineNumber" : 99, + "className" : "reactor.core.publisher.FluxJust$WeakScalarSubscription", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 162, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 229, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 90, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxJust.java", + "lineNumber" : 70, + "className" : "reactor.core.publisher.FluxJust", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 63, + "className" : "reactor.core.publisher.FluxMapFuseable", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxConcatMap", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "Flux.java", + "lineNumber" : 7921, + "className" : "reactor.core.publisher.Flux", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FluxSubscribeOn.java", + "lineNumber" : 194, + "className" : "reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 84, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 37, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FutureTask.java", + "lineNumber" : 266, + "className" : "java.util.concurrent.FutureTask", + "nativeMethod" : false + }, { + "methodName" : "access$201", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 180, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 293, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "runWorker", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 1149, + "className" : "java.util.concurrent.ThreadPoolExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 624, + "className" : "java.util.concurrent.ThreadPoolExecutor$Worker", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : null, + "localizedMessage" : null, + "suppressed" : [ { + "cause" : null, + "stackTrace" : [ { + "methodName" : "blockingGet", + "fileName" : "BlockingSingleSubscriber.java", + "lineNumber" : 93, + "className" : "reactor.core.publisher.BlockingSingleSubscriber", + "nativeMethod" : false + }, { + "methodName" : "block", + "fileName" : "Mono.java", + "lineNumber" : 1494, + "className" : "reactor.core.publisher.Mono", + "nativeMethod" : false + }, { + "methodName" : "blockWithOptionalTimeout", + "fileName" : "Utility.java", + "lineNumber" : 235, + "className" : "com.azure.storage.common.Utility", + "nativeMethod" : false + }, { + "methodName" : "uploadWithResponse", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 156, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "upload", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 115, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : null, + "lineNumber" : -1, + "className" : "sun.reflect.GeneratedMethodAccessor49", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 213, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 56, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite", + "nativeMethod" : false + }, { + "methodName" : "defaultCall", + "fileName" : "CallSiteArray.java", + "lineNumber" : 48, + "className" : "org.codehaus.groovy.runtime.callsite.CallSiteArray", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "AbstractCallSite.java", + "lineNumber" : 113, + "className" : "org.codehaus.groovy.runtime.callsite.AbstractCallSite", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "AbstractCallSite.java", + "lineNumber" : 133, + "className" : "org.codehaus.groovy.runtime.callsite.AbstractCallSite", + "nativeMethod" : false + }, { + "methodName" : "$spock_feature_1_36", + "fileName" : "BlockBlobAPITest.groovy", + "lineNumber" : 583, + "className" : "com.azure.storage.blob.BlockBlobAPITest", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invokeMethod", + "fileName" : "ReflectionUtil.java", + "lineNumber" : 188, + "className" : "org.spockframework.util.ReflectionUtil", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "MethodInfo.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.model.MethodInfo", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatureMethod", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 406, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 324, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 309, + "className" : "org.spockframework.runtime.BaseSpecRunner$6", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 288, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "initializeAndRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 278, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIterations", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 139, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runParameterizedFeature", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 41, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 262, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 246, + "className" : "org.spockframework.runtime.BaseSpecRunner$5", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 238, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatures", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 188, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 98, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.BaseSpecRunner$1", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 76, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 67, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Sputnik.java", + "lineNumber" : 63, + "className" : "org.spockframework.runtime.Sputnik", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 128, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 27, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 290, + "className" : "org.junit.runners.ParentRunner$3", + "nativeMethod" : false + }, { + "methodName" : "schedule", + "fileName" : "ParentRunner.java", + "lineNumber" : 71, + "className" : "org.junit.runners.ParentRunner$1", + "nativeMethod" : false + }, { + "methodName" : "runChildren", + "fileName" : "ParentRunner.java", + "lineNumber" : 288, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "ParentRunner.java", + "lineNumber" : 58, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "evaluate", + "fileName" : "ParentRunner.java", + "lineNumber" : 268, + "className" : "org.junit.runners.ParentRunner$2", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 363, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "JUnitCore.java", + "lineNumber" : 137, + "className" : "org.junit.runner.JUnitCore", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "JUnit4IdeaTestRunner.java", + "lineNumber" : 68, + "className" : "com.intellij.junit4.JUnit4IdeaTestRunner", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "IdeaTestRunner.java", + "lineNumber" : 47, + "className" : "com.intellij.rt.execution.junit.IdeaTestRunner$Repeater", + "nativeMethod" : false + }, { + "methodName" : "prepareStreamsAndStart", + "fileName" : "JUnitStarter.java", + "lineNumber" : 242, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + }, { + "methodName" : "main", + "fileName" : "JUnitStarter.java", + "lineNumber" : 70, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + } ], + "message" : "#block terminated with an error", + "localizedMessage" : "#block terminated with an error", + "suppressed" : [ ] + } ] + }, + "ClassName" : "java.lang.NullPointerException" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadillegalargument&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "a4f5b8a3-e01e-00fb-36fc-59f86c000000", + "Body" : "jtcuploadillegalargumentjtcuploadillegalargument01194916250bb935144eceFri, 23 Aug 2019 21:45:22 GMT\"0x8D7281333296C22\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "3c4e31ba-40a9-4faa-b85a-0f857a220da7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument01194916250bb935144ece?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "a4f5b8c5-e01e-00fb-56fc-59f86c000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "481389f5-6560-4736-8359-1bcb5d6058ae" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadillegalargument01194916250bb935144ece", "javablobuploadillegalargument16061627597d63ddfb4f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[1].json new file mode 100644 index 000000000000..788428791116 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[1].json @@ -0,0 +1,591 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument055604137b214d37d2427a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813334B4DE0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "a4f5b8e3-e01e-00fb-72fc-59f86c000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "d6518b45-fd20-4bbb-ae5c-a64d76ba58b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument055604137b214d37d2427a/javablobuploadillegalargument134088e206f176748948", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728133350F77D\"", + "Content-Length" : "0", + "x-ms-request-id" : "a4f5b8f7-e01e-00fb-05fc-59f86c000000", + "x-ms-client-request-id" : "85ab9f4f-864a-41a0-89ce-785c2e7ce1e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument055604137b214d37d2427a/javablobuploadillegalargument134088e206f176748948", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "read", + "fileName" : "ByteArrayInputStream.java", + "lineNumber" : 180, + "className" : "java.io.ByteArrayInputStream", + "nativeMethod" : false + }, { + "methodName" : "lambda$null$1", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 147, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "MonoCallable.java", + "lineNumber" : 91, + "className" : "reactor.core.publisher.MonoCallable", + "nativeMethod" : false + }, { + "methodName" : "drain", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 402, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 244, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxJust.java", + "lineNumber" : 99, + "className" : "reactor.core.publisher.FluxJust$WeakScalarSubscription", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 162, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 229, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 90, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxJust.java", + "lineNumber" : 70, + "className" : "reactor.core.publisher.FluxJust", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 63, + "className" : "reactor.core.publisher.FluxMapFuseable", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxConcatMap", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "Flux.java", + "lineNumber" : 7921, + "className" : "reactor.core.publisher.Flux", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FluxSubscribeOn.java", + "lineNumber" : 194, + "className" : "reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 84, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 37, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FutureTask.java", + "lineNumber" : 266, + "className" : "java.util.concurrent.FutureTask", + "nativeMethod" : false + }, { + "methodName" : "access$201", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 180, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 293, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "runWorker", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 1149, + "className" : "java.util.concurrent.ThreadPoolExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 624, + "className" : "java.util.concurrent.ThreadPoolExecutor$Worker", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : null, + "localizedMessage" : null, + "suppressed" : [ { + "cause" : null, + "stackTrace" : [ { + "methodName" : "blockingGet", + "fileName" : "BlockingSingleSubscriber.java", + "lineNumber" : 93, + "className" : "reactor.core.publisher.BlockingSingleSubscriber", + "nativeMethod" : false + }, { + "methodName" : "block", + "fileName" : "Mono.java", + "lineNumber" : 1494, + "className" : "reactor.core.publisher.Mono", + "nativeMethod" : false + }, { + "methodName" : "blockWithOptionalTimeout", + "fileName" : "Utility.java", + "lineNumber" : 235, + "className" : "com.azure.storage.common.Utility", + "nativeMethod" : false + }, { + "methodName" : "uploadWithResponse", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 156, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "upload", + "fileName" : "BlockBlobClient.java", + "lineNumber" : 115, + "className" : "com.azure.storage.blob.BlockBlobClient", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : null, + "lineNumber" : -1, + "className" : "sun.reflect.GeneratedMethodAccessor49", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 213, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 56, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite", + "nativeMethod" : false + }, { + "methodName" : "defaultCall", + "fileName" : "CallSiteArray.java", + "lineNumber" : 48, + "className" : "org.codehaus.groovy.runtime.callsite.CallSiteArray", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "PojoMetaMethodSite.java", + "lineNumber" : 58, + "className" : "org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "AbstractCallSite.java", + "lineNumber" : 133, + "className" : "org.codehaus.groovy.runtime.callsite.AbstractCallSite", + "nativeMethod" : false + }, { + "methodName" : "$spock_feature_1_36", + "fileName" : "BlockBlobAPITest.groovy", + "lineNumber" : 583, + "className" : "com.azure.storage.blob.BlockBlobAPITest", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invokeMethod", + "fileName" : "ReflectionUtil.java", + "lineNumber" : 188, + "className" : "org.spockframework.util.ReflectionUtil", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "MethodInfo.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.model.MethodInfo", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatureMethod", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 406, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 324, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 309, + "className" : "org.spockframework.runtime.BaseSpecRunner$6", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 288, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "initializeAndRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 278, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIterations", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 139, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runParameterizedFeature", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 41, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 262, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 246, + "className" : "org.spockframework.runtime.BaseSpecRunner$5", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 238, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatures", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 188, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 98, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.BaseSpecRunner$1", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 76, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 67, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Sputnik.java", + "lineNumber" : 63, + "className" : "org.spockframework.runtime.Sputnik", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 128, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 27, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 290, + "className" : "org.junit.runners.ParentRunner$3", + "nativeMethod" : false + }, { + "methodName" : "schedule", + "fileName" : "ParentRunner.java", + "lineNumber" : 71, + "className" : "org.junit.runners.ParentRunner$1", + "nativeMethod" : false + }, { + "methodName" : "runChildren", + "fileName" : "ParentRunner.java", + "lineNumber" : 288, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "ParentRunner.java", + "lineNumber" : 58, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "evaluate", + "fileName" : "ParentRunner.java", + "lineNumber" : 268, + "className" : "org.junit.runners.ParentRunner$2", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 363, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "JUnitCore.java", + "lineNumber" : 137, + "className" : "org.junit.runner.JUnitCore", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "JUnit4IdeaTestRunner.java", + "lineNumber" : 68, + "className" : "com.intellij.junit4.JUnit4IdeaTestRunner", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "IdeaTestRunner.java", + "lineNumber" : 47, + "className" : "com.intellij.rt.execution.junit.IdeaTestRunner$Repeater", + "nativeMethod" : false + }, { + "methodName" : "prepareStreamsAndStart", + "fileName" : "JUnitStarter.java", + "lineNumber" : 242, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + }, { + "methodName" : "main", + "fileName" : "JUnitStarter.java", + "lineNumber" : 70, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + } ], + "message" : "#block terminated with an error", + "localizedMessage" : "#block terminated with an error", + "suppressed" : [ ] + } ] + }, + "ClassName" : "java.lang.IndexOutOfBoundsException" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadillegalargument&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de2ffc-001e-00f1-5bfc-59e1e5000000", + "Body" : "jtcuploadillegalargumentjtcuploadillegalargument055604137b214d37d2427aFri, 23 Aug 2019 21:45:22 GMT\"0x8D72813334B4DE0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "c7942780-22c4-42b6-8f45-921dad48a7ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadillegalargument055604137b214d37d2427a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3034-001e-00f1-0efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "2b6a9da1-c139-4c77-80e0-3389667bb4d7" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadillegalargument055604137b214d37d2427a", "javablobuploadillegalargument134088e206f176748948" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[0].json new file mode 100644 index 000000000000..47304fffb624 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[0].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata24683293c92?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281333E9D6AE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de36d8-001e-00f1-58fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "09145a76-39a9-4abd-be3e-5124fa9b126c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata24683293c92/javablobuploadmetadata1blockblobapitestuploadmetadata24624888e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281333EF0C02\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de371e-001e-00f1-1dfc-59e1e5000000", + "x-ms-client-request-id" : "05c4cf28-d319-4b82-898c-30d3e3ee4e3a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata24683293c92/javablobuploadmetadata1blockblobapitestuploadmetadata24624888e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281333F72448\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de378f-001e-00f1-08fc-59e1e5000000", + "x-ms-client-request-id" : "1b5af6f4-3ecc-475f-9514-e8f2be142568" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata24683293c92/javablobuploadmetadata1blockblobapitestuploadmetadata24624888e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7281333F72448\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b1de37db-001e-00f1-50fc-59e1e5000000", + "x-ms-client-request-id" : "06bdee40-f367-441f-813a-f735cdf5fe30", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3803-001e-00f1-75fc-59e1e5000000", + "Body" : "jtcuploadmetadatajtcuploadmetadata0blockblobapitestuploadmetadata24683293c92Fri, 23 Aug 2019 21:45:23 GMT\"0x8D7281333E9D6AE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "d6ef5358-1850-4076-b997-f709cf9439b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata24683293c92?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de382f-001e-00f1-1ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "1cb8a78a-58e0-4c3a-a77b-621c6d839421" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadmetadata0blockblobapitestuploadmetadata24683293c92", "javablobuploadmetadata1blockblobapitestuploadmetadata24624888e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[1].json new file mode 100644 index 000000000000..6a4bb85a6668 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[1].json @@ -0,0 +1,143 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata12c10244c64?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813340CA978\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de3890-001e-00f1-7dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "a1d0e12e-eba4-401d-af18-624d6e444aa8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata12c10244c64/javablobuploadmetadata1blockblobapitestuploadmetadata12c819691", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813341C1A80\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3931-001e-00f1-1afc-59e1e5000000", + "x-ms-client-request-id" : "47a5c1d8-4359-49d4-95c1-01c2763c350e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata12c10244c64/javablobuploadmetadata1blockblobapitestuploadmetadata12c819691", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281334214BE2\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de395e-001e-00f1-46fc-59e1e5000000", + "x-ms-client-request-id" : "b2325b73-e6aa-47dc-99fa-23818f9e6fb3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata12c10244c64/javablobuploadmetadata1blockblobapitestuploadmetadata12c819691", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7281334214BE2\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "b1de39a4-001e-00f1-07fc-59e1e5000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "f6356430-660c-4eae-89ca-20b1a937f27e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de39f2-001e-00f1-4dfc-59e1e5000000", + "Body" : "jtcuploadmetadatajtcuploadmetadata0blockblobapitestuploadmetadata12c10244c64Fri, 23 Aug 2019 21:45:23 GMT\"0x8D72813340CA978\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "4bab3007-f913-4e72-bf64-5108a123deb8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata12c10244c64?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de3a36-001e-00f1-0bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:23 GMT", + "x-ms-client-request-id" : "fce60f18-586c-46b4-b298-61cb0cf664f2" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadmetadata0blockblobapitestuploadmetadata12c10244c64", "javablobuploadmetadata1blockblobapitestuploadmetadata12c819691" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmin.json new file mode 100644 index 000000000000..175ba7668803 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmin.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadminf0b04292417c9764?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813330FEA54\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0a3caf8c-301e-0118-34fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "b2c8b1f2-49b5-4437-9e44-df1386054f9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadminf0b04292417c9764/javablobuploadmin1blockblobapitestuploadminf0b934307aed13", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7281333153F65\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3cafa8-301e-0118-4cfc-595bb6000000", + "x-ms-client-request-id" : "29244fe2-2c71-409f-a79d-66c52fbf17e3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadminf0b04292417c9764/javablobuploadmin1blockblobapitestuploadminf0b934307aed13", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813331A2298\"", + "Content-Length" : "0", + "x-ms-request-id" : "0a3cafb9-301e-0118-5afc-595bb6000000", + "x-ms-client-request-id" : "11e4c12e-283d-412b-86f5-c61520c93728" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cafc6-301e-0118-66fc-595bb6000000", + "Body" : "jtcuploadminjtcuploadmin0blockblobapitestuploadminf0b04292417c9764Fri, 23 Aug 2019 21:45:22 GMT\"0x8D72813330FEA54\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:21 GMT", + "x-ms-client-request-id" : "6ccb7eab-2dca-49a9-9414-7d94def14373", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadminf0b04292417c9764?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "0a3cafd9-301e-0118-75fc-595bb6000000", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "3568499d-e2cf-4842-95a3-b1767ff4f78c" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadmin0blockblobapitestuploadminf0b04292417c9764", "javablobuploadmin1blockblobapitestuploadminf0b934307aed13" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadnullbody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadnullbody.json new file mode 100644 index 000000000000..56fa5b8543bf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadnullbody.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadnullbody0blockblobapitestuploadnullbody75c50615baa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133386DDE6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de31a5-001e-00f1-74fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "da12f559-2550-4645-92df-4cceecf15edb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadnullbody0blockblobapitestuploadnullbody75c50615baa/javablobuploadnullbody1blockblobapitestuploadnullbody75c48194f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813338C132F\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de31e3-001e-00f1-2ffc-59e1e5000000", + "x-ms-client-request-id" : "a8857365-1fbf-4be0-bf71-c46601efdb7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadnullbody0blockblobapitestuploadnullbody75c50615baa/javablobuploadnullbody1blockblobapitestuploadnullbody75c48194f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AAAAAAAAAAA=", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "\"0x8D7281333914491\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1de3235-001e-00f1-7cfc-59e1e5000000", + "x-ms-client-request-id" : "352be704-eada-4ed3-98ce-d44f383c3aef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadnullbody&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de328b-001e-00f1-4bfc-59e1e5000000", + "Body" : "jtcuploadnullbodyjtcuploadnullbody0blockblobapitestuploadnullbody75c50615baaFri, 23 Aug 2019 21:45:23 GMT\"0x8D728133386DDE6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "97deffb7-70c3-4684-bea3-ec449bf07ac0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadnullbody0blockblobapitestuploadnullbody75c50615baa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de32b5-001e-00f1-73fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:22 GMT", + "x-ms-client-request-id" : "3670257f-f122-4421-a728-20a225ddf47f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadnullbody0blockblobapitestuploadnullbody75c50615baa", "javablobuploadnullbody1blockblobapitestuploadnullbody75c48194f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[0].json new file mode 100644 index 000000000000..51fdfa6031a8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[0].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease7bf27978ef1d9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281396D5A21F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2b3b-501e-00c0-7bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "417a31f3-9559-46db-ba80-f0406e8e5739" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease7bf27978ef1d9?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281396D5A21F\"", + "x-ms-lease-id" : "ea56ed3a-96a9-48e7-ad0d-75b81bf978d8", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2b5e-501e-00c0-19fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "163742f4-e9d1-46be-ac0e-0e648a4dc1b7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease7bf27978ef1d9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "leased", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7281396D5A21F\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "77cf2b7d-501e-00c0-37fc-59ba32000000", + "x-ms-client-request-id" : "ddb24773-9b28-4cbb-b8ba-19d33ef3eb3f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquirelease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2b9a-501e-00c0-54fc-59ba32000000", + "Body" : "jtcacquireleasejtcacquirelease0containerapitestacquirelease7bf27978ef1d9Fri, 23 Aug 2019 21:48:09 GMT\"0x8D7281396D5A21F\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "91b21a06-7c5e-4c49-81f6-94110df14ee6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease7bf27978ef1d9?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281396D5A21F\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf2bb5-501e-00c0-6efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "1404a80c-ca84-4cce-b53f-5dd55316db04" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease7bf27978ef1d9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2bea-501e-00c0-23fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "4ced83b1-79d5-4192-bcbf-e72aae4b8e6d" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0containerapitestacquirelease7bf27978ef1d9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[1].json new file mode 100644 index 000000000000..e39771de47e6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[1].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease7e835298c1bb2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281396F7D87D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2c20-501e-00c0-57fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "c70e6105-6718-49e7-8f08-9e5c30411426" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease7e835298c1bb2?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281396F7D87D\"", + "x-ms-lease-id" : "18beedc1-f494-4ea8-b1bb-46dca50c6046", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2c47-501e-00c0-78fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "fb37c619-c4fb-4a9d-8d98-1b5e827fdcbe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease7e835298c1bb2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "leased", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7281396F7D87D\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "fixed", + "Content-Length" : "0", + "x-ms-request-id" : "77cf2c5d-501e-00c0-0efc-59ba32000000", + "x-ms-client-request-id" : "24ae9994-ab7b-452c-b7b2-85898b42032a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquirelease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2c78-501e-00c0-29fc-59ba32000000", + "Body" : "jtcacquireleasejtcacquirelease0containerapitestacquirelease7e835298c1bb2Fri, 23 Aug 2019 21:48:09 GMT\"0x8D7281396F7D87D\"lockedleasedfixed$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "b1e27091-ba03-497e-92f7-0fdcadb69ca9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease7e835298c1bb2?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281396F7D87D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf2c9b-501e-00c0-4cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "a0fa70fa-24cf-434c-9b14-4681e89a6d72" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease7e835298c1bb2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2cc0-501e-00c0-70fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "bc38b8d0-db52-4b35-b5a2-468645dfe9b1" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0containerapitestacquirelease7e835298c1bb2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[2].json new file mode 100644 index 000000000000..2cf4e0c1bfae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[2].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease80b91128c0048?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139716646C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2ce4-501e-00c0-11fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "2af3b186-6bed-4089-8054-990981f11a8f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease80b91128c0048?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139716646C\"", + "x-ms-lease-id" : "dd214ddc-e49e-4696-b43e-206c16a59135", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2d10-501e-00c0-38fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "2cec289a-0a93-4797-afdc-92f08fe20693" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease80b91128c0048?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "leased", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728139716646C\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "77cf2d31-501e-00c0-59fc-59ba32000000", + "x-ms-client-request-id" : "225ca774-5fb2-467a-aed2-08950eb23750" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquirelease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2d56-501e-00c0-7cfc-59ba32000000", + "Body" : "jtcacquireleasejtcacquirelease0containerapitestacquirelease80b91128c0048Fri, 23 Aug 2019 21:48:10 GMT\"0x8D728139716646C\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "59f46ba0-95a3-4bca-823a-4d912115120c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease80b91128c0048?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139716646C\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf2d6c-501e-00c0-11fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "7c9e6e4a-7673-4a64-acfc-cf31d005b4c7" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease80b91128c0048?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2d7c-501e-00c0-21fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "30194551-ea92-46c7-99ed-556747af19a4" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0containerapitestacquirelease80b91128c0048" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[0].json new file mode 100644 index 000000000000..b2c9ed594b0b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseaca41670399de?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813974F3593\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2e22-501e-00c0-3afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "3f1659cd-0779-4894-a6c4-c8c4a000556f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseaca41670399de?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813974F3593\"", + "x-ms-lease-id" : "20ca41dc-b0ae-4f43-b048-d43c8928156f", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2e42-501e-00c0-55fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "1015531e-d174-4902-a194-7a6e42318870" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2e5e-501e-00c0-70fc-59ba32000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0containerapitestacquireleaseaca41670399deFri, 23 Aug 2019 21:48:10 GMT\"0x8D72813974F3593\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "d283b381-3a13-4fee-a7ed-e37fd1e02a43", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseaca41670399de?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813974F3593\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf2e76-501e-00c0-07fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "a8e3e026-da4b-439c-aff2-5495d3f21f8a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseaca41670399de?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2e8f-501e-00c0-1ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "de7c03d7-6671-42ff-b9e5-9501fa6969ee" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0containerapitestacquireleaseaca41670399de" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[1].json new file mode 100644 index 000000000000..9f28e15a1a6c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac97c71743095?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139769F002\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2eae-501e-00c0-3dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "e0ab7f38-0d9b-4fce-ac06-7a23552a00dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac97c71743095?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139769F002\"", + "x-ms-lease-id" : "3c67c794-e4cb-4b29-896a-2aa298f697f1", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2ed2-501e-00c0-5efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "3ebb3217-08cd-4165-a054-595370ae5b6e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2efd-501e-00c0-05fc-59ba32000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0containerapitestacquireleaseac97c71743095Fri, 23 Aug 2019 21:48:10 GMT\"0x8D728139769F002\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "d50a14f5-e6d7-497c-b24d-9911bbee85dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac97c71743095?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139769F002\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf2f15-501e-00c0-1cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "6ad13a3a-c80b-462e-b83e-f427f2ecdd76" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac97c71743095?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2f2b-501e-00c0-31fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "58f58e35-4996-4ace-bbdd-4d458378f891" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0containerapitestacquireleaseac97c71743095" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[2].json new file mode 100644 index 000000000000..5fddf5eac0a8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac73480829fb3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813978546DC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2f5a-501e-00c0-5bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "1bfc8055-34be-4959-b885-746a96f2441e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac73480829fb3?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813978546DC\"", + "x-ms-lease-id" : "6904f8da-8054-48b2-bf86-5fd449678ea9", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2f7f-501e-00c0-7bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "63684051-080b-4782-8367-290796c7f8ca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2f91-501e-00c0-0bfc-59ba32000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0containerapitestacquireleaseac73480829fb3Fri, 23 Aug 2019 21:48:10 GMT\"0x8D72813978546DC\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "db89217c-0be4-4add-9e50-cb5020e74bdc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac73480829fb3?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813978546DC\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf2fa5-501e-00c0-1ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "bf79a26a-e006-429c-b927-2e0e64d40845" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseac73480829fb3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2fbd-501e-00c0-35fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "d0c31552-8489-47a2-a463-b795c9135246" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0containerapitestacquireleaseac73480829fb3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[0].json new file mode 100644 index 000000000000..aebec707c064 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[0].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0640729d1073fe8a24411eb5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281397A0015D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2fe9-501e-00c0-61fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "7bc5dd53-e482-4296-bee7-6c5b62859b7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0640729d1073fe8a24411eb5?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77cf3065-501e-00c0-53fc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77cf3065-501e-00c0-53fc-59ba32000000\nTime:2019-08-23T21:48:11.0721031Z", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "35d360b8-c4d3-4bf1-9e6f-5733fbb8c0bf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf3085-501e-00c0-71fc-59ba32000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0640729d1073fe8a24411eb5Fri, 23 Aug 2019 21:48:10 GMT\"0x8D7281397A0015D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "6e9d9dcd-a7bc-4efd-9797-aceee77f083f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0640729d1073fe8a24411eb5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf30ae-501e-00c0-17fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "8379b2c4-7c30-466d-af40-5334fb1b45e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0640729d1073fe8a24411eb5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[1].json new file mode 100644 index 000000000000..82b143446197 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[1].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0222312ad2cb4ded3342838d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281397C1E97A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf30d6-501e-00c0-39fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "fc52a491-e4d3-4e24-a2f0-ecc5bb51d7f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0222312ad2cb4ded3342838d?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77cf30fd-501e-00c0-5cfc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77cf30fd-501e-00c0-5cfc-59ba32000000\nTime:2019-08-23T21:48:11.2102343Z", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "17683e3b-5da3-4fb4-abe9-4d3be7943920", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf3123-501e-00c0-79fc-59ba32000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0222312ad2cb4ded3342838dFri, 23 Aug 2019 21:48:11 GMT\"0x8D7281397C1E97A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "a3cdc574-e989-4c9f-ad8c-86b742d8bd2f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacfail0222312ad2cb4ded3342838d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf3150-501e-00c0-1afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "6976eb35-b49d-4e18-87dd-23a71cc228ef" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0222312ad2cb4ded3342838d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[0].json new file mode 100644 index 000000000000..c26acc85fef6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacillegal074704c1b8d43e78164d0b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281397D5EB93\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf318b-501e-00c0-45fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "3e47da1d-6288-4956-b2db-1cb12643cde9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf31b8-501e-00c0-6cfc-59ba32000000", + "Body" : "jtcacquireleaseacillegaljtcacquireleaseacillegal074704c1b8d43e78164d0bFri, 23 Aug 2019 21:48:11 GMT\"0x8D7281397D5EB93\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "b8970764-6ada-40fa-ba36-0c7a7a04c29c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacillegal074704c1b8d43e78164d0b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf31d6-501e-00c0-05fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "a05c03b4-8a5b-41fc-a17d-7be0916f71fe" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacillegal074704c1b8d43e78164d0b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[1].json new file mode 100644 index 000000000000..14593e6fbd9a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacillegal066588661b8e9d14464592?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281397E64334\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf3206-501e-00c0-2ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "34d18e2d-bba1-4b4d-9be3-187f78e237fe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf322a-501e-00c0-4efc-59ba32000000", + "Body" : "jtcacquireleaseacillegaljtcacquireleaseacillegal066588661b8e9d14464592Fri, 23 Aug 2019 21:48:11 GMT\"0x8D7281397E64334\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "d25f4a48-f07d-42ce-aa52-f51adb8dc848", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseacillegal066588661b8e9d14464592?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf3244-501e-00c0-63fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "39921f50-432e-44fd-813d-14e709c78db3" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacillegal066588661b8e9d14464592" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseerror.json new file mode 100644 index 000000000000..568c6ae90514 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseerror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0containerapitestacquireleaseerrorab869217?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281397F62833\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf3276-501e-00c0-0dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "c8e913ca-db32-4cd0-a89c-f8f8fb669a7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror1containerapitestacquireleaseerrorab802648?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf32a5-501e-00c0-33fc-59ba32000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:77cf32a5-501e-00c0-33fc-59ba32000000\nTime:2019-08-23T21:48:11.5625718Z", + "Date" : "Fri, 23 Aug 2019 21:48:10 GMT", + "x-ms-client-request-id" : "afd9b986-54cb-4a60-bcec-d002b440369b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleaseerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf32c9-501e-00c0-4cfc-59ba32000000", + "Body" : "jtcacquireleaseerrorjtcacquireleaseerror0containerapitestacquireleaseerrorab869217Fri, 23 Aug 2019 21:48:11 GMT\"0x8D7281397F62833\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:11 GMT", + "x-ms-client-request-id" : "bc2361b6-4312-4128-bb5f-2c12eeb97a70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleaseerror0containerapitestacquireleaseerrorab869217?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf32e0-501e-00c0-61fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:11 GMT", + "x-ms-client-request-id" : "801dfcb5-4d84-4be4-838f-bb8e03e39895" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseerror0containerapitestacquireleaseerrorab869217", "jtcacquireleaseerror1containerapitestacquireleaseerrorab802648" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleasemin.json new file mode 100644 index 000000000000..0b00f36dda66 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleasemin.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleaseminea0803015b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139735177D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2da0-501e-00c0-43fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "baebe301-bbe5-4b28-b552-7829f70065c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleaseminea0803015b?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139735177D\"", + "x-ms-lease-id" : "39160c1e-fa59-4091-968a-87f55a97f4e5", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2db9-501e-00c0-56fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "d11cc831-3b0b-419a-a785-e0024f4f9b22" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcacquireleasemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2dd2-501e-00c0-6dfc-59ba32000000", + "Body" : "jtcacquireleaseminjtcacquireleasemin0containerapitestacquireleaseminea0803015bFri, 23 Aug 2019 21:48:10 GMT\"0x8D728139735177D\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "0a5ab0d6-3931-4eed-b58d-600df92cc979", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleaseminea0803015b?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139735177D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf2de7-501e-00c0-02fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "bb0c87be-7815-4cda-a645-bce1f48a06c0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleaseminea0803015b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2e03-501e-00c0-1dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "3bbc4c84-83c8-46e2-8ab5-53c2c5e92c0b" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleasemin0containerapitestacquireleaseminea0803015b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[0].json new file mode 100644 index 000000000000..2f25272b7cd0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[0].json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleaseada3191925c988d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A3A4A9FA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7ccd-501e-00c0-0ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "c4d629f2-6b7a-42e8-b297-5fa8779caca3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleaseada3191925c988d?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A3A4A9FA\"", + "x-ms-lease-id" : "613949e1-7325-483d-9545-b79e0cf5a2f3", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7cea-501e-00c0-2afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "fe370b57-fb73-4b84-866d-774ea646e7c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleaseada3191925c988d?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A3A4A9FA\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf7d0c-501e-00c0-49fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "a6fd17b2-808f-421c-87d5-ec81882b963f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleaseada3191925c988d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "broken", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D72813A3A4A9FA\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "77cf7d27-501e-00c0-61fc-59ba32000000", + "x-ms-client-request-id" : "2d872a14-393d-4c86-8559-e28c08828148" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreaklease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7d4e-501e-00c0-7ffc-59ba32000000", + "Body" : "jtcbreakleasejtcbreaklease0containerapitestbreakleaseada3191925c988dFri, 23 Aug 2019 21:48:31 GMT\"0x8D72813A3A4A9FA\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "9f0562d8-19f6-4ea3-90f9-251e21c07a48", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreakleaseada3191925c988d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7d6d-501e-00c0-18fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "ab62bd5f-22f3-4d0f-8cd2-2e9d776b26fe" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0containerapitestbreakleaseada3191925c988d", "613949e1-7325-483d-9545-b79e0cf5a2f3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[1].json new file mode 100644 index 000000000000..6874459f3045 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[1].json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease572650765ba77c1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A3C11278\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7d94-501e-00c0-39fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "373f43d4-0c36-4d4a-b0fb-3b210b10c2cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease572650765ba77c1?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A3C11278\"", + "x-ms-lease-id" : "86cc76fe-778a-464d-81c3-dc1071c4bd6f", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7db0-501e-00c0-4ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "a9902700-544a-40a4-ab9e-cfe714c5c67b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease572650765ba77c1?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A3C11278\"", + "x-ms-lease-time" : "20", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf7dc6-501e-00c0-63fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "6d747b4c-d295-45ac-a8a8-16a05f80419f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease572650765ba77c1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "breaking", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D72813A3C11278\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "77cf7de6-501e-00c0-80fc-59ba32000000", + "x-ms-client-request-id" : "d05f76db-ed8e-4fd6-93fa-ed9f58313ec9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreaklease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cfc982-501e-00c0-3ffc-59ba32000000", + "Body" : "jtcbreakleasejtcbreaklease0containerapitestbreaklease572650765ba77c1Fri, 23 Aug 2019 21:48:31 GMT\"0x8D72813A3C11278\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:50 GMT", + "x-ms-client-request-id" : "4fb60179-a24b-4de6-89d7-dbea890cf00d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease572650765ba77c1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cfc99e-501e-00c0-59fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:50 GMT", + "x-ms-client-request-id" : "d3221a31-4a47-4a57-a44a-9db3e5a98006" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0containerapitestbreaklease572650765ba77c1", "86cc76fe-778a-464d-81c3-dc1071c4bd6f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[2].json new file mode 100644 index 000000000000..7adaef0cd306 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[2].json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease15918112e89565c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813AFCA503E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cfc9bd-501e-00c0-77fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:50 GMT", + "x-ms-client-request-id" : "fc5bf8a6-8342-4949-9063-f183c7edc0a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease15918112e89565c?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813AFCA503E\"", + "x-ms-lease-id" : "478424cb-fd35-440f-9562-e92b88f012d2", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cfc9d7-501e-00c0-0cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:50 GMT", + "x-ms-client-request-id" : "aa19aa7d-c2f4-438b-a87d-fb90939a9a80" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease15918112e89565c?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813AFCA503E\"", + "x-ms-lease-time" : "15", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cfc9e9-501e-00c0-1bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:50 GMT", + "x-ms-client-request-id" : "05510ac6-07bc-4de9-9b7c-0132cc2ae27d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease15918112e89565c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "breaking", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:48:50 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D72813AFCA503E\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "77cfca03-501e-00c0-33fc-59ba32000000", + "x-ms-client-request-id" : "5f6ee632-ae9c-4152-b510-04005223a061" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreaklease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cfffc3-501e-00c0-45fc-59ba32000000", + "Body" : "jtcbreakleasejtcbreaklease0containerapitestbreaklease15918112e89565cFri, 23 Aug 2019 21:48:51 GMT\"0x8D72813AFCA503E\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:05 GMT", + "x-ms-client-request-id" : "0cee0891-2f7c-44b3-aec6-67c7fea24e11", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease15918112e89565c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cfffe8-501e-00c0-65fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "46c8d5e0-0b86-4d70-b7a2-e0f9261ae56b" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0containerapitestbreaklease15918112e89565c", "478424cb-fd35-440f-9562-e92b88f012d2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[0].json new file mode 100644 index 000000000000..725731c8874f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac62f231779dfe8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B8F6212D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d000a0-501e-00c0-0ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "51c263e9-2b4d-485d-bdb2-00cca92c78d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac62f231779dfe8?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B8F6212D\"", + "x-ms-lease-id" : "d59300ce-b4d7-4d66-8669-9a4fce046923", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d000bf-501e-00c0-27fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "26cee4cc-6d4b-4f40-816c-37f00e158458" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac62f231779dfe8?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B8F6212D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d000e0-501e-00c0-47fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "0888c378-ed60-452c-a395-5d7d573e895a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d000f8-501e-00c0-5cfc-59ba32000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0containerapitestbreakleaseac62f231779dfe8Fri, 23 Aug 2019 21:49:06 GMT\"0x8D72813B8F6212D\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "e645e249-36b1-4f35-86f0-93dcb81f8de1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac62f231779dfe8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00117-501e-00c0-79fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "47796c3c-6260-4109-802b-27c3b591824d" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0containerapitestbreakleaseac62f231779dfe8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[1].json new file mode 100644 index 000000000000..4452cca73a29 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac0e0832759c455?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B912629B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00158-501e-00c0-35fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "1bf9cbbb-3672-4547-a3b9-e99d0afebfe3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac0e0832759c455?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B912629B\"", + "x-ms-lease-id" : "8b596804-5fe7-41b8-ba4d-3613de558fbe", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00195-501e-00c0-6dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "00938a97-4021-4755-84f7-8bd78e837007" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac0e0832759c455?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B912629B\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d001b0-501e-00c0-05fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "d49c842d-8231-4c91-95fe-0d652b6a0c1a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d001c5-501e-00c0-19fc-59ba32000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0containerapitestbreakleaseac0e0832759c455Fri, 23 Aug 2019 21:49:07 GMT\"0x8D72813B912629B\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "399c03ae-16d6-4543-94c3-197f06662926", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac0e0832759c455?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d001dd-501e-00c0-2efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "1231c4f2-845d-408e-8bd3-503b28608367" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0containerapitestbreakleaseac0e0832759c455" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[2].json new file mode 100644 index 000000000000..b65090c4e597 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac67b3829828ae5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B92E55E0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00204-501e-00c0-53fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "a40c40cb-a33f-4454-841f-66e5bd702094" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac67b3829828ae5?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B92E55E0\"", + "x-ms-lease-id" : "4fba081c-8a94-4da7-a16a-1813b368f58a", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00225-501e-00c0-70fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "c7b7ac49-c14d-4780-b311-d974805bc186" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac67b3829828ae5?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B92E55E0\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d00239-501e-00c0-03fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "385ddfbc-c764-4892-8d66-30fc58c69417" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0024f-501e-00c0-19fc-59ba32000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0containerapitestbreakleaseac67b3829828ae5Fri, 23 Aug 2019 21:49:07 GMT\"0x8D72813B92E55E0\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "afb0bc8b-ae2b-4235-b1a2-a1e7e8bc5263", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac67b3829828ae5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00264-501e-00c0-2dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "91387a52-d2e3-40dc-9732-9270d284323e" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0containerapitestbreakleaseac67b3829828ae5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[0].json new file mode 100644 index 000000000000..e7501cbabc73 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[0].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfaile7503558f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B947D78C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0028d-501e-00c0-52fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "cef66af3-43cc-4b98-8bbf-f89d91b16008" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfaile7503558f?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B947D78C\"", + "x-ms-lease-id" : "0564c9a2-89ce-4336-8cb2-df48e69c152a", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d002b0-501e-00c0-71fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "0804af79-a4b6-4a10-810d-6975b658dc72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfaile7503558f?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77d002d8-501e-00c0-17fc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77d002d8-501e-00c0-17fc-59ba32000000\nTime:2019-08-23T21:49:07.5008154Z", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "cd696224-8c5d-489f-91a1-ae84a45b8eba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d002f1-501e-00c0-2dfc-59ba32000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0containerapitestbreakleaseacfaile7503558fFri, 23 Aug 2019 21:49:07 GMT\"0x8D72813B947D78C\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "9e405a41-8a01-4c03-9dd5-c2c37d4df174", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfaile7503558f?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B947D78C\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d00308-501e-00c0-41fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "4f1d2746-e83b-418f-b515-f8c88494c8b5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfaile7503558f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00341-501e-00c0-72fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "88b7893b-de54-44b8-9f10-244a1e28f07b" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0containerapitestbreakleaseacfaile7503558f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[1].json new file mode 100644 index 000000000000..6dfd0b4ceb2a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[1].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail362809974?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B96DDF61\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0036d-501e-00c0-1bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "6ef45fb4-13c0-494d-85e5-bcc8a47d1d4b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail362809974?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B96DDF61\"", + "x-ms-lease-id" : "e4e8dd96-92d0-457a-bd52-cdccd2abbbbc", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00398-501e-00c0-44fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "0fecde24-2ff5-4bab-8600-bc8e087f6862" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail362809974?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77d003b8-501e-00c0-61fc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77d003b8-501e-00c0-61fc-59ba32000000\nTime:2019-08-23T21:49:07.7390429Z", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "cdde68fa-277d-48cd-a954-fccad83b8122", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d003d4-501e-00c0-7afc-59ba32000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0containerapitestbreakleaseacfail362809974Fri, 23 Aug 2019 21:49:07 GMT\"0x8D72813B96DDF61\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "89e5aae9-2102-4175-913b-0f68c7d2159e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail362809974?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B96DDF61\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d003f7-501e-00c0-18fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "effd0c1a-b4f7-4fa6-bef6-20f1a8067507" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail362809974?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0042a-501e-00c0-42fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "d16f542e-8f1e-47ae-b85b-7085734dc549" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0containerapitestbreakleaseacfail362809974" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[0].json new file mode 100644 index 000000000000..30fd97da6c22 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacillegal034371ad05826a374f4021a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B98DF263\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00475-501e-00c0-05fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "5c4f4948-f3bc-4f7c-bd59-93fe6d548119" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0049d-501e-00c0-29fc-59ba32000000", + "Body" : "jtcbreakleaseacillegaljtcbreakleaseacillegal034371ad05826a374f4021aFri, 23 Aug 2019 21:49:07 GMT\"0x8D72813B98DF263\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "a2441711-1ada-46a8-9bd5-5bd908b81e2e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacillegal034371ad05826a374f4021a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d004b4-501e-00c0-3dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "f06bb2ba-c68a-489a-8a84-3d1f0bf0f895" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacillegal034371ad05826a374f4021a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[1].json new file mode 100644 index 000000000000..e80788e6b3f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacillegal0614022fd6253f93204df99?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B99DAD99\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d004d9-501e-00c0-60fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "dc1f145c-20a0-43a3-9665-97675117a420" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d004fa-501e-00c0-7bfc-59ba32000000", + "Body" : "jtcbreakleaseacillegaljtcbreakleaseacillegal0614022fd6253f93204df99Fri, 23 Aug 2019 21:49:07 GMT\"0x8D72813B99DAD99\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "d70e2f3f-4f91-40cb-873f-cf75bb14d2cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseacillegal0614022fd6253f93204df99?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00512-501e-00c0-13fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "8385dde8-da5f-4eb0-8905-680ed65108ac" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacillegal0614022fd6253f93204df99" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseerror.json new file mode 100644 index 000000000000..fa8740ab5baa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseerror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0containerapitestbreakleaseerror58b076375e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B9AD41C7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00540-501e-00c0-3dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "7268fbc6-46a6-489c-bf93-249b23325e71" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror1containerapitestbreakleaseerror58b0463492?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00568-501e-00c0-62fc-59ba32000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:77d00568-501e-00c0-62fc-59ba32000000\nTime:2019-08-23T21:49:08.1184048Z", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "de59a28d-2616-4bf2-828b-75f1d3f67bd5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleaseerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00588-501e-00c0-80fc-59ba32000000", + "Body" : "jtcbreakleaseerrorjtcbreakleaseerror0containerapitestbreakleaseerror58b076375eFri, 23 Aug 2019 21:49:08 GMT\"0x8D72813B9AD41C7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "efe48bcd-9e37-467f-8337-ddc267f2eefe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleaseerror0containerapitestbreakleaseerror58b076375e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d005a0-501e-00c0-17fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "6157b239-e291-4638-aeca-abaaaeaf7db4" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseerror0containerapitestbreakleaseerror58b076375e", "jtcbreakleaseerror1containerapitestbreakleaseerror58b0463492" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleasemin.json new file mode 100644 index 000000000000..fb1379c1d726 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleasemin.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleaseminab1043331b84?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B8DA7C17\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00005-501e-00c0-7ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "3498aab7-d930-4a86-a305-133f318810f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleaseminab1043331b84?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B8DA7C17\"", + "x-ms-lease-id" : "6cb7cf0d-614f-4315-bc55-312e3956e6ad", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00031-501e-00c0-25fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "a79844c2-fca4-41fa-b9f6-05c2e5d6483f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleaseminab1043331b84?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B8DA7C17\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d00051-501e-00c0-42fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "f45dbf68-6a06-4c3e-974d-11f37988f128" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbreakleasemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0006a-501e-00c0-5afc-59ba32000000", + "Body" : "jtcbreakleaseminjtcbreakleasemin0containerapitestbreakleaseminab1043331b84Fri, 23 Aug 2019 21:49:06 GMT\"0x8D72813B8DA7C17\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "8b29b99a-856a-47b9-bb96-da273dedeeda", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleaseminab1043331b84?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00083-501e-00c0-73fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:06 GMT", + "x-ms-client-request-id" : "c724e6b8-1de8-4806-b150-8d16ecd560e4" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleasemin0containerapitestbreakleaseminab1043331b84" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangelease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangelease.json new file mode 100644 index 000000000000..0260175da717 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangelease.json @@ -0,0 +1,124 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0containerapitestchangeleaseddd36703f0033a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B9C0CE8C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d005ce-501e-00c0-42fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "bf91b46d-398f-4c3d-b6db-0b074a7c9a01" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0containerapitestchangeleaseddd36703f0033a?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B9C0CE8C\"", + "x-ms-lease-id" : "db047a81-449f-484f-be23-9d4ebf2d468d", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d005eb-501e-00c0-5afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "9a0ec789-9782-4dc9-87e6-1d6823ef0530" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0containerapitestchangeleaseddd36703f0033a?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B9C0CE8C\"", + "x-ms-lease-id" : "fe0d4db8-0379-48ab-871f-4f0c0ada55f2", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77d0063e-501e-00c0-27fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "c48efccb-a325-4871-8d8a-be3f73e31592" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0containerapitestchangeleaseddd36703f0033a?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B9C0CE8C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77d00668-501e-00c0-4efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "b4677602-b609-4b97-814a-f0015cf9c40f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangelease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0067a-501e-00c0-5efc-59ba32000000", + "Body" : "jtcchangeleasejtcchangelease0containerapitestchangeleaseddd36703f0033aFri, 23 Aug 2019 21:49:08 GMT\"0x8D72813B9C0CE8C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "65efb275-96de-4a73-8e62-a6575281c2d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangelease0containerapitestchangeleaseddd36703f0033a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0068a-501e-00c0-6efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "671ff06d-5adc-4f92-ab96-b666af405f1f" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangelease0containerapitestchangeleaseddd36703f0033a", "fe0d4db8-0379-48ab-871f-4f0c0ada55f2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[0].json new file mode 100644 index 000000000000..b1cec42ed6ab --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[0].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacd2b50636656c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA0F28BD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00780-501e-00c0-52fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "d3d0b077-745b-48d4-b37b-6619c0c49a72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacd2b50636656c?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA0F28BD\"", + "x-ms-lease-id" : "ff1daa47-2c8b-44d4-b9b1-9d623c7a8778", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0079e-501e-00c0-6dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "d6215176-2fba-47ad-a719-73801623d901" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacd2b50636656c?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA0F28BD\"", + "x-ms-lease-id" : "8876669d-e1df-43e5-b935-437d2609fd5c", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77d007c6-501e-00c0-0afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "b095466a-d090-40cc-8e90-ab56d7baab89" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d007e0-501e-00c0-23fc-59ba32000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0containerapitestchangeleaseacd2b50636656cFri, 23 Aug 2019 21:49:08 GMT\"0x8D72813BA0F28BD\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "592d5893-c513-42fd-a7b4-8fe3e899f2aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacd2b50636656c?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA0F28BD\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d007fb-501e-00c0-3efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "b0c8fff7-0762-4609-988b-6db6d253b789" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacd2b50636656c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0081f-501e-00c0-5ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "ce5c502d-ca25-4f95-beb6-4a6bb6aea0df" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0containerapitestchangeleaseacd2b50636656c", "8876669d-e1df-43e5-b935-437d2609fd5c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[1].json new file mode 100644 index 000000000000..b6511259ac28 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[1].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseac60248279b1eb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA2C069B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00849-501e-00c0-04fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "03ad339e-6195-406b-8b73-d33c8eb04bf0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseac60248279b1eb?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA2C069B\"", + "x-ms-lease-id" : "bdd7e8f5-cd92-4fb8-98da-a8329411f23a", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0086e-501e-00c0-26fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "87468061-bf60-4fd9-a73d-d0a00bbc667d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseac60248279b1eb?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA2C069B\"", + "x-ms-lease-id" : "5e6f1be6-0ee3-4a8c-85ca-eb6a9febf335", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77d0088b-501e-00c0-41fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "eeb6d1cd-2ba3-48aa-91ca-f9d0af67041b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d008a3-501e-00c0-57fc-59ba32000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0containerapitestchangeleaseac60248279b1ebFri, 23 Aug 2019 21:49:08 GMT\"0x8D72813BA2C069B\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "d589288a-8b2a-4ef6-9fa6-1b9f0733e5db", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseac60248279b1eb?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA2C069B\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d008bb-501e-00c0-6efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "92b1788c-8882-4283-aabb-56b43ff067be" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseac60248279b1eb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d008da-501e-00c0-0bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "e198b62d-4e83-4081-8310-e797b741f556" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0containerapitestchangeleaseac60248279b1eb", "5e6f1be6-0ee3-4a8c-85ca-eb6a9febf335" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[2].json new file mode 100644 index 000000000000..fd4707afd695 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[2].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacffb42542aab5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA47F9D6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00926-501e-00c0-4ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "40f921ef-a94b-4456-b649-059f94700a89" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacffb42542aab5?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA47F9D6\"", + "x-ms-lease-id" : "af289272-84d0-41c1-b72e-079ec949788c", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00956-501e-00c0-79fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "40dcfaaf-7441-4a58-9539-ba42a2730dba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacffb42542aab5?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA47F9D6\"", + "x-ms-lease-id" : "4ef2211a-af36-4e8b-80bd-211063678c5e", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77d00972-501e-00c0-11fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "a0c957cf-45b9-4423-af0b-54c708c51427" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0099d-501e-00c0-3afc-59ba32000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0containerapitestchangeleaseacffb42542aab5Fri, 23 Aug 2019 21:49:09 GMT\"0x8D72813BA47F9D6\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "fca1f8f8-d9d6-4e6d-997e-223b6ae5978c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacffb42542aab5?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA47F9D6\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d009b4-501e-00c0-50fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "35ba8cfb-6300-42f6-ada8-20f5fdd9c71d" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacffb42542aab5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d009dd-501e-00c0-76fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "e6741302-9173-4cfb-9d1d-49b987cb2f2a" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0containerapitestchangeleaseacffb42542aab5", "4ef2211a-af36-4e8b-80bd-211063678c5e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[0].json new file mode 100644 index 000000000000..be8a31e0f423 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[0].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfailf9870759?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA6525EC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00a13-501e-00c0-25fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "ba69c218-e9d0-4bfc-8138-2573d2493b51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfailf9870759?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA6525EC\"", + "x-ms-lease-id" : "cdf8a6bf-36db-4ffa-b75a-84f8767f2027", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00a30-501e-00c0-41fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "dde3fed6-8035-42e5-9238-b996f21d76f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfailf9870759?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77d00a4b-501e-00c0-5afc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77d00a4b-501e-00c0-5afc-59ba32000000\nTime:2019-08-23T21:49:09.3495779Z", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "c44ada20-b545-4d5e-a0e8-da62248b363d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00a5e-501e-00c0-6cfc-59ba32000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0containerapitestchangeleaseacfailf9870759Fri, 23 Aug 2019 21:49:09 GMT\"0x8D72813BA6525EC\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "9d6e6362-6184-45cb-8cee-596c2472e843", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfailf9870759?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA6525EC\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d00a85-501e-00c0-10fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "1e3d21e9-c6e4-4ded-9e68-61c46b4e1ca1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfailf9870759?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00aa0-501e-00c0-2bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "56d4faf0-ec1f-4f9b-92f9-2c2117a2488b" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0containerapitestchangeleaseacfailf9870759", "01fd9631-76dc-44fe-8ff4-4f1376b6b502" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[1].json new file mode 100644 index 000000000000..a22b1b7b3415 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[1].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail71f24634?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA80F210\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00acb-501e-00c0-52fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "77acf5eb-5c31-4968-b193-72c34ed67e1e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail71f24634?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA80F210\"", + "x-ms-lease-id" : "32f14f39-bd69-49ee-84d3-c783f09d30ba", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00af2-501e-00c0-71fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "b3b1df28-8c98-4110-bea0-fc90ba49cbde" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail71f24634?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77d00b0d-501e-00c0-0cfc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77d00b0d-501e-00c0-0cfc-59ba32000000\nTime:2019-08-23T21:49:09.5317516Z", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "97d23b33-e338-4e11-a630-95b7b814c51d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00b26-501e-00c0-24fc-59ba32000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0containerapitestchangeleaseacfail71f24634Fri, 23 Aug 2019 21:49:09 GMT\"0x8D72813BA80F210\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "4cad8b18-2489-4d9b-a673-6bd486702330", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail71f24634?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA80F210\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d00b3b-501e-00c0-37fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "410a0a88-61ef-4dc1-b510-282eab01e99a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail71f24634?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00b5e-501e-00c0-59fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "50007d43-36cd-4bc3-b9aa-b2f162f46b47" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0containerapitestchangeleaseacfail71f24634", "aca7fd51-6a8f-4f47-8db9-d755ca934d0e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[0].json new file mode 100644 index 000000000000..9149d693990d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacillegal040942d95ecf7d1b8448dd9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BA9CE551\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00b82-501e-00c0-7afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "e73edd1e-266e-4787-8fdb-aa662b8e4ead" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00ba7-501e-00c0-1afc-59ba32000000", + "Body" : "jtcchangeleaseacillegaljtcchangeleaseacillegal040942d95ecf7d1b8448dd9Fri, 23 Aug 2019 21:49:09 GMT\"0x8D72813BA9CE551\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "fb4b856f-81c3-417e-a5a7-650aab9f467b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacillegal040942d95ecf7d1b8448dd9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00bbe-501e-00c0-2ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "50f2ef2f-9894-4f5e-874a-b21158d76ce9" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacillegal040942d95ecf7d1b8448dd9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[1].json new file mode 100644 index 000000000000..db6ec6563ac4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacillegal0124521f173842a8fe4566a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BAABB5FB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00beb-501e-00c0-5bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "e782c3b6-5b94-414d-a4b3-cce12877e19e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00c10-501e-00c0-7efc-59ba32000000", + "Body" : "jtcchangeleaseacillegaljtcchangeleaseacillegal0124521f173842a8fe4566aFri, 23 Aug 2019 21:49:09 GMT\"0x8D72813BAABB5FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "d3a0d8de-3fec-48b8-bf20-c518fde12f54", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseacillegal0124521f173842a8fe4566a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00c30-501e-00c0-1cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "623afff1-1189-4b33-82ab-57d3b4815ccd" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacillegal0124521f173842a8fe4566a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseerror.json new file mode 100644 index 000000000000..b2ee0f413707 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseerror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0containerapitestchangeleaseerror45a696329?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BABA86A4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00c51-501e-00c0-3cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "8784e19d-2621-4ead-861c-af00c91bb769" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror1containerapitestchangeleaseerror45a90288e?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "77d00c73-501e-00c0-59fc-59ba32000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:77d00c73-501e-00c0-59fc-59ba32000000\nTime:2019-08-23T21:49:09.8790817Zx-ms-lease-idid", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "9946c12d-6a2e-46c0-8377-0f761acd0f99", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleaseerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00c87-501e-00c0-6dfc-59ba32000000", + "Body" : "jtcchangeleaseerrorjtcchangeleaseerror0containerapitestchangeleaseerror45a696329Fri, 23 Aug 2019 21:49:09 GMT\"0x8D72813BABA86A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "a38a06d4-1df2-4bbe-87fb-2606ecd5a93c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleaseerror0containerapitestchangeleaseerror45a696329?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00cae-501e-00c0-12fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "0e92d739-5d48-4dfc-ab00-c1e45d15c39a" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseerror0containerapitestchangeleaseerror45a696329", "jtcchangeleaseerror1containerapitestchangeleaseerror45a90288e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleasemin.json new file mode 100644 index 000000000000..2ec3e53ceecb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleasemin.json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleaseminbd4063186d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B9EE2B48\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d006ab-501e-00c0-0efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "4100d825-9952-4e51-8e34-f9fe6374fde4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleaseminbd4063186d8?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B9EE2B48\"", + "x-ms-lease-id" : "94f52350-e5e5-4e08-947a-5bb8bee97857", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d006cb-501e-00c0-2bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "820c2b44-1c00-4cbd-8e0b-c74cf2c21a86" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleaseminbd4063186d8?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B9EE2B48\"", + "x-ms-lease-id" : "923d3b73-b53d-4ffe-9ab3-63f253047e94", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77d006ea-501e-00c0-47fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "4fd25aa4-90e9-4161-bc94-a9dd2c62390e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcchangeleasemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0072f-501e-00c0-06fc-59ba32000000", + "Body" : "jtcchangeleaseminjtcchangeleasemin0containerapitestchangeleaseminbd4063186d8Fri, 23 Aug 2019 21:49:08 GMT\"0x8D72813B9EE2B48\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:07 GMT", + "x-ms-client-request-id" : "deacd975-1e99-4136-91f4-d86c326317ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleaseminbd4063186d8?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813B9EE2B48\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d00745-501e-00c0-1bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "d6ad9691-7224-4401-986f-3123ffb33ab2" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleaseminbd4063186d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00760-501e-00c0-35fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:08 GMT", + "x-ms-client-request-id" : "ffd14303-f817-4fd9-8fdb-40e50d2265d7" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleasemin0containerapitestchangeleaseminbd4063186d8", "923d3b73-b53d-4ffe-9ab3-63f253047e94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateallnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateallnull.json new file mode 100644 index 000000000000..84ea9406b212 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateallnull.json @@ -0,0 +1,100 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0containerapitestcreateallnull2235619008cb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133CE9AFBF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de9cc2-001e-00f1-39fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "e2c2f0b6-6359-4c29-83d7-f0b7797377e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull1containerapitestcreateallnull22396350c931?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133CEE92F3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de9cfb-001e-00f1-69fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "bf9d1352-8c57-48e0-bc67-e39fc7bbe8d3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateallnull&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de9d2f-001e-00f1-16fc-59e1e5000000", + "Body" : "jtccreateallnulljtccreateallnull0containerapitestcreateallnull2235619008cbFri, 23 Aug 2019 21:45:38 GMT\"0x8D728133CE9AFBF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreateallnull1containerapitestcreateallnull22396350c931Fri, 23 Aug 2019 21:45:38 GMT\"0x8D728133CEE92F3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "b2f4d65b-9382-4e36-99ed-35297b0fc239", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0containerapitestcreateallnull2235619008cb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de9d5a-001e-00f1-3dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "3a95bff5-52c4-4bc4-8b23-86d6e70b3e25" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull1containerapitestcreateallnull22396350c931?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de9d96-001e-00f1-72fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "08718da0-292f-471a-bb62-992f0a7d8a0a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateallnull0containerapitestcreateallnull2235619008cb", "jtccreateallnull1containerapitestcreateallnull22396350c931" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateerror.json new file mode 100644 index 000000000000..769ea7517ed6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateerror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0containerapitestcreateerror55e48012617dc8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133DAE8FB1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea577-001e-00f1-40fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "81aa711a-596c-47ef-beb6-6d87c428f0da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0containerapitestcreateerror55e48012617dc8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea5be-001e-00f1-04fc-59e1e5000000", + "Body" : "ContainerAlreadyExistsThe specified container already exists.\nRequestId:b1dea5be-001e-00f1-04fc-59e1e5000000\nTime:2019-08-23T21:45:40.0884727Z", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "bb699546-6def-4edb-9e67-2ab8ec93106e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea5f5-001e-00f1-39fc-59e1e5000000", + "Body" : "jtccreateerrorjtccreateerror0containerapitestcreateerror55e48012617dc8Fri, 23 Aug 2019 21:45:40 GMT\"0x8D728133DAE8FB1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "26246271-34b2-49e6-a3b7-6aa9510b4c05", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0containerapitestcreateerror55e48012617dc8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea61a-001e-00f1-5bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "885bc614-953b-458b-a700-e4b9a8a78120" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateerror0containerapitestcreateerror55e48012617dc8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[0].json new file mode 100644 index 000000000000..bb3697a9b6b2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[0].json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadatad3077891def?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D1B533F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de9f0a-001e-00f1-4bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "1a3b3f28-6162-4321-9023-b8cfd7d51826" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadatad30320645c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D203685\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de9f59-001e-00f1-15fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "9806c997-b48a-4d5d-84ae-57c2949f2b02" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadatad30320645c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133D203685\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "b1de9f94-001e-00f1-4cfc-59e1e5000000", + "x-ms-client-request-id" : "ca307e3e-c5d2-4dcb-8a39-da749d9fffb3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatemetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de9fd3-001e-00f1-08fc-59e1e5000000", + "Body" : "jtccreatemetadatajtccreatemetadata0containerapitestcreatemetadatad3077891defFri, 23 Aug 2019 21:45:39 GMT\"0x8D728133D1B533F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatemetadata1containerapitestcreatemetadatad30320645c4Fri, 23 Aug 2019 21:45:39 GMT\"0x8D728133D203685\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "132bb118-38d9-45e1-be1c-7b0fb7a7fba2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadatad3077891def?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea01a-001e-00f1-48fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "4cbbad53-8f9a-4ad5-9fdd-ed907f8f69d6" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadatad30320645c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea049-001e-00f1-76fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "fb448dd5-9ef9-4534-8340-37f1af6f2b59" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0containerapitestcreatemetadatad3077891def", "jtccreatemetadata1containerapitestcreatemetadatad30320645c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[1].json new file mode 100644 index 000000000000..516a94f3f2f5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadata0996661646d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D38A66F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea090-001e-00f1-38fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "0aba7e60-21c0-46a9-a54b-a60176dbadd5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadata0998841117c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D3DB0C8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea0c4-001e-00f1-68fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "d83f08fe-69b8-458e-aa69-fe4cc1c1c46f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadata0998841117c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-meta-foo" : "bar", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133D3DB0C8\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "b1dea105-001e-00f1-26fc-59e1e5000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "c15a5979-0c65-43ea-9fd2-982a7dc0554c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatemetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea132-001e-00f1-4ffc-59e1e5000000", + "Body" : "jtccreatemetadatajtccreatemetadata0containerapitestcreatemetadata0996661646dFri, 23 Aug 2019 21:45:39 GMT\"0x8D728133D38A66F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatemetadata1containerapitestcreatemetadata0998841117cFri, 23 Aug 2019 21:45:39 GMT\"0x8D728133D3DB0C8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "d9cba537-3c6c-46e0-a477-1084b0e9058a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadata0996661646d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea157-001e-00f1-74fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "34c82077-2301-4f90-9173-bd00ae8b21fb" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadata0998841117c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea18e-001e-00f1-28fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "53d137e0-62e6-4b45-9d34-4164ad63473a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0containerapitestcreatemetadata0996661646d", "jtccreatemetadata1containerapitestcreatemetadata0998841117c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemin.json new file mode 100644 index 000000000000..f87ee91a6657 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemin.json @@ -0,0 +1,100 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0containerapitestcreateminf1e937775347a08a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D02BC27\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de9de9-001e-00f1-40fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "04679dbe-6bdb-40b7-8fd3-2badd5fccf1f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin1containerapitestcreateminf1e571363422f482?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D07783E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1de9e1b-001e-00f1-6ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "99359648-9476-4a76-8332-2ec200b2099b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de9e54-001e-00f1-22fc-59e1e5000000", + "Body" : "jtccreateminjtccreatemin0containerapitestcreateminf1e937775347a08aFri, 23 Aug 2019 21:45:38 GMT\"0x8D728133D02BC27\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatemin1containerapitestcreateminf1e571363422f482Fri, 23 Aug 2019 21:45:38 GMT\"0x8D728133D07783E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "22af1047-b768-4f50-aef6-7f3a09e8512b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0containerapitestcreateminf1e937775347a08a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de9e79-001e-00f1-44fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "620a7059-deea-4ea5-ab75-acc5e2339936" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin1containerapitestcreateminf1e571363422f482?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1de9ea9-001e-00f1-72fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "0058e1eb-d228-49b4-99ca-11b517915c4e" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemin0containerapitestcreateminf1e937775347a08a", "jtccreatemin1containerapitestcreateminf1e571363422f482" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[0].json new file mode 100644 index 000000000000..7a3a1327df64 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[0].json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess015750feed4014bed341f1bd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D558459\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea1cc-001e-00f1-60fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "b3450bf7-1e5d-40d1-b889-a485d0dbd361" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess140049e93588693c3149af9c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D5B03F3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea201-001e-00f1-10fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "eff23941-4e05-485c-8e1a-d03a4ff468d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess140049e93588693c3149af9c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133D5B03F3\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "blob", + "x-ms-request-id" : "b1dea225-001e-00f1-30fc-59e1e5000000", + "x-ms-client-request-id" : "ba5a230c-e63a-438b-b1dd-a3b3a60a0172" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatepublicaccess&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea24c-001e-00f1-55fc-59e1e5000000", + "Body" : "jtccreatepublicaccessjtccreatepublicaccess015750feed4014bed341f1bdFri, 23 Aug 2019 21:45:39 GMT\"0x8D728133D558459\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatepublicaccess140049e93588693c3149af9cFri, 23 Aug 2019 21:45:39 GMT\"0x8D728133D5B03F3\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:38 GMT", + "x-ms-client-request-id" : "58e53c14-d022-4420-94a1-c3193b40bfba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess015750feed4014bed341f1bd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea27b-001e-00f1-7ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "358640f5-25bd-44fd-84c8-e3adbb048869" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess140049e93588693c3149af9c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea2b3-001e-00f1-35fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "4980bb0b-c408-4c6d-a841-6b4d0fed77af" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatepublicaccess015750feed4014bed341f1bd", "jtccreatepublicaccess140049e93588693c3149af9c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[1].json new file mode 100644 index 000000000000..b2f3673e4643 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[1].json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess041976201f6b6188b24d3796?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D72D78E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea2ea-001e-00f1-66fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "555fc5ce-c18c-448d-a3c0-d9782f053730" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess157929b09afc30a1d1438e94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D77BAC6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea31a-001e-00f1-14fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "674859fb-0e38-43a6-8c9d-308a6a2f6a0c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess157929b09afc30a1d1438e94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133D77BAC6\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "container", + "x-ms-request-id" : "b1dea35d-001e-00f1-52fc-59e1e5000000", + "x-ms-client-request-id" : "953ae175-46de-4ef0-b7df-80d26b956ab0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatepublicaccess&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea392-001e-00f1-7ffc-59e1e5000000", + "Body" : "jtccreatepublicaccessjtccreatepublicaccess041976201f6b6188b24d3796Fri, 23 Aug 2019 21:45:39 GMT\"0x8D728133D72D78E\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatepublicaccess157929b09afc30a1d1438e94Fri, 23 Aug 2019 21:45:39 GMT\"0x8D728133D77BAC6\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "5749d1e8-86a1-4fee-a903-9cde13eb7916", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess041976201f6b6188b24d3796?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea3b4-001e-00f1-1ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "5260a8a5-214a-4523-afaf-2bef2e1f6c25" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess157929b09afc30a1d1438e94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea3eb-001e-00f1-53fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "0d33193f-bec6-4ac0-9595-40f0039bc9e0" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatepublicaccess041976201f6b6188b24d3796", "jtccreatepublicaccess157929b09afc30a1d1438e94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[2].json new file mode 100644 index 000000000000..48c46a005a26 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[2].json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess01822860bf8cbfa310435fbd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D90C72D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea42b-001e-00f1-0dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "3a5b791f-6c78-4421-b613-38a3586cfe55" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess172306d00e968936444de488?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133D958345\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea458-001e-00f1-38fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "31ecbc6b-7dca-4fe6-b26c-4a722e70df24" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess172306d00e968936444de488?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133D958345\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "b1dea495-001e-00f1-72fc-59e1e5000000", + "x-ms-client-request-id" : "1acab04d-307d-43c1-ba90-8e778e29cb91" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatepublicaccess&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea4d2-001e-00f1-28fc-59e1e5000000", + "Body" : "jtccreatepublicaccessjtccreatepublicaccess01822860bf8cbfa310435fbdFri, 23 Aug 2019 21:45:39 GMT\"0x8D728133D90C72D\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatepublicaccess172306d00e968936444de488Fri, 23 Aug 2019 21:45:39 GMT\"0x8D728133D958345\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "9f8942a3-eae8-4ade-b4ce-541686cf2a7e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess01822860bf8cbfa310435fbd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea4fe-001e-00f1-4efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "c8ea46b5-3195-4483-8759-66b28ec4df05" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatepublicaccess172306d00e968936444de488?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea523-001e-00f1-72fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "6a9b30a7-f946-4a08-915b-5787a42006ee" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatepublicaccess01822860bf8cbfa310435fbd", "jtccreatepublicaccess172306d00e968936444de488" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[0].json new file mode 100644 index 000000000000..3f8277066999 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[0].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083446d43f4e08c18241ae?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BACD01A8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00cd1-501e-00c0-30fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "ce58d978-1b09-40f2-9b2e-be4c0f2430b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083446d43f4e08c18241ae/az[]", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BAD25587\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00cec-501e-00c0-47fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "53415921-a971-4ca4-8d14-8bcb0aabd6a7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083446d43f4e08c18241ae/az[]", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813BAD25587\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:10 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "77d00d1c-501e-00c0-72fc-59ba32000000", + "x-ms-client-request-id" : "820bed6f-e8fd-4c77-b2b8-2729c9849cc5", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083446d43f4e08c18241ae/az[]2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BADC6A2E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00d37-501e-00c0-0dfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "220e1fb4-2000-4ab5-bc40-b57751fa1d0b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083446d43f4e08c18241ae/az[]3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BAE17477\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d00d66-501e-00c0-3bfc-59ba32000000", + "x-ms-client-request-id" : "e28beb1f-0dfc-456c-92f4-936c6bdd634d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083446d43f4e08c18241ae?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00d8e-501e-00c0-61fc-59ba32000000", + "Body" : "az[]Fri, 23 Aug 2019 21:49:10 GMTFri, 23 Aug 2019 21:49:10 GMT0x8D72813BAD255870application/octet-streamAppendBlobHottrueunlockedavailabletrue0az[]2Fri, 23 Aug 2019 21:49:10 GMTFri, 23 Aug 2019 21:49:10 GMT0x8D72813BADC6A2E512application/octet-stream0PageBlobHottrueunlockedavailabletrue0az[]3Fri, 23 Aug 2019 21:49:10 GMTFri, 23 Aug 2019 21:49:10 GMT0x8D72813BAE174777application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "3a15356d-4de3-4761-93fe-89f121641434", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateurlspecialchars&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00dc1-501e-00c0-0cfc-59ba32000000", + "Body" : "jtccreateurlspecialcharsjtccreateurlspecialchars083446d43f4e08c18241aeFri, 23 Aug 2019 21:49:09 GMT\"0x8D72813BACD01A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "e7bc99f4-aa73-4ab2-ba2a-532b14da79e3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars083446d43f4e08c18241ae?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00dd3-501e-00c0-1cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "3e5c2ff7-32b1-4a2e-9130-f8f70b30495d" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateurlspecialchars083446d43f4e08c18241ae" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[1].json new file mode 100644 index 000000000000..1a291131cc8c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[1].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars06559382df0bea09d84390?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BAF77753\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00dfe-501e-00c0-46fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "c8849941-bfa1-4c62-a3d6-4a316072ac9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars06559382df0bea09d84390/hello/world", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BAFCA44F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00e2f-501e-00c0-6dfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "74bd1854-3ff7-4d4b-bb38-53902ce6bb37" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars06559382df0bea09d84390/hello/world", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813BAFCA44F\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:10 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "77d00e56-501e-00c0-12fc-59ba32000000", + "x-ms-client-request-id" : "c7b199a0-d4f5-4b39-bd38-043e5c896360", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars06559382df0bea09d84390/hello/world2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BB0643A8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00e81-501e-00c0-39fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "022c37be-2a97-4398-abf4-adc3c9c4456d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars06559382df0bea09d84390/hello/world3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BB0DBF87\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d00eb8-501e-00c0-6cfc-59ba32000000", + "x-ms-client-request-id" : "76445507-2d54-4736-bac5-010fd3e0bfc8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars06559382df0bea09d84390?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00edc-501e-00c0-0dfc-59ba32000000", + "Body" : "hello/worldFri, 23 Aug 2019 21:49:10 GMTFri, 23 Aug 2019 21:49:10 GMT0x8D72813BAFCA44F0application/octet-streamAppendBlobHottrueunlockedavailabletrue0hello/world2Fri, 23 Aug 2019 21:49:10 GMTFri, 23 Aug 2019 21:49:10 GMT0x8D72813BB0643A8512application/octet-stream0PageBlobHottrueunlockedavailabletrue0hello/world3Fri, 23 Aug 2019 21:49:10 GMTFri, 23 Aug 2019 21:49:10 GMT0x8D72813BB0DBF877application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "a07ce8a6-6d06-41bb-baf2-51f785436901", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateurlspecialchars&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00f05-501e-00c0-33fc-59ba32000000", + "Body" : "jtccreateurlspecialcharsjtccreateurlspecialchars06559382df0bea09d84390Fri, 23 Aug 2019 21:49:10 GMT\"0x8D72813BAF77753\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "eb8719f6-d87e-495c-9f2c-f00a06aebdec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars06559382df0bea09d84390?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d00f21-501e-00c0-4efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "9b88922e-2dfc-4b39-96b5-d9e4dd8c3cda" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateurlspecialchars06559382df0bea09d84390" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[2].json new file mode 100644 index 000000000000..a324be473185 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[2].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars069694b13353bbb7664a63?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BB25E5A1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00f49-501e-00c0-73fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "38be1e6c-0d3b-49e4-8b8d-9dd77561e398" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars069694b13353bbb7664a63/hello&world", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BB2B12B2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00f6f-501e-00c0-15fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-client-request-id" : "5cbc765e-7757-4904-a98a-d62729ceb33c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars069694b13353bbb7664a63/hello&world", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:09 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813BB2B12B2\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:10 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "77d00f8c-501e-00c0-30fc-59ba32000000", + "x-ms-client-request-id" : "3785f90a-fee8-429f-831a-3a3aff5bd168", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars069694b13353bbb7664a63/hello&world2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BB343CB6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d00fa4-501e-00c0-47fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "45e885a1-7761-4c1a-9536-e7121ae3a24b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars069694b13353bbb7664a63/hello&world3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BB396E18\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d00fc8-501e-00c0-67fc-59ba32000000", + "x-ms-client-request-id" : "cab5d69d-cd2d-4886-82ef-bcb547010f70" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars069694b13353bbb7664a63?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01003-501e-00c0-1dfc-59ba32000000", + "Body" : "hello&worldFri, 23 Aug 2019 21:49:10 GMTFri, 23 Aug 2019 21:49:10 GMT0x8D72813BB2B12B20application/octet-streamAppendBlobHottrueunlockedavailabletrue0hello&world2Fri, 23 Aug 2019 21:49:10 GMTFri, 23 Aug 2019 21:49:10 GMT0x8D72813BB343CB6512application/octet-stream0PageBlobHottrueunlockedavailabletrue0hello&world3Fri, 23 Aug 2019 21:49:10 GMTFri, 23 Aug 2019 21:49:10 GMT0x8D72813BB396E187application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "4ffc6a02-44b0-4286-915a-9c25e6f9a9f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateurlspecialchars&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01033-501e-00c0-49fc-59ba32000000", + "Body" : "jtccreateurlspecialcharsjtccreateurlspecialchars069694b13353bbb7664a63Fri, 23 Aug 2019 21:49:10 GMT\"0x8D72813BB25E5A1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "df8fab28-5c8d-418a-8cdb-5917c8b5683b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateurlspecialchars069694b13353bbb7664a63?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01062-501e-00c0-75fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "c2cde942-ec1f-4ebb-b3e1-87fa4c67252d" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateurlspecialchars069694b13353bbb7664a63" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdelete.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdelete.json new file mode 100644 index 000000000000..372396e573f4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdelete.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0containerapitestdeleted2e05811ba8fe4b506a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813412D6EB9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deceed-001e-00f1-0dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "33285539-4487-491d-a3fc-a354f8afa7a9" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdelete0containerapitestdeleted2e05811ba8fe4b506a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decf15-001e-00f1-33fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "0eb218ac-e54d-4b52-a816-c162ea4278a2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdelete&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decf3e-001e-00f1-59fc-59e1e5000000", + "Body" : "jtcdelete", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "2aeed1db-586f-4da4-8601-8b5e4f92ec4c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdelete0containerapitestdeleted2e05811ba8fe4b506a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[0].json new file mode 100644 index 000000000000..f93e9cdacfe4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteacc937620660b33182f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813414CBE3D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded043-001e-00f1-48fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "83931370-7def-4033-a97f-664f391858d1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteacc937620660b33182f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded07a-001e-00f1-79fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "938370c6-6e83-442c-b204-001d52249961" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded0ad-001e-00f1-26fc-59e1e5000000", + "Body" : "jtcdeleteac", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "7f85e7c9-0314-4b72-adf7-faa997be57ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteacc937620660b33182f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[1].json new file mode 100644 index 000000000000..7adbe93b9ad9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac9a635709c44655d14?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813415D6422\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded0fd-001e-00f1-71fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "1201a5a0-47ea-4dbb-a413-34e0396ab60d" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac9a635709c44655d14?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded13e-001e-00f1-2afc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "07c737c0-9b4a-4996-b732-7526e8c9b8fa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded163-001e-00f1-4efc-59e1e5000000", + "Body" : "jtcdeleteac", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "afd6bc74-a714-4496-bb2e-ff6f61c5a697", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteac9a635709c44655d14" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[2].json new file mode 100644 index 000000000000..f9854cf69437 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteacfcb393878f0b50624?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813416C830B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded1a8-001e-00f1-0efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "a0f67633-b0e9-4e53-b71a-d9a57380ec4e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteacfcb393878f0b50624?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded208-001e-00f1-6bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "d091be03-1274-465b-97bf-4e577fb054f3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded23e-001e-00f1-1cfc-59e1e5000000", + "Body" : "jtcdeleteac", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "c628aa2c-7e21-47f1-8caa-07d56d62d32d", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteacfcb393878f0b50624" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[3].json new file mode 100644 index 000000000000..343040f9f818 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[3].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac8d3499457bd942f71?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813417CB3AA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded27c-001e-00f1-5afc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "1fda2f24-1a83-4a45-b947-b22366592197" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac8d3499457bd942f71?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813417CB3AA\"", + "x-ms-lease-id" : "332c2712-912b-4126-a5aa-8d5965a56143", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded2b7-001e-00f1-11fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "21f47a40-c5dd-43ea-8386-76feb24a131a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac8d3499457bd942f71?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded2eb-001e-00f1-43fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "8ae10602-48b3-4c29-83e8-fb46ed0ca386" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded328-001e-00f1-7efc-59e1e5000000", + "Body" : "jtcdeleteac", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "068f7baf-e663-400c-b1dd-f9cc227e898a", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteac8d3499457bd942f71" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[0].json new file mode 100644 index 000000000000..8007d00640bc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[0].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail01f08110cf0b7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281341908EB0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded365-001e-00f1-38fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "178b2468-89fc-4f1a-a03a-6bdcb64aad0f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail01f08110cf0b7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "b1ded39b-001e-00f1-69fc-59e1e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b1ded39b-001e-00f1-69fc-59e1e5000000\nTime:2019-08-23T21:45:46.6027249Z", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "e5e85ce3-4728-423e-ba18-ac5099280dd6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded3de-001e-00f1-29fc-59e1e5000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0containerapitestdeleteacfail01f08110cf0b7Fri, 23 Aug 2019 21:45:46 GMT\"0x8D7281341908EB0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "a6432200-eef7-49d4-b51a-f4005b811b92", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail01f08110cf0b7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded41a-001e-00f1-62fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "4671c51b-1e9f-456e-87db-e779961f4a59" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0containerapitestdeleteacfail01f08110cf0b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[1].json new file mode 100644 index 000000000000..87401e41f2da --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[1].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfailcc98550151fd5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281341A57B5D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded46b-001e-00f1-32fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "6739416a-abbf-4b54-bdee-980a9d88b1d5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfailcc98550151fd5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "b1ded4aa-001e-00f1-6bfc-59e1e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b1ded4aa-001e-00f1-6bfc-59e1e5000000\nTime:2019-08-23T21:45:46.7438606Z", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "9fb57ab9-89c3-4e18-b709-f8431032df9d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded4da-001e-00f1-1afc-59e1e5000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0containerapitestdeleteacfailcc98550151fd5Fri, 23 Aug 2019 21:45:46 GMT\"0x8D7281341A57B5D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "f338c4d0-4b0f-4939-b292-443613d84fa4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfailcc98550151fd5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded511-001e-00f1-4cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "866de455-6a8c-4f1e-8882-6019ca3fb26b" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0containerapitestdeleteacfailcc98550151fd5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[2].json new file mode 100644 index 000000000000..eda565753b7e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[2].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail94b587862ca0c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281341B90826\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded554-001e-00f1-0efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "2b0091c7-c881-45ac-94c0-5ea9b417bf56" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail94b587862ca0c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseNotPresentWithContainerOperation", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "b1ded584-001e-00f1-3bfc-59e1e5000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:b1ded584-001e-00f1-3bfc-59e1e5000000\nTime:2019-08-23T21:45:46.8689809Z", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "1c625dda-7a45-405f-8cf9-ca7428c74b14", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded5ac-001e-00f1-61fc-59e1e5000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0containerapitestdeleteacfail94b587862ca0cFri, 23 Aug 2019 21:45:46 GMT\"0x8D7281341B90826\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "c527fb4f-c444-4e88-b536-0d124084aea8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail94b587862ca0c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded5dc-001e-00f1-0dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "46d156ed-96e1-4b3f-b652-9105b6cdf236" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0containerapitestdeleteacfail94b587862ca0c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[0].json new file mode 100644 index 000000000000..5039acf1e7a7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegal93b5948474?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281341CDA6A9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded622-001e-00f1-4efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "27d0df23-c0ad-4b66-8d8c-eb64d8f6b1f8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded669-001e-00f1-0dfc-59e1e5000000", + "Body" : "jtcdeleteacillegaljtcdeleteacillegal0containerapitestdeleteacillegal93b5948474Fri, 23 Aug 2019 21:45:46 GMT\"0x8D7281341CDA6A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "d6e69e60-7e16-45ea-9d88-095c021219ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegal93b5948474?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded68a-001e-00f1-2cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "fe32924c-1c57-4096-b33a-12e15d743e41" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacillegal0containerapitestdeleteacillegal93b5948474" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[1].json new file mode 100644 index 000000000000..2d31af82e172 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegalfc903527c0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281341DDFE5B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded6f7-001e-00f1-12fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "8c3f51c6-5a2e-4cc8-83d7-94195c988148" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded744-001e-00f1-59fc-59e1e5000000", + "Body" : "jtcdeleteacillegaljtcdeleteacillegal0containerapitestdeleteacillegalfc903527c0Fri, 23 Aug 2019 21:45:47 GMT\"0x8D7281341DDFE5B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "236064c9-bd4e-4a3a-9f24-997fd8ce0d1e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegalfc903527c0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded77c-001e-00f1-0cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "ed8232fc-9e6a-4407-b858-e5c442976794" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacillegal0containerapitestdeleteacillegalfc903527c0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteerror.json new file mode 100644 index 000000000000..78241d615c91 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteerror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteerror0containerapitestdeleteerror85e91912a903ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281341EDB9B4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded7d3-001e-00f1-5ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "1240e656-8358-4f97-9c9a-3ae0690d82bf" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteerror1containerapitestdeleteerror85e878055752f1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded824-001e-00f1-27fc-59e1e5000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:b1ded824-001e-00f1-27fc-59e1e5000000\nTime:2019-08-23T21:45:47.2133114Z", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "47b16528-6170-484c-9eea-fb24f0177fa4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeleteerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded864-001e-00f1-65fc-59e1e5000000", + "Body" : "jtcdeleteerrorjtcdeleteerror0containerapitestdeleteerror85e91912a903adFri, 23 Aug 2019 21:45:47 GMT\"0x8D7281341EDB9B4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "4ee56972-a51c-4ace-bb9c-808a37d7869b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeleteerror0containerapitestdeleteerror85e91912a903ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded897-001e-00f1-15fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "af22789d-1b14-48a8-8ea2-3ff6dfc1fc00" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteerror0containerapitestdeleteerror85e91912a903ad", "jtcdeleteerror1containerapitestdeleteerror85e878055752f1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeletemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeletemin.json new file mode 100644 index 000000000000..d0c808e51695 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeletemin.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0containerapitestdeletemin73e0848436e97006?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813413CDBD6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1decf73-001e-00f1-0afc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "225b3d67-48f6-4c9a-8787-4d0a891e980c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcdeletemin0containerapitestdeletemin73e0848436e97006?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decfaa-001e-00f1-3dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "b8198c4b-9d1b-4d20-a645-c968538607d7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcdeletemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decff4-001e-00f1-03fc-59e1e5000000", + "Body" : "jtcdeletemin", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "7178ed9e-6b5a-475a-8e55-c3ecee3ce232", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeletemin0containerapitestdeletemin73e0848436e97006" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicy.json new file mode 100644 index 000000000000..e9b47280a3ea --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicy.json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy5ff8328084?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340D2671C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1decb01-001e-00f1-6dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "4ef4e813-9e92-4200-9338-4247cb8abe75" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy5ff8328084?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340D720A4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1decb3d-001e-00f1-23fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "368bf916-b5cc-4a97-80c3-1c2b21626e8f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy5ff8328084?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "ETag" : "\"0x8D7281340D720A4\"", + "x-ms-blob-public-access" : "blob", + "x-ms-request-id" : "b1decb6e-001e-00f1-51fc-59e1e5000000", + "Body" : "00002019-08-23T21:45:45.0000000Z2019-08-24T21:45:45.0000000Zr", + "x-ms-client-request-id" : "05ba0fb5-5a65-4754-95ad-95f0f2e0b146", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccesspolicy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decb9c-001e-00f1-7dfc-59e1e5000000", + "Body" : "jtcgetaccesspolicyjtcgetaccesspolicy0containerapitestgetaccesspolicy5ff8328084Fri, 23 Aug 2019 21:45:45 GMT\"0x8D7281340D720A4\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "24f76748-9232-4dfd-862c-2294d48f3fb6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy5ff8328084?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decbbd-001e-00f1-1dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "808644d8-ac6b-4613-84ba-42b8ac0b4d86" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicy0containerapitestgetaccesspolicy5ff8328084", "2019-08-23T21:45:45.374Z", "2019-08-23T21:45:45.374Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyerror.json new file mode 100644 index 000000000000..9ffc827190c0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyerror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyerror0773019d63ad9e78494d63b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813411A3024\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dece33-001e-00f1-5ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "0769e083-392b-40b9-b03e-1507203620ae" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyerror1339977390cc49fe8548718?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dece67-001e-00f1-0bfc-59e1e5000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:b1dece67-001e-00f1-0bfc-59e1e5000000\nTime:2019-08-23T21:45:45.8259804Z", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "4849311c-fbaf-4ceb-8609-7922cacae12e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccesspolicyerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dece84-001e-00f1-26fc-59e1e5000000", + "Body" : "jtcgetaccesspolicyerrorjtcgetaccesspolicyerror0773019d63ad9e78494d63bFri, 23 Aug 2019 21:45:45 GMT\"0x8D72813411A3024\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "bcefa02b-f0ea-45dd-a743-895397cc591a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyerror0773019d63ad9e78494d63b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decea2-001e-00f1-44fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "acd41a4e-d4d9-441d-af52-be86c9acf438" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicyerror0773019d63ad9e78494d63b", "jtcgetaccesspolicyerror1339977390cc49fe8548718" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicylease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicylease.json new file mode 100644 index 000000000000..f41dc4265150 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicylease.json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicylease0332482c5408ece2f944b5a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340E92905\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1decc04-001e-00f1-5efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "15d2f01c-ae94-434e-97c2-ad26d5cc586a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicylease0332482c5408ece2f944b5a?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340E92905\"", + "x-ms-lease-id" : "b6088bcb-81f2-4d70-98a3-8b800a8f1613", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1decc47-001e-00f1-1dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "1a0016d6-2ace-4d15-b046-d1dbc1138be9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicylease0332482c5408ece2f944b5a?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340E92905\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1decc73-001e-00f1-49fc-59e1e5000000", + "Body" : "", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "80971a75-fe5e-4bff-81bd-8219450fdec7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccesspolicylease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decca8-001e-00f1-7cfc-59e1e5000000", + "Body" : "jtcgetaccesspolicyleasejtcgetaccesspolicylease0332482c5408ece2f944b5aFri, 23 Aug 2019 21:45:45 GMT\"0x8D7281340E92905\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "f6d20796-60b0-4a20-9ae0-202a2dda7b70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicylease0332482c5408ece2f944b5a?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340E92905\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b1deccda-001e-00f1-2bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "97290437-b88c-4b8c-aad4-fa562f52dd07" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicylease0332482c5408ece2f944b5a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decd0d-001e-00f1-5dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "125ee3cc-9f38-4917-b17a-cf508e24e6fb" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicylease0332482c5408ece2f944b5a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyleasefail.json new file mode 100644 index 000000000000..c3f8f2594248 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyleasefail.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyleasefail087228107d14ef5e904bd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728134106F184\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1decd63-001e-00f1-2cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "195b382e-6ec1-428d-8553-29b82811a671" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyleasefail087228107d14ef5e904bd?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseNotPresentWithContainerOperation", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "b1decd9b-001e-00f1-5efc-59e1e5000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:b1decd9b-001e-00f1-5efc-59e1e5000000\nTime:2019-08-23T21:45:45.6988586Z", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "99579746-0fe8-4eb2-bbb5-b79f4c1510d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccesspolicyleasefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decdc7-001e-00f1-03fc-59e1e5000000", + "Body" : "jtcgetaccesspolicyleasefailjtcgetaccesspolicyleasefail087228107d14ef5e904bdFri, 23 Aug 2019 21:45:45 GMT\"0x8D728134106F184\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "c2b529db-c945-4ac8-8aad-142c75a4b624", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccesspolicyleasefail087228107d14ef5e904bd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decdea-001e-00f1-23fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:45 GMT", + "x-ms-client-request-id" : "ef815a79-7050-4e85-84fd-4e7befd2611b" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicyleasefail087228107d14ef5e904bd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfo.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfo.json new file mode 100644 index 000000000000..c43b69aeea84 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfo.json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0containerapitestgetaccountinfo68135841f94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BBC867B8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01466-501e-00c0-73fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "04a03f7c-df14-4414-9c65-85f8671baa32" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=account&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "77d01493-501e-00c0-18fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "5aaf3d8a-efbc-451f-9368-b89d4a4cd0e4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccountinfo&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d014b6-501e-00c0-37fc-59ba32000000", + "Body" : "jtcgetaccountinfojtcgetaccountinfo0containerapitestgetaccountinfo68135841f94Fri, 23 Aug 2019 21:49:11 GMT\"0x8D72813BBC867B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "bea50bf6-ea5f-41a0-a56d-f1f8a027b4e4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0containerapitestgetaccountinfo68135841f94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d014e8-501e-00c0-68fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "74331d71-415b-44fb-af5f-e1fd27e359e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfo0containerapitestgetaccountinfo68135841f94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfoerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfoerror.json new file mode 100644 index 000000000000..46f8cce3a974 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfoerror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror084383442b6eb994ca434c8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BBF01DAD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d015ba-501e-00c0-24fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "90d4178d-fa0b-475e-892b-d31e58e4d1c6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror14707915f4595eb94d4f5eb?restype=account&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "77d015f2-501e-00c0-51fc-59ba32000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:77d015f2-501e-00c0-51fc-59ba32000000\nTime:2019-08-23T21:49:11.9070096Z", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "4f600643-ab31-4d6a-8402-327dc647f002", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccountinfoerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01610-501e-00c0-6cfc-59ba32000000", + "Body" : "jtcgetaccountinfoerrorjtcgetaccountinfoerror084383442b6eb994ca434c8Fri, 23 Aug 2019 21:49:11 GMT\"0x8D72813BBF01DAD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "25e0380d-b0f9-4813-8bc6-d1cfc2929746", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror084383442b6eb994ca434c8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01631-501e-00c0-0afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "5128b13a-3356-4abb-8e80-7f45d301351f" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfoerror084383442b6eb994ca434c8", "jtcgetaccountinfoerror14707915f4595eb94d4f5eb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfomin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfomin.json new file mode 100644 index 000000000000..37ff1facb4e6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfomin.json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0containerapitestgetaccountinfominc5624299?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BBDE3EFA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01524-501e-00c0-21fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "86b8f417-2b01-459d-b82d-8456a2c87758" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=account&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "77d0154d-501e-00c0-44fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "b0f69851-8afe-491f-b59b-7536f1a5bce3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccountinfomin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01566-501e-00c0-59fc-59ba32000000", + "Body" : "jtcgetaccountinfominjtcgetaccountinfomin0containerapitestgetaccountinfominc5624299Fri, 23 Aug 2019 21:49:11 GMT\"0x8D72813BBDE3EFA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "655e732a-b41e-4db3-8b63-892eb539eca4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0containerapitestgetaccountinfominc5624299?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0158e-501e-00c0-7cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "0871ea44-4b97-4809-b8eb-2e989b70aa02" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfomin0containerapitestgetaccountinfominc5624299" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieserror.json new file mode 100644 index 000000000000..109c89021151 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieserror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror004414fb6fed5c1cec4305aa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E2143C9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deaa3f-001e-00f1-3dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "2b3ba3ef-3449-4c27-bd5e-1105ef6e746b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror1075274f153dc863b54059bd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deaa78-001e-00f1-6dfc-59e1e5000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:b1deaa78-001e-00f1-6dfc-59e1e5000000\nTime:2019-08-23T21:45:40.8381930Z", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "0bccbc14-6f2f-495c-a652-51413975fc23", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertieserror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deaab8-001e-00f1-1afc-59e1e5000000", + "Body" : "jtcgetpropertieserrorjtcgetpropertieserror004414fb6fed5c1cec4305aaFri, 23 Aug 2019 21:45:40 GMT\"0x8D728133E2143C9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "7e822e27-5d97-4f93-ab10-8be52e02ab3b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieserror004414fb6fed5c1cec4305aa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deaae9-001e-00f1-44fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "e0ff18b0-fdce-4e34-b818-0f5a96d2ad6a" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertieserror004414fb6fed5c1cec4305aa", "jtcgetpropertieserror1075274f153dc863b54059bd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieslease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieslease.json new file mode 100644 index 000000000000..17586c994812 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieslease.json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieslease090373dcf18032036c4e4f9f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133DEC6B36\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea813-001e-00f1-32fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "a52e8e1f-042f-403d-8858-4b3855a4e571" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieslease090373dcf18032036c4e4f9f?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133DEC6B36\"", + "x-ms-lease-id" : "332a9646-06ed-4244-a91b-cb7aef9dda98", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea855-001e-00f1-6ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "a2e74263-52ee-4546-b4a7-857824820234" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieslease090373dcf18032036c4e4f9f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "leased", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133DEC6B36\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "b1dea884-001e-00f1-1cfc-59e1e5000000", + "x-ms-client-request-id" : "e93fbd73-b084-42b4-8652-2db378a52792" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertieslease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea8b7-001e-00f1-4afc-59e1e5000000", + "Body" : "jtcgetpropertiesleasejtcgetpropertieslease090373dcf18032036c4e4f9fFri, 23 Aug 2019 21:45:40 GMT\"0x8D728133DEC6B36\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "4eda558c-05d3-4284-b6a6-e1a9bf2efac3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieslease090373dcf18032036c4e4f9f?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133DEC6B36\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b1dea8d5-001e-00f1-66fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "b0851861-3439-472c-ba98-adfd1ec99ccb" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertieslease090373dcf18032036c4e4f9f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea916-001e-00f1-24fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "5ad10d1f-2618-4da9-8173-7c104de3d9b1" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertieslease090373dcf18032036c4e4f9f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesleasefail.json new file mode 100644 index 000000000000..d8185175d630 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesleasefail.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesleasefail070422f50077898324473b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E09BE6B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea959-001e-00f1-63fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "04e6bb2b-cb0f-4a81-a6b3-d0c7a378bacc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesleasefail070422f50077898324473b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "b1dea990-001e-00f1-16fc-59e1e5000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:b1dea990-001e-00f1-16fc-59e1e5000000\nTime:2019-08-23T21:45:40.6810414Zx-ms-lease-idgarbage", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "c90ccd10-dfb4-4a3b-ada2-2d9e0553e05d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesleasefail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea9ae-001e-00f1-34fc-59e1e5000000", + "Body" : "jtcgetpropertiesleasefailjtcgetpropertiesleasefail070422f50077898324473bFri, 23 Aug 2019 21:45:40 GMT\"0x8D728133E09BE6B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "242314e7-0d4a-4aae-b1e9-29f71440a23f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesleasefail070422f50077898324473b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea9f6-001e-00f1-79fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "9c945168-e159-4256-8b22-c34d3945dfd3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesleasefail070422f50077898324473b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesmin.json new file mode 100644 index 000000000000..44ee9cc35058 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesmin.json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0containerapitestgetpropertiesmincf0633124?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133DD7304C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea717-001e-00f1-48fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "b44391b8-0aa7-4fb7-b4be-070b249bce46" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0containerapitestgetpropertiesmincf0633124?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133DD7304C\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "b1dea772-001e-00f1-19fc-59e1e5000000", + "x-ms-client-request-id" : "ce4e9436-f9dc-42db-8afa-4d5ed721f248" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea7af-001e-00f1-54fc-59e1e5000000", + "Body" : "jtcgetpropertiesminjtcgetpropertiesmin0containerapitestgetpropertiesmincf0633124Fri, 23 Aug 2019 21:45:40 GMT\"0x8D728133DD7304C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "82895c69-5fc5-4ead-8cdb-d3ec8d53066f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesmin0containerapitestgetpropertiesmincf0633124?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea7d9-001e-00f1-7bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "37b53ea2-c9ef-476b-91af-78fb4e667d8e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesmin0containerapitestgetpropertiesmincf0633124" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesnull.json new file mode 100644 index 000000000000..541c12002145 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesnull.json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesnull0containerapitestgetpropertiesnull13742670?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133DC26AA9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dea64d-001e-00f1-0cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "149559f2-1521-4341-85ea-10596aa58e46" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesnull0containerapitestgetpropertiesnull13742670?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133DC26AA9\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "b1dea680-001e-00f1-3dfc-59e1e5000000", + "x-ms-client-request-id" : "3e4b529b-b9a9-41b4-bf1c-6621a0aa7407" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropertiesnull&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea6b7-001e-00f1-6efc-59e1e5000000", + "Body" : "jtcgetpropertiesnulljtcgetpropertiesnull0containerapitestgetpropertiesnull13742670Fri, 23 Aug 2019 21:45:40 GMT\"0x8D728133DC26AA9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "aff90f21-397a-48ef-a22e-2795f1db41ec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropertiesnull0containerapitestgetpropertiesnull13742670?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dea6d6-001e-00f1-0dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:39 GMT", + "x-ms-client-request-id" : "f739890e-3996-4ca1-a991-6a00b58c361a" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesnull0containerapitestgetpropertiesnull13742670" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflat.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflat.json new file mode 100644 index 000000000000..e65f1b3c3de3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflat.json @@ -0,0 +1,103 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflatad5391376f13?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728134202F495\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded8f5-001e-00f1-69fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "cd554019-68dc-4313-9409-da63d1917ea0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflatad5391376f13/javabloblistblobsflat1containerapitestlistblobsflatad59616770", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728134207DB88\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1ded939-001e-00f1-28fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "b33036e1-8e13-4a16-a659-a1da7e189f6e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflatad5391376f13?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded974-001e-00f1-5ffc-59e1e5000000", + "Body" : "javabloblistblobsflat1containerapitestlistblobsflatad59616770Fri, 23 Aug 2019 21:45:47 GMTFri, 23 Aug 2019 21:45:47 GMT0x8D728134207DB88512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "9df43e7b-4692-4391-96d8-5ecafff8ee7b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflat&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded9a3-001e-00f1-09fc-59e1e5000000", + "Body" : "jtclistblobsflatjtclistblobsflat0containerapitestlistblobsflatad5391376f13Fri, 23 Aug 2019 21:45:47 GMT\"0x8D728134202F495\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "90b2f4e9-16a7-4774-81e7-e70d96e0d236", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflatad5391376f13?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1ded9fd-001e-00f1-5bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "f9a177e7-a2e0-4bfb-a147-b308aec81cd0" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflat0containerapitestlistblobsflatad5391376f13", "javabloblistblobsflat1containerapitestlistblobsflatad59616770" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflaterror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflaterror.json new file mode 100644 index 000000000000..89ca09e5e2a9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflaterror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflaterror0614900b7b078de964447a8e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C583C0C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0c3de-001e-00f1-51fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "4fe29db2-9535-4f70-8aed-b2b3c9c59830" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflaterror105337125ef22a08e4469a86?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c418-001e-00f1-04fc-59e1e5000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:b1e0c418-001e-00f1-04fc-59e1e5000000\nTime:2019-08-23T21:46:58.3746367Z", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "322b4420-65d6-4a6f-b3fc-b99ae5f5a7d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflaterror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c448-001e-00f1-31fc-59e1e5000000", + "Body" : "jtclistblobsflaterrorjtclistblobsflaterror0614900b7b078de964447a8eFri, 23 Aug 2019 21:46:58 GMT\"0x8D728136C583C0C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "b05a291b-8b52-4e74-9902-cb22a2408f01", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflaterror0614900b7b078de964447a8e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c46c-001e-00f1-54fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "7b63ac50-f6b6-40a8-848b-415a6d226173" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflaterror0614900b7b078de964447a8e", "jtclistblobsflaterror105337125ef22a08e4469a86" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmarker.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmarker.json new file mode 100644 index 000000000000..133b30986624 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmarker.json @@ -0,0 +1,372 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136BF99481\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce0618-501e-00c0-1efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "7409161a-c492-4bd4-8e33-c9e435526f14" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a/javabloblistblobsflatmarker188125d253258451244c6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136BFE978E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce0637-501e-00c0-3bfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "c579c811-5d8b-496d-8b77-73db0339d72c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a/javabloblistblobsflatmarker259667d57f7ab628b8403", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C03C8F0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce0663-501e-00c0-62fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "c30626e3-85c8-4173-8bae-7f668b298715" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a/javabloblistblobsflatmarker345749adaabb10823e46c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C08D336\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce0685-501e-00c0-80fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "1ad8e34f-b626-45a2-8c75-3f3f7b8a1578" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a/javabloblistblobsflatmarker4014856eaac4bff62d4c0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C0DDD85\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce06a0-501e-00c0-1bfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "142d6b77-fe79-4341-8ee7-b989561869e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a/javabloblistblobsflatmarker55446528bf08483e1243a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C12C0CB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce06cd-501e-00c0-43fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "86f35db5-df47-4682-b82e-833a5293bc39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a/javabloblistblobsflatmarker6065415ecd98b72de74f0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C17CB11\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce06eb-501e-00c0-5dfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "abeeefe4-dd9b-4d3d-94ba-666626a30a12" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a/javabloblistblobsflatmarker7003791ce87e9f85d4498", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C1CFC6E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce070a-501e-00c0-76fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "4e6fec66-a264-4099-babd-25253b94e035" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a/javabloblistblobsflatmarker8213457c1e77c938fd4f0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C21DFAF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce0738-501e-00c0-1ffc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "21899722-3288-4644-8842-13f4b6909dd1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a/javabloblistblobsflatmarker950846695b8e97fc1e421", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C26E9EC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce0764-501e-00c0-4afc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "50f83593-eb65-4fdf-b571-dc17aaef1512" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a/javabloblistblobsflatmarker107866236e1caf4c37d4a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C2BCD1F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce078e-501e-00c0-73fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "219aef92-1a6d-4e56-91fd-bf8bc9567857" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a?maxresults=6&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77ce07c0-501e-00c0-1cfc-59ba32000000", + "Body" : "6javabloblistblobsflatmarker107866236e1caf4c37d4aFri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136C2BCD1F512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker188125d253258451244c6Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136BFE978E512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker259667d57f7ab628b8403Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C03C8F0512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker345749adaabb10823e46cFri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C08D336512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker4014856eaac4bff62d4c0Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C0DDD85512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker55446528bf08483e1243aFri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C12C0CB512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYwNjU0MTVlY2Q5OGI3MmRlNzRmMCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "c3a0d5b8-dece-46bb-bfaf-4252122d3bb4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYwNjU0MTVlY2Q5OGI3MmRlNzRmMCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=6&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77ce0805-501e-00c0-5bfc-59ba32000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYwNjU0MTVlY2Q5OGI3MmRlNzRmMCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6javabloblistblobsflatmarker6065415ecd98b72de74f0Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C17CB11512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker7003791ce87e9f85d4498Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C1CFC6E512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker8213457c1e77c938fd4f0Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C21DFAF512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker950846695b8e97fc1e421Fri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136C26E9EC512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "9fa9ce73-c2a9-4e31-b709-0a5a54d5860b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYwNjU0MTVlY2Q5OGI3MmRlNzRmMCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=6&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c25b-001e-00f1-64fc-59e1e5000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYwNjU0MTVlY2Q5OGI3MmRlNzRmMCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6javabloblistblobsflatmarker6065415ecd98b72de74f0Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C17CB11512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker7003791ce87e9f85d4498Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C1CFC6E512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker8213457c1e77c938fd4f0Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C21DFAF512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker950846695b8e97fc1e421Fri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136C26E9EC512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "6912ca1e-3019-440f-9642-278d9e36bdf7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a?maxresults=6&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c2bd-001e-00f1-41fc-59e1e5000000", + "Body" : "6javabloblistblobsflatmarker107866236e1caf4c37d4aFri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136C2BCD1F512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker188125d253258451244c6Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136BFE978E512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker259667d57f7ab628b8403Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C03C8F0512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker345749adaabb10823e46cFri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C08D336512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker4014856eaac4bff62d4c0Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C0DDD85512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker55446528bf08483e1243aFri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C12C0CB512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYwNjU0MTVlY2Q5OGI3MmRlNzRmMCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "1c2a497d-13c2-4410-ad61-8243d1a010ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYwNjU0MTVlY2Q5OGI3MmRlNzRmMCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=6&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c320-001e-00f1-21fc-59e1e5000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYwNjU0MTVlY2Q5OGI3MmRlNzRmMCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6javabloblistblobsflatmarker6065415ecd98b72de74f0Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C17CB11512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker7003791ce87e9f85d4498Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C1CFC6E512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker8213457c1e77c938fd4f0Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136C21DFAF512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker950846695b8e97fc1e421Fri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136C26E9EC512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "e7f7a991-57cc-4522-b4a6-964f848e123c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatmarker&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c373-001e-00f1-6cfc-59e1e5000000", + "Body" : "jtclistblobsflatmarkerjtclistblobsflatmarker0666130fc2dd5e79754e05aFri, 23 Aug 2019 21:46:57 GMT\"0x8D728136BF99481\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "210a940b-e5be-461b-9914-80409d8e8c66", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmarker0666130fc2dd5e79754e05a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c3a0-001e-00f1-17fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "f6655431-cc8d-4f77-8fd0-8f5c54eb412b" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatmarker0666130fc2dd5e79754e05a", "javabloblistblobsflatmarker188125d253258451244c6", "javabloblistblobsflatmarker259667d57f7ab628b8403", "javabloblistblobsflatmarker345749adaabb10823e46c", "javabloblistblobsflatmarker4014856eaac4bff62d4c0", "javabloblistblobsflatmarker55446528bf08483e1243a", "javabloblistblobsflatmarker6065415ecd98b72de74f0", "javabloblistblobsflatmarker7003791ce87e9f85d4498", "javabloblistblobsflatmarker8213457c1e77c938fd4f0", "javabloblistblobsflatmarker950846695b8e97fc1e421", "javabloblistblobsflatmarker107866236e1caf4c37d4a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmin.json new file mode 100644 index 000000000000..456df9a7e841 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmin.json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmin0containerapitestlistblobsflatmin4fe395845?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813421E99B6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deda3a-001e-00f1-14fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "cedb17a0-05a5-45f1-9099-2a63604ec6b7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmin0containerapitestlistblobsflatmin4fe395845?include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deda78-001e-00f1-4efc-59e1e5000000", + "Body" : "", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "d3e6c98f-a688-4653-aaa2-703f9b91b6b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dedaa8-001e-00f1-7efc-59e1e5000000", + "Body" : "jtclistblobsflatminjtclistblobsflatmin0containerapitestlistblobsflatmin4fe395845Fri, 23 Aug 2019 21:45:47 GMT\"0x8D72813421E99B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "1758c814-5e34-4187-912d-e36450932877", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatmin0containerapitestlistblobsflatmin4fe395845?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dedad3-001e-00f1-28fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:46 GMT", + "x-ms-client-request-id" : "96d6c458-f75e-49bc-b63a-af5cd74e195a" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatmin0containerapitestlistblobsflatmin4fe395845" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionscopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionscopy.json new file mode 100644 index 000000000000..708eabc8f173 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionscopy.json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281342318A14\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dedb30-001e-00f1-7afc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:47 GMT", + "x-ms-client-request-id" : "f4c20cf4-92a7-40ea-bdd7-1802c601f895" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da/ajavabloblistblobsflatoptionscopy135877ec398c63a643", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728134237D0EF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dedb86-001e-00f1-4bfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:47 GMT", + "x-ms-client-request-id" : "9c162789-8277-4365-9ecb-ecd8a7c155ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da/cjavabloblistblobsflatoptionscopy246066ae325a773f2a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b85f38c6-fc45-442d-8398-5fa911332038", + "ETag" : "\"0x8D72813427005C2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1dedbc4-001e-00f1-06fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:47 GMT", + "x-ms-client-request-id" : "126df9c5-fec4-495c-8211-5b44d300082f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da/cjavabloblistblobsflatoptionscopy246066ae325a773f2a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:48 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1dede5f-001e-00f1-7dfc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "b85f38c6-fc45-442d-8398-5fa911332038", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da/ajavabloblistblobsflatoptionscopy135877ec398c63a643", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:45:47 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:45:48 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813427005C2\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "16e43e97-53b0-4706-883f-ba8d29cf3c46" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da/mjavabloblistblobsflatoptionscopy3973014d74661f97f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728134312D659\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dee65a-001e-00f1-0afc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:48 GMT", + "x-ms-client-request-id" : "f7da3b68-fa48-4185-9dbc-200ab64f2086" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da/ajavabloblistblobsflatoptionscopy135877ec398c63a643?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:45:49.1342500Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728134237D0EF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dee6b7-001e-00f1-63fc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:45:48 GMT", + "x-ms-client-request-id" : "e3910a0a-faba-41d5-99f9-202366453ea5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da/ujavabloblistblobsflatoptionscopy4312670694d81c1cb9?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dee70b-001e-00f1-34fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:48 GMT", + "x-ms-client-request-id" : "613b2a3a-9b88-44f4-8aed-7a6396ca4d00" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da?include=copy&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dee753-001e-00f1-75fc-59e1e5000000", + "Body" : "ajavabloblistblobsflatoptionscopy135877ec398c63a643Fri, 23 Aug 2019 21:45:47 GMTFri, 23 Aug 2019 21:45:47 GMT0x8D728134237D0EF512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionscopy246066ae325a773f2aFri, 23 Aug 2019 21:45:48 GMTFri, 23 Aug 2019 21:45:48 GMT0x8D72813427005C2512application/octet-stream0PageBlobHottrueunlockedavailableb85f38c6-fc45-442d-8398-5fa911332038https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da/ajavabloblistblobsflatoptionscopy135877ec398c63a643success512/512Fri, 23 Aug 2019 21:45:48 GMTtrue0mjavabloblistblobsflatoptionscopy3973014d74661f97f8Fri, 23 Aug 2019 21:45:49 GMTFri, 23 Aug 2019 21:45:49 GMT0x8D728134312D659512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:45:48 GMT", + "x-ms-client-request-id" : "e5d22524-0236-47b3-9cd9-322d82a37387", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatoptionscopy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dee7c5-001e-00f1-5ffc-59e1e5000000", + "Body" : "jtclistblobsflatoptionscopyjtclistblobsflatoptionscopy0218206f91873930aa4daFri, 23 Aug 2019 21:45:47 GMT\"0x8D7281342318A14\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:48 GMT", + "x-ms-client-request-id" : "5da8a5c9-59af-48e6-be90-99c805fbd965", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionscopy0218206f91873930aa4da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dee7f8-001e-00f1-10fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:48 GMT", + "x-ms-client-request-id" : "f13d7ece-999b-48ec-9c8a-eb69aa10697b" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionscopy0218206f91873930aa4da", "javabloblistblobsflatoptionscopy135877ec398c63a643", "javabloblistblobsflatoptionscopy246066ae325a773f2a", "javabloblistblobsflatoptionscopy3973014d74661f97f8", "javabloblistblobsflatoptionscopy4312670694d81c1cb9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsdeleted.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsdeleted.json new file mode 100644 index 000000000000..550acc6ec7b9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsdeleted.json @@ -0,0 +1,160 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsdeleted025341ff711f9a574e4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281345C359CF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1df071c-001e-00f1-4cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:53 GMT", + "x-ms-client-request-id" : "420828e1-4725-4cf3-ab7d-84c42cbb0872" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "b1df0763-001e-00f1-0efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:53 GMT", + "x-ms-client-request-id" : "836073e5-80a9-4847-8fc4-f21c0e20c974" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsdeleted025341ff711f9a574e4/javabloblistblobsflatoptionsdeleted1570991d13f89f51f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281357B921C6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dfd7e8-001e-00f1-33fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:23 GMT", + "x-ms-client-request-id" : "a4983dc4-5d0c-4cb7-94b5-c8493acaa85e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsdeleted025341ff711f9a574e4/javabloblistblobsflatoptionsdeleted1570991d13f89f51f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "false", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b1dfd82b-001e-00f1-71fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:23 GMT", + "x-ms-client-request-id" : "f0bdb4e8-535d-422d-9562-3f9a4f27f689" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsdeleted025341ff711f9a574e4?include=deleted&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dfd858-001e-00f1-1dfc-59e1e5000000", + "Body" : "javabloblistblobsflatoptionsdeleted1570991d13f89f51ftrueFri, 23 Aug 2019 21:46:23 GMTFri, 23 Aug 2019 21:46:23 GMT0x8D7281357B921C60application/octet-streamAppendBlobHottruetrueFri, 23 Aug 2019 21:46:23 GMT10", + "Date" : "Fri, 23 Aug 2019 21:46:23 GMT", + "x-ms-client-request-id" : "30ec7cb3-a762-402a-aae5-af5264957d13", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "b1dfd87e-001e-00f1-42fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:23 GMT", + "x-ms-client-request-id" : "3a628d22-c845-4311-b7cc-c2ac84808550" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatoptionsdeleted&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0a472-001e-00f1-19fc-59e1e5000000", + "Body" : "jtclistblobsflatoptionsdeletedjtclistblobsflatoptionsdeleted025341ff711f9a574e4Fri, 23 Aug 2019 21:45:53 GMT\"0x8D7281345C359CF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:46:53 GMT", + "x-ms-client-request-id" : "731394cf-1198-4e81-8d71-d09acf6522e2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsdeleted025341ff711f9a574e4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0a4b2-001e-00f1-55fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:53 GMT", + "x-ms-client-request-id" : "92caedea-f074-4298-bf96-cf22677f83d2" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsdeleted025341ff711f9a574e4", "javabloblistblobsflatoptionsdeleted1570991d13f89f51f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsfail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsfail.json new file mode 100644 index 000000000000..9ad2e954e1a3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsfail.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsfail03421284c9330e6815483?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136BEAEAF1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77ce05b6-501e-00c0-44fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "828e8e3b-2367-4866-a8db-32813164303b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatoptionsfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77ce05d5-501e-00c0-61fc-59ba32000000", + "Body" : "jtclistblobsflatoptionsfailjtclistblobsflatoptionsfail03421284c9330e6815483Fri, 23 Aug 2019 21:46:57 GMT\"0x8D728136BEAEAF1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "0d29cc10-1d68-4a5e-bce6-f58f1c122d87", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsfail03421284c9330e6815483?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77ce05f2-501e-00c0-78fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "3538d510-7acb-47a3-9f64-c85b62722237" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsfail03421284c9330e6815483" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmaxresults.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmaxresults.json new file mode 100644 index 000000000000..5c5310b6246d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmaxresults.json @@ -0,0 +1,285 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136AF9B579\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0b382-001e-00f1-0efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:55 GMT", + "x-ms-client-request-id" : "aa3a2a3e-6cf0-49d4-a744-f4866cdfb1ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a/ajavabloblistblobsflatoptionsmaxresults185055be6434352", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136AFF3857\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0b3e4-001e-00f1-5cfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:55 GMT", + "x-ms-client-request-id" : "66a0d705-bb7f-4359-977e-3095cf2ffae4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a/cjavabloblistblobsflatoptionsmaxresults25454348305bc99", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "0a1f5fca-09c3-4175-a100-8d613cc14f12", + "ETag" : "\"0x8D728136B099B1F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1e0b445-001e-00f1-2dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:55 GMT", + "x-ms-client-request-id" : "33960830-344e-4fb3-8f5a-9d2762f31c14" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a/cjavabloblistblobsflatoptionsmaxresults25454348305bc99", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:46:56 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1e0b4e0-001e-00f1-31fc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "0a1f5fca-09c3-4175-a100-8d613cc14f12", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a/ajavabloblistblobsflatoptionsmaxresults185055be6434352", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:46:55 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:46:56 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D728136B099B1F\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "a1d26de8-575b-45ea-9b7d-e3c4501aa9da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a/mjavabloblistblobsflatoptionsmaxresults3771988f9029d52", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136BAC44A0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0bc19-001e-00f1-20fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:56 GMT", + "x-ms-client-request-id" : "1f2ded96-6f16-41fd-9493-5210afb848cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a/ajavabloblistblobsflatoptionsmaxresults185055be6434352?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:46:57.2486387Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136AFF3857\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0bc5b-001e-00f1-5efc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:46:56 GMT", + "x-ms-client-request-id" : "283ac8d9-cb6d-40fa-ba89-b85ae6991a7f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a/ujavabloblistblobsflatoptionsmaxresults4362276fae74581?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0bca2-001e-00f1-1efc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:56 GMT", + "x-ms-client-request-id" : "74497727-3668-4aa3-adf6-b9f9d1717ec5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a?maxresults=2&include=copy%2csnapshots%2cuncommittedblobs&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0bcdd-001e-00f1-53fc-59e1e5000000", + "Body" : "2ajavabloblistblobsflatoptionsmaxresults185055be64343522019-08-23T21:46:57.2486387ZFri, 23 Aug 2019 21:46:56 GMTFri, 23 Aug 2019 21:46:56 GMT0x8D728136AFF3857512application/octet-stream0PageBlobHottruetrue0ajavabloblistblobsflatoptionsmaxresults185055be6434352Fri, 23 Aug 2019 21:46:56 GMTFri, 23 Aug 2019 21:46:56 GMT0x8D728136AFF3857512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI1NDU0MzQ4MzA1YmM5OSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 23 Aug 2019 21:46:56 GMT", + "x-ms-client-request-id" : "06091c35-524f-45b1-a906-0f46df38a2f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a?marker=2%21132%21MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI1NDU0MzQ4MzA1YmM5OSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=2&include=copy%2csnapshots%2cuncommittedblobs&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0bd0e-001e-00f1-7dfc-59e1e5000000", + "Body" : "2!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI1NDU0MzQ4MzA1YmM5OSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-2cjavabloblistblobsflatoptionsmaxresults25454348305bc99Fri, 23 Aug 2019 21:46:56 GMTFri, 23 Aug 2019 21:46:56 GMT0x8D728136B099B1F512application/octet-stream0PageBlobHottrueunlockedavailable0a1f5fca-09c3-4175-a100-8d613cc14f12https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a/ajavabloblistblobsflatoptionsmaxresults185055be6434352success512/512Fri, 23 Aug 2019 21:46:56 GMTtrue0mjavabloblistblobsflatoptionsmaxresults3771988f9029d52Fri, 23 Aug 2019 21:46:57 GMTFri, 23 Aug 2019 21:46:57 GMT0x8D728136BAC44A0512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IXVqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czQzNjIyNzZmYWU3NDU4MSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 23 Aug 2019 21:46:56 GMT", + "x-ms-client-request-id" : "31cc65b3-59e4-4d8b-8af8-016255997ba9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a?marker=2%21132%21MDAwMDU0IXVqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czQzNjIyNzZmYWU3NDU4MSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=2&include=copy%2csnapshots%2cuncommittedblobs&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0bd67-001e-00f1-4efc-59e1e5000000", + "Body" : "2!132!MDAwMDU0IXVqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czQzNjIyNzZmYWU3NDU4MSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-2ujavabloblistblobsflatoptionsmaxresults4362276fae745810BlockBlobHottrueunlockedavailablefalse0", + "Date" : "Fri, 23 Aug 2019 21:46:56 GMT", + "x-ms-client-request-id" : "84a07fa1-48b3-4e6c-97b3-eededc7645f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a?maxresults=2&include=copy%2csnapshots%2cuncommittedblobs&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77ce0539-501e-00c0-51fc-59ba32000000", + "Body" : "2ajavabloblistblobsflatoptionsmaxresults185055be64343522019-08-23T21:46:57.2486387ZFri, 23 Aug 2019 21:46:56 GMTFri, 23 Aug 2019 21:46:56 GMT0x8D728136AFF3857512application/octet-stream0PageBlobHottruetrue0ajavabloblistblobsflatoptionsmaxresults185055be6434352Fri, 23 Aug 2019 21:46:56 GMTFri, 23 Aug 2019 21:46:56 GMT0x8D728136AFF3857512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI1NDU0MzQ4MzA1YmM5OSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "02621aaa-fbd3-4a09-9666-0dd596ce9bb8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatoptionsmaxresults&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77ce056a-501e-00c0-7cfc-59ba32000000", + "Body" : "jtclistblobsflatoptionsmaxresultsjtclistblobsflatoptionsmaxresults072236b1fa85ee592aFri, 23 Aug 2019 21:46:56 GMT\"0x8D728136AF9B579\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "a791c860-e403-48a0-94b6-15c2ca8aceb0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmaxresults072236b1fa85ee592a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77ce0592-501e-00c0-20fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "a3053867-b9f6-4118-ba08-8b6571448d37" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsmaxresults072236b1fa85ee592a", "javabloblistblobsflatoptionsmaxresults185055be6434352", "javabloblistblobsflatoptionsmaxresults25454348305bc99", "javabloblistblobsflatoptionsmaxresults3771988f9029d52", "javabloblistblobsflatoptionsmaxresults4362276fae74581" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmetadata.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmetadata.json new file mode 100644 index 000000000000..3d3af6d76bd9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmetadata.json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata067793de92ccf36c9f4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728134333F78E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dee865-001e-00f1-79fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:48 GMT", + "x-ms-client-request-id" : "9a27dd11-a091-41ac-9380-e03e578b4127" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata067793de92ccf36c9f4/ajavabloblistblobsflatoptionsmetadata1421074dc064c25b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281343395388\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dee8ac-001e-00f1-3bfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:48 GMT", + "x-ms-client-request-id" : "adb9b4e1-492e-4d46-bc2c-e5dffbbeb6fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata067793de92ccf36c9f4/cjavabloblistblobsflatoptionsmetadata233566dc646b3c82", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "4a0d084f-b920-478b-be74-de08c6cb5fe0", + "ETag" : "\"0x8D728134345D9BC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1dee8f4-001e-00f1-7ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:48 GMT", + "x-ms-client-request-id" : "ab570a85-327f-4420-8757-77375f74148f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata067793de92ccf36c9f4/cjavabloblistblobsflatoptionsmetadata233566dc646b3c82", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:49 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1dee9b1-001e-00f1-30fc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "4a0d084f-b920-478b-be74-de08c6cb5fe0", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata067793de92ccf36c9f4/ajavabloblistblobsflatoptionsmetadata1421074dc064c25b", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:45:48 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:45:49 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D728134345D9BC\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "fa2e8d3d-e6a2-4780-bc89-e8c5cc5e1b9e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata067793de92ccf36c9f4/mjavabloblistblobsflatoptionsmetadata3112057290d8ed57", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281343E80E08\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1def1ba-001e-00f1-39fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:49 GMT", + "x-ms-client-request-id" : "0296a72a-a7a5-40fb-a492-da5b5cb46f05" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata067793de92ccf36c9f4/ajavabloblistblobsflatoptionsmetadata1421074dc064c25b?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:45:50.5345960Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281343395388\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1def1f8-001e-00f1-76fc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:45:49 GMT", + "x-ms-client-request-id" : "b769354a-0407-4f2d-a658-c14011bfeada" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata067793de92ccf36c9f4/ujavabloblistblobsflatoptionsmetadata4069525052006a24?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1def237-001e-00f1-30fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:49 GMT", + "x-ms-client-request-id" : "1293859d-afb6-48e2-bf95-66eca5288cfe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata067793de92ccf36c9f4?include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1def26c-001e-00f1-62fc-59e1e5000000", + "Body" : "ajavabloblistblobsflatoptionsmetadata1421074dc064c25bFri, 23 Aug 2019 21:45:49 GMTFri, 23 Aug 2019 21:45:49 GMT0x8D7281343395388512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionsmetadata233566dc646b3c82Fri, 23 Aug 2019 21:45:49 GMTFri, 23 Aug 2019 21:45:49 GMT0x8D728134345D9BC512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobsflatoptionsmetadata3112057290d8ed57Fri, 23 Aug 2019 21:45:50 GMTFri, 23 Aug 2019 21:45:50 GMT0x8D7281343E80E08512application/octet-stream0PageBlobHottrueunlockedavailabletrue0bar", + "Date" : "Fri, 23 Aug 2019 21:45:49 GMT", + "x-ms-client-request-id" : "f6688d08-0b9f-4c3f-9f36-0965b569980e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatoptionsmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1def2bf-001e-00f1-2cfc-59e1e5000000", + "Body" : "jtclistblobsflatoptionsmetadatajtclistblobsflatoptionsmetadata067793de92ccf36c9f4Fri, 23 Aug 2019 21:45:49 GMT\"0x8D728134333F78E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:50 GMT", + "x-ms-client-request-id" : "92d20a1b-ce7e-410e-8d7b-ebf508dc5e6f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsmetadata067793de92ccf36c9f4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1def2ed-001e-00f1-57fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:50 GMT", + "x-ms-client-request-id" : "8c268ee0-d1d0-4936-9a84-575e66464355" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsmetadata067793de92ccf36c9f4", "javabloblistblobsflatoptionsmetadata1421074dc064c25b", "javabloblistblobsflatoptionsmetadata233566dc646b3c82", "javabloblistblobsflatoptionsmetadata3112057290d8ed57", "javabloblistblobsflatoptionsmetadata4069525052006a24" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsprefix.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsprefix.json new file mode 100644 index 000000000000..b03bc34c4033 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsprefix.json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix0762970a0a83f03a0940?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281369C5084F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0a576-001e-00f1-09fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:53 GMT", + "x-ms-client-request-id" : "c3ca4cc9-adb8-4c28-9955-ac4e50b96ab9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix0762970a0a83f03a0940/ajavabloblistblobsflatoptionsprefix184040494b2d61583", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281369CA15E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0a5ad-001e-00f1-3dfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:53 GMT", + "x-ms-client-request-id" : "e0012ee4-1085-4d98-ac3e-554d644ff739" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix0762970a0a83f03a0940/cjavabloblistblobsflatoptionsprefix292919b6ea513b48c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "115173a0-f389-4f00-89b5-e2a291923b53", + "ETag" : "\"0x8D728136A3351D2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1e0a5f9-001e-00f1-06fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:54 GMT", + "x-ms-client-request-id" : "1ea4ed8b-0cda-4128-ad4a-77f818f52618" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix0762970a0a83f03a0940/cjavabloblistblobsflatoptionsprefix292919b6ea513b48c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:46:54 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1e0aad1-001e-00f1-19fc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "115173a0-f389-4f00-89b5-e2a291923b53", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix0762970a0a83f03a0940/ajavabloblistblobsflatoptionsprefix184040494b2d61583", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:46:54 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:46:54 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D728136A3351D2\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "2ea743d6-5079-4297-ad48-c76f2a6bd7b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix0762970a0a83f03a0940/mjavabloblistblobsflatoptionsprefix35877296f75b7082a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136AD62269\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0b1e4-001e-00f1-39fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:55 GMT", + "x-ms-client-request-id" : "ab65a796-5f93-4c89-a914-6d61519e02b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix0762970a0a83f03a0940/ajavabloblistblobsflatoptionsprefix184040494b2d61583?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:46:55.8452920Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281369CA15E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0b21a-001e-00f1-6dfc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:46:55 GMT", + "x-ms-client-request-id" : "e6ee99ed-2774-4e34-b508-0b6dc84d04db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix0762970a0a83f03a0940/ujavabloblistblobsflatoptionsprefix425869d3b6c9b395b?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0b25d-001e-00f1-2cfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:55 GMT", + "x-ms-client-request-id" : "bc854347-6c5b-4cdf-a395-dbfae6e31f8a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix0762970a0a83f03a0940?prefix=a&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0b293-001e-00f1-5afc-59e1e5000000", + "Body" : "aajavabloblistblobsflatoptionsprefix184040494b2d61583Fri, 23 Aug 2019 21:46:54 GMTFri, 23 Aug 2019 21:46:54 GMT0x8D7281369CA15E3512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:46:55 GMT", + "x-ms-client-request-id" : "d81e54a1-e911-4df9-9929-40b01c3c2d87", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatoptionsprefix&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0b2b6-001e-00f1-7cfc-59e1e5000000", + "Body" : "jtclistblobsflatoptionsprefixjtclistblobsflatoptionsprefix0762970a0a83f03a0940Fri, 23 Aug 2019 21:46:54 GMT\"0x8D7281369C5084F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:46:55 GMT", + "x-ms-client-request-id" : "e4fbf3f8-7863-465e-a108-68620cc7f31f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsprefix0762970a0a83f03a0940?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0b333-001e-00f1-53fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:55 GMT", + "x-ms-client-request-id" : "68288c6a-481d-46a4-b2a3-52dd131f759c" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsprefix0762970a0a83f03a0940", "javabloblistblobsflatoptionsprefix184040494b2d61583", "javabloblistblobsflatoptionsprefix292919b6ea513b48c", "javabloblistblobsflatoptionsprefix35877296f75b7082a", "javabloblistblobsflatoptionsprefix425869d3b6c9b395b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionssnapshots.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionssnapshots.json new file mode 100644 index 000000000000..1d5d56c5cf19 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionssnapshots.json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots058830907d9f48f37b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813440ADD4F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1def331-001e-00f1-16fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:50 GMT", + "x-ms-client-request-id" : "c5997545-3a65-4a4b-b874-0cca49b74ea5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots058830907d9f48f37b/ajavabloblistblobsflatoptionssnapshots115454d0047be40a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281344103969\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1def36a-001e-00f1-4bfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:50 GMT", + "x-ms-client-request-id" : "45acdb9c-5756-4532-a594-70233e8859e3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots058830907d9f48f37b/cjavabloblistblobsflatoptionssnapshots2737250f01783a98", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "09847b8f-be95-4259-88cc-1550e41bb9ac", + "ETag" : "\"0x8D72813441B1189\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1def3b1-001e-00f1-0dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:50 GMT", + "x-ms-client-request-id" : "16d4d732-5ab4-4436-b2dd-7470c5b5eefe" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots058830907d9f48f37b/cjavabloblistblobsflatoptionssnapshots2737250f01783a98", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:50 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1def422-001e-00f1-7bfc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "09847b8f-be95-4259-88cc-1550e41bb9ac", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots058830907d9f48f37b/ajavabloblistblobsflatoptionssnapshots115454d0047be40a", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:45:50 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:45:50 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813441B1189\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "d5a3ed69-b852-4a19-81dd-98111b729cd2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots058830907d9f48f37b/mjavabloblistblobsflatoptionssnapshots312762079fbd9f21", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281344BD6CEB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1defac0-001e-00f1-2ffc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:51 GMT", + "x-ms-client-request-id" : "3a743747-ab52-4b1e-9e2c-9bc7ef5e8e63" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots058830907d9f48f37b/ajavabloblistblobsflatoptionssnapshots115454d0047be40a?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:45:51.9309394Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281344103969\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1defaf0-001e-00f1-5ffc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:45:51 GMT", + "x-ms-client-request-id" : "4818c2b2-9674-48e8-a6da-e7a21f8d920b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots058830907d9f48f37b/ujavabloblistblobsflatoptionssnapshots481224786f731757?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1defb35-001e-00f1-1ffc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:51 GMT", + "x-ms-client-request-id" : "1008afaf-93bf-4752-94cc-e5ccc24b24af" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots058830907d9f48f37b?include=snapshots&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1defba3-001e-00f1-0afc-59e1e5000000", + "Body" : "ajavabloblistblobsflatoptionssnapshots115454d0047be40a2019-08-23T21:45:51.9309394ZFri, 23 Aug 2019 21:45:50 GMTFri, 23 Aug 2019 21:45:50 GMT0x8D7281344103969512application/octet-stream0PageBlobHottruetrue0ajavabloblistblobsflatoptionssnapshots115454d0047be40aFri, 23 Aug 2019 21:45:50 GMTFri, 23 Aug 2019 21:45:50 GMT0x8D7281344103969512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionssnapshots2737250f01783a98Fri, 23 Aug 2019 21:45:50 GMTFri, 23 Aug 2019 21:45:50 GMT0x8D72813441B1189512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobsflatoptionssnapshots312762079fbd9f21Fri, 23 Aug 2019 21:45:51 GMTFri, 23 Aug 2019 21:45:51 GMT0x8D7281344BD6CEB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:45:51 GMT", + "x-ms-client-request-id" : "ae01ff89-8d0e-4fa5-82c6-42fc472d5c22", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatoptionssnapshots&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1defc04-001e-00f1-69fc-59e1e5000000", + "Body" : "jtclistblobsflatoptionssnapshotsjtclistblobsflatoptionssnapshots058830907d9f48f37bFri, 23 Aug 2019 21:45:50 GMT\"0x8D72813440ADD4F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:51 GMT", + "x-ms-client-request-id" : "a49ab07c-ec78-4b41-a4c6-5c4a121f375c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionssnapshots058830907d9f48f37b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1defc3d-001e-00f1-1efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:51 GMT", + "x-ms-client-request-id" : "8d0fca50-cbc8-45f8-878e-9f82bcf3ebcf" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionssnapshots058830907d9f48f37b", "javabloblistblobsflatoptionssnapshots115454d0047be40a", "javabloblistblobsflatoptionssnapshots2737250f01783a98", "javabloblistblobsflatoptionssnapshots312762079fbd9f21", "javabloblistblobsflatoptionssnapshots481224786f731757" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsuncommitted.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsuncommitted.json new file mode 100644 index 000000000000..a60f1f6b4d0d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsuncommitted.json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted03421417e72d8dede?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281344E19BFC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1defc94-001e-00f1-6efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:51 GMT", + "x-ms-client-request-id" : "1680ad76-b6ba-4f84-b481-cef04ab121be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted03421417e72d8dede/ajavabloblistblobsflatoptionsuncommitted187374b5fc71cf5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281344E6A9EC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1defcd6-001e-00f1-2afc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:51 GMT", + "x-ms-client-request-id" : "1dca7208-7263-4ca6-8236-5bb3d05428f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted03421417e72d8dede/cjavabloblistblobsflatoptionsuncommitted2097182d06694e1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "5141b58b-0174-4bb6-a774-edfa3be6334d", + "ETag" : "\"0x8D7281344FFDD6F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1defd0c-001e-00f1-5ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:51 GMT", + "x-ms-client-request-id" : "b0715ac7-abbd-46eb-a15c-5375b2c7ba07" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted03421417e72d8dede/cjavabloblistblobsflatoptionsuncommitted2097182d06694e1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:45:52 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1defe4c-001e-00f1-09fc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "5141b58b-0174-4bb6-a774-edfa3be6334d", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted03421417e72d8dede/ajavabloblistblobsflatoptionsuncommitted187374b5fc71cf5", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:45:51 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:45:52 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7281344FFDD6F\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "0105a93c-0edd-4b5a-a873-e93c4b3d23b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted03421417e72d8dede/mjavabloblistblobsflatoptionsuncommitted30828370677ce40", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281345A19C50\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1df0549-001e-00f1-1dfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:52 GMT", + "x-ms-client-request-id" : "e99f2f70-12f3-444f-a8e0-eca972d39a3b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted03421417e72d8dede/ajavabloblistblobsflatoptionsuncommitted187374b5fc71cf5?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:45:53.4313795Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281344E6A9EC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1df0586-001e-00f1-56fc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:45:52 GMT", + "x-ms-client-request-id" : "a33477c9-3b04-492d-9ee4-a47a54f9d50a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted03421417e72d8dede/ujavabloblistblobsflatoptionsuncommitted4939636aab7dec9?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1df05d3-001e-00f1-1dfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:45:52 GMT", + "x-ms-client-request-id" : "bea90a6a-b0ad-48cf-981e-bd028074a5c9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted03421417e72d8dede?include=uncommittedblobs&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1df061d-001e-00f1-5dfc-59e1e5000000", + "Body" : "ajavabloblistblobsflatoptionsuncommitted187374b5fc71cf5Fri, 23 Aug 2019 21:45:52 GMTFri, 23 Aug 2019 21:45:52 GMT0x8D7281344E6A9EC512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionsuncommitted2097182d06694e1Fri, 23 Aug 2019 21:45:52 GMTFri, 23 Aug 2019 21:45:52 GMT0x8D7281344FFDD6F512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobsflatoptionsuncommitted30828370677ce40Fri, 23 Aug 2019 21:45:53 GMTFri, 23 Aug 2019 21:45:53 GMT0x8D7281345A19C50512application/octet-stream0PageBlobHottrueunlockedavailabletrue0ujavabloblistblobsflatoptionsuncommitted4939636aab7dec90BlockBlobHottrueunlockedavailablefalse0", + "Date" : "Fri, 23 Aug 2019 21:45:52 GMT", + "x-ms-client-request-id" : "22dad73c-5f9a-43a7-8dfa-be4c15e7ffa6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatoptionsuncommitted&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1df0689-001e-00f1-41fc-59e1e5000000", + "Body" : "jtclistblobsflatoptionsuncommittedjtclistblobsflatoptionsuncommitted03421417e72d8dedeFri, 23 Aug 2019 21:45:52 GMT\"0x8D7281344E19BFC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:52 GMT", + "x-ms-client-request-id" : "55207b50-4d3d-4d58-85cc-ddbca3e06101", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatoptionsuncommitted03421417e72d8dede?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1df06c3-001e-00f1-77fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:52 GMT", + "x-ms-client-request-id" : "3735f923-2473-49e4-a8df-cd081b5fd148" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsuncommitted03421417e72d8dede", "javabloblistblobsflatoptionsuncommitted187374b5fc71cf5", "javabloblistblobsflatoptionsuncommitted2097182d06694e1", "javabloblistblobsflatoptionsuncommitted30828370677ce40", "javabloblistblobsflatoptionsuncommitted4939636aab7dec9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatsimple.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatsimple.json new file mode 100644 index 000000000000..4563ab52d3c3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatsimple.json @@ -0,0 +1,352 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813965AFCFE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf281f-501e-00c0-19fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "18d68a9a-b316-4a5a-8934-064180e16935" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9/javabloblistblobsflatsimple153259b78c6181f87846e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813966212C5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf284f-501e-00c0-44fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "0ec1b2ee-dd13-4cae-9fae-620c7b3f4c20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9/javabloblistblobsflatsimple291203c2ec0ef48e8141f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281396676B42\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2873-501e-00c0-68fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "ce9e13a6-221f-4793-a968-198122e4fc77" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9/javabloblistblobsflatsimple3907977d93b45f6997432", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813966C759F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf289c-501e-00c0-11fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "e440de6b-69ba-4928-b933-bb53116abd5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9/javabloblistblobsflatsimple4976104e28bb0785c74f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139671CE0F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf28ba-501e-00c0-2dfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "44907692-b1fb-4fd3-bf95-bb9a41504151" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9/javabloblistblobsflatsimple597725136f2710baf247f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139677268D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf28e1-501e-00c0-4efc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "e142cbde-b658-44c8-8c4a-91fa739b3cac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9/javabloblistblobsflatsimple6498701f0bdfd20a49486", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813967CCD47\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2908-501e-00c0-72fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "189612c6-7cf6-45ea-aac2-a56c845ed8b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9/javabloblistblobsflatsimple723059fc0216dea7a547a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139682E943\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2946-501e-00c0-2bfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "35bffa0c-21cd-439d-add8-defbcbe5e3a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9/javabloblistblobsflatsimple80959242ea72d477fb452", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813968868DC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf296c-501e-00c0-4cfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "32e95719-b91f-463b-b032-6553bc121ad0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9/javabloblistblobsflatsimple9773469a652f19665f49b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813968E84DC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2999-501e-00c0-74fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "fcd08f29-9ec1-4c82-9e7d-00c1e378d4e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9/javabloblistblobsflatsimple1034012c86a6d72301640", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813969479C1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf29b4-501e-00c0-0ffc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "199072fa-6c69-4426-af84-d44766ab98c6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9?maxresults=3&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf29c9-501e-00c0-23fc-59ba32000000", + "Body" : "3javabloblistblobsflatsimple1034012c86a6d72301640Fri, 23 Aug 2019 21:48:09 GMTFri, 23 Aug 2019 21:48:09 GMT0x8D72813969479C1512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple153259b78c6181f87846eFri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813966212C5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple291203c2ec0ef48e8141fFri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D7281396676B42512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTM5MDc5NzdkOTNiNDVmNjk5NzQzMiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "9d95a1ea-44cc-4c45-ab54-d3148f5bc248", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTM5MDc5NzdkOTNiNDVmNjk5NzQzMiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=3&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf29f3-501e-00c0-49fc-59ba32000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTM5MDc5NzdkOTNiNDVmNjk5NzQzMiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-3javabloblistblobsflatsimple3907977d93b45f6997432Fri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813966C759F512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple4976104e28bb0785c74f8Fri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D728139671CE0F512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple597725136f2710baf247fFri, 23 Aug 2019 21:48:09 GMTFri, 23 Aug 2019 21:48:09 GMT0x8D728139677268D512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTY0OTg3MDFmMGJkZmQyMGE0OTQ4NiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "180c12c9-c05e-4fb6-aed7-07e28c694d3f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTY0OTg3MDFmMGJkZmQyMGE0OTQ4NiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=3&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2a1d-501e-00c0-71fc-59ba32000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTY0OTg3MDFmMGJkZmQyMGE0OTQ4NiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-3javabloblistblobsflatsimple6498701f0bdfd20a49486Fri, 23 Aug 2019 21:48:09 GMTFri, 23 Aug 2019 21:48:09 GMT0x8D72813967CCD47512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple723059fc0216dea7a547aFri, 23 Aug 2019 21:48:09 GMTFri, 23 Aug 2019 21:48:09 GMT0x8D728139682E943512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple80959242ea72d477fb452Fri, 23 Aug 2019 21:48:09 GMTFri, 23 Aug 2019 21:48:09 GMT0x8D72813968868DC512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTk3NzM0NjlhNjUyZjE5NjY1ZjQ5YiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "0be4d1e3-b4a9-42b0-9fe8-da180057c4fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTk3NzM0NjlhNjUyZjE5NjY1ZjQ5YiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=3&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2a41-501e-00c0-12fc-59ba32000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTk3NzM0NjlhNjUyZjE5NjY1ZjQ5YiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-3javabloblistblobsflatsimple9773469a652f19665f49bFri, 23 Aug 2019 21:48:09 GMTFri, 23 Aug 2019 21:48:09 GMT0x8D72813968E84DC512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "4055c2d3-495c-4b2e-a2dc-a52f1727701a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatsimple&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2a62-501e-00c0-31fc-59ba32000000", + "Body" : "jtclistblobsflatsimplejtclistblobsflatsimple0419750631aae9ab2f404a9Fri, 23 Aug 2019 21:48:08 GMT\"0x8D72813965AFCFE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "3f3c4028-91da-4de6-af3a-51ccc473faaf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatsimple0419750631aae9ab2f404a9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2a77-501e-00c0-44fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "285c3389-d9ac-4a73-9cc0-da5a42121b2f" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatsimple0419750631aae9ab2f404a9", "javabloblistblobsflatsimple153259b78c6181f87846e", "javabloblistblobsflatsimple291203c2ec0ef48e8141f", "javabloblistblobsflatsimple3907977d93b45f6997432", "javabloblistblobsflatsimple4976104e28bb0785c74f8", "javabloblistblobsflatsimple597725136f2710baf247f", "javabloblistblobsflatsimple6498701f0bdfd20a49486", "javabloblistblobsflatsimple723059fc0216dea7a547a", "javabloblistblobsflatsimple80959242ea72d477fb452", "javabloblistblobsflatsimple9773469a652f19665f49b", "javabloblistblobsflatsimple1034012c86a6d72301640" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatwithtimeoutstillbackedbypagedflux.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatwithtimeoutstillbackedbypagedflux.json new file mode 100644 index 000000000000..0657ce041fca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatwithtimeoutstillbackedbypagedflux.json @@ -0,0 +1,222 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136C6D4FD9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0c4b5-001e-00f1-18fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "x-ms-client-request-id" : "adf1a422-a57d-40ec-844a-9b6fa47578ce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508/javabloblistblobsflatwithtimeoutstillbackedbypagedflux1980881", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728136C7459AC\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1e0c50f-001e-00f1-68fc-59e1e5000000", + "x-ms-client-request-id" : "7b20adef-4bc2-4eaf-8a6c-7b3b0d24a2f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508/javabloblistblobsflatwithtimeoutstillbackedbypagedflux2967602", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728136C798B09\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1e0c55d-001e-00f1-31fc-59e1e5000000", + "x-ms-client-request-id" : "e7408308-67b8-40a6-9a0a-63ea9d165f74" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508/javabloblistblobsflatwithtimeoutstillbackedbypagedflux372226c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728136C7EE38B\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1e0c5a5-001e-00f1-74fc-59e1e5000000", + "x-ms-client-request-id" : "1ec67125-5744-43a7-8414-41f0e5f65df8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508/javabloblistblobsflatwithtimeoutstillbackedbypagedflux4172616", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728136C83EDD6\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1e0c5d2-001e-00f1-1ffc-59e1e5000000", + "x-ms-client-request-id" : "bc1970f8-d478-417f-9d21-df00617589cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508/javabloblistblobsflatwithtimeoutstillbackedbypagedflux503138d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728136C88F82A\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1e0c608-001e-00f1-52fc-59e1e5000000", + "x-ms-client-request-id" : "6bb5b2b2-4f3e-4256-89c8-7f9d61ca7173" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508?maxresults=3&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c635-001e-00f1-7dfc-59e1e5000000", + "Body" : "3javabloblistblobsflatwithtimeoutstillbackedbypagedflux1980881Fri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136C7459AC7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobsflatwithtimeoutstillbackedbypagedflux2967602Fri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136C798B097application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobsflatwithtimeoutstillbackedbypagedflux372226cFri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136C7EE38B7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue02!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzZmxhdHdpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQxNzI2MTYhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "8e16ddd4-77d6-4362-9cba-ab8d9823dc4e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508?marker=2%21140%21MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzZmxhdHdpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQxNzI2MTYhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh&maxresults=3&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c67c-001e-00f1-3efc-59e1e5000000", + "Body" : "2!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzZmxhdHdpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQxNzI2MTYhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh3javabloblistblobsflatwithtimeoutstillbackedbypagedflux4172616Fri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136C83EDD67application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobsflatwithtimeoutstillbackedbypagedflux503138dFri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136C88F82A7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "afa930fe-ec7a-4508-b748-fedd989985cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobsflatwithtimeoutstillbackedbypagedflux&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c6a4-001e-00f1-63fc-59e1e5000000", + "Body" : "jtclistblobsflatwithtimeoutstillbackedbypagedfluxjtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508Fri, 23 Aug 2019 21:46:58 GMT\"0x8D728136C6D4FD9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "1d127eb7-72ee-4bfc-91d2-ed47f211e55c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c6d1-001e-00f1-0efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "a3b3e29a-05d0-480a-ae8a-1b87ba488dd9" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatwithtimeoutstillbackedbypagedflux0688224508", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux1980881", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux2967602", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux372226c", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux4172616", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux503138d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchy.json new file mode 100644 index 000000000000..3b3c1ed1009d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchy.json @@ -0,0 +1,103 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchy076987fd47bf43ffe941e997?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136CDD1D0D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0ca52-001e-00f1-4dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "cbd11550-d227-4bd4-afe4-fd01a3622c7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchy076987fd47bf43ffe941e997/javabloblistblobshierarchy1562832218a7be2bd1405", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136CF20CF4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0cb6c-001e-00f1-4dfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "6db98aaa-c5cd-4d48-97af-41af8fc64d2b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchy076987fd47bf43ffe941e997?delimiter=/&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0cbb4-001e-00f1-11fc-59e1e5000000", + "Body" : "/javabloblistblobshierarchy1562832218a7be2bd1405Fri, 23 Aug 2019 21:46:59 GMTFri, 23 Aug 2019 21:46:59 GMT0x8D728136CF20CF4512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "d25dff81-af57-40a6-8389-0946f23bb016", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshierarchy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0cbf7-001e-00f1-50fc-59e1e5000000", + "Body" : "jtclistblobshierarchyjtclistblobshierarchy076987fd47bf43ffe941e997Fri, 23 Aug 2019 21:46:59 GMT\"0x8D728136CDD1D0D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "2e443d77-682d-4794-8bec-c7b0fac17d64", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchy076987fd47bf43ffe941e997?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0cc33-001e-00f1-09fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "59e5cdbc-c046-481c-8344-ba9460658c68" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierarchy076987fd47bf43ffe941e997", "javabloblistblobshierarchy1562832218a7be2bd1405" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchymin.json new file mode 100644 index 000000000000..cb76e67d368c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchymin.json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchymin0609235af2c7fc479c4d8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136D056F75\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0cc8d-001e-00f1-5cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "4bfe66da-652e-4e36-8674-bcbf059fbc50" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchymin0609235af2c7fc479c4d8a?prefix=/&delimiter=/&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0cccb-001e-00f1-17fc-59e1e5000000", + "Body" : "//", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "ba8c1419-ccd0-44c3-99e2-df1f5228f530", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshierarchymin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0cd0c-001e-00f1-51fc-59e1e5000000", + "Body" : "jtclistblobshierarchyminjtclistblobshierarchymin0609235af2c7fc479c4d8aFri, 23 Aug 2019 21:46:59 GMT\"0x8D728136D056F75\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "6401615f-fc09-40f9-ae7c-2038c42a7272", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierarchymin0609235af2c7fc479c4d8a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0cd3a-001e-00f1-7dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "13f57751-9811-494a-9bfd-c7edd458f22d" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierarchymin0609235af2c7fc479c4d8a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierdelim.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierdelim.json new file mode 100644 index 000000000000..0ec6934ffb61 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierdelim.json @@ -0,0 +1,229 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim088404fa6c4994594c4850bc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395B6BD5E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a734-001e-00f1-11fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "72bea0c2-8ee4-4b7f-9b0d-48ad0a71cd25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim088404fa6c4994594c4850bc/a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395BC0D0C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a76c-001e-00f1-45fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "346a1255-9c76-48b4-9b00-bcd17d3d73a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim088404fa6c4994594c4850bc/b/a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395C13E73\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a7b0-001e-00f1-06fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "fc64d018-0a5f-40fe-955e-209fe9fc0114" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim088404fa6c4994594c4850bc/c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395C6BE0D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a7e3-001e-00f1-35fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "a07c6205-51f4-4df8-8a15-f3287f44e1bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim088404fa6c4994594c4850bc/d/a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395CC64BE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a822-001e-00f1-70fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "0ddd9a2b-1606-451a-be21-ef8b474c046f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim088404fa6c4994594c4850bc/e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395D20B6F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a85b-001e-00f1-27fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "9f8e4587-2bb2-42bd-9ccc-cb315618c2ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim088404fa6c4994594c4850bc/f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395D763F6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a8a7-001e-00f1-6bfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "aece5e97-c00c-41ed-8666-4deb56e45fbe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim088404fa6c4994594c4850bc/g/a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395DCBC7D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a8e4-001e-00f1-26fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "1574e1be-b74a-4808-9201-3e3270f61df6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim088404fa6c4994594c4850bc?delimiter=/&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2a92c-001e-00f1-67fc-59e1e5000000", + "Body" : "/aFri, 23 Aug 2019 21:48:07 GMTFri, 23 Aug 2019 21:48:07 GMT0x8D7281395BC0D0C0application/octet-streamAppendBlobHottrueunlockedavailabletrue0b/cFri, 23 Aug 2019 21:48:07 GMTFri, 23 Aug 2019 21:48:07 GMT0x8D7281395C6BE0D0application/octet-streamAppendBlobHottrueunlockedavailabletrue0d/eFri, 23 Aug 2019 21:48:07 GMTFri, 23 Aug 2019 21:48:07 GMT0x8D7281395D20B6F0application/octet-streamAppendBlobHottrueunlockedavailabletrue0fFri, 23 Aug 2019 21:48:07 GMTFri, 23 Aug 2019 21:48:07 GMT0x8D7281395D763F60application/octet-streamAppendBlobHottrueunlockedavailabletrue0g/", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "ea9c6f11-516d-48ca-8ba0-5d824fff97f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshierdelim&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2a9b7-001e-00f1-69fc-59e1e5000000", + "Body" : "jtclistblobshierdelimjtclistblobshierdelim088404fa6c4994594c4850bcFri, 23 Aug 2019 21:48:07 GMT\"0x8D7281395B6BD5E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "c5072613-b805-4f61-bdfb-d7e5263fe67c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierdelim088404fa6c4994594c4850bc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2a9fa-001e-00f1-27fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "7eff44b0-a641-4195-8510-2eae12b0837f" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierdelim088404fa6c4994594c4850bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiererror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiererror.json new file mode 100644 index 000000000000..c81afdc1f5b8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiererror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiererror072271499b446305854ad9bc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281396BDF5AA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf2aa7-501e-00c0-73fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "fa8a0c42-f104-4f5b-a177-b21d022c682e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiererror152049666630a3244c4cedba?prefix=.&delimiter=/&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2ac4-501e-00c0-0dfc-59ba32000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:77cf2ac4-501e-00c0-0dfc-59ba32000000\nTime:2019-08-23T21:48:09.5106141Z", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "0811c82c-9473-4a9d-b819-2df05b7807e3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshiererror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2ad9-501e-00c0-21fc-59ba32000000", + "Body" : "jtclistblobshiererrorjtclistblobshiererror072271499b446305854ad9bcFri, 23 Aug 2019 21:48:09 GMT\"0x8D7281396BDF5AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "b0d22015-8f54-4da3-af59-734409ca2a1f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiererror072271499b446305854ad9bc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf2b03-501e-00c0-46fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:09 GMT", + "x-ms-client-request-id" : "a7548bfd-48dd-4272-a937-eba42dd64613" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshiererror072271499b446305854ad9bc", "jtclistblobshiererror152049666630a3244c4cedba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiermarker.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiermarker.json new file mode 100644 index 000000000000..ae81b221599a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiermarker.json @@ -0,0 +1,332 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395F86A5C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2aa53-001e-00f1-7bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "040043fe-7a95-437f-958b-479f46225abb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99/javabloblistblobshiermarker176002f17a1827406543d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395FE7D8B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2aab1-001e-00f1-4efc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "cc895c8a-a275-478d-9c2c-26519cdba7f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99/javabloblistblobshiermarker271163be74bdbf25eb4f8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813960535F6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2aaf9-001e-00f1-14fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "e3b375ff-4988-449e-8dd3-0c671563d121" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99/javabloblistblobshiermarker33346306d451508db543b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813960B791C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2ab3b-001e-00f1-52fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "5119714e-ebaf-4122-baaf-5e50b7455de1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99/javabloblistblobshiermarker48818382a7d44c8d9d442", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281396111FCD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2ab70-001e-00f1-04fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "5645137e-d17e-4245-a969-fc41260fa527" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99/javabloblistblobshiermarker50593473aa94cfc64b4a5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139616C674\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2abb3-001e-00f1-43fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "02f9fa41-2cbc-4a0f-b0d3-07ce70297fda" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99/javabloblistblobshiermarker657780127d4f19a859460", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813961C6D25\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2abf3-001e-00f1-03fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "3a1aa909-49b7-4785-8703-c694ce7d8c46" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99/javabloblistblobshiermarker746216a902ad2cf9144bf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813962213E9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2ac36-001e-00f1-40fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "204be3bc-81dd-4456-8d31-014fce980c4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99/javabloblistblobshiermarker897470e44a0dcfc9ee4f0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813962C0159\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2ac77-001e-00f1-7ffc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "6e72a8bf-b19e-4012-bc9e-428f8be36d2b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99/javabloblistblobshiermarker98614831941116941144a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281396355275\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2acdf-001e-00f1-60fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "d60ce9e9-163e-47c6-8d63-0333483a2f0a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99/javabloblistblobshiermarker10846375824e181a81b48", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813963AD20E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2ad15-001e-00f1-15fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "40ab703a-3c2c-447b-b125-624d64f539df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99?delimiter=/&maxresults=6&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2ad4a-001e-00f1-4afc-59e1e5000000", + "Body" : "6/javabloblistblobshiermarker10846375824e181a81b48Fri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813963AD20E512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker176002f17a1827406543dFri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D7281395FE7D8B512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker271163be74bdbf25eb4f8Fri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813960535F6512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker33346306d451508db543bFri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813960B791C512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker48818382a7d44c8d9d442Fri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D7281396111FCD512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker50593473aa94cfc64b4a5Fri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D728139616C674512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY1Nzc4MDEyN2Q0ZjE5YTg1OTQ2MCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "9b183d39-5c47-4c5b-b3d1-44eba0870b90", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99?delimiter=/&marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY1Nzc4MDEyN2Q0ZjE5YTg1OTQ2MCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=6&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf27aa-501e-00c0-30fc-59ba32000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY1Nzc4MDEyN2Q0ZjE5YTg1OTQ2MCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6/javabloblistblobshiermarker657780127d4f19a859460Fri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813961C6D25512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker746216a902ad2cf9144bfFri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813962213E9512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker897470e44a0dcfc9ee4f0Fri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813962C0159512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker98614831941116941144aFri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D7281396355275512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "ec9d9baf-22f8-461a-b65a-d904ac4e219b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99?delimiter=/&marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY1Nzc4MDEyN2Q0ZjE5YTg1OTQ2MCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=6&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2ad9f-001e-00f1-1cfc-59e1e5000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY1Nzc4MDEyN2Q0ZjE5YTg1OTQ2MCEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6/javabloblistblobshiermarker657780127d4f19a859460Fri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813961C6D25512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker746216a902ad2cf9144bfFri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813962213E9512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker897470e44a0dcfc9ee4f0Fri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D72813962C0159512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker98614831941116941144aFri, 23 Aug 2019 21:48:08 GMTFri, 23 Aug 2019 21:48:08 GMT0x8D7281396355275512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:48:07 GMT", + "x-ms-client-request-id" : "a6f7ca07-7cff-4d2c-80c5-00befefd6c15", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshiermarker&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf27e5-501e-00c0-62fc-59ba32000000", + "Body" : "jtclistblobshiermarkerjtclistblobshiermarker02556469d794e2fb4e48a99Fri, 23 Aug 2019 21:48:08 GMT\"0x8D7281395F86A5C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "b9c5e0ca-d356-4a2f-8f40-835cddf35c5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshiermarker02556469d794e2fb4e48a99?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf27fb-501e-00c0-78fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:08 GMT", + "x-ms-client-request-id" : "7fa4cb64-479b-4db5-90c4-d8aaf7469b46" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshiermarker02556469d794e2fb4e48a99", "javabloblistblobshiermarker176002f17a1827406543d", "javabloblistblobshiermarker271163be74bdbf25eb4f8", "javabloblistblobshiermarker33346306d451508db543b", "javabloblistblobshiermarker48818382a7d44c8d9d442", "javabloblistblobshiermarker50593473aa94cfc64b4a5", "javabloblistblobshiermarker657780127d4f19a859460", "javabloblistblobshiermarker746216a902ad2cf9144bf", "javabloblistblobshiermarker897470e44a0dcfc9ee4f0", "javabloblistblobshiermarker98614831941116941144a", "javabloblistblobshiermarker10846375824e181a81b48" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionscopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionscopy.json new file mode 100644 index 000000000000..7e8cec6fa7af --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionscopy.json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136D185FDD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0cd7d-001e-00f1-3efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "c28f9b32-01e9-498a-9501-a6d2f49f730d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7/ajavabloblistblobshieroptionscopy14264503827a2568bd", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136D1D9472\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0cdc3-001e-00f1-7dfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "df0478a2-380d-4ea9-85df-189c196bca76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7/cjavabloblistblobshieroptionscopy2640617ffbc223e834", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "44158179-5bcb-4169-ae3f-671d388044d1", + "ETag" : "\"0x8D728136D4BDBCB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1e0ce00-001e-00f1-34fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:59 GMT", + "x-ms-client-request-id" : "16c106eb-859c-40f1-983a-0dca556d4767" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7/cjavabloblistblobshieroptionscopy2640617ffbc223e834", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:46:59 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1e0d03d-001e-00f1-50fc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "44158179-5bcb-4169-ae3f-671d388044d1", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7/ajavabloblistblobshieroptionscopy14264503827a2568bd", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:46:59 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:46:59 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D728136D4BDBCB\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "06b6ae6f-06ae-41f2-bc8d-d81c0683ac2d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7/mjavabloblistblobshieroptionscopy309537b9fb94894389", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136DED9ADF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0d832-001e-00f1-4bfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:47:00 GMT", + "x-ms-client-request-id" : "ab29b75c-8f8b-491f-b856-7701a3e16b26" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7/ajavabloblistblobshieroptionscopy14264503827a2568bd?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:47:01.0322732Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136D1D9472\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0d865-001e-00f1-7afc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:47:00 GMT", + "x-ms-client-request-id" : "63a57114-ab29-4f1e-803e-f9915167a0f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7/ujavabloblistblobshieroptionscopy4191309fdc447d4a66?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0d8a4-001e-00f1-37fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:47:00 GMT", + "x-ms-client-request-id" : "08087620-b11a-4c7d-a7a6-59b2d39dd706" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7?delimiter=&include=copy&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0d8ec-001e-00f1-7afc-59e1e5000000", + "Body" : "ajavabloblistblobshieroptionscopy14264503827a2568bdFri, 23 Aug 2019 21:46:59 GMTFri, 23 Aug 2019 21:46:59 GMT0x8D728136D1D9472512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobshieroptionscopy2640617ffbc223e834Fri, 23 Aug 2019 21:46:59 GMTFri, 23 Aug 2019 21:46:59 GMT0x8D728136D4BDBCB512application/octet-stream0PageBlobHottrueunlockedavailable44158179-5bcb-4169-ae3f-671d388044d1https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7/ajavabloblistblobshieroptionscopy14264503827a2568bdsuccess512/512Fri, 23 Aug 2019 21:46:59 GMTtrue0mjavabloblistblobshieroptionscopy309537b9fb94894389Fri, 23 Aug 2019 21:47:01 GMTFri, 23 Aug 2019 21:47:00 GMT0x8D728136DED9ADF512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:47:00 GMT", + "x-ms-client-request-id" : "d2d2d663-4ceb-45eb-9830-6882d7d33ade", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshieroptionscopy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0d94b-001e-00f1-52fc-59e1e5000000", + "Body" : "jtclistblobshieroptionscopyjtclistblobshieroptionscopy07023204ee9f409f994a7Fri, 23 Aug 2019 21:46:59 GMT\"0x8D728136D185FDD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:47:00 GMT", + "x-ms-client-request-id" : "82aa317b-4e47-4c56-8cca-cb5ee23e3132", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionscopy07023204ee9f409f994a7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0d986-001e-00f1-08fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:00 GMT", + "x-ms-client-request-id" : "7cc8a0ce-f65a-4c2e-a46e-8fd1566c54bc" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionscopy07023204ee9f409f994a7", "javabloblistblobshieroptionscopy14264503827a2568bd", "javabloblistblobshieroptionscopy2640617ffbc223e834", "javabloblistblobshieroptionscopy309537b9fb94894389", "javabloblistblobshieroptionscopy4191309fdc447d4a66" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsdeleted.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsdeleted.json new file mode 100644 index 000000000000..ca292810f583 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsdeleted.json @@ -0,0 +1,160 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsdeleted0417070d33825053e44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136FD0B0E1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0f137-001e-00f1-34fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:03 GMT", + "x-ms-client-request-id" : "678fc13c-6d5d-47fe-a564-0cf1c037c8f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "b1e0f177-001e-00f1-6dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:03 GMT", + "x-ms-client-request-id" : "b44a4ea4-5f30-4209-bc8e-18e948f33655" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsdeleted0417070d33825053e44/javabloblistblobshieroptionsdeleted153413a2a220983eb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281381C1BC7D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e1c2c5-001e-00f1-52fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:47:33 GMT", + "x-ms-client-request-id" : "2884816c-28b8-45a9-84d4-fc963bfb98a0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsdeleted0417070d33825053e44/javabloblistblobshieroptionsdeleted153413a2a220983eb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "false", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b1e1c30a-001e-00f1-11fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:33 GMT", + "x-ms-client-request-id" : "8302eda5-5f56-4811-95c0-2e763f913931" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsdeleted0417070d33825053e44?delimiter=&include=deleted&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e1c33a-001e-00f1-39fc-59e1e5000000", + "Body" : "javabloblistblobshieroptionsdeleted153413a2a220983ebtrueFri, 23 Aug 2019 21:47:34 GMTFri, 23 Aug 2019 21:47:34 GMT0x8D7281381C1BC7D0application/octet-streamAppendBlobHottruetrueFri, 23 Aug 2019 21:47:34 GMT10", + "Date" : "Fri, 23 Aug 2019 21:47:33 GMT", + "x-ms-client-request-id" : "2f9356cf-506a-4878-bd6d-44ec9335a47f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "b1e1c365-001e-00f1-61fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:33 GMT", + "x-ms-client-request-id" : "4d8e4747-d7f5-45a7-a92f-450136a54267" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshieroptionsdeleted&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e29161-001e-00f1-2efc-59e1e5000000", + "Body" : "jtclistblobshieroptionsdeletedjtclistblobshieroptionsdeleted0417070d33825053e44Fri, 23 Aug 2019 21:47:04 GMT\"0x8D728136FD0B0E1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:03 GMT", + "x-ms-client-request-id" : "f7527a8f-ed76-4b41-981f-1cf9d65ae088", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsdeleted0417070d33825053e44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e29197-001e-00f1-63fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:03 GMT", + "x-ms-client-request-id" : "6f6bf86b-09e8-4b6c-80e9-f834f074d72c" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsdeleted0417070d33825053e44", "javabloblistblobshieroptionsdeleted153413a2a220983eb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[0].json new file mode 100644 index 000000000000..c7518a4c9dc0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsfail096672eb4d857e941f40a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813959411AB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a598-001e-00f1-11fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "e15a64e5-50d7-4c6a-906f-642a05862bcc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshieroptionsfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2a60a-001e-00f1-79fc-59e1e5000000", + "Body" : "jtclistblobshieroptionsfailjtclistblobshieroptionsfail096672eb4d857e941f40aFri, 23 Aug 2019 21:48:07 GMT\"0x8D72813959411AB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "ffec9df4-1405-4a7d-a5f3-1b1a5f10dadf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsfail096672eb4d857e941f40a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2a63d-001e-00f1-28fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "39e2b5b5-b94b-49b9-8078-abb651c220ca" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsfail096672eb4d857e941f40a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[1].json new file mode 100644 index 000000000000..720f264224dc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsfail027448a47d9ad44e7f4ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281395A5F062\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a678-001e-00f1-5ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "1bb46347-3a97-409a-aa20-ff02170b15bb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshieroptionsfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2a6c5-001e-00f1-26fc-59e1e5000000", + "Body" : "jtclistblobshieroptionsfailjtclistblobshieroptionsfail027448a47d9ad44e7f4adFri, 23 Aug 2019 21:48:07 GMT\"0x8D7281395A5F062\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "08b36e40-a897-4588-a098-c120ec576377", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsfail027448a47d9ad44e7f4ad?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2a6ea-001e-00f1-4bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "181eead2-783d-4db7-af12-f8f6f0ca87c2" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsfail027448a47d9ad44e7f4ad" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmaxresults.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmaxresults.json new file mode 100644 index 000000000000..5e87993ac60b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmaxresults.json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0431465702a9d7f620?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281394B253D0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e29b58-001e-00f1-6dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:05 GMT", + "x-ms-client-request-id" : "296aeb8b-e40a-4add-ab84-064e822ffbe6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0431465702a9d7f620/ajavabloblistblobshieroptionsmaxresults1759550138bd387", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281394B83FED\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e29baf-001e-00f1-3ffc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:05 GMT", + "x-ms-client-request-id" : "0b42f5e0-ed17-4876-b72f-c32a65c1ffff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0431465702a9d7f620/cjavabloblistblobshieroptionsmaxresults275357287678519", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "2ebf8cc6-0a67-4282-81c6-1d2fcbcad4c2", + "ETag" : "\"0x8D7281394C9A958\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1e29be2-001e-00f1-6ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:05 GMT", + "x-ms-client-request-id" : "ad9b86ef-7627-4c71-8da8-21e7fd2c3a7e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0431465702a9d7f620/cjavabloblistblobshieroptionsmaxresults275357287678519", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:06 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:48:06 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1e29ca3-001e-00f1-26fc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "2ebf8cc6-0a67-4282-81c6-1d2fcbcad4c2", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0431465702a9d7f620/ajavabloblistblobshieroptionsmaxresults1759550138bd387", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:48:05 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:48:06 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7281394C9A958\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "933419b8-0392-4612-a22e-92cd7e8ae27c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0431465702a9d7f620/mjavabloblistblobshieroptionsmaxresults3682397e63a196b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813956C52DD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a3d1-001e-00f1-68fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "f21cc4ec-da15-4ea2-b613-8f1bf3dbc563" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0431465702a9d7f620/ajavabloblistblobshieroptionsmaxresults1759550138bd387?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:48:07.2938791Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281394B83FED\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a41c-001e-00f1-2efc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "6836b054-f3ec-4bb2-ba52-b1d562d0f9b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0431465702a9d7f620/ujavabloblistblobshieroptionsmaxresults439727d104cf671?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e2a46b-001e-00f1-7afc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "194d395b-5b22-44c7-94aa-285aedd035de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0431465702a9d7f620?delimiter=&maxresults=1&include=copy%2cuncommittedblobs&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2a49a-001e-00f1-25fc-59e1e5000000", + "Body" : "1ajavabloblistblobshieroptionsmaxresults1759550138bd387Fri, 23 Aug 2019 21:48:06 GMTFri, 23 Aug 2019 21:48:06 GMT0x8D7281394B83FED512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2hpZXJvcHRpb25zbWF4cmVzdWx0czI3NTM1NzI4NzY3ODUxOSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "49dc4abd-718f-4662-b9e7-fa02c35d2dd3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshieroptionsmaxresults&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2a4c6-001e-00f1-50fc-59e1e5000000", + "Body" : "jtclistblobshieroptionsmaxresultsjtclistblobshieroptionsmaxresults0431465702a9d7f620Fri, 23 Aug 2019 21:48:06 GMT\"0x8D7281394B253D0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "315afe7f-c2dc-42b3-9cd8-046b2c267b45", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmaxresults0431465702a9d7f620?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e2a503-001e-00f1-0bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:06 GMT", + "x-ms-client-request-id" : "63725ef8-f61a-4942-9ff7-d071ed3158ae" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsmaxresults0431465702a9d7f620", "javabloblistblobshieroptionsmaxresults1759550138bd387", "javabloblistblobshieroptionsmaxresults275357287678519", "javabloblistblobshieroptionsmaxresults3682397e63a196b", "javabloblistblobshieroptionsmaxresults439727d104cf671" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmetadata.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmetadata.json new file mode 100644 index 000000000000..0bbd17636f86 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmetadata.json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02337233868ba1e10d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136E0D3537\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0d9d4-001e-00f1-4ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:00 GMT", + "x-ms-client-request-id" : "7c43942e-4182-4336-84cc-38bb82007d59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02337233868ba1e10d4/ajavabloblistblobshieroptionsmetadata1600597b090b7388", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136E126A0F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0da21-001e-00f1-14fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:47:00 GMT", + "x-ms-client-request-id" : "7bad941b-34ad-4e87-a148-66b35d200642" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02337233868ba1e10d4/cjavabloblistblobshieroptionsmetadata29557184deac49ff", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "53bbb7fd-4800-4a08-b648-c053d832a9bb", + "ETag" : "\"0x8D728136E2EF9B7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1e0da5a-001e-00f1-47fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:00 GMT", + "x-ms-client-request-id" : "b91d7b04-6c6c-465a-a6f2-f293b20459d6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02337233868ba1e10d4/cjavabloblistblobshieroptionsmetadata29557184deac49ff", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:01 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:47:01 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1e0dc06-001e-00f1-58fc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "53bbb7fd-4800-4a08-b648-c053d832a9bb", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02337233868ba1e10d4/ajavabloblistblobshieroptionsmetadata1600597b090b7388", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:47:00 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:47:01 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D728136E2EF9B7\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "d391cca2-f385-4e2c-8ee5-c6bb9ef085bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02337233868ba1e10d4/mjavabloblistblobshieroptionsmetadata3333273ff02684b5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136ED2188B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0e381-001e-00f1-51fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:47:01 GMT", + "x-ms-client-request-id" : "f30860a8-0d7a-4b39-a107-b4fbed40bbb0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02337233868ba1e10d4/ajavabloblistblobshieroptionsmetadata1600597b090b7388?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:47:02.5297105Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136E126A0F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0e3a8-001e-00f1-77fc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:47:01 GMT", + "x-ms-client-request-id" : "5625caf4-2c6c-492a-bd58-afc89b342035" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02337233868ba1e10d4/ujavabloblistblobshieroptionsmetadata4316809c74c128a9?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0e40e-001e-00f1-56fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:47:01 GMT", + "x-ms-client-request-id" : "a0a9610e-d2a0-414d-b166-41bb480fab07" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02337233868ba1e10d4?delimiter=&include=metadata&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0e443-001e-00f1-05fc-59e1e5000000", + "Body" : "ajavabloblistblobshieroptionsmetadata1600597b090b7388Fri, 23 Aug 2019 21:47:01 GMTFri, 23 Aug 2019 21:47:01 GMT0x8D728136E126A0F512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobshieroptionsmetadata29557184deac49ffFri, 23 Aug 2019 21:47:01 GMTFri, 23 Aug 2019 21:47:01 GMT0x8D728136E2EF9B7512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobshieroptionsmetadata3333273ff02684b5Fri, 23 Aug 2019 21:47:02 GMTFri, 23 Aug 2019 21:47:02 GMT0x8D728136ED2188B512application/octet-stream0PageBlobHottrueunlockedavailabletrue0bar", + "Date" : "Fri, 23 Aug 2019 21:47:01 GMT", + "x-ms-client-request-id" : "f1cb5c98-883f-4892-a4d8-54808289f913", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshieroptionsmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0e492-001e-00f1-50fc-59e1e5000000", + "Body" : "jtclistblobshieroptionsmetadatajtclistblobshieroptionsmetadata02337233868ba1e10d4Fri, 23 Aug 2019 21:47:01 GMT\"0x8D728136E0D3537\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:47:01 GMT", + "x-ms-client-request-id" : "b188f932-2888-496e-b92d-8cad6d75c2d0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsmetadata02337233868ba1e10d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0e4bf-001e-00f1-7cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:02 GMT", + "x-ms-client-request-id" : "4a024853-fb2e-4cb1-966f-907f7e35a4dd" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsmetadata02337233868ba1e10d4", "javabloblistblobshieroptionsmetadata1600597b090b7388", "javabloblistblobshieroptionsmetadata29557184deac49ff", "javabloblistblobshieroptionsmetadata3333273ff02684b5", "javabloblistblobshieroptionsmetadata4316809c74c128a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsprefix.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsprefix.json new file mode 100644 index 000000000000..189567f9fe20 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsprefix.json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix0293530d424d340b8148?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281393C744DC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e291db-001e-00f1-1ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:03 GMT", + "x-ms-client-request-id" : "d8a78f89-615d-4464-acac-dea2a14df0a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix0293530d424d340b8148/ajavabloblistblobshieroptionsprefix1090211470ba60617", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281393DFD338\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e292ba-001e-00f1-6cfc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:03 GMT", + "x-ms-client-request-id" : "63bc13fe-0c1c-4cd8-a0b1-8806de4fb0c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix0293530d424d340b8148/cjavabloblistblobshieroptionsprefix2667302265a11a52f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "51b47deb-de21-40af-98cc-29c0d9683616", + "ETag" : "\"0x8D7281393F07921\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1e292f2-001e-00f1-22fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:04 GMT", + "x-ms-client-request-id" : "cc5d0672-0f2e-4293-865b-1c4d4f31a4c6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix0293530d424d340b8148/cjavabloblistblobshieroptionsprefix2667302265a11a52f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:04 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:48:04 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1e2939f-001e-00f1-47fc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "51b47deb-de21-40af-98cc-29c0d9683616", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix0293530d424d340b8148/ajavabloblistblobshieroptionsprefix1090211470ba60617", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:48:04 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:48:04 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7281393F07921\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "a38d4efa-ef10-4e8a-a0a7-ef0a8ca1bcdf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix0293530d424d340b8148/mjavabloblistblobshieroptionsprefix331671e931310bd9e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728139494828A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e299f4-001e-00f1-18fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:05 GMT", + "x-ms-client-request-id" : "872e8c35-2c89-4b0e-a7d1-65c22c70a578" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix0293530d424d340b8148/ajavabloblistblobshieroptionsprefix1090211470ba60617?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:48:05.8805228Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281393DFD338\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e29a3a-001e-00f1-5afc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:48:05 GMT", + "x-ms-client-request-id" : "b9440851-3931-4085-8a82-bd8b6efafd6a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix0293530d424d340b8148/ujavabloblistblobshieroptionsprefix48555429a50acf351?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e29a79-001e-00f1-16fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:48:05 GMT", + "x-ms-client-request-id" : "6c8344ee-9609-40b9-936e-c067c382ac5f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix0293530d424d340b8148?prefix=a&delimiter=&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e29aae-001e-00f1-4afc-59e1e5000000", + "Body" : "aajavabloblistblobshieroptionsprefix1090211470ba60617Fri, 23 Aug 2019 21:48:04 GMTFri, 23 Aug 2019 21:48:04 GMT0x8D7281393DFD338512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:48:05 GMT", + "x-ms-client-request-id" : "95763c5b-cdf0-43b9-b2fd-0c0fa4893b7b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshieroptionsprefix&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e29adf-001e-00f1-78fc-59e1e5000000", + "Body" : "jtclistblobshieroptionsprefixjtclistblobshieroptionsprefix0293530d424d340b8148Fri, 23 Aug 2019 21:48:04 GMT\"0x8D7281393C744DC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:05 GMT", + "x-ms-client-request-id" : "b6ab0ea7-7f05-4a31-b7a5-06501fe22fd1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsprefix0293530d424d340b8148?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e29b0e-001e-00f1-25fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:48:05 GMT", + "x-ms-client-request-id" : "5e1e5a03-7b3d-4208-9607-ee1b5a535e17" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsprefix0293530d424d340b8148", "javabloblistblobshieroptionsprefix1090211470ba60617", "javabloblistblobshieroptionsprefix2667302265a11a52f", "javabloblistblobshieroptionsprefix331671e931310bd9e", "javabloblistblobshieroptionsprefix48555429a50acf351" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsuncommitted.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsuncommitted.json new file mode 100644 index 000000000000..8ae34651f802 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsuncommitted.json @@ -0,0 +1,225 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0982915adddd406f3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136EF499C4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0e515-001e-00f1-4ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:02 GMT", + "x-ms-client-request-id" : "e775e93c-0d2a-4b12-a136-c3936c4c83e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0982915adddd406f3/ajavabloblistblobshieroptionsuncommitted136551df509f2c8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136EF9A770\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0e55e-001e-00f1-14fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:47:02 GMT", + "x-ms-client-request-id" : "a5c8196b-6d57-4388-a90a-681a81e99fc2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0982915adddd406f3/cjavabloblistblobshieroptionsuncommitted283246d5ce0782e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "047ad600-2afd-4e7e-99a7-e1f135ce74a6", + "ETag" : "\"0x8D728136F0EE259\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "b1e0e5a5-001e-00f1-55fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:02 GMT", + "x-ms-client-request-id" : "31cbbb2a-92b6-4ee7-b568-945ba5a196f2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0982915adddd406f3/cjavabloblistblobshieroptionsuncommitted283246d5ce0782e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:02 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:47:02 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "b1e0e6d2-001e-00f1-6dfc-59e1e5000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "047ad600-2afd-4e7e-99a7-e1f135ce74a6", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0982915adddd406f3/ajavabloblistblobshieroptionsuncommitted136551df509f2c8", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:47:02 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:47:02 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D728136F0EE259\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "55e830b6-cbcd-40a2-9075-c9e6e12cbc34" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0982915adddd406f3/mjavabloblistblobshieroptionsuncommitted38586318b315023", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136FB13DA6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0ef80-001e-00f1-11fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:47:03 GMT", + "x-ms-client-request-id" : "3e4a9a30-6f9f-4129-945c-c16d364371cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0982915adddd406f3/ajavabloblistblobshieroptionsuncommitted136551df509f2c8?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:47:03.9911143Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136EF9A770\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:47:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0efbc-001e-00f1-4cfc-59e1e5000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:47:03 GMT", + "x-ms-client-request-id" : "5d8691fa-b00c-485e-b1d8-f2813866926f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0982915adddd406f3/ujavabloblistblobshieroptionsuncommitted4488648425ba6d5?blockid=0000&comp=block", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0eff7-001e-00f1-03fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:47:03 GMT", + "x-ms-client-request-id" : "bb3236e5-83ef-408b-9611-e39087af92e9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0982915adddd406f3?delimiter=&include=uncommittedblobs&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0f027-001e-00f1-32fc-59e1e5000000", + "Body" : "ajavabloblistblobshieroptionsuncommitted136551df509f2c8Fri, 23 Aug 2019 21:47:02 GMTFri, 23 Aug 2019 21:47:02 GMT0x8D728136EF9A770512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobshieroptionsuncommitted283246d5ce0782eFri, 23 Aug 2019 21:47:02 GMTFri, 23 Aug 2019 21:47:02 GMT0x8D728136F0EE259512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobshieroptionsuncommitted38586318b315023Fri, 23 Aug 2019 21:47:03 GMTFri, 23 Aug 2019 21:47:03 GMT0x8D728136FB13DA6512application/octet-stream0PageBlobHottrueunlockedavailabletrue0ujavabloblistblobshieroptionsuncommitted4488648425ba6d50BlockBlobHottrueunlockedavailablefalse0", + "Date" : "Fri, 23 Aug 2019 21:47:03 GMT", + "x-ms-client-request-id" : "65705d21-1a5d-4547-ab3c-62edf1346f2a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshieroptionsuncommitted&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0f09e-001e-00f1-24fc-59e1e5000000", + "Body" : "jtclistblobshieroptionsuncommittedjtclistblobshieroptionsuncommitted0982915adddd406f3Fri, 23 Aug 2019 21:47:02 GMT\"0x8D728136EF499C4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:47:03 GMT", + "x-ms-client-request-id" : "67c247b4-ae21-401c-8bd6-77b9b3fb1bae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshieroptionsuncommitted0982915adddd406f3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0f0dc-001e-00f1-5cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:47:03 GMT", + "x-ms-client-request-id" : "47bb9cd7-f5be-47cf-842f-13b0b32a8ade" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsuncommitted0982915adddd406f3", "javabloblistblobshieroptionsuncommitted136551df509f2c8", "javabloblistblobshieroptionsuncommitted283246d5ce0782e", "javabloblistblobshieroptionsuncommitted38586318b315023", "javabloblistblobshieroptionsuncommitted4488648425ba6d5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierwithtimeoutstillbackedbypagedflux.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierwithtimeoutstillbackedbypagedflux.json new file mode 100644 index 000000000000..cbfcee0b7f61 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierwithtimeoutstillbackedbypagedflux.json @@ -0,0 +1,222 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728136CA29DC5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e0c71b-001e-00f1-55fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "ca6a6ebb-76f8-4696-9255-18b4bc9bb153" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3/javabloblistblobshierwithtimeoutstillbackedbypagedflux1718225", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728136CA7D259\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1e0c75a-001e-00f1-10fc-59e1e5000000", + "x-ms-client-request-id" : "5745f50a-370e-4e26-9756-e709b0ceaf70" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3/javabloblistblobshierwithtimeoutstillbackedbypagedflux2342904", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728136CACB595\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1e0c792-001e-00f1-45fc-59e1e5000000", + "x-ms-client-request-id" : "c6a8d04e-500e-4a23-9d2e-3aae24eebbd1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3/javabloblistblobshierwithtimeoutstillbackedbypagedflux3337752", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728136CB28359\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1e0c7d9-001e-00f1-07fc-59e1e5000000", + "x-ms-client-request-id" : "bfcc3c0e-4f0e-438e-9364-b919b85af9d3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3/javabloblistblobshierwithtimeoutstillbackedbypagedflux4991950", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728136CB78DAD\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1e0c820-001e-00f1-4cfc-59e1e5000000", + "x-ms-client-request-id" : "be0cc716-e3a5-44dc-80ce-c49fce742b18" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3/javabloblistblobshierwithtimeoutstillbackedbypagedflux567592c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:46:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D728136CBD5B75\"", + "Content-Length" : "0", + "x-ms-request-id" : "b1e0c862-001e-00f1-07fc-59e1e5000000", + "x-ms-client-request-id" : "e14c9afb-acc4-4f6b-aa73-b00b171e2433" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3?delimiter=/&maxresults=3&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c89f-001e-00f1-40fc-59e1e5000000", + "Body" : "3/javabloblistblobshierwithtimeoutstillbackedbypagedflux1718225Fri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136CA7D2597application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobshierwithtimeoutstillbackedbypagedflux2342904Fri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136CACB5957application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobshierwithtimeoutstillbackedbypagedflux3337752Fri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136CB283597application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue02!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzaGllcndpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ5OTE5NTAhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "a535d48d-dd26-40e5-93a6-38c795569f99", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3?delimiter=/&marker=2%21140%21MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzaGllcndpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ5OTE5NTAhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh&maxresults=3&include=&restype=container&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c97c-001e-00f1-06fc-59e1e5000000", + "Body" : "2!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzaGllcndpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ5OTE5NTAhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh3/javabloblistblobshierwithtimeoutstillbackedbypagedflux4991950Fri, 23 Aug 2019 21:46:58 GMTFri, 23 Aug 2019 21:46:58 GMT0x8D728136CB78DAD7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobshierwithtimeoutstillbackedbypagedflux567592cFri, 23 Aug 2019 21:46:59 GMTFri, 23 Aug 2019 21:46:59 GMT0x8D728136CBD5B757application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "4fb220cb-0f43-42d6-bd83-1f4ae4df5c42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistblobshierwithtimeoutstillbackedbypagedflux&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c9c3-001e-00f1-49fc-59e1e5000000", + "Body" : "jtclistblobshierwithtimeoutstillbackedbypagedfluxjtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3Fri, 23 Aug 2019 21:46:58 GMT\"0x8D728136CA29DC5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "78095cd5-3df2-4038-947a-7ae99ca698dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e0c9fd-001e-00f1-79fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:46:58 GMT", + "x-ms-client-request-id" : "ccd6338a-30a1-4374-a0d6-cb274a16ded2" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierwithtimeoutstillbackedbypagedflux0262863fa3", "javabloblistblobshierwithtimeoutstillbackedbypagedflux1718225", "javabloblistblobshierwithtimeoutstillbackedbypagedflux2342904", "javabloblistblobshierwithtimeoutstillbackedbypagedflux3337752", "javabloblistblobshierwithtimeoutstillbackedbypagedflux4991950", "javabloblistblobshierwithtimeoutstillbackedbypagedflux567592c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaselease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaselease.json new file mode 100644 index 000000000000..cd96ff9ecfb1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaselease.json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0containerapitestreleaseleasea78886659d16b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A29FF2D3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf75f8-501e-00c0-6afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "b2ac7bc7-a1b3-4c10-a92a-ba05be5d90ab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0containerapitestreleaseleasea78886659d16b?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A29FF2D3\"", + "x-ms-lease-id" : "4b12f086-2b94-4c2e-8b42-4730bf879513", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf761f-501e-00c0-0efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "c17f21ed-2a47-4879-a1b8-f124df1be16b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0containerapitestreleaseleasea78886659d16b?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A29FF2D3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77cf7649-501e-00c0-36fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "30fecae7-468a-4a2c-b4d0-4aec51fde0c2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0containerapitestreleaseleasea78886659d16b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D72813A29FF2D3\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "77cf7668-501e-00c0-53fc-59ba32000000", + "x-ms-client-request-id" : "a34480e1-7361-4b20-a65e-c46e13ad84c7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaselease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf767d-501e-00c0-67fc-59ba32000000", + "Body" : "jtcreleaseleasejtcreleaselease0containerapitestreleaseleasea78886659d16bFri, 23 Aug 2019 21:48:29 GMT\"0x8D72813A29FF2D3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "4598258e-12b2-46e1-b266-4192a3bcf231", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaselease0containerapitestreleaseleasea78886659d16b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7698-501e-00c0-7ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "017cee55-2785-4e17-a509-f8d0a374b9c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaselease0containerapitestreleaseleasea78886659d16b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[0].json new file mode 100644 index 000000000000..3ca47d52be21 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[0].json @@ -0,0 +1,103 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseaca1f24695136?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2DC6E55\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7748-501e-00c0-1dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "d2aff165-fdf6-46d8-a53f-b106bec7ff35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseaca1f24695136?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2DC6E55\"", + "x-ms-lease-id" : "cb83fdf8-1e98-46d2-8a37-292bdce14fef", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7765-501e-00c0-35fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "42a049b3-b631-4a84-9c36-801630fde4b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseaca1f24695136?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2DC6E55\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77cf777f-501e-00c0-4bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "1af0ea14-31ce-406e-bc63-1daece46d8b5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf779b-501e-00c0-60fc-59ba32000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0containerapitestreleaseleaseaca1f24695136Fri, 23 Aug 2019 21:48:29 GMT\"0x8D72813A2DC6E55\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "833f43be-4665-419d-a7ba-ba2308fe7db8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseaca1f24695136?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf77c0-501e-00c0-01fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "18b0c265-2c20-42c0-a838-40dadec5b142" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0containerapitestreleaseleaseaca1f24695136" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[1].json new file mode 100644 index 000000000000..50c14b2b91cd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[1].json @@ -0,0 +1,103 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacd7b46987e59?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2F6DA91\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf77ec-501e-00c0-2afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "a8370853-03cb-4a7b-95ee-8193b0d702ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacd7b46987e59?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2F6DA91\"", + "x-ms-lease-id" : "68fa42a3-0ead-4ebb-a8cf-5c99ce735c01", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7807-501e-00c0-43fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "1c738e8e-db17-4c16-a679-92dd6beaca4d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacd7b46987e59?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2F6DA91\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77cf781b-501e-00c0-55fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "48457e38-a316-45b4-a58f-01627372a57d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7838-501e-00c0-6efc-59ba32000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0containerapitestreleaseleaseacd7b46987e59Fri, 23 Aug 2019 21:48:29 GMT\"0x8D72813A2F6DA91\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "6e29fa2d-5431-44d8-9769-c5faffd1da3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacd7b46987e59?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf786b-501e-00c0-15fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "7529261a-f74c-4219-8e35-54fe58338653" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0containerapitestreleaseleaseacd7b46987e59" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[2].json new file mode 100644 index 000000000000..e406a4c10946 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[2].json @@ -0,0 +1,103 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac7d130018558?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A30F2375\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7897-501e-00c0-3cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "65c88493-7021-49fc-ac41-b711b9a26e38" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac7d130018558?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A30F2375\"", + "x-ms-lease-id" : "3ccf99ad-d9cf-40f6-98b5-4d1c518e2214", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf78c0-501e-00c0-62fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "13d81486-485c-4f31-b480-bf3d537cbeb1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac7d130018558?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A30F2375\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77cf78e3-501e-00c0-03fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "06e5da06-28bf-4b6a-9d11-c80e547d570f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7901-501e-00c0-1efc-59ba32000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0containerapitestreleaseleaseac7d130018558Fri, 23 Aug 2019 21:48:30 GMT\"0x8D72813A30F2375\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "92a8a17e-2621-4546-8925-fcd093f8bf8f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac7d130018558?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf791e-501e-00c0-39fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "df35eaf6-902e-4c50-a075-da2babe3cba2" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0containerapitestreleaseleaseac7d130018558" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[0].json new file mode 100644 index 000000000000..5db1504812ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[0].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0699152c8a095dfa514826b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A3276C54\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7954-501e-00c0-6bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "613a5bfc-b189-4871-9425-6a2fc838b724" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0699152c8a095dfa514826b5?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A3276C54\"", + "x-ms-lease-id" : "0f4da558-993b-444d-85d9-3f2f477b34d0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf797b-501e-00c0-0efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "6232432b-e77a-4137-bc5c-f7da5f145f43" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0699152c8a095dfa514826b5?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77cf79a2-501e-00c0-33fc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77cf79a2-501e-00c0-33fc-59ba32000000\nTime:2019-08-23T21:48:30.3614638Z", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "eb7abe7a-6695-4989-8bcc-9599b2749c58", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf79cc-501e-00c0-5bfc-59ba32000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0699152c8a095dfa514826b5Fri, 23 Aug 2019 21:48:30 GMT\"0x8D72813A3276C54\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "636f0bf8-8a40-456d-a2d6-e1ef1ad97bec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0699152c8a095dfa514826b5?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A3276C54\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf79e3-501e-00c0-72fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "f39efee4-1e2f-4567-b0c6-3b070034274f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0699152c8a095dfa514826b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf79ff-501e-00c0-0bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "f1957e6e-b8c7-41b1-9973-3f3f9c4eb7b8" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0699152c8a095dfa514826b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[1].json new file mode 100644 index 000000000000..b2b5ca290c4a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[1].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0249247b6afd26a8024b26ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A343D4DA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7a1f-501e-00c0-2afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "89ac3435-04be-4a99-894e-7aaf3371bdb1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0249247b6afd26a8024b26ab?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A343D4DA\"", + "x-ms-lease-id" : "b8193e4f-8899-498c-9577-6f87c2c4e646", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7a40-501e-00c0-45fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "c9e58785-8910-4785-a71d-c6fd03d81182" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0249247b6afd26a8024b26ab?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77cf7a5e-501e-00c0-5ffc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77cf7a5e-501e-00c0-5ffc-59ba32000000\nTime:2019-08-23T21:48:30.5476417Z", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "8c0d81e1-e775-45e0-a96e-7f963d1e3eab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7a7b-501e-00c0-79fc-59ba32000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0249247b6afd26a8024b26abFri, 23 Aug 2019 21:48:30 GMT\"0x8D72813A343D4DA\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "9f9a3d73-4a44-4f14-b342-f66624fe6861", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0249247b6afd26a8024b26ab?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A343D4DA\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf7a9b-501e-00c0-13fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "8cd7d47b-187c-4495-85c8-0a71d40cad13" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacfail0249247b6afd26a8024b26ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7abf-501e-00c0-35fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "38bab6ad-c2f6-40b7-ba82-99acdd078f70" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0249247b6afd26a8024b26ab" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[0].json new file mode 100644 index 000000000000..54ca860befdc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacillegal0283137708c37a0427410b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A360164E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7af2-501e-00c0-66fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "0ff5c80f-7e3b-4d66-bc2e-a49ad9af2465" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7b13-501e-00c0-05fc-59ba32000000", + "Body" : "jtcreleaseleaseacillegaljtcreleaseleaseacillegal0283137708c37a0427410bFri, 23 Aug 2019 21:48:30 GMT\"0x8D72813A360164E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "7eefeaff-f19f-4dda-a15f-78d50b141ece", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacillegal0283137708c37a0427410b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7b37-501e-00c0-25fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "efc2a3af-20ef-4a4f-aed5-6af85c1e75af" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacillegal0283137708c37a0427410b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[1].json new file mode 100644 index 000000000000..b067e3eedb94 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacillegal090262afe7d560ea804f29?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A36F8359\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7b6b-501e-00c0-57fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "7ec104ea-27d1-4489-a420-eb1618e83e26" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7bdb-501e-00c0-38fc-59ba32000000", + "Body" : "jtcreleaseleaseacillegaljtcreleaseleaseacillegal090262afe7d560ea804f29Fri, 23 Aug 2019 21:48:30 GMT\"0x8D72813A36F8359\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "38ecd3eb-17a9-4ff0-aca8-00e195807076", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseacillegal090262afe7d560ea804f29?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7bf8-501e-00c0-50fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "34c1b054-95f8-421f-8b80-61bbfb4da221" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacillegal090262afe7d560ea804f29" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseerror.json new file mode 100644 index 000000000000..67a07938293d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseerror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0containerapitestreleaseleaseerror99605716?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A38A8BFD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7c24-501e-00c0-76fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "79cd8ed2-4cb7-4a1d-952b-3dc146405c9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror1containerapitestreleaseleaseerror99677272?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "77cf7c56-501e-00c0-25fc-59ba32000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:77cf7c56-501e-00c0-25fc-59ba32000000\nTime:2019-08-23T21:48:31.0140833Zx-ms-lease-idid", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "489a95b6-cb51-459a-874d-f8c0ce798132", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleaseerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7c6b-501e-00c0-39fc-59ba32000000", + "Body" : "jtcreleaseleaseerrorjtcreleaseleaseerror0containerapitestreleaseleaseerror99605716Fri, 23 Aug 2019 21:48:30 GMT\"0x8D72813A38A8BFD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "563ccee2-3b94-4dd9-8cd6-d03f8fa606d4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleaseerror0containerapitestreleaseleaseerror99605716?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7c82-501e-00c0-4dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:30 GMT", + "x-ms-client-request-id" : "c9a54926-1b87-4a8b-a819-34c972c8b061" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseerror0containerapitestreleaseleaseerror99605716", "jtcreleaseleaseerror1containerapitestreleaseleaseerror99677272" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleasemin.json new file mode 100644 index 000000000000..e2e6dfc1a615 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleasemin.json @@ -0,0 +1,103 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemin83c03027bb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2C29E76\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf76cc-501e-00c0-2efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "1f6dc666-c0e4-4176-975d-c14011c03f4d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemin83c03027bb?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2C29E76\"", + "x-ms-lease-id" : "65b6031d-c2cc-4a4c-8560-ca663a961bb4", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf76df-501e-00c0-3ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "69cb78af-8332-4136-85a4-f24801a372d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemin83c03027bb?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2C29E76\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77cf76f3-501e-00c0-52fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "1eb67863-77ae-4954-b819-05d2d7bdcfab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreleaseleasemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7701-501e-00c0-5ffc-59ba32000000", + "Body" : "jtcreleaseleaseminjtcreleaseleasemin0containerapitestreleaseleasemin83c03027bbFri, 23 Aug 2019 21:48:29 GMT\"0x8D72813A2C29E76\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "abdd9708-ac3d-4ca4-883f-9264907b603d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemin83c03027bb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7717-501e-00c0-72fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:29 GMT", + "x-ms-client-request-id" : "8fbdb0fe-a6fb-4fd6-af1b-652797befcab" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleasemin0containerapitestreleaseleasemin83c03027bb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewlease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewlease.json new file mode 100644 index 000000000000..3c2c620fa370 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewlease.json @@ -0,0 +1,152 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasefc3996081600b77?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813980BFCD2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf3306-501e-00c0-80fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:11 GMT", + "x-ms-client-request-id" : "2bccbe18-cd2b-489b-8467-c3ab7aa1e309" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasefc3996081600b77?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813980BFCD2\"", + "x-ms-lease-id" : "5f329197-986e-46f2-8460-7b2e1d081998", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf331d-501e-00c0-14fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:11 GMT", + "x-ms-client-request-id" : "4c4426be-bff5-415b-aceb-043ad5e57dae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasefc3996081600b77?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813980BFCD2\"", + "x-ms-lease-id" : "5f329197-986e-46f2-8460-7b2e1d081998", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77cf6f1a-501e-00c0-45fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "815f2cb2-afcc-4bb9-a488-0c7b8f6de302" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasefc3996081600b77?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "leased", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D72813980BFCD2\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "77cf6f44-501e-00c0-6bfc-59ba32000000", + "x-ms-client-request-id" : "7985d51f-3412-4afc-9f25-4dc914144e45" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewlease&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf6f54-501e-00c0-7afc-59ba32000000", + "Body" : "jtcrenewleasejtcrenewlease0containerapitestrenewleasefc3996081600b77Fri, 23 Aug 2019 21:48:11 GMT\"0x8D72813980BFCD2\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "aa4afa6c-1827-481a-820f-c22e072c801f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasefc3996081600b77?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813980BFCD2\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf6f6c-501e-00c0-10fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "1965b528-d74c-42f0-8b4b-2fb5d908f7f3" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewlease0containerapitestrenewleasefc3996081600b77?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf6f8b-501e-00c0-2bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "d4d9985c-9790-4bac-8549-dedd4dae9fd8" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewlease0containerapitestrenewleasefc3996081600b77" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[0].json new file mode 100644 index 000000000000..16b2811172c1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[0].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseacc6e09479e40a7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1D32217\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf706b-501e-00c0-75fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "fdc93f14-e87f-46ce-97f8-1548c7e55f5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseacc6e09479e40a7?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1D32217\"", + "x-ms-lease-id" : "e9cdf0bc-5c6f-4222-bdec-15b1dab9fa87", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf70a6-501e-00c0-26fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "93701092-b7f5-4d99-8408-ea96f2cfb2e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseacc6e09479e40a7?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1D32217\"", + "x-ms-lease-id" : "e9cdf0bc-5c6f-4222-bdec-15b1dab9fa87", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77cf70c4-501e-00c0-40fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "b19d0761-670b-4cfa-aab4-1cccda9b2cc8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf70ea-501e-00c0-5ffc-59ba32000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0containerapitestrenewleaseacc6e09479e40a7Fri, 23 Aug 2019 21:48:28 GMT\"0x8D72813A1D32217\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "b70265cd-b549-4537-87ae-3479fa452f6b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseacc6e09479e40a7?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1D32217\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf70fc-501e-00c0-71fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "a80efb37-c50d-4c72-babc-a987dd5152c1" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseacc6e09479e40a7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7120-501e-00c0-13fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "ae7e5656-9cb3-44ca-ba8b-aeabcc160dfc" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0containerapitestrenewleaseacc6e09479e40a7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[1].json new file mode 100644 index 000000000000..8a5c488821be --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[1].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseac1e728798b8bac?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1F41F8D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7146-501e-00c0-37fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "acbfe4f6-9fb6-4776-a1b7-3e8499b47242" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseac1e728798b8bac?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1F41F8D\"", + "x-ms-lease-id" : "1e172d5c-0412-4428-8849-60b62b3652a4", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7162-501e-00c0-4cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "4840f068-9ba3-4b00-9fbf-87ec94bc6dfc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseac1e728798b8bac?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1F41F8D\"", + "x-ms-lease-id" : "1e172d5c-0412-4428-8849-60b62b3652a4", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77cf717e-501e-00c0-67fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "b2a67ebd-f657-4917-9c85-2a75ebcb037c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7194-501e-00c0-7dfc-59ba32000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0containerapitestrenewleaseac1e728798b8bacFri, 23 Aug 2019 21:48:28 GMT\"0x8D72813A1F41F8D\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "8a9ed93a-5005-4c05-82af-3c27b35f58a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseac1e728798b8bac?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1F41F8D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf71a7-501e-00c0-0ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "5fb5c3e9-9de0-4bc2-8f89-74d9bcee1a49" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseac1e728798b8bac?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf71c6-501e-00c0-2cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "f8d8de92-d2a1-45ab-9cbe-f54f0801483a" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0containerapitestrenewleaseac1e728798b8bac" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[2].json new file mode 100644 index 000000000000..9972e9c24b79 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[2].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaced764975ec699?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2136F03\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf71ef-501e-00c0-51fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "42af1a9b-ed44-40fa-97f4-7306bcbafd65" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaced764975ec699?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2136F03\"", + "x-ms-lease-id" : "062ac0ae-75fd-4383-845d-b42352a48137", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7218-501e-00c0-71fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "a4e1e360-6e91-4ae1-9eff-4aab01b00d7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaced764975ec699?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2136F03\"", + "x-ms-lease-id" : "062ac0ae-75fd-4383-845d-b42352a48137", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77cf7241-501e-00c0-15fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "c14fe82c-e26d-4743-be46-284ecda6a373" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf725b-501e-00c0-2cfc-59ba32000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0containerapitestrenewleaseaced764975ec699Fri, 23 Aug 2019 21:48:28 GMT\"0x8D72813A2136F03\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "5cf719dc-3970-4ef7-abfb-a305658a593b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaced764975ec699?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A2136F03\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf727d-501e-00c0-4dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "34525041-907e-4bea-a64c-53fa62f724f6" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseaced764975ec699?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf72a0-501e-00c0-6cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "16b5de1d-cbe4-4e59-aaaf-d034acc5b07a" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0containerapitestrenewleaseaced764975ec699" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[0].json new file mode 100644 index 000000000000..c5a4a61893bd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[0].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail8ab463561?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A231377F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf72cb-501e-00c0-12fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "b56a63f6-8709-4c78-aff3-fa0ea614fb11" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail8ab463561?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A231377F\"", + "x-ms-lease-id" : "999a45cf-7947-4cf6-87ac-67d0e309c100", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf72fd-501e-00c0-3bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "6dda960b-8b1a-43a4-8ae4-dcd3f6da4e7b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail8ab463561?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77cf7319-501e-00c0-55fc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77cf7319-501e-00c0-55fc-59ba32000000\nTime:2019-08-23T21:48:28.7439228Z", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "fba6258d-72b4-4923-b178-3b0fb20f47cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7335-501e-00c0-6ffc-59ba32000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0containerapitestrenewleaseacfail8ab463561Fri, 23 Aug 2019 21:48:28 GMT\"0x8D72813A231377F\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "da237e58-b4b7-4e15-98fc-3cc2b497faba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail8ab463561?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A231377F\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf7358-501e-00c0-10fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "b75609da-32ba-44e5-b434-93ce94abcab7" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail8ab463561?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7375-501e-00c0-29fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "78277e76-9209-4cef-83f8-577d52e1cfca" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0containerapitestrenewleaseacfail8ab463561" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[1].json new file mode 100644 index 000000000000..1f79554c3385 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[1].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail14e68835c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A24EFFED\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf73a4-501e-00c0-54fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "9e365fbb-c2e1-46ff-8e6e-d52cb5ee7200" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail14e68835c?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A24EFFED\"", + "x-ms-lease-id" : "838f06d0-7491-4471-8303-1fe1b736615e", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf73ce-501e-00c0-78fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "ee7e8595-f1c6-4386-8840-5ecbe7c08998" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail14e68835c?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77cf73f0-501e-00c0-18fc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77cf73f0-501e-00c0-18fc-59ba32000000\nTime:2019-08-23T21:48:28.9451143Z", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "e180c5f3-6636-4b77-a0ad-ac1180ea9a2a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7411-501e-00c0-30fc-59ba32000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0containerapitestrenewleaseacfail14e68835cFri, 23 Aug 2019 21:48:28 GMT\"0x8D72813A24EFFED\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "2d025f38-1f03-4483-a589-c847b19216d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail14e68835c?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A24EFFED\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf7435-501e-00c0-52fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "f9985c97-e608-45cd-98fb-61be0bbcc560" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail14e68835c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7453-501e-00c0-6efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "faf93c84-5cb1-4821-9dcd-c34a36341bbb" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0containerapitestrenewleaseacfail14e68835c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[0].json new file mode 100644 index 000000000000..84664d3ec82f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacillegal067277df5407f3b7984cc89?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A26C04E6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7487-501e-00c0-1efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "0bb43987-af57-4ac6-b4d6-f3451a0e6704" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf74be-501e-00c0-4dfc-59ba32000000", + "Body" : "jtcrenewleaseacillegaljtcrenewleaseacillegal067277df5407f3b7984cc89Fri, 23 Aug 2019 21:48:29 GMT\"0x8D72813A26C04E6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "16e3f658-1e06-45c1-ad22-a31c2fee85b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacillegal067277df5407f3b7984cc89?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf74e7-501e-00c0-71fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "4ac0752f-4b87-4705-a001-9c1e17c0ab6f" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacillegal067277df5407f3b7984cc89" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[1].json new file mode 100644 index 000000000000..e35b8e9a6ad3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacillegal0620001149d1cfe46044d39?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A27C0E5E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf751b-501e-00c0-20fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "08a82930-ca2b-4b2b-9169-e1530a5c127f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf753a-501e-00c0-3afc-59ba32000000", + "Body" : "jtcrenewleaseacillegaljtcrenewleaseacillegal0620001149d1cfe46044d39Fri, 23 Aug 2019 21:48:29 GMT\"0x8D72813A27C0E5E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "16fd0882-a2bf-47ce-881a-0b543b42922f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseacillegal0620001149d1cfe46044d39?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf755a-501e-00c0-56fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "d88f7d41-701a-459c-a897-9fb2a3f6aa5e" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacillegal0620001149d1cfe46044d39" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseerror.json new file mode 100644 index 000000000000..8d5a89e6bc15 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseerror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0containerapitestrenewleaseerrora5c93069fa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A28B5458\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf7579-501e-00c0-75fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "5b89ea24-c810-4eeb-a4d6-5491bc1fb36a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror1containerapitestrenewleaseerrora5c730625f?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "77cf759a-501e-00c0-13fc-59ba32000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:77cf759a-501e-00c0-13fc-59ba32000000\nTime:2019-08-23T21:48:29.3034554Zx-ms-lease-idid", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "c003b102-648b-4bee-9bf1-f982ec09b07f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleaseerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf75b2-501e-00c0-2afc-59ba32000000", + "Body" : "jtcrenewleaseerrorjtcrenewleaseerror0containerapitestrenewleaseerrora5c93069faFri, 23 Aug 2019 21:48:29 GMT\"0x8D72813A28B5458\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "94a05c37-5fc5-4b9a-aae6-a4ef328962b7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleaseerror0containerapitestrenewleaseerrora5c93069fa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf75cb-501e-00c0-41fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:28 GMT", + "x-ms-client-request-id" : "81be4299-76bd-4f07-8e62-2232489cb448" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseerror0containerapitestrenewleaseerrora5c93069fa", "jtcrenewleaseerror1containerapitestrenewleaseerrora5c730625f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleasemin.json new file mode 100644 index 000000000000..65ca98942442 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleasemin.json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleasemin83f37687007d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1B6925F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf6fb2-501e-00c0-4efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "c83fa84f-ed13-4e72-b82c-a84dd81e7f59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleasemin83f37687007d?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1B6925F\"", + "x-ms-lease-id" : "cd4d1a3d-da65-462a-8c6b-5cc74618ad10", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77cf6fd4-501e-00c0-6cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "e56da6ef-4d9b-478a-b819-c3a727c6d666" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleasemin83f37687007d?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1B6925F\"", + "x-ms-lease-id" : "cd4d1a3d-da65-462a-8c6b-5cc74618ad10", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77cf6fec-501e-00c0-01fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "e457466d-776b-4bed-a2c7-c8765a3e0565" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrenewleasemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7003-501e-00c0-16fc-59ba32000000", + "Body" : "jtcrenewleaseminjtcrenewleasemin0containerapitestrenewleasemin83f37687007dFri, 23 Aug 2019 21:48:27 GMT\"0x8D72813A1B6925F\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "71189484-ba46-4d84-beba-9a182feffdce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleasemin83f37687007d?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813A1B6925F\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:48:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77cf701d-501e-00c0-2ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "6e485fc3-3f25-47cc-a6ed-f495cda4c29f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleasemin83f37687007d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77cf7038-501e-00c0-49fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:48:27 GMT", + "x-ms-client-request-id" : "0b91a8a5-fb22-4091-bb7b-7b9353f7c598" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleasemin0containerapitestrenewleasemin83f37687007d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicit.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicit.json new file mode 100644 index 000000000000..45514babc124 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicit.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrootexplicit0containerapitestrootexplicit3c409192fbf56?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BB5F04E0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d010f3-501e-00c0-7ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "344f342a-bd59-4f33-8517-945513b592af" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/$root?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:31:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D72811318929AD\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "77d01115-501e-00c0-1cfc-59ba32000000", + "x-ms-client-request-id" : "8ab8246e-afb8-4efb-978b-aca5ae394ba1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/$root/rootblob", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BB68A006\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0113c-501e-00c0-41fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "759b3e0b-a74f-41f5-8a6e-0e8cb0e4049c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrootexplicit&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0115e-501e-00c0-5ffc-59ba32000000", + "Body" : "jtcrootexplicitjtcrootexplicit0containerapitestrootexplicit3c409192fbf56Fri, 23 Aug 2019 21:49:10 GMT\"0x8D72813BB5F04E0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "4e84980d-3dfc-4081-ad31-3cfeba654617", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrootexplicit0containerapitestrootexplicit3c409192fbf56?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01180-501e-00c0-7cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "d32ee6f2-34cb-4c48-b2e1-9780e9af8241" + }, + "Exception" : null + } ], + "variables" : [ "jtcrootexplicit0containerapitestrootexplicit3c409192fbf56" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicitinendpoint.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicitinendpoint.json new file mode 100644 index 000000000000..0abdbdc96da7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicitinendpoint.json @@ -0,0 +1,140 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrootexplicitinendpoint020629af78a6206e994546?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BB813B43\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d011f3-501e-00c0-65fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "639759d0-eb64-4c7a-b6ac-6aa3e35cf873" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/$root?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:31:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D72811318929AD\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "77d01221-501e-00c0-0dfc-59ba32000000", + "x-ms-client-request-id" : "5d6686c9-34ea-468c-9419-1cd0a1f690c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://azstoragesdkaccount.blob.core.windows.net/$root/rootblob", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BB998007\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ff8d3249-c01e-00e7-27fc-59207b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "fddbd1b8-c058-47fc-9433-a83697783067" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "http://azstoragesdkaccount.blob.core.windows.net/$root/rootblob", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813BB998007\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:31:00 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "ff8d3277-c01e-00e7-44fc-59207b000000", + "x-ms-client-request-id" : "65d3dfb5-2751-49e6-a4b4-7be55a90e51c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrootexplicitinendpoint&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d012f7-501e-00c0-33fc-59ba32000000", + "Body" : "jtcrootexplicitinendpointjtcrootexplicitinendpoint020629af78a6206e994546Fri, 23 Aug 2019 21:49:11 GMT\"0x8D72813BB813B43\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "6f130bd9-f822-4d0a-9feb-373f7304f780", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrootexplicitinendpoint020629af78a6206e994546?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0132e-501e-00c0-60fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "a4f5b500-9cf7-4ef6-b4d8-ea333993dfbe" + }, + "Exception" : null + } ], + "variables" : [ "jtcrootexplicitinendpoint020629af78a6206e994546" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[0].json new file mode 100644 index 000000000000..bdbbf6229e37 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[0].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyee308392bb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F4E26D7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb8e3-001e-00f1-1ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "71a658e6-4716-4bd1-9146-956eddbdaad6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyee308392bb?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F533115\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1deb934-001e-00f1-6cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "d8ca0c2b-25a8-4822-8754-f80b7a8e89b2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyee308392bb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133F533115\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "blob", + "x-ms-request-id" : "b1deb95b-001e-00f1-13fc-59e1e5000000", + "x-ms-client-request-id" : "6e75e3d8-beeb-4fe2-9412-d3a5005c500a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb99c-001e-00f1-49fc-59e1e5000000", + "Body" : "jtcsetaccesspolicyjtcsetaccesspolicy0containerapitestsetaccesspolicyee308392bbFri, 23 Aug 2019 21:45:42 GMT\"0x8D728133F533115\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "a61511dc-a344-457c-af89-4aefef083400", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyee308392bb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb9ca-001e-00f1-75fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "02888d44-a21f-4495-9721-b3d73b8921b1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicy0containerapitestsetaccesspolicyee308392bb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[1].json new file mode 100644 index 000000000000..78a057cf3926 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[1].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicye796725781?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F66BDF8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deba31-001e-00f1-52fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "ab2a8c75-9bf2-4981-a693-924fa2e8e2e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicye796725781?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F6B79D2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1deba70-001e-00f1-0dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "abce39c3-632f-458f-ba51-e3c57f0a86a8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicye796725781?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133F6B79D2\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "container", + "x-ms-request-id" : "b1debaa7-001e-00f1-3efc-59e1e5000000", + "x-ms-client-request-id" : "c98f550f-ef66-4c2e-9a76-79d61c72d134" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1debad7-001e-00f1-6bfc-59e1e5000000", + "Body" : "jtcsetaccesspolicyjtcsetaccesspolicy0containerapitestsetaccesspolicye796725781Fri, 23 Aug 2019 21:45:42 GMT\"0x8D728133F6B79D2\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "ab048042-8298-4529-828b-518e5509bebf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicye796725781?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1debb02-001e-00f1-13fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "8192b5c6-ecc9-42f9-aaf6-97c1b09acbad" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicy0containerapitestsetaccesspolicye796725781" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[2].json new file mode 100644 index 000000000000..34a94ebc1036 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyaa1545892e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F7E6A77\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1debb6b-001e-00f1-6efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "dad32142-847c-4cc4-94bd-8e806b4a9833" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyaa1545892e?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F834D58\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1debba9-001e-00f1-24fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "5e672fb8-0c5c-4090-8f8e-ad288369a94d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyaa1545892e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133F834D58\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "b1debbd3-001e-00f1-4afc-59e1e5000000", + "x-ms-client-request-id" : "2c22d212-e06b-418a-bb2c-66b04b1c9d7d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1debc08-001e-00f1-76fc-59e1e5000000", + "Body" : "jtcsetaccesspolicyjtcsetaccesspolicy0containerapitestsetaccesspolicyaa1545892eFri, 23 Aug 2019 21:45:43 GMT\"0x8D728133F834D58\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "1354af78-df0b-4caa-9fa7-900f64e47e79", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicyaa1545892e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1debc34-001e-00f1-20fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "388ecc48-6bf9-4e50-a6ef-34cabd2e271f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicy0containerapitestsetaccesspolicyaa1545892e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[0].json new file mode 100644 index 000000000000..28c2143fcac1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[0].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac83312169?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133FEE85E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec040-001e-00f1-63fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "626eb4b5-384f-4f4b-967f-940654655549" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac83312169?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133FFEB55B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1dec0f2-001e-00f1-0bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "fb8332da-adc4-427d-be85-25b669405f1d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec116-001e-00f1-2dfc-59e1e5000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyac83312169Fri, 23 Aug 2019 21:45:43 GMT\"0x8D728133FFEB55B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "54698292-b51c-492e-b6e7-33c7fec33ed9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac83312169?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec140-001e-00f1-53fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "b9750e8f-5cd3-4300-8bc9-241f9bbd18c9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyac83312169" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[1].json new file mode 100644 index 000000000000..153640c1f1f3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[1].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac22961009?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813400CC3B5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec176-001e-00f1-09fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "701f4355-18c1-402d-9da7-21d7e0a9378c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac22961009?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340117E86\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1dec19e-001e-00f1-2dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "8933a213-20e8-436c-8e90-60fc429a0fd3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec1de-001e-00f1-67fc-59e1e5000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyac22961009Fri, 23 Aug 2019 21:45:44 GMT\"0x8D7281340117E86\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "989a80e8-c810-4b53-9ed1-3ef682d36769", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac22961009?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec21b-001e-00f1-1ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "4a24fb66-8fdc-4b0e-90dd-88ac3a4ebf85" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyac22961009" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[2].json new file mode 100644 index 000000000000..1ae2ee64ab20 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[2].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacfbb56548?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728134020295E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec274-001e-00f1-6ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "9ac3854e-ef60-44c5-a598-813f9393c26c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacfbb56548?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340250B32\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1dec2ac-001e-00f1-24fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "97dbe973-ea6a-44cd-8ce9-5e70457c8cab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec2de-001e-00f1-53fc-59e1e5000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyacfbb56548Fri, 23 Aug 2019 21:45:44 GMT\"0x8D7281340250B32\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "1cc4bb48-8ac1-4f7a-8b28-f205f1cd0dba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacfbb56548?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec313-001e-00f1-06fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "3f383bbb-7713-46af-932b-9c3b74db9a8a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyacfbb56548" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[3].json new file mode 100644 index 000000000000..eec0498a6a85 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[3].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacb6e63726?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813403367F8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec354-001e-00f1-44fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "e6d205d5-d9dd-4457-a8e4-fdda033dc741" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacb6e63726?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813403367F8\"", + "x-ms-lease-id" : "c6440692-d0fd-40bb-8ce3-8c3a851e0eba", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec38d-001e-00f1-79fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "979b99fe-3afa-4ae5-860f-96120a282e7e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacb6e63726?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813403EB3E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1dec3e7-001e-00f1-4cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "f601ccb9-c88a-47c7-8a71-0d867d5df2ca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec431-001e-00f1-0afc-59e1e5000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyacb6e63726Fri, 23 Aug 2019 21:45:44 GMT\"0x8D72813403EB3E3\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "f5c754c7-19fb-49fd-83e6-77fa638b1c6a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacb6e63726?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813403EB3E3\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b1dec472-001e-00f1-48fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "29be5cc1-95c5-48d4-b0d1-ab2abec9cccc" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacb6e63726?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec4b2-001e-00f1-03fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "8d729496-212c-46c9-a6dc-80efeb5fd7e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyacb6e63726" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[0].json new file mode 100644 index 000000000000..86a02be11867 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[0].json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail0361600eb10e9dc3ef4567?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728134051579D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec515-001e-00f1-61fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "1b8605c8-5dea-479c-986c-4e7051769c4d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail0361600eb10e9dc3ef4567?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "b1dec571-001e-00f1-35fc-59e1e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b1dec571-001e-00f1-35fc-59e1e5000000\nTime:2019-08-23T21:45:44.5187248Z", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "b8c69a97-5535-47c2-bbd0-aa67cfc83cab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec5a5-001e-00f1-61fc-59e1e5000000", + "Body" : "jtcsetaccesspolicyacfailjtcsetaccesspolicyacfail0361600eb10e9dc3ef4567Fri, 23 Aug 2019 21:45:44 GMT\"0x8D728134051579D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "3bda3ff4-2716-4d29-8981-0c2bf6f405a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail0361600eb10e9dc3ef4567?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec5cc-001e-00f1-08fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "a87ed542-7e86-41e3-92db-25467bf5dc63" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacfail0361600eb10e9dc3ef4567" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[1].json new file mode 100644 index 000000000000..8b0bfcdc78ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[1].json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail01102858044ed408ca4add?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813406559B5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec618-001e-00f1-50fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "74356fea-5b9a-45b0-80fb-87fe0d978430" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail01102858044ed408ca4add?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "b1dec659-001e-00f1-0dfc-59e1e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b1dec659-001e-00f1-0dfc-59e1e5000000\nTime:2019-08-23T21:45:44.6428443Z", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "4356c7c4-d6b2-43b1-8b6a-1f080cb88048", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec68d-001e-00f1-3ffc-59e1e5000000", + "Body" : "jtcsetaccesspolicyacfailjtcsetaccesspolicyacfail01102858044ed408ca4addFri, 23 Aug 2019 21:45:44 GMT\"0x8D72813406559B5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "d1b9052d-cd58-49a0-b3d7-a28589c2252c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail01102858044ed408ca4add?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec6bf-001e-00f1-70fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "3e8c5e1b-7bf4-49a3-94ab-73ae5ea3ad35" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacfail01102858044ed408ca4add" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[2].json new file mode 100644 index 000000000000..f7cbce20c192 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[2].json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail027614861e4c66ab284ad7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813407DF0D2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec718-001e-00f1-46fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "4988cc17-4f73-4b52-82ba-cc08d8e23f3f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail027614861e4c66ab284ad7?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "LeaseNotPresentWithContainerOperation", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "b1dec747-001e-00f1-72fc-59e1e5000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:b1dec747-001e-00f1-72fc-59e1e5000000\nTime:2019-08-23T21:45:44.8019969Z", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "9bae3eb4-13e9-4617-8440-445534aa6eec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec76b-001e-00f1-13fc-59e1e5000000", + "Body" : "jtcsetaccesspolicyacfailjtcsetaccesspolicyacfail027614861e4c66ab284ad7Fri, 23 Aug 2019 21:45:44 GMT\"0x8D72813407DF0D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "98307fd2-6e0d-41c9-a04f-128412efd70d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacfail027614861e4c66ab284ad7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec7c8-001e-00f1-6dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "7b62c593-669f-4904-86bd-7e0279436782" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacfail027614861e4c66ab284ad7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[0].json new file mode 100644 index 000000000000..a87560874a2a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacillegal0176579222e19d8bd2436?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340972451\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec80d-001e-00f1-2efc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "bfc7140b-e3c2-4464-80c3-31011fc3e545" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec84c-001e-00f1-68fc-59e1e5000000", + "Body" : "jtcsetaccesspolicyacillegaljtcsetaccesspolicyacillegal0176579222e19d8bd2436Fri, 23 Aug 2019 21:45:44 GMT\"0x8D7281340972451\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "cdc9a368-b94b-4b43-8984-56d0048bafa2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacillegal0176579222e19d8bd2436?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec87c-001e-00f1-17fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "a06a771a-3f4f-4dc4-b2b9-7ac914e64757" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacillegal0176579222e19d8bd2436" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[1].json new file mode 100644 index 000000000000..7fb3a26b69a2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacillegal034095f0d0d6ff7b4140b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340A5CDEB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec8cb-001e-00f1-61fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "71ff7512-36a9-4400-bd0b-7b7aaacb469f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec8fc-001e-00f1-0ffc-59e1e5000000", + "Body" : "jtcsetaccesspolicyacillegaljtcsetaccesspolicyacillegal034095f0d0d6ff7b4140bFri, 23 Aug 2019 21:45:45 GMT\"0x8D7281340A5CDEB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "e93576c9-2d10-4531-bf41-2346a65ac697", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyacillegal034095f0d0d6ff7b4140b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dec93a-001e-00f1-48fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "b326b77f-97b4-4dd9-93be-24f2b029f7d9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacillegal034095f0d0d6ff7b4140b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyerror.json new file mode 100644 index 000000000000..c2948665b735 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyerror.json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyerror033681e4bdb9debad249848?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281340B4ECD0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dec98c-001e-00f1-13fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "8e8ad03c-2efc-4100-b70b-f269e3ebe2a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyerror1139713c4f9557d2e645269?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "b1deca58-001e-00f1-4dfc-59e1e5000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:b1deca58-001e-00f1-4dfc-59e1e5000000\nTime:2019-08-23T21:45:45.2314088Z", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "eb54987a-be1c-447f-85e9-cf40dc76051a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deca92-001e-00f1-03fc-59e1e5000000", + "Body" : "jtcsetaccesspolicyerrorjtcsetaccesspolicyerror033681e4bdb9debad249848Fri, 23 Aug 2019 21:45:45 GMT\"0x8D7281340B4ECD0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "f85bbe4e-3ce4-4fd7-a29b-1439381630a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyerror033681e4bdb9debad249848?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1decabe-001e-00f1-2cfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:44 GMT", + "x-ms-client-request-id" : "978afc37-e625-43ba-b18e-98c417368074" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyerror033681e4bdb9debad249848", "jtcsetaccesspolicyerror1139713c4f9557d2e645269" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyids.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyids.json new file mode 100644 index 000000000000..0277b3256229 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyids.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyids059361039c10d92a5e444e97?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133FD2445F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1debf1e-001e-00f1-55fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "64b6e407-8531-4ded-8783-15be4e214822" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyids059361039c10d92a5e444e97?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133FDC09DF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1debf7f-001e-00f1-2ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "0f303dbc-bdf6-434b-b324-5dc7699ed533" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyids059361039c10d92a5e444e97?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133FDC09DF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1debfac-001e-00f1-5afc-59e1e5000000", + "Body" : "00002019-08-23T21:45:43.0000000Z2019-08-24T21:45:43.0000000Zr00012019-08-23T21:45:43.0000000Z2019-08-25T21:45:43.0000000Zw", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "4aa31459-6138-45e9-ac9b-db3cb5eb2170", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyids&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1debfd2-001e-00f1-7cfc-59e1e5000000", + "Body" : "jtcsetaccesspolicyidsjtcsetaccesspolicyids059361039c10d92a5e444e97Fri, 23 Aug 2019 21:45:43 GMT\"0x8D728133FDC09DF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "9e6fb3a9-e90f-4830-bef7-ba0a58c99a80", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyids059361039c10d92a5e444e97?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1debffa-001e-00f1-22fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "4b087a8c-4d2d-4100-8cfe-173d557d4a13" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyids059361039c10d92a5e444e97", "2019-08-23T21:45:43.727Z", "2019-08-23T21:45:43.727Z", "2019-08-23T21:45:43.727Z", "2019-08-23T21:45:43.727Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminaccess.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminaccess.json new file mode 100644 index 000000000000..bc180b5990e6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminaccess.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminaccess031707801fb687236049f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F974FBE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1debc87-001e-00f1-6ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "a968ec1e-7b16-436f-acb7-f05c71e4720d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminaccess031707801fb687236049f?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F9F1960\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1debcd3-001e-00f1-37fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "a236c8d5-232c-462d-a762-2d90f0c9f569" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminaccess031707801fb687236049f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133F9F1960\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "container", + "x-ms-request-id" : "b1debd03-001e-00f1-66fc-59e1e5000000", + "x-ms-client-request-id" : "b0141812-a084-47a3-9c7b-4f4034c4c3ee" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyminaccess&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1debd3c-001e-00f1-16fc-59e1e5000000", + "Body" : "jtcsetaccesspolicyminaccessjtcsetaccesspolicyminaccess031707801fb687236049fFri, 23 Aug 2019 21:45:43 GMT\"0x8D728133F9F1960\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "7d24fe5d-9786-41f9-8e23-ccb0603dd86d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminaccess031707801fb687236049f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1debd64-001e-00f1-3dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "3ea848d7-ac7a-4d00-b0b6-1dda838d41cc" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyminaccess031707801fb687236049f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminids.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminids.json new file mode 100644 index 000000000000..7e2df66c1896 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminids.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminids093805835db4516488447b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133FB84D5E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1debde5-001e-00f1-37fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "793b18fd-7c62-4ac8-9ebf-75160b67f7d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminids093805835db4516488447b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133FBF2C26\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1debe34-001e-00f1-7dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "e3da1bac-2048-4f18-8101-a6c25d8befbb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminids093805835db4516488447b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133FBF2C26\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:43 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1debe60-001e-00f1-27fc-59e1e5000000", + "Body" : "00002019-08-23T21:45:43.0000000Z2019-08-24T21:45:43.0000000Zr", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "e81ce78c-fe02-43bd-a2ce-f05bc7908b59", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetaccesspolicyminids&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1debead-001e-00f1-6bfc-59e1e5000000", + "Body" : "jtcsetaccesspolicyminidsjtcsetaccesspolicyminids093805835db4516488447bFri, 23 Aug 2019 21:45:43 GMT\"0x8D728133FBF2C26\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "07ec449f-6340-4231-b1fe-3083ddad7552", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetaccesspolicyminids093805835db4516488447b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1debed7-001e-00f1-14fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:43 GMT", + "x-ms-client-request-id" : "2af70d0d-57da-47ca-bfb9-d5905352a6ac" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyminids093805835db4516488447b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadata.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadata.json new file mode 100644 index 000000000000..118c8f6c1800 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadata.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata0containerapitestsetmetadata349216934fcce1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E34D0A5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deab4e-001e-00f1-13fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "1b3addcf-4af2-4ccd-87df-68c3fc365a5b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadata349009936c8d2b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E3A01FD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deab9f-001e-00f1-56fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "a5384af2-17e2-445d-9982-8f0143be4002" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadata349009936c8d2b?restype=container&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E3F8339\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1deabee-001e-00f1-1bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "dd6ce045-33ff-4b38-b012-fa89479da842" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadata349009936c8d2b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133E3F8339\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "b1deac24-001e-00f1-4dfc-59e1e5000000", + "x-ms-client-request-id" : "cc4817c5-191a-4121-bb52-52886dcc5fd7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deac64-001e-00f1-80fc-59e1e5000000", + "Body" : "jtcsetmetadatajtcsetmetadata0containerapitestsetmetadata349216934fcce1Fri, 23 Aug 2019 21:45:40 GMT\"0x8D728133E34D0A5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetmetadata1containerapitestsetmetadata349009936c8d2bFri, 23 Aug 2019 21:45:41 GMT\"0x8D728133E3F8339\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "06f1433f-565a-4855-8dd0-853a09c17d7b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata0containerapitestsetmetadata349216934fcce1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deacb0-001e-00f1-39fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "c950dca5-7a77-46b9-8358-11d3453b4574" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadata349009936c8d2b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1dead17-001e-00f1-0dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "9e0ce8a5-59af-4a10-b89d-1238ee877c99" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadata0containerapitestsetmetadata349216934fcce1", "jtcsetmetadata1containerapitestsetmetadata349009936c8d2b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[0].json new file mode 100644 index 000000000000..e448055b5480 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[0].json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacb1460975d303?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133EA0A535\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb07f-001e-00f1-09fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "f2edab47-d98d-46e3-9f65-33cb2150e99c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacb1460975d303?restype=container&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133EA5D78F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1deb0c6-001e-00f1-4afc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "cf717624-3960-464a-b8c4-cbef184f73ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb0f4-001e-00f1-71fc-59e1e5000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0containerapitestsetmetadataacb1460975d303Fri, 23 Aug 2019 21:45:41 GMT\"0x8D728133EA5D78F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "e9059405-a6cf-475f-8652-73ddf207c054", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacb1460975d303?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb115-001e-00f1-10fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "c948622f-45a2-4189-9519-f2e24e50f6f3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0containerapitestsetmetadataacb1460975d303" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[1].json new file mode 100644 index 000000000000..e205182c8c0d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[1].json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac93b15019e76d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133EB43203\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb156-001e-00f1-4dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "d779ac39-a680-4ef9-a282-84f156c97c32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac93b15019e76d?restype=container&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133EB8C7CC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1deb190-001e-00f1-7ffc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "b593a823-002c-48c1-b44a-9464667b6350" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb1be-001e-00f1-2bfc-59e1e5000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0containerapitestsetmetadataac93b15019e76dFri, 23 Aug 2019 21:45:41 GMT\"0x8D728133EB8C7CC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "028dfcfe-5339-4015-bf8f-0657d3113cca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac93b15019e76d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb1e9-001e-00f1-53fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "1c621dae-03ac-4f2d-8c91-32fb3e20c630" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0containerapitestsetmetadataac93b15019e76d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[2].json new file mode 100644 index 000000000000..e87a1d0fa8d6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[2].json @@ -0,0 +1,124 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacbac0179294a8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133EC6D437\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb225-001e-00f1-09fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "7874b25c-c8d0-4564-8c45-429a9e37b0e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacbac0179294a8?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133EC6D437\"", + "x-ms-lease-id" : "1263684e-cc88-4e7d-a965-94680c517a9f", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb270-001e-00f1-42fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "6bbae009-3932-4784-85ff-0acc9db7fe84" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacbac0179294a8?restype=container&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133ED1108D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1deb2a8-001e-00f1-76fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "aec4f98d-1fbd-4850-b474-e95480e51131" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb2ce-001e-00f1-1afc-59e1e5000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0containerapitestsetmetadataacbac0179294a8Fri, 23 Aug 2019 21:45:41 GMT\"0x8D728133ED1108D\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "82ee0e70-74ad-4424-b13f-00eb4e6178a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacbac0179294a8?comp=lease&restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133ED1108D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b1deb2fb-001e-00f1-44fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "2a3cee01-e960-41ec-9a28-83d05b03a36c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacbac0179294a8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb338-001e-00f1-7dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "38d6592d-c7e1-4cd3-989e-7ba775122b48" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0containerapitestsetmetadataacbac0179294a8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[0].json new file mode 100644 index 000000000000..909252e15a28 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[0].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfailc6b75183?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133EE5AE75\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb3b2-001e-00f1-69fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "d79f0c0a-6e4f-419a-bc09-7c8160ff0558" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfailc6b75183?restype=container&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "b1deb3e9-001e-00f1-1dfc-59e1e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:b1deb3e9-001e-00f1-1dfc-59e1e5000000\nTime:2019-08-23T21:45:42.1244268Z", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "d8855235-63bf-407b-b3a5-b7583f6dadca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb42f-001e-00f1-58fc-59e1e5000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0containerapitestsetmetadataacfailc6b75183Fri, 23 Aug 2019 21:45:42 GMT\"0x8D728133EE5AE75\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "dc28085c-9637-4c84-b455-2cbe56e369b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfailc6b75183?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb45e-001e-00f1-03fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "0957e00f-7502-4e1a-bcd7-2fa846fa1d0f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0containerapitestsetmetadataacfailc6b75183" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[1].json new file mode 100644 index 000000000000..e34462fc2705 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[1].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfaild2a54447?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133EF877B7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb4a1-001e-00f1-40fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "36b9e7e9-6576-402f-902a-9c0242751e8b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfaild2a54447?restype=container&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseNotPresentWithContainerOperation", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "b1deb4e6-001e-00f1-7cfc-59e1e5000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:b1deb4e6-001e-00f1-7cfc-59e1e5000000\nTime:2019-08-23T21:45:42.2495471Z", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "63a1c419-ec97-47ce-8de6-e1fcba452b78", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb524-001e-00f1-33fc-59e1e5000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0containerapitestsetmetadataacfaild2a54447Fri, 23 Aug 2019 21:45:42 GMT\"0x8D728133EF877B7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "5d9cffd7-cd92-4678-ad15-00cd5c077cdf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfaild2a54447?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb555-001e-00f1-60fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "241ef608-99ec-4d0e-bfe3-6d4e7ea914d6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0containerapitestsetmetadataacfaild2a54447" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[0].json new file mode 100644 index 000000000000..1bb27bca6308 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal0045114d8dc5ccf81242ccb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F0BB656\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb5a4-001e-00f1-28fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "1fae3a98-2575-425e-bec4-93cb868320f9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb5e6-001e-00f1-65fc-59e1e5000000", + "Body" : "jtcsetmetadataacillegaljtcsetmetadataacillegal0045114d8dc5ccf81242ccbFri, 23 Aug 2019 21:45:42 GMT\"0x8D728133F0BB656\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "e21c27e2-3386-47cc-a771-47a95b3e76b0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal0045114d8dc5ccf81242ccb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb616-001e-00f1-13fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "82cb018f-2475-4466-80cb-d699dbbb0235" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacillegal0045114d8dc5ccf81242ccb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[1].json new file mode 100644 index 000000000000..90e6149c5fc6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal041127eb48608ac4ff4c329?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F1C5C3F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb66e-001e-00f1-63fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "25daadf2-43cc-4126-afba-8fdd4dcccf2d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb6c0-001e-00f1-2efc-59e1e5000000", + "Body" : "jtcsetmetadataacillegaljtcsetmetadataacillegal041127eb48608ac4ff4c329Fri, 23 Aug 2019 21:45:42 GMT\"0x8D728133F1C5C3F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "92e9fce4-41cf-4b85-a90e-e5bd018880bf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal041127eb48608ac4ff4c329?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb6fb-001e-00f1-65fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "3ec958ab-7866-4cd8-9a14-190dbbe4e7a5" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacillegal041127eb48608ac4ff4c329" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[2].json new file mode 100644 index 000000000000..75cd9336f449 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal003912b428864a760f4113b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F2BC957\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb73a-001e-00f1-20fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "21e8f77d-375a-4c18-8154-f7a3d4ea8007" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataacillegal&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb788-001e-00f1-67fc-59e1e5000000", + "Body" : "jtcsetmetadataacillegaljtcsetmetadataacillegal003912b428864a760f4113bFri, 23 Aug 2019 21:45:42 GMT\"0x8D728133F2BC957\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:41 GMT", + "x-ms-client-request-id" : "2b14b5f2-327d-4ff6-9feb-945c1a3a9b7a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataacillegal003912b428864a760f4113b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb7bb-001e-00f1-16fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "002f5ac0-7255-4aab-8f02-30873972f5c4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacillegal003912b428864a760f4113b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataerror.json new file mode 100644 index 000000000000..2e606ab70cb3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataerror.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0containerapitestsetmetadataerror951706289?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133F3B0F58\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deb7ef-001e-00f1-47fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "1a8a98c5-437c-4215-b79b-813e37883e2b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror1containerapitestsetmetadataerror951774241?restype=container&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb829-001e-00f1-7bfc-59e1e5000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:b1deb829-001e-00f1-7bfc-59e1e5000000\nTime:2019-08-23T21:45:42.6859659Z", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "ce9c1ade-9bc1-47c7-acad-9b28b522f77d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadataerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb863-001e-00f1-2cfc-59e1e5000000", + "Body" : "jtcsetmetadataerrorjtcsetmetadataerror0containerapitestsetmetadataerror951706289Fri, 23 Aug 2019 21:45:42 GMT\"0x8D728133F3B0F58\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "349251bf-bf12-4eac-a194-cc6a2cdb9536", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadataerror0containerapitestsetmetadataerror951706289?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb88f-001e-00f1-55fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:42 GMT", + "x-ms-client-request-id" : "086991a4-9080-413e-a2d7-1113b1e972c4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataerror0containerapitestsetmetadataerror951706289", "jtcsetmetadataerror1containerapitestsetmetadataerror951774241" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[0].json new file mode 100644 index 000000000000..793050d7bfda --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[0].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata038377b22f1a4ee9194e928?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E706199\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deae70-001e-00f1-3bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "377b7fc8-4419-48ce-8499-09fd015792bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata038377b22f1a4ee9194e928?restype=container&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E74F7DB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1deaec7-001e-00f1-02fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "7d6e20dd-0172-43e0-843e-2b4d85e132b6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata038377b22f1a4ee9194e928?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133E74F7DB\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "b1deaeff-001e-00f1-34fc-59e1e5000000", + "x-ms-client-request-id" : "226167c6-1d59-49a3-8391-3510aa42ba6d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadatametadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deaf28-001e-00f1-5bfc-59e1e5000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata038377b22f1a4ee9194e928Fri, 23 Aug 2019 21:45:41 GMT\"0x8D728133E74F7DB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "9c13045b-716c-4be9-9ab6-e222188da5de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata038377b22f1a4ee9194e928?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deaf4f-001e-00f1-7bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "438e6b2e-9aa0-4e4e-881e-8da1f8096ea3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata038377b22f1a4ee9194e928" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[1].json new file mode 100644 index 000000000000..6545c3f0fa1b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[1].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata02119425341c4e82054227a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E8771B6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1deaf80-001e-00f1-27fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "8aeb1622-1529-4057-b761-d8bc335d7699" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata02119425341c4e82054227a?restype=container&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E8CCB4D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1deafb3-001e-00f1-54fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "a367c5a9-6974-4a2d-b0f8-d200ac46e77d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata02119425341c4e82054227a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-meta-foo" : "bar", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133E8CCB4D\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "b1deaff4-001e-00f1-0dfc-59e1e5000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "352d3fe3-6fe2-4c71-84b9-2d03d8e63cff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadatametadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb015-001e-00f1-2afc-59e1e5000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata02119425341c4e82054227aFri, 23 Aug 2019 21:45:41 GMT\"0x8D728133E8CCB4D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "98d8930a-ce8e-49df-b064-a5adf90ebec7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatametadata02119425341c4e82054227a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deb039-001e-00f1-4bfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "60fdc92c-9cd1-4b6d-93e6-e3b9bec1435c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata02119425341c4e82054227a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatamin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatamin.json new file mode 100644 index 000000000000..2c5e7351c947 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatamin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadataminc33346999af?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E56DFF1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1dead68-001e-00f1-53fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "ba6422c6-640c-4889-91f3-1c97ab110ee3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadataminc33346999af?restype=container&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728133E5BEB9A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1deada2-001e-00f1-06fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "fc50c128-f207-4ae0-b41e-2b9b1c936a5b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadataminc33346999af?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Fri, 23 Aug 2019 21:45:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-meta-foo" : "bar", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D728133E5BEB9A\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "b1deadd2-001e-00f1-32fc-59e1e5000000", + "x-ms-client-request-id" : "12fadc67-3070-43a2-a52b-bc58b0c99bde" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetmetadatamin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deadf3-001e-00f1-50fc-59e1e5000000", + "Body" : "jtcsetmetadataminjtcsetmetadatamin0containerapitestsetmetadataminc33346999afFri, 23 Aug 2019 21:45:41 GMT\"0x8D728133E5BEB9A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "5bffddeb-c2b5-4653-8f4b-02a9e7d18d3b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadataminc33346999af?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1deae21-001e-00f1-79fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:45:40 GMT", + "x-ms-client-request-id" : "0575194e-c9ff-4a02-881e-926670381972" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatamin0containerapitestsetmetadataminc33346999af" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestwebcontainer.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestwebcontainer.json new file mode 100644 index 000000000000..3536db683785 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestwebcontainer.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcwebcontainer0containerapitestwebcontainer611313409eeb5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BBAE97DE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01381-501e-00c0-25fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "bb280bf0-ed68-4d11-b83f-195fbc0fb23d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/$web?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d013a8-501e-00c0-4bfc-59ba32000000", + "Body" : "ContainerAlreadyExistsThe specified container already exists.\nRequestId:77d013a8-501e-00c0-4bfc-59ba32000000\nTime:2019-08-23T21:49:11.4816038Z", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "456f126d-b982-4a10-8f9d-6deab548d0b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/$web?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BBB7D121\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77d013ce-501e-00c0-6efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "71efc542-ec5e-4279-ac60-b6a84e705e69" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcwebcontainer&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01400-501e-00c0-16fc-59ba32000000", + "Body" : "jtcwebcontainerjtcwebcontainer0containerapitestwebcontainer611313409eeb5Fri, 23 Aug 2019 21:49:11 GMT\"0x8D72813BBAE97DE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "945364d6-e0ca-49fb-8ee9-b41ae0fa9593", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcwebcontainer0containerapitestwebcontainer611313409eeb5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01422-501e-00c0-36fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:10 GMT", + "x-ms-client-request-id" : "2fb17003-0c8a-4022-a2a5-caea136e1224" + }, + "Exception" : null + } ], + "variables" : [ "jtcwebcontainer0containerapitestwebcontainer611313409eeb5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[0].json new file mode 100644 index 000000000000..6f2c23e5be5d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[0].json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure7ae647683122f602?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BC6B864B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01959-501e-00c0-46fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "b67123a2-a52a-4818-a212-86a3dce8dbec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure7ae647683122f602/javablobfailure1downloadresponsetestfailure7ae18212726b66", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BC70B3EF\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01978-501e-00c0-64fc-59ba32000000", + "x-ms-client-request-id" : "82ab8dd2-a6e5-4967-9820-5ab905ebbfab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcfailure&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01995-501e-00c0-7cfc-59ba32000000", + "Body" : "jtcfailurejtcfailure0downloadresponsetestfailure7ae647683122f602Fri, 23 Aug 2019 21:49:12 GMT\"0x8D72813BC6B864B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "5b3c998c-2801-4c80-96df-d641ff84ac42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure7ae647683122f602?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d019b2-501e-00c0-16fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "ced65d91-8946-491f-b758-cef94f324df6" + }, + "Exception" : null + } ], + "variables" : [ "jtcfailure0downloadresponsetestfailure7ae647683122f602", "javablobfailure1downloadresponsetestfailure7ae18212726b66" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[1].json new file mode 100644 index 000000000000..987d8459977a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[1].json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure36d61703f64c89d6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BC82BD71\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d019e8-501e-00c0-44fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "265ec59b-e0b9-47ce-b8a9-e3fd13bc2095" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure36d61703f64c89d6/javablobfailure1downloadresponsetestfailure36d98034ecce42", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BC879CEF\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01a10-501e-00c0-65fc-59ba32000000", + "x-ms-client-request-id" : "f4c73db9-0ec9-4a01-9e9c-ec48480da475" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcfailure&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01a31-501e-00c0-7ffc-59ba32000000", + "Body" : "jtcfailurejtcfailure0downloadresponsetestfailure36d61703f64c89d6Fri, 23 Aug 2019 21:49:12 GMT\"0x8D72813BC82BD71\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "ed896fa4-de3b-4fa8-b694-2127508fecdb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure36d61703f64c89d6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01a49-501e-00c0-13fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "02342950-f3c0-43c1-a903-459bbeea0890" + }, + "Exception" : null + } ], + "variables" : [ "jtcfailure0downloadresponsetestfailure36d61703f64c89d6", "javablobfailure1downloadresponsetestfailure36d98034ecce42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[2].json new file mode 100644 index 000000000000..d80b994697dc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[2].json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure6a853135a4de19e0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BC964A36\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01a61-501e-00c0-28fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "422c09af-8ded-4d7c-b548-5f9ad2ef108a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure6a853135a4de19e0/javablobfailure1downloadresponsetestfailure6a832356c2d531", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BC9B77F4\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01a86-501e-00c0-48fc-59ba32000000", + "x-ms-client-request-id" : "50c050bc-e4ec-45cc-825e-dedeaedbe6bc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcfailure&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01aa6-501e-00c0-64fc-59ba32000000", + "Body" : "jtcfailurejtcfailure0downloadresponsetestfailure6a853135a4de19e0Fri, 23 Aug 2019 21:49:12 GMT\"0x8D72813BC964A36\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "364a29ea-25eb-493c-b83a-968e3233638b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcfailure0downloadresponsetestfailure6a853135a4de19e0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01abd-501e-00c0-7bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "cc7bd7a6-a05c-4690-827c-799b5b04f2cf" + }, + "Exception" : null + } ], + "variables" : [ "jtcfailure0downloadresponsetestfailure6a853135a4de19e0", "javablobfailure1downloadresponsetestfailure6a832356c2d531" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestgetteria.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestgetteria.json new file mode 100644 index 000000000000..f4c242a1482d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestgetteria.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetteria0downloadresponsetestgetteria05a808015f41e82?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BCF018EF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01cdb-501e-00c0-5efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "3dcc6383-a2ac-4c74-9d6e-57ae88cc1e1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetteria0downloadresponsetestgetteria05a808015f41e82/javablobgetteria1downloadresponsetestgetteria05a8692724272", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BCF546C7\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01d02-501e-00c0-01fc-59ba32000000", + "x-ms-client-request-id" : "6b536319-ef8c-454f-afb3-2f6217012eda" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetteria&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01d28-501e-00c0-22fc-59ba32000000", + "Body" : "jtcgetteriajtcgetteria0downloadresponsetestgetteria05a808015f41e82Fri, 23 Aug 2019 21:49:13 GMT\"0x8D72813BCF018EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "0c80c4cb-4098-428a-98d5-500a1cb4d1cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetteria0downloadresponsetestgetteria05a808015f41e82?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01d4a-501e-00c0-43fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "03337ab0-a74f-4a88-81cc-b5ba7ef8b36f" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetteria0downloadresponsetestgetteria05a808015f41e82", "javablobgetteria1downloadresponsetestgetteria05a8692724272", "951c98fa-12e3-493d-90e7-15bcc66cb00d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfo.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfo.json new file mode 100644 index 000000000000..2536b1a61365 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfo.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfo0downloadresponsetestinfoa4515709af056b8174c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BD03F3D9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01d73-501e-00c0-64fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "d2d58186-88ca-43d1-af2e-31f5ce793dec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfo0downloadresponsetestinfoa4515709af056b8174c/javablobinfo1downloadresponsetestinfoa4517373606a4cdbc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BD0921BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01d9e-501e-00c0-08fc-59ba32000000", + "x-ms-client-request-id" : "ac5a39f2-de38-45ba-b934-a4193068f11e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcinfo&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01dd1-501e-00c0-36fc-59ba32000000", + "Body" : "jtcinfojtcinfo0downloadresponsetestinfoa4515709af056b8174cFri, 23 Aug 2019 21:49:13 GMT\"0x8D72813BD03F3D9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "67c6e68d-0f38-4068-8b4b-58d01dd5b79f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfo0downloadresponsetestinfoa4515709af056b8174c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01df2-501e-00c0-50fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "775eb4c9-6894-4692-8824-2546dcc6de4f" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfo0downloadresponsetestinfoa4515709af056b8174c", "javablobinfo1downloadresponsetestinfoa4517373606a4cdbc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfocountia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfocountia.json new file mode 100644 index 000000000000..bf072da58256 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfocountia.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfocountia0downloadresponsetestinfocountia212748151949?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BD1DC3B8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01e4d-501e-00c0-20fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "e7ecb685-615a-49d0-895a-ca24ed85770e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfocountia0downloadresponsetestinfocountia212748151949/javablobinfocountia1downloadresponsetestinfocountia212774474c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BD22A36F\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01e74-501e-00c0-42fc-59ba32000000", + "x-ms-client-request-id" : "b8503c38-b9de-4f96-aa13-a64346b72ecc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcinfocountia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01e92-501e-00c0-5cfc-59ba32000000", + "Body" : "jtcinfocountiajtcinfocountia0downloadresponsetestinfocountia212748151949Fri, 23 Aug 2019 21:49:13 GMT\"0x8D72813BD1DC3B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "0677a70a-59f6-4a28-a35b-1f2f0a527b0a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfocountia0downloadresponsetestinfocountia212748151949?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01eab-501e-00c0-6ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "41726c81-c5f1-4b5a-92eb-8aa048a60164" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfocountia0downloadresponsetestinfocountia212748151949", "javablobinfocountia1downloadresponsetestinfocountia212774474c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[0].json new file mode 100644 index 000000000000..98cb4f78f9b0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[0].json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliab745367790105?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BCAAC195\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01b00-501e-00c0-2ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "c01cab4e-7cf9-4f05-bbe0-7d30d3d79552" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliab745367790105/javablobinfonullia1downloadresponsetestinfonulliab744014298a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BCB239D8\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01b3a-501e-00c0-5ffc-59ba32000000", + "x-ms-client-request-id" : "e1d5d5ae-ac9d-47a2-b48f-9e10d8e2abd9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcinfonullia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01b73-501e-00c0-13fc-59ba32000000", + "Body" : "jtcinfonulliajtcinfonullia0downloadresponsetestinfonulliab745367790105Fri, 23 Aug 2019 21:49:13 GMT\"0x8D72813BCAAC195\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "ef94811b-ffc4-4be7-bd13-6257ebea8bba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliab745367790105?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01b8f-501e-00c0-2dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "8096f80f-ff7c-41bd-a975-0a7f73bd831e" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfonullia0downloadresponsetestinfonulliab745367790105", "javablobinfonullia1downloadresponsetestinfonulliab744014298a", "8f011b24-eca5-414e-9406-227d3f350b4f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[1].json new file mode 100644 index 000000000000..fae8b81f5fd1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[1].json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliaae814431ae30d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BCC63F8A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01bc3-501e-00c0-5efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "f3754a71-16c5-4ec1-a8cf-cacb95702915" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliaae814431ae30d/javablobinfonullia1downloadresponsetestinfonulliaae8423931d0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BCCB4636\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01be6-501e-00c0-7dfc-59ba32000000", + "x-ms-client-request-id" : "be3bd0dd-3986-4ffe-bbf5-df5b28460254" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcinfonullia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01c0b-501e-00c0-1ffc-59ba32000000", + "Body" : "jtcinfonulliajtcinfonullia0downloadresponsetestinfonulliaae814431ae30dFri, 23 Aug 2019 21:49:13 GMT\"0x8D72813BCC63F8A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "62eb32aa-b88f-4e82-b4ff-252b9140dac2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliaae814431ae30d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01c2c-501e-00c0-3afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "2525f2a5-84e2-4719-8158-8d216aed59c1" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfonullia0downloadresponsetestinfonulliaae814431ae30d", "javablobinfonullia1downloadresponsetestinfonulliaae8423931d0", "7d4b4760-9168-4e54-a560-a96fa27e6c99" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestnetworkcall.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestnetworkcall.json new file mode 100644 index 000000000000..76a0d826e949 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestnetworkcall.json @@ -0,0 +1,116 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcall26539285bdf3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BC03AA73\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01667-501e-00c0-38fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "7e6a73d4-eb5c-41e3-9832-2041ab1d5fdd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcall26539285bdf3/javablobnetworkcall1downloadresponsetestnetworkcall26525761b7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BC08B0D6\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d0168d-501e-00c0-58fc-59ba32000000", + "x-ms-client-request-id" : "92d378d4-c203-4d51-ad0b-df015ac9a286" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcall26539285bdf3/javablobnetworkcall1downloadresponsetestnetworkcall26525761b7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813BC08B0D6\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:12 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "77d016af-501e-00c0-72fc-59ba32000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "99307c44-3091-4441-95e5-c0c88cde7569", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcnetworkcall&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d016e9-501e-00c0-1dfc-59ba32000000", + "Body" : "jtcnetworkcalljtcnetworkcall0downloadresponsetestnetworkcall26539285bdf3Fri, 23 Aug 2019 21:49:12 GMT\"0x8D72813BC03AA73\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "c11d412e-d378-489c-bf30-58e8918bc0a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcall26539285bdf3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01709-501e-00c0-39fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "d850f887-9a17-4c23-8a79-8b8e930f15e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcnetworkcall0downloadresponsetestnetworkcall26539285bdf3", "javablobnetworkcall1downloadresponsetestnetworkcall26525761b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestoptionsia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestoptionsia.json new file mode 100644 index 000000000000..5b9ef080de8d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestoptionsia.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcoptionsia0downloadresponsetestoptionsia56366935b22904?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BCDBA182\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01c5e-501e-00c0-65fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "dce298cf-9262-454f-b103-b90f5d7eeea2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcoptionsia0downloadresponsetestoptionsia56366935b22904/javabloboptionsia1downloadresponsetestoptionsia563063554b8e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BCE0A83B\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01c82-501e-00c0-08fc-59ba32000000", + "x-ms-client-request-id" : "5d966010-bd5f-44da-b9eb-3e3ecfad22c8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcoptionsia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01ca9-501e-00c0-2dfc-59ba32000000", + "Body" : "jtcoptionsiajtcoptionsia0downloadresponsetestoptionsia56366935b22904Fri, 23 Aug 2019 21:49:13 GMT\"0x8D72813BCDBA182\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "b94d08fe-a43a-4e48-8536-5eeaa4631603", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcoptionsia0downloadresponsetestoptionsia56366935b22904?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01cbf-501e-00c0-43fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "d7ac5b21-bf6c-42ac-aace-071eefce63fe" + }, + "Exception" : null + } ], + "variables" : [ "jtcoptionsia0downloadresponsetestoptionsia56366935b22904", "javabloboptionsia1downloadresponsetestoptionsia563063554b8e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[0].json new file mode 100644 index 000000000000..83076f8801b5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[0].json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfulbb176512c8297?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BC1FC4CA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0174d-501e-00c0-6efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "cf17fb29-ba10-4013-8d4c-d0cdae739e90" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfulbb176512c8297/javablobsuccessful1downloadresponsetestsuccessfulbb193950d41", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BC24F25D\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01771-501e-00c0-0dfc-59ba32000000", + "x-ms-client-request-id" : "4606d90a-a5a5-40de-8f3a-283be6b0e6d5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsuccessful&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d017fe-501e-00c0-0efc-59ba32000000", + "Body" : "jtcsuccessfuljtcsuccessful0downloadresponsetestsuccessfulbb176512c8297Fri, 23 Aug 2019 21:49:12 GMT\"0x8D72813BC1FC4CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "99806d6d-c69c-4392-a135-c200170055bd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfulbb176512c8297?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01817-501e-00c0-24fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "e4885ff8-b019-4068-98b5-d78062fd8a64" + }, + "Exception" : null + } ], + "variables" : [ "jtcsuccessful0downloadresponsetestsuccessfulbb176512c8297", "javablobsuccessful1downloadresponsetestsuccessfulbb193950d41", "67eba2e4-e0d5-4b6d-a158-62e6ce9ef069" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[1].json new file mode 100644 index 000000000000..99f6493943af --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[1].json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful64315138f74ee?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BC429789\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0183e-501e-00c0-4afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "897bbcc8-b0b9-4030-a870-6b71a2f780e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful64315138f74ee/javablobsuccessful1downloadresponsetestsuccessful64348069883", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BC479E05\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d01868-501e-00c0-71fc-59ba32000000", + "x-ms-client-request-id" : "96217ae2-b22e-4996-973c-a8d1e64c2adb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsuccessful&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01880-501e-00c0-08fc-59ba32000000", + "Body" : "jtcsuccessfuljtcsuccessful0downloadresponsetestsuccessful64315138f74eeFri, 23 Aug 2019 21:49:12 GMT\"0x8D72813BC429789\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "47a4ecee-b2f5-4494-9055-67bb8fc755ad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful64315138f74ee?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0189c-501e-00c0-1ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "60c5454d-3d3d-4a3a-b67f-df2d41ec7095" + }, + "Exception" : null + } ], + "variables" : [ "jtcsuccessful0downloadresponsetestsuccessful64315138f74ee", "javablobsuccessful1downloadresponsetestsuccessful64348069883", "d489d26a-0d5e-4475-bff0-3ea5dee54590" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[2].json new file mode 100644 index 000000000000..4b9cd6fe38f1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[2].json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful5b994701f3b47?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BC56C0BE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d018c9-501e-00c0-46fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "ee386d8c-9715-451b-a819-8d1c6faa31c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful5b994701f3b47/javablobsuccessful1downloadresponsetestsuccessful5b95040266a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BC5C63A4\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d018e3-501e-00c0-5efc-59ba32000000", + "x-ms-client-request-id" : "5081a7ab-92c1-45b0-86e8-05669d775238" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsuccessful&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01914-501e-00c0-07fc-59ba32000000", + "Body" : "jtcsuccessfuljtcsuccessful0downloadresponsetestsuccessful5b994701f3b47Fri, 23 Aug 2019 21:49:12 GMT\"0x8D72813BC56C0BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:11 GMT", + "x-ms-client-request-id" : "c9f9b99f-7cb0-4e10-b54e-5fec9f6a654e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful5b994701f3b47?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0192b-501e-00c0-1dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:12 GMT", + "x-ms-client-request-id" : "080ee72b-b4f5-4ee2-a50b-bd8949241d38" + }, + "Exception" : null + } ], + "variables" : [ "jtcsuccessful0downloadresponsetestsuccessful5b994701f3b47", "javablobsuccessful1downloadresponsetestsuccessful5b95040266a", "d9ded158-8131-4605-a654-d3b64a0d0f5b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[0].json new file mode 100644 index 000000000000..6e17eade5323 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse006039f3bfd9e8504b48?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C3FFD914\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04cd9-501e-00c0-57fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "9b9fedd4-7d3b-41fd-9ab0-4c5a07d0b988" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04cf9-501e-00c0-76fc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse006039f3bfd9e8504b48Fri, 23 Aug 2019 21:49:25 GMT\"0x8D72813C3FFD914\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "14a00d22-4167-42d5-acf6-3b1a614ead16", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse006039f3bfd9e8504b48?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04d31-501e-00c0-2cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "d14694e8-5077-45eb-9088-0f483b114577" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse006039f3bfd9e8504b48" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[1].json new file mode 100644 index 000000000000..395ba33b0dd0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse085916ce288071ebd349?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C41365D1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04d53-501e-00c0-4cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "c510026f-37bc-45e1-b27a-d15e44722edd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04d77-501e-00c0-6efc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse085916ce288071ebd349Fri, 23 Aug 2019 21:49:25 GMT\"0x8D72813C41365D1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "b18cadd5-4558-4799-bcc9-def5fa2a901d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse085916ce288071ebd349?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04da0-501e-00c0-14fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "cfabc449-3455-43cb-9bdd-2e6d5fbd0368" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse085916ce288071ebd349" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[2].json new file mode 100644 index 000000000000..4cbf1476648d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0053770caf1c46b3014a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C4225D97\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04dca-501e-00c0-3afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "c49935ad-4fe7-4948-8680-02e54852650b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04ded-501e-00c0-59fc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0053770caf1c46b3014aFri, 23 Aug 2019 21:49:25 GMT\"0x8D72813C4225D97\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "07ab8ac9-08af-43d9-984c-ed934a20b43f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0053770caf1c46b3014a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04e10-501e-00c0-7afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "efe9d938-5b79-4e4e-b37b-d81c9c085cbb" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0053770caf1c46b3014a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[3].json new file mode 100644 index 000000000000..04d118e9bcae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse02912511d3cc6f7b6646?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C4315559\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04e4e-501e-00c0-33fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "d7377054-21c9-4a81-90f6-67f04ebeafb6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04e6b-501e-00c0-4dfc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse02912511d3cc6f7b6646Fri, 23 Aug 2019 21:49:25 GMT\"0x8D72813C4315559\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "b0bcc379-2b5a-4fa1-81e7-eec71882e904", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse02912511d3cc6f7b6646?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04e87-501e-00c0-69fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "1eea396a-69c4-41e8-803e-db4ff54809bf" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse02912511d3cc6f7b6646" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[4].json new file mode 100644 index 000000000000..eff985550638 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse091826c792b278a8074f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C43FB0C3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04eba-501e-00c0-18fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "2ab27540-c95e-4596-a7a5-19706189d127" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04ee2-501e-00c0-3bfc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse091826c792b278a8074fFri, 23 Aug 2019 21:49:25 GMT\"0x8D72813C43FB0C3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "1d810bcd-b09d-4e5e-b9bd-aad139bc302d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse091826c792b278a8074f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04efe-501e-00c0-57fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "ef0c3e46-8da7-4532-b29c-216a0c1c9fbc" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse091826c792b278a8074f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[5].json new file mode 100644 index 000000000000..a573ca30b710 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse07143421a725dcc0544c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C44ECFA1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04f2e-501e-00c0-03fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "b050aa5a-1fa1-48c0-baa2-1c293552f57e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04f53-501e-00c0-26fc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse07143421a725dcc0544cFri, 23 Aug 2019 21:49:25 GMT\"0x8D72813C44ECFA1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "e50f97e3-7c76-4dcc-91ac-4b6dcace4081", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse07143421a725dcc0544c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04f6c-501e-00c0-3efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "16f19f07-b8e2-42a4-9d4e-2866491c8ff7" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse07143421a725dcc0544c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[6].json new file mode 100644 index 000000000000..3381b22a63ed --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0030072da0ec9794d54b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C45D792C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04fa2-501e-00c0-71fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "54ddc8a2-ad04-4dd2-abe3-d574a93534c0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04fd0-501e-00c0-1cfc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0030072da0ec9794d54bFri, 23 Aug 2019 21:49:26 GMT\"0x8D72813C45D792C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "e39bbc2a-3e94-4b4e-8a13-5f4b61892a77", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0030072da0ec9794d54b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04ff3-501e-00c0-3dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "95e529e5-1896-4841-bb9e-2fe565ea1b56" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0030072da0ec9794d54b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[7].json new file mode 100644 index 000000000000..086ea04e8850 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[7].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse012893b849d8340e9e41?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C46C70F8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05029-501e-00c0-6ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "560ae8d8-e0c6-4ea4-9439-c9cb3ebf0ed4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05059-501e-00c0-19fc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse012893b849d8340e9e41Fri, 23 Aug 2019 21:49:26 GMT\"0x8D72813C46C70F8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "09a9cf9c-f56e-4325-80e4-1da9a1b5b1af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse012893b849d8340e9e41?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05078-501e-00c0-37fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "959dede6-f5ce-42d6-bb6a-b763a9c4ef12" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse012893b849d8340e9e41" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[8].json new file mode 100644 index 000000000000..e771965c9115 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[8].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse00815854f3d0f6ae1b4b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C47AF379\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d050ab-501e-00c0-63fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "7c40c2d9-e147-49a6-9523-52497ec978ad" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d050d1-501e-00c0-06fc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse00815854f3d0f6ae1b4bFri, 23 Aug 2019 21:49:26 GMT\"0x8D72813C47AF379\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "cb4db212-0242-4a3f-8d29-f0a040af16eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse00815854f3d0f6ae1b4b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d050f0-501e-00c0-23fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "07cf2009-2f69-4a6f-93b3-8aadb4bde865" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse00815854f3d0f6ae1b4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[9].json new file mode 100644 index 000000000000..819446962360 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[9].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0594557f8424a4c71447?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C4899D12\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05120-501e-00c0-45fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "01f8bd4b-6d82-4137-89b7-4fa1588b526f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0514b-501e-00c0-66fc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0594557f8424a4c71447Fri, 23 Aug 2019 21:49:26 GMT\"0x8D72813C4899D12\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "3318a27f-d21a-4b16-aecc-66aeef5325a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0594557f8424a4c71447?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05170-501e-00c0-02fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "698a02cd-bc73-44a9-aa38-dff0d869ca43" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0594557f8424a4c71447" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparseia.json new file mode 100644 index 000000000000..13cbc3bedf4d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparseia.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparseia003396ab7c59258a4a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C498469D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0519f-501e-00c0-2afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "736f10de-e06b-43da-907e-4a1583eb6b03" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparseia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d051c4-501e-00c0-49fc-59ba32000000", + "Body" : "jtcaccountsaspermissionsparseiajtcaccountsaspermissionsparseia003396ab7c59258a4a4Fri, 23 Aug 2019 21:49:26 GMT\"0x8D72813C498469D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "b6f3096e-eb95-41c5-bc72-a65530bee5cc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparseia003396ab7c59258a4a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d051e1-501e-00c0-5ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "3cd19eaf-bfd3-4b6d-a3e3-c7b8c76ed183" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparseia003396ab7c59258a4a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[0].json new file mode 100644 index 000000000000..773eea262aac --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring05015145315837650e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C36BD99B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04888-501e-00c0-5afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "764c6a6c-91c3-4d2d-91f0-0f4f3f2698ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04909-501e-00c0-53fc-59ba32000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring05015145315837650eFri, 23 Aug 2019 21:49:24 GMT\"0x8D72813C36BD99B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "bd7dfb9a-6329-43e4-80b1-041b78ca986e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring05015145315837650e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04922-501e-00c0-69fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "e905eeca-6d9a-4779-812e-e9acc61b5db8" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring05015145315837650e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[1].json new file mode 100644 index 000000000000..e922cb1898f7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring002848ca139b80a32d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C385F7A4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04946-501e-00c0-0dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "7b122a1d-4164-4359-81ad-4b0aeae08c11" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0496f-501e-00c0-33fc-59ba32000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring002848ca139b80a32dFri, 23 Aug 2019 21:49:24 GMT\"0x8D72813C385F7A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "9f1bdd4b-89f8-4c17-9b9d-fb4bd35d0427", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring002848ca139b80a32d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0498f-501e-00c0-50fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "4e99fb42-3df6-4233-9975-027c89a24b4f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring002848ca139b80a32d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[2].json new file mode 100644 index 000000000000..d3a55f13f589 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0889248b1d1f10885d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C394A138\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d049ba-501e-00c0-79fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "a7989f23-012e-4071-a003-fb3fb325ebc6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d049de-501e-00c0-17fc-59ba32000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0889248b1d1f10885dFri, 23 Aug 2019 21:49:24 GMT\"0x8D72813C394A138\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "5d5f3fc1-ee99-4b09-b09e-885df8285015", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0889248b1d1f10885d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d049f8-501e-00c0-30fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "a437230d-bced-4cdb-9046-fa523259df99" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0889248b1d1f10885d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[3].json new file mode 100644 index 000000000000..8f34e8b64147 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring026145cb0208b94d38?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C3A4355E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04a20-501e-00c0-55fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "47a905aa-e15b-4326-b639-9af805162a24" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04a4a-501e-00c0-7dfc-59ba32000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring026145cb0208b94d38Fri, 23 Aug 2019 21:49:24 GMT\"0x8D72813C3A4355E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "b36a2e42-91e9-403b-9433-4fe09d4d4c9f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring026145cb0208b94d38?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04a67-501e-00c0-17fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "e6b61a44-c437-45d5-a4a2-7b5a3c0a6a46" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring026145cb0208b94d38" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[4].json new file mode 100644 index 000000000000..ad32087f73fc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0894550b7dd77a168b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C3B3543F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04a97-501e-00c0-44fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "b2e47805-5e33-4663-a3be-f53706d3dd16" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04ad6-501e-00c0-80fc-59ba32000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0894550b7dd77a168bFri, 23 Aug 2019 21:49:24 GMT\"0x8D72813C3B3543F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "1c24d98a-43b9-4e90-a28a-2798d3ac2c9d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0894550b7dd77a168b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04af5-501e-00c0-1cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "0abc1f47-b6f2-4d7b-bcbf-0503e47c7007" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0894550b7dd77a168b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[5].json new file mode 100644 index 000000000000..e99967823132 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0007912bae58db8074?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C3C1AF95\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04b26-501e-00c0-4bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "936e883e-ae95-4576-8839-3fabb5b1563a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04b49-501e-00c0-6afc-59ba32000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0007912bae58db8074Fri, 23 Aug 2019 21:49:24 GMT\"0x8D72813C3C1AF95\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "2c2fa0ff-401c-48f8-a34f-71dcc66b9836", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0007912bae58db8074?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04b5f-501e-00c0-7ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "63034bef-bd93-4f50-a1c8-9747475eb674" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0007912bae58db8074" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[6].json new file mode 100644 index 000000000000..7ee45b59c29d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0509585dc33a65c14e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C3D1B90B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04ba0-501e-00c0-40fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "238a7ae7-945e-405c-9a1d-6ffe1e916eae" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04bc4-501e-00c0-5cfc-59ba32000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0509585dc33a65c14eFri, 23 Aug 2019 21:49:25 GMT\"0x8D72813C3D1B90B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "8f599346-88fb-4a18-bc40-5b6e82f52c7a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0509585dc33a65c14e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04bea-501e-00c0-80fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "f1d416e9-6fdd-44d1-8345-40fe69d30e82" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0509585dc33a65c14e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[7].json new file mode 100644 index 000000000000..bdf88d863f92 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[7].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring039358af73cf2e64b6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C3E01466\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04c21-501e-00c0-2bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "04369d29-fbb4-4203-9685-4f6853a97ed9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04c41-501e-00c0-49fc-59ba32000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring039358af73cf2e64b6Fri, 23 Aug 2019 21:49:25 GMT\"0x8D72813C3E01466\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "c37df22a-07d0-47fe-9e6e-90268daa3a11", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring039358af73cf2e64b6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04c51-501e-00c0-59fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "4b2b4cd7-ce1a-4369-ab44-29726e200029" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring039358af73cf2e64b6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[8].json new file mode 100644 index 000000000000..dfb4b710f26d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[8].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring002763cc126dc90a8c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C3EF0C26\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04c6a-501e-00c0-72fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "fddf7532-23a5-4a41-82d3-f4f20f7edf57" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04c8a-501e-00c0-0efc-59ba32000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring002763cc126dc90a8cFri, 23 Aug 2019 21:49:25 GMT\"0x8D72813C3EF0C26\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "ec9dcf24-9136-4533-b1a8-9c289c67c4da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring002763cc126dc90a8c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04ca5-501e-00c0-26fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:24 GMT", + "x-ms-client-request-id" : "8c9a95cc-8707-4743-a3bb-4b0b14efc20a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring002763cc126dc90a8c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeia.json new file mode 100644 index 000000000000..a17a255fb4fb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeia.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeia0579865cb7c71786e34fc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C527FF82\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05676-501e-00c0-64fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "4d2dc1a5-b931-4692-abb7-699531a5785b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d056b9-501e-00c0-1dfc-59ba32000000", + "Body" : "jtcaccountsasresourcetypeiajtcaccountsasresourcetypeia0579865cb7c71786e34fcFri, 23 Aug 2019 21:49:27 GMT\"0x8D72813C527FF82\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "3cb40a8c-795d-43f2-b40b-4d628826cfd5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeia0579865cb7c71786e34fc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d056e7-501e-00c0-48fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "849f0b86-b085-4219-9a8d-aad5787bd519" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeia0579865cb7c71786e34fc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[0].json new file mode 100644 index 000000000000..adfc821024e1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0524564eb4d4493ba94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C4EA7246\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0546a-501e-00c0-20fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "82d4e24c-12ab-41c3-9ea7-f549dc7ae7f7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0548f-501e-00c0-3ffc-59ba32000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse0524564eb4d4493ba94Fri, 23 Aug 2019 21:49:26 GMT\"0x8D72813C4EA7246\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "4cd023d3-52cb-4fe2-87c9-385559348370", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0524564eb4d4493ba94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d054b7-501e-00c0-62fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "abe7ec44-7a14-4688-b598-194587ebd293" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse0524564eb4d4493ba94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[1].json new file mode 100644 index 000000000000..4e24f22641fc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse078455de7d2d4b6ddf4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C4F91BE3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d054e5-501e-00c0-0bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "00baee34-9f21-49f3-bd45-54c0cef8bf54" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05517-501e-00c0-32fc-59ba32000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse078455de7d2d4b6ddf4Fri, 23 Aug 2019 21:49:27 GMT\"0x8D72813C4F91BE3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "9280be1f-f28a-4b9c-95f5-43234bb8ee7a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse078455de7d2d4b6ddf4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0553f-501e-00c0-52fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "3c7b22ff-77d1-458f-8367-2ee6a99f6f15" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse078455de7d2d4b6ddf4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[2].json new file mode 100644 index 000000000000..d865e000438d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0988397123e9c6afb74?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C508B00B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05586-501e-00c0-0dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "c6923985-4577-4456-b8fc-32e57a3e1b93" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d055a8-501e-00c0-2dfc-59ba32000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse0988397123e9c6afb74Fri, 23 Aug 2019 21:49:27 GMT\"0x8D72813C508B00B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "2aeb415e-e91b-4f72-a468-288198ab7635", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0988397123e9c6afb74?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d055c9-501e-00c0-49fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "fc679a24-f020-46d7-9f66-667fcf200f7f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse0988397123e9c6afb74" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[3].json new file mode 100644 index 000000000000..3060815c69e4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse051826c5be18b593f14?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5173284\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d055fc-501e-00c0-78fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "b9792260-6294-43bd-a068-8ebc3fe24776" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0561e-501e-00c0-17fc-59ba32000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse051826c5be18b593f14Fri, 23 Aug 2019 21:49:27 GMT\"0x8D72813C5173284\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "6330fbd9-dd0e-428c-b90f-e56702dd13f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse051826c5be18b593f14?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0563c-501e-00c0-2dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "9de7b471-cb4b-4b3c-9223-5160d51ce446" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse051826c5be18b593f14" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[0].json new file mode 100644 index 000000000000..fd9fc19d6c68 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring076003b94840b024cd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C4A78C92\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05204-501e-00c0-7efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "718cfc83-563f-49b1-a1ab-0a5a7c0fd553" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05233-501e-00c0-27fc-59ba32000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring076003b94840b024cdFri, 23 Aug 2019 21:49:26 GMT\"0x8D72813C4A78C92\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "fd1421eb-d4ac-432f-9df3-4ca208e86d1f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring076003b94840b024cd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05251-501e-00c0-41fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "721c695b-f82c-4a00-b486-32bd2095534f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring076003b94840b024cd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[1].json new file mode 100644 index 000000000000..bcf714e8765e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring063597c0af80b1aae4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C4B720C0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05296-501e-00c0-7dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "d0f365a0-d70f-41d1-81aa-2f573413124e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d052bb-501e-00c0-1efc-59ba32000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring063597c0af80b1aae4Fri, 23 Aug 2019 21:49:26 GMT\"0x8D72813C4B720C0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:25 GMT", + "x-ms-client-request-id" : "cd154aba-220e-491b-8453-9ae4a16b24f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring063597c0af80b1aae4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d052e2-501e-00c0-41fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "bc9a0e0a-fde7-4dfd-b60b-8757b53f7b6e" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring063597c0af80b1aae4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[2].json new file mode 100644 index 000000000000..aabd3c25c005 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring039534aa94f50407d9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C4C5CA54\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0530e-501e-00c0-6afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "6417b68a-2ce2-4d48-bac7-a674f11bfae8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05346-501e-00c0-1afc-59ba32000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring039534aa94f50407d9Fri, 23 Aug 2019 21:49:26 GMT\"0x8D72813C4C5CA54\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "2e746e17-f6a3-44f4-a4a7-5e8478b2c3d0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring039534aa94f50407d9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05373-501e-00c0-42fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "cc45c8e4-ac84-47eb-97f9-8e969f3f6d50" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring039534aa94f50407d9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[3].json new file mode 100644 index 000000000000..d8a969ce93cf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring01302474826e900c91?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C4D4E93B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d053ae-501e-00c0-79fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "97511fb8-c193-4c90-9495-06f16cc657cf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d053d6-501e-00c0-1afc-59ba32000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring01302474826e900c91Fri, 23 Aug 2019 21:49:26 GMT\"0x8D72813C4D4E93B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "82696abf-0384-4dbc-a53b-fe11572a4c91", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring01302474826e900c91?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d053fd-501e-00c0-3ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "cf499e04-9d10-4ceb-a5f7-2c9af535519d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring01302474826e900c91" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[0].json new file mode 100644 index 000000000000..678d2b68f762 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign098194ea1eb9ff122?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C2BB715C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04331-501e-00c0-71fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "aa9e90ba-336c-413e-990e-6bcc9429805c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04367-501e-00c0-25fc-59ba32000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign098194ea1eb9ff122Fri, 23 Aug 2019 21:49:23 GMT\"0x8D72813C2BB715C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "fda63c2b-6de9-462d-a102-6524d63a90a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign098194ea1eb9ff122?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04397-501e-00c0-51fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "369a1728-778f-4cad-b6ef-5230c31f7c23" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign098194ea1eb9ff122" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[1].json new file mode 100644 index 000000000000..38a75da4672d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign061523db492138fef?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C2DF2EBE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04465-501e-00c0-13fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "c28c3d9a-9bd1-4c86-bf8f-95749bc48f3d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04497-501e-00c0-43fc-59ba32000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign061523db492138fefFri, 23 Aug 2019 21:49:23 GMT\"0x8D72813C2DF2EBE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "33e1a08a-d662-4ff9-aecf-4bf7fe9e1852", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign061523db492138fef?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d044b2-501e-00c0-5efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "bb9b7cd9-fd6f-4d9c-ac2a-f4d03b21b0bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign061523db492138fef" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[2].json new file mode 100644 index 000000000000..5178b667ecaa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign071222afbc749f557?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C2EDFF60\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d044d6-501e-00c0-80fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "55b198c5-7085-4d82-8b92-f71e96f1b876" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d044fc-501e-00c0-22fc-59ba32000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign071222afbc749f557Fri, 23 Aug 2019 21:49:23 GMT\"0x8D72813C2EDFF60\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "3bc97537-577e-47a6-994b-6e0001cd8dad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign071222afbc749f557?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04511-501e-00c0-35fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "6c397ee3-6133-4164-bb17-c293e7a654c8" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign071222afbc749f557" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[0].json new file mode 100644 index 000000000000..a964741862e6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0900505c2c6992f1794?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C2FD455A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0453c-501e-00c0-5efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "13711863-71d3-44a3-a750-8a7121de837a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0455f-501e-00c0-7efc-59ba32000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0900505c2c6992f1794Fri, 23 Aug 2019 21:49:23 GMT\"0x8D72813C2FD455A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "e5a47903-70de-4408-ade4-ba79567a7bdc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0900505c2c6992f1794?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04586-501e-00c0-22fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "cad8d03b-746f-41f8-882a-b2dfb1dc6491" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0900505c2c6992f1794" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[1].json new file mode 100644 index 000000000000..03d4efe25751 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia05321952b1d78376704?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C30BEEF3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d045b2-501e-00c0-4bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "ae34bc3a-4f73-4f73-a3c4-9c10ee3282e8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d045d3-501e-00c0-69fc-59ba32000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia05321952b1d78376704Fri, 23 Aug 2019 21:49:23 GMT\"0x8D72813C30BEEF3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "532a1646-213d-463f-b723-3b0d1e32d714", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia05321952b1d78376704?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d045ee-501e-00c0-03fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "788309ae-fc70-44ef-93b9-1d8301726a4d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia05321952b1d78376704" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[2].json new file mode 100644 index 000000000000..1adf0682fa60 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0667407beba27f6a964?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C31A9887\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0460a-501e-00c0-1ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "ceafd641-a331-424a-8119-098020ca3fa7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04630-501e-00c0-3dfc-59ba32000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0667407beba27f6a964Fri, 23 Aug 2019 21:49:23 GMT\"0x8D72813C31A9887\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "82aa3d59-9867-46c9-b72c-468faf88b12d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0667407beba27f6a964?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0464e-501e-00c0-5afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "81556e31-f2c8-42fe-a6f7-fde902811892" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0667407beba27f6a964" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[3].json new file mode 100644 index 000000000000..481bc48807f3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia028110f32755d8940c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C329B765\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04678-501e-00c0-02fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "c78e7065-67a2-489d-b755-ce3d3f64ad43" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d046b6-501e-00c0-39fc-59ba32000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia028110f32755d8940c4Fri, 23 Aug 2019 21:49:23 GMT\"0x8D72813C329B765\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "0365d894-a566-4259-b95f-e23bf6b5cb91", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia028110f32755d8940c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d046ea-501e-00c0-68fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "ab771489-cf89-4902-bd68-309cf6bad1de" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia028110f32755d8940c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[4].json new file mode 100644 index 000000000000..a44dd9aeebcb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0944892ac2a54e77004?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C34D74C3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d047b1-501e-00c0-19fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "f5bbd303-adf8-4a3d-8b84-2c83ef9dbc7e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d047d8-501e-00c0-3bfc-59ba32000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0944892ac2a54e77004Fri, 23 Aug 2019 21:49:24 GMT\"0x8D72813C34D74C3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "8fcf5a66-b4a2-4e87-816c-dcd454a46f75", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0944892ac2a54e77004?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d047e8-501e-00c0-4bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "cb98ee48-f4dd-4889-9bda-118082ba39f1" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0944892ac2a54e77004" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[5].json new file mode 100644 index 000000000000..943e8f25dd19 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0985626dff0c957a614?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C35C4572\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0481a-501e-00c0-75fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "e1fe06ac-4330-46ef-afac-b9893db6a22f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04835-501e-00c0-0dfc-59ba32000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0985626dff0c957a614Fri, 23 Aug 2019 21:49:24 GMT\"0x8D72813C35C4572\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "e71bf223-ea90-4f71-b73f-eb589835d8ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0985626dff0c957a614?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04857-501e-00c0-2cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:23 GMT", + "x-ms-client-request-id" : "c3b91206-209f-4883-9145-33efd9c0a9b0" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0985626dff0c957a614" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[0].json new file mode 100644 index 000000000000..d1f1da8aff44 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrangec24651971aa2094dbaf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BD404840\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01f47-501e-00c0-7bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "d3ded137-f3eb-4580-ab05-38223b5ef386" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01fa7-501e-00c0-4cfc-59ba32000000", + "Body" : "jtcblobrangejtcblobrange0helpertestblobrangec24651971aa2094dbafFri, 23 Aug 2019 21:49:14 GMT\"0x8D72813BD404840\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "9ac1e42d-8132-41f6-9974-ac8f8a451dbb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrangec24651971aa2094dbaf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01fc9-501e-00c0-67fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "6a1f59bb-30fa-4af1-9aca-3be4dff1dd2e" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0helpertestblobrangec24651971aa2094dbaf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[1].json new file mode 100644 index 000000000000..4f568be40307 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrange2d705952e2fae756f4e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BD5B02B8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01ffb-501e-00c0-11fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "4b8434ae-e9ce-4989-a5c1-2cb0fd24ebe6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02018-501e-00c0-2afc-59ba32000000", + "Body" : "jtcblobrangejtcblobrange0helpertestblobrange2d705952e2fae756f4eFri, 23 Aug 2019 21:49:14 GMT\"0x8D72813BD5B02B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "7ce9eb7b-286b-4947-a8a3-52592923f2b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrange2d705952e2fae756f4e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02036-501e-00c0-46fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "dab14c2a-f759-4b6d-b1b7-4f23ec9e3d3f" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0helpertestblobrange2d705952e2fae756f4e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[2].json new file mode 100644 index 000000000000..0b77babd8e32 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrange4195711308983804d4d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BD6FA132\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0206e-501e-00c0-7afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "3c7d3fb3-f81c-4632-ad87-27bbc118a343" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02086-501e-00c0-0ffc-59ba32000000", + "Body" : "jtcblobrangejtcblobrange0helpertestblobrange4195711308983804d4dFri, 23 Aug 2019 21:49:14 GMT\"0x8D72813BD6FA132\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "de403855-c48a-479c-b118-0f9257b93518", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0helpertestblobrange4195711308983804d4d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0209d-501e-00c0-23fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "a6c58185-d7e9-4bb6-949c-b09d418c938c" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0helpertestblobrange4195711308983804d4d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[0].json new file mode 100644 index 000000000000..701a40393c9e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeia35087227d5d30d1ef?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BD7DFC93\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d020bb-501e-00c0-40fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "72094235-11ae-421a-b545-ae1012692e54" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobrangeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d020d6-501e-00c0-56fc-59ba32000000", + "Body" : "jtcblobrangeiajtcblobrangeia0helpertestblobrangeia35087227d5d30d1efFri, 23 Aug 2019 21:49:14 GMT\"0x8D72813BD7DFC93\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "178e9bfd-78f2-4670-845d-fa20fe3ae1d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeia35087227d5d30d1ef?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d020ed-501e-00c0-6cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "1a3b2dbc-4604-4a9c-937e-9943a1142d0f" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0helpertestblobrangeia35087227d5d30d1ef" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[1].json new file mode 100644 index 000000000000..94cdbff84e8f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeia5aa713776eaa5254a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BD8D1B72\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02114-501e-00c0-10fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "f750b143-5655-44d5-9d8b-7a945cc30783" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobrangeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02137-501e-00c0-2cfc-59ba32000000", + "Body" : "jtcblobrangeiajtcblobrangeia0helpertestblobrangeia5aa713776eaa5254aFri, 23 Aug 2019 21:49:14 GMT\"0x8D72813BD8D1B72\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "586d17e6-1a5b-4223-adcf-a7250a8cb877", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeia5aa713776eaa5254a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02151-501e-00c0-45fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "836b6906-ffdd-4e66-8b98-3002b2214f12" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0helpertestblobrangeia5aa713776eaa5254a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[0].json new file mode 100644 index 000000000000..9af8f990c068 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse084053d5172ae460234ff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C0AFDF8E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0346b-501e-00c0-78fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "b594d283-afa2-443e-9e0a-48f195282628" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03499-501e-00c0-22fc-59ba32000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse084053d5172ae460234ffFri, 23 Aug 2019 21:49:19 GMT\"0x8D72813C0AFDF8E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "0ce086f5-8ed5-46d8-89ea-173d038b0640", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse084053d5172ae460234ff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d034b4-501e-00c0-38fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "10293332-9e3e-41cd-8417-a543129cb378" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse084053d5172ae460234ff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[1].json new file mode 100644 index 000000000000..b20d43d57ae0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse03228086df2660117d49e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C0BE8917\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d034d9-501e-00c0-5bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "a7e717a2-8844-44db-8244-20ef4d87ccb7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d034fa-501e-00c0-7afc-59ba32000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse03228086df2660117d49eFri, 23 Aug 2019 21:49:19 GMT\"0x8D72813C0BE8917\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "32a2251d-d9ff-4fb1-adbd-fb479435198e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse03228086df2660117d49e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03519-501e-00c0-15fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "c70fcc31-4e41-4f96-acfc-abc739e84f09" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse03228086df2660117d49e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[2].json new file mode 100644 index 000000000000..9a91a88876c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse057054f6b4b9165ec5416?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C0CDCF10\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03541-501e-00c0-3dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "45894c8d-1edb-45c6-ba75-b160c109e86c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0356c-501e-00c0-64fc-59ba32000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse057054f6b4b9165ec5416Fri, 23 Aug 2019 21:49:20 GMT\"0x8D72813C0CDCF10\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "11a646ca-52da-4fc1-a477-8fab24a23257", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse057054f6b4b9165ec5416?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03589-501e-00c0-7dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "0269256e-3536-4663-947b-27b346485a49" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse057054f6b4b9165ec5416" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[3].json new file mode 100644 index 000000000000..723808b80b61 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0072961f7a1219c53a406?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C0DD3C1F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d035bc-501e-00c0-2bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "32c34d45-53d4-4b57-b950-00ac37487b86" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d035d9-501e-00c0-47fc-59ba32000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0072961f7a1219c53a406Fri, 23 Aug 2019 21:49:20 GMT\"0x8D72813C0DD3C1F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "bf2218b4-cc10-49eb-a5c8-f02902e506cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0072961f7a1219c53a406?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d035f7-501e-00c0-61fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "ec3e6724-2681-49ba-91d8-0289de8a8bb8" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0072961f7a1219c53a406" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[4].json new file mode 100644 index 000000000000..1ec3d2e5e5e4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0258458d061edc25a9481?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C0ECA925\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03624-501e-00c0-09fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "6b0a220b-1949-4443-8c09-9c0ff982469c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03640-501e-00c0-22fc-59ba32000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0258458d061edc25a9481Fri, 23 Aug 2019 21:49:20 GMT\"0x8D72813C0ECA925\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "15f3d916-d9d2-480f-b650-afd0ed12ed49", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0258458d061edc25a9481?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03657-501e-00c0-38fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "0671d34f-13a2-4632-8277-04651b1e7b4d" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0258458d061edc25a9481" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[5].json new file mode 100644 index 000000000000..a6f802c71788 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0567701b50a2157498449?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C0FC1639\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03689-501e-00c0-66fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "59c5a3db-c524-4480-9dc5-f7790ab3f89c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d036ae-501e-00c0-0afc-59ba32000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0567701b50a2157498449Fri, 23 Aug 2019 21:49:20 GMT\"0x8D72813C0FC1639\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "8881bdb0-a54e-4bc9-bef4-ede30f75275c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0567701b50a2157498449?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d036cc-501e-00c0-27fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "2e4be269-d297-4b1d-9268-0c65814fba66" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0567701b50a2157498449" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[6].json new file mode 100644 index 000000000000..e71b49c946a0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0870884b54734109094c7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C10A718F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d036fc-501e-00c0-53fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "a1f4d197-0623-44e2-b785-32a3c2743a87" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03721-501e-00c0-73fc-59ba32000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0870884b54734109094c7Fri, 23 Aug 2019 21:49:20 GMT\"0x8D72813C10A718F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "54bc3028-e5c2-4c09-bf0c-839600a62f88", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0870884b54734109094c7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0373f-501e-00c0-0cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "ba0754af-10c4-4fe9-af24-57143f543652" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0870884b54734109094c7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparseia.json new file mode 100644 index 000000000000..a3be06ef78cb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparseia.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparseia0750786c8568dbe1c249?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C11A05B6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03766-501e-00c0-2ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "5e1abd80-0cf0-4c53-81fc-c44703bbd1b6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparseia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03789-501e-00c0-4efc-59ba32000000", + "Body" : "jtcblobsaspermissionsparseiajtcblobsaspermissionsparseia0750786c8568dbe1c249Fri, 23 Aug 2019 21:49:20 GMT\"0x8D72813C11A05B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "dbdec965-6d6f-4f2a-8b76-5c9222a86de8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparseia0750786c8568dbe1c249?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d037ad-501e-00c0-6ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "2441a21b-4b42-4e4d-a98d-3444d3fa8950" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparseia0750786c8568dbe1c249" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[0].json new file mode 100644 index 000000000000..d353df3c9341 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring066601c8413b2cbada4a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C0448080\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d031b0-501e-00c0-04fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "81e32e2e-c07b-420e-a7ac-76d18ac7dfc3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d031c6-501e-00c0-18fc-59ba32000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring066601c8413b2cbada4aFri, 23 Aug 2019 21:49:19 GMT\"0x8D72813C0448080\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "d0e9dbce-308f-4ddc-ae6a-4bd78ce5e97f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring066601c8413b2cbada4a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d031db-501e-00c0-2bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "481e4b98-8a22-4db5-a7b7-5b22c9321d85" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring066601c8413b2cbada4a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[1].json new file mode 100644 index 000000000000..5e006e0c019a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0368414479a01766c84d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C052DBDC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03200-501e-00c0-4ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "1c995b87-9f08-4aac-964a-bbd6a47697d6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03223-501e-00c0-6efc-59ba32000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring0368414479a01766c84dFri, 23 Aug 2019 21:49:19 GMT\"0x8D72813C052DBDC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "1dc74de5-910e-414d-94db-5e51daa4e33c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0368414479a01766c84d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03246-501e-00c0-0bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "9a73528d-3974-4019-b113-300f8a30d0e6" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring0368414479a01766c84d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[2].json new file mode 100644 index 000000000000..be700c67ee00 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring077127ce23c442e59a48?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C0629725\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0327c-501e-00c0-3dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "26db0837-4c41-4913-9190-7641506c68ca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d032a0-501e-00c0-5cfc-59ba32000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring077127ce23c442e59a48Fri, 23 Aug 2019 21:49:19 GMT\"0x8D72813C0629725\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "c4ed63c8-5d8c-4e5b-b566-f54a84542afe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring077127ce23c442e59a48?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d032bc-501e-00c0-74fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "f6b42151-b134-4282-82b1-5bd31ea030e7" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring077127ce23c442e59a48" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[3].json new file mode 100644 index 000000000000..d0a723ca08dd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring098505e9fe5b0929274e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C07167D5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d032e3-501e-00c0-16fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "ea09d0b8-0705-4698-8415-9f6dc1c14104" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d032fd-501e-00c0-2cfc-59ba32000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring098505e9fe5b0929274eFri, 23 Aug 2019 21:49:19 GMT\"0x8D72813C07167D5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "0f3709d6-dea2-45e6-b4cc-615be0c34667", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring098505e9fe5b0929274e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0330e-501e-00c0-3dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "d3c63d96-d567-41f3-b50d-2d4b2392afc9" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring098505e9fe5b0929274e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[4].json new file mode 100644 index 000000000000..0f8cbf5014cf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0687802db74010393d4e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C080387C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03331-501e-00c0-60fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "a129870a-86d1-4e2b-b2ef-6b6753a5972d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0334a-501e-00c0-75fc-59ba32000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring0687802db74010393d4eFri, 23 Aug 2019 21:49:19 GMT\"0x8D72813C080387C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "f221f4c4-7ca3-458a-a5a9-feb86b5dc17a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0687802db74010393d4e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03366-501e-00c0-0efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "349cbbc3-27d6-4c98-955a-7bcb3bdeb8ea" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring0687802db74010393d4e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[5].json new file mode 100644 index 000000000000..7bdf35f2c2a4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring025753c4afffefafc24f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C09FD614\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03409-501e-00c0-21fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "fbbaa086-8af8-48f6-a227-ef7aa570a430" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0341f-501e-00c0-35fc-59ba32000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring025753c4afffefafc24fFri, 23 Aug 2019 21:49:19 GMT\"0x8D72813C09FD614\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "449f14e4-269f-4b1d-bff0-76fd823fdef4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring025753c4afffefafc24f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0343e-501e-00c0-4ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:19 GMT", + "x-ms-client-request-id" : "b54296fd-f5b5-410c-aa6b-8bf3c56b8f3a" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring025753c4afffefafc24f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestbloburlparts.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestbloburlparts.json new file mode 100644 index 000000000000..7ebab1fb9c46 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestbloburlparts.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbloburlparts0helpertestbloburlparts1606301127846bef?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C536A916\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0571a-501e-00c0-77fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "55ef7be5-0bd3-4c7f-a1bf-73d7fda73ead" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbloburlparts&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05753-501e-00c0-2cfc-59ba32000000", + "Body" : "jtcbloburlpartsjtcbloburlparts0helpertestbloburlparts1606301127846befFri, 23 Aug 2019 21:49:27 GMT\"0x8D72813C536A916\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "5d4f9d37-7bb9-46cd-9286-ad3d877b06d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbloburlparts0helpertestbloburlparts1606301127846bef?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0577e-501e-00c0-53fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "f13c4be9-d8f5-420e-aea3-4e58d3f5aa3c" + }, + "Exception" : null + } ], + "variables" : [ "jtcbloburlparts0helpertestbloburlparts1606301127846bef" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[0].json new file mode 100644 index 000000000000..c53276f49814 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0932990fa9f4e3073e4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C1AC0913\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03b9f-501e-00c0-7bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "7b7849c1-89eb-481c-95f6-022cdea58070" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03bc6-501e-00c0-1efc-59ba32000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0932990fa9f4e3073e4Fri, 23 Aug 2019 21:49:21 GMT\"0x8D72813C1AC0913\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "77acf567-9daa-40f8-ae3f-f335477638a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0932990fa9f4e3073e4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03be7-501e-00c0-3ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "3ffc0600-108c-4f2b-84e0-bdcf17385082" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0932990fa9f4e3073e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[1].json new file mode 100644 index 000000000000..863214e5511b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse063049ace764debaf34?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C1BB27F1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03c0d-501e-00c0-65fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "3a6cf378-bf95-40fa-a6a6-bb83bacfea0b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03c31-501e-00c0-06fc-59ba32000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse063049ace764debaf34Fri, 23 Aug 2019 21:49:21 GMT\"0x8D72813C1BB27F1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "532abd24-2b47-4b81-ba8c-5a6e89e8f3d4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse063049ace764debaf34?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03c45-501e-00c0-17fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "e334fa83-3c94-4fd3-a360-efd18cc2a25a" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse063049ace764debaf34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[2].json new file mode 100644 index 000000000000..06f0636ad243 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse093814fb87ed73eb354?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C1C9AA77\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03c69-501e-00c0-36fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "8390ddd8-72e2-4c36-96d7-8f357cbf1cab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03ca1-501e-00c0-68fc-59ba32000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse093814fb87ed73eb354Fri, 23 Aug 2019 21:49:21 GMT\"0x8D72813C1C9AA77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "ec359185-eb14-462d-bc1c-c6063470bb69", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse093814fb87ed73eb354?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03cb9-501e-00c0-7dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "5de0dc7b-ef7b-4554-8926-1b12752209ac" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse093814fb87ed73eb354" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[3].json new file mode 100644 index 000000000000..7e8b51c64dac --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse02245031cd80feb6664?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C1EC7D32\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03d51-501e-00c0-03fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "e0e09cd5-854c-4449-a123-c021bc08031e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03d82-501e-00c0-31fc-59ba32000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse02245031cd80feb6664Fri, 23 Aug 2019 21:49:21 GMT\"0x8D72813C1EC7D32\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "8e92e26c-80fc-445d-bfb5-80f7a04aae95", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse02245031cd80feb6664?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03d9a-501e-00c0-48fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "2405318e-a01a-448f-8b04-8ad496a210bf" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse02245031cd80feb6664" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[4].json new file mode 100644 index 000000000000..d4110bcf2ffb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0590157be521c3aa844?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C1FB4DD8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03dcd-501e-00c0-77fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "fc50db82-87b2-422a-866e-29355cf20354" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03ddf-501e-00c0-08fc-59ba32000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0590157be521c3aa844Fri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C1FB4DD8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "35db3736-76ca-45fa-9923-489fd1f22628", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0590157be521c3aa844?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03e11-501e-00c0-34fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "c5a28f28-6a8b-4639-89f9-279b10aeb96c" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0590157be521c3aa844" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[5].json new file mode 100644 index 000000000000..b31f5f504e40 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse009019549ec30ea6ce4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C209F768\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03e44-501e-00c0-64fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "8669d4a8-e991-44e9-9f1d-15cfab5ce7f7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03e61-501e-00c0-7ffc-59ba32000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse009019549ec30ea6ce4Fri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C209F768\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "51aa1588-4538-4fd1-be83-420eade03536", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse009019549ec30ea6ce4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03e81-501e-00c0-1dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "daf5f6c8-05bf-4979-9f4a-f65afb0151a5" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse009019549ec30ea6ce4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[6].json new file mode 100644 index 000000000000..e6088eb6c600 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse020327494f2b0a8c4b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C21852D2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03ea7-501e-00c0-41fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "e4a1957e-f0fc-455a-bd36-2d1ad8f0818e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03ec8-501e-00c0-60fc-59ba32000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse020327494f2b0a8c4b4Fri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C21852D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "ec4cd15b-28db-4a7c-b087-5f8bc21fceff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse020327494f2b0a8c4b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03ee4-501e-00c0-7bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "1213e889-7a65-457e-976d-d5a495460994" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse020327494f2b0a8c4b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[7].json new file mode 100644 index 000000000000..8fa5f42fb886 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[7].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse029070d57427dfb2a04?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C2272379\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03f05-501e-00c0-1bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "faa12670-71a4-46dd-a526-d4f8230ebcdf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03f28-501e-00c0-3bfc-59ba32000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse029070d57427dfb2a04Fri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C2272379\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "57d75d5e-95e2-46f9-aab5-dbbce6a6bc80", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse029070d57427dfb2a04?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03f4b-501e-00c0-5dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "3a66bb4b-f498-4aa3-9b00-c52260ec2864" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse029070d57427dfb2a04" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparseia.json new file mode 100644 index 000000000000..10e3e7b5cd53 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparseia.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparseia074073cd0413105927?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C2361B49\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03f72-501e-00c0-03fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "5c2f4e89-a0c2-4e7d-affc-b2f4d371f6c7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparseia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03f9a-501e-00c0-26fc-59ba32000000", + "Body" : "jtccontainersaspermissionsparseiajtccontainersaspermissionsparseia074073cd0413105927Fri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C2361B49\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "f675ae35-6476-45d0-a953-7d07feb93399", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparseia074073cd0413105927?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03fa8-501e-00c0-34fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "2e9f84d9-e926-4fc9-bff6-cb7b61d1ead0" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparseia074073cd0413105927" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[0].json new file mode 100644 index 000000000000..1407b25f7f7e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring08594457bcce15971?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C136E38A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03837-501e-00c0-6efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "2cd9a883-260f-4df0-ab6d-ffca0a92f795" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03865-501e-00c0-17fc-59ba32000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring08594457bcce15971Fri, 23 Aug 2019 21:49:20 GMT\"0x8D72813C136E38A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "a25fc64e-71e1-478d-8ac3-98670c5ac9bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring08594457bcce15971?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03881-501e-00c0-30fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "6466108c-d37a-4315-ba13-ce8620d98f4a" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring08594457bcce15971" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[1].json new file mode 100644 index 000000000000..72b3dc194366 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring060829cdfd27e9963?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C147D7A8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d038be-501e-00c0-61fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "36e731ce-e26b-44f1-98d6-2aa61cbdc3c2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d038f4-501e-00c0-11fc-59ba32000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring060829cdfd27e9963Fri, 23 Aug 2019 21:49:20 GMT\"0x8D72813C147D7A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "e4349a1b-1944-47f5-b6a4-d7da74209c45", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring060829cdfd27e9963?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0390f-501e-00c0-2afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "e37d4890-4f2d-4e7a-8d73-5a2efd935287" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring060829cdfd27e9963" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[2].json new file mode 100644 index 000000000000..ec513e0425fa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0868168fd5b5fae09?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C1563305\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0393e-501e-00c0-57fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "65ecf47a-9343-40a2-b140-dac23390aab6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03977-501e-00c0-0dfc-59ba32000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0868168fd5b5fae09Fri, 23 Aug 2019 21:49:20 GMT\"0x8D72813C1563305\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "b86db92b-4158-4348-82ec-976e4a321307", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0868168fd5b5fae09?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0398e-501e-00c0-24fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "775bee21-6a7c-4f8b-b231-e1a1a1b0cf22" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0868168fd5b5fae09" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[3].json new file mode 100644 index 000000000000..568057926931 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring039398ac5422b31ea?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C16ECA13\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03a00-501e-00c0-09fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "19e424bb-fff5-498f-9adf-555a5b1ee3b1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03a19-501e-00c0-1ffc-59ba32000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring039398ac5422b31eaFri, 23 Aug 2019 21:49:21 GMT\"0x8D72813C16ECA13\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "01039cb6-71a8-422c-ab41-fcd25c243c54", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring039398ac5422b31ea?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03a38-501e-00c0-3afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "027c4b38-5579-4d74-aa91-e98e837d9c73" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring039398ac5422b31ea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[4].json new file mode 100644 index 000000000000..89de6789597b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring034985332771b102e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C17D2574\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03a69-501e-00c0-67fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "a5513593-0d08-44bc-8e33-0b53451897b4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03a8b-501e-00c0-05fc-59ba32000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring034985332771b102eFri, 23 Aug 2019 21:49:21 GMT\"0x8D72813C17D2574\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "e36e32b1-2a6a-4346-a831-aec2fb237e29", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring034985332771b102e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03aa6-501e-00c0-1afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "96df2227-7dbe-4371-86c7-3c59bfd6aebf" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring034985332771b102e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[5].json new file mode 100644 index 000000000000..ae7af2e1631d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring011090013b045da53?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C18CB99C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03ad3-501e-00c0-42fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "6bda9f69-9400-411e-9a2b-b27c145f3967" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03b04-501e-00c0-6efc-59ba32000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring011090013b045da53Fri, 23 Aug 2019 21:49:21 GMT\"0x8D72813C18CB99C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "c8409033-e7c4-4154-bc47-f50bb19b46fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring011090013b045da53?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03b1f-501e-00c0-06fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "7d18efe5-d913-409a-89f5-e9df0993659d" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring011090013b045da53" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[6].json new file mode 100644 index 000000000000..a6c906b53f52 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring024251f754820fd0f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C19D5F7F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03b3f-501e-00c0-21fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "a045fed7-a510-4bee-91ab-eae666ae9ed0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03b5a-501e-00c0-3afc-59ba32000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring024251f754820fd0fFri, 23 Aug 2019 21:49:21 GMT\"0x8D72813C19D5F7F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "91837ad8-8143-497e-8a41-296e4e21ef97", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring024251f754820fd0f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03b7a-501e-00c0-59fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:20 GMT", + "x-ms-client-request-id" : "b1ac958c-3171-4e02-89ea-e3b17b9a1583" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring024251f754820fd0f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[0].json new file mode 100644 index 000000000000..1c3880b0d927 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparsedbf227818bbe1ddc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C2710FC7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04102-501e-00c0-6ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "42337155-c5e3-4145-8d22-ed9e13b7afc0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04126-501e-00c0-0ffc-59ba32000000", + "Body" : "jtciprangeparsejtciprangeparse0helpertestiprangeparsedbf227818bbe1ddcFri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C2710FC7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "37fa0819-c068-4097-a106-f19902c23c43", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparsedbf227818bbe1ddc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04149-501e-00c0-30fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "111d2d01-dd91-498f-80af-5c350d1b3165" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0helpertestiprangeparsedbf227818bbe1ddc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[1].json new file mode 100644 index 000000000000..090d2397c97e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparse0650470871039977?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C28055C2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04180-501e-00c0-64fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "bb7fee19-ff68-4403-b18d-2aee7db8a569" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04194-501e-00c0-77fc-59ba32000000", + "Body" : "jtciprangeparsejtciprangeparse0helpertestiprangeparse0650470871039977Fri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C28055C2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "40f7c8b8-292d-4301-9b1e-49972dafbc5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparse0650470871039977?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d041ae-501e-00c0-0efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "f142b856-d390-4c46-9b21-9d3912980e58" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0helpertestiprangeparse0650470871039977" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[2].json new file mode 100644 index 000000000000..6c9cf1705e0a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparse74c49122608f31d7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C28EB123\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d041d0-501e-00c0-2dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "99a05818-483a-4c30-9138-3ed8cbdb14e2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04201-501e-00c0-58fc-59ba32000000", + "Body" : "jtciprangeparsejtciprangeparse0helpertestiprangeparse74c49122608f31d7Fri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C28EB123\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "6639e101-f40c-45c4-b750-f7be9aab427a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0helpertestiprangeparse74c49122608f31d7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0421f-501e-00c0-75fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "47308e5f-008c-46cf-8103-868e4f412678" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0helpertestiprangeparse74c49122608f31d7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[0].json new file mode 100644 index 000000000000..14ad2a0f08aa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringd495583177a43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C2449DBC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03fc7-501e-00c0-4ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "3ac22d9a-9477-4f05-a402-e7c1136be619" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03fe3-501e-00c0-69fc-59ba32000000", + "Body" : "jtciprangetostringjtciprangetostring0helpertestiprangetostringd495583177a43Fri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C2449DBC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "7b7ce39f-dd77-4b99-b1ec-95836d87c722", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringd495583177a43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04002-501e-00c0-03fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "2d04dc0a-cf97-4259-84d9-7731d2d25d94" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0helpertestiprangetostringd495583177a43" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[1].json new file mode 100644 index 000000000000..35a89cf1b1fd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostring402441081c2c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C2532039\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d04031-501e-00c0-2ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "31e58a41-445e-44ff-bc8f-e89a064becb6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04050-501e-00c0-4dfc-59ba32000000", + "Body" : "jtciprangetostringjtciprangetostring0helpertestiprangetostring402441081c2c6Fri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C2532039\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "a4b9078d-87ff-4540-bc14-215655e55608", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostring402441081c2c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04077-501e-00c0-70fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:21 GMT", + "x-ms-client-request-id" : "d60fc291-55c3-4cdd-bd14-e2e5ea6b5bac" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0helpertestiprangetostring402441081c2c6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[2].json new file mode 100644 index 000000000000..74f227d82761 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringf4f251532c69c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C261A2B1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0409e-501e-00c0-13fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "e24fe19b-9c87-4ba0-9d80-e9e878c66d4b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d040c0-501e-00c0-33fc-59ba32000000", + "Body" : "jtciprangetostringjtciprangetostring0helpertestiprangetostringf4f251532c69cFri, 23 Aug 2019 21:49:22 GMT\"0x8D72813C261A2B1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "8c18908c-eeea-4204-bb1d-d5bf0e2e52c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringf4f251532c69c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d040d9-501e-00c0-4bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "915f92f5-78c0-4414-83bf-bf0299cdf856" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0helpertestiprangetostringf4f251532c69c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestrequestproperty.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestrequestproperty.json new file mode 100644 index 000000000000..c33b174f8ac3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestrequestproperty.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrequestproperty0helpertestrequestproperty94641208db749?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BD31C5D1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d01ed6-501e-00c0-17fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "b850c150-c317-4f73-b3f4-02364ff5fa4e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrequestproperty0helpertestrequestproperty94641208db749?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01ef6-501e-00c0-35fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "deb596df-688a-4003-a7e3-444f1e069f64" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrequestproperty&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d01f17-501e-00c0-4ffc-59ba32000000", + "Body" : "jtcrequestproperty", + "Date" : "Fri, 23 Aug 2019 21:49:13 GMT", + "x-ms-client-request-id" : "38588cfc-baab-4943-a671-6e1af9d6f3d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcrequestproperty0helpertestrequestproperty94641208db749" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[0].json new file mode 100644 index 000000000000..9f002fcb75a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparseb80710751c3e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C29D81D2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0425c-501e-00c0-2dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "fa47117d-f2c1-4c5a-9120-fff028edf882" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsasprotocolparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0427e-501e-00c0-4cfc-59ba32000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0helpertestsasprotocolparseb80710751c3eFri, 23 Aug 2019 21:49:23 GMT\"0x8D72813C29D81D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "2a4a1985-8598-4069-9bca-782d403b8ba1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparseb80710751c3e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04298-501e-00c0-62fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "3bcf2623-5d36-45dd-ad12-b5024d08e965" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0helpertestsasprotocolparseb80710751c3e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[1].json new file mode 100644 index 000000000000..d4997bb2c808 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparseaa8801273afe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C2AC7995\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d042c1-501e-00c0-06fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "d7c05a70-5f73-47ca-a9a9-334981452116" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsasprotocolparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d042e9-501e-00c0-2dfc-59ba32000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0helpertestsasprotocolparseaa8801273afeFri, 23 Aug 2019 21:49:23 GMT\"0x8D72813C2AC7995\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "c4e22d2b-0a83-4c56-ae30-b80a20208c31", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparseaa8801273afe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d04303-501e-00c0-46fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:22 GMT", + "x-ms-client-request-id" : "14f7d5a4-e087-4dfe-a526-ff8eaefe953b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0helpertestsasprotocolparseaa8801273afe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[0].json new file mode 100644 index 000000000000..0c8ac9e278d9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0397377d751f80985?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BDDCFC7E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02336-501e-00c0-72fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "45cfbdc4-298c-4f2d-9f12-009a2af2c621" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0234d-501e-00c0-07fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0397377d751f80985Fri, 23 Aug 2019 21:49:15 GMT\"0x8D72813BDDCFC7E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "47c69202-3968-4d08-a34a-00aed6cfb74c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0397377d751f80985?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0236e-501e-00c0-24fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "e4ba91f7-37fd-4c8b-a657-765901291ad2" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0397377d751f80985" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[10].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[10].json new file mode 100644 index 000000000000..73a20c2fc525 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[10].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign007330dde240224db?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BE85736B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02736-501e-00c0-08fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "1778f0b6-1b08-43a8-82a5-d9fc5106a882" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02769-501e-00c0-34fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign007330dde240224dbFri, 23 Aug 2019 21:49:16 GMT\"0x8D72813BE85736B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "85732d54-451f-43a0-a7b9-463e54db721c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign007330dde240224db?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0277e-501e-00c0-46fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "034bcf45-8ff3-477a-906e-54157891a158" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign007330dde240224db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[11].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[11].json new file mode 100644 index 000000000000..14695207951c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[11].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0044294fcfa930744?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BE966781\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d027a1-501e-00c0-66fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "7c0a5b1d-9764-4866-b028-265685abc856" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d027b7-501e-00c0-7bfc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0044294fcfa930744Fri, 23 Aug 2019 21:49:16 GMT\"0x8D72813BE966781\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "f513974d-a080-4282-aac6-828d242283c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0044294fcfa930744?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d027cc-501e-00c0-10fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "8d914608-8d50-48f4-bc6c-eabc5303eeda" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0044294fcfa930744" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[1].json new file mode 100644 index 000000000000..7fad812da6c1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign04872315078de2d82?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BDEC4271\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0239b-501e-00c0-4afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "35901ba6-9818-435d-8ff4-beedf70d5539" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d023b0-501e-00c0-5dfc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign04872315078de2d82Fri, 23 Aug 2019 21:49:15 GMT\"0x8D72813BDEC4271\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "0b88e269-9927-467b-8a19-97a5941aade1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign04872315078de2d82?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d023c6-501e-00c0-72fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "8ad70b6e-b5b0-47af-b0a0-c202bcd0296f" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign04872315078de2d82" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[2].json new file mode 100644 index 000000000000..b8f7436e1cc5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0640456ec9e25ee02?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BDFB3A37\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d023ea-501e-00c0-12fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "b43ce29f-d095-48ad-b2d7-f01ab7c75cf6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02404-501e-00c0-28fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0640456ec9e25ee02Fri, 23 Aug 2019 21:49:15 GMT\"0x8D72813BDFB3A37\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "618102a5-22bb-4bcc-b5a9-d7628311d3c9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0640456ec9e25ee02?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02420-501e-00c0-40fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "fb7d3e46-c68b-44f6-9710-170e751ef502" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0640456ec9e25ee02" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[3].json new file mode 100644 index 000000000000..49d4dd438af9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign087906b102f1938d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BE0ACE62\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02442-501e-00c0-62fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "1ed0a6ab-b833-445a-b540-fadd78d0be38" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02460-501e-00c0-7efc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign087906b102f1938d8Fri, 23 Aug 2019 21:49:15 GMT\"0x8D72813BE0ACE62\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "71edde1f-6101-4efa-a5ab-4be9825c7158", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign087906b102f1938d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0247c-501e-00c0-15fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "6e9e48fb-473d-45b8-a2b2-7da883283472" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign087906b102f1938d8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[4].json new file mode 100644 index 000000000000..84252cbb3fbe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign095828316f307826e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BE19C623\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d024a0-501e-00c0-33fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "299514c5-017c-49b3-a033-72f78d416f0e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d024cb-501e-00c0-57fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign095828316f307826eFri, 23 Aug 2019 21:49:15 GMT\"0x8D72813BE19C623\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "e4d372ba-6f06-4268-9972-2698de75f8dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign095828316f307826e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d024e9-501e-00c0-74fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "361966f8-4acc-4897-9788-334d28fa09cf" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign095828316f307826e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[5].json new file mode 100644 index 000000000000..e7bcb3b42194 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign069038aafcc4f7360?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BE284890\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02516-501e-00c0-1cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "2a25ad42-9d2b-410d-be27-d23d247b12f7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02537-501e-00c0-3afc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign069038aafcc4f7360Fri, 23 Aug 2019 21:49:15 GMT\"0x8D72813BE284890\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "85991e78-d7bd-4fad-bcd8-cd30401d82bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign069038aafcc4f7360?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0254c-501e-00c0-4dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "a104e8db-73a6-4c38-bebf-abceb2a5345b" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign069038aafcc4f7360" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[6].json new file mode 100644 index 000000000000..bb53cf73db1d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign066491826fea6b440?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BE37193F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02567-501e-00c0-66fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "b0b87cee-ae0e-45d4-82d1-5749a2a4f8e1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0258b-501e-00c0-05fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign066491826fea6b440Fri, 23 Aug 2019 21:49:15 GMT\"0x8D72813BE37193F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "5ab15789-6459-4ef6-92d0-fc0d99d875f7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign066491826fea6b440?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0259c-501e-00c0-16fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "e12dbd54-30de-4075-beae-735541db224e" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign066491826fea6b440" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[7].json new file mode 100644 index 000000000000..9e230b585688 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[7].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign017816668526a8372?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BE46AD6C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d025bc-501e-00c0-36fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "aa681a58-1f63-4bbc-b943-94d10814b9c6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d025de-501e-00c0-55fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign017816668526a8372Fri, 23 Aug 2019 21:49:15 GMT\"0x8D72813BE46AD6C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "8703597b-aef9-4bc3-a334-61a78d2489ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign017816668526a8372?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d025f1-501e-00c0-67fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "56cb3ca9-b7fa-4053-b616-fa9022054ee9" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign017816668526a8372" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[8].json new file mode 100644 index 000000000000..c80a9940cc19 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[8].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign02720955797e059ea?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BE552FF2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0260a-501e-00c0-80fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "2fd7decc-4b1d-475d-993c-499647935cf9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0261b-501e-00c0-0ffc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign02720955797e059eaFri, 23 Aug 2019 21:49:15 GMT\"0x8D72813BE552FF2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "e5493402-1fca-4e9a-8035-9650bb884378", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign02720955797e059ea?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0263f-501e-00c0-2dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "a6614505-f5a3-4551-819a-ac04cb99532c" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign02720955797e059ea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[9].json new file mode 100644 index 000000000000..feb5889bb51a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[9].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0603026eab761ff50?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BE76548D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d026d9-501e-00c0-38fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "b0952692-5311-4da1-a0a5-e36da4c341b4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d026fd-501e-00c0-58fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0603026eab761ff50Fri, 23 Aug 2019 21:49:16 GMT\"0x8D72813BE76548D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "fa3e8ac4-3f77-4b7d-bd6c-471dc3b5a966", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0603026eab761ff50?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02718-501e-00c0-70fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "1b18cc0f-d00d-4b47-b715-99312cf1cfc3" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0603026eab761ff50" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[0].json new file mode 100644 index 000000000000..2f355f409095 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey03612577?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BEA5865F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d027ee-501e-00c0-2ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "1352165c-3667-460b-8293-e898a77ca69c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02809-501e-00c0-46fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey03612577Fri, 23 Aug 2019 21:49:16 GMT\"0x8D72813BEA5865F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "336b5c4d-0199-49c5-bffb-27c3cfe084fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey03612577?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02818-501e-00c0-53fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "92f4e570-3b21-47eb-a54f-cb05e8fa9a86" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey03612577" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[10].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[10].json new file mode 100644 index 000000000000..00badbc315ca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[10].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0421203e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BF63D4B0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02c7b-501e-00c0-51fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "6aeb9b83-e47b-46a9-aa8a-c1aa9d41dbe8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02c95-501e-00c0-69fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0421203eFri, 23 Aug 2019 21:49:17 GMT\"0x8D72813BF63D4B0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "50541b5a-05fd-4957-a5d1-5f4af25e5fcf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0421203e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02cb1-501e-00c0-02fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "fc46e4c9-835b-4837-a0f7-94382fd4d349" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0421203e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[11].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[11].json new file mode 100644 index 000000000000..76b8ed004a1a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[11].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05081385?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BF7341D0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02cce-501e-00c0-1efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "12f0c6a6-d832-4f6b-9fcd-ffef44ff77ed" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02ce7-501e-00c0-32fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey05081385Fri, 23 Aug 2019 21:49:17 GMT\"0x8D72813BF7341D0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "e55d054e-b183-4c55-ac51-3a40e1c11e3a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05081385?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02cfd-501e-00c0-48fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "fd61b8c3-35c7-4669-a2ea-32773f249fd0" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey05081385" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[12].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[12].json new file mode 100644 index 000000000000..53b22df3cd65 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[12].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04163291?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BF81C43E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02d27-501e-00c0-6dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "3b58013e-cac9-49fb-917e-10645054ee78" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02d49-501e-00c0-0afc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey04163291Fri, 23 Aug 2019 21:49:17 GMT\"0x8D72813BF81C43E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "8250f37a-b9ef-48bb-a70e-ace682db0845", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04163291?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02d66-501e-00c0-23fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "0719e77e-6f02-42c3-aaab-6cfc70398ee0" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey04163291" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[13].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[13].json new file mode 100644 index 000000000000..418a23b27af6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[13].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey075062b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BF901F9F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02d85-501e-00c0-3ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "e9b86098-98aa-4eb6-8939-93bf6e9133f0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02da2-501e-00c0-59fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey075062b5Fri, 23 Aug 2019 21:49:17 GMT\"0x8D72813BF901F9F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "e785f666-a8df-4ef9-b47f-278bc4aa7de1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey075062b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02db5-501e-00c0-6afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "e0165bc7-5242-4f78-a2a1-a20809f41f77" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey075062b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[14].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[14].json new file mode 100644 index 000000000000..baeac5b27d6d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[14].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0204869a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BFA0774F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02de5-501e-00c0-15fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "c00fb14b-5fcc-47fe-94b6-75efbcb28dd9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02e12-501e-00c0-3dfc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0204869aFri, 23 Aug 2019 21:49:18 GMT\"0x8D72813BFA0774F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "beb76bde-8cfb-4568-82ee-ebbd02285a65", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0204869a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02e30-501e-00c0-58fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "7df42bc5-3f73-44f3-97f2-c49dc10b6fb3" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0204869a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[15].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[15].json new file mode 100644 index 000000000000..a8b55a65e835 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[15].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09328955?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BFB03293\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02e5d-501e-00c0-01fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "267af04a-3d7e-4ef5-9b93-393a78fee011" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02e7c-501e-00c0-1dfc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey09328955Fri, 23 Aug 2019 21:49:18 GMT\"0x8D72813BFB03293\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "b4559431-d85d-4d3d-999c-fc107831d0c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09328955?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02e91-501e-00c0-2efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "51459e07-35b1-4bdc-91e5-43f9572df477" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey09328955" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[16].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[16].json new file mode 100644 index 000000000000..0f99e8bebe85 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[16].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0121053f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BFBF0343\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02eb2-501e-00c0-4cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "80e390fb-f1de-46a2-904d-5e1ed8850a5b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02ece-501e-00c0-66fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0121053fFri, 23 Aug 2019 21:49:18 GMT\"0x8D72813BFBF0343\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "bba5e948-6c93-4745-b9a4-4758f130470a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0121053f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02ee6-501e-00c0-7dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "1cc707be-6695-4b71-8694-db0e30fc0ee2" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0121053f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[1].json new file mode 100644 index 000000000000..42ffbc9026d2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey01275162?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BEB45718\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0282e-501e-00c0-69fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "70b97abb-2164-4d3a-bdfb-e7eaaf03fb06" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0284b-501e-00c0-02fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey01275162Fri, 23 Aug 2019 21:49:16 GMT\"0x8D72813BEB45718\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "5618e39c-878b-40be-9685-a982e03bdb8c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey01275162?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02856-501e-00c0-0cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "f096cdc3-232b-4f9d-ad1b-86d2b130e2b8" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey01275162" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[2].json new file mode 100644 index 000000000000..0b8ea9086381 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey06200983?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BEC2D990\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0286c-501e-00c0-21fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "d509139c-cec2-42f5-9c44-87acf38339f9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02884-501e-00c0-38fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey06200983Fri, 23 Aug 2019 21:49:16 GMT\"0x8D72813BEC2D990\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:15 GMT", + "x-ms-client-request-id" : "b5e5972f-f492-4b83-947c-916a7a30423a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey06200983?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0289c-501e-00c0-4ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "232db278-49da-4c6b-9223-680d33cd0131" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey06200983" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[3].json new file mode 100644 index 000000000000..0d78f38efebd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0646282b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BED37F65\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d028c0-501e-00c0-6cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "860360aa-d63c-4b9e-841f-d1c3b85ccf55" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d028dd-501e-00c0-07fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0646282bFri, 23 Aug 2019 21:49:16 GMT\"0x8D72813BED37F65\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "51569d26-670b-4429-9a74-d312f461b45a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0646282b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d028f8-501e-00c0-1efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "385e2a53-d143-4941-8753-7b25da83a2da" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0646282b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[4].json new file mode 100644 index 000000000000..3724368f5968 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey068148da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BEE29E48\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02921-501e-00c0-45fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "f1564b07-735f-4f59-a0e8-96ecbcefe426" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02982-501e-00c0-1bfc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey068148daFri, 23 Aug 2019 21:49:16 GMT\"0x8D72813BEE29E48\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "6d3301ff-f3d0-4336-87b0-a30685d1cf58", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey068148da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d029a6-501e-00c0-3dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "60154b6b-e3bb-446f-bc89-0165604c0c84" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey068148da" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[5].json new file mode 100644 index 000000000000..ef02fa2fb43d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey00201051?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BF0FACB4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02a64-501e-00c0-6afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "89f84e16-ee38-4633-98ff-0c7be94db987" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02a8b-501e-00c0-0efc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey00201051Fri, 23 Aug 2019 21:49:17 GMT\"0x8D72813BF0FACB4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "8f2864f8-e574-48b5-a56e-c39830e2ddc1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey00201051?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02aa4-501e-00c0-23fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "b423b189-4403-4b7f-a93b-cf0cffead256" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey00201051" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[6].json new file mode 100644 index 000000000000..83adad26e27a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0560182b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BF1F19CA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02acd-501e-00c0-46fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "c9fa0c7a-0fc4-418a-b598-d2c83f2e9771" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02aea-501e-00c0-61fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0560182bFri, 23 Aug 2019 21:49:17 GMT\"0x8D72813BF1F19CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "b9ebb8f3-6729-4a6c-8097-d63945b92fef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0560182b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02afe-501e-00c0-74fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "3e54443d-a7c5-4641-bfa9-fb59d95d06cc" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0560182b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[7].json new file mode 100644 index 000000000000..282f44fda0aa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[7].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey06813161?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BF2E38B7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02b27-501e-00c0-1bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "6f004d92-badf-4d87-83bc-8f21c25c7ffd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02b4d-501e-00c0-3cfc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey06813161Fri, 23 Aug 2019 21:49:17 GMT\"0x8D72813BF2E38B7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "152e8df5-2b09-4879-b670-9d338097adcf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey06813161?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02b68-501e-00c0-55fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "2ce79376-3d58-4a11-927f-27c97e859290" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey06813161" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[8].json new file mode 100644 index 000000000000..fc030654a9ee --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[8].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey08836818?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BF3D0959\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02b93-501e-00c0-7efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "7758e507-c783-4dd2-a0da-c667dce0a24d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02baf-501e-00c0-16fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey08836818Fri, 23 Aug 2019 21:49:17 GMT\"0x8D72813BF3D0959\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "e91890ac-cae4-4060-9b87-c229a64bb493", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey08836818?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02bca-501e-00c0-2ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "b391a3d1-f64b-44a8-83b6-5c5fb51a8543" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey08836818" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[9].json new file mode 100644 index 000000000000..d5d1f08da7f9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[9].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0674236c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BF4BB2F1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02bea-501e-00c0-4cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "b4d1de3c-13b8-48d3-a386-8149d7b66776" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02c16-501e-00c0-71fc-59ba32000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0674236cFri, 23 Aug 2019 21:49:17 GMT\"0x8D72813BF4BB2F1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "8e32dcb6-f695-42cd-82d0-7d66fa3c5161", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0674236c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02c2b-501e-00c0-05fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:16 GMT", + "x-ms-client-request-id" : "eb50f20c-cb8f-48b3-a843-cb7564ae8f31" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0674236c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[0].json new file mode 100644 index 000000000000..88fd2e3e40e2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource0714563e49?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BFCDACDC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02efe-501e-00c0-15fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "4fc06680-3a2b-4612-8b31-33462df98c1b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluescanonicalizedresource&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02f21-501e-00c0-34fc-59ba32000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource0714563e49Fri, 23 Aug 2019 21:49:18 GMT\"0x8D72813BFCDACDC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "1880fc93-82ea-4c0a-b5af-0e527f58be36", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource0714563e49?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02f42-501e-00c0-50fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "f46003ef-b04a-4fd7-8f8c-275b6c6fd874" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource0714563e49" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[1].json new file mode 100644 index 000000000000..4fde759416bc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource004470ff5f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BFDC0838\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02f64-501e-00c0-6efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "a6e8100d-2ee1-4f1e-94b7-b114e2c7de79" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluescanonicalizedresource&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02f7f-501e-00c0-08fc-59ba32000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource004470ff5fFri, 23 Aug 2019 21:49:18 GMT\"0x8D72813BFDC0838\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "42a693f1-60d6-45b8-be22-4593ae6f43cc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource004470ff5f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02f98-501e-00c0-1ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "ba22dd4e-bce6-47f7-a013-bb48248ece02" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource004470ff5f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[2].json new file mode 100644 index 000000000000..7a355c2fd6c3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource003580a36d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BFEAD8E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02fb3-501e-00c0-37fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "6fe25490-e50a-4c09-8482-dcf8d6902e46" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluescanonicalizedresource&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02fd5-501e-00c0-53fc-59ba32000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource003580a36dFri, 23 Aug 2019 21:49:18 GMT\"0x8D72813BFEAD8E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "7d6f3799-2503-4e3d-bbea-2d75d0e41224", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource003580a36d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d02feb-501e-00c0-66fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:17 GMT", + "x-ms-client-request-id" : "065181d9-b01a-49e0-8f91-ffeb8e0df698" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource003580a36d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[0].json new file mode 100644 index 000000000000..3100aeba3540 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia04660947af1fe1e7d54?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BFFB57BC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d03012-501e-00c0-0afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "64efcdc2-fbb8-4f62-ac3a-36f50b76d48f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0302a-501e-00c0-21fc-59ba32000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia04660947af1fe1e7d54Fri, 23 Aug 2019 21:49:18 GMT\"0x8D72813BFFB57BC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "b1ab337c-d4f1-4209-8853-307c812a34c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia04660947af1fe1e7d54?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03048-501e-00c0-3cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "a85a8de8-be6d-4695-a72e-105b6149aed1" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia04660947af1fe1e7d54" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[1].json new file mode 100644 index 000000000000..d5897ba61404 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia03349072c10f3d8bab4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C00C24A8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0306b-501e-00c0-58fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "e8046bbe-470d-4a2a-886c-568215121682" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d03091-501e-00c0-7bfc-59ba32000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia03349072c10f3d8bab4Fri, 23 Aug 2019 21:49:18 GMT\"0x8D72813C00C24A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "4c82738b-1360-47ec-81e2-a4e1ae221a9a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia03349072c10f3d8bab4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d030a8-501e-00c0-11fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "c12d58d6-98ee-40da-95f0-c1c53ae60feb" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia03349072c10f3d8bab4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[2].json new file mode 100644 index 000000000000..56fe9994ce1a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia06154250f1c1cf534b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C01B6A9D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d030c7-501e-00c0-2efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "06b2c295-821c-4ee4-be1f-32e1de56fb0d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d030e5-501e-00c0-4bfc-59ba32000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia06154250f1c1cf534b4Fri, 23 Aug 2019 21:49:18 GMT\"0x8D72813C01B6A9D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "80429a69-9469-4f37-b55f-a4ca112f0ad6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia06154250f1c1cf534b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d030f9-501e-00c0-5ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:18 GMT", + "x-ms-client-request-id" : "0f859c0f-873d-406c-8435-7181e8dfeddc" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia06154250f1c1cf534b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesnetworktestblobsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesnetworktestblobsnapshot.json new file mode 100644 index 000000000000..fbb8a8d0c37e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesnetworktestblobsnapshot.json @@ -0,0 +1,231 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot00973756c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BDA340E9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02192-501e-00c0-02fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "5e51d577-eff0-41da-b54a-9bffdcbbd4fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BDA87242\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d021c2-501e-00c0-2afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "6a210b3c-f7ce-4eb8-bdc5-cf2378ac1c7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a/javablobservicesassignaturevaluesnetworktestblobsnapshot284499", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BDADEEA4\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d021e6-501e-00c0-4bfc-59ba32000000", + "x-ms-client-request-id" : "2096360f-4e39-4cc2-90d2-a42d0345eb51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a/javablobservicesassignaturevaluesnetworktestblobsnapshot284499?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:14.8327160Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BDADEEA4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02209-501e-00c0-67fc-59ba32000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "62906b46-f061-4c3c-9f27-ed2e04a60621" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a/javablobservicesassignaturevaluesnetworktestblobsnapshot284499?sv=2018-11-09&spr=https&st=2019-08-23T21%3A49%3A14Z&se=2019-08-24T21%3A49%3A14Z&sip=0.0.0.0-255.255.255.255&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "447", + "StatusCode" : "403", + "x-ms-request-id" : "77d0225c-501e-00c0-30fc-59ba32000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:77d0225c-501e-00c0-30fc-59ba32000000\nTime:2019-08-23T21:49:14.9008614ZThe specified signed resource is not allowed for the this resource level", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a/javablobservicesassignaturevaluesnetworktestblobsnapshot284499?snapshot=2019-08-23T21%3a49%3a14.8327160Z&sv=2018-11-09&spr=https&st=2019-08-23T21%3A49%3A14Z&se=2019-08-24T21%3A49%3A14Z&sip=0.0.0.0-255.255.255.255&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-snapshot" : "2019-08-23T21:49:14.8327160Z", + "Cache-Control" : "cache", + "ETag" : "\"0x8D72813BDADEEA4\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "77d0227f-501e-00c0-4ffc-59ba32000000", + "Body" : "default", + "x-ms-client-request-id" : "cf6fe629-66bd-4e67-98e6-ced1fe21be74", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a/javablobservicesassignaturevaluesnetworktestblobsnapshot284499?snapshot=2019-08-23T21%3a49%3a14.8327160Z&sv=2018-11-09&spr=https&st=2019-08-23T21%3A49%3A14Z&se=2019-08-24T21%3A49%3A14Z&sip=0.0.0.0-255.255.255.255&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-snapshot" : "2019-08-23T21:49:14.8327160Z", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "\"0x8D72813BDADEEA4\"", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "77d022a3-501e-00c0-6dfc-59ba32000000", + "x-ms-client-request-id" : "1d9774f4-2389-459b-8c32-4e83a862a44f", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestblobsnapshot&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d022bd-501e-00c0-06fc-59ba32000000", + "Body" : "jtcservicesassignaturevaluesnetworktestblobsnapshotjtcservicesassignaturevaluesnetworktestblobsnapshot00973756cFri, 23 Aug 2019 21:49:14 GMT\"0x8D72813BDA340E9\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcservicesassignaturevaluesnetworktestblobsnapshot10201430aFri, 23 Aug 2019 21:49:14 GMT\"0x8D72813BDA87242\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "5ccd2de2-4002-4e32-927d-18a071dbf888", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot00973756c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d022d7-501e-00c0-1dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "53ff19ca-1f97-4abb-909a-9b69ac3a86ef" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d022f4-501e-00c0-38fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "b81035d1-1c1b-4050-ac65-a80512071c07" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestblobsnapshot00973756c", "jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a", "javablobservicesassignaturevaluesnetworktestblobsnapshot284499", "2019-08-23T21:49:14.890Z", "2019-08-23T21:49:14.890Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTesturlparser.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTesturlparser.json new file mode 100644 index 000000000000..d3f794884dad --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTesturlparser.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcurlparser0helpertesturlparser93a6035066936cd9585?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5461623\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d057b6-501e-00c0-07fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "5716e3d6-7ae7-4876-9b90-73282a8f7458" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcurlparser&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d057d6-501e-00c0-24fc-59ba32000000", + "Body" : "jtcurlparserjtcurlparser0helpertesturlparser93a6035066936cd9585Fri, 23 Aug 2019 21:49:27 GMT\"0x8D72813C5461623\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "b0c14fd6-acd4-4cdc-9a69-aa36a3f4a651", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcurlparser0helpertesturlparser93a6035066936cd9585?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05815-501e-00c0-5afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:26 GMT", + "x-ms-client-request-id" : "20919273-8e41-4925-b350-50fce5d0ee00" + }, + "Exception" : null + } ], + "variables" : [ "jtcurlparser0helpertesturlparser93a6035066936cd9585" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpage.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpage.json new file mode 100644 index 000000000000..035cbb65dd5a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpage.json @@ -0,0 +1,151 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpagec94614174395fbab7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0A13ED4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb74e-301e-0094-08fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "aad28a8c-2c24-42f7-b063-98bc5652c4cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpagec94614174395fbab7/javablobclearpage1pageblobapitestclearpagec94182519c4bcb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0A6474C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb759-301e-0094-12fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "d33dd76c-05ae-472f-a486-4173f0802d33" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpagec94614174395fbab7/javablobclearpage1pageblobapitestclearpagec94182519c4bcb?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "KNPAbzKTDi0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "ETag" : "\"0x8D72813D0AB78C0\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb766-301e-0094-1efc-5950b8000000", + "x-ms-client-request-id" : "3cfb512b-163b-41bf-a47a-bc209dc93497" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpagec94614174395fbab7/javablobclearpage1pageblobapitestclearpagec94182519c4bcb?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0B0F85A\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb77f-301e-0094-33fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "8ec23732-2772-45a5-b217-9e57380d652d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpagec94614174395fbab7/javablobclearpage1pageblobapitestclearpagec94182519c4bcb?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "ETag" : "\"0x8D72813D0B0F85A\"", + "x-ms-request-id" : "f77fb796-301e-0094-47fc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "cdf12657-c4ec-47bb-85c8-f7f70c2764bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpage&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb7ab-301e-0094-58fc-5950b8000000", + "Body" : "jtcclearpagejtcclearpage0pageblobapitestclearpagec94614174395fbab7Fri, 23 Aug 2019 21:49:46 GMT\"0x8D72813D0A13ED4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "9f27f6ad-6afd-4d28-b9ba-f69d59d341e3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpage0pageblobapitestclearpagec94614174395fbab7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb7b6-301e-0094-61fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "e6e44bd9-b4b8-479a-ac6e-1ea89c0b3d35" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpage0pageblobapitestclearpagec94614174395fbab7", "javablobclearpage1pageblobapitestclearpagec94182519c4bcb", "39ac9c53-b8aa-435d-aa0b-f58871093844" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpageerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpageerror.json new file mode 100644 index 000000000000..d845be197b63 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpageerror.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerrord3118800585c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D31850E2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbf1f-301e-0094-37fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "c337fd27-24e0-46a3-805d-ad414268bd72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerrord3118800585c/javablobclearpageerror1pageblobapitestclearpageerrord31401664", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D31E4B6D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbf32-301e-0094-46fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "c4aba9ee-dee7-4495-9c25-40b4252b159d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerrord3118800585c/javablobclearpageerror2pageblobapitestclearpageerrord3144661b?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbf40-301e-0094-53fc-5950b8000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:f77fbf40-301e-0094-53fc-5950b8000000\nTime:2019-08-23T21:49:50.8011002Z", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "382048ec-bfaa-4757-94f9-9f156430c253", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpageerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbf47-301e-0094-5afc-5950b8000000", + "Body" : "jtcclearpageerrorjtcclearpageerror0pageblobapitestclearpageerrord3118800585cFri, 23 Aug 2019 21:49:50 GMT\"0x8D72813D31850E2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "575b1598-01e8-4ba5-9758-b933cadf37d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerrord3118800585c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbf50-301e-0094-62fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "6c23d997-b87c-419e-a7c7-fdc44fdc361c" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpageerror0pageblobapitestclearpageerrord3118800585c", "javablobclearpageerror1pageblobapitestclearpageerrord31401664", "javablobclearpageerror2pageblobapitestclearpageerrord3144661b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagemin.json new file mode 100644 index 000000000000..1a8347117f6a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagemin.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemin001167591cc9b2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0C74657\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb7c4-301e-0094-6cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "694d6913-928e-4bc8-aafa-cd1947bb4b43" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemin001167591cc9b2/javablobclearpagemin1pageblobapitestclearpagemin0018597914f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0CE246D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb7d4-301e-0094-78fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "3907bd5d-ea09-48d2-b614-f6d70a078351" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemin001167591cc9b2/javablobclearpagemin1pageblobapitestclearpagemin0018597914f?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0D32EB3\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb7e5-301e-0094-08fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "34c1afed-bf61-42db-a377-2eaa69e509ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb7f2-301e-0094-12fc-5950b8000000", + "Body" : "jtcclearpageminjtcclearpagemin0pageblobapitestclearpagemin001167591cc9b2Fri, 23 Aug 2019 21:49:46 GMT\"0x8D72813D0C74657\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "fc920b1c-5a45-46af-bd26-9af8187cdc09", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemin001167591cc9b2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb7f8-301e-0094-18fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "98647a1f-673c-4a66-b6dc-8e9b7dba0258" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagemin0pageblobapitestclearpagemin001167591cc9b2", "javablobclearpagemin1pageblobapitestclearpagemin0018597914f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[0].json new file mode 100644 index 000000000000..555872403ad3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[0].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaccb565514e4a9e0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0E2EB1E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb807-301e-0094-26fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "da61b4f4-f8f9-45f3-9993-fd46092d18a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaccb565514e4a9e0/javablobclearpagesac1pageblobapitestclearpagesaccb578113884", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0E8B7CF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb818-301e-0094-33fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "9e6d53e6-e894-42f9-9e74-2ecfe9cb3571" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaccb565514e4a9e0/javablobclearpagesac1pageblobapitestclearpagesaccb578113884?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "AyfKQDTg4aA=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "ETag" : "\"0x8D72813D0F1BAB3\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb83c-301e-0094-4ffc-5950b8000000", + "x-ms-client-request-id" : "4f05430a-8d4e-49f1-8d17-d6207eb45238" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaccb565514e4a9e0/javablobclearpagesac1pageblobapitestclearpagesaccb578113884?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0F76169\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb84b-301e-0094-5cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "c3deb27f-a2c8-476e-bad4-b5d4498911d7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb85d-301e-0094-6dfc-5950b8000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesaccb565514e4a9e0Fri, 23 Aug 2019 21:49:47 GMT\"0x8D72813D0E2EB1E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "97e4889b-9b80-45a5-8793-f3f961fb5ddf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaccb565514e4a9e0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb86b-301e-0094-77fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "b67d6e0c-80fa-4043-948f-69659dcf274d" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesaccb565514e4a9e0", "javablobclearpagesac1pageblobapitestclearpagesaccb578113884", "20629fa7-2f01-4a4c-9337-e2666120a0db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[1].json new file mode 100644 index 000000000000..7b99eb0d77f7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacade45661bf5ef2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D10792AA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb87a-301e-0094-03fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "50be3f3e-4175-400a-9700-52c378924e20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacade45661bf5ef2/javablobclearpagesac1pageblobapitestclearpagesacade16844672", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D10D5FCF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb88b-301e-0094-10fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "d687ba3a-84e1-47de-b108-626b2202c0cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacade45661bf5ef2/javablobclearpagesac1pageblobapitestclearpagesacade16844672?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "xd1T84/CkMU=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "ETag" : "\"0x8D72813D1126A1F\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb89a-301e-0094-1cfc-5950b8000000", + "x-ms-client-request-id" : "a488de9c-45eb-46c6-9aee-a37d1b57c99a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacade45661bf5ef2/javablobclearpagesac1pageblobapitestclearpagesacade16844672?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D116B0E7\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb8a5-301e-0094-26fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "e77e2403-af15-4f08-aae6-f3bdbb9bc860" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb8ae-301e-0094-2efc-5950b8000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesacade45661bf5ef2Fri, 23 Aug 2019 21:49:47 GMT\"0x8D72813D10792AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "3bd1fcae-e8af-463d-bb39-afc0605cb38b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacade45661bf5ef2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb8b6-301e-0094-35fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "89e5c263-b837-4f9f-9963-f989d6fbc850" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesacade45661bf5ef2", "javablobclearpagesac1pageblobapitestclearpagesacade16844672", "a894e378-70e0-4bb0-8856-55270c880e72" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[2].json new file mode 100644 index 000000000000..64fe2763b4cd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf5e9420198023c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1255AD1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb8c5-301e-0094-42fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "83b15ce6-15fc-49f8-89df-abd33096de55" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf5e9420198023c/javablobclearpagesac1pageblobapitestclearpagesacf5e99249f14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D12A64D5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb8cf-301e-0094-4afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "00d0ea3c-ac5e-4696-9eae-ee48f7710708" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf5e9420198023c/javablobclearpagesac1pageblobapitestclearpagesacf5e99249f14?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "c8gYAuF5xIE=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "ETag" : "\"0x8D72813D12F47FF\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb8dc-301e-0094-55fc-5950b8000000", + "x-ms-client-request-id" : "160e4bbf-514e-4b32-8c84-fd7cd8234351" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf5e9420198023c/javablobclearpagesac1pageblobapitestclearpagesacf5e99249f14?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1373932\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb8e6-301e-0094-5dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "222ed1e8-3da1-4214-9fab-7b2ab15cd629" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb8fb-301e-0094-6ffc-5950b8000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesacf5e9420198023cFri, 23 Aug 2019 21:49:47 GMT\"0x8D72813D1255AD1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "2cd1f4b6-49ce-4706-98ac-40167defb43c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf5e9420198023c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb911-301e-0094-7efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "3459fa16-ae87-43d8-86cf-31a48e57bc64" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesacf5e9420198023c", "javablobclearpagesac1pageblobapitestclearpagesacf5e99249f14", "e7c75f32-9947-4693-a6c0-9a285887192d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[3].json new file mode 100644 index 000000000000..d59120f03caf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[3].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac96d45425ea0a6c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D148A28B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb921-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "9e0fe44c-990e-4be8-9e72-a9a14b1fdb00" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac96d45425ea0a6c/javablobclearpagesac1pageblobapitestclearpagesac96d559341a7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D14DD416\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb931-301e-0094-19fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "20c3bc00-764c-432d-b819-8928c22bb6ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac96d45425ea0a6c/javablobclearpagesac1pageblobapitestclearpagesac96d559341a7?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "jIPeDJnpNXM=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "ETag" : "\"0x8D72813D152B732\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb944-301e-0094-27fc-5950b8000000", + "x-ms-client-request-id" : "87a4a6c0-bef8-4d25-834a-fce57085a84f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac96d45425ea0a6c/javablobclearpagesac1pageblobapitestclearpagesac96d559341a7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D152B732\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:47 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fb950-301e-0094-32fc-5950b8000000", + "x-ms-client-request-id" : "768e9e57-9a2e-4e98-a922-a40dbd1be5ee", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac96d45425ea0a6c/javablobclearpagesac1pageblobapitestclearpagesac96d559341a7?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D15B1DC3\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb95f-301e-0094-40fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "88a02613-15f0-405c-960f-3d8e05b357c6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb96c-301e-0094-4cfc-5950b8000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac96d45425ea0a6cFri, 23 Aug 2019 21:49:47 GMT\"0x8D72813D148A28B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "0a4e391f-f16a-4225-9f1f-b37596ab34c1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac96d45425ea0a6c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb977-301e-0094-54fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "acb4ec05-a3aa-4077-be2a-2df03c8dfe5f" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac96d45425ea0a6c", "javablobclearpagesac1pageblobapitestclearpagesac96d559341a7", "5a248409-7841-4d4c-aa77-0aa8b4ef5930" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[4].json new file mode 100644 index 000000000000..e444ede8eb3e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[4].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaca8a68727886744?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D169C6D6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb98d-301e-0094-69fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "f092154b-c393-41ef-85bc-e1b921006159" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaca8a68727886744/javablobclearpagesac1pageblobapitestclearpagesaca8a58881a96", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D16EF8BA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb9a1-301e-0094-76fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "a24f695b-a3a7-4487-85d2-9edd66b120ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaca8a68727886744/javablobclearpagesac1pageblobapitestclearpagesaca8a58881a96?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "VoPAzf4vY7o=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "ETag" : "\"0x8D72813D1742A20\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb9b2-301e-0094-06fc-5950b8000000", + "x-ms-client-request-id" : "66ad1d03-0568-4532-9e70-8bbefb70c900" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaca8a68727886744/javablobclearpagesac1pageblobapitestclearpagesaca8a58881a96?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D17870F2\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb9bc-301e-0094-0ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "477c36b4-469c-4ddc-9ac6-65d349c1721b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb9d0-301e-0094-20fc-5950b8000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesaca8a68727886744Fri, 23 Aug 2019 21:49:47 GMT\"0x8D72813D169C6D6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "a878fe33-5463-429f-866a-fe2fb78c7c81", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaca8a68727886744?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb9e4-301e-0094-30fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "4185e8e6-9907-4505-80b1-b264a2c25939" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesaca8a68727886744", "javablobclearpagesac1pageblobapitestclearpagesaca8a58881a96", "9ac81331-c651-49d4-8b0c-887a3b928759" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[5].json new file mode 100644 index 000000000000..b5a170b8df46 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[5].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1b674248e74c89?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1878F07\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb9f7-301e-0094-42fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "3a2d005c-904c-45da-8b7c-584a507354b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1b674248e74c89/javablobclearpagesac1pageblobapitestclearpagesac1b6136753c0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D18DFA09\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fba0a-301e-0094-51fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "62c63dc3-69aa-43b3-bb20-520d144e0c52" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1b674248e74c89/javablobclearpagesac1pageblobapitestclearpagesac1b6136753c0?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "cCQgg4x/xeg=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "ETag" : "\"0x8D72813D192DD38\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fba17-301e-0094-5dfc-5950b8000000", + "x-ms-client-request-id" : "82012885-2acc-42e2-8377-c5b330586183" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1b674248e74c89/javablobclearpagesac1pageblobapitestclearpagesac1b6136753c0?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D192DD38\"", + "x-ms-lease-id" : "46cde987-447f-430f-bed6-84dae5cfcc62", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fba2d-301e-0094-71fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "806e925f-94b6-4f26-97ab-44db7f8ae7b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1b674248e74c89/javablobclearpagesac1pageblobapitestclearpagesac1b6136753c0?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D19C2E54\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fba41-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "1c8bf092-3014-4e3a-b2dd-1d46f6e051db" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fba5b-301e-0094-1afc-5950b8000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac1b674248e74c89Fri, 23 Aug 2019 21:49:48 GMT\"0x8D72813D1878F07\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "a173fc02-9d82-43f3-9b4b-e2df398d817f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1b674248e74c89?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fba6a-301e-0094-27fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "3a02e236-812f-4abf-93c1-c39bc9650a16" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac1b674248e74c89", "javablobclearpagesac1pageblobapitestclearpagesac1b6136753c0", "91e979fe-740c-4560-ae6a-34979e9cc32d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[6].json new file mode 100644 index 000000000000..a85456d049e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[6].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac273151985bc270?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1AA616E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fba84-301e-0094-3dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:47 GMT", + "x-ms-client-request-id" : "e3c0ad21-b161-48f6-b4b0-4459a3802497" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac273151985bc270/javablobclearpagesac1pageblobapitestclearpagesac27347572b14", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1AFE238\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fba94-301e-0094-49fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "84b12a5f-b4fb-4f1a-8f0f-6fb1628d0443" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac273151985bc270/javablobclearpagesac1pageblobapitestclearpagesac27347572b14?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "MbemdRTC3iQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "ETag" : "\"0x8D72813D1B5139F\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbaab-301e-0094-5dfc-5950b8000000", + "x-ms-client-request-id" : "8e050dd4-ab58-4de8-9406-d4b98db443e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac273151985bc270/javablobclearpagesac1pageblobapitestclearpagesac27347572b14?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1B9A8A4\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbac5-301e-0094-72fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "a0284b66-956c-498a-8c79-284216a215ed" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbacd-301e-0094-78fc-5950b8000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac273151985bc270Fri, 23 Aug 2019 21:49:48 GMT\"0x8D72813D1AA616E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "124fc20a-f091-4050-a1fe-619f317953ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac273151985bc270?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbad9-301e-0094-02fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "337c0914-a0f3-4746-98dc-56ea44852ced" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac273151985bc270", "javablobclearpagesac1pageblobapitestclearpagesac27347572b14", "80e41055-d65a-4de3-9256-4b48fe004dd7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[7].json new file mode 100644 index 000000000000..4b31926f64b8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[7].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf3e34131a42a02?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1C8027E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbaf0-301e-0094-16fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "2c4bc5ef-0389-44ab-b7e2-f0526933552a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf3e34131a42a02/javablobclearpagesac1pageblobapitestclearpagesacf3e76964d19", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1CD356C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbb01-301e-0094-25fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "39a87534-557f-4144-8e2b-3f46e9b79023" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf3e34131a42a02/javablobclearpagesac1pageblobapitestclearpagesacf3e76964d19?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "rA+DT4PxUwo=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "ETag" : "\"0x8D72813D1D2189B\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbb11-301e-0094-31fc-5950b8000000", + "x-ms-client-request-id" : "1d5f0393-e590-4b88-a56e-8491b7a24499" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf3e34131a42a02/javablobclearpagesac1pageblobapitestclearpagesacf3e76964d19?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1DA5806\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbb3b-301e-0094-55fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "81e6f7b3-1ca7-4df3-8efc-a50ba5945da2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbb4a-301e-0094-62fc-5950b8000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesacf3e34131a42a02Fri, 23 Aug 2019 21:49:48 GMT\"0x8D72813D1C8027E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "87fd68a0-8d54-42f6-a5d3-50be2f85044f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf3e34131a42a02?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbb59-301e-0094-6ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "14e292cd-e089-47b9-b02a-7934b3a2ec41" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesacf3e34131a42a02", "javablobclearpagesac1pageblobapitestclearpagesacf3e76964d19", "5a83b2c3-85d7-4980-bd2c-193b9a336190" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[8].json new file mode 100644 index 000000000000..7220b960a97d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[8].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac74430402a880c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1E9EA58\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbb69-301e-0094-7ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "689ec2f1-14f9-4651-84c6-6eda3ef0f913" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac74430402a880c6/javablobclearpagesac1pageblobapitestclearpagesac74408035b2d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1EF6BCE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbb81-301e-0094-14fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "3777b1d7-911b-4fbc-9663-f4e69dbbea7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac74430402a880c6/javablobclearpagesac1pageblobapitestclearpagesac74408035b2d?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "qOz50PTCStQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "ETag" : "\"0x8D72813D1F47622\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbb8b-301e-0094-1dfc-5950b8000000", + "x-ms-client-request-id" : "bc931f9a-1e39-4021-badd-faa384c27ff2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac74430402a880c6/javablobclearpagesac1pageblobapitestclearpagesac74408035b2d?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D1F8BCEF\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbb98-301e-0094-27fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "14c06cb7-8fc3-4452-9985-0f1b9bfdb9db" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbba5-301e-0094-33fc-5950b8000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac74430402a880c6Fri, 23 Aug 2019 21:49:48 GMT\"0x8D72813D1E9EA58\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "b11ed08b-ad21-4f95-ada8-dfd0017e49b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac74430402a880c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbbaf-301e-0094-3bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "231cbcc3-0900-4f6d-944f-d95e5f3300a1" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac74430402a880c6", "javablobclearpagesac1pageblobapitestclearpagesac74408035b2d", "423d40c1-b2a3-453b-8c3a-39aa18e8603f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[0].json new file mode 100644 index 000000000000..c2eae593896d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[0].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail14f6224558?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D206C7DF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbbd1-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "82a86e1f-0318-49b8-8caf-25ba9ac55503" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail14f6224558/javablobclearpagesacfail15172955698c517c5046b6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D20C70CF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbbe3-301e-0094-68fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "2f493436-6b10-4b5a-8511-ccc9e5f24e29" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail14f6224558/javablobclearpagesacfail15172955698c517c5046b6?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "IyWSznax7p4=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "ETag" : "\"0x8D72813D2117B23\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbbfe-301e-0094-80fc-5950b8000000", + "x-ms-client-request-id" : "4898ee65-92cb-41d0-b850-d0963ed59f7b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail14f6224558/javablobclearpagesacfail15172955698c517c5046b6?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fbc0f-301e-0094-0ffc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fbc0f-301e-0094-0ffc-5950b8000000\nTime:2019-08-23T21:49:49.0434907Z", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "1bd63e90-e63a-4f48-8cea-81053c76415b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbc21-301e-0094-21fc-5950b8000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail14f6224558Fri, 23 Aug 2019 21:49:48 GMT\"0x8D72813D206C7DF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "6dbf4c0a-343d-4f92-8cdc-869b0a051076", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail14f6224558?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbc37-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "9126365b-a53b-4483-89c3-6078abc6e1a2" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail14f6224558", "javablobclearpagesacfail15172955698c517c5046b6", "30eadb57-3065-4f63-8404-9ea81da45b23" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[1].json new file mode 100644 index 000000000000..94d2173243ba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8ac785633d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D2250553\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbc48-301e-0094-43fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "b815b0ce-b904-4368-980b-7c83ab01932d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8ac785633d/javablobclearpagesacfail175136b1ebcdbcdae14cbe", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D22A395B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbc5d-301e-0094-54fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "a8afa52b-1cc0-4941-84ac-5e7c909c446a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8ac785633d/javablobclearpagesacfail175136b1ebcdbcdae14cbe?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "LrkudOW/c+E=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "ETag" : "\"0x8D72813D22F6AC6\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbc75-301e-0094-6bfc-5950b8000000", + "x-ms-client-request-id" : "45c71694-efef-4c92-afe9-ed9ce52b2b74" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8ac785633d/javablobclearpagesacfail175136b1ebcdbcdae14cbe?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fbc8a-301e-0094-7cfc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fbc8a-301e-0094-7cfc-5950b8000000\nTime:2019-08-23T21:49:49.2416729Z", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "cc0ce64f-6807-4706-b1ee-b2a4c49d8fd4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbc93-301e-0094-05fc-5950b8000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail8ac785633dFri, 23 Aug 2019 21:49:49 GMT\"0x8D72813D2250553\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "f661d4f8-6e88-4d97-8933-2824074976f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8ac785633d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbca2-301e-0094-13fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:48 GMT", + "x-ms-client-request-id" : "ebbb86a0-4435-4911-bcd5-909c896930da" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail8ac785633d", "javablobclearpagesacfail175136b1ebcdbcdae14cbe", "143a962c-a042-4bc9-af7e-a525c4e151ae" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[2].json new file mode 100644 index 000000000000..19b5428a0c0f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail47862397b1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D24629AD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbcb3-301e-0094-22fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "6b13083d-5ca7-4d39-bb64-13d8a2fbdefa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail47862397b1/javablobclearpagesacfail152163b6a263ed5ff646b8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D25264A9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbce0-301e-0094-4afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "f37a71b5-a86c-4e6d-9146-2088ddfee2e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail47862397b1/javablobclearpagesacfail152163b6a263ed5ff646b8?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "5PHfSgKXlCU=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "ETag" : "\"0x8D72813D2579611\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbcf2-301e-0094-5bfc-5950b8000000", + "x-ms-client-request-id" : "588c6cad-fa15-442b-b696-8c4b3a872c02" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail47862397b1/javablobclearpagesacfail152163b6a263ed5ff646b8?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fbcfc-301e-0094-64fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fbcfc-301e-0094-64fc-5950b8000000\nTime:2019-08-23T21:49:49.4949057Z", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "80e6a22a-33c4-4d89-a8f1-bf4f5793845a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbd0d-301e-0094-74fc-5950b8000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail47862397b1Fri, 23 Aug 2019 21:49:49 GMT\"0x8D72813D24629AD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "af7a5a90-10a6-4311-8bb3-d3e7d03d8692", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail47862397b1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbd16-301e-0094-7dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "e5d2bd4e-d669-42ee-a8c7-231fa1656021" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail47862397b1", "javablobclearpagesacfail152163b6a263ed5ff646b8", "8fef2b27-f471-4c84-a319-2b2f0695e2dd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[3].json new file mode 100644 index 000000000000..ebf116e7a05b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[3].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8c03330638?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D269BF90\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbd28-301e-0094-0efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "899e0e33-5393-49de-8b17-b69a4a28d0e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8c03330638/javablobclearpagesacfail147207b935e8c82dd347ab", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D26F429E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbd36-301e-0094-19fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "d6a3f9df-78dd-4c9a-9fad-7b9629130fec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8c03330638/javablobclearpagesacfail147207b935e8c82dd347ab?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "mQXOPhxx4/I=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "ETag" : "\"0x8D72813D273FEBC\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbd50-301e-0094-2dfc-5950b8000000", + "x-ms-client-request-id" : "fb6d79dd-05bb-4489-86f3-7a5ef886a721" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8c03330638/javablobclearpagesacfail147207b935e8c82dd347ab", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D273FEBC\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:49 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fbd60-301e-0094-3bfc-5950b8000000", + "x-ms-client-request-id" : "04ede7c8-03d3-4072-a344-e0a9d17ee478", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8c03330638/javablobclearpagesacfail147207b935e8c82dd347ab?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fbd69-301e-0094-44fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fbd69-301e-0094-44fc-5950b8000000\nTime:2019-08-23T21:49:49.7301201Z", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "56e41925-0902-4c91-aaaf-3d881efa54f6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbd79-301e-0094-51fc-5950b8000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail8c03330638Fri, 23 Aug 2019 21:49:49 GMT\"0x8D72813D269BF90\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "bf9f62ab-21e7-477f-9a71-e2bafbcab0ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail8c03330638?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbd8a-301e-0094-61fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "ef7ed2de-2557-4a30-91ee-b9b326483072" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail8c03330638", "javablobclearpagesacfail147207b935e8c82dd347ab", "28acd555-81bb-4d86-b7e6-8a6de1013406" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[4].json new file mode 100644 index 000000000000..9abab21a32e6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[4].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila8f69925db?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D28DF1E5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbd9a-301e-0094-70fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "e7ae505d-fd18-4123-b553-8f266be272f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila8f69925db/javablobclearpagesacfail14182103056ba78f514747", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D2934E43\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbda9-301e-0094-7dfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "bafec08c-aecd-4ee2-ab09-d0112934b2d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila8f69925db/javablobclearpagesacfail14182103056ba78f514747?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "DfXM0e+dpVk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "ETag" : "\"0x8D72813D298F4F6\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbdb4-301e-0094-06fc-5950b8000000", + "x-ms-client-request-id" : "ba855fed-0c28-4fec-b525-3260eb85cff3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila8f69925db/javablobclearpagesacfail14182103056ba78f514747?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D298F4F6\"", + "x-ms-lease-id" : "4858d3ec-a207-4aa1-81d1-50458a0cc22e", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbdc7-301e-0094-15fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "866b286f-522d-471e-99db-c798e7160e01" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila8f69925db/javablobclearpagesacfail14182103056ba78f514747?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "f77fbde6-301e-0094-31fc-5950b8000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:f77fbde6-301e-0094-31fc-5950b8000000\nTime:2019-08-23T21:49:50.0023701Z", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "247f044b-bd38-4fb4-b4dd-aaf51c96d628", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbdf3-301e-0094-3dfc-5950b8000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfaila8f69925dbFri, 23 Aug 2019 21:49:49 GMT\"0x8D72813D28DF1E5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "3c435f87-5f18-47a8-b0df-5ae9f0f99977", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila8f69925db?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbdfb-301e-0094-45fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "decdaf19-b322-4587-9ecd-2cf8dac63477" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfaila8f69925db", "javablobclearpagesacfail14182103056ba78f514747", "e5842395-9953-4cc0-a728-ce3b899e6411" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[5].json new file mode 100644 index 000000000000..08ecfe21d02b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[5].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila283090031?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D2B7F1DA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbe1b-301e-0094-5ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "fa23e043-1cd4-4049-9a46-c293b663a853" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila283090031/javablobclearpagesacfail167952ab3856bfd4414c13", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D2BD75F4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbe2b-301e-0094-6cfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "e905c5b8-77a4-4719-a403-fcf49a23f7d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila283090031/javablobclearpagesacfail167952ab3856bfd4414c13?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "ZMxC090eAJI=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "ETag" : "\"0x8D72813D2C2CE82\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbe3f-301e-0094-7cfc-5950b8000000", + "x-ms-client-request-id" : "75f888f8-a908-4771-b209-052b57e83204" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila283090031/javablobclearpagesacfail167952ab3856bfd4414c13?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidInput", + "retry-after" : "0", + "Content-Length" : "220", + "StatusCode" : "400", + "x-ms-request-id" : "f77fbe4d-301e-0094-09fc-5950b8000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:f77fbe4d-301e-0094-09fc-5950b8000000\nTime:2019-08-23T21:49:50.2195676Z", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "165369a5-695f-48b0-9b6a-7e7f79184567", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbe59-301e-0094-14fc-5950b8000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfaila283090031Fri, 23 Aug 2019 21:49:50 GMT\"0x8D72813D2B7F1DA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "22d20c3c-aa3e-4238-969c-48ff7cd74281", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila283090031?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbe61-301e-0094-1bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:49 GMT", + "x-ms-client-request-id" : "a9e31206-a243-4eb8-82cc-e0cd1ad47342" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfaila283090031", "javablobclearpagesacfail167952ab3856bfd4414c13", "89d18247-6723-4731-844f-a76161ce6b3c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[6].json new file mode 100644 index 000000000000..dd6f6d2848fb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[6].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail7779201368?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D2DD8402\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbe7f-301e-0094-30fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "090dce8d-c4e2-49fb-afcf-275e4af5ee9a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail7779201368/javablobclearpagesacfail132498535fbb8f3ee34a9d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D2E2934B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbe86-301e-0094-35fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "2ed5c449-c6e9-48ca-888b-dc33ef324fa0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail7779201368/javablobclearpagesacfail132498535fbb8f3ee34a9d?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "+bSK//vH92Y=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "ETag" : "\"0x8D72813D2E74F67\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbe96-301e-0094-42fc-5950b8000000", + "x-ms-client-request-id" : "9593e61d-60a5-44a6-90fe-1633155874da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail7779201368/javablobclearpagesacfail132498535fbb8f3ee34a9d?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidInput", + "retry-after" : "0", + "Content-Length" : "220", + "StatusCode" : "400", + "x-ms-request-id" : "f77fbea2-301e-0094-4dfc-5950b8000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:f77fbea2-301e-0094-4dfc-5950b8000000\nTime:2019-08-23T21:49:50.4397690Z", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "6a02dcc4-995d-45d6-bfc3-b335103e6e77", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbea9-301e-0094-54fc-5950b8000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail7779201368Fri, 23 Aug 2019 21:49:50 GMT\"0x8D72813D2DD8402\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "ca955fea-fac8-4a32-ad79-a31eec62b9af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail7779201368?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbeaf-301e-0094-5afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "4318ec35-d96b-4ced-a814-e85be686882d" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail7779201368", "javablobclearpagesacfail132498535fbb8f3ee34a9d", "86a6a497-562c-47eb-a4bf-2f7cc83a581b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[7].json new file mode 100644 index 000000000000..cf372bf20181 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[7].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail99e30251e3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D2FA88B2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbec9-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "0b0d6e21-8695-4adc-9d12-95d10090cb1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail99e30251e3/javablobclearpagesacfail195771ef099969028146d9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3000D96\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbed5-301e-0094-77fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "b9c17342-8800-4612-a1cf-22dbba98ca06" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail99e30251e3/javablobclearpagesacfail195771ef099969028146d9?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "oa0KToiVFeo=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "ETag" : "\"0x8D72813D305661D\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbedb-301e-0094-7dfc-5950b8000000", + "x-ms-client-request-id" : "2958f921-bdf6-4795-a0d5-c78c158e1b6c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail99e30251e3/javablobclearpagesacfail195771ef099969028146d9?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SequenceNumberConditionNotMet", + "retry-after" : "0", + "Content-Length" : "250", + "StatusCode" : "412", + "x-ms-request-id" : "f77fbef5-301e-0094-15fc-5950b8000000", + "Body" : "SequenceNumberConditionNotMetThe sequence number condition specified was not met.\nRequestId:f77fbef5-301e-0094-15fc-5950b8000000\nTime:2019-08-23T21:49:50.6369491Z", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "2153622f-41e6-449f-a0cc-78125b29d804", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcclearpagesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbf02-301e-0094-20fc-5950b8000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail99e30251e3Fri, 23 Aug 2019 21:49:50 GMT\"0x8D72813D2FA88B2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "76c40cc0-5f2f-4ed1-a52b-119a8e01a6df", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail99e30251e3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbf10-301e-0094-29fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "7ace1877-c886-488c-8235-05edbb0cb522" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail99e30251e3", "javablobclearpagesacfail195771ef099969028146d9", "5c5df530-1d66-4af2-a2f3-489177f46341" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[0].json new file mode 100644 index 000000000000..6ea74a3275d4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd0670209360e2fcca0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C62B2FCB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05fc5-501e-00c0-69fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "108d57f8-9d83-4651-a13c-ed6a5a8be562" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd0670209360e2fcca0/javablobcreateac1pageblobapitestcreateacd0601245d463c3a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C630625A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06005-501e-00c0-21fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "0d454a25-b3e0-41af-b446-fd0085b163fd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd0670209360e2fcca0/javablobcreateac1pageblobapitestcreateacd0601245d463c3a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C634F756\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06040-501e-00c0-53fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "67a22a78-f501-4c3f-812a-a8679b31cc00" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06074-501e-00c0-04fc-59ba32000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateacd0670209360e2fcca0Fri, 23 Aug 2019 21:49:29 GMT\"0x8D72813C62B2FCB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "5cf2249a-d0ef-4b41-b8b9-c2dc70ccb3e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd0670209360e2fcca0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d060a2-501e-00c0-2cfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "cad22fa3-8a73-452b-a589-601b705eb149" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateacd0670209360e2fcca0", "javablobcreateac1pageblobapitestcreateacd0601245d463c3a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[1].json new file mode 100644 index 000000000000..a61d836d547b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac6a238928f219ffb8ae?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C64526C1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d060e7-501e-00c0-6afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "47078c21-f247-4181-b09e-1a6939abc346" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac6a238928f219ffb8ae/javablobcreateac1pageblobapitestcreateac6a2343386d3fa0b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C649E40C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0611e-501e-00c0-1dfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "309b011c-7ea5-429b-995c-4015d2179f86" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac6a238928f219ffb8ae/javablobcreateac1pageblobapitestcreateac6a2343386d3fa0b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C64E7907\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06148-501e-00c0-46fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "576341ab-bc2a-4f2e-8896-317cd9485f72" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06176-501e-00c0-6efc-59ba32000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac6a238928f219ffb8aeFri, 23 Aug 2019 21:49:29 GMT\"0x8D72813C64526C1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "c93ccc2e-429a-43ba-acb7-b829b521c98b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac6a238928f219ffb8ae?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0619a-501e-00c0-0efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "9737f6c4-57af-4a24-8efb-64e4d0e8dcf8" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac6a238928f219ffb8ae", "javablobcreateac1pageblobapitestcreateac6a2343386d3fa0b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[2].json new file mode 100644 index 000000000000..1857b4dbfa2d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd2280120d528deafa8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C6600855\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d061db-501e-00c0-47fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "8cd0fc47-c008-4f65-9724-98cda23042ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd2280120d528deafa8/javablobcreateac1pageblobapitestcreateacd2269065f28bc16", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C66513E1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0620a-501e-00c0-72fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "124d7fd0-6191-4e51-8e9e-2c63731b171e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd2280120d528deafa8/javablobcreateac1pageblobapitestcreateacd2269065f28bc16", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C66981CC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06238-501e-00c0-1efc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "20a0321e-4aee-4409-a3ef-afdedd4b5d9e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06261-501e-00c0-43fc-59ba32000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateacd2280120d528deafa8Fri, 23 Aug 2019 21:49:29 GMT\"0x8D72813C6600855\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "673f1d74-981d-41f9-9630-4342b3404743", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd2280120d528deafa8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06286-501e-00c0-66fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "623b5641-b58a-4c2c-ad49-9552d19ad9e0" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateacd2280120d528deafa8", "javablobcreateac1pageblobapitestcreateacd2269065f28bc16" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[3].json new file mode 100644 index 000000000000..c62bed39f420 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[3].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac9e77929486d87cec43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C67962E1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d062ba-501e-00c0-19fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "95aaee07-af30-4b29-9221-02fb1359011a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac9e77929486d87cec43/javablobcreateac1pageblobapitestcreateac9e7561380ab669d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C67E476A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d062dd-501e-00c0-3afc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "acbaf453-d402-4667-be05-3dda80466147" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac9e77929486d87cec43/javablobcreateac1pageblobapitestcreateac9e7561380ab669d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813C67E476A\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:29 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "77d0630d-501e-00c0-66fc-59ba32000000", + "x-ms-client-request-id" : "243ef98e-27fc-4437-bbf9-12b24a2a9620", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac9e77929486d87cec43/javablobcreateac1pageblobapitestcreateac9e7561380ab669d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C686D515\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06332-501e-00c0-07fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "c519fb82-599f-44c5-8110-6a5d3dafc9ad" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06363-501e-00c0-36fc-59ba32000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac9e77929486d87cec43Fri, 23 Aug 2019 21:49:29 GMT\"0x8D72813C67962E1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "3e7e0f2a-4f97-44eb-ad62-f27d1f87aa0d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac9e77929486d87cec43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0637f-501e-00c0-50fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "6f77bb21-a865-4fbb-958a-c5f2ef08cb2e" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac9e77929486d87cec43", "javablobcreateac1pageblobapitestcreateac9e7561380ab669d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[4].json new file mode 100644 index 000000000000..f5b600880e42 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[4].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac6291666576b0d3c34c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C69619A9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d063ba-501e-00c0-07fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "a567e233-ec16-4cca-a7a6-591e206eb725" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac6291666576b0d3c34c/javablobcreateac1pageblobapitestcreateac6299665233c14ea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C69AFE3F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d063ea-501e-00c0-34fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "3f818cf5-aba8-44d8-89ea-3e47f862b4bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac6291666576b0d3c34c/javablobcreateac1pageblobapitestcreateac6299665233c14ea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C69FBA61\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06411-501e-00c0-56fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "edbcdfd8-10aa-4cb8-a1ce-d39cecfa4e84" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0643c-501e-00c0-7dfc-59ba32000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac6291666576b0d3c34cFri, 23 Aug 2019 21:49:29 GMT\"0x8D72813C69619A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "49d287af-778e-40e1-8bfb-2f0482ee9ea9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac6291666576b0d3c34c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06454-501e-00c0-15fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "298182ef-3431-4c79-a30f-41a6786a83a3" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac6291666576b0d3c34c", "javablobcreateac1pageblobapitestcreateac6299665233c14ea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[5].json new file mode 100644 index 000000000000..71f3df426496 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[5].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac3dc114692aaeab9100?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C6AEB0A8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0647e-501e-00c0-3efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "9a4853bb-9d24-46b6-b236-2396c5da280a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac3dc114692aaeab9100/javablobcreateac1pageblobapitestcreateac3dc28494fb868b2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C6B3BC8F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0649d-501e-00c0-5cfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "a080111c-21d4-4336-98a8-20f2989ffffc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac3dc114692aaeab9100/javablobcreateac1pageblobapitestcreateac3dc28494fb868b2?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C6B3BC8F\"", + "x-ms-lease-id" : "e21df567-126f-41ae-9f38-2b2b92d9cfad", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d064d5-501e-00c0-0bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "72590903-d707-4675-80a0-a21e2f02fa22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac3dc114692aaeab9100/javablobcreateac1pageblobapitestcreateac3dc28494fb868b2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C6BCE685\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d064f3-501e-00c0-26fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "6b9042a2-b0c0-4d1c-bec5-d638e3ce5c6c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06517-501e-00c0-45fc-59ba32000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac3dc114692aaeab9100Fri, 23 Aug 2019 21:49:29 GMT\"0x8D72813C6AEB0A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "5c31de74-9021-4b5a-9bb1-f4bcef200fd4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateac0pageblobapitestcreateac3dc114692aaeab9100?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06532-501e-00c0-5efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "44cabfb0-0d4d-4328-ad63-c2981fcfedd9" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac3dc114692aaeab9100", "javablobcreateac1pageblobapitestcreateac3dc28494fb868b2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[0].json new file mode 100644 index 000000000000..43e84e2733d3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail6e49542124ff1a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C6CBDCA3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06570-501e-00c0-15fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "ff4409a5-1b59-497d-b8f1-bcba8519a292" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail6e49542124ff1a/javablobcreateacfail1pageblobapitestcreateacfail6e410331a3d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C6D10FBD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0659d-501e-00c0-40fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "68f89810-6330-48a4-a8f1-1e882c3349ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail6e49542124ff1a/javablobcreateacfail1pageblobapitestcreateacfail6e410331a3d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77d065dd-501e-00c0-79fc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77d065dd-501e-00c0-79fc-59ba32000000\nTime:2019-08-23T21:49:30.1824073Z", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "8fa1eb75-add7-4cfb-987c-2e49b0cf3aa2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d065f6-501e-00c0-12fc-59ba32000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfail6e49542124ff1aFri, 23 Aug 2019 21:49:30 GMT\"0x8D72813C6CBDCA3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "7a1ac661-da99-4a06-990b-63074626d4dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail6e49542124ff1a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06620-501e-00c0-37fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "37f5e24c-7d6f-476c-bfb3-f3989961dce0" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfail6e49542124ff1a", "javablobcreateacfail1pageblobapitestcreateacfail6e410331a3d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[1].json new file mode 100644 index 000000000000..a462ad4e2e9b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb8e520651c033c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C6E70C5A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06660-501e-00c0-72fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "259101a2-7c34-406a-a9cd-0ee2de1be13e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb8e520651c033c/javablobcreateacfail1pageblobapitestcreateacfailb8e473398a1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C6EC3F95\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06698-501e-00c0-24fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "d3ce4cc8-97d0-44a0-a80e-418dce608eca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb8e520651c033c/javablobcreateacfail1pageblobapitestcreateacfailb8e473398a1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77d066ba-501e-00c0-46fc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77d066ba-501e-00c0-46fc-59ba32000000\nTime:2019-08-23T21:49:30.3425599Z", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "28b1afec-715c-47cd-80e5-2fd925a4ea24", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d066d4-501e-00c0-5ffc-59ba32000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfailb8e520651c033cFri, 23 Aug 2019 21:49:30 GMT\"0x8D72813C6E70C5A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "e31b9bac-47e0-4b93-b71f-937a399a4b95", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb8e520651c033c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d066ec-501e-00c0-75fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "3f597f5b-9588-46e2-b19b-97c83109aaeb" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfailb8e520651c033c", "javablobcreateacfail1pageblobapitestcreateacfailb8e473398a1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[2].json new file mode 100644 index 000000000000..22148818bdb2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail0ec75373c07fdb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C6FF552F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06713-501e-00c0-17fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "0d5ad572-7f7b-44ae-95c8-34d668576def" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail0ec75373c07fdb/javablobcreateacfail1pageblobapitestcreateacfail0ec74839bba", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C704132F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0673c-501e-00c0-3afc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "764f24ac-1547-4bc0-9bca-d7738b979618" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail0ec75373c07fdb/javablobcreateacfail1pageblobapitestcreateacfail0ec74839bba", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77d0675d-501e-00c0-5bfc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77d0675d-501e-00c0-5bfc-59ba32000000\nTime:2019-08-23T21:49:30.4917004Z", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "1702dc76-2223-4bb5-961f-1acfc5078096", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06772-501e-00c0-6ffc-59ba32000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfail0ec75373c07fdbFri, 23 Aug 2019 21:49:30 GMT\"0x8D72813C6FF552F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "c703c7b9-4120-4ab5-86d8-749af998180e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail0ec75373c07fdb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06788-501e-00c0-04fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "7291161c-cb6e-414a-83db-b9e1f9625e06" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfail0ec75373c07fdb", "javablobcreateacfail1pageblobapitestcreateacfail0ec74839bba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[3].json new file mode 100644 index 000000000000..268efd36d83f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[3].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail4eb16259acb9ed?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C7168C4F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d067b6-501e-00c0-2ffc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "643b26ac-1cce-4fce-8e83-c9c9ec8221b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail4eb16259acb9ed/javablobcreateacfail1pageblobapitestcreateacfail4eb044695e8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C71CAA59\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d067de-501e-00c0-4ffc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-client-request-id" : "cc3d9db2-40d0-4aa5-a2e8-eba12ea7806f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail4eb16259acb9ed/javablobcreateacfail1pageblobapitestcreateacfail4eb044695e8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:29 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813C71CAA59\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:30 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "77d06805-501e-00c0-6efc-59ba32000000", + "x-ms-client-request-id" : "8a5adab2-d8bc-468c-b33f-93c5b022a6d2", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail4eb16259acb9ed/javablobcreateacfail1pageblobapitestcreateacfail4eb044695e8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "77d06824-501e-00c0-0afc-59ba32000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:77d06824-501e-00c0-0afc-59ba32000000\nTime:2019-08-23T21:49:30.6868862Z", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "4ca323d0-1cf7-480c-b3b0-c32dd6f87caa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06847-501e-00c0-28fc-59ba32000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfail4eb16259acb9edFri, 23 Aug 2019 21:49:30 GMT\"0x8D72813C7168C4F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "a8ade871-5d75-40bc-9c9b-6c5486485713", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail4eb16259acb9ed?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0685a-501e-00c0-3afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "b6f7c0ed-c22c-44c8-8596-6767b7876cf4" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfail4eb16259acb9ed", "javablobcreateacfail1pageblobapitestcreateacfail4eb044695e8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[4].json new file mode 100644 index 000000000000..69ab01048500 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[4].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail19f5627978c595?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C734CA0D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06883-501e-00c0-5dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "c458e071-4f1f-4a24-b91c-f82a6b3cbd92" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail19f5627978c595/javablobcreateacfail1pageblobapitestcreateacfail19f15710082", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C73A4BC5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d068b2-501e-00c0-09fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "6e7fe634-3649-496e-b003-f98bbb34960c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail19f5627978c595/javablobcreateacfail1pageblobapitestcreateacfail19f15710082?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C73A4BC5\"", + "x-ms-lease-id" : "e1885379-e0fd-4e4d-8c56-9c951814d167", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d068d4-501e-00c0-28fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "1554cd14-f0e0-46a3-aca9-ae2f75dc651c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail19f5627978c595/javablobcreateacfail1pageblobapitestcreateacfail19f15710082", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "77d068f7-501e-00c0-46fc-59ba32000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:77d068f7-501e-00c0-46fc-59ba32000000\nTime:2019-08-23T21:49:30.8830728Z", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "b11f6362-ca71-4809-b227-db846dcef471", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0690d-501e-00c0-5cfc-59ba32000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfail19f5627978c595Fri, 23 Aug 2019 21:49:30 GMT\"0x8D72813C734CA0D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "0478d80a-f217-4d4e-a307-c51272ccda3b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail19f5627978c595?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06945-501e-00c0-11fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "5ab3f8e5-5a5c-4ba9-ac3b-7fbadd001950" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfail19f5627978c595", "javablobcreateacfail1pageblobapitestcreateacfail19f15710082" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateallnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateallnull.json new file mode 100644 index 000000000000..d2f53642283f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateallnull.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull97a0863914d03?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C55BED69\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05872-501e-00c0-2bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "0ee3b817-6084-4e08-bd81-d3f3b1c7d8c5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull97a0863914d03/javablobcreateallnull1pageblobapitestcreateallnull97a7540542", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5623157\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d058a7-501e-00c0-5cfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "c620602b-cca6-4cd1-9ecd-95fb3bedbd35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull97a0863914d03/javablobcreateallnull2pageblobapitestcreateallnull97a0609134", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5673B9D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d058dc-501e-00c0-0dfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "a09ff286-d85a-4667-a853-702d9078ef7c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateallnull&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d0593c-501e-00c0-66fc-59ba32000000", + "Body" : "jtccreateallnulljtccreateallnull0pageblobapitestcreateallnull97a0863914d03Fri, 23 Aug 2019 21:49:27 GMT\"0x8D72813C55BED69\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "e443901a-c2e6-4102-93d6-4e2215d82f49", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull97a0863914d03?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05956-501e-00c0-7efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "4aa7fe63-b30a-46bc-a268-5a14a2ec734e" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateallnull0pageblobapitestcreateallnull97a0863914d03", "javablobcreateallnull1pageblobapitestcreateallnull97a7540542", "javablobcreateallnull2pageblobapitestcreateallnull97a0609134" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateerror.json new file mode 100644 index 000000000000..dc2a6dc6ee76 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateerror.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerror05412673738ccc1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C7574E9A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d0696d-501e-00c0-38fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "ddd0461a-a581-4e30-a607-f90b34747c1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerror05412673738ccc1/javablobcreateerror1pageblobapitestcreateerror0543716054b1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C76C164D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06a26-501e-00c0-5cfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "c4555fca-c4df-4696-9100-79d7f55030f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerror05412673738ccc1/javablobcreateerror1pageblobapitestcreateerror0543716054b1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "77d06a48-501e-00c0-7afc-59ba32000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:77d06a48-501e-00c0-7afc-59ba32000000\nTime:2019-08-23T21:49:31.1733495Zx-ms-lease-idid", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "c73107aa-da03-49ba-b895-ee8969133e41", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06a70-501e-00c0-1bfc-59ba32000000", + "Body" : "jtccreateerrorjtccreateerror0pageblobapitestcreateerror05412673738ccc1Fri, 23 Aug 2019 21:49:31 GMT\"0x8D72813C7574E9A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "508ff9c4-a145-4aea-bacd-1839b3c6c38b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerror05412673738ccc1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06a89-501e-00c0-31fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "11693dde-676d-42b0-b467-18949b1720c9" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateerror0pageblobapitestcreateerror05412673738ccc1", "javablobcreateerror1pageblobapitestcreateerror0543716054b1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[0].json new file mode 100644 index 000000000000..5d9b6e6b190f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[0].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders13c363909859c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5B40DFD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05b85-501e-00c0-6bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "c7461bc4-58b5-4cbe-a67a-2305608e94dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders13c363909859c/javablobcreateheaders1pageblobapitestcreateheaders13c5312891", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5B96770\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05bc1-501e-00c0-1efc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "83d7955c-604b-47bf-b540-794b9cb1ae08" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders13c363909859c/javablobcreateheaders1pageblobapitestcreateheaders13c5312891", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5BE2387\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05bf1-501e-00c0-4bfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "1f7257c0-e417-4a8f-961f-78bce732bea1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders13c363909859c/javablobcreateheaders1pageblobapitestcreateheaders13c5312891", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813C5BE2387\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:28 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "77d05c1d-501e-00c0-75fc-59ba32000000", + "x-ms-client-request-id" : "ed531c92-a1db-4756-9f60-7026bce614ae", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05c3e-501e-00c0-11fc-59ba32000000", + "Body" : "jtccreateheadersjtccreateheaders0pageblobapitestcreateheaders13c363909859cFri, 23 Aug 2019 21:49:28 GMT\"0x8D72813C5B40DFD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "221199a0-74a9-4dfc-b700-ab2e7fe6b0e3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders13c363909859c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05c6c-501e-00c0-3bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "5a042b53-120f-4fae-9608-df9818be8926" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0pageblobapitestcreateheaders13c363909859c", "javablobcreateheaders1pageblobapitestcreateheaders13c5312891" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[1].json new file mode 100644 index 000000000000..f65b7a740bf6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[1].json @@ -0,0 +1,140 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders6f940191faa59?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5D1FD90\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05ca3-501e-00c0-71fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "80f5b67e-d3d3-4e76-be2c-cb99848d6753" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders6f940191faa59/javablobcreateheaders1pageblobapitestcreateheaders6f94015022", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5D708D2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05cd7-501e-00c0-22fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "8b691de1-874e-4733-8b15-8483139b1460" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders6f940191faa59/javablobcreateheaders1pageblobapitestcreateheaders6f94015022", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5DC1321\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05d07-501e-00c0-51fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "9e27fa9f-017e-4264-b0d9-a2ea82fe1a7b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders6f940191faa59/javablobcreateheaders1pageblobapitestcreateheaders6f94015022", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:28 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "77d05d31-501e-00c0-79fc-59ba32000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "x-ms-blob-sequence-number" : "0", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D72813C5DC1321\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "c212a064-da23-49a6-b4e2-fec4c67c7f4d", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreateheaders&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05d5b-501e-00c0-20fc-59ba32000000", + "Body" : "jtccreateheadersjtccreateheaders0pageblobapitestcreateheaders6f940191faa59Fri, 23 Aug 2019 21:49:28 GMT\"0x8D72813C5D1FD90\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "feef67c9-0112-4f6b-bbe9-ee2dc9c7bbbb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders6f940191faa59?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05d74-501e-00c0-38fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "bd281a50-dc4e-41b0-97ca-85ac706f5fad" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0pageblobapitestcreateheaders6f940191faa59", "javablobcreateheaders1pageblobapitestcreateheaders6f94015022" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[0].json new file mode 100644 index 000000000000..2a95ecf944b8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[0].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata24825769cca4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5EEDB60\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05d95-501e-00c0-59fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "a297a9f5-05a7-4398-9f65-dfa1d15f86c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata24825769cca4/javablobcreatemetadata1pageblobapitestcreatemetadata248940260", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5F40DD7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05dd3-501e-00c0-14fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "815744b9-5ce9-4db2-96dd-3f6012ac007a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata24825769cca4/javablobcreatemetadata1pageblobapitestcreatemetadata248940260", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5FC4D42\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05e2a-501e-00c0-68fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "c07c9414-ee18-452a-82d6-10396bdce801" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata24825769cca4/javablobcreatemetadata1pageblobapitestcreatemetadata248940260", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813C5FC4D42\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:28 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "77d05e62-501e-00c0-1efc-59ba32000000", + "x-ms-client-request-id" : "ffb28b21-557b-4c72-9ba3-467f665bf395", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatemetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05e8f-501e-00c0-48fc-59ba32000000", + "Body" : "jtccreatemetadatajtccreatemetadata0pageblobapitestcreatemetadata24825769cca4Fri, 23 Aug 2019 21:49:28 GMT\"0x8D72813C5EEDB60\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "5cf81afc-6583-487f-9f8f-4765c5d2d02d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata24825769cca4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05eaa-501e-00c0-61fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "b47b8bcd-66db-4fd4-bff8-dbfdc2190df9" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0pageblobapitestcreatemetadata24825769cca4", "javablobcreatemetadata1pageblobapitestcreatemetadata248940260" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[1].json new file mode 100644 index 000000000000..a3c600615e59 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[1].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata8e123548a06f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C60EC73C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05ed1-501e-00c0-05fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "e9c14263-0795-4b9e-b3bc-efef061d0616" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata8e123548a06f/javablobcreatemetadata1pageblobapitestcreatemetadata8e124742d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C613F9BC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05f03-501e-00c0-34fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "4e97c317-11bd-453f-8243-800dafb177a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata8e123548a06f/javablobcreatemetadata1pageblobapitestcreatemetadata8e124742d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C61867A5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05f27-501e-00c0-56fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "9c6636b5-1445-4318-bec8-bfe69cd3106d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata8e123548a06f/javablobcreatemetadata1pageblobapitestcreatemetadata8e124742d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813C61867A5\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:28 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "77d05f47-501e-00c0-74fc-59ba32000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "ed322f23-9593-4991-ae57-796401289e38", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatemetadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05f6f-501e-00c0-18fc-59ba32000000", + "Body" : "jtccreatemetadatajtccreatemetadata0pageblobapitestcreatemetadata8e123548a06fFri, 23 Aug 2019 21:49:28 GMT\"0x8D72813C60EC73C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "23376eac-b44e-42dc-ae79-0a2681e1ebac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadata8e123548a06f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05fa0-501e-00c0-46fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:28 GMT", + "x-ms-client-request-id" : "e6e61c3f-ecbb-4ce7-91d2-d3f720e2e46d" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0pageblobapitestcreatemetadata8e123548a06f", "javablobcreatemetadata1pageblobapitestcreatemetadata8e124742d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemin.json new file mode 100644 index 000000000000..de49a95524c7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemin.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemin4ec9992635fbfd46b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C57DAE74\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05991-501e-00c0-32fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "eb6ddcbc-363a-43c7-b4b1-ed81a6b4e218" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemin4ec9992635fbfd46b/javablobcreatemin1pageblobapitestcreatemin4ec54158edb46f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C582B9A2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d059b1-501e-00c0-51fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "fe4f5015-05b7-40ff-9665-1fd56c66cc23" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemin4ec9992635fbfd46b/javablobcreatemin1pageblobapitestcreatemin4ec54158edb46f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C587EB09\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d059e2-501e-00c0-7dfc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "8ccc2e2a-cb08-4336-939b-32642792e2d1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05a15-501e-00c0-2cfc-59ba32000000", + "Body" : "jtccreateminjtccreatemin0pageblobapitestcreatemin4ec9992635fbfd46bFri, 23 Aug 2019 21:49:27 GMT\"0x8D72813C57DAE74\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "3108c7df-22cc-4bb1-b6d3-cac1720d35cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemin4ec9992635fbfd46b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05a3b-501e-00c0-4efc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "ba441317-d98a-4441-9177-9408ee3bf1c5" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemin0pageblobapitestcreatemin4ec9992635fbfd46b", "javablobcreatemin1pageblobapitestcreatemin4ec54158edb46f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatesequencenumber.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatesequencenumber.json new file mode 100644 index 000000000000..6b8623d91187 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatesequencenumber.json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatesequencenumber066534eed701a93dcd47bab?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C59693B5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05a6c-501e-00c0-79fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "6d8f019d-567e-454c-be87-8da5833110a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatesequencenumber066534eed701a93dcd47bab/javablobcreatesequencenumber1014567c102a7f1f1d47", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C59B77D6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05aa6-501e-00c0-28fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "a0d30cce-2efb-4b16-8abd-3291443eba56" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatesequencenumber066534eed701a93dcd47bab/javablobcreatesequencenumber1014567c102a7f1f1d47", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C5A033ED\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d05ad5-501e-00c0-4efc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "e3b3130d-6755-4dcd-b356-4dff7b30c2d3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatesequencenumber066534eed701a93dcd47bab/javablobcreatesequencenumber1014567c102a7f1f1d47", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "2", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813C5A033ED\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:28 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "77d05b03-501e-00c0-76fc-59ba32000000", + "x-ms-client-request-id" : "3c7def69-75d8-4212-b339-3cebc6c2fac9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccreatesequencenumber&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05b22-501e-00c0-11fc-59ba32000000", + "Body" : "jtccreatesequencenumberjtccreatesequencenumber066534eed701a93dcd47babFri, 23 Aug 2019 21:49:28 GMT\"0x8D72813C59693B5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "87120801-d6e3-49fa-9ff0-90dbb730b737", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccreatesequencenumber066534eed701a93dcd47bab?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d05b42-501e-00c0-2dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:27 GMT", + "x-ms-client-request-id" : "818089c3-5413-434b-ba05-0e2d73e8ac5f" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatesequencenumber066534eed701a93dcd47bab", "javablobcreatesequencenumber1014567c102a7f1f1d47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpageranges.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpageranges.json new file mode 100644 index 000000000000..6bc54b607b67 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpageranges.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpageranges7a24360429688?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3318412\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbf5d-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "da2783da-17ed-483a-b4d2-0e1cf06359ec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpageranges7a24360429688/javablobgetpageranges1pageblobapitestgetpageranges7a228613ba", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D336944C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbf75-301e-0094-80fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "eccdba7e-d7fa-4903-8bbf-fd265d4d5e3c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpageranges7a24360429688/javablobgetpageranges1pageblobapitestgetpageranges7a228613ba?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Rn2nxzJRw5U=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "ETag" : "\"0x8D72813D33B777B\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fbf81-301e-0094-0afc-5950b8000000", + "x-ms-client-request-id" : "164e9d7c-a8d9-4d44-9a60-8945443ea205" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpageranges7a24360429688/javablobgetpageranges1pageblobapitestgetpageranges7a228613ba?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "ETag" : "\"0x8D72813D33B777B\"", + "x-ms-request-id" : "f77fbf8f-301e-0094-14fc-5950b8000000", + "Body" : "0511", + "x-ms-client-request-id" : "fd407511-25f3-46bd-be9d-828b9ba61991", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpageranges&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbf9e-301e-0094-20fc-5950b8000000", + "Body" : "jtcgetpagerangesjtcgetpageranges0pageblobapitestgetpageranges7a24360429688Fri, 23 Aug 2019 21:49:50 GMT\"0x8D72813D3318412\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "60471673-99f0-47a6-8cb2-77547de47af8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpageranges7a24360429688?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbfaa-301e-0094-29fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "b53dc3aa-3ff5-4f77-9ea6-9a901c2c084d" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpageranges0pageblobapitestgetpageranges7a24360429688", "javablobgetpageranges1pageblobapitestgetpageranges7a228613ba", "6f52ba19-e080-4325-8a5d-c4e186ad5367" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[0].json new file mode 100644 index 000000000000..0d74b8585ee6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[0].json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacdc617925df6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D36FFB40\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc01d-301e-0094-0dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "ac73a077-c37f-4b84-a440-1f6afef50637" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacdc617925df6/javablobgetpagerangesac1pageblobapitestgetpagerangesacdc657500", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D375F6CB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc033-301e-0094-1efc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "076359d7-9de1-49c2-9dce-cc588b2f4224" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacdc617925df6/javablobgetpagerangesac1pageblobapitestgetpagerangesacdc657500?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "ETag" : "\"0x8D72813D375F6CB\"", + "x-ms-request-id" : "f77fc040-301e-0094-2bfc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "e24b004e-a5e9-4d82-9086-421ff63861eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc048-301e-0094-33fc-5950b8000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesacdc617925df6Fri, 23 Aug 2019 21:49:51 GMT\"0x8D72813D36FFB40\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "effd957f-7d80-4176-bf7b-5b07444f1280", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacdc617925df6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc055-301e-0094-3dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "4613d6a6-64e1-4704-a6e7-12d69c04d722" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesacdc617925df6", "javablobgetpagerangesac1pageblobapitestgetpagerangesacdc657500" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[1].json new file mode 100644 index 000000000000..1fab29d1cbf5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[1].json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacdac671130d2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D38A1919\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc06c-301e-0094-51fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "eec5321c-ab24-4cad-947c-6d660ddedf64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacdac671130d2/javablobgetpagerangesac1pageblobapitestgetpagerangesacdac40516", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D38F2A52\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc085-301e-0094-66fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "455419d7-f15c-41c9-b127-c9014408a210" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacdac671130d2/javablobgetpagerangesac1pageblobapitestgetpagerangesacdac40516?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "ETag" : "\"0x8D72813D38F2A52\"", + "x-ms-request-id" : "f77fc09a-301e-0094-7bfc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "cad5cb4d-a154-4924-82cc-e84e4de43ffe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc0ac-301e-0094-0cfc-5950b8000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesacdac671130d2Fri, 23 Aug 2019 21:49:51 GMT\"0x8D72813D38A1919\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "6a184611-d1c6-4c00-8fdf-bb867e4c4ed2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacdac671130d2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc0ba-301e-0094-1afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "7d5f7a41-8d8f-412e-84ef-6eec20691e29" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesacdac671130d2", "javablobgetpagerangesac1pageblobapitestgetpagerangesacdac40516" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[2].json new file mode 100644 index 000000000000..64bdc1b125f8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[2].json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesaceab41806d77?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3A261B6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc0ce-301e-0094-2bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "6cfe583a-82cc-41a7-9e05-2f0e4e19002b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesaceab41806d77/javablobgetpagerangesac1pageblobapitestgetpagerangesaceab98880", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3A7C165\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc0e6-301e-0094-41fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "1a984d31-041f-4ad9-affc-bc28e0ae8349" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesaceab41806d77/javablobgetpagerangesac1pageblobapitestgetpagerangesaceab98880?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "ETag" : "\"0x8D72813D3A7C165\"", + "x-ms-request-id" : "f77fc0f9-301e-0094-50fc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "007a47c7-3eda-4754-b3d9-bf28b94f0ebe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc100-301e-0094-55fc-5950b8000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesaceab41806d77Fri, 23 Aug 2019 21:49:51 GMT\"0x8D72813D3A261B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "2a1f2b95-f61b-410a-acea-1e931121c61d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesaceab41806d77?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc10a-301e-0094-5ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "18cec56f-5dc5-468b-91b6-cb10dcc1ff04" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesaceab41806d77", "javablobgetpagerangesac1pageblobapitestgetpagerangesaceab98880" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[3].json new file mode 100644 index 000000000000..2b954bf2403d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[3].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac9434173559e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3BAD174\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc11b-301e-0094-6bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "448c6657-a8c4-480a-a55d-f6c6c878fb78" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac9434173559e/javablobgetpagerangesac1pageblobapitestgetpagerangesac94304638", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3C16A37\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc12d-301e-0094-77fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "ae777c28-56bf-4e32-8cf7-8c7744d240d2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac9434173559e/javablobgetpagerangesac1pageblobapitestgetpagerangesac94304638", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D3C16A37\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:51 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fc149-301e-0094-10fc-5950b8000000", + "x-ms-client-request-id" : "ca8e8d55-e5ae-4a75-ac6c-0b532d13ba27", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac9434173559e/javablobgetpagerangesac1pageblobapitestgetpagerangesac94304638?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "ETag" : "\"0x8D72813D3C16A37\"", + "x-ms-request-id" : "f77fc152-301e-0094-18fc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "babb0c86-b01e-44cb-974e-f680f9fed1dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc160-301e-0094-23fc-5950b8000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac9434173559eFri, 23 Aug 2019 21:49:51 GMT\"0x8D72813D3BAD174\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "2a600706-5199-47bf-b4b0-d8dd07623625", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac9434173559e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc166-301e-0094-28fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "b8125479-c86a-448d-8746-efbeb99c573e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac9434173559e", "javablobgetpagerangesac1pageblobapitestgetpagerangesac94304638" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[4].json new file mode 100644 index 000000000000..0989ad2399f4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[4].json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac68804678592?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3DF03BB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc175-301e-0094-35fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "f3f9f4af-9c53-46d5-a66c-85ec3ec26278" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac68804678592/javablobgetpagerangesac1pageblobapitestgetpagerangesac68892829", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3E4641C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc189-301e-0094-47fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "5dcd6709-2ca3-4143-af72-cf5c9c58b00d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac68804678592/javablobgetpagerangesac1pageblobapitestgetpagerangesac68892829?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "ETag" : "\"0x8D72813D3E4641C\"", + "x-ms-request-id" : "f77fc19f-301e-0094-59fc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "373a1baf-1725-4a87-97ad-b87ffb08ce78", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc1ad-301e-0094-67fc-5950b8000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac68804678592Fri, 23 Aug 2019 21:49:52 GMT\"0x8D72813D3DF03BB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "48d4571b-4cee-4864-bc54-89a629cead32", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac68804678592?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc1bf-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "ca54049d-985a-49c6-bd3b-13484699b741" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac68804678592", "javablobgetpagerangesac1pageblobapitestgetpagerangesac68892829" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[5].json new file mode 100644 index 000000000000..8e1c4f808995 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[5].json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac13742901db2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3F996CB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc1cd-301e-0094-02fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "09c3ca97-d667-42e2-a4a3-faeef3740f46" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac13742901db2/javablobgetpagerangesac1pageblobapitestgetpagerangesac13793395", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3FF6CD2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc1e4-301e-0094-13fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "4a04ebae-33db-4b72-bac3-9ba9ebf21284" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac13742901db2/javablobgetpagerangesac1pageblobapitestgetpagerangesac13793395?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3FF6CD2\"", + "x-ms-lease-id" : "98f5837f-db49-453c-bc5a-b994780f3523", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc1f6-301e-0094-24fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "f3c969e8-0397-45e1-b376-ce2616b998ae" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac13742901db2/javablobgetpagerangesac1pageblobapitestgetpagerangesac13793395?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "ETag" : "\"0x8D72813D3FF6CD2\"", + "x-ms-request-id" : "f77fc1fc-301e-0094-29fc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "b7f133de-4f68-48ae-a0f3-e13c2071bf59", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc208-301e-0094-32fc-5950b8000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac13742901db2Fri, 23 Aug 2019 21:49:52 GMT\"0x8D72813D3F996CB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:51 GMT", + "x-ms-client-request-id" : "438a319c-7c02-4db5-913c-9211781b2a2a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac13742901db2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc21e-301e-0094-45fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "26de9c81-0bbc-4f44-bce2-61c9e6a1ea01" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac13742901db2", "javablobgetpagerangesac1pageblobapitestgetpagerangesac13793395" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[0].json new file mode 100644 index 000000000000..5a372d1804f2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[0].json @@ -0,0 +1,103 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail043753020ce54fe8dc40298?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4182277\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc234-301e-0094-55fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "5c521851-5ba0-428d-8f3b-7c4a31bf73be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail043753020ce54fe8dc40298/javablobgetpagerangesacfail13723456ffca69fa174b4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D41DAA9F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc247-301e-0094-61fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "f06e8372-a104-4a4c-91b6-81f739aecaf9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail043753020ce54fe8dc40298/javablobgetpagerangesacfail13723456ffca69fa174b4?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "f77fc259-301e-0094-71fc-5950b8000000", + "Body" : "", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "cd1f11a5-ba19-455a-be1a-a02b28f4147a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc260-301e-0094-77fc-5950b8000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail043753020ce54fe8dc40298Fri, 23 Aug 2019 21:49:52 GMT\"0x8D72813D4182277\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "3edbdb34-0acb-4b3c-a321-daf8d35e2917", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail043753020ce54fe8dc40298?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc26a-301e-0094-01fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "ff66ae32-d266-4e45-8d27-d886de52f891" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail043753020ce54fe8dc40298", "javablobgetpagerangesacfail13723456ffca69fa174b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[1].json new file mode 100644 index 000000000000..08c5f0b1a238 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0075185669ab094e1e49079?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4326759\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc27a-301e-0094-10fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "067796f3-87ef-40d2-b4a5-c22952d96268" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0075185669ab094e1e49079/javablobgetpagerangesacfail16653117eea54c1026439", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D437EFE1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc28f-301e-0094-21fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "fe92d8de-caef-4869-838f-4f942b8430c1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0075185669ab094e1e49079/javablobgetpagerangesacfail16653117eea54c1026439?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fc2a0-301e-0094-31fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fc2a0-301e-0094-31fc-5950b8000000\nTime:2019-08-23T21:49:52.6467875Z", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "fdc1b1af-d83c-4125-a85f-c2768149e38a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc2a8-301e-0094-39fc-5950b8000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail0075185669ab094e1e49079Fri, 23 Aug 2019 21:49:52 GMT\"0x8D72813D4326759\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "e922c469-9c34-4c6a-84be-5baddd35e359", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0075185669ab094e1e49079?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc2b4-301e-0094-43fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "d19e8d42-f513-499c-99ae-a0de3d0698e9" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail0075185669ab094e1e49079", "javablobgetpagerangesacfail16653117eea54c1026439" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[2].json new file mode 100644 index 000000000000..4e99c7f6ab58 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail043464d9144632e4ba4c069?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D44B9A8D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc2d0-301e-0094-5afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "96463c81-6096-4ad8-abd3-65b15e81198f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail043464d9144632e4ba4c069/javablobgetpagerangesacfail19672368c537a5e64d47c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D454F4D3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc2e5-301e-0094-6bfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "ee22fd5f-a312-47df-8da2-2e7ac118dea9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail043464d9144632e4ba4c069/javablobgetpagerangesacfail19672368c537a5e64d47c?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fc2f0-301e-0094-75fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fc2f0-301e-0094-75fc-5950b8000000\nTime:2019-08-23T21:49:52.8349591Z", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "24b37370-6d10-4978-ae3b-8fb8a7379c5c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc2f7-301e-0094-7cfc-5950b8000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail043464d9144632e4ba4c069Fri, 23 Aug 2019 21:49:52 GMT\"0x8D72813D44B9A8D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "05d75529-b50d-4234-bd00-ff5581d3a438", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail043464d9144632e4ba4c069?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc2fe-301e-0094-02fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "8439cd9d-3fb6-4cb1-a7c5-a33189c793c9" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail043464d9144632e4ba4c069", "javablobgetpagerangesacfail19672368c537a5e64d47c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[3].json new file mode 100644 index 000000000000..bdea250ead6c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[3].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0829479a5b1659ae964aac9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D46829EF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc318-301e-0094-18fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "2878d76e-c6a9-4f91-b1ff-5ddf3f4b6aeb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0829479a5b1659ae964aac9/javablobgetpagerangesacfail1183302ce1c7fd3a924c0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D46D8BF4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc332-301e-0094-2bfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "58d1e9da-2d4f-4d7a-97b6-86b43d9b74b5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0829479a5b1659ae964aac9/javablobgetpagerangesacfail1183302ce1c7fd3a924c0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D46D8BF4\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:52 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fc33e-301e-0094-36fc-5950b8000000", + "x-ms-client-request-id" : "9162b627-0f1f-4da1-9014-304254ad557a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0829479a5b1659ae964aac9/javablobgetpagerangesacfail1183302ce1c7fd3a924c0?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "f77fc347-301e-0094-3efc-5950b8000000", + "Body" : "", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "5eb34c66-fbcd-4f2b-b785-cf43adca5668", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc352-301e-0094-49fc-5950b8000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail0829479a5b1659ae964aac9Fri, 23 Aug 2019 21:49:52 GMT\"0x8D72813D46829EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "f7e493e9-58e9-4334-b8f1-b6145853936d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail0829479a5b1659ae964aac9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc35e-301e-0094-54fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "8effa432-cac7-45b8-b71d-6591c1c366ed" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail0829479a5b1659ae964aac9", "javablobgetpagerangesacfail1183302ce1c7fd3a924c0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[4].json new file mode 100644 index 000000000000..61b4e1c32592 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[4].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail04037800cd1ef74145439b9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4866764\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc380-301e-0094-74fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "3d4251f5-8fa7-440a-92e4-b57011cf90a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail04037800cd1ef74145439b9/javablobgetpagerangesacfail1370524942e623dc1b45a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D48B7B85\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc38c-301e-0094-7efc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "2608dc82-752b-4f44-af3f-828b8a8c0121" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail04037800cd1ef74145439b9/javablobgetpagerangesacfail1370524942e623dc1b45a?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D48B7B85\"", + "x-ms-lease-id" : "47b15803-691f-4a60-8e95-ceae637e28df", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc39e-301e-0094-0efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "e8d3211e-4ddd-45f2-ba32-a7fb43e77ac0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail04037800cd1ef74145439b9/javablobgetpagerangesacfail1370524942e623dc1b45a?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "f77fc3a8-301e-0094-18fc-5950b8000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:f77fc3a8-301e-0094-18fc-5950b8000000\nTime:2019-08-23T21:49:53.2353258Z", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "fa2fda55-8c30-4285-8c30-4374a772969b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc3b1-301e-0094-21fc-5950b8000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail04037800cd1ef74145439b9Fri, 23 Aug 2019 21:49:53 GMT\"0x8D72813D4866764\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "75045a01-a429-49a8-96c6-9e51a7c29a8e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesacfail04037800cd1ef74145439b9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc3ba-301e-0094-2afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "2194d04d-ef2c-477e-845d-a30e164e8d78" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail04037800cd1ef74145439b9", "javablobgetpagerangesacfail1370524942e623dc1b45a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiff.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiff.json new file mode 100644 index 000000000000..853782ae84f2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiff.json @@ -0,0 +1,218 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4BCED7F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc415-301e-0094-79fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "aecac4b7-fd59-4a00-bb77-401ea1cdf876" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452a/javablobgetpagerangesdiff17804757cab200caaf468b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4C1DB1B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc42f-301e-0094-0dfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "da3b1c38-5ed3-46cc-86a5-cf7294b04605" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452a/javablobgetpagerangesdiff17804757cab200caaf468b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4C6701B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc440-301e-0094-1cfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "381956ab-20b1-4f02-a4f9-a5378c4d4365" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452a/javablobgetpagerangesdiff17804757cab200caaf468b?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "KPFrAtAz8hY=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "ETag" : "\"0x8D72813D4CB7A6A\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fc454-301e-0094-2dfc-5950b8000000", + "x-ms-client-request-id" : "4922188c-1e15-438a-8d8f-4771d1429f0c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452a/javablobgetpagerangesdiff17804757cab200caaf468b?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:53.6119430Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4CB7A6A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc463-301e-0094-3afc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "7cf851da-ba5b-4fb6-9d2b-2448a86ea6fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452a/javablobgetpagerangesdiff17804757cab200caaf468b?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "SxF1ErNXV3Q=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "ETag" : "\"0x8D72813D4D58F08\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fc47b-301e-0094-4efc-5950b8000000", + "x-ms-client-request-id" : "e0429b49-9bc1-413e-bf80-827bd4c58eb2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452a/javablobgetpagerangesdiff17804757cab200caaf468b?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4D9D5D5\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc488-301e-0094-5afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "95f93fed-3341-4b5f-ad79-bd4b8a5dd03e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452a/javablobgetpagerangesdiff17804757cab200caaf468b?prevsnapshot=2019-08-23T21%3a49%3a53.6119430Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "1024", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "ETag" : "\"0x8D72813D4D9D5D5\"", + "x-ms-request-id" : "f77fc49b-301e-0094-6cfc-5950b8000000", + "Body" : "05115121023", + "x-ms-client-request-id" : "7b1a5b8a-9382-42f1-9468-925907836a91", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiff&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc4af-301e-0094-80fc-5950b8000000", + "Body" : "jtcgetpagerangesdiffjtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452aFri, 23 Aug 2019 21:49:53 GMT\"0x8D72813D4BCED7F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "28cc26bf-41b0-425b-8c24-cbd3b2f68203", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc4c4-301e-0094-14fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "45afc60d-fca1-478a-ba2b-4317b39c802d" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff7ba35452a", "javablobgetpagerangesdiff17804757cab200caaf468b", "9b4b823f-541d-4135-b45e-11d43f32f844", "e01c3f03-1d49-41ed-8888-87596536e5b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[0].json new file mode 100644 index 000000000000..335da7bf76bd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[0].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac015469f49702d662f64c57a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5135F18\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc553-301e-0094-11fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "68f4161c-4a93-4182-9796-6d2282ddd433" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac015469f49702d662f64c57a/javablobgetpagerangesdiffac137922d11d9792a3c0407", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5189BED\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc572-301e-0094-2cfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "b1241bb5-fc82-4a78-9dfe-5cbca78e99a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac015469f49702d662f64c57a/javablobgetpagerangesdiffac137922d11d9792a3c0407?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:54.1184293Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5189BED\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc581-301e-0094-39fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "70ac3156-a6ed-47d3-a970-ebf006ba9441" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac015469f49702d662f64c57a/javablobgetpagerangesdiffac137922d11d9792a3c0407?prevsnapshot=2019-08-23T21%3a49%3a54.1184293Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "ETag" : "\"0x8D72813D5189BED\"", + "x-ms-request-id" : "f77fc590-301e-0094-45fc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "e593effc-a993-4df1-adae-46a2bc99e3d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc5a4-301e-0094-59fc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac015469f49702d662f64c57aFri, 23 Aug 2019 21:49:54 GMT\"0x8D72813D5135F18\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "9143c20e-ec90-4734-bfeb-21f49cee859e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac015469f49702d662f64c57a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc5b2-301e-0094-66fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "6965a8b9-ce9b-4e9d-858d-a075a403de15" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac015469f49702d662f64c57a", "javablobgetpagerangesdiffac137922d11d9792a3c0407" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[1].json new file mode 100644 index 000000000000..d10f8e78fb1c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[1].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0732096eca2c47389148508?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D53E229C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc5e0-301e-0094-0ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "9368c96b-db43-438e-9ead-cdabbf956af3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0732096eca2c47389148508/javablobgetpagerangesdiffac1885092e4eac9dd953492", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D543D53D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc5f6-301e-0094-22fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "d3ea2639-ab30-4a83-b34d-58ab2fa1b411" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0732096eca2c47389148508/javablobgetpagerangesdiffac1885092e4eac9dd953492?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:54.4017004Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D543D53D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc60d-301e-0094-37fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "76748a58-86ea-4934-84b2-f27a285abec5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0732096eca2c47389148508/javablobgetpagerangesdiffac1885092e4eac9dd953492?prevsnapshot=2019-08-23T21%3a49%3a54.4017004Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "ETag" : "\"0x8D72813D543D53D\"", + "x-ms-request-id" : "f77fc61d-301e-0094-44fc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "1dc7dbc0-675d-47bd-9f17-b8dd69a76a16", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc627-301e-0094-4efc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac0732096eca2c47389148508Fri, 23 Aug 2019 21:49:54 GMT\"0x8D72813D53E229C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "36a18d1b-9aa9-4e45-882a-686bd9284d0c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0732096eca2c47389148508?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc639-301e-0094-5ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "e22e8be4-bf68-40f2-affe-cc2b5e74c30e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac0732096eca2c47389148508", "javablobgetpagerangesdiffac1885092e4eac9dd953492" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[2].json new file mode 100644 index 000000000000..4effda6af533 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[2].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0856259b8ece5e37f846d89?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D55CAE4C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc64e-301e-0094-70fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "48ed0924-1567-49bb-bc76-ddca6cf09155" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0856259b8ece5e37f846d89/javablobgetpagerangesdiffac1351801138ab6853ac483", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D561C4D7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc669-301e-0094-07fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "b869c54f-e73d-4ae7-b0fc-d6a531e5fe89" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0856259b8ece5e37f846d89/javablobgetpagerangesdiffac1351801138ab6853ac483?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:54.6038962Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D561C4D7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc683-301e-0094-1bfc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "001906fb-0829-4891-b15b-faee7bbad1f9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0856259b8ece5e37f846d89/javablobgetpagerangesdiffac1351801138ab6853ac483?prevsnapshot=2019-08-23T21%3a49%3a54.6038962Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "ETag" : "\"0x8D72813D561C4D7\"", + "x-ms-request-id" : "f77fc69a-301e-0094-2ffc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "b66df3e9-8d07-4a42-9eeb-cc8032a67593", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc6bb-301e-0094-4dfc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac0856259b8ece5e37f846d89Fri, 23 Aug 2019 21:49:54 GMT\"0x8D72813D55CAE4C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "bcaab385-2a7b-4a40-8615-dc58c465249d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac0856259b8ece5e37f846d89?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc6cf-301e-0094-60fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "d7248cd3-77df-46c0-83c3-0a6a3a114f15" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac0856259b8ece5e37f846d89", "javablobgetpagerangesdiffac1351801138ab6853ac483" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[3].json new file mode 100644 index 000000000000..16966d4baf42 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[3].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac046034968e508ddb6541638?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5817CF4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc6ea-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "d69563e7-e12f-4b7b-9a7f-2eb3cdbf2d0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac046034968e508ddb6541638/javablobgetpagerangesdiffac115553f05932736fee436", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D586E227\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc6fc-301e-0094-0afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "85b3d930-c64f-453c-9835-202481e9736f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac046034968e508ddb6541638/javablobgetpagerangesdiffac115553f05932736fee436?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:54.8431241Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D586E227\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc70d-301e-0094-19fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "4d757035-e2eb-4019-b8e4-45c9b74e4a1e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac046034968e508ddb6541638/javablobgetpagerangesdiffac115553f05932736fee436", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D586E227\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:54 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fc71f-301e-0094-2afc-5950b8000000", + "x-ms-client-request-id" : "ecb8d759-e2a4-4a2b-bfe7-4e34a2800575", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac046034968e508ddb6541638/javablobgetpagerangesdiffac115553f05932736fee436?prevsnapshot=2019-08-23T21%3a49%3a54.8431241Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "ETag" : "\"0x8D72813D586E227\"", + "x-ms-request-id" : "f77fc729-301e-0094-33fc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "bbc0fefe-4537-47e9-b51f-4731d1f4ac04", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc73c-301e-0094-46fc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac046034968e508ddb6541638Fri, 23 Aug 2019 21:49:54 GMT\"0x8D72813D5817CF4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "c7290bd6-9f88-4260-bf84-f53f736d3f79", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac046034968e508ddb6541638?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc753-301e-0094-5cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "388e2546-18f7-4756-8c33-3cfcba7c69f4" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac046034968e508ddb6541638", "javablobgetpagerangesdiffac115553f05932736fee436" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[4].json new file mode 100644 index 000000000000..cb1e94652eae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[4].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac024792786c00e4048945819?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5A4766D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc774-301e-0094-78fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "76b0f443-cf03-4ff9-b6ce-9a5a0c377491" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac024792786c00e4048945819/javablobgetpagerangesdiffac163527d381306d436b43a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5A9DC07\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc792-301e-0094-0ffc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "8e534c09-9435-485a-96b3-a5cbe31f262d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac024792786c00e4048945819/javablobgetpagerangesdiffac163527d381306d436b43a?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:55.0723447Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5A9DC07\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc7b5-301e-0094-2ffc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "21dbd324-f374-47a7-b41a-3568c48c54eb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac024792786c00e4048945819/javablobgetpagerangesdiffac163527d381306d436b43a?prevsnapshot=2019-08-23T21%3a49%3a55.0723447Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "ETag" : "\"0x8D72813D5A9DC07\"", + "x-ms-request-id" : "f77fc7c8-301e-0094-42fc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "e11b1ebb-c38c-4ddc-8bc5-c27d2e42fa59", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc7d7-301e-0094-50fc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac024792786c00e4048945819Fri, 23 Aug 2019 21:49:55 GMT\"0x8D72813D5A4766D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "ea0b1799-2764-49aa-8397-84ce5a7d5019", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac024792786c00e4048945819?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc7e8-301e-0094-5efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "c1335c63-a46e-4c9f-9fb6-759e6fccb50d" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac024792786c00e4048945819", "javablobgetpagerangesdiffac163527d381306d436b43a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[5].json new file mode 100644 index 000000000000..a8d8940ee1f9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[5].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00683186f685aef0cc4f119?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5C2B3E2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc7fc-301e-0094-70fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "5b4b44a6-631e-46b6-b6a9-488acd585f49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00683186f685aef0cc4f119/javablobgetpagerangesdiffac1686828b644bbfa0db40b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5C819D9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc816-301e-0094-02fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "c6a07e4a-e591-401c-921d-6eee76f5ce64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00683186f685aef0cc4f119/javablobgetpagerangesdiffac1686828b644bbfa0db40b?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:55.2695331Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5C819D9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc822-301e-0094-0cfc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "563b2e21-a794-4003-a92b-1545192374b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00683186f685aef0cc4f119/javablobgetpagerangesdiffac1686828b644bbfa0db40b?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5C819D9\"", + "x-ms-lease-id" : "07e96545-43c4-44f9-9d01-10459947bde2", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc831-301e-0094-19fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "x-ms-client-request-id" : "309f3c3b-3e30-4bb3-a075-88abd478c7c3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00683186f685aef0cc4f119/javablobgetpagerangesdiffac1686828b644bbfa0db40b?prevsnapshot=2019-08-23T21%3a49%3a55.2695331Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:54 GMT", + "ETag" : "\"0x8D72813D5C819D9\"", + "x-ms-request-id" : "f77fc844-301e-0094-2afc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "b2f70758-a09a-4ae1-b68d-94c6b7b909c9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc851-301e-0094-35fc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac00683186f685aef0cc4f119Fri, 23 Aug 2019 21:49:55 GMT\"0x8D72813D5C2B3E2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "db409dfb-ef85-4be0-8307-06ac338aff7d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffac00683186f685aef0cc4f119?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc862-301e-0094-42fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "9c1de257-95f9-4ed7-b36e-23a0794127cb" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac00683186f685aef0cc4f119", "javablobgetpagerangesdiffac1686828b644bbfa0db40b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[0].json new file mode 100644 index 000000000000..f9b2c517b939 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[0].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0782710b3224b01d8a4fe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5E51100\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc877-301e-0094-52fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "f5e1487d-691a-4c7c-a29a-3a38858f0013" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0782710b3224b01d8a4fe/javablobgetpagerangesdiffacfail1750888332c7c024a34", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5EA2924\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc88b-301e-0094-64fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "61038f60-dfc8-4205-a699-02d91b8a8403" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0782710b3224b01d8a4fe/javablobgetpagerangesdiffacfail1750888332c7c024a34?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:55.4917472Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D5EA2924\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc8a4-301e-0094-7cfc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "0fb6e54e-85cb-48bb-8821-2d1ce2b86263" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0782710b3224b01d8a4fe/javablobgetpagerangesdiffacfail1750888332c7c024a34?prevsnapshot=2019-08-23T21%3a49%3a55.4917472Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "f77fc8ae-301e-0094-06fc-5950b8000000", + "Body" : "", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "de1cc9c7-fc36-462a-bfe5-4f700d4b3f10", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc8b8-301e-0094-0ffc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail0782710b3224b01d8a4feFri, 23 Aug 2019 21:49:55 GMT\"0x8D72813D5E51100\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "4a96b6a0-510c-4083-bdd1-1c29d21e0d23", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail0782710b3224b01d8a4fe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc8c8-301e-0094-1dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "b67b4b4a-a3dc-45f7-ba43-73abcb1759b7" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail0782710b3224b01d8a4fe", "javablobgetpagerangesdiffacfail1750888332c7c024a34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[1].json new file mode 100644 index 000000000000..c7a33ccf7a3b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[1].json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail076838d5052273928d42a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D60FAD6D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc917-301e-0094-64fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "85cc42a5-45bf-45f3-bba5-8586690be1fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail076838d5052273928d42a/javablobgetpagerangesdiffacfail183809a4d20a01d18e4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6153B5C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc927-301e-0094-72fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "4d27f945-0311-4e82-808f-c62d2a5905ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail076838d5052273928d42a/javablobgetpagerangesdiffacfail183809a4d20a01d18e4?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:55.7800228Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6153B5C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc938-301e-0094-02fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "0cc9e54d-eb6d-47ba-b302-8621dd2bd0ab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail076838d5052273928d42a/javablobgetpagerangesdiffacfail183809a4d20a01d18e4?prevsnapshot=2019-08-23T21%3a49%3a55.7800228Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fc94c-301e-0094-13fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fc94c-301e-0094-13fc-5950b8000000\nTime:2019-08-23T21:49:55.8126830Z", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "a6b04319-ac5e-4116-a0f1-d9682a1f0df5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc95a-301e-0094-21fc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail076838d5052273928d42aFri, 23 Aug 2019 21:49:55 GMT\"0x8D72813D60FAD6D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "253f3a94-e807-4ed9-8192-9403a3c9b69d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail076838d5052273928d42a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc96a-301e-0094-30fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "0056c744-0527-400f-8647-49b894d3785a" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail076838d5052273928d42a", "javablobgetpagerangesdiffacfail183809a4d20a01d18e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[2].json new file mode 100644 index 000000000000..525d060676c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[2].json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail061581819e165dd1654a6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D62E11FD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc981-301e-0094-42fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "522d1bc4-4e53-4009-aca1-a8d64f07dfb0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail061581819e165dd1654a6/javablobgetpagerangesdiffacfail197724290e90c3021d4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D63303D1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc995-301e-0094-52fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "f31577c9-083b-4ace-8e6e-e208a26cc5f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail061581819e165dd1654a6/javablobgetpagerangesdiffacfail197724290e90c3021d4?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:55.9692041Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D63303D1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc9a3-301e-0094-5efc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "bd459992-f71b-43f5-84a0-b880ed0b8309" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail061581819e165dd1654a6/javablobgetpagerangesdiffacfail197724290e90c3021d4?prevsnapshot=2019-08-23T21%3a49%3a55.9692041Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fc9b2-301e-0094-6bfc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fc9b2-301e-0094-6bfc-5950b8000000\nTime:2019-08-23T21:49:55.9988537Z", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "2b813abc-75cd-4eef-b167-8bc3acfc534f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc9b9-301e-0094-72fc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail061581819e165dd1654a6Fri, 23 Aug 2019 21:49:55 GMT\"0x8D72813D62E11FD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "768ddf61-89a2-4333-ac19-af99af79984d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail061581819e165dd1654a6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc9c6-301e-0094-7ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "7fa22866-702f-4b6b-8d7b-fc86fe2b3828" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail061581819e165dd1654a6", "javablobgetpagerangesdiffacfail197724290e90c3021d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[3].json new file mode 100644 index 000000000000..e2ad718d54cb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[3].json @@ -0,0 +1,156 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail070137bf84e902f6094f6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D64A5324\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc9ea-301e-0094-1efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "f6691028-11f7-4e07-bff4-8a8b41e82f45" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail070137bf84e902f6094f6/javablobgetpagerangesdiffacfail1012001cbea535dd4c4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D64FBAA8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc9fe-301e-0094-2ffc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "93c5e6f4-f61c-4afb-a7c4-07dd39f453ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail070137bf84e902f6094f6/javablobgetpagerangesdiffacfail1012001cbea535dd4c4?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:56.1583863Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D64FBAA8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fca11-301e-0094-3efc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "a590292a-eedf-4838-880e-4d250a523f01" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail070137bf84e902f6094f6/javablobgetpagerangesdiffacfail1012001cbea535dd4c4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D64FBAA8\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:56 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fca29-301e-0094-54fc-5950b8000000", + "x-ms-client-request-id" : "400e4f97-3e71-40b3-ae10-be42c6fd8a24", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail070137bf84e902f6094f6/javablobgetpagerangesdiffacfail1012001cbea535dd4c4?prevsnapshot=2019-08-23T21%3a49%3a56.1583863Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "f77fca3c-301e-0094-65fc-5950b8000000", + "Body" : "", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "99836f01-782e-40e3-acfa-a15ad9baa935", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fca4e-301e-0094-74fc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail070137bf84e902f6094f6Fri, 23 Aug 2019 21:49:56 GMT\"0x8D72813D64A5324\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "e7ca3467-4ee0-47e0-be2b-cac0adc7f74b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail070137bf84e902f6094f6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fca61-301e-0094-03fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "0e8b9497-660c-49b1-83a8-5d52023e99d1" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail070137bf84e902f6094f6", "javablobgetpagerangesdiffacfail1012001cbea535dd4c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[4].json new file mode 100644 index 000000000000..7dc5482c1090 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[4].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail03978465a26a9be0534f8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D66C13E2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fca7f-301e-0094-14fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:55 GMT", + "x-ms-client-request-id" : "6d296ac4-c9d1-42a5-99be-f28eb5289640" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail03978465a26a9be0534f8/javablobgetpagerangesdiffacfail1793303b306ed8427b4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D671C9F3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fca97-301e-0094-22fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "513242cf-09cb-45d6-bf87-12c298981530" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail03978465a26a9be0534f8/javablobgetpagerangesdiffacfail1793303b306ed8427b4?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:56.3826009Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D671C9F3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcab2-301e-0094-37fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "71f43ca1-06da-4bdd-8698-d376d2cdff25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail03978465a26a9be0534f8/javablobgetpagerangesdiffacfail1793303b306ed8427b4?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D671C9F3\"", + "x-ms-lease-id" : "161ec213-34d0-478b-a269-919738011870", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcac0-301e-0094-44fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "0a4e069f-d25e-4829-b07d-863d7b1c971b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail03978465a26a9be0534f8/javablobgetpagerangesdiffacfail1793303b306ed8427b4?prevsnapshot=2019-08-23T21%3a49%3a56.3826009Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "f77fcacc-301e-0094-4dfc-5950b8000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:f77fcacc-301e-0094-4dfc-5950b8000000\nTime:2019-08-23T21:49:56.4452611Z", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "be52358a-c9ec-4319-8758-1df0b9fe7759", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcad9-301e-0094-56fc-5950b8000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail03978465a26a9be0534f8Fri, 23 Aug 2019 21:49:56 GMT\"0x8D72813D66C13E2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "02af9a9e-e5df-447d-a2ba-29010fa19e2b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffacfail03978465a26a9be0534f8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcaf4-301e-0094-69fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "a696d86b-a162-4dfb-a70c-0e629fd9f62d" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail03978465a26a9be0534f8", "javablobgetpagerangesdiffacfail1793303b306ed8427b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdifferror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdifferror.json new file mode 100644 index 000000000000..44994ea73ea2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdifferror.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdifferror041558f93bc28f51de4855?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D68EE652\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcb14-301e-0094-80fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "23a75030-f810-40e7-bd5c-855f89f9d02c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdifferror041558f93bc28f51de4855/javablobgetpagerangesdifferror160752e85149b149534", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6944E96\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcb21-301e-0094-09fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "f7629e7b-ed3d-4369-af3a-8e421a0fd15e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdifferror041558f93bc28f51de4855/javablobgetpagerangesdifferror24133246a6984d53824?prevsnapshot=snapshot&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "f77fcb3f-301e-0094-1dfc-5950b8000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:f77fcb3f-301e-0094-1dfc-5950b8000000\nTime:2019-08-23T21:49:56.6184202ZprevsnapshotsnapshotMust be in the specific snapshot date time format.", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "9ea14091-9566-48f4-876a-f80cc6885c74", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdifferror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcb49-301e-0094-26fc-5950b8000000", + "Body" : "jtcgetpagerangesdifferrorjtcgetpagerangesdifferror041558f93bc28f51de4855Fri, 23 Aug 2019 21:49:56 GMT\"0x8D72813D68EE652\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "a307e9d6-aba3-4b82-9bd0-81ed75bb1cd2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdifferror041558f93bc28f51de4855?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcb5a-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "022bbae8-866f-45e3-a345-f2d7cff9b937" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdifferror041558f93bc28f51de4855", "javablobgetpagerangesdifferror160752e85149b149534", "javablobgetpagerangesdifferror24133246a6984d53824" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffmin.json new file mode 100644 index 000000000000..ebb470105268 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffmin.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffmin000312fa3b6760575042c7a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4F17751\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc4d3-301e-0094-21fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "96258e8e-3ecd-48b9-b1a2-dc3c042b7020" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffmin000312fa3b6760575042c7a/javablobgetpagerangesdiffmin10775325d538329cd042", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4F66590\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc4e6-301e-0094-32fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "705a566c-4824-4fba-9a9b-c409d75d75ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffmin000312fa3b6760575042c7a/javablobgetpagerangesdiffmin10775325d538329cd042?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:53.9242426Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4F66590\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc507-301e-0094-4cfc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "4f34c082-939b-487b-a759-aa0a8574000f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffmin000312fa3b6760575042c7a/javablobgetpagerangesdiffmin10775325d538329cd042?prevsnapshot=2019-08-23T21%3a49%3a53.9242426Z&comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "ETag" : "\"0x8D72813D4F66590\"", + "x-ms-request-id" : "f77fc515-301e-0094-5afc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "c40b067c-45cb-4005-a5cd-035aa9417ca9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesdiffmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc520-301e-0094-65fc-5950b8000000", + "Body" : "jtcgetpagerangesdiffminjtcgetpagerangesdiffmin000312fa3b6760575042c7aFri, 23 Aug 2019 21:49:53 GMT\"0x8D72813D4F17751\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "262c0250-0f0a-44fd-a5c9-ee4fd4fcc6a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesdiffmin000312fa3b6760575042c7a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc537-301e-0094-77fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "9f7e63b7-6232-419f-b97e-c40d82cf25b3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffmin000312fa3b6760575042c7a", "javablobgetpagerangesdiffmin10775325d538329cd042" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangeserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangeserror.json new file mode 100644 index 000000000000..6a49f283098c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangeserror.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangeserror035534895806a9845c433c8d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4A4A4DD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc3cd-301e-0094-38fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:52 GMT", + "x-ms-client-request-id" : "f4e32330-cf8d-427d-8a7d-a334070f8650" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangeserror035534895806a9845c433c8d/javablobgetpagerangeserror17073274178ac1b2d14ea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D4A9B952\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fc3e0-301e-0094-48fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "a6bd0fe3-04c1-44f6-8059-f0e15b625480" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangeserror035534895806a9845c433c8d/javablobgetpagerangeserror2395506e6681658250495?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc3f1-301e-0094-58fc-5950b8000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:f77fc3f1-301e-0094-58fc-5950b8000000\nTime:2019-08-23T21:49:53.3924693Z", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "f9f281b7-a90a-4212-a79a-7e1e40279a63", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangeserror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc3fe-301e-0094-63fc-5950b8000000", + "Body" : "jtcgetpagerangeserrorjtcgetpagerangeserror035534895806a9845c433c8dFri, 23 Aug 2019 21:49:53 GMT\"0x8D72813D4A4A4DD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "6f766ef7-a22a-4095-ac86-d55b2cf75d9d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangeserror035534895806a9845c433c8d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc404-301e-0094-69fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:53 GMT", + "x-ms-client-request-id" : "0e874ed2-2ff4-454b-8321-11f793e0a708" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangeserror035534895806a9845c433c8d", "javablobgetpagerangeserror17073274178ac1b2d14ea", "javablobgetpagerangeserror2395506e6681658250495" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesmin.json new file mode 100644 index 000000000000..cfe07f2edc0c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesmin.json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmin671914297d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D3562BAC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbfdb-301e-0094-56fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "2531a9f4-2598-4dd3-a930-aba6ad96013c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmin671914297d/javablobgetpagerangesmin16444054976c696b1f4a91", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D35B8A85\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fbfe8-301e-0094-62fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "cae3374c-ce10-4fb2-8beb-9609c75cfc8e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmin671914297d/javablobgetpagerangesmin16444054976c696b1f4a91?comp=pagelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "ETag" : "\"0x8D72813D35B8A85\"", + "x-ms-request-id" : "f77fbffa-301e-0094-70fc-5950b8000000", + "Body" : "", + "x-ms-client-request-id" : "f34365be-80ab-402c-bada-98da700592d0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpagerangesmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fbfff-301e-0094-74fc-5950b8000000", + "Body" : "jtcgetpagerangesminjtcgetpagerangesmin0pageblobapitestgetpagerangesmin671914297dFri, 23 Aug 2019 21:49:51 GMT\"0x8D72813D3562BAC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "e6d2075f-6e09-4846-b3b8-28366a106a5c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmin671914297d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fc00d-301e-0094-80fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:50 GMT", + "x-ms-client-request-id" : "938b4c91-5ee8-40ab-af9d-76e5b1bd3bcf" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesmin0pageblobapitestgetpagerangesmin671914297d", "javablobgetpagerangesmin16444054976c696b1f4a91" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[0].json new file mode 100644 index 000000000000..83b5fe947a6e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[0].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia19e2464980a467c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6A95247\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcb74-301e-0094-48fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "5db612c6-5a94-440c-9b0f-51b92b05364b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia19e2464980a467c/javablobpagerangeia1pageblobapitestpagerangeia19e72056a476", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6AE4596\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcb87-301e-0094-59fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "98ea6855-00d1-42c0-85aa-bfe4cb3685f4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcpagerangeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcb99-301e-0094-68fc-5950b8000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia19e2464980a467cFri, 23 Aug 2019 21:49:56 GMT\"0x8D72813D6A95247\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "a903173a-34de-47f9-a193-51117a4a6684", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia19e2464980a467c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcbb0-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "14b2a3a6-2cb0-407d-85ac-b585322a55d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia19e2464980a467c", "javablobpagerangeia1pageblobapitestpagerangeia19e72056a476" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[1].json new file mode 100644 index 000000000000..e60355c970d8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[1].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiad5086816023819e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6BCDEDB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcbd1-301e-0094-12fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "553d62bc-481f-4aa2-bd51-7e8f9379d7bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiad5086816023819e/javablobpagerangeia1pageblobapitestpagerangeiad50431754748", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6C9000B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcc00-301e-0094-3afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "87c3f553-d059-42d4-bcc8-d66af00a2697" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcpagerangeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcc15-301e-0094-4cfc-5950b8000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeiad5086816023819eFri, 23 Aug 2019 21:49:56 GMT\"0x8D72813D6BCDEDB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "4a95aacc-f322-4117-8e4d-6c3ad8b804a3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiad5086816023819e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcc20-301e-0094-57fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "6f5ea773-c763-410a-9c72-b40ccf6b8ed4" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeiad5086816023819e", "javablobpagerangeia1pageblobapitestpagerangeiad50431754748" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[2].json new file mode 100644 index 000000000000..3b11eb16e1fd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[2].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia22938809d2e91b8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6D79906\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcc31-301e-0094-67fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "8ffbc186-3602-4114-a946-98095d2968f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia22938809d2e91b8/javablobpagerangeia1pageblobapitestpagerangeia229311777919", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6DCB3FD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcc48-301e-0094-78fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "9000994c-bc57-4568-a32e-41909d586f54" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcpagerangeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcc5f-301e-0094-08fc-5950b8000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia22938809d2e91b8Fri, 23 Aug 2019 21:49:57 GMT\"0x8D72813D6D79906\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "3f2a3091-b507-4f18-a8a5-607a2d4753fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia22938809d2e91b8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcc75-301e-0094-16fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "9abd8470-a1a1-4242-b427-0dadb8cbc380" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia22938809d2e91b8", "javablobpagerangeia1pageblobapitestpagerangeia229311777919" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[3].json new file mode 100644 index 000000000000..3e19b92e94f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[3].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia95a491534ae769b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6EBE91A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcc89-301e-0094-27fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "b1eefb5d-04a8-4b64-91a7-406face0043f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia95a491534ae769b/javablobpagerangeia1pageblobapitestpagerangeia95a57329667e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6F10444\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcc9e-301e-0094-39fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "4434ba90-0710-4f09-a3eb-b148b22a52ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcpagerangeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fccae-301e-0094-46fc-5950b8000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia95a491534ae769bFri, 23 Aug 2019 21:49:57 GMT\"0x8D72813D6EBE91A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "b39d0b86-eecd-4b03-bbcd-9a11bbe2ca32", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia95a491534ae769b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fccbe-301e-0094-51fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "430a609d-9be1-4af3-bc75-07932e036b84" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia95a491534ae769b", "javablobpagerangeia1pageblobapitestpagerangeia95a57329667e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[4].json new file mode 100644 index 000000000000..f357fb5ce824 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[4].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiadea40705bc0613e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D6FF9CCE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcccf-301e-0094-5ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "431f1acd-c688-45dc-9196-22d42ec14e01" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiadea40705bc0613e/javablobpagerangeia1pageblobapitestpagerangeiadea14733a089", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D704911A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcce1-301e-0094-6cfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "ba7959e7-463c-40b1-b17b-77944dabf0ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcpagerangeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fccf3-301e-0094-7bfc-5950b8000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeiadea40705bc0613eFri, 23 Aug 2019 21:49:57 GMT\"0x8D72813D6FF9CCE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:56 GMT", + "x-ms-client-request-id" : "79c6677b-5da3-43d1-98b1-c33e6ffeb428", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiadea40705bc0613e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fccfd-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "1b7afacf-7f15-4a54-a61a-bd014dabb691" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeiadea40705bc0613e", "javablobpagerangeia1pageblobapitestpagerangeiadea14733a089" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[5].json new file mode 100644 index 000000000000..1a2965635f13 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[5].json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia288282710a0fd40?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7143B14\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcd1a-301e-0094-1afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "f8f1960c-b55e-4c4b-aac0-704c701661b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia288282710a0fd40/javablobpagerangeia1pageblobapitestpagerangeia28871799de2c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7197DC2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcd37-301e-0094-34fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "f6791bad-c991-441e-8430-c89fcdf91a7a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcpagerangeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcd4c-301e-0094-47fc-5950b8000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia288282710a0fd40Fri, 23 Aug 2019 21:49:57 GMT\"0x8D72813D7143B14\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "7b33e6e4-7a92-4dd5-b5bc-00519edf1876", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia288282710a0fd40?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcd55-301e-0094-4ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "196e2414-254d-4f2b-aa62-007b45eec532" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia288282710a0fd40", "javablobpagerangeia1pageblobapitestpagerangeia28871799de2c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresize.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresize.json new file mode 100644 index 000000000000..4e5a44b2d723 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresize.json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresize0pageblobapitestresize57588046294bcc70fe60?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7283CF6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcd6f-301e-0094-65fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "fa16db78-b8eb-44c5-8dde-075b1c489cd1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresize0pageblobapitestresize57588046294bcc70fe60/javablobresize1pageblobapitestresize575076003358171f6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7310329\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcd82-301e-0094-77fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "229ce18d-d10d-4bf2-be05-e7f2c7209202" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresize0pageblobapitestresize57588046294bcc70fe60/javablobresize1pageblobapitestresize575076003358171f6?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7376D5C\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fcda2-301e-0094-12fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "d33236b3-93d6-43c0-95aa-1b883c59411a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresize0pageblobapitestresize57588046294bcc70fe60/javablobresize1pageblobapitestresize575076003358171f6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D7376D5C\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:57 GMT", + "Content-Length" : "1024", + "x-ms-request-id" : "f77fcdb8-301e-0094-21fc-5950b8000000", + "x-ms-client-request-id" : "ae7edb43-9f08-4a44-896f-9f6572444828", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresize&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcdcc-301e-0094-31fc-5950b8000000", + "Body" : "jtcresizejtcresize0pageblobapitestresize57588046294bcc70fe60Fri, 23 Aug 2019 21:49:57 GMT\"0x8D72813D7283CF6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "d38c4166-1a32-4d88-822f-0bffe438febf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresize0pageblobapitestresize57588046294bcc70fe60?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcde4-301e-0094-44fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "1a0fe1c0-4f26-4b02-b893-2a9b998ae79a" + }, + "Exception" : null + } ], + "variables" : [ "jtcresize0pageblobapitestresize57588046294bcc70fe60", "javablobresize1pageblobapitestresize575076003358171f6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[0].json new file mode 100644 index 000000000000..67acfea2bc9e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac06a80523efee7b37c2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7641B6C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fce8c-301e-0094-4afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "fe5cdd40-03bc-4f8d-9590-40f5018efa83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac06a80523efee7b37c2/javablobresizeac1pageblobapitestresizeac06a20840f03530a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D769AD41\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcea2-301e-0094-5efc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "215543be-d575-46bd-93b7-75cf2cdf3295" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac06a80523efee7b37c2/javablobresizeac1pageblobapitestresizeac06a20840f03530a?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D76EB78B\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fceba-301e-0094-73fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "7bb1adaa-aa1e-4262-a38d-b2e75f54c9b3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcec5-301e-0094-7efc-5950b8000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac06a80523efee7b37c2Fri, 23 Aug 2019 21:49:57 GMT\"0x8D72813D7641B6C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "816b284a-f8f4-406e-bd25-ae3bc78bbc79", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac06a80523efee7b37c2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcee5-301e-0094-18fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "2d0e1129-ec32-4734-9409-6dd24839ae68" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac06a80523efee7b37c2", "javablobresizeac1pageblobapitestresizeac06a20840f03530a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[1].json new file mode 100644 index 000000000000..285718639525 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacf1b13732b7321db09d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D77E122A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcf09-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "3d292fbc-00a9-4cf1-8ce3-bed95f472e25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacf1b13732b7321db09d/javablobresizeac1pageblobapitestresizeacf1b741975ee3253", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7832EF7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcf1b-301e-0094-40fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "08e42a77-222a-421c-b1de-de32c93fa74b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacf1b13732b7321db09d/javablobresizeac1pageblobapitestresizeacf1b741975ee3253?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7ABA875\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fcfbb-301e-0094-46fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "aeca6948-4a30-4806-a229-cf682d9e41b5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcfc9-301e-0094-4efc-5950b8000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeacf1b13732b7321db09dFri, 23 Aug 2019 21:49:58 GMT\"0x8D72813D77E122A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "1eabfa51-6e78-45db-8d48-b86aad0c74cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacf1b13732b7321db09d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fcfd7-301e-0094-5bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "68a0f30c-1b67-40f1-aac9-093829a1d037" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeacf1b13732b7321db09d", "javablobresizeac1pageblobapitestresizeacf1b741975ee3253" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[2].json new file mode 100644 index 000000000000..8bf2ab93391c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacb2590390132ebbe257?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7BA3ED8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fcfec-301e-0094-6bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "a0d9517d-b104-43e6-b758-89dd84a78f87" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacb2590390132ebbe257/javablobresizeac1pageblobapitestresizeacb259054359c49d5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7BF8383\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd004-301e-0094-7efc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "4f6ecbca-5c72-4c0b-b92e-bb317d750d9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacb2590390132ebbe257/javablobresizeac1pageblobapitestresizeacb259054359c49d5?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7C48DC9\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd012-301e-0094-0afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "cf22a3c3-23b0-4a89-907f-6edab9425af0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd023-301e-0094-1afc-5950b8000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeacb2590390132ebbe257Fri, 23 Aug 2019 21:49:58 GMT\"0x8D72813D7BA3ED8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "d09519bb-9528-4746-af78-a36f3936f795", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacb2590390132ebbe257?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd030-301e-0094-24fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "b205fa99-cb55-43e2-9bc0-2f19bf85c998" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeacb2590390132ebbe257", "javablobresizeac1pageblobapitestresizeacb259054359c49d5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[3].json new file mode 100644 index 000000000000..1f08fa0d9acd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[3].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac12c5170889b8e532fc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7D3C043\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd04d-301e-0094-3ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "35a4c8bc-b948-4169-8d44-6842597f4ea0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac12c5170889b8e532fc/javablobresizeac1pageblobapitestresizeac12c8213567feb4a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7D9535A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd064-301e-0094-51fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "afa45bef-8b41-4478-a115-a11cffb55540" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac12c5170889b8e532fc/javablobresizeac1pageblobapitestresizeac12c8213567feb4a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D7D9535A\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:58 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fd082-301e-0094-67fc-5950b8000000", + "x-ms-client-request-id" : "9469d002-83a4-41a0-8b2d-f7ffb0098961", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac12c5170889b8e532fc/javablobresizeac1pageblobapitestresizeac12c8213567feb4a?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7E22F30\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd095-301e-0094-78fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "5df5bc5a-d088-415a-9dc0-b3b0569c82ed" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd0ae-301e-0094-0cfc-5950b8000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac12c5170889b8e532fcFri, 23 Aug 2019 21:49:58 GMT\"0x8D72813D7D3C043\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "f2da0e9f-b915-41df-8aa8-0f3a11d13c99", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac12c5170889b8e532fc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd0c0-301e-0094-1bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "7c460034-b8c4-423b-93c8-c516c032d5d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac12c5170889b8e532fc", "javablobresizeac1pageblobapitestresizeac12c8213567feb4a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[4].json new file mode 100644 index 000000000000..53392120a9a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[4].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac09b096273bf4a6587d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7F04FA5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd0cb-301e-0094-26fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "a7f0940c-c583-461d-8aba-7a7a749935ab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac09b096273bf4a6587d/javablobresizeac1pageblobapitestresizeac09b2263663cbb01", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7F76A1E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd0e2-301e-0094-37fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "d03aee09-db70-40bc-b779-ae3ea5a64b72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac09b096273bf4a6587d/javablobresizeac1pageblobapitestresizeac09b2263663cbb01?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7FCE9A9\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd0f7-301e-0094-49fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "5157ad46-8370-4088-9f25-7e369331ddd7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd105-301e-0094-53fc-5950b8000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac09b096273bf4a6587dFri, 23 Aug 2019 21:49:58 GMT\"0x8D72813D7F04FA5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "c198e7db-a229-4e28-92d5-5f3e11ba7d95", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac09b096273bf4a6587d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd113-301e-0094-5ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "bbca71fe-6093-4849-a308-06ecdc1ff016" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac09b096273bf4a6587d", "javablobresizeac1pageblobapitestresizeac09b2263663cbb01" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[5].json new file mode 100644 index 000000000000..56ccc1c82d80 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[5].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacfd2517215eaed4cce2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D80B5811\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd12c-301e-0094-74fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "b76a599c-27d0-41b7-974a-9ccb91cee0f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacfd2517215eaed4cce2/javablobresizeac1pageblobapitestresizeacfd2900155d34cc7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D811FD77\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd15b-301e-0094-1cfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "e3fa7551-6dd2-46b1-a6c1-e1d3156c1072" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacfd2517215eaed4cce2/javablobresizeac1pageblobapitestresizeacfd2900155d34cc7?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D811FD77\"", + "x-ms-lease-id" : "f0486b63-5a8a-42c8-a7a5-f90aae50e406", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd172-301e-0094-31fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "2b6e0206-2cc6-4d26-90d0-cb5a978a6216" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacfd2517215eaed4cce2/javablobresizeac1pageblobapitestresizeacfd2900155d34cc7?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D81B4E93\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd18a-301e-0094-46fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "980f4df1-5325-4fc3-811f-5800d614b417" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd1ae-301e-0094-66fc-5950b8000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeacfd2517215eaed4cce2Fri, 23 Aug 2019 21:49:59 GMT\"0x8D72813D80B5811\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "9f206859-bea4-42de-8ece-70e4ccadf9bf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacfd2517215eaed4cce2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd1c4-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "62497c1b-2a4d-4fc5-92b3-cfcdebb1cbea" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeacfd2517215eaed4cce2", "javablobresizeac1pageblobapitestresizeacfd2900155d34cc7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[0].json new file mode 100644 index 000000000000..373c949fe54c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail46143689086cd0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D82CCA93\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd1d7-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "0f2786ca-f8ec-4e8a-86ae-2a50935951a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail46143689086cd0/javablobresizeacfail1pageblobapitestresizeacfail46175779cb9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D831E95B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd1ec-301e-0094-12fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "b782a6a1-a37f-437a-a10c-65ac41c1fbfb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail46143689086cd0/javablobresizeacfail1pageblobapitestresizeacfail46175779cb9?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fd1f8-301e-0094-1dfc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fd1f8-301e-0094-1dfc-5950b8000000\nTime:2019-08-23T21:49:59.3178900Z", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "f86e8c93-67ad-4d80-bb08-0fb44cdc8021", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd206-301e-0094-27fc-5950b8000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfail46143689086cd0Fri, 23 Aug 2019 21:49:59 GMT\"0x8D72813D82CCA93\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:58 GMT", + "x-ms-client-request-id" : "8e28aa94-3e7c-4153-82bb-e5cb09ba48e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail46143689086cd0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd213-301e-0094-32fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "32899ff9-ccf7-43d8-a5a9-fa8a04d66eb7" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfail46143689086cd0", "javablobresizeacfail1pageblobapitestresizeacfail46175779cb9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[1].json new file mode 100644 index 000000000000..04471010bea1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailf5a30907fdfc75?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D844EC15\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd225-301e-0094-41fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "443ff6b8-709c-4c47-9448-21f72f110055" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailf5a30907fdfc75/javablobresizeacfail1pageblobapitestresizeacfailf5a12649d61", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D84A8084\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd23c-301e-0094-54fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "1934d6fe-b0e0-4234-b032-5b4fbf9f05a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailf5a30907fdfc75/javablobresizeacfail1pageblobapitestresizeacfailf5a12649d61?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fd253-301e-0094-69fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fd253-301e-0094-69fc-5950b8000000\nTime:2019-08-23T21:49:59.4800374Z", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "e9da55f4-f95e-4c55-bb39-4f1b3263d0dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd266-301e-0094-7afc-5950b8000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfailf5a30907fdfc75Fri, 23 Aug 2019 21:49:59 GMT\"0x8D72813D844EC15\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "1be78a92-a5e6-4453-bbc9-1eb9b8bc17a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfailf5a30907fdfc75?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd276-301e-0094-07fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "079e9c87-2412-4f48-8a48-5c2db10de227" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfailf5a30907fdfc75", "javablobresizeacfail1pageblobapitestresizeacfailf5a12649d61" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[2].json new file mode 100644 index 000000000000..b13de5f117c2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaile6f6130138708d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D85DD121\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd286-301e-0094-17fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "fb4c45d9-f011-4602-b321-dfd36f974f95" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaile6f6130138708d/javablobresizeacfail1pageblobapitestresizeacfaile6f21472d77", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D862F08F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd292-301e-0094-22fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "ac8a7c18-4765-4a38-aceb-6ccdff46834d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaile6f6130138708d/javablobresizeacfail1pageblobapitestresizeacfaile6f21472d77?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fd2a2-301e-0094-30fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fd2a2-301e-0094-30fc-5950b8000000\nTime:2019-08-23T21:49:59.6351805Z", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "65698bd4-9717-48f3-91a7-691ea0b50da7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd2af-301e-0094-3afc-5950b8000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfaile6f6130138708dFri, 23 Aug 2019 21:49:59 GMT\"0x8D72813D85DD121\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "ce3d4602-2648-47d8-8cca-bef7d4eaf11a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaile6f6130138708d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd2b5-301e-0094-40fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "0cbe6eab-e3f7-4d9f-a6d5-6e6ca055abe5" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfaile6f6130138708d", "javablobresizeacfail1pageblobapitestresizeacfaile6f21472d77" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[3].json new file mode 100644 index 000000000000..31dbda2cfe72 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[3].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail3b3594953a1804?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D8757D59\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd2c5-301e-0094-4efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "dd508e14-794a-4688-8c11-a43cc12e99ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail3b3594953a1804/javablobresizeacfail1pageblobapitestresizeacfail3b391838900", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D87AC433\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd2ea-301e-0094-6afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "454ad7b6-36be-4407-936a-bcba01eaa6c2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail3b3594953a1804/javablobresizeacfail1pageblobapitestresizeacfail3b391838900", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D87AC433\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:59 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fd2ff-301e-0094-7ffc-5950b8000000", + "x-ms-client-request-id" : "7e5dbaf4-bca0-45d9-b278-d3d130752eec", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail3b3594953a1804/javablobresizeacfail1pageblobapitestresizeacfail3b391838900?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fd313-301e-0094-0ffc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fd313-301e-0094-0ffc-5950b8000000\nTime:2019-08-23T21:49:59.8223505Z", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "8512a6ae-a43c-4cc9-844f-6e2a81079c73", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd32a-301e-0094-23fc-5950b8000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfail3b3594953a1804Fri, 23 Aug 2019 21:49:59 GMT\"0x8D72813D8757D59\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "2122fe5a-157b-4913-b9ae-b6e5a53c92cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail3b3594953a1804?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd336-301e-0094-2dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "018ea4ab-1fb7-4cbd-842b-b1400f6f9689" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfail3b3594953a1804", "javablobresizeacfail1pageblobapitestresizeacfail3b391838900" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[4].json new file mode 100644 index 000000000000..5a3075e6bf58 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[4].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail524762540c2d1c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D891BE89\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd341-301e-0094-38fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "56779ec5-95b4-4611-b8bf-fb0d96179285" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail524762540c2d1c/javablobresizeacfail1pageblobapitestresizeacfail52432385f6c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D89753EC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd359-301e-0094-4cfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "d1784a6c-1a9e-4590-bf6d-34d51b259404" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail524762540c2d1c/javablobresizeacfail1pageblobapitestresizeacfail52432385f6c?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D89753EC\"", + "x-ms-lease-id" : "405c059d-8ecb-47d3-bdf0-076e2f95b4d1", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd375-301e-0094-63fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "4ec97589-f621-464d-9a3c-a4efc7699f1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail524762540c2d1c/javablobresizeacfail1pageblobapitestresizeacfail52432385f6c?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "f77fd392-301e-0094-7dfc-5950b8000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:f77fd392-301e-0094-7dfc-5950b8000000\nTime:2019-08-23T21:50:00.0125245Z", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "b7e9b0f4-e594-48be-8075-ddfdbbf89c12", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd3a4-301e-0094-0efc-5950b8000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfail524762540c2d1cFri, 23 Aug 2019 21:49:59 GMT\"0x8D72813D891BE89\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "fc7f76eb-a0e7-4070-bd7a-19e0b6442f18", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail524762540c2d1c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd3b6-301e-0094-1cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "160b458f-8151-471b-a855-0b84863269c2" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfail524762540c2d1c", "javablobresizeacfail1pageblobapitestresizeacfail52432385f6c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeerror.json new file mode 100644 index 000000000000..c89559153cd7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeerror.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror5ee53336ae162d7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D8AF1162\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd3c6-301e-0094-2afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "682db5a2-0689-4056-a895-e5a02814f5d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror5ee53336ae162d7/javablobresizeerror1pageblobapitestresizeerror5ee38423d344", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D8D04C59\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd442-301e-0094-11fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:59 GMT", + "x-ms-client-request-id" : "ea01413b-325e-4ff8-9899-a94d5a147f12" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror5ee53336ae162d7/javablobresizeerror2pageblobapitestresizeerror5ee15874fec1?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd458-301e-0094-21fc-5950b8000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:f77fd458-301e-0094-21fc-5950b8000000\nTime:2019-08-23T21:50:00.3568394Z", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "81352f1c-97d6-402d-80e4-ac940937153b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizeerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd467-301e-0094-2ffc-5950b8000000", + "Body" : "jtcresizeerrorjtcresizeerror0pageblobapitestresizeerror5ee53336ae162d7Fri, 23 Aug 2019 21:50:00 GMT\"0x8D72813D8AF1162\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "277312a1-e7e4-454b-955a-c45b862c2a1e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror5ee53336ae162d7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd472-301e-0094-39fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "fafb7aaf-e20e-4ec1-8e17-087b9d7edd06" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeerror0pageblobapitestresizeerror5ee53336ae162d7", "javablobresizeerror1pageblobapitestresizeerror5ee38423d344", "javablobresizeerror2pageblobapitestresizeerror5ee15874fec1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizemin.json new file mode 100644 index 000000000000..41f0daf9deb1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizemin.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin08504661ac24797c0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D74BD2D8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fce01-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "4db1bb62-982e-4b67-8828-b6a07030d5d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin08504661ac24797c0/javablobresizemin1pageblobapitestresizemin0856235390bd18", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D750C7F6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fce25-301e-0094-75fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "2e924b6d-9b11-4b96-9645-2918cd3ebabe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin08504661ac24797c0/javablobresizemin1pageblobapitestresizemin0856235390bd18?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D7558412\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fce42-301e-0094-0dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "c9980462-7092-4c4e-97f2-44144850392e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcresizemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fce5c-301e-0094-24fc-5950b8000000", + "Body" : "jtcresizeminjtcresizemin0pageblobapitestresizemin08504661ac24797c0Fri, 23 Aug 2019 21:49:57 GMT\"0x8D72813D74BD2D8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "e6c4d9ba-3015-4d00-b16b-fddde9edb4b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin08504661ac24797c0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fce6b-301e-0094-30fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:57 GMT", + "x-ms-client-request-id" : "6b7fdaae-4c95-403f-9fd7-207282c678b5" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizemin0pageblobapitestresizemin08504661ac24797c0", "javablobresizemin1pageblobapitestresizemin0856235390bd18" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[0].json new file mode 100644 index 000000000000..28189c92055a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[0].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber5ed176467695?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D8E4379E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd483-301e-0094-48fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "571262d3-76ab-4bfa-a690-5f669eae7f6b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber5ed176467695/javablobsequencenumber1pageblobapitestsequencenumber5ed65019a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D8E90A91\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd4a0-301e-0094-5cfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "5a7edf45-ea03-4e32-9256-43d1536d57fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber5ed176467695/javablobsequencenumber1pageblobapitestsequencenumber5ed65019a?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D8EEFF7A\"", + "x-ms-blob-sequence-number" : "5", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd4bb-301e-0094-70fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "06b2052f-86c9-489c-b4d7-ef6d754a42d5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber5ed176467695/javablobsequencenumber1pageblobapitestsequencenumber5ed65019a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "5", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D8EEFF7A\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:00 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fd4cc-301e-0094-7cfc-5950b8000000", + "x-ms-client-request-id" : "04446257-001f-4137-970e-19b9e2b97dd4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumber&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd4de-301e-0094-08fc-5950b8000000", + "Body" : "jtcsequencenumberjtcsequencenumber0pageblobapitestsequencenumber5ed176467695Fri, 23 Aug 2019 21:50:00 GMT\"0x8D72813D8E4379E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "175d89c9-7b48-4a73-9037-f6080fe1df17", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber5ed176467695?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd4ec-301e-0094-15fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "3de31cd9-01a4-44cf-92ae-faf5db94f7c8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumber0pageblobapitestsequencenumber5ed176467695", "javablobsequencenumber1pageblobapitestsequencenumber5ed65019a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[1].json new file mode 100644 index 000000000000..388ed8d78b45 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[1].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberd9029441714c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9016360\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd4fb-301e-0094-24fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "efb8d4ea-d4f1-4eb7-b31b-d8930fef1a58" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberd9029441714c/javablobsequencenumber1pageblobapitestsequencenumberd9077940f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D90684E1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd517-301e-0094-3afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "27711a93-5b35-4dc3-8f5c-30847fe25d70" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberd9029441714c/javablobsequencenumber1pageblobapitestsequencenumberd9077940f?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D90EEB51\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd52d-301e-0094-4bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "e3ddd98a-32ab-40a9-8ede-12f5eeea3a60" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberd9029441714c/javablobsequencenumber1pageblobapitestsequencenumberd9077940f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D90EEB51\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:00 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fd53b-301e-0094-57fc-5950b8000000", + "x-ms-client-request-id" : "c4b8190d-25cf-4b7c-bbc1-d17a19221580", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumber&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd545-301e-0094-60fc-5950b8000000", + "Body" : "jtcsequencenumberjtcsequencenumber0pageblobapitestsequencenumberd9029441714cFri, 23 Aug 2019 21:50:00 GMT\"0x8D72813D9016360\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "9be87ff7-4621-426a-9978-611e249c7e7f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberd9029441714c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd550-301e-0094-67fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "04720cd6-1552-4a2b-9620-8daf87763661" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumber0pageblobapitestsequencenumberd9029441714c", "javablobsequencenumber1pageblobapitestsequencenumberd9077940f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[2].json new file mode 100644 index 000000000000..a3fc25036332 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[2].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber56390629242c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D922FCF5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd569-301e-0094-79fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "1b43827b-48d8-4d9e-936c-27d903485dc5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber56390629242c/javablobsequencenumber1pageblobapitestsequencenumber563237603", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D92845EB\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd577-301e-0094-05fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "c13f76f6-6c71-4c95-b59c-15249343cead" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber56390629242c/javablobsequencenumber1pageblobapitestsequencenumber563237603?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D92CDAEF\"", + "x-ms-blob-sequence-number" : "2", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd585-301e-0094-11fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "d5c11992-bbdd-463a-88a8-0606528b9a7e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber56390629242c/javablobsequencenumber1pageblobapitestsequencenumber563237603", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "2", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D92CDAEF\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:00 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fd5a6-301e-0094-2efc-5950b8000000", + "x-ms-client-request-id" : "66aba7c9-70c8-4ece-8732-3c7cad6bbcdb", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumber&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd5ad-301e-0094-35fc-5950b8000000", + "Body" : "jtcsequencenumberjtcsequencenumber0pageblobapitestsequencenumber56390629242cFri, 23 Aug 2019 21:50:00 GMT\"0x8D72813D922FCF5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "11872413-6047-4a6c-b7cc-7eb148f0dc3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber56390629242c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd5be-301e-0094-45fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "730dacf3-c285-40e7-90bf-0d7b17a62760" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumber0pageblobapitestsequencenumber56390629242c", "javablobsequencenumber1pageblobapitestsequencenumber563237603" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[0].json new file mode 100644 index 000000000000..761e2a36239e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberace3c25794cc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D960D7BE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd62a-301e-0094-24fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "86618b58-09f1-42f2-bc70-28e117935eda" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberace3c25794cc/javablobsequencenumberac1956156f873910f98845a6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D965FA69\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd63e-301e-0094-31fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "b77f89ca-108c-409b-9393-4cb05fcbd5a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberace3c25794cc/javablobsequencenumberac1956156f873910f98845a6?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D96ADD93\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd650-301e-0094-3efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "b3ba9b07-8ad3-4167-b938-e96ecb69587d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd663-301e-0094-4afc-5950b8000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberace3c25794ccFri, 23 Aug 2019 21:50:01 GMT\"0x8D72813D960D7BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "48121d34-5820-4009-808e-a3da3dd4b863", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberace3c25794cc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd674-301e-0094-57fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "362b8a67-4033-4cc1-adc7-e72f86aded21" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberace3c25794cc", "javablobsequencenumberac1956156f873910f98845a6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[1].json new file mode 100644 index 000000000000..f6f23098a023 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac0788281045?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9792065\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd684-301e-0094-65fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "46976b64-8096-4fed-8efc-bfd0a7de177b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac0788281045/javablobsequencenumberac199529d2ee58fb52e6426c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D97E9173\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd691-301e-0094-6ffc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "ea2a0380-96f2-4791-b5b9-09f283169a7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac0788281045/javablobsequencenumberac199529d2ee58fb52e6426c?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D98374A2\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd6a8-301e-0094-01fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "bcc28cb9-8afc-4da0-8af6-c0c197d78e68" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd6bf-301e-0094-11fc-5950b8000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac0788281045Fri, 23 Aug 2019 21:50:01 GMT\"0x8D72813D9792065\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "8ddc81ce-2bd7-42c0-8459-b66e15f81819", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac0788281045?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd6cb-301e-0094-1cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "c3e73921-f289-4781-8cdc-e11de239b3f4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac0788281045", "javablobsequencenumberac199529d2ee58fb52e6426c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[2].json new file mode 100644 index 000000000000..52499bc0b285 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacfde36213cf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9920562\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd6e7-301e-0094-31fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "2af0826f-4be6-4910-b5ec-b19b7fbd1bfa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacfde36213cf/javablobsequencenumberac12120602e75b698c854071", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D997017D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd6f4-301e-0094-3afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "46838dbd-0cf9-4aac-b7b8-9e0d40ea828a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacfde36213cf/javablobsequencenumberac12120602e75b698c854071?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D99BBD8F\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd701-301e-0094-45fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "fa1e06d7-6aeb-4a99-bbd8-781b07a95630" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd70c-301e-0094-4ffc-5950b8000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberacfde36213cfFri, 23 Aug 2019 21:50:01 GMT\"0x8D72813D9920562\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "47accc46-9a49-4d69-b9ca-b18e447fe38f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacfde36213cf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd719-301e-0094-5cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "9d300bac-3fe9-4c04-aa92-ca59e22ec199" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberacfde36213cf", "javablobsequencenumberac12120602e75b698c854071" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[3].json new file mode 100644 index 000000000000..41d70087b54d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[3].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberace3a61786dc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9AA7520\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd72e-301e-0094-6efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "9e20ebfb-47b2-4bf2-8729-4910d6336fe2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberace3a61786dc/javablobsequencenumberac108927a0143f7c6b274871", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9AFE6B9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd74d-301e-0094-06fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "17c173d5-51b0-4cb0-b9bc-5d873efceedb" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberace3a61786dc/javablobsequencenumberac108927a0143f7c6b274871", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D9AFE6B9\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:01 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fd765-301e-0094-18fc-5950b8000000", + "x-ms-client-request-id" : "c0195ce9-b9ff-490b-9605-d3919a3f915a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberace3a61786dc/javablobsequencenumberac108927a0143f7c6b274871?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9BC6CF6\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd776-301e-0094-29fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "6c3b9187-cbb5-4ee5-9115-d9068c11c25f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd783-301e-0094-35fc-5950b8000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberace3a61786dcFri, 23 Aug 2019 21:50:01 GMT\"0x8D72813D9AA7520\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "15de6f47-7866-468d-945a-6951f2436b4f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberace3a61786dc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd791-301e-0094-43fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "3e44aba2-00b1-4a63-b5bd-c6fc857531a0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberace3a61786dc", "javablobsequencenumberac108927a0143f7c6b274871" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[4].json new file mode 100644 index 000000000000..d6cb5cc7e7c7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[4].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacf4240563fa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9CB4B42\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd7a6-301e-0094-54fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "893e7d2a-d318-4e32-b0a9-50ba0df3818a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacf4240563fa/javablobsequencenumberac13871090622b9a2bf34009", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9D06F20\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd7bc-301e-0094-65fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "f74c4b37-ab90-4e04-8923-3b97694b9599" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacf4240563fa/javablobsequencenumberac13871090622b9a2bf34009?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9D5523C\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd7cb-301e-0094-70fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "7d325a3f-c973-4f79-92e2-5ef7998518b2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd7df-301e-0094-01fc-5950b8000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberacf4240563faFri, 23 Aug 2019 21:50:01 GMT\"0x8D72813D9CB4B42\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "9597d172-4cc8-4a06-b880-83356b9e2866", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberacf4240563fa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd7f5-301e-0094-14fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "e049c7a9-bd2c-4087-8b21-6f04e94a4a26" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberacf4240563fa", "javablobsequencenumberac13871090622b9a2bf34009" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[5].json new file mode 100644 index 000000000000..f745c436fdb8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[5].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac83f6986485?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9E47E77\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd811-301e-0094-2efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "453767f7-9dd5-49c5-a849-2d839bdcd9ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac83f6986485/javablobsequencenumberac129568579b52c5c5624e96", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9F90FA8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd855-301e-0094-64fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:01 GMT", + "x-ms-client-request-id" : "b49ca4bf-9850-4e5c-9c75-3a4b344459e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac83f6986485/javablobsequencenumberac129568579b52c5c5624e96?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9F90FA8\"", + "x-ms-lease-id" : "e42c5418-d883-4127-b960-4a55bbaab560", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd863-301e-0094-70fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "f1fad55e-4606-429d-ad01-85682c5a84a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac83f6986485/javablobsequencenumberac129568579b52c5c5624e96?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA11588C\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd8a4-301e-0094-26fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "5612a388-da63-4c69-a0f7-b68ff3f38264" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd8b8-301e-0094-37fc-5950b8000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac83f6986485Fri, 23 Aug 2019 21:50:02 GMT\"0x8D72813D9E47E77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "7be1e14e-3e9c-43e6-ac36-ff4e91228d99", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac83f6986485?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd8c6-301e-0094-42fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "f4109b53-fc2d-4ce2-b099-fb97c136733c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac83f6986485", "javablobsequencenumberac129568579b52c5c5624e96" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[0].json new file mode 100644 index 000000000000..7c9d64c88d81 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[0].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0761515f06d9473f924c2fa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA21478E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd8e3-301e-0094-5bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "847879ab-e2c9-4a3c-b7b3-b050a3fd57af" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0761515f06d9473f924c2fa/javablobsequencenumberacfail11036653edeae72d4944", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA269371\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd8f3-301e-0094-69fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "233ee1ac-eeae-4389-8356-843bb930a033" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0761515f06d9473f924c2fa/javablobsequencenumberacfail11036653edeae72d4944?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fd902-301e-0094-77fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fd902-301e-0094-77fc-5950b8000000\nTime:2019-08-23T21:50:02.6008920Z", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "c7a0185d-d37b-4a77-901a-8b16f819b0f7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd90a-301e-0094-7efc-5950b8000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail0761515f06d9473f924c2faFri, 23 Aug 2019 21:50:02 GMT\"0x8D72813DA21478E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "1e7bfe12-e621-4055-8aa3-ab250eaa815f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0761515f06d9473f924c2fa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd916-301e-0094-08fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "99236db3-f035-4903-8f45-3a8d9867ac17" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail0761515f06d9473f924c2fa", "javablobsequencenumberacfail11036653edeae72d4944" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[1].json new file mode 100644 index 000000000000..e5c136d5e97a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0624197807891a09ba48d39?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA3A2C90\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd921-301e-0094-12fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "e8dfcb40-4575-4755-bb74-ee2f397da852" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0624197807891a09ba48d39/javablobsequencenumberacfail189328b8ddb1348f6744", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA3FEE0F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd939-301e-0094-26fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "ff02f76d-b3c0-47d7-af20-eabbd5915d37" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0624197807891a09ba48d39/javablobsequencenumberacfail189328b8ddb1348f6744?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fd94e-301e-0094-39fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fd94e-301e-0094-39fc-5950b8000000\nTime:2019-08-23T21:50:02.7680446Z", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "0b306561-07fd-4881-95d0-a164a2aedff4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd958-301e-0094-42fc-5950b8000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail0624197807891a09ba48d39Fri, 23 Aug 2019 21:50:02 GMT\"0x8D72813DA3A2C90\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "75e610f7-d200-4814-97aa-7c0944a20331", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0624197807891a09ba48d39?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd967-301e-0094-4ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "003551ff-7198-417b-bf82-fcf39bdd8303" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail0624197807891a09ba48d39", "javablobsequencenumberacfail189328b8ddb1348f6744" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[2].json new file mode 100644 index 000000000000..e7d3cb2e1c14 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail010323ef2c697ba37c4bc79?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA5386F7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd975-301e-0094-5bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "09783d18-99ad-4108-b086-cd6fdf6baa95" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail010323ef2c697ba37c4bc79/javablobsequencenumberacfail1414725e3d7202d2e045", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA58FA72\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd984-301e-0094-69fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "f5deab5c-4537-4827-b888-8b01c01c8946" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail010323ef2c697ba37c4bc79/javablobsequencenumberacfail1414725e3d7202d2e045?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fd996-301e-0094-7bfc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fd996-301e-0094-7bfc-5950b8000000\nTime:2019-08-23T21:50:02.9281911Z", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "6af59fb6-41ab-4cc5-a8ab-d1d15fab87d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd9a5-301e-0094-08fc-5950b8000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail010323ef2c697ba37c4bc79Fri, 23 Aug 2019 21:50:02 GMT\"0x8D72813DA5386F7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "2e20c2d9-bf17-43df-a471-90267da71046", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail010323ef2c697ba37c4bc79?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd9b4-301e-0094-16fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "d86b29d2-60f7-4c47-9a0d-eb55306cf36a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail010323ef2c697ba37c4bc79", "javablobsequencenumberacfail1414725e3d7202d2e045" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[3].json new file mode 100644 index 000000000000..9a7acf8628a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[3].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail015195431c0e8f138044d38?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA6BCF86\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd9d0-301e-0094-2efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "b4117508-f91e-4bab-bac5-0f423c4be5ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail015195431c0e8f138044d38/javablobsequencenumberacfail1204657f51ddbeb5ad4a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA711C48\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd9dd-301e-0094-37fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "6a0cfc4b-0690-4731-b409-6005bc4399b2" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail015195431c0e8f138044d38/javablobsequencenumberacfail1204657f51ddbeb5ad4a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813DA711C48\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:03 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fd9fa-301e-0094-4dfc-5950b8000000", + "x-ms-client-request-id" : "2913a7d4-f92a-4f08-8d72-02cbf634e5ab", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail015195431c0e8f138044d38/javablobsequencenumberacfail1204657f51ddbeb5ad4a?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77fda07-301e-0094-58fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fda07-301e-0094-58fc-5950b8000000\nTime:2019-08-23T21:50:03.1183651Z", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "2e095e5f-34d2-4b6d-86e8-16c194b2d3cc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fda1a-301e-0094-6afc-5950b8000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail015195431c0e8f138044d38Fri, 23 Aug 2019 21:50:03 GMT\"0x8D72813DA6BCF86\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "694840ff-a45c-4fe1-9a8b-bcd651b8f3fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail015195431c0e8f138044d38?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fda27-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "6449e998-ab2b-40d0-bfe6-1e1c0d558098" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail015195431c0e8f138044d38", "javablobsequencenumberacfail1204657f51ddbeb5ad4a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[4].json new file mode 100644 index 000000000000..a7d7372a954f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[4].json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0242448b3b370e1ce247eaa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA88FB48\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fda34-301e-0094-01fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "1653ca90-e970-4da0-b43c-247deb6905a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0242448b3b370e1ce247eaa/javablobsequencenumberacfail12383384beac1a8e8044", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA8E6F72\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fda45-301e-0094-0efc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "961661ac-f23b-4cfa-b6d2-73aaed8afecd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0242448b3b370e1ce247eaa/javablobsequencenumberacfail12383384beac1a8e8044?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DA8E6F72\"", + "x-ms-lease-id" : "62ec9573-ae81-40e1-bf3f-625c4b3e5347", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fda52-301e-0094-1afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "ceb92d4a-6519-4b07-b257-89b408e331c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0242448b3b370e1ce247eaa/javablobsequencenumberacfail12383384beac1a8e8044?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "f77fda63-301e-0094-28fc-5950b8000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:f77fda63-301e-0094-28fc-5950b8000000\nTime:2019-08-23T21:50:03.3115420Z", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "12b662ca-3783-4fec-80f7-bf8aa2fe19d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumberacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fda74-301e-0094-37fc-5950b8000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail0242448b3b370e1ce247eaaFri, 23 Aug 2019 21:50:03 GMT\"0x8D72813DA88FB48\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:02 GMT", + "x-ms-client-request-id" : "78c8ba2c-3d23-4b4a-8950-9252e0c78aca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumberacfail0242448b3b370e1ce247eaa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fda87-301e-0094-47fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "21e3b6a2-5514-4349-8be2-971206c371b0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail0242448b3b370e1ce247eaa", "javablobsequencenumberacfail12383384beac1a8e8044" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbererror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbererror.json new file mode 100644 index 000000000000..a798c1f63454 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbererror.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbererror00422893a0e79555164d0a8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DAA711B0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fda9c-301e-0094-5afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "57d81a13-4a83-4532-b9bd-160dc520b2e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbererror00422893a0e79555164d0a8/javablobsequencenumbererror121442d0e20c443cd941d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DAB4C58F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fdac1-301e-0094-78fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "10cb2e23-e946-4ad5-b012-65020f8e2c8d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbererror00422893a0e79555164d0a8/javablobsequencenumbererror225918b22a05273a7a4cd?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fdae6-301e-0094-19fc-5950b8000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:f77fdae6-301e-0094-19fc-5950b8000000\nTime:2019-08-23T21:50:03.5527629Z", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "ba648b6c-f142-4d04-9188-a94f53bcd13a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumbererror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fdaf6-301e-0094-27fc-5950b8000000", + "Body" : "jtcsequencenumbererrorjtcsequencenumbererror00422893a0e79555164d0a8Fri, 23 Aug 2019 21:50:03 GMT\"0x8D72813DAA711B0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "73afd2c0-c7eb-461b-9a5e-56e245b80f7e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbererror00422893a0e79555164d0a8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fdb09-301e-0094-3afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "f1146b92-1e30-4bfa-acb9-9766b0d3ca06" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumbererror00422893a0e79555164d0a8", "javablobsequencenumbererror121442d0e20c443cd941d", "javablobsequencenumbererror225918b22a05273a7a4cd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbermin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbermin.json new file mode 100644 index 000000000000..fb873ce02d82 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbermin.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumbermin92c030999?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D948B646\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd5dd-301e-0094-61fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "e7851a35-72ae-4ade-b407-e7800e01aea9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumbermin92c030999/javablobsequencenumbermin155277a66186b46e544179", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D94DB172\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fd5e8-301e-0094-6bfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "734c16b9-2eff-43e9-b114-c31b0f1c5ff9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumbermin92c030999/javablobsequencenumbermin155277a66186b46e544179?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D9524677\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fd5fb-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "ff85ecdc-e4a3-4258-bb7f-0507a24a2a83" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsequencenumbermin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd611-301e-0094-0efc-5950b8000000", + "Body" : "jtcsequencenumberminjtcsequencenumbermin0pageblobapitestsequencenumbermin92c030999Fri, 23 Aug 2019 21:50:01 GMT\"0x8D72813D948B646\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "bec4c27e-8b74-4509-ab91-cef2e516eae2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumbermin92c030999?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fd61c-301e-0094-18fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:00 GMT", + "x-ms-client-request-id" : "cb06fd07-2624-443c-8ca6-4ff0b5259408" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumbermin0pageblobapitestsequencenumbermin92c030999", "javablobsequencenumbermin155277a66186b46e544179" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopy.json new file mode 100644 index 000000000000..b4adcbb2ea92 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopy.json @@ -0,0 +1,260 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DACEA01C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fdb1f-301e-0094-4cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "7906eea6-04f9-4ab4-9940-95d0ca530fbb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db/javablobstartincrementalcopy11631110d3816c7f484e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DAD4FFA7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fdb38-301e-0094-60fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "957af1d0-91d9-49e9-bb05-f2296e933741" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DAD9C172\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fdb4e-301e-0094-73fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "d4c55398-5c2f-4abf-ba76-075dca966f30" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db/javablobstartincrementalcopy11631110d3816c7f484e?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:03.7716954Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DAD4FFA7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fdb62-301e-0094-03fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "b2705e41-3632-4880-a643-f9850c98932c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db/javablobstartincrementalcopy27410230e1e0e9b81548?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "8c91482b-1a3e-46ed-931e-9dd19a39b580", + "ETag" : "\"0x8D72813DAEFE14A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77fdb85-301e-0094-24fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-client-request-id" : "93a03103-6bb0-4ff4-a7e3-f2b43e48ba77" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db/javablobstartincrementalcopy27410230e1e0e9b81548", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77fdbbc-301e-0094-57fc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "8c91482b-1a3e-46ed-931e-9dd19a39b580", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db/javablobstartincrementalcopy11631110d3816c7f484e?snapshot=2019-08-23T21:50:03.7716954Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "0/512", + "Date" : "Fri, 23 Aug 2019 21:50:03 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813DAEFE14A\"", + "x-ms-copy-status" : "pending", + "x-ms-client-request-id" : "2bd29fe3-1e09-4769-806b-661bca7193ac" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db/javablobstartincrementalcopy27410230e1e0e9b81548", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-08-23T21:50:03.9648810Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77fddc3-301e-0094-11fc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "8c91482b-1a3e-46ed-931e-9dd19a39b580", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db/javablobstartincrementalcopy11631110d3816c7f484e?snapshot=2019-08-23T21:50:03.7716954Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:50:04 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:50:03 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813DAEFE14A\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "1bd80ab8-07d4-4e5b-a43a-c8e228c05156" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db/javablobstartincrementalcopy27410230e1e0e9b81548", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-08-23T21:50:03.9648810Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:03 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77fe029-301e-0094-2afc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "8c91482b-1a3e-46ed-931e-9dd19a39b580", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db/javablobstartincrementalcopy11631110d3816c7f484e?snapshot=2019-08-23T21:50:03.7716954Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:50:03 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813DAEFE14A\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "583d2dcd-75ac-4214-bc8d-9340b15d5f79" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopy&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fe036-301e-0094-35fc-5950b8000000", + "Body" : "jtcstartincrementalcopyjtcstartincrementalcopy077862e14253b7c00a4e8dbFri, 23 Aug 2019 21:50:03 GMT\"0x8D72813DAD9C172\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-client-request-id" : "1793d4e8-0822-4662-8aab-989730b99374", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopy077862e14253b7c00a4e8db?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fe045-301e-0094-41fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-client-request-id" : "618b2ab1-c580-4d32-9533-49303cf95fa2" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopy077862e14253b7c00a4e8db", "javablobstartincrementalcopy11631110d3816c7f484e", "javablobstartincrementalcopy27410230e1e0e9b81548" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[0].json new file mode 100644 index 000000000000..a1d30c6f70d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[0].json @@ -0,0 +1,266 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DC657DE1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe0c1-301e-0094-2afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-client-request-id" : "acdffc2b-f6a5-4e41-a969-d72af29d55fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe/javablobstartincrementalcopyac1079800fd71d61a09b4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DC6AD067\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe0d9-301e-0094-3ffc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:06 GMT", + "x-ms-client-request-id" : "54758cef-eb4d-4006-9345-4b6b57a69730" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DC6F8F7C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fe0e9-301e-0094-4cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:06 GMT", + "x-ms-client-request-id" : "e8d35a29-0a56-4a7b-be1b-01969d35353c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe/javablobstartincrementalcopyac1079800fd71d61a09b4?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:06.4422573Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DC6AD067\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe0f8-301e-0094-5afc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:06 GMT", + "x-ms-client-request-id" : "f1b02ed4-eee1-45b3-a562-17a79dde1b98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe/javablobstartincrementalcopyac25276123443a8e9cd74?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "14a09b7f-1bce-4805-a492-f07774e10dfa", + "ETag" : "\"0x8D72813DC7D729F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77fe10d-301e-0094-6bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:06 GMT", + "x-ms-client-request-id" : "64871887-e24e-4f12-acb6-fd366ca913b3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe/javablobstartincrementalcopyac25276123443a8e9cd74", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:06 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77fe123-301e-0094-7efc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "14a09b7f-1bce-4805-a492-f07774e10dfa", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe/javablobstartincrementalcopyac1079800fd71d61a09b4?snapshot=2019-08-23T21:50:06.4422573Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "0/512", + "Date" : "Fri, 23 Aug 2019 21:50:06 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813DC7D729F\"", + "x-ms-copy-status" : "pending", + "x-ms-client-request-id" : "3fd62a59-98a2-4966-9305-15588cd3b4cc" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe/javablobstartincrementalcopyac25276123443a8e9cd74", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-08-23T21:50:06.5213339Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:06 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77fe2fd-301e-0094-07fc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "14a09b7f-1bce-4805-a492-f07774e10dfa", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe/javablobstartincrementalcopyac1079800fd71d61a09b4?snapshot=2019-08-23T21:50:06.4422573Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:50:07 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:50:06 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813DC7D729F\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "d2d135ca-6eee-4d68-b3f9-e931f9d0d782" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe/javablobstartincrementalcopyac1079800fd71d61a09b4?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:08.5793076Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DC6AD067\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe4ee-301e-0094-3efc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-client-request-id" : "3a55d305-ad15-4c09-876f-668f1bc9cbef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe/javablobstartincrementalcopyac25276123443a8e9cd74?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "bb6dcd5a-da1f-4792-9be2-93e7325d1f22", + "ETag" : "\"0x8D72813DDC7F70B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77fe508-301e-0094-57fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-client-request-id" : "79248fa6-0ae4-421c-b390-15f574f855d3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopyac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fe52c-301e-0094-77fc-5950b8000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac00081154497fdfcea945feFri, 23 Aug 2019 21:50:06 GMT\"0x8D72813DC6F8F7C\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-client-request-id" : "4be19385-2d91-4a07-9d23-d1a2a852b436", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac00081154497fdfcea945fe?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fe53a-301e-0094-02fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-client-request-id" : "2442c691-e70a-4a03-acff-6efa8a570ff5" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac00081154497fdfcea945fe", "javablobstartincrementalcopyac1079800fd71d61a09b4", "javablobstartincrementalcopyac25276123443a8e9cd74" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[1].json new file mode 100644 index 000000000000..f3fe612e004d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[1].json @@ -0,0 +1,230 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0950987fe6783676db499f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DDD7B40C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe549-301e-0094-10fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-client-request-id" : "129704d2-4a83-49c1-b85e-c676213d0eb3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0950987fe6783676db499f/javablobstartincrementalcopyac1876583e51a77fc6364", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DDDD31EA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe55a-301e-0094-1dfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-client-request-id" : "97504c83-f733-4908-aaa8-b070d89eed37" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0950987fe6783676db499f?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DDE263E5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fe566-301e-0094-29fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-client-request-id" : "430b6575-44fa-4828-857f-a37c3dfce480" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0950987fe6783676db499f/javablobstartincrementalcopyac1876583e51a77fc6364?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:08.8635813Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DDDD31EA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe578-301e-0094-37fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-client-request-id" : "41093f75-42cd-45d8-b90d-46bf62168f7b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0950987fe6783676db499f/javablobstartincrementalcopyac2202835f3a1313a5674?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "44cf15bb-1431-4694-bd35-d6d3b490711c", + "ETag" : "\"0x8D72813DDEE7435\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77fe58f-301e-0094-4afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-client-request-id" : "8651fd60-338d-45ee-b3b7-af901d257171" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0950987fe6783676db499f/javablobstartincrementalcopyac2202835f3a1313a5674", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-08-23T21:50:08.9336476Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:08 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77fe5a6-301e-0094-60fc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "44cf15bb-1431-4694-bd35-d6d3b490711c", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0950987fe6783676db499f/javablobstartincrementalcopyac1876583e51a77fc6364?snapshot=2019-08-23T21:50:08.8635813Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:50:08 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:50:08 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813DDEE7435\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "4b3efb9d-2e2e-43f6-b06a-9985eaef4326" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0950987fe6783676db499f/javablobstartincrementalcopyac1876583e51a77fc6364?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:09.9746504Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DDDD31EA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe750-301e-0094-51fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:09 GMT", + "x-ms-client-request-id" : "245a483e-c3a9-4773-9302-81eaa73e0160" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0950987fe6783676db499f/javablobstartincrementalcopyac2202835f3a1313a5674?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "ce4929e7-fd9d-421e-8948-d83797c0f92d", + "ETag" : "\"0x8D72813DE984B93\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77fe763-301e-0094-62fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:09 GMT", + "x-ms-client-request-id" : "458c8327-060e-48eb-b3d2-ce3e04dbb543" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopyac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fe776-301e-0094-70fc-5950b8000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac0950987fe6783676db499fFri, 23 Aug 2019 21:50:08 GMT\"0x8D72813DDE263E5\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:09 GMT", + "x-ms-client-request-id" : "6523309d-d319-456b-8a2d-b270e0703783", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac0950987fe6783676db499f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fe77c-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:09 GMT", + "x-ms-client-request-id" : "a8e5900f-2c35-45f9-b983-6dc5f6d08d65" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac0950987fe6783676db499f", "javablobstartincrementalcopyac1876583e51a77fc6364", "javablobstartincrementalcopyac2202835f3a1313a5674" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[2].json new file mode 100644 index 000000000000..c08aac2a1e5e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[2].json @@ -0,0 +1,266 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DEA790E2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe793-301e-0094-09fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:09 GMT", + "x-ms-client-request-id" : "0c5f7287-7322-4e7f-8b7a-5f98d6e8b17a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043/javablobstartincrementalcopyac186543dde2054dcc704", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DEACEA2C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe7a7-301e-0094-17fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:09 GMT", + "x-ms-client-request-id" : "8b57b32b-41eb-4318-986d-8f088a7a0726" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DEB21A90\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fe7b1-301e-0094-21fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:09 GMT", + "x-ms-client-request-id" : "b1f2ebe8-9d7f-446c-a9a1-b7fa60d5120e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043/javablobstartincrementalcopyac186543dde2054dcc704?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:10.2268944Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DEACEA2C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe7c0-301e-0094-2ffc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:09 GMT", + "x-ms-client-request-id" : "a103a976-7c24-4b7c-a2bb-72aa64d37938" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043/javablobstartincrementalcopyac214569e0177b281b9a4?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "c24ac169-5e93-4bc5-8b96-a3deec434192", + "ETag" : "\"0x8D72813DEBDB72A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77fe7c9-301e-0094-38fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:09 GMT", + "x-ms-client-request-id" : "890d88ca-447c-4bc3-92ce-c16a1c8429bd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043/javablobstartincrementalcopyac214569e0177b281b9a4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:10 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77fe7e9-301e-0094-55fc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "c24ac169-5e93-4bc5-8b96-a3deec434192", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043/javablobstartincrementalcopyac186543dde2054dcc704?snapshot=2019-08-23T21:50:10.2268944Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "0/512", + "Date" : "Fri, 23 Aug 2019 21:50:09 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813DEBDB72A\"", + "x-ms-copy-status" : "pending", + "x-ms-client-request-id" : "371511c9-76eb-4ec3-a529-b8953168f5cb" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043/javablobstartincrementalcopyac214569e0177b281b9a4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-08-23T21:50:10.3139788Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:10 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77fe9ed-301e-0094-0afc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "c24ac169-5e93-4bc5-8b96-a3deec434192", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043/javablobstartincrementalcopyac186543dde2054dcc704?snapshot=2019-08-23T21:50:10.2268944Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:50:10 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:50:10 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813DEBDB72A\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "44b0d8b2-56f4-4bf2-b00b-cfe3a812277e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043/javablobstartincrementalcopyac186543dde2054dcc704?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:12.3679493Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DEACEA2C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fec65-301e-0094-10fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-client-request-id" : "4be4dc4d-25c8-4d91-a589-eb82f26734d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043/javablobstartincrementalcopyac214569e0177b281b9a4?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "5961131b-623e-4bff-9077-f427cc8905aa", + "ETag" : "\"0x8D72813E005F11D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77fec85-301e-0094-2afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-client-request-id" : "b7329ce8-8f34-426e-9bee-44effb3d5b58" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopyac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fecb7-301e-0094-54fc-5950b8000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac09315791154d1f31d04043Fri, 23 Aug 2019 21:50:10 GMT\"0x8D72813DEB21A90\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-client-request-id" : "e3dda803-d630-4199-a74f-fd225da8d4dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac09315791154d1f31d04043?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fecc5-301e-0094-5ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-client-request-id" : "1b7d11a8-d417-4dd3-b669-e76f22c8e32c" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac09315791154d1f31d04043", "javablobstartincrementalcopyac186543dde2054dcc704", "javablobstartincrementalcopyac214569e0177b281b9a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[3].json new file mode 100644 index 000000000000..968632d622d9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[3].json @@ -0,0 +1,268 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E01978C8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fecdd-301e-0094-74fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-client-request-id" : "98592799-63a7-4b95-8762-34b5a1c0beab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5/javablobstartincrementalcopyac158124c676664f67684", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E01EAF50\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fecf0-301e-0094-03fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-client-request-id" : "251f8afd-af00-418f-9434-bd2b5eb87a58" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E0238F04\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fed07-301e-0094-15fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-client-request-id" : "af0a0165-9823-44da-accc-ef6960a9162c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5/javablobstartincrementalcopyac158124c676664f67684?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:12.6482173Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E01EAF50\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fed23-301e-0094-2efc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-client-request-id" : "f2698ac2-1da6-4330-b28d-0f7da9c93129" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5/javablobstartincrementalcopyac225156505339a5d86f4?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "c7031611-9feb-480a-95fb-090053c5bb86", + "ETag" : "\"0x8D72813E02F2E19\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77fed4b-301e-0094-4cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-client-request-id" : "63de0b48-01bf-4c08-8dd1-2d903bd94a8f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5/javablobstartincrementalcopyac225156505339a5d86f4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-08-23T21:50:12.7172838Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77fed66-301e-0094-62fc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "c7031611-9feb-480a-95fb-090053c5bb86", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5/javablobstartincrementalcopyac158124c676664f67684?snapshot=2019-08-23T21:50:12.6482173Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:50:12 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813E02F2E19\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "2650c284-81e2-421e-aaee-2068f2ee342e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5/javablobstartincrementalcopyac158124c676664f67684?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:13.7612855Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E01EAF50\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fefff-301e-0094-12fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "x-ms-client-request-id" : "2a4e4661-f06e-4b95-9c69-6ce9e68607a6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5/javablobstartincrementalcopyac225156505339a5d86f4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-08-23T21:50:12.7172838Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:12 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77ff00e-301e-0094-20fc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "c7031611-9feb-480a-95fb-090053c5bb86", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5/javablobstartincrementalcopyac158124c676664f67684?snapshot=2019-08-23T21:50:12.6482173Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:50:12 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813E02F2E19\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "695abae1-85ea-4a2b-8575-784bfde8daa3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5/javablobstartincrementalcopyac225156505339a5d86f4?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "882252cb-5d36-46a9-a988-b68510bb322e", + "ETag" : "\"0x8D72813E0DE0F99\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77ff026-301e-0094-32fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "x-ms-client-request-id" : "d30c168e-a7ce-4e40-a2fc-ab23854f473f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopyac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff05e-301e-0094-63fc-5950b8000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac08758004bc9b8ee6234ea5Fri, 23 Aug 2019 21:50:12 GMT\"0x8D72813E0238F04\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "x-ms-client-request-id" : "518416f4-00cc-413f-a515-e6adbc6a74aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac08758004bc9b8ee6234ea5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff072-301e-0094-75fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "x-ms-client-request-id" : "75f56f11-2fbc-4b04-a6e1-c5ec9f00944b" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac08758004bc9b8ee6234ea5", "javablobstartincrementalcopyac158124c676664f67684", "javablobstartincrementalcopyac225156505339a5d86f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[4].json new file mode 100644 index 000000000000..d2a1f4876a8b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[4].json @@ -0,0 +1,266 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E0F342E7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff08b-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "x-ms-client-request-id" : "3a624f17-c9a9-4254-9e85-d7284ea089f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b/javablobstartincrementalcopyac120434b632db577a494", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E0F854D1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff0aa-301e-0094-24fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "x-ms-client-request-id" : "b690f283-b438-46dc-894e-0036e49754ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E0FD3322\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77ff0bf-301e-0094-37fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "x-ms-client-request-id" : "9325f701-7857-43d6-b47b-b04b3b3a341f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b/javablobstartincrementalcopyac120434b632db577a494?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:14.1886953Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E0F854D1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff11d-301e-0094-01fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "x-ms-client-request-id" : "474d916c-7996-4bd0-a950-e51c9d8d2428" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b/javablobstartincrementalcopyac224685f306009d69e34?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "7a4daf88-cb36-4096-a326-e64b3bc4f132", + "ETag" : "\"0x8D72813E11A3D05\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77ff12f-301e-0094-12fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "x-ms-client-request-id" : "49dd0eec-33a7-40e9-842d-a06182690944" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b/javablobstartincrementalcopyac224685f306009d69e34", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:14 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77ff14a-301e-0094-29fc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "7a4daf88-cb36-4096-a326-e64b3bc4f132", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b/javablobstartincrementalcopyac120434b632db577a494?snapshot=2019-08-23T21:50:14.1886953Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "0/512", + "Date" : "Fri, 23 Aug 2019 21:50:13 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813E11A3D05\"", + "x-ms-copy-status" : "pending", + "x-ms-client-request-id" : "f141ee93-f02f-40c4-a527-bf9828541275" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b/javablobstartincrementalcopyac224685f306009d69e34", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-08-23T21:50:14.2687726Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:14 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77ff392-301e-0094-31fc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "7a4daf88-cb36-4096-a326-e64b3bc4f132", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b/javablobstartincrementalcopyac120434b632db577a494?snapshot=2019-08-23T21:50:14.1886953Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:50:14 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:50:14 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813E11A3D05\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "d63ed402-246c-4b33-ac30-6761590312db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b/javablobstartincrementalcopyac120434b632db577a494?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:16.3207406Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E0F854D1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff686-301e-0094-45fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:15 GMT", + "x-ms-client-request-id" : "c3c95eb3-d618-4a4d-bd77-5c0b558e9e47" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b/javablobstartincrementalcopyac224685f306009d69e34?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "aac9f980-fa19-49c6-94bd-10ea321fd16e", + "ETag" : "\"0x8D72813E2602C6C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77ff691-301e-0094-4ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "6a6eb759-bb47-4f8f-a164-48d4c7ff19bd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopyac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff6ab-301e-0094-65fc-5950b8000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac047506ddb4b23f44cc433bFri, 23 Aug 2019 21:50:14 GMT\"0x8D72813E0FD3322\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "11a2d546-0693-4274-98c9-8baee9c32eb9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyac047506ddb4b23f44cc433b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff6bf-301e-0094-77fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "df1986ff-8740-475d-889c-4298d9545040" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac047506ddb4b23f44cc433b", "javablobstartincrementalcopyac120434b632db577a494", "javablobstartincrementalcopyac224685f306009d69e34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[0].json new file mode 100644 index 000000000000..4e6a6b656da1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[0].json @@ -0,0 +1,191 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail018746f9785a8daede40?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E27162C6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff6d4-301e-0094-0afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "9c606af1-afd2-4382-b7f4-f506fbb8c376" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail018746f9785a8daede40/javablobstartincrementalcopyacfail194673c9d6d2f9a60", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2767918\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff6eb-301e-0094-1ffc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "2ffd0dc0-a2b3-47d1-a7f1-0f40ed7d02f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail018746f9785a8daede40?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E27B7BF1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77ff6fe-301e-0094-31fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "0c476e33-d7a7-4e59-beff-0b56480e33a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail018746f9785a8daede40/javablobstartincrementalcopyacfail194673c9d6d2f9a60?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:16.5759852Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2767918\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff70e-301e-0094-3ffc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "9d1d7f1c-e2ef-4ec1-87db-55c312e4a214" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail018746f9785a8daede40/javablobstartincrementalcopyacfail29228135ac7ef56a2?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "83fd55cf-a9b2-49c9-ba0e-136a4a31d0b6", + "ETag" : "\"0x8D72813E286A9A9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77ff71b-301e-0094-4bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "7c9eaffa-72db-46fa-9397-1317d52da40d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail018746f9785a8daede40/javablobstartincrementalcopyacfail194673c9d6d2f9a60?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:16.6500567Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2767918\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff734-301e-0094-61fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "5db2b8c6-ae36-4b41-ae27-f5322310123e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail018746f9785a8daede40/javablobstartincrementalcopyacfail29228135ac7ef56a2?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77ff746-301e-0094-71fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77ff746-301e-0094-71fc-5950b8000000\nTime:2019-08-23T21:50:16.6957842Z", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "013fbfc0-0ed2-40b2-be5d-188ea3b45785", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopyacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff756-301e-0094-7efc-5950b8000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail018746f9785a8daede40Fri, 23 Aug 2019 21:50:16 GMT\"0x8D72813E27B7BF1\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "6e763f22-281c-43e9-a0e7-f647e8704b2d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail018746f9785a8daede40?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff767-301e-0094-0ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "47aeb0cd-a005-4c58-bce0-299f82bd0b45" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail018746f9785a8daede40", "javablobstartincrementalcopyacfail194673c9d6d2f9a60", "javablobstartincrementalcopyacfail29228135ac7ef56a2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[1].json new file mode 100644 index 000000000000..2d2abbcb8716 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[1].json @@ -0,0 +1,191 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0716622e1222d1ea344a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2A0E24E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff773-301e-0094-1bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "d209ca64-8423-4fb3-874e-61e6f93d023f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0716622e1222d1ea344a/javablobstartincrementalcopyacfail1491799c85e9cb974", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2A5F922\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff78c-301e-0094-2efc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "38e33284-89ae-4ea4-8b2a-ffa4a802ccc6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0716622e1222d1ea344a?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2AAD4A6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77ff79a-301e-0094-3bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "1f20a681-2d1d-4631-85df-19c2457293fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0716622e1222d1ea344a/javablobstartincrementalcopyacfail1491799c85e9cb974?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:16.9273230Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2A5F922\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff7b7-301e-0094-53fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "7af44a94-f90e-4f8b-8bed-a6e246d36ab8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0716622e1222d1ea344a/javablobstartincrementalcopyacfail284926c72b267228b?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "97b1d08d-dc32-4e1b-8e64-921b48675126", + "ETag" : "\"0x8D72813E2C3253A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77ff7df-301e-0094-77fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "7ade5a69-9055-4472-ad9b-044706b7c942" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0716622e1222d1ea344a/javablobstartincrementalcopyacfail1491799c85e9cb974?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:17.0484385Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2A5F922\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff7ee-301e-0094-04fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "aa4d537b-b801-4c1c-b554-5df1406e3536" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0716622e1222d1ea344a/javablobstartincrementalcopyacfail284926c72b267228b?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77ff805-301e-0094-15fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77ff805-301e-0094-15fc-5950b8000000\nTime:2019-08-23T21:50:17.0951501Z", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "aa10ad4c-11ec-4531-bacb-8259a8301b5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopyacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff816-301e-0094-25fc-5950b8000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail0716622e1222d1ea344aFri, 23 Aug 2019 21:50:16 GMT\"0x8D72813E2AAD4A6\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "149e726c-1ce9-43d9-8021-8ab2f5c13a70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0716622e1222d1ea344a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff823-301e-0094-2efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "0dd305c8-a828-402e-b7b3-57fd070b5d06" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail0716622e1222d1ea344a", "javablobstartincrementalcopyacfail1491799c85e9cb974", "javablobstartincrementalcopyacfail284926c72b267228b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[2].json new file mode 100644 index 000000000000..b4e2392945fe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[2].json @@ -0,0 +1,191 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0861252992916a80e54f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2DDAB6F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff831-301e-0094-3afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "0c0886a2-ecc3-4cbc-9955-a4711a4dfafa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0861252992916a80e54f/javablobstartincrementalcopyacfail147693389fe825255", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2E2C2F0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff83f-301e-0094-45fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "07d40d52-ef04-4668-b450-6a59c39198c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0861252992916a80e54f?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2E79E0A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77ff84a-301e-0094-4ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "8952f2c1-c1de-4e0c-9379-58b3e1a9cae7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0861252992916a80e54f/javablobstartincrementalcopyacfail147693389fe825255?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:17.2836643Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2E2C2F0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff851-301e-0094-56fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "b7050544-7982-45f9-a298-f85e77e8de0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0861252992916a80e54f/javablobstartincrementalcopyacfail29116226e74ebda22?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "1b1d2622-f73e-491b-bc28-0820de9cec10", + "ETag" : "\"0x8D72813E2F25728\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77ff858-301e-0094-5bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:16 GMT", + "x-ms-client-request-id" : "da96f025-8662-46b7-8890-73daf6d5ea1e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0861252992916a80e54f/javablobstartincrementalcopyacfail147693389fe825255?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:17.3617402Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E2E2C2F0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff868-301e-0094-66fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "8f4d52f7-88bd-4d5d-9076-e3cdf1b158b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0861252992916a80e54f/javablobstartincrementalcopyacfail29116226e74ebda22?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "f77ff87e-301e-0094-7afc-5950b8000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:f77ff87e-301e-0094-7afc-5950b8000000\nTime:2019-08-23T21:50:17.4294550Z", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "1649980a-18e4-43c2-8225-1977cd6c9a62", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopyacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff891-301e-0094-0cfc-5950b8000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail0861252992916a80e54fFri, 23 Aug 2019 21:50:17 GMT\"0x8D72813E2E79E0A\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "644d3267-a16e-4f7d-84d1-7af9e45ca809", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail0861252992916a80e54f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff8a1-301e-0094-19fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "d9c1a586-de06-4a50-96dd-be1815c2a83c" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail0861252992916a80e54f", "javablobstartincrementalcopyacfail147693389fe825255", "javablobstartincrementalcopyacfail29116226e74ebda22" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[3].json new file mode 100644 index 000000000000..d54a6b50a134 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[3].json @@ -0,0 +1,229 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail095051499124c5734d4c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E31DD0B4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff8e4-301e-0094-52fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "afdc1258-ed2f-4593-9a96-c3afdb411d2f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail095051499124c5734d4c/javablobstartincrementalcopyacfail116296b2349cea632", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E3246FF6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff8fd-301e-0094-69fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "d55a1372-b513-497a-966c-4bf5b6b81c4e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail095051499124c5734d4c?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E3294A9C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77ff90a-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "b47e613c-1a58-46a2-b157-5a5eb9727dc8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail095051499124c5734d4c/javablobstartincrementalcopyacfail116296b2349cea632?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:17.7150784Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E3246FF6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff91c-301e-0094-05fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "3f440ec4-6e4c-4db0-9e44-05efe2b42ba2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail095051499124c5734d4c/javablobstartincrementalcopyacfail2356756c13faec228?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b9e0802b-41f4-450b-ace2-399f011a3d95", + "ETag" : "\"0x8D72813E334525C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77ff929-301e-0094-12fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "da14a526-7e72-47bc-834b-72a609201024" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail095051499124c5734d4c/javablobstartincrementalcopyacfail116296b2349cea632?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:17.7881483Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E3246FF6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff93f-301e-0094-25fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "30f92d0f-f202-4c25-8508-ab355186a9ad" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail095051499124c5734d4c/javablobstartincrementalcopyacfail2356756c13faec228", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-08-23T21:50:17.7851456Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "f77ff956-301e-0094-3bfc-5950b8000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "b9e0802b-41f4-450b-ace2-399f011a3d95", + "x-ms-copy-source" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail095051499124c5734d4c/javablobstartincrementalcopyacfail116296b2349cea632?snapshot=2019-08-23T21:50:17.7150784Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-copy-completion-time" : "Fri, 23 Aug 2019 21:50:17 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813E334525C\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "c95b8859-c406-4d7f-abba-bfc4eeda292b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail095051499124c5734d4c/javablobstartincrementalcopyacfail2356756c13faec228?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77ff967-301e-0094-4cfc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77ff967-301e-0094-4cfc-5950b8000000\nTime:2019-08-23T21:50:17.8618505Z", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "0d65090e-78de-444a-af98-fb46a91bdc83", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopyacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff990-301e-0094-72fc-5950b8000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail095051499124c5734d4cFri, 23 Aug 2019 21:50:17 GMT\"0x8D72813E3294A9C\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "dbd1f4bd-4e8b-4d7c-9857-c4aa1a5e3bc3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyacfail095051499124c5734d4c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff99d-301e-0094-7efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "b6465985-48d9-4d5d-8fb0-40296dac918f" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail095051499124c5734d4c", "javablobstartincrementalcopyacfail116296b2349cea632", "javablobstartincrementalcopyacfail2356756c13faec228" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyerror.json new file mode 100644 index 000000000000..d68fb4fc4aee --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyerror.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyerror0972711d425e89c69040?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E3531DFC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff9a9-301e-0094-08fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "b26d775e-4e60-421f-87fb-9bd5486ddcf7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyerror0972711d425e89c69040/javablobstartincrementalcopyerror1921794731328db8c4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E3580FC8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff9c0-301e-0094-1cfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "308609ce-237b-4bef-8a5e-d3081d9dbb6a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyerror0972711d425e89c69040/javablobstartincrementalcopyerror2891946f3fea4f76c3?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidSourceBlobUrl", + "retry-after" : "0", + "Content-Length" : "270", + "StatusCode" : "409", + "x-ms-request-id" : "f77ff9ce-301e-0094-29fc-5950b8000000", + "Body" : "InvalidSourceBlobUrlThe source url for incremental copy request must be valid azure storage blob url.\nRequestId:f77ff9ce-301e-0094-29fc-5950b8000000\nTime:2019-08-23T21:50:18.0250000Z", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "11eda4e1-3f13-4266-82c4-1b91b558006e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopyerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff9da-301e-0094-33fc-5950b8000000", + "Body" : "jtcstartincrementalcopyerrorjtcstartincrementalcopyerror0972711d425e89c69040Fri, 23 Aug 2019 21:50:17 GMT\"0x8D72813E3531DFC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "d0ae54d5-17fd-46ce-bcfe-e5db6e552157", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopyerror0972711d425e89c69040?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ff9e9-301e-0094-40fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "8f4c712d-1722-4588-8fb3-9fdea3f38389" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyerror0972711d425e89c69040", "javablobstartincrementalcopyerror1921794731328db8c4", "javablobstartincrementalcopyerror2891946f3fea4f76c3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopymin.json new file mode 100644 index 000000000000..2ee71749398a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopymin.json @@ -0,0 +1,148 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin089018269b36656520457?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DC40FD6C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe053-301e-0094-4dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-client-request-id" : "120ca411-2441-4dd2-922b-5cd94544b572" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin089018269b36656520457/javablobstartincrementalcopymin1133809037bbcf6a4e4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DC462866\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe065-301e-0094-5dfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-client-request-id" : "f2178b24-dbb4-4a98-aba4-4cc957558187" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin089018269b36656520457?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DC4B0ED4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fe076-301e-0094-6cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-client-request-id" : "1accfae5-f110-473a-ba33-b5f950679e25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin089018269b36656520457/javablobstartincrementalcopymin1133809037bbcf6a4e4?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:50:06.1930208Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813DC462866\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fe08a-301e-0094-7bfc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-client-request-id" : "c21bc8a7-2407-4771-82d5-c00eaed200c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin089018269b36656520457/javablobstartincrementalcopymin230646159d0b682a974?comp=incrementalcopy", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "4e340133-37eb-477b-bbaf-f56b122f3e0e", + "ETag" : "\"0x8D72813DC568021\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "f77fe096-301e-0094-07fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-client-request-id" : "52a11b95-0105-4085-a51a-0a303d3b42de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcstartincrementalcopymin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fe0a5-301e-0094-12fc-5950b8000000", + "Body" : "jtcstartincrementalcopyminjtcstartincrementalcopymin089018269b36656520457Fri, 23 Aug 2019 21:50:06 GMT\"0x8D72813DC4B0ED4\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-client-request-id" : "12985cd3-f08c-492a-a25f-46ab032e1b01", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcstartincrementalcopymin089018269b36656520457?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fe0ac-301e-0094-19fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:05 GMT", + "x-ms-client-request-id" : "58df29e6-f03a-4223-894c-57bee91c700a" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopymin089018269b36656520457", "javablobstartincrementalcopymin1133809037bbcf6a4e4", "javablobstartincrementalcopymin230646159d0b682a974" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpage.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpage.json new file mode 100644 index 000000000000..c6e29172846e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpage.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpaged9267295aff1954e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C77EB653\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06aa7-501e-00c0-4dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "2cf69244-1780-48a0-bad2-c431ff805f36" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpaged9267295aff1954e/javablobuploadpage1pageblobapitestuploadpaged92663715d36b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C78374A1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06ac6-501e-00c0-6afc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "675e5dc9-a135-46a8-868e-2162d2b8e7cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpaged9267295aff1954e/javablobuploadpage1pageblobapitestuploadpaged92663715d36b?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "OEiAqd7Y+hE=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "ETag" : "\"0x8D72813C78AA252\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d06b00-501e-00c0-1dfc-59ba32000000", + "x-ms-client-request-id" : "a07e3f25-8c50-448b-81ee-f8d40a62dc12" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpage&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06b1c-501e-00c0-37fc-59ba32000000", + "Body" : "jtcuploadpagejtcuploadpage0pageblobapitestuploadpaged9267295aff1954eFri, 23 Aug 2019 21:49:31 GMT\"0x8D72813C77EB653\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "6b8ef239-ecb0-4d17-b351-b464562885e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpaged9267295aff1954e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06b42-501e-00c0-58fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "f8b11f59-fad5-4686-87fc-87b6085a57e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpage0pageblobapitestuploadpaged9267295aff1954e", "javablobuploadpage1pageblobapitestuploadpaged92663715d36b", "64790a18-4c98-4ced-9fd6-c0b5294eebfe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[0].json new file mode 100644 index 000000000000..90f98860a443 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[0].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac0bc642895f9498?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C805D836\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f98cd-301e-0094-1ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "e8a52ef3-776c-4473-bccf-0209034ceb12" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac0bc642895f9498/javablobuploadpageac1pageblobapitestuploadpageac0bc073396fe", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C80AEE4F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f98df-301e-0094-2ffc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "ca98c345-5a51-4d02-b459-afc210f9b1cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac0bc642895f9498/javablobuploadpageac1pageblobapitestuploadpageac0bc073396fe?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "5rWzqhEtJQU=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "ETag" : "\"0x8D72813C810E338\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77f98f4-301e-0094-42fc-5950b8000000", + "x-ms-client-request-id" : "e12fe7a3-6b32-480a-a5cc-1c416eacf1bb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9902-301e-0094-4ffc-5950b8000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac0bc642895f9498Fri, 23 Aug 2019 21:49:32 GMT\"0x8D72813C805D836\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "428c77f9-29c7-4c92-a0b6-820c1483fa4c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac0bc642895f9498?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f990b-301e-0094-58fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "c2620f25-300b-4cdc-8386-d56826b4e1eb" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac0bc642895f9498", "javablobuploadpageac1pageblobapitestuploadpageac0bc073396fe", "598ae4b1-ff6a-492e-9c7a-5ed7b8edca29" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[1].json new file mode 100644 index 000000000000..c51a1515fba5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[1].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac27442788392cb1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C81FF601\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9920-301e-0094-6cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "63c31a5d-8ccb-40b6-9dec-d6e2bf37e331" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac27442788392cb1/javablobuploadpageac1pageblobapitestuploadpageac2749961687a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C8272FD2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9938-301e-0094-01fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "72a85c9b-6e5d-4469-8adc-2e65270bacea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac27442788392cb1/javablobuploadpageac1pageblobapitestuploadpageac2749961687a?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "yx4/u8B6g50=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "ETag" : "\"0x8D72813C82C1301\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77f9947-301e-0094-0ffc-5950b8000000", + "x-ms-client-request-id" : "49cce742-062c-414d-b011-d3e62117d762" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9952-301e-0094-1afc-5950b8000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac27442788392cb1Fri, 23 Aug 2019 21:49:32 GMT\"0x8D72813C81FF601\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "eb941d96-3fcd-4c57-800c-c94110695ae2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac27442788392cb1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f995c-301e-0094-24fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "c92b45c9-1410-46be-aff6-055930e78702" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac27442788392cb1", "javablobuploadpageac1pageblobapitestuploadpageac2749961687a", "4b920eab-c707-4c8b-825a-6824160cb6e0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[2].json new file mode 100644 index 000000000000..bfffc18152f0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[2].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac99b8202383c691?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C83A891F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f996d-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "e2119782-59fa-4bf2-a8dc-ca2f2fcbac6d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac99b8202383c691/javablobuploadpageac1pageblobapitestuploadpageac99b999872f2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C83FC6EA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9979-301e-0094-3dfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "4d69adc4-5ef8-4b5e-96ce-8a3d064ed1c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac99b8202383c691/javablobuploadpageac1pageblobapitestuploadpageac99b999872f2?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "ShiVx5W+viQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "ETag" : "\"0x8D72813C8480655\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77f998a-301e-0094-4cfc-5950b8000000", + "x-ms-client-request-id" : "ebf886a1-0178-481e-9f7f-f1457e55ebad" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f99b3-301e-0094-6cfc-5950b8000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac99b8202383c691Fri, 23 Aug 2019 21:49:32 GMT\"0x8D72813C83A891F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "1eeb5bc7-a3e7-4301-b453-411976a89344", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac99b8202383c691?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f99bd-301e-0094-75fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "0dcae15d-7cc0-408a-b3fe-2bd8338c3f5a" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac99b8202383c691", "javablobuploadpageac1pageblobapitestuploadpageac99b999872f2", "96bdeb6c-3423-4082-96de-23ef7a79b287" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[3].json new file mode 100644 index 000000000000..5607f67607c4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[3].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac3d600925970519?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C85B1114\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f99ce-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "5920b0c0-705c-4c5c-9389-25ee0b907bc6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac3d600925970519/javablobuploadpageac1pageblobapitestuploadpageac3d624593dcb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C8600106\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f99da-301e-0094-0efc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "61f0b2c3-c719-4793-833a-eba9a5484a34" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac3d600925970519/javablobuploadpageac1pageblobapitestuploadpageac3d624593dcb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813C8600106\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:32 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77f99f6-301e-0094-28fc-5950b8000000", + "x-ms-client-request-id" : "629a3b2c-c7cb-4f8d-80be-fd62ee19136a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac3d600925970519/javablobuploadpageac1pageblobapitestuploadpageac3d624593dcb?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "MpBzSijuIi8=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "ETag" : "\"0x8D72813C86D4AB7\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77f9a08-301e-0094-33fc-5950b8000000", + "x-ms-client-request-id" : "8a2eb5ab-9ed7-438f-b115-3d530aebca51" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9a15-301e-0094-3efc-5950b8000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac3d600925970519Fri, 23 Aug 2019 21:49:32 GMT\"0x8D72813C85B1114\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "6e9b4c35-cf48-4b8e-9c5f-4bb5dcd50060", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac3d600925970519?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9a1e-301e-0094-47fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "42620937-e795-43ca-8ddf-7b999f7efc2f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac3d600925970519", "javablobuploadpageac1pageblobapitestuploadpageac3d624593dcb", "24715f43-eefe-4c2c-8062-6edd7e9e03be" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[4].json new file mode 100644 index 000000000000..ec478e53f8ac --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[4].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac700143573612f3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C87BC01B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9a2f-301e-0094-56fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "db7d0cd1-2f04-42a3-a56a-75635d81179c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac700143573612f3/javablobuploadpageac1pageblobapitestuploadpageac700862621b3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C880B06D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9a44-301e-0094-67fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "d7bccfa3-59f0-454b-b4ad-4eb1a672a3f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac700143573612f3/javablobuploadpageac1pageblobapitestuploadpageac700862621b3?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "OeRSmLoARAo=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "ETag" : "\"0x8D72813C885BAB7\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77f9a52-301e-0094-74fc-5950b8000000", + "x-ms-client-request-id" : "a04f3430-0761-4429-8f44-e467a68b167c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9a61-301e-0094-01fc-5950b8000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac700143573612f3Fri, 23 Aug 2019 21:49:32 GMT\"0x8D72813C87BC01B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "4d2d8325-5010-4c1b-9b39-f89f427d0108", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac700143573612f3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9a6a-301e-0094-08fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "bccf5aac-e241-44cd-b87b-6ae713d9ac53" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac700143573612f3", "javablobuploadpageac1pageblobapitestuploadpageac700862621b3", "7c8452dd-cc35-4ab2-953e-2700c99f9f2d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[5].json new file mode 100644 index 000000000000..abb2600c677d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[5].json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacaf487673d6a882?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C89456E1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9a84-301e-0094-20fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "677edadc-3b4e-4f72-a9b9-13a134a776b1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacaf487673d6a882/javablobuploadpageac1pageblobapitestuploadpageacaf4955947a4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C89995BC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9a9b-301e-0094-33fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "fd73d0a2-7729-46f9-b9d4-4270f9a48364" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacaf487673d6a882/javablobuploadpageac1pageblobapitestuploadpageacaf4955947a4?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C89995BC\"", + "x-ms-lease-id" : "8d45628b-2ff8-4f31-a409-ef84dbfc40c9", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9ab1-301e-0094-47fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "a4e8b5b9-6843-4813-bbfd-9e3e56fcf310" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacaf487673d6a882/javablobuploadpageac1pageblobapitestuploadpageacaf4955947a4?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "ZuDc09AZ4P4=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "ETag" : "\"0x8D72813C8A5314D\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77f9ac2-301e-0094-56fc-5950b8000000", + "x-ms-client-request-id" : "43571474-b06b-4435-85b8-fab510054a16" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9ada-301e-0094-6bfc-5950b8000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageacaf487673d6a882Fri, 23 Aug 2019 21:49:33 GMT\"0x8D72813C89456E1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "fa88948e-8d50-42ea-bd99-c9a706041dba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacaf487673d6a882?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9aed-301e-0094-7bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "85f8e606-65c8-48fd-b492-25ac3f7eb007" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageacaf487673d6a882", "javablobuploadpageac1pageblobapitestuploadpageacaf4955947a4", "176591ce-e441-4492-bf2d-e7838996159a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[6].json new file mode 100644 index 000000000000..02e9d99a2833 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[6].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac4b486503608045?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C8B3CD29\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9aff-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:32 GMT", + "x-ms-client-request-id" : "dc9ccad7-1b9c-41b8-abe4-4b987279dadb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac4b486503608045/javablobuploadpageac1pageblobapitestuploadpageac4b453490637", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C8B8E53F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9b08-301e-0094-13fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "ef9c2bce-9957-4a5f-8121-9387d099770a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac4b486503608045/javablobuploadpageac1pageblobapitestuploadpageac4b453490637?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "XDZNarQ6sMk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "ETag" : "\"0x8D72813C8BDC86E\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77f9b18-301e-0094-23fc-5950b8000000", + "x-ms-client-request-id" : "75cba183-3c8d-451f-834b-0b5da3413ec1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9b29-301e-0094-32fc-5950b8000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac4b486503608045Fri, 23 Aug 2019 21:49:33 GMT\"0x8D72813C8B3CD29\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "2dcb6d34-7db5-4791-9bf3-44e9fcd967a8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac4b486503608045?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9b3a-301e-0094-42fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "79b267d8-df0e-49d4-b42a-b3655d4e05c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac4b486503608045", "javablobuploadpageac1pageblobapitestuploadpageac4b453490637", "dc2c2cc2-152a-4edc-8ca2-5ccbb758658f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[7].json new file mode 100644 index 000000000000..1e4963013e83 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[7].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac85f69596f4989e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C8CC3CE6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9b47-301e-0094-4dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "df4258ce-8da0-4400-8532-a8e1a0fb8730" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac85f69596f4989e/javablobuploadpageac1pageblobapitestuploadpageac85f27790300", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C8D1553B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9b56-301e-0094-5bfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "2acef205-b024-45c1-90f6-a02d0ec0fe7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac85f69596f4989e/javablobuploadpageac1pageblobapitestuploadpageac85f27790300?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "/VadNO9MWiY=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "ETag" : "\"0x8D72813C8D61157\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77f9b6d-301e-0094-6dfc-5950b8000000", + "x-ms-client-request-id" : "9582842e-ab98-4b2f-affb-93084742b34c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9b7c-301e-0094-78fc-5950b8000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac85f69596f4989eFri, 23 Aug 2019 21:49:33 GMT\"0x8D72813C8CC3CE6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "ca9103d6-6a49-4b4d-b7a9-93031dc1d4a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac85f69596f4989e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9b8e-301e-0094-09fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "8ad7631f-8ded-4901-b57e-b7fa9365b5b7" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac85f69596f4989e", "javablobuploadpageac1pageblobapitestuploadpageac85f27790300", "454d4c96-fa22-4de9-ae69-2ae6c68348e6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[8].json new file mode 100644 index 000000000000..c298e707a839 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[8].json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac2674694689ee06?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C8E521E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9ba6-301e-0094-1ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "4b4de492-69c8-4b35-a88b-cc5ef6e8ee2f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac2674694689ee06/javablobuploadpageac1pageblobapitestuploadpageac26710119ee4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C8EA136A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9bc0-301e-0094-34fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "ee9e26b0-55cf-45de-8f40-d527cf71c95c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac2674694689ee06/javablobuploadpageac1pageblobapitestuploadpageac26710119ee4?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "LNwM1pgGRNc=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "ETag" : "\"0x8D72813C8EEF6A6\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77f9bce-301e-0094-40fc-5950b8000000", + "x-ms-client-request-id" : "4f222dd4-d86b-459f-b3f6-c373f4909e74" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9bdc-301e-0094-4dfc-5950b8000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac2674694689ee06Fri, 23 Aug 2019 21:49:33 GMT\"0x8D72813C8E521E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "7914e12d-d2c0-426a-a31a-a4ff12105a3a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac2674694689ee06?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9be7-301e-0094-57fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "1f5db953-2889-4daf-86c7-645f34808c3a" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac2674694689ee06", "javablobuploadpageac1pageblobapitestuploadpageac26710119ee4", "c66491c9-1efe-4cf4-805a-b682cbc1ca03" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[0].json new file mode 100644 index 000000000000..d91d34aecdb3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[0].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile4b10863d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C8FDDFCA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9bf6-301e-0094-65fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "13337b34-7e5d-4214-b19b-6d5d01c34996" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile4b10863d8/javablobuploadpageacfail145404eb771f9b781c4dea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C902F8BE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9c07-301e-0094-75fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "71400c55-892c-4bdf-9fa8-8ed26a40fc52" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile4b10863d8/javablobuploadpageacfail145404eb771f9b781c4dea?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77f9c2c-301e-0094-16fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77f9c2c-301e-0094-16fc-5950b8000000\nTime:2019-08-23T21:49:33.8475929Z", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "21f7e956-c57f-40b9-87e0-cb7717fba225", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9c3b-301e-0094-24fc-5950b8000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfaile4b10863d8Fri, 23 Aug 2019 21:49:33 GMT\"0x8D72813C8FDDFCA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "134e42ae-841e-4fdb-8f0e-16f0b0215223", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile4b10863d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9c4b-301e-0094-32fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "1e219400-b3d8-4076-8bd5-98b07dd80f0c" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfaile4b10863d8", "javablobuploadpageacfail145404eb771f9b781c4dea", "8ceee250-ffc3-49ca-9c6e-cbd196423488" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[1].json new file mode 100644 index 000000000000..69181192887d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[1].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail57895842f8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C9160150\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9c5c-301e-0094-40fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "3689ea63-47b5-4134-b133-2aa7f5cccea3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail57895842f8/javablobuploadpageacfail1960233055dc52a164498d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C91B8FD6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9c6e-301e-0094-4efc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "3f2195d5-ed8c-4a92-b45f-4a8f17f1acf2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail57895842f8/javablobuploadpageacfail1960233055dc52a164498d?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77f9c82-301e-0094-5ffc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77f9c82-301e-0094-5ffc-5950b8000000\nTime:2019-08-23T21:49:34.0087396Z", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "cf27f14e-e283-4f45-83c0-d0018deed77e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9c91-301e-0094-6dfc-5950b8000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail57895842f8Fri, 23 Aug 2019 21:49:33 GMT\"0x8D72813C9160150\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "a1e3304b-192e-46c7-95bc-12be2554e1c1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail57895842f8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9cac-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "d0234194-ab11-4482-ae99-03d265e67b3e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail57895842f8", "javablobuploadpageacfail1960233055dc52a164498d", "815cb790-7dcd-4bcf-84fe-28e39ab74fd3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[2].json new file mode 100644 index 000000000000..2675d899f474 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[2].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail62b551009c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C94E5C90\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9d33-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:33 GMT", + "x-ms-client-request-id" : "426b6d12-dce2-4ac7-bec4-c3abbef1b566" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail62b551009c/javablobuploadpageacfail150875bf82683474c844fb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C9539D87\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9d43-301e-0094-01fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "b5048130-2961-4224-94ed-78d43ce5c227" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail62b551009c/javablobuploadpageacfail150875bf82683474c844fb?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77f9d5a-301e-0094-16fc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77f9d5a-301e-0094-16fc-5950b8000000\nTime:2019-08-23T21:49:34.3720721Z", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "1c6b9af9-0cd2-4b24-9ba3-2a7b6d1e3fbf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9d5f-301e-0094-1bfc-5950b8000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail62b551009cFri, 23 Aug 2019 21:49:34 GMT\"0x8D72813C94E5C90\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "d394a853-701c-4aeb-a1b7-e183af608549", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail62b551009c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9d7a-301e-0094-2ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "329fcef3-499a-4dcd-a566-7cdfdbe5ee89" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail62b551009c", "javablobuploadpageacfail150875bf82683474c844fb", "b43f7cd4-3f90-4204-a54e-fbae54610123" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[3].json new file mode 100644 index 000000000000..d8dae2c9e2ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[3].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile3496789cb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C96A9DBC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9d8a-301e-0094-3efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "89c69259-5d56-47e2-b126-46fd34f1048e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile3496789cb/javablobuploadpageacfail1611981d3670d8a1fa4848", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C96F90D7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9d9d-301e-0094-4ffc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "c86af335-fa37-4c5d-b673-c68c5415b2aa" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile3496789cb/javablobuploadpageacfail1611981d3670d8a1fa4848", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:34 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813C96F90D7\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:34 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77f9dcb-301e-0094-77fc-5950b8000000", + "x-ms-client-request-id" : "31b02e41-c5f7-4ad3-99c9-2739e71218a4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile3496789cb/javablobuploadpageacfail1611981d3670d8a1fa4848?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "f77f9dd0-301e-0094-7cfc-5950b8000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77f9dd0-301e-0094-7cfc-5950b8000000\nTime:2019-08-23T21:49:34.6333108Z", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "5a9e11a9-c280-4487-aa60-d9ec6b182c92", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9ddd-301e-0094-07fc-5950b8000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfaile3496789cbFri, 23 Aug 2019 21:49:34 GMT\"0x8D72813C96A9DBC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "70a48fae-2825-4c5e-b741-83873ba7b5ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile3496789cb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9dea-301e-0094-14fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "6986c485-7b8f-4bbe-a650-af848cef2b7e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfaile3496789cb", "javablobuploadpageacfail1611981d3670d8a1fa4848", "820d9856-a94b-42e0-bc9c-8e069fae9b41" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[4].json new file mode 100644 index 000000000000..bdd20d1eb40e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[4].json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail0f2511051b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C98E5AC8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9dff-301e-0094-26fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "f7d62249-0d33-4772-a118-fc4c4592d972" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail0f2511051b/javablobuploadpageacfail140283b101314957034f17", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C9A2943E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9e3b-301e-0094-5dfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "80809e56-7de6-4f7c-88f9-3830204130c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail0f2511051b/javablobuploadpageacfail140283b101314957034f17?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C9A2943E\"", + "x-ms-lease-id" : "95c10554-f2c8-47ef-a04f-11d82f0b6c66", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9e47-301e-0094-68fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "4d923a62-2513-4765-8f47-93713740b3be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail0f2511051b/javablobuploadpageacfail140283b101314957034f17?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "f77f9e50-301e-0094-70fc-5950b8000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:f77f9e50-301e-0094-70fc-5950b8000000\nTime:2019-08-23T21:49:34.9245770Z", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "26f0070c-b262-49f5-a145-bb1960a6f9be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9e61-301e-0094-80fc-5950b8000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail0f2511051bFri, 23 Aug 2019 21:49:34 GMT\"0x8D72813C98E5AC8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "ead2106d-00df-4186-a870-ffa4aa0d3c9d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail0f2511051b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9e71-301e-0094-10fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "63f4c7b0-49c9-48bc-9e6a-526417f41747" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail0f2511051b", "javablobuploadpageacfail140283b101314957034f17", "164966fb-20d9-4eb6-8e1d-536dfb5bbdae" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[5].json new file mode 100644 index 000000000000..f34c41057c98 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[5].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailc4010271d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C9BAA542\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9e89-301e-0094-27fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "90cbb78c-5614-455b-9fe9-a1016bfce3aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailc4010271d8/javablobuploadpageacfail1412946733460d6d474cd3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C9BFE772\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9e9d-301e-0094-39fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "3c37a982-dff2-4813-b389-ebd8cb56b2b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailc4010271d8/javablobuploadpageacfail1412946733460d6d474cd3?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidInput", + "retry-after" : "0", + "Content-Length" : "220", + "StatusCode" : "400", + "x-ms-request-id" : "f77f9ec4-301e-0094-5dfc-5950b8000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:f77f9ec4-301e-0094-5dfc-5950b8000000\nTime:2019-08-23T21:49:35.1617942Z", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "52504ba6-abe3-48d2-8786-ded254dc2cc0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9ef8-301e-0094-07fc-5950b8000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfailc4010271d8Fri, 23 Aug 2019 21:49:35 GMT\"0x8D72813C9BAA542\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "bad49978-feaf-4f6d-b616-fb85f7581408", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailc4010271d8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9f0e-301e-0094-1afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "c627f3cd-5994-406a-b4b9-1496d74f1967" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfailc4010271d8", "javablobuploadpageacfail1412946733460d6d474cd3", "4dceb8cd-f582-46c4-8955-56f74e31be8f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[6].json new file mode 100644 index 000000000000..54ff9124421e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[6].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailb695087886?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C9DF9B05\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9f2b-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "574a882b-b7e5-4fa4-8fbe-8191c704a8e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailb695087886/javablobuploadpageacfail176494c21fdb1ba6054ecb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C9E4B68E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9f3e-301e-0094-46fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:34 GMT", + "x-ms-client-request-id" : "d8f5b312-2eaf-4789-859c-b08638578879" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailb695087886/javablobuploadpageacfail176494c21fdb1ba6054ecb?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidInput", + "retry-after" : "0", + "Content-Length" : "220", + "StatusCode" : "400", + "x-ms-request-id" : "f77f9f50-301e-0094-53fc-5950b8000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:f77f9f50-301e-0094-53fc-5950b8000000\nTime:2019-08-23T21:49:35.3269451Z", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "8d295e42-a715-49c1-83ad-3b676d63af4f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9f5a-301e-0094-5cfc-5950b8000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfailb695087886Fri, 23 Aug 2019 21:49:35 GMT\"0x8D72813C9DF9B05\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "a3b135a3-7153-4692-937e-db2f06b326fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailb695087886?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9f67-301e-0094-67fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "b49daf13-a67a-4b66-82d3-ea0771716f3d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfailb695087886", "javablobuploadpageacfail176494c21fdb1ba6054ecb", "cb104bfb-887b-49a5-865f-674a9f472510" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[7].json new file mode 100644 index 000000000000..d8722731cfb0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[7].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail5cb237778d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C9F96AA3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9f82-301e-0094-80fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "9626f64c-1ed1-4715-afe7-ecea13edaf37" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail5cb237778d/javablobuploadpageacfail1745633f58084d6b324407", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C9FE8673\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9f95-301e-0094-10fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "7a9c2e76-a034-4fa6-84de-f3c5607475d1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail5cb237778d/javablobuploadpageacfail1745633f58084d6b324407?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SequenceNumberConditionNotMet", + "retry-after" : "0", + "Content-Length" : "250", + "StatusCode" : "412", + "x-ms-request-id" : "f77f9fa8-301e-0094-23fc-5950b8000000", + "Body" : "SequenceNumberConditionNotMetThe sequence number condition specified was not met.\nRequestId:f77f9fa8-301e-0094-23fc-5950b8000000\nTime:2019-08-23T21:49:35.4981023Z", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "65cd5689-2029-4b10-a518-8d56ab766119", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9fbf-301e-0094-33fc-5950b8000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail5cb237778dFri, 23 Aug 2019 21:49:35 GMT\"0x8D72813C9F96AA3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "e541b063-2a6a-41f9-bfc1-ac2d051e6fce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail5cb237778d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9fca-301e-0094-3dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "e6ea3738-a80b-4ab0-a893-5e9a2d62af44" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail5cb237778d", "javablobuploadpageacfail1745633f58084d6b324407", "d42dc386-14ee-4f0b-bc6f-3df3d42368ce" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageerror.json new file mode 100644 index 000000000000..8655c8500a9f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageerror.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerror63a5077953e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CA124FA0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9fd8-301e-0094-4bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "81e30178-6e11-4176-9ff9-dda81f116149" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerror63a5077953e/javablobuploadpageerror1pageblobapitestuploadpageerror63a04324", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CA1744A6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f9fe9-301e-0094-5afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "1b34fd11-99c7-46dc-be05-afecece20d57" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerror63a5077953e/javablobuploadpageerror2pageblobapitestuploadpageerror63a80698?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "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" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "f77f9ff4-301e-0094-64fc-5950b8000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:f77f9ff4-301e-0094-64fc-5950b8000000\nTime:2019-08-23T21:49:36.2948315Zx-ms-lease-idid", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "59106297-59e8-4b73-b5e9-05854a6ac782", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa159-301e-0094-1afc-5950b8000000", + "Body" : "jtcuploadpageerrorjtcuploadpageerror0pageblobapitestuploadpageerror63a5077953eFri, 23 Aug 2019 21:49:35 GMT\"0x8D72813CA124FA0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:35 GMT", + "x-ms-client-request-id" : "d69e2061-9ac2-414d-b6ad-17d5182df6c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerror63a5077953e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa162-301e-0094-21fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "50152bc8-0ffe-42a7-9fab-627c2389a7f9" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageerror0pageblobapitestuploadpageerror63a5077953e", "javablobuploadpageerror1pageblobapitestuploadpageerror63a04324", "javablobuploadpageerror2pageblobapitestuploadpageerror63a80698", "50bd2aa6-ca97-4649-bb98-5eb090f9d27c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[0].json new file mode 100644 index 000000000000..d1d9b5572d20 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[0].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac008201ca8c26312021?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CBAA6633\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa533-301e-0094-6cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "d83ec85c-047f-45af-9f99-27dcc12cac83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac008201ca8c26312021/javablobuploadpagefromurldestinationac102347d2897c733", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CBAF5FE0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa54a-301e-0094-80fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "f9f272d8-0ebc-43d1-9138-ddf358c66922" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac008201ca8c26312021?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CBB46263\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa561-301e-0094-15fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "95434d20-8e2d-459d-a723-e42f659f87a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac008201ca8c26312021/javablobuploadpagefromurldestinationac22238266a58c51a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CBBA37FC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa570-301e-0094-23fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "562d7f57-371f-4db2-bb26-fe3feb5d70a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac008201ca8c26312021/javablobuploadpagefromurldestinationac22238266a58c51a?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "CDMgYbjzOuc=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "ETag" : "\"0x8D72813CBBF4254\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa583-301e-0094-31fc-5950b8000000", + "x-ms-client-request-id" : "f1997498-63ff-4c7d-9f78-1fc4887a44e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac008201ca8c26312021/javablobuploadpagefromurldestinationac102347d2897c733?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "Content-MD5" : "xN7IsfhKxHL5gDLuj4EIrg==", + "ETag" : "\"0x8D72813CBC81E18\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa5a1-301e-0094-4bfc-5950b8000000", + "x-ms-client-request-id" : "9ae6ae7f-40df-4713-bfe3-25d7002786fa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa5bc-301e-0094-64fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac008201ca8c26312021Fri, 23 Aug 2019 21:49:38 GMT\"0x8D72813CBB46263\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "077d5433-5360-423a-ada4-214d5bd4844b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac008201ca8c26312021?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa5c7-301e-0094-6ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "04ba6925-04fd-4a1a-9bd3-864cdeea08b3" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac008201ca8c26312021", "javablobuploadpagefromurldestinationac102347d2897c733", "javablobuploadpagefromurldestinationac22238266a58c51a", "74a6c0f3-6547-4a11-87e0-0377a98f8788" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[1].json new file mode 100644 index 000000000000..339c25474ecc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[1].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac023783fa28320842c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CBD8D417\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa5dc-301e-0094-02fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "359036a8-0cc4-4c60-b9c5-ff0e04433924" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac023783fa28320842c6/javablobuploadpagefromurldestinationac197872978693757", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CBDE4396\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa5ed-301e-0094-10fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "37289bd8-4f64-4227-996d-ff433b95e7c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac023783fa28320842c6?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CBE2F798\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa5f6-301e-0094-19fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "fcb26990-b9b9-4872-a994-6c854a089482" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac023783fa28320842c6/javablobuploadpagefromurldestinationac280815555fcca72", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CBE809FC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa606-301e-0094-28fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "2d3d6b1a-c3c3-4348-9738-ea4889e0e28e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac023783fa28320842c6/javablobuploadpagefromurldestinationac280815555fcca72?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "PlSCrm2nxyc=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "ETag" : "\"0x8D72813CBED3B63\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa61a-301e-0094-3afc-5950b8000000", + "x-ms-client-request-id" : "e63f5759-9c82-4c2f-85f0-c87febf77255" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac023783fa28320842c6/javablobuploadpagefromurldestinationac197872978693757?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "Content-MD5" : "OsVzOLV4xkz2caz46q4vPA==", + "ETag" : "\"0x8D72813CBF33047\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa623-301e-0094-43fc-5950b8000000", + "x-ms-client-request-id" : "f8d0edcf-b1bd-4783-afd6-78bdba4cf627" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa63c-301e-0094-57fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac023783fa28320842c6Fri, 23 Aug 2019 21:49:38 GMT\"0x8D72813CBE2F798\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "cc52ac99-3c44-4062-8738-cf00ceab5f2f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac023783fa28320842c6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa649-301e-0094-62fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "fabac030-cdbf-4618-8571-6741dcddea73" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac023783fa28320842c6", "javablobuploadpagefromurldestinationac197872978693757", "javablobuploadpagefromurldestinationac280815555fcca72", "bbaa43e5-84ed-455e-a1a7-b287b3d66a2c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[2].json new file mode 100644 index 000000000000..acd74c884828 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[2].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09959294031342a490?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC0285E8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa654-301e-0094-6bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "3542e9e2-915c-4cc7-a49b-da89ef4408fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09959294031342a490/javablobuploadpagefromurldestinationac143225f3ad25d0a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC07597F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa667-301e-0094-7afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "704bd58f-5319-402b-a80d-0eb5d295e18e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09959294031342a490?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC0DE26D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa683-301e-0094-11fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "71b6d6ac-2e45-441b-8116-685d382f9754" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09959294031342a490/javablobuploadpagefromurldestinationac2194144a76f2a54", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC12F519\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa68d-301e-0094-19fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "e93cbf4c-8406-4cfc-b284-bc8f2cbfee80" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09959294031342a490/javablobuploadpagefromurldestinationac2194144a76f2a54?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "lAfWHMm30BI=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "ETag" : "\"0x8D72813CC1B5BA0\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa6a3-301e-0094-2dfc-5950b8000000", + "x-ms-client-request-id" : "6e120eba-4eda-42e7-9fc8-f111a7028bae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09959294031342a490/javablobuploadpagefromurldestinationac143225f3ad25d0a?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "Content-MD5" : "TD1ZYgjczm0dihlpWILCEA==", + "ETag" : "\"0x8D72813CC21C5CA\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa6b2-301e-0094-3bfc-5950b8000000", + "x-ms-client-request-id" : "eef7ff32-e29b-449c-b413-9ccf2238f9b1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa6c8-301e-0094-50fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac09959294031342a490Fri, 23 Aug 2019 21:49:38 GMT\"0x8D72813CC0DE26D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "f68afed6-ffe9-4581-a322-409c3ac79419", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09959294031342a490?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa6e1-301e-0094-65fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "fb03590d-cbb0-4c45-a1f9-3433a5673ee4" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac09959294031342a490", "javablobuploadpagefromurldestinationac143225f3ad25d0a", "javablobuploadpagefromurldestinationac2194144a76f2a54", "9c45b27c-6481-4f97-8658-570173e845d5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[3].json new file mode 100644 index 000000000000..34441ecfdf15 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[3].json @@ -0,0 +1,203 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac048402f34db33b8c5d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC311ADE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa6f1-301e-0094-74fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "edcf53c0-0344-4aaa-ba54-c05cc38a7f82" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac048402f34db33b8c5d/javablobuploadpagefromurldestinationac1542710f2050e88", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC361615\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa712-301e-0094-10fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "c25ff4cb-06e2-40bc-af55-c515a53acc9b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac048402f34db33b8c5d?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC3AF0A0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa728-301e-0094-23fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "c22fce1f-31b8-43ac-9e6e-1aa9fb078300" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac048402f34db33b8c5d/javablobuploadpagefromurldestinationac251343bb3eb2256", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC40039C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa73a-301e-0094-33fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-client-request-id" : "317f13c0-7691-4c2c-87cd-62a6d89e7e0f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac048402f34db33b8c5d/javablobuploadpagefromurldestinationac251343bb3eb2256?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Etxij5jHYVM=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "ETag" : "\"0x8D72813CC455C15\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa756-301e-0094-49fc-5950b8000000", + "x-ms-client-request-id" : "d23a2051-30bf-4f63-83be-79355a5a0378" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac048402f34db33b8c5d/javablobuploadpagefromurldestinationac1542710f2050e88", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:38 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813CC361615\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:39 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fa76b-301e-0094-5afc-5950b8000000", + "x-ms-client-request-id" : "b18e65a3-5928-4269-8c80-c99c21f2b8f4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac048402f34db33b8c5d/javablobuploadpagefromurldestinationac1542710f2050e88?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "Content-MD5" : "ieeDp51aFX/hZ4unncTOQw==", + "ETag" : "\"0x8D72813CC505B50\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa77d-301e-0094-6bfc-5950b8000000", + "x-ms-client-request-id" : "57b7735e-0f07-4ee9-aeac-1f9dd4a10c3b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa793-301e-0094-80fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac048402f34db33b8c5dFri, 23 Aug 2019 21:49:39 GMT\"0x8D72813CC3AF0A0\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "59c70320-3ab1-43f1-9df9-7f8b897cd48f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac048402f34db33b8c5d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa79b-301e-0094-07fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "50866895-8423-4a9d-9c16-3d3abe4a5711" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac048402f34db33b8c5d", "javablobuploadpagefromurldestinationac1542710f2050e88", "javablobuploadpagefromurldestinationac251343bb3eb2256", "7e8187fe-c0b8-4839-bf17-645b0e1b2059" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[4].json new file mode 100644 index 000000000000..f1d75a7abd44 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[4].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09502129fc9e61f1a3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC60C18B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa7b4-301e-0094-1efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "e85f76d6-81ff-40cf-9a18-09113c4e3bea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09502129fc9e61f1a3/javablobuploadpagefromurldestinationac19566893153a042", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC660B88\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa7d0-301e-0094-33fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "5397d01f-b16b-48c3-8bb7-5189003272dd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09502129fc9e61f1a3?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC6AE5B6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa7e4-301e-0094-46fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "ef0e49a9-7e69-4007-954b-b2bcf9c864f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09502129fc9e61f1a3/javablobuploadpagefromurldestinationac223242c06bf0c37", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC6F83C4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa7f5-301e-0094-51fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "6d5bf6e8-350c-45b8-a23c-d7aef0224cd5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09502129fc9e61f1a3/javablobuploadpagefromurldestinationac223242c06bf0c37?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "gq+u7tnLDaQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "ETag" : "\"0x8D72813CC748E11\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa804-301e-0094-5dfc-5950b8000000", + "x-ms-client-request-id" : "a899d5eb-0c03-4e8a-89b8-9407d9604078" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09502129fc9e61f1a3/javablobuploadpagefromurldestinationac19566893153a042?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "Content-MD5" : "r1mgw0TtsjM/Ox1ILaHatQ==", + "ETag" : "\"0x8D72813CC889031\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa818-301e-0094-6efc-5950b8000000", + "x-ms-client-request-id" : "ea204ef4-90cf-4f7e-90c1-9e1dc380d15d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa85b-301e-0094-27fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac09502129fc9e61f1a3Fri, 23 Aug 2019 21:49:39 GMT\"0x8D72813CC6AE5B6\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "02cedf6a-74f9-478c-a6ff-e1002bc3fa5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac09502129fc9e61f1a3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa868-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "f074c52e-edda-4d27-b496-6fa0ecde7a20" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac09502129fc9e61f1a3", "javablobuploadpagefromurldestinationac19566893153a042", "javablobuploadpagefromurldestinationac223242c06bf0c37", "55f23fa0-2b7f-4398-9abe-755645d52fe8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[5].json new file mode 100644 index 000000000000..293e767646ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[5].json @@ -0,0 +1,193 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac005677658b687dbdb0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CC9F11A2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa897-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "f5ceb353-cadd-4c77-b1cb-311ce6fd35a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac005677658b687dbdb0/javablobuploadpagefromurldestinationac1777251466e195b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CCA51FF3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa8a3-301e-0094-60fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "8bb3c06a-5f03-421f-9941-c5f596faff88" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac005677658b687dbdb0?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CCAABD19\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa8b8-301e-0094-72fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "c4536fb9-2412-4fdd-8fba-8b3f024b75d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac005677658b687dbdb0/javablobuploadpagefromurldestinationac245690ee955cc5c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CCB1A635\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa8d0-301e-0094-06fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "cefc942c-f337-4bc7-8934-713f6f2584b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac005677658b687dbdb0/javablobuploadpagefromurldestinationac245690ee955cc5c?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "hig3JMpoCmM=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "ETag" : "\"0x8D72813CCB6FEB1\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa8e2-301e-0094-16fc-5950b8000000", + "x-ms-client-request-id" : "0b85f505-ef04-4487-843b-961ac198fff1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac005677658b687dbdb0/javablobuploadpagefromurldestinationac1777251466e195b?comp=lease", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CCA51FF3\"", + "x-ms-lease-id" : "53a4fdae-08ca-445d-b34c-e8cd5d5145be", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa8ef-301e-0094-22fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "d9a871e7-05b4-4ae9-9e19-232685d44698" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac005677658b687dbdb0/javablobuploadpagefromurldestinationac1777251466e195b?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "Content-MD5" : "1Mn3OxbzmAn9YGg8PZE9EA==", + "ETag" : "\"0x8D72813CCC29A4B\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa909-301e-0094-3bfc-5950b8000000", + "x-ms-client-request-id" : "9d858e4d-d58b-4f0f-b0f5-241ce04875e0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa925-301e-0094-51fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac005677658b687dbdb0Fri, 23 Aug 2019 21:49:39 GMT\"0x8D72813CCAABD19\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "5173b387-412f-4d48-b167-a214181742ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac005677658b687dbdb0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa934-301e-0094-5ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "1c275031-9804-4e3b-b40b-df803815ea8d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac005677658b687dbdb0", "javablobuploadpagefromurldestinationac1777251466e195b", "javablobuploadpagefromurldestinationac245690ee955cc5c", "825a913a-7aa1-48a9-8434-4f5b2fc71f66" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[6].json new file mode 100644 index 000000000000..6b1d34ce9234 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[6].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac069638c2439791b99d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CCD3E99D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa952-301e-0094-79fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "9f311fe0-1636-490a-998c-36c235411d51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac069638c2439791b99d/javablobuploadpagefromurldestinationac106137f7a713199", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CCD93522\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa960-301e-0094-05fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "b056a728-a2e9-46d6-a055-f195977bd96a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac069638c2439791b99d?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CCE14374\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa971-301e-0094-13fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:39 GMT", + "x-ms-client-request-id" : "3f1d1470-1ea6-454c-8c8b-14a57cdcd705" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac069638c2439791b99d/javablobuploadpagefromurldestinationac24720205892cb3e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CCE630AD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa981-301e-0094-21fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "85c60c68-0893-42e7-9323-5062106b8188" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac069638c2439791b99d/javablobuploadpagefromurldestinationac24720205892cb3e?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "ylVC0imiqig=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "ETag" : "\"0x8D72813CCEB3AFC\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa98e-301e-0094-2dfc-5950b8000000", + "x-ms-client-request-id" : "72705b9b-c7d5-4ca5-b262-6b4a27bbc760" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac069638c2439791b99d/javablobuploadpagefromurldestinationac106137f7a713199?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "Content-MD5" : "gN3iSCdDy+9Y21g4LpouGg==", + "ETag" : "\"0x8D72813CCF7C12B\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa9a1-301e-0094-3ffc-5950b8000000", + "x-ms-client-request-id" : "f57b4b2f-4039-48e6-ae5e-15922720e786" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa9c9-301e-0094-64fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac069638c2439791b99dFri, 23 Aug 2019 21:49:40 GMT\"0x8D72813CCE14374\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "488e9cf0-b06c-417d-b8a0-708442fd46e2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac069638c2439791b99d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa9d9-301e-0094-73fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "2b80331b-85da-4dcb-b7ea-f231a4f61f7d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac069638c2439791b99d", "javablobuploadpagefromurldestinationac106137f7a713199", "javablobuploadpagefromurldestinationac24720205892cb3e", "bab71ee8-f645-4807-a8e0-2631cb3c3ecc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[7].json new file mode 100644 index 000000000000..d3d09adb5f06 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[7].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0386916c19526d866b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD07138F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa9f3-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "17d18785-2a17-49ce-98d1-a4be8b9ffe72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0386916c19526d866b/javablobuploadpagefromurldestinationac179548444d3dbcf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD0C86CE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77faa0c-301e-0094-20fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "6dfa548d-bac0-47ac-b97a-06b0d46a35eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0386916c19526d866b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD11ADD4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77faa2e-301e-0094-3ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "6a19dc43-af24-456e-b0cd-20de68f21b1f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0386916c19526d866b/javablobuploadpagefromurldestinationac264416de94976c2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD167447\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77faa39-301e-0094-49fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "0d84d2ab-eaeb-49ec-8e5f-6b71f6c420f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0386916c19526d866b/javablobuploadpagefromurldestinationac264416de94976c2?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "M9UVIX6Tx2g=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "ETag" : "\"0x8D72813CD1B7E88\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77faa4b-301e-0094-59fc-5950b8000000", + "x-ms-client-request-id" : "0c107035-08e2-473e-91c8-5f07ecf5ed64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0386916c19526d866b/javablobuploadpagefromurldestinationac179548444d3dbcf?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "Content-MD5" : "a4cq1Ar2Dqnvq+f8wRwPPA==", + "ETag" : "\"0x8D72813CD28C843\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77faa5e-301e-0094-6cfc-5950b8000000", + "x-ms-client-request-id" : "c6fc2335-e083-4524-a164-9004e506ee67" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77faa89-301e-0094-12fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac0386916c19526d866bFri, 23 Aug 2019 21:49:40 GMT\"0x8D72813CD11ADD4\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "bb4579b4-69c5-4f1d-ae57-6c097221eb94", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac0386916c19526d866b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77faa9e-301e-0094-22fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "67f72fde-eb2b-4abb-ab7b-8859867662e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac0386916c19526d866b", "javablobuploadpagefromurldestinationac179548444d3dbcf", "javablobuploadpagefromurldestinationac264416de94976c2", "0b8a064d-eba8-40be-8258-c1adc6de399c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[8].json new file mode 100644 index 000000000000..979a637bd0a8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[8].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac067403efc055fb00c2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD3A1658\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77faab1-301e-0094-35fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "d943c34d-ee5f-474c-817d-1e579ca9559b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac067403efc055fb00c2/javablobuploadpagefromurldestinationac1588201d8ea15f2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD3F14D8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77faac1-301e-0094-42fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "d9e35c57-4203-4f1f-a31b-abd3e3b5b1be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac067403efc055fb00c2?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD43ED65\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77faace-301e-0094-4ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "1a6eef71-31f5-4075-9791-475083611ab4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac067403efc055fb00c2/javablobuploadpagefromurldestinationac204512101d95f0f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD48B42C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77faadb-301e-0094-5afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "6997ce43-382f-4da7-aafd-b9adf23e2bc3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac067403efc055fb00c2/javablobuploadpagefromurldestinationac204512101d95f0f?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "3ioMaKnap+s=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "ETag" : "\"0x8D72813CD4EF743\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77faae8-301e-0094-67fc-5950b8000000", + "x-ms-client-request-id" : "ac2e03fc-877f-4895-a995-d2c8fef6d7c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac067403efc055fb00c2/javablobuploadpagefromurldestinationac1588201d8ea15f2?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "Content-MD5" : "usju/JojfTxpn2Kbdz78CQ==", + "ETag" : "\"0x8D72813CD59CF5B\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77faaf7-301e-0094-73fc-5950b8000000", + "x-ms-client-request-id" : "fa64330e-0f8d-4353-99d4-5800a8ccf8f5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fab28-301e-0094-1efc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac067403efc055fb00c2Fri, 23 Aug 2019 21:49:40 GMT\"0x8D72813CD43ED65\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "2cc529b8-e92c-4bb2-81e7-0448e63fb5b6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationac067403efc055fb00c2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fab30-301e-0094-25fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "b748572c-5e38-4117-bfad-bf80c3c18cdd" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac067403efc055fb00c2", "javablobuploadpagefromurldestinationac1588201d8ea15f2", "javablobuploadpagefromurldestinationac204512101d95f0f", "11cb7981-18c4-4ef9-a97b-5dda19e75336" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[0].json new file mode 100644 index 000000000000..2b6c6c8e1c7e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[0].json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail001683c5061d6869?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD69209B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fab44-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "2da34812-e359-47e5-ab8f-c4fec3c37a99" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail001683c5061d6869/javablobuploadpagefromurldestinationacfail1578615fdf975", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD6FF4DD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fab5d-301e-0094-48fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "60f7dd85-06cf-426e-9e5a-a8df1c3728da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail001683c5061d6869?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD75DEC7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fab65-301e-0094-4efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "ef21150d-cc6a-4fd6-b5b7-8a47e7c275d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail001683c5061d6869/javablobuploadpagefromurldestinationacfail2691358577d6b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CD7C05C2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fab87-301e-0094-5efc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:40 GMT", + "x-ms-client-request-id" : "95b3c71d-96ff-49b2-b91c-a28a6015fd97" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail001683c5061d6869/javablobuploadpagefromurldestinationacfail2691358577d6b?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "wNrjcWuuNW8=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "ETag" : "\"0x8D72813CD80E8F9\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77faba0-301e-0094-6efc-5950b8000000", + "x-ms-client-request-id" : "370c58ae-c3cf-42ce-84b2-136bf0ed6e5f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail001683c5061d6869/javablobuploadpagefromurldestinationacfail1578615fdf975?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "f77fabaa-301e-0094-76fc-5950b8000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fabaa-301e-0094-76fc-5950b8000000\nTime:2019-08-23T21:49:41.3914928Z", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "3d46e82e-f14f-4c9d-b587-d21bc0d6fd46", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fabbc-301e-0094-04fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail001683c5061d6869Fri, 23 Aug 2019 21:49:41 GMT\"0x8D72813CD75DEC7\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "54f7f04d-84be-4633-b366-e5def60f8757", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail001683c5061d6869?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fabde-301e-0094-19fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "a12b6824-bed5-458e-a9be-87b7dddfdeeb" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail001683c5061d6869", "javablobuploadpagefromurldestinationacfail1578615fdf975", "javablobuploadpagefromurldestinationacfail2691358577d6b", "f9e6dce0-7159-4f60-ac53-68d9d25e2f1f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[1].json new file mode 100644 index 000000000000..2ec54e1f3056 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[1].json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail074215770eed7982?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CDA4148E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fac31-301e-0094-53fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "cc00c679-1c37-48e8-a299-61035f3bb6f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail074215770eed7982/javablobuploadpagefromurldestinationacfail15613578af441", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CDA96273\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fac47-301e-0094-66fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "4aff231e-15f4-49ae-854f-1707a5bd7a4f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail074215770eed7982?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CDAE133B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fac5e-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "bbb263c4-0a30-4061-941c-490779d170af" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail074215770eed7982/javablobuploadpagefromurldestinationacfail2370183561246", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CDB328DE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fac6d-301e-0094-04fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "a9695a7a-ebe1-4140-bc08-141823d810cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail074215770eed7982/javablobuploadpagefromurldestinationacfail2370183561246?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "89MQAaAzk1Y=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "ETag" : "\"0x8D72813CDB88161\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fac83-301e-0094-14fc-5950b8000000", + "x-ms-client-request-id" : "6fba7c26-0588-4483-93d3-08108a2ef541" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail074215770eed7982/javablobuploadpagefromurldestinationacfail15613578af441?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "f77fac9a-301e-0094-29fc-5950b8000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fac9a-301e-0094-29fc-5950b8000000\nTime:2019-08-23T21:49:41.7558265Z", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "7a4360e5-73b8-43c1-b103-b065da0d5c14", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77faca9-301e-0094-36fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail074215770eed7982Fri, 23 Aug 2019 21:49:41 GMT\"0x8D72813CDAE133B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "8e4dccef-3e58-499a-8d72-0ba50d57a272", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail074215770eed7982?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77facb5-301e-0094-40fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "eaabae03-c9d7-4f3c-ba86-357856152d13" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail074215770eed7982", "javablobuploadpagefromurldestinationacfail15613578af441", "javablobuploadpagefromurldestinationacfail2370183561246", "97cfbb2c-fb2b-406c-8c1a-4c0a368defbc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[2].json new file mode 100644 index 000000000000..20ed89a8a776 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[2].json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail03510915b865d408?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CDCDC65F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77facc4-301e-0094-4dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "8f5edadd-f10b-4373-8865-db87f7c7bed8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail03510915b865d408/javablobuploadpagefromurldestinationacfail123888fe8bd8f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CDD314C3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77facd5-301e-0094-5afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "5aab1e72-ad87-4606-9ab2-e16feb7c7fe1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail03510915b865d408?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CDD83A8F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77face3-301e-0094-66fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "2276f1e6-0a92-4826-9d43-149ed58e6e18" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail03510915b865d408/javablobuploadpagefromurldestinationacfail2345961cf4f98", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CDE4F374\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fad14-301e-0094-10fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "0793904b-571e-4052-85d2-03325acb9d35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail03510915b865d408/javablobuploadpagefromurldestinationacfail2345961cf4f98?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "C3/aaXK8nt0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "ETag" : "\"0x8D72813CDEA24DF\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fad20-301e-0094-1bfc-5950b8000000", + "x-ms-client-request-id" : "5ab8e03d-4d6e-4085-91b4-4433b49cf01b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail03510915b865d408/javablobuploadpagefromurldestinationacfail123888fe8bd8f?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "266", + "StatusCode" : "412", + "x-ms-request-id" : "f77fad3d-301e-0094-2efc-5950b8000000", + "Body" : "\nTargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fad3d-301e-0094-2efc-5950b8000000\nTime:2019-08-23T21:49:42.0771192Z", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "82164385-43e0-45a2-b9b2-dfe83fa92801", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fad5a-301e-0094-43fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail03510915b865d408Fri, 23 Aug 2019 21:49:41 GMT\"0x8D72813CDD83A8F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "d74c6df9-3dd8-4c3f-a384-f0f9f9c0a211", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail03510915b865d408?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fad70-301e-0094-50fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "cdb64728-555a-4ae0-906e-1cd0c6389a76" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail03510915b865d408", "javablobuploadpagefromurldestinationacfail123888fe8bd8f", "javablobuploadpagefromurldestinationacfail2345961cf4f98", "2516cf30-6bcc-4f67-abef-38c60b939a2c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[3].json new file mode 100644 index 000000000000..294f7709d9d1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[3].json @@ -0,0 +1,201 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0798174f4916b111?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE049AA3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fad9f-301e-0094-79fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "87156669-6040-475a-abcc-eaeba0de67bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0798174f4916b111/javablobuploadpagefromurldestinationacfail1085717c8ae96", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE0A10CD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fadb4-301e-0094-0afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "07da017c-28fa-4be0-aa55-06868717ced5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0798174f4916b111?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE0F362A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fadc0-301e-0094-13fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "fb797602-81fc-4a83-9689-985c71a70780" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0798174f4916b111/javablobuploadpagefromurldestinationacfail252805be5d54b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE144C75\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fadcc-301e-0094-1efc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:41 GMT", + "x-ms-client-request-id" : "f1f90afa-88f2-42fb-919c-1bcaee80a073" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0798174f4916b111/javablobuploadpagefromurldestinationacfail252805be5d54b?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "oPASs/pS4Dw=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "ETag" : "\"0x8D72813CE19CC0E\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fade1-301e-0094-30fc-5950b8000000", + "x-ms-client-request-id" : "475484d9-06c3-4b1e-a85f-23c17f126e35" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0798174f4916b111/javablobuploadpagefromurldestinationacfail1085717c8ae96", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813CE0A10CD\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:42 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fadf0-301e-0094-3efc-5950b8000000", + "x-ms-client-request-id" : "03e5e90d-3792-401d-8057-978c8d55783e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0798174f4916b111/javablobuploadpagefromurldestinationacfail1085717c8ae96?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "f77fadff-301e-0094-4cfc-5950b8000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:f77fadff-301e-0094-4cfc-5950b8000000\nTime:2019-08-23T21:49:42.4224349Z", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "e7bddd19-e9d2-4c98-98e8-9f7934195f64", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fae13-301e-0094-5dfc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail0798174f4916b111Fri, 23 Aug 2019 21:49:42 GMT\"0x8D72813CE0F362A\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "418e1ceb-e765-4fe7-bd8d-93ce3211ecfc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0798174f4916b111?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fae1c-301e-0094-65fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "9f743940-3f8f-4589-90c1-dbf289326ce2" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail0798174f4916b111", "javablobuploadpagefromurldestinationacfail1085717c8ae96", "javablobuploadpagefromurldestinationacfail252805be5d54b", "b0de8bf8-8554-4469-a5e0-950eea2bdcd5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[4].json new file mode 100644 index 000000000000..0ca81db11878 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[4].json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail071049ff876f409b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE348F83\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fae3d-301e-0094-7ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "8b1b3a53-8a85-4fbb-b409-dab51900c13c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail071049ff876f409b/javablobuploadpagefromurldestinationacfail119305e15c580", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE39DF18\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fae5a-301e-0094-13fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "0169f40a-a0f7-467a-b2cd-5f768d29ce84" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail071049ff876f409b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE406415\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fae6f-301e-0094-22fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "6ef83c4b-45a4-44e5-a49d-d06cd9a6586c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail071049ff876f409b/javablobuploadpagefromurldestinationacfail238475b7e65ed", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE45A1C5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fae82-301e-0094-30fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "6e7a3d52-22fc-4517-b921-3e05b56713f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail071049ff876f409b/javablobuploadpagefromurldestinationacfail238475b7e65ed?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "JMWH642KuVM=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "ETag" : "\"0x8D72813CE4B215E\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fae96-301e-0094-41fc-5950b8000000", + "x-ms-client-request-id" : "d0b07790-0926-4d42-822f-fc3c2f838077" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail071049ff876f409b/javablobuploadpagefromurldestinationacfail119305e15c580?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseNotPresentWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "242", + "StatusCode" : "412", + "x-ms-request-id" : "f77faea4-301e-0094-4afc-5950b8000000", + "Body" : "\nLeaseNotPresentWithBlobOperationThere is currently no lease on the blob.\nRequestId:f77faea4-301e-0094-4afc-5950b8000000\nTime:2019-08-23T21:49:42.7167049Z", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "fedb3ec3-02f6-44b1-b0ac-fe731e1a0ccc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77faeb7-301e-0094-59fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail071049ff876f409bFri, 23 Aug 2019 21:49:42 GMT\"0x8D72813CE406415\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "fc688371-ed77-496a-8afd-cbd6702f159b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail071049ff876f409b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77faecc-301e-0094-68fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "821a4c4f-d498-4c47-95e1-c97862be465f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail071049ff876f409b", "javablobuploadpagefromurldestinationacfail119305e15c580", "javablobuploadpagefromurldestinationacfail238475b7e65ed", "e8322e73-d6af-4182-9eb1-6a7d2dcb0c98" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[5].json new file mode 100644 index 000000000000..f871de4a9dc1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[5].json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail088847cc392c2fe2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE603D9D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77faee3-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "6e89a6c0-87a4-492c-b9ac-a210863f7dd1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail088847cc392c2fe2/javablobuploadpagefromurldestinationacfail1211889e2d58c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE65DBE1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77faef6-301e-0094-09fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "82958215-2f4a-4462-96bb-e5d016316b48" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail088847cc392c2fe2?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE6AB28C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77faf02-301e-0094-12fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "7525c6b6-1077-44b2-9d91-0bae66c8db67" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail088847cc392c2fe2/javablobuploadpagefromurldestinationacfail2225959affcc4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE6F7B2C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77faf0e-301e-0094-1dfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "2d5a7b89-8004-4841-9894-e7067e6268ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail088847cc392c2fe2/javablobuploadpagefromurldestinationacfail2225959affcc4?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "k16hvceuPis=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "ETag" : "\"0x8D72813CE74D3AE\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77faf1b-301e-0094-2afc-5950b8000000", + "x-ms-client-request-id" : "5719135a-4ab5-4604-9f27-6371f73d7451" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail088847cc392c2fe2/javablobuploadpagefromurldestinationacfail1211889e2d58c?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "335", + "StatusCode" : "400", + "x-ms-request-id" : "f77faf24-301e-0094-33fc-5950b8000000", + "Body" : "\nInvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:f77faf24-301e-0094-33fc-5950b8000000\nTime:2019-08-23T21:49:42.9789443Zx-ms-if-sequence-number-lt-1", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "ecdc4845-ef23-4d6e-a84c-45deed94088a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77faf2b-301e-0094-39fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail088847cc392c2fe2Fri, 23 Aug 2019 21:49:42 GMT\"0x8D72813CE6AB28C\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "d18b58f6-8b25-4be9-80a6-d4a39ff04d2b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail088847cc392c2fe2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77faf42-301e-0094-4bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "b2a57935-0185-4b1c-8d04-37799fae470a" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail088847cc392c2fe2", "javablobuploadpagefromurldestinationacfail1211889e2d58c", "javablobuploadpagefromurldestinationacfail2225959affcc4", "be021f8a-cf83-4f21-8afe-dad267a715cc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[6].json new file mode 100644 index 000000000000..8acb96a5a766 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[6].json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039844d12fc1f768?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE87F329\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77faf5d-301e-0094-61fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "89111f03-37ee-41c3-8b14-dfea61faa509" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039844d12fc1f768/javablobuploadpagefromurldestinationacfail1465633beb8ab", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE8D43BC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77faf7c-301e-0094-78fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "035da48c-bff4-4849-bf11-ab8bfc03db7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039844d12fc1f768?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE921A28\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77faf8f-301e-0094-0afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "8122e338-4a85-4d47-b8c0-ae463286964c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039844d12fc1f768/javablobuploadpagefromurldestinationacfail288063ac0f926", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CE96E2F9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fafa7-301e-0094-1bfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "b2a4d8e9-c784-4cae-bb0c-a19212151e5d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039844d12fc1f768/javablobuploadpagefromurldestinationacfail288063ac0f926?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "f90Mvv41jqo=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "ETag" : "\"0x8D72813CE9C6293\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fafbf-301e-0094-31fc-5950b8000000", + "x-ms-client-request-id" : "b8738f82-b761-4636-b8f5-5bb8cbc6ffa0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039844d12fc1f768/javablobuploadpagefromurldestinationacfail1465633beb8ab?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "335", + "StatusCode" : "400", + "x-ms-request-id" : "f77fafd1-301e-0094-43fc-5950b8000000", + "Body" : "\nInvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:f77fafd1-301e-0094-43fc-5950b8000000\nTime:2019-08-23T21:49:43.2361803Zx-ms-if-sequence-number-le-1", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "66fe4038-6169-4a39-8eab-1fd8b51c3c74", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fafdb-301e-0094-4dfc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail039844d12fc1f768Fri, 23 Aug 2019 21:49:43 GMT\"0x8D72813CE921A28\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "a28e4415-ad34-4e2c-aaf4-f76630937284", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039844d12fc1f768?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77faff1-301e-0094-5cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:42 GMT", + "x-ms-client-request-id" : "9818123d-9e7e-471d-a0a6-59bb3862aea8" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail039844d12fc1f768", "javablobuploadpagefromurldestinationacfail1465633beb8ab", "javablobuploadpagefromurldestinationacfail288063ac0f926", "c1af582c-e153-42da-a49f-65c9e0de78ba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[7].json new file mode 100644 index 000000000000..105197120b8b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[7].json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail09879499ed94ad04?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CEAFCFC8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb007-301e-0094-72fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "31457eb5-ce83-4687-bc7b-1dc0198570e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail09879499ed94ad04/javablobuploadpagefromurldestinationacfail101824ff3bdab", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CEB5E444\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb01b-301e-0094-80fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "5444ae38-9bc7-4260-9432-177be24b71b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail09879499ed94ad04?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CEBA9379\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fb02b-301e-0094-0dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "844cb1ca-fcbe-40e4-98cb-c4fd1e52df61" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail09879499ed94ad04/javablobuploadpagefromurldestinationacfail24358020438b8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CEBF8393\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb03d-301e-0094-1bfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "cd1562be-d700-4a2a-9eb9-ea7620258821" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail09879499ed94ad04/javablobuploadpagefromurldestinationacfail24358020438b8?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "id4ARGUzCpk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "ETag" : "\"0x8D72813CEC4B4FA\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb048-301e-0094-26fc-5950b8000000", + "x-ms-client-request-id" : "e6f75f17-9c3e-47b2-a868-9db8c850cc80" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail09879499ed94ad04/javablobuploadpagefromurldestinationacfail101824ff3bdab?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SequenceNumberConditionNotMet", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "f77fb066-301e-0094-3ffc-5950b8000000", + "Body" : "\nSequenceNumberConditionNotMetThe sequence number condition specified was not met.\nRequestId:f77fb066-301e-0094-3ffc-5950b8000000\nTime:2019-08-23T21:49:43.5704861Z", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "2b9010c1-3be3-4a6a-a5cf-ac26aa4c8eb9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb08a-301e-0094-60fc-5950b8000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail09879499ed94ad04Fri, 23 Aug 2019 21:49:43 GMT\"0x8D72813CEBA9379\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "50793016-3daf-470a-a2fb-b962839f5eb8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurldestinationacfail09879499ed94ad04?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb097-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "4636404a-9426-4dad-a0a7-5fd0b04a23cd" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail09879499ed94ad04", "javablobuploadpagefromurldestinationacfail101824ff3bdab", "javablobuploadpagefromurldestinationacfail24358020438b8", "a52d8485-7fa2-4705-a3d3-f2231b8cefbc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlia.json new file mode 100644 index 000000000000..e7e2acbee92e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlia.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlia0661572a8387b4b7294383b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB34CC8E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa38e-301e-0094-7efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "41f0a607-7537-4524-9008-451a9da97436" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlia0661572a8387b4b7294383b/javablobuploadpagefromurlia155008d3cd98bb02d048c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB3A885C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa3a7-301e-0094-15fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "30e3b29a-f0d8-4fb6-8eee-484cbf5e683a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa3b6-301e-0094-24fc-5950b8000000", + "Body" : "jtcuploadpagefromurliajtcuploadpagefromurlia0661572a8387b4b7294383bFri, 23 Aug 2019 21:49:37 GMT\"0x8D72813CB34CC8E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "ad4f5882-8387-4820-95f0-0cd4c6212bcc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlia0661572a8387b4b7294383b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa3d2-301e-0094-39fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "3490f0d8-f162-432c-be4e-1ebc2a833785" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlia0661572a8387b4b7294383b", "javablobuploadpagefromurlia155008d3cd98bb02d048c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5.json new file mode 100644 index 000000000000..3adda17ff95d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5.json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5048731732a5c2b5a0d4556a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB4EEA5E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa3f7-301e-0094-5bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "833fc934-a58b-4890-8213-6827913ab9a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5048731732a5c2b5a0d4556a/javablobuploadpagefromurlmd518392973fcdc1469414b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB53BBDA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa40d-301e-0094-6afc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "d74d5cf5-032a-4c0c-b0bc-32bc51d54cae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5048731732a5c2b5a0d4556a?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB5B7EC4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa41f-301e-0094-7cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "1c678e2b-b36f-49f3-bbe3-22f14e4ea455" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5048731732a5c2b5a0d4556a/javablobuploadpagefromurlmd5285042cf97b89c331c46", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB604212\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa432-301e-0094-09fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "8599d4de-1db2-491f-96ff-da9defdf3686" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5048731732a5c2b5a0d4556a/javablobuploadpagefromurlmd518392973fcdc1469414b?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "9fp99wAuX7g=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "ETag" : "\"0x8D72813CB65E8C3\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa441-301e-0094-17fc-5950b8000000", + "x-ms-client-request-id" : "e5961689-1d57-45fa-9e08-d852a91e57f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5048731732a5c2b5a0d4556a/javablobuploadpagefromurlmd5285042cf97b89c331c46?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "Content-MD5" : "QQW2oSlujuDWcnK9tCu26Q==", + "ETag" : "\"0x8D72813CB72961B\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa45d-301e-0094-2efc-5950b8000000", + "x-ms-client-request-id" : "627400ef-2096-4c17-adad-6f7f4fed83d5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlmd5&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa475-301e-0094-43fc-5950b8000000", + "Body" : "jtcuploadpagefromurlmd5jtcuploadpagefromurlmd5048731732a5c2b5a0d4556aFri, 23 Aug 2019 21:49:37 GMT\"0x8D72813CB5B7EC4\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "7d7aabe0-8b08-4d3d-9bc7-6e4dda7422b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5048731732a5c2b5a0d4556a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa488-301e-0094-54fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "39820e80-5555-4762-ab8d-da7058250140" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlmd5048731732a5c2b5a0d4556a", "javablobuploadpagefromurlmd518392973fcdc1469414b", "javablobuploadpagefromurlmd5285042cf97b89c331c46", "827fdeae-f0c6-4d80-a686-730ffaf53e01" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5fail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5fail.json new file mode 100644 index 000000000000..50eb54aac0bc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5fail.json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail07879078104ec7f2e84f7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB80B46B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa49f-301e-0094-67fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "bd4857b2-9501-4b71-812c-6abcd14abfab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail07879078104ec7f2e84f7/javablobuploadpagefromurlmd5fail173688ee87512365f1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB85D4AC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa4ae-301e-0094-75fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "889f6b27-ad66-4748-906d-999be8d47f0b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail07879078104ec7f2e84f7?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB8A6230\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa4bf-301e-0094-02fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "620f58ac-fd18-4fd9-b29d-f07c9760f47f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail07879078104ec7f2e84f7/javablobuploadpagefromurlmd5fail28150913c6802161d3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB91BE79\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa4df-301e-0094-20fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "dfb056ed-9d13-4ba5-ba93-2060a190170f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail07879078104ec7f2e84f7/javablobuploadpagefromurlmd5fail173688ee87512365f1?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "HE6jJbSz6Rw=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "ETag" : "\"0x8D72813CB967A90\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa4f2-301e-0094-32fc-5950b8000000", + "x-ms-client-request-id" : "943e2e4d-bdc5-49b8-bbd1-a5ffdf25c0b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail07879078104ec7f2e84f7/javablobuploadpagefromurlmd5fail28150913c6802161d3?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "Md5Mismatch", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "f77fa4ff-301e-0094-3dfc-5950b8000000", + "Body" : "\nMd5MismatchThe MD5 value specified in the request did not match with the MD5 value calculated by the server.\nRequestId:f77fa4ff-301e-0094-3dfc-5950b8000000\nTime:2019-08-23T21:49:38.1715474Z", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "f87462a6-4c0b-4883-84c6-9d8c44b2b166", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlmd5fail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa510-301e-0094-4dfc-5950b8000000", + "Body" : "jtcuploadpagefromurlmd5failjtcuploadpagefromurlmd5fail07879078104ec7f2e84f7Fri, 23 Aug 2019 21:49:38 GMT\"0x8D72813CB8A6230\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "dc950782-7f3a-4a97-bb63-281f40d76755", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmd5fail07879078104ec7f2e84f7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa51d-301e-0094-58fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "7dc935a8-107f-4f5d-b9d1-b050379cc292" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlmd5fail07879078104ec7f2e84f7", "javablobuploadpagefromurlmd5fail173688ee87512365f1", "javablobuploadpagefromurlmd5fail28150913c6802161d3", "7ba0ab91-cebf-4d36-97ba-577dd8a1387c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmin.json new file mode 100644 index 000000000000..4abdaabdc974 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmin.json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin05414347c0dcd8b5bb4682b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CA8B6C8E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa170-301e-0094-2ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "c2a425fa-0fed-43fc-a8d5-49a3eca7c900" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin05414347c0dcd8b5bb4682b/javablobuploadpagefromurlmin123461a2c5ef7ddb8845", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CA903BE0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa17e-301e-0094-3cfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "27375374-ec44-48fa-823d-671b32b88b55" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin05414347c0dcd8b5bb4682b?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CA94CAF7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa185-301e-0094-43fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "40810243-788d-4533-b768-a56de78bfa46" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin05414347c0dcd8b5bb4682b/javablobuploadpagefromurlmin2298870f6e471bd4c04f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CA99B413\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa197-301e-0094-53fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "405b86d1-da0a-4028-a480-383801a1d70f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin05414347c0dcd8b5bb4682b/javablobuploadpagefromurlmin2298870f6e471bd4c04f?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "zS1HXoguS/g=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "ETag" : "\"0x8D72813CA9EBE5E\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa1a5-301e-0094-60fc-5950b8000000", + "x-ms-client-request-id" : "72258b40-b552-4377-a025-927e52b07f3d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin05414347c0dcd8b5bb4682b/javablobuploadpagefromurlmin123461a2c5ef7ddb8845?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "Content-MD5" : "kLc+qkShw1p54TUNAsyB5g==", + "ETag" : "\"0x8D72813CAD9168D\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa1b2-301e-0094-68fc-5950b8000000", + "x-ms-client-request-id" : "55b6bb31-41cb-425e-b7d8-2cf0d7a7932c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa265-301e-0094-02fc-5950b8000000", + "Body" : "jtcuploadpagefromurlminjtcuploadpagefromurlmin05414347c0dcd8b5bb4682bFri, 23 Aug 2019 21:49:36 GMT\"0x8D72813CA94CAF7\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "7378c6af-1b44-461e-bd92-da0fa8fdef97", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlmin05414347c0dcd8b5bb4682b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa274-301e-0094-0dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "9207852e-f977-484c-861b-9abc58effc2f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlmin05414347c0dcd8b5bb4682b", "javablobuploadpagefromurlmin123461a2c5ef7ddb8845", "javablobuploadpagefromurlmin2298870f6e471bd4c04f", "dc5d6d9a-5818-4380-b8f2-d00f21d212ba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlrange.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlrange.json new file mode 100644 index 000000000000..f6dc1fff5367 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlrange.json @@ -0,0 +1,223 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange0524383eff7910a9e74757?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CAF34764\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa289-301e-0094-1ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "9676beac-3131-46cf-b307-c26ee9a2408a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange0524383eff7910a9e74757/javablobuploadpagefromurlrange102713a1f06cd366bc4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CAF8DB5F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa2b4-301e-0094-42fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "aa4bc6f2-b3cb-4f1b-bbcd-8f9ed6168738" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange0524383eff7910a9e74757?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB01897A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fa2d8-301e-0094-61fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "57642ef0-f0a4-440f-9c8f-6505612adbae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange0524383eff7910a9e74757/javablobuploadpagefromurlrange228561e60453311fac4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB067344\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa2eb-301e-0094-72fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "1e5858d2-1efd-4db2-902e-64bbeedb61d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange0524383eff7910a9e74757/javablobuploadpagefromurlrange228561e60453311fac4?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "qjOn9fxQLWk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "ETag" : "\"0x8D72813CB0BF2E7\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa2fe-301e-0094-04fc-5950b8000000", + "x-ms-client-request-id" : "ee21543b-cebb-4d90-a4b8-108845fc8130" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange0524383eff7910a9e74757/javablobuploadpagefromurlrange341254165d6753de7c4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CB11998E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fa30c-301e-0094-10fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:36 GMT", + "x-ms-client-request-id" : "efda67bf-665d-4a0f-a8fc-a8f37a0ae844" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange0524383eff7910a9e74757/javablobuploadpagefromurlrange341254165d6753de7c4?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "Content-MD5" : "IEtussILsMXOXaRTB5/zqg==", + "ETag" : "\"0x8D72813CB1F58A1\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fa319-301e-0094-1dfc-5950b8000000", + "x-ms-client-request-id" : "be35653c-1a0c-4924-b05d-9dc3706d0702" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange0524383eff7910a9e74757/javablobuploadpagefromurlrange341254165d6753de7c4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72813CB1F58A1\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:37 GMT", + "Content-Length" : "1024", + "x-ms-request-id" : "f77fa351-301e-0094-49fc-5950b8000000", + "Body" : "[-25, 119, 44, 28, -34, 106, 116, -86, -76, -4, 13, -26, -76, 49, -125, -123, 59, 26, -20, -2, -91, -97, -73, 122, -45, -122, -118, -120, 93, 14, 74, -106, -103, -37, 35, 108, 72, -70, 88, -114, 91, -1, -90, -60, 89, -57, 78, -106, 65, 22, -47, 127, 10, 50, 97, 109, -99, 110, 73, -103, -63, 96, 35, -71, -107, -35, -47, 87, 66, 23, -15, -15, 119, 34, -105, 19, -32, 124, -111, 24, -3, 69, 71, 20, 115, -121, -34, -68, -44, 18, -109, -109, 113, -64, 9, 92, 14, -57, -7, -83, -102, -50, -49, 95, 120, -118, -97, -60, 13, -58, 40, -110, -23, 27, -97, 13, -57, -55, -59, -95, -3, 23, 107, 89, -34, 84, -45, -68, -31, 69, -13, -110, -17, 94, 81, 36, 24, 11, -51, -68, -104, -50, 82, -86, 96, -107, -116, 5, 0, 30, 8, 88, 32, 2, -106, -58, -86, 8, -10, 62, 10, -35, 108, -59, 52, 95, 121, -5, -47, 75, -99, -48, -80, 4, 74, -118, 34, 51, -48, 108, -87, 114, 38, -62, 76, 33, -100, -3, 42, 60, 65, -36, 45, -27, -37, 1, 49, -75, 21, 126, 98, -4, -13, 28, 115, 115, -41, 112, -44, -127, -42, 75, 103, -98, -63, -105, 17, -114, -115, -44, -21, 71, 43, 79, 14, 29, -68, -10, 2, 28, -94, 114, 78, 25, -46, -32, 118, -19, -27, 50, 126, 50, -112, 103, 109, -50, -97, -47, 4, 54, -103, -110, 42, -49, 92, 7, 25, -54, 0, -98, -106, -6, -91, 123, 92, 64, 1, -56, 67, 7, 96, -38, 11, -61, 4, 67, 6, 69, -127, 110, 63, -8, -56, 127, 90, -30, 99, -92, -37, 104, 89, 58, 49, -118, -122, 90, 24, 21, 37, -85, -42, -31, -30, -77, -52, -74, 97, 68, 15, 104, 94, -3, -34, -47, 116, -32, -94, -15, -72, -123, -122, -19, 43, -87, -22, 76, 7, 35, 81, -75, -28, 37, 32, -59, 15, -29, -10, 94, -120, -102, 121, 31, -23, -110, -125, 26, 63, -42, 93, -113, 127, -6, 113, -108, 102, 52, 46, -44, -14, 72, -103, 61, 30, 8, -123, -118, -122, 4, 31, 51, 92, 94, -52, -125, 107, -15, -46, -48, -85, 72, -104, 2, -83, -66, -106, 66, -117, -111, 59, -41, -91, 102, -56, 93, 86, -109, 93, -41, -46, 123, -59, -71, 83, -47, -97, -36, 93, -77, -10, -10, -92, 103, -105, -87, 126, -66, 19, 118, -106, 69, -90, -103, 118, -8, 121, -3, -43, -87, 118, 39, -42, -54, -57, 0, 14, -119, 33, -17, 77, 58, 26, -1, 125, -110, 80, 44, 106, -116, -87, -58, -93, 55, -42, -95, 50, 14, -116, -16, 39, -111, -112, -89, 120, -73, -22, -91, -18, -51, -109, -100, -15, -4, -15, 71, 72, 110, -18, 126, -15, -112, 64, -10, 113, -42, -122, -65, 44, 33, -94, -69, -24, -83, -32, -33, -86, 19, 85, 111, 2, 113, -52, -48, 126, -112, 47, -87, -118, -66, 79, -76, 4, -65, 97, -111, 40, -41, 71, 98, -107, -46, -92, 104, 26, -85, -114, 46, 2, -77, 21, 116, -82, -29, -76, -64, -94, 114, 14, 16, -82, 35, -121, -96, -37, -126, -70, 31, 1, 62, -5, 63, 23, 83, 61, 107, 110, -45, 54, 18, 122, 120, -102, -44, -21, 105, -55, 120, -78, 42, -54, 43, -79, 58, 91, 75, 113, -76, -98, -28, -75, 19, 91, 75, -14, -103, 91, -107, 55, -1, 107, 68, 36, 110, 56, 3, 18, -42, -99, -69, -18, -47, 37, 42, -11, -71, -57, 50, 11, -110, -125, 47, -40, -28, 115, -6, 14, 95, -78, 27, -10, 93, 48, -92, -47, -121, -89, -100, 113, 91, 85, 48, -11, 115, -28, -125, 53, 15, 121, 93, 118, 42, -126, 60, 112, -22, 33, -35, -61, 0, 57, -86, -81, -114, 125, -16, -3, 8, -124, -48, 65, -85, 44, -31, -72, 1, 79, -39, -4, -78, 83, 61, -28, 41, -38, -92, -120, -123, -103, -125, 71, 27, -86, -120, -123, -18, -64, 82, -120, -123, -50, 89, -94, -67, -18, 9, -100, -62, -75, -34, 40, -34, -20, 97, -111, -81, 108, 95, -121, -119, -29, -76, 8, -99, 6, -49, 58, -63, 89, -71, 2, 28, 105, 7, -76, 94, 125, 54, -123, 72, -26, 88, 79, -114, 16, -5, -97, -83, 64, 81, 118, -85, 91, -11, 102, -112, 15, -86, -100, -37, 28, 2, -94, -41, -98, -44, 9, -42, 80, -79, 9, -19, -73, 41, 22, -50, 60, 43, -48, 87, 0, 110, -99, 78, 49, 93, -123, -88, -51, -81, -2, -61, -45, -12, 24, 31, -103, -111, -12, -60, -17, 65, 7, -57, -126, 108, -48, 6, 35, 42, 0, 81, 120, 104, 16, -47, -25, -66, 49, -36, 10, 68, 61, -47, -70, 13, -24, -76, -22, 27, 107, -90, 120, 59, 71, -39, -93, -94, -14, -72, 43, 55, -98, -102, 28, -13, 17, 109, -42, 29, 26, -1, -42, 12, -8, -84, 1, 24, -20, 20, 5, 39, -111, 49, 29, -37, 4, -12, -4, -17, 47, 89, -15, 91, 118, -60, -126, -112, 110, -66, -87, 116, -54, 86, 3, 119, -10, -63, 78, -104, 53, -22, -62, -108, 30, 62, -92, -10, 112, 100, 114, 103, 82, 56, -63, -2, -123, 126, -29, -13, 48, -3, -33, -53, 44, -98, -87, 74, -24, -117, 56, 7, 115, -17, -35, 93, 41, -80, -27, -6, -116, 22, 109, 103, 32, 76, 30, 69, -65, 121, -97, -15, 81, 9, 77, -96, -123, -57, -92, 79, -12, 113, -51, -37, 119, -53, 119, 10, 20, 95, 80, 58, -9, 62, 92, 6, -31, 103, 64, 70, -26, 119, -74, -1, 69, 117, -102, -103, 38, 18, 17, 2, -57, -47, 13, 102, -86, 98, -109, -70, -94, -31, 100, -117, -126, -5, 47, -113, 81, -13, -111, 13, -14, -123, 79, 70, -118, -41, -62, -112, 81, -74, -43, 86, 19, 37, 108, 121, 98, -91, -102, -66, 120, -89, 57, 55, -77, -102, -37, 13, 30, 119, 47, 109, -101, -97]", + "x-ms-client-request-id" : "55f995bf-be9d-474b-98b6-588c45322868", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa362-301e-0094-58fc-5950b8000000", + "Body" : "jtcuploadpagefromurlrangejtcuploadpagefromurlrange0524383eff7910a9e74757Fri, 23 Aug 2019 21:49:37 GMT\"0x8D72813CB01897A\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "a64369ff-717d-47c2-ac2c-3993130b2e13", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlrange0524383eff7910a9e74757?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fa370-301e-0094-66fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:37 GMT", + "x-ms-client-request-id" : "47b8b16a-731f-4c15-ba5d-fdd86cd6a3c9" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlrange0524383eff7910a9e74757", "javablobuploadpagefromurlrange102713a1f06cd366bc4", "cfdbbc47-52b1-4092-9bd4-9566ded51940", "javablobuploadpagefromurlrange228561e60453311fac4", "javablobuploadpagefromurlrange341254165d6753de7c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[0].json new file mode 100644 index 000000000000..5addf679f294 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[0].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac083471eeab320b7b384d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CEE2F9BA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb0b4-301e-0094-03fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "13862b6e-90dd-4f33-928d-3d32034d6690" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac083471eeab320b7b384d/javablobuploadpagefromurlsourceac139957eb6e9c191990", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CEE87261\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb0c7-301e-0094-12fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "087e515c-84a2-4fbe-b3bb-579a30729109" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac083471eeab320b7b384d?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CEED6F7C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fb0d4-301e-0094-1efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "4e05dade-2669-4d7e-91a7-0adac267a889" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac083471eeab320b7b384d/javablobuploadpagefromurlsourceac29016432b211303656", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CEF7DF8F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb0e8-301e-0094-30fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "1c2da2bd-eb6e-45e9-8b2b-f67cb9e917a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac083471eeab320b7b384d/javablobuploadpagefromurlsourceac29016432b211303656?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "SGD0PwUaDv8=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "ETag" : "\"0x8D72813CEFD10DF\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb0fd-301e-0094-41fc-5950b8000000", + "x-ms-client-request-id" : "44b2a104-84db-4730-8598-4496cf33c657" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac083471eeab320b7b384d/javablobuploadpagefromurlsourceac139957eb6e9c191990?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "Content-MD5" : "Emj0Ay9RS0AB9ZQdbBAN6w==", + "ETag" : "\"0x8D72813CF072578\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb11b-301e-0094-5bfc-5950b8000000", + "x-ms-client-request-id" : "1aa7a4f4-6e49-41f4-9fcd-484c2df16818" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb12c-301e-0094-68fc-5950b8000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac083471eeab320b7b384dFri, 23 Aug 2019 21:49:43 GMT\"0x8D72813CEED6F7C\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "7d4167a4-86fe-4023-8b4b-99f1a73411fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac083471eeab320b7b384d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb144-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "92f516fb-4d0b-4383-9ac0-4c8a22bc161e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac083471eeab320b7b384d", "javablobuploadpagefromurlsourceac139957eb6e9c191990", "javablobuploadpagefromurlsourceac29016432b211303656", "e18ce199-c555-4bb8-9f57-2c1c4b26c892" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[1].json new file mode 100644 index 000000000000..c1bfc096eb8c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[1].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac04136697e7dd5587834e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF1698F0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb158-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "b1109a96-b3d7-48e8-a628-13e8458d05a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac04136697e7dd5587834e/javablobuploadpagefromurlsourceac1245123b0e4fd6591c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF1BC400\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb16a-301e-0094-19fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "b6c37b11-8208-4884-a49c-466bf3d0b501" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac04136697e7dd5587834e?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF20728E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fb186-301e-0094-2dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "c1f59ff2-22f4-4469-947c-52cecf27fe5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac04136697e7dd5587834e/javablobuploadpagefromurlsourceac2250177bf28b557742", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF340CF2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb1d5-301e-0094-69fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "56e134cb-4ec1-46df-bc5a-8eb0e323776e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac04136697e7dd5587834e/javablobuploadpagefromurlsourceac2250177bf28b557742?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "3bR+q9gz/ko=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "ETag" : "\"0x8D72813CF391733\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb1ec-301e-0094-7ffc-5950b8000000", + "x-ms-client-request-id" : "944ff987-4094-4de9-8849-12ab6033f64e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac04136697e7dd5587834e/javablobuploadpagefromurlsourceac1245123b0e4fd6591c?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "Content-MD5" : "nqAjnSAgrepnXxGBs96ktg==", + "ETag" : "\"0x8D72813CF3F332A\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb1f7-301e-0094-08fc-5950b8000000", + "x-ms-client-request-id" : "1f002f89-03ff-474d-bce3-609b8e90a72e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb21f-301e-0094-28fc-5950b8000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac04136697e7dd5587834eFri, 23 Aug 2019 21:49:44 GMT\"0x8D72813CF20728E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:43 GMT", + "x-ms-client-request-id" : "2c66412a-8bf4-4882-99b2-b1eae5c7c920", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac04136697e7dd5587834e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb234-301e-0094-3afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "ca472aee-ebe6-4448-a1c7-27f5ec1f1537" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac04136697e7dd5587834e", "javablobuploadpagefromurlsourceac1245123b0e4fd6591c", "javablobuploadpagefromurlsourceac2250177bf28b557742", "3000a41e-28c2-44a0-8053-07384735d758" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[2].json new file mode 100644 index 000000000000..a3dac778b6f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[2].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac003536cfeff723966249?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF50C967\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb257-301e-0094-58fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "90f70ece-f093-42c8-b1f5-cd4dee01f361" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac003536cfeff723966249/javablobuploadpagefromurlsourceac14764426193015a8cc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF566A62\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb270-301e-0094-70fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "11e92ae8-9a13-487e-95e6-8be8aa61baa9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac003536cfeff723966249?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF5C032B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fb287-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "4e4060db-0bf6-41b7-9d38-fa0337edc153" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac003536cfeff723966249/javablobuploadpagefromurlsourceac262376a24d90292b1c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF61699A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb2a5-301e-0094-1ffc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "d8ad0a38-c728-48a9-9fc8-d5846338a48d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac003536cfeff723966249/javablobuploadpagefromurlsourceac262376a24d90292b1c?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "wV0UJIXttYo=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "ETag" : "\"0x8D72813CF6673E0\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb2b7-301e-0094-2ffc-5950b8000000", + "x-ms-client-request-id" : "46b25b3a-57e1-4ca1-85b6-d0307347bcbf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac003536cfeff723966249/javablobuploadpagefromurlsourceac14764426193015a8cc?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "Content-MD5" : "jnO6CRpRT7JfGgkYKSEoIw==", + "ETag" : "\"0x8D72813CF6C8FE0\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb2dd-301e-0094-50fc-5950b8000000", + "x-ms-client-request-id" : "a4cdf2a5-c0f1-4e59-aa70-153e0b829e20" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb30d-301e-0094-79fc-5950b8000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac003536cfeff723966249Fri, 23 Aug 2019 21:49:44 GMT\"0x8D72813CF5C032B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "8a2b90e9-8955-480d-b1da-ce9901e5f59f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac003536cfeff723966249?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb322-301e-0094-0efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "a197dd46-86e8-4e9a-a6e0-077b0d49e927" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac003536cfeff723966249", "javablobuploadpagefromurlsourceac14764426193015a8cc", "javablobuploadpagefromurlsourceac262376a24d90292b1c", "cec38362-b5da-4ab8-9752-d244df5e331d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[3].json new file mode 100644 index 000000000000..966b3f351c80 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[3].json @@ -0,0 +1,203 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0434832855f50d2de647?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF80E554\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb33e-301e-0094-28fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "b25134f0-64be-45c1-b30d-b8dac3f900cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0434832855f50d2de647/javablobuploadpagefromurlsourceac134704b44a3d7e11a0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF90E9B2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb37e-301e-0094-61fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "257c232a-28dc-4902-af83-bea949683622" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0434832855f50d2de647?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF95706E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fb391-301e-0094-74fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "1ae35c3f-06df-4f41-a792-711a62c8bf19" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0434832855f50d2de647/javablobuploadpagefromurlsourceac240695b96c16e7d037", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CF9A88FD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb39f-301e-0094-80fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "b0ef0263-64fd-48ec-af1f-e1656379d8c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0434832855f50d2de647/javablobuploadpagefromurlsourceac240695b96c16e7d037?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Kg9joD4Js5s=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "ETag" : "\"0x8D72813CF9FBA63\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb3b5-301e-0094-0efc-5950b8000000", + "x-ms-client-request-id" : "1861943b-1e6f-49da-b3b4-b9a7abab80d7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0434832855f50d2de647/javablobuploadpagefromurlsourceac240695b96c16e7d037", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:44 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813CF9FBA63\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:44 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fb3cc-301e-0094-24fc-5950b8000000", + "x-ms-client-request-id" : "7d1fff92-86ae-41d8-b4d3-ddf0710a352a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0434832855f50d2de647/javablobuploadpagefromurlsourceac134704b44a3d7e11a0?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "Content-MD5" : "QNqyuNU2+OuRtLvXCZS2OA==", + "ETag" : "\"0x8D72813CFAE8B15\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb3d9-301e-0094-2ffc-5950b8000000", + "x-ms-client-request-id" : "7b48dc0d-f104-48a9-b13c-a131113c33fb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb3e7-301e-0094-3dfc-5950b8000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac0434832855f50d2de647Fri, 23 Aug 2019 21:49:44 GMT\"0x8D72813CF95706E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "99d7e4f9-39e6-4a10-838d-2fc956999d4e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac0434832855f50d2de647?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb3ff-301e-0094-4bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "e441877c-76e9-48db-adc1-6338c43a4370" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac0434832855f50d2de647", "javablobuploadpagefromurlsourceac134704b44a3d7e11a0", "javablobuploadpagefromurlsourceac240695b96c16e7d037", "8a2bfde4-78c7-42ee-9438-896bb34cda9e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[4].json new file mode 100644 index 000000000000..7da8544c1de1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[4].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac090935433cc4dc245c49?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CFBD8754\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb41f-301e-0094-64fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "292253a3-4bac-4f56-8866-b7b24f58f147" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac090935433cc4dc245c49/javablobuploadpagefromurlsourceac1363286dae7c35963d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CFC30280\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb436-301e-0094-77fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "537a460c-d442-4c9d-a754-59f68e14b71e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac090935433cc4dc245c49?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CFC7D716\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fb446-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "d2b076d1-9cf4-4862-ad2c-7702edcad103" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac090935433cc4dc245c49/javablobuploadpagefromurlsourceac28323298679a7c7a63", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CFCCF002\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb450-301e-0094-0dfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "4177b900-f90c-4c5e-9c56-db46f1dda79c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac090935433cc4dc245c49/javablobuploadpagefromurlsourceac28323298679a7c7a63?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "TWjRpgxn1xI=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "ETag" : "\"0x8D72813CFD1FA4D\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb45e-301e-0094-18fc-5950b8000000", + "x-ms-client-request-id" : "3e853303-c186-4b94-b482-ba0ee882e50e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac090935433cc4dc245c49/javablobuploadpagefromurlsourceac1363286dae7c35963d?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "Content-MD5" : "fbnGdLcZ+LyN94pU8sHHHQ==", + "ETag" : "\"0x8D72813CFD7EF31\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb468-301e-0094-20fc-5950b8000000", + "x-ms-client-request-id" : "79e3d415-f973-46dc-9ab8-f86ac9f071e7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceac&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb476-301e-0094-2efc-5950b8000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac090935433cc4dc245c49Fri, 23 Aug 2019 21:49:45 GMT\"0x8D72813CFC7D716\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:44 GMT", + "x-ms-client-request-id" : "64563992-ba1e-4722-bbc4-2bcb4195e2d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceac090935433cc4dc245c49?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb480-301e-0094-36fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "23ebe936-d2e1-4a40-9bbf-95997b3513d2" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac090935433cc4dc245c49", "javablobuploadpagefromurlsourceac1363286dae7c35963d", "javablobuploadpagefromurlsourceac28323298679a7c7a63", "9f741067-301a-4181-b30c-a0708b56b29d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[0].json new file mode 100644 index 000000000000..bc63e44ad4c8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[0].json @@ -0,0 +1,167 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011367ead38b78b074?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CFE6C3E1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb491-301e-0094-44fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "2a9d6720-98a2-4362-a78b-627acb20c62e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011367ead38b78b074/javablobuploadpagefromurlsourceacfail11827717a9f6b948", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CFEC669D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb4a1-301e-0094-50fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "9e60d0b6-1ca3-4f7c-a700-a4195f253972" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011367ead38b78b074?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CFF13AE8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fb4be-301e-0094-66fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "0fe155e3-be7d-4e43-940f-3785d8f1402c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011367ead38b78b074/javablobuploadpagefromurlsourceacfail238544de1f6f57ed", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813CFF62D0C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb4d0-301e-0094-75fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "1aae9396-3124-4729-b535-29a3fc89f55d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011367ead38b78b074/javablobuploadpagefromurlsourceacfail238544de1f6f57ed?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "DgjCpAE193w=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "ETag" : "\"0x8D72813CFFBACA1\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb4f1-301e-0094-0efc-5950b8000000", + "x-ms-client-request-id" : "28425b8e-167f-48af-8bad-a02c626051e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011367ead38b78b074/javablobuploadpagefromurlsourceacfail11827717a9f6b948?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "f77fb501-301e-0094-1cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "b401ec7a-31cf-4d19-8418-ea9fb21541af" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb515-301e-0094-2dfc-5950b8000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail011367ead38b78b074Fri, 23 Aug 2019 21:49:45 GMT\"0x8D72813CFF13AE8\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "34a44500-e574-4c7b-a32a-fde7f9167765", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail011367ead38b78b074?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb528-301e-0094-3cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "dd282255-fa53-44d7-b0a4-e6e37d1d25d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail011367ead38b78b074", "javablobuploadpagefromurlsourceacfail11827717a9f6b948", "javablobuploadpagefromurlsourceacfail238544de1f6f57ed", "318c7b1e-fb06-4393-8b15-582bfdb95774" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[1].json new file mode 100644 index 000000000000..276e0e0383a9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[1].json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail008119f7a09540615f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0100064\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb53d-301e-0094-4cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "b6180147-2625-49de-961a-d84668e3c584" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail008119f7a09540615f/javablobuploadpagefromurlsourceacfail113327fa809e6e28", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0155565\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb552-301e-0094-5cfc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "784df907-9344-4e40-bb40-390b3e158903" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail008119f7a09540615f?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D01A025A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fb571-301e-0094-75fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "e334c863-0cfa-4266-8ba4-c9f767720546" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail008119f7a09540615f/javablobuploadpagefromurlsourceacfail274355726974bfd9", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0286CF6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb5a2-301e-0094-1ffc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "8a290ac7-e8e6-4e04-8bc8-7c52e679b5ec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail008119f7a09540615f/javablobuploadpagefromurlsourceacfail274355726974bfd9?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "HDTtpLmaDkM=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "ETag" : "\"0x8D72813D02DC561\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb5ae-301e-0094-29fc-5950b8000000", + "x-ms-client-request-id" : "5bdd9be9-413b-4a0a-9c75-65190d06a1b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail008119f7a09540615f/javablobuploadpagefromurlsourceacfail113327fa809e6e28?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "f77fb5c4-301e-0094-39fc-5950b8000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:f77fb5c4-301e-0094-39fc-5950b8000000\nTime:2019-08-23T21:49:45.9046201Z", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "9c37eb5a-64d9-4fb3-b9e4-3899d32e4342", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb5d3-301e-0094-45fc-5950b8000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail008119f7a09540615fFri, 23 Aug 2019 21:49:45 GMT\"0x8D72813D01A025A\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "6073d38b-2bda-410a-b9cc-6a84699ef42e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail008119f7a09540615f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb5dc-301e-0094-4dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "11f99999-7c22-402f-9a97-64e03118fd8b" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail008119f7a09540615f", "javablobuploadpagefromurlsourceacfail113327fa809e6e28", "javablobuploadpagefromurlsourceacfail274355726974bfd9", "1f8bfd8b-f417-4b95-92ed-f4490aaec705" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[2].json new file mode 100644 index 000000000000..8dc430b5dc0a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[2].json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail078772ad68e850804c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0480D76\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb5ed-301e-0094-5afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "d176d10f-b00b-49b2-948d-316c7955be7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail078772ad68e850804c/javablobuploadpagefromurlsourceacfail1653426eca25a9a4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D04D3C00\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb606-301e-0094-6ffc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "0c3e0c7e-9f6e-4a41-b62f-c2096c5f9bf5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail078772ad68e850804c?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D051C17B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fb625-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "918c0667-b244-4308-85b3-5d34fe762ac7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail078772ad68e850804c/javablobuploadpagefromurlsourceacfail294663b8c474bd98", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0570262\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb63d-301e-0094-20fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "487e8018-bc47-4c99-a184-a47806767608" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail078772ad68e850804c/javablobuploadpagefromurlsourceacfail294663b8c474bd98?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "E6xqshffJRs=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "ETag" : "\"0x8D72813D05C5AE4\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb653-301e-0094-31fc-5950b8000000", + "x-ms-client-request-id" : "c0fa57b9-33d1-45ad-9a0b-987914fb3b87" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail078772ad68e850804c/javablobuploadpagefromurlsourceacfail1653426eca25a9a4?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "f77fb669-301e-0094-43fc-5950b8000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:f77fb669-301e-0094-43fc-5950b8000000\nTime:2019-08-23T21:49:46.1768696Z", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "1eb2c955-7b99-4adf-b48b-26f3ddd51107", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb677-301e-0094-51fc-5950b8000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail078772ad68e850804cFri, 23 Aug 2019 21:49:46 GMT\"0x8D72813D051C17B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "9ebf4127-7d20-412f-81ee-ae6d6f4aab5b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail078772ad68e850804c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb684-301e-0094-5afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "06c685f2-af83-40a5-a664-15bbdc67002e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail078772ad68e850804c", "javablobuploadpagefromurlsourceacfail1653426eca25a9a4", "javablobuploadpagefromurlsourceacfail294663b8c474bd98", "b97dc106-1156-4324-9071-097962704de0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[3].json new file mode 100644 index 000000000000..8eac5310c4c6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[3].json @@ -0,0 +1,198 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail05384679d5a61d5863?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0720D7A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb69c-301e-0094-71fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:45 GMT", + "x-ms-client-request-id" : "622aca2c-687b-40d3-96cd-9aaf08b2ef43" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail05384679d5a61d5863/javablobuploadpagefromurlsourceacfail129529dd53360a67", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0778AB6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb6b3-301e-0094-05fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "bcce3375-7566-423c-8f86-e58926ecf94d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail05384679d5a61d5863?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D07E8180\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f77fb6d0-301e-0094-1cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "6ba7204d-d872-49f3-8fa6-33b5e0c852a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail05384679d5a61d5863/javablobuploadpagefromurlsourceacfail2386839c36f1ab1b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813D0834D7A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77fb6de-301e-0094-27fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "8068a0fe-360e-4d9e-b3c7-c4f546958021" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail05384679d5a61d5863/javablobuploadpagefromurlsourceacfail2386839c36f1ab1b?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "y5SluIZFiGQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "ETag" : "\"0x8D72813D08857B6\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77fb6f0-301e-0094-36fc-5950b8000000", + "x-ms-client-request-id" : "e2640a7e-6dc5-4e59-b839-451feba3dadb" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail05384679d5a61d5863/javablobuploadpagefromurlsourceacfail2386839c36f1ab1b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D72813D08857B6\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:46 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "f77fb700-301e-0094-43fc-5950b8000000", + "x-ms-client-request-id" : "13f23bfe-0c4f-4923-9b5d-f5af939a5bea", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail05384679d5a61d5863/javablobuploadpagefromurlsourceacfail129529dd53360a67?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "f77fb70f-301e-0094-52fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "72012394-2434-47a3-b853-9f0c82c3011e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceacfail&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb722-301e-0094-62fc-5950b8000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail05384679d5a61d5863Fri, 23 Aug 2019 21:49:46 GMT\"0x8D72813D07E8180\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "ec33da2a-3b7e-402b-9de7-18d41aa85b36", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagefromurlsourceacfail05384679d5a61d5863?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77fb730-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:46 GMT", + "x-ms-client-request-id" : "c9ccd839-6474-45eb-b0a4-6a955eb8be3e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail05384679d5a61d5863", "javablobuploadpagefromurlsourceacfail129529dd53360a67", "javablobuploadpagefromurlsourceacfail2386839c36f1ab1b", "b3ca6f45-d585-4168-a8b0-0b214c797985" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[0].json new file mode 100644 index 000000000000..88c48d1e6b4a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[0].json @@ -0,0 +1,564 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia2bb2563922e494?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C7B3DD10\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06c1c-501e-00c0-1bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "9e2f139c-1428-4379-960d-eb3a9da2573c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia2bb2563922e494/javablobuploadpageia1pageblobapitestuploadpageia2bb852232a3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C7B98608\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06c47-501e-00c0-43fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "432c96b5-6435-44c3-8c62-5022b791e5f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia2bb2563922e494/javablobuploadpageia1pageblobapitestuploadpageia2bb852232a3?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "lambda$null$1", + "fileName" : "PageBlobClient.java", + "lineNumber" : 183, + "className" : "com.azure.storage.blob.PageBlobClient", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "MonoCallable.java", + "lineNumber" : 91, + "className" : "reactor.core.publisher.MonoCallable", + "nativeMethod" : false + }, { + "methodName" : "drain", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 402, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 244, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "slowPath", + "fileName" : "FluxRange.java", + "lineNumber" : 154, + "className" : "reactor.core.publisher.FluxRange$RangeSubscription", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxRange.java", + "lineNumber" : 109, + "className" : "reactor.core.publisher.FluxRange$RangeSubscription", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 162, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 229, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 90, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxRange.java", + "lineNumber" : 68, + "className" : "reactor.core.publisher.FluxRange", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 63, + "className" : "reactor.core.publisher.FluxMapFuseable", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxConcatMap", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "Flux.java", + "lineNumber" : 7921, + "className" : "reactor.core.publisher.Flux", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FluxSubscribeOn.java", + "lineNumber" : 194, + "className" : "reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 84, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 37, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FutureTask.java", + "lineNumber" : 266, + "className" : "java.util.concurrent.FutureTask", + "nativeMethod" : false + }, { + "methodName" : "access$201", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 180, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 293, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "runWorker", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 1149, + "className" : "java.util.concurrent.ThreadPoolExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 624, + "className" : "java.util.concurrent.ThreadPoolExecutor$Worker", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : null, + "localizedMessage" : null, + "suppressed" : [ { + "cause" : null, + "stackTrace" : [ { + "methodName" : "blockingGet", + "fileName" : "BlockingSingleSubscriber.java", + "lineNumber" : 93, + "className" : "reactor.core.publisher.BlockingSingleSubscriber", + "nativeMethod" : false + }, { + "methodName" : "block", + "fileName" : "Mono.java", + "lineNumber" : 1494, + "className" : "reactor.core.publisher.Mono", + "nativeMethod" : false + }, { + "methodName" : "blockWithOptionalTimeout", + "fileName" : "Utility.java", + "lineNumber" : 235, + "className" : "com.azure.storage.common.Utility", + "nativeMethod" : false + }, { + "methodName" : "uploadPagesWithResponse", + "fileName" : "PageBlobClient.java", + "lineNumber" : 192, + "className" : "com.azure.storage.blob.PageBlobClient", + "nativeMethod" : false + }, { + "methodName" : "uploadPages", + "fileName" : "PageBlobClient.java", + "lineNumber" : 153, + "className" : "com.azure.storage.blob.PageBlobClient", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : null, + "lineNumber" : -1, + "className" : "com.azure.storage.blob.PageBlobClient$uploadPages$0", + "nativeMethod" : false + }, { + "methodName" : "defaultCall", + "fileName" : "CallSiteArray.java", + "lineNumber" : 48, + "className" : "org.codehaus.groovy.runtime.callsite.CallSiteArray", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "AbstractCallSite.java", + "lineNumber" : 113, + "className" : "org.codehaus.groovy.runtime.callsite.AbstractCallSite", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "AbstractCallSite.java", + "lineNumber" : 133, + "className" : "org.codehaus.groovy.runtime.callsite.AbstractCallSite", + "nativeMethod" : false + }, { + "methodName" : "$spock_feature_1_10", + "fileName" : "PageBlobAPITest.groovy", + "lineNumber" : 201, + "className" : "com.azure.storage.blob.PageBlobAPITest", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invokeMethod", + "fileName" : "ReflectionUtil.java", + "lineNumber" : 188, + "className" : "org.spockframework.util.ReflectionUtil", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "MethodInfo.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.model.MethodInfo", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatureMethod", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 406, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 324, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 309, + "className" : "org.spockframework.runtime.BaseSpecRunner$6", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 288, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "initializeAndRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 278, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIterations", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 139, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runParameterizedFeature", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 41, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 262, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 246, + "className" : "org.spockframework.runtime.BaseSpecRunner$5", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 238, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatures", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 188, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 98, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.BaseSpecRunner$1", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 76, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 67, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Sputnik.java", + "lineNumber" : 63, + "className" : "org.spockframework.runtime.Sputnik", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 128, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 27, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 290, + "className" : "org.junit.runners.ParentRunner$3", + "nativeMethod" : false + }, { + "methodName" : "schedule", + "fileName" : "ParentRunner.java", + "lineNumber" : 71, + "className" : "org.junit.runners.ParentRunner$1", + "nativeMethod" : false + }, { + "methodName" : "runChildren", + "fileName" : "ParentRunner.java", + "lineNumber" : 288, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "ParentRunner.java", + "lineNumber" : 58, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "evaluate", + "fileName" : "ParentRunner.java", + "lineNumber" : 268, + "className" : "org.junit.runners.ParentRunner$2", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 363, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "JUnitCore.java", + "lineNumber" : 137, + "className" : "org.junit.runner.JUnitCore", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "JUnit4IdeaTestRunner.java", + "lineNumber" : 68, + "className" : "com.intellij.junit4.JUnit4IdeaTestRunner", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "IdeaTestRunner.java", + "lineNumber" : 47, + "className" : "com.intellij.rt.execution.junit.IdeaTestRunner$Repeater", + "nativeMethod" : false + }, { + "methodName" : "prepareStreamsAndStart", + "fileName" : "JUnitStarter.java", + "lineNumber" : 242, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + }, { + "methodName" : "main", + "fileName" : "JUnitStarter.java", + "lineNumber" : 70, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + } ], + "message" : "#block terminated with an error", + "localizedMessage" : "#block terminated with an error", + "suppressed" : [ ] + } ] + }, + "ClassName" : "java.lang.NullPointerException" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e4d9f4-001e-00f1-03fc-59e1e5000000", + "Body" : "jtcuploadpageiajtcuploadpageia0pageblobapitestuploadpageia2bb2563922e494Fri, 23 Aug 2019 21:49:31 GMT\"0x8D72813C7B3DD10\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "a6cc3972-6811-4c0f-8685-7106a6844309", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia2bb2563922e494?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "b1e4da22-001e-00f1-2dfc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "edbda0a7-882f-4068-8227-b86cbe6ea51a" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageia0pageblobapitestuploadpageia2bb2563922e494", "javablobuploadpageia1pageblobapitestuploadpageia2bb852232a3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[1].json new file mode 100644 index 000000000000..82fb07f48eb8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[1].json @@ -0,0 +1,564 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia06695663f10aaa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C7C99950\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e4da60-001e-00f1-68fc-59e1e5000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "02599998-2045-4a98-963a-44cee00346ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia06695663f10aaa/javablobuploadpageia1pageblobapitestuploadpageia06655213525", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C7CEC0E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1e4da9e-001e-00f1-22fc-59e1e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "1deb9c47-5942-4576-b139-ebdd438a34a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia06695663f10aaa/javablobuploadpageia1pageblobapitestuploadpageia06655213525?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "read", + "fileName" : "ByteArrayInputStream.java", + "lineNumber" : 180, + "className" : "java.io.ByteArrayInputStream", + "nativeMethod" : false + }, { + "methodName" : "lambda$null$1", + "fileName" : "PageBlobClient.java", + "lineNumber" : 183, + "className" : "com.azure.storage.blob.PageBlobClient", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "MonoCallable.java", + "lineNumber" : 91, + "className" : "reactor.core.publisher.MonoCallable", + "nativeMethod" : false + }, { + "methodName" : "drain", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 402, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 244, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onNext", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "slowPath", + "fileName" : "FluxRange.java", + "lineNumber" : 154, + "className" : "reactor.core.publisher.FluxRange$RangeSubscription", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxRange.java", + "lineNumber" : 109, + "className" : "reactor.core.publisher.FluxRange$RangeSubscription", + "nativeMethod" : false + }, { + "methodName" : "request", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 162, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 229, + "className" : "reactor.core.publisher.FluxConcatMap$ConcatMapImmediate", + "nativeMethod" : false + }, { + "methodName" : "onSubscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 90, + "className" : "reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxRange.java", + "lineNumber" : 68, + "className" : "reactor.core.publisher.FluxRange", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxMapFuseable.java", + "lineNumber" : 63, + "className" : "reactor.core.publisher.FluxMapFuseable", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "FluxConcatMap.java", + "lineNumber" : 121, + "className" : "reactor.core.publisher.FluxConcatMap", + "nativeMethod" : false + }, { + "methodName" : "subscribe", + "fileName" : "Flux.java", + "lineNumber" : 7921, + "className" : "reactor.core.publisher.Flux", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FluxSubscribeOn.java", + "lineNumber" : 194, + "className" : "reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 84, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : "WorkerTask.java", + "lineNumber" : 37, + "className" : "reactor.core.scheduler.WorkerTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "FutureTask.java", + "lineNumber" : 266, + "className" : "java.util.concurrent.FutureTask", + "nativeMethod" : false + }, { + "methodName" : "access$201", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 180, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ScheduledThreadPoolExecutor.java", + "lineNumber" : 293, + "className" : "java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask", + "nativeMethod" : false + }, { + "methodName" : "runWorker", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 1149, + "className" : "java.util.concurrent.ThreadPoolExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ThreadPoolExecutor.java", + "lineNumber" : 624, + "className" : "java.util.concurrent.ThreadPoolExecutor$Worker", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : null, + "localizedMessage" : null, + "suppressed" : [ { + "cause" : null, + "stackTrace" : [ { + "methodName" : "blockingGet", + "fileName" : "BlockingSingleSubscriber.java", + "lineNumber" : 93, + "className" : "reactor.core.publisher.BlockingSingleSubscriber", + "nativeMethod" : false + }, { + "methodName" : "block", + "fileName" : "Mono.java", + "lineNumber" : 1494, + "className" : "reactor.core.publisher.Mono", + "nativeMethod" : false + }, { + "methodName" : "blockWithOptionalTimeout", + "fileName" : "Utility.java", + "lineNumber" : 235, + "className" : "com.azure.storage.common.Utility", + "nativeMethod" : false + }, { + "methodName" : "uploadPagesWithResponse", + "fileName" : "PageBlobClient.java", + "lineNumber" : 192, + "className" : "com.azure.storage.blob.PageBlobClient", + "nativeMethod" : false + }, { + "methodName" : "uploadPages", + "fileName" : "PageBlobClient.java", + "lineNumber" : 153, + "className" : "com.azure.storage.blob.PageBlobClient", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : null, + "lineNumber" : -1, + "className" : "com.azure.storage.blob.PageBlobClient$uploadPages$0", + "nativeMethod" : false + }, { + "methodName" : "defaultCall", + "fileName" : "CallSiteArray.java", + "lineNumber" : 48, + "className" : "org.codehaus.groovy.runtime.callsite.CallSiteArray", + "nativeMethod" : false + }, { + "methodName" : "call", + "fileName" : null, + "lineNumber" : -1, + "className" : "com.azure.storage.blob.PageBlobClient$uploadPages$0", + "nativeMethod" : false + }, { + "methodName" : "$spock_feature_1_10", + "fileName" : "PageBlobAPITest.groovy", + "lineNumber" : 201, + "className" : "com.azure.storage.blob.PageBlobAPITest", + "nativeMethod" : false + }, { + "methodName" : "invoke0", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : -2, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : true + }, { + "methodName" : "invoke", + "fileName" : "NativeMethodAccessorImpl.java", + "lineNumber" : 62, + "className" : "sun.reflect.NativeMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "DelegatingMethodAccessorImpl.java", + "lineNumber" : 43, + "className" : "sun.reflect.DelegatingMethodAccessorImpl", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "Method.java", + "lineNumber" : 498, + "className" : "java.lang.reflect.Method", + "nativeMethod" : false + }, { + "methodName" : "invokeMethod", + "fileName" : "ReflectionUtil.java", + "lineNumber" : 188, + "className" : "org.spockframework.util.ReflectionUtil", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "MethodInfo.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.model.MethodInfo", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatureMethod", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 406, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 324, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 309, + "className" : "org.spockframework.runtime.BaseSpecRunner$6", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 288, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "initializeAndRunIteration", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 278, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runIterations", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 139, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runParameterizedFeature", + "fileName" : "ParameterizedSpecRunner.java", + "lineNumber" : 41, + "className" : "org.spockframework.runtime.ParameterizedSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 262, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 246, + "className" : "org.spockframework.runtime.BaseSpecRunner$5", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeature", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 238, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runFeatures", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 188, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "doRunSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 98, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 84, + "className" : "org.spockframework.runtime.BaseSpecRunner$1", + "nativeMethod" : false + }, { + "methodName" : "invokeRaw", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 481, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "invoke", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 464, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "runSpec", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 76, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "BaseSpecRunner.java", + "lineNumber" : 67, + "className" : "org.spockframework.runtime.BaseSpecRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Sputnik.java", + "lineNumber" : 63, + "className" : "org.spockframework.runtime.Sputnik", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 128, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "runChild", + "fileName" : "Suite.java", + "lineNumber" : 27, + "className" : "org.junit.runners.Suite", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 290, + "className" : "org.junit.runners.ParentRunner$3", + "nativeMethod" : false + }, { + "methodName" : "schedule", + "fileName" : "ParentRunner.java", + "lineNumber" : 71, + "className" : "org.junit.runners.ParentRunner$1", + "nativeMethod" : false + }, { + "methodName" : "runChildren", + "fileName" : "ParentRunner.java", + "lineNumber" : 288, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "ParentRunner.java", + "lineNumber" : 58, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "evaluate", + "fileName" : "ParentRunner.java", + "lineNumber" : 268, + "className" : "org.junit.runners.ParentRunner$2", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "ParentRunner.java", + "lineNumber" : 363, + "className" : "org.junit.runners.ParentRunner", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "JUnitCore.java", + "lineNumber" : 137, + "className" : "org.junit.runner.JUnitCore", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "JUnit4IdeaTestRunner.java", + "lineNumber" : 68, + "className" : "com.intellij.junit4.JUnit4IdeaTestRunner", + "nativeMethod" : false + }, { + "methodName" : "startRunnerWithArgs", + "fileName" : "IdeaTestRunner.java", + "lineNumber" : 47, + "className" : "com.intellij.rt.execution.junit.IdeaTestRunner$Repeater", + "nativeMethod" : false + }, { + "methodName" : "prepareStreamsAndStart", + "fileName" : "JUnitStarter.java", + "lineNumber" : 242, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + }, { + "methodName" : "main", + "fileName" : "JUnitStarter.java", + "lineNumber" : 70, + "className" : "com.intellij.rt.execution.junit.JUnitStarter", + "nativeMethod" : false + } ], + "message" : "#block terminated with an error", + "localizedMessage" : "#block terminated with an error", + "suppressed" : [ ] + } ] + }, + "ClassName" : "java.lang.IndexOutOfBoundsException" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9839-301e-0094-20fc-5950b8000000", + "Body" : "jtcuploadpageiajtcuploadpageia0pageblobapitestuploadpageia06695663f10aaaFri, 23 Aug 2019 21:49:31 GMT\"0x8D72813C7C99950\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "22a0fdd4-5f8d-418b-a1aa-54e4f7bd4500", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia06695663f10aaa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f9847-301e-0094-2dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "415193a4-cb4e-4dc3-b0d8-9bf2de22ce59" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageia0pageblobapitestuploadpageia06695663f10aaa", "javablobuploadpageia1pageblobapitestuploadpageia06655213525", "21da381f-4380-49b1-9fb1-e09e5ade7198" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[2].json new file mode 100644 index 000000000000..76def1f1f20b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[2].json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia55342897de5359?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C7EB1E0B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f985c-301e-0094-40fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "c52f0484-f671-4a3d-8a44-dab9a87ad9d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia55342897de5359/javablobuploadpageia1pageblobapitestuploadpageia55374230cb8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C7F1BAD6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77f987c-301e-0094-58fc-5950b8000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "7e16769e-f513-4151-9d51-ad1b22140db8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia55342897de5359/javablobuploadpageia1pageblobapitestuploadpageia55374230cb8?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidPageRange", + "retry-after" : "0", + "Content-Length" : "221", + "StatusCode" : "416", + "x-ms-request-id" : "f77f9898-301e-0094-71fc-5950b8000000", + "Body" : "InvalidPageRangeThe page range specified is invalid.\nRequestId:f77f9898-301e-0094-71fc-5950b8000000\nTime:2019-08-23T21:49:32.0609580Z", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "6ec4334c-266c-4a8c-9771-f51c32e3e12d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpageia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f98af-301e-0094-07fc-5950b8000000", + "Body" : "jtcuploadpageiajtcuploadpageia0pageblobapitestuploadpageia55342897de5359Fri, 23 Aug 2019 21:49:31 GMT\"0x8D72813C7EB1E0B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "2049b854-16cb-4ee0-b175-f1ae481572fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia55342897de5359?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77f98c4-301e-0094-16fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:49:31 GMT", + "x-ms-client-request-id" : "ee5d1337-2d54-493b-a462-a538d9162e02" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageia0pageblobapitestuploadpageia55342897de5359", "javablobuploadpageia1pageblobapitestuploadpageia55374230cb8", "35bdf439-28b6-46dc-b3a8-c41d452c439a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagemin.json new file mode 100644 index 000000000000..c2836e3f6e6e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagemin.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemind766607786d2a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C79B1EE2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06b81-501e-00c0-10fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "2cedd004-51e3-4320-9942-95cba96fb235" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemind766607786d2a/javablobuploadpagemin1pageblobapitestuploadpagemind7690817ea", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813C79FDD32\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d06ba9-501e-00c0-34fc-59ba32000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "57859da3-5726-4eff-95f6-2fe8ca5e5182" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemind766607786d2a/javablobuploadpagemin1pageblobapitestuploadpagemind7690817ea?comp=page", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "XCXZzDaDf+k=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "ETag" : "\"0x8D72813C7A49952\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d06bc2-501e-00c0-4afc-59ba32000000", + "x-ms-client-request-id" : "07c1f4a2-f729-4cc9-a280-3c26f4ab7fdc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcuploadpagemin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06bdc-501e-00c0-63fc-59ba32000000", + "Body" : "jtcuploadpageminjtcuploadpagemin0pageblobapitestuploadpagemind766607786d2aFri, 23 Aug 2019 21:49:31 GMT\"0x8D72813C79B1EE2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "451d0d92-b21c-4f03-9c7b-7d99699d1e51", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemind766607786d2a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "77d06bf9-501e-00c0-7bfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:30 GMT", + "x-ms-client-request-id" : "bf31949c-b466-428c-ba2a-d6d1a021fa4e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagemin0pageblobapitestuploadpagemind766607786d2a", "javablobuploadpagemin1pageblobapitestuploadpagemind7690817ea", "251c27de-89eb-4a0f-893f-c97dd30fcffe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogressparallel.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogressparallel.json new file mode 100644 index 000000000000..1838dc415ea1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogressparallel.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogressparallel028073462110df6ca64fc6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E3B37D04\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ffad5-301e-0094-11fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:18 GMT", + "x-ms-client-request-id" : "7bf24824-ced7-449f-8b21-65d76ca4b851" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreportprogressparallel&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78001ea-301e-0094-50fc-5950b8000000", + "Body" : "jtcreportprogressparalleljtcreportprogressparallel028073462110df6ca64fc6Fri, 23 Aug 2019 21:50:18 GMT\"0x8D72813E3B37D04\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:21 GMT", + "x-ms-client-request-id" : "58b5cfb5-c09b-407c-a49d-b7aa80b73d65", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogressparallel028073462110df6ca64fc6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7800200-301e-0094-61fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:21 GMT", + "x-ms-client-request-id" : "70662f81-e20b-4f74-8cc3-40f72c71a0a1" + }, + "Exception" : null + } ], + "variables" : [ "jtcreportprogressparallel028073462110df6ca64fc6", "d483aa21-ff84-473d-ac9e-9c28d19c6a07", "73f5c3c0-510f-49aa-87ae-6134ddd7ff36", "9bccac4b-f898-4826-9f76-1fe5bd2fab30" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequential.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequential.json new file mode 100644 index 000000000000..0454e7f24c9d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequential.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogresssequential063585826d7b5fed3a434?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E36C5135\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ff9f4-301e-0094-4afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "1a52a194-ac6f-46ab-8a03-72adf80ead33" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreportprogresssequential&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ffa36-301e-0094-05fc-5950b8000000", + "Body" : "jtcreportprogresssequentialjtcreportprogresssequential063585826d7b5fed3a434Fri, 23 Aug 2019 21:50:18 GMT\"0x8D72813E36C5135\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "43f951f0-2952-4082-8834-fdc7bc97c827", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogresssequential063585826d7b5fed3a434?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ffa3b-301e-0094-0afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "9a4569b8-72ad-429d-a8cc-feca707c9ac9" + }, + "Exception" : null + } ], + "variables" : [ "jtcreportprogresssequential063585826d7b5fed3a434", "3041d0cb-2539-4764-9088-f50dd6ea8401", "9584253a-e8d6-4915-b7c1-7eb601c9940e", "de42eb87-8090-418e-a4ff-e3d414b5bda4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequentialnetworktest.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequentialnetworktest.json new file mode 100644 index 000000000000..f0a6794ca9ad --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequentialnetworktest.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogresssequentialnetworktest0666662df218c6e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E388E093\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f77ffa4c-301e-0094-1afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:17 GMT", + "x-ms-client-request-id" : "c162f443-739c-4b58-a468-d4e023e7dffc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogresssequentialnetworktest0666662df218c6e/javablobreportprogresssequentialnetworktest109770a69d292", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "XCuSfj7xjr0=", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:50:18 GMT", + "Content-MD5" : "hDmlCXyc0xGEQJGQaNCbFg==", + "ETag" : "\"0x8D72813E39F6371\"", + "Content-Length" : "0", + "x-ms-request-id" : "f77ffa62-301e-0094-2afc-5950b8000000", + "x-ms-client-request-id" : "4d9de0f1-236c-46b9-8a7c-bd99d88ab366" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcreportprogresssequentialnetworktest&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ffaac-301e-0094-6efc-5950b8000000", + "Body" : "jtcreportprogresssequentialnetworktestjtcreportprogresssequentialnetworktest0666662df218c6eFri, 23 Aug 2019 21:50:18 GMT\"0x8D72813E388E093\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:18 GMT", + "x-ms-client-request-id" : "ea7c420a-042d-4e12-b972-f016269f816b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcreportprogresssequentialnetworktest0666662df218c6e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f77ffabb-301e-0094-7bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:18 GMT", + "x-ms-client-request-id" : "d4a99771-efb2-45b8-8d45-227718a80401" + }, + "Exception" : null + } ], + "variables" : [ "jtcreportprogresssequentialnetworktest0666662df218c6e", "7f3f93c6-0c7e-466e-a854-ac2aad16513b", "javablobreportprogresssequentialnetworktest109770a69d292" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesexponentialdelay.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesexponentialdelay.json new file mode 100644 index 000000000000..0311ed60eab8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesexponentialdelay.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesexponentialdelay085903814ae7a528a3440?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813F5F4F3CD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7803f60-301e-0094-69fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:48 GMT", + "x-ms-client-request-id" : "0ed4c4f9-5c1c-4691-85a3-570ecc0684de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesexponentialdelay&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7805f7c-301e-0094-12fc-5950b8000000", + "Body" : "jtcretriesexponentialdelayjtcretriesexponentialdelay085903814ae7a528a3440Fri, 23 Aug 2019 21:50:49 GMT\"0x8D72813F5F4F3CD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:02 GMT", + "x-ms-client-request-id" : "3ffb4490-2d49-44fd-a792-0dbe4f44bde5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesexponentialdelay085903814ae7a528a3440?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7805f8f-301e-0094-24fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:02 GMT", + "x-ms-client-request-id" : "580709b0-d196-47b8-b434-51b70aa48ce5" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesexponentialdelay085903814ae7a528a3440" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesfixeddelay.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesfixeddelay.json new file mode 100644 index 000000000000..02ad751e65a8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesfixeddelay.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesfixeddelay0retrytestretriesfixeddelay9bf5826460ff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813FDF15D27\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7805fbd-301e-0094-51fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:02 GMT", + "x-ms-client-request-id" : "efbda475-2b90-4565-9ddc-8f96566c3cb1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesfixeddelay&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806a88-301e-0094-26fc-5950b8000000", + "Body" : "jtcretriesfixeddelayjtcretriesfixeddelay0retrytestretriesfixeddelay9bf5826460ffFri, 23 Aug 2019 21:51:02 GMT\"0x8D72813FDF15D27\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:05 GMT", + "x-ms-client-request-id" : "b791a59b-1fd3-49b7-ae20-f856968d91fb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesfixeddelay0retrytestretriesfixeddelay9bf5826460ff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806a9a-301e-0094-37fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:05 GMT", + "x-ms-client-request-id" : "c9b15fb8-f371-4000-831a-dbf3b1c4a44e" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesfixeddelay0retrytestretriesfixeddelay9bf5826460ff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnetworkerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnetworkerror.json new file mode 100644 index 000000000000..9c55254cfd32 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnetworkerror.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnetworkerror0retrytestretriesnetworkerrorb0b32285e4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813F0AFC1C1\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7802e09-301e-0094-0dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:39 GMT", + "x-ms-client-request-id" : "8aec0669-9249-4e5a-bc00-1d58556feef4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesnetworkerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7803198-301e-0094-6dfc-5950b8000000", + "Body" : "jtcretriesnetworkerrorjtcretriesnetworkerror0retrytestretriesnetworkerrorb0b32285e4Fri, 23 Aug 2019 21:50:40 GMT\"0x8D72813F0AFC1C1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:41 GMT", + "x-ms-client-request-id" : "c1ccb45b-2163-41e7-860f-63ca8ebf33b6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnetworkerror0retrytestretriesnetworkerrorb0b32285e4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78031ac-301e-0094-79fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:41 GMT", + "x-ms-client-request-id" : "3feb583e-3000-4760-914f-df80cee39dd7" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnetworkerror0retrytestretriesnetworkerrorb0b32285e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonreplyableflux.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonreplyableflux.json new file mode 100644 index 000000000000..cd7fbd331be1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonreplyableflux.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonreplyableflux0625999221f7600e5e4b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281400032D04\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7806ab3-301e-0094-4ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:05 GMT", + "x-ms-client-request-id" : "cffded6e-abeb-44dd-bfbd-d1620262c7ce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesnonreplyableflux&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806e17-301e-0094-60fc-5950b8000000", + "Body" : "jtcretriesnonreplyablefluxjtcretriesnonreplyableflux0625999221f7600e5e4b5Fri, 23 Aug 2019 21:51:06 GMT\"0x8D7281400032D04\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:06 GMT", + "x-ms-client-request-id" : "20638adb-39d5-4b10-a3a1-8ed6fccadbe1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonreplyableflux0625999221f7600e5e4b5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806e24-301e-0094-6cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:06 GMT", + "x-ms-client-request-id" : "3793cdcf-2075-4940-ba24-3c53117da4ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnonreplyableflux0625999221f7600e5e4b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryable.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryable.json new file mode 100644 index 000000000000..503515c549c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryable.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonretryable0retrytestretriesnonretryable0f51911100?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813F0037AEA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7802be5-301e-0094-2ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:38 GMT", + "x-ms-client-request-id" : "709b8ddd-d631-4c8f-bcb2-75e301e08bf2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesnonretryable&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7802bf2-301e-0094-3afc-5950b8000000", + "Body" : "jtcretriesnonretryablejtcretriesnonretryable0retrytestretriesnonretryable0f51911100Fri, 23 Aug 2019 21:50:39 GMT\"0x8D72813F0037AEA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:38 GMT", + "x-ms-client-request-id" : "2b32aa35-b50f-4f9c-8e15-5e88b8218cd8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonretryable0retrytestretriesnonretryable0f51911100?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7802c0b-301e-0094-50fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:38 GMT", + "x-ms-client-request-id" : "481ce40d-1526-4112-9752-54e095a30c11" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnonretryable0retrytestretriesnonretryable0f51911100" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryablesecondary.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryablesecondary.json new file mode 100644 index 000000000000..6b7407e116a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryablesecondary.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonretryablesecondary005045c10c06961e3a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813F019EE67\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7802c31-301e-0094-73fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:39 GMT", + "x-ms-client-request-id" : "cbecc5ef-8780-4872-992c-687720059b08" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesnonretryablesecondary&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7802de1-301e-0094-6dfc-5950b8000000", + "Body" : "jtcretriesnonretryablesecondaryjtcretriesnonretryablesecondary005045c10c06961e3a4Fri, 23 Aug 2019 21:50:39 GMT\"0x8D72813F019EE67\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:39 GMT", + "x-ms-client-request-id" : "8753c283-b8db-45d2-9ae3-220d1ae28d79", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesnonretryablesecondary005045c10c06961e3a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7802df2-301e-0094-7cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:39 GMT", + "x-ms-client-request-id" : "ba45768a-2941-433d-9242-9c089b8b1873" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnonretryablesecondary005045c10c06961e3a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[0].json new file mode 100644 index 000000000000..20212bd7b701 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid0325412e3c497f51e14bd2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281400CB8E07\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7806e34-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:06 GMT", + "x-ms-client-request-id" : "848596ad-0ebe-4f6c-a3b6-b8f1bde6326d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806e4d-301e-0094-12fc-5950b8000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid0325412e3c497f51e14bd2Fri, 23 Aug 2019 21:51:07 GMT\"0x8D7281400CB8E07\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "82dc6504-44ce-4f29-b25b-b3609a8169eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid0325412e3c497f51e14bd2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806e62-301e-0094-21fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "1635fbcf-1e91-4a5b-be15-c304c139b821" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid0325412e3c497f51e14bd2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[1].json new file mode 100644 index 000000000000..e6b3b21f7439 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid050397a2242981b3e64b41?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281400DA3768\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7806e86-301e-0094-41fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "3eb2735a-bd41-44fb-9c6d-fc43c7ed6242" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806e9d-301e-0094-56fc-5950b8000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid050397a2242981b3e64b41Fri, 23 Aug 2019 21:51:07 GMT\"0x8D7281400DA3768\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "ac904cac-6eb8-420d-beb6-a42cdaecadc9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid050397a2242981b3e64b41?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806eab-301e-0094-64fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "ae22a975-01ea-4403-a6cd-1ea70f410137" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid050397a2242981b3e64b41" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[2].json new file mode 100644 index 000000000000..f3cb78f8d465 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid08356950a966f1554d4571?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281400EB7976\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7806ec1-301e-0094-78fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "252e136a-12f1-43b9-9365-aa95d20558b8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806ee7-301e-0094-17fc-5950b8000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid08356950a966f1554d4571Fri, 23 Aug 2019 21:51:07 GMT\"0x8D7281400EB7976\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "1c5289b6-a01a-4f19-a522-28d72afc4a0f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid08356950a966f1554d4571?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806ef3-301e-0094-23fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "f8dfcb69-58df-436b-b0ad-866bbf897878" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid08356950a966f1554d4571" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[3].json new file mode 100644 index 000000000000..5a0450ce455f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid02396408ae872d2e8b4752?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281400FBF818\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7806f0a-301e-0094-38fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "2d7b6803-e753-4e7d-bde2-59eddc940bbb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806f1e-301e-0094-47fc-5950b8000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid02396408ae872d2e8b4752Fri, 23 Aug 2019 21:51:07 GMT\"0x8D7281400FBF818\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "58b7f54c-98a0-4ac0-a275-3ca96ca5f533", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid02396408ae872d2e8b4752?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806f34-301e-0094-5bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "dc2967e0-c9ce-42ae-bb70-f69a3ffb24a7" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid02396408ae872d2e8b4752" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[4].json new file mode 100644 index 000000000000..793d23953236 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid0634869784d1cc837848ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814010A7A75\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7806f50-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "feef024b-2ab1-481f-be71-b658913bdd7a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806f74-301e-0094-14fc-5950b8000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid0634869784d1cc837848abFri, 23 Aug 2019 21:51:07 GMT\"0x8D72814010A7A75\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "6704c304-a2e3-4dc8-b2b9-8beb9e54c31b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid0634869784d1cc837848ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806f90-301e-0094-2ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "e968b12f-4e9c-4e96-b906-1185b3e75ede" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid0634869784d1cc837848ab" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[5].json new file mode 100644 index 000000000000..9e1db951af79 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid08602096fd8b6a70a24a32?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814011923E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7806fab-301e-0094-46fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "4a3a25f6-299e-4f58-ac15-4658562cdb91" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806fc6-301e-0094-5cfc-5950b8000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid08602096fd8b6a70a24a32Fri, 23 Aug 2019 21:51:07 GMT\"0x8D72814011923E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "435b3d71-6b05-4fb7-96af-88bcbad983ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid08602096fd8b6a70a24a32?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7806fdb-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "aa3dab25-fe15-4362-b009-c4f9cea6ea9e" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid08602096fd8b6a70a24a32" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[6].json new file mode 100644 index 000000000000..df67a08b2d68 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid0447897c06817ac84b44b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814012890CF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7806fea-301e-0094-7bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "42cbde0b-d032-47c1-b76c-bb176b10c67c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807003-301e-0094-10fc-5950b8000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid0447897c06817ac84b44b4Fri, 23 Aug 2019 21:51:08 GMT\"0x8D72814012890CF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "ce4959c3-1a2e-4c86-ab14-5e1a86d946ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesoptionsinvalid0447897c06817ac84b44b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807013-301e-0094-20fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "c9c7d7e9-3a91-4d93-9d9f-dc99143eeaaf" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid0447897c06817ac84b44b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriestrytimeout.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriestrytimeout.json new file mode 100644 index 000000000000..c670f3b26b65 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriestrytimeout.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriestrytimeout0retrytestretriestrytimeout1fb46449ae42?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813F1D6856F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78031c3-301e-0094-0dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:41 GMT", + "x-ms-client-request-id" : "c3fe61a4-617e-406a-bf7a-f0c203226034" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriestrytimeout&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7803f48-301e-0094-55fc-5950b8000000", + "Body" : "jtcretriestrytimeoutjtcretriestrytimeout0retrytestretriestrytimeout1fb46449ae42Fri, 23 Aug 2019 21:50:42 GMT\"0x8D72813F1D6856F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:48 GMT", + "x-ms-client-request-id" : "18b827f3-8a76-4366-8bf7-98c15599ef51", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriestrytimeout0retrytestretriestrytimeout1fb46449ae42?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7803f54-301e-0094-5ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:48 GMT", + "x-ms-client-request-id" : "d6f4ba53-cf2b-41f0-bb32-ade0c05a2fce" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriestrytimeout0retrytestretriestrytimeout1fb46449ae42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilmaxretries.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilmaxretries.json new file mode 100644 index 000000000000..82c2b6456466 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilmaxretries.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesuntilmaxretries051705df2d01e14eb84469?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813EB921E2F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7801b5c-301e-0094-18fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:31 GMT", + "x-ms-client-request-id" : "67837b5a-4220-4146-b210-d54d3d1e515e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesuntilmaxretries&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7802baf-301e-0094-80fc-5950b8000000", + "Body" : "jtcretriesuntilmaxretriesjtcretriesuntilmaxretries051705df2d01e14eb84469Fri, 23 Aug 2019 21:50:31 GMT\"0x8D72813EB921E2F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:38 GMT", + "x-ms-client-request-id" : "90a752f8-9812-4d02-8eb1-f196b52432be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesuntilmaxretries051705df2d01e14eb84469?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7802bc2-301e-0094-0ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:38 GMT", + "x-ms-client-request-id" : "520ae37e-7fd4-4d77-b058-722295beb554" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesuntilmaxretries051705df2d01e14eb84469" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilsuccess.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilsuccess.json new file mode 100644 index 000000000000..807b237110a2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilsuccess.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesuntilsuccess0retrytestretriesuntilsuccess410660516e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813E5930D8B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:50:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7800233-301e-0094-0efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:21 GMT", + "x-ms-client-request-id" : "99881d18-b5ad-4493-98af-dfa3dbfe8e7c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcretriesuntilsuccess&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7801b3b-301e-0094-7cfc-5950b8000000", + "Body" : "jtcretriesuntilsuccessjtcretriesuntilsuccess0retrytestretriesuntilsuccess410660516eFri, 23 Aug 2019 21:50:21 GMT\"0x8D72813E5930D8B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:50:31 GMT", + "x-ms-client-request-id" : "e8481a79-13eb-4818-b916-4bebc5fe4e7e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcretriesuntilsuccess0retrytestretriesuntilsuccess410660516e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7801b49-301e-0094-08fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:50:31 GMT", + "x-ms-client-request-id" : "6eec244f-d5d7-4ee9-bf87-69770587b587" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesuntilsuccess0retrytestretriesuntilsuccess410660516e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainerfails.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainerfails.json new file mode 100644 index 000000000000..f8278f579382 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainerfails.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails0630650503df00?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814025F5DFF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780761a-301e-0094-22fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "c8f20226-5ab6-4166-b7a6-698930aefd56" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails16933248908924?restype=container&sv=2018-11-09&ss=b&srt=sco&se=2019-08-24T21%3A51%3A10Z&sp=r&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthorizationPermissionMismatch", + "retry-after" : "0", + "Content-Length" : "279", + "StatusCode" : "403", + "x-ms-request-id" : "f7807641-301e-0094-46fc-5950b8000000", + "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:f7807641-301e-0094-46fc-5950b8000000\nTime:2019-08-23T21:51:10.0786189Z", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "dccf112d-111c-4e14-b0df-cfda337014fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworkcreatecontainerfails&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807656-301e-0094-59fc-5950b8000000", + "Body" : "jtcaccountsasnetworkcreatecontainerfailsjtcaccountsasnetworkcreatecontainerfails0630650503df00Fri, 23 Aug 2019 21:51:10 GMT\"0x8D72814025F5DFF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "9504bd55-15a7-4e92-b5e3-fe097f6459c1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails0630650503df00?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780766c-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "ea492607-93cb-4dc2-ae27-54c24ab754ed" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworkcreatecontainerfails0630650503df00", "2019-08-23T21:51:10.092Z", "jtcaccountsasnetworkcreatecontainerfails16933248908924" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainersucceeds.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainersucceeds.json new file mode 100644 index 000000000000..f9a257978d30 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainersucceeds.json @@ -0,0 +1,100 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds021286083779d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281402720000\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807684-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "ae8217b0-397c-44b5-b259-7712236dd614" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds143322adf3343?restype=container&sv=2018-11-09&ss=b&srt=sco&se=2019-08-24T21%3A51%3A10Z&sp=rc&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140277CDB7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78076a5-301e-0094-23fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "0d8e8782-f31b-46de-aebd-63084c83f7e3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworkcreatecontainersucceeds&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78076c6-301e-0094-3ffc-5950b8000000", + "Body" : "jtcaccountsasnetworkcreatecontainersucceedsjtcaccountsasnetworkcreatecontainersucceeds021286083779dFri, 23 Aug 2019 21:51:10 GMT\"0x8D7281402720000\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcaccountsasnetworkcreatecontainersucceeds143322adf3343Fri, 23 Aug 2019 21:51:10 GMT\"0x8D728140277CDB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "bf8613ec-c126-4cc0-8cb7-47b80221b7fd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds021286083779d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78076da-301e-0094-51fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "3daf880f-4ba7-429f-aac6-d2455657ba0c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds143322adf3343?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78076e9-301e-0094-60fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "00fa4ae3-8b72-4fe2-acae-5773e0d213b7" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworkcreatecontainersucceeds021286083779d", "2019-08-23T21:51:10.221Z", "jtcaccountsasnetworkcreatecontainersucceeds143322adf3343" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobdeletefails.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobdeletefails.json new file mode 100644 index 000000000000..8597c064e16b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobdeletefails.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails096792221e2dc41?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140237CF92\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807545-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "b1e58b10-1f4b-42bf-8a64-63341e4e7706" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails096792221e2dc41/javablobaccountsasnetworktestblobdeletefails151563edb44f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Q7G6/s6+u/k=", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D72814024C53B6\"", + "Content-Length" : "0", + "x-ms-request-id" : "f78075ac-301e-0094-3bfc-5950b8000000", + "x-ms-client-request-id" : "cae5a703-8e13-4b31-9ef5-23392c813dac" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails096792221e2dc41/javablobaccountsasnetworktestblobdeletefails151563edb44f?sv=2018-11-09&ss=b&srt=sco&se=2019-08-24T21%3A51%3A09Z&sp=r&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthorizationPermissionMismatch", + "retry-after" : "0", + "Content-Length" : "279", + "StatusCode" : "403", + "x-ms-request-id" : "f78075ca-301e-0094-57fc-5950b8000000", + "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:f78075ca-301e-0094-57fc-5950b8000000\nTime:2019-08-23T21:51:09.9525031Z", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "5d19910c-208d-4f66-94b3-e2ed33e93aa1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworktestblobdeletefails&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78075eb-301e-0094-74fc-5950b8000000", + "Body" : "jtcaccountsasnetworktestblobdeletefailsjtcaccountsasnetworktestblobdeletefails096792221e2dc41Fri, 23 Aug 2019 21:51:09 GMT\"0x8D728140237CF92\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "f7ea63c9-a7ea-4ef0-9242-905e8e9c8a54", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails096792221e2dc41?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807600-301e-0094-08fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "535236d4-dfb3-4bdf-b932-f46a20440c09" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworktestblobdeletefails096792221e2dc41", "javablobaccountsasnetworktestblobdeletefails151563edb44f", "2019-08-23T21:51:09.968Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobread.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobread.json new file mode 100644 index 000000000000..a4497c789844 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobread.json @@ -0,0 +1,116 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread00792775a37eb58def?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814021B8E59\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780748c-301e-0094-36fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "4b2bcdd0-3106-482c-9976-cc482b8b7691" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread00792775a37eb58def/javablobaccountsasnetworktestblobread194514cee5ca1796", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Q7G6/s6+u/k=", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D728140220A521\"", + "Content-Length" : "0", + "x-ms-request-id" : "f78074b8-301e-0094-5cfc-5950b8000000", + "x-ms-client-request-id" : "ba009d21-c8ad-4ebc-bb7b-c12fb615270b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread00792775a37eb58def/javablobaccountsasnetworktestblobread194514cee5ca1796?sv=2018-11-09&ss=b&srt=sco&se=2019-08-24T21%3A51%3A09Z&sp=r&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D728140220A521\"", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:51:09 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "f78074e5-301e-0094-02fc-5950b8000000", + "Body" : "[116, 101, 115, 116]", + "x-ms-client-request-id" : "d77549ff-4f42-4292-8b8b-63535cc2e01b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworktestblobread&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807506-301e-0094-20fc-5950b8000000", + "Body" : "jtcaccountsasnetworktestblobreadjtcaccountsasnetworktestblobread00792775a37eb58defFri, 23 Aug 2019 21:51:09 GMT\"0x8D72814021B8E59\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "d7adefc1-451b-41e9-93be-a440a847805a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread00792775a37eb58def?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780751a-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "31e9e25a-0916-41e3-ad93-1b1c33db7761" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworktestblobread00792775a37eb58def", "javablobaccountsasnetworktestblobread194514cee5ca1796", "2019-08-23T21:51:09.693Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[0].json new file mode 100644 index 000000000000..ff1c6a6127ea --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0682850d20771ae12941?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140867989B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78094bd-301e-0094-26fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "c8c26650-9faa-41c1-808b-8b2ea7dd9b49" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78094d0-301e-0094-34fc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0682850d20771ae12941Fri, 23 Aug 2019 21:51:20 GMT\"0x8D728140867989B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "161472ea-5daa-4657-9ad9-fd33fbc59b1f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0682850d20771ae12941?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78094dc-301e-0094-3efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "66be1d8d-7959-4148-bf0e-367fa67d5e92" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0682850d20771ae12941" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[1].json new file mode 100644 index 000000000000..5a334becda53 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0558069e57addb85684b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281408772C8E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78094fd-301e-0094-5bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "e134e3ac-c431-457e-af7c-14628b12047c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809521-301e-0094-7cfc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0558069e57addb85684bFri, 23 Aug 2019 21:51:20 GMT\"0x8D7281408772C8E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "d5cd650d-a1b3-44ab-9ade-72d501727c01", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0558069e57addb85684b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809530-301e-0094-09fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "cb97b15d-a526-44ce-a2f6-81f401753270" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0558069e57addb85684b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[2].json new file mode 100644 index 000000000000..48ed592b4052 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse082136900c69b58e8945?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140886242A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780954e-301e-0094-24fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "9aa667fe-8acd-4e23-baba-af3fdd10d0bd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780956d-301e-0094-3dfc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse082136900c69b58e8945Fri, 23 Aug 2019 21:51:20 GMT\"0x8D728140886242A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "424fed5d-eac8-494c-ae4e-6d45f0c41dc3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse082136900c69b58e8945?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780957c-301e-0094-4bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "ef0c469c-f1bd-4c43-8c30-a6feffb0fd55" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse082136900c69b58e8945" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[3].json new file mode 100644 index 000000000000..eb18d8a565f8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0740818b007a5ed01547?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140894CD99\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780959a-301e-0094-67fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "511af8b1-aedf-410c-9397-7e5316d3c3b0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78095b1-301e-0094-7cfc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0740818b007a5ed01547Fri, 23 Aug 2019 21:51:20 GMT\"0x8D728140894CD99\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "d3b26ef2-9fb2-474b-af20-4768da603419", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0740818b007a5ed01547?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78095ca-301e-0094-12fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "0449a82d-993d-4c74-a199-2eea89fd371a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0740818b007a5ed01547" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[4].json new file mode 100644 index 000000000000..34deef4e01c6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse04196795954f2969c243?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281408A328DA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78095e8-301e-0094-2efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "8ec29c54-aace-4065-90be-1e43aa40c991" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78095fd-301e-0094-41fc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse04196795954f2969c243Fri, 23 Aug 2019 21:51:20 GMT\"0x8D7281408A328DA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "e9e069de-ba57-4f4d-b349-967a8c0a6d3f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse04196795954f2969c243?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809607-301e-0094-4afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "e4a0f2f1-06bb-42dc-a868-609bafb7451d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse04196795954f2969c243" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[5].json new file mode 100644 index 000000000000..513a456772be --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0271823161bb8ced3449?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281408B10EC9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809620-301e-0094-61fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "510fb844-a6ae-44bb-815e-d9c4c7c74b3f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809636-301e-0094-75fc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0271823161bb8ced3449Fri, 23 Aug 2019 21:51:20 GMT\"0x8D7281408B10EC9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "fb1ba688-01b6-4035-a6ea-6f0b0b61a640", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0271823161bb8ced3449?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780964e-301e-0094-0afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "72ff7949-b5e9-4580-aff2-b4d8a238ae60" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0271823161bb8ced3449" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[6].json new file mode 100644 index 000000000000..a0b08e1c510a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse029453b44787f35dc444?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281408C277FD\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809683-301e-0094-36fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "ff47c613-1123-47d2-9453-51ce63e8ed7e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780969f-301e-0094-50fc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse029453b44787f35dc444Fri, 23 Aug 2019 21:51:20 GMT\"0x8D7281408C277FD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "ccce8616-a64e-40f1-bd9d-872f155638d9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse029453b44787f35dc444?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78096af-301e-0094-5ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "d290d499-0839-49d4-9290-277b71e8e541" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse029453b44787f35dc444" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[7].json new file mode 100644 index 000000000000..a9d7f66077b3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[7].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse074455f541c3df76c94c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281408D14887\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78096c5-301e-0094-74fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "4d55893e-9eaf-4694-b0f8-e19fd481e7dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78096d8-301e-0094-05fc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse074455f541c3df76c94cFri, 23 Aug 2019 21:51:20 GMT\"0x8D7281408D14887\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "309521fc-1a47-4514-84e8-3080ecd7b522", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse074455f541c3df76c94c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78096e7-301e-0094-12fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "cee7b2ec-7364-4ff4-b90a-5f4a815f498f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse074455f541c3df76c94c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[8].json new file mode 100644 index 000000000000..8a0e003b567d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[8].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0052843971eccbf0d547?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281408E0190D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809704-301e-0094-2ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "8699ff3c-5513-4f23-ae97-6fb21252f7de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780971e-301e-0094-45fc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0052843971eccbf0d547Fri, 23 Aug 2019 21:51:20 GMT\"0x8D7281408E0190D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "c933fe63-9920-4227-9890-c259af07e7b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0052843971eccbf0d547?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780972f-301e-0094-53fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "93683b04-7436-4ab8-be16-1be83f81d7a1" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0052843971eccbf0d547" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[9].json new file mode 100644 index 000000000000..0aef1fb2a509 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[9].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0698138bb469839cbf43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281409092E79\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78097bf-301e-0094-52fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "a1aeb100-c919-4ad9-8cae-9148c546dfb2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78097dd-301e-0094-6efc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0698138bb469839cbf43Fri, 23 Aug 2019 21:51:21 GMT\"0x8D7281409092E79\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "4f670773-d92d-4aac-bad7-3638706fce9a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparse0698138bb469839cbf43?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78097ea-301e-0094-7bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "d8ca9f6a-db87-4749-a38f-40b4aafcdc87" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0698138bb469839cbf43" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparseia.json new file mode 100644 index 000000000000..954b3a230111 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparseia.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparseia0047537c3e66b488f14?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814091A7092\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809813-301e-0094-22fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "93a6d1ae-f6b3-405c-8f17-d08283cfc4e0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionsparseia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809828-301e-0094-35fc-5950b8000000", + "Body" : "jtcaccountsaspermissionsparseiajtcaccountsaspermissionsparseia0047537c3e66b488f14Fri, 23 Aug 2019 21:51:21 GMT\"0x8D72814091A7092\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "21874ff1-5bef-4729-b4c3-635f92b8c7b6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionsparseia0047537c3e66b488f14?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780983a-301e-0094-47fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:20 GMT", + "x-ms-client-request-id" : "f6cde3db-4ca9-43d3-a201-1e4ee1d31a17" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparseia0047537c3e66b488f14" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[0].json new file mode 100644 index 000000000000..d60f314e192d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0492946389ca4c9615?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281407DCC434\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780926b-301e-0094-10fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "5d33f9da-e1a2-425e-86e5-08d7ff46a001" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809285-301e-0094-29fc-5950b8000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0492946389ca4c9615Fri, 23 Aug 2019 21:51:19 GMT\"0x8D7281407DCC434\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "4753b253-4ffe-427c-a661-83cad1e53880", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0492946389ca4c9615?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780929a-301e-0094-3bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "b1fe63ce-3bda-4bc9-8c5a-79b43f173768" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0492946389ca4c9615" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[1].json new file mode 100644 index 000000000000..f165a20897d6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring012745879f4394fe07?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281407EB4682\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78092bb-301e-0094-54fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "08669129-a71f-45c2-97ae-4c9b396c578b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78092d2-301e-0094-69fc-5950b8000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring012745879f4394fe07Fri, 23 Aug 2019 21:51:19 GMT\"0x8D7281407EB4682\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "bd299dea-581c-4952-a05c-99b3da7ff2d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring012745879f4394fe07?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78092dd-301e-0094-73fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "e8cbd647-fddd-436b-8ec8-8d4da41fb1bd" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring012745879f4394fe07" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[2].json new file mode 100644 index 000000000000..9bf9f1276d18 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0506403309f2b1e30f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281407FB01A4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78092f8-301e-0094-0dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "0ec721c2-69f4-4e3a-8c51-c542016bd639" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809313-301e-0094-21fc-5950b8000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0506403309f2b1e30fFri, 23 Aug 2019 21:51:19 GMT\"0x8D7281407FB01A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "9f2107cc-cf64-4270-befa-e22adde0465d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0506403309f2b1e30f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780932b-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "70e0e432-a4ab-42f5-9e6a-0ed01d36e63d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0506403309f2b1e30f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[3].json new file mode 100644 index 000000000000..8b51ac23de99 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0450371fc4c0441551?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140809AB17\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809345-301e-0094-4afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "390a81cd-8acc-4c91-a053-4b111b3beff5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809358-301e-0094-5bfc-5950b8000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0450371fc4c0441551Fri, 23 Aug 2019 21:51:19 GMT\"0x8D728140809AB17\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "d0582b46-9f9f-49e0-9663-1f8db4a3536e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0450371fc4c0441551?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809364-301e-0094-67fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "fa7a8098-c345-42fc-8d07-d70dd0da9080" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0450371fc4c0441551" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[4].json new file mode 100644 index 000000000000..b84727415b6a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring06464578f8b2fa9295?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281408182D6B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780937e-301e-0094-7efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "d4ae13f6-c4e0-4afc-b6d2-98378cf651ae" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809394-301e-0094-13fc-5950b8000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring06464578f8b2fa9295Fri, 23 Aug 2019 21:51:19 GMT\"0x8D7281408182D6B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "c242de72-91f2-4c9b-9f24-e63dd6ff84f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring06464578f8b2fa9295?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78093aa-301e-0094-27fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "dc104f0d-6899-4a9d-8894-df56c5ef1b86" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring06464578f8b2fa9295" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[5].json new file mode 100644 index 000000000000..d4159ade278d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring002835ff76077f7b95?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281408296F88\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78093c2-301e-0094-3efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "6075ee34-c37a-4910-a9b2-9f2b1accb43e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78093da-301e-0094-54fc-5950b8000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring002835ff76077f7b95Fri, 23 Aug 2019 21:51:19 GMT\"0x8D7281408296F88\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "61f88501-21db-4e86-8fb7-ff1568243ae7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring002835ff76077f7b95?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78093f5-301e-0094-6bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "1653f976-c1a6-4432-85aa-a3367620e21b" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring002835ff76077f7b95" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[6].json new file mode 100644 index 000000000000..953d87b965de --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring039825ac7c9a94ca71?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281408399FF2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780940d-301e-0094-02fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "37185c8b-688b-458e-b08d-1e4afd09b7de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809424-301e-0094-15fc-5950b8000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring039825ac7c9a94ca71Fri, 23 Aug 2019 21:51:19 GMT\"0x8D7281408399FF2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "a9bae751-96b7-4c52-af6b-14b0da806b97", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring039825ac7c9a94ca71?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809431-301e-0094-22fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "6cb8b0e8-54f5-479b-859f-e08b5b414ec0" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring039825ac7c9a94ca71" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[7].json new file mode 100644 index 000000000000..052fdc6c8352 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[7].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring07410442e72c603a92?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281408482241\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809449-301e-0094-39fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "f92edda8-eede-4b27-8a70-00668ae1c356" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809459-301e-0094-47fc-5950b8000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring07410442e72c603a92Fri, 23 Aug 2019 21:51:19 GMT\"0x8D7281408482241\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "ef206a2a-21e6-40af-a076-3c4a10475b98", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring07410442e72c603a92?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780946f-301e-0094-5cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "419c4b2e-ab77-42fa-bdce-e0822d83ccef" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring07410442e72c603a92" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[8].json new file mode 100644 index 000000000000..9dc5758419d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[8].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0714178ec2c5d2469f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140858A0E2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780948b-301e-0094-77fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "125df98a-584e-44ab-bf62-90b096655a50" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78094a5-301e-0094-0efc-5950b8000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0714178ec2c5d2469fFri, 23 Aug 2019 21:51:20 GMT\"0x8D728140858A0E2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "3333071f-664d-41b3-a7b8-2996107f2025", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsaspermissionstostring0714178ec2c5d2469f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78094ac-301e-0094-15fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:19 GMT", + "x-ms-client-request-id" : "3a06b7be-8bcb-4c7e-9070-28a7a5495069" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0714178ec2c5d2469f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeia.json new file mode 100644 index 000000000000..61e24ea9a597 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeia.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeia062800bb1cc0e011e342d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281409B65FEC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809adf-301e-0094-25fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "413082e0-0677-436e-bb64-14ad8dce6e13" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809af7-301e-0094-3afc-5950b8000000", + "Body" : "jtcaccountsasresourcetypeiajtcaccountsasresourcetypeia062800bb1cc0e011e342dFri, 23 Aug 2019 21:51:22 GMT\"0x8D7281409B65FEC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "94554056-1312-4c6f-9608-d2f837c24359", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeia062800bb1cc0e011e342d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809b0a-301e-0094-4bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "564aea1e-dc6c-43dd-a7fc-ac9857369c25" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeia062800bb1cc0e011e342d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[0].json new file mode 100644 index 000000000000..329c0a0a7e1c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse00323296e6de02bdf94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140968F118\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809973-301e-0094-5bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "206b26e9-60b7-4f65-87db-20fac9e5d5a8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780997f-301e-0094-66fc-5950b8000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse00323296e6de02bdf94Fri, 23 Aug 2019 21:51:21 GMT\"0x8D728140968F118\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "438f1b9f-c951-4ca8-b12e-590d587bccbc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse00323296e6de02bdf94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809991-301e-0094-74fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "035fbb8f-cc3d-4dd4-ab88-bfec6aec5970" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse00323296e6de02bdf94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[1].json new file mode 100644 index 000000000000..bdf3bf034ac9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse09155296d45e579e9a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140978FA70\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78099a7-301e-0094-0afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "a982f6c2-3a27-462c-8df7-63fd8955138f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78099f6-301e-0094-51fc-5950b8000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse09155296d45e579e9a4Fri, 23 Aug 2019 21:51:21 GMT\"0x8D728140978FA70\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "956150c9-0261-4bc1-9ad8-a9d70373cdfb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse09155296d45e579e9a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809a09-301e-0094-62fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "5b72a408-c086-4bc8-bbbc-f7446e49b1ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse09155296d45e579e9a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[2].json new file mode 100644 index 000000000000..3def0df4a8e3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse044972982d678aa9ee4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140995FF0E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809a2b-301e-0094-02fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "0e50e826-d556-4931-bc54-a67bf31c9d19" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809a44-301e-0094-19fc-5950b8000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse044972982d678aa9ee4Fri, 23 Aug 2019 21:51:22 GMT\"0x8D728140995FF0E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "7893d5e7-afe7-43db-8a81-155121d6414a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse044972982d678aa9ee4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809a61-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "883528ad-edde-41e0-97d0-f5cc813414a7" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse044972982d678aa9ee4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[3].json new file mode 100644 index 000000000000..8e43ebe64c3a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0237517860d32e242b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281409A6F2F8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809a8c-301e-0094-5bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "b134287f-b4a9-430f-8f23-0782c58f9cd5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809aa4-301e-0094-6dfc-5950b8000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse0237517860d32e242b4Fri, 23 Aug 2019 21:51:22 GMT\"0x8D7281409A6F2F8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "2a8ce4d8-8ed9-464f-883d-a07fbaa2e607", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypeparse0237517860d32e242b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809ab7-301e-0094-7ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "338b66cf-1da8-4e59-8035-872d2e5dd6d8" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse0237517860d32e242b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[0].json new file mode 100644 index 000000000000..e2de6563a952 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring046499f0ba2d428cd2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814092BB2B8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780985a-301e-0094-62fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "fad3b426-d33b-4fa3-8f9f-3592085fec42" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809877-301e-0094-7bfc-5950b8000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring046499f0ba2d428cd2Fri, 23 Aug 2019 21:51:21 GMT\"0x8D72814092BB2B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "7e3cfbc4-2884-42a1-84b9-6e134997e77c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring046499f0ba2d428cd2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809887-301e-0094-0afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "34b52c9d-a61d-438a-a676-767888d0520d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring046499f0ba2d428cd2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[1].json new file mode 100644 index 000000000000..e5618ebf3ddb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring0382631f443a977336?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814093BBC02\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780989e-301e-0094-1ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "68119d1d-2a12-4fa8-86eb-dfa702c3e06d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78098bd-301e-0094-38fc-5950b8000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring0382631f443a977336Fri, 23 Aug 2019 21:51:21 GMT\"0x8D72814093BBC02\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "dcf25780-3483-4538-a765-e2fc3b8aa053", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring0382631f443a977336?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78098d2-301e-0094-4afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "76f2f26b-e669-4861-bc4f-7f60ab633d75" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring0382631f443a977336" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[2].json new file mode 100644 index 000000000000..5b6c6a41f6c0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring014707d7bd93c2281c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814094B28EC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78098ea-301e-0094-5ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "220a559a-82b3-40cc-b32d-503131c63569" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809903-301e-0094-73fc-5950b8000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring014707d7bd93c2281cFri, 23 Aug 2019 21:51:21 GMT\"0x8D72814094B28EC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "fca0aab1-c4f4-448d-985e-c63905eddf6f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring014707d7bd93c2281c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780991b-301e-0094-0afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "77ecd7f3-7ba9-4f42-8ab1-ea8fdc2d782b" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring014707d7bd93c2281c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[3].json new file mode 100644 index 000000000000..4fe4cedf0abf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring056037a13bc2bb0750?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140959D257\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809930-301e-0094-1ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "95c6d7d4-7c25-44b9-9c5f-abf89338f49d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780994c-301e-0094-36fc-5950b8000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring056037a13bc2bb0750Fri, 23 Aug 2019 21:51:21 GMT\"0x8D728140959D257\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "390791e0-17b7-46d0-9d69-7dbde6d04964", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasresourcetypetostring056037a13bc2bb0750?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780995e-301e-0094-47fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:21 GMT", + "x-ms-client-request-id" : "5b069d51-5218-4936-8fd6-d1e6f1786392" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring056037a13bc2bb0750" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[0].json new file mode 100644 index 000000000000..1fced804793b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign08059874509b5ef70?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140754616D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808f65-301e-0094-45fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "9db2c006-9bfb-461d-b05e-c58903e0ce80" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808f84-301e-0094-62fc-5950b8000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign08059874509b5ef70Fri, 23 Aug 2019 21:51:18 GMT\"0x8D728140754616D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "57f3ade8-1537-4030-886d-09eb9d072c12", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign08059874509b5ef70?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808f93-301e-0094-71fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "f489b307-c5a3-4a86-b4ab-74e01ad2b160" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign08059874509b5ef70" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[1].json new file mode 100644 index 000000000000..8b7a08991603 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign059127d6e9f6f4393?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140762959C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808fa8-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "fb57600b-1e32-4442-a7f2-ad527a8c5db2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808fc5-301e-0094-20fc-5950b8000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign059127d6e9f6f4393Fri, 23 Aug 2019 21:51:18 GMT\"0x8D728140762959C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "c23c4dc4-8a1f-43fc-88c0-a91e28400104", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign059127d6e9f6f4393?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808fe4-301e-0094-3cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "a21938c7-fac2-4e40-a67a-df5105664d6f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign059127d6e9f6f4393" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[2].json new file mode 100644 index 000000000000..b317bad9d3f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign05802095c4f16a961?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140770C9B9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780900e-301e-0094-65fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "e43390dc-f231-4f11-8570-459cd70447f7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809032-301e-0094-06fc-5950b8000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign05802095c4f16a961Fri, 23 Aug 2019 21:51:18 GMT\"0x8D728140770C9B9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "a952746d-af5a-4e1d-a4a1-f7731de3c879", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturesstringtosign05802095c4f16a961?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780904f-301e-0094-21fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "b89f719a-5a8a-4780-a5ea-b3585889945e" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign05802095c4f16a961" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[0].json new file mode 100644 index 000000000000..20d2bfa454f1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0391040f345580fd794?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814077F9A43\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809076-301e-0094-47fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "7656927f-27f1-43ed-b026-81f6b313502b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809099-301e-0094-68fc-5950b8000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0391040f345580fd794Fri, 23 Aug 2019 21:51:18 GMT\"0x8D72814077F9A43\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "c1516463-89e2-4104-9148-d0c3b88c273b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0391040f345580fd794?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78090ad-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "8e63e61e-76ff-48a1-8bf0-2a7b8f87dbfd" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0391040f345580fd794" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[1].json new file mode 100644 index 000000000000..20603a66e4ea --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0630513b3ad130c0af4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814079018E4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78090de-301e-0094-2afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "46036262-ef97-448e-80a2-879c0ba01a80" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78090fa-301e-0094-44fc-5950b8000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0630513b3ad130c0af4Fri, 23 Aug 2019 21:51:18 GMT\"0x8D72814079018E4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "443220a2-bc7d-4702-b0eb-3e2168aff26a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0630513b3ad130c0af4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809112-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "cd08b0f5-cf15-4c19-8eb7-69ef9bc8c90e" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0630513b3ad130c0af4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[2].json new file mode 100644 index 000000000000..c1ac768e424c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0055560bd9047b2bb64?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814079F107C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809134-301e-0094-78fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "5d9c5f30-a283-4adf-b864-555b998e1b64" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809154-301e-0094-13fc-5950b8000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0055560bd9047b2bb64Fri, 23 Aug 2019 21:51:18 GMT\"0x8D72814079F107C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "b2b6d3f2-7856-47f7-8bcb-ac210eb2d4d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia0055560bd9047b2bb64?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809168-301e-0094-25fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "22cb6242-88a5-47bf-9ffc-250ec1f9f91f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0055560bd9047b2bb64" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[3].json new file mode 100644 index 000000000000..f0984e791aef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia04268835ada20a9d244?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281407AFB635\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809181-301e-0094-3cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "1182d585-c3ed-412e-b349-d20eae60e16d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809198-301e-0094-50fc-5950b8000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia04268835ada20a9d244Fri, 23 Aug 2019 21:51:18 GMT\"0x8D7281407AFB635\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "4817aef2-4870-4be9-935d-f2ca832a334e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia04268835ada20a9d244?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78091ad-301e-0094-63fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "00d64f80-c726-4fc4-a950-cb0015af5c1c" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia04268835ada20a9d244" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[4].json new file mode 100644 index 000000000000..605d3726fcd7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia03108372863e318bcd4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281407BED4ED\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78091cf-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "22a2ec01-8dcb-49d5-8a02-a9713265a382" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78091f2-301e-0094-21fc-5950b8000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia03108372863e318bcd4Fri, 23 Aug 2019 21:51:19 GMT\"0x8D7281407BED4ED\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "d4e750a8-f800-4461-a361-adcd3f7797a0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia03108372863e318bcd4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780920f-301e-0094-3afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "f43e6ac4-a93c-45f7-8c5e-10f6e8aaff0a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia03108372863e318bcd4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[5].json new file mode 100644 index 000000000000..47725dad3810 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia093039aa888f024ea84?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281407CE68F7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780922a-301e-0094-54fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "7c5777af-f310-42ed-acdb-856699d3993d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809244-301e-0094-6bfc-5950b8000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia093039aa888f024ea84Fri, 23 Aug 2019 21:51:19 GMT\"0x8D7281407CE68F7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "3900c07b-7527-477d-9f43-f5d91ae7cf20", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsassignaturevaluesia093039aa888f024ea84?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809251-301e-0094-77fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:18 GMT", + "x-ms-client-request-id" : "048bb7af-a1f1-4e3f-b0ad-ee40772e8bab" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia093039aa888f024ea84" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientgetsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientgetsnapshot.json new file mode 100644 index 000000000000..9abe0141cbce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientgetsnapshot.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot3ab58849a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814019240F7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78071ca-301e-0094-24fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "ece2b51e-8ae5-4b96-bf69-94680c544e31" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot3ab58849a/javablobblobclientgetsnapshot1780087ec5bc24cd7141", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Q7G6/s6+u/k=", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D7281401977D49\"", + "Content-Length" : "0", + "x-ms-request-id" : "f78071ea-301e-0094-42fc-5950b8000000", + "x-ms-client-request-id" : "c0c2e843-3276-48c1-a139-450735d47d1f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot3ab58849a/javablobblobclientgetsnapshot1780087ec5bc24cd7141?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:51:08.7717044Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281401977D49\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807208-301e-0094-5ffc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "ea97077b-0c51-4c1e-91b3-d6656d85854c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobclientgetsnapshot&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807245-301e-0094-16fc-5950b8000000", + "Body" : "jtcblobclientgetsnapshotjtcblobclientgetsnapshot0sastestblobclientgetsnapshot3ab58849aFri, 23 Aug 2019 21:51:08 GMT\"0x8D72814019240F7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "3a4709e6-3ab5-4698-88db-f4a5621260a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot3ab58849a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780725a-301e-0094-2afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "468ac7c2-416f-4bf0-af07-2d38d9e66749" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobclientgetsnapshot0sastestblobclientgetsnapshot3ab58849a", "javablobblobclientgetsnapshot1780087ec5bc24cd7141" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientissnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientissnapshot.json new file mode 100644 index 000000000000..68009dbdcf14 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientissnapshot.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshot47d38411a3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281401B07E79\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807281-301e-0094-4ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "4e940087-7df9-47ac-a104-253322cb658b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshot47d38411a3/javablobblobclientissnapshot144837b522f02b6c114a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Q7G6/s6+u/k=", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D7281401B5BB1A\"", + "Content-Length" : "0", + "x-ms-request-id" : "f78072a3-301e-0094-6efc-5950b8000000", + "x-ms-client-request-id" : "75cd3946-bc53-438c-9424-e75258907dcb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshot47d38411a3/javablobblobclientissnapshot144837b522f02b6c114a?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:51:08.9698950Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281401B5BB1A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78072be-301e-0094-06fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "9b956318-5910-4c58-87c5-1e4050d53b2d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobclientissnapshot&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78072d1-301e-0094-18fc-5950b8000000", + "Body" : "jtcblobclientissnapshotjtcblobclientissnapshot0sastestblobclientissnapshot47d38411a3Fri, 23 Aug 2019 21:51:08 GMT\"0x8D7281401B07E79\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "4c015b10-4858-4998-aa31-4563199d14f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshot47d38411a3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78072e3-301e-0094-2afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "41e37760-af1f-4332-afb1-4e614a6c8273" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobclientissnapshot0sastestblobclientissnapshot47d38411a3", "javablobblobclientissnapshot144837b522f02b6c114a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[0].json new file mode 100644 index 000000000000..26f86be1f7b5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrangefc143659ce1dd2ceef294?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140147439A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807071-301e-0094-74fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "daa6860c-ff68-45f9-8a67-c57a097beea0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807083-301e-0094-80fc-5950b8000000", + "Body" : "jtcblobrangejtcblobrange0sastestblobrangefc143659ce1dd2ceef294Fri, 23 Aug 2019 21:51:08 GMT\"0x8D728140147439A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "50dd0134-bab4-4d62-9882-c5644baa8dd4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrangefc143659ce1dd2ceef294?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807095-301e-0094-10fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "5ce3fad9-5a06-48cf-9f75-bde756c58822" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0sastestblobrangefc143659ce1dd2ceef294" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[1].json new file mode 100644 index 000000000000..43887827240b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrange92600703f18c5f9cc9b24?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140155C5EF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78070ac-301e-0094-27fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "0fcf48e3-329f-4365-af98-cf110a8e4da0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78070c4-301e-0094-3cfc-5950b8000000", + "Body" : "jtcblobrangejtcblobrange0sastestblobrange92600703f18c5f9cc9b24Fri, 23 Aug 2019 21:51:08 GMT\"0x8D728140155C5EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "05eff2d6-7d7b-4054-b588-14d737bd401a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrange92600703f18c5f9cc9b24?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78070d2-301e-0094-49fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "17695633-a731-4e41-9900-cd6c11c66dd9" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0sastestblobrange92600703f18c5f9cc9b24" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[2].json new file mode 100644 index 000000000000..8fa297dd94dd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrange0de7066812b51e5e4e1d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814016532F3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78070ec-301e-0094-62fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "c10918d9-6d79-4cf1-9663-d38f3c785e35" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobrange&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807104-301e-0094-77fc-5950b8000000", + "Body" : "jtcblobrangejtcblobrange0sastestblobrange0de7066812b51e5e4e1d4Fri, 23 Aug 2019 21:51:08 GMT\"0x8D72814016532F3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "8552f842-6308-47ee-88d9-6019c54091af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrange0sastestblobrange0de7066812b51e5e4e1d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807116-301e-0094-05fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "79181170-1ebd-4d58-8531-8dfd33808f36" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0sastestblobrange0de7066812b51e5e4e1d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[0].json new file mode 100644 index 000000000000..8477b6898d75 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0sastestblobrangeiab730514680a61f500d2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281401749FE4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780712d-301e-0094-18fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "6e142199-d563-4ffd-bde3-2e1df50cf4e7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobrangeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780713c-301e-0094-26fc-5950b8000000", + "Body" : "jtcblobrangeiajtcblobrangeia0sastestblobrangeiab730514680a61f500d2Fri, 23 Aug 2019 21:51:08 GMT\"0x8D7281401749FE4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "812e6114-48ab-4103-bfd7-9c5b7628c43b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0sastestblobrangeiab730514680a61f500d2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807151-301e-0094-35fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "55b448f3-20f0-4eab-8ce9-85a1b9d29b90" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0sastestblobrangeiab730514680a61f500d2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[1].json new file mode 100644 index 000000000000..4a42527d2c4e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0sastestblobrangeiac50474630f98c4a16b1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281401834954\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807173-301e-0094-54fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "d289f41b-c5bb-43c3-88ea-c78563b1a5e3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobrangeia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807188-301e-0094-67fc-5950b8000000", + "Body" : "jtcblobrangeiajtcblobrangeia0sastestblobrangeiac50474630f98c4a16b1Fri, 23 Aug 2019 21:51:08 GMT\"0x8D7281401834954\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "031b3eaa-2592-41ed-ab38-3aad348cf4e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobrangeia0sastestblobrangeiac50474630f98c4a16b1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78071a3-301e-0094-80fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "a83064ef-14aa-4c21-a4d8-a9a9ab08c06f" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0sastestblobrangeiac50474630f98c4a16b1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[0].json new file mode 100644 index 000000000000..19f4bf5395ff --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse08733477fc71be605045f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281404BA55F4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78082ba-301e-0094-12fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "484e46f7-70e4-4ef8-bfcc-32114b0121ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78082d4-301e-0094-29fc-5950b8000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse08733477fc71be605045fFri, 23 Aug 2019 21:51:13 GMT\"0x8D7281404BA55F4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "9f61d18c-ed0e-4bf1-89e4-68f0033ef220", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse08733477fc71be605045f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78082f5-301e-0094-48fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "3a446550-27de-4a8d-bbd2-38c08e886dce" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse08733477fc71be605045f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[1].json new file mode 100644 index 000000000000..55a850a66849 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0938627dbb05178e0943d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281404CAD48C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780831a-301e-0094-63fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "6322df5f-c3ba-4a68-be7e-2b42103d1531" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808390-301e-0094-42fc-5950b8000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0938627dbb05178e0943dFri, 23 Aug 2019 21:51:14 GMT\"0x8D7281404CAD48C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "f6f0f80e-3599-4ff3-8555-ac1ab29293fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0938627dbb05178e0943d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78083a6-301e-0094-56fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "95d7e3ed-a512-49af-9083-58e3095feb10" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0938627dbb05178e0943d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[2].json new file mode 100644 index 000000000000..fa92268e345c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse02576651259c277314467?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281404ED0A8E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78083bd-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "6f987a51-77a4-47c3-8b45-304b81b50b8e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78083cf-301e-0094-7efc-5950b8000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse02576651259c277314467Fri, 23 Aug 2019 21:51:14 GMT\"0x8D7281404ED0A8E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "ee2ea0fe-7b21-4058-a368-ff6bc1a98867", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse02576651259c277314467?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78083e2-301e-0094-11fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "edfe137b-5caa-4a1c-8c73-cbf0b1f3a617" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse02576651259c277314467" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[3].json new file mode 100644 index 000000000000..79d26734f1e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse02176877e03c7258a6458?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814050A0F3A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808428-301e-0094-4efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "ed69de98-1fcd-4eae-ab05-8d55e17bc2b0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780845f-301e-0094-78fc-5950b8000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse02176877e03c7258a6458Fri, 23 Aug 2019 21:51:14 GMT\"0x8D72814050A0F3A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "a037acd4-6b02-45a1-ae95-9978a7d5e6b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse02176877e03c7258a6458?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808473-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "ea0b8601-5f5a-4dca-8f90-d4aba787457f" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse02176877e03c7258a6458" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[4].json new file mode 100644 index 000000000000..f2e44f5e0155 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse003080f6dacb7263364b0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140528C1F8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78084d5-301e-0094-63fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "253f73d5-18bd-4243-8ac7-2204b0b6b991" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78084ed-301e-0094-77fc-5950b8000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse003080f6dacb7263364b0Fri, 23 Aug 2019 21:51:14 GMT\"0x8D728140528C1F8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "bf3a4e06-8bed-40f8-a1f6-cb487cdcf21b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse003080f6dacb7263364b0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78084fe-301e-0094-06fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "61060476-1c62-442e-a3a1-8d22f8f1789a" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse003080f6dacb7263364b0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[5].json new file mode 100644 index 000000000000..5fbaa6a91c53 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0233871cc49a83641f447?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140537444B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808513-301e-0094-17fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "fbc34666-0e69-405b-bb8c-f18bf5da5240" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808529-301e-0094-2afc-5950b8000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0233871cc49a83641f447Fri, 23 Aug 2019 21:51:14 GMT\"0x8D728140537444B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "4d756185-b698-48da-9488-59958f62865a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0233871cc49a83641f447?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808538-301e-0094-35fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "ccb1758a-6bc1-49b2-a2ad-27ebdb624bef" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0233871cc49a83641f447" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[6].json new file mode 100644 index 000000000000..f741d3cc802d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0686899d074a0cfeda433?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281405474DA3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808548-301e-0094-44fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "259c804d-1c5a-4480-bc53-fff1328af68a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808564-301e-0094-5efc-5950b8000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0686899d074a0cfeda433Fri, 23 Aug 2019 21:51:14 GMT\"0x8D7281405474DA3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "d17bede9-65b4-45d3-b0d3-fd749081ad6d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparse0686899d074a0cfeda433?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808579-301e-0094-71fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "ff4268e0-9de8-47b5-84f2-fca7415389f9" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0686899d074a0cfeda433" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparseia.json new file mode 100644 index 000000000000..90ceef25e370 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparseia.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparseia095152344c801f10ad44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814055756EE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78085a1-301e-0094-13fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "e6012fdd-7fbe-4150-88a9-c3e15295f607" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionsparseia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78085f9-301e-0094-64fc-5950b8000000", + "Body" : "jtcblobsaspermissionsparseiajtcblobsaspermissionsparseia095152344c801f10ad44Fri, 23 Aug 2019 21:51:15 GMT\"0x8D72814055756EE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "5a50408e-54e7-4b34-b948-73c276cd38e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionsparseia095152344c801f10ad44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808602-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "3fce7a03-ad73-4cf3-aa90-b64ca490eeb8" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparseia095152344c801f10ad44" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[0].json new file mode 100644 index 000000000000..38d1560d5892 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0802828bc23ad7af2440?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814045E64C8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78080eb-301e-0094-80fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "e289497c-9eb3-41fe-b8f3-3f8f09aa0e0e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78080fa-301e-0094-0dfc-5950b8000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring0802828bc23ad7af2440Fri, 23 Aug 2019 21:51:13 GMT\"0x8D72814045E64C8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "c743ce59-c11d-4092-a776-da0ae80f883c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0802828bc23ad7af2440?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780810c-301e-0094-1efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "a4383762-f4de-47ea-a286-92eca1f89c0b" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring0802828bc23ad7af2440" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[1].json new file mode 100644 index 000000000000..97aa22b6b1f9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring066105c10f2a6c425646?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814046F7FC4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808134-301e-0094-45fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "7163a804-674a-4610-b012-b15dc0a47629" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780814b-301e-0094-56fc-5950b8000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring066105c10f2a6c425646Fri, 23 Aug 2019 21:51:13 GMT\"0x8D72814046F7FC4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "e105c1f2-ded7-4466-8fe4-5ced58548ab3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring066105c10f2a6c425646?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808165-301e-0094-6bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "69efbf4f-d4e9-42da-8dfa-c1378e8b4fd8" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring066105c10f2a6c425646" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[2].json new file mode 100644 index 000000000000..90f3d68e9bde --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring097336591a04e3c17640?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814047DDB0A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780817f-301e-0094-80fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "d480d999-d3fa-45cb-88b4-bb131808f885" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808192-301e-0094-10fc-5950b8000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring097336591a04e3c17640Fri, 23 Aug 2019 21:51:13 GMT\"0x8D72814047DDB0A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "f5b5d8cf-c85f-4030-ba0b-2f066219d931", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring097336591a04e3c17640?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78081a4-301e-0094-1ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "57167c0e-f6ba-477f-92bd-74518b808223" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring097336591a04e3c17640" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[3].json new file mode 100644 index 000000000000..dfb7d438c6e9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0119800809cf22eabe41?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814048C8479\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78081cd-301e-0094-41fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "79b13a6d-1a0e-4ccc-ba5e-b7900f89a727" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78081f7-301e-0094-63fc-5950b8000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring0119800809cf22eabe41Fri, 23 Aug 2019 21:51:13 GMT\"0x8D72814048C8479\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "d3452752-3070-4d31-8677-ee3132f541bd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring0119800809cf22eabe41?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808206-301e-0094-72fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "f8525207-2c7a-4f41-9178-1010e8d8a356" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring0119800809cf22eabe41" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[4].json new file mode 100644 index 000000000000..11048af6073c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring00268038853e9eeac740?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814049B2DDF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808222-301e-0094-0cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "e000bacc-45b7-4361-b5db-dad45dc27d8b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808237-301e-0094-1cfc-5950b8000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring00268038853e9eeac740Fri, 23 Aug 2019 21:51:13 GMT\"0x8D72814049B2DDF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "7b705fbe-df93-4bf8-8986-e9a35142f0c3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring00268038853e9eeac740?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808243-301e-0094-28fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "364c5a58-89d1-453c-8090-8a46fa326b8d" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring00268038853e9eeac740" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[5].json new file mode 100644 index 000000000000..667d3a7b0ed5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring032967c3ae5e03afc142?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281404AA2580\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808261-301e-0094-43fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "76f0e4cc-9599-498b-b87d-2fe550aa2ab7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780827f-301e-0094-5efc-5950b8000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring032967c3ae5e03afc142Fri, 23 Aug 2019 21:51:13 GMT\"0x8D7281404AA2580\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "e0668a87-09b7-401a-be23-52eae8ac2570", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobsaspermissionstostring032967c3ae5e03afc142?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808291-301e-0094-6ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:13 GMT", + "x-ms-client-request-id" : "58da562c-cca9-4e75-ba4c-42417f2003c2" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring032967c3ae5e03afc142" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestbloburlparts.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestbloburlparts.json new file mode 100644 index 000000000000..3932f5fdcda3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestbloburlparts.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbloburlparts0sastestbloburlpartsb511862717896a28bf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281409C50951\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809b28-301e-0094-65fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "315271fc-2b4d-4a7e-9bdc-c8278f8e6ddf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcbloburlparts&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809b43-301e-0094-7efc-5950b8000000", + "Body" : "jtcbloburlpartsjtcbloburlparts0sastestbloburlpartsb511862717896a28bfFri, 23 Aug 2019 21:51:22 GMT\"0x8D7281409C50951\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "0f56a486-2e15-4998-a6da-83c6c14deafc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcbloburlparts0sastestbloburlpartsb511862717896a28bf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809b53-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "85145e7f-b9fe-4993-b810-717a1fb0fb99" + }, + "Exception" : null + } ], + "variables" : [ "jtcbloburlparts0sastestbloburlpartsb511862717896a28bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[0].json new file mode 100644 index 000000000000..93e5121778d9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse076067fd28c5e0d0fe4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281405DF4462\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780884c-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "75231733-4ea3-4021-9c9b-30cdcd4b7b43" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780885b-301e-0094-04fc-5950b8000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse076067fd28c5e0d0fe4Fri, 23 Aug 2019 21:51:15 GMT\"0x8D7281405DF4462\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "4fd40059-3ac0-41fc-8487-ac26f1a7b84c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse076067fd28c5e0d0fe4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780886f-301e-0094-14fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "1d274daf-5844-419f-8d7b-baecb58c1495" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse076067fd28c5e0d0fe4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[1].json new file mode 100644 index 000000000000..802fe8a83a09 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse042429606f945a73b74?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281405EEB155\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808888-301e-0094-2bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "6410d35a-1ec2-49d3-a6ac-c35d9f892121" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780889c-301e-0094-3bfc-5950b8000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse042429606f945a73b74Fri, 23 Aug 2019 21:51:16 GMT\"0x8D7281405EEB155\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "6d3ab3ad-3b42-46c2-b23e-b024344c9bac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse042429606f945a73b74?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78088b1-301e-0094-4ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "7609f0b4-244d-430e-b7dc-2e9b8afcb217" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse042429606f945a73b74" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[2].json new file mode 100644 index 000000000000..8902fc866c2e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse075769464fd43cf9dd4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140600DE04\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78088d7-301e-0094-6cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "de205560-f37f-4d11-be15-8424c704aefb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78088f2-301e-0094-03fc-5950b8000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse075769464fd43cf9dd4Fri, 23 Aug 2019 21:51:16 GMT\"0x8D728140600DE04\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "33a29f29-fb45-43a7-975b-982baad6ade7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse075769464fd43cf9dd4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808903-301e-0094-14fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "9c3c3df1-077d-4022-8a9a-2e27ad08ab22" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse075769464fd43cf9dd4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[3].json new file mode 100644 index 000000000000..4ac71666ce00 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0146326160880ec60a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814060FFCB8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808927-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "11ba8711-4990-438f-a9b0-ba3a77bd0ee8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808941-301e-0094-49fc-5950b8000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0146326160880ec60a4Fri, 23 Aug 2019 21:51:16 GMT\"0x8D72814060FFCB8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "9fe79f1d-d821-4856-b320-a7a34837137e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0146326160880ec60a4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808950-301e-0094-56fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "7f8233d1-9aa3-4a39-bd39-d875e4939489" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0146326160880ec60a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[4].json new file mode 100644 index 000000000000..32953e2af03b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse076527041260e7b7e64?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814061E30E7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780896c-301e-0094-70fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "36eb8edf-2ba3-49ae-8f70-ef80853f49b6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808981-301e-0094-02fc-5950b8000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse076527041260e7b7e64Fri, 23 Aug 2019 21:51:16 GMT\"0x8D72814061E30E7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "9eb9e861-a6bd-4bd1-aa0f-d74cf0e3dacd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse076527041260e7b7e64?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808995-301e-0094-14fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "08703703-79d2-45ff-8761-9a0d3f25e54b" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse076527041260e7b7e64" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[5].json new file mode 100644 index 000000000000..2729c2b76613 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse084853615246dee1884?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814062C8C1F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78089b0-301e-0094-2efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "68a94911-05f9-48ec-ab5e-901361cd9e12" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78089c9-301e-0094-41fc-5950b8000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse084853615246dee1884Fri, 23 Aug 2019 21:51:16 GMT\"0x8D72814062C8C1F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "43dda32a-171a-4103-a162-b60d0066fb2c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse084853615246dee1884?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78089e2-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "12e1ddb8-8dca-41d8-8777-d2d1e1258de9" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse084853615246dee1884" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[6].json new file mode 100644 index 000000000000..8adc2f5446fa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse080797fe8fb4e517f44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814063D31DC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808a01-301e-0094-74fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "488ec6f9-13d6-414b-aa2a-b49a0e393dcc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808a1f-301e-0094-0efc-5950b8000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse080797fe8fb4e517f44Fri, 23 Aug 2019 21:51:16 GMT\"0x8D72814063D31DC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "bd0d245d-d5b4-4fbe-b189-3cd4323a6f98", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse080797fe8fb4e517f44?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808a37-301e-0094-25fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "df5da507-92b8-4ea6-b40f-55ec73725bc5" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse080797fe8fb4e517f44" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[7].json new file mode 100644 index 000000000000..bee202d2ac08 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[7].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0636345efd68ee12184?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281406588875\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808a95-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "c0fd0843-04e8-4830-8b84-303e9192afe4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808ab2-301e-0094-12fc-5950b8000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0636345efd68ee12184Fri, 23 Aug 2019 21:51:16 GMT\"0x8D7281406588875\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "cfb14822-6cec-4b00-b57b-495ed2ab077d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparse0636345efd68ee12184?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808ac3-301e-0094-21fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "7e575e8c-8422-421e-91b4-48644a93d561" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0636345efd68ee12184" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparseia.json new file mode 100644 index 000000000000..879982699759 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparseia.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparseia08137495ee314d8d91?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140666E3A8\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808adb-301e-0094-38fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "960502d2-51f5-40b8-8998-f4d614d17c4a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionsparseia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808aef-301e-0094-49fc-5950b8000000", + "Body" : "jtccontainersaspermissionsparseiajtccontainersaspermissionsparseia08137495ee314d8d91Fri, 23 Aug 2019 21:51:16 GMT\"0x8D728140666E3A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "81ee7dd2-38f5-401f-a319-ba7e98569821", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionsparseia08137495ee314d8d91?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808b06-301e-0094-60fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "c233b1de-c0fc-47ef-9e1d-ff92aa971200" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparseia08137495ee314d8d91" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[0].json new file mode 100644 index 000000000000..90e676ade35f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring06429765a4d83be54?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140572AD95\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808622-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "45df0fe0-e74a-4873-8792-0bd9827c23d2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780863a-301e-0094-22fc-5950b8000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring06429765a4d83be54Fri, 23 Aug 2019 21:51:15 GMT\"0x8D728140572AD95\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "5594ae9b-a1f2-40a6-b276-4ef8580ff890", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring06429765a4d83be54?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780864c-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "64d45dca-c69a-4d6a-952e-30335278dfea" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring06429765a4d83be54" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[1].json new file mode 100644 index 000000000000..2dc17e6c1d13 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring03631064ce5479cd8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814058108C3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808660-301e-0094-48fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "ddd66734-f7e8-4e35-a5c9-51fe49705977" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808679-301e-0094-5cfc-5950b8000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring03631064ce5479cd8Fri, 23 Aug 2019 21:51:15 GMT\"0x8D72814058108C3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "0e2954d3-511b-4caf-9463-43d57fada449", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring03631064ce5479cd8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808696-301e-0094-78fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "6c129ed3-094a-4a91-819c-5030e5906a5f" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring03631064ce5479cd8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[2].json new file mode 100644 index 000000000000..618d91e2e6a7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0499635d3d76ca082?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281405900069\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78086b3-301e-0094-13fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "7a95e783-a41a-4712-9ff3-292b63fbb936" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78086d0-301e-0094-2dfc-5950b8000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0499635d3d76ca082Fri, 23 Aug 2019 21:51:15 GMT\"0x8D7281405900069\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:14 GMT", + "x-ms-client-request-id" : "50ee00e8-7c00-4fa4-a055-01f29c43720c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0499635d3d76ca082?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78086ed-301e-0094-45fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "f8be6a85-192a-40cf-8715-b3f0c841fc3b" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0499635d3d76ca082" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[3].json new file mode 100644 index 000000000000..85c375d8d347 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0678103d4a1a1914a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814059FE29D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780870f-301e-0094-62fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "02d3fe8d-8713-4020-8e0f-0f061f6ff8cf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808725-301e-0094-75fc-5950b8000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0678103d4a1a1914aFri, 23 Aug 2019 21:51:15 GMT\"0x8D72814059FE29D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "547dced0-c3b3-496e-b5a1-ec78a1790c7f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0678103d4a1a1914a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808732-301e-0094-02fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "e8f5cc2f-855e-463b-9dda-86af56afc0e1" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0678103d4a1a1914a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[4].json new file mode 100644 index 000000000000..23a6be118436 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring096078f6109b468dd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281405AE16C2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780874e-301e-0094-19fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "2d8d31d6-480e-464f-9f1c-dc342c61a590" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808766-301e-0094-2efc-5950b8000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring096078f6109b468ddFri, 23 Aug 2019 21:51:15 GMT\"0x8D7281405AE16C2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "5010eec8-1c37-43e0-af31-9d68e3d24c6d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring096078f6109b468dd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808771-301e-0094-39fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "3839972c-936d-4b1c-9b21-194ce28eb615" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring096078f6109b468dd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[5].json new file mode 100644 index 000000000000..905b18ca8986 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0403295a4a707ebc7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281405BC4AED\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808790-301e-0094-55fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "f5aed9c0-d190-47e9-8bf3-c420e885b7a4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78087ad-301e-0094-6ffc-5950b8000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0403295a4a707ebc7Fri, 23 Aug 2019 21:51:15 GMT\"0x8D7281405BC4AED\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "3a2550bd-685c-430a-a7c7-c1909de7799f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring0403295a4a707ebc7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78087c0-301e-0094-7ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "e6772f8b-e8c0-4ecc-9ab8-9daaf985d194" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0403295a4a707ebc7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[6].json new file mode 100644 index 000000000000..95df3c99beda --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring04833370feebbdc70?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281405CEECEA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78087f9-301e-0094-2ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "f6841d98-af20-48e5-a516-d0bfbe597734" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780881a-301e-0094-4cfc-5950b8000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring04833370feebbdc70Fri, 23 Aug 2019 21:51:15 GMT\"0x8D7281405CEECEA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "da3929c1-1c53-40f3-a4e8-91d90c8f38fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtccontainersaspermissionstostring04833370feebbdc70?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780882f-301e-0094-5dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:15 GMT", + "x-ms-client-request-id" : "76c1f62a-930b-4f1c-82ea-64bc795e48cc" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring04833370feebbdc70" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[0].json new file mode 100644 index 000000000000..a67ab1cec4d6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparse93901923103fb7667f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281406A3FAFF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808c14-301e-0094-4afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "376c38d7-6f0f-4cea-9d8c-101718507a44" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808c2e-301e-0094-61fc-5950b8000000", + "Body" : "jtciprangeparsejtciprangeparse0sastestiprangeparse93901923103fb7667fFri, 23 Aug 2019 21:51:17 GMT\"0x8D7281406A3FAFF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "f287603a-ae21-46d6-85bd-9684a362d12c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparse93901923103fb7667f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808c37-301e-0094-69fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "97b0359a-e1ac-4d35-b2e2-2042757d0442" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0sastestiprangeparse93901923103fb7667f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[1].json new file mode 100644 index 000000000000..01d13bf41b88 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparseb613467552082c76fd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281406B38EFC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808c4a-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "fa44569c-9daa-4860-8b19-e03b49958ae5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808c6b-301e-0094-17fc-5950b8000000", + "Body" : "jtciprangeparsejtciprangeparse0sastestiprangeparseb613467552082c76fdFri, 23 Aug 2019 21:51:17 GMT\"0x8D7281406B38EFC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "089a68fe-7f0f-4159-918d-1be93617c0db", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparseb613467552082c76fd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808c80-301e-0094-2cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "3fb5e126-f665-429f-bb7e-714db1826a96" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0sastestiprangeparseb613467552082c76fd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[2].json new file mode 100644 index 000000000000..36b9d81e26c4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparsec4109122476d043c0e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281406C23866\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808c9a-301e-0094-43fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "a8234175-5613-46d4-8288-010187c5fa79" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangeparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808cb1-301e-0094-54fc-5950b8000000", + "Body" : "jtciprangeparsejtciprangeparse0sastestiprangeparsec4109122476d043c0eFri, 23 Aug 2019 21:51:17 GMT\"0x8D7281406C23866\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "6405fc92-d54e-493c-aaba-79ac0ac2bdb9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangeparse0sastestiprangeparsec4109122476d043c0e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808cbe-301e-0094-61fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "d029d001-be1e-4dc1-aa14-158fd8f54216" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0sastestiprangeparsec4109122476d043c0e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[0].json new file mode 100644 index 000000000000..456b94eda671 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostringece871124860922?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814067873F7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808b39-301e-0094-09fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "b9910643-67f8-47f7-acab-cf68edb50384" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808b52-301e-0094-1dfc-5950b8000000", + "Body" : "jtciprangetostringjtciprangetostring0sastestiprangetostringece871124860922Fri, 23 Aug 2019 21:51:16 GMT\"0x8D72814067873F7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "b18bef59-3015-40d6-9ce9-81879519d15a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostringece871124860922?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808b70-301e-0094-39fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "b9fd5ce0-13b2-48d4-815c-d4787f191df0" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0sastestiprangetostringece871124860922" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[1].json new file mode 100644 index 000000000000..e18ad9c30096 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostring5c215188a918de1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140686CF3D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808b97-301e-0094-58fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "33ff7bfc-c4de-476c-8aad-4780b58890e2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808bb0-301e-0094-6ffc-5950b8000000", + "Body" : "jtciprangetostringjtciprangetostring0sastestiprangetostring5c215188a918de1Fri, 23 Aug 2019 21:51:17 GMT\"0x8D728140686CF3D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "8daa9dc5-b329-4015-bf72-8428d6160af5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostring5c215188a918de1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808bc4-301e-0094-01fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "ede0e7cc-6032-46f0-9dec-a3523e616a71" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0sastestiprangetostring5c215188a918de1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[2].json new file mode 100644 index 000000000000..132cf11b30db --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostring40f987541fbdddf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281406959FB9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808be2-301e-0094-1cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "15659d4d-acfd-4035-b2b1-f303980c7f6a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtciprangetostring&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808bfb-301e-0094-33fc-5950b8000000", + "Body" : "jtciprangetostringjtciprangetostring0sastestiprangetostring40f987541fbdddfFri, 23 Aug 2019 21:51:17 GMT\"0x8D7281406959FB9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "30828354-0e7a-4a74-81fd-da895c638ad3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtciprangetostring0sastestiprangetostring40f987541fbdddf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808c08-301e-0094-40fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:16 GMT", + "x-ms-client-request-id" : "7e18bcdd-1c79-4a52-9737-dfeced1f6f31" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0sastestiprangetostring40f987541fbdddf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestrequestproperty.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestrequestproperty.json new file mode 100644 index 000000000000..f42c8268a46c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestrequestproperty.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrequestproperty0sastestrequestpropertyabb887312b53de4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281401384BF3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807039-301e-0094-41fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "498d1629-2e40-40a2-8586-4ffb45af4564" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcrequestproperty0sastestrequestpropertyabb887312b53de4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807050-301e-0094-56fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "bd8b681b-905d-4613-b593-362d0fecd913" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcrequestproperty&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807060-301e-0094-64fc-5950b8000000", + "Body" : "jtcrequestproperty", + "Date" : "Fri, 23 Aug 2019 21:51:07 GMT", + "x-ms-client-request-id" : "99a64c4d-076e-4ef7-aba2-68e8da22c249", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcrequestproperty0sastestrequestpropertyabb887312b53de4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[0].json new file mode 100644 index 000000000000..5e8de0e20e2a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparse1de11852779ee9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281406D48C3A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808ce5-301e-0094-04fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "84333cc7-3fe9-46b4-a3c7-826195ca21fe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsasprotocolparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808cf6-301e-0094-13fc-5950b8000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0sastestsasprotocolparse1de11852779ee9Fri, 23 Aug 2019 21:51:17 GMT\"0x8D7281406D48C3A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "5b3a3e6f-e1ac-4b0f-8a75-eebba0af52ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparse1de11852779ee9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808d05-301e-0094-1ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "ed76a97c-7d58-4831-b89e-248f564fe955" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0sastestsasprotocolparse1de11852779ee9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[1].json new file mode 100644 index 000000000000..343d3fbe2bd1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparse01a9386116631e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281406E70717\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808d0e-301e-0094-28fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "8db4ba0a-3280-4f3c-904a-4926b39989a1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsasprotocolparse&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808d30-301e-0094-40fc-5950b8000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0sastestsasprotocolparse01a9386116631eFri, 23 Aug 2019 21:51:17 GMT\"0x8D7281406E70717\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "fb58e988-a740-4d58-bdc1-2ed8e4deaaed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparse01a9386116631e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808d3e-301e-0094-4dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "8d83a951-96e6-49ec-989d-c30c87165ca3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0sastestsasprotocolparse01a9386116631e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[0].json new file mode 100644 index 000000000000..c9ebc395773f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign010347a233e14f1d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814028B3342\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807702-301e-0094-77fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "68a4bc2f-a158-4f11-9bc8-900d50b16f37" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780771b-301e-0094-0efc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign010347a233e14f1d4Fri, 23 Aug 2019 21:51:10 GMT\"0x8D72814028B3342\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "2d4fdd0a-af16-49c8-a4dc-e84188db6f75", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign010347a233e14f1d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780772e-301e-0094-1ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "625300bf-2499-4918-8a58-de2690f323d4" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign010347a233e14f1d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[1].json new file mode 100644 index 000000000000..5ebaeccc0193 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign065337a9202e29755?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814029A790D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807748-301e-0094-35fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "5ed48358-cbd4-45d9-b48c-f29a790863a9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780775c-301e-0094-46fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign065337a9202e29755Fri, 23 Aug 2019 21:51:10 GMT\"0x8D72814029A790D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "90c43a37-d548-45f0-9fbb-c35cff938e50", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign065337a9202e29755?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807771-301e-0094-5afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "a905706d-48b5-4e60-a973-ca4ff2fd0aa8" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign065337a9202e29755" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[2].json new file mode 100644 index 000000000000..2df58cf778c3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign034354955c070cab6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281402AB45E0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78077a7-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "c15a269f-ac34-4782-8b9f-9530686a3832" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78077c4-301e-0094-23fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign034354955c070cab6Fri, 23 Aug 2019 21:51:10 GMT\"0x8D7281402AB45E0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "589e8c61-3e3a-425d-a590-30e41f92a1bf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign034354955c070cab6?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78077d9-301e-0094-37fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "94824516-e8c1-4046-8b4f-4f284e780a6d" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign034354955c070cab6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[3].json new file mode 100644 index 000000000000..de221d762795 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign065499d4073aa252d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281402B9EF46\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78077fb-301e-0094-55fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "c4127a3d-ddb6-4f75-b707-1b355bdd71d1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780780a-301e-0094-61fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign065499d4073aa252dFri, 23 Aug 2019 21:51:10 GMT\"0x8D7281402B9EF46\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "59516b19-bc31-40b2-afe4-7874f202d819", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign065499d4073aa252d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807821-301e-0094-73fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "818bf333-6bdb-4d38-9435-2f54a5014a59" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign065499d4073aa252d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[4].json new file mode 100644 index 000000000000..a2601946326b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign020493d8cb2626eff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281402C8BFCC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807838-301e-0094-0afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "317ae28d-c355-4b40-ac6f-1fa727f3a31b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780785d-301e-0094-28fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign020493d8cb2626effFri, 23 Aug 2019 21:51:10 GMT\"0x8D7281402C8BFCC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "91cf849e-b9b9-461c-a018-6fa8cd12a75d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign020493d8cb2626eff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807877-301e-0094-3dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "7a7b623b-b60f-4e57-b796-dfd9a6e1d205" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign020493d8cb2626eff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[5].json new file mode 100644 index 000000000000..8a50268f8bbf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0356082593da4c445?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281402D7B76D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78078a1-301e-0094-64fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "2509a287-054d-4768-8f48-01ac4aa335d3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78078c1-301e-0094-03fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0356082593da4c445Fri, 23 Aug 2019 21:51:10 GMT\"0x8D7281402D7B76D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "9f1ac7d6-7521-463c-9a99-f405d0876049", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0356082593da4c445?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78078d3-301e-0094-14fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "1ad68f0c-e847-4633-8a74-437d0b230662" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0356082593da4c445" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[6].json new file mode 100644 index 000000000000..6ca709c1558e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign098352bc7a552699f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281402E660DC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78078e9-301e-0094-27fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "5bd7d679-fad1-4118-aa42-0d8619b8c82a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807906-301e-0094-3ffc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign098352bc7a552699fFri, 23 Aug 2019 21:51:10 GMT\"0x8D7281402E660DC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "05bed39d-a74b-4894-b79a-76a4da5c3210", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign098352bc7a552699f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807923-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "597ef734-a662-4eef-a602-673ae1e75188" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign098352bc7a552699f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[7].json new file mode 100644 index 000000000000..00e57ba17619 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[7].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign00825251250801a57?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281402F49501\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780793d-301e-0094-71fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "3de77da0-533d-4896-a080-6bf2dcfd773b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807952-301e-0094-04fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign00825251250801a57Fri, 23 Aug 2019 21:51:11 GMT\"0x8D7281402F49501\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "2d576d3a-c5e5-4aee-8250-9440debcaea8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign00825251250801a57?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780796f-301e-0094-1ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "2ad261da-0b35-4f94-b4dd-106da90a9d70" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign00825251250801a57" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[8].json new file mode 100644 index 000000000000..ce281fbce5ba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[8].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign020477bf91312b51b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281403049E55\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807994-301e-0094-42fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "b219ee69-4261-4a7a-bb94-cfc5a18da65e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807a06-301e-0094-2bfc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign020477bf91312b51bFri, 23 Aug 2019 21:51:11 GMT\"0x8D7281403049E55\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "610c71f1-d426-44e1-a0ea-1ab422892d8d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign020477bf91312b51b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807a20-301e-0094-43fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "9efe5880-3708-4cb0-a627-7036db718844" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign020477bf91312b51b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[9].json new file mode 100644 index 000000000000..8705fd316695 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[9].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0899539991fdea6d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814031E46D2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807a40-301e-0094-5efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "ba4671aa-3142-4a11-bd4c-e9495900192e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807a5f-301e-0094-70fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0899539991fdea6d4Fri, 23 Aug 2019 21:51:11 GMT\"0x8D72814031E46D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "27234407-ea44-4141-9c31-9ea201ed7d13", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosign0899539991fdea6d4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807a77-301e-0094-03fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "e38e7172-3bae-42dd-a7eb-6a17cb54a6a6" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0899539991fdea6d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[0].json new file mode 100644 index 000000000000..b2dfc0c77759 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0625585a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814032E290F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807a98-301e-0094-1bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:10 GMT", + "x-ms-client-request-id" : "3daa1841-c7d1-45de-ae49-a0d23721574c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807aad-301e-0094-29fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0625585aFri, 23 Aug 2019 21:51:11 GMT\"0x8D72814032E290F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "6a54f0ae-5b81-4e4b-b27f-0697324af00f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0625585a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807ac6-301e-0094-3efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "7eeb13b7-1e71-4024-aaba-cc53b1bdfbc7" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0625585a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[10].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[10].json new file mode 100644 index 000000000000..c3768e7591cb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[10].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey033174d2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281403E064BE\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807e71-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "060d2c05-13dd-4f62-8bb7-037caffb461f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807e93-301e-0094-77fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey033174d2Fri, 23 Aug 2019 21:51:12 GMT\"0x8D7281403E064BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "c5553b0c-2786-4898-a832-fb49e8db26c9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey033174d2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807eaa-301e-0094-0efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "ee1da366-695d-49c9-bdc0-c8b025ce879d" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey033174d2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[11].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[11].json new file mode 100644 index 000000000000..2c779f911078 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[11].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04544550?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281403EF5C55\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807eca-301e-0094-2bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "f9934dd9-4987-419e-abdc-98c9cc587038" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807ee7-301e-0094-43fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey04544550Fri, 23 Aug 2019 21:51:12 GMT\"0x8D7281403EF5C55\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "e3a008be-8944-472d-b3ab-cee38a9fb359", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04544550?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807efa-301e-0094-53fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "967ec1cf-8814-4d90-a6e5-62e9ffc762ea" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey04544550" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[12].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[12].json new file mode 100644 index 000000000000..58f3bb0bd64a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[12].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0967824e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140400020E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807f1b-301e-0094-6ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "7c86fde7-12ad-47e3-a0ff-1da24868dfd1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807f31-301e-0094-7ffc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0967824eFri, 23 Aug 2019 21:51:12 GMT\"0x8D728140400020E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "bc5a0736-7921-446a-960c-6ed8c36ed350", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0967824e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807f45-301e-0094-11fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "23f03733-fbbb-4b04-9f85-b7a75187f2fd" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0967824e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[13].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[13].json new file mode 100644 index 000000000000..9d4be0dbf007 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[13].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey066377bc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814041080AA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807f58-301e-0094-24fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "4a1b6bfc-1e1d-4d04-82f8-c7c020157303" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807f66-301e-0094-31fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey066377bcFri, 23 Aug 2019 21:51:12 GMT\"0x8D72814041080AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "131f9c61-e8a1-4d3f-ba50-a850c6316ffa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey066377bc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807f70-301e-0094-3bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "1f0a1a2b-35f0-402a-acef-498f3b7b1b96" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey066377bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[14].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[14].json new file mode 100644 index 000000000000..16c117904da1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[14].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05401474?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814041FED90\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807f90-301e-0094-56fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "581e75ed-eff3-44e5-ad73-8e30b46979d2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807fa0-301e-0094-64fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey05401474Fri, 23 Aug 2019 21:51:12 GMT\"0x8D72814041FED90\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "4849c670-79ac-4879-9ded-483611c89b4a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05401474?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807fb9-301e-0094-77fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "b34fabaf-46c3-463c-832c-82bf412873ca" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey05401474" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[1].json new file mode 100644 index 000000000000..109804b31d3b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05819493?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814033D95FA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807aee-301e-0094-62fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "6da60493-9d6e-4958-8b17-1fe2ac6b51a0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807b55-301e-0094-40fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey05819493Fri, 23 Aug 2019 21:51:11 GMT\"0x8D72814033D95FA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "ea95b774-4c6c-4fbc-96cd-0da88d4743fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05819493?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807b6c-301e-0094-51fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "f9c51e1b-069a-44fc-9e29-04bd542a5ecf" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey05819493" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[2].json new file mode 100644 index 000000000000..9e87d77342fc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey065901cd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814035CE51C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807b8d-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "b573381c-7a88-4293-86f7-4fc5e065a010" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807ba1-301e-0094-7cfc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey065901cdFri, 23 Aug 2019 21:51:11 GMT\"0x8D72814035CE51C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "45a63be7-21be-42c4-af09-79843f2a40e5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey065901cd?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807bbd-301e-0094-13fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "87570da9-0a8d-43d5-b9c0-6871d0971f05" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey065901cd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[3].json new file mode 100644 index 000000000000..81e5afa1beaf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey010417a5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814036C7922\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807bd6-301e-0094-2bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "347e850c-e3d6-4a1b-9dc6-db7ad5fb2546" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807beb-301e-0094-3dfc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey010417a5Fri, 23 Aug 2019 21:51:11 GMT\"0x8D72814036C7922\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "d84d0a47-e5a4-43d0-99a6-4c8b7d0282ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey010417a5?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807c06-301e-0094-51fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "8e1bf1aa-8f01-466b-8f44-7f784a6dea77" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey010417a5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[4].json new file mode 100644 index 000000000000..ec0705ce477a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05061761?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814037B49B6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807c29-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "2d6340f1-f316-4b58-b5e1-37db4a17cc2a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807c47-301e-0094-05fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey05061761Fri, 23 Aug 2019 21:51:11 GMT\"0x8D72814037B49B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "ec2b124f-e200-4405-b584-7002b95f9102", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05061761?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807c63-301e-0094-1bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "0c0e1839-fe85-4c55-834c-6bfc191ae2ef" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey05061761" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[5].json new file mode 100644 index 000000000000..2c354f71db0b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey057085e8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140396A041\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807cce-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "8d4968ab-abbf-4c29-b041-54c20363b393" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807cee-301e-0094-13fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey057085e8Fri, 23 Aug 2019 21:51:12 GMT\"0x8D728140396A041\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "023b9601-cce3-42f6-8511-5b20ba7b7ff5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey057085e8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807d00-301e-0094-21fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "79c24935-8b03-431a-9bc5-4d9695ecefae" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey057085e8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[6].json new file mode 100644 index 000000000000..c8b3763befcd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[6].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey00687250?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281403A5E61D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807d14-301e-0094-34fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "1af39547-b282-439d-be03-1e8ec76283a1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807d31-301e-0094-4efc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey00687250Fri, 23 Aug 2019 21:51:12 GMT\"0x8D7281403A5E61D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "b95c1eb3-17d6-4f7a-b8a4-6d2ce421f4d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey00687250?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807d4f-301e-0094-67fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "5cbc3112-00ea-47b6-b0d9-f8dafdb8d08e" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey00687250" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[7].json new file mode 100644 index 000000000000..ab87332bd5ef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[7].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0449192b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281403B4B6A3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807d6a-301e-0094-80fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "dad6eb2c-39a8-4404-9fa4-4a5e7ffcdf8b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807d91-301e-0094-21fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0449192bFri, 23 Aug 2019 21:51:12 GMT\"0x8D7281403B4B6A3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "c073b2a0-9a80-4751-9dbb-10850469ba7a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0449192b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807db8-301e-0094-3dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "03427359-4a6a-4ac8-918f-f450d7f75f3b" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0449192b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[8].json new file mode 100644 index 000000000000..5f4e665e5a80 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[8].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey015074bf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281403C338ED\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807dd7-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "351a8299-5e23-41b6-8a7e-f89051476073" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807df4-301e-0094-72fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey015074bfFri, 23 Aug 2019 21:51:12 GMT\"0x8D7281403C338ED\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:11 GMT", + "x-ms-client-request-id" : "ee1fd8f0-d8b4-4bfb-b305-61c49a7c5b82", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey015074bf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807e0f-301e-0094-09fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "d89a9cb5-80d8-45f5-acac-b9313bb66eb7" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey015074bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[9].json new file mode 100644 index 000000000000..fd822b936cf7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[9].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey07184901?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281403D1BB45\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807e2e-301e-0094-27fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "6dc5f6cd-2e29-4048-990d-c877b55995a9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807e46-301e-0094-37fc-5950b8000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey07184901Fri, 23 Aug 2019 21:51:12 GMT\"0x8D7281403D1BB45\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "14bc0c82-fd1c-4d3e-9369-76c5a089f6ff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey07184901?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807e5c-301e-0094-48fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "f358873b-3a62-49e2-896c-6ad4f335a392" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey07184901" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[0].json new file mode 100644 index 000000000000..ff0d01bc22b5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok084199fd4f4b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281406F64CEA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808d52-301e-0094-5efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "42d5aa22-5f7f-4f37-bac1-83343bd4acc5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808d6c-301e-0094-73fc-5950b8000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok084199fd4f4bFri, 23 Aug 2019 21:51:17 GMT\"0x8D7281406F64CEA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "a7ad1b45-84bf-418d-9682-9216b167ed22", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok084199fd4f4b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808d87-301e-0094-0bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "aae29639-e516-4b64-bec2-2114b0641f3c" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok084199fd4f4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[1].json new file mode 100644 index 000000000000..eda298e48dfd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok030167ad4b74?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281407056BB0\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808da1-301e-0094-22fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "a89299b2-6db9-40fd-8719-9c4a0534fae9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808dbc-301e-0094-3bfc-5950b8000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok030167ad4b74Fri, 23 Aug 2019 21:51:17 GMT\"0x8D7281407056BB0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "ca984c61-387d-4556-9853-6910c52afaa2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok030167ad4b74?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808dcf-301e-0094-4efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "5e2becf9-8097-4868-bb03-85dd2076021c" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok030167ad4b74" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[2].json new file mode 100644 index 000000000000..c0d633c60c82 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[2].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok037808ba8634?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281407143C2D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808dec-301e-0094-6afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "185c108e-29f3-4009-a523-9cf8eebd342e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808e04-301e-0094-7ffc-5950b8000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok037808ba8634Fri, 23 Aug 2019 21:51:17 GMT\"0x8D7281407143C2D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "0f392f2f-5d95-46d0-b934-3f8a267bb0a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok037808ba8634?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808e18-301e-0094-10fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "543acf7c-e76a-4812-acda-9ff154bc223c" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok037808ba8634" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[3].json new file mode 100644 index 000000000000..909850ef58ca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[3].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok058523f3143d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281407277A93\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808e5d-301e-0094-52fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "ed8e7d0f-1529-4c63-91b3-d57c0abd1e59" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808e8c-301e-0094-78fc-5950b8000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok058523f3143dFri, 23 Aug 2019 21:51:18 GMT\"0x8D7281407277A93\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "0598639c-877b-405f-a451-1ffc46c08524", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok058523f3143d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808ea5-301e-0094-11fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "8852496a-c8da-4728-ac65-2e460ee0a272" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok058523f3143d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[4].json new file mode 100644 index 000000000000..9c7eba3f51e3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[4].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok017175139125?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140736E782\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808ebc-301e-0094-26fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "a08c8ab0-10f9-4a3c-b4a7-16b8f5885ef1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808ede-301e-0094-46fc-5950b8000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok017175139125Fri, 23 Aug 2019 21:51:18 GMT\"0x8D728140736E782\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "0ae96aa5-aa7a-4507-9884-6842132989f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok017175139125?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808ee9-301e-0094-51fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "2dafcdfe-0338-4ae2-87e9-fb5bd181e1df" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok017175139125" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[5].json new file mode 100644 index 000000000000..66262cd0efc9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[5].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok092290d842c9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281407462D51\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808f07-301e-0094-6ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "686b8d7f-6b86-4845-93ba-1ade7d61a57e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808f25-301e-0094-0cfc-5950b8000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok092290d842c9Fri, 23 Aug 2019 21:51:18 GMT\"0x8D7281407462D51\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "68dce1d7-2622-4c84-968c-8b2386c1f9da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok092290d842c9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808f3f-301e-0094-25fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:17 GMT", + "x-ms-client-request-id" : "2b945728-bfc6-4786-869c-b1ef625dd438" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok092290d842c9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluescanonicalizedresource.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluescanonicalizedresource.json new file mode 100644 index 000000000000..4e77cab35299 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluescanonicalizedresource.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource010254841c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814042FA8B6\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807fef-301e-0094-26fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "3c49b8b2-f14c-4005-90cf-c0f9bd07b201" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluescanonicalizedresource&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780800d-301e-0094-3bfc-5950b8000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource010254841cFri, 23 Aug 2019 21:51:13 GMT\"0x8D72814042FA8B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "3b171647-39bf-465d-8a63-7a4523b49a44", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource010254841c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780801f-301e-0094-4cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "a2f4bcb1-6116-4471-9090-89d497a5c5ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource010254841c", "javablobservicesassignaturevaluescanonicalizedresource148688b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[0].json new file mode 100644 index 000000000000..ba4bad4c84c5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[0].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia055400013d97242e664?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814043FB200\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7808053-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "3359e2d3-6c1e-4e63-b271-1c0911a90e5c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7808078-301e-0094-19fc-5950b8000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia055400013d97242e664Fri, 23 Aug 2019 21:51:13 GMT\"0x8D72814043FB200\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "cbc32f5d-3d3e-4d5f-8e99-ce5cb51adfa2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia055400013d97242e664?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780808d-301e-0094-2cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "670fb046-92ca-4348-afd0-f9bb83e69048" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia055400013d97242e664" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[1].json new file mode 100644 index 000000000000..8ddc9586a08b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[1].json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia0742729d7eea04bcc24?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814045030A2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78080a4-301e-0094-3ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "687b9a79-8f7b-4f39-991d-aefcf528be3c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesia&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78080c1-301e-0094-56fc-5950b8000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia0742729d7eea04bcc24Fri, 23 Aug 2019 21:51:13 GMT\"0x8D72814045030A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "e6b80aee-3a45-4021-af35-0ffeeae0941e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesia0742729d7eea04bcc24?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78080d6-301e-0094-6bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:12 GMT", + "x-ms-client-request-id" : "826ababf-7d73-44d1-acc4-b2767f04bb30" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia0742729d7eea04bcc24" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblob.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblob.json new file mode 100644 index 000000000000..47299c809d9f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblob.json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob0215515b3b7fa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281401CB5FCA\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807307-301e-0094-4efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "db575b68-d83b-4fb2-af41-e40572f1c5a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob0215515b3b7fa/javablobservicesassignaturevaluesnetworktestblob1961305b0f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Q7G6/s6+u/k=", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D7281401D0EAEC\"", + "Content-Length" : "0", + "x-ms-request-id" : "f780732b-301e-0094-6cfc-5950b8000000", + "x-ms-client-request-id" : "96fb7080-d9e8-4fe7-b428-499a7d390840" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob0215515b3b7fa/javablobservicesassignaturevaluesnetworktestblob1961305b0f?sv=2018-11-09&spr=https%2Chttp&st=2019-08-22T21%3A51%3A09Z&se=2019-08-24T21%3A51%3A09Z&sip=0.0.0.0-255.255.255.255&sr=b&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "\"0x8D7281401D0EAEC\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:51:09 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "f7807361-301e-0094-1ffc-5950b8000000", + "Body" : "test", + "x-ms-client-request-id" : "de7f2905-e684-462d-b22e-4829edebb8b0", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob0215515b3b7fa/javablobservicesassignaturevaluesnetworktestblob1961305b0f?sv=2018-11-09&spr=https%2Chttp&st=2019-08-22T21%3A51%3A09Z&se=2019-08-24T21%3A51%3A09Z&sip=0.0.0.0-255.255.255.255&sr=b&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:51:09 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "f78073b6-301e-0094-70fc-5950b8000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "\"0x8D7281401D0EAEC\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "223774ef-611e-43d2-b781-b959c73ba374", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestblob&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78073d0-301e-0094-07fc-5950b8000000", + "Body" : "jtcservicesassignaturevaluesnetworktestblobjtcservicesassignaturevaluesnetworktestblob0215515b3b7faFri, 23 Aug 2019 21:51:09 GMT\"0x8D7281401CB5FCA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "7a5c4560-8e8d-4de5-aa73-c9e4b2d6eaeb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob0215515b3b7fa?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f78073e1-301e-0094-15fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "9db486df-1623-4494-a489-457c04c4377e" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestblob0215515b3b7fa", "javablobservicesassignaturevaluesnetworktestblob1961305b0f", "2019-08-23T21:51:09.178Z", "2019-08-23T21:51:09.178Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshot.json new file mode 100644 index 000000000000..35045a9f30c3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshot.json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot039931a93?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281401F86DC9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f78073fd-301e-0094-2dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "x-ms-client-request-id" : "35273797-395f-41c6-a087-8dc4275cd08a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot039931a93/javablobservicesassignaturevaluesnetworktestblobsnapshot195124", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Q7G6/s6+u/k=", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:51:08 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D7281401FDD253\"", + "Content-Length" : "0", + "x-ms-request-id" : "f7807415-301e-0094-44fc-5950b8000000", + "x-ms-client-request-id" : "eaadfca2-ee7c-4608-87f5-a7ce4cb2c67d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot039931a93/javablobservicesassignaturevaluesnetworktestblobsnapshot195124?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:51:09.4423482Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281401FDD253\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7807423-301e-0094-52fc-5950b8000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "cb8b7aba-cd4b-4f8d-8262-8f5ad48a07ad" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot039931a93/javablobservicesassignaturevaluesnetworktestblobsnapshot195124?snapshot=2019-08-23T21%3a51%3a09.4423482Z&sv=2018-11-09&spr=https%2Chttp&st=2019-08-22T21%3A51%3A09Z&se=2019-08-24T21%3A51%3A09Z&sip=0.0.0.0-255.255.255.255&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-snapshot" : "2019-08-23T21:51:09.4423482Z", + "Cache-Control" : "cache", + "ETag" : "\"0x8D7281401FDD253\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:51:09 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "f7807438-301e-0094-67fc-5950b8000000", + "Body" : "test", + "x-ms-client-request-id" : "825b59b0-9708-4da4-ac9d-eb6b0dcf1e22", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot039931a93/javablobservicesassignaturevaluesnetworktestblobsnapshot195124?snapshot=2019-08-23T21%3a51%3a09.4423482Z&sv=2018-11-09&spr=https%2Chttp&st=2019-08-22T21%3A51%3A09Z&se=2019-08-24T21%3A51%3A09Z&sip=0.0.0.0-255.255.255.255&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-snapshot" : "2019-08-23T21:51:09.4423482Z", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "\"0x8D7281401FDD253\"", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:51:09 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "f7807458-301e-0094-04fc-5950b8000000", + "x-ms-client-request-id" : "bf418097-aab5-48f8-980b-aae8aef991cc", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestblobsnapshot&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807469-301e-0094-14fc-5950b8000000", + "Body" : "jtcservicesassignaturevaluesnetworktestblobsnapshotjtcservicesassignaturevaluesnetworktestblobsnapshot039931a93Fri, 23 Aug 2019 21:51:09 GMT\"0x8D7281401F86DC9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "4ecb7856-3049-4727-9692-10f1bdb4f31d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot039931a93?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7807477-301e-0094-22fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:09 GMT", + "x-ms-client-request-id" : "3a136e88-1795-49b9-b60c-a70a022afabd" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestblobsnapshot039931a93", "javablobservicesassignaturevaluesnetworktestblobsnapshot195124", "2019-08-23T21:51:09.489Z", "2019-08-23T21:51:09.489Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTesturlparser.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTesturlparser.json new file mode 100644 index 000000000000..0a5c9b928387 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTesturlparser.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcurlparser0sastesturlparserd5b18550ed2295d002734?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281409D49D5C\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809b74-301e-0094-29fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "74bf5fbd-d3fd-40c8-ada5-dfcb4520fac1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcurlparser&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809b93-301e-0094-44fc-5950b8000000", + "Body" : "jtcurlparserjtcurlparser0sastesturlparserd5b18550ed2295d002734Fri, 23 Aug 2019 21:51:22 GMT\"0x8D7281409D49D5C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "e3732363-25f8-499a-b0d5-ddf99a75c520", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcurlparser0sastesturlparserd5b18550ed2295d002734?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809bac-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "60e3089a-1f0f-4237-b641-73aa870a7d21" + }, + "Exception" : null + } ], + "variables" : [ "jtcurlparser0sastesturlparserd5b18550ed2295d002734" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfo.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfo.json new file mode 100644 index 000000000000..3aec28cf8b17 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfo.json @@ -0,0 +1,124 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0serviceapitestgetaccountinfofd924157069c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728142086D21A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:52:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe00fb4-201e-004c-43fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "6576cca3-4199-4cd7-877c-89928f17df6e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00fc2-201e-004c-4efc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "bc3bad95-9d07-4280-9b25-9fda1c99c384" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=account&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "cfe00fe0-201e-004c-68fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "cb12df60-bcad-46b1-9d76-60a6f35e3fb9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00feb-201e-004c-73fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "6f5314e4-d7b1-4d82-9b94-59750d3af035" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccountinfo&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe01046-201e-004c-3bfc-59f769000000", + "Body" : "jtcgetaccountinfojtcgetaccountinfo0serviceapitestgetaccountinfofd924157069cFri, 23 Aug 2019 21:52:00 GMT\"0x8D728142086D21A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "0c82a600-3ded-42d5-a46d-c44a54c17f53", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfo0serviceapitestgetaccountinfofd924157069c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe0104e-201e-004c-42fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "dafa8341-ebf7-490a-8c46-4463b453ece0" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfo0serviceapitestgetaccountinfofd924157069c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfoerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfoerror.json new file mode 100644 index 000000000000..0113de3d3fcc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfoerror.json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror041083e6b55007f0ee402a9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814210B3E00\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:52:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe0111b-201e-004c-6afc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "29c37b45-3918-45ad-a098-09a73b7098f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe0112c-201e-004c-77fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "7f987842-6ed0-4aaf-9c30-55920c5b66bb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=account&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-error-code" : "ResourceNotFound", + "Content-Length" : "223", + "x-ms-request-id" : "cfe0113e-201e-004c-04fc-59f769000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:cfe0113e-201e-004c-04fc-59f769000000\nTime:2019-08-23T21:52:01.5707008Z", + "x-ms-client-request-id" : "83bfc1ea-20b4-4a53-973e-d467b710e555", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe0114a-201e-004c-0cfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "7473b619-a62b-4dba-942a-79aacb1739cb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccountinfoerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe0115b-201e-004c-1bfc-59f769000000", + "Body" : "jtcgetaccountinfoerrorjtcgetaccountinfoerror041083e6b55007f0ee402a9Fri, 23 Aug 2019 21:52:01 GMT\"0x8D72814210B3E00\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "163361f3-3f59-44ea-a231-a752c2eda36c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfoerror041083e6b55007f0ee402a9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe0115f-201e-004c-1ffc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "dcc09ffa-b3e9-419e-9051-58353af8f4f1" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfoerror041083e6b55007f0ee402a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfomin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfomin.json new file mode 100644 index 000000000000..bb2036aef9e1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfomin.json @@ -0,0 +1,124 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0serviceapitestgetaccountinfomine6d605227?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281420CAF0CF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:52:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe01068-201e-004c-57fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "a15a1eb4-39a2-48b8-b337-e384b4eae40a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe01075-201e-004c-61fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "6102ed2e-71b8-4568-b473-ed5c657da01d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=account&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "cfe0107f-201e-004c-68fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "58b17ea3-d8e8-4645-87cb-8f7bf0df639e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe01087-201e-004c-70fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "6fe604ac-7114-448c-8bfb-f32d9ebbcaaf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetaccountinfomin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe0109a-201e-004c-80fc-59f769000000", + "Body" : "jtcgetaccountinfominjtcgetaccountinfomin0serviceapitestgetaccountinfomine6d605227Fri, 23 Aug 2019 21:52:01 GMT\"0x8D7281420CAF0CF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "93ec218a-e4f1-46ef-b073-bf4fbe0f3099", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetaccountinfomin0serviceapitestgetaccountinfomine6d605227?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe010a5-201e-004c-09fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "27d413d1-84ac-4566-b481-455c415c6508" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfomin0serviceapitestgetaccountinfomine6d605227" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropserror.json new file mode 100644 index 000000000000..188d27546ab9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropserror.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropserror0serviceapitestgetpropserrorff190235d11bf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728141E8B47B5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe009b2-201e-004c-56fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "e336ad7a-2b9d-4e24-83b8-b06643014f8f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe009c2-201e-004c-60fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "6adade90-f486-427a-90a1-04fcbe1a973e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://error.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "472", + "StatusCode" : "403", + "x-ms-request-id" : "af83baeb-c01e-00fe-5efc-596566000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:af83baeb-c01e-00fe-5efc-596566000000\nTime:2019-08-23T21:51:57.4430745ZCannot find the claimed account when trying to GetProperties for the account azstoragesdkaccount.", + "Date" : "Fri, 23 Aug 2019 21:51:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00a0e-201e-004c-1cfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "f9299f6e-d21a-4cc7-a817-6891434c7462" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropserror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe00a20-201e-004c-2bfc-59f769000000", + "Body" : "jtcgetpropserrorjtcgetpropserror0serviceapitestgetpropserrorff190235d11bfFri, 23 Aug 2019 21:51:57 GMT\"0x8D728141E8B47B5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "5eadaa9c-b255-45e6-9661-a559908c7524", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropserror0serviceapitestgetpropserrorff190235d11bf?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe00a32-201e-004c-36fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "84e495e9-84ae-4f58-9a63-54c3deea6aef" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropserror0serviceapitestgetpropserrorff190235d11bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropsmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropsmin.json new file mode 100644 index 000000000000..dccf73ac2f26 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropsmin.json @@ -0,0 +1,124 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropsmin0serviceapitestgetpropsmin21c575065209173?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728141E6BF81D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe00962-201e-004c-1cfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "be796875-69e2-4159-9222-be43a62e0b22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00972-201e-004c-27fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "094f85d0-16fd-4e23-80a4-a9b62dbeffd7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe0097d-201e-004c-30fc-59f769000000", + "Body" : "1.0falsefalsefalsefalse1.0falsefalse1.0falsefalsefalsefalse2018-03-28", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "b40b78d9-fa4f-4290-a6d4-43bdbe0d98e1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00981-201e-004c-34fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "fb98c5f8-e659-478a-bb6f-2b457c7707e2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetpropsmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe0098e-201e-004c-3cfc-59f769000000", + "Body" : "jtcgetpropsminjtcgetpropsmin0serviceapitestgetpropsmin21c575065209173Fri, 23 Aug 2019 21:51:57 GMT\"0x8D728141E6BF81D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "710cfb90-4eac-4b9b-82ec-cbcdf6f979e1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetpropsmin0serviceapitestgetpropsmin21c575065209173?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe0099d-201e-004c-48fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "9dca94f1-5d79-43ed-abc0-eeae39a9bbf9" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropsmin0serviceapitestgetpropsmin21c575065209173" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstats.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstats.json new file mode 100644 index 000000000000..6a4215a44608 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstats.json @@ -0,0 +1,124 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstats0serviceapitestgetstats7808229705e612cd9f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728141FD33405\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe00dbb-201e-004c-1cfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "dcd620af-c18a-4025-98af-e5187a2792d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00dcf-201e-004c-2dfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "d3f52d2a-d044-4455-bd7e-890a5a0bdfd6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount-secondary.blob.core.windows.net?restype=service&comp=stats", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "3a04d331-501e-008c-02fc-59e84f000000", + "Body" : "liveFri, 23 Aug 2019 21:50:12 GMT", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "6fb6f0a5-6d1c-43e1-aa18-3796b2007863", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00ec6-201e-004c-04fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "8a1709d3-9007-43e0-b797-ba1f69f292aa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetstats&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe00edd-201e-004c-18fc-59f769000000", + "Body" : "jtcgetstatsjtcgetstats0serviceapitestgetstats7808229705e612cd9fFri, 23 Aug 2019 21:51:59 GMT\"0x8D728141FD33405\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "1211b22f-96a1-43e4-ae75-5075cc830920", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstats0serviceapitestgetstats7808229705e612cd9f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe00eea-201e-004c-22fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "d2e8c181-37d9-4279-9534-6e0d4c202dd9" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetstats0serviceapitestgetstats7808229705e612cd9f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatserror.json new file mode 100644 index 000000000000..27e8073925ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatserror.json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstatserror0serviceapitestgetstatserror2e572516b9a5c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728142067F7D2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:52:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe00f6d-201e-004c-0dfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "2a78db88-26eb-4f83-9b74-90717dce3de4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00f82-201e-004c-1bfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "16ea4848-7551-4ecb-a25c-d7a9c7049b74" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=stats", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "400", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-error-code" : "InvalidQueryParameterValue", + "Content-Length" : "376", + "x-ms-request-id" : "cfe00f8b-201e-004c-23fc-59f769000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:cfe00f8b-201e-004c-23fc-59f769000000\nTime:2019-08-23T21:52:00.5066741Zcompstats", + "x-ms-client-request-id" : "3798ff49-239a-4ad7-80d6-de571c11b06e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00f94-201e-004c-2afc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "f56c5391-20ae-4049-8bdd-204d34a9ac3f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetstatserror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe00f9f-201e-004c-31fc-59f769000000", + "Body" : "jtcgetstatserrorjtcgetstatserror0serviceapitestgetstatserror2e572516b9a5cFri, 23 Aug 2019 21:52:00 GMT\"0x8D728142067F7D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "a6c2b1ac-5a34-46c9-bec1-4c3eae4b4239", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstatserror0serviceapitestgetstatserror2e572516b9a5c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe00fa8-201e-004c-39fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "2139b3da-fb45-47f4-b2ec-ecfe8754237d" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetstatserror0serviceapitestgetstatserror2e572516b9a5c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatsmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatsmin.json new file mode 100644 index 000000000000..f25b986f3744 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatsmin.json @@ -0,0 +1,124 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstatsmin0serviceapitestgetstatsmin61511723a0eb255?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72814203D33B5\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:52:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe00efa-201e-004c-30fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "d8f93967-9d13-4987-b2d6-ef5d066fd017" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00f0e-201e-004c-3efc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "a41ffd2d-53db-48cb-9a20-9aa5bb59a3b0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount-secondary.blob.core.windows.net?restype=service&comp=stats", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "3a04d333-501e-008c-03fc-59e84f000000", + "Body" : "liveFri, 23 Aug 2019 21:50:12 GMT", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "5de71e74-d33f-4151-9323-96be55cdebb5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00f3b-201e-004c-64fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "0e7c292f-1d55-466f-bcd0-f68faab5d576" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetstatsmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe00f4e-201e-004c-75fc-59f769000000", + "Body" : "jtcgetstatsminjtcgetstatsmin0serviceapitestgetstatsmin61511723a0eb255Fri, 23 Aug 2019 21:52:00 GMT\"0x8D72814203D33B5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "a7108e13-be27-4cd3-b4f8-6eb06fbfdd03", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetstatsmin0serviceapitestgetstatsmin61511723a0eb255?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe00f5e-201e-004c-01fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:59 GMT", + "x-ms-client-request-id" : "14fdfb06-d847-41f2-ad1e-66d30b678f34" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetstatsmin0serviceapitestgetstatsmin61511723a0eb255" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkey.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkey.json new file mode 100644 index 000000000000..d642374cc8ad --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkey.json @@ -0,0 +1,123 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkey046028eb05fabae2c1406ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728141EB5BD9A\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe00a4e-201e-004c-51fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "01283b64-a48e-4a88-9b6a-7129a4573c57" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00a61-201e-004c-5ffc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "b1ef2c13-3b7d-4fda-b4b9-a68d0273921e" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=userdelegationkey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00bd7-201e-004c-06fc-59f769000000", + "Body" : "d9f78ed3-049b-45dd-acb6-b9bfc8d987b173cc7e6b-b65e-49f1-b907-01947e3044b12019-08-23T21:51:57Z2019-08-24T21:51:57Zb2019-02-02UkVEQUNURUQ=", + "Date" : "Fri, 23 Aug 2019 21:51:57 GMT", + "x-ms-client-request-id" : "dffa821e-b8a3-44d5-9d75-c63dc93a2658", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00bf5-201e-004c-1ffc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:57 GMT", + "x-ms-client-request-id" : "cbd6cf95-74a7-4984-8bbd-a90cf25d65cc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe00c02-201e-004c-2afc-59f769000000", + "Body" : "jtcgetuserdelegationkeyjtcgetuserdelegationkey046028eb05fabae2c1406abFri, 23 Aug 2019 21:51:57 GMT\"0x8D728141EB5BD9A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:57 GMT", + "x-ms-client-request-id" : "03243474-475d-435a-974e-43c6a5892292", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkey046028eb05fabae2c1406ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe00c13-201e-004c-35fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:57 GMT", + "x-ms-client-request-id" : "4066a1c6-7846-4900-b62b-8251d4939ea6" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetuserdelegationkey046028eb05fabae2c1406ab" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror.json new file mode 100644 index 000000000000..3215c4b48628 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror.json @@ -0,0 +1,102 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror0113900a4d1ec4cbb440?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728141FB96410\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe00d6a-201e-004c-56fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "92d085f2-c930-468a-bd77-75cd893bd61d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00d82-201e-004c-6afc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "3c138333-6066-48b8-8586-556d66e622c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00d91-201e-004c-79fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "c81504c8-1e67-4180-9f84-c754d1ad1747" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetuserdelegationkeyerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe00da1-201e-004c-05fc-59f769000000", + "Body" : "jtcgetuserdelegationkeyerrorjtcgetuserdelegationkeyerror0113900a4d1ec4cbb440Fri, 23 Aug 2019 21:51:59 GMT\"0x8D728141FB96410\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "60da8097-0206-450a-bbeb-3c0a749b2d67", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror0113900a4d1ec4cbb440?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe00da6-201e-004c-0afc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "4f9e4e8c-a853-4e11-9ff6-924fb726c1f9" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetuserdelegationkeyerror0113900a4d1ec4cbb440" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[0].json new file mode 100644 index 000000000000..bf1dd1b118f2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[0].json @@ -0,0 +1,97 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror0708881dee1597095b42?restype=container", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D720E3498385E1\"", + "Last-Modified" : "Wed, 14 Aug 2019 18:14:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8ef12d14-901e-0099-33cc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d21-901e-0099-3ecc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d2a-901e-0099-46cc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetuserdelegationkeyerror&comp=list", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8ef12d38-901e-0099-52cc-52bfb4000000", + "Body" : "jtcgetuserdelegationkeyerrorjtcgetuserdelegationkeyerror0708881dee1597095b42Wed, 14 Aug 2019 18:14:45 GMT\"0x8D720E3498385E1\"unlockedavailablefalsefalse", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror0708881dee1597095b42?restype=container", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d4d-901e-0099-66cc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetuserdelegationkeyerror0708881dee1597095b42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[1].json new file mode 100644 index 000000000000..2fe304e751c4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[1].json @@ -0,0 +1,97 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror065100e4ad1d52ef4944?restype=container", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D720E349A25FD8\"", + "Last-Modified" : "Wed, 14 Aug 2019 18:14:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8ef12d61-901e-0099-78cc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d67-901e-0099-7ccc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d71-901e-0099-06cc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetuserdelegationkeyerror&comp=list", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8ef12d7e-901e-0099-10cc-52bfb4000000", + "Body" : "jtcgetuserdelegationkeyerrorjtcgetuserdelegationkeyerror065100e4ad1d52ef4944Wed, 14 Aug 2019 18:14:46 GMT\"0x8D720E349A25FD8\"unlockedavailablefalsefalse", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror065100e4ad1d52ef4944?restype=container", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d8c-901e-0099-1acc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetuserdelegationkeyerror065100e4ad1d52ef4944" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeymin.json new file mode 100644 index 000000000000..bea87ff0f550 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeymin.json @@ -0,0 +1,123 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeymin088960aa24eaaa424d415?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728141F529984\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe00c25-201e-004c-43fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:57 GMT", + "x-ms-client-request-id" : "2e4b28c0-4601-41e8-9bba-3ba339f6e42b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00c2f-201e-004c-49fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:57 GMT", + "x-ms-client-request-id" : "9024d299-e63b-42f2-b8bc-d55bfbf4ebad" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=userdelegationkey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00ca8-201e-004c-33fc-59f769000000", + "Body" : "9ab219b8-bea4-41b2-acba-155a6c2d7f7cac2a9a66-b410-4a93-b4f8-80deb3b7e4ab2019-08-23T21:51:58Z2019-08-24T21:51:58Zb2019-02-02UkVEQUNURUQ=", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "7f70f5e5-21f0-427e-bfa6-8dce215db13e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00cb6-201e-004c-3efc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "5f9a5fbd-df03-489f-b4e6-d290553e1e5f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetuserdelegationkeymin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe00cc3-201e-004c-4bfc-59f769000000", + "Body" : "jtcgetuserdelegationkeyminjtcgetuserdelegationkeymin088960aa24eaaa424d415Fri, 23 Aug 2019 21:51:58 GMT\"0x8D728141F529984\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "a6d95259-095e-43e7-ab3a-8131e2e0647f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeymin088960aa24eaaa424d415?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe00cda-201e-004c-60fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:58 GMT", + "x-ms-client-request-id" : "e80f55cb-dc99-4446-83ec-6cbfc3b797a2" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetuserdelegationkeymin088960aa24eaaa424d415" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestinvalidaccountname.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestinvalidaccountname.json new file mode 100644 index 000000000000..8fbaa6d0eb7b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestinvalidaccountname.json @@ -0,0 +1,1852 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinvalidaccountname0serviceapitestinvalidaccountname4dd87860?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728142128B84E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:52:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe0116d-201e-004c-29fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:00 GMT", + "x-ms-client-request-id" : "8802edd9-92be-4366-93c2-5a3fb9e177a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe0117b-201e-004c-31fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:52:01 GMT", + "x-ms-client-request-id" : "c07e44ae-3fe4-4225-abc4-15c204aea9cb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "lookupAllHostAddr", + "fileName" : "Inet6AddressImpl.java", + "lineNumber" : -2, + "className" : "java.net.Inet6AddressImpl", + "nativeMethod" : true + }, { + "methodName" : "lookupAllHostAddr", + "fileName" : "InetAddress.java", + "lineNumber" : 929, + "className" : "java.net.InetAddress$2", + "nativeMethod" : false + }, { + "methodName" : "getAddressesFromNameService", + "fileName" : "InetAddress.java", + "lineNumber" : 1324, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName0", + "fileName" : "InetAddress.java", + "lineNumber" : 1277, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1193, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1127, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1077, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 146, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "doPrivileged", + "fileName" : "AccessController.java", + "lineNumber" : -2, + "className" : "java.security.AccessController", + "nativeMethod" : true + }, { + "methodName" : "addressByName", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "DefaultNameResolver.java", + "lineNumber" : 43, + "className" : "io.netty.resolver.DefaultNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 63, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 55, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 57, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 32, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "AbstractAddressResolver.java", + "lineNumber" : 108, + "className" : "io.netty.resolver.AbstractAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolveAndConnect0", + "fileName" : "Bootstrap.java", + "lineNumber" : 208, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "Bootstrap.java", + "lineNumber" : 49, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 188, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 174, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "notifyListener0", + "fileName" : "DefaultPromise.java", + "lineNumber" : 511, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListenersNow", + "fileName" : "DefaultPromise.java", + "lineNumber" : 485, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListeners", + "fileName" : "DefaultPromise.java", + "lineNumber" : 424, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultPromise.java", + "lineNumber" : 103, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultChannelPromise.java", + "lineNumber" : 84, + "className" : "io.netty.channel.DefaultChannelPromise", + "nativeMethod" : false + }, { + "methodName" : "safeSetSuccess", + "fileName" : "AbstractChannel.java", + "lineNumber" : 982, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "register0", + "fileName" : "AbstractChannel.java", + "lineNumber" : 516, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "access$200", + "fileName" : "AbstractChannel.java", + "lineNumber" : 427, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "AbstractChannel.java", + "lineNumber" : 486, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe$1", + "nativeMethod" : false + }, { + "methodName" : "safeExecute", + "fileName" : "AbstractEventExecutor.java", + "lineNumber" : 163, + "className" : "io.netty.util.concurrent.AbstractEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "runAllTasks", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 404, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "NioEventLoop.java", + "lineNumber" : 495, + "className" : "io.netty.channel.nio.NioEventLoop", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 905, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor$5", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : "fake.blobfake.core.windows.net", + "localizedMessage" : "fake.blobfake.core.windows.net", + "suppressed" : [ ] + }, + "ClassName" : "java.net.UnknownHostException" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "getAllByName0", + "fileName" : "InetAddress.java", + "lineNumber" : 1281, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1193, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1127, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1077, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 146, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "doPrivileged", + "fileName" : "AccessController.java", + "lineNumber" : -2, + "className" : "java.security.AccessController", + "nativeMethod" : true + }, { + "methodName" : "addressByName", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "DefaultNameResolver.java", + "lineNumber" : 43, + "className" : "io.netty.resolver.DefaultNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 63, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 55, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 57, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 32, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "AbstractAddressResolver.java", + "lineNumber" : 108, + "className" : "io.netty.resolver.AbstractAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolveAndConnect0", + "fileName" : "Bootstrap.java", + "lineNumber" : 208, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "Bootstrap.java", + "lineNumber" : 49, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 188, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 174, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "notifyListener0", + "fileName" : "DefaultPromise.java", + "lineNumber" : 511, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListenersNow", + "fileName" : "DefaultPromise.java", + "lineNumber" : 485, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListeners", + "fileName" : "DefaultPromise.java", + "lineNumber" : 424, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultPromise.java", + "lineNumber" : 103, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultChannelPromise.java", + "lineNumber" : 84, + "className" : "io.netty.channel.DefaultChannelPromise", + "nativeMethod" : false + }, { + "methodName" : "safeSetSuccess", + "fileName" : "AbstractChannel.java", + "lineNumber" : 982, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "register0", + "fileName" : "AbstractChannel.java", + "lineNumber" : 516, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "access$200", + "fileName" : "AbstractChannel.java", + "lineNumber" : 427, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "AbstractChannel.java", + "lineNumber" : 486, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe$1", + "nativeMethod" : false + }, { + "methodName" : "safeExecute", + "fileName" : "AbstractEventExecutor.java", + "lineNumber" : 163, + "className" : "io.netty.util.concurrent.AbstractEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "runAllTasks", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 404, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "NioEventLoop.java", + "lineNumber" : 495, + "className" : "io.netty.channel.nio.NioEventLoop", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 905, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor$5", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : "fake.blobfake.core.windows.net", + "localizedMessage" : "fake.blobfake.core.windows.net", + "suppressed" : [ ] + }, + "ClassName" : "java.net.UnknownHostException" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "getAllByName0", + "fileName" : "InetAddress.java", + "lineNumber" : 1281, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1193, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1127, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1077, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 146, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "doPrivileged", + "fileName" : "AccessController.java", + "lineNumber" : -2, + "className" : "java.security.AccessController", + "nativeMethod" : true + }, { + "methodName" : "addressByName", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "DefaultNameResolver.java", + "lineNumber" : 43, + "className" : "io.netty.resolver.DefaultNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 63, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 55, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 57, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 32, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "AbstractAddressResolver.java", + "lineNumber" : 108, + "className" : "io.netty.resolver.AbstractAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolveAndConnect0", + "fileName" : "Bootstrap.java", + "lineNumber" : 208, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "Bootstrap.java", + "lineNumber" : 49, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 188, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 174, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "notifyListener0", + "fileName" : "DefaultPromise.java", + "lineNumber" : 511, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListenersNow", + "fileName" : "DefaultPromise.java", + "lineNumber" : 485, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListeners", + "fileName" : "DefaultPromise.java", + "lineNumber" : 424, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultPromise.java", + "lineNumber" : 103, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultChannelPromise.java", + "lineNumber" : 84, + "className" : "io.netty.channel.DefaultChannelPromise", + "nativeMethod" : false + }, { + "methodName" : "safeSetSuccess", + "fileName" : "AbstractChannel.java", + "lineNumber" : 982, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "register0", + "fileName" : "AbstractChannel.java", + "lineNumber" : 516, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "access$200", + "fileName" : "AbstractChannel.java", + "lineNumber" : 427, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "AbstractChannel.java", + "lineNumber" : 486, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe$1", + "nativeMethod" : false + }, { + "methodName" : "safeExecute", + "fileName" : "AbstractEventExecutor.java", + "lineNumber" : 163, + "className" : "io.netty.util.concurrent.AbstractEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "runAllTasks", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 404, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "NioEventLoop.java", + "lineNumber" : 495, + "className" : "io.netty.channel.nio.NioEventLoop", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 905, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor$5", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : "fake.blobfake.core.windows.net", + "localizedMessage" : "fake.blobfake.core.windows.net", + "suppressed" : [ ] + }, + "ClassName" : "java.net.UnknownHostException" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "lookupAllHostAddr", + "fileName" : "Inet6AddressImpl.java", + "lineNumber" : -2, + "className" : "java.net.Inet6AddressImpl", + "nativeMethod" : true + }, { + "methodName" : "lookupAllHostAddr", + "fileName" : "InetAddress.java", + "lineNumber" : 929, + "className" : "java.net.InetAddress$2", + "nativeMethod" : false + }, { + "methodName" : "getAddressesFromNameService", + "fileName" : "InetAddress.java", + "lineNumber" : 1324, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName0", + "fileName" : "InetAddress.java", + "lineNumber" : 1277, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1193, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1127, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1077, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 146, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "doPrivileged", + "fileName" : "AccessController.java", + "lineNumber" : -2, + "className" : "java.security.AccessController", + "nativeMethod" : true + }, { + "methodName" : "addressByName", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "DefaultNameResolver.java", + "lineNumber" : 43, + "className" : "io.netty.resolver.DefaultNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 63, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 55, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 57, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 32, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "AbstractAddressResolver.java", + "lineNumber" : 108, + "className" : "io.netty.resolver.AbstractAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolveAndConnect0", + "fileName" : "Bootstrap.java", + "lineNumber" : 208, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "Bootstrap.java", + "lineNumber" : 49, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 188, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 174, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "notifyListener0", + "fileName" : "DefaultPromise.java", + "lineNumber" : 511, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListenersNow", + "fileName" : "DefaultPromise.java", + "lineNumber" : 485, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListeners", + "fileName" : "DefaultPromise.java", + "lineNumber" : 424, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultPromise.java", + "lineNumber" : 103, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultChannelPromise.java", + "lineNumber" : 84, + "className" : "io.netty.channel.DefaultChannelPromise", + "nativeMethod" : false + }, { + "methodName" : "safeSetSuccess", + "fileName" : "AbstractChannel.java", + "lineNumber" : 982, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "register0", + "fileName" : "AbstractChannel.java", + "lineNumber" : 516, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "access$200", + "fileName" : "AbstractChannel.java", + "lineNumber" : 427, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "AbstractChannel.java", + "lineNumber" : 486, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe$1", + "nativeMethod" : false + }, { + "methodName" : "safeExecute", + "fileName" : "AbstractEventExecutor.java", + "lineNumber" : 163, + "className" : "io.netty.util.concurrent.AbstractEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "runAllTasks", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 404, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "NioEventLoop.java", + "lineNumber" : 495, + "className" : "io.netty.channel.nio.NioEventLoop", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 905, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor$5", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : "fake.blobfake.core.windows.net", + "localizedMessage" : "fake.blobfake.core.windows.net", + "suppressed" : [ ] + }, + "ClassName" : "java.net.UnknownHostException" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "lookupAllHostAddr", + "fileName" : "Inet6AddressImpl.java", + "lineNumber" : -2, + "className" : "java.net.Inet6AddressImpl", + "nativeMethod" : true + }, { + "methodName" : "lookupAllHostAddr", + "fileName" : "InetAddress.java", + "lineNumber" : 929, + "className" : "java.net.InetAddress$2", + "nativeMethod" : false + }, { + "methodName" : "getAddressesFromNameService", + "fileName" : "InetAddress.java", + "lineNumber" : 1324, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName0", + "fileName" : "InetAddress.java", + "lineNumber" : 1277, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1193, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1127, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1077, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 146, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "doPrivileged", + "fileName" : "AccessController.java", + "lineNumber" : -2, + "className" : "java.security.AccessController", + "nativeMethod" : true + }, { + "methodName" : "addressByName", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "DefaultNameResolver.java", + "lineNumber" : 43, + "className" : "io.netty.resolver.DefaultNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 63, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 55, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 57, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 32, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "AbstractAddressResolver.java", + "lineNumber" : 108, + "className" : "io.netty.resolver.AbstractAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolveAndConnect0", + "fileName" : "Bootstrap.java", + "lineNumber" : 208, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "Bootstrap.java", + "lineNumber" : 49, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 188, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 174, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "notifyListener0", + "fileName" : "DefaultPromise.java", + "lineNumber" : 511, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListenersNow", + "fileName" : "DefaultPromise.java", + "lineNumber" : 485, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListeners", + "fileName" : "DefaultPromise.java", + "lineNumber" : 424, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultPromise.java", + "lineNumber" : 103, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultChannelPromise.java", + "lineNumber" : 84, + "className" : "io.netty.channel.DefaultChannelPromise", + "nativeMethod" : false + }, { + "methodName" : "safeSetSuccess", + "fileName" : "AbstractChannel.java", + "lineNumber" : 982, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "register0", + "fileName" : "AbstractChannel.java", + "lineNumber" : 516, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "access$200", + "fileName" : "AbstractChannel.java", + "lineNumber" : 427, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "AbstractChannel.java", + "lineNumber" : 486, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe$1", + "nativeMethod" : false + }, { + "methodName" : "safeExecute", + "fileName" : "AbstractEventExecutor.java", + "lineNumber" : 163, + "className" : "io.netty.util.concurrent.AbstractEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "runAllTasks", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 404, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "NioEventLoop.java", + "lineNumber" : 495, + "className" : "io.netty.channel.nio.NioEventLoop", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 905, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor$5", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : "fake.blobfake.core.windows.net", + "localizedMessage" : "fake.blobfake.core.windows.net", + "suppressed" : [ ] + }, + "ClassName" : "java.net.UnknownHostException" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "getAllByName0", + "fileName" : "InetAddress.java", + "lineNumber" : 1281, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1193, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1127, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1077, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 146, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "doPrivileged", + "fileName" : "AccessController.java", + "lineNumber" : -2, + "className" : "java.security.AccessController", + "nativeMethod" : true + }, { + "methodName" : "addressByName", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "DefaultNameResolver.java", + "lineNumber" : 43, + "className" : "io.netty.resolver.DefaultNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 63, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 55, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 57, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 32, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "AbstractAddressResolver.java", + "lineNumber" : 108, + "className" : "io.netty.resolver.AbstractAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolveAndConnect0", + "fileName" : "Bootstrap.java", + "lineNumber" : 208, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "Bootstrap.java", + "lineNumber" : 49, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 188, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 174, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "notifyListener0", + "fileName" : "DefaultPromise.java", + "lineNumber" : 511, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListenersNow", + "fileName" : "DefaultPromise.java", + "lineNumber" : 485, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListeners", + "fileName" : "DefaultPromise.java", + "lineNumber" : 424, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultPromise.java", + "lineNumber" : 103, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultChannelPromise.java", + "lineNumber" : 84, + "className" : "io.netty.channel.DefaultChannelPromise", + "nativeMethod" : false + }, { + "methodName" : "safeSetSuccess", + "fileName" : "AbstractChannel.java", + "lineNumber" : 982, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "register0", + "fileName" : "AbstractChannel.java", + "lineNumber" : 516, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "access$200", + "fileName" : "AbstractChannel.java", + "lineNumber" : 427, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "AbstractChannel.java", + "lineNumber" : 486, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe$1", + "nativeMethod" : false + }, { + "methodName" : "safeExecute", + "fileName" : "AbstractEventExecutor.java", + "lineNumber" : 163, + "className" : "io.netty.util.concurrent.AbstractEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "runAllTasks", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 404, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "NioEventLoop.java", + "lineNumber" : 495, + "className" : "io.netty.channel.nio.NioEventLoop", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 905, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor$5", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : "fake.blobfake.core.windows.net", + "localizedMessage" : "fake.blobfake.core.windows.net", + "suppressed" : [ ] + }, + "ClassName" : "java.net.UnknownHostException" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "lookupAllHostAddr", + "fileName" : "Inet6AddressImpl.java", + "lineNumber" : -2, + "className" : "java.net.Inet6AddressImpl", + "nativeMethod" : true + }, { + "methodName" : "lookupAllHostAddr", + "fileName" : "InetAddress.java", + "lineNumber" : 929, + "className" : "java.net.InetAddress$2", + "nativeMethod" : false + }, { + "methodName" : "getAddressesFromNameService", + "fileName" : "InetAddress.java", + "lineNumber" : 1324, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName0", + "fileName" : "InetAddress.java", + "lineNumber" : 1277, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1193, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1127, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1077, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 146, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "doPrivileged", + "fileName" : "AccessController.java", + "lineNumber" : -2, + "className" : "java.security.AccessController", + "nativeMethod" : true + }, { + "methodName" : "addressByName", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "DefaultNameResolver.java", + "lineNumber" : 43, + "className" : "io.netty.resolver.DefaultNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 63, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 55, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 57, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 32, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "AbstractAddressResolver.java", + "lineNumber" : 108, + "className" : "io.netty.resolver.AbstractAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolveAndConnect0", + "fileName" : "Bootstrap.java", + "lineNumber" : 208, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "Bootstrap.java", + "lineNumber" : 49, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 188, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 174, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "notifyListener0", + "fileName" : "DefaultPromise.java", + "lineNumber" : 511, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListenersNow", + "fileName" : "DefaultPromise.java", + "lineNumber" : 485, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListeners", + "fileName" : "DefaultPromise.java", + "lineNumber" : 424, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultPromise.java", + "lineNumber" : 103, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultChannelPromise.java", + "lineNumber" : 84, + "className" : "io.netty.channel.DefaultChannelPromise", + "nativeMethod" : false + }, { + "methodName" : "safeSetSuccess", + "fileName" : "AbstractChannel.java", + "lineNumber" : 982, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "register0", + "fileName" : "AbstractChannel.java", + "lineNumber" : 516, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "access$200", + "fileName" : "AbstractChannel.java", + "lineNumber" : 427, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "AbstractChannel.java", + "lineNumber" : 486, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe$1", + "nativeMethod" : false + }, { + "methodName" : "safeExecute", + "fileName" : "AbstractEventExecutor.java", + "lineNumber" : 163, + "className" : "io.netty.util.concurrent.AbstractEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "runAllTasks", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 404, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "NioEventLoop.java", + "lineNumber" : 495, + "className" : "io.netty.channel.nio.NioEventLoop", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 905, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor$5", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : "fake.blobfake.core.windows.net", + "localizedMessage" : "fake.blobfake.core.windows.net", + "suppressed" : [ ] + }, + "ClassName" : "java.net.UnknownHostException" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : null, + "Exception" : { + "Throwable" : { + "cause" : null, + "stackTrace" : [ { + "methodName" : "getAllByName0", + "fileName" : "InetAddress.java", + "lineNumber" : 1281, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1193, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getAllByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1127, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "getByName", + "fileName" : "InetAddress.java", + "lineNumber" : 1077, + "className" : "java.net.InetAddress", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 146, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils$8", + "nativeMethod" : false + }, { + "methodName" : "doPrivileged", + "fileName" : "AccessController.java", + "lineNumber" : -2, + "className" : "java.security.AccessController", + "nativeMethod" : true + }, { + "methodName" : "addressByName", + "fileName" : "SocketUtils.java", + "lineNumber" : 143, + "className" : "io.netty.util.internal.SocketUtils", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "DefaultNameResolver.java", + "lineNumber" : 43, + "className" : "io.netty.resolver.DefaultNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 63, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "SimpleNameResolver.java", + "lineNumber" : 55, + "className" : "io.netty.resolver.SimpleNameResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 57, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolve", + "fileName" : "InetSocketAddressResolver.java", + "lineNumber" : 32, + "className" : "io.netty.resolver.InetSocketAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "resolve", + "fileName" : "AbstractAddressResolver.java", + "lineNumber" : 108, + "className" : "io.netty.resolver.AbstractAddressResolver", + "nativeMethod" : false + }, { + "methodName" : "doResolveAndConnect0", + "fileName" : "Bootstrap.java", + "lineNumber" : 208, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "access$000", + "fileName" : "Bootstrap.java", + "lineNumber" : 49, + "className" : "io.netty.bootstrap.Bootstrap", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 188, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "operationComplete", + "fileName" : "Bootstrap.java", + "lineNumber" : 174, + "className" : "io.netty.bootstrap.Bootstrap$1", + "nativeMethod" : false + }, { + "methodName" : "notifyListener0", + "fileName" : "DefaultPromise.java", + "lineNumber" : 511, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListenersNow", + "fileName" : "DefaultPromise.java", + "lineNumber" : 485, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "notifyListeners", + "fileName" : "DefaultPromise.java", + "lineNumber" : 424, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultPromise.java", + "lineNumber" : 103, + "className" : "io.netty.util.concurrent.DefaultPromise", + "nativeMethod" : false + }, { + "methodName" : "trySuccess", + "fileName" : "DefaultChannelPromise.java", + "lineNumber" : 84, + "className" : "io.netty.channel.DefaultChannelPromise", + "nativeMethod" : false + }, { + "methodName" : "safeSetSuccess", + "fileName" : "AbstractChannel.java", + "lineNumber" : 982, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "register0", + "fileName" : "AbstractChannel.java", + "lineNumber" : 516, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "access$200", + "fileName" : "AbstractChannel.java", + "lineNumber" : 427, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "AbstractChannel.java", + "lineNumber" : 486, + "className" : "io.netty.channel.AbstractChannel$AbstractUnsafe$1", + "nativeMethod" : false + }, { + "methodName" : "safeExecute", + "fileName" : "AbstractEventExecutor.java", + "lineNumber" : 163, + "className" : "io.netty.util.concurrent.AbstractEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "runAllTasks", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 404, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "NioEventLoop.java", + "lineNumber" : 495, + "className" : "io.netty.channel.nio.NioEventLoop", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "SingleThreadEventExecutor.java", + "lineNumber" : 905, + "className" : "io.netty.util.concurrent.SingleThreadEventExecutor$5", + "nativeMethod" : false + }, { + "methodName" : "run", + "fileName" : "Thread.java", + "lineNumber" : 748, + "className" : "java.lang.Thread", + "nativeMethod" : false + } ], + "message" : "fake.blobfake.core.windows.net", + "localizedMessage" : "fake.blobfake.core.windows.net", + "suppressed" : [ ] + }, + "ClassName" : "java.net.UnknownHostException" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe07b28-201e-004c-67fd-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:53:01 GMT", + "x-ms-client-request-id" : "16cff8bb-4ebc-4600-a591-f7ceabc20dae" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcinvalidaccountname&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe07b72-201e-004c-21fd-59f769000000", + "Body" : "jtcinvalidaccountnamejtcinvalidaccountname0serviceapitestinvalidaccountname4dd87860Fri, 23 Aug 2019 21:52:01 GMT\"0x8D728142128B84E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:53:01 GMT", + "x-ms-client-request-id" : "66fa78cc-8be7-481a-99ae-f0d173d7fa60", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcinvalidaccountname0serviceapitestinvalidaccountname4dd87860?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe07b88-201e-004c-31fd-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:53:01 GMT", + "x-ms-client-request-id" : "38d1de1d-f0da-4f76-93ad-bc35674fc8cb" + }, + "Exception" : null + } ], + "variables" : [ "jtcinvalidaccountname0serviceapitestinvalidaccountname4dd87860" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainers.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainers.json new file mode 100644 index 000000000000..dc5956a5662f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainers.json @@ -0,0 +1,120 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainers0serviceapitestlistcontainersd4e01803ca20?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7281409E4587D\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809bca-301e-0094-76fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "eac9d35b-b302-4a4a-9f13-b1e1b8672ee8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "f7809be8-301e-0094-12fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "600760cc-85aa-4565-b28d-9ccae9d4f33a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtc&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809c3a-301e-0094-57fc-5950b8000000", + "Body" : "jtcjtclistcontainers0serviceapitestlistcontainersd4e01803ca20Fri, 23 Aug 2019 21:51:22 GMT\"0x8D7281409E4587D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "778cbaa8-792d-4ae0-a19a-839429ee2b22", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "f7809c53-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "fd631fc7-e74f-430d-85d7-9bfc22d98d47" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistcontainers&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809c72-301e-0094-05fc-5950b8000000", + "Body" : "jtclistcontainersjtclistcontainers0serviceapitestlistcontainersd4e01803ca20Fri, 23 Aug 2019 21:51:22 GMT\"0x8D7281409E4587D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "901e2e66-0843-490d-ac76-dd2dd58f4193", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainers0serviceapitestlistcontainersd4e01803ca20?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809c86-301e-0094-17fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "31c53614-af49-4a8f-b693-26ea0b148e9c" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainers0serviceapitestlistcontainersd4e01803ca20" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersdetails.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersdetails.json new file mode 100644 index 000000000000..641e49be918f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersdetails.json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersdetails0117653bf1cbf17ceb49d0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140AB93F77\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809f8a-301e-0094-53fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "5cb6ed0e-7856-417a-a2ec-635725255532" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "f7809fb6-301e-0094-7afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "69bcfeb8-94b6-4d43-85ef-93fde3adb7b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/aaajtclistcontainersdetails1588756c029606160545ac?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140AC43E8B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809fd9-301e-0094-19fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "9b077c50-02ed-4d62-acb6-ed2eb7eca3b8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=aaajtc&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780a038-301e-0094-73fc-5950b8000000", + "Body" : "aaajtcaaajtclistcontainersdetails1588756c029606160545acFri, 23 Aug 2019 21:51:24 GMT\"0x8D728140AC43E8B\"unlockedavailable$account-encryption-keyfalsefalsefalsebar", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "73e9ac39-cdee-474c-8488-19d34ed14c1f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/aaajtclistcontainersdetails1588756c029606160545ac?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780a048-301e-0094-03fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "06c85ee9-0856-4e54-948f-bca0fac563d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "f780a05e-301e-0094-19fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "da3f950e-bce5-476a-a249-89fa56a6ca6a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistcontainersdetails&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780a074-301e-0094-2ffc-5950b8000000", + "Body" : "jtclistcontainersdetailsjtclistcontainersdetails0117653bf1cbf17ceb49d0Fri, 23 Aug 2019 21:51:24 GMT\"0x8D728140AB93F77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "b3f004a8-e602-4d05-932e-da0c2c4deeb6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersdetails0117653bf1cbf17ceb49d0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780a085-301e-0094-40fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "227d8d92-18ea-49f5-9d13-e67034b7f50c" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersdetails0117653bf1cbf17ceb49d0", "jtclistcontainersdetails1588756c029606160545ac" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerserror.json new file mode 100644 index 000000000000..66e27501e89c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerserror.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerserror071402810e24302ae9451ca?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B5BC261\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfdfd8b6-201e-004c-54fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "79fece96-5805-40a9-b077-6ffe25105436" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfdfd8c1-201e-004c-5dfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "99b0ffff-ef0d-4c1f-80d3-baa5b31e6588" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=garbage%20continuation%20token&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "226", + "StatusCode" : "400", + "x-ms-request-id" : "cfdfd8cf-201e-004c-68fc-59f769000000", + "Body" : "OutOfRangeInputOne of the request inputs is out of range.\nRequestId:cfdfd8cf-201e-004c-68fc-59f769000000\nTime:2019-08-23T21:51:25.1905053Z", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "05e53547-d505-4c23-bdf6-fa76eda3d35e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfdfd8d8-201e-004c-71fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "6c28ce20-621e-4f36-abc0-3556a831ef14" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistcontainerserror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd8e4-201e-004c-7cfc-59f769000000", + "Body" : "jtclistcontainerserrorjtclistcontainerserror071402810e24302ae9451caFri, 23 Aug 2019 21:51:25 GMT\"0x8D728140B5BC261\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "a0afe045-8e88-43e7-948e-ca721dc8aef2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerserror071402810e24302ae9451ca?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd8ef-201e-004c-05fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "4ba47b79-80a6-40ab-b684-6dfb748f2b1d" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainerserror071402810e24302ae9451ca" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmarker.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmarker.json new file mode 100644 index 000000000000..4d1f46758d55 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmarker.json @@ -0,0 +1,500 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker095632f73979e51a244e68b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A2DF5E3\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809d67-301e-0094-65fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "8f54e3c4-8d45-4d88-9ec4-b4123c897869" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "f7809d7b-301e-0094-73fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "d7190a95-b396-47ab-8557-d657e943d14f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker1866757921b8dd214c4a82b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A3ACA1B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809dad-301e-0094-21fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "d149fe7f-60de-4476-a0da-7eb1e13e44b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker24734766ec65b4a8bc42d39?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A429420\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809dd2-301e-0094-3ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "f1234f5b-cc97-43c0-a00f-7c4fb3e7d996" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker397669c8d77cf66b66457ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A47502E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809de0-301e-0094-4cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "ab0d01fe-5802-42f8-9eb1-4f96ba6ce354" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker475385698e9cb759e848b1b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A4C334F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809dee-301e-0094-59fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "87df97cd-9f8d-4d8b-86c9-74be76c09628" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker564090d5fa6e3c695045c88?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A50C846\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809e05-301e-0094-6ffc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "df954384-0456-462c-8b57-1210963ea581" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker64834123e741096c1c4cdf8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A55F994\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809e0f-301e-0094-77fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "1fd49f52-0799-4262-87b1-f6479a8e1015" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker795863bdfb41663873481cb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A5AB5A2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809e22-301e-0094-07fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "23f76328-3d68-40c0-9d09-0e68fffb2dd9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker824430684f1746dc2347cd8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A5F98C7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809e35-301e-0094-17fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "64f1b53b-1552-43fd-b75a-67ec70eb01ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker940838eda08b0a80c34962a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A647BEC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809e41-301e-0094-20fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "920b3cc7-7ccf-4277-b5dc-081f4d65587f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker101852793173450b4cb4f2c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A6910DF\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809e4f-301e-0094-2bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "f0bd1f3d-5000-43df-87b4-366c329c7e04" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809e5e-301e-0094-38fc-5950b8000000", + "Body" : "$rootFri, 23 Aug 2019 21:31:00 GMT\"0x8D72811318929AD\"unlockedavailable$account-encryption-keyfalsefalsefalse$webFri, 23 Aug 2019 21:49:11 GMT\"0x8D72813BBB7D121\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker095632f73979e51a244e68bFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A2DF5E3\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker101852793173450b4cb4f2cFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A6910DF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker1866757921b8dd214c4a82bFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A3ACA1B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker24734766ec65b4a8bc42d39Fri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A429420\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker397669c8d77cf66b66457abFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A47502E\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker475385698e9cb759e848b1bFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A4C334F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker564090d5fa6e3c695045c88Fri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A50C846\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker64834123e741096c1c4cdf8Fri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A55F994\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker795863bdfb41663873481cbFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A5AB5A2\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker824430684f1746dc2347cd8Fri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A5F98C7\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker940838eda08b0a80c34962aFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A647BEC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "cfa61f35-b171-4d39-9692-697bda9fef0b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "f7809e77-301e-0094-50fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "8c1cc9fa-f4b0-4df2-b78f-4757595fc9c1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistcontainersmarker&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809e87-301e-0094-5efc-5950b8000000", + "Body" : "jtclistcontainersmarkerjtclistcontainersmarker095632f73979e51a244e68bFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A2DF5E3\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker101852793173450b4cb4f2cFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A6910DF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker1866757921b8dd214c4a82bFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A3ACA1B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker24734766ec65b4a8bc42d39Fri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A429420\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker397669c8d77cf66b66457abFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A47502E\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker475385698e9cb759e848b1bFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A4C334F\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker564090d5fa6e3c695045c88Fri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A50C846\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker64834123e741096c1c4cdf8Fri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A55F994\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker795863bdfb41663873481cbFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A5AB5A2\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker824430684f1746dc2347cd8Fri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A5F98C7\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker940838eda08b0a80c34962aFri, 23 Aug 2019 21:51:23 GMT\"0x8D728140A647BEC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "9cc16fb8-2459-47b8-ad55-fad86e051f23", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker095632f73979e51a244e68b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809eab-301e-0094-01fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "2c69c75d-7569-4ccb-ba29-e78908d9bd3a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker101852793173450b4cb4f2c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809ebf-301e-0094-13fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "d05c1a8f-195a-4ba9-8058-35f8be480dc6" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker1866757921b8dd214c4a82b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809ed3-301e-0094-26fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "76707a85-7b3d-45ef-bbc6-42d21343eaa4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker24734766ec65b4a8bc42d39?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809ee9-301e-0094-3afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "a2f24c3e-ed0c-41f6-8daa-025e70a4880c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker397669c8d77cf66b66457ab?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809efb-301e-0094-4bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "9c37dde1-5fd7-4d28-ba1f-eefe69d2cf14" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker475385698e9cb759e848b1b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809f12-301e-0094-61fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "69381ca1-ccf3-437a-982d-9bcb4de29839" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker564090d5fa6e3c695045c88?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809f1f-301e-0094-6dfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "b78139d4-f875-43ef-b7ec-994fa320c078" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker64834123e741096c1c4cdf8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809f36-301e-0094-01fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "d423305a-23aa-4509-b56b-8f6eec91e3c4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker795863bdfb41663873481cb?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809f4a-301e-0094-15fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "9330e561-59aa-4c68-92ba-dd15a2481701" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker824430684f1746dc2347cd8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809f5f-301e-0094-28fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "2c1c046a-f0c8-43e8-acb3-8422140d6384" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmarker940838eda08b0a80c34962a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809f75-301e-0094-3efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "9a716443-b953-4e84-827d-b578b77f280c" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersmarker095632f73979e51a244e68b", "jtclistcontainersmarker1866757921b8dd214c4a82b", "jtclistcontainersmarker24734766ec65b4a8bc42d39", "jtclistcontainersmarker397669c8d77cf66b66457ab", "jtclistcontainersmarker475385698e9cb759e848b1b", "jtclistcontainersmarker564090d5fa6e3c695045c88", "jtclistcontainersmarker64834123e741096c1c4cdf8", "jtclistcontainersmarker795863bdfb41663873481cb", "jtclistcontainersmarker824430684f1746dc2347cd8", "jtclistcontainersmarker940838eda08b0a80c34962a", "jtclistcontainersmarker101852793173450b4cb4f2c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmaxresults.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmaxresults.json new file mode 100644 index 000000000000..23d21770fac0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmaxresults.json @@ -0,0 +1,350 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults036594ca878869c1d44da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140AF2D385\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780a09d-301e-0094-58fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:23 GMT", + "x-ms-client-request-id" : "074f4703-491a-4735-aedf-c63337dd9080" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "f780a0b1-301e-0094-6afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "f7285647-e5fe-48f5-9026-ed6d83c7dbdb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults157004db9e9cb4410d43c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140AFD5D54\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780a0cb-301e-0094-01fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "385e430c-1d90-4a55-8065-20d27e40beb6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults280999bc2ff719d171439?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B02406B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780a0e9-301e-0094-1cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "e7cdbe98-599a-47cf-927f-3a186b8a8ec9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults336986148f26b28170416?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B07E719\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780a108-301e-0094-36fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "4be0bc22-3be9-4e66-a80b-a48e60390bd0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults4835257ce729f864fe405?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B0CA327\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780a122-301e-0094-4efc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "1e467ccc-706d-466a-a27c-f6f2dfc899d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults554650dde84a797352496?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B115F28\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f780a143-301e-0094-6afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "09f35348-514e-4d0f-894f-c77cddf57493" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?maxresults=3&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780a167-301e-0094-06fc-5950b8000000", + "Body" : "3$rootFri, 23 Aug 2019 21:31:00 GMT\"0x8D72811318929AD\"unlockedavailable$account-encryption-keyfalsefalsefalse$webFri, 23 Aug 2019 21:49:11 GMT\"0x8D72813BBB7D121\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults036594ca878869c1d44daFri, 23 Aug 2019 21:51:24 GMT\"0x8D728140AF2D385\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtclistcontainersmaxresults157004db9e9cb4410d43c", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "0b87c3da-e747-4001-8c03-5a31f44095e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtclistcontainersmaxresults157004db9e9cb4410d43c&maxresults=3&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780a18a-301e-0094-24fc-5950b8000000", + "Body" : "/azstoragesdkaccount/jtclistcontainersmaxresults157004db9e9cb4410d43c3jtclistcontainersmaxresults157004db9e9cb4410d43cFri, 23 Aug 2019 21:51:24 GMT\"0x8D728140AFD5D54\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults280999bc2ff719d171439Fri, 23 Aug 2019 21:51:24 GMT\"0x8D728140B02406B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults336986148f26b28170416Fri, 23 Aug 2019 21:51:24 GMT\"0x8D728140B07E719\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtclistcontainersmaxresults4835257ce729f864fe405", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "e997152b-88aa-49a0-a50e-5ec160955f22", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtclistcontainersmaxresults4835257ce729f864fe405&maxresults=3&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f780a199-301e-0094-33fc-5950b8000000", + "Body" : "/azstoragesdkaccount/jtclistcontainersmaxresults4835257ce729f864fe4053jtclistcontainersmaxresults4835257ce729f864fe405Fri, 23 Aug 2019 21:51:24 GMT\"0x8D728140B0CA327\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults554650dde84a797352496Fri, 23 Aug 2019 21:51:24 GMT\"0x8D728140B115F28\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "10a161f7-1132-4442-845b-503724c449a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults157004db9e9cb4410d43c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd84d-201e-004c-7efc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "3bff3711-4bf4-4b3b-a655-69bdfce93f8a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults280999bc2ff719d171439?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd85d-201e-004c-09fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "c30a97b4-8e2c-4fd8-897b-abd8a6560f49" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults336986148f26b28170416?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd866-201e-004c-12fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "a7b3cd56-d260-4c9d-b5ca-a022827ffa78" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults4835257ce729f864fe405?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd872-201e-004c-1cfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "d78dd583-9a22-4812-bbf6-82da64e8bbfe" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults554650dde84a797352496?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd880-201e-004c-27fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "c91cdf73-207a-4cb5-a3eb-83d94589085b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfdfd889-201e-004c-30fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "fffcf596-9bd3-4b14-882d-85556b0173b8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistcontainersmaxresults&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd899-201e-004c-39fc-59f769000000", + "Body" : "jtclistcontainersmaxresultsjtclistcontainersmaxresults036594ca878869c1d44daFri, 23 Aug 2019 21:51:24 GMT\"0x8D728140AF2D385\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "abb8ae87-00b8-4b67-8547-03607c64cbe1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmaxresults036594ca878869c1d44da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd8aa-201e-004c-4afc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "21deafd0-05a4-4524-804b-bb3f7accace6" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersmaxresults036594ca878869c1d44da", "jtclistcontainersmaxresults157004db9e9cb4410d43c", "jtclistcontainersmaxresults280999bc2ff719d171439", "jtclistcontainersmaxresults336986148f26b28170416", "jtclistcontainersmaxresults4835257ce729f864fe405", "jtclistcontainersmaxresults554650dde84a797352496" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmin.json new file mode 100644 index 000000000000..0a67818f1994 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmin.json @@ -0,0 +1,120 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmin0serviceapitestlistcontainersmin222222049?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140A0D1FB7\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f7809ca4-301e-0094-33fc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "a6109d34-602d-4a19-abea-ffa5d20ab9c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "f7809cbf-301e-0094-4bfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "5b42344f-2402-4124-badf-34d1dc79ae0b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809cdb-301e-0094-66fc-5950b8000000", + "Body" : "$rootFri, 23 Aug 2019 21:31:00 GMT\"0x8D72811318929AD\"unlockedavailable$account-encryption-keyfalsefalsefalse$webFri, 23 Aug 2019 21:49:11 GMT\"0x8D72813BBB7D121\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmin0serviceapitestlistcontainersmin222222049Fri, 23 Aug 2019 21:51:22 GMT\"0x8D728140A0D1FB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "b4bdb1b4-8892-40b8-afea-b3e84674ecd0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "f7809d03-301e-0094-0cfc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "787238b9-8a5c-4738-ab7a-70bd09f9e80b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistcontainersmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809d2c-301e-0094-32fc-5950b8000000", + "Body" : "jtclistcontainersminjtclistcontainersmin0serviceapitestlistcontainersmin222222049Fri, 23 Aug 2019 21:51:22 GMT\"0x8D728140A0D1FB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "d5336ad9-7ba9-42fb-966a-2a0bfc9717cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainersmin0serviceapitestlistcontainersmin222222049?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "f7809d4a-301e-0094-4afc-5950b8000000", + "Date" : "Fri, 23 Aug 2019 21:51:22 GMT", + "x-ms-client-request-id" : "d69f4678-9718-436e-9718-7f389a5ce7af" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersmin0serviceapitestlistcontainersmin222222049" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerswithtimeoutstillbackedbypagedflux.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerswithtimeoutstillbackedbypagedflux.json new file mode 100644 index 000000000000..02ef5b87f9f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerswithtimeoutstillbackedbypagedflux.json @@ -0,0 +1,350 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux020719b85?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B79B20F\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfdfd900-201e-004c-14fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "a06dd1ac-9da9-48fa-a3f9-57f83e7ad692" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfdfd909-201e-004c-1afc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "ffc37d18-4a8b-4cb4-b671-ae7a0dc8d975" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux170034d10?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B84D861\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfdfd911-201e-004c-21fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "4743af3f-551c-4fb7-a44f-39ba82ea5cc9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux2686008b9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B89E2B4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfdfd921-201e-004c-2cfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "01714fe9-4c61-4527-9c2b-89914dbcf1e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux364945e8e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B8F141E\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfdfd934-201e-004c-3cfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "5ebe11f3-ec1e-4309-9d76-01be3cf108f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux440082d23?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B93F759\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfdfd945-201e-004c-4bfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "8fabe185-2922-42b1-9d2c-2fab704fa2ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux56845425d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140B9901A2\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfdfd959-201e-004c-5bfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "3aa6c341-86d3-4b85-bc20-abd232789c8b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?maxresults=3&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd962-201e-004c-61fc-59f769000000", + "Body" : "3$rootFri, 23 Aug 2019 21:31:00 GMT\"0x8D72811318929AD\"unlockedavailable$account-encryption-keyfalsefalsefalse$webFri, 23 Aug 2019 21:49:11 GMT\"0x8D72813BBB7D121\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux020719b85Fri, 23 Aug 2019 21:51:25 GMT\"0x8D728140B79B20F\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux170034d10", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "20c42f08-641f-4a6c-bf12-26fe0604c2fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux170034d10&maxresults=3&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd96b-201e-004c-6afc-59f769000000", + "Body" : "/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux170034d103jtclistcontainerswithtimeoutstillbackedbypagedflux170034d10Fri, 23 Aug 2019 21:51:25 GMT\"0x8D728140B84D861\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux2686008b9Fri, 23 Aug 2019 21:51:25 GMT\"0x8D728140B89E2B4\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux364945e8eFri, 23 Aug 2019 21:51:25 GMT\"0x8D728140B8F141E\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux440082d23", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "c37b9f94-0168-4f69-a8d2-aa937dbf6d65", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux440082d23&maxresults=3&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd96f-201e-004c-6efc-59f769000000", + "Body" : "/azstoragesdkaccount/jtclistcontainerswithtimeoutstillbackedbypagedflux440082d233jtclistcontainerswithtimeoutstillbackedbypagedflux440082d23Fri, 23 Aug 2019 21:51:25 GMT\"0x8D728140B93F759\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux56845425dFri, 23 Aug 2019 21:51:25 GMT\"0x8D728140B9901A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "4c759e35-01e0-4335-9a08-7f8b5328733b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux170034d10?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd97b-201e-004c-78fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:24 GMT", + "x-ms-client-request-id" : "166c689e-42e4-4bce-b67e-badff5665294" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux2686008b9?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd986-201e-004c-02fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:25 GMT", + "x-ms-client-request-id" : "38f2a8c7-1629-4ab8-bbee-1504f1b7fa51" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux364945e8e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd990-201e-004c-0bfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:25 GMT", + "x-ms-client-request-id" : "a24d7b60-1ce9-415b-bc88-ab9f97a25801" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux440082d23?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd999-201e-004c-13fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:25 GMT", + "x-ms-client-request-id" : "78dbc6d8-089b-4c05-9d11-6e7142a25d4f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux56845425d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd9a3-201e-004c-1bfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:25 GMT", + "x-ms-client-request-id" : "3e0cd589-ffae-4c7e-a2f9-168eedad83f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfdfd9a9-201e-004c-21fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:25 GMT", + "x-ms-client-request-id" : "00e88471-8a55-423f-9fa8-4d55361b0cc4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtclistcontainerswithtimeoutstillbackedbypagedflux&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd9bf-201e-004c-31fc-59f769000000", + "Body" : "jtclistcontainerswithtimeoutstillbackedbypagedfluxjtclistcontainerswithtimeoutstillbackedbypagedflux020719b85Fri, 23 Aug 2019 21:51:25 GMT\"0x8D728140B79B20F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:25 GMT", + "x-ms-client-request-id" : "c2243c11-ab03-4bb9-8ce6-a902b32c05e3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux020719b85?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfdfd9cd-201e-004c-3cfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:25 GMT", + "x-ms-client-request-id" : "da0aeee1-04b1-4333-be0b-eba0b630c432" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainerswithtimeoutstillbackedbypagedflux020719b85", "jtclistcontainerswithtimeoutstillbackedbypagedflux170034d10", "jtclistcontainerswithtimeoutstillbackedbypagedflux2686008b9", "jtclistcontainerswithtimeoutstillbackedbypagedflux364945e8e", "jtclistcontainerswithtimeoutstillbackedbypagedflux440082d23", "jtclistcontainerswithtimeoutstillbackedbypagedflux56845425d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetgetproperties.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetgetproperties.json new file mode 100644 index 000000000000..533c29106165 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetgetproperties.json @@ -0,0 +1,143 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetgetproperties0serviceapitestsetgetpropertiesffe7200488?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728140BE9314B\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfdfda01-201e-004c-69fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:25 GMT", + "x-ms-client-request-id" : "629da275-05f9-43cd-9d49-9930d2c4c809" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfdfda10-201e-004c-77fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:25 GMT", + "x-ms-client-request-id" : "daca6db1-3ef6-44fa-8ef4-e30316f1bd11" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfdfda27-201e-004c-0afc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:25 GMT", + "x-ms-client-request-id" : "714f441d-670c-4a2c-a3f3-502d2b9fd0c8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe0078e-201e-004c-4bfc-59f769000000", + "Body" : "1.0truefalsefalsetrue51.0truetruetrue51.0truetruetrue5GET,PUT,HEAD*x-ms-versionx-ms-client-request-id10true5truemyIndex.htmlcustom/error/path.html2016-05-31", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "c8e5de2f-ae5d-4ea2-9f0a-0aec153675a8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe007a7-201e-004c-5ffc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "86c4159f-5df6-47b3-9fb6-7ab82e1f5041" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetgetproperties&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe007bc-201e-004c-6bfc-59f769000000", + "Body" : "jtcsetgetpropertiesjtcsetgetproperties0serviceapitestsetgetpropertiesffe7200488Fri, 23 Aug 2019 21:51:26 GMT\"0x8D728140BE9314B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "8012c1ed-c207-425e-b35f-9e8b9a9d6ccc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetgetproperties0serviceapitestsetgetpropertiesffe7200488?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe007c7-201e-004c-75fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "224af830-f4e0-4c6a-8787-2c11ce21795d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetgetproperties0serviceapitestsetgetpropertiesffe7200488" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropserror.json new file mode 100644 index 000000000000..4b0be6983488 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropserror.json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetpropserror0serviceapitestsetpropserroraca18238a88da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728141E1D0136\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe0085b-201e-004c-5bfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "2520c810-7f9e-4637-b86e-a8b49f6ae3f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe0086f-201e-004c-68fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "b48cfbd0-2a5d-4330-b13f-e1277dd57be6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://error.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "472", + "StatusCode" : "403", + "x-ms-request-id" : "af83ba0d-c01e-00fe-1efc-596566000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:af83ba0d-c01e-00fe-1efc-596566000000\nTime:2019-08-23T21:51:56.9587302ZCannot find the claimed account when trying to GetProperties for the account azstoragesdkaccount.", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00926-201e-004c-72fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "cad5d6f9-926d-44ad-8f28-975b558cb4e2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetpropserror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe0092f-201e-004c-79fc-59f769000000", + "Body" : "jtcsetpropserrorjtcsetpropserror0serviceapitestsetpropserroraca18238a88daFri, 23 Aug 2019 21:51:56 GMT\"0x8D728141E1D0136\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "10b45d05-3ed7-4b5d-9dab-a9dc644e2703", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetpropserror0serviceapitestsetpropserroraca18238a88da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe0093f-201e-004c-04fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:56 GMT", + "x-ms-client-request-id" : "ad7f4cec-6e96-4484-9815-5bf8c4003a23" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetpropserror0serviceapitestsetpropserroraca18238a88da" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropsmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropsmin.json new file mode 100644 index 000000000000..9a8e538b918a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropsmin.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetpropsmin0serviceapitestsetpropsmin6116783558aabe3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728141DF65CCC\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:51:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cfe007e9-201e-004c-0afc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "36844029-1cbd-4f66-b7d2-5726aaa2c2e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe007f7-201e-004c-15fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "9393f959-b286-407d-94cd-e47058488c22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe00810-201e-004c-23fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "182a43fe-f2be-4751-99bb-5965cf7ea168" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "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" : "cfe0081d-201e-004c-2bfc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "b4b9dd80-41bc-4da2-8491-26c13fb5f618" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsetpropsmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "cfe00832-201e-004c-3cfc-59f769000000", + "Body" : "jtcsetpropsminjtcsetpropsmin0serviceapitestsetpropsmin6116783558aabe3Fri, 23 Aug 2019 21:51:56 GMT\"0x8D728141DF65CCC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "0b8ddd78-f5ef-43c5-98b5-c7d1fa7be97f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsetpropsmin0serviceapitestsetpropsmin6116783558aabe3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "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" : "cfe00840-201e-004c-47fc-59f769000000", + "Date" : "Fri, 23 Aug 2019 21:51:55 GMT", + "x-ms-client-request-id" : "8d542bde-f779-4d92-a498-02bf5a21113d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetpropsmin0serviceapitestsetpropsmin6116783558aabe3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md new file mode 100644 index 000000000000..5ada8e591d32 --- /dev/null +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -0,0 +1,884 @@ +# Azure Blob Storage for Java + +> see https://aka.ms/autorest + +### Setup +```ps +cd C:\work +git clone --recursive https://github.com/Azure/autorest.java/ +cd autorest.java +git checkout v3 +npm install +cd .. +git clone --recursive https://github.com/jianghaolu/autorest.modeler/ +cd autorest.modeler +git checkout headerprefixfix +npm install +``` + +### Generation +```ps +cd +autorest --use=C:/work/autorest.java --use=C:/work/autorest.modeler --version=2.0.4280 +``` + +### Code generation settings +``` yaml +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.BlobStorage/preview/2019-02-02/blob.json +java: true +output-folder: ../ +namespace: com.azure.storage.blob +enable-xml: true +generate-client-interfaces: false +sync-methods: none +license-header: MICROSOFT_MIT_SMALL +add-context-parameter: true +``` + +### /{containerName}?restype=container +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + $.delete.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?restype=container&comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container&comp=metadata"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?restype=container&comp=acl +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container&comp=acl"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?comp=lease&restype=container&acquire +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?comp=lease&restype=container&acquire"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?comp=lease&restype=container&release +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?comp=lease&restype=container&release"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?comp=lease&restype=container&renew +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?comp=lease&restype=container&renew"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?comp=lease&restype=container&break +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?comp=lease&restype=container&break"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?comp=lease&restype=container&change +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?comp=lease&restype=container&change"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?restype=container&comp=list&flat +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container&comp=list&flat"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?restype=container&comp=list&hierarchy +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container&comp=list&hierarchy"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?restype=account&comp=properties +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=account&comp=properties"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}/{blob} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.get.description = "The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or version."; + $.head.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.head.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.delete.description = "If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the \"include=deleted\" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC permissions."; + $.delete.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.delete.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?PageBlob +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?PageBlob"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?AppendBlob +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?AppendBlob"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=appendblock +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=appendblock"] + transform: > + $.put.consumes = ["application/octet-stream"]; +``` + +### /{containerName}/{blob}?BlockBlob +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?BlockBlob"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=undelete +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=undelete"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=properties&SetHTTPHeaders +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=properties&SetHTTPHeaders"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=metadata"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=lease&acquire +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=lease&acquire"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=lease&release +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=lease&release"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=lease&renew +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=lease&renew"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=lease&change +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=lease&change"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=lease&break +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=lease&break"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=snapshot +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=snapshot"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=copy +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=copy"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.put.responses["202"].headers["x-ms-version-id"] = { + "x-ms-client-name": "VersionId", + "type": "string", + "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." + }; + } +``` + +### /{containerName}/{blob}?comp=copy&sync +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=copy&sync"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.put.responses["202"].headers["x-ms-version-id"] = { + "x-ms-client-name": "VersionId", + "type": "string", + "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." + }; + } +``` + +### /{containerName}/{blob}?comp=copy©id={CopyId} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=copy©id={CopyId}"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=tier +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=tier"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?restype=account&comp=properties +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?restype=account&comp=properties"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=block +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=block"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=block&fromURL +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=block&fromURL"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=blocklist +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=blocklist"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=page&update +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&update"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=page&clear +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&clear"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=page&clear +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&clear"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=page&update&fromUrl +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&update&fromUrl"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=pagelist +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=pagelist"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.get.description = "The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a page blob"; + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=pagelist&diff +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=pagelist&diff"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.get.description = "[Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were changed between target blob and previous snapshot or version."; + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=properties&Resize +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=properties&Resize"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=properties&UpdateSequenceNumber +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=properties&UpdateSequenceNumber"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=incrementalcopy +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=incrementalcopy"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=appendblock +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=appendblock"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=appendblock&fromUrl +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=appendblock&fromUrl"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### BlobItem +``` yaml +directive: +- from: swagger-document + where: $.definitions.BlobItem + transform: > + if (!$.required.includes("VersionId")) { + $.required.push("VersionId"); + $.properties.Metadata.type = "object"; + $.properties.Metadata.additionalProperties = { "type": "string" }; + delete $.properties.Metadata.$ref; + $.properties.VersionId = { "type": "string" }; + } + $.properties.IsPrefix = { "type": "boolean" }; +``` + +### BlobMetadata +Deleting out Encryption until https://github.com/Azure/azure-sdk-for-java/issues/5000 is determined. +``` yaml +directive: +- from: swagger-document + where: $.definitions.BlobMetadata + transform: > + delete $.properties +``` + +### BlobProperties +``` yaml +directive: +- from: swagger-document + where: $.definitions.BlobProperties + transform: > + $.properties.CustomerProvidedKeySha256 = { "type": "string" } +``` + +### ListBlobsFlatSegmentResponse +``` yaml +directive: +- from: swagger-document + where: $.definitions.ListBlobsFlatSegmentResponse + transform: > + if (!$.required.includes("Prefix")) { + $.required.push("Prefix"); + $.required.push("Marker"); + $.required.push("MaxResults"); + $.required.push("Delimiter"); + $.required.push("NextMarker"); + } +``` + +### ListBlobsHierarchySegmentResponse +``` yaml +directive: +- from: swagger-document + where: $.definitions.ListBlobsHierarchySegmentResponse + transform: > + if (!$.required.includes("Prefix")) { + $.required.push("Prefix"); + $.required.push("Marker"); + $.required.push("MaxResults"); + $.required.push("Delimiter"); + $.required.push("NextMarker"); + } +``` + +### ListContainersSegmentResponse +``` yaml +directive: +- from: swagger-document + where: $.definitions.ListContainersSegmentResponse + transform: > + if (!$.required.includes("Prefix")) { + $.required.push("Prefix"); + $.required.push("MaxResults"); + $.required.push("NextMarker"); + } +``` + +### SignedIdentifier +``` yaml +directive: +- from: swagger-document + where: $.definitions.SignedIdentifier + transform: > + if ($.xml) { + delete $.xml; + } +- from: swagger-document + where: $.definitions.SignedIdentifiers + transform: > + $.items.xml = { "name": "SignedIdentifier" } +``` + +### KeyInfo +``` yaml +directive: +- from: swagger-document + where: $.parameters.KeyInfo + transform: > + if ($["x-ms-parameter-location"]) { + delete $["x-ms-parameter-location"]; + } +``` + +### Make AccessTier Unique +autorest.python complains that the same enum has different values +``` yaml +directive: +- from: swagger-document + where: $.parameters.AccessTierRequired + transform: > + $["x-ms-enum"].name = "AccessTierRequired"; +- from: swagger-document + where: $.parameters.AccessTierOptional + transform: > + $["x-ms-enum"].name = "AccessTierOptional"; +``` + +### Extra parameters +``` yaml +directive: +- from: swagger-document + where: $.parameters + transform: > + if (!$.CacheControl) { + $.CacheControl = { + "name": "Cache-Control", + "x-ms-client-name": "cacheControl", + "in": "header", + "required": false, + "type": "string", + "x-ms-parameter-location": "method", + "description": "Cache control for given resource" + }; + } +``` + +### /{containerName}/{blob}?comp=tags +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=tags"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{filesystem}/{path}?resource=directory&Create +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{filesystem}/{path}?resource=directory&Create"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("Filesystem")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "Filesystem" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Path" }); + } +``` + +### /{filesystem}/{path}?DirectoryRename +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{filesystem}/{path}?DirectoryRename"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("Filesystem")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "Filesystem" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Path" }); + } +``` + +### /{filesystem}/{path}?DirectoryDelete +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{filesystem}/{path}?DirectoryDelete"] + transform: > + let param = $.delete.parameters[0]; + if (!param["$ref"].endsWith("Filesystem")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.delete.parameters.splice(0, 0, { "$ref": path + "Filesystem" }); + $.delete.parameters.splice(1, 0, { "$ref": path + "Path" }); + } +``` + +### /{filesystem}/{path}?FileRename +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{filesystem}/{path}?FileRename"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("Filesystem")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "Filesystem" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Path" }); + } +``` + +### Add the CustomHierarchicalListingDeserializer attribute +``` yaml +directive: +- from: BlobHierarchyListSegment.java + where: $ + transform: > + return $. + replace( + "import com.fasterxml.jackson.annotation.JsonProperty;", + "import com.fasterxml.jackson.annotation.JsonProperty;\nimport com.fasterxml.jackson.databind.annotation.JsonDeserialize;"). + replace( + "public final class BlobHierarchyListSegment {", + "@JsonDeserialize(using = CustomHierarchicalListingDeserializer.class)\npublic final class BlobHierarchyListSegment {"); +``` + diff --git a/sdk/storage/azure-storage-blob/swagger/blob.json b/sdk/storage/azure-storage-blob/swagger/blob.json deleted file mode 100644 index 0bf6a308f327..000000000000 --- a/sdk/storage/azure-storage-blob/swagger/blob.json +++ /dev/null @@ -1,8647 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Azure Blob Storage", - "version": "2018-11-09", - "x-ms-code-generation-settings": { - "header": "MIT", - "strictSpecAdherence": false - } - }, - "x-ms-parameterized-host": { - "hostTemplate": "{url}", - "useSchemePrefix": false, - "positionInOperation": "first", - "parameters": [ - { - "$ref": "#/parameters/Url" - } - ] - }, - "securityDefinitions": { - "blob_shared_key": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - }, - "schemes": [ - "https" - ], - "consumes": [ - "application/xml" - ], - "produces": [ - "application/xml" - ], - "paths": {}, - "x-ms-paths": { - "/?restype=service&comp=properties": { - "put": { - "tags": [ - "service" - ], - "operationId": "Service_SetProperties", - "description": "Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules", - "parameters": [ - { - "$ref": "#/parameters/StorageServiceProperties" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "Success (Accepted)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetProperties", - "description": "gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - }, - "schema": { - "$ref": "#/definitions/StorageServiceProperties" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/?restype=service&comp=stats": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetStatistics", - "description": "Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/StorageServiceStats" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "stats" - ] - } - ] - }, - "/?comp=list": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_ListContainersSegment", - "description": "The List Containers Segment operation returns a list of the containers under the specified account", - "parameters": [ - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListContainersInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - }, - "schema": { - "$ref": "#/definitions/ListContainersSegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/?restype=service&comp=userdelegationkey": { - "post": { - "tags": [ - "service" - ], - "operationId": "Service_GetUserDelegationKey", - "description": "Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication.", - "parameters": [ - { - "$ref": "#/parameters/KeyInfo" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/UserDelegationKey" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "userdelegationkey" - ] - } - ] - }, - "/?restype=account&comp=properties": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetAccountInfo", - "description": "Returns the sku name and account kind ", - "parameters": [ - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-sku-name": { - "x-ms-client-name": "SkuName", - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_GRS", - "Standard_RAGRS", - "Standard_ZRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "SkuName", - "modelAsString": false - }, - "description": "Identifies the sku name of the account" - }, - "x-ms-account-kind": { - "x-ms-client-name": "AccountKind", - "type": "string", - "enum": [ - "Storage", - "BlobStorage", - "StorageV2" - ], - "x-ms-enum": { - "name": "AccountKind", - "modelAsString": false - }, - "description": "Identifies the account kind" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "account" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}?restype=container": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_Create", - "description": "creates a new container under the specified account. If the container with the same name already exists, the operation fails", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/BlobPublicAccess" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "Success, Container created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "container" - ], - "operationId": "Container_GetProperties", - "description": "returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-public-access": { - "x-ms-client-name": "BlobPublicAccess", - "description": "Indicated whether data in the container may be accessed publicly and the level of access", - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "x-ms-has-immutability-policy": { - "x-ms-client-name": "HasImmutabilityPolicy", - "description": "Indicates whether the container has an immutability policy set on it.", - "type": "boolean" - }, - "x-ms-has-legal-hold": { - "x-ms-client-name": "HasLegalHold", - "description": "Indicates whether the container has a legal hold.", - "type": "boolean" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "container" - ], - "operationId": "Container_Delete", - "description": "operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "Accepted", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - } - ] - }, - "/{containerName}?restype=container&comp=metadata": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_SetMetadata", - "description": "operation sets one or more user-defined name-value pairs for the specified container.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{containerName}?restype=container&comp=acl": { - "get": { - "tags": [ - "container" - ], - "operationId": "Container_GetAccessPolicy", - "description": "gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "x-ms-blob-public-access": { - "x-ms-client-name": "BlobPublicAccess", - "description": "Indicated whether data in the container may be accessed publicly and the level of access", - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "put": { - "tags": [ - "container" - ], - "operationId": "Container_SetAccessPolicy", - "description": "sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/ContainerAcl" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobPublicAccess" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "acl" - ] - } - ] - }, - "/{containerName}?comp=lease&restype=container&acquire": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_AcquireLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseDuration" - }, - { - "$ref": "#/parameters/ProposedLeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The Acquire operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a container's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "acquire" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&release": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_ReleaseLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Release operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "release" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&renew": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_RenewLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Renew operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a container's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "renew" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&break": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_BreakLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseBreakPeriod" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The Break operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-time": { - "x-ms-client-name": "LeaseTime", - "type": "integer", - "description": "Approximate time remaining in the lease period, in seconds." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "break" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&change": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_ChangeLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/ProposedLeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Change operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a container's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "change" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?restype=container&comp=list&flat": { - "get": { - "tags": [ - "containers" - ], - "operationId": "Container_ListBlobFlatSegment", - "description": "[Update] The List Blobs operation returns a list of the blobs under the specified container", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListBlobsInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For List Blobs this is 'application/xml'" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/ListBlobsFlatSegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/{containerName}?restype=container&comp=list&hierarchy": { - "get": { - "tags": [ - "containers" - ], - "operationId": "Container_ListBlobHierarchySegment", - "description": "[Update] The List Blobs operation returns a list of the blobs under the specified container", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Delimiter" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListBlobsInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For List Blobs this is 'application/xml'" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/ListBlobsHierarchySegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/{containerName}?restype=account&comp=properties": { - "get": { - "tags": [ - "container" - ], - "operationId": "Container_GetAccountInfo", - "description": "Returns the sku name and account kind ", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-sku-name": { - "x-ms-client-name": "SkuName", - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_GRS", - "Standard_RAGRS", - "Standard_ZRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "SkuName", - "modelAsString": false - }, - "description": "Identifies the sku name of the account" - }, - "x-ms-account-kind": { - "x-ms-client-name": "AccountKind", - "type": "string", - "enum": [ - "Storage", - "BlobStorage", - "StorageV2" - ], - "x-ms-enum": { - "name": "AccountKind", - "modelAsString": false - }, - "description": "Identifies the account kind" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "account" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}": { - "get": { - "tags": [ - "blob" - ], - "operationId": "Blob_Download", - "description": "The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or verison.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/GetRangeContentMD5" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Returns the content of the entire blob.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For Download Blob this is 'application/octet-stream'" - }, - "Content-Range": { - "type": "string", - "description": "Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' request header." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Encoding request header" - }, - "Cache-Control": { - "type": "string", - "description": "This header is returned if it was previously specified for the blob." - }, - "Content-Disposition": { - "type": "string", - "description": "This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition response header field conveys additional information about how to process the response payload, and also can be used to attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the response, but instead show a Save As dialog with a filename other than the blob name specified." - }, - "Content-Language": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Language request header." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-blob-type": { - "x-ms-client-name": "BlobType", - "description": "The blob's type.", - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial blob content." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key." - }, - "x-ms-blob-content-md5": { - "x-ms-client-name": "BlobContentMD5", - "type": "string", - "format": "byte", - "description": "If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 header, with the latter calculated from the requested range" - } - }, - "schema": { - "type": "object", - "format": "file" - } - }, - "206": { - "description": "Returns the content of a specified range of the blob.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For Download Blob this is 'application/octet-stream'" - }, - "Content-Range": { - "type": "string", - "description": "Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' request header." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Encoding request header" - }, - "Cache-Control": { - "type": "string", - "description": "This header is returned if it was previously specified for the blob." - }, - "Content-Disposition": { - "type": "string", - "description": "This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition response header field conveys additional information about how to process the response payload, and also can be used to attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the response, but instead show a Save As dialog with a filename other than the blob name specified." - }, - "Content-Language": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Language request header." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-blob-type": { - "x-ms-client-name": "BlobType", - "description": "The blob's type.", - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial blob content." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)." - }, - "x-ms-blob-content-md5": { - "x-ms-client-name": "BlobContentMD5", - "type": "string", - "format": "byte", - "description": "If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 header, with the latter calculated from the requested range" - } - }, - "schema": { - "type": "object", - "format": "file" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "head": { - "tags": [ - "blob" - ], - "operationId": "Blob_GetProperties", - "description": "The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Returns the properties of the blob.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-creation-time": { - "x-ms-client-name": "CreationTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was created." - }, - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "x-ms-blob-type": { - "x-ms-client-name": "BlobType", - "description": "The blob's type.", - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-incremental-copy": { - "x-ms-client-name": "IsIncrementalCopy", - "type": "boolean", - "description": "Included if the blob is incremental copy blob." - }, - "x-ms-copy-destination-snapshot": { - "x-ms-client-name": "DestinationSnapshot", - "type": "string", - "description": "Included if the blob is incremental copy blob or incremental copy snapshot, if x-ms-copy-status is success. Snapshot time of the last successful incremental copy snapshot for this blob." - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The content type specified for the blob. The default content type is 'application/octet-stream'" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Encoding request header" - }, - "Content-Disposition": { - "type": "string", - "description": "This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition response header field conveys additional information about how to process the response payload, and also can be used to attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the response, but instead show a Save As dialog with a filename other than the blob name specified." - }, - "Content-Language": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Language request header." - }, - "Cache-Control": { - "type": "string", - "description": "This header is returned if it was previously specified for the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial blob content." - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the metadata. This header is only returned when the metadata was encrypted with a customer-provided key." - }, - "x-ms-access-tier": { - "x-ms-client-name": "AccessTier", - "type": "string", - "description": "The tier of page blob on a premium storage account or tier of block blob on blob storage LRS accounts. For a list of allowed premium page blob tiers, see https://docs.microsoft.com/en-us/azure/virtual-machines/windows/premium-storage#features. For blob storage LRS accounts, valid values are Hot/Cool/Archive." - }, - "x-ms-access-tier-inferred": { - "x-ms-client-name": "AccessTierInferred", - "type": "boolean", - "description": "For page blobs on a premium storage account only. If the access tier is not explicitly set on the blob, the tier is inferred based on its content length and this header will be returned with true value." - }, - "x-ms-archive-status": { - "x-ms-client-name": "ArchiveStatus", - "type": "string", - "description": "For blob storage LRS accounts, valid values are rehydrate-pending-to-hot/rehydrate-pending-to-cool. If the blob is being rehydrated and is not complete then this header is returned indicating that rehydrate is pending and also tells the destination tier." - }, - "x-ms-access-tier-change-time": { - "x-ms-client-name": "AccessTierChangeTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "The time the tier was changed on the object. This is only returned if the tier on the block blob was ever set." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "blob" - ], - "operationId": "Blob_Delete", - "description": "If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the \"include=deleted\" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC permissions.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/DeleteSnapshots" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The delete request was accepted and the blob will be deleted.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - } - }, - "/{containerName}/{blob}?PageBlob": { - "put": { - "tags": [ - "blob" - ], - "operationId": "PageBlob_Create", - "description": "The Create operation creates a new page blob.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/BlobContentLengthRequired" - }, - { - "$ref": "#/parameters/BlobSequenceNumber" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The blob was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies a version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-blob-type", - "x-ms-client-name": "blobType", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Specifies the type of blob to create: block blob, page blob, or append blob.", - "type": "string", - "enum": [ - "PageBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?AppendBlob": { - "put": { - "tags": [ - "blob" - ], - "operationId": "AppendBlob_Create", - "description": "The Create Append Blob operation creates a new append blob.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The blob was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies a version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-blob-type", - "x-ms-client-name": "blobType", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Specifies the type of blob to create: block blob, page blob, or append blob.", - "type": "string", - "enum": [ - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?BlockBlob": { - "put": { - "tags": [ - "blob" - ], - "operationId": "BlockBlob_Upload", - "description": "The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the Put Block List operation.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The blob was updated.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies a version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-blob-type", - "x-ms-client-name": "blobType", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Specifies the type of blob to create: block blob, page blob, or append blob.", - "type": "string", - "enum": [ - "BlockBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=undelete": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_Undelete", - "description": "Undelete a blob that was previously soft deleted", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The blob was undeleted successfully.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "undelete" - ] - } - ] - }, - "/{containerName}/{blob}?comp=properties&SetHTTPHeaders": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_SetHTTPHeaders", - "description": "The Set HTTP Headers operation sets system properties on the blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The properties were set successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=metadata": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_SetMetadata", - "description": "The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The metadata was set successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the metadata. This header is only returned when the metadata was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{containerName}/{blob}?comp=lease&acquire": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_AcquireLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseDuration" - }, - { - "$ref": "#/parameters/ProposedLeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The Acquire operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a blobs's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "acquire" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&release": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_ReleaseLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Release operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "release" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&renew": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_RenewLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Renew operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a blobs's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "renew" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&change": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_ChangeLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/ProposedLeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Change operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a blobs's lease" - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "change" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&break": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_BreakLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseBreakPeriod" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The Break operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-time": { - "x-ms-client-name": "LeaseTime", - "type": "integer", - "description": "Approximate time remaining in the lease period, in seconds." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "break" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=snapshot": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_CreateSnapshot", - "description": "The Create Snapshot operation creates a read-only snapshot of a blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The snaptshot was taken successfully.", - "headers": { - "x-ms-snapshot": { - "x-ms-client-name": "Snapshot", - "type": "string", - "description": "Uniquely identifies the snapshot and indicates the snapshot version. It may be used in subsequent requests to access the snapshot" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "True if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise. For a snapshot request, this header is set to true when metadata was provided in the request and encrypted with a customer-provided key." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the source blob. This header is only returned when the blob was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "snapshot" - ] - } - ] - }, - "/{containerName}/{blob}?comp=copy": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_StartCopyFromURL", - "description": "The Start Copy From URL operation copies a blob or an internet resource to a new blob.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/CopySource" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The copy blob has been accepted with the specified copy status.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{containerName}/{blob}?comp=copy&sync": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_CopyFromURL", - "description": "The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/CopySource" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The copy has completed.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "success" - ], - "x-ms-enum": { - "name": "SyncCopyStatusType", - "modelAsString": false - } - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-requires-sync", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "true" - ] - } - ] - }, - "/{containerName}/{blob}?comp=copy©id={CopyId}": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_AbortCopyFromURL", - "description": "The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/CopyId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "The delete request was accepted and the blob will be deleted.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "copy" - ] - }, - { - "name": "x-ms-copy-action", - "x-ms-client-name": "copyActionAbortConstant", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "abort" - ], - "x-ms-parameter-location": "method" - } - ] - }, - "/{containerName}/{blob}?comp=tier": { - "put": { - "tags": [ - "blobs" - ], - "operationId": "Blob_SetTier", - "description": "The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/AccessTier" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - } - ], - "responses": { - "200": { - "description": "The new tier will take effect immediately.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and newer." - } - } - }, - "202": { - "description": "The transition to the new tier is pending.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and newer." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "tier" - ] - } - ] - }, - "/{containerName}/{blob}?restype=account&comp=properties": { - "get": { - "tags": [ - "blob" - ], - "operationId": "Blob_GetAccountInfo", - "description": "Returns the sku name and account kind ", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-sku-name": { - "x-ms-client-name": "SkuName", - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_GRS", - "Standard_RAGRS", - "Standard_ZRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "SkuName", - "modelAsString": false - }, - "description": "Identifies the sku name of the account" - }, - "x-ms-account-kind": { - "x-ms-client-name": "AccountKind", - "type": "string", - "enum": [ - "Storage", - "BlobStorage", - "StorageV2" - ], - "x-ms-enum": { - "name": "AccountKind", - "modelAsString": false - }, - "description": "Identifies the account kind" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "account" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=block": { - "put": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_StageBlock", - "description": "The Stage Block operation creates a new block to be committed as part of a blob", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/BlockId" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the block was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "block" - ] - } - ] - }, - "/{containerName}/{blob}?comp=block&fromURL": { - "put": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_StageBlockFromURL", - "description": "The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from a URL.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/BlockId" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/SourceUrl" - }, - { - "$ref": "#/parameters/SourceRange" - }, - { - "$ref": "#/parameters/SourceContentMD5" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the block was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "block" - ] - } - ] - }, - "/{containerName}/{blob}?comp=blocklist": { - "put": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_CommitBlockList", - "description": "The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "name": "blocks", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/BlockLookupList" - } - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block list was recorded.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies a version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_GetBlockList", - "description": "The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/BlockListType" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The page range was written.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For Get Block List this is 'application/xml'" - }, - "x-ms-blob-content-length": { - "x-ms-client-name": "BlobContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the blob in bytes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/BlockList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "blocklist" - ] - } - ] - }, - "/{containerName}/{blob}?comp=page&update": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_UploadPages", - "description": "The Upload Pages operation writes a range of pages to a page blob", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThanOrEqualTo" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThan" - }, - { - "$ref": "#/parameters/IfSequenceNumberEqualTo" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The page range was written.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for the page blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the pages. This header is only returned when the pages were encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "page" - ] - }, - { - "name": "x-ms-page-write", - "x-ms-client-name": "pageWrite", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. You may specify one of the following options:\n - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update.\n - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that indicates the range to clear, up to maximum blob size.", - "type": "string", - "enum": [ - "update" - ], - "x-ms-enum": { - "name": "PageWriteType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=page&clear": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_ClearPages", - "description": "The Clear Pages operation clears a set of pages from a page blob", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThanOrEqualTo" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThan" - }, - { - "$ref": "#/parameters/IfSequenceNumberEqualTo" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The page range was cleared.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for the page blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "page" - ] - }, - { - "name": "x-ms-page-write", - "x-ms-client-name": "pageWrite", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. You may specify one of the following options:\n - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update.\n - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that indicates the range to clear, up to maximum blob size.", - "type": "string", - "enum": [ - "clear" - ], - "x-ms-enum": { - "name": "PageWriteType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=page&update&fromUrl": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_UploadPagesFromURL", - "description": "The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/SourceUrl" - }, - { - "$ref": "#/parameters/SourceRangeRequiredPutPageFromUrl" - }, - { - "$ref": "#/parameters/SourceContentMD5" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/RangeRequiredPutPageFromUrl" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThanOrEqualTo" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThan" - }, - { - "$ref": "#/parameters/IfSequenceNumberEqualTo" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The page range was written.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for the page blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "page" - ] - }, - { - "name": "x-ms-page-write", - "x-ms-client-name": "pageWrite", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. You may specify one of the following options:\n - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update.\n - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that indicates the range to clear, up to maximum blob size.", - "type": "string", - "enum": [ - "update" - ], - "x-ms-enum": { - "name": "PageWriteType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=pagelist": { - "get": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_GetPageRanges", - "description": "The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a page blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Information on the page blob was found.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "x-ms-blob-content-length": { - "x-ms-client-name": "BlobContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the blob in bytes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/PageList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "pagelist" - ] - } - ] - }, - "/{containerName}/{blob}?comp=pagelist&diff": { - "get": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_GetPageRangesDiff", - "description": "[Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were changed between target blob and previous snapshot or version.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/PrevSnapshot" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Information on the page blob was found.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "x-ms-blob-content-length": { - "x-ms-client-name": "BlobContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the blob in bytes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/PageList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "pagelist" - ] - } - ] - }, - "/{containerName}/{blob}?comp=properties&Resize": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_Resize", - "description": "Resize the Blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/BlobContentLengthRequired" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Blob was resized successfully", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=properties&UpdateSequenceNumber": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_UpdateSequenceNumber", - "description": "Update the sequence number of the blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/SequenceNumberAction" - }, - { - "$ref": "#/parameters/BlobSequenceNumber" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The sequence numbers were updated successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=incrementalcopy": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_CopyIncremental", - "description": "The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/CopySource" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The blob was copied.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "incrementalcopy" - ] - } - ] - }, - "/{containerName}/{blob}?comp=appendblock": { - "put": { - "tags": [ - "appendblob" - ], - "consumes": [ - "application/octet-stream" - ], - "operationId": "AppendBlob_AppendBlock", - "description": "The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobConditionMaxSize" - }, - { - "$ref": "#/parameters/BlobConditionAppendPos" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-append-offset": { - "x-ms-client-name": "BlobAppendOffset", - "type": "string", - "description": "This response header is returned only for append operations. It returns the offset at which the block was committed, in bytes." - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the block was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "appendblock" - ] - } - ] - }, - "/{containerName}/{blob}?comp=appendblock&fromUrl": { - "put": { - "tags": [ - "appendblob" - ], - "operationId": "AppendBlob_AppendBlockFromUrl", - "description": "The Append Block operation commits a new block of data to the end of an existing append blob where the contents are read from a source url. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/SourceUrl" - }, - { - "$ref": "#/parameters/SourceRange" - }, - { - "$ref": "#/parameters/SourceContentMD5" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobConditionMaxSize" - }, - { - "$ref": "#/parameters/BlobConditionAppendPos" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally. If the request version is 2011-08-18 or newer, the ETag value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-append-offset": { - "x-ms-client-name": "BlobAppendOffset", - "type": "string", - "description": "This response header is returned only for append operations. It returns the offset at which the block was committed, in bytes." - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "appendblock" - ] - } - ] - } - }, - "definitions": { - "KeyInfo": { - "type": "object", - "required": [ - "Start", - "Expiry" - ], - "description": "Key information", - "properties": { - "Start": { - "description": "The date-time the key is active in ISO 8601 UTC time", - "type": "string" - }, - "Expiry": { - "description": "The date-time the key expires in ISO 8601 UTC time", - "type": "string" - } - } - }, - "UserDelegationKey": { - "type": "object", - "required": [ - "SignedOid", - "SignedTid", - "SignedStart", - "SignedExpiry", - "SignedService", - "SignedVersion", - "Value" - ], - "description": "A user delegation key", - "properties": { - "SignedOid": { - "description": "The Azure Active Directory object ID in GUID format.", - "type": "string" - }, - "SignedTid": { - "description": "The Azure Active Directory tenant ID in GUID format", - "type": "string" - }, - "SignedStart": { - "description": "The date-time the key is active", - "type": "string", - "format": "date-time" - }, - "SignedExpiry": { - "description": "The date-time the key expires", - "type": "string", - "format": "date-time" - }, - "SignedService": { - "description": "Abbreviation of the Azure Storage service that accepts the key", - "type": "string" - }, - "SignedVersion": { - "description": "The service version that created the key", - "type": "string" - }, - "Value": { - "description": "The key as a base64 string", - "type": "string" - } - } - }, - "PublicAccessType": { - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "CopyStatus": { - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "LeaseDuration": { - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "LeaseState": { - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "LeaseStatus": { - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "StorageError": { - "type": "object", - "properties": { - "Code": { - "type": "string" - }, - "Message": { - "type": "string" - } - } - }, - "AccessPolicy": { - "type": "object", - "required": [ - "Start", - "Expiry", - "Permission" - ], - "description": "An Access policy", - "properties": { - "Start": { - "description": "the date-time the policy is active", - "type": "string", - "format": "date-time" - }, - "Expiry": { - "description": "the date-time the policy expires", - "type": "string", - "format": "date-time" - }, - "Permission": { - "description": "the permissions for the acl policy", - "type": "string" - } - } - }, - "AccessTier": { - "type": "string", - "enum": [ - "P4", - "P6", - "P10", - "P20", - "P30", - "P40", - "P50", - "Hot", - "Cool", - "Archive" - ], - "x-ms-enum": { - "name": "AccessTier", - "modelAsString": true - } - }, - "ArchiveStatus": { - "type": "string", - "enum": [ - "rehydrate-pending-to-hot", - "rehydrate-pending-to-cool" - ], - "x-ms-enum": { - "name": "ArchiveStatus", - "modelAsString": true - } - }, - "BlobItem": { - "xml": { - "name": "Blob" - }, - "description": "An Azure Storage blob", - "type": "object", - "required": [ - "Name", - "Deleted", - "Snapshot", - "VersionId", - "Properties" - ], - "properties": { - "Name": { - "type": "string" - }, - "Deleted": { - "type": "boolean" - }, - "Snapshot": { - "type": "string" - }, - "VersionId": { - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/BlobProperties" - }, - "Metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "IsPrefix": { - "type": "boolean" - } - } - }, - "BlobProperties": { - "xml": { - "name": "Properties" - }, - "description": "Properties of a blob", - "type": "object", - "required": [ - "Etag", - "Last-Modified" - ], - "properties": { - "Creation-Time": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Etag": { - "type": "string", - "format": "etag" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "Size in bytes" - }, - "Content-Type": { - "type": "string" - }, - "Content-Encoding": { - "type": "string" - }, - "Content-Language": { - "type": "string" - }, - "Content-MD5": { - "type": "string", - "format": "byte" - }, - "Content-Disposition": { - "type": "string" - }, - "Cache-Control": { - "type": "string" - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "blobSequenceNumber", - "type": "integer", - "format": "int64" - }, - "BlobType": { - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "LeaseStatus": { - "$ref": "#/definitions/LeaseStatus" - }, - "LeaseState": { - "$ref": "#/definitions/LeaseState" - }, - "LeaseDuration": { - "$ref": "#/definitions/LeaseDuration" - }, - "CopyId": { - "type": "string" - }, - "CopyStatus": { - "$ref": "#/definitions/CopyStatus" - }, - "CopySource": { - "type": "string" - }, - "CopyProgress": { - "type": "string" - }, - "CopyCompletionTime": { - "type": "string", - "format": "date-time-rfc1123" - }, - "CopyStatusDescription": { - "type": "string" - }, - "ServerEncrypted": { - "type": "boolean" - }, - "IncrementalCopy": { - "type": "boolean" - }, - "DestinationSnapshot": { - "type": "string" - }, - "DeletedTime": { - "type": "string", - "format": "date-time-rfc1123" - }, - "RemainingRetentionDays": { - "type": "integer" - }, - "AccessTier": { - "$ref": "#/definitions/AccessTier" - }, - "AccessTierInferred": { - "type": "boolean" - }, - "ArchiveStatus": { - "$ref": "#/definitions/ArchiveStatus" - }, - "CustomerProvidedKeySha256": { - "type": "string" - }, - "AccessTierChangeTime": { - "type": "string", - "format": "date-time-rfc1123" - } - } - }, - "ListBlobsFlatSegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of blobs", - "type": "object", - "required": [ - "ServiceEndpoint", - "ContainerName", - "Prefix", - "Marker", - "MaxResults", - "Delimiter", - "Segment", - "NextMarker" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "ContainerName": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "Delimiter": { - "type": "string" - }, - "Segment": { - "$ref": "#/definitions/BlobFlatListSegment" - }, - "NextMarker": { - "type": "string" - } - } - }, - "ListBlobsHierarchySegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of blobs", - "type": "object", - "required": [ - "ServiceEndpoint", - "ContainerName", - "Prefix", - "Marker", - "MaxResults", - "Delimiter", - "Segment", - "NextMarker" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "ContainerName": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "Delimiter": { - "type": "string" - }, - "Segment": { - "$ref": "#/definitions/BlobHierarchyListSegment" - }, - "NextMarker": { - "type": "string" - } - } - }, - "BlobFlatListSegment": { - "xml": { - "name": "Blobs" - }, - "required": [ - "BlobItems" - ], - "type": "object", - "properties": { - "BlobItems": { - "type": "array", - "items": { - "$ref": "#/definitions/BlobItem" - } - } - } - }, - "BlobHierarchyListSegment": { - "xml": { - "name": "Blobs" - }, - "type": "object", - "required": [ - "BlobItems" - ], - "properties": { - "BlobPrefixes": { - "type": "array", - "items": { - "$ref": "#/definitions/BlobPrefix" - } - }, - "BlobItems": { - "type": "array", - "items": { - "$ref": "#/definitions/BlobItem" - } - } - } - }, - "BlobPrefix": { - "type": "object", - "required": [ - "Name" - ], - "properties": { - "Name": { - "type": "string" - } - } - }, - "Block": { - "type": "object", - "required": [ - "Name", - "Size" - ], - "description": "Represents a single block in a block blob. It describes the block's ID and size.", - "properties": { - "Name": { - "description": "The base64 encoded block ID.", - "type": "string" - }, - "Size": { - "description": "The block size in bytes.", - "type": "integer" - } - } - }, - "BlockList": { - "type": "object", - "properties": { - "CommittedBlocks": { - "xml": { - "wrapped": true - }, - "type": "array", - "items": { - "$ref": "#/definitions/Block" - } - }, - "UncommittedBlocks": { - "xml": { - "wrapped": true - }, - "type": "array", - "items": { - "$ref": "#/definitions/Block" - } - } - } - }, - "BlockLookupList": { - "type": "object", - "properties": { - "Committed": { - "type": "array", - "items": { - "type": "string", - "xml": { - "name": "Committed" - } - } - }, - "Uncommitted": { - "type": "array", - "items": { - "type": "string", - "xml": { - "name": "Uncommitted" - } - } - }, - "Latest": { - "type": "array", - "items": { - "type": "string", - "xml": { - "name": "Latest" - } - } - } - }, - "xml": { - "name": "BlockList" - } - }, - "ContainerItem": { - "xml": { - "name": "Container" - }, - "type": "object", - "required": [ - "Name", - "Properties" - ], - "description": "An Azure Storage container", - "properties": { - "Name": { - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/ContainerProperties" - }, - "Metadata": { - "$ref": "#/definitions/ContainerMetadata" - } - } - }, - "ContainerProperties": { - "type": "object", - "required": [ - "Last-Modified", - "Etag" - ], - "description": "Properties of a container", - "properties": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Etag": { - "type": "string", - "format": "etag" - }, - "LeaseStatus": { - "$ref": "#/definitions/LeaseStatus" - }, - "LeaseState": { - "$ref": "#/definitions/LeaseState" - }, - "LeaseDuration": { - "$ref": "#/definitions/LeaseDuration" - }, - "PublicAccess": { - "$ref": "#/definitions/PublicAccessType" - }, - "HasImmutabilityPolicy": { - "type": "boolean" - }, - "HasLegalHold": { - "type": "boolean" - } - } - }, - "ListContainersSegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of containers", - "type": "object", - "required": [ - "ServiceEndpoint", - "Prefix", - "MaxResults", - "NextMarker", - "ContainerItems" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "ContainerItems": { - "xml": { - "wrapped": true, - "name": "Containers" - }, - "type": "array", - "items": { - "$ref": "#/definitions/ContainerItem" - } - }, - "NextMarker": { - "type": "string" - } - } - }, - "CorsRule": { - "description": "CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain", - "type": "object", - "required": [ - "AllowedOrigins", - "AllowedMethods", - "AllowedHeaders", - "ExposedHeaders", - "MaxAgeInSeconds" - ], - "properties": { - "AllowedOrigins": { - "description": "The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS.", - "type": "string" - }, - "AllowedMethods": { - "description": "The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated)", - "type": "string" - }, - "AllowedHeaders": { - "description": "the request headers that the origin domain may specify on the CORS request.", - "type": "string" - }, - "ExposedHeaders": { - "description": "The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer", - "type": "string" - }, - "MaxAgeInSeconds": { - "description": "The maximum amount time that a browser should cache the preflight OPTIONS request.", - "type": "integer", - "minimum": 0 - } - } - }, - "ErrorCode": { - "description": "Error codes returned by the service", - "type": "string", - "enum": [ - "AccountAlreadyExists", - "AccountBeingCreated", - "AccountIsDisabled", - "AuthenticationFailed", - "AuthorizationFailure", - "ConditionHeadersNotSupported", - "ConditionNotMet", - "EmptyMetadataKey", - "InsufficientAccountPermissions", - "InternalError", - "InvalidAuthenticationInfo", - "InvalidHeaderValue", - "InvalidHttpVerb", - "InvalidInput", - "InvalidMd5", - "InvalidMetadata", - "InvalidQueryParameterValue", - "InvalidRange", - "InvalidResourceName", - "InvalidUri", - "InvalidXmlDocument", - "InvalidXmlNodeValue", - "Md5Mismatch", - "MetadataTooLarge", - "MissingContentLengthHeader", - "MissingRequiredQueryParameter", - "MissingRequiredHeader", - "MissingRequiredXmlNode", - "MultipleConditionHeadersNotSupported", - "OperationTimedOut", - "OutOfRangeInput", - "OutOfRangeQueryParameterValue", - "RequestBodyTooLarge", - "ResourceTypeMismatch", - "RequestUrlFailedToParse", - "ResourceAlreadyExists", - "ResourceNotFound", - "ServerBusy", - "UnsupportedHeader", - "UnsupportedXmlNode", - "UnsupportedQueryParameter", - "UnsupportedHttpVerb", - "AppendPositionConditionNotMet", - "BlobAlreadyExists", - "BlobNotFound", - "BlobOverwritten", - "BlobTierInadequateForContentLength", - "BlockCountExceedsLimit", - "BlockListTooLong", - "CannotChangeToLowerTier", - "CannotVerifyCopySource", - "ContainerAlreadyExists", - "ContainerBeingDeleted", - "ContainerDisabled", - "ContainerNotFound", - "ContentLengthLargerThanTierLimit", - "CopyAcrossAccountsNotSupported", - "CopyIdMismatch", - "FeatureVersionMismatch", - "IncrementalCopyBlobMismatch", - "IncrementalCopyOfEralierVersionSnapshotNotAllowed", - "IncrementalCopySourceMustBeSnapshot", - "InfiniteLeaseDurationRequired", - "InvalidBlobOrBlock", - "InvalidBlobTier", - "InvalidBlobType", - "InvalidBlockId", - "InvalidBlockList", - "InvalidOperation", - "InvalidPageRange", - "InvalidSourceBlobType", - "InvalidSourceBlobUrl", - "InvalidVersionForPageBlobOperation", - "LeaseAlreadyPresent", - "LeaseAlreadyBroken", - "LeaseIdMismatchWithBlobOperation", - "LeaseIdMismatchWithContainerOperation", - "LeaseIdMismatchWithLeaseOperation", - "LeaseIdMissing", - "LeaseIsBreakingAndCannotBeAcquired", - "LeaseIsBreakingAndCannotBeChanged", - "LeaseIsBrokenAndCannotBeRenewed", - "LeaseLost", - "LeaseNotPresentWithBlobOperation", - "LeaseNotPresentWithContainerOperation", - "LeaseNotPresentWithLeaseOperation", - "MaxBlobSizeConditionNotMet", - "NoPendingCopyOperation", - "OperationNotAllowedOnIncrementalCopyBlob", - "PendingCopyOperation", - "PreviousSnapshotCannotBeNewer", - "PreviousSnapshotNotFound", - "PreviousSnapshotOperationNotSupported", - "SequenceNumberConditionNotMet", - "SequenceNumberIncrementTooLarge", - "SnapshotCountExceeded", - "SnaphotOperationRateExceeded", - "SnapshotsPresent", - "SourceConditionNotMet", - "SystemInUse", - "TargetConditionNotMet", - "UnauthorizedBlobOverwrite", - "BlobBeingRehydrated", - "BlobArchived", - "BlobNotArchived" - ], - "x-ms-enum": { - "name": "StorageErrorCode", - "modelAsString": true - } - }, - "GeoReplication": { - "description": "Geo-Replication information for the Secondary Storage Service", - "type": "object", - "required": [ - "Status", - "LastSyncTime" - ], - "properties": { - "Status": { - "description": "The status of the secondary location", - "type": "string", - "enum": [ - "live", - "bootstrap", - "unavailable" - ], - "x-ms-enum": { - "name": "GeoReplicationStatusType", - "modelAsString": true - } - }, - "LastSyncTime": { - "description": "A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads.", - "type": "string", - "format": "date-time-rfc1123" - } - } - }, - "Logging": { - "description": "Azure Analytics Logging settings.", - "type": "object", - "required": [ - "Version", - "Delete", - "Read", - "Write", - "RetentionPolicy" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Delete": { - "description": "Indicates whether all delete requests should be logged.", - "type": "boolean" - }, - "Read": { - "description": "Indicates whether all read requests should be logged.", - "type": "boolean" - }, - "Write": { - "description": "Indicates whether all write requests should be logged.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "ContainerMetadata": { - "type": "object", - "xml": { - "name": "Metadata" - }, - "additionalProperties": { - "type": "string" - } - }, - "BlobMetadata": { - "type": "object", - "xml": { - "name": "Metadata" - }, - "properties": { - "Encrypted": { - "type": "string", - "xml": { - "attribute": true - } - } - }, - "additionalProperties": { - "type": "string" - } - }, - "Metrics": { - "description": "a summary of request statistics grouped by API in hour or minute aggregates for blobs", - "required": [ - "Enabled" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Enabled": { - "description": "Indicates whether metrics are enabled for the Blob service.", - "type": "boolean" - }, - "IncludeAPIs": { - "description": "Indicates whether metrics should generate summary statistics for called API operations.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "PageList": { - "description": "the list of pages", - "type": "object", - "properties": { - "PageRange": { - "type": "array", - "items": { - "$ref": "#/definitions/PageRange" - } - }, - "ClearRange": { - "type": "array", - "items": { - "$ref": "#/definitions/ClearRange" - } - } - } - }, - "PageRange": { - "type": "object", - "required": [ - "Start", - "End" - ], - "properties": { - "Start": { - "type": "integer", - "format": "int64", - "xml": { - "name": "Start" - } - }, - "End": { - "type": "integer", - "format": "int64", - "xml": { - "name": "End" - } - } - }, - "xml": { - "name": "PageRange" - } - }, - "ClearRange": { - "type": "object", - "required": [ - "Start", - "End" - ], - "properties": { - "Start": { - "type": "integer", - "format": "int64", - "xml": { - "name": "Start" - } - }, - "End": { - "type": "integer", - "format": "int64", - "xml": { - "name": "End" - } - } - }, - "xml": { - "name": "ClearRange" - } - }, - "RetentionPolicy": { - "description": "the retention policy which determines how long the associated data should persist", - "type": "object", - "required": [ - "Enabled" - ], - "properties": { - "Enabled": { - "description": "Indicates whether a retention policy is enabled for the storage service", - "type": "boolean" - }, - "Days": { - "description": "Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted", - "type": "integer", - "minimum": 1 - } - } - }, - "SignedIdentifier": { - "description": "signed identifier", - "type": "object", - "required": [ - "Id", - "AccessPolicy" - ], - "properties": { - "Id": { - "type": "string", - "description": "a unique id" - }, - "AccessPolicy": { - "$ref": "#/definitions/AccessPolicy" - } - } - }, - "SignedIdentifiers": { - "description": "a collection of signed identifiers", - "type": "array", - "items": { - "$ref": "#/definitions/SignedIdentifier", - "xml": { - "name": "SignedIdentifier" - } - }, - "xml": { - "wrapped": true, - "name": "SignedIdentifiers" - } - }, - "StaticWebsite": { - "description": "The properties that enable an account to host a static website", - "type": "object", - "required": [ - "Enabled" - ], - "properties": { - "Enabled": { - "description": "Indicates whether this account is hosting a static website", - "type": "boolean" - }, - "IndexDocument": { - "description": "The default name of the index page under each directory", - "type": "string" - }, - "ErrorDocument404Path": { - "description": "The absolute path of the custom 404 page", - "type": "string" - } - } - }, - "StorageServiceProperties": { - "description": "Storage Service Properties.", - "type": "object", - "properties": { - "Logging": { - "$ref": "#/definitions/Logging" - }, - "HourMetrics": { - "$ref": "#/definitions/Metrics" - }, - "MinuteMetrics": { - "$ref": "#/definitions/Metrics" - }, - "Cors": { - "description": "The set of CORS rules.", - "type": "array", - "items": { - "$ref": "#/definitions/CorsRule" - }, - "xml": { - "wrapped": true - } - }, - "DefaultServiceVersion": { - "description": "The default version to use for requests to the Blob service if an incoming request's version is not specified. Possible values include version 2008-10-27 and all more recent versions", - "type": "string" - }, - "DeleteRetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - }, - "StaticWebsite": { - "$ref": "#/definitions/StaticWebsite" - } - } - }, - "StorageServiceStats": { - "description": "Stats for the storage service.", - "type": "object", - "properties": { - "GeoReplication": { - "$ref": "#/definitions/GeoReplication" - } - } - } - }, - "parameters": { - "Url": { - "name": "url", - "description": "The URL of the service account, container, or blob that is the targe of the desired operation.", - "required": true, - "type": "string", - "in": "path", - "x-ms-skip-url-encoding": true - }, - "ApiVersionParameter": { - "name": "x-ms-version", - "x-ms-client-name": "version", - "in": "header", - "required": true, - "type": "string", - "description": "Specifies the version of the operation to use for this request.", - "enum": [ - "2018-11-09" - ] - }, - "Blob": { - "name": "blob", - "in": "path", - "required": true, - "type": "string", - "pattern": "^[a-zA-Z0-9]+(?:/[a-zA-Z0-9]+)*(?:\\.[a-zA-Z0-9]+){0,1}$", - "minLength": 1, - "maxLength": 1024, - "x-ms-parameter-location": "method", - "description": "The blob name." - }, - "BlobCacheControl": { - "name": "x-ms-blob-cache-control", - "x-ms-client-name": "blobCacheControl", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobConditionAppendPos": { - "name": "x-ms-blob-condition-appendpos", - "x-ms-client-name": "appendPosition", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "append-position-access-conditions" - }, - "description": "Optional conditional header, used only for the Append Block operation. A number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed)." - }, - "BlobConditionMaxSize": { - "name": "x-ms-blob-condition-maxsize", - "x-ms-client-name": "maxSize", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "append-position-access-conditions" - }, - "description": "Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed)." - }, - "BlobPublicAccess": { - "name": "x-ms-blob-public-access", - "x-ms-client-name": "access", - "in": "header", - "required": false, - "x-ms-parameter-location": "method", - "description": "Specifies whether data in the container may be accessed publicly and the level of access", - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "AccessTier": { - "name": "x-ms-access-tier", - "x-ms-client-name": "tier", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "P4", - "P6", - "P10", - "P20", - "P30", - "P40", - "P50", - "Hot", - "Cool", - "Archive" - ], - "x-ms-enum": { - "name": "AccessTier", - "modelAsString": true - }, - "x-ms-parameter-location": "method", - "description": "Indicates the tier to be set on the blob." - }, - "BlobContentDisposition": { - "name": "x-ms-blob-content-disposition", - "x-ms-client-name": "blobContentDisposition", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's Content-Disposition header." - }, - "BlobContentEncoding": { - "name": "x-ms-blob-content-encoding", - "x-ms-client-name": "blobContentEncoding", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobContentLanguage": { - "name": "x-ms-blob-content-language", - "x-ms-client-name": "blobContentLanguage", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobContentLengthOptional": { - "name": "x-ms-blob-content-length", - "x-ms-client-name": "blobContentLength", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary." - }, - "BlobContentLengthRequired": { - "name": "x-ms-blob-content-length", - "x-ms-client-name": "blobContentLength", - "in": "header", - "required": true, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary." - }, - "BlobContentMD5": { - "name": "x-ms-blob-content-md5", - "x-ms-client-name": "blobContentMD5", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks were validated when each was uploaded." - }, - "BlobContentType": { - "name": "x-ms-blob-content-type", - "x-ms-client-name": "blobContentType", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobSequenceNumber": { - "name": "x-ms-blob-sequence-number", - "x-ms-client-name": "blobSequenceNumber", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "default": 0, - "x-ms-parameter-location": "method", - "description": "Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 and 2^63 - 1." - }, - "BlockId": { - "name": "blockid", - "x-ms-client-name": "blockId", - "in": "query", - "type": "string", - "required": true, - "x-ms-parameter-location": "method", - "description": "A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block." - }, - "BlockListType": { - "name": "blocklisttype", - "x-ms-client-name": "listType", - "in": "query", - "required": true, - "default": "committed", - "x-ms-parameter-location": "method", - "description": "Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together.", - "type": "string", - "enum": [ - "committed", - "uncommitted", - "all" - ], - "x-ms-enum": { - "name": "BlockListType", - "modelAsString": false - } - }, - "Body": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "format": "file" - }, - "x-ms-parameter-location": "method", - "description": "Initial data" - }, - "CacheControl": { - "name": "Cache-Control", - "x-ms-client-name": "cacheControl", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Cache control for given resource" - }, - "ContainerAcl": { - "name": "containerAcl", - "in": "body", - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - }, - "x-ms-parameter-location": "method", - "description": "the acls for the container" - }, - "CopyId": { - "name": "copyid", - "x-ms-client-name": "copyId", - "in": "query", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation." - }, - "ClientRequestId": { - "name": "x-ms-client-request-id", - "x-ms-client-name": "requestId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled." - }, - "ContainerName": { - "name": "containerName", - "in": "path", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The container name." - }, - "ContentCrc64": { - "name": "x-ms-content-crc64", - "x-ms-client-name": "transactionalContentCrc64", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "description": "Specify the transactional crc64 for the body, to be validated by the service." - }, - "ContentLength": { - "name": "Content-Length", - "in": "header", - "required": true, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "The length of the request." - }, - "ContentMD5": { - "name": "Content-MD5", - "x-ms-client-name": "transactionalContentMD5", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "description": "Specify the transactional md5 for the body, to be validated by the service." - }, - "CopySource": { - "name": "x-ms-copy-source", - "x-ms-client-name": "copySource", - "in": "header", - "required": true, - "type": "string", - "format": "url", - "x-ms-parameter-location": "method", - "description": "Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature." - }, - "DeleteSnapshots": { - "name": "x-ms-delete-snapshots", - "x-ms-client-name": "deleteSnapshots", - "description": "Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself", - "x-ms-parameter-location": "method", - "in": "header", - "required": false, - "type": "string", - "enum": [ - "include", - "only" - ], - "x-ms-enum": { - "name": "DeleteSnapshotsOptionType", - "modelAsString": false - } - }, - "Delimiter": { - "name": "delimiter", - "description": "When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string.", - "type": "string", - "x-ms-parameter-location": "method", - "in": "query", - "required": true - }, - "EncryptionKey": { - "name": "x-ms-encryption-key", - "x-ms-client-name": "EncryptionKey", - "type": "string", - "in": "query", - "required": false, - "x-ms-parameter-location": "method", - "description": "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services." - }, - "EncryptionKeySha256": { - "name": "x-ms-encryption-key-sha256", - "x-ms-client-name": "encryptionKeySha256", - "type": "string", - "in": "query", - "required": false, - "x-ms-parameter-location": "method", - "description": "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided." - }, - "EncryptionAlgorithm": { - "name": "x-ms-encryption-algorithm", - "x-ms-client-name": "EncryptionAlgorithm", - "type": "string", - "in": "query", - "required": false, - "enum": [ - "AES256" - ], - "x-ms-enum": { - "name": "EncryptionAlgorithmType", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "The algorithm used to produce the encryption key hash. Currently, the only accepted value is \"AES256\". Must be provided if the x-ms-encryption-key header is provided." - }, - "GetRangeContentMD5": { - "name": "x-ms-range-get-content-md5", - "x-ms-client-name": "rangeGetContentMD5", - "in": "header", - "required": false, - "type": "boolean", - "x-ms-parameter-location": "method", - "description": "When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size." - }, - "IfMatch": { - "name": "If-Match", - "x-ms-client-name": "ifMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs with a matching value." - }, - "IfModifiedSince": { - "name": "If-Modified-Since", - "x-ms-client-name": "ifModifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has been modified since the specified date/time." - }, - "IfNoneMatch": { - "name": "If-None-Match", - "x-ms-client-name": "ifNoneMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs without a matching value." - }, - "IfUnmodifiedSince": { - "name": "If-Unmodified-Since", - "x-ms-client-name": "ifUnmodifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has not been modified since the specified date/time." - }, - "IfSequenceNumberEqualTo": { - "name": "x-ms-if-sequence-number-eq", - "x-ms-client-name": "ifSequenceNumberEqualTo", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "sequence-number-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has the specified sequence number." - }, - "IfSequenceNumberLessThan": { - "name": "x-ms-if-sequence-number-lt", - "x-ms-client-name": "ifSequenceNumberLessThan", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "sequence-number-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has a sequence number less than the specified." - }, - "IfSequenceNumberLessThanOrEqualTo": { - "name": "x-ms-if-sequence-number-le", - "x-ms-client-name": "ifSequenceNumberLessThanOrEqualTo", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "sequence-number-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified." - }, - "KeyInfo": { - "name": "KeyInfo", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/KeyInfo" - } - }, - "ListBlobsInclude": { - "name": "include", - "in": "query", - "required": false, - "type": "array", - "collectionFormat": "csv", - "items": { - "type": "string", - "enum": [ - "copy", - "deleted", - "metadata", - "snapshots", - "uncommittedblobs" - ], - "x-ms-enum": { - "name": "ListBlobsIncludeItem", - "modelAsString": false - } - }, - "x-ms-parameter-location": "method", - "description": "Include this parameter to specify one or more datasets to include in the response." - }, - "ListContainersInclude": { - "name": "include", - "in": "query", - "required": false, - "type": "string", - "enum": [ - "metadata" - ], - "x-ms-enum": { - "name": "ListContainersIncludeType", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Include this parameter to specify that the container's metadata be returned as part of the response body." - }, - "LeaseBreakPeriod": { - "name": "x-ms-lease-break-period", - "x-ms-client-name": "breakPeriod", - "in": "header", - "required": false, - "type": "integer", - "x-ms-parameter-location": "method", - "description": "For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately." - }, - "LeaseDuration": { - "name": "x-ms-lease-duration", - "x-ms-client-name": "duration", - "in": "header", - "required": false, - "type": "integer", - "x-ms-parameter-location": "method", - "description": "Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change." - }, - "LeaseIdOptional": { - "name": "x-ms-lease-id", - "x-ms-client-name": "leaseId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "lease-access-conditions" - }, - "description": "If specified, the operation only succeeds if the resource's lease is active and matches this ID." - }, - "LeaseIdRequired": { - "name": "x-ms-lease-id", - "x-ms-client-name": "leaseId", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Specifies the current lease ID on the resource." - }, - "Marker": { - "name": "marker", - "in": "query", - "required": false, - "type": "string", - "description": "A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client.", - "x-ms-parameter-location": "method" - }, - "MaxResults": { - "name": "maxresults", - "in": "query", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method", - "description": "Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000." - }, - "Metadata": { - "name": "x-ms-meta", - "x-ms-client-name": "metadata", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Prefix": { - "name": "prefix", - "in": "query", - "required": false, - "type": "string", - "description": "Filters the results to return only containers whose name begins with the specified prefix.", - "x-ms-parameter-location": "method" - }, - "PrevSnapshot": { - "name": "prevsnapshot", - "in": "query", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs created on or after January 1, 2016." - }, - "ProposedLeaseIdOptional": { - "name": "x-ms-proposed-lease-id", - "x-ms-client-name": "proposedLeaseId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats." - }, - "ProposedLeaseIdRequired": { - "name": "x-ms-proposed-lease-id", - "x-ms-client-name": "proposedLeaseId", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats." - }, - "Range": { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Return only the bytes of the blob in the specified range." - }, - "RangeRequiredPutPageFromUrl": { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The range of bytes to which the source range would be written. The range should be 512 aligned and range-end is required." - }, - "SequenceNumberAction": { - "name": "x-ms-sequence-number-action", - "x-ms-client-name": "sequenceNumberAction", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs only. This property indicates how the service should modify the blob's sequence number", - "type": "string", - "enum": [ - "max", - "update", - "increment" - ], - "x-ms-enum": { - "name": "SequenceNumberActionType", - "modelAsString": false - } - }, - "Snapshot": { - "name": "snapshot", - "in": "query", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see Creating a Snapshot of a Blob." - }, - "SourceContentMD5": { - "name": "x-ms-source-content-md5", - "x-ms-client-name": "sourceContentMD5", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "description": "Specify the md5 calculated for the range of bytes that must be read from the copy source." - }, - "SourceRange": { - "name": "x-ms-source-range", - "x-ms-client-name": "sourceRange", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Bytes of source data in the specified range." - }, - "SourceRangeRequiredPutPageFromUrl": { - "name": "x-ms-source-range", - "x-ms-client-name": "sourceRange", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Bytes of source data in the specified range. The length of this range should match the ContentLength header and x-ms-range/Range destination range header." - }, - "SourceIfMatch": { - "name": "x-ms-source-if-match", - "x-ms-client-name": "sourceIfMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs with a matching value." - }, - "SourceIfModifiedSince": { - "name": "x-ms-source-if-modified-since", - "x-ms-client-name": "sourceIfModifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has been modified since the specified date/time." - }, - "SourceIfNoneMatch": { - "name": "x-ms-source-if-none-match", - "x-ms-client-name": "sourceIfNoneMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs without a matching value." - }, - "SourceIfUnmodifiedSince": { - "name": "x-ms-source-if-unmodified-since", - "x-ms-client-name": "sourceIfUnmodifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has not been modified since the specified date/time." - }, - "SourceLeaseId": { - "name": "x-ms-source-lease-id", - "x-ms-client-name": "sourceLeaseId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "A lease ID for the source path. If specified, the source path must have an active lease and the leaase ID must match." - }, - "SourceUrl": { - "name": "x-ms-copy-source", - "x-ms-client-name": "sourceUrl", - "in": "header", - "required": true, - "type": "string", - "format": "url", - "x-ms-parameter-location": "method", - "description": "Specify a URL to the copy source." - }, - "StorageServiceProperties": { - "name": "StorageServiceProperties", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/StorageServiceProperties" - }, - "x-ms-parameter-location": "method", - "description": "The StorageService properties." - }, - "Timeout": { - "name": "timeout", - "in": "query", - "required": false, - "type": "integer", - "minimum": 0, - "x-ms-parameter-location": "method", - "description": "The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations." - }, - "VersionId": { - "name": "versionid", - "x-ms-client-name": "versionId", - "in": "query", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve." - }, - "XMsCacheControl": { - "name": "x-ms-cache-control", - "x-ms-client-name": "cacheControl", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "directory-http-headers" - }, - "description": "Cache control for given resource" - }, - "XMsContentType": { - "name": "x-ms-content-type", - "x-ms-client-name": "contentType", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "directory-http-headers" - }, - "description": "Content type for given resource" - }, - "XMsContentEncoding": { - "name": "x-ms-content-encoding", - "x-ms-client-name": "contentEncoding", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "directory-http-headers" - }, - "description": "Content encoding for given resource" - }, - "XMsContentLanguage": { - "name": "x-ms-content-language", - "x-ms-client-name": "contentLanguage", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "directory-http-headers" - }, - "description": "Content language for given resource" - }, - "XMsContentDisposition": { - "name": "x-ms-content-disposition", - "x-ms-client-name": "contentDisposition", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "directory-http-headers" - }, - "description": "Content disposition for given resource" - } - } -} diff --git a/sdk/storage/azure-storage-common/pom.xml b/sdk/storage/azure-storage-common/pom.xml index e50ea1d13cd8..aac2b5fcb2b0 100644 --- a/sdk/storage/azure-storage-common/pom.xml +++ b/sdk/storage/azure-storage-common/pom.xml @@ -15,7 +15,8 @@ azure-storage-common 12.0.0-preview.3 - azure-storage-common + Microsoft Azure common module for Storage + This module contains common code based for all Microsoft Azure Storage client libraries. https://github.com/Azure/azure-sdk-for-java @@ -31,11 +32,15 @@ HEAD + + com.azure.storage.common + + com.azure azure-core - 1.0.0-preview.3 + 1.0.0-preview.4 org.slf4j @@ -55,7 +60,7 @@ com.azure azure-core-test - 1.0.0-preview.3 + 1.0.0-preview.4 test diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SASProtocol.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SASProtocol.java index bd7120ebc93e..68c3a6282452 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SASProtocol.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SASProtocol.java @@ -28,8 +28,7 @@ public enum SASProtocol { /** * Parses a {@code String} into a {@code SASProtocl} value if possible. * - * @param str - * The value to try to parse. + * @param str The value to try to parse. * * @return A {@code SASProtocol} value that represents the string if possible. * @throws IllegalArgumentException If {@code str} doesn't equal "https" or "https,http" diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Utility.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Utility.java index 650db18fcbf3..3be040b8f572 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Utility.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Utility.java @@ -11,6 +11,7 @@ import com.azure.core.implementation.util.ImplUtils; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.common.policy.SharedKeyCredentialPolicy; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import javax.crypto.Mac; @@ -62,13 +63,29 @@ public final class Utility { private static final int MAX_PRECISION_DATESTRING_LENGTH = MAX_PRECISION_PATTERN.replaceAll("'", "").length(); /** - *Parses the query string into a key-value pair map that maintains key, query parameter key, order. + * Parses the query string into a key-value pair map that maintains key, query parameter key, order. The value is + * stored as a string (ex. key=val1,val2,val3 instead of key=[val1, val2, val3]). * * @param queryString Query string to parse * @return a mapping of query string pieces as key-value pairs. */ public static TreeMap parseQueryString(final String queryString) { - TreeMap pieces = new TreeMap<>(String::compareTo); + return parseQueryStringHelper(queryString, Utility::urlDecode); + } + + /** + * Parses the query string into a key-value pair map that maintains key, query parameter key, order. The value is + * stored as a parsed array (ex. key=[val1, val2, val3] instead of key=val1,val2,val3). + * + * @param queryString Query string to parse + * @return a mapping of query string pieces as key-value pairs. + */ + public static TreeMap parseQueryStringSplitValues(final String queryString) { + return parseQueryStringHelper(queryString, (value) -> urlDecode(value).split(",")); + } + + private static TreeMap parseQueryStringHelper(final String queryString, Function valueParser) { + TreeMap pieces = new TreeMap<>(); if (ImplUtils.isNullOrEmpty(queryString)) { return pieces; @@ -76,8 +93,8 @@ public static TreeMap parseQueryString(final String queryString) for (String kvp : queryString.split("&")) { int equalIndex = kvp.indexOf("="); - String key = urlDecode(kvp.substring(0, equalIndex)).toLowerCase(Locale.ROOT); - String value = urlDecode(kvp.substring(equalIndex + 1)); + String key = urlDecode(kvp.substring(0, equalIndex).toLowerCase(Locale.ROOT)); + T value = valueParser.apply(kvp.substring(equalIndex + 1)); pieces.putIfAbsent(key, value); } @@ -221,6 +238,34 @@ public static T blockWithOptionalTimeout(Mono response, Duration timeout) } } + /** + * Applies a timeout to a publisher if the given timeout is not null. + * + * @param publisher Mono to apply optional timeout to. + * @param timeout Optional timeout. + * @param Return type of the Mono. + * @return Mono with an applied timeout, if any. + */ + public static Mono applyOptionalTimeout(Mono publisher, Duration timeout) { + return timeout == null + ? publisher + : publisher.timeout(timeout); + } + + /** + * Applies a timeout to a publisher if the given timeout is not null. + * + * @param publisher Flux to apply optional timeout to. + * @param timeout Optional timeout. + * @param Return type of the Flux. + * @return Flux with an applied timeout, if any. + */ + public static Flux applyOptionalTimeout(Flux publisher, Duration timeout) { + return timeout == null + ? publisher + : publisher.timeout(timeout); + } + /** * Asserts that a value is not {@code null}. * diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java index fbf1bc0af180..f93d8ec8ab69 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java @@ -42,6 +42,10 @@ public static SASTokenCredential fromSASTokenString(String sasToken) { return null; } + if (sasToken.charAt(0) == '?') { + sasToken = sasToken.substring(1); + } + return new SASTokenCredential(sasToken); } diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java index c71a22064016..0d6023687bf5 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java @@ -5,10 +5,10 @@ import com.azure.core.implementation.util.ImplUtils; import com.azure.storage.common.Utility; -import io.netty.handler.codec.http.QueryStringDecoder; import java.net.URL; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -181,15 +181,14 @@ private String getCanonicalizedResource(URL requestURL) { } // The URL object's query field doesn't include the '?'. The QueryStringDecoder expects it. - QueryStringDecoder queryDecoder = new QueryStringDecoder("?" + requestURL.getQuery()); - Map> queryParams = queryDecoder.parameters(); + Map queryParams = Utility.parseQueryStringSplitValues(requestURL.getQuery()); ArrayList queryParamNames = new ArrayList<>(queryParams.keySet()); Collections.sort(queryParamNames); for (String queryParamName : queryParamNames) { - final List queryParamValues = queryParams.get(queryParamName); - Collections.sort(queryParamValues); + String[] queryParamValues = queryParams.get(queryParamName); + Arrays.sort(queryParamValues); String queryParamValuesStr = String.join(",", queryParamValues); canonicalizedResource.append("\n") .append(queryParamName.toLowerCase(Locale.ROOT)) diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java index a99897511901..42fbcce913a7 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java @@ -3,6 +3,8 @@ package com.azure.storage.common.policy; +import com.azure.core.util.logging.ClientLogger; + import java.util.concurrent.TimeUnit; /** @@ -11,6 +13,7 @@ * functionality. */ public final class RequestRetryOptions { + private final ClientLogger logger = new ClientLogger(RequestRetryOptions.class); private final int maxTries; private final int tryTimeout; @@ -19,8 +22,8 @@ public final class RequestRetryOptions { /** * A {@link RetryPolicyType} telling the pipeline what kind of retry policy to use. */ - private RetryPolicyType retryPolicyType; - private String secondaryHost; + private final RetryPolicyType retryPolicyType; + private final String secondaryHost; /** * Constructor with default retry values: Exponential backoff, maxTries=4, tryTimeout=30, retryDelayInMs=4000, @@ -34,22 +37,22 @@ public RequestRetryOptions() { /** * Configures how the {@link com.azure.core.http.HttpPipeline} should retry requests. * - * @param retryPolicyType A {@link RetryPolicyType} specifying the type of retry pattern to use. A value of {@code - * null} accepts the default. + * @param retryPolicyType A {@link RetryPolicyType} specifying the type of retry pattern to use. A value of + * {@code null} accepts the default. * @param maxTries Specifies the maximum number of attempts an operation will be tried before producing an error. A * value of {@code null} means that you accept our default policy. A value of 1 means 1 try and no retries. - * @param tryTimeout Indicates the maximum time allowed for any single try of an HTTP request. A value of {@code - * null} means that you accept our default. NOTE: When transferring large amounts of data, the default TryTimeout - * will probably not be sufficient. You should override this value based on the bandwidth available to the host - * machine and proximity to the Storage service. A good starting point may be something like (60 seconds per MB of - * anticipated-payload-size). + * @param tryTimeout Indicates the maximum time allowed for any single try of an HTTP request. A value of + * {@code null} means that you accept our default. NOTE: When transferring large amounts of data, the default + * TryTimeout will probably not be sufficient. You should override this value based on the bandwidth available to + * the host machine and proximity to the Storage service. A good starting point may be something like (60 seconds + * per MB of anticipated-payload-size). * @param retryDelayInMs Specifies the amount of delay to use before retrying an operation. A value of {@code null} * means you accept the default value. The delay increases (exponentially or linearly) with each retry up to a * maximum specified by MaxRetryDelay. If you specify {@code null}, then you must also specify {@code null} for * MaxRetryDelay. - * @param maxRetryDelayInMs Specifies the maximum delay allowed before retrying an operation. A value of {@code - * null} means you accept the default value. If you specify {@code null}, then you must also specify {@code null} - * for RetryDelay. + * @param maxRetryDelayInMs Specifies the maximum delay allowed before retrying an operation. A value of + * {@code null} means you accept the default value. If you specify {@code null}, then you must also specify + * {@code null} for RetryDelay. * @param secondaryHost If a secondaryHost is specified, retries will be tried against this host. If secondaryHost * is {@code null} (the default) then operations are not retried against another host. NOTE: Before setting this * field, make sure you understand the issues around reading stale and potentially-inconsistent data at @@ -154,7 +157,7 @@ long calculateDelayInMs(int tryCount) { delay = this.retryDelayInMs; break; default: - throw new IllegalArgumentException("Invalid retry policy type."); + throw logger.logExceptionAsError(new IllegalArgumentException("Invalid retry policy type.")); } return Math.min(delay, this.maxRetryDelayInMs); diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java index 22b62af89b04..3fc0326aa3bb 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java @@ -11,12 +11,12 @@ import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.implementation.http.UrlBuilder; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.io.IOException; import java.net.MalformedURLException; +import java.nio.ByteBuffer; import java.time.Duration; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeoutException; @@ -92,7 +92,7 @@ stream, the buffers that were emitted will have already been consumed (their pos duplicates the ByteBuffer object, not the underlying data. */ context.httpRequest(originalRequest.buffer()); - Flux bufferedBody = (context.httpRequest().body() == null) ? null : context.httpRequest().body().map(ByteBuf::duplicate); + Flux bufferedBody = (context.httpRequest().body() == null) ? null : context.httpRequest().body().map(ByteBuffer::duplicate); context.httpRequest().body(bufferedBody); if (!tryingPrimary) { UrlBuilder builder = UrlBuilder.parse(context.httpRequest().url()); diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java index 4af3edf7f229..00625019ca36 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java @@ -8,6 +8,7 @@ import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.credentials.SASTokenCredential; import reactor.core.publisher.Mono; @@ -18,6 +19,8 @@ * Policy that adds the SAS token to the request URL's query. */ public final class SASTokenCredentialPolicy implements HttpPipelinePolicy { + private final ClientLogger logger = new ClientLogger(SASTokenCredentialPolicy.class); + private final SASTokenCredential credential; /** @@ -38,7 +41,7 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN String newURL = requestURL.toString() + delimiter + credential.sasToken(); context.httpRequest().url(new URL(newURL)); } catch (MalformedURLException ex) { - throw new IllegalStateException(ex); + throw logger.logExceptionAsError(new IllegalStateException(ex)); } return next.process(); diff --git a/sdk/storage/azure-storage-file/README.md b/sdk/storage/azure-storage-file/README.md index 75e91197b6d4..a834363f52f0 100644 --- a/sdk/storage/azure-storage-file/README.md +++ b/sdk/storage/azure-storage-file/README.md @@ -246,7 +246,8 @@ Taking the directoryClient in KeyConcept, [`${directoryClient}`](#Directory) . ```Java String fileName = "testfile"; -directoryClient.createFile(fileName); +long maxSize = 1024; +directoryClient.createFile(fileName, maxSize); ``` ### List all Shares @@ -306,14 +307,14 @@ Taking the fileClient in KeyConcept, [`${fileClient}`](#File) with string of sou ```Java String sourceURL = "https://myaccount.file.core.windows.net/myshare/myfile"; -Response copyInfoResponse = fileClient.startCopy(sourceURL, null); +FileCopyInfo copyInfo = fileClient.startCopy(sourceURL, null); ``` ### Abort copy a file Taking the fileClient in KeyConcept, [`${fileClient}`](#File) with the copy info response returned above `${copyId}=[copyInfoResponse](#Copy-a-file)`. ```Java -String copyId = copyInfoResponse.value().copyId(); +String copyId = copyInfoResponse.copyId(); fileClient.abortCopy(copyId); ``` @@ -321,7 +322,7 @@ fileClient.abortCopy(copyId); Taking the fileClient in KeyConcept, [`${fileClient}`](#File) with data of "default" . ```Java -ByteBuf data = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8)); +ByteBuffer data = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); fileClient.upload(data, data.readableBytes()); ``` @@ -336,7 +337,7 @@ fileClient.uploadFromFile(filePath); Taking the fileClient in KeyConcept, [`${fileClient}`](#File) with the range from 1024 to 2048. ```Java FileRange fileRange = new FileRange(1024, 2047); -fileClient.downloadWithProperties(fileRange, false); +fileClient.downloadWithProperties(fileRange, false, null); ``` ### Download file from storage @@ -357,12 +358,12 @@ fileServiceClient.getProperties(); Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services) . ```Java -FileServiceProperties properties = fileServiceClient.getProperties().value(); +FileServiceProperties properties = fileServiceClient.getProperties(); properties.minuteMetrics().enabled(true); properties.hourMetrics().enabled(true); -VoidResponse response = fileServiceClient.setProperties(properties); +fileServiceClient.setProperties(properties); ``` ### Set a share metadata @@ -396,7 +397,7 @@ shareClient.setAccessPolicy(Collections.singletonList(permission)); Taking the directoryClient in KeyConcept, [`${directoryClient}`](#Directory) ```Java -Iterable handleItems = directoryClient.getHandles(null, true); +Iterable handleItems = directoryClient.listHandles(null, true); ``` ### Force close handles on handle id @@ -420,7 +421,8 @@ Taking the fileClient in KeyConcept, [`${fileClient}`](#File) . ```Java FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); -fileClient.setHttpHeaders(httpHeaders); +long newFileSize = 1024; +fileClient.setHttpHeaders(newFileSize, httpHeaders); ``` ## Troubleshooting @@ -479,3 +481,5 @@ If you would like to become an active contributor to this project please follow [samples_directory]: src/samples/java/com/azure/storage/file/DirectorySample.java [samples_file]: src/samples/java/com/azure/storage/file/FileSample.java [samples_async]: src/samples/java/com/azure/storage/file/AsyncSample.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/storage/azure-storage-file/README.png) diff --git a/sdk/storage/azure-storage-file/pom.xml b/sdk/storage/azure-storage-file/pom.xml index 91058c7dcdb7..76f9d8c85f8d 100644 --- a/sdk/storage/azure-storage-file/pom.xml +++ b/sdk/storage/azure-storage-file/pom.xml @@ -15,7 +15,8 @@ azure-storage-file 12.0.0-preview.3 - azure-storage-file + Microsoft Azure client library for File Storage + This module contains client library for Microsoft Azure File Storage. https://github.com/Azure/azure-sdk-for-java @@ -31,6 +32,10 @@ HEAD + + com.azure.storage.file + + com.azure @@ -61,13 +66,13 @@ com.azure - azure-identity - 1.0.0-preview.3 + azure-core-http-netty + 1.0.0-preview.4 test - junit - junit + org.slf4j + slf4j-simple test @@ -75,6 +80,45 @@ reactor-test test + + org.spockframework + spock-core + 1.3-groovy-2.5 + test + + + + src/main/java + src/test/java + + + + + org.apache.maven.plugins + maven-compiler-plugin + + groovy-eclipse-compiler + -Xlint:unchecked + 1.8 + 1.8 + true + + + + org.codehaus.groovy + groovy-eclipse-compiler + ${groovy-eclipse-compiler.version} + + + org.codehaus.groovy + groovy-eclipse-batch + ${groovy-eclipse-batch.version} + + + + + + diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java index e5a044464b8d..d78b89c1d3ea 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java @@ -7,7 +7,9 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.implementation.AzureFileStorageBuilder; @@ -25,6 +27,9 @@ import com.azure.storage.file.models.FileRef; import com.azure.storage.file.models.HandleItem; import com.azure.storage.file.models.StorageErrorException; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + import java.net.MalformedURLException; import java.net.URL; import java.time.OffsetDateTime; @@ -32,8 +37,9 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; +import java.util.Objects; + +import static com.azure.core.implementation.util.FluxUtil.withContext; /** * This class provides a client that contains all the operations for interacting with directory in Azure Storage File Service. @@ -52,6 +58,8 @@ * @see SASTokenCredential */ public class DirectoryAsyncClient { + private final ClientLogger logger = new ClientLogger(DirectoryAsyncClient.class); + private final AzureFileStorageImpl azureFileStorageClient; private final String shareName; private final String directoryPath; @@ -66,6 +74,8 @@ public class DirectoryAsyncClient { * @param snapshot The snapshot of the share */ DirectoryAsyncClient(AzureFileStorageImpl azureFileStorageClient, String shareName, String directoryPath, String snapshot) { + Objects.requireNonNull(shareName); + Objects.requireNonNull(directoryPath); this.shareName = shareName; this.directoryPath = directoryPath; this.snapshot = snapshot; @@ -82,6 +92,8 @@ public class DirectoryAsyncClient { * @param snapshot Optional snapshot of the share */ DirectoryAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String directoryPath, String snapshot) { + Objects.requireNonNull(shareName); + Objects.requireNonNull(directoryPath); this.shareName = shareName; this.directoryPath = directoryPath; this.snapshot = snapshot; @@ -99,8 +111,8 @@ public URL getDirectoryUrl() { try { return new URL(azureFileStorageClient.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), - azureFileStorageClient.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), + azureFileStorageClient.getUrl()), e)); } } @@ -144,11 +156,11 @@ public DirectoryAsyncClient getSubDirectoryClient(String subDirectoryName) { *

    For more information, see the * Azure Docs.

    * - * @return A response containing the directory info and the status of creating the directory. + * @return The {@link DirectoryInfo directory info}. * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. */ - public Mono> create() { - return create(null); + public Mono create() { + return createWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -158,7 +170,7 @@ public Mono> create() { * *

    Create the directory

    * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.create#map} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.createWithResponse#Map} * *

    For more information, see the * Azure Docs.

    @@ -167,8 +179,17 @@ public Mono> create() { * @return A response containing the directory info and the status of creating the directory. * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. */ - public Mono> create(Map metadata) { - return azureFileStorageClient.directorys().createWithRestResponseAsync(shareName, directoryPath, null, metadata, Context.NONE) + public Mono> createWithResponse(Map metadata) { + return withContext(context -> createWithResponse(metadata, context)); + } + + Mono> createWithResponse(Map metadata, Context context) { + // TODO (alzimmer): These properties are dummy defaults to allow the new service version to be used. Remove these and use correct defaults when known (https://github.com/Azure/azure-sdk-for-java/issues/5039) + String fileAttributes = "None"; + String filePermission = "inherit"; + String fileCreationTime = "now"; + String fileLastWriteTime = "now"; + return azureFileStorageClient.directorys().createWithRestResponseAsync(shareName, directoryPath, fileAttributes, fileCreationTime, fileLastWriteTime, null, metadata, filePermission, null, context) .map(this::createWithRestResponse); } @@ -179,7 +200,26 @@ public Mono> create(Map metadata) { * *

    Delete the directory

    * - * {@codesnippet com.azure.storage.file.directoryClient.delete} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.delete} + * + *

    For more information, see the + * Azure Docs.

    + * + * @return An empty response. + * @throws StorageErrorException If the share doesn't exist + */ + public Mono delete() { + return deleteWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Deletes the directory in the file share. + * + *

    Code Samples

    + * + *

    Delete the directory

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.deleteWithResponse} * *

    For more information, see the * Azure Docs.

    @@ -187,8 +227,12 @@ public Mono> create(Map metadata) { * @return A response that only contains headers and response status code * @throws StorageErrorException If the share doesn't exist */ - public Mono delete() { - return azureFileStorageClient.directorys().deleteWithRestResponseAsync(shareName, directoryPath, Context.NONE).map(VoidResponse::new) + public Mono deleteWithResponse() { + return withContext(context -> deleteWithResponse(context)); + } + + Mono deleteWithResponse(Context context) { + return azureFileStorageClient.directorys().deleteWithRestResponseAsync(shareName, directoryPath, context).map(VoidResponse::new) .map(VoidResponse::new); } @@ -207,8 +251,31 @@ public Mono delete() { * * @return Storage directory properties */ - public Mono> getProperties() { - return azureFileStorageClient.directorys().getPropertiesWithRestResponseAsync(shareName, directoryPath, snapshot, null, Context.NONE) + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves the properties of this directory. + * The properties includes directory metadata, last modified date, is server encrypted, and eTag. + * + *

    Code Samples

    + * + *

    Retrieve directory properties

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.getPropertiesWithResponse} + * + *

    For more information, see the + * Azure Docs.

    + * + * @return A response containing the storage directory properties with headers and response status code + */ + public Mono> getPropertiesWithResponse() { + return withContext(context -> getPropertiesWithResponse(context)); + } + + Mono> getPropertiesWithResponse(Context context) { + return azureFileStorageClient.directorys().getPropertiesWithRestResponseAsync(shareName, directoryPath, snapshot, null, context) .map(this::getPropertiesResponse); } @@ -234,8 +301,38 @@ public Mono> getProperties() { * @return information about the directory * @throws StorageErrorException If the directory doesn't exist or the metadata contains invalid keys */ - public Mono> setMetadata(Map metadata) { - return azureFileStorageClient.directorys().setMetadataWithRestResponseAsync(shareName, directoryPath, null, metadata, Context.NONE) + public Mono setMetadata(Map metadata) { + return setMetadataWithResponse(metadata).flatMap(FluxUtil::toMono); + } + + /** + * Sets the user-defined metadata to associate to the directory. + * + *

    If {@code null} is passed for the metadata it will clear the metadata associated to the directory.

    + * + *

    Code Samples

    + * + *

    Set the metadata to "directory:updatedMetadata"

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map} + * + *

    Clear the metadata of the directory

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map.clearMetadata} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param metadata Optional metadata to set on the directory, if null is passed the metadata for the directory is cleared + * @return A response containing the information about the directory with headers and response status code + * @throws StorageErrorException If the directory doesn't exist or the metadata contains invalid keys + */ + public Mono> setMetadataWithResponse(Map metadata) { + return withContext(context -> setMetadataWithResponse(metadata, context)); + } + + Mono> setMetadataWithResponse(Map metadata, Context context) { + return azureFileStorageClient.directorys().setMetadataWithRestResponseAsync(shareName, directoryPath, null, metadata, context) .map(this::setMetadataResponse); } @@ -246,7 +343,7 @@ public Mono> setMetadata(Map * *

    List all sub-directories and files in the account

    * - * {@codesnippet com.azure.storage.file.directoryClient.listFilesAndDirectories} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories} * *

    For more information, see the * Azure Docs.

    @@ -286,7 +383,7 @@ public Flux listFilesAndDirectories(String prefix, Integer maxResults) * *

    Get 10 handles with recursive call.

    * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.getHandles} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.listHandles#integer-boolean} * *

    For more information, see the * Azure Docs.

    @@ -295,15 +392,13 @@ public Flux listFilesAndDirectories(String prefix, Integer maxResults) * @param recursive Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. * @return {@link HandleItem handles} in the directory that satisfy the requirements */ - public Flux getHandles(Integer maxResult, boolean recursive) { + public Flux listHandles(Integer maxResult, boolean recursive) { return azureFileStorageClient.directorys().listHandlesWithRestResponseAsync(shareName, directoryPath, null, maxResult, null, snapshot, recursive, Context.NONE) .flatMapMany(response -> nextPageForHandles(response, maxResult, recursive)); } /** - * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryAsyncClient#getHandles(Integer, boolean)} . - * TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. - * TODO: @see Github Issue 4525 + * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryAsyncClient#listHandles(Integer, boolean)} . * *

    Code Samples

    * @@ -319,6 +414,8 @@ public Flux getHandles(Integer maxResult, boolean recursive) { * @return The counts of number of handles closed */ public Flux forceCloseHandles(String handleId, boolean recursive) { + // TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. + // TODO: @see Github Issue 4525 return azureFileStorageClient.directorys().forceCloseHandlesWithRestResponseAsync(shareName, directoryPath, handleId, null, null, snapshot, recursive, Context.NONE) .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId, recursive)); } @@ -336,11 +433,11 @@ public Flux forceCloseHandles(String handleId, boolean recursive) { * Azure Docs.

    * * @param subDirectoryName Name of the subdirectory - * @return A response containing the subdirectory client and the status of creating the directory. + * @return A subdirectory client. * @throws StorageErrorException If the subdirectory has already existed, the parent directory does not exist or directory is an invalid resource name. */ - public Mono> createSubDirectory(String subDirectoryName) { - return createSubDirectory(subDirectoryName, null); + public Mono createSubDirectory(String subDirectoryName) { + return createSubDirectoryWithResponse(subDirectoryName, null).flatMap(FluxUtil::toMono); } /** @@ -350,7 +447,7 @@ public Mono> createSubDirectory(String subDirecto * *

    Create the subdirectory named "subdir", with metadata

    * - * {@codesnippet com.azure.storage.file.directoryClient.createSubDirectory#string-map} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.createSubDirectoryWithResponse#string-map} * *

    For more information, see the * Azure Docs.

    @@ -360,10 +457,14 @@ public Mono> createSubDirectory(String subDirecto * @return A response containing the subdirectory client and the status of creating the directory. * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or subdirectory is an invalid resource name. */ - public Mono> createSubDirectory(String subDirectoryName, Map metadata) { + public Mono> createSubDirectoryWithResponse(String subDirectoryName, Map metadata) { + return withContext(context -> createSubDirectoryWithResponse(subDirectoryName, metadata, context)); + } + + Mono> createSubDirectoryWithResponse(String subDirectoryName, Map metadata, Context context) { DirectoryAsyncClient createSubClient = getSubDirectoryClient(subDirectoryName); - return createSubClient.create(metadata) - .map(response -> new SimpleResponse<>(response, createSubClient)); + return createSubClient.createWithResponse(metadata, context) + .map(response -> new SimpleResponse<>(response, createSubClient)); } /** @@ -379,12 +480,36 @@ public Mono> createSubDirectory(String subDirecto * Azure Docs.

    * * @param subDirectoryName Name of the subdirectory + * @return An empty response. + * @throws StorageErrorException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. + */ + public Mono deleteSubDirectory(String subDirectoryName) { + return deleteSubDirectoryWithResponse(subDirectoryName).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the subdirectory with specific name in this directory. + * + *

    Code Samples

    + * + *

    Delete the subdirectory named "subdir"

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.deleteSubDirectoryWithResponse#string} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param subDirectoryName Name of the subdirectory * @return A response that only contains headers and response status code * @throws StorageErrorException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. */ - public Mono deleteSubDirectory(String subDirectoryName) { + public Mono deleteSubDirectoryWithResponse(String subDirectoryName) { + return withContext(context -> deleteSubDirectoryWithResponse(subDirectoryName, context)); + } + + Mono deleteSubDirectoryWithResponse(String subDirectoryName, Context context) { DirectoryAsyncClient deleteSubClient = getSubDirectoryClient(subDirectoryName); - return deleteSubClient.delete().map(VoidResponse::new); + return deleteSubClient.deleteWithResponse(context).map(VoidResponse::new); } /** @@ -401,11 +526,11 @@ public Mono deleteSubDirectory(String subDirectoryName) { * * @param fileName Name of the file * @param maxSize Size of the file - * @return A response containing the FileAsyncClient and the status of creating the directory. + * @return The FileAsyncClient. * @throws StorageErrorException If the file has already existed, the parent directory does not exist or file name is an invalid resource name. */ - public Mono> createFile(String fileName, long maxSize) { - return createFile(fileName, maxSize, null, null); + public Mono createFile(String fileName, long maxSize) { + return createFileWithResponse(fileName, maxSize, null, null).flatMap(FluxUtil::toMono); } /** @@ -415,7 +540,7 @@ public Mono> createFile(String fileName, long maxSize) * *

    Create the file named "myFile"

    * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.createFile#string-long-fileHTTPHeaders-map} + * {@codesnippet com.azure.storage.file.directoryAsyncClient.createFileWithResponse#string-long-fileHTTPHeaders-map} * *

    For more information, see the * Azure Docs.

    @@ -427,9 +552,13 @@ public Mono> createFile(String fileName, long maxSize) * @return A response containing the directory info and the status of creating the directory. * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or file name is an invalid resource name. */ - public Mono> createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + public Mono> createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + return withContext(context -> createFileWithResponse(fileName, maxSize, httpHeaders, metadata, context)); + } + + Mono> createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata, Context context) { FileAsyncClient fileAsyncClient = getFileClient(fileName); - return fileAsyncClient.create(maxSize, httpHeaders, metadata).map(response -> new SimpleResponse<>(response, fileAsyncClient)); + return fileAsyncClient.createWithResponse(maxSize, httpHeaders, metadata, context).map(response -> new SimpleResponse<>(response, fileAsyncClient)); } /** @@ -445,12 +574,36 @@ public Mono> createFile(String fileName, long maxSize, * Azure Docs.

    * * @param fileName Name of the file + * @return An empty response. + * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. + */ + public Mono deleteFile(String fileName) { + return deleteFileWithResponse(fileName).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the file with specific name in this directory. + * + *

    Code Samples

    + * + *

    Delete the file "filetest"

    + * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.deleteFileWithResponse#string} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param fileName Name of the file * @return A response that only contains headers and response status code * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. */ - public Mono deleteFile(String fileName) { + public Mono deleteFileWithResponse(String fileName) { + return withContext(context -> deleteFileWithResponse(fileName, context)); + } + + Mono deleteFileWithResponse(String fileName, Context context) { FileAsyncClient fileAsyncClient = getFileClient(fileName); - return fileAsyncClient.delete().map(VoidResponse::new); + return fileAsyncClient.deleteWithResponse(context).map(VoidResponse::new); } /** @@ -530,8 +683,10 @@ private Flux nextPageForForceCloseHandles(DirectorysForceCloseHandlesRe private List convertResponseAndGetNumOfResults(DirectorysListFilesAndDirectoriesSegmentResponse response) { List fileRefs = new ArrayList<>(); - response.value().segment().directoryItems().forEach(directoryItem -> fileRefs.add(new FileRef(directoryItem.name(), true, null))); - response.value().segment().fileItems().forEach(fileItem -> fileRefs.add(new FileRef(fileItem.name(), false, fileItem.properties()))); + if (response.value().segment() != null) { + response.value().segment().directoryItems().forEach(directoryItem -> fileRefs.add(new FileRef(directoryItem.name(), true, null))); + response.value().segment().fileItems().forEach(fileItem -> fileRefs.add(new FileRef(fileItem.name(), false, fileItem.properties()))); + } return fileRefs; } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java index 7de1792d0c35..26c0f9e361d2 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java @@ -6,6 +6,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.DirectoryInfo; @@ -94,11 +95,11 @@ public DirectoryClient getSubDirectoryClient(String subDirectoryName) { *

    For more information, see the * Azure Docs.

    * - * @return A response containing the directory info and the status of creating the directory. + * @return The {@link DirectoryInfo directory info}. * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. */ - public Response create() { - return create(null); + public DirectoryInfo create() { + return createWithResponse(null, Context.NONE).value(); } /** @@ -108,17 +109,18 @@ public Response create() { * *

    Create the directory

    * - * {@codesnippet com.azure.storage.file.directoryClient.create#map} + * {@codesnippet com.azure.storage.file.directoryClient.createWithResponse#map-Context} * *

    For more information, see the * Azure Docs.

    * * @param metadata Optional metadata to associate with the directory. * @return A response containing the directory info and the status of creating the directory. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. */ - public Response create(Map metadata) { - return directoryAsyncClient.create(metadata).block(); + public Response createWithResponse(Map metadata, Context context) { + return directoryAsyncClient.createWithResponse(metadata, context).block(); } /** @@ -133,11 +135,30 @@ public Response create(Map metadata) { *

    For more information, see the * Azure Docs.

    * + * @throws StorageErrorException If the share doesn't exist + */ + public void delete() { + deleteWithResponse(Context.NONE); + } + + /** + * Deletes the directory in the file share. The directory must be empty before it can be deleted. + * + *

    Code Samples

    + * + *

    Delete the directory

    + * + * {@codesnippet com.azure.storage.file.DirectoryClient.deleteWithResponse#Context} + * + *

    For more information, see the + * Azure Docs.

    + * * @return A response that only contains headers and response status code + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws StorageErrorException If the share doesn't exist */ - public VoidResponse delete() { - return directoryAsyncClient.delete().block(); + public VoidResponse deleteWithResponse(Context context) { + return directoryAsyncClient.deleteWithResponse(context).block(); } /** @@ -155,8 +176,28 @@ public VoidResponse delete() { * * @return Storage directory properties */ - public Response getProperties() { - return directoryAsyncClient.getProperties().block(); + public DirectoryProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * Retrieves the properties of this directory. + * The properties includes directory metadata, last modified date, is server encrypted, and eTag. + * + *

    Code Samples

    + * + *

    Retrieve directory properties

    + * + * {@codesnippet com.azure.storage.file.directoryClient.getPropertiesWithResponse#Context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the storage directory properties with response status code and headers + */ + public Response getPropertiesWithResponse(Context context) { + return directoryAsyncClient.getPropertiesWithResponse(context).block(); } /** @@ -178,11 +219,38 @@ public Response getProperties() { * Azure Docs.

    * * @param metadata Optional metadata to set on the directory, if null is passed the metadata for the directory is cleared - * @return information about the directory + * @return The information about the directory * @throws StorageErrorException If the directory doesn't exist or the metadata contains invalid keys */ - public Response setMetadata(Map metadata) { - return directoryAsyncClient.setMetadata(metadata).block(); + public DirectorySetMetadataInfo setMetadata(Map metadata) { + return setMetadataWithResponse(metadata, Context.NONE).value(); + } + + /** + * Sets the user-defined metadata to associate to the directory. + * + *

    If {@code null} is passed for the metadata it will clear the metadata associated to the directory.

    + * + *

    Code Samples

    + * + *

    Set the metadata to "directory:updatedMetadata"

    + * + * {@codesnippet com.azure.storage.file.directoryClient.setMetadataWithResponse#map-Context} + * + *

    Clear the metadata of the directory

    + * + * {@codesnippet com.azure.storage.file.DirectoryClient.setMetadataWithResponse#Map-Context.clearMetadata} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param metadata Optional metadata to set on the directory, if null is passed the metadata for the directory is cleared + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the information about the directory and response status code + * @throws StorageErrorException If the directory doesn't exist or the metadata contains invalid keys + */ + public Response setMetadataWithResponse(Map metadata, Context context) { + return directoryAsyncClient.setMetadataWithResponse(metadata, context).block(); } /** @@ -231,7 +299,7 @@ public Iterable listFilesAndDirectories(String prefix, Integer maxResul * *

    Get 10 handles with recursive call.

    * - * {@codesnippet com.azure.storage.file.directoryClient.getHandles} + * {@codesnippet com.azure.storage.file.directoryClient.listHandles#Integer-boolean} * *

    For more information, see the * Azure Docs.

    @@ -240,14 +308,12 @@ public Iterable listFilesAndDirectories(String prefix, Integer maxResul * @param recursive Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. * @return {@link HandleItem handles} in the directory that satisfy the requirements */ - public Iterable getHandles(Integer maxResult, boolean recursive) { - return directoryAsyncClient.getHandles(maxResult, recursive).collectList().block(); + public Iterable listHandles(Integer maxResult, boolean recursive) { + return directoryAsyncClient.listHandles(maxResult, recursive).collectList().block(); } /** - * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryClient#getHandles(Integer, boolean)} . - * TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. - * TODO: @see Github Issue 4525 + * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryClient#listHandles(Integer, boolean)} . * *

    Code Samples

    * @@ -263,6 +329,8 @@ public Iterable getHandles(Integer maxResult, boolean recursive) { * @return The counts of number of handles closed. */ public Iterable forceCloseHandles(String handleId, boolean recursive) { + // TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. + // TODO: @see Github Issue 4525 return directoryAsyncClient.forceCloseHandles(handleId, recursive).collectList().block(); } @@ -279,11 +347,11 @@ public Iterable forceCloseHandles(String handleId, boolean recursive) { * Azure Docs.

    * * @param subDirectoryName Name of the subdirectory - * @return A response containing the subdirectory client and the status of creating the directory. + * @return The subdirectory client. * @throws StorageErrorException If the subdirectory has already existed, the parent directory does not exist or directory is an invalid resource name. */ - public Response createSubDirectory(String subDirectoryName) { - return createSubDirectory(subDirectoryName, null); + public DirectoryClient createSubDirectory(String subDirectoryName) { + return createSubDirectoryWithResponse(subDirectoryName, null, Context.NONE).value(); } /** @@ -293,7 +361,7 @@ public Response createSubDirectory(String subDirectoryName) { * *

    Create the subdirectory named "subdir", with metadata

    * - * {@codesnippet com.azure.storage.file.directoryClient.createSubDirectory#string-map} + * {@codesnippet com.azure.storage.file.directoryClient.createSubDirectoryWithResponse#string-map-Context} * *

    For more information, see the * Azure Docs.

    @@ -301,11 +369,12 @@ public Response createSubDirectory(String subDirectoryName) { * @param subDirectoryName Name of the subdirectory * @param metadata Optional metadata to associate with the subdirectory * @return A response containing the subdirectory client and the status of creating the directory. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or subdirectory is an invalid resource name. */ - public Response createSubDirectory(String subDirectoryName, Map metadata) { + public Response createSubDirectoryWithResponse(String subDirectoryName, Map metadata, Context context) { DirectoryClient directoryClient = getSubDirectoryClient(subDirectoryName); - return new SimpleResponse<>(directoryClient.create(metadata), directoryClient); + return new SimpleResponse<>(directoryClient.createWithResponse(metadata, context), directoryClient); } /** @@ -321,11 +390,31 @@ public Response createSubDirectory(String subDirectoryName, Map * Azure Docs.

    * * @param subDirectoryName Name of the subdirectory + * @throws StorageErrorException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. + */ + public void deleteSubDirectory(String subDirectoryName) { + deleteSubDirectoryWithResponse(subDirectoryName, Context.NONE); + } + + /** + * Deletes the subdirectory with specific name in this directory. The directory must be empty before it can be deleted. + * + *

    Code Samples

    + * + *

    Delete the subdirectory named "subdir"

    + * + * {@codesnippet com.azure.storage.file.directoryClient.deleteSubDirectoryWithResponse#string-Context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param subDirectoryName Name of the subdirectory * @return A response that only contains headers and response status code + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws StorageErrorException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. */ - public VoidResponse deleteSubDirectory(String subDirectoryName) { - return directoryAsyncClient.deleteSubDirectory(subDirectoryName).block(); + public VoidResponse deleteSubDirectoryWithResponse(String subDirectoryName, Context context) { + return directoryAsyncClient.deleteSubDirectoryWithResponse(subDirectoryName, context).block(); } /** @@ -342,11 +431,11 @@ public VoidResponse deleteSubDirectory(String subDirectoryName) { * * @param fileName Name of the file * @param maxSize Size of the file - * @return A response containing the FileClient and the status of creating the directory. + * @return The FileClient * @throws StorageErrorException If the file has already existed, the parent directory does not exist or file name is an invalid resource name. */ - public Response createFile(String fileName, long maxSize) { - return createFile(fileName, maxSize, null, null); + public FileClient createFile(String fileName, long maxSize) { + return createFileWithResponse(fileName, maxSize, null, null, Context.NONE).value(); } /** @@ -356,7 +445,7 @@ public Response createFile(String fileName, long maxSize) { * *

    Create the file named "myFile"

    * - * {@codesnippet com.azure.storage.file.directoryClient.createFile#string-long-fileHTTPHeaders-map} + * {@codesnippet com.azure.storage.file.directoryClient.createFile#string-long-fileHTTPHeaders-map-Context} * *

    For more information, see the * Azure Docs.

    @@ -365,11 +454,12 @@ public Response createFile(String fileName, long maxSize) { * @param maxSize Max size of the file * @param httpHeaders the Http headers set to the file * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing the directory info and the status of creating the directory. * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or file name is an invalid resource name. */ - public Response createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - return directoryAsyncClient.createFile(fileName, maxSize, httpHeaders, metadata) + public Response createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata, Context context) { + return directoryAsyncClient.createFileWithResponse(fileName, maxSize, httpHeaders, metadata, context) .map(response -> new SimpleResponse<>(response, new FileClient(response.value()))).block(); } @@ -380,17 +470,37 @@ public Response createFile(String fileName, long maxSize, FileHTTPHe * *

    Delete the file "filetest"

    * - * {@codesnippet com.azure.storage.file.directoryClient.deleteFile#string} + * {@codesnippet com.azure.storage.file.directoryClient.deleteFileWithResponse#string-Context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param fileName Name of the file + * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. + */ + public void deleteFile(String fileName) { + deleteFileWithResponse(fileName, Context.NONE); + } + + /** + * Deletes the file with specific name in this directory. + * + *

    Code Samples

    + * + *

    Delete the file "filetest"

    + * + * {@codesnippet com.azure.storage.file.DirectoryClient.deleteFileWithResponse#String-Context} * *

    For more information, see the * Azure Docs.

    * * @param fileName Name of the file * @return A response that only contains headers and response status code + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. */ - public VoidResponse deleteFile(String fileName) { - return directoryAsyncClient.deleteFile(fileName).block(); + public VoidResponse deleteFileWithResponse(String fileName, Context context) { + return directoryAsyncClient.deleteFileWithResponse(fileName, context).block(); } /** diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java index 85609f09297b..2b320b9074ab 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java @@ -13,9 +13,11 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -70,8 +72,11 @@ * @see SASTokenCredential * @see SharedKeyCredential */ +@ServiceClientBuilder(serviceClients = {DirectoryClient.class, DirectoryAsyncClient.class}) public class DirectoryClientBuilder { private static final String ACCOUNT_NAME = "accountname"; + + private final ClientLogger logger = new ClientLogger(DirectoryClientBuilder.class); private final List policies; private final RetryPolicy retryPolicy; @@ -121,7 +126,7 @@ public DirectoryAsyncClient buildAsyncClient() { } if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); + throw logger.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); } // Closest to API goes first, closest to wire goes last. @@ -200,7 +205,7 @@ public DirectoryClientBuilder endpoint(String endpoint) { this.sharedKeyCredential = null; } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Directory endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage Directory endpoint url is malformed.")); } return this; @@ -257,8 +262,8 @@ private void getEndPointFromConnectionString(String connectionString) { try { this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " - + "Connection String: %s", connectionString)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format("There is no valid endpoint " + + "for the connection string. Connection String: %s", connectionString))); } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java index ce3b9b561530..fc5c246cea39 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java @@ -38,12 +38,16 @@ import com.azure.storage.file.models.FilesUploadRangeResponse; import com.azure.storage.file.models.HandleItem; import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; + import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; import java.net.MalformedURLException; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; @@ -53,15 +57,15 @@ import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.concurrent.TimeoutException; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; + +import static com.azure.core.implementation.util.FluxUtil.withContext; /** - * This class provides a client that contains all the operations for interacting with file in Azure Storage File Service. - * Operations allowed by the client are creating, copying, uploading, downloading, deleting and listing on a file, retrieving properties, setting metadata - * and list or force close handles of the file. + * This class provides a client that contains all the operations for interacting with file in Azure Storage File + * Service. Operations allowed by the client are creating, copying, uploading, downloading, deleting and listing on a + * file, retrieving properties, setting metadata and list or force close handles of the file. * *

    Instantiating an Asynchronous File Client

    * @@ -85,14 +89,17 @@ public class FileAsyncClient { private final String snapshot; /** - * Creates a FileAsyncClient that sends requests to the storage file at {@link AzureFileStorageImpl#getUrl() endpoint}. - * Each service call goes through the {@link HttpPipeline pipeline} in the {@code client}. + * Creates a FileAsyncClient that sends requests to the storage file at {@link AzureFileStorageImpl#getUrl() + * endpoint}. Each service call goes through the {@link HttpPipeline pipeline} in the {@code client}. + * * @param azureFileStorageClient Client that interacts with the service interfaces * @param shareName Name of the share * @param filePath Path to the file * @param snapshot The snapshot of the share */ FileAsyncClient(AzureFileStorageImpl azureFileStorageClient, String shareName, String filePath, String snapshot) { + Objects.requireNonNull(shareName); + Objects.requireNonNull(filePath); this.shareName = shareName; this.filePath = filePath; this.snapshot = snapshot; @@ -100,8 +107,9 @@ public class FileAsyncClient { } /** - * Creates a FileAsyncClient that sends requests to the storage account at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. + * Creates a FileAsyncClient that sends requests to the storage account at {@code endpoint}. Each service call goes + * through the {@code httpPipeline}. + * * @param endpoint URL for the Storage File service * @param httpPipeline HttpPipeline that HTTP requests and response flow through * @param shareName Name of the share @@ -109,16 +117,19 @@ public class FileAsyncClient { * @param snapshot Optional snapshot of the share */ FileAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String filePath, String snapshot) { + Objects.requireNonNull(shareName); + Objects.requireNonNull(filePath); this.shareName = shareName; this.filePath = filePath; this.snapshot = snapshot; this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); + .url(endpoint.toString()) + .build(); } /** * Get the url of the storage file client. + * * @return the URL of the storage file client * @throws RuntimeException If the file is using a malformed URL. */ @@ -126,8 +137,8 @@ public URL getFileUrl() { try { return new URL(azureFileStorageClient.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), - azureFileStorageClient.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), + azureFileStorageClient.getUrl()), e)); } } @@ -145,10 +156,11 @@ public URL getFileUrl() { * * @param maxSize The maximum size in bytes for the file, up to 1 TiB. * @return A response containing the file info and the status of creating the file. - * @throws StorageErrorException If the file has already existed, the parent directory does not exist or fileName is an invalid resource name. + * @throws StorageErrorException If the file has already existed, the parent directory does not exist or fileName is + * an invalid resource name. */ - public Mono> create(long maxSize) { - return create(maxSize, null, null); + public Mono create(long maxSize) { + return createWithResponse(maxSize, null, null).flatMap(FluxUtil::toMono); } /** @@ -158,7 +170,7 @@ public Mono> create(long maxSize) { * *

    Create the file with length of 1024 bytes, some headers and metadata.

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map} + * {@codesnippet com.azure.storage.file.fileAsyncClient.createWithResponse#long-filehttpheaders-map} * *

    For more information, see the * Azure Docs.

    @@ -166,12 +178,22 @@ public Mono> create(long maxSize) { * @param maxSize The maximum size in bytes for the file, up to 1 TiB. * @param httpHeaders Additional parameters for the operation. * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. - * @see C# identifiers - * @return A response containing the directory info and the status of creating the directory. + * @return A response containing the {@link FileInfo file info} and the status of creating the file. * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory is an invalid resource name. */ - public Mono> create(long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - return azureFileStorageClient.files().createWithRestResponseAsync(shareName, filePath, maxSize, null, metadata, httpHeaders, Context.NONE) + public Mono> createWithResponse(long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + return withContext(context -> createWithResponse(maxSize, httpHeaders, metadata, context)); + } + + Mono> createWithResponse(long maxSize, FileHTTPHeaders httpHeaders, Map metadata, Context context) { + // TODO (alzimmer): These properties are dummy defaults to allow the new service version to be used. Remove these and use correct defaults when known (https://github.com/Azure/azure-sdk-for-java/issues/5039) + String fileAttributes = "None"; + String filePermission = "inherit"; + String fileCreationTime = "now"; + String fileLastWriteTime = "now"; + + return azureFileStorageClient.files().createWithRestResponseAsync(shareName, filePath, maxSize, fileAttributes, + fileCreationTime, fileLastWriteTime, null, metadata, filePermission, null, httpHeaders, context) .map(this::createFileInfoResponse); } @@ -189,12 +211,37 @@ public Mono> create(long maxSize, FileHTTPHeaders httpHeaders * * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @return The {@link FileCopyInfo file copy info}. * @see C# identifiers - * @return A response containing the file copy info and the status of copying the file. */ - public Mono> startCopy(String sourceUrl, Map metadata) { - return azureFileStorageClient.files().startCopyWithRestResponseAsync(shareName, filePath, sourceUrl, null, metadata, Context.NONE) - .map(this::startCopyResponse); + public Mono startCopy(String sourceUrl, Map metadata) { + return startCopyWithResponse(sourceUrl, metadata).flatMap(FluxUtil::toMono); + } + + /** + * Copies a blob or file to a destination file within the storage account. + * + *

    Code Samples

    + * + *

    Copy file from source url to the {@code filePath}

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.startCopyWithResponse#string-map} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. + * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @return A response containing the {@link FileCopyInfo file copy info} and the status of copying the file. + * @see C# identifiers + */ + public Mono> startCopyWithResponse(String sourceUrl, Map metadata) { + return withContext(context -> startCopyWithResponse(sourceUrl, metadata, context)); + } + + Mono> startCopyWithResponse(String sourceUrl, Map metadata, Context context) { + return azureFileStorageClient.files().startCopyWithRestResponseAsync(shareName, filePath, sourceUrl, null, metadata, context) + .map(this::startCopyResponse); } /** @@ -210,11 +257,34 @@ public Mono> startCopy(String sourceUrl, MapAzure Docs.

    * * @param copyId Specifies the copy id which has copying pending status associate with it. + * @return An empty response. + */ + public Mono abortCopy(String copyId) { + return abortCopyWithResponse(copyId).flatMap(FluxUtil::toMono); + } + + /** + * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. + * + *

    Code Samples

    + * + *

    Abort copy file from copy id("someCopyId")

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.abortCopyWithResponse#string} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param copyId Specifies the copy id which has copying pending status associate with it. * @return A response containing the status of aborting copy the file. */ - public Mono abortCopy(String copyId) { - return azureFileStorageClient.files().abortCopyWithRestResponseAsync(shareName, filePath, copyId, Context.NONE) - .map(VoidResponse::new); + public Mono abortCopyWithResponse(String copyId) { + return withContext(context -> abortCopyWithResponse(copyId, context)); + } + + Mono abortCopyWithResponse(String copyId, Context context) { + return azureFileStorageClient.files().abortCopyWithRestResponseAsync(shareName, filePath, copyId, context) + .map(VoidResponse::new); } /** @@ -255,22 +325,22 @@ public Mono downloadToFile(String downloadFilePath) { public Mono downloadToFile(String downloadFilePath, FileRange range) { AsynchronousFileChannel channel = channelSetup(downloadFilePath); return sliceFileRange(range) - .flatMap(chunk -> downloadWithProperties(chunk, false) - .map(dar -> dar.value().body()) - .subscribeOn(Schedulers.elastic()) - .flatMap(fbb -> FluxUtil.bytebufStreamToFile(fbb, channel, chunk.start() - (range == null ? 0 : range.start())) - .subscribeOn(Schedulers.elastic()) - .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) - .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException))) - .then() - .doOnTerminate(() -> channelCleanUp(channel)); + .flatMap(chunk -> downloadWithPropertiesWithResponse(chunk, false) + .map(dar -> dar.value().body()) + .subscribeOn(Schedulers.elastic()) + .flatMap(fbb -> FluxUtil.writeFile(fbb, channel, chunk.start() - (range == null ? 0 : range.start())) + .subscribeOn(Schedulers.elastic()) + .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) + .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException))) + .then() + .doOnTerminate(() -> channelCleanUp(channel)); } private AsynchronousFileChannel channelSetup(String filePath) { try { return AsynchronousFileChannel.open(Paths.get(filePath), StandardOpenOption.READ, StandardOpenOption.WRITE); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } @@ -278,7 +348,7 @@ private void channelCleanUp(AsynchronousFileChannel channel) { try { channel.close(); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } @@ -290,20 +360,20 @@ private Flux sliceFileRange(FileRange fileRange) { } else { end = Mono.empty(); } - end = end.switchIfEmpty(getProperties().map(rb -> rb.value().contentLength())); + end = end.switchIfEmpty(getProperties().map(rb -> rb.contentLength())); return end - .map(e -> { - List chunks = new ArrayList<>(); - for (long pos = offset; pos < e; pos += FILE_DEFAULT_BLOCK_SIZE) { - long count = FILE_DEFAULT_BLOCK_SIZE; - if (pos + count > e) { - count = e - pos; - } - chunks.add(new FileRange(pos, pos + count - 1)); - } - return chunks; - }) - .flatMapMany(Flux::fromIterable); + .map(e -> { + List chunks = new ArrayList<>(); + for (long pos = offset; pos < e; pos += FILE_DEFAULT_BLOCK_SIZE) { + long count = FILE_DEFAULT_BLOCK_SIZE; + if (pos + count > e) { + count = e - pos; + } + chunks.add(new FileRange(pos, pos + count - 1)); + } + return chunks; + }) + .flatMapMany(Flux::fromIterable); } /** @@ -318,10 +388,10 @@ private Flux sliceFileRange(FileRange fileRange) { *

    For more information, see the * Azure Docs.

    * - * @return A response that only contains headers and response status code + * @return The {@link FileDownloadInfo file download Info} */ - public Mono> downloadWithProperties() { - return downloadWithProperties(null, null); + public Mono downloadWithProperties() { + return downloadWithPropertiesWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -331,19 +401,24 @@ public Mono> downloadWithProperties() { * *

    Download the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean} + * {@codesnippet com.azure.storage.file.fileAsyncClient.downloadWithPropertiesWithResponse#filerange-boolean} * *

    For more information, see the * Azure Docs.

    * * @param range Optional byte range which returns file data only from the specified range. - * @param rangeGetContentMD5 Optional boolean which the service returns the MD5 hash for the range when it sets to true, as long as the range is less than or equal to 4 MB in size. - * @return A response that only contains headers and response status code + * @param rangeGetContentMD5 Optional boolean which the service returns the MD5 hash for the range when it sets + * to true, as long as the range is less than or equal to 4 MB in size. + * @return A response containing the {@link FileDownloadInfo file download Info} with headers and response status code */ - public Mono> downloadWithProperties(FileRange range, Boolean rangeGetContentMD5) { + public Mono> downloadWithPropertiesWithResponse(FileRange range, Boolean rangeGetContentMD5) { + return withContext(context -> downloadWithPropertiesWithResponse(range, rangeGetContentMD5, context)); + } + + Mono> downloadWithPropertiesWithResponse(FileRange range, Boolean rangeGetContentMD5, Context context) { String rangeString = range == null ? null : range.toString(); - return azureFileStorageClient.files().downloadWithRestResponseAsync(shareName, filePath, null, rangeString, rangeGetContentMD5, Context.NONE) - .map(this::downloadWithPropertiesResponse); + return azureFileStorageClient.files().downloadWithRestResponseAsync(shareName, filePath, null, rangeString, rangeGetContentMD5, context) + .map(this::downloadWithPropertiesResponse); } /** @@ -357,13 +432,54 @@ public Mono> downloadWithProperties(FileRange range, * *

    For more information, see the * Azure Docs.

    + * @return An empty response + * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist. + */ + public Mono delete() { + return deleteWithResponse(null).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the file associate with the client. + * + *

    Code Samples

    + * + *

    Delete the file

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.deleteWithResponse} + * + *

    For more information, see the + * Azure Docs.

    * * @return A response that only contains headers and response status code * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist. */ - public Mono delete() { - return azureFileStorageClient.files().deleteWithRestResponseAsync(shareName, filePath, Context.NONE) - .map(VoidResponse::new); + public Mono deleteWithResponse() { + return withContext(context -> deleteWithResponse(context)); + } + + Mono deleteWithResponse(Context context) { + return azureFileStorageClient.files().deleteWithRestResponseAsync(shareName, filePath, context) + .map(VoidResponse::new); + } + + /** + * Retrieves the properties of the storage account's file. The properties includes file metadata, last modified + * date, is server encrypted, and eTag. + * + *

    Code Samples

    + * + *

    Retrieve file properties

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.getProperties} + * + *

    For more information, see the + * Azure Docs.

    + * + * @return {@link FileProperties Storage file properties} + */ + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } /** @@ -374,16 +490,20 @@ public Mono delete() { * *

    Retrieve file properties

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.getProperties} + * {@codesnippet com.azure.storage.file.fileAsyncClient.getPropertiesWithResponse} * *

    For more information, see the * Azure Docs.

    * - * @return Storage file properties + * @return A response containing the {@link FileProperties storage file properties} and response status code */ - public Mono> getProperties() { - return azureFileStorageClient.files().getPropertiesWithRestResponseAsync(shareName, filePath, snapshot, null, Context.NONE) - .map(this::getPropertiesResponse); + public Mono> getPropertiesWithResponse() { + return withContext(context -> getPropertiesWithResponse(context)); + } + + Mono> getPropertiesWithResponse(Context context) { + return azureFileStorageClient.files().getPropertiesWithRestResponseAsync(shareName, filePath, snapshot, null, context) + .map(this::getPropertiesResponse); } /** @@ -406,12 +526,50 @@ public Mono> getProperties() { * * @param newFileSize New file size of the file * @param httpHeaders Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. - * @return Response of the information about the file + * @return The {@link FileInfo file info} * @throws IllegalArgumentException thrown if parameters fail the validation. */ - public Mono> setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { - return azureFileStorageClient.files().setHTTPHeadersWithRestResponseAsync(shareName, filePath, null, newFileSize, httpHeaders, Context.NONE) - .map(this::setHttpHeadersResponse); + public Mono setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { + return setHttpHeadersWithResponse(newFileSize, httpHeaders).flatMap(FluxUtil::toMono); + } + + /** + * Sets the user-defined httpHeaders to associate to the file. + * + *

    If {@code null} is passed for the httpHeaders it will clear the httpHeaders associated to the file.

    + * + *

    Code Samples

    + * + *

    Set the httpHeaders of contentType of "text/plain"

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.setHttpHeadersWithResponse#long-filehttpheaders} + * + *

    Clear the metadata of the file

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.setHttpHeadersWithResponse#long-filehttpheaders.clearHttpHeaders} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param newFileSize New file size of the file + * @param httpHeaders Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. + * @return Response containing the {@link FileInfo file info} and response status code + * @throws IllegalArgumentException thrown if parameters fail the validation. + */ + public Mono> setHttpHeadersWithResponse(long newFileSize, FileHTTPHeaders httpHeaders) { + return withContext(context -> setHttpHeadersWithResponse(newFileSize, httpHeaders, context)); + } + + Mono> setHttpHeadersWithResponse(long newFileSize, FileHTTPHeaders httpHeaders, Context context) { + // TODO (alzimmer): These properties are dummy defaults to allow the new service version to be used. Remove these and use correct defaults when known (https://github.com/Azure/azure-sdk-for-java/issues/5039) + String fileAttributes = "None"; + String filePermission = "inherit"; + String fileCreationTime = "preserve"; + String fileLastWriteTime = "preserve"; + + return azureFileStorageClient.files().setHTTPHeadersWithRestResponseAsync(shareName, filePath, fileAttributes, + fileCreationTime, fileLastWriteTime, null, newFileSize, filePermission, null, httpHeaders, context) + .map(this::setHttpHeadersResponse); } /** @@ -427,18 +585,69 @@ public Mono> setHttpHeaders(long newFileSize, FileHTTPHeaders * *

    Clear the metadata of the file

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata} + * {@codesnippet com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map.clearMetadata} * *

    For more information, see the * Azure Docs.

    * * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared - * @return information about the file + * @return {@link FileMetadataInfo file meta info} * @throws StorageErrorException If the file doesn't exist or the metadata contains invalid keys */ - public Mono> setMetadata(Map metadata) { - return azureFileStorageClient.files().setMetadataWithRestResponseAsync(shareName, filePath, null, metadata, Context.NONE) - .map(this::setMetadataResponse); + public Mono setMetadata(Map metadata) { + return setMetadataWithResponse(metadata).flatMap(FluxUtil::toMono); + } + + /** + * Sets the user-defined metadata to associate to the file. + * + *

    If {@code null} is passed for the metadata it will clear the metadata associated to the file.

    + * + *

    Code Samples

    + * + *

    Set the metadata to "file:updatedMetadata"

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map} + * + *

    Clear the metadata of the file

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map.clearMetadata} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared + * @return A response containing the {@link FileMetadataInfo file meta info} and status code + * @throws StorageErrorException If the file doesn't exist or the metadata contains invalid keys + */ + public Mono> setMetadataWithResponse(Map metadata) { + return withContext(context -> setMetadataWithResponse(metadata, context)); + } + + Mono> setMetadataWithResponse(Map metadata, Context context) { + return azureFileStorageClient.files().setMetadataWithRestResponseAsync(shareName, filePath, null, metadata, context) + .map(this::setMetadataResponse); + } + + /** + * Uploads a range of bytes to the beginning of a file in storage file service. Upload operations performs an + * in-place write on the specified file. + * + *

    Code Samples

    + * + *

    Upload data "default" to the file in Storage File Service.

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.upload#flux-long} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param data The data which will upload to the storage file. + * @param length Specifies the number of bytes being transmitted in the request body. + * @return A response that only contains headers and response status code + */ + public Mono upload(Flux data, long length) { + return uploadWithResponse(data, length).flatMap(FluxUtil::toMono); } /** @@ -448,22 +657,49 @@ public Mono> setMetadata(Map metadata * *

    Upload "default" to the file.

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.upload#flux-long} + * {@codesnippet com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long} * *

    For more information, see the * Azure Docs.

    * * @param data The data which will upload to the storage file. * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero.. - * @return A response that only contains headers and response status code + * @return A response containing the {@link FileUploadInfo file upload info} with headers and response status code * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) */ - public Mono> upload(Flux data, long length) { + public Mono> uploadWithResponse(Flux data, long length) { + return withContext(context -> uploadWithResponse(data, length, context)); + } + + Mono> uploadWithResponse(Flux data, long length, Context context) { FileRange range = new FileRange(0, length - 1); - return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.UPDATE, length, data, null, null, Context.NONE) + return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.UPDATE, length, data, null, null, context) .map(this::uploadResponse); } + /** + * Uploads a range of bytes to specific of a file in storage file service. Upload operations performs an in-place + * write on the specified file. + * + *

    Code Samples

    + * + *

    Upload data "default" starting from 1024 bytes.

    + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.upload#flux-long-long} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param data The data which will upload to the storage file. + * @param length Specifies the number of bytes being transmitted in the request body. + * @param offset Optional starting point of the upload range. It will start from the beginning if it is {@code null} + * @return The {@link FileUploadInfo file upload info} + * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + */ + public Mono upload(Flux data, long length, long offset) { + return uploadWithResponse(data, length, offset).flatMap(FluxUtil::toMono); + } + /** * Uploads a range of bytes to specific of a file in storage file service. Upload operations performs an in-place write on the specified file. * @@ -471,7 +707,7 @@ public Mono> upload(Flux data, long length) { * *

    Upload the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

    * - * {@codesnippet com.azure.storage.file.fileAsyncClient.upload#bytebuf-long-int-filerangewritetype} + * {@codesnippet com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long-long} * *

    For more information, see the * Azure Docs.

    @@ -479,39 +715,64 @@ public Mono> upload(Flux data, long length) { * @param data The data which will upload to the storage file. * @param offset Optional starting point of the upload range. It will start from the beginning if it is {@code null} * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero. - * @param type You may specify one of the following options: - *
      - *
    • Update: Writes the bytes specified by the request body into the specified range.
    • - *
    • Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero.
    • - *
        - * @return A response that only contains headers and response status code + * @return A response containing the {@link FileUploadInfo file upload info} with headers and response status code * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) */ - public Mono> upload(Flux data, long length, long offset, FileRangeWriteType type) { + public Mono> uploadWithResponse(Flux data, long length, long offset) { + return withContext(context -> uploadWithResponse(data, length, offset, context)); + } + + Mono> uploadWithResponse(Flux data, long length, long offset, Context context) { FileRange range = new FileRange(offset, offset + length - 1); - return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), type, length, data, null, null, Context.NONE) - .map(this::uploadResponse); + return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.UPDATE, length, data, null, null, context) + .map(this::uploadResponse); } /** - * Uploads file to storage file service. + * Clear a range of bytes to specific of a file in storage file service. Clear operations performs an in-place + * write on the specified file. * *

        Code Samples

        * - *

        Upload the file from the source file path.

        + *

        Clears the first 1024 bytes.

        * - * {@codesnippet com.azure.storage.file.fileAsyncClient.uploadFromFile#string} + * {@codesnippet com.azure.storage.file.fileAsyncClient.clearRange#long} * *

        For more information, see the - * Azure Docs Create File - * and - * Azure Docs Upload.

        + * Azure Docs.

        * - * @param uploadFilePath The path where store the source file to upload - * @return An empty response. + * @param length Specifies the number of bytes being cleared. + * @return The {@link FileUploadInfo file upload info} */ - public Mono uploadFromFile(String uploadFilePath) { - return uploadFromFile(uploadFilePath, FileRangeWriteType.UPDATE); + public Mono clearRange(long length) { + return clearRangeWithResponse(length, 0).flatMap(FluxUtil::toMono); + } + + /** + * Clear a range of bytes to specific of a file in storage file service. Clear operations performs an in-place + * write on the specified file. + * + *

        Code Samples

        + * + *

        Clear the range starting from 1024 with length of 1024.

        + * + * {@codesnippet com.azure.storage.file.fileAsyncClient.clearRange#long-long} + * + *

        For more information, see the + * Azure Docs.

        + * + * @param length Specifies the number of bytes being cleared in the request body. + * @param offset Optional starting point of the upload range. It will start from the beginning if it is {@code null} + * @return A response of {@link FileUploadInfo file upload info} that only contains headers and response status code + */ + public Mono> clearRangeWithResponse(long length, long offset) { + return withContext(context -> clearRangeWithResponse(length, offset, context)); + } + + Mono> clearRangeWithResponse(long length, long offset, Context context) { + FileRange range = new FileRange(offset, offset + length - 1); + return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.CLEAR, 0L, null, null, null, context) + .map(this::uploadResponse); } /** @@ -521,7 +782,7 @@ public Mono uploadFromFile(String uploadFilePath) { * *

        Upload the file from the source file path.

        * - * (@codesnippet com.azure.storage.file.fileAsyncClient.uploadFromFile#string-filerangewritetype} + * (@codesnippet com.azure.storage.file.fileAsyncClient.uploadFromFile#string} * *

        For more information, see the * Azure Docs Create File @@ -529,25 +790,19 @@ public Mono uploadFromFile(String uploadFilePath) { * Azure Docs Upload.

        * * @param uploadFilePath The path where store the source file to upload - * @param type You may specify one of the following options: - *
          - *
        • Update: Writes the bytes specified by the request body into the specified range.
        • - *
        • Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero.
        • - *
            - * * @return An empty response. * @throws UncheckedIOException If an I/O error occurs. */ - public Mono uploadFromFile(String uploadFilePath, FileRangeWriteType type) { + public Mono uploadFromFile(String uploadFilePath) { AsynchronousFileChannel channel = channelSetup(uploadFilePath); return Flux.fromIterable(sliceFile(uploadFilePath)) - .flatMap(chunk -> { - return upload(FluxUtil.byteBufStreamFromFile(channel, chunk.start(), chunk.end() - chunk.start() + 1), chunk.end() - chunk.start() + 1, chunk.start(), type) - .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) - .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException); - }) - .then() - .doOnTerminate(() -> channelCleanUp(channel)); + .flatMap(chunk -> { + return upload(FluxUtil.readFile(channel, chunk.start(), chunk.end() - chunk.start() + 1), chunk.end() - chunk.start() + 1, chunk.start()) + .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) + .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException); + }) + .then() + .doOnTerminate(() -> channelCleanUp(channel)); } private List sliceFile(String path) { @@ -579,8 +834,7 @@ private List sliceFile(String path) { * @return {@link FileRange ranges} in the files. */ public Flux listRanges() { - return azureFileStorageClient.files().getRangeListWithRestResponseAsync(shareName, filePath, snapshot, null, null, Context.NONE) - .flatMapMany(this::convertListRangesResponseToFileRangeInfo); + return listRanges(null); } /** @@ -601,7 +855,7 @@ public Flux listRanges() { public Flux listRanges(FileRange range) { String rangeString = range == null ? null : range.toString(); return azureFileStorageClient.files().getRangeListWithRestResponseAsync(shareName, filePath, snapshot, null, rangeString, Context.NONE) - .flatMapMany(this::convertListRangesResponseToFileRangeInfo); + .flatMapMany(this::convertListRangesResponseToFileRangeInfo); } /** @@ -639,13 +893,12 @@ public Flux listHandles() { */ public Flux listHandles(Integer maxResults) { return azureFileStorageClient.files().listHandlesWithRestResponseAsync(shareName, filePath, null, maxResults, null, snapshot, Context.NONE) - .flatMapMany(response -> nextPageForHandles(response, maxResults)); + .flatMapMany(response -> nextPageForHandles(response, maxResults)); } /** - * Closes a handle or handles opened on a file at the service. It is intended to be used alongside {@link FileAsyncClient#listHandles()} (Integer)} . - * TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. - * TODO: @see Github Issue 4525 + * Closes a handle or handles opened on a file at the service. It is intended to be used alongside {@link + * FileAsyncClient#listHandles()} (Integer)} . * *

            Code Samples

            * @@ -656,17 +909,19 @@ public Flux listHandles(Integer maxResults) { *

            For more information, see the * Azure Docs.

            * - * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. + * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all + * handles. * @return The counts of number of handles closed */ public Flux forceCloseHandles(String handleId) { + // TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. + // TODO: @see Github return azureFileStorageClient.files().forceCloseHandlesWithRestResponseAsync(shareName, filePath, handleId, null, null, snapshot, Context.NONE) - .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId)); + .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId)); } /** - * Get snapshot id which attached to {@link FileAsyncClient}. - * Return {@code null} if no snapshot id attached. + * Get snapshot id which attached to {@link FileAsyncClient}. Return {@code null} if no snapshot id attached. * *

            Code Samples

            * @@ -674,7 +929,8 @@ public Flux forceCloseHandles(String handleId) { * * {@codesnippet com.azure.storage.file.fileAsyncClient.getShareSnapshotId} * - * @return The snapshot id which is a unique {@code DateTime} value that identifies the share snapshot to its base share. + * @return The snapshot id which is a unique {@code DateTime} value that identifies the share snapshot to its base + * share. */ public String getShareSnapshotId() { return this.snapshot; @@ -698,7 +954,7 @@ private Flux nextPageForHandles(final FilesListHandlesResponse respo return Flux.fromIterable(handleItems); } - Mono listResponse = azureFileStorageClient.files().listHandlesWithRestResponseAsync(shareName, filePath, response.value().nextMarker(), maxResults, null, snapshot, Context.NONE); + Mono listResponse = azureFileStorageClient.files().listHandlesWithRestResponseAsync(shareName, filePath, response.value().nextMarker(), maxResults, null, snapshot, Context.NONE); Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForHandles(newResponse, maxResults)); return Flux.fromIterable(handleItems).concatWith(fileRefPublisher); } @@ -727,6 +983,7 @@ private Response setHttpHeadersResponse(final FilesSetHTTPHeadersRespo FileInfo fileInfo = new FileInfo(eTag, lastModified, isServerEncrypted); return new SimpleResponse<>(response, fileInfo); } + private Response downloadWithPropertiesResponse(final FilesDownloadResponse response) { String eTag = response.deserializedHeaders().eTag(); OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); @@ -734,7 +991,7 @@ private Response downloadWithPropertiesResponse(final FilesDow Long contentLength = response.deserializedHeaders().contentLength(); String contentType = response.deserializedHeaders().contentType(); String contentRange = response.deserializedHeaders().contentRange(); - Flux body = response.value(); + Flux body = response.value(); FileDownloadInfo fileDownloadInfo = new FileDownloadInfo(eTag, lastModified, metadata, contentLength, contentType, contentRange, body); return new SimpleResponse<>(response, fileDownloadInfo); } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java index b8de3708e898..5d2fa97b4270 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java @@ -5,6 +5,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.FileCopyInfo; @@ -14,14 +15,14 @@ import com.azure.storage.file.models.FileMetadataInfo; import com.azure.storage.file.models.FileProperties; import com.azure.storage.file.models.FileRange; -import com.azure.storage.file.models.FileRangeWriteType; import com.azure.storage.file.models.FileUploadInfo; import com.azure.storage.file.models.HandleItem; import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; +import reactor.core.publisher.Flux; + import java.net.URL; +import java.nio.ByteBuffer; import java.util.Map; -import reactor.core.publisher.Flux; /** * This class provides a client that contains all the operations for interacting files under Azure Storage File Service. @@ -72,11 +73,11 @@ public URL getFileUrl() { *
            Azure Docs.

            * * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @return A response containing the file info and the status of creating the file. + * @return The {@link FileInfo file info} * @throws StorageErrorException If the file has already existed, the parent directory does not exist or fileName is an invalid resource name. */ - public Response create(long maxSize) { - return fileAsyncClient.create(maxSize).block(); + public FileInfo create(long maxSize) { + return createWithResponse(maxSize, null, null, Context.NONE).value(); } /** @@ -86,7 +87,7 @@ public Response create(long maxSize) { * *

            Create the file with length of 1024 bytes, some headers and metadata.

            * - * {@codesnippet com.azure.storage.file.fileClient.create#long-filehttpheaders-map} + * {@codesnippet com.azure.storage.file.fileClient.createWithResponse#long-filehttpheaders-map-Context} * *

            For more information, see the * Azure Docs.

            @@ -95,11 +96,12 @@ public Response create(long maxSize) { * @param httpHeaders Additional parameters for the operation. * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. * @see C# identifiers - * @return A response containing the directory info and the status of creating the directory. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileInfo file info} and the status of creating the file. * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory is an invalid resource name. */ - public Response create(long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - return fileAsyncClient.create(maxSize, httpHeaders, metadata).block(); + public Response createWithResponse(long maxSize, FileHTTPHeaders httpHeaders, Map metadata, Context context) { + return fileAsyncClient.createWithResponse(maxSize, httpHeaders, metadata, context).block(); } /** @@ -117,10 +119,32 @@ public Response create(long maxSize, FileHTTPHeaders httpHeaders, Map< * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. * @see C# identifiers - * @return A response containing the file copy info and the status of copying the file. + * @return The {@link FileCopyInfo file copy info} + */ + public FileCopyInfo startCopy(String sourceUrl, Map metadata) { + return startCopyWithResponse(sourceUrl, metadata, Context.NONE).value(); + } + + /** + * Copies a blob or file to a destination file within the storage account. + * + *

            Code Samples

            + * + *

            Copy file from source getDirectoryUrl to the {@code filePath}

            + * + * {@codesnippet com.azure.storage.file.fileClient.startCopyWithResponse#string-map-Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. + * @param metadata Optional name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @see C# identifiers + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileCopyInfo file copy info} and the status of copying the file. */ - public Response startCopy(String sourceUrl, Map metadata) { - return fileAsyncClient.startCopy(sourceUrl, metadata).block(); + public Response startCopyWithResponse(String sourceUrl, Map metadata, Context context) { + return fileAsyncClient.startCopyWithResponse(sourceUrl, metadata, context).block(); } /** @@ -136,10 +160,29 @@ public Response startCopy(String sourceUrl, Map me * Azure Docs.

            * * @param copyId Specifies the copy id which has copying pending status associate with it. + */ + public void abortCopy(String copyId) { + abortCopyWithResponse(copyId, Context.NONE); + } + + /** + * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. + * + *

            Code Samples

            + * + *

            Abort copy file from copy id("someCopyId")

            + * + * {@codesnippet com.azure.storage.file.fileClient.abortCopyWithResponse#string-Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param copyId Specifies the copy id which has copying pending status associate with it. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing the status of aborting copy the file. */ - public VoidResponse abortCopy(String copyId) { - return fileAsyncClient.abortCopy(copyId).block(); + public VoidResponse abortCopyWithResponse(String copyId, Context context) { + return fileAsyncClient.abortCopyWithResponse(copyId, context).block(); } /** @@ -191,10 +234,10 @@ public void downloadToFile(String downloadFilePath, FileRange range) { *

            For more information, see the * Azure Docs.

            * - * @return A response that only contains headers and response status code + * @return The {@link FileDownloadInfo file download info} */ - public Response downloadWithProperties() { - return fileAsyncClient.downloadWithProperties(null, null).block(); + public FileDownloadInfo downloadWithProperties() { + return downloadWithPropertiesWithResponse(null, null, Context.NONE).value(); } /** @@ -204,17 +247,18 @@ public Response downloadWithProperties() { * *

            Download the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

            * - * {@codesnippet com.azure.storage.file.fileClient.downloadWithProperties#filerange-boolean} + * {@codesnippet com.azure.storage.file.fileClient.downloadWithPropertiesWithResponse#filerange-boolean-Context} * *

            For more information, see the * Azure Docs.

            * * @param range Optional byte range which returns file data only from the specified range. * @param rangeGetContentMD5 Optional boolean which the service returns the MD5 hash for the range when it sets to true, as long as the range is less than or equal to 4 MB in size. - * @return A response that only contains headers and response status code + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileDownloadInfo file download info} headers and response status code */ - public Response downloadWithProperties(FileRange range, Boolean rangeGetContentMD5) { - return fileAsyncClient.downloadWithProperties(range, rangeGetContentMD5).block(); + public Response downloadWithPropertiesWithResponse(FileRange range, Boolean rangeGetContentMD5, Context context) { + return fileAsyncClient.downloadWithPropertiesWithResponse(range, rangeGetContentMD5, context).block(); } /** @@ -229,11 +273,31 @@ public Response downloadWithProperties(FileRange range, Boolea *

            For more information, see the * Azure Docs.

            * + * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist. + */ + public void delete() { + deleteWithResponse(Context.NONE); + } + + + /** + * Deletes the file associate with the client. + * + *

            Code Samples

            + * + *

            Delete the file

            + * + * {@codesnippet com.azure.storage.file.fileClient.deleteWithResponse#Context} + * + *

            For more information, see the + * Azure Docs.

            + * * @return A response that only contains headers and response status code + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist. */ - public VoidResponse delete() { - return fileAsyncClient.delete().block(); + public VoidResponse deleteWithResponse(Context context) { + return fileAsyncClient.deleteWithResponse(context).block(); } /** @@ -249,10 +313,30 @@ public VoidResponse delete() { *

            For more information, see the * Azure Docs.

            * - * @return Storage file properties + * @return {@link FileProperties Storage file properties} + */ + public FileProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * Retrieves the properties of the storage account's file. + * The properties includes file metadata, last modified date, is server encrypted, and eTag. + * + *

            Code Samples

            + * + *

            Retrieve file properties

            + * + * {@codesnippet com.azure.storage.file.fileClient.getPropertiesWithResponse#Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileProperties Storage file properties} with headers and status code */ - public Response getProperties() { - return fileAsyncClient.getProperties().block(); + public Response getPropertiesWithResponse(Context context) { + return fileAsyncClient.getPropertiesWithResponse(context).block(); } /** @@ -275,11 +359,39 @@ public Response getProperties() { * * @param newFileSize New file size of the file * @param httpHeaders Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. - * @return Response of the information about the file + * @return The {@link FileInfo file info} * @throws IllegalArgumentException thrown if parameters fail the validation. */ - public Response setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { - return fileAsyncClient.setHttpHeaders(newFileSize, httpHeaders).block(); + public FileInfo setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { + return setHttpHeadersWithResponse(newFileSize, httpHeaders, Context.NONE).value(); + } + + /** + * Sets the user-defined httpHeaders to associate to the file. + * + *

            If {@code null} is passed for the httpHeaders it will clear the httpHeaders associated to the file.

            + * + *

            Code Samples

            + * + *

            Set the httpHeaders of contentType of "text/plain"

            + * + * {@codesnippet com.azure.storage.file.fileClient.setHttpHeadersWithResponse#long-filehttpheaders-Context} + * + *

            Clear the httpHeaders of the file

            + * + * {@codesnippet com.azure.storage.file.fileClient.setHttpHeadersWithResponse#long-filehttpheaders-Context.clearHttpHeaders} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param newFileSize New file size of the file + * @param httpHeaders Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return Response containing the {@link FileInfo file info} with headers and status code + * @throws IllegalArgumentException thrown if parameters fail the validation. + */ + public Response setHttpHeadersWithResponse(long newFileSize, FileHTTPHeaders httpHeaders, Context context) { + return fileAsyncClient.setHttpHeadersWithResponse(newFileSize, httpHeaders, context).block(); } /** @@ -301,32 +413,81 @@ public Response setHttpHeaders(long newFileSize, FileHTTPHeaders httpH * Azure Docs.

            * * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared - * @return information about the file + * @return The {@link FileMetadataInfo file meta info} + * @throws StorageErrorException If the file doesn't exist or the metadata contains invalid keys + */ + public FileMetadataInfo setMetadata(Map metadata) { + return setMetadataWithResponse(metadata, Context.NONE).value(); + } + + /** + * Sets the user-defined metadata to associate to the file. + * + *

            If {@code null} is passed for the metadata it will clear the metadata associated to the file.

            + * + *

            Code Samples

            + * + *

            Set the metadata to "file:updatedMetadata"

            + * + * {@codesnippet com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context} + * + *

            Clear the metadata of the file

            + * + * {@codesnippet com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context.clearMetadata} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return Response containing the {@link FileMetadataInfo file meta info} with headers and status code * @throws StorageErrorException If the file doesn't exist or the metadata contains invalid keys */ - public Response setMetadata(Map metadata) { - return fileAsyncClient.setMetadata(metadata).block(); + public Response setMetadataWithResponse(Map metadata, Context context) { + return fileAsyncClient.setMetadataWithResponse(metadata, context).block(); } /** + * Uploads a range of bytes to the beginning of a file in storage file service. Upload operations performs an in-place write on the specified file. + * + *

            Code Samples

            + * + *

            Upload data "default" to the file in Storage File Service.

            + * + * {@codesnippet com.azure.storage.file.fileClient.upload#bytebuffer-long} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param data The data which will upload to the storage file. + * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero.. + * @return The {@link FileUploadInfo file upload info} + * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + */ + public FileUploadInfo upload(ByteBuffer data, long length) { + return uploadWithResponse(data, length, Context.NONE).value(); + } + + /** * Uploads a range of bytes to the beginning of a file in storage file service. Upload operations performs an in-place write on the specified file. * *

            Code Samples

            * *

            Upload "default" to the file.

            * - * {@codesnippet com.azure.storage.file.fileClient.upload#flux-long} + * {@codesnippet com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-Context} * *

            For more information, see the * Azure Docs.

            * * @param data The data which will upload to the storage file. * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero.. - * @return A response that only contains headers and response status code + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return The {@link FileUploadInfo file upload info} * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) */ - public Response upload(ByteBuf data, long length) { - return fileAsyncClient.upload(Flux.just(data), length).block(); + public Response uploadWithResponse(ByteBuffer data, long length, Context context) { + return fileAsyncClient.uploadWithResponse(Flux.just(data), length, context).block(); } /** @@ -334,46 +495,62 @@ public Response upload(ByteBuf data, long length) { * *

            Code Samples

            * - *

            Upload the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

            + *

            Upload data "default" starting from 1024.

            * - * {@codesnippet com.azure.storage.file.fileClient.upload#bytebuf-long-int-filerangewritetype} + * {@codesnippet com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-long-Context} * *

            For more information, see the * Azure Docs.

            * * @param data The data which will upload to the storage file. + * @param length Specifies the number of bytes being transmitted in the request body. * @param offset Optional starting point of the upload range. It will start from the beginning if it is {@code null} - * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero. - * @param type You may specify one of the following options: - *
              - *
            • Update: Writes the bytes specified by the request body into the specified range.
            • - *
            • Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero.
            • - *
                - * @return A response that only contains headers and response status code + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileUploadInfo file upload info} with headers and response status code * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) */ - public Response upload(ByteBuf data, long length, int offset, FileRangeWriteType type) { - return fileAsyncClient.upload(Flux.just(data), length, offset, type).block(); + public Response uploadWithResponse(ByteBuffer data, long length, long offset, Context context) { + return fileAsyncClient.uploadWithResponse(Flux.just(data), length, offset, context).block(); } /** - * Uploads file to storage file service. + * Clears a range of bytes to specific of a file in storage file service. Clear operations performs an in-place write on the specified file. * *

                Code Samples

                * - *

                Upload the file from the source file path.

                + *

                Clears the first 1024 bytes.

                * - * {@codesnippet com.azure.storage.file.fileClient.uploadFromFile#string} + * {@codesnippet com.azure.storage.file.fileClient.clearRange#long} * *

                For more information, see the - * Azure Docs Create File - * and - * Azure Docs Upload.

                + * Azure Docs.

                * - * @param uploadFilePath The path where store the source file to upload + * @param length Specifies the number of bytes being cleared. + * @return The {@link FileUploadInfo file upload info} */ - public void uploadFromFile(String uploadFilePath) { - uploadFromFile(uploadFilePath, FileRangeWriteType.UPDATE); + public FileUploadInfo clearRange(long length) { + return clearRangeWithResponse(length, 0, Context.NONE).value(); + } + + /** + * Clears a range of bytes to specific of a file in storage file service. Upload operations performs an in-place write on the specified file. + * + *

                Code Samples

                + * + *

                Clear the range starting from 1024 with length of 1024.

                + * + * {@codesnippet com.azure.storage.file.fileClient.clearRangeWithResponse#long-long-Context} + * + *

                For more information, see the + * Azure Docs.

                + * + * @param length Specifies the number of bytes being transmitted in the request body. + * @param offset Optional starting point of the upload range. It will start from the beginning if it is {@code null} + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link FileUploadInfo file upload info} with headers and response status code + */ + public Response clearRangeWithResponse(long length, long offset, Context context) { + return fileAsyncClient.clearRangeWithResponse(length, offset, context).block(); } /** @@ -381,9 +558,9 @@ public void uploadFromFile(String uploadFilePath) { * *

                Code Samples

                * - *

                Upload the file from the source file path.

                + *

                Upload the file from the source file path.

                * - * {@codesnippet com.azure.storage.file.fileClient.uploadFromFile#string-filerangewritetype} + * {@codesnippet com.azure.storage.file.fileClient.uploadFromFile#string} * *

                For more information, see the * Azure Docs Create File @@ -391,14 +568,9 @@ public void uploadFromFile(String uploadFilePath) { * Azure Docs Upload.

                * * @param uploadFilePath The path where store the source file to upload - * @param type You may specify one of the following options: - *
                  - *
                • Update: Writes the bytes specified by the request body into the specified range.
                • - *
                • Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero.
                • - *
                    */ - public void uploadFromFile(String uploadFilePath, FileRangeWriteType type) { - fileAsyncClient.uploadFromFile(uploadFilePath, type).block(); + public void uploadFromFile(String uploadFilePath) { + fileAsyncClient.uploadFromFile(uploadFilePath).block(); } /** @@ -477,8 +649,6 @@ public Iterable listHandles(Integer maxResults) { /** * Closes a handle or handles opened on a file at the service. It is intended to be used alongside {@link FileClient#listHandles()} (Integer)} . - * TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. - * TODO: @see Github Issue 4525 * *

                    Code Samples

                    * @@ -493,6 +663,8 @@ public Iterable listHandles(Integer maxResults) { * @return The counts of number of handles closed */ public Iterable forceCloseHandles(String handleId) { + // TODO: Will change the return type to how many handles have been closed. Implement one more API to force close all handles. + // TODO: @see Github Issue 4525 return fileAsyncClient.forceCloseHandles(handleId).toIterable(); } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClientBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClientBuilder.java index 24ae291a5048..3cc47d07b076 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClientBuilder.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClientBuilder.java @@ -13,9 +13,11 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -71,8 +73,11 @@ * @see SASTokenCredential * @see SharedKeyCredential */ +@ServiceClientBuilder(serviceClients = {FileClient.class, FileAsyncClient.class}) public class FileClientBuilder { private static final String ACCOUNT_NAME = "accountname"; + + private final ClientLogger logger = new ClientLogger(FileClientBuilder.class); private final List policies; private final RetryPolicy retryPolicy; @@ -122,7 +127,7 @@ public FileAsyncClient buildAsyncClient() { } if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); + throw logger.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); } // Closest to API goes first, closest to wire goes last. @@ -204,7 +209,7 @@ public FileClientBuilder endpoint(String endpoint) { this.sharedKeyCredential = null; } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage File endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage File endpoint url is malformed.")); } return this; @@ -260,8 +265,8 @@ private void getEndPointFromConnectionString(String connectionString) { try { this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " - + "Connection String: %s", connectionString)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format("There is no valid endpoint for" + + " the connection string. Connection String: %s", connectionString))); } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java index e545c18965a5..5dbfd71773b7 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java @@ -7,8 +7,10 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.implementation.AzureFileStorageBuilder; @@ -31,6 +33,8 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import static com.azure.core.implementation.util.FluxUtil.withContext; + /** * This class provides a azureFileStorageClient that contains all the operations for interacting with a file account in Azure Storage. * Operations allowed by the azureFileStorageClient are creating, listing, and deleting shares and retrieving and updating properties @@ -48,6 +52,7 @@ * @see SASTokenCredential */ public final class FileServiceAsyncClient { + private final ClientLogger logger = new ClientLogger(FileServiceAsyncClient.class); private final AzureFileStorageImpl azureFileStorageClient; /** @@ -72,8 +77,8 @@ public URL getFileServiceUrl() { try { return new URL(azureFileStorageClient.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), - azureFileStorageClient.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), + azureFileStorageClient.getUrl()), e)); } } @@ -205,13 +210,70 @@ private Publisher extractAndFetchShares(ServicesListSharesSegmentResp *

                    For more information, see the * Azure Docs.

                    * - * @return Storage account File service properties + * @return Storage account {@link FileServiceProperties File service properties} */ - public Mono> getProperties() { - return azureFileStorageClient.services().getPropertiesWithRestResponseAsync(Context.NONE) + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves the properties of the storage account's File service. The properties range from storage analytics and + * metrics to CORS (Cross-Origin Resource Sharing). + * + *

                    Code Samples

                    + * + *

                    Retrieve File service properties

                    + * + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.getPropertiesWithResponse} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @return A response containing the Storage account {@link FileServiceProperties File service properties} + */ + public Mono> getPropertiesWithResponse() { + return withContext(context -> getPropertiesWithResponse(context)); + } + + Mono> getPropertiesWithResponse(Context context) { + return azureFileStorageClient.services().getPropertiesWithRestResponseAsync(context) .map(response -> new SimpleResponse<>(response, response.value())); } + /** + * Sets the properties for the storage account's File service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + * To maintain the CORS in the Queue service pass a {@code null} value for {@link FileServiceProperties#cors() CORS}. + * To disable all CORS in the Queue service pass an empty list for {@link FileServiceProperties#cors() CORS}. + * + *

                    Code Sample

                    + * + *

                    Enable Minute and Hour Metrics

                    + * + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties} + * + *

                    For more information, see the + * Azure Docs.

                    + * + * @param properties Storage account File service properties + * @return An empty response + * @throws StorageErrorException When one of the following is true + *
                      + *
                    • A CORS rule is missing one of its fields
                    • + *
                    • More than five CORS rules will exist for the Queue service
                    • + *
                    • Size of all CORS rules exceeds 2KB
                    • + *
                    • + * Length of {@link CorsRule#allowedHeaders() allowed headers}, {@link CorsRule#exposedHeaders() exposed headers}, + * or {@link CorsRule#allowedOrigins() allowed origins} exceeds 256 characters. + *
                    • + *
                    • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
                    • + *
                    + */ + public Mono setProperties(FileServiceProperties properties) { + return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); + } + /** * Sets the properties for the storage account's File service. The properties range from storage analytics and * metric to CORS (Cross-Origin Resource Sharing). @@ -223,11 +285,11 @@ public Mono> getProperties() { * *

                    Clear CORS in the File service

                    * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties.clearCORS} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponse#fileServiceProperties.clearCORS} * *

                    Enable Minute and Hour Metrics

                    * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponseAsync#fileServiceProperties} * *

                    For more information, see the * Azure Docs.

                    @@ -246,8 +308,12 @@ public Mono> getProperties() { *
                  • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
                  • *
                  */ - public Mono setProperties(FileServiceProperties properties) { - return azureFileStorageClient.services().setPropertiesWithRestResponseAsync(properties, Context.NONE) + public Mono setPropertiesWithResponse(FileServiceProperties properties) { + return withContext(context -> setPropertiesWithResponse(properties, context)); + } + + Mono setPropertiesWithResponse(FileServiceProperties properties, Context context) { + return azureFileStorageClient.services().setPropertiesWithRestResponseAsync(properties, context) .map(VoidResponse::new); } @@ -264,11 +330,11 @@ public Mono setProperties(FileServiceProperties properties) { * Azure Docs.

                  * * @param shareName Name of the share - * @return A response containing the ShareAsyncClient and the status of creating the share. + * @return The {@link ShareAsyncClient ShareAsyncClient} * @throws StorageErrorException If a share with the same name already exists */ - public Mono> createShare(String shareName) { - return createShare(shareName, null, null); + public Mono createShare(String shareName) { + return createShareWithResponse(shareName, null, null).flatMap(FluxUtil::toMono); } /** @@ -279,11 +345,11 @@ public Mono> createShare(String shareName) { * *

                  Create the share "test" with metadata "share:metadata"

                  * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.metadata} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.metadata} * *

                  Create the share "test" with a quota of 10 GB

                  * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.quota} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.quota} * *

                  For more information, see the * Azure Docs.

                  @@ -292,14 +358,18 @@ public Mono> createShare(String shareName) { * @param metadata Optional metadata to associate with the share * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and * less than or equal to 5120. The default value is 5120. - * @return A response containing the ShareAsyncClient and the status of creating the share. + * @return A response containing the {@link ShareAsyncClient ShareAsyncClient} and the status of creating the share. * @throws StorageErrorException If a share with the same name already exists or {@code quotaInGB} is outside the * allowed range. */ - public Mono> createShare(String shareName, Map metadata, Integer quotaInGB) { + public Mono> createShareWithResponse(String shareName, Map metadata, Integer quotaInGB) { + return withContext(context -> createShareWithResponse(shareName, metadata, quotaInGB, context)); + } + + Mono> createShareWithResponse(String shareName, Map metadata, Integer quotaInGB, Context context) { ShareAsyncClient shareAsyncClient = new ShareAsyncClient(azureFileStorageClient, shareName); - return shareAsyncClient.create(metadata, quotaInGB) + return shareAsyncClient.createWithResponse(metadata, quotaInGB, context) .map(response -> new SimpleResponse<>(response, shareAsyncClient)); } @@ -316,11 +386,11 @@ public Mono> createShare(String shareName, MapAzure Docs.

                  * * @param shareName Name of the share - * @return A response that only contains headers and response status code + * @return An empty response * @throws StorageErrorException If the share doesn't exist */ - public Mono deleteShare(String shareName) { - return deleteShare(shareName, null); + public Mono deleteShare(String shareName) { + return deleteShareWithResponse(shareName, null).flatMap(FluxUtil::toMono); } /** @@ -331,7 +401,7 @@ public Mono deleteShare(String shareName) { * *

                  Delete the snapshot of share "test" that was created at current time.

                  * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.deleteShare#string-string} + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.deleteShareWithResponse#string-string} * *

                  For more information, see the * Azure Docs.

                  @@ -341,12 +411,16 @@ public Mono deleteShare(String shareName) { * @return A response that only contains headers and response status code * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist */ - public Mono deleteShare(String shareName, String snapshot) { + public Mono deleteShareWithResponse(String shareName, String snapshot) { + return withContext(context -> deleteShareWithResponse(shareName, snapshot, context)); + } + + Mono deleteShareWithResponse(String shareName, String snapshot, Context context) { DeleteSnapshotsOptionType deleteSnapshots = null; if (ImplUtils.isNullOrEmpty(snapshot)) { deleteSnapshots = DeleteSnapshotsOptionType.fromString(DeleteSnapshotsOptionType.INCLUDE.toString()); } - return azureFileStorageClient.shares().deleteWithRestResponseAsync(shareName, snapshot, null, deleteSnapshots, Context.NONE) + return azureFileStorageClient.shares().deleteWithRestResponseAsync(shareName, snapshot, null, deleteSnapshots, context) .map(VoidResponse::new); } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java index f1603d94c448..9b3b0dbb8782 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java @@ -6,6 +6,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.CorsRule; @@ -13,6 +14,7 @@ import com.azure.storage.file.models.ListSharesOptions; import com.azure.storage.file.models.ShareItem; import com.azure.storage.file.models.StorageErrorException; + import java.net.URL; import java.util.Map; @@ -129,10 +131,30 @@ public Iterable listShares(ListSharesOptions options) { *

                  For more information, see the * Azure Docs.

                  * - * @return Storage account File service properties + * @return Storage account {@link FileServiceProperties File service properties} + */ + public FileServiceProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * Retrieves the properties of the storage account's File service. The properties range from storage analytics and + * metrics to CORS (Cross-Origin Resource Sharing). + * + *

                  Code Samples

                  + * + *

                  Retrieve File service properties

                  + * + * {@codesnippet com.azure.storage.file.fileServiceClient.getPropertiesWithResponse#Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the Storage account {@link FileServiceProperties File service properties} with headers and response status code */ - public Response getProperties() { - return fileServiceAsyncClient.getProperties().block(); + public Response getPropertiesWithResponse(Context context) { + return fileServiceAsyncClient.getPropertiesWithResponse(context).block(); } /** @@ -146,7 +168,7 @@ public Response getProperties() { * *

                  Clear CORS in the File service

                  * - * {@codesnippet com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties.clearCORS} + * {@codesnippet com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context.clearCORS} * *

                  Enable Minute and Hour Metrics

                  * @@ -156,6 +178,44 @@ public Response getProperties() { * Azure Docs.

                  * * @param properties Storage account File service properties + * @throws StorageErrorException When one of the following is true + *
                    + *
                  • A CORS rule is missing one of its fields
                  • + *
                  • More than five CORS rules will exist for the Queue service
                  • + *
                  • Size of all CORS rules exceeds 2KB
                  • + *
                  • + * Length of {@link CorsRule#allowedHeaders() allowed headers}, {@link CorsRule#exposedHeaders() exposed headers}, + * or {@link CorsRule#allowedOrigins() allowed origins} exceeds 256 characters. + *
                  • + *
                  • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
                  • + *
                  + */ + public void setProperties(FileServiceProperties properties) { + setPropertiesWithResponse(properties, Context.NONE); + } + + /** + * Sets the properties for the storage account's File service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + * To maintain the CORS in the Queue service pass a {@code null} value for {@link FileServiceProperties#cors() CORS}. + * To disable all CORS in the Queue service pass an empty list for {@link FileServiceProperties#cors() CORS}. + * + *

                  Code Sample

                  + * + *

                  Clear CORS in the File service

                  + * + * {@codesnippet com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context.clearCORS} + * + *

                  Enable Minute and Hour Metrics

                  + * + * {@codesnippet com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param properties Storage account File service properties + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException When one of the following is true *
                    @@ -169,8 +229,8 @@ public Response getProperties() { *
                  • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
                  • *
                  */ - public VoidResponse setProperties(FileServiceProperties properties) { - return fileServiceAsyncClient.setProperties(properties).block(); + public VoidResponse setPropertiesWithResponse(FileServiceProperties properties, Context context) { + return fileServiceAsyncClient.setPropertiesWithResponse(properties, context).block(); } /** @@ -186,11 +246,11 @@ public VoidResponse setProperties(FileServiceProperties properties) { * Azure Docs.

                  * * @param shareName Name of the share - * @return A response containing the ShareClient and the status of creating the share. + * @return The {@link ShareClient ShareClient} * @throws StorageErrorException If a share with the same name already exists */ - public Response createShare(String shareName) { - return createShare(shareName, null, null); + public ShareClient createShare(String shareName) { + return createShareWithResponse(shareName, null, null, Context.NONE).value(); } /** @@ -199,13 +259,9 @@ public Response createShare(String shareName) { * *

                  Code Samples

                  * - *

                  Create the share "test" with metadata "share:metadata"

                  - * - * {@codesnippet com.azure.storage.file.fileServiceClient.createShare#string-map-integer.metadata} - * *

                  Create the share "test" with a quota of 10 GB

                  * - * {@codesnippet com.azure.storage.file.fileServiceClient.createShare#string-map-integer.quota} + * {@codesnippet com.azure.storage.file.FileServiceClient.createShareWithResponse#String-Map-Integer-Context} * *

                  For more information, see the * Azure Docs.

                  @@ -214,13 +270,14 @@ public Response createShare(String shareName) { * @param metadata Optional metadata to associate with the share * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and * less than or equal to 5120. The default value is 5120. - * @return A response containing the ShareClient and the status of creating the share. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link ShareClient ShareClient} and the status of creating the share. * @throws StorageErrorException If a share with the same name already exists or {@code quotaInGB} is outside the * allowed range. */ - public Response createShare(String shareName, Map metadata, Integer quotaInGB) { + public Response createShareWithResponse(String shareName, Map metadata, Integer quotaInGB, Context context) { ShareClient shareClient = getShareClient(shareName); - return new SimpleResponse<>(shareClient.create(metadata, quotaInGB), shareClient); + return new SimpleResponse<>(shareClient.createWithResponse(metadata, quotaInGB, context), shareClient); } /** @@ -236,11 +293,10 @@ public Response createShare(String shareName, Map m * Azure Docs.

                  * * @param shareName Name of the share - * @return A response that only contains headers and response status code * @throws StorageErrorException If the share doesn't exist */ - public VoidResponse deleteShare(String shareName) { - return deleteShare(shareName, null); + public void deleteShare(String shareName) { + deleteShareWithResponse(shareName, null, Context.NONE); } /** @@ -251,17 +307,18 @@ public VoidResponse deleteShare(String shareName) { * *

                  Delete the snapshot of share "test" that was created at current time.

                  * - * {@codesnippet com.azure.storage.file.fileServiceClient.deleteShare#string-string} + * {@codesnippet com.azure.storage.file.fileServiceClient.deleteShareWithResponse#string-string-Context} * *

                  For more information, see the * Azure Docs.

                  * * @param shareName Name of the share * @param snapshot Identifier of the snapshot + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist */ - public VoidResponse deleteShare(String shareName, String snapshot) { - return fileServiceAsyncClient.deleteShare(shareName, snapshot).block(); + public VoidResponse deleteShareWithResponse(String shareName, String snapshot, Context context) { + return fileServiceAsyncClient.deleteShareWithResponse(shareName, snapshot, context).block(); } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java index a5563ba704c3..e6676528be8d 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java @@ -13,9 +13,11 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -70,7 +72,9 @@ * @see SASTokenCredential * @see SharedKeyCredential */ +@ServiceClientBuilder(serviceClients = {FileServiceClient.class, FileServiceAsyncClient.class}) public final class FileServiceClientBuilder { + private final ClientLogger logger = new ClientLogger(FileServiceClientBuilder.class); private static final String ACCOUNT_NAME = "accountname"; private final List policies; @@ -80,7 +84,7 @@ public final class FileServiceClientBuilder { private HttpClient httpClient; private HttpPipeline pipeline; private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -113,7 +117,7 @@ public FileServiceAsyncClient buildAsyncClient() { } if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); + throw logger.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); } // Closest to API goes first, closest to wire goes last. @@ -184,7 +188,7 @@ public FileServiceClientBuilder endpoint(String endpoint) { this.sharedKeyCredential = null; } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed.")); } return this; @@ -241,8 +245,8 @@ private void getEndPointFromConnectionString(String connectionString) { try { this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " - + "Connection String: %s", connectionString)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format("There is no valid endpoint for" + + " the connection string. Connection String: %s", connectionString))); } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java index 7d7b059f55cf..da746cd44ddc 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java @@ -8,7 +8,9 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.implementation.AzureFileStorageBuilder; @@ -30,9 +32,12 @@ import java.time.OffsetDateTime; import java.util.List; import java.util.Map; +import java.util.Objects; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import static com.azure.core.implementation.util.FluxUtil.withContext; + /** * This class provides a azureFileStorageClient that contains all the operations for interacting with a share in Azure Storage Share. * Operations allowed by the azureFileStorageClient are creating and deleting the share, creating snapshots for the share, creating and @@ -50,6 +55,8 @@ * @see SASTokenCredential */ public class ShareAsyncClient { + private final ClientLogger logger = new ClientLogger(ShareAsyncClient.class); + private final AzureFileStorageImpl azureFileStorageClient; private final String shareName; private final String snapshot; @@ -62,6 +69,7 @@ public class ShareAsyncClient { * @param shareName Name of the share */ ShareAsyncClient(AzureFileStorageImpl client, String shareName) { + Objects.requireNonNull(shareName); this.shareName = shareName; this.snapshot = null; @@ -78,6 +86,7 @@ public class ShareAsyncClient { * @param snapshot Optional specific snapshot of the share */ ShareAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String snapshot) { + Objects.requireNonNull(shareName); this.shareName = shareName; this.snapshot = snapshot; @@ -95,8 +104,8 @@ public URL getShareUrl() { try { return new URL(azureFileStorageClient.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), - azureFileStorageClient.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), + azureFileStorageClient.getUrl()), e)); } } @@ -104,7 +113,7 @@ public URL getShareUrl() { /** * Constructs a {@link DirectoryAsyncClient} that interacts with the root directory in the share. * - *

                  If the directory doesn't exist in the share {@link DirectoryAsyncClient#create(Map) create} in the azureFileStorageClient will + *

                  If the directory doesn't exist in the share {@link DirectoryAsyncClient#create()} in the azureFileStorageClient will * need to be called before interaction with the directory can happen.

                  * * @return a {@link DirectoryAsyncClient} that interacts with the root directory in the share @@ -116,7 +125,7 @@ public DirectoryAsyncClient getRootDirectoryClient() { /** * Constructs a {@link DirectoryAsyncClient} that interacts with the specified directory. * - *

                  If the directory doesn't exist in the share {@link DirectoryAsyncClient#create(Map) create} in the azureFileStorageClient will + *

                  If the directory doesn't exist in the share {@link DirectoryAsyncClient#create() create} in the azureFileStorageClient will * need to be called before interaction with the directory can happen.

                  * * @param directoryName Name of the directory @@ -151,11 +160,11 @@ public FileAsyncClient getFileClient(String filePath) { *

                  For more information, see the * Azure Docs.

                  * - * @return A response containing information about the share and the status its creation. + * @return The information about the {@link ShareInfo share} * @throws StorageErrorException If the share already exists with different metadata */ - public Mono> create() { - return create(null, null); + public Mono create() { + return createWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -165,11 +174,11 @@ public Mono> create() { * *

                  Create the share with metadata "share:metadata"

                  * - * {@codesnippet com.azure.storage.file.shareAsyncClient.create#map-integer.metadata} + * {@codesnippet com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.metadata} * *

                  Create the share with a quota of 10 GB

                  * - * {@codesnippet com.azure.storage.file.shareAsyncClient.create#map-integer.quota} + * {@codesnippet com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.quota} * *

                  For more information, see the * Azure Docs.

                  @@ -177,12 +186,16 @@ public Mono> create() { * @param metadata Optional metadata to associate with the share * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and * less than or equal to 5120. The default value is 5120. - * @return A response containing information about the share and the status its creation. + * @return A response containing information about the {@link ShareInfo share} and the status its creation. * @throws StorageErrorException If the share already exists with different metadata or {@code quotaInGB} is outside the * allowed range. */ - public Mono> create(Map metadata, Integer quotaInGB) { - return azureFileStorageClient.shares().createWithRestResponseAsync(shareName, null, metadata, quotaInGB, Context.NONE) + public Mono> createWithResponse(Map metadata, Integer quotaInGB) { + return withContext(context -> createWithResponse(metadata, quotaInGB, context)); + } + + Mono> createWithResponse(Map metadata, Integer quotaInGB, Context context) { + return azureFileStorageClient.shares().createWithRestResponseAsync(shareName, null, metadata, quotaInGB, context) .map(this::mapToShareInfoResponse); } @@ -198,12 +211,12 @@ public Mono> create(Map metadata, Integer qu *

                  For more information, see the * Azure Docs.

                  * - * @return A response containing information about the snapshot of share. + * @return The information about the {@link ShareSnapshotInfo snapshot of share}. * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is * in progress for the share */ - public Mono> createSnapshot() { - return createSnapshot(null); + public Mono createSnapshot() { + return createSnapshotWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -213,19 +226,23 @@ public Mono> createSnapshot() { * *

                  Create a snapshot with metadata "snapshot:metadata"

                  * - * {@codesnippet com.azure.storage.file.shareAsyncClient.createSnapshot#map} + * {@codesnippet com.azure.storage.file.shareAsyncClient.createSnapshotWithResponse#map} * *

                  For more information, see the * Azure Docs.

                  * * @param metadata Optional metadata to associate with the snapshot. If {@code null} the metadata of the share * will be copied to the snapshot. - * @return A response containing information about the snapshot of share. + * @return A response containing information about the {@link ShareSnapshotInfo snapshot of share}. * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is * in progress for the share */ - public Mono> createSnapshot(Map metadata) { - return azureFileStorageClient.shares().createSnapshotWithRestResponseAsync(shareName, null, metadata, Context.NONE) + public Mono> createSnapshotWithResponse(Map metadata) { + return withContext(context -> createSnapshotWithResponse(metadata, context)); + } + + Mono> createSnapshotWithResponse(Map metadata, Context context) { + return azureFileStorageClient.shares().createSnapshotWithRestResponseAsync(shareName, null, metadata, context) .map(this::mapCreateSnapshotResponse); } @@ -241,11 +258,34 @@ public Mono> createSnapshot(Map meta *

                  For more information, see the * Azure Docs.

                  * + * @return An empty response + * @throws StorageErrorException If the share doesn't exist + */ + public Mono delete() { + return deleteWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Deletes the share in the storage account + * + *

                  Code Samples

                  + * + *

                  Delete the share

                  + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.deleteWithResponse} + * + *

                  For more information, see the + * Azure Docs.

                  + * * @return A response that only contains headers and response status code * @throws StorageErrorException If the share doesn't exist */ - public Mono delete() { - return azureFileStorageClient.shares().deleteWithRestResponseAsync(shareName, snapshot, null, null, Context.NONE) + public Mono deleteWithResponse() { + return withContext(context -> deleteWithResponse(context)); + } + + Mono deleteWithResponse(Context context) { + return azureFileStorageClient.shares().deleteWithRestResponseAsync(shareName, snapshot, null, null, context) .map(VoidResponse::new); } @@ -262,11 +302,35 @@ public Mono delete() { *

                  For more information, see the * Azure Docs.

                  * - * @return the properties of the share + * @return The {@link ShareProperties properties of the share} * @throws StorageErrorException If the share doesn't exist */ - public Mono> getProperties() { - return azureFileStorageClient.shares().getPropertiesWithRestResponseAsync(shareName, snapshot, null, Context.NONE) + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves the properties of the share, these include the metadata associated to it and the quota that the share + * is restricted to. + * + *

                  Code Samples

                  + * + *

                  Retrieve the share properties

                  + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.getPropertiesWithResponse} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @return A response containing the {@link ShareProperties properties of the share} with headers and response status code + * @throws StorageErrorException If the share doesn't exist + */ + public Mono> getPropertiesWithResponse() { + return withContext(context -> getPropertiesWithResponse(context)); + } + + Mono> getPropertiesWithResponse(Context context) { + return azureFileStorageClient.shares().getPropertiesWithRestResponseAsync(shareName, snapshot, null, context) .map(this::mapGetPropertiesResponse); } @@ -277,17 +341,41 @@ public Mono> getProperties() { * *

                  Set the quota to 1024 GB

                  * - * {@codesnippet com.azure.storage.file.shareAsyncClient.setQuota} + * {@codesnippet com.azure.storage.file.ShareAsyncClient.setQuota#int} * *

                  For more information, see the * Azure Docs.

                  * * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. - * @return information about the share + * @return The {@link ShareInfo information about the share} * @throws StorageErrorException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds */ - public Mono> setQuota(int quotaInGB) { - return azureFileStorageClient.shares().setQuotaWithRestResponseAsync(shareName, null, quotaInGB, Context.NONE) + public Mono setQuota(int quotaInGB) { + return setQuotaWithResponse(quotaInGB).flatMap(FluxUtil::toMono); + } + + /** + * Sets the maximum size in GB that the share is allowed to grow. + * + *

                  Code Samples

                  + * + *

                  Set the quota to 1024 GB

                  + * + * {@codesnippet com.azure.storage.file.ShareAsyncClient.setQuotaWithResponse#int} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. + * @return A response containing the {@link ShareInfo information about the share} with headers and response status code + * @throws StorageErrorException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds + */ + public Mono> setQuotaWithResponse(int quotaInGB) { + return withContext(context -> setQuotaWithResponse(quotaInGB, context)); + } + + Mono> setQuotaWithResponse(int quotaInGB, Context context) { + return azureFileStorageClient.shares().setQuotaWithRestResponseAsync(shareName, null, quotaInGB, context) .map(this::mapToShareInfoResponse); } @@ -310,11 +398,41 @@ public Mono> setQuota(int quotaInGB) { * Azure Docs.

                  * * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared - * @return information about the share + * @return The {@link ShareInfo information about the share} * @throws StorageErrorException If the share doesn't exist or the metadata contains invalid keys */ - public Mono> setMetadata(Map metadata) { - return azureFileStorageClient.shares().setMetadataWithRestResponseAsync(shareName, null, metadata, Context.NONE) + public Mono setMetadata(Map metadata) { + return setMetadataWithResponse(metadata).flatMap(FluxUtil::toMono); + } + + /** + * Sets the user-defined metadata to associate to the share. + * + *

                  If {@code null} is passed for the metadata it will clear the metadata associated to the share.

                  + * + *

                  Code Samples

                  + * + *

                  Set the metadata to "share:updatedMetadata"

                  + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.setMetadata#map} + * + *

                  Clear the metadata of the share

                  + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.clearMetadata#map} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared + * @return A response containing the {@link ShareInfo information about the share} with headers and response status code + * @throws StorageErrorException If the share doesn't exist or the metadata contains invalid keys + */ + public Mono> setMetadataWithResponse(Map metadata) { + return withContext(context -> setMetadataWithResponse(metadata, context)); + } + + Mono> setMetadataWithResponse(Map metadata, Context context) { + return azureFileStorageClient.shares().setMetadataWithRestResponseAsync(shareName, null, metadata, context) .map(this::mapToShareInfoResponse); } @@ -345,18 +463,43 @@ public Flux getAccessPolicy() { * *

                  Set a read only stored access policy

                  * - * {@codesnippet com.azure.storage.file.shareAsyncClient.setAccessPolicy} + * {@codesnippet com.azure.storage.file.ShareAsyncClient.setAccessPolicy#List} * *

                  For more information, see the * Azure Docs.

                  * * @param permissions Access policies to set on the queue - * @return A response that only contains headers and response status code + * @return The {@link ShareInfo information about the share} * @throws StorageErrorException If the share doesn't exist, a stored access policy doesn't have all fields filled out, * or the share will have more than five policies. */ - public Mono> setAccessPolicy(List permissions) { - return azureFileStorageClient.shares().setAccessPolicyWithRestResponseAsync(shareName, permissions, null, Context.NONE) + public Mono setAccessPolicy(List permissions) { + return setAccessPolicyWithResponse(permissions).flatMap(FluxUtil::toMono); + } + + /** + * Sets stored access policies for the share. + * + *

                  Code Samples

                  + * + *

                  Set a read only stored access policy

                  + * + * {@codesnippet com.azure.storage.file.ShareAsyncClient.setAccessPolicyWithResponse#List} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @param permissions Access policies to set on the queue + * @return A response containing the {@link ShareInfo information about the share} with headers and response status code + * @throws StorageErrorException If the share doesn't exist, a stored access policy doesn't have all fields filled out, + * or the share will have more than five policies. + */ + public Mono> setAccessPolicyWithResponse(List permissions) { + return withContext(context -> setAccessPolicyWithResponse(permissions, context)); + } + + Mono> setAccessPolicyWithResponse(List permissions, Context context) { + return azureFileStorageClient.shares().setAccessPolicyWithRestResponseAsync(shareName, permissions, null, context) .map(this::mapToShareInfoResponse); } @@ -372,10 +515,32 @@ public Mono> setAccessPolicy(List permissi *

                  For more information, see the * Azure Docs.

                  * - * @return the storage statistics of the share + * @return The storage {@link ShareStatistics statistics of the share} */ - public Mono> getStatistics() { - return azureFileStorageClient.shares().getStatisticsWithRestResponseAsync(shareName, Context.NONE) + public Mono getStatistics() { + return getStatisticsWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves storage statistics about the share. + * + *

                  Code Samples

                  + * + *

                  Retrieve the storage statistics

                  + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.getStatisticsWithResponse} + * + *

                  For more information, see the + * Azure Docs.

                  + * + * @return A response containing the storage {@link ShareStatistics statistics of the share} with headers and response status code + */ + public Mono> getStatisticsWithResponse() { + return withContext(context -> getStatisticsWithResponse(context)); + } + + Mono> getStatisticsWithResponse(Context context) { + return azureFileStorageClient.shares().getStatisticsWithRestResponseAsync(shareName, context) .map(this::mapGetStatisticsResponse); } @@ -392,13 +557,12 @@ public Mono> getStatistics() { * Azure Docs.

                  * * @param directoryName Name of the directory - * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the - * status of its creation. + * @return The {@link DirectoryAsyncClient} to interact with the created directory. * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of * being deleted, or the parent directory for the new directory doesn't exist */ - public Mono> createDirectory(String directoryName) { - return createDirectory(directoryName, null); + public Mono createDirectory(String directoryName) { + return createDirectoryWithResponse(directoryName, null).flatMap(FluxUtil::toMono); } /** @@ -408,7 +572,7 @@ public Mono> createDirectory(String directoryName * *

                  Create the directory "documents" with metadata "directory:metadata"

                  * - * {@codesnippet com.azure.storage.file.shareAsyncClient.createDirectory#string-map} + * {@codesnippet com.azure.storage.file.shareAsyncClient.createDirectoryWithResponse#string-map} * *

                  For more information, see the * Azure Docs.

                  @@ -421,9 +585,13 @@ public Mono> createDirectory(String directoryName * being deleted, the parent directory for the new directory doesn't exist, or the metadata is using an illegal * key name */ - public Mono> createDirectory(String directoryName, Map metadata) { + public Mono> createDirectoryWithResponse(String directoryName, Map metadata) { + return withContext(context -> createDirectoryWithResponse(directoryName, metadata, context)); + } + + Mono> createDirectoryWithResponse(String directoryName, Map metadata, Context context) { DirectoryAsyncClient directoryAsyncClient = getDirectoryClient(directoryName); - return directoryAsyncClient.create(metadata).map(response -> new SimpleResponse<>(response, directoryAsyncClient)); + return directoryAsyncClient.createWithResponse(metadata).map(response -> new SimpleResponse<>(response, directoryAsyncClient)); } /** @@ -440,8 +608,7 @@ public Mono> createDirectory(String directoryName * * @param fileName Name of the file. * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @return A response containing a {@link FileAsyncClient} to interact with the created file and the - * status of its creation. + * @return The {@link FileAsyncClient} to interact with the created file. * @throws StorageErrorException If one of the following cases happen: *
                    *
                  • @@ -452,8 +619,8 @@ public Mono> createDirectory(String directoryName *
                  • *
                  */ - public Mono> createFile(String fileName, long maxSize) { - return createFile(fileName, maxSize, null, null); + public Mono createFile(String fileName, long maxSize) { + return createFileWithResponse(fileName, maxSize, null, null).flatMap(FluxUtil::toMono); } /** @@ -463,7 +630,7 @@ public Mono> createFile(String fileName, long maxSize) * *

                  Create the file "myfile" with length of 1024 bytes, some headers and metadata

                  * - * {@codesnippet com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map} + * {@codesnippet com.azure.storage.file.shareAsyncClient.createFileWithResponse#string-long-filehttpheaders-map} * *

                  For more information, see the * Azure Docs.

                  @@ -484,9 +651,33 @@ public Mono> createFile(String fileName, long maxSize) * *
                */ - public Mono> createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + public Mono> createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + return withContext(context -> createFileWithResponse(fileName, maxSize, httpHeaders, metadata, context)); + } + + Mono> createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata, Context context) { FileAsyncClient fileAsyncClient = getFileClient(fileName); - return fileAsyncClient.create(maxSize, httpHeaders, metadata).map(response -> new SimpleResponse<>(response, fileAsyncClient)); + return fileAsyncClient.createWithResponse(maxSize, httpHeaders, metadata, context).map(response -> new SimpleResponse<>(response, fileAsyncClient)); + } + + /** + * Deletes the specified directory in the share. + * + *

                Code Samples

                + * + *

                Delete the directory "mydirectory"

                + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.deleteDirectory#string} + * + *

                For more information, see the + * Azure Docs.

                + * + * @param directoryName Name of the directory + * @return An empty response + * @throws StorageErrorException If the share doesn't exist or the directory isn't empty + */ + public Mono deleteDirectory(String directoryName) { + return deleteDirectoryWithResponse(directoryName).flatMap(FluxUtil::toMono); } /** @@ -505,8 +696,32 @@ public Mono> createFile(String fileName, long maxSize, * @return A response that only contains headers and response status code * @throws StorageErrorException If the share doesn't exist or the directory isn't empty */ - public Mono deleteDirectory(String directoryName) { - return getDirectoryClient(directoryName).delete().map(VoidResponse::new); + public Mono deleteDirectoryWithResponse(String directoryName) { + return withContext(context -> deleteDirectoryWithResponse(directoryName, context)); + } + + Mono deleteDirectoryWithResponse(String directoryName, Context context) { + return getDirectoryClient(directoryName).deleteWithResponse(context).map(VoidResponse::new); + } + + /** + * Deletes the specified file in the share. + * + *

                Code Samples

                + * + *

                Delete the file "myfile"

                + * + * {@codesnippet com.azure.storage.file.shareAsyncClient.deleteFile#string} + * + *

                For more information, see the + * Azure Docs.

                + * + * @param fileName Name of the file. + * @return A empty response + * @throws StorageErrorException If the share or the file doesn't exist. + */ + public Mono deleteFile(String fileName) { + return deleteFileWithResponse(fileName).flatMap(FluxUtil::toMono); } /** @@ -525,8 +740,12 @@ public Mono deleteDirectory(String directoryName) { * @return A response that only contains headers and response status code * @throws StorageErrorException If the share or the file doesn't exist. */ - public Mono deleteFile(String fileName) { - return getFileClient(fileName).delete().map(VoidResponse::new); + public Mono deleteFileWithResponse(String fileName) { + return withContext(context -> deleteFileWithResponse(fileName, context)); + } + + Mono deleteFileWithResponse(String fileName, Context context) { + return getFileClient(fileName).deleteWithResponse(context).map(VoidResponse::new); } /** diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java index 476b9a2187c1..5c7156fe7061 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java @@ -6,6 +6,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.FileHTTPHeaders; @@ -54,7 +55,7 @@ public URL getShareUrl() { /** * Constructs a {@link DirectoryClient} that interacts with the root directory in the share. * - *

                If the directory doesn't exist in the share {@link DirectoryClient#create(Map) create} in the client will + *

                If the directory doesn't exist in the share {@link DirectoryClient#create() create} in the client will * need to be called before interaction with the directory can happen.

                * * @return a {@link DirectoryClient} that interacts with the root directory in the share @@ -66,7 +67,7 @@ public DirectoryClient getRootDirectoryClient() { /** * Constructs a {@link DirectoryClient} that interacts with the specified directory. * - *

                If the directory doesn't exist in the share {@link DirectoryClient#create(Map) create} in the client will + *

                If the directory doesn't exist in the share {@link DirectoryClient#create() create} in the client will * need to be called before interaction with the directory can happen.

                * * @param directoryName Name of the directory @@ -101,11 +102,11 @@ public FileClient getFileClient(String filePath) { *

                For more information, see the * Azure Docs.

                * - * @return A response containing information about the share and the status its creation. + * @return The {@link ShareInfo information about the share}. * @throws StorageErrorException If the share already exists with different metadata */ - public Response create() { - return create(null, null); + public ShareInfo create() { + return createWithResponse(null, null, Context.NONE).value(); } /** @@ -115,11 +116,11 @@ public Response create() { * *

                Create the share with metadata "share:metadata"

                * - * {@codesnippet com.azure.storage.file.shareClient.create#map-integer.metadata} + * {@codesnippet com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.metadata} * *

                Create the share with a quota of 10 GB

                * - * {@codesnippet com.azure.storage.file.shareClient.create#map-integer.quota} + * {@codesnippet com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.quota} * *

                For more information, see the * Azure Docs.

                @@ -127,12 +128,13 @@ public Response create() { * @param metadata Optional metadata to associate with the share * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and * less than or equal to 5120. The default value is 5120. - * @return A response containing information about the share and the status its creation. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link ShareInfo information about the share} and the status its creation. * @throws StorageErrorException If the share already exists with different metadata or {@code quotaInGB} is outside the * allowed range. */ - public Response create(Map metadata, Integer quotaInGB) { - return client.create(metadata, quotaInGB).block(); + public Response createWithResponse(Map metadata, Integer quotaInGB, Context context) { + return client.createWithResponse(metadata, quotaInGB, context).block(); } /** @@ -142,16 +144,17 @@ public Response create(Map metadata, Integer quotaInG * *

                Create a snapshot

                * + * {@codesnippet com.azure.storage.file.shareClient.createSnapshot} * *

                For more information, see the * Azure Docs.

                * - * @return A response containing information about the snapshot of share. + * @return The {@link ShareSnapshotInfo information about snapshot of share} * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is * in progress for the share */ - public Response createSnapshot() { - return createSnapshot(null); + public ShareSnapshotInfo createSnapshot() { + return createSnapshotWithResponse(null, Context.NONE).value(); } /** @@ -161,19 +164,20 @@ public Response createSnapshot() { * *

                Create a snapshot with metadata "snapshot:metadata"

                * - * {@codesnippet com.azure.storage.file.shareClient.createSnapshot#map} + * {@codesnippet com.azure.storage.file.shareClient.createSnapshotWithResponse#map-Context} * *

                For more information, see the * Azure Docs.

                * * @param metadata Optional metadata to associate with the snapshot. If {@code null} the metadata of the share * will be copied to the snapshot. - * @return A response containing information about the snapshot of share. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link ShareSnapshotInfo information about snapshot of the share} and status of creation. * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is * in progress for the share */ - public Response createSnapshot(Map metadata) { - return client.createSnapshot(metadata).block(); + public Response createSnapshotWithResponse(Map metadata, Context context) { + return client.createSnapshotWithResponse(metadata, context).block(); } /** @@ -188,11 +192,30 @@ public Response createSnapshot(Map metadata) *

                For more information, see the * Azure Docs.

                * + * @throws StorageErrorException If the share doesn't exist + */ + public void delete() { + deleteWithResponse(Context.NONE); + } + + /** + * Deletes the share in the storage account + * + *

                Code Samples

                + * + *

                Delete the share

                + * + * {@codesnippet com.azure.storage.file.shareClient.deleteWithResponse#Context} + * + *

                For more information, see the + * Azure Docs.

                + * + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException If the share doesn't exist */ - public VoidResponse delete() { - return client.delete().block(); + public VoidResponse deleteWithResponse(Context context) { + return client.deleteWithResponse(context).block(); } /** @@ -208,11 +231,32 @@ public VoidResponse delete() { *

                For more information, see the * Azure Docs.

                * - * @return the properties of the share + * @return The {@link ShareProperties properties of the share} + * @throws StorageErrorException If the share doesn't exist + */ + public ShareProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * Retrieves the properties of the share, these include the metadata associated to it and the quota that the share + * is restricted to. + * + *

                Code Samples

                + * + *

                Retrieve the share properties

                + * + * {@codesnippet com.azure.storage.file.shareClient.getPropertiesWithResponse#Context} + * + *

                For more information, see the + * Azure Docs.

                + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing {@link ShareProperties properties of the share} with response status code * @throws StorageErrorException If the share doesn't exist */ - public Response getProperties() { - return client.getProperties().block(); + public Response getPropertiesWithResponse(Context context) { + return client.getPropertiesWithResponse(context).block(); } /** @@ -222,17 +266,38 @@ public Response getProperties() { * *

                Set the quota to 1024 GB

                * - * {@codesnippet com.azure.storage.file.shareClient.setQuota} + * {@codesnippet com.azure.storage.file.ShareClient.setQuota#int} * *

                For more information, see the * Azure Docs.

                * * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. - * @return information about the share + * @return The {@link ShareProperties properties of the share} * @throws StorageErrorException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds */ - public Response setQuota(int quotaInGB) { - return client.setQuota(quotaInGB).block(); + public ShareInfo setQuota(int quotaInGB) { + return setQuotaWithResponse(quotaInGB, Context.NONE).value(); + } + + /** + * Sets the maximum size in GB that the share is allowed to grow. + * + *

                Code Samples

                + * + *

                Set the quota to 1024 GB

                + * + * {@codesnippet com.azure.storage.file.shareClient.setQuotaWithResponse#int-Context} + * + *

                For more information, see the + * Azure Docs.

                + * + * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing {@link ShareProperties properties of the share} with response status code + * @throws StorageErrorException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds + */ + public Response setQuotaWithResponse(int quotaInGB, Context context) { + return client.setQuotaWithResponse(quotaInGB, context).block(); } /** @@ -254,11 +319,34 @@ public Response setQuota(int quotaInGB) { * Azure Docs.

                * * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared - * @return information about the share + * @return The {@link ShareProperties properties of the share} * @throws StorageErrorException If the share doesn't exist or the metadata contains invalid keys */ - public Response setMetadata(Map metadata) { - return client.setMetadata(metadata).block(); + public ShareInfo setMetadata(Map metadata) { + return setMetadataWithResponse(metadata, Context.NONE).value(); + } + + /** + * Sets the user-defined metadata to associate to the share. + * + *

                If {@code null} is passed for the metadata it will clear the metadata associated to the share.

                + * + *

                Code Samples

                + * + *

                Set the metadata to "share:updatedMetadata"

                + * + * {@codesnippet com.azure.storage.file.shareClient.setMetadataWithResponse#map-Context} + * + *

                For more information, see the + * Azure Docs.

                + * + * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing {@link ShareProperties properties of the share} with response status code + * @throws StorageErrorException If the share doesn't exist or the metadata contains invalid keys + */ + public Response setMetadataWithResponse(Map metadata, Context context) { + return client.setMetadataWithResponse(metadata, context).block(); } /** @@ -287,18 +375,40 @@ public Iterable getAccessPolicy() { * *

                Set a read only stored access policy

                * - * {@codesnippet com.azure.storage.file.shareClient.setAccessPolicy} + * {@codesnippet com.azure.storage.file.ShareClient.setAccessPolicy#List} * *

                For more information, see the * Azure Docs.

                * * @param permissions Access policies to set on the queue - * @return A response that only contains headers and response status code + * @return The {@link ShareInfo information of the share} * @throws StorageErrorException If the share doesn't exist, a stored access policy doesn't have all fields filled out, * or the share will have more than five policies. */ - public Response setAccessPolicy(List permissions) { - return client.setAccessPolicy(permissions).block(); + public ShareInfo setAccessPolicy(List permissions) { + return setAccessPolicyWithResponse(permissions, Context.NONE).value(); + } + + /** + * Sets stored access policies for the share. + * + *

                Code Samples

                + * + *

                Set a read only stored access policy

                + * + * {@codesnippet com.azure.storage.file.shareClient.setAccessPolicyWithResponse#List-Context} + * + *

                For more information, see the + * Azure Docs.

                + * + * @param permissions Access policies to set on the queue + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link ShareInfo information of the share} with headers and response status code + * @throws StorageErrorException If the share doesn't exist, a stored access policy doesn't have all fields filled out, + * or the share will have more than five policies. + */ + public Response setAccessPolicyWithResponse(List permissions, Context context) { + return client.setAccessPolicyWithResponse(permissions, context).block(); } /** @@ -313,10 +423,29 @@ public Response setAccessPolicy(List permissions) { *

                For more information, see the * Azure Docs.

                * - * @return the storage statistics of the share + * @return The storage {@link ShareStatistics statistics of the share} */ - public Response getStatistics() { - return client.getStatistics().block(); + public ShareStatistics getStatistics() { + return getStatisticsWithResponse(Context.NONE).value(); + } + + /** + * Retrieves storage statistics about the share. + * + *

                Code Samples

                + * + *

                Retrieve the storage statistics

                + * + * {@codesnippet com.azure.storage.file.shareClient.getStatisticsWithResponse#Context} + * + *

                For more information, see the + * Azure Docs.

                + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link ShareStatistics statistics of the share} + */ + public Response getStatisticsWithResponse(Context context) { + return client.getStatisticsWithResponse(context).block(); } /** @@ -332,13 +461,12 @@ public Response getStatistics() { * Azure Docs.

                * * @param directoryName Name of the directory - * @return A response containing a {@link DirectoryClient} to interact with the created directory and the - * status of its creation. + * @return A response containing a {@link DirectoryClient} to interact with the created directory. * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of * being deleted, or the parent directory for the new directory doesn't exist */ - public Response createDirectory(String directoryName) { - return createDirectory(directoryName, null); + public DirectoryClient createDirectory(String directoryName) { + return createDirectoryWithResponse(directoryName, null, Context.NONE).value(); } /** @@ -348,22 +476,23 @@ public Response createDirectory(String directoryName) { * *

                Create the directory "documents" with metadata "directory:metadata"

                * - * {@codesnippet com.azure.storage.file.shareClient.createDirectory#string-map} + * {@codesnippet com.azure.storage.file.shareClient.createDirectoryWithResponse#string-map-Context} * *

                For more information, see the * Azure Docs.

                * * @param directoryName Name of the directory * @param metadata Optional metadata to associate with the directory + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the * status of its creation. * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of * being deleted, the parent directory for the new directory doesn't exist, or the metadata is using an illegal * key name */ - public Response createDirectory(String directoryName, Map metadata) { + public Response createDirectoryWithResponse(String directoryName, Map metadata, Context context) { DirectoryClient directoryClient = getDirectoryClient(directoryName); - return new SimpleResponse<>(directoryClient.create(metadata), directoryClient); + return new SimpleResponse<>(directoryClient.createWithResponse(metadata, context), directoryClient); } /** @@ -380,8 +509,7 @@ public Response createDirectory(String directoryName, Map *
              • @@ -392,8 +520,8 @@ public Response createDirectory(String directoryName, Map *
              */ - public Response createFile(String fileName, long maxSize) { - return createFile(fileName, maxSize, null, null); + public FileClient createFile(String fileName, long maxSize) { + return createFileWithResponse(fileName, maxSize, null, null, Context.NONE).value(); } /** @@ -403,7 +531,7 @@ public Response createFile(String fileName, long maxSize) { * *

              Create the file "myfile" with length of 1024 bytes, some headers and metadata

              * - * {@codesnippet com.azure.storage.file.shareClient.createFile#string-long-filehttpheaders-map} + * {@codesnippet com.azure.storage.file.shareClient.createFileWithResponse#string-long-filehttpheaders-map-Context} * *

              For more information, see the * Azure Docs.

              @@ -412,6 +540,7 @@ public Response createFile(String fileName, long maxSize) { * @param maxSize The maximum size in bytes for the file, up to 1 TiB. * @param httpHeaders Additional parameters for the operation. * @param metadata Optional metadata to associate with the file. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing a {@link FileClient} to interact with the created file and the * status of its creation. * @throws StorageErrorException If one of the following cases happen: @@ -424,9 +553,9 @@ public Response createFile(String fileName, long maxSize) { * *
            */ - public Response createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + public Response createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata, Context context) { FileClient fileClient = getFileClient(fileName); - return new SimpleResponse<>(fileClient.create(maxSize, httpHeaders, metadata), fileClient); + return new SimpleResponse<>(fileClient.createWithResponse(maxSize, httpHeaders, metadata, context), fileClient); } /** @@ -442,11 +571,32 @@ public Response createFile(String fileName, long maxSize, FileHTTPHe * Azure Docs.

            * * @param directoryName Name of the directory + * @throws StorageErrorException If the share doesn't exist or the directory isn't empty + */ + public void deleteDirectory(String directoryName) { + deleteDirectoryWithResponse(directoryName, Context.NONE); + } + + + /** + * Deletes the specified directory in the share. + * + *

            Code Samples

            + * + *

            Delete the directory "mydirectory"

            + * + * {@codesnippet com.azure.storage.file.shareClient.deleteDirectoryWithResponse#string-Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param directoryName Name of the directory + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException If the share doesn't exist or the directory isn't empty */ - public VoidResponse deleteDirectory(String directoryName) { - return client.deleteDirectory(directoryName).block(); + public VoidResponse deleteDirectoryWithResponse(String directoryName, Context context) { + return client.deleteDirectoryWithResponse(directoryName, context).block(); } /** @@ -462,11 +612,31 @@ public VoidResponse deleteDirectory(String directoryName) { * Azure Docs.

            * * @param fileName Name of the file + * @throws StorageErrorException If the share or the file doesn't exist. + */ + public void deleteFile(String fileName) { + deleteFileWithResponse(fileName, Context.NONE); + } + + /** + * Deletes the specified file in the share. + * + *

            Code Samples

            + * + *

            Delete the file "myfile"

            + * + * {@codesnippet com.azure.storage.file.shareClient.deleteFileWithResponse#string-Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param fileName Name of the file + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException If the share or the file doesn't exist. */ - public VoidResponse deleteFile(String fileName) { - return client.deleteFile(fileName).block(); + public VoidResponse deleteFileWithResponse(String fileName, Context context) { + return client.deleteFileWithResponse(fileName, context).block(); } /** diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClientBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClientBuilder.java index e175993d7579..7528ce318e73 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClientBuilder.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClientBuilder.java @@ -13,9 +13,11 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -70,7 +72,9 @@ * @see SASTokenCredential * @see SharedKeyCredential */ +@ServiceClientBuilder(serviceClients = {ShareClient.class, ShareAsyncClient.class}) public class ShareClientBuilder { + private final ClientLogger logger = new ClientLogger(ShareClientBuilder.class); private static final String ACCOUNT_NAME = "accountname"; private final List policies; @@ -82,7 +86,7 @@ public class ShareClientBuilder { private HttpClient httpClient; private HttpPipeline pipeline; private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -118,7 +122,7 @@ public ShareAsyncClient buildAsyncClient() { } if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); + throw logger.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); } // Closest to API goes first, closest to wire goes last. @@ -192,7 +196,7 @@ public ShareClientBuilder endpoint(String endpoint) { this.sharedKeyCredential = null; } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed.")); } return this; @@ -249,8 +253,8 @@ private void getEndPointFromConnectionString(String connectionString) { try { this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " - + "Connection String: %s", connectionString)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format("There is no valid endpoint for" + + " the connection string. Connection String: %s", connectionString))); } } @@ -272,10 +276,9 @@ public ShareClientBuilder shareName(String shareName) { * * @param snapshot Identifier of the snapshot * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code snapshot} is {@code null}. */ public ShareClientBuilder snapshot(String snapshot) { - this.snapshot = Objects.requireNonNull(snapshot); + this.snapshot = snapshot; return this; } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java index 39584a1738f9..b4c6646822aa 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java @@ -74,7 +74,7 @@ public AzureFileStorageImpl build() { if (this.version != null) { client.setVersion(this.version); } else { - client.setVersion("2018-11-09"); + client.setVersion("2019-02-02"); } if (this.url != null) { client.setUrl(this.url); diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java index 4d6953cdd9d0..d1f49570b6ff 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java @@ -26,6 +26,7 @@ import com.azure.storage.file.models.DirectorysListFilesAndDirectoriesSegmentResponse; import com.azure.storage.file.models.DirectorysListHandlesResponse; import com.azure.storage.file.models.DirectorysSetMetadataResponse; +import com.azure.storage.file.models.DirectorysSetPropertiesResponse; import com.azure.storage.file.models.StorageErrorException; import java.util.Map; import reactor.core.publisher.Mono; @@ -65,7 +66,7 @@ private interface DirectorysService { @Put("{shareName}/{directoryPath}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@PathParam("shareName") String shareName, @PathParam("directoryPath") String directoryPath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); + Mono create(@PathParam("shareName") String shareName, @PathParam("directoryPath") String directoryPath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-file-permission") String filePermission, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @HeaderParam("x-ms-file-attributes") String fileAttributes, @HeaderParam("x-ms-file-creation-time") String fileCreationTime, @HeaderParam("x-ms-file-last-write-time") String fileLastWriteTime, @QueryParam("restype") String restype, Context context); @Get("{shareName}/{directoryPath}") @ExpectedResponses({200}) @@ -77,6 +78,11 @@ private interface DirectorysService { @UnexpectedResponseExceptionType(StorageErrorException.class) Mono delete(@PathParam("shareName") String shareName, @PathParam("directoryPath") String directoryPath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); + @Put("{shareName}/{directoryPath}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono setProperties(@PathParam("shareName") String shareName, @PathParam("directoryPath") String directoryPath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-file-permission") String filePermission, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @HeaderParam("x-ms-file-attributes") String fileAttributes, @HeaderParam("x-ms-file-creation-time") String fileCreationTime, @HeaderParam("x-ms-file-last-write-time") String fileLastWriteTime, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + @Put("{shareName}/{directoryPath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) @@ -103,16 +109,21 @@ private interface DirectorysService { * * @param shareName The name of the target share. * @param directoryPath The path of the target directory. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createWithRestResponseAsync(String shareName, String directoryPath, Context context) { + public Mono createWithRestResponseAsync(String shareName, String directoryPath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Context context) { final Integer timeout = null; final Map metadata = null; + final String filePermission = null; + final String filePermissionKey = null; final String restype = "directory"; - return service.create(shareName, directoryPath, this.client.getUrl(), timeout, metadata, this.client.getVersion(), restype, context); + return service.create(shareName, directoryPath, this.client.getUrl(), timeout, metadata, this.client.getVersion(), filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, restype, context); } /** @@ -120,16 +131,21 @@ public Mono createWithRestResponseAsync(String shareNa * * @param shareName The name of the target share. * @param directoryPath The path of the target directory. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. + * @param filePermission If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param filePermissionKey Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createWithRestResponseAsync(String shareName, String directoryPath, Integer timeout, Map metadata, Context context) { + public Mono createWithRestResponseAsync(String shareName, String directoryPath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, Map metadata, String filePermission, String filePermissionKey, Context context) { final String restype = "directory"; - return service.create(shareName, directoryPath, this.client.getUrl(), timeout, metadata, this.client.getVersion(), restype, context); + return service.create(shareName, directoryPath, this.client.getUrl(), timeout, metadata, this.client.getVersion(), filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, restype, context); } /** @@ -198,6 +214,50 @@ public Mono deleteWithRestResponseAsync(String shareNa return service.delete(shareName, directoryPath, this.client.getUrl(), timeout, this.client.getVersion(), restype, context); } + /** + * Sets properties on the directory. + * + * @param shareName The name of the target share. + * @param directoryPath The path of the target directory. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setPropertiesWithRestResponseAsync(String shareName, String directoryPath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Context context) { + final Integer timeout = null; + final String filePermission = null; + final String filePermissionKey = null; + final String restype = "directory"; + final String comp = "properties"; + return service.setProperties(shareName, directoryPath, this.client.getUrl(), timeout, this.client.getVersion(), filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, restype, comp, context); + } + + /** + * Sets properties on the directory. + * + * @param shareName The name of the target share. + * @param directoryPath The path of the target directory. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. + * @param filePermission If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param filePermissionKey Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setPropertiesWithRestResponseAsync(String shareName, String directoryPath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, String filePermission, String filePermissionKey, Context context) { + final String restype = "directory"; + final String comp = "properties"; + return service.setProperties(shareName, directoryPath, this.client.getUrl(), timeout, this.client.getVersion(), filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, restype, comp, context); + } + /** * Updates user defined metadata for the specified directory. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java index 5a3ea58d911c..0b41902369f2 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java @@ -35,9 +35,11 @@ import com.azure.storage.file.models.FilesSetHTTPHeadersResponse; import com.azure.storage.file.models.FilesSetMetadataResponse; import com.azure.storage.file.models.FilesStartCopyResponse; +import com.azure.storage.file.models.FilesUploadRangeFromURLResponse; import com.azure.storage.file.models.FilesUploadRangeResponse; +import com.azure.storage.file.models.SourceModifiedAccessConditions; import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; +import java.nio.ByteBuffer; import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -77,7 +79,7 @@ private interface FilesService { @Put("{shareName}/{filePath}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") long fileContentLength, @HeaderParam("x-ms-type") String fileTypeConstant, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); + Mono create(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") long fileContentLength, @HeaderParam("x-ms-type") String fileTypeConstant, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-file-permission") String filePermission, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @HeaderParam("x-ms-file-attributes") String fileAttributes, @HeaderParam("x-ms-file-creation-time") String fileCreationTime, @HeaderParam("x-ms-file-last-write-time") String fileLastWriteTime, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); @Get("{shareName}/{filePath}") @ExpectedResponses({200, 206}) @@ -96,7 +98,7 @@ private interface FilesService { @Put("{shareName}/{filePath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setHTTPHeaders(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") Long fileContentLength, @QueryParam("comp") String comp, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); + Mono setHTTPHeaders(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") Long fileContentLength, @HeaderParam("x-ms-file-permission") String filePermission, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @HeaderParam("x-ms-file-attributes") String fileAttributes, @HeaderParam("x-ms-file-creation-time") String fileCreationTime, @HeaderParam("x-ms-file-last-write-time") String fileLastWriteTime, @QueryParam("comp") String comp, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); @Put("{shareName}/{filePath}") @ExpectedResponses({200}) @@ -106,7 +108,12 @@ private interface FilesService { @Put("{shareName}/{filePath}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono uploadRange(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux optionalbody, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-write") FileRangeWriteType fileRangeWrite, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String contentMD5, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + Mono uploadRange(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux optionalbody, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-write") FileRangeWriteType fileRangeWrite, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String contentMD5, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + + @Put("{shareName}/{filePath}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono uploadRangeFromURL(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-copy-source") String copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-write") String fileRangeWriteFromUrl, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-source-content-crc64") String sourceContentCrc64, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, @HeaderParam("x-ms-source-if-match-crc64") String sourceIfMatchCrc64, @HeaderParam("x-ms-source-if-none-match-crc64") String sourceIfNoneMatchCrc64, Context context); @Get("{shareName}/{filePath}") @ExpectedResponses({200}) @@ -140,22 +147,27 @@ private interface FilesService { * @param shareName The name of the target share. * @param filePath The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 1 TB. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, Context context) { + public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Context context) { final Integer timeout = null; final String fileTypeConstant = "file"; final Map metadata = null; + final String filePermission = null; + final String filePermissionKey = null; final String fileContentType = null; final String fileContentEncoding = null; final String fileContentLanguage = null; final String fileCacheControl = null; final String fileContentDisposition = null; String fileContentMD5Converted = null; - return service.create(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, metadata, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.create(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, metadata, filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** @@ -164,15 +176,20 @@ public Mono createWithRestResponseAsync(String shareName, S * @param shareName The name of the target share. * @param filePath The path of the target file. * @param fileContentLength Specifies the maximum size for the file, up to 1 TB. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. + * @param filePermission If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param filePermissionKey Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. * @param fileHTTPHeaders Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, Integer timeout, Map metadata, FileHTTPHeaders fileHTTPHeaders, Context context) { + public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, Map metadata, String filePermission, String filePermissionKey, FileHTTPHeaders fileHTTPHeaders, Context context) { final String fileTypeConstant = "file"; String fileContentType = null; if (fileHTTPHeaders != null) { @@ -199,7 +216,7 @@ public Mono createWithRestResponseAsync(String shareName, S fileContentDisposition = fileHTTPHeaders.fileContentDisposition(); } String fileContentMD5Converted = Base64Util.encodeToString(fileContentMD5); - return service.create(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, metadata, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.create(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, fileTypeConstant, metadata, filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** @@ -303,14 +320,19 @@ public Mono deleteWithRestResponseAsync(String shareName, S * * @param shareName The name of the target share. * @param filePath The path of the target file. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, Context context) { + public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Context context) { final Integer timeout = null; final Long fileContentLength = null; + final String filePermission = null; + final String filePermissionKey = null; final String comp = "properties"; final String fileContentType = null; final String fileContentEncoding = null; @@ -318,7 +340,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str final String fileCacheControl = null; final String fileContentDisposition = null; String fileContentMD5Converted = null; - return service.setHTTPHeaders(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.setHTTPHeaders(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** @@ -326,15 +348,20 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str * * @param shareName The name of the target share. * @param filePath The path of the target file. + * @param fileAttributes If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + * @param fileCreationTime Creation time for the file/directory. Default value: Now. + * @param fileLastWriteTime Last write time for the file/directory. Default value: Now. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param fileContentLength Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. + * @param filePermission If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param filePermissionKey Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. * @param fileHTTPHeaders Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, Integer timeout, Long fileContentLength, FileHTTPHeaders fileHTTPHeaders, Context context) { + public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, Long fileContentLength, String filePermission, String filePermissionKey, FileHTTPHeaders fileHTTPHeaders, Context context) { final String comp = "properties"; String fileContentType = null; if (fileHTTPHeaders != null) { @@ -361,7 +388,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str fileContentDisposition = fileHTTPHeaders.fileContentDisposition(); } String fileContentMD5Converted = Base64Util.encodeToString(fileContentMD5); - return service.setHTTPHeaders(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.setHTTPHeaders(shareName, filePath, this.client.getUrl(), timeout, this.client.getVersion(), fileContentLength, filePermission, filePermissionKey, fileAttributes, fileCreationTime, fileLastWriteTime, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** @@ -412,7 +439,7 @@ public Mono setMetadataWithRestResponseAsync(String sh */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono uploadRangeWithRestResponseAsync(String shareName, String filePath, String range, FileRangeWriteType fileRangeWrite, long contentLength, Context context) { - final Flux optionalbody = null; + final Flux optionalbody = null; final Integer timeout = null; final String comp = "range"; String contentMD5Converted = null; @@ -435,12 +462,70 @@ public Mono uploadRangeWithRestResponseAsync(String sh * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadRangeWithRestResponseAsync(String shareName, String filePath, String range, FileRangeWriteType fileRangeWrite, long contentLength, Flux optionalbody, Integer timeout, byte[] contentMD5, Context context) { + public Mono uploadRangeWithRestResponseAsync(String shareName, String filePath, String range, FileRangeWriteType fileRangeWrite, long contentLength, Flux optionalbody, Integer timeout, byte[] contentMD5, Context context) { final String comp = "range"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); return service.uploadRange(shareName, filePath, this.client.getUrl(), optionalbody, timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.getVersion(), comp, context); } + /** + * Upload a range of bytes to a file where the contents are read from a URL. + * + * @param shareName The name of the target share. + * @param filePath The path of the target file. + * @param range Writes data to the specified byte range in the file. + * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source. + * @param contentLength Specifies the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of this header must be set to zero. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uploadRangeFromURLWithRestResponseAsync(String shareName, String filePath, String range, String copySource, long contentLength, Context context) { + final Integer timeout = null; + final String sourceRange = null; + final String fileRangeWriteFromUrl = "update"; + final String comp = "range"; + String sourceContentCrc64Converted = null; + String sourceIfMatchCrc64Converted = null; + String sourceIfNoneMatchCrc64Converted = null; + return service.uploadRangeFromURL(shareName, filePath, this.client.getUrl(), timeout, range, copySource, sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, this.client.getVersion(), comp, sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, context); + } + + /** + * Upload a range of bytes to a file where the contents are read from a URL. + * + * @param shareName The name of the target share. + * @param filePath The path of the target file. + * @param range Writes data to the specified byte range in the file. + * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source. + * @param contentLength Specifies the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of this header must be set to zero. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. + * @param sourceRange Bytes of source data in the specified range. + * @param sourceContentCrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy source. + * @param sourceModifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uploadRangeFromURLWithRestResponseAsync(String shareName, String filePath, String range, String copySource, long contentLength, Integer timeout, String sourceRange, byte[] sourceContentCrc64, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + final String fileRangeWriteFromUrl = "update"; + final String comp = "range"; + byte[] sourceIfMatchCrc64 = null; + if (sourceModifiedAccessConditions != null) { + sourceIfMatchCrc64 = sourceModifiedAccessConditions.sourceIfMatchCrc64(); + } + byte[] sourceIfNoneMatchCrc64 = null; + if (sourceModifiedAccessConditions != null) { + sourceIfNoneMatchCrc64 = sourceModifiedAccessConditions.sourceIfNoneMatchCrc64(); + } + String sourceContentCrc64Converted = Base64Util.encodeToString(sourceContentCrc64); + String sourceIfMatchCrc64Converted = Base64Util.encodeToString(sourceIfMatchCrc64); + String sourceIfNoneMatchCrc64Converted = Base64Util.encodeToString(sourceIfNoneMatchCrc64); + return service.uploadRangeFromURL(shareName, filePath, this.client.getUrl(), timeout, range, copySource, sourceRange, fileRangeWriteFromUrl, contentLength, sourceContentCrc64Converted, this.client.getVersion(), comp, sourceIfMatchCrc64Converted, sourceIfNoneMatchCrc64Converted, context); + } + /** * Returns the list of valid ranges for a file. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java index d847d3ecd9ff..1dbbddddede2 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java @@ -21,10 +21,12 @@ import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; import com.azure.core.util.Context; import com.azure.storage.file.models.DeleteSnapshotsOptionType; +import com.azure.storage.file.models.SharesCreatePermissionResponse; import com.azure.storage.file.models.SharesCreateResponse; import com.azure.storage.file.models.SharesCreateSnapshotResponse; import com.azure.storage.file.models.SharesDeleteResponse; import com.azure.storage.file.models.SharesGetAccessPolicyResponse; +import com.azure.storage.file.models.SharesGetPermissionResponse; import com.azure.storage.file.models.SharesGetPropertiesResponse; import com.azure.storage.file.models.SharesGetStatisticsResponse; import com.azure.storage.file.models.SharesSetAccessPolicyResponse; @@ -88,6 +90,16 @@ private interface SharesService { @UnexpectedResponseExceptionType(StorageErrorException.class) Mono createSnapshot(@PathParam("shareName") String shareName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + @Put("{shareName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono createPermission(@PathParam("shareName") String shareName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + + @Get("{shareName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono getPermission(@HostParam("url") String url, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + @Put("{shareName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) @@ -248,6 +260,70 @@ public Mono createSnapshotWithRestResponseAsync(St return service.createSnapshot(shareName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), restype, comp, context); } + /** + * Create a permission (a security descriptor). + * + * @param shareName The name of the target share. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createPermissionWithRestResponseAsync(String shareName, Context context) { + final Integer timeout = null; + final String restype = "share"; + final String comp = "filepermission"; + return service.createPermission(shareName, this.client.getUrl(), timeout, this.client.getVersion(), restype, comp, context); + } + + /** + * Create a permission (a security descriptor). + * + * @param shareName The name of the target share. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createPermissionWithRestResponseAsync(String shareName, Integer timeout, Context context) { + final String restype = "share"; + final String comp = "filepermission"; + return service.createPermission(shareName, this.client.getUrl(), timeout, this.client.getVersion(), restype, comp, context); + } + + /** + * Returns the permission (security descriptor) for a given key. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getPermissionWithRestResponseAsync(Context context) { + final String filePermissionKey = null; + final Integer timeout = null; + final String restype = "share"; + final String comp = "filepermission"; + return service.getPermission(this.client.getUrl(), filePermissionKey, timeout, this.client.getVersion(), restype, comp, context); + } + + /** + * Returns the permission (security descriptor) for a given key. + * + * @param filePermissionKey Key of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getPermissionWithRestResponseAsync(String filePermissionKey, Integer timeout, Context context) { + final String restype = "share"; + final String comp = "filepermission"; + return service.getPermission(this.client.getUrl(), filePermissionKey, timeout, this.client.getVersion(), restype, comp, context); + } + /** * Sets quota for the specified share. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java index 2d9e1b99dda5..2ffa84d00254 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java @@ -60,6 +60,48 @@ public final class DirectoryCreateHeaders { @JsonProperty(value = "x-ms-request-server-encrypted") private Boolean isServerEncrypted; + /* + * Key of the permission set for the directory. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * Attributes set for the directory. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the directory. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the directory. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the directory. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * The fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -218,6 +260,148 @@ public DirectoryCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { return this; } + /** + * Get the filePermissionKey property: Key of the permission set for the + * directory. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * directory. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileAttributes property: Attributes set for the directory. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the directory. + * + * @param fileAttributes the fileAttributes value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the directory. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the directory. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the directory. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the directory. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the directory. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the directory. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the fileId property: The fileId of the directory. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the directory. + * + * @param fileId the fileId value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the directory. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the directory. + * + * @param fileParentId the fileParentId value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java index 3e42c0318f67..0656e0fd3a8e 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java @@ -67,6 +67,48 @@ public final class DirectoryGetPropertiesHeaders { @JsonProperty(value = "x-ms-server-encrypted") private Boolean isServerEncrypted; + /* + * Attributes set for the directory. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the directory. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the directory. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the directory. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * Key of the permission set for the directory. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * The fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -243,6 +285,148 @@ public DirectoryGetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted return this; } + /** + * Get the fileAttributes property: Attributes set for the directory. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the directory. + * + * @param fileAttributes the fileAttributes value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the directory. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the directory. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the directory. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the directory. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the directory. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the directory. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the filePermissionKey property: Key of the permission set for the + * directory. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * directory. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileId property: The fileId of the directory. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the directory. + * + * @param fileId the fileId value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the directory. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the directory. + * + * @param fileParentId the fileParentId value to set. + * @return the DirectoryGetPropertiesHeaders object itself. + */ + public DirectoryGetPropertiesHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorySetPropertiesHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorySetPropertiesHeaders.java new file mode 100644 index 000000000000..f6a7c522af40 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorySetPropertiesHeaders.java @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for SetProperties operation. + */ +@JacksonXmlRootElement(localName = "Directory-SetProperties-Headers") +@Fluent +public final class DirectorySetPropertiesHeaders { + /* + * The ETag contains a value which represents the version of the file, in + * quotes. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Returns the date and time the directory was last modified. Any operation + * that modifies the directory or its properties updates the last modified + * time. Operations on files do not affect the last modified time of the + * directory. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * Indicates the version of the File service used to execute the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * The value of this header is set to true if the contents of the request + * are successfully encrypted using the specified algorithm, and false + * otherwise. + */ + @JsonProperty(value = "x-ms-request-server-encrypted") + private Boolean isServerEncrypted; + + /* + * Key of the permission set for the directory. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * Attributes set for the directory. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the directory. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the directory. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the directory. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * The fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the eTag property: The ETag contains a value which represents the + * version of the file, in quotes. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag contains a value which represents the + * version of the file, in quotes. + * + * @param eTag the eTag value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders eTag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the lastModified property: Returns the date and time the directory + * was last modified. Any operation that modifies the directory or its + * properties updates the last modified time. Operations on files do not + * affect the last modified time of the directory. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: Returns the date and time the directory + * was last modified. Any operation that modifies the directory or its + * properties updates the last modified time. Operations on files do not + * affect the last modified time of the directory. + * + * @param lastModified the lastModified value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the version property: Indicates the version of the File service used + * to execute the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the File service used + * to execute the request. + * + * @param version the version value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the isServerEncrypted property: The value of this header is set to + * true if the contents of the request are successfully encrypted using the + * specified algorithm, and false otherwise. + * + * @return the isServerEncrypted value. + */ + public Boolean isServerEncrypted() { + return this.isServerEncrypted; + } + + /** + * Set the isServerEncrypted property: The value of this header is set to + * true if the contents of the request are successfully encrypted using the + * specified algorithm, and false otherwise. + * + * @param isServerEncrypted the isServerEncrypted value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted) { + this.isServerEncrypted = isServerEncrypted; + return this; + } + + /** + * Get the filePermissionKey property: Key of the permission set for the + * directory. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * directory. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileAttributes property: Attributes set for the directory. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the directory. + * + * @param fileAttributes the fileAttributes value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the directory. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the directory. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the directory. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the directory. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the directory. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the directory. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the fileId property: The fileId of the directory. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the directory. + * + * @param fileId the fileId value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the directory. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the directory. + * + * @param fileParentId the fileParentId value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the DirectorySetPropertiesHeaders object itself. + */ + public DirectorySetPropertiesHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysSetPropertiesResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysSetPropertiesResponse.java new file mode 100644 index 000000000000..4cf0f7337a33 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/DirectorysSetPropertiesResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the setProperties operation. + */ +public final class DirectorysSetPropertiesResponse extends ResponseBase { + /** + * Creates an instance of DirectorysSetPropertiesResponse. + * + * @param request the request which resulted in this DirectorysSetPropertiesResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysSetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectorySetPropertiesHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java index 581e232cc3ce..1cbd74988f7d 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java @@ -60,6 +60,48 @@ public final class FileCreateHeaders { @JsonProperty(value = "x-ms-request-server-encrypted") private Boolean isServerEncrypted; + /* + * Key of the permission set for the file. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * Attributes set for the file. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the file. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the file. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the file. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * The fileId of the file. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the file. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -218,6 +260,148 @@ public FileCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { return this; } + /** + * Get the filePermissionKey property: Key of the permission set for the + * file. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * file. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileAttributes property: Attributes set for the file. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the file. + * + * @param fileAttributes the fileAttributes value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the file. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the file. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the file. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the file. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the file. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the file. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the fileId property: The fileId of the file. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the file. + * + * @param fileId the fileId value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the file. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the file. + * + * @param fileParentId the fileParentId value to set. + * @return the FileCreateHeaders object itself. + */ + public FileCreateHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java index 7ac009d11d0c..2506f470e547 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java @@ -187,6 +187,48 @@ public final class FileDownloadHeaders { @JsonProperty(value = "x-ms-server-encrypted") private Boolean isServerEncrypted; + /* + * Attributes set for the file. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the file. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the file. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the file. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * Key of the permission set for the file. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * The fileId of the file. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the file. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -762,6 +804,148 @@ public FileDownloadHeaders isServerEncrypted(Boolean isServerEncrypted) { return this; } + /** + * Get the fileAttributes property: Attributes set for the file. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the file. + * + * @param fileAttributes the fileAttributes value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the file. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the file. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the file. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the file. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the file. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the file. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the filePermissionKey property: Key of the permission set for the + * file. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * file. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileId property: The fileId of the file. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the file. + * + * @param fileId the fileId value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the file. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the file. + * + * @param fileParentId the fileParentId value to set. + * @return the FileDownloadHeaders object itself. + */ + public FileDownloadHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java index 74ce72c7315e..f84b64b94777 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java @@ -3,10 +3,11 @@ package com.azure.storage.file.models; -import io.netty.buffer.ByteBuf; +import reactor.core.publisher.Flux; + +import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.Map; -import reactor.core.publisher.Flux; /** * Contains download information about a File in the storage File service. @@ -18,7 +19,7 @@ public final class FileDownloadInfo { private final Long contentLength; private final String contentType; private final String contentRange; - private final Flux body; + private final Flux body; /** * Creates an instance of download information about a specific File. @@ -31,7 +32,7 @@ public final class FileDownloadInfo { * @param contentRange Indicates the range of bytes returned if the client requested a subset of the file by setting the Range request header. * @param body The download request body. */ - public FileDownloadInfo(final String eTag, final OffsetDateTime lastModified, final Map metadata, final Long contentLength, final String contentType, final String contentRange, final Flux body) { + public FileDownloadInfo(final String eTag, final OffsetDateTime lastModified, final Map metadata, final Long contentLength, final String contentType, final String contentRange, final Flux body) { this.eTag = eTag; this.lastModified = lastModified; this.metadata = metadata; @@ -86,7 +87,7 @@ public String contentRange() { /** * @return The download request body. */ - public Flux body() { + public Flux body() { return body; } } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java index 05059ba57cc4..2f3f28906ead 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java @@ -170,6 +170,48 @@ public final class FileGetPropertiesHeaders { @JsonProperty(value = "x-ms-server-encrypted") private Boolean isServerEncrypted; + /* + * Attributes set for the file. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the file. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the file. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the file. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * Key of the permission set for the file. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * The fileId of the file. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the file. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -689,6 +731,148 @@ public FileGetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted) { return this; } + /** + * Get the fileAttributes property: Attributes set for the file. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the file. + * + * @param fileAttributes the fileAttributes value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the file. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the file. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the file. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the file. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the file. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the file. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the filePermissionKey property: Key of the permission set for the + * file. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * file. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileId property: The fileId of the file. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the file. + * + * @param fileId the fileId value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the file. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the file. + * + * @param fileParentId the fileParentId value to set. + * @return the FileGetPropertiesHeaders object itself. + */ + public FileGetPropertiesHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRef.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRef.java index 8ed977bee61c..b5327856a225 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRef.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRef.java @@ -3,6 +3,8 @@ package com.azure.storage.file.models; +import com.azure.core.implementation.annotation.Fluent; + /** * Contains file or directory reference information in the storage File service. */ diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java index 6d50bff6a3ca..7ae2e8e0c7b4 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java @@ -60,6 +60,48 @@ public final class FileSetHTTPHeadersHeaders { @JsonProperty(value = "x-ms-request-server-encrypted") private Boolean isServerEncrypted; + /* + * Key of the permission set for the file. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * Attributes set for the file. + */ + @JsonProperty(value = "x-ms-file-attributes") + private String fileAttributes; + + /* + * Creation time for the file. + */ + @JsonProperty(value = "x-ms-file-creation-time") + private OffsetDateTime fileCreationTime; + + /* + * Last write time for the file. + */ + @JsonProperty(value = "x-ms-file-last-write-time") + private OffsetDateTime fileLastWriteTime; + + /* + * Change time for the file. + */ + @JsonProperty(value = "x-ms-file-change-time") + private OffsetDateTime fileChangeTime; + + /* + * The fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-id") + private String fileId; + + /* + * The parent fileId of the directory. + */ + @JsonProperty(value = "x-ms-file-parent-id") + private String fileParentId; + /* * The errorCode property. */ @@ -218,6 +260,148 @@ public FileSetHTTPHeadersHeaders isServerEncrypted(Boolean isServerEncrypted) { return this; } + /** + * Get the filePermissionKey property: Key of the permission set for the + * file. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * file. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the fileAttributes property: Attributes set for the file. + * + * @return the fileAttributes value. + */ + public String fileAttributes() { + return this.fileAttributes; + } + + /** + * Set the fileAttributes property: Attributes set for the file. + * + * @param fileAttributes the fileAttributes value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileAttributes(String fileAttributes) { + this.fileAttributes = fileAttributes; + return this; + } + + /** + * Get the fileCreationTime property: Creation time for the file. + * + * @return the fileCreationTime value. + */ + public OffsetDateTime fileCreationTime() { + return this.fileCreationTime; + } + + /** + * Set the fileCreationTime property: Creation time for the file. + * + * @param fileCreationTime the fileCreationTime value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileCreationTime(OffsetDateTime fileCreationTime) { + this.fileCreationTime = fileCreationTime; + return this; + } + + /** + * Get the fileLastWriteTime property: Last write time for the file. + * + * @return the fileLastWriteTime value. + */ + public OffsetDateTime fileLastWriteTime() { + return this.fileLastWriteTime; + } + + /** + * Set the fileLastWriteTime property: Last write time for the file. + * + * @param fileLastWriteTime the fileLastWriteTime value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileLastWriteTime(OffsetDateTime fileLastWriteTime) { + this.fileLastWriteTime = fileLastWriteTime; + return this; + } + + /** + * Get the fileChangeTime property: Change time for the file. + * + * @return the fileChangeTime value. + */ + public OffsetDateTime fileChangeTime() { + return this.fileChangeTime; + } + + /** + * Set the fileChangeTime property: Change time for the file. + * + * @param fileChangeTime the fileChangeTime value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileChangeTime(OffsetDateTime fileChangeTime) { + this.fileChangeTime = fileChangeTime; + return this; + } + + /** + * Get the fileId property: The fileId of the directory. + * + * @return the fileId value. + */ + public String fileId() { + return this.fileId; + } + + /** + * Set the fileId property: The fileId of the directory. + * + * @param fileId the fileId value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileId(String fileId) { + this.fileId = fileId; + return this; + } + + /** + * Get the fileParentId property: The parent fileId of the directory. + * + * @return the fileParentId value. + */ + public String fileParentId() { + return this.fileParentId; + } + + /** + * Set the fileParentId property: The parent fileId of the directory. + * + * @param fileParentId the fileParentId value to set. + * @return the FileSetHTTPHeadersHeaders object itself. + */ + public FileSetHTTPHeadersHeaders fileParentId(String fileParentId) { + this.fileParentId = fileParentId; + return this; + } + /** * Get the errorCode property: The errorCode property. * diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileUploadRangeFromURLHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileUploadRangeFromURLHeaders.java new file mode 100644 index 000000000000..8cf6f922ce03 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileUploadRangeFromURLHeaders.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.util.ImplUtils; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for UploadRangeFromURL operation. + */ +@JacksonXmlRootElement(localName = "File-UploadRangeFromURL-Headers") +@Fluent +public final class FileUploadRangeFromURLHeaders { + /* + * The ETag contains a value which represents the version of the file, in + * quotes. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * Returns the date and time the directory was last modified. Any operation + * that modifies the share or its properties or metadata updates the last + * modified time. Operations on files do not affect the last modified time + * of the share. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the File service; it + * is not necessarily the same value as may have been specified in the + * request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the File service used to execute the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * The value of this header is set to true if the contents of the request + * are successfully encrypted using the specified algorithm, and false + * otherwise. + */ + @JsonProperty(value = "x-ms-request-server-encrypted") + private Boolean isServerEncrypted; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the eTag property: The ETag contains a value which represents the + * version of the file, in quotes. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the eTag property: The ETag contains a value which represents the + * version of the file, in quotes. + * + * @param eTag the eTag value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders eTag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: Returns the date and time the directory + * was last modified. Any operation that modifies the share or its + * properties or metadata updates the last modified time. Operations on + * files do not affect the last modified time of the share. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.dateTime(); + } + + /** + * Set the lastModified property: Returns the date and time the directory + * was last modified. Any operation that modifies the share or its + * properties or metadata updates the last modified time. Operations on + * files do not affect the last modified time of the share. + * + * @param lastModified the lastModified value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders lastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the File service; it is not necessarily the same value as + * may have been specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] xMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the File service; it is not necessarily the same value as + * may have been specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders xMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the File service used + * to execute the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the File service used + * to execute the request. + * + * @param version the version value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the isServerEncrypted property: The value of this header is set to + * true if the contents of the request are successfully encrypted using the + * specified algorithm, and false otherwise. + * + * @return the isServerEncrypted value. + */ + public Boolean isServerEncrypted() { + return this.isServerEncrypted; + } + + /** + * Set the isServerEncrypted property: The value of this header is set to + * true if the contents of the request are successfully encrypted using the + * specified algorithm, and false otherwise. + * + * @param isServerEncrypted the isServerEncrypted value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders isServerEncrypted(Boolean isServerEncrypted) { + this.isServerEncrypted = isServerEncrypted; + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the FileUploadRangeFromURLHeaders object itself. + */ + public FileUploadRangeFromURLHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java index b9a1d0270c15..61e5a951f859 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java @@ -7,14 +7,14 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; -import io.netty.buffer.ByteBuf; import java.io.Closeable; +import java.nio.ByteBuffer; import reactor.core.publisher.Flux; /** * Contains all response data for the download operation. */ -public final class FilesDownloadResponse extends ResponseBase> implements Closeable { +public final class FilesDownloadResponse extends ResponseBase> implements Closeable { /** * Creates an instance of FilesDownloadResponse. * @@ -24,7 +24,7 @@ public final class FilesDownloadResponse extends ResponseBase value, FileDownloadHeaders headers) { + public FilesDownloadResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Flux value, FileDownloadHeaders headers) { super(request, statusCode, rawHeaders, value, headers); } @@ -32,7 +32,7 @@ public FilesDownloadResponse(HttpRequest request, int statusCode, HttpHeaders ra * @return the response content stream. */ @Override - public Flux value() { + public Flux value() { return super.value(); } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesUploadRangeFromURLResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesUploadRangeFromURLResponse.java new file mode 100644 index 000000000000..2743a5a6d954 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FilesUploadRangeFromURLResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the uploadRangeFromURL operation. + */ +public final class FilesUploadRangeFromURLResponse extends ResponseBase { + /** + * Creates an instance of FilesUploadRangeFromURLResponse. + * + * @param request the request which resulted in this FilesUploadRangeFromURLResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public FilesUploadRangeFromURLResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileUploadRangeFromURLHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareCreatePermissionHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareCreatePermissionHeaders.java new file mode 100644 index 000000000000..d84436426198 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareCreatePermissionHeaders.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for CreatePermission operation. + */ +@JacksonXmlRootElement(localName = "Share-CreatePermission-Headers") +@Fluent +public final class ShareCreatePermissionHeaders { + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the File service used to execute the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * Key of the permission set for the directory/file. + */ + @JsonProperty(value = "x-ms-file-permission-key") + private String filePermissionKey; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the ShareCreatePermissionHeaders object itself. + */ + public ShareCreatePermissionHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the File service used + * to execute the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the File service used + * to execute the request. + * + * @param version the version value to set. + * @return the ShareCreatePermissionHeaders object itself. + */ + public ShareCreatePermissionHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the ShareCreatePermissionHeaders object itself. + */ + public ShareCreatePermissionHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the filePermissionKey property: Key of the permission set for the + * directory/file. + * + * @return the filePermissionKey value. + */ + public String filePermissionKey() { + return this.filePermissionKey; + } + + /** + * Set the filePermissionKey property: Key of the permission set for the + * directory/file. + * + * @param filePermissionKey the filePermissionKey value to set. + * @return the ShareCreatePermissionHeaders object itself. + */ + public ShareCreatePermissionHeaders filePermissionKey(String filePermissionKey) { + this.filePermissionKey = filePermissionKey; + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the ShareCreatePermissionHeaders object itself. + */ + public ShareCreatePermissionHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareGetPermissionHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareGetPermissionHeaders.java new file mode 100644 index 000000000000..ac36522215ad --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/ShareGetPermissionHeaders.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for GetPermission operation. + */ +@JacksonXmlRootElement(localName = "Share-GetPermission-Headers") +@Fluent +public final class ShareGetPermissionHeaders { + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the File service used to execute the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the ShareGetPermissionHeaders object itself. + */ + public ShareGetPermissionHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the File service used + * to execute the request. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the File service used + * to execute the request. + * + * @param version the version value to set. + * @return the ShareGetPermissionHeaders object itself. + */ + public ShareGetPermissionHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.dateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the ShareGetPermissionHeaders object itself. + */ + public ShareGetPermissionHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the ShareGetPermissionHeaders object itself. + */ + public ShareGetPermissionHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreatePermissionResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreatePermissionResponse.java new file mode 100644 index 000000000000..a8b5d330d873 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesCreatePermissionResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the createPermission operation. + */ +public final class SharesCreatePermissionResponse extends ResponseBase { + /** + * Creates an instance of SharesCreatePermissionResponse. + * + * @param request the request which resulted in this SharesCreatePermissionResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SharesCreatePermissionResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ShareCreatePermissionHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetPermissionResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetPermissionResponse.java new file mode 100644 index 000000000000..a0e6c3fe6fb8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SharesGetPermissionResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the getPermission operation. + */ +public final class SharesGetPermissionResponse extends ResponseBase { + /** + * Creates an instance of SharesGetPermissionResponse. + * + * @param request the request which resulted in this SharesGetPermissionResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SharesGetPermissionResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ShareGetPermissionHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SourceModifiedAccessConditions.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SourceModifiedAccessConditions.java new file mode 100644 index 000000000000..3a259ab6687d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/SourceModifiedAccessConditions.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.util.ImplUtils; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Additional parameters for uploadRangeFromURL operation. + */ +@JacksonXmlRootElement(localName = "source-modified-access-conditions") +@Fluent +public final class SourceModifiedAccessConditions { + /* + * Specify the crc64 value to operate only on range with a matching crc64 + * checksum. + */ + @JsonProperty(value = "sourceIfMatchCrc64") + private byte[] sourceIfMatchCrc64; + + /* + * Specify the crc64 value to operate only on range without a matching + * crc64 checksum. + */ + @JsonProperty(value = "sourceIfNoneMatchCrc64") + private byte[] sourceIfNoneMatchCrc64; + + /** + * Get the sourceIfMatchCrc64 property: Specify the crc64 value to operate + * only on range with a matching crc64 checksum. + * + * @return the sourceIfMatchCrc64 value. + */ + public byte[] sourceIfMatchCrc64() { + return ImplUtils.clone(this.sourceIfMatchCrc64); + } + + /** + * Set the sourceIfMatchCrc64 property: Specify the crc64 value to operate + * only on range with a matching crc64 checksum. + * + * @param sourceIfMatchCrc64 the sourceIfMatchCrc64 value to set. + * @return the SourceModifiedAccessConditions object itself. + */ + public SourceModifiedAccessConditions sourceIfMatchCrc64(byte[] sourceIfMatchCrc64) { + this.sourceIfMatchCrc64 = ImplUtils.clone(sourceIfMatchCrc64); + return this; + } + + /** + * Get the sourceIfNoneMatchCrc64 property: Specify the crc64 value to + * operate only on range without a matching crc64 checksum. + * + * @return the sourceIfNoneMatchCrc64 value. + */ + public byte[] sourceIfNoneMatchCrc64() { + return ImplUtils.clone(this.sourceIfNoneMatchCrc64); + } + + /** + * Set the sourceIfNoneMatchCrc64 property: Specify the crc64 value to + * operate only on range without a matching crc64 checksum. + * + * @param sourceIfNoneMatchCrc64 the sourceIfNoneMatchCrc64 value to set. + * @return the SourceModifiedAccessConditions object itself. + */ + public SourceModifiedAccessConditions sourceIfNoneMatchCrc64(byte[] sourceIfNoneMatchCrc64) { + this.sourceIfNoneMatchCrc64 = ImplUtils.clone(sourceIfNoneMatchCrc64); + return this; + } +} diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/StorageException.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/StorageException.java new file mode 100644 index 000000000000..140eaf049177 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/StorageException.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.models; + +import com.azure.core.exception.HttpResponseException; + +/** + * A {@code StorageException} 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 StorageException}. 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 StorageException extends HttpResponseException { + private static final String ERROR_CODE = "x-ms-error-code"; + + private final StorageErrorCode errorCode; + private final String message; + + StorageException(StorageErrorException e, String responseBody) { + super(e.getMessage(), e.response(), e); + this.errorCode = StorageErrorCode.fromString(e.response().headers().value(ERROR_CODE)); + this.message = responseBody; + } + + /** + * @return The error code returned by the service. + */ + public StorageErrorCode errorCode() { + return this.errorCode; + } + + /** + * @return The message returned by the service. + */ + public String serviceMessage() { + return this.message; + } + + /** + * @return The status code on the response. + */ + public int statusCode() { + return super.response().statusCode(); + } +} diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java index 10fa11d5728f..6d95d9d79fe2 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/AsyncSample.java @@ -27,7 +27,7 @@ public static void main(String[] args) { .buildAsyncClient(); // Create a share String shareName = generateRandomName(); - fileServiceAsyncClient.createShare(shareName).subscribe( + fileServiceAsyncClient.createShareWithResponse(shareName, null, null).subscribe( response -> { System.out.printf("Successfully created a share with status code: %d.", response.statusCode()); }, diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryAsyncJavaDocCodeSamples.java new file mode 100644 index 000000000000..7e3550749a18 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryAsyncJavaDocCodeSamples.java @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.storage.file; + +import com.azure.storage.common.Utility; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.models.FileHTTPHeaders; + +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Collections; +import java.util.Map; + +/** + * Contains code snippets when generating javadocs through doclets for {@link DirectoryClient} and {@link DirectoryAsyncClient}. + */ +public class DirectoryAsyncJavaDocCodeSamples { + + /** + * Generates code sample for {@link DirectoryAsyncClient} instantiation. + */ + public void asyncInitialization() { + // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation + DirectoryAsyncClient client = new DirectoryClientBuilder() + .connectionString("${connectionString}") + .endpoint("${endpoint}") + .buildAsyncClient(); + // END: com.azure.storage.file.directoryAsyncClient.instantiation + } + + /** + * Generates code sample for creating a {@link DirectoryAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link DirectoryAsyncClient} + */ + public DirectoryAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.sastoken + DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") + .shareName("myshare") + .directoryPath("mydirectory") + .buildAsyncClient(); + // END: com.azure.storage.file.directoryAsyncClient.instantiation.sastoken + return directoryAsyncClient; + } + + /** + * Generates code sample for creating a {@link DirectoryAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link DirectoryAsyncClient} + */ + public DirectoryAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.credential + DirectoryAsyncClient direcotryAsyncClient = new DirectoryClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) + .shareName("myshare") + .directoryPath("mydirectory") + .buildAsyncClient(); + // END: com.azure.storage.file.directoryAsyncClient.instantiation.credential + return direcotryAsyncClient; + } + + /** + * Generates code sample for creating a {@link DirectoryAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * @return An instance of {@link DirectoryAsyncClient} + */ + public DirectoryAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() + .connectionString(connectionString).shareName("myshare").directoryPath("mydirectory") + .buildAsyncClient(); + // END: com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring + return directoryAsyncClient; + } + + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#create} + */ + public void createDirectoryAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.create + directoryAsyncClient.create().subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Completed creating the directory!") + ); + // END: com.azure.storage.file.directoryAsyncClient.create + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#createWithResponse(Map)} + */ + public void createDirectoryWithResponseAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.createWithResponse#Map + directoryAsyncClient.createWithResponse(Collections.singletonMap("directory", "metadata")).subscribe( + response -> System.out.println("Completed creating the directory with status code:" + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.file.directoryAsyncClient.createWithResponse#Map + } + + /** + * Generates code sample for creating a subdirectory with {@link DirectoryAsyncClient} + */ + public void createSubDirectory() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string + directoryAsyncClient.createSubDirectory("subdir") + .doOnSuccess(response -> System.out.println("Completed creating the subdirectory.")); + // END: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#createSubDirectoryWithResponse(String, Map)} + */ + public void createSubDirectoryAsyncMaxOverload() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectoryWithResponse#string-map + directoryAsyncClient.createSubDirectoryWithResponse("subdir", + Collections.singletonMap("directory", "metadata")).subscribe( + response -> + System.out.println("Successfully creating the subdirectory with status code: " + + response.statusCode()), + error -> System.err.println(error.toString()) + ); + // END: com.azure.storage.file.directoryAsyncClient.createSubDirectoryWithResponse#string-map + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#createFile(String, long)} + */ + public void createFileAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.createFile#string-long + directoryAsyncClient.createFile("myfile", 1024).subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Completed creating the file.") + ); + // END: com.azure.storage.file.directoryAsyncClient.createFile#string-long + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#createFileWithResponse(String, long, FileHTTPHeaders, Map)} + */ + public void createFileWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.createFileWithResponse#string-long-fileHTTPHeaders-map + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); + directoryAsyncClient.createFileWithResponse("myFile", 1024, httpHeaders, + Collections.singletonMap("directory", "metadata")).subscribe( + response -> System.out.printf("Creating the file completed with status code %d", response.statusCode()), + error -> System.err.println(error.toString()), + () -> System.out.println("Completed creating the file.") + ); + // END: com.azure.storage.file.directoryAsyncClient.createFileWithResponse#string-long-fileHTTPHeaders-map + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#listFilesAndDirectories()} + */ + public void listDirectoriesAndFilesAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories + directoryAsyncClient.listFilesAndDirectories().subscribe( + fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", + fileRef.isDirectory(), fileRef.name()), + error -> System.err.println(error.toString()), + () -> System.out.println("Completed listing the directories and files.") + ); + // END: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#listFilesAndDirectories(String, Integer)} + */ + public void listDirectoriesAndFilesAsyncMaxOverload() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer + directoryAsyncClient.listFilesAndDirectories("subdir", 10).subscribe( + fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", + fileRef.isDirectory(), fileRef.name()), + error -> System.err.println(error.toString()), + () -> System.out.println("Completed listing the directories and files.") + ); + // END: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#deleteFile(String)} ()} + */ + public void deleteFileAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteFile#string + directoryAsyncClient.deleteFile("myfile").subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Completed deleting the file.") + ); + // END: com.azure.storage.file.directoryAsyncClient.deleteFile#string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#deleteFileWithResponse(String)} + */ + public void deleteFileWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteFileWithResponse#string + directoryAsyncClient.deleteFileWithResponse("myfile").subscribe( + response -> System.out.printf("Delete file completed with status code %d", response.statusCode()), + error -> System.err.println(error.toString()), + () -> System.out.println("Completed deleting the file.") + ); + // END: com.azure.storage.file.directoryAsyncClient.deleteFileWithResponse#string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#deleteSubDirectory(String)} ()} + */ + public void deleteSubDirectoryAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string + directoryAsyncClient.deleteSubDirectory("mysubdirectory").subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Completed deleting the subdirectory.") + ); + // END: com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#deleteSubDirectoryWithResponse(String)} ()} + */ + public void deleteSubDirectoryWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteSubDirectoryWithResponse#string + directoryAsyncClient.deleteSubDirectoryWithResponse("mysubdirectory").subscribe( + response -> System.out.printf("Delete subdirectory completed with status code %d", response.statusCode()), + error -> System.err.println(error.toString()), + () -> System.out.println("Completed deleting the subdirectory.") + ); + // END: com.azure.storage.file.directoryAsyncClient.deleteSubDirectoryWithResponse#string + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#delete()} + */ + public void deleteDirectoryAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.delete + directoryAsyncClient.delete().subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Completed deleting the file.") + ); + // END: com.azure.storage.file.directoryAsyncClient.delete + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#deleteWithResponse()} + */ + public void deleteWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteWithResponse + directoryAsyncClient.deleteWithResponse().subscribe( + response -> System.out.printf("Delete completed with status code %d", response.statusCode()), + error -> System.err.println(error.toString()) + ); + // END: com.azure.storage.file.directoryAsyncClient.deleteWithResponse + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.getProperties + directoryAsyncClient.getProperties().subscribe(properties -> { + System.out.printf("Directory latest modified date is %s.", properties.lastModified()); + }); + // END: com.azure.storage.file.directoryAsyncClient.getProperties + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.getPropertiesWithResponse + directoryAsyncClient.getPropertiesWithResponse().subscribe(properties -> { + System.out.printf("Directory latest modified date is %s:", properties.value().lastModified()); + }); + // END: com.azure.storage.file.directoryAsyncClient.getPropertiesWithResponse + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#setMetadata(Map)} + */ + public void setMetadataAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadata#map + directoryAsyncClient.setMetadata(Collections.singletonMap("directory", "updatedMetadata")) + .subscribe(response -> System.out.println("Setting the directory metadata completed.")); + // END: com.azure.storage.file.directoryAsyncClient.setMetadata#map + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#setMetadata(Map)} to clear the metadata. + */ + public void setMetadataClear() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadata#map.clearMetadata + directoryAsyncClient.setMetadata(null) + .doOnSuccess(response -> System.out.println("Clearing the directory metadata completed")); + // END: com.azure.storage.file.directoryAsyncClient.setMetadata#map.clearMetadata + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#setMetadataWithResponse(Map)} to clear the metadata. + */ + public void setMetadataWithResponseClear() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map.clearMetadata + directoryAsyncClient.setMetadataWithResponse(null).subscribe( + response -> System.out.printf("Clearing the directory metadata completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map.clearMetadata + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#setMetadataWithResponse(Map)} + */ + public void setMetadataWithResponse() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map + directoryAsyncClient.setMetadataWithResponse(Collections.singletonMap("directory", "updatedMetadata")) + .subscribe(response -> System.out.println("Setting the directory metadata completed with status code:" + + response.statusCode())); + // END: com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#listHandles(Integer, boolean)} + */ + public void listHandlesAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.listHandles#integer-boolean + directoryAsyncClient.listHandles(10, true) + .subscribe(handleItem -> System.out.printf("Get handles completed with handle id %s", + handleItem.handleId())); + // END: com.azure.storage.file.directoryAsyncClient.listHandles#integer-boolean + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#forceCloseHandles(String, boolean)} + */ + public void forceCloseHandlesAsync() { + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryAsyncClient.forceCloseHandles + directoryAsyncClient.listHandles(10, true) + .subscribe(handleItem -> directoryAsyncClient.forceCloseHandles(handleItem.handleId(), true) + .subscribe(numOfClosedHandles -> System.out.printf("Closed %d handles.", numOfClosedHandles))); + // END: com.azure.storage.file.directoryAsyncClient.forceCloseHandles + } + + /** + * Generates a code sample for using {@link DirectoryAsyncClient#getShareSnapshotId()} + */ + public void getShareSnapshotIdAsync() { + // BEGIN: com.azure.storage.file.directoryAsyncClient.getShareSnapshotId + OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); + DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() + .endpoint("https://${accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) + .shareName("myshare") + .directoryPath("mydirectory") + .snapshot(currentTime.toString()) + .buildAsyncClient(); + + System.out.printf("Snapshot ID: %s%n", directoryAsyncClient.getShareSnapshotId()); + // END: com.azure.storage.file.directoryAsyncClient.getShareSnapshotId + } +} diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java index 1a557f412941..2f46ad28709c 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java @@ -5,6 +5,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; import com.azure.storage.common.Utility; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.DirectoryInfo; @@ -20,9 +21,13 @@ import java.util.Map; /** - * Contains code snippets when generating javadocs through doclets for {@link DirectoryClient} and {@link DirectoryAsyncClient}. + * Contains code snippets when generating javadocs through doclets for {@link DirectoryClient}. */ public class DirectoryJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for {@link DirectoryClient} instantiation. */ @@ -35,18 +40,6 @@ public void initialization() { // END: com.azure.storage.file.directoryClient.instantiation } - /** - * Generates code sample for {@link DirectoryAsyncClient} instantiation. - */ - public void asyncInitialization() { - // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation - DirectoryAsyncClient client = new DirectoryClientBuilder() - .connectionString("${connectionString}") - .endpoint("${endpoint}") - .buildAsyncClient(); - // END: com.azure.storage.file.directoryAsyncClient.instantiation - } - /** * Generates code sample for creating a {@link DirectoryClient} with {@link SASTokenCredential} * @return An instance of {@link DirectoryClient} @@ -62,21 +55,6 @@ public DirectoryClient createClientWithSASToken() { return directoryClient; } - /** - * Generates code sample for creating a {@link DirectoryAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link DirectoryAsyncClient} - */ - public DirectoryAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.sastoken - DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") - .shareName("myshare") - .directoryPath("mydirectory") - .buildAsyncClient(); - // END: com.azure.storage.file.directoryAsyncClient.instantiation.sastoken - return directoryAsyncClient; - } - /** * Generates code sample for creating a {@link DirectoryClient} with {@link SASTokenCredential} * @return An instance of {@link DirectoryClient} @@ -94,22 +72,6 @@ public DirectoryClient createClientWithCredential() { return directoryClient; } - /** - * Generates code sample for creating a {@link DirectoryAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link DirectoryAsyncClient} - */ - public DirectoryAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.credential - DirectoryAsyncClient direcotryAsyncClient = new DirectoryClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) - .shareName("myshare") - .directoryPath("mydirectory") - .buildAsyncClient(); - // END: com.azure.storage.file.directoryAsyncClient.instantiation.credential - return direcotryAsyncClient; - } - /** * Generates code sample for creating a {@link DirectoryClient} with {@code connectionString} which turns into {@link SharedKeyCredential} * @return An instance of {@link DirectoryClient} @@ -125,121 +87,50 @@ public DirectoryClient createClientWithConnectionString() { return directoryClient; } - /** - * Generates code sample for creating a {@link DirectoryAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link DirectoryAsyncClient} - */ - public DirectoryAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" - + "EndpointSuffix={core.windows.net}"; - DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() - .connectionString(connectionString).shareName("myshare").directoryPath("mydirectory") - .buildAsyncClient(); - // END: com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring - return directoryAsyncClient; - } - /** * Generates a code sample for using {@link DirectoryClient#create()} */ public void createDirectory() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.createDirectory - Response response = directoryClient.create(); - System.out.println("Complete creating the directory with status code: " + response.statusCode()); + directoryClient.create(); + System.out.println("Completed creating the directory. "); // END: com.azure.storage.file.directoryClient.createDirectory } /** - * Generates a code sample for using {@link DirectoryAsyncClient#create} + * Generates a code sample for using {@link DirectoryClient#createWithResponse(Map, Context)} */ - public void createDirectoryAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.create - directoryAsyncClient.create().subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the directory!") - ); - // END: com.azure.storage.file.directoryAsyncClient.create - } - - /** - * Generates a code sample for using {@link DirectoryClient#create(Map)} - */ - public void createDirectoryWithOverload() { + public void createWithResponse() { DirectoryClient directoryClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryClient.create#map - Response response = directoryClient.create(Collections.singletonMap("directory", "metadata")); - System.out.println("Complete creating the directory with status code: " + response.statusCode()); - // END: com.azure.storage.file.directoryClient.create#map + // BEGIN: com.azure.storage.file.directoryClient.createWithResponse#map-Context + Response response = directoryClient.createWithResponse( + Collections.singletonMap("directory", "metadata"), new Context(key1, value1)); + System.out.println("Completed creating the directory with status code: " + response.statusCode()); + // END: com.azure.storage.file.directoryClient.createWithResponse#map-Context } /** - * Generates a code sample for using {@link DirectoryAsyncClient#create(Map)} - */ - public void createDirectoryAsyncWithOverload() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.create#map - directoryAsyncClient.create(Collections.singletonMap("directory", "metadata")).subscribe( - response -> System.out.printf("Creating the directory completed with status code %d", - response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the directory!") - ); - // END: com.azure.storage.file.directoryAsyncClient.create#map - } - - /** - * Generates a code sample for using {@link DirectoryClient#createSubDirectory(String) + * Generates a code sample for using {@link DirectoryClient#createSubDirectory(String)} */ public void createSubDirectory() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.createSubDirectory#string - Response response = directoryClient.createSubDirectory("subdir"); - System.out.println("Complete creating the subdirectory with status code " + response.statusCode()); + directoryClient.createSubDirectory("subdir"); + System.out.println("Completed creating the subdirectory."); // END: com.azure.storage.file.directoryClient.createSubDirectory#string } /** - * Generates a code sample for using {@link DirectoryAsyncClient#createSubDirectory(String)} - */ - public void createSubDirectoryAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string - directoryAsyncClient.createSubDirectory("subdir").subscribe( - response -> System.out.println("Successfully creating the subdirectory with status code: " - + response.statusCode()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete creating the sub directory.") - ); - // END: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string - } - - /** - * Generates a code sample for using {@link DirectoryClient#createSubDirectory(String, Map)} + * Generates a code sample for using {@link DirectoryClient#createSubDirectoryWithResponse(String, Map, Context)} */ public void createSubDirectoryMaxOverload() { DirectoryClient directoryClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryClient.createSubDirectory#string-map - Response response = directoryClient.createSubDirectory("subdir", - Collections.singletonMap("directory", "metadata")); + // BEGIN: com.azure.storage.file.directoryClient.createSubDirectoryWithResponse#string-map-Context + Response response = directoryClient.createSubDirectoryWithResponse("subdir", + Collections.singletonMap("directory", "metadata"), new Context(key1, value1)); System.out.printf("Creating the sub directory completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.directoryClient.createSubDirectory#string-map - } - - /** - * Generates a code sample for using {@link DirectoryAsyncClient#createSubDirectory(String, Map)} - */ - public void createSubDirectoryAsyncMaxOverload() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string-map - directoryAsyncClient.createSubDirectory("subdir", - Collections.singletonMap("directory", "metadata")) - .subscribe(response -> System.out.printf("Creating the subdirectory completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string-map + // END: com.azure.storage.file.directoryClient.createSubDirectoryWithResponse#string-map-Context } /** @@ -248,52 +139,22 @@ public void createSubDirectoryAsyncMaxOverload() { public void createFile() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.createFile#string-long - Response response = directoryClient.createFile("myfile", 1024); - System.out.println("Complete creating the file with status code: " + response.statusCode()); + FileClient response = directoryClient.createFile("myfile", 1024); + System.out.println("Completed creating the file: " + response); // END: com.azure.storage.file.directoryClient.createFile#string-long } /** - * Generates a code sample for using {@link DirectoryAsyncClient#createFile(String, long)} - */ - public void createFileAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.createFile#string-long - directoryAsyncClient.createFile("myfile", 1024).subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete creating the file.") - ); - // END: com.azure.storage.file.directoryAsyncClient.createFile#string-long - } - - /** - * Generates a code sample for using {@link DirectoryClient#createFile(String, long, FileHTTPHeaders, Map)} + * Generates a code sample for using {@link DirectoryClient#createFileWithResponse(String, long, FileHTTPHeaders, Map, Context)} */ public void createFileMaxOverload() { DirectoryClient directoryClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryClient.createFile#string-long-fileHTTPHeaders-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - Response response = directoryClient.createFile("myFile", 1024, - httpHeaders, Collections.singletonMap("directory", "metadata")); - System.out.println("Complete creating the file with status code: " + response.statusCode()); - // END: com.azure.storage.file.directoryClient.createFile#string-long-fileHTTPHeaders-map - } - - /** - * Generates a code sample for using {@link DirectoryAsyncClient#createFile(String, long, FileHTTPHeaders, Map)} - */ - public void createFileAsyncMaxOverload() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.createFile#string-long-fileHTTPHeaders-map + // BEGIN: com.azure.storage.file.directoryClient.createFile#string-long-fileHTTPHeaders-map-Context FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - directoryAsyncClient.createFile("myFile", 1024, httpHeaders, - Collections.singletonMap("directory", "metadata")).subscribe( - response -> System.out.printf("Creating the file completed with status code %d", response.statusCode()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete creating the file.") - ); - // END: com.azure.storage.file.directoryAsyncClient.createFile#string-long-fileHTTPHeaders-map + Response response = directoryClient.createFileWithResponse("myFile", 1024, + httpHeaders, Collections.singletonMap("directory", "metadata"), new Context(key1, value1)); + System.out.println("Completed creating the file with status code: " + response.statusCode()); + // END: com.azure.storage.file.directoryClient.createFile#string-long-fileHTTPHeaders-map-Context } /** @@ -309,21 +170,6 @@ public void listDirectoriesAndFiles() { // END: com.azure.storage.file.directoryClient.listFilesAndDirectories } - /** - * Generates a code sample for using {@link DirectoryAsyncClient#listFilesAndDirectories()} - */ - public void listDirectoriesAndFilesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories - directoryAsyncClient.listFilesAndDirectories().subscribe( - fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", - fileRef.isDirectory(), fileRef.name()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete listing the directories and files.") - ); - // END: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories - } - /** * Generates a code sample for using {@link DirectoryClient#listFilesAndDirectories(String, Integer)} */ @@ -337,45 +183,26 @@ public void listDirectoriesAndFilesMaxOverload() { // END: com.azure.storage.file.directoryClient.listFilesAndDirectories#string-integer } - - /** - * Generates a code sample for using {@link DirectoryAsyncClient#listFilesAndDirectories(String, Integer)} - */ - public void listDirectoriesAndFilesAsyncMaxOverload() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer - directoryAsyncClient.listFilesAndDirectories("subdir", 10).subscribe( - fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", - fileRef.isDirectory(), fileRef.name()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete listing the directories and files.") - ); - // END: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer - } - /** * Generates a code sample for using {@link DirectoryClient#deleteFile(String)} ()} */ public void deleteFile() { DirectoryClient directoryClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryClient.deleteFile#string - VoidResponse response = directoryClient.deleteFile("myfile"); - System.out.println("Complete deleting the file with status code: " + response.statusCode()); - // END: com.azure.storage.file.directoryClient.deleteFile#string + // BEGIN: com.azure.storage.file.DirectoryClient.deleteFileWithResponse#String-Context + directoryClient.deleteFile("myfile"); + System.out.println("Completed deleting the file."); + // END: com.azure.storage.file.DirectoryClient.deleteFileWithResponse#String-Context } /** - * Generates a code sample for using {@link DirectoryAsyncClient#deleteFile(String)} ()} + * Generates a code sample for using {@link DirectoryClient#deleteFileWithResponse(String, Context)} */ - public void deleteFileAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteFile#string - directoryAsyncClient.deleteFile("myfile").subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the file.") - ); - // END: com.azure.storage.file.directoryAsyncClient.deleteFile#string + public void deleteFileWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryClient.deleteFileWithResponse#string-Context + VoidResponse response = directoryClient.deleteFileWithResponse("myfile", new Context(key1, value1)); + System.out.println("Completed deleting the file with status code: " + response.statusCode()); + // END: com.azure.storage.file.directoryClient.deleteFileWithResponse#string-Context } /** @@ -384,48 +211,43 @@ public void deleteFileAsync() { public void deleteSubDirectory() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.deleteSubDirectory#string - VoidResponse response = directoryClient.deleteSubDirectory("mysubdirectory"); - System.out.println("Complete deleting the subdirectory with status code: " + response.statusCode()); + directoryClient.deleteSubDirectory("mysubdirectory"); + System.out.println("Complete deleting the subdirectory."); // END: com.azure.storage.file.directoryClient.deleteSubDirectory#string } /** - * Generates a code sample for using {@link DirectoryAsyncClient#deleteSubDirectory(String)} ()} + * Generates a code sample for using {@link DirectoryClient#deleteSubDirectoryWithResponse(String, Context)} */ - public void deleteSubDirectoryAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string - directoryAsyncClient.deleteSubDirectory("mysubdirectory").subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the subdirectory.") - ); - // END: com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string + public void deleteSubDirectoryWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryClient.deleteSubDirectoryWithResponse#string-Context + VoidResponse response = directoryClient.deleteSubDirectoryWithResponse("mysubdirectory", + new Context(key1, value1)); + System.out.println("Completed deleting the subdirectory with status code: " + response.statusCode()); + // END: com.azure.storage.file.directoryClient.deleteSubDirectoryWithResponse#string-Context } /** - * Generates a code sample for using {@link DirectoryClient#delete()} ()} + * Generates a code sample for using {@link DirectoryClient#delete()} */ public void deleteDirectory() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.delete - VoidResponse response = directoryClient.delete(); - System.out.println("Complete deleting the file with status code: " + response.statusCode()); + directoryClient.delete(); + System.out.println("Completed deleting the file."); // END: com.azure.storage.file.directoryClient.delete } /** - * Generates a code sample for using {@link DirectoryAsyncClient#delete()} + * Generates a code sample for using {@link DirectoryClient#deleteWithResponse(Context)} */ - public void deleteDirectoryAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.delete - directoryAsyncClient.delete().subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the file.") - ); - // END: com.azure.storage.file.directoryAsyncClient.delete + public void deleteWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.DirectoryClient.deleteWithResponse#Context + VoidResponse response = directoryClient.deleteWithResponse(new Context(key1, value1)); + System.out.println("Completed deleting the file with status code: " + response.statusCode()); + // END: com.azure.storage.file.DirectoryClient.deleteWithResponse#Context } /** @@ -434,23 +256,20 @@ public void deleteDirectoryAsync() { public void getProperties() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.getProperties - Response response = directoryClient.getProperties(); - System.out.printf("Directory latest modified date is %s.", response.value().lastModified()); + DirectoryProperties response = directoryClient.getProperties(); + System.out.printf("Directory latest modified date is %s.", response.lastModified()); // END: com.azure.storage.file.directoryClient.getProperties } /** - * Generates a code sample for using {@link DirectoryAsyncClient#getProperties()} + * Generates a code sample for using {@link DirectoryClient#getPropertiesWithResponse(Context)} */ - public void getPropertiesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.getProperties - directoryAsyncClient.getProperties() - .subscribe(response -> { - DirectoryProperties properties = response.value(); - System.out.printf("Directory latest modified date is %s.", properties.lastModified()); - }); - // END: com.azure.storage.file.directoryAsyncClient.getProperties + public void getPropertiesWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryClient.getPropertiesWithResponse#Context + Response response = directoryClient.getPropertiesWithResponse(new Context(key1, value1)); + System.out.printf("Directory latest modified date is %s.", response.value().lastModified()); + // END: com.azure.storage.file.directoryClient.getPropertiesWithResponse#Context } /** @@ -459,68 +278,57 @@ public void getPropertiesAsync() { public void setMetadata() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.setMetadata#map - Response response = + DirectorySetMetadataInfo response = directoryClient.setMetadata(Collections.singletonMap("directory", "updatedMetadata")); - System.out.printf("Setting the directory metadata completed with status code %d", response.statusCode()); + System.out.printf("Setting the directory metadata completed with updated etag %d", response.eTag()); // END: com.azure.storage.file.directoryClient.setMetadata#map } /** - * Generates a code sample for using {@link DirectoryAsyncClient#setMetadata(Map)} + * Generates a code sample for using {@link DirectoryClient#setMetadataWithResponse(Map, Context)} */ - public void setMetadataAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadata#map - directoryAsyncClient.setMetadata(Collections.singletonMap("directory", "updatedMetadata")) - .subscribe(response -> System.out.printf("Setting the directory metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.directoryAsyncClient.setMetadata#map + public void setMetadataWithResponse() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.directoryClient.setMetadataWithResponse#map-Context + Response response = + directoryClient.setMetadataWithResponse(Collections.singletonMap("directory", "updatedMetadata"), + new Context(key1, value1)); + System.out.printf("Setting the directory metadata completed with updated etag %d", response.statusCode()); + // END: com.azure.storage.file.directoryClient.setMetadataWithResponse#map-Context } /** * Generates a code sample for using {@link DirectoryClient#setMetadata(Map)} to clear the metadata. */ - public void clearMetadata() { + public void clearSetMetadata() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.setMetadata#map.clearMetadata - Response response = directoryClient.setMetadata(null); - System.out.printf("Directory latest modified date is %s.", response.statusCode()); + DirectorySetMetadataInfo response = directoryClient.setMetadata(null); + System.out.printf("Cleared metadata."); // END: com.azure.storage.file.directoryClient.setMetadata#map.clearMetadata } /** - * Generates a code sample for using {@link DirectoryAsyncClient#setMetadata(Map)} to clear the metadata. + * Generates a code sample for using {@link DirectoryClient#setMetadata(Map)} to clear the metadata. */ - public void clearMetadataAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadata#map.clearMetadata - directoryAsyncClient.setMetadata(null) - .subscribe(response -> System.out.printf("Clearing the directory metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.directoryAsyncClient.setMetadata#map.clearMetadata + public void clearMetadata() { + DirectoryClient directoryClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.DirectoryClient.setMetadataWithResponse#Map-Context.clearMetadata + Response response = directoryClient.setMetadataWithResponse(null, + new Context(key1, value1)); + System.out.printf("Directory latest modified date is %s.", response.statusCode()); + // END: com.azure.storage.file.DirectoryClient.setMetadataWithResponse#Map-Context.clearMetadata } /** - * Generates a code sample for using {@link DirectoryClient#getHandles(Integer, boolean)} + * Generates a code sample for using {@link DirectoryClient#listHandles(Integer, boolean)} */ - public void getHandles() { + public void listHandles() { DirectoryClient directoryClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryClient.getHandles - Iterable result = directoryClient.getHandles(10, true); + // BEGIN: com.azure.storage.file.directoryClient.listHandles#Integer-boolean + Iterable result = directoryClient.listHandles(10, true); System.out.printf("Get handles completed with handle id %s", result.iterator().next().handleId()); - // END: com.azure.storage.file.directoryClient.getHandles - } - - /** - * Generates a code sample for using {@link DirectoryAsyncClient#getHandles(Integer, boolean)} - */ - public void getHandlesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.getHandles - directoryAsyncClient.getHandles(10, true) - .subscribe(handleItem -> System.out.printf("Get handles completed with handle id %s", - handleItem.handleId())); - // END: com.azure.storage.file.directoryAsyncClient.getHandles + // END: com.azure.storage.file.directoryClient.listHandles#Integer-boolean } /** @@ -529,7 +337,7 @@ public void getHandlesAsync() { public void forceCloseHandles() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.forceCloseHandles - Iterable result = directoryClient.getHandles(10, true); + Iterable result = directoryClient.listHandles(10, true); result.forEach(handleItem -> { directoryClient.forceCloseHandles(handleItem.handleId(), true).forEach(numOfClosedHandles -> System.out.printf("Get handles completed with handle id %s", handleItem.handleId())); @@ -537,21 +345,6 @@ public void forceCloseHandles() { // END: com.azure.storage.file.directoryClient.forceCloseHandles } - /** - * Generates a code sample for using {@link DirectoryAsyncClient#forceCloseHandles(String, boolean)} - */ - public void forceCloseHandlesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.directoryAsyncClient.forceCloseHandles - directoryAsyncClient.getHandles(10, true) - .subscribe(handleItem -> { - directoryAsyncClient.forceCloseHandles(handleItem.handleId(), true) - .subscribe(numOfClosedHandles -> - System.out.printf("Close %d handles.", numOfClosedHandles)); - }); - // END: com.azure.storage.file.directoryAsyncClient.forceCloseHandles - } - /** * Generates a code sample for using {@link DirectoryClient#getShareSnapshotId()} */ @@ -565,24 +358,8 @@ public void getShareSnapshotId() { .directoryPath("mydirectory") .snapshot(currentTime.toString()) .buildClient(); - directoryClient.getShareSnapshotId(); - // END: com.azure.storage.file.directoryClient.getShareSnapshotId - } - /** - * Generates a code sample for using {@link DirectoryAsyncClient#getShareSnapshotId()} - */ - public void getShareSnapshotIdAsync() { - // BEGIN: com.azure.storage.file.directoryAsyncClient.getShareSnapshotId - OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() - .endpoint("https://${accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) - .shareName("myshare") - .directoryPath("mydirectory") - .snapshot(currentTime.toString()) - .buildAsyncClient(); - directoryAsyncClient.getShareSnapshotId(); - // END: com.azure.storage.file.directoryAsyncClient.getShareSnapshotId + System.out.printf("Snapshot ID: %s%n", directoryClient.getShareSnapshotId()); + // END: com.azure.storage.file.directoryClient.getShareSnapshotId } } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java index 4e7193286232..000d0bc00f85 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectorySample.java @@ -2,7 +2,6 @@ // Licensed under the MIT License. package com.azure.storage.file; -import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.models.DirectoryProperties; import com.azure.storage.file.models.StorageErrorException; @@ -49,10 +48,9 @@ public static void main(String[] args) { } // Create a 1KB file under the child directory. - DirectoryClient childDirClient = null; + DirectoryClient childDirClient = directoryClient.getSubDirectoryClient(childDirectoryName); String fileName = generateRandomName(); try { - childDirClient = directoryClient.getSubDirectoryClient(childDirectoryName); childDirClient.createFile(fileName, 1024); } catch (StorageErrorException e) { System.out.println("Failed to create a file under the child directory. Reasons: " + e.getMessage()); @@ -68,19 +66,16 @@ public static void main(String[] args) { // List all the sub directories and files. try { directoryClient.listFilesAndDirectories().forEach( - fileRef -> { - System.out.printf("Is the resource a directory? %b. The resource name is: ", fileRef.isDirectory(), - fileRef.name()); - } - ); + fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s%n", + fileRef.isDirectory(), fileRef.name())); } catch (StorageErrorException e) { System.out.println("Failed to list all the subdirectories and files. Reasons: " + e.getMessage()); } // Get the parent directory properties. try { - Response propertiesResponse = directoryClient.getProperties(); - System.out.printf("This is the eTag %s of the directory: ", propertiesResponse.value().eTag()); + DirectoryProperties propertiesResponse = directoryClient.getProperties(); + System.out.printf("This is the eTag of the directory: %s%n", propertiesResponse.eTag()); } catch (StorageErrorException e) { System.out.println("Failed to get the properties of the parent directory"); } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java new file mode 100644 index 000000000000..4908c836e037 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java @@ -0,0 +1,588 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.storage.file; + +import com.azure.storage.common.Utility; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileProperties; +import com.azure.storage.file.models.FileRange; +import reactor.core.publisher.Flux; + +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Collections; +import java.util.Map; + +/** + * Contains code snippets when generating javadocs through doclets for {@link FileClient} and {@link FileAsyncClient}. + */ +public class FileAsyncJavaDocCodeSamples { + + /** + * Generates code sample for {@link FileAsyncClient} instantiation. + */ + public void asyncInitialization() { + // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation + FileAsyncClient client = new FileClientBuilder() + .connectionString("${connectionString}") + .endpoint("${endpoint}") + .buildAsyncClient(); + // END: com.azure.storage.file.fileAsyncClient.instantiation + } + + + /** + * Generates code sample for creating a {@link FileAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link FileAsyncClient} + */ + public FileAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.sastoken + FileAsyncClient fileAsyncClient = new FileClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") + .shareName("myshare") + .filePath("myfilepath") + .buildAsyncClient(); + // END: com.azure.storage.file.fileAsyncClient.instantiation.sastoken + return fileAsyncClient; + } + + /** + * Generates code sample for creating a {@link FileAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link FileAsyncClient} + */ + public FileAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.credential + FileAsyncClient fileAsyncClient = new FileClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) + .shareName("myshare") + .filePath("myfilepath") + .buildAsyncClient(); + // END: com.azure.storage.file.fileAsyncClient.instantiation.credential + return fileAsyncClient; + } + + /** + * Generates code sample for creating a {@link FileAsyncClient} with {@code connectionString} + * which turns into {@link SharedKeyCredential} + * @return An instance of {@link FileAsyncClient} + */ + public FileAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + FileAsyncClient fileAsyncClient = new FileClientBuilder() + .connectionString(connectionString).shareName("myshare").filePath("myfilepath") + .buildAsyncClient(); + // END: com.azure.storage.file.fileAsyncClient.instantiation.connectionstring + return fileAsyncClient; + } + + + /** + * Generates a code sample for using {@link FileAsyncClient#create(long)} + */ + public void createFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.create + fileAsyncClient.create(1024).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.create + } + + /** + * Generates a code sample for using {@link FileAsyncClient#create(long)} + */ + public void createFileAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); + fileAsyncClient.create(1024) + .doOnSuccess(response -> System.out.println("Creating the file completed.")); + // END: com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#createWithResponse(long, FileHTTPHeaders, Map)} + */ + public void createWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.createWithResponse#long-filehttpheaders-map + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); + fileAsyncClient.createWithResponse(1024, httpHeaders, Collections.singletonMap("file", + "updatedMetadata")) + .subscribe(response -> System.out.printf("Creating the file completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.createWithResponse#long-filehttpheaders-map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#startCopy(String, Map)} + */ + public void copyFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.startCopy#string-map + fileAsyncClient.startCopy("https://{accountName}.file.core.windows.net?{SASToken}", + Collections.singletonMap("file", "metadata")).subscribe( + response -> System.out.println("Successfully copied the file;"), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete copying the file.") + ); + // END: com.azure.storage.file.fileAsyncClient.startCopy#string-map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#startCopyWithResponse(String, Map)} + */ + public void startCopyWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.startCopyWithResponse#string-map + fileAsyncClient.startCopyWithResponse("https://{accountName}.file.core.windows.net?{SASToken}", + Collections.singletonMap("file", "metadata")).subscribe( + response -> + System.out.println("Successfully copying the file with status code: " + response.statusCode()), + error -> System.err.println(error.toString()) + ); + // END: com.azure.storage.file.fileAsyncClient.startCopyWithResponse#string-map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#abortCopy(String)} + */ + public void abortCopyFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.abortCopy#string + fileAsyncClient.abortCopy("someCopyId") + .doOnSuccess(response -> System.out.println("Abort copying the file completed.")); + // END: com.azure.storage.file.fileAsyncClient.abortCopy#string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#abortCopyWithResponse(String)} + */ + public void abortCopyWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.abortCopyWithResponse#string + fileAsyncClient.abortCopyWithResponse("someCopyId") + .subscribe(response -> System.out.printf("Abort copying the file completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.abortCopyWithResponse#string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#upload(Flux, long)} + */ + public void uploadDataAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.upload#flux-long + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + fileAsyncClient.upload(Flux.just(defaultData), defaultData.remaining()).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete deleting the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.upload#flux-long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#upload(Flux, long, long)} + */ + public void uploadDataMaxOverloadAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.upload#flux-long-long + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + fileAsyncClient.upload(Flux.just(defaultData), defaultData.remaining()).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete deleting the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.upload#flux-long-long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#uploadWithResponse(Flux, long)} + */ + public void uploadWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + fileAsyncClient.uploadWithResponse(Flux.just(defaultData), defaultData.remaining()).subscribe( + response -> System.out.println("Complete deleting the file with status code:" + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#uploadWithResponse(Flux, long, long)} + */ + public void uploadWithResponseOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long-long + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + fileAsyncClient.uploadWithResponse(Flux.just(defaultData), defaultData.remaining(), 1024).subscribe( + response -> System.out.println("Complete deleting the file with status code" + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long-long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#clearRange(long)} + */ + public void clearRangeAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.clearRange#long + fileAsyncClient.clearRange(1024).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete clearing the range!") + ); + // END: com.azure.storage.file.fileAsyncClient.clearRange#long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#clearRangeWithResponse(long, long)} + */ + public void clearRangeAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.clearRange#long-long + fileAsyncClient.clearRangeWithResponse(1024, 1024).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete clearing the range!") + ); + // END: com.azure.storage.file.fileAsyncClient.clearRange#long-long + } + + /** + * Generates a code sample for using {@link FileAsyncClient#uploadFromFile(String)} + */ + public void uploadFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.uploadFromFile#string + fileAsyncClient.uploadFromFile("someFilePath").subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete deleting the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.uploadFromFile#string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#downloadWithProperties()} + */ + public void downloadDataAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithProperties + fileAsyncClient.downloadWithProperties().subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete downloading the data!") + ); + // END: com.azure.storage.file.fileAsyncClient.downloadWithProperties + } + + /** + * Generates a code sample for using {@link FileAsyncClient#downloadWithPropertiesWithResponse(FileRange, Boolean)} + */ + public void downloadDataAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean + fileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(1024, 2047L), false). + subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete downloading the data!") + ); + // END: com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean + } + + /** + * Generates a code sample for using {@link FileAsyncClient#downloadWithPropertiesWithResponse(FileRange, Boolean)} + */ + public void downloadWithPropertiesWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithPropertiesWithResponse#filerange-boolean + fileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(1024, 2047L), false) + .subscribe( + response -> System.out.println("Complete downloading the data with status code: " + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.file.fileAsyncClient.downloadWithPropertiesWithResponse#filerange-boolean + } + + /** + * Generates a code sample for using {@link FileAsyncClient#downloadToFile(String)} + */ + public void downloadFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.downloadToFile#string + fileAsyncClient.downloadToFile("somelocalfilepath").subscribe( + response -> { + if (Files.exists(Paths.get("somelocalfilepath"))) { + System.out.println("Successfully downloaded the file."); + } + }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete downloading the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.downloadToFile#string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#downloadToFile(String, FileRange)} + */ + public void downloadFileAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.downloadToFile#string-filerange + fileAsyncClient.downloadToFile("somelocalfilepath", new FileRange(1024, 2047L)).subscribe( + response -> { + if (Files.exists(Paths.get("somelocalfilepath"))) { + System.out.println("Successfully downloaded the file."); + } + }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete downloading the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.downloadToFile#string-filerange + } + + /** + * Generates a code sample for using {@link FileAsyncClient#delete()} + */ + public void deleteFileAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.delete + fileAsyncClient.delete().subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete deleting the file!") + ); + // END: com.azure.storage.file.fileAsyncClient.delete + } + + /** + * Generates a code sample for using {@link FileAsyncClient#deleteWithResponse()} + */ + public void deleteWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.deleteWithResponse + fileAsyncClient.deleteWithResponse().subscribe( + response -> System.out.println("Complete deleting the file with status code:" + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.file.fileAsyncClient.deleteWithResponse + } + + /** + * Generates a code sample for using {@link FileAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.getProperties + fileAsyncClient.getProperties() + .subscribe(properties -> { + System.out.printf("File latest modified date is %s.", properties.lastModified()); + }); + // END: com.azure.storage.file.fileAsyncClient.getProperties + } + + /** + * Generates a code sample for using {@link FileAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.getPropertiesWithResponse + fileAsyncClient.getPropertiesWithResponse() + .subscribe(response -> { + FileProperties properties = response.value(); + System.out.printf("File latest modified date is %s.", properties.lastModified()); + }); + // END: com.azure.storage.file.fileAsyncClient.getPropertiesWithResponse + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} + */ + public void setMetadataAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadata#map + fileAsyncClient.setMetadata(Collections.singletonMap("file", "updatedMetadata")) + .doOnSuccess(response -> System.out.println("Setting the file metadata completed.")); + // END: com.azure.storage.file.fileAsyncClient.setMetadata#map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} + */ + public void setMetadataWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map + fileAsyncClient.setMetadataWithResponse(Collections.singletonMap("file", "updatedMetadata")) + .subscribe(response -> System.out.printf("Setting the file metadata completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setMetadataWithResponse(Map)} to clear metadata. + */ + public void clearMetadataAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map.clearMetadata + fileAsyncClient.setMetadataWithResponse(null).subscribe( + response -> System.out.printf("Setting the file metadata completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map.clearMetadata + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} to clear metadata. + */ + public void clearMetadata() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata + fileAsyncClient.setMetadata(null).subscribe( + response -> System.out.println("Setting the file metadata completed.") + ); + // END: com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setHttpHeaders(long, FileHTTPHeaders)} + */ + public void setHTTPHeadersAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); + fileAsyncClient.setHttpHeaders(1024, httpHeaders) + .doOnSuccess(response -> System.out.println("Setting the file httpHeaders completed.")); + // END: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setHttpHeadersWithResponse(long, FileHTTPHeaders)} + */ + public void setHttpHeadersWithResponse() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setHttpHeadersWithResponse#long-filehttpheaders + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); + fileAsyncClient.setHttpHeadersWithResponse(1024, httpHeaders) + .subscribe(response -> System.out.printf("Setting the file httpHeaders completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.setHttpHeadersWithResponse#long-filehttpheaders + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setHttpHeadersWithResponse(long, FileHTTPHeaders)} + * to clear httpHeaders. + */ + public void clearHTTPHeadersAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setHttpHeadersWithResponse#long-filehttpheaders.clearHttpHeaders + fileAsyncClient.setHttpHeadersWithResponse(1024, null) + .subscribe(response -> System.out.printf("Setting the file httpHeaders completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileAsyncClient.setHttpHeadersWithResponse#long-filehttpheaders.clearHttpHeaders + } + + /** + * Generates a code sample for using {@link FileAsyncClient#setHttpHeaders(long, FileHTTPHeaders)} + * to clear httpHeaders. + */ + public void clearHTTPHeaders() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders + fileAsyncClient.setHttpHeaders(1024, null) + .subscribe(response -> System.out.println("Setting the file httpHeaders completed.")); + // END: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders + } + + /** + * Generates a code sample for using {@link FileAsyncClient#listRanges()} + */ + public void listRangesAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.listRanges + fileAsyncClient.listRanges().subscribe(range -> + System.out.printf("List ranges completed with start: %d, end: %d", range.start(), range.end())); + // END: com.azure.storage.file.fileAsyncClient.listRanges + } + + /** + * Generates a code sample for using {@link FileAsyncClient#listRanges(FileRange)} + */ + public void listRangesAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.listRanges#filerange + fileAsyncClient.listRanges(new FileRange(1024, 2048L)) + .subscribe(result -> System.out.printf("List ranges completed with start: %d, end: %d", + result.start(), result.end())); + // END: com.azure.storage.file.fileAsyncClient.listRanges#filerange + } + + /** + * Generates a code sample for using {@link FileAsyncClient#listHandles()} + */ + public void listHandlesAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.listHandles + fileAsyncClient.listHandles() + .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId())); + // END: com.azure.storage.file.fileAsyncClient.listHandles + } + + /** + * Generates a code sample for using {@link FileAsyncClient#listHandles(Integer)} + */ + public void listHandlesAsyncMaxOverload() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.listHandles#integer + fileAsyncClient.listHandles(10) + .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId())); + // END: com.azure.storage.file.fileAsyncClient.listHandles#integer + } + + /** + * Generates a code sample for using {@link FileAsyncClient#forceCloseHandles(String)} + */ + public void forceCloseHandlesAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileAsyncClient.forceCloseHandles#string + fileAsyncClient.listHandles(10) + .subscribe(result -> { + fileAsyncClient.forceCloseHandles(result.handleId()).subscribe(numOfClosedHandles -> + System.out.printf("Close %d handles.", numOfClosedHandles)); + }); + // END: com.azure.storage.file.fileAsyncClient.forceCloseHandles#string + } + + /** + * Generates a code sample for using {@link FileAsyncClient#getShareSnapshotId()} + */ + public void getShareSnapshotIdAsync() { + // BEGIN: com.azure.storage.file.fileAsyncClient.getShareSnapshotId + OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); + FileAsyncClient fileAsyncClient = new FileClientBuilder() + .endpoint("https://${accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) + .shareName("myshare") + .filePath("myfiile") + .snapshot(currentTime.toString()) + .buildAsyncClient(); + + System.out.printf("Snapshot ID: %s%n", fileAsyncClient.getShareSnapshotId()); + // END: com.azure.storage.file.fileAsyncClient.getShareSnapshotId + } +} diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java index bbbb206f09c8..e1b1c5d177cb 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java @@ -5,6 +5,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; import com.azure.storage.common.Utility; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.FileCopyInfo; @@ -14,12 +15,9 @@ import com.azure.storage.file.models.FileMetadataInfo; import com.azure.storage.file.models.FileProperties; import com.azure.storage.file.models.FileRange; -import com.azure.storage.file.models.FileRangeWriteType; import com.azure.storage.file.models.FileUploadInfo; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import reactor.core.publisher.Flux; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; @@ -33,6 +31,10 @@ * Contains code snippets when generating javadocs through doclets for {@link FileClient} and {@link FileAsyncClient}. */ public class FileJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for {@link FileClient} instantiation. */ @@ -45,18 +47,6 @@ public void initialization() { // END: com.azure.storage.file.fileClient.instantiation } - /** - * Generates code sample for {@link FileAsyncClient} instantiation. - */ - public void asyncInitialization() { - // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation - FileAsyncClient client = new FileClientBuilder() - .connectionString("${connectionString}") - .endpoint("${endpoint}") - .buildAsyncClient(); - // END: com.azure.storage.file.fileAsyncClient.instantiation - } - /** * Generates code sample for creating a {@link FileClient} with {@link SASTokenCredential} * @return An instance of {@link FileClient} @@ -73,20 +63,6 @@ public FileClient createClientWithSASToken() { return fileClient; } - /** - * Generates code sample for creating a {@link FileAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link FileAsyncClient} - */ - public FileAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.sastoken - FileAsyncClient fileAsyncClient = new FileClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") - .shareName("myshare") - .filePath("myfilepath") - .buildAsyncClient(); - // END: com.azure.storage.file.fileAsyncClient.instantiation.sastoken - return fileAsyncClient; - } /** * Generates code sample for creating a {@link FileClient} with {@link SASTokenCredential} @@ -106,23 +82,8 @@ public FileClient createClientWithCredential() { } /** - * Generates code sample for creating a {@link FileAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link FileAsyncClient} - */ - public FileAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.credential - FileAsyncClient fileAsyncClient = new FileClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) - .shareName("myshare") - .filePath("myfilepath") - .buildAsyncClient(); - // END: com.azure.storage.file.fileAsyncClient.instantiation.credential - return fileAsyncClient; - } - - /** - * Generates code sample for creating a {@link FileClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * Generates code sample for creating a {@link FileClient} with {@code connectionString} + * which turns into {@link SharedKeyCredential} * @return An instance of {@link FileClient} */ public FileClient createClientWithConnectionString() { @@ -136,98 +97,54 @@ public FileClient createClientWithConnectionString() { return fileClient; } - /** - * Generates code sample for creating a {@link FileAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link FileAsyncClient} - */ - public FileAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" - + "EndpointSuffix={core.windows.net}"; - FileAsyncClient fileAsyncClient = new FileClientBuilder() - .connectionString(connectionString).shareName("myshare").filePath("myfilepath") - .buildAsyncClient(); - // END: com.azure.storage.file.fileAsyncClient.instantiation.connectionstring - return fileAsyncClient; - } - /** * Generates a code sample for using {@link FileClient#create(long)} */ public void createFile() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.create - Response response = fileClient.create(1024); - System.out.println("Complete creating the file with status code: " + response.statusCode()); + FileInfo response = fileClient.create(1024); + System.out.println("Complete creating the file."); // END: com.azure.storage.file.fileClient.create } /** - * Generates a code sample for using {@link FileAsyncClient#create(long)} + * Generates a code sample for using {@link FileClient#createWithResponse(long, FileHTTPHeaders, Map, Context)} */ - public void createFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.create - fileAsyncClient.create(1024).subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.create - } - - /** - * Generates a code sample for using {@link FileClient#create(long, FileHTTPHeaders, Map)} - */ - public void createFileMaxOverload() { + public void createWithResponse() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.create#long-filehttpheaders-map + // BEGIN: com.azure.storage.file.fileClient.createWithResponse#long-filehttpheaders-map-Context FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - Response response = fileClient.create(1024, httpHeaders, - Collections.singletonMap("file", "updatedMetadata")); + Response response = fileClient.createWithResponse(1024, httpHeaders, + Collections.singletonMap("file", "updatedMetadata"), new Context(key1, value1)); System.out.printf("Creating the file completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileClient.create#long-filehttpheaders-map - } - - /** - * Generates a code sample for using {@link FileAsyncClient#create(long, FileHTTPHeaders, Map)} - */ - public void createFileAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - fileAsyncClient.create(1024, httpHeaders, Collections.singletonMap("file", "updatedMetadata")) - .subscribe(response -> System.out.printf("Creating the file completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map + // END: com.azure.storage.file.fileClient.createWithResponse#long-filehttpheaders-map-Context } /** * Generates a code sample for using {@link FileClient#startCopy(String, Map)} */ - public void copyFile() { + public void startCopy() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.startCopy#string-map - Response response = fileClient.startCopy( + FileCopyInfo response = fileClient.startCopy( "https://{accountName}.file.core.windows.net?{SASToken}", Collections.singletonMap("file", "metadata")); - System.out.println("Complete copying the file with status code: " + response.statusCode()); + System.out.println("Complete copying the file with copy Id: " + response.copyId()); // END: com.azure.storage.file.fileClient.startCopy#string-map } /** - * Generates a code sample for using {@link FileClient#startCopy(String, Map)} + * Generates a code sample for using {@link FileClient#startCopyWithResponse(String, Map, Context)} */ - public void copyFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.startCopy#string-map - fileAsyncClient.startCopy("https://{accountName}.file.core.windows.net?{SASToken}", - Collections.singletonMap("file", "metadata")).subscribe( - response -> System.out.println("Successfully copying the file with status code: " + response.statusCode()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete copying the file.") - ); - // END: com.azure.storage.file.fileAsyncClient.startCopy#string-map + public void startCopyWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.startCopyWithResponse#string-map-Context + Response response = fileClient.startCopyWithResponse( + "https://{accountName}.file.core.windows.net?{SASToken}", + Collections.singletonMap("file", "metadata"), new Context(key1, value1)); + System.out.println("Complete copying the file with copy Id: " + response.value().copyId()); + // END: com.azure.storage.file.fileClient.startCopyWithResponse#string-map-Context } /** @@ -236,77 +153,81 @@ public void copyFileAsync() { public void abortCopyFile() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.abortCopy#string - VoidResponse response = fileClient.abortCopy("someCopyId"); - System.out.printf("Abort copying the file completed with status code %d", response.statusCode()); + fileClient.abortCopy("someCopyId"); + System.out.printf("Abort copying the file completed."); // END: com.azure.storage.file.fileClient.abortCopy#string } /** - * Generates a code sample for using {@link FileClient#abortCopy(String)} + * Generates a code sample for using {@link FileClient#abortCopyWithResponse(String, Context)} */ - public void abortCopyFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.abortCopy#string - fileAsyncClient.abortCopy("someCopyId") - .subscribe(response -> System.out.printf("Abort copying the file completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.abortCopy#string + public void abortCopyWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.abortCopyWithResponse#string-Context + VoidResponse response = fileClient.abortCopyWithResponse("someCopyId", new Context(key1, value1)); + System.out.printf("Abort copying the file completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.fileClient.abortCopyWithResponse#string-Context } /** - * Generates a code sample for using {@link FileClient#upload(ByteBuf, long)} + * Generates a code sample for using {@link FileClient#upload(ByteBuffer, long)} */ public void uploadData() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.upload#flux-long - ByteBuf defaultData = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8)); - Response response = fileClient.upload(defaultData, defaultData.readableBytes()); - System.out.println("Complete uploading the data with status code: " + response.statusCode()); - // END: com.azure.storage.file.fileClient.upload#flux-long + // BEGIN: com.azure.storage.file.fileClient.upload#bytebuffer-long + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + FileUploadInfo response = fileClient.upload(defaultData, defaultData.remaining()); + System.out.println("Complete uploading the data with eTag: " + response.eTag()); + // END: com.azure.storage.file.fileClient.upload#bytebuffer-long } /** - * Generates a code sample for using {@link FileAsyncClient#upload(Flux, long)} + * Generates a code sample for using {@link FileClient#uploadWithResponse(ByteBuffer, long, Context)} */ - public void uploadDataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.upload#flux-long - ByteBuf defaultData = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8)); - fileAsyncClient.upload(Flux.just(defaultData), defaultData.readableBytes()).subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete deleting the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.upload#flux-long + public void uploadWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-Context + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + Response response = fileClient.uploadWithResponse(defaultData, defaultData.remaining(), + new Context(key1, value1)); + System.out.println("Complete uploading the data with status code: " + response.statusCode()); + // END: com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-Context } /** - * Generates a code sample for using {@link FileClient#upload(ByteBuf, long, int, FileRangeWriteType)} + * Generates a code sample for using {@link FileClient#uploadWithResponse(ByteBuffer, long, long, Context)} */ - public void uploadDataMaxOverload() { + public void uploadWithResponseMaxOverload() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.upload#bytebuf-long-int-filerangewritetype - ByteBuf defaultData = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8)); - Response response = fileClient.upload(defaultData, defaultData.readableBytes(), 1024, - FileRangeWriteType.UPDATE); + // BEGIN: com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-long-Context + ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); + Response response = fileClient.uploadWithResponse(defaultData, defaultData.remaining(), + 1024, new Context(key1, value1)); System.out.println("Complete uploading the data with status code: " + response.statusCode()); - // END: com.azure.storage.file.fileClient.upload#bytebuf-long-int-filerangewritetype + // END: com.azure.storage.file.fileClient.uploadWithResponse#bytebuffer-long-long-Context } /** - * Generates a code sample for using {@link FileAsyncClient#upload(Flux, long)} + * Generates a code sample for using {@link FileClient#clearRange(long)} */ - public void uploadDataAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.upload#bytebuf-long-int-filerangewritetype - ByteBuf defaultData = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8)); - fileAsyncClient.upload(Flux.just(defaultData), defaultData.readableBytes(), 1024, - FileRangeWriteType.UPDATE).subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete deleting the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.upload#bytebuf-long-int-filerangewritetype + public void clearRange() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.clearRange#long + FileUploadInfo response = fileClient.clearRange(1024); + System.out.println("Complete clearing the range with eTag: " + response.eTag()); + // END: com.azure.storage.file.fileClient.clearRange#long + } + + /** + * Generates a code sample for using {@link FileClient#clearRangeWithResponse(long, long, Context)} + */ + public void clearRangeMaxOverload() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.clearRangeWithResponse#long-long-Context + Response response = fileClient.clearRangeWithResponse(1024, 1024, + new Context(key1, value1)); + System.out.println("Complete clearing the range with status code: " + response.statusCode()); + // END: com.azure.storage.file.fileClient.clearRangeWithResponse#long-long-Context } /** @@ -320,60 +241,30 @@ public void uploadFile() { } /** - * Generates a code sample for using {@link FileAsyncClient#uploadFromFile(String)} - */ - public void uploadFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.uploadFromFile#string - fileAsyncClient.uploadFromFile("someFilePath").subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete deleting the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.uploadFromFile#string - } - - /** - * Generates a code sample for using {@link FileClient#uploadFromFile(String, FileRangeWriteType)} + * Generates a code sample for using {@link FileClient#uploadFromFile(String)} */ public void uploadFileMaxOverload() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.uploadFromFile#string-filerangewritetype - fileClient.uploadFromFile("someFilePath", FileRangeWriteType.UPDATE); + fileClient.uploadFromFile("someFilePath"); if (fileClient.getProperties() != null) { System.out.printf("Upload the file with length of %d completed", - fileClient.getProperties().value().contentLength()); + fileClient.getProperties().contentLength()); } // END: com.azure.storage.file.fileClient.uploadFromFile#string-filerangewritetype } - /** - * Generates a code sample for using {@link FileAsyncClient#uploadFromFile(String, FileRangeWriteType)} - */ - public void uploadFileAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.uploadFromFile#string-filerangewritetype - fileAsyncClient.uploadFromFile("someFilePath", FileRangeWriteType.UPDATE) - .subscribe(response -> { - if (fileAsyncClient.getProperties() != null) { - System.out.printf("Upload the file with length of %d completed", - fileAsyncClient.getProperties().block().value().contentLength()); - } - }); - // END: com.azure.storage.file.fileAsyncClient.uploadFromFile#string-filerangewritetype - } - /** * Generates a code sample for using {@link FileClient#downloadWithProperties()} */ public void downloadData() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.downloadWithProperties - Response response = fileClient.downloadWithProperties(); - System.out.println("Complete downloading the data with status code: " + response.statusCode()); - response.value().body().subscribe( - byteBuf -> System.out.println("Complete downloading the data with body: " - + byteBuf.toString(StandardCharsets.UTF_8)), + FileDownloadInfo response = fileClient.downloadWithProperties(); + System.out.println("Complete downloading the data."); + response.body().subscribe( + byteBuffer -> System.out.println("Complete downloading the data with body: " + + new String(byteBuffer.array(), StandardCharsets.UTF_8)), error -> System.err.print(error.toString()), () -> System.out.println("Complete downloading the data!") ); @@ -381,49 +272,22 @@ public void downloadData() { } /** - * Generates a code sample for using {@link FileAsyncClient#downloadWithProperties()} + * Generates a code sample for using {@link FileClient#downloadWithPropertiesWithResponse( + * FileRange, Boolean, Context)} */ - public void downloadDataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithProperties - fileAsyncClient.downloadWithProperties().subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete downloading the data!") - ); - // END: com.azure.storage.file.fileAsyncClient.downloadWithProperties - } - - /** - * Generates a code sample for using {@link FileClient#downloadWithProperties(FileRange, Boolean)} - */ - public void downloadDataMaxOverload() { + public void downloadWithPropertiesWithResponse() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.downloadWithProperties#filerange-boolean - Response response = fileClient.downloadWithProperties(new FileRange(1024, 2047L), - false); + // BEGIN: com.azure.storage.file.fileClient.downloadWithPropertiesWithResponse#filerange-boolean-Context + Response response = fileClient.downloadWithPropertiesWithResponse(new FileRange(1024, 2047L), + false, new Context(key1, value1)); System.out.println("Complete downloading the data with status code: " + response.statusCode()); response.value().body().subscribe( - byteBuf -> System.out.println("Complete downloading the data with body: " - + byteBuf.toString(StandardCharsets.UTF_8)), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete downloading the data!") - ); - // END: com.azure.storage.file.fileClient.downloadWithProperties#filerange-boolean - } - - /** - * Generates a code sample for using {@link FileAsyncClient#downloadWithProperties(FileRange, Boolean)} - */ - public void downloadDataAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean - fileAsyncClient.downloadWithProperties(new FileRange(1024, 2047L), false).subscribe( - response -> { }, + byteBuffer -> System.out.println("Complete downloading the data with body: " + + new String(byteBuffer.array(), StandardCharsets.UTF_8)), error -> System.err.print(error.toString()), () -> System.out.println("Complete downloading the data!") ); - // END: com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean + // END: com.azure.storage.file.fileClient.downloadWithPropertiesWithResponse#filerange-boolean-Context } /** @@ -439,24 +303,6 @@ public void downloadFile() { // END: com.azure.storage.file.fileClient.downloadToFile#string } - /** - * Generates a code sample for using {@link FileAsyncClient#downloadToFile(String)} - */ - public void downloadFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.downloadToFile#string - fileAsyncClient.downloadToFile("somelocalfilepath").subscribe( - response -> { - if (Files.exists(Paths.get("somelocalfilepath"))) { - System.out.println("Successfully downloaded the file."); - } - }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete downloading the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.downloadToFile#string - } - /** * Generates a code sample for using {@link FileClient#downloadToFile(String, FileRange)} */ @@ -470,47 +316,26 @@ public void downloadFileMaxOverload() { // END: com.azure.storage.file.fileClient.downloadToFile#string-filerange } - /** - * Generates a code sample for using {@link FileAsyncClient#downloadToFile(String, FileRange)} - */ - public void downloadFileAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.downloadToFile#string-filerange - fileAsyncClient.downloadToFile("somelocalfilepath", new FileRange(1024, 2047L)).subscribe( - response -> { - if (Files.exists(Paths.get("somelocalfilepath"))) { - System.out.println("Successfully downloaded the file."); - } - }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete downloading the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.downloadToFile#string-filerange - } - /** * Generates a code sample for using {@link FileClient#delete()} */ public void deleteFile() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.delete - VoidResponse response = fileClient.delete(); - System.out.println("Complete deleting the file with status code: " + response.statusCode()); + fileClient.delete(); + System.out.println("Complete deleting the file."); // END: com.azure.storage.file.fileClient.delete } /** - * Generates a code sample for using {@link FileAsyncClient#delete()} + * Generates a code sample for using {@link FileClient#deleteWithResponse(Context)} */ - public void deleteFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.delete - fileAsyncClient.delete().subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete deleting the file!") - ); - // END: com.azure.storage.file.fileAsyncClient.delete + public void deleteWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.deleteWithResponse#Context + VoidResponse response = fileClient.deleteWithResponse(new Context(key1, value1)); + System.out.println("Complete deleting the file with status code: " + response.statusCode()); + // END: com.azure.storage.file.fileClient.deleteWithResponse#Context } /** @@ -519,24 +344,20 @@ public void deleteFileAsync() { public void getProperties() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.getProperties - Response response = fileClient.getProperties(); - FileProperties properties = response.value(); + FileProperties properties = fileClient.getProperties(); System.out.printf("File latest modified date is %s.", properties.lastModified()); // END: com.azure.storage.file.fileClient.getProperties } /** - * Generates a code sample for using {@link FileAsyncClient#getProperties()} + * Generates a code sample for using {@link FileClient#getPropertiesWithResponse(Context)} */ - public void getPropertiesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.getProperties - fileAsyncClient.getProperties() - .subscribe(response -> { - FileProperties properties = response.value(); - System.out.printf("File latest modified date is %s.", properties.lastModified()); - }); - // END: com.azure.storage.file.fileAsyncClient.getProperties + public void getPropertiesWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.getPropertiesWithResponse#Context + Response response = fileClient.getPropertiesWithResponse(new Context(key1, value1)); + System.out.printf("File latest modified date is %s.", response.value().lastModified()); + // END: com.azure.storage.file.fileClient.getPropertiesWithResponse#Context } /** @@ -545,45 +366,44 @@ public void getPropertiesAsync() { public void setMetadata() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.setMetadata#map - Response response = fileClient.setMetadata( - Collections.singletonMap("file", "updatedMetadata")); - System.out.printf("Setting the file metadata completed with status code %d", response.statusCode()); + fileClient.setMetadata(Collections.singletonMap("file", "updatedMetadata")); + System.out.printf("Setting the file metadata completed."); // END: com.azure.storage.file.fileClient.setMetadata#map } /** - * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} + * Generates a code sample for using {@link FileClient#setMetadataWithResponse(Map, Context)} */ - public void setMetadataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadata#map - fileAsyncClient.setMetadata(Collections.singletonMap("file", "updatedMetadata")) - .subscribe(response -> System.out.printf("Setting the file metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.setMetadata#map + public void setMetadataWithResponse() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context + Response response = fileClient.setMetadataWithResponse( + Collections.singletonMap("file", "updatedMetadata"), new Context(key1, value1)); + System.out.printf("Setting the file metadata completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context } /** - * Generates a code sample for using {@link FileClient#setMetadata(Map)} to clear metadata. + * Generates a code sample for using {@link FileClient#setMetadataWithResponse(Map, Context)} to clear metadata. */ - public void clearMetadata() { + public void clearMetadataWithResponse() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.setMetadata#map.clearMetadata - Response response = fileClient.setMetadata(null); + // BEGIN: com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context.clearMetadata + Response response = fileClient.setMetadataWithResponse(null, + new Context(key1, value1)); System.out.printf("Setting the file metadata completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileClient.setMetadata#map.clearMetadata + // END: com.azure.storage.file.fileClient.setMetadataWithResponse#map-Context.clearMetadata } /** - * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} to clear metadata. + * Generates a code sample for using {@link FileClient#setMetadataWithResponse(Map, Context)} to clear metadata. */ - public void clearMetadataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata - fileAsyncClient.setMetadata(null) - .subscribe(response -> System.out.printf("Setting the file metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata + public void clearMetadata() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.setMetadata#map.clearMetadata + fileClient.setMetadata(null); + System.out.printf("Setting the file metadata completed."); + // END: com.azure.storage.file.fileClient.setMetadata#map.clearMetadata } /** @@ -593,45 +413,46 @@ public void setHTTPHeaders() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - Response response = fileClient.setHttpHeaders(1024, httpHeaders); - System.out.printf("Setting the file httpHeaders completed with status code %d", response.statusCode()); + fileClient.setHttpHeaders(1024, httpHeaders); + System.out.printf("Setting the file httpHeaders completed."); // END: com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders } /** - * Generates a code sample for using {@link FileAsyncClient#setHttpHeaders(long, FileHTTPHeaders)} + * Generates a code sample for using {@link FileClient#setHttpHeaders(long, FileHTTPHeaders)} to clear httpHeaders. */ - public void setHTTPHeadersAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - fileAsyncClient.setHttpHeaders(1024, httpHeaders) - .subscribe(response -> System.out.printf("Setting the file httpHeaders completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders + public void clearSyncHTTPHeaders() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders + FileInfo response = fileClient.setHttpHeaders(1024, null); + System.out.printf("Setting the file httpHeaders completed."); + // END: com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders } /** - * Generates a code sample for using {@link FileClient#setHttpHeaders(long, FileHTTPHeaders)} to clear httpHeaders. + * Generates a code sample for using {@link FileClient#setHttpHeadersWithResponse(long, FileHTTPHeaders, Context)} */ - public void clearHTTPHeaders() { + public void setHttpHeadersWithResponse() { FileClient fileClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders - Response response = fileClient.setHttpHeaders(1024, null); + // BEGIN: com.azure.storage.file.fileClient.setHttpHeadersWithResponse#long-filehttpheaders-Context + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); + Response response = fileClient.setHttpHeadersWithResponse(1024, httpHeaders, + new Context(key1, value1)); System.out.printf("Setting the file httpHeaders completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders + // END: com.azure.storage.file.fileClient.setHttpHeadersWithResponse#long-filehttpheaders-Context } /** - * Generates a code sample for using {@link FileAsyncClient#setHttpHeaders(long, FileHTTPHeaders)} to clear httpHeaders. + * Generates a code sample for using {@link FileClient#setHttpHeadersWithResponse(long, FileHTTPHeaders, Context)} + * (long, FileHTTPHeaders)} to clear httpHeaders. */ - public void clearHTTPHeadersAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders - fileAsyncClient.setHttpHeaders(1024, null) - .subscribe(response -> System.out.printf("Setting the file httpHeaders completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileAsyncClient.setHttpHeaders#long-filehttpheaders.clearHttpHeaders + public void clearHTTPHeaders() { + FileClient fileClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileClient.setHttpHeadersWithResponse#long-filehttpheaders-Context.clearHttpHeaders + Response response = fileClient.setHttpHeadersWithResponse(1024, null, + new Context(key1, value1)); + System.out.printf("Setting the file httpHeaders completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.fileClient.setHttpHeadersWithResponse#long-filehttpheaders-Context.clearHttpHeaders } /** @@ -646,16 +467,6 @@ public void listRanges() { // END: com.azure.storage.file.fileClient.listRanges } - /** - * Generates a code sample for using {@link FileAsyncClient#listRanges()} - */ - public void listRangesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.listRanges - fileAsyncClient.listRanges().subscribe(range -> - System.out.printf("List ranges completed with start: %d, end: %d", range.start(), range.end())); - // END: com.azure.storage.file.fileAsyncClient.listRanges - } /** * Generates a code sample for using {@link FileClient#listRanges(FileRange)} */ @@ -668,17 +479,6 @@ public void listRangesMaxOverload() { // END: com.azure.storage.file.fileClient.listRanges#filerange } - /** - * Generates a code sample for using {@link FileAsyncClient#listRanges(FileRange)} - */ - public void listRangesAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.listRanges#filerange - fileAsyncClient.listRanges(new FileRange(1024, 2048L)) - .subscribe(result -> System.out.printf("List ranges completed with start: %d, end: %d", - result.start(), result.end())); - // END: com.azure.storage.file.fileAsyncClient.listRanges#filerange - } /** * Generates a code sample for using {@link FileClient#listHandles()} */ @@ -686,21 +486,11 @@ public void listHandles() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.listHandles fileClient.listHandles() - .forEach(handleItem -> System.out.printf("List handles completed with handleId %d", + .forEach(handleItem -> System.out.printf("List handles completed with handleId %s", handleItem.handleId())); // END: com.azure.storage.file.fileClient.listHandles } - /** - * Generates a code sample for using {@link FileAsyncClient#listHandles()} - */ - public void listHandlesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.listHandles - fileAsyncClient.listHandles() - .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId())); - // END: com.azure.storage.file.fileAsyncClient.listHandles - } /** * Generates a code sample for using {@link FileClient#listHandles(Integer)} */ @@ -708,21 +498,11 @@ public void listHandlesWithOverload() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.listHandles#integer fileClient.listHandles(10) - .forEach(handleItem -> System.out.printf("List handles completed with handleId %d", + .forEach(handleItem -> System.out.printf("List handles completed with handleId %s", handleItem.handleId())); // END: com.azure.storage.file.fileClient.listHandles#integer } - /** - * Generates a code sample for using {@link FileAsyncClient#listHandles(Integer)} - */ - public void listHandlesAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.listHandles#integer - fileAsyncClient.listHandles(10) - .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId())); - // END: com.azure.storage.file.fileAsyncClient.listHandles#integer - } /** * Generates a code sample for using {@link FileClient#forceCloseHandles(String)} */ @@ -737,20 +517,6 @@ public void forceCloseHandles() { // END: com.azure.storage.file.fileClient.forceCloseHandles#string } - /** - * Generates a code sample for using {@link FileAsyncClient#forceCloseHandles(String)} - */ - public void forceCloseHandlesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileAsyncClient.forceCloseHandles#string - fileAsyncClient.listHandles(10) - .subscribe(result -> { - fileAsyncClient.forceCloseHandles(result.handleId()).subscribe(numOfClosedHandles -> - System.out.printf("Close %d handles.", numOfClosedHandles)); - }); - // END: com.azure.storage.file.fileAsyncClient.forceCloseHandles#string - } - /** * Generates a code sample for using {@link FileClient#getShareSnapshotId()} */ @@ -764,24 +530,8 @@ public void getShareSnapshotId() { .filePath("myfile") .snapshot(currentTime.toString()) .buildClient(); - fileClient.getShareSnapshotId(); - // END: com.azure.storage.file.fileClient.getShareSnapshotId - } - /** - * Generates a code sample for using {@link FileAsyncClient#getShareSnapshotId()} - */ - public void getShareSnapshotIdAsync() { - // BEGIN: com.azure.storage.file.fileAsyncClient.getShareSnapshotId - OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - FileAsyncClient fileAsyncClient = new FileClientBuilder() - .endpoint("https://${accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) - .shareName("myshare") - .filePath("myfiile") - .snapshot(currentTime.toString()) - .buildAsyncClient(); - fileAsyncClient.getShareSnapshotId(); - // END: com.azure.storage.file.fileAsyncClient.getShareSnapshotId + System.out.printf("Snapshot ID: %s%n", fileClient.getShareSnapshotId()); + // END: com.azure.storage.file.fileClient.getShareSnapshotId } } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java index b33587dab198..d6ae6f81d732 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileSample.java @@ -2,18 +2,16 @@ // Licensed under the MIT License. package com.azure.storage.file; -import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.models.CopyStatusType; import com.azure.storage.file.models.FileCopyInfo; import com.azure.storage.file.models.FileProperties; import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import java.io.File; import java.io.IOException; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.UUID; @@ -33,9 +31,8 @@ private static String generateRandomName() { * The main method shows how to do the base operation using file sync client. * @param args No args needed for the main method. * @throws RuntimeException If error occurs when make storage API call. - * @throws Exception If there are any IO exception occurs. */ - public static void main(String[] args) throws Exception { + public static void main(String[] args) { String shareName = generateRandomName(); ShareClient shareClient = new ShareClientBuilder().endpoint(ENDPOINT).shareName(shareName).buildClient(); shareClient.create(); @@ -56,9 +53,9 @@ public static void main(String[] args) throws Exception { // Upload some data bytes to the src file. String dataText = "Hello, file client sample!"; - ByteBuf uploadData = Unpooled.wrappedBuffer(dataText.getBytes(StandardCharsets.UTF_8)); + ByteBuffer uploadData = ByteBuffer.wrap(dataText.getBytes(StandardCharsets.UTF_8)); try { - srcFileClient.upload(uploadData, uploadData.readableBytes()); + srcFileClient.upload(uploadData, uploadData.remaining()); } catch (StorageErrorException e) { System.out.println("Failed to upload the data. Reasons: " + e.getMessage()); } @@ -69,12 +66,11 @@ public static void main(String[] args) throws Exception { destFileClient.create(1024); // Copy the file from source file to destination file. - URL clientURL = null; - clientURL = srcFileClient.getFileUrl(); + URL clientURL = srcFileClient.getFileUrl(); String sourceURL = clientURL.toString() + "/" + shareName + "/" + parentDirName + "/" + srcFileName; - Response copyResponse = null; + FileCopyInfo copyResponse = null; try { copyResponse = destFileClient.startCopy(sourceURL, null); } catch (StorageErrorException e) { @@ -82,17 +78,17 @@ public static void main(String[] args) throws Exception { } // Abort the copy if the status is pending. - if (copyResponse.value().copyStatus() == CopyStatusType.PENDING) { + if (copyResponse.copyStatus() == CopyStatusType.PENDING) { try { - destFileClient.abortCopy(copyResponse.value().copyId()); + destFileClient.abortCopy(copyResponse.copyId()); } catch (StorageErrorException e) { System.out.println("Failed to abort the copy. Reasons: " + e.getMessage()); } } // Upload a local file to the storage. - URL fileFolder = FileSample.class.getClassLoader().getResource("."); - String uploadPath = fileFolder.getPath() + "testfiles/" + "uploadSample.txt"; + String filePath = "C:/filePath/"; + String uploadPath = filePath + "testfiles/" + "uploadSample.txt"; try { srcFileClient.uploadFromFile(uploadPath); @@ -101,11 +97,11 @@ public static void main(String[] args) throws Exception { } // Download storage file to local file. - String downloadPath = fileFolder.getPath() + "testfiles/" + "downloadSample.txt"; + String downloadPath = filePath + "testfiles/" + "downloadSample.txt"; File downloadFile = new File(downloadPath); try { - if (!Files.exists(downloadFile.toPath())) { - downloadFile.createNewFile(); + if (!Files.exists(downloadFile.toPath()) && !downloadFile.createNewFile()) { + throw new RuntimeException("Failed to create new upload file."); } } catch (IOException e) { throw new RuntimeException("Failed to create new upload file."); @@ -116,14 +112,14 @@ public static void main(String[] args) throws Exception { System.out.println("Failed to download file from storage. Reasons: " + e.getMessage()); } - if (!Files.exists(downloadFile.toPath())) { - downloadFile.delete(); + if (Files.exists(downloadFile.toPath()) && !downloadFile.delete()) { + System.out.println("Failed to delete download file."); } // Get the file properties try { - Response propertiesResponse = srcFileClient.getProperties(); - System.out.printf("This is the eTag: %s of the file. File type is : %s.", propertiesResponse.value().eTag(), propertiesResponse.value().fileType()); + FileProperties propertiesResponse = srcFileClient.getProperties(); + System.out.printf("This is the eTag: %s of the file. File type is : %s.", propertiesResponse.eTag(), propertiesResponse.fileType()); } catch (StorageErrorException e) { System.out.println("Failed to get file properties. Reasons: " + e.getMessage()); } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java new file mode 100644 index 000000000000..2d21deebdf90 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.storage.file; + +import com.azure.storage.common.Utility; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.models.FileServiceProperties; +import com.azure.storage.file.models.ListSharesOptions; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Collections; +import java.util.Map; + +/** + * Contains code snippets when generating javadocs through doclets for {@link FileServiceClient} and {@link FileServiceAsyncClient}. + */ +public class FileServiceAsyncJavaDocCodeSamples { + + /** + * Generates code sample for {@link FileServiceAsyncClient} instantiation. + */ + public void asyncInitialization() { + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation + ShareAsyncClient client = new ShareClientBuilder() + .connectionString("${connectionString}") + .endpoint("${endpoint}") + .buildAsyncClient(); + // END: com.azure.storage.file.fileServiceAsyncClient.instantiation + } + + /** + * Generates code sample for creating a {@link FileServiceAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link FileServiceAsyncClient} + */ + public FileServiceAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken + FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") + .buildAsyncClient(); + // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken + return fileServiceAsyncClient; + } + + /** + * Generates code sample for creating a {@link FileServiceAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link FileServiceAsyncClient} + */ + public FileServiceAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.credential + FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) + .buildAsyncClient(); + // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.credential + return fileServiceAsyncClient; + } + + /** + * Generates code sample for creating a {@link FileServiceAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * @return An instance of {@link FileServiceAsyncClient} + */ + public FileServiceAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring + return fileServiceAsyncClient; + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#createShare(String)} + */ + public void createShareAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShare#string + fileServiceAsyncClient.createShare("myshare").subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.createShare#string + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#createShareWithResponse(String, Map, Integer)} with metadata + */ + public void createShareWithResponse() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.metadata + fileServiceAsyncClient.createShareWithResponse("test", Collections.singletonMap("share", "metadata"), null) + .subscribe( + response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.metadata + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#createShareWithResponse(String, Map, Integer)} with quota. + */ + public void createShareAsyncWithQuota() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.quota + fileServiceAsyncClient.createShareWithResponse("test", null, 10) + .subscribe( + response -> System.out.printf("Creating the share completed with status code %d", + response.statusCode()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.quota + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#listShares()} + */ + public void listSharesAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares + fileServiceAsyncClient.listShares().subscribe( + shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete listing the shares!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.listShares + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#listShares(ListSharesOptions)} of prefix. + */ + public void listSharesAsyncWithPrefix() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.prefix + fileServiceAsyncClient.listShares(new ListSharesOptions().prefix("azure")).subscribe( + shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete listing the shares!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.prefix + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#listShares(ListSharesOptions)} of metadata and snapshot. + */ + public void listSharesAsyncWithOverload() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.metadata.snapshot + fileServiceAsyncClient.listShares(new ListSharesOptions().includeMetadata(true) + .includeSnapshots(true)).subscribe( + shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete listing the shares!") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.metadata.snapshot + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#deleteShare(String)} + */ + public void deleteShareAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string + fileServiceAsyncClient.deleteShare("test").doOnSuccess( + response -> System.out.println("Deleting the share completed.") + ); + // END: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#deleteShareWithResponse(String, String)} + */ + public void deleteShareAsyncMaxOverload() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShareWithResponse#string-string + OffsetDateTime midnight = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); + fileServiceAsyncClient.deleteShareWithResponse("test", midnight.toString()) + .subscribe(response -> System.out.printf("Deleting the snapshot completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.fileServiceAsyncClient.deleteShareWithResponse#string-string + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.getProperties + fileServiceAsyncClient.getProperties() + .subscribe(properties -> { + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); + }); + // END: com.azure.storage.file.fileServiceAsyncClient.getProperties + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.getPropertiesWithResponse + fileServiceAsyncClient.getPropertiesWithResponse() + .subscribe(properties -> { + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.value().hourMetrics().enabled(), properties.value().minuteMetrics().enabled()); + }); + // END: com.azure.storage.file.fileServiceAsyncClient.getPropertiesWithResponse + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#setProperties(FileServiceProperties)} + */ + public void setPropertiesAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties + fileServiceAsyncClient.getProperties().subscribe(properties -> { + properties.minuteMetrics().enabled(true); + properties.hourMetrics().enabled(true); + + fileServiceAsyncClient.setProperties(properties) + .subscribe(r -> System.out.println("Setting File service properties completed.")); + }); + // END: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties + } + + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#setPropertiesWithResponse(FileServiceProperties)} + */ + public void setPropertiesWithResponseAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponseAsync#fileServiceProperties + fileServiceAsyncClient.getPropertiesWithResponse().subscribe(response -> { + FileServiceProperties properties = response.value(); + properties.minuteMetrics().enabled(true); + properties.hourMetrics().enabled(true); + + fileServiceAsyncClient.setPropertiesWithResponse(properties).subscribe(r -> + System.out.printf("Setting File service properties completed with status code %d", r.statusCode())); + }); + // END: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponseAsync#fileServiceProperties + } + + /** + * Generates a code sample for using {@link FileServiceAsyncClient#setPropertiesWithResponse(FileServiceProperties)} to clear CORS in file service. + */ + public void clearPropertiesAsync() { + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponse#fileServiceProperties.clearCORS + fileServiceAsyncClient.getProperties().subscribe(properties -> { + properties.cors(Collections.emptyList()); + + fileServiceAsyncClient.setPropertiesWithResponse(properties).subscribe(response -> + System.out.printf("Setting File service properties completed with status code %d", + response.statusCode())); + }); + // END: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponse#fileServiceProperties.clearCORS + } +} diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java index b2f4a959e906..acac6a361c2f 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java @@ -5,11 +5,11 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; import com.azure.storage.common.Utility; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.FileServiceProperties; import com.azure.storage.file.models.ListSharesOptions; - import java.time.LocalDateTime; import java.time.OffsetDateTime; import java.time.ZoneOffset; @@ -20,6 +20,10 @@ * Contains code snippets when generating javadocs through doclets for {@link FileServiceClient} and {@link FileServiceAsyncClient}. */ public class FileServiceJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for {@link FileServiceClient} instantiation. */ @@ -56,19 +60,6 @@ public FileServiceClient createClientWithSASToken() { return fileServiceClient; } - /** - * Generates code sample for creating a {@link FileServiceAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link FileServiceAsyncClient} - */ - public FileServiceAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken - FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") - .buildAsyncClient(); - // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken - return fileServiceAsyncClient; - } - /** * Generates code sample for creating a {@link FileServiceClient} with {@link SASTokenCredential} * {@code SASTokenQueryParams} is composed of the Key @@ -84,20 +75,6 @@ public FileServiceClient createClientWithCredential() { return fileServiceClient; } - /** - * Generates code sample for creating a {@link FileServiceAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link FileServiceAsyncClient} - */ - public FileServiceAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.credential - FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) - .buildAsyncClient(); - // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.credential - return fileServiceAsyncClient; - } - /** * Generates code sample for creating a {@link FileServiceClient} with {@code connectionString} which turns into {@link SharedKeyCredential} * @return An instance of {@link FileServiceClient} @@ -113,20 +90,6 @@ public FileServiceClient createClientWithConnectionString() { return fileServiceClient; } - /** - * Generates code sample for creating a {@link FileServiceAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link FileServiceAsyncClient} - */ - public FileServiceAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" - + "EndpointSuffix={core.windows.net}"; - FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() - .connectionString(connectionString) - .buildAsyncClient(); - // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring - return fileServiceAsyncClient; - } /** * Generates a code sample for using {@link FileServiceClient#createShare(String)} @@ -134,77 +97,21 @@ public FileServiceAsyncClient createAsyncClientWithConnectionString() { public void createShare() { FileServiceClient fileServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileServiceClient.createShare#string - Response response = fileServiceClient.createShare("myshare"); - System.out.printf("Creating the share completed with status code %d", response.statusCode()); + fileServiceClient.createShare("myshare"); + System.out.println("Creating the share completed."); // END: com.azure.storage.file.fileServiceClient.createShare#string } /** - * Generates a code sample for using {@link FileServiceAsyncClient#createShare(String)} - */ - public void createShareAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShare#string - fileServiceAsyncClient.createShare("myshare").subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.createShare#string - } - - /** - * Generates a code sample for using {@link FileServiceClient#createShare(String, Map, Integer)} with metadata + * Generates a code sample for using {@link FileServiceClient#createShareWithResponse(String, Map, Integer, Context)} with metadata */ public void createShareWithMetadata() { FileServiceClient fileServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceClient.createShare#string-map-integer.metadata - Response response = fileServiceClient.createShare("test", - Collections.singletonMap("share", "metadata"), null); + // BEGIN: com.azure.storage.file.FileServiceClient.createShareWithResponse#String-Map-Integer-Context + Response response = fileServiceClient.createShareWithResponse("test", + Collections.singletonMap("share", "metadata"), null, new Context(key1, value1)); System.out.printf("Creating the share completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileServiceClient.createShare#string-map-integer.metadata - } - - /** - * Generates a code sample for using {@link FileServiceAsyncClient#createShare(String, Map, Integer)} with metadata - */ - public void createShareAsyncWithMetadata() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.metadata - fileServiceAsyncClient.createShare("test", Collections.singletonMap("share", "metadata"), null) - .subscribe( - response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.metadata - } - - /** - * Generates a code sample for using {@link FileServiceClient#createShare(String, Map, Integer)} with quota. - */ - public void createShareWithQuota() { - FileServiceClient fileServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceClient.createShare#string-map-integer.quota - Response response = fileServiceClient.createShare("test", null, 10); - System.out.printf("Creating the share completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileServiceClient.createShare#string-map-integer.quota - } - - /** - * Generates a code sample for using {@link FileServiceAsyncClient#createShare(String, Map, Integer)} with quota. - */ - public void createShareAsyncWithQuota() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.quota - fileServiceAsyncClient.createShare("test", null, 10) - .subscribe( - response -> System.out.printf("Creating the share completed with status code %d", - response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.createShare#string-map-integer.quota + // END: com.azure.storage.file.FileServiceClient.createShareWithResponse#String-Map-Integer-Context } /** @@ -219,20 +126,6 @@ public void listShares() { // END: com.azure.storage.file.fileServiceClient.listShares } - /** - * Generates a code sample for using {@link FileServiceAsyncClient#listShares()} - */ - public void listSharesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares - fileServiceAsyncClient.listShares().subscribe( - shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete listing the shares!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.listShares - } - /** * Generates a code sample for using {@link FileServiceClient#listShares(ListSharesOptions)} of prefix. */ @@ -245,20 +138,6 @@ public void listSharesWithPrefix() { // END: com.azure.storage.file.fileServiceClient.listShares#ListSharesOptions.prefix } - /** - * Generates a code sample for using {@link FileServiceAsyncClient#listShares(ListSharesOptions)} of prefix. - */ - public void listSharesAsyncWithPrefix() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.prefix - fileServiceAsyncClient.listShares(new ListSharesOptions().prefix("azure")).subscribe( - shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete listing the shares!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.prefix - } - /** * Generates a code sample for using {@link FileServiceClient#listShares(ListSharesOptions)} of metadata and snapshot. */ @@ -272,21 +151,6 @@ public void listSharesWithMetadataAndSnapshot() { // END: com.azure.storage.file.fileServiceClient.listShares#ListSharesOptions.metadata.snapshot } - /** - * Generates a code sample for using {@link FileServiceAsyncClient#listShares(ListSharesOptions)} of metadata and snapshot. - */ - public void listSharesAsyncWithOverload() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.metadata.snapshot - fileServiceAsyncClient.listShares(new ListSharesOptions().includeMetadata(true) - .includeSnapshots(true)).subscribe( - shareItem -> System.out.printf("Share %s exists in the account", shareItem.name()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete listing the shares!") - ); - // END: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.metadata.snapshot - } - /** * Generates a code sample for using {@link FileServiceClient#deleteShare(String)} */ @@ -298,40 +162,16 @@ public void deleteShare() { } /** - * Generates a code sample for using {@link FileServiceAsyncClient#deleteShare(String)} - */ - public void deleteShareAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string - fileServiceAsyncClient.deleteShare("test").subscribe( - response -> System.out.println("Deleting the share completed with status code: " + response.statusCode()) - ); - // END: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string - } - - /** - * Generates a code sample for using {@link FileServiceClient#deleteShare(String, String)} + * Generates a code sample for using {@link FileServiceClient#deleteShareWithResponse(String, String, Context)} */ public void deleteShareMaxOverload() { FileServiceClient fileServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceClient.deleteShare#string-string + // BEGIN: com.azure.storage.file.fileServiceClient.deleteShareWithResponse#string-string-Context OffsetDateTime midnight = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - VoidResponse response = fileServiceClient.deleteShare("test", midnight.toString()); + VoidResponse response = fileServiceClient.deleteShareWithResponse("test", midnight.toString(), + new Context(key1, value1)); System.out.printf("Deleting the snapshot completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileServiceClient.deleteShare#string-string - } - - /** - * Generates a code sample for using {@link FileServiceAsyncClient#deleteShare(String, String)} - */ - public void deleteShareAsyncMaxOverload() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string-string - OffsetDateTime midnight = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - fileServiceAsyncClient.deleteShare("test", midnight.toString()) - .subscribe(response -> System.out.printf("Deleting the snapshot completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string-string + // END: com.azure.storage.file.fileServiceClient.deleteShareWithResponse#string-string-Context } /** @@ -340,25 +180,34 @@ public void deleteShareAsyncMaxOverload() { public void getProperties() { FileServiceClient fileServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileServiceClient.getProperties - FileServiceProperties properties = fileServiceClient.getProperties().value(); + FileServiceProperties properties = fileServiceClient.getProperties(); System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); // END: com.azure.storage.file.fileServiceClient.getProperties } /** - * Generates a code sample for using {@link FileServiceAsyncClient#getProperties()} + * Generates a code sample for using {@link FileServiceClient#getPropertiesWithResponse(Context)} */ - public void getPropertiesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.getProperties - fileServiceAsyncClient.getProperties() - .subscribe(response -> { - FileServiceProperties properties = response.value(); - System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", - properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); - }); - // END: com.azure.storage.file.fileServiceAsyncClient.getProperties + public void getPropertiesWithRespose() { + FileServiceClient fileServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceClient.getPropertiesWithRespose#Context + Response properties = fileServiceClient.getPropertiesWithResponse(new Context(key1, value1)); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.value().hourMetrics().enabled(), + properties.value().minuteMetrics().enabled()); + // END: com.azure.storage.file.fileServiceClient.getPropertiesWithRespose#Context + } + + /** + * Generates a code sample for using {@link FileServiceClient#getPropertiesWithResponse(Context)} + */ + public void getPropertiesWithResponse() { + FileServiceClient fileServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceClient.getPropertiesWithResponse#Context + FileServiceProperties properties = fileServiceClient.getPropertiesWithResponse(new Context(key1, value1)).value(); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.hourMetrics().enabled(), + properties.minuteMetrics().enabled()); + // END: com.azure.storage.file.fileServiceClient.getPropertiesWithResponse#Context } /** @@ -367,31 +216,30 @@ public void getPropertiesAsync() { public void setProperties() { FileServiceClient fileServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties - FileServiceProperties properties = fileServiceClient.getProperties().value(); + FileServiceProperties properties = fileServiceClient.getProperties(); properties.minuteMetrics().enabled(true); properties.hourMetrics().enabled(true); - VoidResponse response = fileServiceClient.setProperties(properties); - System.out.printf("Setting File service properties completed with status code %d", response.statusCode()); + fileServiceClient.setProperties(properties); + System.out.println("Setting File service properties completed."); // END: com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties } /** - * Generates a code sample for using {@link FileServiceAsyncClient#setProperties(FileServiceProperties)} + * Generates a code sample for using {@link FileServiceClient#setProperties(FileServiceProperties)} */ - public void setPropertiesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties - FileServiceProperties properties = fileServiceAsyncClient.getProperties().block().value(); + public void setPropertiesWithResponse() { + FileServiceClient fileServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context + FileServiceProperties properties = fileServiceClient.getPropertiesWithResponse(new Context(key1, value1)).value(); properties.minuteMetrics().enabled(true); properties.hourMetrics().enabled(true); - fileServiceAsyncClient.setProperties(properties) - .subscribe(response -> System.out.printf("Setting File service properties completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties + VoidResponse response = fileServiceClient.setPropertiesWithResponse(properties, new Context(key1, value1)); + System.out.printf("Setting File service properties completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context } /** @@ -399,27 +247,12 @@ public void setPropertiesAsync() { */ public void clearProperties() { FileServiceClient fileServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties.clearCORS - FileServiceProperties properties = fileServiceClient.getProperties().value(); + // BEGIN: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context.clearCORS + FileServiceProperties properties = fileServiceClient.getProperties(); properties.cors(Collections.emptyList()); - VoidResponse response = fileServiceClient.setProperties(properties); + VoidResponse response = fileServiceClient.setPropertiesWithResponse(properties, new Context(key1, value1)); System.out.printf("Setting File service properties completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties.clearCORS - } - - /** - * Generates a code sample for using {@link FileServiceAsyncClient#setProperties(FileServiceProperties)} to clear CORS in file service. - */ - public void clearPropertiesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties.clearCORS - FileServiceProperties properties = fileServiceAsyncClient.getProperties().block().value(); - properties.cors(Collections.emptyList()); - - fileServiceAsyncClient.setProperties(properties) - .subscribe(response -> System.out.printf("Setting File service properties completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties.clearCORS + // END: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context.clearCORS } } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java index 931aa6b7ecee..14652a8fcce1 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceSample.java @@ -2,7 +2,6 @@ // Licensed under the MIT License. package com.azure.storage.file; -import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.models.FileServiceProperties; import com.azure.storage.file.models.StorageErrorException; @@ -40,10 +39,10 @@ public static void main(String[] args) { // Get properties from the file service try { - Response response = fileServiceClient.getProperties(); + FileServiceProperties properties = fileServiceClient.getProperties(); - System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b\n", - response.value().hourMetrics(), response.value().minuteMetrics()); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b%n", + properties.hourMetrics(), properties.minuteMetrics()); } catch (StorageErrorException e) { System.out.println("Failed to get the account properties. Reasons: " + e.getMessage()); } @@ -51,7 +50,7 @@ public static void main(String[] args) { fileServiceClient.listShares().forEach( shareItem -> { try { - System.out.printf("This is the share name: %s in the file account.\n", shareItem.name()); + System.out.printf("This is the share name: %s in the file account.%n", shareItem.name()); fileServiceClient.deleteShare(shareItem.name()); System.out.println("The share has been deleted from the storage file account!"); } catch (StorageErrorException e) { diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java new file mode 100644 index 000000000000..fc38bde290aa --- /dev/null +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.storage.file; + +import com.azure.storage.common.Utility; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.models.AccessPolicy; +import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.SignedIdentifier; + +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** +* Contains code snippets when generating javadocs through doclets for {@link ShareAsyncClient}. +*/ +public class ShareAsyncJavaDocCodeSamples { + + + /** + * Generates code sample for {@link ShareAsyncClient} instantiation. + */ + public void asyncInitialization() { + // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation + ShareAsyncClient client = new ShareClientBuilder() + .connectionString("${connectionString}") + .endpoint("${endpoint}") + .buildAsyncClient(); + // END: com.azure.storage.file.shareAsyncClient.instantiation + } + + /** + * Generates code sample for creating a {@link ShareAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link ShareAsyncClient} + */ + public ShareAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.sastoken + ShareAsyncClient shareAsyncClient = new ShareClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") + .shareName("myshare") + .buildAsyncClient(); + // END: com.azure.storage.file.shareAsyncClient.instantiation.sastoken + return shareAsyncClient; + } + + /** + * Generates code sample for creating a {@link ShareAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link ShareAsyncClient} + */ + public ShareAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.credential + ShareAsyncClient shareAsyncClient = new ShareClientBuilder() + .endpoint("https://{accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) + .shareName("myshare") + .buildAsyncClient(); + // END: com.azure.storage.file.shareAsyncClient.instantiation.credential + return shareAsyncClient; + } + + /** + * Generates code sample for creating a {@link ShareAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * @return An instance of {@link ShareAsyncClient} + */ + public ShareAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + ShareAsyncClient shareAsyncClient = new ShareClientBuilder() + .connectionString(connectionString).shareName("myshare") + .buildAsyncClient(); + // END: com.azure.storage.file.shareAsyncClient.instantiation.connectionstring + return shareAsyncClient; + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#create} + */ + public void createShareAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.create + shareAsyncClient.create().subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.shareAsyncClient.create + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createWithResponse(Map, Integer)} with Metadata. + */ + public void createWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.metadata + shareAsyncClient.createWithResponse(Collections.singletonMap("share", "metadata"), null).subscribe( + response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.metadata + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createWithResponse(Map, Integer)} with Quota. + */ + public void createShareAsyncMaxOverloadQuota() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.quota + shareAsyncClient.createWithResponse(null, 10).subscribe( + response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the share!") + ); + // END: com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.quota + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createDirectory(String)} + */ + public void createDirectoryAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectory#string + shareAsyncClient.createDirectory("mydirectory").subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the directory!") + ); + // END: com.azure.storage.file.shareAsyncClient.createDirectory#string + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createFile(String, long)} + */ + public void createFileAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createFile#string-long + shareAsyncClient.createFile("myfile", 1024).subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the directory!") + ); + // END: com.azure.storage.file.shareAsyncClient.createFile#string-long + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createSnapshot()} + */ + public void createSnapshotAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshot + shareAsyncClient.createSnapshot().subscribe( + response -> System.out.println("Successfully creating the share snapshot with snapshot id: " + + response.snapshot()), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete creating the share snapshot.") + ); + // END: com.azure.storage.file.shareAsyncClient.createSnapshot + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createSnapshotWithResponse(Map)} + */ + public void createSnapshotAsyncWithMetadata() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshotWithResponse#map + shareAsyncClient.createSnapshotWithResponse(Collections.singletonMap("snapshot", "metadata")).subscribe( + response -> System.out.println("Successfully creating the share snapshot with snapshot id: " + + response.value().snapshot()), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete creating the share snapshot.") + ); + // END: com.azure.storage.file.shareAsyncClient.createSnapshotWithResponse#map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createDirectoryWithResponse(String, Map)} + */ + public void createDirectoryWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectoryWithResponse#string-map + shareAsyncClient.createDirectoryWithResponse("documents", Collections.singletonMap("directory", "metadata")) + .subscribe(response -> System.out.printf("Creating the directory completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.shareAsyncClient.createDirectoryWithResponse#string-map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createFile(String, long)} + */ + public void createFileAsyncMaxOverload() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); + shareAsyncClient.createFile("myfile", 1024) + .doOnSuccess(response -> System.out.println("Creating the file completed.")); + // END: com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createFileWithResponse(String, long, FileHTTPHeaders, Map)} + */ + public void createFileWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createFileWithResponse#string-long-filehttpheaders-map + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); + shareAsyncClient.createFileWithResponse("myfile", 1024, httpHeaders, + Collections.singletonMap("directory", "metadata")) + .subscribe(response -> System.out.printf("Creating the file completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.shareAsyncClient.createFileWithResponse#string-long-filehttpheaders-map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#deleteDirectory(String)} + */ + public void deleteDirectoryAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.deleteDirectory#string + shareAsyncClient.deleteDirectory("mydirectory").subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Complete deleting the directory.") + ); + // END: com.azure.storage.file.shareAsyncClient.deleteDirectory#string + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#deleteFile(String)} + */ + public void deleteFileAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.deleteFile#string + shareAsyncClient.deleteFile("myfile").subscribe( + response -> { }, + error -> System.err.println(error.toString()), + () -> System.out.println("Complete deleting the file.") + ); + // END: com.azure.storage.file.shareAsyncClient.deleteFile#string + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#delete} + */ + public void deleteShareAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.delete + shareAsyncClient.delete().subscribe( + response -> System.out.println("Deleting the shareAsyncClient completed."), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete deleting the share.") + ); + // END: com.azure.storage.file.shareAsyncClient.delete + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#deleteWithResponse()} + */ + public void deleteWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.deleteWithResponse + shareAsyncClient.deleteWithResponse().subscribe( + response -> System.out.println("Deleting the shareAsyncClient completed with status code: " + + response.statusCode()), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete deleting the share.") + ); + // END: com.azure.storage.file.shareAsyncClient.deleteWithResponse + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getProperties + shareAsyncClient.getProperties() + .subscribe(properties -> { + System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata()); + }); + // END: com.azure.storage.file.shareAsyncClient.getProperties + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getPropertiesWithResponse + shareAsyncClient.getPropertiesWithResponse() + .subscribe(properties -> { + System.out.printf("Share quota: %d, Metadata: %s", properties.value().quota(), properties.value().metadata()); + }); + // END: com.azure.storage.file.shareAsyncClient.getPropertiesWithResponse + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setQuota(int)} + */ + public void setQuotaAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareAsyncClient.setQuota#int + shareAsyncClient.setQuota(1024).doOnSuccess(response -> + System.out.println("Setting the share quota completed.") + ); + // END: com.azure.storage.file.ShareAsyncClient.setQuota#int + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setQuotaWithResponse(int)} + */ + public void setQuotaWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareAsyncClient.setQuotaWithResponse#int + shareAsyncClient.setQuotaWithResponse(1024) + .subscribe(response -> + System.out.printf("Setting the share quota completed with status code %d", response.statusCode()) + ); + // END: com.azure.storage.file.ShareAsyncClient.setQuotaWithResponse#int + } + + + /** + * Generates a code sample for using {@link ShareAsyncClient#setMetadata(Map)} + */ + public void setMetadataAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.setMetadata#map + shareAsyncClient.setMetadata(Collections.singletonMap("share", "updatedMetadata")).doOnSuccess(response -> + System.out.println("Setting the share metadata completed.") + ); + // END: com.azure.storage.file.shareAsyncClient.setMetadata#map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setMetadataWithResponse(Map)} + */ + public void setMetadataWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.setMetadataWithResponse#map + shareAsyncClient.setMetadataWithResponse(Collections.singletonMap("share", "updatedMetadata")) + .subscribe(response -> + System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()) + ); + // END: com.azure.storage.file.shareAsyncClient.setMetadataWithResponse#map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setMetadata(Map)} to clear the metadata. + */ + public void clearMetadataAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.clearMetadata#map + shareAsyncClient.setMetadata(null).doOnSuccess(response -> + System.out.println("Setting the share metadata completed.") + ); + // END: com.azure.storage.file.shareAsyncClient.clearMetadata#map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getAccessPolicy()} + */ + public void getAccessPolicyAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getAccessPolicy + shareAsyncClient.getAccessPolicy() + .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", result.id(), + result.accessPolicy().permission()) + ); + // END: com.azure.storage.file.shareAsyncClient.getAccessPolicy + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setAccessPolicy(List)} + */ + public void setAccessPolicyAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareAsyncClient.setAccessPolicy#List + AccessPolicy accessPolicy = new AccessPolicy().permission("r") + .start(OffsetDateTime.now(ZoneOffset.UTC)) + .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + + SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); + shareAsyncClient.setAccessPolicy(Collections.singletonList(permission)).doOnSuccess( + response -> System.out.println("Setting access policies completed.")); + // END: com.azure.storage.file.ShareAsyncClient.setAccessPolicy#List + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#setAccessPolicyWithResponse(List)} + */ + public void setAccessPolicyWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareAsyncClient.setAccessPolicyWithResponse#List + AccessPolicy accessPolicy = new AccessPolicy().permission("r") + .start(OffsetDateTime.now(ZoneOffset.UTC)) + .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + + SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); + shareAsyncClient.setAccessPolicyWithResponse(Collections.singletonList(permission)) + .subscribe(response -> System.out.printf("Setting access policies completed completed with status code %d", + response.statusCode())); + // END: com.azure.storage.file.ShareAsyncClient.setAccessPolicyWithResponse#List + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getStatistics()} + */ + public void getStatisticsAsync() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getStatistics + shareAsyncClient.getStatistics().doOnSuccess(response -> System.out.printf("The share is using %d GB", + response.getShareUsageInGB())); + // END: com.azure.storage.file.shareAsyncClient.getStatistics + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getStatisticsWithResponse()} + */ + public void getStatisticsWithResponse() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.getStatisticsWithResponse + shareAsyncClient.getStatisticsWithResponse().subscribe(response -> System.out.printf("The share is using %d GB", + response.value().getShareUsageInGB())); + // END: com.azure.storage.file.shareAsyncClient.getStatisticsWithResponse + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#getSnapshotId()} + */ + public void getSnapshotIdAsync() { + // BEGIN: com.azure.storage.file.shareAsyncClient.getSnapshotId + OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); + ShareAsyncClient shareAysncClient = new ShareClientBuilder().endpoint("https://${accountName}.file.core.windows.net") + .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) + .shareName("myshare") + .snapshot(currentTime.toString()) + .buildAsyncClient(); + + System.out.printf("Snapshot ID: %s%n", shareAysncClient.getSnapshotId()); + // END: com.azure.storage.file.shareAsyncClient.getSnapshotId + } +} diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java index 46234818fa5a..5ee0f9ae1549 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java @@ -5,6 +5,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; import com.azure.storage.common.Utility; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.AccessPolicy; @@ -14,7 +15,6 @@ import com.azure.storage.file.models.ShareSnapshotInfo; import com.azure.storage.file.models.ShareStatistics; import com.azure.storage.file.models.SignedIdentifier; - import java.time.LocalDateTime; import java.time.OffsetDateTime; import java.time.ZoneOffset; @@ -23,9 +23,13 @@ import java.util.Map; /** - * Contains code snippets when generating javadocs through doclets for {@link ShareClient} and {@link ShareAsyncClient}. + * Contains code snippets when generating javadocs through doclets for {@link ShareClient}. */ public class ShareJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for {@link ShareClient} instantiation. */ @@ -38,18 +42,6 @@ public void initialization() { // END: com.azure.storage.file.shareClient.instantiation } - /** - * Generates code sample for {@link ShareAsyncClient} instantiation. - */ - public void asyncInitialization() { - // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation - ShareAsyncClient client = new ShareClientBuilder() - .connectionString("${connectionString}") - .endpoint("${endpoint}") - .buildAsyncClient(); - // END: com.azure.storage.file.shareAsyncClient.instantiation - } - /** * Generates code sample for creating a {@link ShareClient} with {@link SASTokenCredential} * @return An instance of {@link ShareClient} @@ -65,19 +57,6 @@ public ShareClient createClientWithSASToken() { return shareClient; } - /** - * Generates code sample for creating a {@link ShareAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link ShareAsyncClient} - */ - public ShareAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.sastoken - ShareAsyncClient shareAsyncClient = new ShareClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") - .shareName("myshare") - .buildAsyncClient(); - // END: com.azure.storage.file.shareAsyncClient.instantiation.sastoken - return shareAsyncClient; - } /** * Generates code sample for creating a {@link ShareClient} with {@link SASTokenCredential} @@ -95,21 +74,6 @@ public ShareClient createClientWithCredential() { return shareClient; } - /** - * Generates code sample for creating a {@link ShareAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link ShareAsyncClient} - */ - public ShareAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.credential - ShareAsyncClient shareAsyncClient = new ShareClientBuilder() - .endpoint("https://{accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("${SASTokenQueryParams}"))) - .shareName("myshare") - .buildAsyncClient(); - // END: com.azure.storage.file.shareAsyncClient.instantiation.credential - return shareAsyncClient; - } - /** * Generates code sample for creating a {@link ShareClient} with {@code connectionString} which turns into {@link SharedKeyCredential} * @return An instance of {@link ShareClient} @@ -125,94 +89,49 @@ public ShareClient createClientWithConnectionString() { return shareClient; } - /** - * Generates code sample for creating a {@link ShareAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link ShareAsyncClient} - */ - public ShareAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" - + "EndpointSuffix={core.windows.net}"; - ShareAsyncClient shareAsyncClient = new ShareClientBuilder() - .connectionString(connectionString).shareName("myshare") - .buildAsyncClient(); - // END: com.azure.storage.file.shareAsyncClient.instantiation.connectionstring - return shareAsyncClient; - } - /** * Generates a code sample for using {@link ShareClient#create()} */ public void createShare() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.create - Response response = shareClient.create(); - System.out.println("Complete creating the shares with status code: " + response.statusCode()); + ShareInfo response = shareClient.create(); + System.out.println("Complete creating the shares with status code: " + response); // END: com.azure.storage.file.shareClient.create } /** - * Generates a code sample for using {@link ShareAsyncClient#create} - */ - public void createShareAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.create - shareAsyncClient.create().subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.shareAsyncClient.create - } - - /** - * Generates a code sample for using {@link ShareClient#create(Map, Integer)} with Metadata. + * Generates a code sample for using {@link ShareClient#create()}. */ public void createShareMaxOverloadMetadata() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.create#map-integer.metadata - Response response = shareClient.create(Collections.singletonMap("share", "metadata"), null); - System.out.println("Complete creating the shares with status code: " + response.statusCode()); + ShareInfo response = shareClient.create(); + System.out.println("Complete creating the shares."); // END: com.azure.storage.file.shareClient.create#map-integer.metadata } /** - * Generates a code sample for using {@link ShareAsyncClient#create(Map, Integer)} with Metadata. - */ - public void createShareAsyncMaxOverloadMetadata() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.create#map-integer.metadata - shareAsyncClient.create(Collections.singletonMap("share", "metadata"), null).subscribe( - response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.shareAsyncClient.create#map-integer.metadata - } - - /** - * Generates a code sample for using {@link ShareClient#create(Map, Integer)} with Quota. + * Generates a code sample for using {@link ShareClient#createWithResponse(Map, Integer, Context)} with Quota. */ - public void createShareMaxOverloadQuota() { + public void createWithResponse() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.create#map-integer.quota - Response response = shareClient.create(null, 10); + // BEGIN: com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.quota + Response response = shareClient.createWithResponse(null, 10, new Context(key1, value1)); System.out.println("Complete creating the shares with status code: " + response.statusCode()); - // END: com.azure.storage.file.shareClient.create#map-integer.quota + // END: com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.quota } /** - * Generates a code sample for using {@link ShareAsyncClient#create(Map, Integer)} with Quota. + * Generates a code sample for using {@link ShareClient#createWithResponse(Map, Integer, Context)} with Metadata. */ - public void createShareAsyncMaxOverloadQuota() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.create#map-integer.quota - shareAsyncClient.create(null, 10).subscribe( - response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the share!") - ); - // END: com.azure.storage.file.shareAsyncClient.create#map-integer.quota + public void createWithResponseMetadata() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.metadata + Response response = shareClient.createWithResponse(Collections.singletonMap("share", "metadata"), null, + new Context(key1, value1)); + System.out.println("Complete creating the shares with status code: " + response.statusCode()); + // END: com.azure.storage.file.ShareClient.createWithResponse#Map-Integer-Context.metadata } /** @@ -221,23 +140,21 @@ public void createShareAsyncMaxOverloadQuota() { public void createDirectory() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.createDirectory#string - Response response = shareClient.createDirectory("mydirectory"); - System.out.println("Complete creating the directory with status code: " + response.statusCode()); + DirectoryClient response = shareClient.createDirectory("mydirectory"); + System.out.println("Complete creating the directory."); // END: com.azure.storage.file.shareClient.createDirectory#string } /** - * Generates a code sample for using {@link ShareAsyncClient#createDirectory(String)} + * Generates a code sample for using {@link ShareClient#createDirectoryWithResponse(String, Map, Context)} */ - public void createDirectoryAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectory#string - shareAsyncClient.createDirectory("mydirectory").subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the directory!") - ); - // END: com.azure.storage.file.shareAsyncClient.createDirectory#string + public void createDirectoryWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.createDirectoryWithResponse#string-map-Context + Response response = shareClient.createDirectoryWithResponse("documents", + Collections.singletonMap("directory", "metadata"), new Context(key1, value1)); + System.out.printf("Creating the directory completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.shareClient.createDirectoryWithResponse#string-map-Context } /** @@ -246,177 +163,89 @@ public void createDirectoryAsync() { public void createFile() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.createFile#string-long - Response response = shareClient.createFile("myfile", 1024); - System.out.println("Complete creating the file with status code: " + response.statusCode()); + FileClient response = shareClient.createFile("myfile", 1024); + System.out.println("Complete creating the file with snapshot Id:" + response.getShareSnapshotId()); // END: com.azure.storage.file.shareClient.createFile#string-long } /** - * Generates a code sample for using {@link ShareAsyncClient#createFile(String, long)} - */ - public void createFileAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createFile#string-long - shareAsyncClient.createFile("myfile", 1024).subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the directory!") - ); - // END: com.azure.storage.file.shareAsyncClient.createFile#string-long - } - - /** - * Generates a code sample for using {@link ShareClient#createSnapshot()()} + * Generates a code sample for using {@link ShareClient#createSnapshot()} */ public void createSnapshot() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.createSnapshot - Response response = shareClient.createSnapshot(); - System.out.println("Complete creating the share snpashot with snapshot id: " + response.value().snapshot()); + ShareSnapshotInfo response = shareClient.createSnapshot(); + System.out.println("Complete creating the share snpashot with snapshot id: " + response.snapshot()); // END: com.azure.storage.file.shareClient.createSnapshot } /** - * Generates a code sample for using {@link ShareAsyncClient#createSnapshot()} - */ - public void createSnapshotAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshot - shareAsyncClient.createSnapshot().subscribe( - response -> System.out.println("Successfully creating the share snapshot with snapshot id: " - + response.value().snapshot()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete creating the share snapshot.") - ); - // END: com.azure.storage.file.shareAsyncClient.createSnapshot - } - - /** - * Generates a code sample for using {@link ShareClient#createSnapshot(Map)} + * Generates a code sample for using {@link ShareClient#createSnapshotWithResponse(Map, Context)} */ public void createSnapshotWithMetadata() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.createSnapshot#map + // BEGIN: com.azure.storage.file.shareClient.createSnapshotWithResponse#map-Context Response response = - shareClient.createSnapshot(Collections.singletonMap("snpashot", "metadata")); + shareClient.createSnapshotWithResponse(Collections.singletonMap("snpashot", "metadata"), new Context(key1, value1)); System.out.println("Complete creating the share snpashot with snapshot id: " + response.value().snapshot()); - // END: com.azure.storage.file.shareClient.createSnapshot#map - } - - /** - * Generates a code sample for using {@link ShareAsyncClient#createSnapshot(Map)} - */ - public void createSnapshotAsyncWithMetadata() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshot#map - shareAsyncClient.createSnapshot(Collections.singletonMap("snapshot", "metadata")).subscribe( - response -> System.out.println("Successfully creating the share snapshot with snapshot id: " - + response.value().snapshot()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete creating the share snapshot.") - ); - // END: com.azure.storage.file.shareAsyncClient.createSnapshot#map + // END: com.azure.storage.file.shareClient.createSnapshotWithResponse#map-Context } /** - * Generates a code sample for using {@link ShareClient#createDirectory(String, Map)} + * Generates a code sample for using {@link ShareClient#createFileWithResponse(String, long, FileHTTPHeaders, Map, Context)} */ - public void createDirectoryMaxOverload() { + public void createFileWithResponse() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.createDirectory#string-map - Response response = shareClient.createDirectory("documents", - Collections.singletonMap("directory", "metadata")); - System.out.printf("Creating the directory completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.shareClient.createDirectory#string-map - } - - /** - * Generates a code sample for using {@link ShareAsyncClient#createDirectory(String, Map)} - */ - public void createDirectoryAsyncMaxOverload() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectory#string-map - shareAsyncClient.createDirectory("documents", Collections.singletonMap("directory", "metadata")) - .subscribe(response -> System.out.printf("Creating the directory completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.shareAsyncClient.createDirectory#string-map - } - - /** - * Generates a code sample for using {@link ShareClient#createFile(String, long, FileHTTPHeaders, Map)} - */ - public void createFileMaxOverload() { - ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.createFile#string-long-filehttpheaders-map + // BEGIN: com.azure.storage.file.shareClient.createFileWithResponse#string-long-filehttpheaders-map-Context FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - Response response = shareClient.createFile("myfile", 1024, httpHeaders, - Collections.singletonMap("directory", "metadata")); + Response response = shareClient.createFileWithResponse("myfile", 1024, httpHeaders, + Collections.singletonMap("directory", "metadata"), new Context(key1, value1)); System.out.printf("Creating the file completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.shareClient.createFile#string-long-filehttpheaders-map + // END: com.azure.storage.file.shareClient.createFileWithResponse#string-long-filehttpheaders-map-Context } /** - * Generates a code sample for using {@link ShareAsyncClient#createFile(String, long, FileHTTPHeaders, Map)} - */ - public void createFileAsyncMaxOverload() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); - shareAsyncClient.createFile("myfile", 1024, httpHeaders, - Collections.singletonMap("directory", "metadata")) - .subscribe(response -> System.out.printf("Creating the file completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map - } - - /** - * Generates a code sample for using {@link ShareClient#deleteDirectory(String)()} + * Generates a code sample for using {@link ShareClient#deleteDirectory(String)} */ public void deleteDirectory() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.deleteDirectory#string - VoidResponse response = shareClient.deleteDirectory("mydirectory"); - System.out.println("Complete deleting the directory with status code: " + response.statusCode()); + shareClient.deleteDirectory("mydirectory"); + System.out.println("Completed deleting the directory."); // END: com.azure.storage.file.shareClient.deleteDirectory#string } /** - * Generates a code sample for using {@link ShareAsyncClient#deleteDirectory(String)()} + * Generates a code sample for using {@link ShareClient#deleteDirectoryWithResponse(String, Context)} */ - public void deleteDirectoryAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.deleteDirectory#string - shareAsyncClient.deleteDirectory("mydirectory").subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the directory.") - ); - // END: com.azure.storage.file.shareAsyncClient.deleteDirectory#string + public void deleteDirectoryWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.deleteDirectoryWithResponse#string-Context + VoidResponse response = shareClient.deleteDirectoryWithResponse("mydirectory", new Context(key1, value1)); + System.out.println("Complete deleting the directory with status code: " + response.statusCode()); + // END: com.azure.storage.file.shareClient.deleteDirectoryWithResponse#string-Context } /** - * Generates a code sample for using {@link ShareClient#deleteFile(String)()} + * Generates a code sample for using {@link ShareClient#deleteFile(String)} */ public void deleteFile() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.deleteFile#string - VoidResponse response = shareClient.deleteFile("myfile"); - System.out.println("Complete deleting the file with status code: " + response.statusCode()); + shareClient.deleteFile("myfile"); + System.out.println("Complete deleting the file."); // END: com.azure.storage.file.shareClient.deleteFile#string } /** - * Generates a code sample for using {@link ShareAsyncClient#deleteFile(String)()} + * Generates a code sample for using {@link ShareClient#deleteFileWithResponse(String, Context)} */ - public void deleteFileAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.deleteFile#string - shareAsyncClient.deleteFile("myfile").subscribe( - response -> { }, - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the file.") - ); - // END: com.azure.storage.file.shareAsyncClient.deleteFile#string + public void deleteFileWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.deleteFileWithResponse#string-Context + VoidResponse response = shareClient.deleteFileWithResponse("myfile", new Context(key1, value1)); + System.out.println("Complete deleting the file with status code: " + response.statusCode()); + // END: com.azure.storage.file.shareClient.deleteFileWithResponse#string-Context } /** @@ -425,25 +254,20 @@ public void deleteFileAsync() { public void deleteShare() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.delete - VoidResponse response = shareClient.delete(); - System.out.println("Complete deleting the share with status code: " + response.statusCode()); + shareClient.delete(); + System.out.println("Completed deleting the share."); // END: com.azure.storage.file.shareClient.delete } - /** - * Generates a code sample for using {@link ShareAsyncClient#delete} + * Generates a code sample for using {@link ShareClient#delete} */ - public void deleteShareAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.delete - shareAsyncClient.delete().subscribe( - response -> System.out.println("Deleting the shareAsyncClient completed with status code: " - + response.statusCode()), - error -> System.err.println(error.toString()), - () -> System.out.println("Complete deleting the share.") - ); - // END: com.azure.storage.file.shareAsyncClient.delete + public void deleteShareWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.deleteWithResponse#Context + VoidResponse response = shareClient.deleteWithResponse(new Context(key1, value1)); + System.out.println("Complete deleting the share with status code: " + response.statusCode()); + // END: com.azure.storage.file.shareClient.deleteWithResponse#Context } /** @@ -452,24 +276,20 @@ public void deleteShareAsync() { public void getProperties() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.getProperties - ShareProperties properties = shareClient.getProperties().value(); + ShareProperties properties = shareClient.getProperties(); System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata()); // END: com.azure.storage.file.shareClient.getProperties } - /** - * Generates a code sample for using {@link ShareAsyncClient#getProperties()} + * Generates a code sample for using {@link ShareClient#getPropertiesWithResponse(Context)} */ - public void getPropertiesAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.getProperties - shareAsyncClient.getProperties() - .subscribe(response -> { - ShareProperties properties = response.value(); - System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata()); - }); - // END: com.azure.storage.file.shareAsyncClient.getProperties + public void getPropertiesWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.getPropertiesWithResponse#Context + ShareProperties properties = shareClient.getPropertiesWithResponse(new Context(key1, value1)).value(); + System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata()); + // END: com.azure.storage.file.shareClient.getPropertiesWithResponse#Context } /** @@ -477,24 +297,20 @@ public void getPropertiesAsync() { */ public void setQuota() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.setQuota - Response response = shareClient.setQuota(1024); - System.out.printf("Setting the share quota completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.shareClient.setQuota + // BEGIN: com.azure.storage.file.ShareClient.setQuota#int + System.out.println("Setting the share quota completed." + shareClient.setQuota(1024)); + // END: com.azure.storage.file.ShareClient.setQuota#int } - /** - * Generates a code sample for using {@link ShareAsyncClient#setQuota(int)} + * Generates a code sample for using {@link ShareClient#setQuotaWithResponse(int, Context)} */ - public void setQuotaAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.setQuota - shareAsyncClient.setQuota(1024) - .subscribe(response -> - System.out.printf("Setting the share quota completed with status code %d", response.statusCode()) - ); - // END: com.azure.storage.file.shareAsyncClient.setQuota + public void setQuotaWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.setQuotaWithResponse#int-Context + Response response = shareClient.setQuotaWithResponse(1024, new Context(key1, value1)); + System.out.printf("Setting the share quota completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.shareClient.setQuotaWithResponse#int-Context } /** @@ -503,50 +319,37 @@ public void setQuotaAsync() { public void setMetadata() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.setMetadata#map - Response response = shareClient.setMetadata(Collections.singletonMap("share", "updatedMetadata")); - System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()); + shareClient.setMetadata(Collections.singletonMap("share", "updatedMetadata")); + System.out.println("Setting the share metadata."); // END: com.azure.storage.file.shareClient.setMetadata#map } - /** - * Generates a code sample for using {@link ShareAsyncClient#setMetadata(Map)} + * Generates a code sample for using {@link ShareClient#setMetadataWithResponse(Map, Context)} */ - public void setMetadataAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.setMetadata#map - shareAsyncClient.setMetadata(Collections.singletonMap("share", "updatedMetadata")) - .subscribe(response -> - System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()) - ); - // END: com.azure.storage.file.shareAsyncClient.setMetadata#map + public void setMetadataWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.setMetadataWithResponse#map-Context + Response response = shareClient.setMetadataWithResponse( + Collections.singletonMap("share", "updatedMetadata"), + new Context(key1, value1)); + System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.shareClient.setMetadataWithResponse#map-Context } + /** * Generates a code sample for using {@link ShareClient#setMetadata(Map)} to clear the metadata. */ public void clearMetadata() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.clearMetadata#map - Response response = shareClient.setMetadata(null); - System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()); + shareClient.setMetadata(null); + System.out.println("Clear metadata completed."); // END: com.azure.storage.file.shareClient.clearMetadata#map } - /** - * Generates a code sample for using {@link ShareAsyncClient#setMetadata(Map)} to clear the metadata. - */ - public void clearMetadataAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.clearMetadata#map - shareAsyncClient.setMetadata(null) - .subscribe(response -> - System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()) - ); - // END: com.azure.storage.file.shareAsyncClient.clearMetadata#map - } - /** * Generates a code sample for using {@link ShareClient#getAccessPolicy()} */ @@ -559,74 +362,62 @@ public void getAccessPolicy() { // END: com.azure.storage.file.shareClient.getAccessPolicy } - /** - * Generates a code sample for using {@link ShareAsyncClient#getAccessPolicy()} - */ - public void getAccessPolicyAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.getAccessPolicy - shareAsyncClient.getAccessPolicy() - .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", result.id(), - result.accessPolicy().permission()) - ); - // END: com.azure.storage.file.shareAsyncClient.getAccessPolicy - } - /** * Generates a code sample for using {@link ShareClient#setAccessPolicy(List)} */ public void setAccessPolicy() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.setAccessPolicy + // BEGIN: com.azure.storage.file.ShareClient.setAccessPolicy#List AccessPolicy accessPolicy = new AccessPolicy().permission("r") .start(OffsetDateTime.now(ZoneOffset.UTC)) .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); - Response response = shareClient.setAccessPolicy(Collections.singletonList(permission)); - System.out.printf("Setting access policies completed with status code %d", response.statusCode()); - // END: com.azure.storage.file.shareClient.setAccessPolicy + shareClient.setAccessPolicy(Collections.singletonList(permission)); + System.out.println("Setting access policies completed."); + // END: com.azure.storage.file.ShareClient.setAccessPolicy#List } /** - * Generates a code sample for using {@link ShareAsyncClient#setAccessPolicy(List)} + * Generates a code sample for using {@link ShareClient#setAccessPolicyWithResponse(List, Context)} */ - public void setAccessPolicyAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.setAccessPolicy + public void setAccessPolicyWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.setAccessPolicyWithResponse#List-Context AccessPolicy accessPolicy = new AccessPolicy().permission("r") .start(OffsetDateTime.now(ZoneOffset.UTC)) .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); - shareAsyncClient.setAccessPolicy(Collections.singletonList(permission)) - .subscribe(response -> System.out.printf("Setting access policies completed with status code %d", - response.statusCode())); - // END: com.azure.storage.file.shareAsyncClient.setAccessPolicy + + Response response = shareClient.setAccessPolicyWithResponse(Collections.singletonList(permission), + new Context(key1, value1)); + System.out.printf("Setting access policies completed with status code %d", response.statusCode()); + // END: com.azure.storage.file.shareClient.setAccessPolicyWithResponse#List-Context } + /** * Generates a code sample for using {@link ShareClient#getStatistics()} */ public void getStatistics() { ShareClient shareClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.shareClient.getStatistics - Response response = shareClient.getStatistics(); - System.out.printf("The share is using %d GB", response.value().getShareUsageInGB()); + ShareStatistics response = shareClient.getStatistics(); + System.out.printf("The share is using %d GB", response.getShareUsageInGB()); // END: com.azure.storage.file.shareClient.getStatistics } /** - * Generates a code sample for using {@link ShareAsyncClient#getStatistics()} + * Generates a code sample for using {@link ShareClient#getStatisticsWithResponse(Context)} */ - public void getStatisticsAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.getStatistics - shareAsyncClient.getStatistics() - .subscribe(response -> System.out.printf("The share is using %d GB", - response.value().getShareUsageInGB())); - // END: com.azure.storage.file.shareAsyncClient.getStatistics + public void getStatisticsWithResponse() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.getStatisticsWithResponse#Context + Response response = shareClient.getStatisticsWithResponse(new Context(key1, value1)); + System.out.printf("The share is using %d GB", response.value().getShareUsageInGB()); + // END: com.azure.storage.file.shareClient.getStatisticsWithResponse#Context } /** @@ -640,22 +431,8 @@ public void getSnapshotId() { .shareName("myshare") .snapshot(currentTime.toString()) .buildClient(); - shareClient.getSnapshotId(); - // END: com.azure.storage.file.shareClient.getSnapshotId - } - /** - * Generates a code sample for using {@link ShareAsyncClient#getSnapshotId()} - */ - public void getSnapshotIdAsync() { - // BEGIN: com.azure.storage.file.shareAsyncClient.getSnapshotId - OffsetDateTime currentTime = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); - ShareAsyncClient shareAysncClient = new ShareClientBuilder().endpoint("https://${accountName}.file.core.windows.net") - .credential(SASTokenCredential.fromSASTokenString("${SASToken}")) - .shareName("myshare") - .snapshot(currentTime.toString()) - .buildAsyncClient(); - shareAysncClient.getSnapshotId(); - // END: com.azure.storage.file.shareAsyncClient.getSnapshotId + System.out.printf("Snapshot ID: %s%n", shareClient.getSnapshotId()); + // END: com.azure.storage.file.shareClient.getSnapshotId } } diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java index 9fb593d14dd6..6e16ec572046 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareSample.java @@ -2,7 +2,6 @@ // Licensed under the MIT License. package com.azure.storage.file; -import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.models.ShareProperties; import com.azure.storage.file.models.StorageErrorException; @@ -33,7 +32,7 @@ public static void main(String[] args) { // Create first snapshot on share. String shareSnapshot1 = null; try { - shareSnapshot1 = shareClient.createSnapshot().value().snapshot(); + shareSnapshot1 = shareClient.createSnapshot().snapshot(); } catch (StorageErrorException e) { System.out.println("Failed to create snapshot on share. Reasons: " + e.getMessage()); } @@ -42,7 +41,7 @@ public static void main(String[] args) { try { shareClient.create(); } catch (StorageErrorException e) { - System.out.printf("Failed to create the share %s with share client. Reasons: %s\n", shareName, e.getMessage()); + System.out.printf("Failed to create the share %s with share client. Reasons: %s%n", shareName, e.getMessage()); } // Create 3 directories using share client for (int i = 0; i < 3; i++) { @@ -56,7 +55,7 @@ public static void main(String[] args) { // Create another snapshot on share. String shareSnapshot2 = null; try { - shareSnapshot2 = shareClient.createSnapshot().value().snapshot(); + shareSnapshot2 = shareClient.createSnapshot().snapshot(); } catch (StorageErrorException e) { System.out.println("Failed to create snapshot on share. Reasons: " + e.getMessage()); } @@ -71,34 +70,37 @@ public static void main(String[] args) { // Get the properties of the share with first snapshot. - ShareClient shareClientWithSnapshot1 = null; + ShareClient shareClientWithSnapshot1 = new ShareClientBuilder() + .endpoint(ENDPOINT) + .shareName(shareName) + .snapshot(shareSnapshot1) + .buildClient(); + try { - shareClientWithSnapshot1 = new ShareClientBuilder().endpoint(ENDPOINT) - .shareName(shareName).snapshot(shareSnapshot1).buildClient(); - Response shareProperties1 = shareClientWithSnapshot1.getProperties(); - System.out.println("This is the first snapshot eTag: " + shareProperties1.value().etag()); + ShareProperties shareProperties1 = shareClientWithSnapshot1.getProperties(); + System.out.println("This is the first snapshot eTag: " + shareProperties1.etag()); } catch (StorageErrorException e) { System.out.println("Failed to get properties for the first share snapshot. Reasons: " + e.getMessage()); } // Get the properties of the share with second snapshot. - ShareClient shareClientWithSnapshot2 = null; + ShareClient shareClientWithSnapshot2 = new ShareClientBuilder() + .endpoint(ENDPOINT) + .shareName(shareName) + .snapshot(shareSnapshot2) + .buildClient(); + try { - shareClientWithSnapshot2 = new ShareClientBuilder().endpoint(ENDPOINT) - .shareName(shareName).snapshot(shareSnapshot2).buildClient(); - Response shareProperties2 = shareClientWithSnapshot2.getProperties(); - System.out.println("This is the second snapshot eTag: " + shareProperties2.value().etag()); + ShareProperties shareProperties2 = shareClientWithSnapshot2.getProperties(); + System.out.println("This is the second snapshot eTag: " + shareProperties2.etag()); } catch (StorageErrorException e) { System.out.println("Failed to get properties for the second share snapshot. Reasons: " + e.getMessage()); } // Get the root directory and list all directories. try { - shareClient.getRootDirectoryClient().listFilesAndDirectories().forEach( - fileRef -> { - System.out.printf("Is the resource a file or directory?"); - } - ); + shareClient.getRootDirectoryClient().listFilesAndDirectories().forEach(resource -> + System.out.printf("Name: %s, Directory? %b%n", resource.name(), resource.isDirectory())); } catch (StorageErrorException e) { System.out.println("Failed to delete the share. Reasons: " + e.getMessage()); } diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java deleted file mode 100644 index 3e84a1bb90cf..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java +++ /dev/null @@ -1,319 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.implementation.http.UrlBuilder; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.FileProperty; -import com.azure.storage.file.models.FileRef; -import com.azure.storage.file.models.HandleItem; -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import reactor.test.StepVerifier; - -import static com.azure.storage.file.FileTestHelpers.setupClient; - -public class DirectoryAsyncClientTests extends DirectoryClientTestBase { - private final ClientLogger directoryAsyncLogger = new ClientLogger(DirectoryAsyncClientTests.class); - private static ShareClient shareClient; - private static String shareName = "dirsharename"; - private DirectoryAsyncClient client; - - @Override - public void beforeTest() { - beforeDirectoryTest(); - if (interceptorManager.isPlaybackMode()) { - client = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .directoryPath(dirName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, directoryAsyncLogger); - } else { - client = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .directoryPath(dirName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, directoryAsyncLogger); - } - } - - @BeforeClass - public static void beforeClass() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - FileServiceClient fileServiceClient = new FileServiceClientBuilder() - .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .buildClient(); - shareClient = fileServiceClient.getShareClient(shareName); - shareClient.create(); - } - - @AfterClass - public static void tearDown() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - shareClient.delete(); - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - } - - @Override - public void urlFromDirClient() { - if (interceptorManager.isPlaybackMode()) { - azureStorageFileEndpoint = "https://teststorage.file.core.windows.net/"; - } - UrlBuilder urlBuilder = UrlBuilder.parse(azureStorageFileEndpoint); - String endpointURL = new UrlBuilder().scheme(urlBuilder.scheme()).host(urlBuilder.host()).toString(); - Assert.assertTrue(endpointURL.equals(client.getDirectoryUrl().toString())); - } - - @Override - public void createMinFromDirClient() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createTwiceFromDirClient() { - client.create().block(); - StepVerifier.create(client.create()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void createWithMetadataFromDirClient() { - StepVerifier.create(client.create(basicMetadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void getFileClientFromDirClient() { - FileAsyncClient fileClient = client.getFileClient(testResourceNamer.randomName("getFileAsync", 16)); - Assert.assertNotNull(fileClient); - } - - @Override - public void getSubDirectoryClient() { - Assert.assertNotNull(client.getSubDirectoryClient("getSubdirectoryASync")); - } - - @Override - public void deleteFromDirClient() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteNotExistFromDirClient() { - StepVerifier.create(client.delete()) - .verifyErrorSatisfies(exception -> FileTestHelpers.assertExceptionErrorMessage(exception, "ResourceNotFound")); - - } - - @Override - public void getPropertiesFromDirClient() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.getProperties()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void clearMetadataFromDirClient() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.setMetadata(null)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void setMetadataFromDirClient() { - client.create().block(); - StepVerifier.create(client.setMetadata(basicMetadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void setMetadataInvalidKeyFromDirClient() { - client.create().block(); - StepVerifier.create(client.setMetadata(invalidMetadata)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void listFilesAndDirectoriesFromDirClient() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - List fileRefs = new ArrayList<>(); - int repeatTimes = 3; - // generate some subdirectories - String fileNameSameLayer = testResourceNamer.randomName("sameLayer", 16); - String fileNameNextLayer = testResourceNamer.randomName("nextLayer", 16); - - for (int i = 0; i < repeatTimes; i++) { - String directoryName = dirName + i; - DirectoryAsyncClient subDirectoryClient = client.getSubDirectoryClient(directoryName); - StepVerifier.create(subDirectoryClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - fileRefs.add(new FileRef(directoryName, true, null)); - - fileNameSameLayer = fileNameSameLayer + i; - fileNameNextLayer = fileNameNextLayer + i; - - StepVerifier.create(client.createFile(fileNameSameLayer, 1024)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - fileRefs.add(new FileRef(fileNameSameLayer, false, new FileProperty().contentLength(1024))); - StepVerifier.create(subDirectoryClient.createFile(fileNameNextLayer, 1024)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - } - - Collections.sort(fileRefs, new LexicographicComparator()); - StepVerifier.create(client.listFilesAndDirectories(null, null)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(0), fileRef)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(1), fileRef)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(2), fileRef)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(3), fileRef)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(4), fileRef)) - .assertNext(fileRef -> FileTestHelpers.assertFileRefsAreEqual(fileRefs.get(5), fileRef)) - .verifyComplete(); - } - - class LexicographicComparator implements Comparator { - @Override - public int compare(FileRef a, FileRef b) { - return a.name().compareToIgnoreCase(b.name()); - } - } - - @Override - public void getHandlesFromDirClient() { - // TODO: Need to figure out way of creating handlers first. - -// StepVerifier.create(client.create()) -// .assertNext(response -> StorageTestBase.assertResponseStatusCode(response, 201)) -// .verifyComplete(); -// StepVerifier.create(client.getHandles(null, true)) -// .assertNext(response -> Assert.assertNotNull(response)) -// .verifyComplete(); - } - - @Override - public void forceCloseHandlesFromDirClient() { - client.create().block(); - client.createFile("test", 1024); - Iterable handleItems = client.getHandles(null, true).toIterable(); - handleItems.forEach(handleItem -> { - StepVerifier.create(client.forceCloseHandles(handleItem.handleId(), true)) - .assertNext(numOfClosedHandles -> Assert.assertTrue(numOfClosedHandles.longValue() > 0)) - .verifyComplete(); - }); - } - - @Override - public void createSubDirectory() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.createSubDirectory(testResourceNamer.randomName("dir", 16))) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createSubDirectoryWithMetadata() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.createSubDirectory(testResourceNamer.randomName("dir", 16), basicMetadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createSubDirectoryTwiceSameMetadata() { - StepVerifier.create(client.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - String dirName = testResourceNamer.randomName("dir", 16); - StepVerifier.create(client.createSubDirectory(dirName, basicMetadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.createSubDirectory(dirName, basicMetadata)) - .verifyErrorSatisfies(exception -> FileTestHelpers.assertExceptionErrorMessage(exception, "ResourceAlreadyExists")); - } - - @Override - public void deleteSubDirectory() { - client.create().block(); - String dirName = testResourceNamer.randomName("dir", 16); - StepVerifier.create(client.createSubDirectory(dirName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.deleteSubDirectory(dirName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void createFileFromDirClient() { - client.create().block(); - StepVerifier.create(client.createFile("testfile", 1024)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createFileWithoutCreateDirFromDirClient() { - StepVerifier.create(client.createFile("testfile", 1024)) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void deleteFileFromDirClient() { - client.create().block(); - client.createFile("testfile", 1024).block(); - StepVerifier.create(client.deleteFile("testfile")) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteFileWithoutCreateFileFromDirClient() { - client.create().block(); - StepVerifier.create(client.deleteFile("testfile")) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTestBase.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTestBase.java deleted file mode 100644 index f86f1c2ec14a..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTestBase.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.test.TestBase; -import com.azure.core.util.configuration.ConfigurationManager; -import java.util.Collections; -import java.util.Map; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.rules.TestName; - -public abstract class DirectoryClientTestBase extends TestBase { - protected String dirName; - protected String shareName; - - String azureStorageFileEndpoint = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_FILE_ENDPOINT"); - final Map basicMetadata = Collections.singletonMap("test", "metadata"); - final Map invalidMetadata = Collections.singletonMap("1", "metadata"); - - @Rule - public TestName testName = new TestName(); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - void beforeDirectoryTest() { - dirName = testResourceNamer.randomName("directory", 16); - } - - /** - * Gets the name of the current test being run. - *

            - * NOTE: This could not be implemented in the base class using {@link TestName} because it always returns {@code - * null}. See https://stackoverflow.com/a/16113631/4220757. - * - * @return The name of the current test. - */ - @Override - protected String testName() { - return testName.getMethodName(); - } - - @Test - public abstract void urlFromDirClient(); - - @Test - public abstract void getFileClientFromDirClient(); - - @Test - public abstract void getSubDirectoryClient(); - - @Test - public abstract void createMinFromDirClient(); - - @Test - public abstract void createTwiceFromDirClient(); - - @Test - public abstract void createWithMetadataFromDirClient(); - - @Test - public abstract void deleteFromDirClient(); - - @Test - public abstract void deleteNotExistFromDirClient(); - - @Test - public abstract void getPropertiesFromDirClient(); - - @Test - public abstract void clearMetadataFromDirClient(); - - @Test - public abstract void setMetadataFromDirClient(); - - @Test - public abstract void setMetadataInvalidKeyFromDirClient(); - - @Test - public abstract void listFilesAndDirectoriesFromDirClient(); - - @Test - public abstract void getHandlesFromDirClient(); - - @Test - public abstract void forceCloseHandlesFromDirClient(); - - @Test - public abstract void createSubDirectory(); - - @Test - public abstract void createSubDirectoryWithMetadata(); - - @Test - public abstract void createSubDirectoryTwiceSameMetadata(); - - @Test - public abstract void deleteSubDirectory(); - - @Test - public abstract void createFileFromDirClient(); - - @Test - public abstract void createFileWithoutCreateDirFromDirClient(); - - @Test - public abstract void deleteFileFromDirClient(); - - @Test - public abstract void deleteFileWithoutCreateFileFromDirClient(); -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTests.java deleted file mode 100644 index ce73781ae3a5..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryClientTests.java +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.implementation.http.UrlBuilder; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.FileRef; -import com.azure.storage.file.models.StorageErrorException; -import java.time.Duration; -import java.util.Iterator; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; - -import static com.azure.storage.file.FileTestHelpers.setupClient; -import static org.junit.Assert.assertTrue; - -public class DirectoryClientTests extends DirectoryClientTestBase { - private final ClientLogger directoryLogger = new ClientLogger(DirectoryClientTests.class); - private static String shareName = "dirsharename"; - private static ShareClient shareClient; - private DirectoryClient directoryClient; - - @Override - public void beforeTest() { - beforeDirectoryTest(); - if (interceptorManager.isPlaybackMode()) { - directoryClient = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .directoryPath(dirName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, directoryLogger); - } else { - directoryClient = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .directoryPath(dirName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, directoryLogger); - } - } - - @BeforeClass - public static void beforeClass() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - FileServiceClient fileServiceClient = new FileServiceClientBuilder() - .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .buildClient(); - shareClient = fileServiceClient.getShareClient(shareName); - shareClient.create(); - } - - @AfterClass - public static void tearDown() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - shareClient.delete(); - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - } - - @Override - public void urlFromDirClient() { - if (interceptorManager.isPlaybackMode()) { - azureStorageFileEndpoint = "https://teststorage.file.core.windows.net/"; - } - UrlBuilder urlBuilder = UrlBuilder.parse(azureStorageFileEndpoint); - String endpointURL = new UrlBuilder().scheme(urlBuilder.scheme()).host(urlBuilder.host()).toString(); - Assert.assertEquals(endpointURL, directoryClient.getDirectoryUrl().toString()); - } - - @Override - public void createMinFromDirClient() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(), 201); - } - - @Override - public void createTwiceFromDirClient() { - directoryClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceAlreadyExists"); - directoryClient.create(); - } - - @Override - public void createWithMetadataFromDirClient() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(basicMetadata), 201); - } - - @Override - public void getFileClientFromDirClient() { - Assert.assertNotNull(directoryClient.getFileClient(testResourceNamer.randomName("getFileSync", 16))); - } - - @Override - public void getSubDirectoryClient() { - Assert.assertNotNull(directoryClient.getSubDirectoryClient("getSubdirectorySync")); - } - - @Override - public void deleteFromDirClient() { - directoryClient.create(); - FileTestHelpers.assertResponseStatusCode(directoryClient.delete(), 202); - } - - @Override - public void deleteNotExistFromDirClient() { - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceNotFound"); - directoryClient.delete(); - } - - @Override - public void getPropertiesFromDirClient() { - directoryClient.create(); - FileTestHelpers.assertResponseStatusCode(directoryClient.getProperties(), 200); - } - - @Override - public void clearMetadataFromDirClient() { - directoryClient.create(); - FileTestHelpers.assertResponseStatusCode(directoryClient.setMetadata(null), 200); - } - - @Override - public void setMetadataFromDirClient() { - directoryClient.create(); - FileTestHelpers.assertResponseStatusCode(directoryClient.setMetadata(basicMetadata), 200); - } - - @Override - public void setMetadataInvalidKeyFromDirClient() { - directoryClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("InvalidMetadata"); - directoryClient.setMetadata(invalidMetadata); - } - - @Override - public void listFilesAndDirectoriesFromDirClient() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(), 201); - int repeatTimes = 3; - String fileNameSameLayer = testResourceNamer.randomName("sameLayer", 16); - String fileNameNextLayer = testResourceNamer.randomName("nextLayer", 16); - for (int i = 0; i < repeatTimes; i++) { - DirectoryClient subDirClient = directoryClient.getSubDirectoryClient(dirName + i); - FileTestHelpers.assertResponseStatusCode(subDirClient.create(), 201); - fileNameSameLayer = fileNameSameLayer + i; - fileNameNextLayer = fileNameNextLayer + i; - FileTestHelpers.assertResponseStatusCode(directoryClient.createFile(fileNameSameLayer, 1024), 201); - FileTestHelpers.assertResponseStatusCode(subDirClient.createFile(fileNameNextLayer, 1024), 201); - } - - Iterable fileRefs = directoryClient.listFilesAndDirectories(); - - int count = 0; - Iterator it = fileRefs.iterator(); - while (it.hasNext()) { - count++; - FileRef ref = it.next(); - Assert.assertNotNull(ref); - if (!ref.isDirectory()) { - assertTrue("It is supposed to list the files in same layer.", ref.name().contains("samelayer")); - } - } - Assert.assertEquals(repeatTimes * 2, count); - } - - @Override - public void getHandlesFromDirClient() { - // TODO: Need to open channel and create handlers first. -// StorageTestBase.assertResponseStatusCode(directoryClient.create(), 201); -// Assert.assertTrue(directoryClient.getHandles(null, true).iterator().hasNext()); - } - - @Override - public void forceCloseHandlesFromDirClient() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(), 201); - directoryClient.getHandles(null, true).forEach( - handleItem -> { - directoryClient.forceCloseHandles(handleItem.handleId(), true).forEach( - numberOfClosedHandles -> assertTrue(numberOfClosedHandles > 0) - ); - } - ); - } - - @Override - public void createSubDirectory() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(), 201); - FileTestHelpers.assertResponseStatusCode(directoryClient.createSubDirectory(testResourceNamer.randomName("directory", 16)), 201); - } - - @Override - public void createSubDirectoryWithMetadata() { - FileTestHelpers.assertResponseStatusCode(directoryClient.create(), 201); - FileTestHelpers.assertResponseStatusCode(directoryClient.createSubDirectory(testResourceNamer.randomName("directory", 16), basicMetadata), 201); - } - - @Override - public void createSubDirectoryTwiceSameMetadata() { - directoryClient.create(); - String dirName = testResourceNamer.randomName("dir", 16); - FileTestHelpers.assertResponseStatusCode(directoryClient.createSubDirectory(dirName, basicMetadata), 201); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceAlreadyExists"); - directoryClient.createSubDirectory(dirName, basicMetadata); - } - - - @Override - public void deleteSubDirectory() { - directoryClient.create(); - String dirName = testResourceNamer.randomName("dir", 16); - FileTestHelpers.assertResponseStatusCode(directoryClient.createSubDirectory(dirName), 201); - FileTestHelpers.assertResponseStatusCode(directoryClient.deleteSubDirectory(dirName), 202); - } - - @Override - public void createFileFromDirClient() { - directoryClient.create(); - FileTestHelpers.assertResponseStatusCode(directoryClient.createFile("testfile", 1024), 201); - } - - @Override - public void createFileWithoutCreateDirFromDirClient() { - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ParentNotFound"); - directoryClient.createFile("testfile", 1024); - } - - @Override - public void deleteFileFromDirClient() { - directoryClient.create(); - directoryClient.createFile("testfile", 1024); - FileTestHelpers.assertResponseStatusCode(directoryClient.deleteFile("testfile"), 202); - } - - @Override - public void deleteFileWithoutCreateFileFromDirClient() { - directoryClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceNotFound"); - directoryClient.deleteFile("testfile"); - } - -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAsyncClientTest.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAsyncClientTest.java deleted file mode 100644 index 262cc4b0b98d..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAsyncClientTest.java +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.FileHTTPHeaders; -import com.azure.storage.file.models.HandleItem; -import java.io.File; -import java.net.URL; -import java.nio.file.Files; -import java.time.Duration; -import java.util.Arrays; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; - -import static com.azure.storage.file.FileTestHelpers.assertTwoFilesAreSame; -import static com.azure.storage.file.FileTestHelpers.setupClient; - -public class FileAsyncClientTest extends FileClientTestBase { - private final ClientLogger fileAsyncLogger = new ClientLogger(FileAsyncClientTest.class); - String filePath; - private static String shareName = "filesharename"; - private static String dirName = "testdir/"; - private static ShareClient shareClient; - private FileAsyncClient fileAsyncClient; - - @Override - public void beforeTest() { - filePath = dirName + testResourceNamer.randomName("file", 16); - if (interceptorManager.isPlaybackMode()) { - fileAsyncClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .filePath(filePath) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, fileAsyncLogger); - } else { - fileAsyncClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .filePath(filePath) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, fileAsyncLogger); - } - } - @BeforeClass - public static void beforeClass() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - FileServiceClient fileServiceClient = new FileServiceClientBuilder() - .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .buildClient(); - shareClient = fileServiceClient.getShareClient(shareName); - shareClient.create(); - shareClient.createDirectory(dirName); - } - - @AfterClass - public static void tearDown() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - shareClient.delete(); - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - } - - @Override - public void createFromFileClient() { - StepVerifier.create(fileAsyncClient.create(1024)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(fileAsyncClient.getProperties()) - .assertNext(filePropertiesResponse -> Assert.assertTrue(filePropertiesResponse.value().contentLength() == 1024)) - .verifyComplete(); - } - - @Override - public void createExcessMaxSizeFromFileClient() { - StepVerifier.create(fileAsyncClient.create(1024 * 1024 * 1024 * 1024, null, null)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(fileAsyncClient.getProperties()) - .assertNext(filePropertiesResponse -> Assert.assertTrue(filePropertiesResponse.value().contentLength() == 0)) - .verifyComplete(); - } - - @Override - public void startCopy() throws Exception { - fileAsyncClient.create(1024).block(); - String sourceURL = fileAsyncClient.getFileUrl().toString() + "/" + shareName + "/" + filePath; - StepVerifier.create(fileAsyncClient.startCopy(sourceURL, null)) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 202); - Assert.assertTrue(response.value().copyId() != null); - }) - .verifyComplete(); - } - - @Override - public void abortCopy() { - // TODO: need to mock a pending copy process. - } - - @Override - public void downloadWithProperties() { - fileAsyncClient.create(1024, null, null).block(); - StepVerifier.create(fileAsyncClient.downloadWithProperties()) - .assertNext(response -> FileTestHelpers.assertResponseListStatusCode(response, Arrays.asList(200, 206))) - .verifyComplete(); - } - - @Override - public void uploadToStorageAndDownloadToFile() throws Exception { - URL fileFolder = FileClientTestBase.class.getClassLoader().getResource("testfiles"); - File uploadFile = new File(fileFolder.getPath() + "/helloworld"); - File downloadFile = new File(fileFolder.getPath() + "/testDownload"); - - if (!Files.exists(downloadFile.toPath())) { - downloadFile.createNewFile(); - } - fileAsyncClient.create(uploadFile.length()).block(); - StepVerifier.create(fileAsyncClient.uploadFromFile(uploadFile.toString())) - .verifyComplete(); - StepVerifier.create(fileAsyncClient.downloadToFile(downloadFile.toString())) - .verifyComplete(); - - assertTwoFilesAreSame(uploadFile, downloadFile); - } - - @Override - public void deleteFromFileClient() { - fileAsyncClient.create(1024, null, null).block(); - StepVerifier.create(fileAsyncClient.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void getPropertiesFromFileClient() { - fileAsyncClient.create(1024).block(); - StepVerifier.create(fileAsyncClient.getProperties()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void setHttpHeadersFromFileClient() { - fileAsyncClient.create(1024).block(); - FileHTTPHeaders headers = new FileHTTPHeaders(); - headers.fileContentMD5(new byte[0]); - StepVerifier.create(fileAsyncClient.setHttpHeaders(1024, headers)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void setMeatadataFromFileClient() { - fileAsyncClient.create(1024).block(); - StepVerifier.create(fileAsyncClient.setMetadata(basicMetadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void upload() { - fileAsyncClient.create(1024 * 5, null, null).block(); - StepVerifier.create(fileAsyncClient.upload(Flux.just(defaultData), defaultData.readableBytes())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void listRangesFromFileClient() { - fileAsyncClient.create(512, null, null).block(); - fileAsyncClient.upload(Flux.just(defaultData), defaultData.readableBytes()).block(); - StepVerifier.create(fileAsyncClient.listRanges()) - .assertNext(response -> Assert.assertTrue(response.start() == 0 && response.end() == 511)) - .verifyComplete(); - } - - @Override - public void listHandlesFromFileClient() { - //TODO: need to create a handle first - fileAsyncClient.create(1024).block(); - StepVerifier.create(fileAsyncClient.listHandles()) - .verifyComplete(); - } - - @Override - public void forceCloseHandlesFromFileClient() { - //TODO: need to figureout create a handle first - fileAsyncClient.create(1024).block(); - Iterable handles = fileAsyncClient.listHandles(10).toIterable(); - handles.forEach( - response -> { - StepVerifier.create(fileAsyncClient.forceCloseHandles(response.handleId())) - .assertNext(forceCloseHandles -> Assert.assertTrue(forceCloseHandles > 0)) - .verifyComplete(); - } - ); - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTest.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTest.java deleted file mode 100644 index 7a08972b0109..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTest.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.rest.Response; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.FileCopyInfo; -import com.azure.storage.file.models.FileHTTPHeaders; -import com.azure.storage.file.models.FileInfo; -import com.azure.storage.file.models.FileProperties; -import com.azure.storage.file.models.FileRange; -import java.io.File; -import java.net.URL; -import java.nio.file.Files; -import java.time.Duration; -import java.util.Arrays; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; - -import static com.azure.storage.file.FileTestHelpers.assertTwoFilesAreSame; -import static com.azure.storage.file.FileTestHelpers.setupClient; - -public class FileClientTest extends FileClientTestBase { - private final ClientLogger fileLogger = new ClientLogger(FileClientTest.class); - private static String shareName = "filesharename"; - private static String dirName = "testdir/"; - private static ShareClient shareClient; - String filePath; - - private FileClient fileClient; - - @Override - public void beforeTest() { - filePath = dirName + testResourceNamer.randomName("file", 16); - if (interceptorManager.isPlaybackMode()) { - fileClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .filePath(filePath) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, fileLogger); - } else { - fileClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .filePath(filePath) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, fileLogger); - } - } - @BeforeClass - public static void beforeClass() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - FileServiceClient fileServiceClient = new FileServiceClientBuilder() - .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .buildClient(); - shareClient = fileServiceClient.getShareClient(shareName); - shareClient.create(); - shareClient.createDirectory(dirName); - } - - @AfterClass - public static void tearDown() { - if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { - return; - } - shareClient.delete(); - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - } - - @Override - public void createFromFileClient() { - FileTestHelpers.assertResponseStatusCode(fileClient.create(1024), 201); - Assert.assertTrue(fileClient.getProperties().value().contentLength() == 1024); - } - - @Override - public void createExcessMaxSizeFromFileClient() { - FileTestHelpers.assertResponseStatusCode(fileClient.create(1024 * 1024 * 1024 * 1024, null, null), 201); - Assert.assertTrue(fileClient.getProperties().value().contentLength() == 0); - } - - @Override - public void startCopy() throws Exception { - FileTestHelpers.assertResponseStatusCode(fileClient.create(1024, null, null), 201); - String sourceURL = fileClient.getFileUrl().toString() + "/" + shareName + "/" + filePath; - Response copyInfoResponse = fileClient.startCopy(sourceURL, null); - FileTestHelpers.assertResponseStatusCode(copyInfoResponse, 202); - Assert.assertTrue(copyInfoResponse.value().copyId() != null); - } - - @Override - public void abortCopy() { - // TODO: Need to construct or mock a copy with pending status - } - - @Override - public void downloadWithProperties() { - fileClient.create(1024, null, null); - FileRange range = new FileRange(0, 1024L); - FileTestHelpers.assertResponseListStatusCode(fileClient.downloadWithProperties(range, null), Arrays.asList(200, 206)); - } - - @Override - public void uploadToStorageAndDownloadToFile() throws Exception { - URL fileFolder = FileClientTestBase.class.getClassLoader().getResource("testfiles"); - File uploadFile = new File(fileFolder.getPath() + "/helloworld"); - File downloadFile = new File(fileFolder.getPath() + "/testDownload"); - - if (!Files.exists(downloadFile.toPath())) { - downloadFile.createNewFile(); - } - - fileClient.create(uploadFile.length()); - fileClient.uploadFromFile(uploadFile.toString()); - fileClient.downloadToFile(downloadFile.toString()); - assertTwoFilesAreSame(uploadFile, downloadFile); - } - - @Override - public void deleteFromFileClient() { - fileClient.create(1024, null, null); - FileTestHelpers.assertResponseStatusCode(fileClient.delete(), 202); - } - - @Override - public void getPropertiesFromFileClient() { - fileClient.create(1024, null, null); - Response propertiesResponse = fileClient.getProperties(); - Assert.assertNotNull(propertiesResponse.value()); - Assert.assertNotNull(propertiesResponse.value().contentLength() == 1024); - Assert.assertNotNull(propertiesResponse.value().eTag()); - Assert.assertNotNull(propertiesResponse.value().lastModified()); - } - - @Override - public void setHttpHeadersFromFileClient() { - fileClient.create(1024, null, null); - FileHTTPHeaders headers = new FileHTTPHeaders(); - headers.fileContentMD5(new byte[0]); - Response response = fileClient.setHttpHeaders(1024, headers); - FileTestHelpers.assertResponseStatusCode(response, 200); - Assert.assertNotNull(response.value().eTag()); - } - - @Override - public void setMeatadataFromFileClient() { - fileClient.create(1024, null, null); - FileTestHelpers.assertResponseStatusCode(fileClient.setMetadata(basicMetadata), 200); - } - - @Override - public void upload() { - fileClient.create(1024 * 5, null, null); - FileTestHelpers.assertResponseStatusCode(fileClient.upload(defaultData, defaultData.readableBytes()), 201); - } - - @Override - public void listRangesFromFileClient() { - fileClient.create(1024, null, null); - fileClient.upload(defaultData, defaultData.readableBytes()); - fileClient.listRanges(new FileRange(0, 511L)).forEach( - fileRangeInfo -> { - Assert.assertTrue(fileRangeInfo.start() == 0); - Assert.assertTrue(fileRangeInfo.end() == 511); - } - ); - } - - @Override - public void listHandlesFromFileClient() { - //TODO: need to find a way to create handles. - fileClient.create(1024); - fileClient.listHandles().forEach( - handleItem -> { - Assert.assertNotNull(handleItem.handleId()); - } - ); - } - - @Override - public void forceCloseHandlesFromFileClient() { - fileClient.create(1024, null, null); - fileClient.listHandles(10).forEach( - handleItem -> { - Assert.assertNotNull(fileClient.forceCloseHandles(handleItem.handleId())); - } - ); - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTestBase.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTestBase.java deleted file mode 100644 index 9aba9e055bbc..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileClientTestBase.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.test.TestBase; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import java.nio.charset.StandardCharsets; -import java.util.Collections; -import java.util.Map; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.rules.TestName; - -public abstract class FileClientTestBase extends TestBase { - final Map basicMetadata = Collections.singletonMap("test", "metadata"); - static final String DEFAULT_TEXT = "default"; - final ByteBuf defaultData = Unpooled.wrappedBuffer(DEFAULT_TEXT.getBytes(StandardCharsets.UTF_8)); - - @Rule - public TestName testName = new TestName(); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - /** - * Gets the name of the current test being run. - *

            - * NOTE: This could not be implemented in the base class using {@link TestName} because it always returns {@code - * null}. See https://stackoverflow.com/a/16113631/4220757. - * - * @return The name of the current test. - */ - @Override - protected String testName() { - return testName.getMethodName(); - } - - @Test - public abstract void createFromFileClient(); - - @Test - public abstract void createExcessMaxSizeFromFileClient(); - - @Test - public abstract void startCopy() throws Exception; - - @Test - public abstract void abortCopy(); - - @Test - public abstract void downloadWithProperties(); - - @Test - public abstract void uploadToStorageAndDownloadToFile() throws Exception; - - @Test - public abstract void deleteFromFileClient(); - - @Test - public abstract void getPropertiesFromFileClient(); - - @Test - public abstract void setHttpHeadersFromFileClient(); - - @Test - public abstract void setMeatadataFromFileClient(); - - @Test - public abstract void upload(); - - @Test - public abstract void listRangesFromFileClient() throws Exception; - - @Test - public abstract void listHandlesFromFileClient(); - - @Test - public abstract void forceCloseHandlesFromFileClient(); -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java deleted file mode 100644 index 8f7c96dc579c..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java +++ /dev/null @@ -1,470 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.CorsRule; -import com.azure.storage.file.models.FileServiceProperties; -import com.azure.storage.file.models.ListSharesOptions; -import com.azure.storage.file.models.Metrics; -import com.azure.storage.file.models.RetentionPolicy; -import com.azure.storage.file.models.ShareItem; -import com.azure.storage.file.models.ShareProperties; -import com.azure.storage.file.models.StorageErrorException; -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import reactor.test.StepVerifier; - -import static com.azure.storage.file.FileTestHelpers.setupClient; -import static org.junit.Assert.fail; - -public class FileServiceClientAsyncTests extends FileServiceClientTestBase { - private final ClientLogger fileServiceAsyncLogger = new ClientLogger(FileServiceClientAsyncTests.class); - - private FileServiceAsyncClient fileServiceAsyncClient; - - @Override - public void beforeTest() { - shareName = getShareName(); - - if (interceptorManager.isPlaybackMode()) { - fileServiceAsyncClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() - .connectionString(connectionString) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, fileServiceAsyncLogger); - } else { - fileServiceAsyncClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() - .connectionString(connectionString) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, fileServiceAsyncLogger); - } - } - - @Override - public void afterTest() { - fileServiceAsyncClient.listShares(new ListSharesOptions().prefix(shareName)) - .collectList() - .block() - .forEach(share -> { - ShareAsyncClient client = fileServiceAsyncClient.getShareAsyncClient(share.name()); - try { - client.delete().block(); - } catch (StorageErrorException ex) { - // Share already deleted, that's what we wanted anyways. - } - }); - } - - @Override - public void getShareDoesNotCreateAShare() { - ShareAsyncClient client = fileServiceAsyncClient.getShareAsyncClient(shareName); - try { - client.getStatistics().block(); - fail("getShareAsyncClient shouldn't create a share in Azure."); - } catch (Exception ex) { - FileTestHelpers.assertExceptionStatusCode(ex, 404); - } - } - - @Override - public void createShare() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createShareTwiceSameMetadata() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void createShareTwiceDifferentMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName, metadata, null)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void createShareInvalidQuota() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName, null, -1)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName, null, 9999999)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void deleteShare() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.deleteShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteShareDoesNotExist() { - StepVerifier.create(fileServiceAsyncClient.deleteShare(shareName)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void deleteThenCreateShareFromFileServiceClient() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.deleteShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void deleteThenCreateShareTooSoonFromFileServiceClient() { - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.deleteShare(shareName)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void listShares() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - testShares.add(share); - StepVerifier.create(fileServiceAsyncClient.createShare(share.name(), share.metadata(), share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions())) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void listSharesWithPrefix() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.name(shareName + "prefix" + i); - testShares.add(share); - } else { - share.name(shareName + i); - } - - StepVerifier.create(fileServiceAsyncClient.createShare(share.name(), share.metadata(), share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().prefix(shareName + "prefix"))) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void listSharesWithLimit() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - testShares.add(share); - StepVerifier.create(fileServiceAsyncClient.createShare(share.name(), share.metadata(), share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().maxResults(2))) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void listSharesInvalidMaxResults() { - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().maxResults(-1))) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().maxResults(0))) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void listSharesIncludeMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.metadata(metadata); - } - - testShares.add(share); - StepVerifier.create(fileServiceAsyncClient.createShare(share.name(), share.metadata(), share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().includeMetadata(true))) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void listSharesIncludeSnapshots() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - ShareAsyncClient client = fileServiceAsyncClient.getShareAsyncClient(share.name()); - - StepVerifier.create(client.create(null, share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - if (i % 2 == 0) { - StepVerifier.create(client.createSnapshot()) - .assertNext(response -> { - testShares.add(new ShareItem().name(share.name()) - .snapshot(response.value().snapshot()) - .properties(share.properties())); - - FileTestHelpers.assertResponseStatusCode(response, 201); - }) - .verifyComplete(); - } - - testShares.add(share); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().includeSnapshots(true))) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void listSharesIncludeMetadataAndSnapshots() { - Map metadata = Collections.singletonMap("test", "metadata"); - - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.metadata(metadata); - } - - ShareAsyncClient client = fileServiceAsyncClient.getShareAsyncClient(share.name()); - - StepVerifier.create(client.create(share.metadata(), share.properties().quota())) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - if (i % 2 == 0) { - StepVerifier.create(client.createSnapshot()) - .assertNext(response -> { - testShares.add(new ShareItem().name(share.name()) - .snapshot(response.value().snapshot()) - .properties(share.properties())); - - FileTestHelpers.assertResponseStatusCode(response, 201); - }) - .verifyComplete(); - } - - testShares.add(share); - } - - StepVerifier.create(fileServiceAsyncClient.listShares(defaultOptions().includeMetadata(true).includeSnapshots(true))) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .assertNext(share -> FileTestHelpers.assertSharesAreEqual(testShares.pop(), share)) - .verifyComplete(); - } - - @Override - public void setFileServiceProperties() { - FileServiceProperties originalProperties = fileServiceAsyncClient.getProperties().block().value(); - - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties updatedProperties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(new ArrayList<>()); - - StepVerifier.create(fileServiceAsyncClient.setProperties(updatedProperties)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.getProperties()) - .assertNext(response -> FileTestHelpers.assertFileServicePropertiesAreEqual(updatedProperties, response.value())) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.setProperties(originalProperties)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(fileServiceAsyncClient.getProperties()) - .assertNext(response -> FileTestHelpers.assertFileServicePropertiesAreEqual(originalProperties, response.value())) - .verifyComplete(); - } - - @Override - public void setPropertiesTooManyRules() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - List cors = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - cors.add(new CorsRule()); - } - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(cors); - - StepVerifier.create(fileServiceAsyncClient.setProperties(properties)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesInvalidAllowedHeader() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedHeaders(reallyLongString))); - - StepVerifier.create(fileServiceAsyncClient.setProperties(properties)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesInvalidExposedHeader() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().exposedHeaders(reallyLongString))); - - StepVerifier.create(fileServiceAsyncClient.setProperties(properties)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesInvalidAllowedOrigin() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedOrigins(reallyLongString))); - - StepVerifier.create(fileServiceAsyncClient.setProperties(properties)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesInvalidAllowedMethod() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedMethods("NOTAREALHTTPMETHOD"))); - - StepVerifier.create(fileServiceAsyncClient.setProperties(properties)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTestBase.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTestBase.java deleted file mode 100644 index 6a34f910052f..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTestBase.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.test.TestBase; -import com.azure.storage.file.models.ListSharesOptions; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; - -public abstract class FileServiceClientTestBase extends TestBase { - String shareName; - - String reallyLongString = "thisisareallylongstringthatexceedsthe64characterlimitallowedoncertainproperties"; - - @Rule - public TestName testName = new TestName(); - - /** - * Gets the name of the current test being run. - *

            - * NOTE: This could not be implemented in the base class using {@link TestName} because it always returns {@code - * null}. See https://stackoverflow.com/a/16113631/4220757. - * - * @return The name of the current test. - */ - @Override - protected String testName() { - return testName.getMethodName(); - } - - String getShareName() { - return testResourceNamer.randomName("share", 16).toLowerCase(); - } - - ListSharesOptions defaultOptions() { - return new ListSharesOptions().prefix(shareName); - } - - @Test - public abstract void getShareDoesNotCreateAShare(); - - @Test - public abstract void createShare(); - - @Test - public abstract void createShareTwiceSameMetadata(); - - @Test - public abstract void createShareTwiceDifferentMetadata(); - - @Test - public abstract void createShareInvalidQuota(); - - @Test - public abstract void deleteShare(); - - @Test - public abstract void deleteShareDoesNotExist(); - - @Test - public abstract void deleteThenCreateShareFromFileServiceClient(); - - /** - * Cannot re-create a share within 30 seconds of it being deleted. - */ - @Test - public abstract void deleteThenCreateShareTooSoonFromFileServiceClient(); - - @Test - public abstract void listShares(); - - @Test - public abstract void listSharesWithPrefix(); - - @Test - public abstract void listSharesWithLimit(); - - @Test - public abstract void listSharesInvalidMaxResults(); - - @Test - public abstract void listSharesIncludeMetadata(); - - @Test - public abstract void listSharesIncludeSnapshots(); - - @Test - public abstract void listSharesIncludeMetadataAndSnapshots(); - - @Test - public abstract void setFileServiceProperties(); - - @Test - public abstract void setPropertiesTooManyRules(); - - /** - * A header in AllowedHeaders is not allowed to exceed 256 characters. - */ - @Test - public abstract void setPropertiesInvalidAllowedHeader(); - - /** - * A header in ExposedHeaders is not allowed to exceed 256 characters. - */ - @Test - public abstract void setPropertiesInvalidExposedHeader(); - - /** - * An origin in AllowedOrigins is not allowed to exceed 256 characters. - */ - @Test - public abstract void setPropertiesInvalidAllowedOrigin(); - - /** - * AllowedMethods only supports DELETE, GET, HEAD, MERGE, POST, OPTIONS, and PUT. - */ - @Test - public abstract void setPropertiesInvalidAllowedMethod(); -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTests.java deleted file mode 100644 index f8795d6048af..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileServiceClientTests.java +++ /dev/null @@ -1,477 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.rest.Response; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.CorsRule; -import com.azure.storage.file.models.FileServiceProperties; -import com.azure.storage.file.models.ListSharesOptions; -import com.azure.storage.file.models.Metrics; -import com.azure.storage.file.models.RetentionPolicy; -import com.azure.storage.file.models.ShareInfo; -import com.azure.storage.file.models.ShareItem; -import com.azure.storage.file.models.ShareProperties; -import com.azure.storage.file.models.ShareSnapshotInfo; -import com.azure.storage.file.models.StorageErrorException; -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import static com.azure.storage.file.FileTestHelpers.setupClient; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.fail; - -public class FileServiceClientTests extends FileServiceClientTestBase { - private final ClientLogger fileServiceLogger = new ClientLogger(FileServiceClientTests.class); - - private FileServiceClient fileServiceClient; - - @Override - public void beforeTest() { - shareName = getShareName(); - - if (interceptorManager.isPlaybackMode()) { - fileServiceClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() - .connectionString(connectionString) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, fileServiceLogger); - } else { - fileServiceClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() - .connectionString(connectionString) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, fileServiceLogger); - } - } - - @Override - public void afterTest() { - for (ShareItem share : fileServiceClient.listShares(new ListSharesOptions().prefix(shareName))) { - ShareClient client = fileServiceClient.getShareClient(share.name()); - try { - client.delete(); - } catch (StorageErrorException ex) { - // Share already deleted, that's what we wanted anyways. - } - } - } - - @Override - public void getShareDoesNotCreateAShare() { - ShareClient client = fileServiceClient.getShareClient(shareName); - try { - client.getStatistics(); - fail("getShareAsyncClient shouldn't create a share in Azure."); - } catch (Exception ex) { - FileTestHelpers.assertExceptionStatusCode(ex, 404); - } - } - - @Override - public void createShare() { - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - } - - @Override - public void createShareTwiceSameMetadata() { - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - - try { - fileServiceClient.createShare(shareName); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 409); - } - } - - @Override - public void createShareTwiceDifferentMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - - try { - fileServiceClient.createShare(shareName, metadata, null); - fail("Attempting to create the share twice with different metadata should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 409); - } - } - - @Override - public void createShareInvalidQuota() { - try { - fileServiceClient.createShare(shareName, null, -1); - fail("Attempting to create a share with a negative quota should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - - try { - fileServiceClient.createShare(shareName, null, 9999999); - fail("Attempting to create a share with a quota above 5120 GB should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void deleteShare() { - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.deleteShare(shareName), 202); - } - - @Override - public void deleteShareDoesNotExist() { - try { - fileServiceClient.deleteShare(shareName); - fail("Attempting to delete a share that doesn't exist should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void deleteThenCreateShareFromFileServiceClient() { - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.deleteShare(shareName), 202); - - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - } - - @Override - public void deleteThenCreateShareTooSoonFromFileServiceClient() { - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.deleteShare(shareName), 202); - - try { - fileServiceClient.createShare(shareName); - fail("Attempting to re-create a share within 30 seconds of deleting it should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 409); - } - } - - @Override - public void listShares() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - testShares.add(share); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(share.name(), share.metadata(), share.properties().quota()), 201); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions()).iterator(); - for (int i = 0; i < 3; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void listSharesWithPrefix() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.name(shareName + "prefix" + i); - testShares.add(share); - } else { - share.name(shareName + i); - } - - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(share.name(), share.metadata(), share.properties().quota()), 201); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions().prefix(shareName + "prefix")).iterator(); - for (int i = 0; i < 2; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void listSharesWithLimit() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - testShares.add(share); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(share.name(), share.metadata(), share.properties().quota()), 201); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions().maxResults(2)).iterator(); - for (int i = 0; i < 2; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void listSharesInvalidMaxResults() { - try { - fileServiceClient.listShares(defaultOptions().maxResults(-1)).iterator().hasNext(); - fail("Attempting to list shares with a negative maximum should throw an error"); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - - try { - fileServiceClient.listShares(defaultOptions().maxResults(0)).iterator().hasNext(); - fail("Attempting to list shares with a zero maximum should throw an error"); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void listSharesIncludeMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.metadata(metadata); - } - - testShares.add(share); - FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(share.name(), share.metadata(), share.properties().quota()), 201); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions().includeMetadata(true)).iterator(); - for (int i = 0; i < 3; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void listSharesIncludeSnapshots() { - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - ShareClient client = fileServiceClient.getShareClient(share.name()); - - Response createResponse = client.create(null, share.properties().quota()); - FileTestHelpers.assertResponseStatusCode(createResponse, 201); - - if (i % 2 == 0) { - Response snapshotResponse = client.createSnapshot(); - FileTestHelpers.assertResponseStatusCode(snapshotResponse, 201); - - testShares.add(new ShareItem().name(share.name()) - .snapshot(snapshotResponse.value().snapshot()) - .properties(new ShareProperties().quota(share.properties().quota()))); - } - - testShares.add(share); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions().includeSnapshots(true)).iterator(); - for (int i = 0; i < 5; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void listSharesIncludeMetadataAndSnapshots() { - Map metadata = Collections.singletonMap("test", "metadata"); - - LinkedList testShares = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - ShareItem share = new ShareItem().name(shareName + i) - .properties(new ShareProperties().quota(2)); - - if (i % 2 == 0) { - share.metadata(metadata); - } - - ShareClient client = fileServiceClient.getShareClient(share.name()); - - Response createResponse = client.create(share.metadata(), share.properties().quota()); - FileTestHelpers.assertResponseStatusCode(createResponse, 201); - - if (i % 2 == 0) { - Response snapshotResponse = client.createSnapshot(); - FileTestHelpers.assertResponseStatusCode(snapshotResponse, 201); - - testShares.add(new ShareItem().name(share.name()) - .snapshot(snapshotResponse.value().snapshot()) - .properties(share.properties())); - } - - testShares.add(share); - } - - Iterator shares = fileServiceClient.listShares(defaultOptions().includeMetadata(true).includeSnapshots(true)).iterator(); - for (int i = 0; i < 5; i++) { - FileTestHelpers.assertSharesAreEqual(testShares.pop(), shares.next()); - } - assertFalse(shares.hasNext()); - } - - @Override - public void setFileServiceProperties() { - FileServiceProperties originalProperties = fileServiceClient.getProperties().value(); - - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties updatedProperties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(new ArrayList<>()); - - FileTestHelpers.assertResponseStatusCode(fileServiceClient.setProperties(updatedProperties), 202); - - Response getResponse = fileServiceClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(getResponse, 200); - FileTestHelpers.assertFileServicePropertiesAreEqual(updatedProperties, getResponse.value()); - - FileTestHelpers.assertResponseStatusCode(fileServiceClient.setProperties(originalProperties), 202); - - getResponse = fileServiceClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(getResponse, 200); - FileTestHelpers.assertFileServicePropertiesAreEqual(originalProperties, getResponse.value()); - } - - @Override - public void setPropertiesTooManyRules() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - List cors = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - cors.add(new CorsRule()); - } - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(cors); - - try { - fileServiceClient.setProperties(properties); - fail("Attempting to set more than 5 CorsRules on files should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setPropertiesInvalidAllowedHeader() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedHeaders(reallyLongString))); - - try { - fileServiceClient.setProperties(properties); - fail("Attempting to set an allowed header longer than 64 characters should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setPropertiesInvalidExposedHeader() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().exposedHeaders(reallyLongString))); - - try { - fileServiceClient.setProperties(properties); - fail("Attempting to set an exposed header longer than 64 characters should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setPropertiesInvalidAllowedOrigin() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedOrigins(reallyLongString))); - - try { - fileServiceClient.setProperties(properties); - fail("Attempting to set an allowed origin longer than 64 characters should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setPropertiesInvalidAllowedMethod() { - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - FileServiceProperties properties = new FileServiceProperties().hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(Collections.singletonList(new CorsRule().allowedMethods("NOTAREALHTTPMETHOD"))); - - try { - fileServiceClient.setProperties(properties); - fail("Attempting to set an invalid allowed method should throw an exception."); - } catch (Exception exception) { - FileTestHelpers.assertExceptionStatusCode(exception, 400); - } - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileTestHelpers.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileTestHelpers.java deleted file mode 100644 index d9ea09ede4c3..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileTestHelpers.java +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.rest.Response; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.core.test.InterceptorManager; -import com.azure.core.test.TestBase; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.CorsRule; -import com.azure.storage.file.models.FileRef; -import com.azure.storage.file.models.FileServiceProperties; -import com.azure.storage.file.models.Metrics; -import com.azure.storage.file.models.RetentionPolicy; -import com.azure.storage.file.models.ShareItem; -import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.security.NoSuchAlgorithmException; -import java.time.Duration; -import java.util.List; -import java.util.Locale; -import java.util.function.BiFunction; -import org.junit.Assert; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -class FileTestHelpers { - private static final String AZURE_TEST_MODE = "AZURE_TEST_MODE"; - - static T setupClient(BiFunction clientBuilder, boolean isPlayback, ClientLogger logger) { - String connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;AccountKey=atestaccountkey;EndpointSuffix=core.windows.net"; - String endpoint = "https://teststorage.file.core.windows.net/"; - - if (!isPlayback) { - connectionString = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING"); - endpoint = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_FILE_ENDPOINT"); - } - - if (ImplUtils.isNullOrEmpty(connectionString) && ImplUtils.isNullOrEmpty(endpoint)) { - logger.warning("Connection string or endpoint must be set to buildClient the testing client"); - fail(); - return null; - } - - return clientBuilder.apply(connectionString, endpoint); - } - - static ShareClientBuilder createShareClientWithSnapshot(InterceptorManager interceptorManager, String shareName, String snapshot) { - String connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;AccountKey=atestaccountkey;EndpointSuffix=core.windows.net"; - String endpoint = "https://teststorage.file.core.windows.net/"; - - ShareClientBuilder shareClientBuilder; - if (!interceptorManager.isPlaybackMode()) { - connectionString = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING"); - endpoint = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_FILE_ENDPOINT"); - shareClientBuilder = new ShareClientBuilder() - .endpoint(endpoint) - .connectionString(connectionString) - .addPolicy(interceptorManager.getRecordPolicy()) - .shareName(shareName) - .snapshot(snapshot); - } else { - shareClientBuilder = new ShareClientBuilder() - .endpoint(endpoint) - .connectionString(connectionString) - .httpClient(interceptorManager.getPlaybackClient()) - .shareName(shareName) - .snapshot(snapshot); - } - return shareClientBuilder; - } - - static void assertResponseStatusCode(Response response, int expectedStatusCode) { - assertEquals(expectedStatusCode, response.statusCode()); - } - - static void assertResponseListStatusCode(Response response, List expectedStatusCodeList) { - for (Integer expectedStatusCode: expectedStatusCodeList) { - if (expectedStatusCode == response.statusCode()) { - return; - } - } - fail("The response status code did not include in the list."); - } - - static void assertExceptionStatusCode(Throwable throwable, int expectedStatusCode) { - assertTrue(throwable instanceof StorageErrorException); - StorageErrorException exception = (StorageErrorException) throwable; - assertEquals(expectedStatusCode, exception.response().statusCode()); - } - - static void assertExceptionErrorMessage(Throwable throwable, String message) { - assertTrue(throwable instanceof StorageErrorException); - StorageErrorException exception = (StorageErrorException) throwable; - assertTrue(exception.getMessage().contains(message)); - } - - static void assertExceptionStatusCode(Runnable thrower, int expectedStatusCode) { - try { - thrower.run(); - fail(); - } catch (Exception ex) { - assertTrue(ex instanceof StorageErrorException); - StorageErrorException exception = (StorageErrorException) ex; - assertEquals(expectedStatusCode, exception.response().statusCode()); - } - } - - static void sleepInRecordMode(Duration duration) { - if (getTestMode() == TestMode.RECORD) { - sleep(duration); - } - } - - static void sleep(Duration duration) { - try { - Thread.sleep(duration.toMillis()); - } catch (InterruptedException ex) { - // Ignore the exception - } - } - - static void assertSharesAreEqual(ShareItem expected, ShareItem actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.name(), actual.name()); - assertEquals(expected.properties().quota(), actual.properties().quota()); - - if (expected.metadata() != null) { - assertEquals(expected.metadata(), actual.metadata()); - } - - if (expected.snapshot() != null) { - assertEquals(expected.snapshot(), actual.snapshot()); - } - } - } - - static void assertFileServicePropertiesAreEqual(FileServiceProperties expected, FileServiceProperties actual) { - if (expected == null) { - assertNull(actual); - } else { - assertMetricsAreEqual(expected.hourMetrics(), actual.hourMetrics()); - assertMetricsAreEqual(expected.minuteMetrics(), actual.minuteMetrics()); - assertCorsAreEqual(expected.cors(), actual.cors()); - } - } - - static void assertFileRefsAreEqual(FileRef expected, FileRef actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.name(), actual.name()); - assertEquals(expected.isDirectory(), actual.isDirectory()); - - if (expected.fileProperties() != null && actual.fileProperties() != null) { - assertEquals(expected.fileProperties().contentLength(), actual.fileProperties().contentLength()); - } - } - } - - static void assertPermissionsAreEqual(SignedIdentifier expected, SignedIdentifier actual) { - assertEquals(expected.id(), actual.id()); - assertEquals(expected.accessPolicy().permission(), actual.accessPolicy().permission()); - assertEquals(expected.accessPolicy().start(), actual.accessPolicy().start()); - assertEquals(expected.accessPolicy().expiry(), actual.accessPolicy().expiry()); - } - - static TestMode getTestMode() { - final Logger logger = LoggerFactory.getLogger(TestBase.class); - final String azureTestMode = ConfigurationManager.getConfiguration().get(AZURE_TEST_MODE); - - if (azureTestMode != null) { - try { - return TestMode.valueOf(azureTestMode.toUpperCase(Locale.US)); - } catch (IllegalArgumentException e) { - if (logger.isErrorEnabled()) { - logger.error("Could not parse '{}' into TestEnum. Using 'Playback' mode.", azureTestMode); - } - - return TestMode.PLAYBACK; - } - } - - if (logger.isInfoEnabled()) { - logger.info("Environment variable '{}' has not been set yet. Using 'Playback' mode.", AZURE_TEST_MODE); - } - return TestMode.PLAYBACK; - } - - private static void assertMetricsAreEqual(Metrics expected, Metrics actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.enabled(), actual.enabled()); - assertEquals(expected.includeAPIs(), actual.includeAPIs()); - assertEquals(expected.version(), actual.version()); - assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()); - } - } - - static void assertTwoFilesAreSame(File f1, File f2) throws IOException, NoSuchAlgorithmException { - List uploadFileString = Files.readAllLines(f1.toPath()); - List downloadFileString = Files.readAllLines(f2.toPath()); - if (uploadFileString != null && downloadFileString != null) { - downloadFileString.removeAll(uploadFileString); - } - while (!downloadFileString.isEmpty()) { - Assert.assertTrue("The download file is supposed to be the same as the upload file.", downloadFileString.get(0).isEmpty()); - downloadFileString.remove(0); - } - } - - private static void assertRetentionPoliciesAreEqual(RetentionPolicy expected, RetentionPolicy actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.days(), actual.days()); - assertEquals(expected.enabled(), actual.enabled()); - } - } - - private static void assertCorsAreEqual(List expected, List actual) { - if (expected == null) { - assertTrue(ImplUtils.isNullOrEmpty(actual)); - } else { - assertEquals(expected.size(), actual.size()); - for (int i = 0; i < expected.size(); i++) { - assertCorRulesAreEqual(expected.get(i), actual.get(i)); - } - } - } - - private static void assertCorRulesAreEqual(CorsRule expected, CorsRule actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.allowedHeaders(), actual.allowedHeaders()); - assertEquals(expected.allowedMethods(), actual.allowedMethods()); - assertEquals(expected.allowedOrigins(), actual.allowedOrigins()); - assertEquals(expected.exposedHeaders(), actual.exposedHeaders()); - assertEquals(expected.maxAgeInSeconds(), actual.maxAgeInSeconds()); - } - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/LargeFileTest.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/LargeFileTest.java deleted file mode 100644 index db25264a92de..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/LargeFileTest.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.file; - -import com.azure.core.test.TestBase; -import com.azure.core.test.TestMode; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.RandomAccessFile; -import java.net.URL; -import java.nio.file.Files; -import java.security.MessageDigest; -import java.time.Duration; -import java.time.OffsetDateTime; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; - -import static org.junit.Assert.fail; -import static org.junit.Assume.assumeTrue; - -public class LargeFileTest extends TestBase { - private final ClientLogger largeFileLogger = new ClientLogger(LargeFileTest.class); - private final String azureStorageConnectionString = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING"); - private static final String LARGE_TEST_FOLDER = "test-large-files/"; - private static FileClient largeFileClient; - private static String fileName; - private static File largeFile; - private ShareClient shareClient; - private File dirPath; - - @Rule - public TestName testName = new TestName(); - - @Before - public void setup() { - assumeTrue("The test is only for live mode.", FileTestHelpers.getTestMode() == TestMode.RECORD); - fileName = testResourceNamer.randomName("largefile", 16); - URL folderUrl = LargeFileTest.class.getClassLoader().getResource("."); - dirPath = new File(folderUrl.getPath() + LARGE_TEST_FOLDER); - if (dirPath.exists() || dirPath.mkdir()) { - largeFile = new File(folderUrl.getPath() + LARGE_TEST_FOLDER + fileName); - } else { - largeFileLogger.warning("Failed to create the large file dir."); - } - String shareName = testResourceNamer.randomName("largefileshare", 32); - shareClient = new ShareClientBuilder().connectionString(azureStorageConnectionString).shareName(shareName) - .buildClient(); - shareClient.create(); - shareClient.createDirectory("largefiledir"); - largeFileClient = shareClient.getDirectoryClient("largefiledir").getFileClient(fileName); - } - - @Ignore - @Test - public void uploadAndDownloadLargeFile() throws Exception { - Long fileSize = 5 * 1024 * 1024L; - RandomAccessFile raf = new RandomAccessFile(largeFile, "rw"); - raf.setLength(fileSize); - largeFileClient.create(fileSize); - if (largeFile.exists()) { - largeFileClient.uploadFromFile(largeFile.getPath()); - largeFileLogger.warning("Uploaded success!"); - } else { - fail("Did not find the upload file."); - } - OffsetDateTime start = OffsetDateTime.now(); - File downloadFile = new File(dirPath + "/" + testResourceNamer.randomName("download", 16)); - downloadFile.createNewFile(); - largeFileClient.downloadToFile(downloadFile.getPath()); - System.out.println("Download " + downloadFile.length() + " bytes took " + Duration.between(start, OffsetDateTime.now()).getSeconds() + " seconds"); - if (Files.exists(downloadFile.toPath()) && Files.exists(largeFile.toPath())) { - String checksumUpload = getFileChecksum(largeFile); - String checksumDownload = getFileChecksum(downloadFile); - Assert.assertEquals(checksumUpload, checksumDownload); - } else { - fail("Did not find the download file."); - } - } - - @After - public void cleanUp() { - assumeTrue("The test is only for live mode.", FileTestHelpers.getTestMode() == TestMode.RECORD); - shareClient.delete(); - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - } - - private String getFileChecksum(File file) throws Exception { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(Files.readAllBytes(file.toPath())); - int numRead; - InputStream fis = new FileInputStream(file.getPath()); - byte[] buffer = new byte[1024]; - do { - numRead = fis.read(buffer); - if (numRead > 0) { - md.update(buffer, 0, numRead); - } - } while (numRead != -1); - - fis.close(); - byte[] digestByte = md.digest(); - String result = ""; - for (int i = 0; i < digestByte.length; i++) { - result += Integer.toString((digestByte[i] & 0xff) + 0x100, 16).substring(1); - } - return result; - } - - /** - * Gets the name of the current test being run. - *

            - * NOTE: This could not be implemented in the base class using {@link TestName} because it always returns {@code - * null}. See https://stackoverflow.com/a/16113631/4220757. - * - * @return The name of the current test. - */ - @Override - protected String testName() { - return testName.getMethodName(); - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java deleted file mode 100644 index 694cf3c2ffa9..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java +++ /dev/null @@ -1,668 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.rest.Response; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.AccessPolicy; -import com.azure.storage.file.models.ShareSnapshotInfo; -import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import org.junit.Assert; -import reactor.test.StepVerifier; - -import static com.azure.storage.file.FileTestHelpers.createShareClientWithSnapshot; -import static com.azure.storage.file.FileTestHelpers.setupClient; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class ShareAsyncClientTests extends ShareClientTestBase { - private final ClientLogger shareAsyncLogger = new ClientLogger(ShareAsyncClientTests.class); - - private ShareAsyncClient shareAsyncClient; - - @Override - public void beforeTest() { - shareName = getShareName(); - - if (interceptorManager.isPlaybackMode()) { - shareAsyncClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, shareAsyncLogger); - } else { - shareAsyncClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, shareAsyncLogger); - } - } - - @Override - public void afterTest() { - try { - shareAsyncClient.delete().block(); - } catch (StorageErrorException ex) { - // Ignore the exception as the share is already deleted and that is what we wanted. - } - } - - @Override - public void getRootDirectoryDoesNotCreateADirectory() { - shareAsyncClient.create().block(); - DirectoryAsyncClient directoryAsyncClient = shareAsyncClient.getRootDirectoryClient(); - StepVerifier.create(directoryAsyncClient.getProperties()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - } - - @Override - public void getDirectoryDoesNotCreateADirectory() { - shareAsyncClient.create().block(); - DirectoryAsyncClient directoryAsyncClient = shareAsyncClient.getDirectoryClient("testshare"); - Assert.assertNotNull(directoryAsyncClient); - StepVerifier.create(directoryAsyncClient.getProperties()) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void getFileClientDoesNotCreateAFile() { - shareAsyncClient.create().block(); - FileAsyncClient fileAsyncClient = shareAsyncClient.getFileClient("testfile"); - Assert.assertNotNull(fileAsyncClient); - StepVerifier.create(fileAsyncClient.getProperties()) - .verifyErrorSatisfies(response -> Assert.assertTrue(response instanceof HttpResponseException)); - } - - @Override - public void createDirectoryFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createDirectory("testshare")) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createDirectoryInvalidNameFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createDirectory("test/share")) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void createDirectoryAlreadyExistsFromShareClient() { - shareAsyncClient.create().block(); - shareAsyncClient.createDirectory("testshare").block(); - StepVerifier.create(shareAsyncClient.createDirectory("testshare")) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 409)); - } - - @Override - public void deleteDirectoryFromShareClient() { - shareAsyncClient.create().block(); - shareAsyncClient.createDirectory("testshare").block(); - StepVerifier.create(shareAsyncClient.deleteDirectory("testshare")) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteDirectoryDoesNotExistFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.deleteDirectory("testshare")) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void createFileFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createFile("myFile", 1024)) - .assertNext(fileAsyncClientResponse -> FileTestHelpers.assertResponseStatusCode(fileAsyncClientResponse, 201)) - .verifyComplete(); - } - - @Override - public void createFileInvalidNameFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createFile("my/File", 1024)) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void createFileAlreadyExistsFromShareClient() { - shareAsyncClient.create().block(); - shareAsyncClient.createFile("myFile", 1024).block(); - StepVerifier.create(shareAsyncClient.createFile("myFile", 1024)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void deleteFileFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createFile("myFile", 1024)) - .assertNext(fileAsyncClientResponse -> FileTestHelpers.assertResponseStatusCode(fileAsyncClientResponse, 201)) - .verifyComplete(); - StepVerifier.create(shareAsyncClient.deleteFile("myFile")) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteFileDoesNotExistFromShareClient() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.deleteFile("myFile")) - .verifyErrorSatisfies(response -> FileTestHelpers.assertExceptionStatusCode(response, 404)); - } - - @Override - public void createFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createTwiceSameMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void createTwiceDifferentMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void createInvalidQuotaFromShareClient() { - StepVerifier.create(shareAsyncClient.create(null, -1)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - - StepVerifier.create(shareAsyncClient.create(null, 0)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void deleteFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - } - - @Override - public void deleteDoesNotExistFromShareClient() { - StepVerifier.create(shareAsyncClient.delete()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void deleteThenCreateFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void deleteThenCreateTooSoonFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.create()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void snapshot() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.createSnapshot()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void deleteSnapshotFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Response snapshotInfoResponse = shareAsyncClient.createSnapshot().block(); - assertNotNull(snapshotInfoResponse); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot( - interceptorManager, shareName, snapshotInfoResponse.value().snapshot()).buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.delete()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.createSnapshot()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void snapshotSameMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Response snapshotInfoResponse = shareAsyncClient.createSnapshot(metadata).block(); - assertNotNull(snapshotInfoResponse); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot( - interceptorManager, shareName, snapshotInfoResponse.value().snapshot()).buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void snapshotDifferentMetadata() { - Map createMetadata = Collections.singletonMap("create", "metadata"); - - StepVerifier.create(shareAsyncClient.create(createMetadata, 2)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Map updateMetadata = Collections.singletonMap("update", "metadata"); - Response snapshotInfoResponse = shareAsyncClient.createSnapshot(updateMetadata).block(); - assertNotNull(snapshotInfoResponse); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(createMetadata, response.value().metadata()); - }) - .verifyComplete(); - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, snapshotInfoResponse.value().snapshot()).buildAsyncClient(); - - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(updateMetadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void snapshotDoesNotExist() { - StepVerifier.create(shareAsyncClient.createSnapshot()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getPropertiesFromShareClient() { - final int quotaInGB = 2; - Map metadata = Collections.singletonMap("test", "metadata"); - - StepVerifier.create(shareAsyncClient.create(metadata, quotaInGB)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(quotaInGB, response.value().quota()); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getSnapshotPropertiesFromShareClient() { - final int quotaInGB = 2; - Map snapshotMetadata = Collections.singletonMap("snapshot", "metadata"); - - StepVerifier.create(shareAsyncClient.create(null, quotaInGB)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Response snapshotInfoResponse = shareAsyncClient.createSnapshot(snapshotMetadata).block(); - assertNotNull(snapshotInfoResponse); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, snapshotInfoResponse.value().snapshot()).buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(quotaInGB, response.value().quota()); - assertEquals(snapshotMetadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getPropertiesDoesNotExistFromShareClient() { - StepVerifier.create(shareAsyncClient.getProperties()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getSnapshotPropertiesDoesNotExist() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, "snapshot").buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesFromShareClient() { - final int initialQuoteInGB = 2; - - StepVerifier.create(shareAsyncClient.create(null, initialQuoteInGB)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(initialQuoteInGB, response.value().quota()); - }) - .verifyComplete(); - - final int updatedQuotaInGB = 4; - StepVerifier.create(shareAsyncClient.setQuota(updatedQuotaInGB)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(updatedQuotaInGB, response.value().quota()); - }) - .verifyComplete(); - } - - @Override - public void setPropertiesInvalidQuotaFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.setQuota(-1)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - - StepVerifier.create(shareAsyncClient.setQuota(9999)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPropertiesDoesNotExistFromShareClient() { - StepVerifier.create(shareAsyncClient.setQuota(2)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getSnapshotMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - StepVerifier.create(shareAsyncClient.create(metadata, 2)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Response snapshotInfoResponse = shareAsyncClient.createSnapshot().block(); - assertNotNull(snapshotInfoResponse); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, snapshotInfoResponse.value().snapshot()).buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getMetadataDoesNotExistFromShareClient() { - StepVerifier.create(shareAsyncClient.getProperties()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getSnapshotMetadataDoesNotExistFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, "snapshot").buildAsyncClient(); - StepVerifier.create(shareAsyncClientWithSnapshot.getProperties()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setMetadataFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Map metadata = Collections.singletonMap("setting", "metadata"); - StepVerifier.create(shareAsyncClient.setMetadata(metadata)) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getProperties()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void setMetadataInvalidMetadataFromShareClient() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - Map metadata = Collections.singletonMap("", "metadata"); - StepVerifier.create(shareAsyncClient.setMetadata(metadata)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setMetadataDoesNotExistFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - StepVerifier.create(shareAsyncClient.setMetadata(metadata)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getPolicies() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getAccessPolicy()) - .expectNextCount(0) - .verifyComplete(); - } - - @Override - public void getPoliciesDoesNotExist() { - StepVerifier.create(shareAsyncClient.getAccessPolicy()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void setPolicies() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - AccessPolicy policy = new AccessPolicy().permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier().id("test") - .accessPolicy(policy); - - StepVerifier.create(shareAsyncClient.setAccessPolicy(Collections.singletonList(permission))) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 200)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getAccessPolicy()) - .assertNext(responsePermission -> FileTestHelpers.assertPermissionsAreEqual(permission, responsePermission)) - .verifyComplete(); - } - - @Override - public void setPoliciesInvalidPermission() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - AccessPolicy policy = new AccessPolicy().permission("abcdefg") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier().id("test") - .accessPolicy(policy); - - StepVerifier.create(shareAsyncClient.setAccessPolicy(Collections.singletonList(permission))) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPoliciesTooManyPermissions() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - List permissions = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - AccessPolicy policy = new AccessPolicy().permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - permissions.add(new SignedIdentifier().id("test" + i).accessPolicy(policy)); - } - - StepVerifier.create(shareAsyncClient.setAccessPolicy(permissions)) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setPoliciesDoesNotExist() { - AccessPolicy policy = new AccessPolicy().permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier().id("test") - .accessPolicy(policy); - - StepVerifier.create(shareAsyncClient.setAccessPolicy(Collections.singletonList(permission))) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getStats() { - StepVerifier.create(shareAsyncClient.create()) - .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(shareAsyncClient.getStatistics()) - .assertNext(response -> { - FileTestHelpers.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().getShareUsageInGB()); - }) - .verifyComplete(); - } - - @Override - public void getStatsDoesNotExist() { - StepVerifier.create(shareAsyncClient.getStatistics()) - .verifyErrorSatisfies(throwable -> FileTestHelpers.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getSnapshotId() { - shareAsyncClient.create().block(); - StepVerifier.create(shareAsyncClient.createSnapshot()) - .assertNext(response -> { - ShareAsyncClient shareAsyncClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, response.value().snapshot()).buildAsyncClient(); - Assert.assertEquals(response.value().snapshot(), shareAsyncClientWithSnapshot.getSnapshotId()); - }) - .verifyComplete(); - - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTestBase.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTestBase.java deleted file mode 100644 index 0601788ea732..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTestBase.java +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.test.TestBase; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.rules.TestName; - -public abstract class ShareClientTestBase extends TestBase { - String shareName; - - @Rule - public TestName testName = new TestName(); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - /** - * Gets the name of the current test being run. - *

            - * NOTE: This could not be implemented in the base class using {@link TestName} because it always returns {@code - * null}. See https://stackoverflow.com/a/16113631/4220757. - * - * @return The name of the current test. - */ - - @Override - public String testName() { - return testName.getMethodName(); - } - - String getShareName() { - return testResourceNamer.randomName("share", 16).toLowerCase(); - } - - @Test - public abstract void getRootDirectoryDoesNotCreateADirectory(); - - @Test - public abstract void getDirectoryDoesNotCreateADirectory(); - - @Test - public abstract void getFileClientDoesNotCreateAFile(); - - @Test - public abstract void createDirectoryFromShareClient(); - - @Test - public abstract void createDirectoryInvalidNameFromShareClient(); - - @Test - public abstract void createDirectoryAlreadyExistsFromShareClient(); - - @Test - public abstract void deleteDirectoryFromShareClient(); - - @Test - public abstract void deleteDirectoryDoesNotExistFromShareClient(); - - @Test - public abstract void createFileFromShareClient(); - - @Test - public abstract void createFileInvalidNameFromShareClient(); - - @Test - public abstract void createFileAlreadyExistsFromShareClient(); - - @Test - public abstract void deleteFileFromShareClient(); - - @Test - public abstract void deleteFileDoesNotExistFromShareClient(); - - @Test - public abstract void createFromShareClient(); - - @Test - public abstract void createTwiceSameMetadataFromShareClient(); - - @Test - public abstract void createTwiceDifferentMetadataFromShareClient(); - - @Test - public abstract void createInvalidQuotaFromShareClient(); - - @Test - public abstract void deleteFromShareClient(); - - @Test - public abstract void deleteDoesNotExistFromShareClient(); - - @Test - public abstract void deleteThenCreateFromShareClient(); - - /** - * Cannot re-create a share within 30 seconds of it being deleted. - */ - @Test - public abstract void deleteThenCreateTooSoonFromShareClient(); - - @Test - public abstract void snapshot(); - - @Test - public abstract void deleteSnapshotFromShareClient(); - - @Test - public abstract void snapshotSameMetadata(); - - @Test - public abstract void snapshotDifferentMetadata(); - - @Test - public abstract void snapshotDoesNotExist(); - - @Test - public abstract void getPropertiesFromShareClient(); - - @Test - public abstract void getSnapshotPropertiesFromShareClient(); - - @Test - public abstract void getPropertiesDoesNotExistFromShareClient(); - - @Test - public abstract void getSnapshotPropertiesDoesNotExist(); - - @Test - public abstract void setPropertiesFromShareClient(); - - @Test - public abstract void setPropertiesInvalidQuotaFromShareClient(); - - @Test - public abstract void setPropertiesDoesNotExistFromShareClient(); - - @Test - public abstract void getMetadataFromShareClient(); - - @Test - public abstract void getSnapshotMetadataFromShareClient(); - - @Test - public abstract void getMetadataDoesNotExistFromShareClient(); - - @Test - public abstract void getSnapshotMetadataDoesNotExistFromShareClient(); - - @Test - public abstract void setMetadataFromShareClient(); - - @Test - public abstract void setMetadataInvalidMetadataFromShareClient(); - - @Test - public abstract void setMetadataDoesNotExistFromShareClient(); - - @Test - public abstract void getPolicies(); - - @Test - public abstract void getPoliciesDoesNotExist(); - - @Test - public abstract void setPolicies(); - - @Test - public abstract void setPoliciesInvalidPermission(); - - @Test - public abstract void setPoliciesTooManyPermissions(); - - @Test - public abstract void setPoliciesDoesNotExist(); - - @Test - public abstract void getStats(); - - @Test - public abstract void getStatsDoesNotExist(); - - @Test - public abstract void getSnapshotId(); -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTests.java b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTests.java deleted file mode 100644 index ff5cc5485406..000000000000 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareClientTests.java +++ /dev/null @@ -1,534 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.rest.Response; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.file.models.AccessPolicy; -import com.azure.storage.file.models.DirectoryProperties; -import com.azure.storage.file.models.ShareProperties; -import com.azure.storage.file.models.ShareSnapshotInfo; -import com.azure.storage.file.models.ShareStatistics; -import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import org.junit.Assert; - -import static com.azure.storage.file.FileTestHelpers.createShareClientWithSnapshot; -import static com.azure.storage.file.FileTestHelpers.setupClient; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -public class ShareClientTests extends ShareClientTestBase { - private final ClientLogger shareLogger = new ClientLogger(ShareClient.class); - - private ShareClient shareClient; - - @Override - public void beforeTest() { - shareName = getShareName(); - - if (interceptorManager.isPlaybackMode()) { - shareClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, shareLogger); - } else { - shareClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() - .connectionString(connectionString) - .shareName(shareName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, shareLogger); - } - } - - @Override - public void afterTest() { - try { - shareClient.delete(); - } catch (StorageErrorException ex) { - // Ignore the exception as the share is already deleted and that is what we wanted. - } - } - - @Override - public void getRootDirectoryDoesNotCreateADirectory() { - shareClient.create(); - DirectoryClient directoryClient = shareClient.getRootDirectoryClient(); - Response response = directoryClient.getProperties(); - Assert.assertEquals(response.statusCode(), 200); - Assert.assertNotNull(response.value().eTag()); - } - - @Override - public void getDirectoryDoesNotCreateADirectory() { - shareClient.create(); - DirectoryClient directoryClient = shareClient.getDirectoryClient("testshare"); - Assert.assertNotNull(directoryClient); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceNotFound"); - directoryClient.getProperties(); - } - - @Override - public void getFileClientDoesNotCreateAFile() { - shareClient.create(); - FileClient fileClient = shareClient.getFileClient("testfile"); - Assert.assertNotNull(fileClient); - thrown.expect(HttpResponseException.class); - fileClient.getProperties(); - } - - @Override - public void createDirectoryFromShareClient() { - shareClient.create(); - FileTestHelpers.assertResponseStatusCode(shareClient.createDirectory("testshare"), 201); - } - - @Override - public void createDirectoryInvalidNameFromShareClient() { - shareClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ParentNotFound"); - shareClient.createDirectory("test/share"); - } - - @Override - public void createDirectoryAlreadyExistsFromShareClient() { - shareClient.create(); - shareClient.createDirectory("testshare"); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceAlreadyExists"); - shareClient.createDirectory("testshare"); - } - - @Override - public void deleteDirectoryFromShareClient() { - shareClient.create(); - shareClient.createDirectory("testshare"); - FileTestHelpers.assertResponseStatusCode(shareClient.deleteDirectory("testshare"), 202); - } - - @Override - public void deleteDirectoryDoesNotExistFromShareClient() { - shareClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceNotFound"); - shareClient.deleteDirectory("testshare"); - } - - @Override - public void createFileFromShareClient() { - shareClient.create(); - FileTestHelpers.assertResponseStatusCode(shareClient.createFile("myFile", 1024), 201); - } - - @Override - public void createFileInvalidNameFromShareClient() { - shareClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ParentNotFound"); - FileTestHelpers.assertResponseStatusCode(shareClient.createFile("my/File", 1024), 201); - } - - @Override - public void createFileAlreadyExistsFromShareClient() { - shareClient.create(); - shareClient.createFile("myFile", 1024); - FileTestHelpers.assertResponseStatusCode(shareClient.createFile("myFile", 1024), 201); - } - - @Override - public void deleteFileFromShareClient() { - shareClient.create(); - FileTestHelpers.assertResponseStatusCode(shareClient.createFile("myFile", 1024), 201); - FileTestHelpers.assertResponseStatusCode(shareClient.deleteFile("myFile"), 202); - } - - @Override - public void deleteFileDoesNotExistFromShareClient() { - shareClient.create(); - thrown.expect(StorageErrorException.class); - thrown.expectMessage("ResourceNotFound"); - shareClient.deleteFile("myFile"); - } - - @Override - public void createFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - } - - @Override - public void createTwiceSameMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(metadata, 2), 201); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.create(metadata, 2), 409); - } - - @Override - public void createTwiceDifferentMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.create(metadata, 2), 409); - } - - @Override - public void createInvalidQuotaFromShareClient() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.create(null, -1), 400); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.create(null, 0), 400); - } - - @Override - public void deleteFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertResponseStatusCode(shareClient.delete(), 202); - } - - @Override - public void deleteDoesNotExistFromShareClient() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.delete(), 404); - } - - @Override - public void deleteThenCreateFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertResponseStatusCode(shareClient.delete(), 202); - - FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - } - - @Override - public void deleteThenCreateTooSoonFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertResponseStatusCode(shareClient.delete(), 202); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.create(), 409); - } - - @Override - public void snapshot() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertResponseStatusCode(shareClient.createSnapshot(), 201); - } - - @Override - public void deleteSnapshotFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - Response snapshotInfoResponse = shareClient.createSnapshot(); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - snapshotInfoResponse.value().snapshot()).buildClient(); - FileTestHelpers.assertResponseStatusCode(shareClientWithSnapshot.delete(), 202); - - FileTestHelpers.assertResponseStatusCode(shareClient.createSnapshot(), 201); - } - - @Override - public void snapshotSameMetadata() { - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(metadata, 2), 201); - - Response snapshotInfoResponse = shareClient.createSnapshot(metadata); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - snapshotInfoResponse.value().snapshot()).buildClient(); - Response propertiesResponse = shareClientWithSnapshot.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void snapshotDifferentMetadata() { - Map createMetadata = Collections.singletonMap("create", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(createMetadata, 2), 201); - - Map updateMetadata = Collections.singletonMap("update", "metadata"); - Response snapshotInfoResponse = shareClient.createSnapshot(updateMetadata); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - Response propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(createMetadata, propertiesResponse.value().metadata()); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - snapshotInfoResponse.value().snapshot()).buildClient(); - propertiesResponse = shareClientWithSnapshot.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(updateMetadata, propertiesResponse.value().metadata()); - } - - @Override - public void snapshotDoesNotExist() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.createSnapshot(), 404); - } - - @Override - public void getPropertiesFromShareClient() { - final int quotaInGB = 2; - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(metadata, quotaInGB), 201); - - Response propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(quotaInGB, propertiesResponse.value().quota()); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void getSnapshotPropertiesFromShareClient() { - final int quotaInGB = 2; - Map snapshotMetadata = Collections.singletonMap("snapshot", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(null, quotaInGB), 201); - - Response snapshotInfoResponse = shareClient.createSnapshot(snapshotMetadata); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - snapshotInfoResponse.value().snapshot()).buildClient(); - Response propertiesResponse = shareClientWithSnapshot.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(quotaInGB, propertiesResponse.value().quota()); - assertEquals(snapshotMetadata, propertiesResponse.value().metadata()); - } - - @Override - public void getPropertiesDoesNotExistFromShareClient() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.getProperties(), 404); - } - - @Override - public void getSnapshotPropertiesDoesNotExist() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - "snapshot").buildClient(); - FileTestHelpers.assertExceptionStatusCode(() -> shareClientWithSnapshot.getProperties(), 400); - } - - @Override - public void setPropertiesFromShareClient() { - final int initialQuoteInGB = 2; - - FileTestHelpers.assertResponseStatusCode(shareClient.create(null, initialQuoteInGB), 201); - - Response propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(initialQuoteInGB, propertiesResponse.value().quota()); - - final int updatedQuotaInGB = 4; - FileTestHelpers.assertResponseStatusCode(shareClient.setQuota(updatedQuotaInGB), 200); - - propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(updatedQuotaInGB, propertiesResponse.value().quota()); - } - - @Override - public void setPropertiesInvalidQuotaFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setQuota(-1), 400); - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setQuota(9999), 400); - } - - @Override - public void setPropertiesDoesNotExistFromShareClient() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setQuota(2), 404); - } - - @Override - public void getMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - FileTestHelpers.assertResponseStatusCode(shareClient.create(metadata, 2), 201); - - Response propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void getSnapshotMetadataFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - - FileTestHelpers.assertResponseStatusCode(shareClient.create(metadata, 2), 201); - - Response snapshotInfoResponse = shareClient.createSnapshot(); - FileTestHelpers.assertResponseStatusCode(snapshotInfoResponse, 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - snapshotInfoResponse.value().snapshot()).buildClient(); - Response propertiesResponse = shareClientWithSnapshot.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void getMetadataDoesNotExistFromShareClient() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.getProperties(), 404); - } - - @Override - public void getSnapshotMetadataDoesNotExistFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, shareName, - "snapshot").buildClient(); - FileTestHelpers.assertExceptionStatusCode(() -> shareClientWithSnapshot.getProperties(), 400); - } - - @Override - public void setMetadataFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - Map metadata = Collections.singletonMap("setting", "metadata"); - FileTestHelpers.assertResponseStatusCode(shareClient.setMetadata(metadata), 200); - - Response propertiesResponse = shareClient.getProperties(); - FileTestHelpers.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void setMetadataInvalidMetadataFromShareClient() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - Map metadata = Collections.singletonMap("", "metadata"); - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setMetadata(metadata), 400); - } - - @Override - public void setMetadataDoesNotExistFromShareClient() { - Map metadata = Collections.singletonMap("test", "metadata"); - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setMetadata(metadata), 404); - } - - @Override - public void getPolicies() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - Iterator accessPolicies = shareClient.getAccessPolicy().iterator(); - assertFalse(accessPolicies.hasNext()); - } - - @Override - public void getPoliciesDoesNotExist() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.getAccessPolicy().iterator().hasNext(), 404); - } - - @Override - public void setPolicies() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - AccessPolicy policy = new AccessPolicy().permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier().id("test") - .accessPolicy(policy); - - FileTestHelpers.assertResponseStatusCode(shareClient.setAccessPolicy(Collections.singletonList(permission)), 200); - - Iterator permissions = shareClient.getAccessPolicy().iterator(); - FileTestHelpers.assertPermissionsAreEqual(permission, permissions.next()); - assertFalse(permissions.hasNext()); - } - - @Override - public void setPoliciesInvalidPermission() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - AccessPolicy policy = new AccessPolicy().permission("abcdefg") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier().id("test") - .accessPolicy(policy); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setAccessPolicy(Collections.singletonList(permission)), 400); - } - - @Override - public void setPoliciesTooManyPermissions() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - List permissions = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - AccessPolicy policy = new AccessPolicy().permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - permissions.add(new SignedIdentifier().id("test" + i).accessPolicy(policy)); - } - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setAccessPolicy(permissions), 400); - } - - @Override - public void setPoliciesDoesNotExist() { - AccessPolicy policy = new AccessPolicy().permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier().id("test") - .accessPolicy(policy); - - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.setAccessPolicy(Collections.singletonList(permission)), 404); - } - - @Override - public void getStats() { - FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); - - Response statisticsResponse = shareClient.getStatistics(); - FileTestHelpers.assertResponseStatusCode(statisticsResponse, 200); - assertEquals(0, statisticsResponse.value().getShareUsageInGB()); - } - - @Override - public void getStatsDoesNotExist() { - FileTestHelpers.assertExceptionStatusCode(() -> shareClient.getStatistics(), 404); - } - - @Override - public void getSnapshotId() { - shareClient.create(); - String actualSnapshot = shareClient.createSnapshot().value().snapshot(); - ShareClient shareClientWithSnapshot = createShareClientWithSnapshot(interceptorManager, - shareName, actualSnapshot).buildClient(); - Assert.assertEquals(actualSnapshot, shareClientWithSnapshot.getSnapshotId()); - } -} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/APISpec.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/APISpec.groovy new file mode 100644 index 000000000000..3aaeed739732 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/APISpec.groovy @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.core.http.policy.HttpLogDetailLevel +import com.azure.core.test.InterceptorManager +import com.azure.core.test.TestMode +import com.azure.core.test.utils.TestResourceNamer +import com.azure.core.util.configuration.ConfigurationManager +import com.azure.core.util.logging.ClientLogger +import com.azure.storage.file.DirectoryClientBuilder +import com.azure.storage.file.FileClientBuilder +import com.azure.storage.file.FileServiceAsyncClient +import com.azure.storage.file.FileServiceClient +import com.azure.storage.file.FileServiceClientBuilder +import com.azure.storage.file.ShareClientBuilder +import com.azure.storage.file.models.ListSharesOptions +import spock.lang.Specification + +class APISpec extends Specification { + // Field common used for all APIs. + def logger = new ClientLogger(APISpec.class) + def AZURE_TEST_MODE = "AZURE_TEST_MODE" + def tmpFolder = getClass().getClassLoader().getResource("tmptestfiles") + def testFolder = getClass().getClassLoader().getResource("testfiles") + def interceptorManager + def testResourceName + + // Primary Clients used for API tests + FileServiceClient primaryFileServiceClient + FileServiceAsyncClient primaryFileServiceAsyncClient + + + // Test name for test method name. + def methodName + def testMode = getTestMode() + def connectionString + + /** + * Setup the File service clients commonly used for the API tests. + */ + def setup() { + String testName = reformat(specificationContext.currentIteration.getName()) + String className = specificationContext.getCurrentSpec().getName() + methodName = className + testName + logger.info("Test Mode: {}, Name: {}", testMode, methodName) + interceptorManager = new InterceptorManager(methodName, testMode) + testResourceName = new TestResourceNamer(methodName, testMode, + interceptorManager.getRecordedData()) + if (getTestMode() == TestMode.RECORD) { + connectionString = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_FILE_CONNECTION_STRING") + } else { + connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;" + + "AccountKey=atestaccountkey;EndpointSuffix=core.windows.net" + } + } + + /** + * Clean up the test shares, directories and files for the account. + */ + def cleanup() { + interceptorManager.close() + if (getTestMode() == TestMode.RECORD) { + FileServiceClient cleanupFileServiceClient = new FileServiceClientBuilder() + .connectionString(connectionString) + .buildClient() + cleanupFileServiceClient.listShares(new ListSharesOptions().prefix(methodName.toLowerCase())).each { + cleanupFileServiceClient.deleteShare(it.name()) + } + } + } + + /** + * Test mode is initialized whenever test is executed. Helper method which is used to determine what to do under + * certain test mode. + * @return The TestMode: + *

              + *
            • Record
            • + *
            • Playback: (default if no test mode setup)
            • + *
            + */ + def getTestMode() { + def azureTestMode = ConfigurationManager.getConfiguration().get(AZURE_TEST_MODE) + + if (azureTestMode != null) { + try { + return TestMode.valueOf(azureTestMode.toUpperCase(Locale.US)) + } catch (IllegalArgumentException e) { + logger.error("Could not parse '{}' into TestEnum. Using 'Playback' mode.", azureTestMode) + return TestMode.PLAYBACK + } + } + + logger.info("Environment variable '{}' has not been set yet. Using 'Playback' mode.", AZURE_TEST_MODE) + return TestMode.PLAYBACK + } + + def fileServiceBuilderHelper(final InterceptorManager interceptorManager) { + if (testMode == TestMode.RECORD) { + return new FileServiceClientBuilder() + .connectionString(connectionString) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(interceptorManager.getRecordPolicy()) + } else { + return new FileServiceClientBuilder() + .connectionString(connectionString) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + def shareBuilderHelper(final InterceptorManager interceptorManager, final String shareName) { + if (testMode == TestMode.RECORD) { + return new ShareClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(interceptorManager.getRecordPolicy()) + } else { + return new ShareClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + def directoryBuilderHelper(final InterceptorManager interceptorManager, final String shareName, final String directoryPath) { + if (testMode == TestMode.RECORD) { + return new DirectoryClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .directoryPath(directoryPath) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(interceptorManager.getRecordPolicy()) + } else { + return new DirectoryClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .directoryPath(directoryPath) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + def fileBuilderHelper(final InterceptorManager interceptorManager, final String shareName, final String filePath) { + if (testMode == TestMode.RECORD) { + return new FileClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .filePath(filePath) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(interceptorManager.getRecordPolicy()) + } else { + return new FileClientBuilder() + .connectionString(connectionString) + .shareName(shareName) + .filePath(filePath) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + private def reformat(String text) { + def fullName = text.split(" ").collect { it.capitalize() }.join("") + def matcher = (fullName =~ /(.*)(\[)(.*)(\])/) + + if (!matcher.find()) { + return fullName + } + return matcher[0][1] + matcher[0][3] + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAPITests.groovy new file mode 100644 index 000000000000..26f00146a5ed --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAPITests.groovy @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.DirectoryClient +import com.azure.storage.file.FileClient +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.StorageErrorCode +import com.azure.storage.file.models.StorageErrorException +import spock.lang.Ignore +import spock.lang.Unroll + +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class DirectoryAPITests extends APISpec { + DirectoryClient primaryDirectoryClient + def directoryPath + def shareName + static def testMetadata + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + directoryPath = testResourceName.randomName(methodName, 60) + def shareClient = shareBuilderHelper(interceptorManager, shareName).buildClient() + shareClient.create() + primaryDirectoryClient = directoryBuilderHelper(interceptorManager, shareName, directoryPath).buildClient() + testMetadata = Collections.singletonMap("testmetadata", "value") + } + + def "Get directory URL"() { + given: + def accoutName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accoutName) + when: + def directoryURL = primaryDirectoryClient.getDirectoryUrl().toString() + then: + expectURL.equals(directoryURL) + } + + def "Get sub directory client"() { + given: + def subDirectoryClient = primaryDirectoryClient.getSubDirectoryClient("testSubDirectory") + expect: + subDirectoryClient instanceof DirectoryClient + } + + def "Get file client"() { + given: + def fileClient = primaryDirectoryClient.getFileClient("testFile") + expect: + fileClient instanceof FileClient + } + + def "Create directory"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryDirectoryClient.createWithResponse(null, null), 201) + } + + def "Create directory error"() { + given: + def testShareName = testResourceName.randomName(methodName, 60) + when: + directoryBuilderHelper(interceptorManager, testShareName, directoryPath).buildClient().create() + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Create directory with metadata"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryDirectoryClient.createWithResponse(testMetadata, null), 201) + } + + def "Create directory error with metadata"() { + given: + def errorMetadata = Collections.singletonMap("testMeta", "value") + when: + primaryDirectoryClient.createWithResponse(errorMetadata, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 403, StorageErrorCode.AUTHENTICATION_FAILED) + } + + def "Delete directory"() { + given: + primaryDirectoryClient.create() + expect: + FileTestHelper.assertResponseStatusCode(primaryDirectoryClient.deleteWithResponse(null), 202) + } + + def "Delete directory error"() { + when: + primaryDirectoryClient.delete() + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Get properties"() { + given: + primaryDirectoryClient.create() + def getPropertiesResponse = primaryDirectoryClient.getPropertiesWithResponse(null) + expect: + FileTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.value().eTag() + } + + def "Get properties error"() { + when: + primaryDirectoryClient.getPropertiesWithResponse(null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Set metadata"() { + given: + primaryDirectoryClient.createWithResponse(testMetadata, null) + def updatedMetadata = Collections.singletonMap("update", "value") + when: + def getPropertiesBefore = primaryDirectoryClient.getProperties() + def setPropertiesResponse = primaryDirectoryClient.setMetadataWithResponse(updatedMetadata, null) + def getPropertiesAfter = primaryDirectoryClient.getProperties() + then: + testMetadata.equals(getPropertiesBefore.metadata()) + FileTestHelper.assertResponseStatusCode(setPropertiesResponse, 200) + updatedMetadata.equals(getPropertiesAfter.metadata()) + } + + def "Set metadata error"() { + given: + primaryDirectoryClient.create() + def errorMetadata = Collections.singletonMap("", "value") + when: + primaryDirectoryClient.setMetadata(errorMetadata) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + + /** + * The listing hierarchy: + * share -> dir -> listOp0 (dir) -> listOp3 (file) + * -> listOp4 (file) + * -> listOp1 (dir) -> listOp5 (file) + * -> listOp6 (file) + * -> listOp2 (file) + */ + def "List files and directories"() { + given: + primaryDirectoryClient.create() + def nameList = new LinkedList() + def dirPrefix = testResourceName.randomName(methodName, 60) + for (int i = 0; i < 2; i++) { + def subDirClient = primaryDirectoryClient.getSubDirectoryClient(dirPrefix + i) + subDirClient.create() + for (int j = 0; j < 2; j++) { + def num = i * 2 + j + 3 + subDirClient.createFile(dirPrefix + num, 1024) + } + } + primaryDirectoryClient.createFile(dirPrefix + 2, 1024) + for (int i = 0; i < 3; i++) { + nameList.add(dirPrefix + i) + } + + when: + def fileRefIter = primaryDirectoryClient.listFilesAndDirectories().iterator() + then: + while (fileRefIter.hasNext()) { + Objects.equals(nameList.pop(), fileRefIter.next().name()) + } + nameList.isEmpty() + } + + /** + * The listing hierarchy: + * share -> dir -> listOp0 (dir) -> listOp3 (file) + * -> listOp4 (file) + * -> listOp1 (dir) -> listOp5 (file) + * -> listOp6 (file) + * -> listOp2 (file) + */ + @Unroll + def "List files and directories args"() { + given: + primaryDirectoryClient.create() + def nameList = new LinkedList() + def dirPrefix = testResourceName.randomName(methodName, 60) + for (int i = 0; i < 2; i++) { + def subDirClient = primaryDirectoryClient.getSubDirectoryClient(dirPrefix + i) + subDirClient.create() + for (int j = 0; j < 2; j++) { + def num = i * 2 + j + 3 + subDirClient.createFile(dirPrefix + num, 1024) + } + } + primaryDirectoryClient.createFile(dirPrefix + 2, 1024) + for (int i = 0; i < 3; i++) { + nameList.add(dirPrefix + i) + } + + when: + def fileRefIter = primaryDirectoryClient.listFilesAndDirectories(prefix, maxResults).iterator() + + then: + for (int i = 0; i < numOfResults; i++) { + Objects.equals(nameList.pop(), fileRefIter.next().name()) + } + !fileRefIter.hasNext() + + where: + prefix | maxResults | numOfResults + null | null | 3 + "directoryapitestslistfilesanddirectoriesargs" | 1 | 3 + "noOp" | 3 | 0 + } + + @Unroll + def "List handles"() { + given: + primaryDirectoryClient.create() + expect: + primaryDirectoryClient.listHandles(maxResult, recursive).size() == 0 + where: + maxResult | recursive + 2 | true + null | false + } + + def "List handles error"() { + when: + primaryDirectoryClient.listHandles(null, true) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + @Ignore + def "Force close handles"() { + // TODO: Need to find a way of mocking handles. + } + + def "Force close handles error"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.forceCloseHandles("handleId", true) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.INVALID_HEADER_VALUE) + } + + def "Create sub directory"() { + given: + primaryDirectoryClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.createSubDirectoryWithResponse("testCreateSubDirectory", null, null), 201) + } + + def "Create sub directory invalid name"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.createSubDirectory("test/subdirectory") + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.PARENT_NOT_FOUND) + } + + def "Create sub directory metadata"() { + given: + primaryDirectoryClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.createSubDirectoryWithResponse("testCreateSubDirectory", testMetadata, null), 201) + } + + def "Create sub directory metadata error"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.createSubDirectoryWithResponse("testsubdirectory", Collections.singletonMap("", "value"), null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + + def "Delete sub directory"() { + given: + def subDirectoryName = "testSubCreateDirectory" + primaryDirectoryClient.create() + primaryDirectoryClient.createSubDirectory(subDirectoryName) + expect: + FileTestHelper.assertResponseStatusCode(primaryDirectoryClient.deleteSubDirectoryWithResponse(subDirectoryName, null), 202) + } + + def "Delete sub directory error"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.deleteSubDirectory("testsubdirectory") + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + + def "Create file"() { + given: + primaryDirectoryClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.createFileWithResponse("testCreateFile", 1024, null, null, null), 201) + } + + @Unroll + def "Create file invalid args"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.createFileWithResponse(fileName, maxSize, null, null, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + fileName | maxSize | statusCode | errMsg + "test\file" | 1024 | 400 | "Bad Request" + "fileName" | -1 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + + } + + def "Create file maxOverload"() { + given: + primaryDirectoryClient.create() + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("txt") + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.createFileWithResponse("testCreateFile", 1024, httpHeaders, testMetadata, null), 201) + } + + @Unroll + def "Create file maxOverload invalid args"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.createFileWithResponse("test\file", maxSize, null, null, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, "Bad Request") + where: + fileName | maxSize | httpHeaders | metadata + "test\file" | 1024 | new FileHTTPHeaders() | testMetadata + "fileName" | -1 | new FileHTTPHeaders() | testMetadata + "fileName" | 1024 | new FileHTTPHeaders().fileContentMD5(new byte[0]) | testMetadata + "fileName" | 1024 | new FileHTTPHeaders() | Collections.singletonMap("", "value") + + } + + def "Delete file"() { + given: + def fileName = "testCreateFile" + primaryDirectoryClient.create() + primaryDirectoryClient.createFile(fileName, 1024) + expect: + FileTestHelper.assertResponseStatusCode( + primaryDirectoryClient.deleteFileWithResponse(fileName, null), 202) + } + + def "Delete file error"() { + given: + primaryDirectoryClient.create() + when: + primaryDirectoryClient.deleteFileWithResponse("testfile", null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = directoryBuilderHelper(interceptorManager, shareName, directoryPath).snapshot(snapshot).buildClient() + then: + snapshot.equals(shareSnapshotClient.getShareSnapshotId()) + } + +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAsyncAPITests.groovy new file mode 100644 index 000000000000..77955dd20e84 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/DirectoryAsyncAPITests.groovy @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.DirectoryAsyncClient +import com.azure.storage.file.FileAsyncClient +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.StorageErrorCode +import reactor.test.StepVerifier +import spock.lang.Ignore +import spock.lang.Unroll + +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class DirectoryAsyncAPITests extends APISpec { + DirectoryAsyncClient primaryDirectoryAsyncClient + def directoryPath + def shareName + static def testMetadata + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + directoryPath = testResourceName.randomName(methodName, 60) + def shareClient = shareBuilderHelper(interceptorManager, shareName).buildClient() + shareClient.create() + primaryDirectoryAsyncClient = directoryBuilderHelper(interceptorManager, shareName, directoryPath).buildAsyncClient() + testMetadata = Collections.singletonMap("testmetadata", "value") + } + + def "Get directory URL"() { + given: + def accoutName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accoutName) + when: + def directoryURL = primaryDirectoryAsyncClient.getDirectoryUrl().toString() + then: + expectURL.equals(directoryURL) + } + + def "Get sub directory client"() { + given: + def subDirectoryClient = primaryDirectoryAsyncClient.getSubDirectoryClient("testSubDirectory") + expect: + subDirectoryClient instanceof DirectoryAsyncClient + } + + def "Get file client"() { + given: + def fileClient = primaryDirectoryAsyncClient.getFileClient("testFile") + expect: + fileClient instanceof FileAsyncClient + } + + def "Create directory"() { + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createWithResponse(null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create directory error"() { + given: + def testShareName = testResourceName.randomName(methodName, 60) + when: + def createDirErrorVerifier = StepVerifier.create(directoryBuilderHelper(interceptorManager, testShareName, directoryPath).buildAsyncClient().create()) + then: + createDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Create directory with metadata"() { + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createWithResponse(testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create directory error with metadata"() { + given: + def errorMetadata = Collections.singletonMap("testMeta", "value") + when: + def createMetadataErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.createWithResponse(errorMetadata)) + then: + createMetadataErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 403, StorageErrorCode.AUTHENTICATION_FAILED) + } + } + + def "Delete directory"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.deleteWithResponse()) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + } + + def "Delete directory error"() { + when: + def deleteDirErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.delete()) + then: + deleteDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Get properties"() { + given: + primaryDirectoryAsyncClient.create().block() + def getPropertiesVerifier = StepVerifier.create(primaryDirectoryAsyncClient.getPropertiesWithResponse()) + expect: + getPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert it.value().eTag() + }.verifyComplete() + } + + def "Get properties error"() { + when: + def getPropertiesErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Set metadata"() { + given: + primaryDirectoryAsyncClient.createWithResponse(testMetadata).block() + def updatedMetadata = Collections.singletonMap("update", "value") + when: + def getPropertiesBeforeVerifier = StepVerifier.create(primaryDirectoryAsyncClient.getPropertiesWithResponse()) + def setPropertiesVerifier = StepVerifier.create(primaryDirectoryAsyncClient.setMetadataWithResponse(updatedMetadata)) + def getPropertiesAfterVerifier = StepVerifier.create(primaryDirectoryAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesBeforeVerifier.assertNext { + assert testMetadata.equals(it.value().metadata()) + }.verifyComplete() + setPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + }.verifyComplete() + getPropertiesAfterVerifier.assertNext { + assert updatedMetadata.equals(it.value().metadata()) + }.verifyComplete() + } + + def "Set metadata error"() { + given: + primaryDirectoryAsyncClient.create().block() + def errorMetadata = Collections.singletonMap("", "value") + when: + def setMetadataVerifier = StepVerifier.create(primaryDirectoryAsyncClient.setMetadata(errorMetadata)) + then: + setMetadataVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + } + + /** + * The listing hierarchy: + * share -> dir -> listOp0 (dir) -> listOp3 (file) + * -> listOp4 (file) + * -> listOp1 (dir) -> listOp5 (file) + * -> listOp6 (file) + * -> listOp2 (file) + */ + @Unroll + def "List files and directories args"() { + given: + primaryDirectoryAsyncClient.create().block() + LinkedList nameList = new LinkedList<>() + def dirPrefix = testResourceName.randomName(methodName, 60) + for (int i = 0; i < 2; i++) { + def subDirClient = primaryDirectoryAsyncClient.getSubDirectoryClient(dirPrefix + i) + subDirClient.create().block() + for (int j = 0; j < 2; j++) { + def num = i * 2 + j + 3 + subDirClient.createFile(dirPrefix + num, 1024).block() + } + } + primaryDirectoryAsyncClient.createFile(dirPrefix + 2, 1024).block() + for (int i = 0; i < 3; i++) { + nameList.add(dirPrefix + i) + } + + when: + def listFileAndDirVerifier = StepVerifier.create(primaryDirectoryAsyncClient.listFilesAndDirectories(prefix, maxResults)) + + then: + listFileAndDirVerifier.thenConsumeWhile { + Objects.equals(it.name(), nameList.pop()) + }.verifyComplete() + for (int i = 0; i < 3 - numOfResults; i++) { + nameList.pop() + } + nameList.isEmpty() + where: + prefix | maxResults | numOfResults + "directoryasyncapitestslistfilesanddirectoriesargs" | null | 3 + "directoryasyncapitestslistfilesanddirectoriesargs" | 1 | 3 + "directoryasyncapitestslistfilesanddirectoriesargsnoops" | 1 | 0 + } + + @Unroll + def "List handles"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.listHandles(maxResult, recursive)).verifyComplete() + where: + maxResult | recursive + 2 | true + null | false + } + + def "List handles error"() { + when: + def listHandesVerifier = StepVerifier.create(primaryDirectoryAsyncClient.listHandles(null, true)) + then: + listHandesVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + @Ignore + def "Force close handles"() { + // TODO: Need to find a way of mocking handles. + } + + def "Force close handles error"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def forceCloseHandlesErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.forceCloseHandles("handleId", true)) + then: + forceCloseHandlesErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.INVALID_HEADER_VALUE) + } + } + + def "Create sub directory"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createSubDirectoryWithResponse("testCreateSubDirectory", null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create sub directory invalid name"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def createDirErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.createSubDirectory("test/subdirectory")) + then: + createDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.PARENT_NOT_FOUND) + } + } + + def "Create sub directory metadata"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createSubDirectoryWithResponse("testCreateSubDirectory", testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create sub directory metadata error"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def createDirErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.createSubDirectoryWithResponse("testsubdirectory", Collections.singletonMap("", "value"))) + then: + createDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + } + + def "Delete sub directory"() { + given: + def subDirectoryName = "testSubCreateDirectory" + primaryDirectoryAsyncClient.create().block() + primaryDirectoryAsyncClient.createSubDirectory(subDirectoryName).block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.deleteSubDirectoryWithResponse(subDirectoryName)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + } + + def "Delete sub directory error"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def deleteDirErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.deleteSubDirectoryWithResponse("testsubdirectory")) + then: + deleteDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Create file"() { + given: + primaryDirectoryAsyncClient.create().block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createFileWithResponse("testCreateFile", 1024, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create file invalid args"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def createFileErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.createFileWithResponse(fileName, maxSize, null, null)) + then: + createFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + fileName | maxSize | statusCode | errMsg + "test\file" | 1024 | 400 | "Bad Request" + "fileName" | -1 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + + } + + def "Create file maxOverload"() { + given: + primaryDirectoryAsyncClient.create().block() + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("txt") + expect: + StepVerifier.create(primaryDirectoryAsyncClient.createFileWithResponse("testCreateFile", 1024, httpHeaders, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create file maxOverload invalid args"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def createFileErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.createFile("test\file", maxSize)) + then: + createFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, "Bad Request") + } + + where: + fileName | maxSize | httpHeaders | metadata + "test\file" | 1024 | new FileHTTPHeaders() | testMetadata + "fileName" | -1 | new FileHTTPHeaders() | testMetadata + "fileName" | 1024 | new FileHTTPHeaders().fileContentMD5(new byte[0]) | testMetadata + "fileName" | 1024 | new FileHTTPHeaders() | Collections.singletonMap("", "value") + + } + + def "Delete file"() { + given: + def fileName = "testCreateFile" + primaryDirectoryAsyncClient.create().block() + primaryDirectoryAsyncClient.createFile(fileName, 1024).block() + expect: + StepVerifier.create(primaryDirectoryAsyncClient.deleteFileWithResponse(fileName)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + } + + def "Delete file error"() { + given: + primaryDirectoryAsyncClient.create().block() + when: + def deleteFileErrorVerifier = StepVerifier.create(primaryDirectoryAsyncClient.deleteFileWithResponse("testfile")) + then: + deleteFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = directoryBuilderHelper(interceptorManager, shareName, directoryPath).snapshot(snapshot).buildAsyncClient() + then: + snapshot.equals(shareSnapshotClient.getShareSnapshotId()) + } + +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAPITests.groovy new file mode 100644 index 000000000000..ea0a2a21f319 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAPITests.groovy @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.core.exception.HttpResponseException +import com.azure.core.http.rest.Response +import com.azure.core.implementation.util.FluxUtil +import com.azure.core.util.Context +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.FileClient +import com.azure.storage.file.ShareClient +import com.azure.storage.file.models.FileCopyInfo +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.FileRange +import com.azure.storage.file.models.StorageErrorCode +import com.azure.storage.file.models.StorageErrorException +import spock.lang.Ignore +import spock.lang.Unroll + +import java.nio.ByteBuffer +import java.nio.charset.StandardCharsets +import java.nio.file.Files +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class FileAPITests extends APISpec { + FileClient primaryFileClient + def shareName + def filePath + def defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)) + def dataLength = defaultData.remaining() + static def testMetadata + static def httpHeaders + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + filePath = testResourceName.randomName(methodName, 60) + ShareClient shareClient = shareBuilderHelper(interceptorManager, shareName).buildClient() + shareClient.create() + primaryFileClient = fileBuilderHelper(interceptorManager, shareName, filePath).buildClient() + testMetadata = Collections.singletonMap("testmetadata", "value") + httpHeaders = new FileHTTPHeaders().fileContentLanguage("en") + .fileContentType("application/octet-stream") + } + + def "Get file URL"() { + given: + def accoutName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accoutName) + when: + def fileURL = primaryFileClient.getFileUrl().toString() + then: + expectURL.equals(fileURL) + } + + def "Create file"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryFileClient.createWithResponse(1024, null, null, null), 201) + } + + def "Create file error"() { + when: + primaryFileClient.create(-1) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.OUT_OF_RANGE_INPUT) + } + + def "Create file with args"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryFileClient.createWithResponse(1024, httpHeaders, testMetadata, null), 201) + } + + @Unroll + def "Create file with args error"() { + when: + primaryFileClient.createWithResponse(maxSize, fileHttpHeaders, metadata, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + maxSize | fileHttpHeaders | metadata | statusCode | errMsg + -1 | httpHeaders | testMetadata | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + 1024 | httpHeaders | Collections.singletonMap("testMeta", "value") | 403 | StorageErrorCode.AUTHENTICATION_FAILED + } + + def "Upload and download data"() { + given: + primaryFileClient.create(dataLength) + def dataBytes = new byte[dataLength] + defaultData.get(dataBytes) + defaultData.rewind() + when: + def uploadResponse = primaryFileClient.uploadWithResponse(defaultData, dataLength, null) + def downloadResponse = primaryFileClient.downloadWithPropertiesWithResponse(null, null, null) + then: + FileTestHelper.assertResponseStatusCode(uploadResponse, 201) + FileTestHelper.assertResponseStatusCode(downloadResponse, 200) + downloadResponse.value().contentLength() == dataLength + + Arrays.equals(dataBytes, FluxUtil.collectBytesInByteBufferStream(downloadResponse.value().body()).block()) + cleanup: + defaultData.clear() + } + + def "Upload and download data with args"() { + given: + primaryFileClient.create(1024) + def dataBytes = new byte[dataLength] + defaultData.get(dataBytes) + defaultData.rewind() + when: + def uploadResponse = primaryFileClient.uploadWithResponse(defaultData, dataLength, 1, null) + def downloadResponse = primaryFileClient.downloadWithPropertiesWithResponse(new FileRange(1, dataLength), true, null) + + then: + FileTestHelper.assertResponseStatusCode(uploadResponse, 201) + FileTestHelper.assertResponseStatusCode(downloadResponse, 206) + downloadResponse.value().contentLength() == dataLength + + Arrays.equals(dataBytes, FluxUtil.collectBytesInByteBufferStream(downloadResponse.value().body()).block()) + cleanup: + defaultData.clear() + } + + def "Upload data error"() { + when: + primaryFileClient.uploadWithResponse(defaultData, dataLength, 1, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + cleanup: + defaultData.clear() + } + + def "Upload and clear range" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileClient.create(fullInfoString.length()) + primaryFileClient.upload(fullInfoData, fullInfoString.length()) + when: + primaryFileClient.clearRange(7) + def downloadResponse = primaryFileClient.downloadWithPropertiesWithResponse(new FileRange(0, 6), false, null) + then: + def downloadArray = FluxUtil.collectBytesInByteBufferStream(downloadResponse.value().body()).block() + downloadArray.eachByte { + assert it == 0 + } + cleanup: + fullInfoData.clear() + } + + def "Upload and clear range with args" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileClient.create(fullInfoString.length()) + primaryFileClient.upload(fullInfoData, fullInfoString.length()) + when: + primaryFileClient.clearRangeWithResponse(7, 1, null) + def downloadResponse = primaryFileClient.downloadWithPropertiesWithResponse(new FileRange(1, 7), false, null) + then: + def downloadArray = FluxUtil.collectBytesInByteBufferStream(downloadResponse.value().body()).block() + downloadArray.eachByte { + assert it == 0 + } + } + + def "Clear range error" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileClient.create(fullInfoString.length()) + primaryFileClient.upload(fullInfoData, fullInfoString.length()) + when: + primaryFileClient.clearRange(30) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 416, StorageErrorCode.INVALID_RANGE) + } + + def "Clear range error args" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileClient.create(fullInfoString.length()) + primaryFileClient.upload(fullInfoData, fullInfoString.length()) + when: + primaryFileClient.clearRangeWithResponse(7, 20, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 416, StorageErrorCode.INVALID_RANGE) + } + + def "Download data error"() { + when: + primaryFileClient.downloadWithPropertiesWithResponse(new FileRange(0, 1023), false, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Upload and download file"() { + given: + File uploadFile = new File(testFolder.getPath() + "/helloworld") + File downloadFile = new File(testFolder.getPath() + "/testDownload") + + if (!Files.exists(downloadFile.toPath())) { + downloadFile.createNewFile() + } + + primaryFileClient.create(uploadFile.length()) + when: + primaryFileClient.uploadFromFile(uploadFile.toString()) + primaryFileClient.downloadToFile(downloadFile.toString()) + then: + FileTestHelper.assertTwoFilesAreSame(uploadFile, downloadFile) + cleanup: + FileTestHelper.deleteFolderIfExists(testFolder.toString()) + + } + + def "Start copy"() { + given: + primaryFileClient.create(1024) + // TODO: Need another test account if using SAS token for authentication. + // TODO: SasToken auth cannot be used until the logging redaction + def sourceURL = primaryFileClient.getFileUrl().toString() + "/" + shareName + "/" + filePath + when: + Response copyInfoResponse = primaryFileClient.startCopyWithResponse(sourceURL, null, null) + then: + FileTestHelper.assertResponseStatusCode(copyInfoResponse, 202) + copyInfoResponse.value().copyId() != null + } + + def "Start copy error"() { + given: + primaryFileClient.create(1024) + when: + primaryFileClient.startCopyWithResponse("some url", testMetadata, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.INVALID_HEADER_VALUE) + } + + @Ignore + def "Abort copy"() { + //TODO: Need to find a way of mocking pending copy status + } + + def "Delete file"() { + given: + primaryFileClient.createWithResponse(1024, null, null, null) + expect: + FileTestHelper.assertResponseStatusCode(primaryFileClient.deleteWithResponse(null), 202) + } + + def "Delete file error"() { + when: + primaryFileClient.deleteWithResponse(null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Get properties"() { + given: + primaryFileClient.create(1024) + when: + def getPropertiesResponse = primaryFileClient.getPropertiesWithResponse(null) + then: + FileTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.value().eTag() != null + getPropertiesResponse.value().lastModified() != null + } + + def "Get properties error"() { + when: + primaryFileClient.getProperties() + then: + thrown(HttpResponseException) + } + + // This test needs to update since the service version update. + @Ignore + def "Set httpHeaders"() { + given: + primaryFileClient.createWithResponse(1024, httpHeaders, testMetadata, null) + expect: + FileTestHelper.assertResponseStatusCode(primaryFileClient.setHttpHeadersWithResponse(512, httpHeaders, null), 200) + } + + def "Set httpHeaders error"() { + given: + primaryFileClient.createWithResponse(1024, httpHeaders, testMetadata, null) + when: + primaryFileClient.setHttpHeadersWithResponse(-1, httpHeaders, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.OUT_OF_RANGE_INPUT) + } + + def "Set metadata"() { + given: + primaryFileClient.createWithResponse(1024, httpHeaders, testMetadata, null) + def updatedMetadata = Collections.singletonMap("update", "value") + when: + def getPropertiesBefore = primaryFileClient.getProperties() + def setPropertiesResponse = primaryFileClient.setMetadataWithResponse(updatedMetadata, null) + def getPropertiesAfter = primaryFileClient.getProperties() + then: + testMetadata.equals(getPropertiesBefore.metadata()) + FileTestHelper.assertResponseStatusCode(setPropertiesResponse, 200) + updatedMetadata.equals(getPropertiesAfter.metadata()) + } + + def "Set metadata error"() { + given: + primaryFileClient.create(1024) + def errorMetadata = Collections.singletonMap("", "value") + when: + primaryFileClient.setMetadataWithResponse(errorMetadata, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + + def "List ranges"() { + given: + def fileName = testResourceName.randomName("file", 60) + primaryFileClient.create(1024) + def uploadFile = FileTestHelper.createRandomFileWithLength(1024, tmpFolder.toString(), fileName) + primaryFileClient.uploadFromFile(uploadFile) + expect: + primaryFileClient.listRanges().each { + assert it.start() == 0 + assert it.end() == 1023 + } + cleanup: + FileTestHelper.deleteFolderIfExists(tmpFolder.toString()) + } + + def "List ranges with range"() { + given: + def fileName = testResourceName.randomName("file", 60) + primaryFileClient.create(1024) + def uploadFile = FileTestHelper.createRandomFileWithLength(1024, tmpFolder.toString(), fileName) + primaryFileClient.uploadFromFile(uploadFile) + expect: + primaryFileClient.listRanges(new FileRange(0, 511L)).each { + assert it.start() == 0 + assert it.end() == 511 + } + cleanup: + FileTestHelper.deleteFolderIfExists(tmpFolder.toString()) + } + + def "List handles"() { + given: + primaryFileClient.create(1024) + expect: + primaryFileClient.listHandles().size() == 0 + } + + def "List handles with maxResult"() { + given: + primaryFileClient.create(1024) + expect: + primaryFileClient.listHandles(2).size() == 0 + } + + @Ignore + def "Force close handles"() { + // TODO: Need to find a way of mocking handles. + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = fileBuilderHelper(interceptorManager, shareName, filePath).snapshot(snapshot).buildClient() + then: + snapshot.equals(shareSnapshotClient.getShareSnapshotId()) + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAsyncAPITests.groovy new file mode 100644 index 000000000000..0a131eb3321b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileAsyncAPITests.groovy @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.core.exception.HttpResponseException +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.FileAsyncClient +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.FileRange +import com.azure.storage.file.models.StorageErrorCode +import reactor.core.publisher.Flux +import reactor.test.StepVerifier +import spock.lang.Ignore +import spock.lang.Unroll + +import java.nio.ByteBuffer +import java.nio.charset.StandardCharsets +import java.nio.file.Files +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class FileAsyncAPITests extends APISpec { + FileAsyncClient primaryFileAsyncClient + def shareName + def filePath + def defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)) + def dataLength = defaultData.remaining() + static def testMetadata + static def httpHeaders + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + filePath = testResourceName.randomName(methodName, 60) + def shareClient = shareBuilderHelper(interceptorManager, shareName).buildClient() + shareClient.create() + primaryFileAsyncClient = fileBuilderHelper(interceptorManager, shareName, filePath).buildAsyncClient() + testMetadata = Collections.singletonMap("testmetadata", "value") + httpHeaders = new FileHTTPHeaders().fileContentLanguage("en") + .fileContentType("application/octet-stream") + } + + def "Get file URL"() { + given: + def accoutName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accoutName) + when: + def fileURL = primaryFileAsyncClient.getFileUrl().toString() + then: + expectURL.equals(fileURL) + } + + def "Create file"() { + expect: + StepVerifier.create(primaryFileAsyncClient.create(1024)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + } + } + + def "Create file error"() { + when: + def createFileErrorVerifier = StepVerifier.create(primaryFileAsyncClient.create(-1)) + then: + createFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.OUT_OF_RANGE_INPUT) + } + } + + def "Create file with args"() { + expect: + StepVerifier.create(primaryFileAsyncClient.createWithResponse(1024, httpHeaders, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create file with args error"() { + when: + def createFileErrorVerifier = StepVerifier.create(primaryFileAsyncClient.createWithResponse(maxSize, fileHttpHeaders, metadata)) + then: + createFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + maxSize | fileHttpHeaders | metadata | statusCode | errMsg + -1 | httpHeaders | testMetadata | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + 1024 | httpHeaders | Collections.singletonMap("testMeta", "value") | 403 | StorageErrorCode.AUTHENTICATION_FAILED + } + + def "Upload and download data"() { + given: + primaryFileAsyncClient.create(dataLength).block() + when: + def uploadVerifier = StepVerifier.create(primaryFileAsyncClient.uploadWithResponse(Flux.just(defaultData), dataLength)) + def downloadVerifier = StepVerifier.create(primaryFileAsyncClient.downloadWithPropertiesWithResponse(null, null)) + + then: + uploadVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + + downloadVerifier.assertNext { + assert it.value().contentLength() == dataLength + assert FileTestHelper.assertResponseStatusCode(it, 200) + }.verifyComplete() + cleanup: + defaultData.clear() + } + + def "Upload and download data with args"() { + given: + primaryFileAsyncClient.create(1024).block() + when: + def uploadVerifier = StepVerifier.create(primaryFileAsyncClient.uploadWithResponse(Flux.just(defaultData), dataLength, 1)) + def downloadVerifier = StepVerifier.create(primaryFileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(1, dataLength), true)) + + then: + uploadVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + + downloadVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 206) + assert it.value().contentLength() == dataLength + }.verifyComplete() + cleanup: + defaultData.clear() + } + + def "Upload data error"() { + when: + def updateDataErrorVerifier = StepVerifier.create(primaryFileAsyncClient.upload(Flux.just(defaultData), dataLength, 1)) + then: + updateDataErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + cleanup: + defaultData.clear() + } + + def "Download data error"() { + when: + def downloadDataErrorVerifier = StepVerifier.create(primaryFileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(0, 1023), false, null)) + then: + downloadDataErrorVerifier.assertNext { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Upload and clear range" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileAsyncClient.create(fullInfoString.length()).block() + primaryFileAsyncClient.upload(Flux.just(fullInfoData), fullInfoString.length()).block() + when: + def clearRangeVerifier = StepVerifier.create(primaryFileAsyncClient.clearRange(7)) + def downloadResponseVerifier = StepVerifier.create(primaryFileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(0, 6), false, null)) + then: + clearRangeVerifier.assertNext { + FileTestHelper.assertResponseStatusCode(it, 201) + } + downloadResponseVerifier.assertNext { + assert it.value().body() != null + } + } + + def "Upload and clear range with args" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileAsyncClient.create(fullInfoString.length()).block() + primaryFileAsyncClient.upload(Flux.just(fullInfoData), fullInfoString.length()).block() + when: + def clearRangeVerifier = StepVerifier.create(primaryFileAsyncClient.clearRangeWithResponse(7, 1)) + def downloadResponseVerifier = StepVerifier.create(primaryFileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(1, 7), false, null)) + then: + clearRangeVerifier.assertNext { + FileTestHelper.assertResponseStatusCode(it, 201) + } + downloadResponseVerifier.assertNext { + assert it.value().body() != null + } + cleanup: + fullInfoData.clear() + } + + def "Clear range error" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileAsyncClient.create(fullInfoString.length()).block() + primaryFileAsyncClient.upload(Flux.just(fullInfoData), fullInfoString.length()).block() + when: + def clearRangeErrorVerifier = StepVerifier.create(primaryFileAsyncClient.clearRange(30)) + then: + clearRangeErrorVerifier.verifyErrorSatisfies { + FileTestHelper.assertExceptionStatusCodeAndMessage(it, 416, StorageErrorCode.INVALID_RANGE) + } + } + + def "Clear range error args" () { + given: + def fullInfoString = "please clear the range" + def fullInfoData = ByteBuffer.wrap(fullInfoString.getBytes(StandardCharsets.UTF_8)) + primaryFileAsyncClient.create(fullInfoString.length()).block() + primaryFileAsyncClient.upload(Flux.just(fullInfoData), fullInfoString.length()).block() + when: + def clearRangeErrorVerifier = StepVerifier.create(primaryFileAsyncClient.clearRangeWithResponse(7, 20)) + then: + clearRangeErrorVerifier.verifyErrorSatisfies { + FileTestHelper.assertExceptionStatusCodeAndMessage(it, 416, StorageErrorCode.INVALID_RANGE) + } + cleanup: + fullInfoData.clear() + } + + def "Upload and download file"() { + given: + File uploadFile = new File(testFolder.getPath() + "/helloworld") + File downloadFile = new File(testFolder.getPath() + "/testDownload") + + if (!Files.exists(downloadFile.toPath())) { + downloadFile.createNewFile() + } + + primaryFileAsyncClient.create(uploadFile.length()).block() + when: + def uploadFileVerifier = StepVerifier.create(primaryFileAsyncClient.uploadFromFile(uploadFile.toString())) + def downloadFileVerifier = StepVerifier.create(primaryFileAsyncClient.downloadToFile(downloadFile.toString())) + then: + uploadFileVerifier.verifyComplete() + downloadFileVerifier.verifyComplete() + assert FileTestHelper.assertTwoFilesAreSame(uploadFile, downloadFile) + cleanup: + FileTestHelper.deleteFolderIfExists(testFolder.toString()) + } + + def "Start copy"() { + given: + primaryFileAsyncClient.create(1024).block() + // TODO: Need another test account if using SAS token for authentication. + // TODO: SasToken auth cannot be used until the logging redaction + def sourceURL = primaryFileAsyncClient.getFileUrl().toString() + "/" + shareName + "/" + filePath + when: + def copyInfoVerifier = StepVerifier.create(primaryFileAsyncClient.startCopyWithResponse(sourceURL, null)) + then: + copyInfoVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + assert it.value().copyId() != null + }.verifyComplete() + } + + def "Start copy error"() { + given: + primaryFileAsyncClient.create(1024).block() + when: + def startCopyErrorVerifier = StepVerifier.create(primaryFileAsyncClient.startCopyWithResponse("some url", testMetadata)) + then: + startCopyErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.INVALID_HEADER_VALUE) + } + } + + @Ignore + def "Abort copy"() { + //TODO: Need to find a way of mocking pending copy status + } + + def "Delete file"() { + given: + primaryFileAsyncClient.create(1024).block() + expect: + StepVerifier.create(primaryFileAsyncClient.deleteWithResponse()) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + } + + def "Delete file error"() { + when: + def deleteFileErrorVerifier = StepVerifier.create(primaryFileAsyncClient.delete()) + then: + deleteFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Get properties"() { + given: + primaryFileAsyncClient.create(1024).block() + when: + def getPropertiesVerifier = StepVerifier.create(primaryFileAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert it.eTag() != null + assert it.lastModified() != null + } + } + + def "Get properties error"() { + when: + def getProperitesErrorVerifier = StepVerifier.create(primaryFileAsyncClient.getProperties()) + then: + getProperitesErrorVerifier.verifyErrorSatisfies { + assert it instanceof HttpResponseException + } + } + + // This test needs to update since the service version update. + @Ignore + def "Set httpHeaders"() { + given: + primaryFileAsyncClient.createWithResponse(1024, httpHeaders, testMetadata).block() + expect: + StepVerifier.create(primaryFileAsyncClient.setHttpHeadersWithResponse(512, httpHeaders)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + }.verifyComplete() + } + + def "Set httpHeaders error"() { + given: + primaryFileAsyncClient.createWithResponse(1024, httpHeaders, testMetadata).block() + when: + def setHttpHeaderVerifier = StepVerifier.create(primaryFileAsyncClient.setHttpHeaders(-1, httpHeaders)) + then: + setHttpHeaderVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.OUT_OF_RANGE_INPUT) + } + } + + def "Set metadata"() { + given: + primaryFileAsyncClient.createWithResponse(1024, httpHeaders, testMetadata).block() + def updatedMetadata = Collections.singletonMap("update", "value") + when: + def getPropertiesBeforeVerifier = StepVerifier.create(primaryFileAsyncClient.getProperties()) + def setPropertiesVerifier = StepVerifier.create(primaryFileAsyncClient.setMetadataWithResponse(updatedMetadata)) + def getPropertiesAfterVerifier = StepVerifier.create(primaryFileAsyncClient.getProperties()) + then: + getPropertiesBeforeVerifier.assertNext { + assert testMetadata.equals(it.metadata()) + }.verifyComplete() + setPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + }.verifyComplete() + getPropertiesAfterVerifier.assertNext { + assert updatedMetadata.equals(it.metadata()) + }.verifyComplete() + } + + def "Set metadata error"() { + given: + primaryFileAsyncClient.create(1024).block() + def errorMetadata = Collections.singletonMap("", "value") + when: + def setMetadataErrorVerifier = StepVerifier.create(primaryFileAsyncClient.setMetadataWithResponse(errorMetadata)) + then: + setMetadataErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + } + + def "List ranges"() { + given: + primaryFileAsyncClient.createWithResponse(1024, null, null).block() + def fileName = testResourceName.randomName("file", 60) + def uploadFile = FileTestHelper.createRandomFileWithLength(1024, tmpFolder.toString(), fileName) + primaryFileAsyncClient.uploadFromFile(uploadFile).block() + expect: + StepVerifier.create(primaryFileAsyncClient.listRanges()) + .assertNext { + assert it.start() == 0 + assert it.end() == 1023 + }.verifyComplete() + cleanup: + FileTestHelper.deleteFolderIfExists(tmpFolder.toString()) + } + + def "List ranges with range"() { + given: + primaryFileAsyncClient.createWithResponse(1024, null, null).block() + def fileName = testResourceName.randomName("file", 60) + def uploadFile = FileTestHelper.createRandomFileWithLength(1024, tmpFolder.toString(), fileName) + primaryFileAsyncClient.uploadFromFile(uploadFile).block() + expect: + StepVerifier.create(primaryFileAsyncClient.listRanges(new FileRange(0, 511L))) + .assertNext { + assert it.start() == 0 + assert it.end() == 511 + }.verifyComplete() + cleanup: + FileTestHelper.deleteFolderIfExists(tmpFolder.toString()) + } + + def "List handles"() { + given: + primaryFileAsyncClient.create(1024).block() + expect: + StepVerifier.create(primaryFileAsyncClient.listHandles()) + .verifyComplete() + } + + def "List handles with maxResult"() { + given: + primaryFileAsyncClient.create(1024).block() + expect: + StepVerifier.create(primaryFileAsyncClient.listHandles(2)) + .verifyComplete() + } + + @Ignore + def "Force close handles"() { + // TODO: Need to find a way of mocking handles. + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = fileBuilderHelper(interceptorManager, shareName, filePath).snapshot(snapshot).buildAsyncClient() + then: + snapshot.equals(shareSnapshotClient.getShareSnapshotId()) + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAPITests.groovy new file mode 100644 index 000000000000..22646b477795 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAPITests.groovy @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.ShareClient +import com.azure.storage.file.models.CorsRule +import com.azure.storage.file.models.FileServiceProperties +import com.azure.storage.file.models.ListSharesOptions +import com.azure.storage.file.models.Metrics +import com.azure.storage.file.models.RetentionPolicy +import com.azure.storage.file.models.ShareItem +import com.azure.storage.file.models.ShareProperties +import com.azure.storage.file.models.StorageErrorCode +import com.azure.storage.file.models.StorageErrorException +import spock.lang.Unroll + +class FileServiceAPITests extends APISpec { + def shareName + + static def testMetadata = Collections.singletonMap("testmetadata", "value") + static def reallyLongString = "thisisareallylongstringthatexceedsthe64characterlimitallowedoncertainproperties" + static def TOO_MANY_RULES = new ArrayList<>() + static def INVALID_ALLOWED_HEADER = Collections.singletonList(new CorsRule().allowedHeaders(reallyLongString)) + static def INVALID_EXPOSED_HEADER = Collections.singletonList(new CorsRule().exposedHeaders(reallyLongString)) + static def INVALID_ALLOWED_ORIGIN = Collections.singletonList(new CorsRule().allowedOrigins(reallyLongString)) + static def INVALID_ALLOWED_METHOD = Collections.singletonList(new CorsRule().allowedMethods("NOTAREALHTTPMETHOD")) + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + primaryFileServiceClient = fileServiceBuilderHelper(interceptorManager).buildClient() + for (int i = 0; i < 6; i++) { + TOO_MANY_RULES.add(new CorsRule()) + } + } + + def "Get file service URL"() { + given: + def accoutName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accoutName) + when: + def fileServiceURL = primaryFileServiceClient.getFileServiceUrl().toString() + then: + expectURL.equals(fileServiceURL) + } + + def "Get share does not create a share"() { + given: + def shareClient = primaryFileServiceClient.getShareClient(shareName) + expect: + shareClient instanceof ShareClient + } + + def "Create share"() { + when: + def createShareResponse = primaryFileServiceClient.createShareWithResponse(shareName, null, null, null) + then: + FileTestHelper.assertResponseStatusCode(createShareResponse, 201) + } + + def "Create share max overloads"() { + when: + def createShareResponse = primaryFileServiceClient.createShareWithResponse(shareName, testMetadata, 1, null) + then: + FileTestHelper.assertResponseStatusCode(createShareResponse, 201) + } + + @Unroll + def "Create share with invalid args"() { + when: + primaryFileServiceClient.createShareWithResponse(shareName, metadata, quota, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + metadata | quota | statusCode | errMsg + Collections.singletonMap("invalid#", "value") | 1 | 400 | StorageErrorCode.INVALID_METADATA + testMetadata | -1 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + } + + def "Delete share"() { + given: + primaryFileServiceClient.createShare(shareName) + when: + def deleteShareResponse = primaryFileServiceClient.deleteShareWithResponse(shareName, null, null) + then: + FileTestHelper.assertResponseStatusCode(deleteShareResponse, 202) + } + + def "Delete share does not exist"() { + when: + primaryFileServiceClient.deleteShare(testResourceName.randomName(methodName, 60)) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + @Unroll + def "List shares with filter"() { + given: + LinkedList testShares = new LinkedList<>() + for (int i = 0; i < 3; i++) { + ShareItem share = new ShareItem().properties(new ShareProperties().quota(i + 1)).name(shareName + i) + if (i == 2) { + share.metadata(testMetadata) + } + + testShares.add(share) + primaryFileServiceClient.createShareWithResponse(share.name(), share.metadata(), share.properties().quota(), null) + } + when: + def shares = primaryFileServiceClient.listShares(options).iterator() + then: + for (int i = 0; i < limits; i++) { + FileTestHelper.assertSharesAreEqual(testShares.pop(), shares.next(), includeMetadata, includeSnapshot) + } + !shares.hasNext() + where: + options | limits | includeMetadata | includeSnapshot + new ListSharesOptions().prefix("fileserviceapitestslistshareswithfilter") | 3 | false | true + new ListSharesOptions().prefix("fileserviceapitestslistshareswithfilter").includeMetadata(true) | 3 | true | true + new ListSharesOptions().prefix("fileserviceapitestslistshareswithfilter").includeMetadata(false) | 3 | false | true + new ListSharesOptions().prefix("fileserviceapitestslistshareswithfilter").maxResults(2) | 2 | true | true + } + + @Unroll + def "List shares with args"() { + given: + LinkedList testShares = new LinkedList<>() + for (int i = 0; i < 3; i++) { + ShareItem share = new ShareItem().name(shareName + i).properties(new ShareProperties().quota(2)) + .metadata(testMetadata) + def shareClient = primaryFileServiceClient.getShareClient(share.name()) + shareClient.createWithResponse(share.metadata(), share.properties().quota(), null) + if (i == 2) { + def snapshot = shareClient.createSnapshot().snapshot() + testShares.add(new ShareItem().name(share.name()).metadata(share.metadata()).properties(share.properties()).snapshot(snapshot)) + } + testShares.add(share) + } + when: + def shares = primaryFileServiceClient.listShares(options).iterator() + then: + for (int i = 0; i < limits; i++) { + FileTestHelper.assertSharesAreEqual(testShares.pop(), shares.next(), includeMetadata, includeSnapshot) + } + !shares.hasNext() + + where: + options | limits | includeMetadata | includeSnapshot + new ListSharesOptions().prefix("fileserviceapitestslistshareswithargs") | 3 | false | false + new ListSharesOptions().prefix("fileserviceapitestslistshareswithargs") .includeMetadata(true) | 3 | true | false + new ListSharesOptions().prefix("fileserviceapitestslistshareswithargs") .includeMetadata(true).includeSnapshots(true) | 4 | true | true + } + + def "Set and get properties"() { + given: + def originalProperties = primaryFileServiceClient.getProperties() + def retentionPolicy = new RetentionPolicy().enabled(true).days(3) + def metrics = new Metrics().enabled(true).includeAPIs(false) + .retentionPolicy(retentionPolicy).version("1.0") + def updatedProperties = new FileServiceProperties().hourMetrics(metrics) + .minuteMetrics(metrics).cors(new ArrayList<>()) + when: + def getPropertiesBeforeResponse = primaryFileServiceClient.getPropertiesWithResponse(null) + def setPropertiesResponse = primaryFileServiceClient.setPropertiesWithResponse(updatedProperties, null) + def getPropertiesAfterResponse = primaryFileServiceClient.getPropertiesWithResponse(null) + then: + FileTestHelper.assertResponseStatusCode(getPropertiesBeforeResponse, 200) + FileTestHelper.assertFileServicePropertiesAreEqual(originalProperties, getPropertiesBeforeResponse.value()) + FileTestHelper.assertResponseStatusCode(setPropertiesResponse, 202) + FileTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200) + FileTestHelper.assertFileServicePropertiesAreEqual(updatedProperties, getPropertiesAfterResponse.value()) + } + + @Unroll + def "Set and get properties with invalid args"() { + given: + def retentionPolicy = new RetentionPolicy().enabled(true).days(3) + def metrics = new Metrics().enabled(true).includeAPIs(false) + .retentionPolicy(retentionPolicy).version("1.0") + + when: + def updatedProperties = new FileServiceProperties().hourMetrics(metrics) + .minuteMetrics(metrics).cors(coreList) + primaryFileServiceClient.setProperties(updatedProperties) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + coreList | statusCode | errMsg + TOO_MANY_RULES | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_HEADER | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_EXPOSED_HEADER | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_ORIGIN | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_METHOD | 400 | StorageErrorCode.INVALID_XML_NODE_VALUE + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAsyncAPITests.groovy new file mode 100644 index 000000000000..8d8db80b5418 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileServiceAsyncAPITests.groovy @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.ShareAsyncClient +import com.azure.storage.file.models.CorsRule +import com.azure.storage.file.models.FileServiceProperties +import com.azure.storage.file.models.ListSharesOptions +import com.azure.storage.file.models.Metrics +import com.azure.storage.file.models.RetentionPolicy +import com.azure.storage.file.models.ShareItem +import com.azure.storage.file.models.ShareProperties +import com.azure.storage.file.models.StorageErrorCode +import reactor.test.StepVerifier +import spock.lang.Unroll + +class FileServiceAsyncAPITests extends APISpec { + def shareName + + static def testMetadata = Collections.singletonMap("testmetadata", "value") + static def reallyLongString = "thisisareallylongstringthatexceedsthe64characterlimitallowedoncertainproperties" + static def TOO_MANY_RULES = new ArrayList<>() + static def INVALID_ALLOWED_HEADER = Collections.singletonList(new CorsRule().allowedHeaders(reallyLongString)) + static def INVALID_EXPOSED_HEADER = Collections.singletonList(new CorsRule().exposedHeaders(reallyLongString)) + static def INVALID_ALLOWED_ORIGIN = Collections.singletonList(new CorsRule().allowedOrigins(reallyLongString)) + static def INVALID_ALLOWED_METHOD = Collections.singletonList(new CorsRule().allowedMethods("NOTAREALHTTPMETHOD")) + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + primaryFileServiceAsyncClient = fileServiceBuilderHelper(interceptorManager).buildAsyncClient() + for (int i = 0; i < 6; i++) { + TOO_MANY_RULES.add(new CorsRule()) + } + } + + def "Get file service URL"() { + given: + def accoutName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accoutName) + when: + def fileServiceURL = primaryFileServiceAsyncClient.getFileServiceUrl().toString() + then: + expectURL.equals(fileServiceURL) + } + + def "Get share does not create a share"() { + when: + def shareAsyncClient = primaryFileServiceAsyncClient.getShareAsyncClient(shareName) + then: + shareAsyncClient instanceof ShareAsyncClient + } + + def "Create share"() { + when: + def createShareVerifier = StepVerifier.create(primaryFileServiceAsyncClient.createShareWithResponse(shareName, null, null)) + then: + createShareVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create share with metadata"() { + when: + def createShareVerifier = StepVerifier.create(primaryFileServiceAsyncClient.createShareWithResponse(shareName, metadata, quota)) + then: + createShareVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + } + where: + metadata | quota + null | null + testMetadata | null + null | 1 + testMetadata | 1 + } + + @Unroll + def "Create share with invalid args"() { + when: + def createShareVerifier = StepVerifier.create(primaryFileServiceAsyncClient.createShareWithResponse(shareName, metadata, quota)) + then: + createShareVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + metadata | quota | statusCode | errMsg + Collections.singletonMap("invalid#", "value") | 1 | 400 | StorageErrorCode.INVALID_METADATA + testMetadata | -1 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + testMetadata | 0 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + testMetadata | 5200 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + } + + def "Delete share"() { + given: + primaryFileServiceAsyncClient.createShare(shareName) + when: + def deleteShareVerifier = StepVerifier.create(primaryFileServiceAsyncClient.deleteShareWithResponse(shareName, null)) + then: + deleteShareVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + } + } + + def "Delete share does not exist"() { + when: + def deleteShareVerifier = StepVerifier.create(primaryFileServiceAsyncClient.deleteShare(testResourceName.randomName(methodName, 60))) + then: + deleteShareVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, "ShareNotFound") + } + } + + @Unroll + def "List shares with filter"() { + given: + LinkedList testShares = new LinkedList<>() + for (int i = 0; i < 3; i++) { + ShareItem share = new ShareItem().name(shareName + i).properties(new ShareProperties().quota(i + 1)) + if (i == 2) { + share.metadata(testMetadata) + } + testShares.add(share) + primaryFileServiceAsyncClient.createShareWithResponse(share.name(), share.metadata(), share.properties().quota()).block() + } + when: + def sharesVerifier = StepVerifier.create(primaryFileServiceAsyncClient.listShares(options)) + then: + sharesVerifier.thenConsumeWhile { + FileTestHelper.assertSharesAreEqual(testShares.pop(), it, includeMetadata, includeSnapshot) + }.verifyComplete() + for (int i = 0; i < 3 - limits; i++) { + testShares.pop() + } + testShares.isEmpty() + where: + options | limits | includeMetadata | includeSnapshot + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithfilter") | 3 | false | true + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithfilter").includeMetadata(true) | 3 | true | true + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithfilter").includeMetadata(false) | 3 | false | true + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithfilter").maxResults(2) | 2 | true | true + } + + @Unroll + def "List shares with args"() { + given: + LinkedList testShares = new LinkedList<>() + for (int i = 0; i < 3; i++) { + ShareItem share = new ShareItem().name(shareName + i).properties(new ShareProperties().quota(2)) + .metadata(testMetadata) + def shareAsyncClient = primaryFileServiceAsyncClient.getShareAsyncClient(share.name()) + shareAsyncClient.createWithResponse(share.metadata(), share.properties().quota()).block() + if (i == 2) { + StepVerifier.create(shareAsyncClient.createSnapshotWithResponse(null)) + .assertNext { + testShares.add(new ShareItem().name(share.name()).metadata(share.metadata()).properties(share.properties()).snapshot(it.value().snapshot())) + FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + testShares.add(share) + } + when: + def sharesVerifier = StepVerifier.create(primaryFileServiceAsyncClient.listShares(options)) + then: + sharesVerifier.assertNext { + assert FileTestHelper.assertSharesAreEqual(testShares.pop(), it, includeMetadata, includeSnapshot) + }.expectNextCount(limits - 1).verifyComplete() + + where: + options | limits | includeMetadata | includeSnapshot + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithargs") | 3 | false | false + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithargs").includeMetadata(true) | 3 | true | false + new ListSharesOptions().prefix("fileserviceasyncapitestslistshareswithargs").includeMetadata(true).includeSnapshots(true) | 4 | true | true + } + + def "Set and get properties"() { + given: + def originalProperties = primaryFileServiceAsyncClient.getProperties().block() + def retentionPolicy = new RetentionPolicy().enabled(true).days(3) + def metrics = new Metrics().enabled(true).includeAPIs(false) + .retentionPolicy(retentionPolicy).version("1.0") + def updatedProperties = new FileServiceProperties().hourMetrics(metrics) + .minuteMetrics(metrics).cors(new ArrayList<>()) + when: + def getPropertiesBeforeVerifier = StepVerifier.create(primaryFileServiceAsyncClient.getPropertiesWithResponse()) + def setPropertiesVerifier = StepVerifier.create(primaryFileServiceAsyncClient.setPropertiesWithResponse(updatedProperties)) + def getPropertiesAfterVerifier = StepVerifier.create(primaryFileServiceAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesBeforeVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert FileTestHelper.assertFileServicePropertiesAreEqual(originalProperties, it.value()) + }.verifyComplete() + setPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + } + + getPropertiesAfterVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert FileTestHelper.assertFileServicePropertiesAreEqual(originalProperties, it.value()) + }.verifyComplete() + } + + @Unroll + def "Set and get properties with invalid args"() { + given: + def retentionPolicy = new RetentionPolicy().enabled(true).days(3) + def metrics = new Metrics().enabled(true).includeAPIs(false) + .retentionPolicy(retentionPolicy).version("1.0") + + when: + def updatedProperties = new FileServiceProperties().hourMetrics(metrics) + .minuteMetrics(metrics).cors(coreList) + def setPropertyVerifier = StepVerifier.create(primaryFileServiceAsyncClient.setProperties(updatedProperties)) + then: + setPropertyVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + coreList | statusCode | errMsg + TOO_MANY_RULES | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_HEADER | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_EXPOSED_HEADER | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_ORIGIN | 400 | StorageErrorCode.INVALID_XML_DOCUMENT + INVALID_ALLOWED_METHOD | 400 | StorageErrorCode.INVALID_XML_NODE_VALUE + + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileTestHelper.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileTestHelper.groovy new file mode 100644 index 000000000000..0c052b8dc7b0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/FileTestHelper.groovy @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.core.http.rest.Response +import com.azure.core.util.configuration.ConfigurationManager +import com.azure.storage.file.models.CorsRule +import com.azure.storage.file.models.FileRef +import com.azure.storage.file.models.FileServiceProperties +import com.azure.storage.file.models.Metrics +import com.azure.storage.file.models.RetentionPolicy +import com.azure.storage.file.models.ShareItem +import com.azure.storage.file.models.SignedIdentifier +import com.azure.storage.file.models.StorageErrorCode +import com.azure.storage.file.models.StorageErrorException +import com.azure.storage.file.models.StorageServiceProperties + +import java.nio.file.Files +import java.nio.file.Paths +import java.security.NoSuchAlgorithmException +import java.time.Duration +import java.util.logging.Logging + +class FileTestHelper { + + static boolean assertResponseStatusCode(Response response, int expectedStatusCode) { + return expectedStatusCode == response.statusCode() + } + + static boolean assertExceptionStatusCodeAndMessage(Throwable throwable, int expectedStatusCode, String errMessage) { + return assertExceptionStatusCode(throwable, expectedStatusCode) && assertExceptionErrorMessage(throwable, errMessage) + } + + static boolean assertExceptionStatusCodeAndMessage(Throwable throwable, int expectedStatusCode, StorageErrorCode errMessage) { + return assertExceptionStatusCode(throwable, expectedStatusCode) && assertExceptionErrorMessage(throwable, errMessage) + } + + static boolean assertExceptionStatusCode(Throwable throwable, int expectedStatusCode) { + if (!throwable instanceof StorageErrorException) { + return false + } + StorageErrorException storageErrorException = (StorageErrorException) throwable + return expectedStatusCode == storageErrorException.response().statusCode() + } + + static boolean assertExceptionErrorMessage(Throwable throwable, String errMessage) { + return throwable instanceof StorageErrorException && throwable.getMessage().contains(errMessage) + } + + static boolean assertExceptionErrorMessage(Throwable throwable, StorageErrorCode errMessage) { + return throwable instanceof StorageErrorException && throwable.getMessage().contains(errMessage.toString()) + } + + static boolean assertFileServicePropertiesAreEqual(StorageServiceProperties expected, StorageServiceProperties actual) { + if (expected == null) { + return actual == null + } else { + return assertMetricsAreEqual(expected.hourMetrics(), actual.hourMetrics()) && + assertMetricsAreEqual(expected.minuteMetrics(), actual.minuteMetrics()) && + assertLoggingAreEqual(expected.logging(), actual.logging()) && + assertCorsAreEqual(expected.cors(), actual.cors()) + } + } + + static boolean assertMetricsAreEqual(Metrics expected, Metrics actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.enabled(), actual.enabled()) && + Objects.equals(expected.includeAPIs(), actual.includeAPIs()) && + Objects.equals(expected.version(), actual.version()) && + assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()) + } + } + + static boolean assertLoggingAreEqual(Logging expected, Logging actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.read(), actual.read()) && + Objects.equals(expected.write(), actual.write()) && + Objects.equals(expected.delete(), actual.delete()) && + Objects.equals(expected.version(), actual.version()) && + assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()) + } + } + + static boolean assertRetentionPoliciesAreEqual(RetentionPolicy expected, RetentionPolicy actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.days(), actual.days()) && + Objects.equals(expected.enabled(), actual.enabled()) + } + } + + static boolean assertCorsAreEqual(List expected, List actual) { + if (expected == null) { + return actual == null + } else { + if (expected.size() != actual.size()) { + return false + } + for (int i = 0; i < expected.size(); i++) { + if (!assertCorRulesAreEqual(expected.get(i), actual.get(i))) { + return false + } + } + return true + } + } + + static boolean assertCorRulesAreEqual(CorsRule expected, CorsRule actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.allowedHeaders(), actual.allowedHeaders()) && + Objects.equals(expected.allowedMethods(), actual.allowedMethods()) && + Objects.equals(expected.allowedOrigins(), actual.allowedOrigins()) && + Objects.equals(expected.maxAgeInSeconds(), actual.maxAgeInSeconds()) + } + } + + static boolean assertPermissionsAreEqual(SignedIdentifier expected, SignedIdentifier actual) { + if (expected == null) { + return actual == null + } + if (expected.accessPolicy() == null) { + return actual.accessPolicy() == null + } + return Objects.equals(expected.id(), actual.id()) && + Objects.equals(expected.accessPolicy().permission(), actual.accessPolicy().permission()) && + Objects.equals(expected.accessPolicy().start(), actual.accessPolicy().start()) && + Objects.equals(expected.accessPolicy().expiry(), actual.accessPolicy().expiry()) + } + + static void sleepInRecord(Duration time) { + String azureTestMode = ConfigurationManager.getConfiguration().get("AZURE_TEST_MODE") + if ("RECORD".equalsIgnoreCase(azureTestMode)) { + sleep(time) + } + } + + private static void sleep(Duration time) { + try { + Thread.sleep(time.toMillis()) + } catch (InterruptedException ex) { + // Ignore the error + } + } + + static boolean assertSharesAreEqual(ShareItem expected, ShareItem actual, boolean includeMetadata, boolean includeSnapshot) { + if (expected == null) { + return actual == null + } else { + Objects.equals(expected.name(), actual.name()) + if (expected.properties() == null) { + return actual.properties() == null + } + if (!Objects.equals(expected.properties().quota(), actual.properties().quota())) { + return false + } + if (includeMetadata) { + if (!Objects.equals(expected.metadata(), actual.metadata())) { + return false + } + } + if (includeSnapshot) { + if (!Objects.equals(expected.snapshot(), actual.snapshot())) { + return false + } + } + return true + } + } + + static boolean assertFileServicePropertiesAreEqual(FileServiceProperties expected, FileServiceProperties actual) { + if (expected == null) { + return actual == null + } else { + return assertMetricsAreEqual(expected.hourMetrics(), actual.hourMetrics()) && + assertMetricsAreEqual(expected.minuteMetrics(), actual.minuteMetrics()) && + assertCorsAreEqual(expected.cors(), actual.cors()) + } + } + + static boolean assertTwoFilesAreSame(File f1, File f2) throws IOException, NoSuchAlgorithmException { + List uploadFileString = Files.readAllLines(f1.toPath()) + List downloadFileString = Files.readAllLines(f2.toPath()) + if (uploadFileString != null && downloadFileString != null) { + downloadFileString.removeAll(uploadFileString) + } + while (!downloadFileString.isEmpty()) { + if (!downloadFileString.get(0).trim().isEmpty()) { + return false + } + downloadFileString.remove(0) + } + return true + } + + static String createRandomFileWithLength(int size, String folder, String fileName) { + def path = Paths.get(folder) + if (!Files.exists(path)) { + Files.createDirectory(path) + } + def randomFile = new File(folder + "/" + fileName) + RandomAccessFile raf = new RandomAccessFile(randomFile, "rw") + raf.setLength(size) + raf.close() + return randomFile.getPath() + } + + static boolean assertFileRefName(FileRef fileRef, String name) { + if (fileRef != null) { + return Objects.equals(name, fileRef.name()) + } + return true + } + + static void deleteFolderIfExists(String folder) { + // Clean up all temporary generated files + def dir = new File(folder) + if (dir.isDirectory()) { + File[] children = dir.listFiles() + for (int i = 0; i < children.length; i++) { + Files.delete(children[i].toPath()) + } + } + } +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAPITests.groovy new file mode 100644 index 000000000000..718d8d6e63db --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAPITests.groovy @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.DirectoryClient +import com.azure.storage.file.FileClient +import com.azure.storage.file.ShareClient +import com.azure.storage.file.ShareClientBuilder +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.StorageErrorCode +import com.azure.storage.file.models.StorageErrorException +import spock.lang.Unroll + +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class ShareAPITests extends APISpec { + ShareClient primaryShareClient + def shareName + static def testMetadata + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + primaryFileServiceClient = fileServiceBuilderHelper(interceptorManager).buildClient() + primaryShareClient = primaryFileServiceClient.getShareClient(shareName) + testMetadata = Collections.singletonMap("testmetadata", "value") + } + + def "Get share URL"() { + given: + def accoutName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accoutName) + when: + def shareURL = primaryShareClient.getShareUrl().toString() + then: + expectURL.equals(shareURL) + } + + def "Get root directory client"() { + given: + def directoryClient = primaryShareClient.getRootDirectoryClient() + expect: + directoryClient instanceof DirectoryClient + } + + def "Get file client does not create a file"() { + given: + def fileClient = primaryShareClient.getFileClient("testFile") + expect: + fileClient instanceof FileClient + } + + def "Create share"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryShareClient.createWithResponse(null, null, null), 201) + } + + @Unroll + def "Create share with args"() { + expect: + FileTestHelper.assertResponseStatusCode(primaryShareClient.createWithResponse(metadata, quota, null), 201) + where: + metadata | quota + null | null + null | 1 + testMetadata | null + testMetadata | 1 + } + + @Unroll + def "Create share with invalid args"() { + when: + primaryShareClient.createWithResponse(metadata, quota, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMessage) + where: + metadata | quota | statusCode | errMessage + Collections.singletonMap("", "value") | 1 | 400 | StorageErrorCode.EMPTY_METADATA_KEY + Collections.singletonMap("a@B", "value") | 1 | 400 | "Bad Request" + testMetadata | 6000 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + } + + def "Create snapshot"() { + given: + primaryShareClient.create() + def shareSnapshotName = testResourceName.randomName(methodName, 60) + when: + def createSnapshotResponse = primaryShareClient.createSnapshotWithResponse(null, null) + def shareSnapshotClient = new ShareClientBuilder().shareName(shareSnapshotName).connectionString(connectionString) + .snapshot(createSnapshotResponse.value().snapshot()).buildClient() + then: + Objects.equals(createSnapshotResponse.value().snapshot(), + shareSnapshotClient.getSnapshotId()) + } + + def "Create snapshot error"() { + when: + primaryShareClient.createSnapshot() + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Create snapshot metadata"() { + given: + primaryShareClient.create() + def shareSnapshotName = testResourceName.randomName(methodName, 60) + when: + def createSnapshotResponse = primaryShareClient.createSnapshotWithResponse(testMetadata, null) + def shareSnapshotClient = new ShareClientBuilder().shareName(shareSnapshotName).connectionString(connectionString) + .snapshot(createSnapshotResponse.value().snapshot()).buildClient() + then: + Objects.equals(createSnapshotResponse.value().snapshot(), + shareSnapshotClient.getSnapshotId()) + } + + def "Create snapshot metadata error"() { + when: + primaryShareClient.createSnapshotWithResponse(Collections.singletonMap("", "value"), null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + + def "Delete share"() { + given: + primaryShareClient.create() + expect: + FileTestHelper.assertResponseStatusCode(primaryShareClient.deleteWithResponse(null), 202) + } + + def "Delete share error"() { + when: + primaryShareClient.delete() + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Get properties"() { + given: + primaryShareClient.createWithResponse(testMetadata, 1, null) + when: + def getPropertiesResponse = primaryShareClient.getPropertiesWithResponse(null) + then: + FileTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + testMetadata.equals(getPropertiesResponse.value().metadata()) + getPropertiesResponse.value().quota() == 1L + } + + def "Get properties error"() { + when: + primaryShareClient.getProperties() + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Set quota"() { + given: + primaryShareClient.createWithResponse(null, 1, null) + when: + def getQuotaBeforeResponse = primaryShareClient.getProperties() + def setQuotaResponse = primaryShareClient.setQuotaWithResponse(2, null) + def getQuotaAfterResponse = primaryShareClient.getProperties() + then: + getQuotaBeforeResponse.quota() == 1 + FileTestHelper.assertResponseStatusCode(setQuotaResponse, 200) + getQuotaAfterResponse.quota() == 2 + } + + def "Set quota error"() { + when: + primaryShareClient.setQuota(2) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Set metadata"() { + given: + primaryShareClient.createWithResponse(testMetadata, null, null) + def metadataAfterSet = Collections.singletonMap("afterset", "value") + when: + def getMetadataBeforeResponse = primaryShareClient.getProperties() + def setMetadataResponse = primaryShareClient.setMetadataWithResponse(metadataAfterSet, null) + def getMetadataAfterResponse = primaryShareClient.getProperties() + then: + testMetadata.equals(getMetadataBeforeResponse.metadata()) + FileTestHelper.assertResponseStatusCode(setMetadataResponse, 200) + metadataAfterSet.equals(getMetadataAfterResponse.metadata()) + } + + def "Set metadata error"() { + when: + primaryShareClient.setMetadata(testMetadata) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + + def "Create directory"() { + given: + primaryShareClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createDirectoryWithResponse("testCreateDirectory", null, null), 201) + } + + def "Create directory invalid name"() { + given: + primaryShareClient.create() + when: + primaryShareClient.createDirectory("test/directory") + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.PARENT_NOT_FOUND) + } + + def "Create directory metadata"() { + given: + primaryShareClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createDirectoryWithResponse("testCreateDirectory", testMetadata, null), 201) + } + + def "Create directory metadata error"() { + given: + primaryShareClient.create() + when: + primaryShareClient.createDirectoryWithResponse("testdirectory", Collections.singletonMap("", "value"), null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + + def "Create file"() { + given: + primaryShareClient.create() + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createFileWithResponse("testCreateFile", 1024, null, null, null), 201) + } + + @Unroll + def "Create file invalid args"() { + given: + primaryShareClient.create() + when: + primaryShareClient.createFileWithResponse(fileName, maxSize, null, null, null) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + fileName | maxSize | statusCode | errMsg + "test\file" | 1024 | 400 | "Bad Request" + "fileName" | -1 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + + } + + def "Create file maxOverload"() { + given: + primaryShareClient.create() + FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + .fileContentType("txt") + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.createFileWithResponse("testCreateFile", 1024, httpHeaders, testMetadata, null), 201) + } + + @Unroll + def "Create file maxOverload invalid args"() { + given: + primaryShareClient.create() + when: + primaryShareClient.createFile("test\file", maxSize) + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, "Bad Request") + where: + fileName | maxSize | httpHeaders | metadata + "test\file" | 1024 | new FileHTTPHeaders() | testMetadata + "fileName" | -1 | new FileHTTPHeaders() | testMetadata + "fileName" | 1024 | new FileHTTPHeaders().fileContentMD5(new byte[0]) | testMetadata + "fileName" | 1024 | new FileHTTPHeaders() | Collections.singletonMap("", "value") + + } + + def "Delete directory"() { + given: + def directoryName = "testCreateDirectory" + primaryShareClient.create() + primaryShareClient.createDirectory(directoryName) + expect: + FileTestHelper.assertResponseStatusCode(primaryShareClient.deleteDirectoryWithResponse(directoryName, null), 202) + } + + def "Delete directory error"() { + given: + primaryShareClient.create() + when: + primaryShareClient.deleteDirectory("testdirectory") + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Delete file"() { + given: + def fileName = "testCreateFile" + primaryShareClient.create() + primaryShareClient.createFile(fileName, 1024) + expect: + FileTestHelper.assertResponseStatusCode( + primaryShareClient.deleteFileWithResponse(fileName, null), 202) + } + + def "Delete file error"() { + given: + primaryShareClient.create() + when: + primaryShareClient.deleteFile("testdirectory") + then: + def e = thrown(StorageErrorException) + FileTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = shareBuilderHelper(interceptorManager, shareName).snapshot(snapshot).buildClient() + then: + snapshot.equals(shareSnapshotClient.getSnapshotId()) + } + +} diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAsyncAPITests.groovy new file mode 100644 index 000000000000..e406994df36a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/spock/ShareAsyncAPITests.groovy @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.file.spock + +import com.azure.storage.common.credentials.SharedKeyCredential +import com.azure.storage.file.DirectoryAsyncClient +import com.azure.storage.file.FileAsyncClient +import com.azure.storage.file.ShareAsyncClient +import com.azure.storage.file.ShareClientBuilder +import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.StorageErrorCode +import reactor.test.StepVerifier +import spock.lang.Unroll + +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class ShareAsyncAPITests extends APISpec { + ShareAsyncClient primaryShareAsyncClient + def shareName + static def testMetadata + + def setup() { + shareName = testResourceName.randomName(methodName, 60) + primaryFileServiceAsyncClient = fileServiceBuilderHelper(interceptorManager).buildAsyncClient() + primaryShareAsyncClient = primaryFileServiceAsyncClient.getShareAsyncClient(shareName) + testMetadata = Collections.singletonMap("testmetadata", "value") + } + + def "Get share URL"() { + given: + def accoutName = SharedKeyCredential.fromConnectionString(connectionString).accountName() + def expectURL = String.format("https://%s.file.core.windows.net", accoutName) + when: + def shareURL = primaryShareAsyncClient.getShareUrl().toString() + then: + expectURL.equals(shareURL) + } + + def "Get root directory client"() { + given: + def directoryClient = primaryShareAsyncClient.getRootDirectoryClient() + expect: + directoryClient instanceof DirectoryAsyncClient + } + + def "Get file client does not create a file"() { + given: + def fileClient = primaryShareAsyncClient.getFileClient("testFile") + expect: + fileClient instanceof FileAsyncClient + } + + def "Create share"() { + expect: + StepVerifier.create(primaryShareAsyncClient.createWithResponse(null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create share with args"() { + expect: + StepVerifier.create(primaryShareAsyncClient.createWithResponse(metadata, quota)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + where: + metadata | quota + null | null + null | 1 + testMetadata | null + testMetadata | 1 + } + + @Unroll + def "Create share with invalid args"() { + when: + def createShareVerifier = StepVerifier.create(primaryShareAsyncClient.createWithResponse(metadata, quota)) + then: + createShareVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMessage) + } + + where: + metadata | quota | statusCode | errMessage + Collections.singletonMap("", "value") | 1 | 400 | StorageErrorCode.EMPTY_METADATA_KEY + Collections.singletonMap("a@B", "value") | 1 | 400 | "Bad Request" + testMetadata | 6000 | 400 | StorageErrorCode.INVALID_HEADER_VALUE + } + + def "Create snapshot"() { + given: + primaryShareAsyncClient.create().block() + def shareSnapshotName = testResourceName.randomName(methodName, 60) + when: + def createSnapshotVerifier = StepVerifier.create(primaryShareAsyncClient.createSnapshotWithResponse(null)) + + then: + createSnapshotVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + def shareSnapshotClient = new ShareClientBuilder().shareName(shareSnapshotName).connectionString(connectionString) + .snapshot(it.value().snapshot()).buildClient() + assert Objects.equals(it.value().snapshot(), + shareSnapshotClient.getSnapshotId()) + }.verifyComplete() + + } + + def "Create snapshot error"() { + when: + def createShareShnapshotErrorVerifier = StepVerifier.create(primaryShareAsyncClient.createSnapshot()) + then: + createShareShnapshotErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Create snapshot metadata"() { + given: + primaryShareAsyncClient.create().block() + def shareSnapshotName = testResourceName.randomName(methodName, 60) + when: + def createSnapshotVerifier = StepVerifier.create(primaryShareAsyncClient.createSnapshotWithResponse(testMetadata)) + then: + createSnapshotVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + def shareSnapshotClient = new ShareClientBuilder().shareName(shareSnapshotName).connectionString(connectionString) + .snapshot(it.value().snapshot()).buildClient() + assert Objects.equals(it.value().snapshot(), + shareSnapshotClient.getSnapshotId()) + }.verifyComplete() + } + + def "Create snapshot metadata error"() { + when: + def createSnapshotErrorVerifier = StepVerifier.create(primaryShareAsyncClient.createSnapshotWithResponse(Collections.singletonMap("", "value"))) + then: + createSnapshotErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + } + + def "Delete share"() { + given: + primaryShareAsyncClient.create().block() + expect: + StepVerifier.create(primaryShareAsyncClient.deleteWithResponse()) + .assertNext { + FileTestHelper.assertResponseStatusCode(it, 201) + } + } + + def "Delete share error"() { + expect: + StepVerifier.create(primaryShareAsyncClient.delete()) + .verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Get properties"() { + given: + primaryShareAsyncClient.createWithResponse(testMetadata, 1).block() + when: + def getPropertiesVerifier = StepVerifier.create(primaryShareAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + assert testMetadata.equals(it.value().metadata()) + assert it.value().quota() == 1L + }.verifyComplete() + } + + def "Get properties error"() { + expect: + StepVerifier.create(primaryShareAsyncClient.getProperties()) + .verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Set quota"() { + given: + primaryShareAsyncClient.createWithResponse(null, 1).block() + when: + def getQuotaBeforeVerifier = StepVerifier.create(primaryShareAsyncClient.getProperties()) + def setQuotaVerifier = StepVerifier.create(primaryShareAsyncClient.setQuota(2)) + def getQuotaAfterVerifier = StepVerifier.create(primaryShareAsyncClient.getProperties()) + then: + getQuotaBeforeVerifier.assertNext { + assert it.quota() == 1 + } + setQuotaVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(setQuotaResponse, 200) + } + getQuotaAfterVerifier.assertNext { + assert it.quota() == 2 + } + } + + def "Set quota error"() { + expect: + StepVerifier.create(primaryShareAsyncClient.setQuota(2)) + .verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Set metadata"() { + given: + primaryShareAsyncClient.createWithResponse(testMetadata, null).block() + def metadataAfterSet = Collections.singletonMap("afterset", "value") + when: + def getMetadataBeforeVerifer = StepVerifier.create(primaryShareAsyncClient.getProperties()) + def setMetadataVerifier = StepVerifier.create(primaryShareAsyncClient.setMetadataWithResponse(metadataAfterSet)) + def getMetadataAfterVerifier = StepVerifier.create(primaryShareAsyncClient.getProperties()) + then: + getMetadataBeforeVerifer.assertNext { + assert testMetadata.equals(it.metadata()) + } + setMetadataVerifier.assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 200) + } + getMetadataAfterVerifier.assertNext { + assert metadataAfterSet.equals(it.metadata()) + } + } + + def "Set metadata error"() { + expect: + StepVerifier.create(primaryShareAsyncClient.setMetadata(testMetadata)) + .verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.SHARE_NOT_FOUND) + } + } + + def "Create directory"() { + given: + primaryShareAsyncClient.create().block() + expect: + StepVerifier.create(primaryShareAsyncClient.createDirectoryWithResponse("testCreateDirectory", null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create directory invalid name"() { + given: + primaryShareAsyncClient.create().block() + when: + def createDirectoryVerifier = StepVerifier.create(primaryShareAsyncClient.createDirectory("test/directory")) + then: + createDirectoryVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.PARENT_NOT_FOUND) + } + } + + def "Create directory metadata"() { + given: + primaryShareAsyncClient.create().block() + expect: + StepVerifier.create(primaryShareAsyncClient.createDirectoryWithResponse("testCreateDirectory", testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Create directory metadata error"() { + given: + primaryShareAsyncClient.create().block() + when: + def createDirErrorVerifier = StepVerifier.create(primaryShareAsyncClient.createDirectoryWithResponse("testdirectory", Collections.singletonMap("", "value"))) + then: + createDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.EMPTY_METADATA_KEY) + } + } + + def "Create file"() { + given: + primaryShareAsyncClient.create().block() + expect: + StepVerifier.create(primaryShareAsyncClient.createFileWithResponse("testCreateFile", 1024, null, null)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create file invalid args"() { + given: + primaryShareAsyncClient.create().block() + when: + def createFileErrorVerifier = StepVerifier.create(primaryShareAsyncClient.createFileWithResponse(fileName, maxSize, null, null)) + then: + createFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + fileName | maxSize | statusCode | errMsg + "test\file" | 1024 | 400 | "Bad Request" + "fileName" | -1 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + + } + + def "Create file maxOverload"() { + given: + primaryShareAsyncClient.create().block() + FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("txt") + expect: + StepVerifier.create(primaryShareAsyncClient.createFileWithResponse("testCreateFile", 1024, httpHeaders, testMetadata)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create file maxOverload invalid args"() { + given: + primaryShareAsyncClient.create().block() + when: + def createFileVerifier = StepVerifier.create(primaryShareAsyncClient.createFile("test\file", maxSize)) + then: + createFileVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 400, "Bad Request") + } + where: + fileName | maxSize | httpHeaders | metadata + "test\file" | 1024 | new FileHTTPHeaders() | testMetadata + "fileName" | -1 | new FileHTTPHeaders() | testMetadata + "fileName" | 1024 | new FileHTTPHeaders().fileContentMD5(new byte[0]) | testMetadata + "fileName" | 1024 | new FileHTTPHeaders() | Collections.singletonMap("", "value") + + } + + def "Delete directory"() { + given: + def directoryName = "testCreateDirectory" + primaryShareAsyncClient.create().block() + primaryShareAsyncClient.createDirectory(directoryName).block() + expect: + StepVerifier.create(primaryShareAsyncClient.deleteDirectoryWithResponse(directoryName)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + } + + def "Delete directory error"() { + given: + primaryShareAsyncClient.create().block() + when: + def deleteDirErrorVerifier = StepVerifier.create(primaryShareAsyncClient.deleteDirectory("testdirectory")) + then: + deleteDirErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Delete file"() { + given: + def fileName = "testCreateFile" + primaryShareAsyncClient.create().block() + primaryShareAsyncClient.createFile(fileName, 1024).block() + expect: + StepVerifier.create(primaryShareAsyncClient.deleteFileWithResponse(fileName)) + .assertNext { + assert FileTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + + } + + def "Delete file error"() { + given: + primaryShareAsyncClient.create().block() + when: + def deleteFileErrorVerifier = StepVerifier.create(primaryShareAsyncClient.deleteFile("testdirectory")) + then: + deleteFileErrorVerifier.verifyErrorSatisfies { + assert FileTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.RESOURCE_NOT_FOUND) + } + } + + def "Get snapshot id"() { + given: + def snapshot = OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, + 1, 1), ZoneOffset.UTC).toString() + when: + def shareSnapshotClient = shareBuilderHelper(interceptorManager, shareName).snapshot(snapshot).buildAsyncClient() + then: + snapshot.equals(shareSnapshotClient.getSnapshotId()) + } + +} diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectory.json new file mode 100644 index 000000000000..a1b2be4372b0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectory.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatedirectory968416890f957455?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BF684C2A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28dc-e01a-00d9-7112-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:46 GMT", + "x-ms-client-request-id" : "db038cf3-262b-4506-8e32-5dfef10ee51f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatedirectory968416890f957455/directoryapitestscreatedirectory702513f8eeaf3371?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:46.6726093Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:46 GMT", + "ETag" : "\"0x8D72829BF6F48CD\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:46.6726093Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c28de-e01a-00d9-7212-5a965a000000", + "x-ms-client-request-id" : "a1d9d5f3-88a1-4b99-9af6-ae393718330f", + "x-ms-file-last-write-time" : "2019-08-24T00:26:46.6726093Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectory968416890f957455", "directoryapitestscreatedirectory702513f8eeaf3371" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryError.json new file mode 100644 index 000000000000..a875dbccc69d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatedirectoryerror44617f32834228?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BF8614AB\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28e1-e01a-00d9-7512-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:46 GMT", + "x-ms-client-request-id" : "3047eefd-5ee1-4b99-b190-303cb555ead9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatedirectoryerror68209aca543bde/directoryapitestscreatedirectoryerror1771122b60bdf5?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "799c28e4-e01a-00d9-7612-5a965a000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:799c28e4-e01a-00d9-7612-5a965a000000\nTime:2019-08-24T00:26:46.8650490Z", + "Date" : "Sat, 24 Aug 2019 00:26:46 GMT", + "x-ms-client-request-id" : "6ff17057-8782-4401-9938-494bf629bcd3", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectoryerror44617f32834228", "directoryapitestscreatedirectoryerror1771122b60bdf5", "directoryapitestscreatedirectoryerror68209aca543bde" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryErrorWithMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryErrorWithMetadata.json new file mode 100644 index 000000000000..7e4c4be1c069 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryErrorWithMetadata.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatedirectoryerrorwithmetadata37248e76?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BFD112BF\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28ec-e01a-00d9-7d12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:46 GMT", + "x-ms-client-request-id" : "e61ac142-ea10-4d40-91ab-772ad1339531" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatedirectoryerrorwithmetadata37248e76/directoryapitestscreatedirectoryerrorwithmetadata07034f3c?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "970", + "StatusCode" : "403", + "x-ms-request-id" : "799c28ee-e01a-00d9-7e12-5a965a000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:799c28ee-e01a-00d9-7e12-5a965a000000\nTime:2019-08-24T00:26:47.3605241ZThe MAC signature found in the HTTP request 'WlH+HzOuuGGO2B4yKpX9nsgiKmVXh5E7aep9O62nW64=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nSat, 24 Aug 2019 00:26:47 GMT\n\n\n\n\n\nx-ms-client-request-id:e327c481-c964-483d-a63f-61806340bf85\nx-ms-file-attributes:None\nx-ms-file-creation-time:now\nx-ms-file-last-write-time:now\nx-ms-file-permission:inherit\nx-ms-meta-testmeta:value\nx-ms-version:2019-02-02\n/azstoragesdkaccount/directoryapitestscreatedirectoryerrorwithmetadata37248e76/directoryapitestscreatedirectoryerrorwithmetadata07034f3c\nrestype:directory'.", + "Date" : "Sat, 24 Aug 2019 00:26:46 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectoryerrorwithmetadata37248e76", "directoryapitestscreatedirectoryerrorwithmetadata07034f3c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithMetadata.json new file mode 100644 index 000000000000..f0f549db46f4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateDirectoryWithMetadata.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatedirectorywithmetadata7554932ec8?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BFA4EEDD\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28e7-e01a-00d9-7912-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:46 GMT", + "x-ms-client-request-id" : "6c0c472a-f9ba-4d55-b916-94e437a7249f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatedirectorywithmetadata7554932ec8/directoryapitestscreatedirectorywithmetadata83316e9af8?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:47.0739935Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:46 GMT", + "ETag" : "\"0x8D72829BFAC87DF\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:47.0739935Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c28e9-e01a-00d9-7a12-5a965a000000", + "x-ms-client-request-id" : "846fb376-d506-4653-a33f-f06dbc5d0bbc", + "x-ms-file-last-write-time" : "2019-08-24T00:26:47.0739935Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatedirectorywithmetadata7554932ec8", "directoryapitestscreatedirectorywithmetadata83316e9af8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFile.json new file mode 100644 index 000000000000..21a20c9d17d7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFile.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefile57642fea742809b014c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C48D537E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2992-e01a-00d9-0612-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:54 GMT", + "x-ms-client-request-id" : "6309339c-b964-40d0-bc51-931e347bcc46" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefile57642fea742809b014c/directoryapitestscreatefile47041559c11aef46b43?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:55.3018995Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:54 GMT", + "ETag" : "\"0x8D72829C4940273\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:55.3018995Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2994-e01a-00d9-0712-5a965a000000", + "x-ms-client-request-id" : "9d19c2b2-9633-462d-a638-3a6e17bfd07f", + "x-ms-file-last-write-time" : "2019-08-24T00:26:55.3018995Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefile57642fea742809b014c/directoryapitestscreatefile47041559c11aef46b43%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:55.3399362Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:54 GMT", + "ETag" : "\"0x8D72829C499D042\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:55.3399362Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c2995-e01a-00d9-0812-5a965a000000", + "x-ms-client-request-id" : "48d94c34-9316-40bc-a479-222b39f77fd5", + "x-ms-file-last-write-time" : "2019-08-24T00:26:55.3399362Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefile57642fea742809b014c", "directoryapitestscreatefile47041559c11aef46b43" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs0.json new file mode 100644 index 000000000000..64034da592e3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs0.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefileinvalidargs085489d809ec1c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C4B0E9CC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2998-e01a-00d9-0b12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:54 GMT", + "x-ms-client-request-id" : "b105c6af-c6be-4998-acb1-f5ccd7818d4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefileinvalidargs085489d809ec1c/directoryapitestscreatefileinvalidargs0024523b585190?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:55.5361257Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:54 GMT", + "ETag" : "\"0x8D72829C4B7BFE9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:55.5361257Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c299a-e01a-00d9-0c12-5a965a000000", + "x-ms-client-request-id" : "8293d53d-d018-42d9-9c51-1cd96195f313", + "x-ms-file-last-write-time" : "2019-08-24T00:26:55.5361257Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefileinvalidargs085489d809ec1c/directoryapitestscreatefileinvalidargs0024523b585190%2ftest%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:26:55 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefileinvalidargs085489d809ec1c", "directoryapitestscreatefileinvalidargs0024523b585190" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs1.json new file mode 100644 index 000000000000..b95ce4562991 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileInvalidArgs1.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefileinvalidargs17470639be32bd?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C55C1F30\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "102edf70-401a-0090-6412-5aa53a000000", + "Date" : "Sat, 24 Aug 2019 00:26:55 GMT", + "x-ms-client-request-id" : "ce2e2dfc-2e7d-4eda-bbf3-6a0590afa7c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefileinvalidargs17470639be32bd/directoryapitestscreatefileinvalidargs122354f3e4376d?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:56.8123512Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:56 GMT", + "ETag" : "\"0x8D72829C57A7C78\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:56.8123512Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "102edf74-401a-0090-6512-5aa53a000000", + "x-ms-client-request-id" : "33e7ad76-4eb4-45f7-b7a7-cb16dbaf879f", + "x-ms-file-last-write-time" : "2019-08-24T00:26:56.8123512Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefileinvalidargs17470639be32bd/directoryapitestscreatefileinvalidargs122354f3e4376d%2ffileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "102edf75-401a-0090-6612-5aa53a000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:102edf75-401a-0090-6612-5aa53a000000\nTime:2019-08-24T00:26:56.9958658Z", + "Date" : "Sat, 24 Aug 2019 00:26:56 GMT", + "x-ms-client-request-id" : "68d4f559-1071-413f-9cdf-0512605238e6", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefileinvalidargs17470639be32bd", "directoryapitestscreatefileinvalidargs122354f3e4376d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverload.json new file mode 100644 index 000000000000..6722c68d6ff6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverload.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverload592621c635f60?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C5AE2957\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "102edf78-401a-0090-6912-5aa53a000000", + "Date" : "Sat, 24 Aug 2019 00:26:56 GMT", + "x-ms-client-request-id" : "468775eb-ba28-4499-bcb2-6bc31d14a717" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverload592621c635f60/directoryapitestscreatefilemaxoverload113020c7ec107?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:57.1917165Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:56 GMT", + "ETag" : "\"0x8D72829C5B45F6D\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:57.1917165Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "102edf7a-401a-0090-6a12-5aa53a000000", + "x-ms-client-request-id" : "628d3ff1-ea53-42e2-ab98-7a7969166efe", + "x-ms-file-last-write-time" : "2019-08-24T00:26:57.1917165Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverload592621c635f60/directoryapitestscreatefilemaxoverload113020c7ec107%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:57.2327545Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:56 GMT", + "ETag" : "\"0x8D72829C5BAA279\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:57.2327545Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "102edf7b-401a-0090-6b12-5aa53a000000", + "x-ms-client-request-id" : "44bef9c5-3f8c-457a-a489-bd72c41c54cd", + "x-ms-file-last-write-time" : "2019-08-24T00:26:57.2327545Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefilemaxoverload592621c635f60", "directoryapitestscreatefilemaxoverload113020c7ec107" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs0.json new file mode 100644 index 000000000000..b3aba4c257c5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs0.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs088813fe?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C5DB1082\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "102edf7e-401a-0090-6e12-5aa53a000000", + "Date" : "Sat, 24 Aug 2019 00:26:56 GMT", + "x-ms-client-request-id" : "ebbee1c4-486d-42f0-84e4-bc8c08f5ed43" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs088813fe/directoryapitestscreatefilemaxoverloadinvalidargs000701ba?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:57.4910034Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:56 GMT", + "ETag" : "\"0x8D72829C5E20A52\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:57.4910034Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "102edf80-401a-0090-6f12-5aa53a000000", + "x-ms-client-request-id" : "66caa7b6-fe5c-420b-babe-f5c051125ddb", + "x-ms-file-last-write-time" : "2019-08-24T00:26:57.4910034Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs088813fe/directoryapitestscreatefilemaxoverloadinvalidargs000701ba%2ftest%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:26:56 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefilemaxoverloadinvalidargs088813fe", "directoryapitestscreatefilemaxoverloadinvalidargs000701ba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs1.json new file mode 100644 index 000000000000..698a4245320d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs1.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs1090341b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C6126A87\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d4877d5-801a-004a-1712-5a0011000000", + "Date" : "Sat, 24 Aug 2019 00:26:57 GMT", + "x-ms-client-request-id" : "ca3d4b6e-17a4-402a-b016-f3d7cbbbe7c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs1090341b/directoryapitestscreatefilemaxoverloadinvalidargs175775be?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:57.8533522Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:57 GMT", + "ETag" : "\"0x8D72829C6195492\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:57.8533522Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "6d4877d7-801a-004a-1812-5a0011000000", + "x-ms-client-request-id" : "75490a45-c1a0-4360-847d-7a01e7f5b770", + "x-ms-file-last-write-time" : "2019-08-24T00:26:57.8533522Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs1090341b/directoryapitestscreatefilemaxoverloadinvalidargs175775be%2ftest%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:26:57 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefilemaxoverloadinvalidargs1090341b", "directoryapitestscreatefilemaxoverloadinvalidargs175775be" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs2.json new file mode 100644 index 000000000000..563967076ad2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs2.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs25639551?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C714A5C4\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "3f5df309-a01a-013f-7012-5ac1ff000000", + "Date" : "Sat, 24 Aug 2019 00:26:59 GMT", + "x-ms-client-request-id" : "c622ec5d-e782-4b4f-981e-550fcf1a5e76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs25639551/directoryapitestscreatefilemaxoverloadinvalidargs285479cd?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:59.6781050Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:59 GMT", + "ETag" : "\"0x8D72829C72FC3FA\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:59.6781050Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "3f5df30b-a01a-013f-7112-5ac1ff000000", + "x-ms-client-request-id" : "aa5faab8-b44a-48b9-9ce5-3400bea35b4c", + "x-ms-file-last-write-time" : "2019-08-24T00:26:59.6781050Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs25639551/directoryapitestscreatefilemaxoverloadinvalidargs285479cd%2ftest%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:26:59 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefilemaxoverloadinvalidargs25639551", "directoryapitestscreatefilemaxoverloadinvalidargs285479cd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs3.json new file mode 100644 index 000000000000..f573b49659a3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateFileMaxOverloadInvalidArgs3.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs39149072?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C7EEE490\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "441f5643-f01a-012c-4812-5af41e000000", + "Date" : "Sat, 24 Aug 2019 00:27:00 GMT", + "x-ms-client-request-id" : "287ecbee-8977-4ffb-883f-17cb60a06bc6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs39149072/directoryapitestscreatefilemaxoverloadinvalidargs315681f6?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:01.0744447Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:00 GMT", + "ETag" : "\"0x8D72829C804D47F\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:01.0744447Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "441f564a-f01a-012c-4d12-5af41e000000", + "x-ms-client-request-id" : "fc543332-37b3-4c62-9a7c-2185714d00c2", + "x-ms-file-last-write-time" : "2019-08-24T00:27:01.0744447Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatefilemaxoverloadinvalidargs39149072/directoryapitestscreatefilemaxoverloadinvalidargs315681f6%2ftest%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:27:00 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatefilemaxoverloadinvalidargs39149072", "directoryapitestscreatefilemaxoverloadinvalidargs315681f6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectory.json new file mode 100644 index 000000000000..ab93234886eb --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectory.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectory89546247c727269?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C33A418A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2969-e01a-00d9-6612-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:52 GMT", + "x-ms-client-request-id" : "98aa5e84-c5ae-40bb-a287-7149d60452be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectory89546247c727269/directoryapitestscreatesubdirectory09786f8ae1aa9d4?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:53.0857707Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:52 GMT", + "ETag" : "\"0x8D72829C341DAEB\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:53.0857707Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c296b-e01a-00d9-6712-5a965a000000", + "x-ms-client-request-id" : "8843effb-a36f-410c-a71d-1778ce045e13", + "x-ms-file-last-write-time" : "2019-08-24T00:26:53.0857707Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectory89546247c727269/directoryapitestscreatesubdirectory09786f8ae1aa9d4%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:53.2449239Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:52 GMT", + "ETag" : "\"0x8D72829C35A23D7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:53.2449239Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c296d-e01a-00d9-6912-5a965a000000", + "x-ms-client-request-id" : "a5eb9e79-bea5-4f7f-b9a3-2536298ccc91", + "x-ms-file-last-write-time" : "2019-08-24T00:26:53.2449239Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatesubdirectory89546247c727269", "directoryapitestscreatesubdirectory09786f8ae1aa9d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryInvalidName.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryInvalidName.json new file mode 100644 index 000000000000..8b4270b0f96f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryInvalidName.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectoryinvalidname35154263a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C370C842\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2970-e01a-00d9-6c12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:52 GMT", + "x-ms-client-request-id" : "f4feb896-07db-4b4c-8054-a34f9435b824" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectoryinvalidname35154263a/directoryapitestscreatesubdirectoryinvalidname3539807ff?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:53.4361075Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:52 GMT", + "ETag" : "\"0x8D72829C3774FF3\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:53.4361075Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2972-e01a-00d9-6d12-5a965a000000", + "x-ms-client-request-id" : "2bdcc5dd-bd77-46b1-92fc-3f0a64655dab", + "x-ms-file-last-write-time" : "2019-08-24T00:26:53.4361075Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectoryinvalidname35154263a/directoryapitestscreatesubdirectoryinvalidname3539807ff%2ftest%2fsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ParentNotFound", + "retry-after" : "0", + "Content-Length" : "224", + "StatusCode" : "404", + "x-ms-request-id" : "799c2973-e01a-00d9-6e12-5a965a000000", + "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:799c2973-e01a-00d9-6e12-5a965a000000\nTime:2019-08-24T00:26:53.5004145Z", + "Date" : "Sat, 24 Aug 2019 00:26:52 GMT", + "x-ms-client-request-id" : "bc39abad-eb04-4727-9e08-b263bb54d349", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatesubdirectoryinvalidname35154263a", "directoryapitestscreatesubdirectoryinvalidname3539807ff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadata.json new file mode 100644 index 000000000000..184f306f2fef --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadata.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectorymetadata55718b0c022?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C39B3E11\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2977-e01a-00d9-7112-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:53 GMT", + "x-ms-client-request-id" : "53fc399c-0d54-4108-9d5b-966078940bf6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectorymetadata55718b0c022/directoryapitestscreatesubdirectorymetadata3489559ba0c?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:53.8244832Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:53 GMT", + "ETag" : "\"0x8D72829C3B292E0\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:53.8244832Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2979-e01a-00d9-7212-5a965a000000", + "x-ms-client-request-id" : "7aabbe1d-927c-42a2-805a-fb7bc3a5d42c", + "x-ms-file-last-write-time" : "2019-08-24T00:26:53.8244832Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectorymetadata55718b0c022/directoryapitestscreatesubdirectorymetadata3489559ba0c%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:53.8625185Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:53 GMT", + "ETag" : "\"0x8D72829C3B860A1\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:53.8625185Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c297a-e01a-00d9-7312-5a965a000000", + "x-ms-client-request-id" : "267d65b5-7b31-4e6d-9d26-32905aeb0e33", + "x-ms-file-last-write-time" : "2019-08-24T00:26:53.8625185Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatesubdirectorymetadata55718b0c022", "directoryapitestscreatesubdirectorymetadata3489559ba0c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadataError.json new file mode 100644 index 000000000000..3b16ccc119c8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsCreateSubDirectoryMetadataError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectorymetadataerror11694100?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C3DCC3F2\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c297d-e01a-00d9-7612-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:53 GMT", + "x-ms-client-request-id" : "523581b1-0b00-480d-aa1a-48e571d8c746" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectorymetadataerror11694100/directoryapitestscreatesubdirectorymetadataerror46982bea?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:54.1457911Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:53 GMT", + "ETag" : "\"0x8D72829C3E399F7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:54.1457911Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c297f-e01a-00d9-7712-5a965a000000", + "x-ms-client-request-id" : "da0848af-5666-4a7b-87b5-71aac7c03eb2", + "x-ms-file-last-write-time" : "2019-08-24T00:26:54.1457911Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestscreatesubdirectorymetadataerror11694100/directoryapitestscreatesubdirectorymetadataerror46982bea%2ftestsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "799c2980-e01a-00d9-7812-5a965a000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:799c2980-e01a-00d9-7812-5a965a000000\nTime:2019-08-24T00:26:54.1810673Zvalue", + "Date" : "Sat, 24 Aug 2019 00:26:53 GMT", + "x-ms-client-request-id" : "a7d027f4-6fce-46f0-ae41-7dd43121e278", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestscreatesubdirectorymetadataerror11694100", "directoryapitestscreatesubdirectorymetadataerror46982bea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectory.json new file mode 100644 index 000000000000..4ded690e9909 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectory.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletedirectory90273f36ba39bfd8?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BFEE8D12\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28f1-e01a-00d9-0112-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:46 GMT", + "x-ms-client-request-id" : "005a2eae-b03c-4f59-bfde-6f7913d6e99f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletedirectory90273f36ba39bfd8/directoryapitestsdeletedirectory471153c65d02d2e2?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:47.6795726Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "ETag" : "\"0x8D72829C008EF4E\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:47.6795726Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c28f3-e01a-00d9-0212-5a965a000000", + "x-ms-client-request-id" : "147dca63-a94e-4a71-8c40-8926a067d399", + "x-ms-file-last-write-time" : "2019-08-24T00:26:47.6795726Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletedirectory90273f36ba39bfd8/directoryapitestsdeletedirectory471153c65d02d2e2?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "799c28f4-e01a-00d9-0312-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "x-ms-client-request-id" : "e75d1570-3b9a-4ba1-ad36-1fed020550ee" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletedirectory90273f36ba39bfd8", "directoryapitestsdeletedirectory471153c65d02d2e2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectoryError.json new file mode 100644 index 000000000000..098bd2a9dc72 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteDirectoryError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletedirectoryerror4792326bedc17a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C0233E92\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28f7-e01a-00d9-0612-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "x-ms-client-request-id" : "b569d873-c801-4687-a1d8-0ed389a0f2a2" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletedirectoryerror4792326bedc17a/directoryapitestsdeletedirectoryerror27953366787115?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "799c28f9-e01a-00d9-0712-5a965a000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:799c28f9-e01a-00d9-0712-5a965a000000\nTime:2019-08-24T00:26:47.8900309Z", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "x-ms-client-request-id" : "b0798f25-064e-4ffd-9879-4ea927c28736", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletedirectoryerror4792326bedc17a", "directoryapitestsdeletedirectoryerror27953366787115" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFile.json new file mode 100644 index 000000000000..ac0599e2fbee --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFile.json @@ -0,0 +1,98 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletefile544150aa58f0c20d94f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D0C75B35\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce3e4-801a-010a-0112-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:15 GMT", + "x-ms-client-request-id" : "f4ecd3de-11cf-4038-b678-f270172297d3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletefile544150aa58f0c20d94f/directoryapitestsdeletefile42449d2eb02ba482b42?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:16.4842533Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:16 GMT", + "ETag" : "\"0x8D72829D1342E25\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:16.4842533Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce3fb-801a-010a-0412-5a6faa000000", + "x-ms-client-request-id" : "62f268c7-a4f8-42ef-8065-6d4cbe426eb7", + "x-ms-file-last-write-time" : "2019-08-24T00:27:16.4842533Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletefile544150aa58f0c20d94f/directoryapitestsdeletefile42449d2eb02ba482b42%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:16.6003652Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:16 GMT", + "ETag" : "\"0x8D72829D145E5C4\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:16.6003652Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "42bce3fd-801a-010a-0512-5a6faa000000", + "x-ms-client-request-id" : "3bf09c4a-4c26-4b87-873b-d0b50219922a", + "x-ms-file-last-write-time" : "2019-08-24T00:27:16.6003652Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletefile544150aa58f0c20d94f/directoryapitestsdeletefile42449d2eb02ba482b42%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "42bce3fe-801a-010a-0612-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:16 GMT", + "x-ms-client-request-id" : "0533a301-b3d2-4a13-917e-319d950260cf" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletefile544150aa58f0c20d94f", "directoryapitestsdeletefile42449d2eb02ba482b42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFileError.json new file mode 100644 index 000000000000..94b72271aebc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteFileError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletefileerror61200c335c20fb6a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D1603E0E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce401-801a-010a-0912-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:16 GMT", + "x-ms-client-request-id" : "5ea06f4b-045e-43fe-ac5a-21de8bbdb630" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletefileerror61200c335c20fb6a/directoryapitestsdeletefileerror115502b44dd320e8?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:16.8205775Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:16 GMT", + "ETag" : "\"0x8D72829D1677FCF\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:16.8205775Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce403-801a-010a-0a12-5a6faa000000", + "x-ms-client-request-id" : "6a1cf568-d007-4045-bd00-d416240d81ae", + "x-ms-file-last-write-time" : "2019-08-24T00:27:16.8205775Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletefileerror61200c335c20fb6a/directoryapitestsdeletefileerror115502b44dd320e8%2ftestfile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "42bce404-801a-010a-0b12-5a6faa000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:42bce404-801a-010a-0b12-5a6faa000000\nTime:2019-08-24T00:27:18.7248816Z", + "Date" : "Sat, 24 Aug 2019 00:27:18 GMT", + "x-ms-client-request-id" : "f43a02e6-348d-425c-a913-eccaf8600e37", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletefileerror61200c335c20fb6a", "directoryapitestsdeletefileerror115502b44dd320e8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectory.json new file mode 100644 index 000000000000..185e22eb0499 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectory.json @@ -0,0 +1,98 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletesubdirectory6902025a22d624c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C3FE36DD\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2983-e01a-00d9-7b12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:53 GMT", + "x-ms-client-request-id" : "b30c630b-caea-4252-a68b-4827936ad9cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletesubdirectory6902025a22d624c/directoryapitestsdeletesubdirectory58048bd54dde42a?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:54.4110444Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:53 GMT", + "ETag" : "\"0x8D72829C40C136C\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:54.4110444Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2986-e01a-00d9-7c12-5a965a000000", + "x-ms-client-request-id" : "13a52616-33d3-438f-b5df-248f5711eab2", + "x-ms-file-last-write-time" : "2019-08-24T00:26:54.4110444Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletesubdirectory6902025a22d624c/directoryapitestsdeletesubdirectory58048bd54dde42a%2ftestSubCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:54.4761060Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:53 GMT", + "ETag" : "\"0x8D72829C41600E4\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:54.4761060Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c2987-e01a-00d9-7d12-5a965a000000", + "x-ms-client-request-id" : "bd597c67-72dd-46ab-836a-616a9cf00a63", + "x-ms-file-last-write-time" : "2019-08-24T00:26:54.4761060Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletesubdirectory6902025a22d624c/directoryapitestsdeletesubdirectory58048bd54dde42a%2ftestSubCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "799c2988-e01a-00d9-7e12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:53 GMT", + "x-ms-client-request-id" : "e9db0e4c-c5b2-431b-853e-7ac2992f6656" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletesubdirectory6902025a22d624c", "directoryapitestsdeletesubdirectory58048bd54dde42a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectoryError.json new file mode 100644 index 000000000000..860117100bc0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsDeleteSubDirectoryError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletesubdirectoryerror500809e0429f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C448E6B0\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c298c-e01a-00d9-0112-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:54 GMT", + "x-ms-client-request-id" : "0e8c9ba0-56ab-4fd2-8cf6-c2f01974d189" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletesubdirectoryerror500809e0429f/directoryapitestsdeletesubdirectoryerror86783303117f?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:54.9675772Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:54 GMT", + "ETag" : "\"0x8D72829C460FEFC\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:54.9675772Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c298e-e01a-00d9-0212-5a965a000000", + "x-ms-client-request-id" : "d6786a17-f01f-479e-aa1f-57f3fd576747", + "x-ms-file-last-write-time" : "2019-08-24T00:26:54.9675772Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsdeletesubdirectoryerror500809e0429f/directoryapitestsdeletesubdirectoryerror86783303117f%2ftestsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "799c298f-e01a-00d9-0312-5a965a000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:799c298f-e01a-00d9-0312-5a965a000000\nTime:2019-08-24T00:26:55.0939427Z", + "Date" : "Sat, 24 Aug 2019 00:26:54 GMT", + "x-ms-client-request-id" : "c8923e80-fa64-4a5a-9c17-2bafd9a004b7", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsdeletesubdirectoryerror500809e0429f", "directoryapitestsdeletesubdirectoryerror86783303117f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsForceCloseHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsForceCloseHandlesError.json new file mode 100644 index 000000000000..cd33ad6f2f47 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsForceCloseHandlesError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsforceclosehandleserror76971dbd71de1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C2DE9D51\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2962-e01a-00d9-6012-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:51 GMT", + "x-ms-client-request-id" : "181f3183-3108-4d19-8743-7308a03b178a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsforceclosehandleserror76971dbd71de1/directoryapitestsforceclosehandleserror82004ee13f8d2?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:52.4831930Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:51 GMT", + "ETag" : "\"0x8D72829C2E5E8BA\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:52.4831930Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2964-e01a-00d9-6112-5a965a000000", + "x-ms-client-request-id" : "35c41438-6036-4227-bb1f-58b7c61f051f", + "x-ms-file-last-write-time" : "2019-08-24T00:26:52.4831930Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsforceclosehandleserror76971dbd71de1/directoryapitestsforceclosehandleserror82004ee13f8d2?comp=forceclosehandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "328", + "StatusCode" : "400", + "x-ms-request-id" : "799c2965-e01a-00d9-6212-5a965a000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:799c2965-e01a-00d9-6212-5a965a000000\nTime:2019-08-24T00:26:52.8808168Zx-ms-handle-idhandleId", + "Date" : "Sat, 24 Aug 2019 00:26:52 GMT", + "x-ms-client-request-id" : "b2a38b61-d62e-4c91-80d0-ba114945130f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsforceclosehandleserror76971dbd71de1", "directoryapitestsforceclosehandleserror82004ee13f8d2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetDirectoryURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetDirectoryURL.json new file mode 100644 index 000000000000..921f74b87074 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetDirectoryURL.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsgetdirectoryurl39726d590a1d2d78?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BF227F6B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28d0-e01a-00d9-6812-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:45 GMT", + "x-ms-client-request-id" : "9f31bc00-ab15-400c-9d75-efe0c1fd9025" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetdirectoryurl39726d590a1d2d78", "directoryapitestsgetdirectoryurl774119ddc9987278" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetFileClient.json new file mode 100644 index 000000000000..6c11be5d4a1c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetFileClient.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsgetfileclient775525b3db93ec2db?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BF5422FD\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28d8-e01a-00d9-6e12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:45 GMT", + "x-ms-client-request-id" : "d783d9e8-8a0a-4905-8a4f-afe832ec7052" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetfileclient775525b3db93ec2db", "directoryapitestsgetfileclient35750a0866f854102" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetProperties.json new file mode 100644 index 000000000000..c9b7ce5d9b8f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetProperties.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsgetproperties6599443391ec7c151?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C03BAE8C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28fc-e01a-00d9-0a12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "x-ms-client-request-id" : "5a490a3c-d517-47ed-98e0-f64cabd87721" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsgetproperties6599443391ec7c151/directoryapitestsgetproperties26965268a0615e9b9?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:48.0529322Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "ETag" : "\"0x8D72829C041E7AA\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:48.0529322Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c28fe-e01a-00d9-0b12-5a965a000000", + "x-ms-client-request-id" : "da79d56e-a1d4-4386-b55d-5e749cdcabc8", + "x-ms-file-last-write-time" : "2019-08-24T00:26:48.0529322Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsgetproperties6599443391ec7c151/directoryapitestsgetproperties26965268a0615e9b9?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:48.0529322Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72829C041E7AA\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:48.0529322Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c28ff-e01a-00d9-0c12-5a965a000000", + "x-ms-client-request-id" : "ef1813df-1368-4370-be6a-9e705bb0d5e1", + "x-ms-file-last-write-time" : "2019-08-24T00:26:48.0529322Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetproperties6599443391ec7c151", "directoryapitestsgetproperties26965268a0615e9b9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..eec3194b2084 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetPropertiesError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsgetpropertieserror28259ed8d11e135?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C05CD344\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2902-e01a-00d9-0f12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "x-ms-client-request-id" : "dc989fc1-b574-4d18-8c27-9118d35da2d2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsgetpropertieserror28259ed8d11e135/directoryapitestsgetpropertieserror960150b5bc3e4ee?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "799c2904-e01a-00d9-1012-5a965a000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:799c2904-e01a-00d9-1012-5a965a000000\nTime:2019-08-24T00:26:48.2723983Z", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "x-ms-client-request-id" : "34ad74c4-67c7-4de6-82ba-42bc48d8d91c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetpropertieserror28259ed8d11e135", "directoryapitestsgetpropertieserror960150b5bc3e4ee" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..f983af636bd0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSnapshotId.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsgetsnapshotid45218c26d054d85ea?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D29EFF5B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce40c-801a-010a-0f12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:18 GMT", + "x-ms-client-request-id" : "46b7c80a-d3aa-4d6f-a799-f4e340bd54c9" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetsnapshotid45218c26d054d85ea", "directoryapitestsgetsnapshotid533441147312e2709" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSubDirectoryClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSubDirectoryClient.json new file mode 100644 index 000000000000..fdcc2dd43c36 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsGetSubDirectoryClient.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestsgetsubdirectoryclient16221c4a931fa?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BF3A5312\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28d4-e01a-00d9-6b12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:45 GMT", + "x-ms-client-request-id" : "f7455918-87d3-4239-afe9-7ef4db9a8bab" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestsgetsubdirectoryclient16221c4a931fa", "directoryapitestsgetsubdirectoryclient01431eec57b91" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories.json new file mode 100644 index 000000000000..dcd5feb9580c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectories.json @@ -0,0 +1,268 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories27931e182285?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C0E0544C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2916-e01a-00d9-1f12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "x-ms-client-request-id" : "17261ea5-f39f-441a-91a2-dcac0aa86055" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories27931e182285/directoryapitestslistfilesanddirectories54080eb29297?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.1429823Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "ETag" : "\"0x8D72829C0E83BBF\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:49.1429823Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2918-e01a-00d9-2012-5a965a000000", + "x-ms-client-request-id" : "714b3f27-7a51-4a09-b7d9-2d4f44777fce", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.1429823Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories27931e182285/directoryapitestslistfilesanddirectories54080eb29297%2fdirectoryapitestslistfilesanddirectories91188c8d3e680?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.2020399Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "ETag" : "\"0x8D72829C0F13EAF\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:49.2020399Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c2919-e01a-00d9-2112-5a965a000000", + "x-ms-client-request-id" : "a79b4059-2b1b-4385-9f69-04316d997349", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.2020399Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories27931e182285/directoryapitestslistfilesanddirectories54080eb29297%2fdirectoryapitestslistfilesanddirectories91188c8d3e680%2fdirectoryapitestslistfilesanddirectories91188c8d3e683", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.2530889Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "ETag" : "\"0x8D72829C0F908C9\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:49.2530889Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "799c291a-e01a-00d9-2212-5a965a000000", + "x-ms-client-request-id" : "f398c9ee-8ae8-4262-a5da-a80c02af56e6", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.2530889Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories27931e182285/directoryapitestslistfilesanddirectories54080eb29297%2fdirectoryapitestslistfilesanddirectories91188c8d3e680%2fdirectoryapitestslistfilesanddirectories91188c8d3e684", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.2991338Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "ETag" : "\"0x8D72829C1000F6A\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:49.2991338Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "799c291b-e01a-00d9-2312-5a965a000000", + "x-ms-client-request-id" : "32eea9a1-cb4d-4ba2-8edf-aeb8e982f29d", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.2991338Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories27931e182285/directoryapitestslistfilesanddirectories54080eb29297%2fdirectoryapitestslistfilesanddirectories91188c8d3e681?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.3431753Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "ETag" : "\"0x8D72829C106C7C9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:49.3431753Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c291d-e01a-00d9-2412-5a965a000000", + "x-ms-client-request-id" : "8357a4c1-eaac-46b2-a0c9-1f0120836cd8", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.3431753Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories27931e182285/directoryapitestslistfilesanddirectories54080eb29297%2fdirectoryapitestslistfilesanddirectories91188c8d3e681%2fdirectoryapitestslistfilesanddirectories91188c8d3e685", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.3832139Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "ETag" : "\"0x8D72829C10CE3CB\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:49.3832139Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "799c291e-e01a-00d9-2512-5a965a000000", + "x-ms-client-request-id" : "12d8c324-40d3-4ac1-a317-3e34d9bad559", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.3832139Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories27931e182285/directoryapitestslistfilesanddirectories54080eb29297%2fdirectoryapitestslistfilesanddirectories91188c8d3e681%2fdirectoryapitestslistfilesanddirectories91188c8d3e686", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.4262561Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "ETag" : "\"0x8D72829C1137521\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:49.4262561Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "799c291f-e01a-00d9-2612-5a965a000000", + "x-ms-client-request-id" : "9836f314-2f83-46f0-ae25-8bdfc2ffebad", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.4262561Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories27931e182285/directoryapitestslistfilesanddirectories54080eb29297%2fdirectoryapitestslistfilesanddirectories91188c8d3e682", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.4642927Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "ETag" : "\"0x8D72829C11942EF\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:49.4642927Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c2920-e01a-00d9-2712-5a965a000000", + "x-ms-client-request-id" : "2053be0a-ff5b-4bc8-b2a9-ac3c07cc8f5e", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.4642927Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectories27931e182285/directoryapitestslistfilesanddirectories54080eb29297?restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "799c2921-e01a-00d9-2812-5a965a000000", + "Body" : "directoryapitestslistfilesanddirectories91188c8d3e680directoryapitestslistfilesanddirectories91188c8d3e681directoryapitestslistfilesanddirectories91188c8d3e6821024", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "x-ms-client-request-id" : "50aafdf9-f60c-4dec-b4db-516c7ac2712e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslistfilesanddirectories27931e182285", "directoryapitestslistfilesanddirectories54080eb29297", "directoryapitestslistfilesanddirectories91188c8d3e68" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs0.json new file mode 100644 index 000000000000..4a324ebd0d8f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs0.json @@ -0,0 +1,268 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs099616437c0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C13826D4\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2924-e01a-00d9-2b12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "x-ms-client-request-id" : "1baaea78-7c12-4436-89d2-6f5e608f28d3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs099616437c0/directoryapitestslistfilesanddirectoriesargs001437e4edb?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.7155342Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C13F990E\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:49.7155342Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2926-e01a-00d9-2c12-5a965a000000", + "x-ms-client-request-id" : "3d630b63-9951-48b5-b34c-42e816fd31ba", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.7155342Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs099616437c0/directoryapitestslistfilesanddirectoriesargs001437e4edb%2fdirectoryapitestslistfilesanddirectoriesargs0542178df370?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.7615791Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C1469FAF\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:49.7615791Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c2927-e01a-00d9-2d12-5a965a000000", + "x-ms-client-request-id" : "927b50b5-3f85-49f9-8498-6be923553279", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.7615791Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs099616437c0/directoryapitestslistfilesanddirectoriesargs001437e4edb%2fdirectoryapitestslistfilesanddirectoriesargs0542178df370%2fdirectoryapitestslistfilesanddirectoriesargs0542178df373", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.8046199Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C14D30F7\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:49.8046199Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "799c2928-e01a-00d9-2e12-5a965a000000", + "x-ms-client-request-id" : "935227eb-adb7-4b87-ad5c-722352d76554", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.8046199Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs099616437c0/directoryapitestslistfilesanddirectoriesargs001437e4edb%2fdirectoryapitestslistfilesanddirectoriesargs0542178df370%2fdirectoryapitestslistfilesanddirectoriesargs0542178df374", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.8456606Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C153741E\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:49.8456606Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "799c2929-e01a-00d9-2f12-5a965a000000", + "x-ms-client-request-id" : "7dc6588c-cb11-4389-a6b3-f080ea73dd3a", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.8456606Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs099616437c0/directoryapitestslistfilesanddirectoriesargs001437e4edb%2fdirectoryapitestslistfilesanddirectoriesargs0542178df371?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:49.9727829Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C166D9D5\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:49.9727829Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c292a-e01a-00d9-3012-5a965a000000", + "x-ms-client-request-id" : "f3a2ec1e-b7e2-4157-b582-adc7305301ff", + "x-ms-file-last-write-time" : "2019-08-24T00:26:49.9727829Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs099616437c0/directoryapitestslistfilesanddirectoriesargs001437e4edb%2fdirectoryapitestslistfilesanddirectoriesargs0542178df371%2fdirectoryapitestslistfilesanddirectoriesargs0542178df375", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.0118191Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C16CCEAF\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:50.0118191Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "799c292b-e01a-00d9-3112-5a965a000000", + "x-ms-client-request-id" : "19979191-d6ae-4894-b872-62c23a5e3107", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.0118191Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs099616437c0/directoryapitestslistfilesanddirectoriesargs001437e4edb%2fdirectoryapitestslistfilesanddirectoriesargs0542178df371%2fdirectoryapitestslistfilesanddirectoriesargs0542178df376", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.0528581Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C17311C5\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:50.0528581Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "799c292c-e01a-00d9-3212-5a965a000000", + "x-ms-client-request-id" : "2e29b00c-a7e6-4142-a155-8d64516d1942", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.0528581Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs099616437c0/directoryapitestslistfilesanddirectoriesargs001437e4edb%2fdirectoryapitestslistfilesanddirectoriesargs0542178df372", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.0969008Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C179CA30\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:50.0969008Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c292d-e01a-00d9-3312-5a965a000000", + "x-ms-client-request-id" : "71a1bb5d-1e4a-49f2-9662-b92ec4010a2d", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.0969008Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs099616437c0/directoryapitestslistfilesanddirectoriesargs001437e4edb?restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "799c292e-e01a-00d9-3412-5a965a000000", + "Body" : "directoryapitestslistfilesanddirectoriesargs0542178df370directoryapitestslistfilesanddirectoriesargs0542178df371directoryapitestslistfilesanddirectoriesargs0542178df3721024", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "x-ms-client-request-id" : "29e7512d-1887-4016-9b5e-b75a717fc109", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslistfilesanddirectoriesargs099616437c0", "directoryapitestslistfilesanddirectoriesargs001437e4edb", "directoryapitestslistfilesanddirectoriesargs0542178df37" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs1.json new file mode 100644 index 000000000000..4a4be96c4ee2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs1.json @@ -0,0 +1,308 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C19418FE\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2931-e01a-00d9-3712-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "x-ms-client-request-id" : "156f3217-e8c6-492d-8d14-fb20e894a005" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.3091035Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C19A2B5B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:50.3091035Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2933-e01a-00d9-3812-5a965a000000", + "x-ms-client-request-id" : "917d89aa-bf2c-49dd-b4fd-c73f617b1887", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.3091035Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a0?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.3461392Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C19FD210\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:50.3461392Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c2934-e01a-00d9-3912-5a965a000000", + "x-ms-client-request-id" : "5914cf84-c161-49cf-b2af-82a137a06998", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.3461392Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a0%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a3", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.3901823Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C1A68A7F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:50.3901823Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "799c2935-e01a-00d9-3a12-5a965a000000", + "x-ms-client-request-id" : "8079103f-bd93-4b0d-aa52-e1406f9ae087", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.3901823Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a0%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.4292194Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C1AC7F62\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:50.4292194Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "799c2936-e01a-00d9-3b12-5a965a000000", + "x-ms-client-request-id" : "97bc9b4f-4ba8-4369-9c95-3817ccb4cbf6", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.4292194Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a1?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.4682570Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C1B2744A\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:50.4682570Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c2937-e01a-00d9-3c12-5a965a000000", + "x-ms-client-request-id" : "2f7c5681-f859-4057-9fee-5fd0cd06d2ea", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.4682570Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a1%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.5092966Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:49 GMT", + "ETag" : "\"0x8D72829C1B8B766\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:50.5092966Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "799c2938-e01a-00d9-3d12-5a965a000000", + "x-ms-client-request-id" : "b63d2708-bee4-4ee8-914c-e7865a82cfe3", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.5092966Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a1%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.5593435Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C1C05A5B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:50.5593435Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "799c2939-e01a-00d9-3e12-5a965a000000", + "x-ms-client-request-id" : "b4766a90-a8e7-446f-acf7-388b734ab6fc", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.5593435Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4%2fdirectoryapitestslistfilesanddirectoriesargs173166a872a2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.6003835Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C1C69D7B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:50.6003835Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c293a-e01a-00d9-3f12-5a965a000000", + "x-ms-client-request-id" : "0c1f9659-9636-4844-bb71-879e78913ad7", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.6003835Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4?prefix=directoryapitestslistfilesanddirectoriesargs&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "799c293b-e01a-00d9-4012-5a965a000000", + "Body" : "directoryapitestslistfilesanddirectoriesargs1directoryapitestslistfilesanddirectoriesargs173166a872a01!76!ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzMxNjZhODcyYTE-", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "x-ms-client-request-id" : "f6821ab3-b0c3-49f2-918c-760d3075978b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4?prefix=directoryapitestslistfilesanddirectoriesargs&marker=1%2176%21ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzMxNjZhODcyYTE-&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "799c293c-e01a-00d9-4112-5a965a000000", + "Body" : "directoryapitestslistfilesanddirectoriesargs1!76!ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzMxNjZhODcyYTE-1directoryapitestslistfilesanddirectoriesargs173166a872a11!76!ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzMxNjZhODcyYTI-", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "x-ms-client-request-id" : "8b950965-b005-45d6-8d4a-45d039ba1518", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs152547003f8/directoryapitestslistfilesanddirectoriesargs154778f7fc4?prefix=directoryapitestslistfilesanddirectoriesargs&marker=1%2176%21ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzMxNjZhODcyYTI-&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "799c293d-e01a-00d9-4212-5a965a000000", + "Body" : "directoryapitestslistfilesanddirectoriesargs1!76!ZGlyZWN0b3J5YXBpdGVzdHNsaXN0ZmlsZXNhbmRkaXJlY3Rvcmllc2FyZ3MxNzMxNjZhODcyYTI-1directoryapitestslistfilesanddirectoriesargs173166a872a21024", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "x-ms-client-request-id" : "91c11bf1-c341-4679-8f29-b878757f2924", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslistfilesanddirectoriesargs152547003f8", "directoryapitestslistfilesanddirectoriesargs154778f7fc4", "directoryapitestslistfilesanddirectoriesargs173166a872a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs2.json new file mode 100644 index 000000000000..46a92060b568 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListFilesAndDirectoriesArgs2.json @@ -0,0 +1,268 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs240192fe46a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C1EE0EEC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2940-e01a-00d9-4512-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "x-ms-client-request-id" : "b671327c-91a5-4f9a-b5bb-75193c277a4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs240192fe46a/directoryapitestslistfilesanddirectoriesargs25761473925?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.9046759Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C1F50BE7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:50.9046759Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2942-e01a-00d9-4612-5a965a000000", + "x-ms-client-request-id" : "700b23e1-6fac-4639-8fcb-dbff4a099180", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.9046759Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs240192fe46a/directoryapitestslistfilesanddirectoriesargs25761473925%2fdirectoryapitestslistfilesanddirectoriesargs21448491db30?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.9467150Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C1FB760E\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:50.9467150Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c2943-e01a-00d9-4712-5a965a000000", + "x-ms-client-request-id" : "21886822-db6c-4a93-a844-aaaa3261b039", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.9467150Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs240192fe46a/directoryapitestslistfilesanddirectoriesargs25761473925%2fdirectoryapitestslistfilesanddirectoriesargs21448491db30%2fdirectoryapitestslistfilesanddirectoriesargs21448491db33", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:50.9947608Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C202CAD8\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:50.9947608Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "799c2944-e01a-00d9-4812-5a965a000000", + "x-ms-client-request-id" : "f4ca9888-519a-4932-965c-6533982dfa52", + "x-ms-file-last-write-time" : "2019-08-24T00:26:50.9947608Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs240192fe46a/directoryapitestslistfilesanddirectoriesargs25761473925%2fdirectoryapitestslistfilesanddirectoriesargs21448491db30%2fdirectoryapitestslistfilesanddirectoriesargs21448491db34", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:51.0378021Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C2095C25\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:51.0378021Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "799c2945-e01a-00d9-4912-5a965a000000", + "x-ms-client-request-id" : "d2d04fdb-9d69-4fa0-a7dc-a32e3954d31d", + "x-ms-file-last-write-time" : "2019-08-24T00:26:51.0378021Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs240192fe46a/directoryapitestslistfilesanddirectoriesargs25761473925%2fdirectoryapitestslistfilesanddirectoriesargs21448491db31?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:51.0808443Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C20FED7B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:51.0808443Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c2946-e01a-00d9-4a12-5a965a000000", + "x-ms-client-request-id" : "144d4749-b1b5-4bdb-a896-e27559e717a3", + "x-ms-file-last-write-time" : "2019-08-24T00:26:51.0808443Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs240192fe46a/directoryapitestslistfilesanddirectoriesargs25761473925%2fdirectoryapitestslistfilesanddirectoriesargs21448491db31%2fdirectoryapitestslistfilesanddirectoriesargs21448491db35", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:51.1208824Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C2160978\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:51.1208824Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "799c2947-e01a-00d9-4b12-5a965a000000", + "x-ms-client-request-id" : "e4b7871e-9e79-488b-a250-1e5e93097f45", + "x-ms-file-last-write-time" : "2019-08-24T00:26:51.1208824Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs240192fe46a/directoryapitestslistfilesanddirectoriesargs25761473925%2fdirectoryapitestslistfilesanddirectoriesargs21448491db31%2fdirectoryapitestslistfilesanddirectoriesargs21448491db36", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:51.1619217Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C21C4C91\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:51.1619217Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "799c2948-e01a-00d9-4c12-5a965a000000", + "x-ms-client-request-id" : "a26279e1-7d0d-43d7-9540-b54e4a35b67c", + "x-ms-file-last-write-time" : "2019-08-24T00:26:51.1619217Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs240192fe46a/directoryapitestslistfilesanddirectoriesargs25761473925%2fdirectoryapitestslistfilesanddirectoriesargs21448491db32", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:51.2039623Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C222B6C7\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:51.2039623Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "799c2949-e01a-00d9-4d12-5a965a000000", + "x-ms-client-request-id" : "48cc56f4-ec5e-4c57-8d95-013358ad7f1b", + "x-ms-file-last-write-time" : "2019-08-24T00:26:51.2039623Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslistfilesanddirectoriesargs240192fe46a/directoryapitestslistfilesanddirectoriesargs25761473925?prefix=noOp&maxresults=3&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "799c294a-e01a-00d9-4e12-5a965a000000", + "Body" : "noOp3", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "x-ms-client-request-id" : "ca012cc2-aaa3-4fc7-a69d-8a1933a34aa1", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslistfilesanddirectoriesargs240192fe46a", "directoryapitestslistfilesanddirectoriesargs25761473925", "directoryapitestslistfilesanddirectoriesargs21448491db3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles0.json new file mode 100644 index 000000000000..b1a4643931fa --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles0.json @@ -0,0 +1,72 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslisthandles0319087d0c64aae58f4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C23FC558\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c294d-e01a-00d9-5112-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "x-ms-client-request-id" : "92600f46-746d-40d3-b558-5405b18cf456" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslisthandles0319087d0c64aae58f4/directoryapitestslisthandles018077943e042afe1f4?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:51.4542040Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:50 GMT", + "ETag" : "\"0x8D72829C248E5D8\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:51.4542040Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c294f-e01a-00d9-5212-5a965a000000", + "x-ms-client-request-id" : "4a5a8cea-ae81-4f61-9f9e-9f8759d11c0b", + "x-ms-file-last-write-time" : "2019-08-24T00:26:51.4542040Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslisthandles0319087d0c64aae58f4/directoryapitestslisthandles018077943e042afe1f4?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "799c2950-e01a-00d9-5312-5a965a000000", + "Body" : "2", + "Date" : "Sat, 24 Aug 2019 00:26:51 GMT", + "x-ms-client-request-id" : "166d5f72-81c9-4d74-b505-27aa7fafa63b", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslisthandles0319087d0c64aae58f4", "directoryapitestslisthandles018077943e042afe1f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles1.json new file mode 100644 index 000000000000..a426ba2158fb --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandles1.json @@ -0,0 +1,72 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslisthandles1566976a8c91ed16f04?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C279CF56\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2956-e01a-00d9-5712-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:51 GMT", + "x-ms-client-request-id" : "cfbaf7c6-86e2-4ee6-800c-5a2c92252f3f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslisthandles1566976a8c91ed16f04/directoryapitestslisthandles125440d7e515af74664?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:51.8195559Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:51 GMT", + "ETag" : "\"0x8D72829C280A567\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:51.8195559Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2958-e01a-00d9-5812-5a965a000000", + "x-ms-client-request-id" : "786d2864-e4ac-4b3d-b60a-6ffba88a1118", + "x-ms-file-last-write-time" : "2019-08-24T00:26:51.8195559Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslisthandles1566976a8c91ed16f04/directoryapitestslisthandles125440d7e515af74664?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "799c295a-e01a-00d9-5912-5a965a000000", + "Body" : "", + "Date" : "Sat, 24 Aug 2019 00:26:51 GMT", + "x-ms-client-request-id" : "a017bae0-7839-4ca5-bd65-d2acf0e039be", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslisthandles1566976a8c91ed16f04", "directoryapitestslisthandles125440d7e515af74664" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandlesError.json new file mode 100644 index 000000000000..f6627476c859 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsListHandlesError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslisthandleserror52052be4912134b3?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C29DDAED\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c295d-e01a-00d9-5c12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:51 GMT", + "x-ms-client-request-id" : "be2393d6-3db6-46cd-9667-fa2557366e94" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestslisthandleserror52052be4912134b3/directoryapitestslisthandleserror5386395775529ac6?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "799c295f-e01a-00d9-5d12-5a965a000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:799c295f-e01a-00d9-5d12-5a965a000000\nTime:2019-08-24T00:26:52.1180830Z", + "Date" : "Sat, 24 Aug 2019 00:26:51 GMT", + "x-ms-client-request-id" : "6813f4bb-6eb7-4db6-8d90-ef0f1141765e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestslisthandleserror52052be4912134b3", "directoryapitestslisthandleserror5386395775529ac6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadata.json new file mode 100644 index 000000000000..08a8ce663315 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadata.json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestssetmetadata0733663a1fd8f0bad4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C0771872\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2907-e01a-00d9-1312-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "x-ms-client-request-id" : "96f614af-bbc7-44c9-83cc-ad8de1881a72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestssetmetadata0733663a1fd8f0bad4/directoryapitestssetmetadata7536023af0c91afb84?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:48.4443097Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "ETag" : "\"0x8D72829C07D9FD9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:48.4443097Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2909-e01a-00d9-1412-5a965a000000", + "x-ms-client-request-id" : "0b06cd6a-0ac0-49ae-838c-80519c7d9ddd", + "x-ms-file-last-write-time" : "2019-08-24T00:26:48.4443097Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestssetmetadata0733663a1fd8f0bad4/directoryapitestssetmetadata7536023af0c91afb84?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:48.4443097Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72829C07D9FD9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-meta-testmetadata" : "value", + "x-ms-file-change-time" : "2019-08-24T00:26:48.4443097Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c290b-e01a-00d9-1512-5a965a000000", + "x-ms-client-request-id" : "2a50cbc5-553a-4c6b-9024-fd268cf2febc", + "x-ms-file-last-write-time" : "2019-08-24T00:26:48.4443097Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestssetmetadata0733663a1fd8f0bad4/directoryapitestssetmetadata7536023af0c91afb84?restype=directory&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C089B0BD\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "799c290c-e01a-00d9-1612-5a965a000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:47 GMT", + "x-ms-client-request-id" : "a862445a-b591-493a-88b9-804004a3175b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestssetmetadata0733663a1fd8f0bad4/directoryapitestssetmetadata7536023af0c91afb84?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-meta-update" : "value", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:48.4443097Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72829C089B0BD\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:48.5233853Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c290d-e01a-00d9-1712-5a965a000000", + "x-ms-client-request-id" : "4cec9b9d-6c79-41c9-9616-58eb90afff83", + "x-ms-file-last-write-time" : "2019-08-24T00:26:48.4443097Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestssetmetadata0733663a1fd8f0bad4", "directoryapitestssetmetadata7536023af0c91afb84" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadataError.json new file mode 100644 index 000000000000..da53f02eae7b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAPITestsSetMetadataError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestssetmetadataerror60714bca69cc0085?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829C0A7832A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c2910-e01a-00d9-1a12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "x-ms-client-request-id" : "048a026c-4d95-4d3c-a110-e0d552485a36" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestssetmetadataerror60714bca69cc0085/directoryapitestssetmetadataerror52611d2c090fea82?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:48.8446957Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "ETag" : "\"0x8D72829C0BAB7ED\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:48.8446957Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c2912-e01a-00d9-1b12-5a965a000000", + "x-ms-client-request-id" : "6d3eef51-8bb5-48b4-8e92-ee6220beb172", + "x-ms-file-last-write-time" : "2019-08-24T00:26:48.8446957Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryapitestssetmetadataerror60714bca69cc0085/directoryapitestssetmetadataerror52611d2c090fea82?restype=directory&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "799c2913-e01a-00d9-1c12-5a965a000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:799c2913-e01a-00d9-1c12-5a965a000000\nTime:2019-08-24T00:26:48.9470439Zvalue", + "Date" : "Sat, 24 Aug 2019 00:26:48 GMT", + "x-ms-client-request-id" : "cd3926a5-d1ba-4be5-bf6e-670ee46458a8", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryapitestssetmetadataerror60714bca69cc0085", "directoryapitestssetmetadataerror52611d2c090fea82" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectory.json new file mode 100644 index 000000000000..6372072023f8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectory.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatedirectory96755cfc8dd331?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E6E11A53\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf622-c01a-0046-3e12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:52 GMT", + "x-ms-client-request-id" : "c7ad2572-32ca-4bf9-8f59-55be373e478e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatedirectory96755cfc8dd331/directoryasyncapitestscreatedirectory63850535a28f37?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:52.9843288Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:52 GMT", + "ETag" : "\"0x8D72829E6F5A658\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:52.9843288Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf624-c01a-0046-3f12-5aeee0000000", + "x-ms-client-request-id" : "98986f8a-5d97-46ef-ad7b-b4d46dae1426", + "x-ms-file-last-write-time" : "2019-08-24T00:27:52.9843288Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirectory96755cfc8dd331", "directoryasyncapitestscreatedirectory63850535a28f37" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryError.json new file mode 100644 index 000000000000..f2f8fd03e49d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatedirectoryerror53667e9c019?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E70BB72A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf627-c01a-0046-4212-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:52 GMT", + "x-ms-client-request-id" : "4a262b52-c8aa-4f4b-ae3f-384503913b2d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatedirectoryerror3538544ce1b/directoryasyncapitestscreatedirectoryerror33265b6f884?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b02cf629-c01a-0046-4312-5aeee0000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:b02cf629-c01a-0046-4312-5aeee0000000\nTime:2019-08-24T00:27:53.1819889Z", + "Date" : "Sat, 24 Aug 2019 00:27:53 GMT", + "x-ms-client-request-id" : "ca4e5365-f66d-4071-a04f-2f1167179f21", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirectoryerror53667e9c019", "directoryasyncapitestscreatedirectoryerror33265b6f884", "directoryasyncapitestscreatedirectoryerror3538544ce1b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryErrorWithMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryErrorWithMetadata.json new file mode 100644 index 000000000000..5596dbd62738 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryErrorWithMetadata.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatedirectoryerrorwithmetadata29994?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E74AA443\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf632-c01a-0046-4a12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:53 GMT", + "x-ms-client-request-id" : "71781ecd-bd05-4a48-8149-2f7c2b204ee5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatedirectoryerrorwithmetadata29994/directoryasyncapitestscreatedirectoryerrorwithmetadata10091?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "974", + "StatusCode" : "403", + "x-ms-request-id" : "b02cf634-c01a-0046-4b12-5aeee0000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:b02cf634-c01a-0046-4b12-5aeee0000000\nTime:2019-08-24T00:27:53.6544386ZThe MAC signature found in the HTTP request 'bklx4mNSGijo0xvNKMGfqD/e5YbGzuaswPwFRUqfSiA=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nSat, 24 Aug 2019 00:27:53 GMT\n\n\n\n\n\nx-ms-client-request-id:0d6cebec-55c9-4a45-b752-844f508e0d6c\nx-ms-file-attributes:None\nx-ms-file-creation-time:now\nx-ms-file-last-write-time:now\nx-ms-file-permission:inherit\nx-ms-meta-testmeta:value\nx-ms-version:2019-02-02\n/azstoragesdkaccount/directoryasyncapitestscreatedirectoryerrorwithmetadata29994/directoryasyncapitestscreatedirectoryerrorwithmetadata10091\nrestype:directory'.", + "Date" : "Sat, 24 Aug 2019 00:27:53 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirectoryerrorwithmetadata29994", "directoryasyncapitestscreatedirectoryerrorwithmetadata10091" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithMetadata.json new file mode 100644 index 000000000000..3e7dfd516080 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateDirectoryWithMetadata.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatedirectorywithmetadata425753ed?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E72A9151\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf62d-c01a-0046-4612-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:53 GMT", + "x-ms-client-request-id" : "9dcbb523-258c-49ba-86cf-9ce534e7b1f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatedirectorywithmetadata425753ed/directoryasyncapitestscreatedirectorywithmetadata02735955?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:53.3837127Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:53 GMT", + "ETag" : "\"0x8D72829E7329747\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:53.3837127Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf62f-c01a-0046-4712-5aeee0000000", + "x-ms-client-request-id" : "0a3dc68b-37da-4fc8-9cce-16e86015a673", + "x-ms-file-last-write-time" : "2019-08-24T00:27:53.3837127Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatedirectorywithmetadata425753ed", "directoryasyncapitestscreatedirectorywithmetadata02735955" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFile.json new file mode 100644 index 000000000000..41cab61beceb --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFile.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefile7111065632055937?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829ED2BD45A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf6ed-c01a-0046-5c12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "x-ms-client-request-id" : "6d58cdb1-3d5e-480b-83fb-7d9b05d75a6c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefile7111065632055937/directoryasyncapitestscreatefile916723672dab3460?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:03.4513845Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "ETag" : "\"0x8D72829ED32CBB5\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:03.4513845Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6ef-c01a-0046-5d12-5aeee0000000", + "x-ms-client-request-id" : "a8a85ef5-6c76-40d0-b2fa-6e69939b4612", + "x-ms-file-last-write-time" : "2019-08-24T00:28:03.4513845Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefile7111065632055937/directoryasyncapitestscreatefile916723672dab3460%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:03.5044358Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "ETag" : "\"0x8D72829ED3AE406\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:28:03.5044358Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6f0-c01a-0046-5e12-5aeee0000000", + "x-ms-client-request-id" : "25156216-3c8e-47fe-9c81-609f98af69c2", + "x-ms-file-last-write-time" : "2019-08-24T00:28:03.5044358Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefile7111065632055937", "directoryasyncapitestscreatefile916723672dab3460" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs0.json new file mode 100644 index 000000000000..6bbc6b1a5fbc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs0.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs073505430c1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829ED4E7FFD\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf6f5-c01a-0046-6312-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "x-ms-client-request-id" : "f02df0b5-fdbb-48b3-91dd-30413fad2d65" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs073505430c1/directoryasyncapitestscreatefileinvalidargs063916349d4?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:03.6745999Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "ETag" : "\"0x8D72829ED54DB0F\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:03.6745999Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6f8-c01a-0046-6512-5aeee0000000", + "x-ms-client-request-id" : "7ce68087-b2fe-4e46-a120-1763c54a349a", + "x-ms-file-last-write-time" : "2019-08-24T00:28:03.6745999Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs073505430c1/directoryasyncapitestscreatefileinvalidargs063916349d4%2ftest%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefileinvalidargs073505430c1", "directoryasyncapitestscreatefileinvalidargs063916349d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs1.json new file mode 100644 index 000000000000..0e9df820263c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileInvalidArgs1.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs1951113537b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829ED9D3FC2\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8b2063ee-801a-0101-6b12-5a77de000000", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "x-ms-client-request-id" : "32b14534-1e26-4ad5-bf58-e1d80dd26fce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs1951113537b/directoryasyncapitestscreatefileinvalidargs105292886a6?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:04.1951001Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "ETag" : "\"0x8D72829EDA44719\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:04.1951001Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "8b2063f0-801a-0101-6c12-5a77de000000", + "x-ms-client-request-id" : "f9203106-728b-4f71-9a36-52d6be49457e", + "x-ms-file-last-write-time" : "2019-08-24T00:28:04.1951001Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefileinvalidargs1951113537b/directoryasyncapitestscreatefileinvalidargs105292886a6%2ffileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "8b2063f1-801a-0101-6d12-5a77de000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:8b2063f1-801a-0101-6d12-5a77de000000\nTime:2019-08-24T00:28:04.2471312Z", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "x-ms-client-request-id" : "24fcd562-ca02-49f5-b697-5c56fc8760ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefileinvalidargs1951113537b", "directoryasyncapitestscreatefileinvalidargs105292886a6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverload.json new file mode 100644 index 000000000000..f0e4f4358daf --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverload.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverload25665a98e88?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EDC060CC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8b2063f5-801a-0101-7012-5a77de000000", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "x-ms-client-request-id" : "800e6dcf-73b1-4011-b1fe-8db95ece58fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverload25665a98e88/directoryasyncapitestscreatefilemaxoverload80993946159?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:04.4293244Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "ETag" : "\"0x8D72829EDC8047C\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:04.4293244Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "8b2063f7-801a-0101-7112-5a77de000000", + "x-ms-client-request-id" : "74659bb0-dc62-40d2-b505-8c8de8572ff1", + "x-ms-file-last-write-time" : "2019-08-24T00:28:04.4293244Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverload25665a98e88/directoryasyncapitestscreatefilemaxoverload80993946159%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:04.4813742Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "ETag" : "\"0x8D72829EDCFF5AE\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:28:04.4813742Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "8b2063f8-801a-0101-7212-5a77de000000", + "x-ms-client-request-id" : "59f667a3-6cc8-493e-8019-31d1448ddfaa", + "x-ms-file-last-write-time" : "2019-08-24T00:28:04.4813742Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefilemaxoverload25665a98e88", "directoryasyncapitestscreatefilemaxoverload80993946159" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json new file mode 100644 index 000000000000..510623d07076 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs049687?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EDE5F379\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8b2063fc-801a-0101-7512-5a77de000000", + "Date" : "Sat, 24 Aug 2019 00:28:04 GMT", + "x-ms-client-request-id" : "827c86aa-0fa5-43e3-aeb8-c1a386a68959" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs049687/directoryasyncapitestscreatefilemaxoverloadinvalidargs011179?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:04.6665518Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:04 GMT", + "ETag" : "\"0x8D72829EDEC372E\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:04.6665518Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "8b2063fe-801a-0101-7612-5a77de000000", + "x-ms-client-request-id" : "55a70f9b-2cd4-43b9-bb02-d09e16d666aa", + "x-ms-file-last-write-time" : "2019-08-24T00:28:04.6665518Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs049687/directoryasyncapitestscreatefilemaxoverloadinvalidargs011179%2ftest%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:28:04 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefilemaxoverloadinvalidargs049687", "directoryasyncapitestscreatefilemaxoverloadinvalidargs011179" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json new file mode 100644 index 000000000000..f86548a96c7a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs174647?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EEA196D4\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e711fb79-401a-0057-1112-5ad9fb000000", + "Date" : "Sat, 24 Aug 2019 00:28:04 GMT", + "x-ms-client-request-id" : "8bb8611a-8e2a-440a-b584-5d70a6c383b9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs174647/directoryasyncapitestscreatefilemaxoverloadinvalidargs194884?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:05.8987378Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:05 GMT", + "ETag" : "\"0x8D72829EEA83B72\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:05.8987378Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "e711fb7b-401a-0057-1212-5ad9fb000000", + "x-ms-client-request-id" : "c0b654ae-e217-4194-8f81-a79c2ecf194e", + "x-ms-file-last-write-time" : "2019-08-24T00:28:05.8987378Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs174647/directoryasyncapitestscreatefilemaxoverloadinvalidargs194884%2ftest%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:28:05 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefilemaxoverloadinvalidargs174647", "directoryasyncapitestscreatefilemaxoverloadinvalidargs194884" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json new file mode 100644 index 000000000000..cc25077f6367 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs250799?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EEE4B226\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "25b851a8-501a-00e2-7912-5ad404000000", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "x-ms-client-request-id" : "efcfebbc-19b7-48d6-87f8-3e55ee5fbfe8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs250799/directoryasyncapitestscreatefilemaxoverloadinvalidargs255691?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:06.3351557Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "ETag" : "\"0x8D72829EEEAD305\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:06.3351557Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "25b851aa-501a-00e2-7a12-5ad404000000", + "x-ms-client-request-id" : "2673d7bf-7791-45f1-a9b5-27d22f1f3ff5", + "x-ms-file-last-write-time" : "2019-08-24T00:28:06.3351557Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs250799/directoryasyncapitestscreatefilemaxoverloadinvalidargs255691%2ftest%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefilemaxoverloadinvalidargs250799", "directoryasyncapitestscreatefilemaxoverloadinvalidargs255691" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json new file mode 100644 index 000000000000..e164590ce6fb --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs334900?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EF1573A9\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "24aa6534-201a-008b-7f12-5a8ba8000000", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "x-ms-client-request-id" : "1f41e3c9-30c2-4592-bcf8-755ed1a49033" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs334900/directoryasyncapitestscreatefilemaxoverloadinvalidargs362613?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:06.6604674Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "ETag" : "\"0x8D72829EF1C7682\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:06.6604674Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "24aa6536-201a-008b-8012-5a8ba8000000", + "x-ms-client-request-id" : "08c84931-5fac-4230-aeac-8ba1a7674df9", + "x-ms-file-last-write-time" : "2019-08-24T00:28:06.6604674Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatefilemaxoverloadinvalidargs334900/directoryasyncapitestscreatefilemaxoverloadinvalidargs362613%2ftest%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatefilemaxoverloadinvalidargs334900", "directoryasyncapitestscreatefilemaxoverloadinvalidargs362613" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectory.json new file mode 100644 index 000000000000..114f14b94d2d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectory.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectory19757e2cddc7?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EBEDFDBC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf6ba-c01a-0046-3212-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:28:01 GMT", + "x-ms-client-request-id" : "862fd059-a7dc-49fa-805d-79f06403b3bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectory19757e2cddc7/directoryasyncapitestscreatesubdirectory81375cd19182?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:01.3723881Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:01 GMT", + "ETag" : "\"0x8D72829EBF590E9\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:01.3723881Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6bc-c01a-0046-3312-5aeee0000000", + "x-ms-client-request-id" : "f30371b5-3ade-4fca-8170-9f7cdf3ac4de", + "x-ms-file-last-write-time" : "2019-08-24T00:28:01.3723881Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectory19757e2cddc7/directoryasyncapitestscreatesubdirectory81375cd19182%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:01.4144277Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:01 GMT", + "ETag" : "\"0x8D72829EBFBFB15\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:01.4144277Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6bd-c01a-0046-3412-5aeee0000000", + "x-ms-client-request-id" : "85adbd28-7e76-4f42-a169-8c3e99b37601", + "x-ms-file-last-write-time" : "2019-08-24T00:28:01.4144277Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatesubdirectory19757e2cddc7", "directoryasyncapitestscreatesubdirectory81375cd19182" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryInvalidName.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryInvalidName.json new file mode 100644 index 000000000000..51114601e0af --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryInvalidName.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectoryinvalidname4883928?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EC119406\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf6c1-c01a-0046-3812-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:28:01 GMT", + "x-ms-client-request-id" : "a71b3b0c-03cb-4084-8b6c-b3bac0c2f583" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectoryinvalidname4883928/directoryasyncapitestscreatesubdirectoryinvalidname05138b3?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:01.6006071Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:01 GMT", + "ETag" : "\"0x8D72829EC1863B7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:01.6006071Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6c3-c01a-0046-3912-5aeee0000000", + "x-ms-client-request-id" : "9af13e1a-22a5-49ca-a22f-c03237acf322", + "x-ms-file-last-write-time" : "2019-08-24T00:28:01.6006071Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectoryinvalidname4883928/directoryasyncapitestscreatesubdirectoryinvalidname05138b3%2ftest%2fsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ParentNotFound", + "retry-after" : "0", + "Content-Length" : "224", + "StatusCode" : "404", + "x-ms-request-id" : "b02cf6c6-c01a-0046-3c12-5aeee0000000", + "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:b02cf6c6-c01a-0046-3c12-5aeee0000000\nTime:2019-08-24T00:28:02.0644522Z", + "Date" : "Sat, 24 Aug 2019 00:28:01 GMT", + "x-ms-client-request-id" : "a7acee72-57db-48aa-bd47-d572e1c61dcb", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatesubdirectoryinvalidname4883928", "directoryasyncapitestscreatesubdirectoryinvalidname05138b3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadata.json new file mode 100644 index 000000000000..4a735b046535 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadata.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadata776472a3?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EC743E69\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf6ca-c01a-0046-4012-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:28:02 GMT", + "x-ms-client-request-id" : "ff083e1f-e31c-4437-a84a-1b6b8e64f7cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadata776472a3/directoryasyncapitestscreatesubdirectorymetadata06066439?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:02.2452276Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:02 GMT", + "ETag" : "\"0x8D72829EC7AC034\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:02.2452276Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6cc-c01a-0046-4112-5aeee0000000", + "x-ms-client-request-id" : "db98413e-aec4-44c1-837a-6f41af72a777", + "x-ms-file-last-write-time" : "2019-08-24T00:28:02.2452276Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadata776472a3/directoryasyncapitestscreatesubdirectorymetadata06066439%2ftestCreateSubDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:02.2902701Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:02 GMT", + "ETag" : "\"0x8D72829EC819FAD\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:02.2902701Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6ce-c01a-0046-4212-5aeee0000000", + "x-ms-client-request-id" : "9462175c-caf2-427c-984b-4a66671a8059", + "x-ms-file-last-write-time" : "2019-08-24T00:28:02.2902701Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatesubdirectorymetadata776472a3", "directoryasyncapitestscreatesubdirectorymetadata06066439" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadataError.json new file mode 100644 index 000000000000..6538942397c0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsCreateSubDirectoryMetadataError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadataerror546090?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EC99D0F8\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf6d3-c01a-0046-4712-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:28:02 GMT", + "x-ms-client-request-id" : "de1813bb-5d54-411d-a76f-3b8d13f50d4e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadataerror546090/directoryasyncapitestscreatesubdirectorymetadataerror923044?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:02.4944656Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:02 GMT", + "ETag" : "\"0x8D72829ECA0C810\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:02.4944656Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6d5-c01a-0046-4812-5aeee0000000", + "x-ms-client-request-id" : "a3aec858-d788-49a0-ac7b-a988068eb0f2", + "x-ms-file-last-write-time" : "2019-08-24T00:28:02.4944656Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestscreatesubdirectorymetadataerror546090/directoryasyncapitestscreatesubdirectorymetadataerror923044%2ftestsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "b02cf6d6-c01a-0046-4912-5aeee0000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:b02cf6d6-c01a-0046-4912-5aeee0000000\nTime:2019-08-24T00:28:02.5328985Zvalue", + "Date" : "Sat, 24 Aug 2019 00:28:02 GMT", + "x-ms-client-request-id" : "42528317-2a0c-4257-9df2-f73611224420", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestscreatesubdirectorymetadataerror546090", "directoryasyncapitestscreatesubdirectorymetadataerror923044" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectory.json new file mode 100644 index 000000000000..cf30c6b75db5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectory.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletedirectory87916b03334dfc?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E77B8426\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf637-c01a-0046-4e12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:53 GMT", + "x-ms-client-request-id" : "260f0ce4-3a6d-4639-bfc0-f6f064a49ff7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletedirectory87916b03334dfc/directoryasyncapitestsdeletedirectory32096c66cb5666?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:53.9032127Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:53 GMT", + "ETag" : "\"0x8D72829E781DC3F\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:53.9032127Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf63a-c01a-0046-4f12-5aeee0000000", + "x-ms-client-request-id" : "66bf04fb-b9da-4018-b5e2-6314e074143d", + "x-ms-file-last-write-time" : "2019-08-24T00:27:53.9032127Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletedirectory87916b03334dfc/directoryasyncapitestsdeletedirectory32096c66cb5666?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b02cf63b-c01a-0046-5012-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:53 GMT", + "x-ms-client-request-id" : "e19708a8-7ec9-4506-92dc-433ad0b82d1a" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletedirectory87916b03334dfc", "directoryasyncapitestsdeletedirectory32096c66cb5666" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectoryError.json new file mode 100644 index 000000000000..18f4f52fecd5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteDirectoryError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletedirectoryerror06807c0d943?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E7A6E47F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf63e-c01a-0046-5312-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:53 GMT", + "x-ms-client-request-id" : "55ebefcb-bd24-42e4-9a67-6199365821e4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletedirectoryerror06807c0d943/directoryasyncapitestsdeletedirectoryerror35189908a69?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "b02cf640-c01a-0046-5412-5aeee0000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:b02cf640-c01a-0046-5412-5aeee0000000\nTime:2019-08-24T00:27:54.1919510Z", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-client-request-id" : "b8494d24-68af-42bd-aeb9-77cb83714bdf", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletedirectoryerror06807c0d943", "directoryasyncapitestsdeletedirectoryerror35189908a69" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFile.json new file mode 100644 index 000000000000..99e15ccbc2d3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFile.json @@ -0,0 +1,98 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletefile49386ef89f75964b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EF43E517\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe54899-601a-008c-2412-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "x-ms-client-request-id" : "d2300604-f7b2-4994-b0b6-101120401dc3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletefile49386ef89f75964b/directoryasyncapitestsdeletefile6649692da1043dd8?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:06.9787722Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "ETag" : "\"0x8D72829EF4D084A\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:06.9787722Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "efe5489b-601a-008c-2512-5a7d2d000000", + "x-ms-client-request-id" : "30ce3cf6-faa9-449b-a07a-aaee947d912f", + "x-ms-file-last-write-time" : "2019-08-24T00:28:06.9787722Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletefile49386ef89f75964b/directoryasyncapitestsdeletefile6649692da1043dd8%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:07.0148064Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "ETag" : "\"0x8D72829EF5287E0\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:28:07.0148064Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "efe5489c-601a-008c-2612-5a7d2d000000", + "x-ms-client-request-id" : "a16b35de-be40-477d-b7ed-12109d397e72", + "x-ms-file-last-write-time" : "2019-08-24T00:28:07.0148064Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletefile49386ef89f75964b/directoryasyncapitestsdeletefile6649692da1043dd8%2ftestCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "efe5489d-601a-008c-2712-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "x-ms-client-request-id" : "13bec95b-9222-4457-aac9-b24d7a8e2591" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletefile49386ef89f75964b", "directoryasyncapitestsdeletefile6649692da1043dd8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFileError.json new file mode 100644 index 000000000000..d60c1a18db0f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteFileError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletefileerror9732087abc0d07?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EF6B4C65\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548a1-601a-008c-2a12-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:06 GMT", + "x-ms-client-request-id" : "9842d7ce-afb8-4ff3-b2a2-ccf4d6ed455f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletefileerror9732087abc0d07/directoryasyncapitestsdeletefileerror006881f8d4f61f?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:07.3621420Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:07 GMT", + "ETag" : "\"0x8D72829EF8787AC\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:07.3621420Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "efe548a3-601a-008c-2b12-5a7d2d000000", + "x-ms-client-request-id" : "2dbb915d-59c5-4831-846f-1cf2f49161f9", + "x-ms-file-last-write-time" : "2019-08-24T00:28:07.3621420Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletefileerror9732087abc0d07/directoryasyncapitestsdeletefileerror006881f8d4f61f%2ftestfile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "efe548a4-601a-008c-2c12-5a7d2d000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:efe548a4-601a-008c-2c12-5a7d2d000000\nTime:2019-08-24T00:28:07.4814017Z", + "Date" : "Sat, 24 Aug 2019 00:28:07 GMT", + "x-ms-client-request-id" : "fb7e33b8-a7a1-4ea2-9e63-83b15291bf6f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletefileerror9732087abc0d07", "directoryasyncapitestsdeletefileerror006881f8d4f61f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectory.json new file mode 100644 index 000000000000..e1dc26340bf6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectory.json @@ -0,0 +1,98 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletesubdirectory88607e0de51d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829ECBB6AEA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf6d9-c01a-0046-4c12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:28:02 GMT", + "x-ms-client-request-id" : "b690a785-59d7-422a-b0ae-4f42100e18e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletesubdirectory88607e0de51d/directoryasyncapitestsdeletesubdirectory405668063431?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:02.7176795Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:02 GMT", + "ETag" : "\"0x8D72829ECC2D75B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:02.7176795Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6dc-c01a-0046-4d12-5aeee0000000", + "x-ms-client-request-id" : "43e6d7a0-90b8-4073-91d9-249c8b199cc5", + "x-ms-file-last-write-time" : "2019-08-24T00:28:02.7176795Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletesubdirectory88607e0de51d/directoryasyncapitestsdeletesubdirectory405668063431%2ftestSubCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:02.7677265Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:02 GMT", + "ETag" : "\"0x8D72829ECCA7A51\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:02.7677265Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6dd-c01a-0046-4e12-5aeee0000000", + "x-ms-client-request-id" : "3b6717aa-41de-40ca-bdfd-d22a262baf03", + "x-ms-file-last-write-time" : "2019-08-24T00:28:02.7677265Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletesubdirectory88607e0de51d/directoryasyncapitestsdeletesubdirectory405668063431%2ftestSubCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b02cf6de-c01a-0046-4f12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:28:02 GMT", + "x-ms-client-request-id" : "0a154712-76c4-43f5-be1e-1774be58050e" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletesubdirectory88607e0de51d", "directoryasyncapitestsdeletesubdirectory405668063431" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectoryError.json new file mode 100644 index 000000000000..d7d27e6b41da --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsDeleteSubDirectoryError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletesubdirectoryerror998289c684?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829ED0A6184\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf6e5-c01a-0046-5612-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "x-ms-client-request-id" : "fce82aea-0226-41a1-8013-ed241a1e319a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletesubdirectoryerror998289c684/directoryasyncapitestsdeletesubdirectoryerror7491810131?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:03.2291707Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "ETag" : "\"0x8D72829ED10E37B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:03.2291707Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6e8-c01a-0046-5712-5aeee0000000", + "x-ms-client-request-id" : "7fb9e6ee-64d4-4064-a37a-73b9740b6f85", + "x-ms-file-last-write-time" : "2019-08-24T00:28:03.2291707Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsdeletesubdirectoryerror998289c684/directoryasyncapitestsdeletesubdirectoryerror7491810131%2ftestsubdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "b02cf6e9-c01a-0046-5812-5aeee0000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:b02cf6e9-c01a-0046-5812-5aeee0000000\nTime:2019-08-24T00:28:03.2826131Z", + "Date" : "Sat, 24 Aug 2019 00:28:03 GMT", + "x-ms-client-request-id" : "4c61d30f-8f7e-4789-8d10-c826df8aa047", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsdeletesubdirectoryerror998289c684", "directoryasyncapitestsdeletesubdirectoryerror7491810131" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsForceCloseHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsForceCloseHandlesError.json new file mode 100644 index 000000000000..e081a0221e71 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsForceCloseHandlesError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsforceclosehandleserror2852811910?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EB93B9CA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf6b1-c01a-0046-2a12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:28:00 GMT", + "x-ms-client-request-id" : "e1275916-d62c-4f0b-9fdd-3864d049bdac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsforceclosehandleserror2852811910/directoryasyncapitestsforceclosehandleserror2864445cf9?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:28:00.7758138Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:28:00 GMT", + "ETag" : "\"0x8D72829EB9A893A\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:28:00.7758138Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf6b4-c01a-0046-2c12-5aeee0000000", + "x-ms-client-request-id" : "7223e6f7-c828-4f50-a0a2-aa1ee0625183", + "x-ms-file-last-write-time" : "2019-08-24T00:28:00.7758138Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsforceclosehandleserror2852811910/directoryasyncapitestsforceclosehandleserror2864445cf9?comp=forceclosehandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "328", + "StatusCode" : "400", + "x-ms-request-id" : "b02cf6b5-c01a-0046-2d12-5aeee0000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:b02cf6b5-c01a-0046-2d12-5aeee0000000\nTime:2019-08-24T00:28:01.1906198Zx-ms-handle-idhandleId", + "Date" : "Sat, 24 Aug 2019 00:28:01 GMT", + "x-ms-client-request-id" : "a8ce4c2e-ec02-4acb-b5ff-c00dd57da49c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsforceclosehandleserror2852811910", "directoryasyncapitestsforceclosehandleserror2864445cf9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetDirectoryURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetDirectoryURL.json new file mode 100644 index 000000000000..717bc9795f9d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetDirectoryURL.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsgetdirectoryurl23803f5bf62b2d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E64B1E6C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf615-c01a-0046-3512-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:51 GMT", + "x-ms-client-request-id" : "3bfdae11-8935-4cd5-8944-5d1e1281c5ff" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetdirectoryurl23803f5bf62b2d", "directoryasyncapitestsgetdirectoryurl991750b2715bd3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetFileClient.json new file mode 100644 index 000000000000..9bbaee6003a8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetFileClient.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsgetfileclient4609239fa51d96c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E6A22D3E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf61d-c01a-0046-3b12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:52 GMT", + "x-ms-client-request-id" : "f4134026-4c02-477c-9a9a-69dd06ea28ae" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetfileclient4609239fa51d96c", "directoryasyncapitestsgetfileclient11766fc8e533d75" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetProperties.json new file mode 100644 index 000000000000..af0e18904a93 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetProperties.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsgetproperties26992b5cbd43863?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E7C1C612\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf643-c01a-0046-5712-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-client-request-id" : "0e406a10-93de-40df-8af3-47812bd0db6e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsgetproperties26992b5cbd43863/directoryasyncapitestsgetproperties21973d1ee34381a?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:54.3706609Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "ETag" : "\"0x8D72829E7C92FF1\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:54.3706609Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf645-c01a-0046-5812-5aeee0000000", + "x-ms-client-request-id" : "0bae0ce4-8837-4f5c-91db-b8c357b5eaa5", + "x-ms-file-last-write-time" : "2019-08-24T00:27:54.3706609Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsgetproperties26992b5cbd43863/directoryasyncapitestsgetproperties21973d1ee34381a?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:54.3706609Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72829E7C92FF1\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:54.3706609Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf646-c01a-0046-5912-5aeee0000000", + "x-ms-client-request-id" : "ff04f2f8-fd8b-49c1-8e79-64740c34138c", + "x-ms-file-last-write-time" : "2019-08-24T00:27:54.3706609Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetproperties26992b5cbd43863", "directoryasyncapitestsgetproperties21973d1ee34381a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..e16d91effd72 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetPropertiesError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsgetpropertieserror2834027ab13d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E7E29C79\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf649-c01a-0046-5c12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-client-request-id" : "fb08f1d4-883c-4193-b9cc-4696d4d93ca5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsgetpropertieserror2834027ab13d/directoryasyncapitestsgetpropertieserror338880ed98d1?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "b02cf64b-c01a-0046-5d12-5aeee0000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:b02cf64b-c01a-0046-5d12-5aeee0000000\nTime:2019-08-24T00:27:54.5813227Z", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-client-request-id" : "c88c687f-7325-4aba-a6b1-40971d7e65f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetpropertieserror2834027ab13d", "directoryasyncapitestsgetpropertieserror338880ed98d1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..011d5457530f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSnapshotId.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsgetsnapshotid576905f0da6aec3?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EFB93089\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548a7-601a-008c-2f12-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:07 GMT", + "x-ms-client-request-id" : "102c940e-78ab-4a76-a363-98cb0c4e15f1" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetsnapshotid576905f0da6aec3", "directoryasyncapitestsgetsnapshotid57451acb6ffcf54" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSubDirectoryClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSubDirectoryClient.json new file mode 100644 index 000000000000..d6db240b4064 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsGetSubDirectoryClient.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestsgetsubdirectoryclient55414b8645e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E660F5AD\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf619-c01a-0046-3812-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:51 GMT", + "x-ms-client-request-id" : "b84db49b-fca1-447d-83ef-16c7f3b5d211" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestsgetsubdirectoryclient55414b8645e", "directoryasyncapitestsgetsubdirectoryclient32423e0166e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories.json new file mode 100644 index 000000000000..5e2395987587 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectories.json @@ -0,0 +1,192 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093B82CFA1\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd70a-d01a-0112-50f2-56423f000000", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f?restype=directory", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BAE2DD1\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd70e-d01a-0112-51f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b420?restype=directory", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BB8B7B9\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd70f-d01a-0112-52f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b420%2fdirectoryasyncapitestslistfilesanddirectories9439006b423", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BC0F727\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd710-d01a-0112-53f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b420%2fdirectoryasyncapitestslistfilesanddirectories9439006b424", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BC7D6AD\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd712-d01a-0112-54f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b421?restype=directory", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BD127C8\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd713-d01a-0112-55f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b421%2fdirectoryasyncapitestslistfilesanddirectories9439006b425", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BDAC716\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd714-d01a-0112-56f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b421%2fdirectoryasyncapitestslistfilesanddirectories9439006b426", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BE10A35\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd715-d01a-0112-57f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f%2fdirectoryasyncapitestslistfilesanddirectories9439006b422", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D725093BE6D7FF\"", + "Last-Modified" : "Tue, 20 Aug 2019 00:56:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c63cd716-d01a-0112-58f2-56423f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectories325882ed4d/directoryasyncapitestslistfilesanddirectories28315e317f?restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c63cd717-d01a-0112-59f2-56423f000000", + "Body" : "directoryasyncapitestslistfilesanddirectories9439006b420directoryasyncapitestslistfilesanddirectories9439006b421directoryasyncapitestslistfilesanddirectories9439006b4221024", + "Date" : "Tue, 20 Aug 2019 00:56:27 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "directoryasyncapitestslistfilesanddirectories325882ed4d", "directoryasyncapitestslistfilesanddirectories28315e317f", "directoryasyncapitestslistfilesanddirectories9439006b42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs0.json new file mode 100644 index 000000000000..50215ee50059 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs0.json @@ -0,0 +1,268 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs02647854?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E84EBF27\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf65e-c01a-0046-6e12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "x-ms-client-request-id" : "5c8cc126-8518-402a-aaa4-5b5a9e92a8a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs02647854/directoryasyncapitestslistfilesanddirectoriesargs096160ef?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:55.3756263Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E8628867\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:55.3756263Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf660-c01a-0046-6f12-5aeee0000000", + "x-ms-client-request-id" : "83487af0-b4fe-4166-8997-eac498a630e3", + "x-ms-file-last-write-time" : "2019-08-24T00:27:55.3756263Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs02647854/directoryasyncapitestslistfilesanddirectoriesargs096160ef%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485660?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:55.4116610Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E8680802\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:55.4116610Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf661-c01a-0046-7012-5aeee0000000", + "x-ms-client-request-id" : "650a3df3-b564-4bd4-a508-151ed06d54a7", + "x-ms-file-last-write-time" : "2019-08-24T00:27:55.4116610Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs02647854/directoryasyncapitestslistfilesanddirectoriesargs096160ef%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485660%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485663", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:55.4867332Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E8737C84\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:55.4867332Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf662-c01a-0046-7112-5aeee0000000", + "x-ms-client-request-id" : "c4a0116e-a6bd-4c4c-a8b4-eb5e1b6043b2", + "x-ms-file-last-write-time" : "2019-08-24T00:27:55.4867332Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs02647854/directoryasyncapitestslistfilesanddirectoriesargs096160ef%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485660%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485664", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:55.5307756Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E87A34EC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:55.5307756Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf663-c01a-0046-7212-5aeee0000000", + "x-ms-client-request-id" : "08a5d72a-e6a6-476f-a7bb-aa99adb0f672", + "x-ms-file-last-write-time" : "2019-08-24T00:27:55.5307756Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs02647854/directoryasyncapitestslistfilesanddirectoriesargs096160ef%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485661?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:55.5678115Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E87FDBA3\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:55.5678115Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf664-c01a-0046-7312-5aeee0000000", + "x-ms-client-request-id" : "d290cba0-321c-4cf0-80c2-70a770744e2f", + "x-ms-file-last-write-time" : "2019-08-24T00:27:55.5678115Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs02647854/directoryasyncapitestslistfilesanddirectoriesargs096160ef%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485661%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485665", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:55.6068489Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E885D089\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:55.6068489Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf665-c01a-0046-7412-5aeee0000000", + "x-ms-client-request-id" : "c9b4fff9-9d5c-4139-8d20-484200ad6afc", + "x-ms-file-last-write-time" : "2019-08-24T00:27:55.6068489Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs02647854/directoryasyncapitestslistfilesanddirectoriesargs096160ef%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485661%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485666", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:55.6458877Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E88BC57D\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:55.6458877Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf666-c01a-0046-7512-5aeee0000000", + "x-ms-client-request-id" : "ce3ddfd3-00db-4967-ad29-b00ba54aa9cf", + "x-ms-file-last-write-time" : "2019-08-24T00:27:55.6458877Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs02647854/directoryasyncapitestslistfilesanddirectoriesargs096160ef%2fdirectoryasyncapitestslistfilesanddirectoriesargs041485662", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:55.6849242Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E891BA5A\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:55.6849242Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf667-c01a-0046-7612-5aeee0000000", + "x-ms-client-request-id" : "dfb61e5a-feab-410e-850a-cde2a90b0381", + "x-ms-file-last-write-time" : "2019-08-24T00:27:55.6849242Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs02647854/directoryasyncapitestslistfilesanddirectoriesargs096160ef?prefix=directoryasyncapitestslistfilesanddirectoriesargs&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf669-c01a-0046-7712-5aeee0000000", + "Body" : "directoryasyncapitestslistfilesanddirectoriesargsdirectoryasyncapitestslistfilesanddirectoriesargs041485660directoryasyncapitestslistfilesanddirectoriesargs041485661directoryasyncapitestslistfilesanddirectoriesargs0414856621024", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "x-ms-client-request-id" : "d0f60fe5-d501-47cf-ac41-8c932da58227", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslistfilesanddirectoriesargs02647854", "directoryasyncapitestslistfilesanddirectoriesargs096160ef", "directoryasyncapitestslistfilesanddirectoriesargs04148566" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs1.json new file mode 100644 index 000000000000..2bf5a231fc62 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs1.json @@ -0,0 +1,308 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E8B56227\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf66c-c01a-0046-7a12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "x-ms-client-request-id" : "b4740211-69e0-4bdb-b533-0fdfe3945f16" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:55.9661955Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E8BCA583\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:55.9661955Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf66e-c01a-0046-7b12-5aeee0000000", + "x-ms-client-request-id" : "08603a2b-4ad1-4e8a-9eac-28fc5c7c1bb0", + "x-ms-file-last-write-time" : "2019-08-24T00:27:55.9661955Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454090?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.0032322Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E8C24C42\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:56.0032322Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf66f-c01a-0046-7c12-5aeee0000000", + "x-ms-client-request-id" : "3074b64c-2adc-4721-90f5-ce03f4c52eb9", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.0032322Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454090%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454093", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.0462722Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E8C8DD82\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:56.0462722Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf670-c01a-0046-7d12-5aeee0000000", + "x-ms-client-request-id" : "5de1e7a7-bbdc-43a7-89ac-038bc0959646", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.0462722Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454090%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454094", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.0893132Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E8CF6ECC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:56.0893132Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf671-c01a-0046-7e12-5aeee0000000", + "x-ms-client-request-id" : "ff941d02-3b9e-46b4-8415-e57097362cc0", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.0893132Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454091?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.1303527Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:55 GMT", + "ETag" : "\"0x8D72829E8D5B1E7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:56.1303527Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf672-c01a-0046-7f12-5aeee0000000", + "x-ms-client-request-id" : "07f5032e-85b8-41e3-b586-f08285de1510", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.1303527Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454091%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454095", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.1683900Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E8DB7FBC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:56.1683900Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf673-c01a-0046-8012-5aeee0000000", + "x-ms-client-request-id" : "59badeee-03e0-4553-9ec1-7f8ef851dd19", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.1683900Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454091%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454096", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.2074263Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E8E17497\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:56.2074263Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf674-c01a-0046-0112-5aeee0000000", + "x-ms-client-request-id" : "d34aa755-0c16-48f3-be86-e40cf0b61aa1", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.2074263Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad%2fdirectoryasyncapitestslistfilesanddirectoriesargs109454092", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.2464639Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E8E7697F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:56.2464639Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf675-c01a-0046-0212-5aeee0000000", + "x-ms-client-request-id" : "5050c186-e2d6-4f6d-bb5e-25c2ed107d3b", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.2464639Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad?prefix=directoryasyncapitestslistfilesanddirectoriesargs&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf676-c01a-0046-0312-5aeee0000000", + "Body" : "directoryasyncapitestslistfilesanddirectoriesargs1directoryasyncapitestslistfilesanddirectoriesargs1094540901!80!ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczEwOTQ1NDA5MQ--", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "x-ms-client-request-id" : "71d92930-acca-4243-a48e-97896f559750", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad?prefix=directoryasyncapitestslistfilesanddirectoriesargs&marker=1%2180%21ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczEwOTQ1NDA5MQ--&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf677-c01a-0046-0412-5aeee0000000", + "Body" : "directoryasyncapitestslistfilesanddirectoriesargs1!80!ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczEwOTQ1NDA5MQ--1directoryasyncapitestslistfilesanddirectoriesargs1094540911!80!ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczEwOTQ1NDA5Mg--", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "x-ms-client-request-id" : "b68289af-643d-48fe-aa44-7fcc0ac9599f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs1748180a/directoryasyncapitestslistfilesanddirectoriesargs177213ad?prefix=directoryasyncapitestslistfilesanddirectoriesargs&marker=1%2180%21ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczEwOTQ1NDA5Mg--&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf678-c01a-0046-0512-5aeee0000000", + "Body" : "directoryasyncapitestslistfilesanddirectoriesargs1!80!ZGlyZWN0b3J5YXN5bmNhcGl0ZXN0c2xpc3RmaWxlc2FuZGRpcmVjdG9yaWVzYXJnczEwOTQ1NDA5Mg--1directoryasyncapitestslistfilesanddirectoriesargs1094540921024", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "x-ms-client-request-id" : "49a8da82-5da8-445c-b3e7-0248e1b297db", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslistfilesanddirectoriesargs1748180a", "directoryasyncapitestslistfilesanddirectoriesargs177213ad", "directoryasyncapitestslistfilesanddirectoriesargs10945409" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs2.json new file mode 100644 index 000000000000..5606cd68f458 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListFilesAndDirectoriesArgs2.json @@ -0,0 +1,268 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs213289ee?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E90EE2A1\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf67b-c01a-0046-0812-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "x-ms-client-request-id" : "a2fd7682-d2c3-4d16-840c-a384a872f0bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs213289ee/directoryasyncapitestslistfilesanddirectoriesargs2772687a?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.6038058Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E91DF02A\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:56.6038058Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf67d-c01a-0046-0912-5aeee0000000", + "x-ms-client-request-id" : "ebcce08c-72d1-4eb6-a71c-7c6b114d9ef5", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.6038058Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs213289ee/directoryasyncapitestslistfilesanddirectoriesargs2772687a%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639540?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "11529285414812647424", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.6638637Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E9271A2D\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:56.6638637Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf67e-c01a-0046-0a12-5aeee0000000", + "x-ms-client-request-id" : "b8925f8a-6b63-4893-800b-d10c88a60e3a", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.6638637Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs213289ee/directoryasyncapitestslistfilesanddirectoriesargs2772687a%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639540%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639543", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "16140971433240035328", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.7069043Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E92DAB73\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:56.7069043Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf67f-c01a-0046-0b12-5aeee0000000", + "x-ms-client-request-id" : "2510d37b-dfe6-4d45-9710-ad00e7294dda", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.7069043Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs213289ee/directoryasyncapitestslistfilesanddirectoriesargs2772687a%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639540%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639544", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "10376363910205800448", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.8350274Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E9413842\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:56.8350274Z", + "x-ms-file-parent-id" : "11529285414812647424", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf680-c01a-0046-0c12-5aeee0000000", + "x-ms-client-request-id" : "354d02e1-2a8a-4378-a942-b2aaaad038df", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.8350274Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs213289ee/directoryasyncapitestslistfilesanddirectoriesargs2772687a%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639541?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "14988049928633188352", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.8720636Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E946DEFC\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:56.8720636Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf681-c01a-0046-0d12-5aeee0000000", + "x-ms-client-request-id" : "a21256fa-fd15-4778-840b-764a22de6c80", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.8720636Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs213289ee/directoryasyncapitestslistfilesanddirectoriesargs2772687a%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639541%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639545", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "12682206919419494400", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.9090992Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E94C85B0\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:56.9090992Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf682-c01a-0046-0e12-5aeee0000000", + "x-ms-client-request-id" : "409b3e12-d4fe-44c4-841f-237abb8f062f", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.9090992Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs213289ee/directoryasyncapitestslistfilesanddirectoriesargs2772687a%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639541%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639546", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "17293892937846882304", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.9481355Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E9527A8B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:56.9481355Z", + "x-ms-file-parent-id" : "14988049928633188352", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf683-c01a-0046-0f12-5aeee0000000", + "x-ms-client-request-id" : "77187f53-2971-4eff-9040-0f59b25fa926", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.9481355Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs213289ee/directoryasyncapitestslistfilesanddirectoriesargs2772687a%2fdirectoryasyncapitestslistfilesanddirectoriesargs233639542", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "9799903157902376960", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:56.9861720Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "ETag" : "\"0x8D72829E9584858\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:56.9861720Z", + "x-ms-file-parent-id" : "13835128424026341376", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf684-c01a-0046-1012-5aeee0000000", + "x-ms-client-request-id" : "2b5d9959-c1a9-4008-b801-a4273ff4cf72", + "x-ms-file-last-write-time" : "2019-08-24T00:27:56.9861720Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslistfilesanddirectoriesargs213289ee/directoryasyncapitestslistfilesanddirectoriesargs2772687a?prefix=directoryasyncapitestslistfilesanddirectoriesargsnoops&maxresults=1&restype=directory&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf685-c01a-0046-1112-5aeee0000000", + "Body" : "directoryasyncapitestslistfilesanddirectoriesargsnoops1", + "Date" : "Sat, 24 Aug 2019 00:27:56 GMT", + "x-ms-client-request-id" : "2a5d3b27-3f9a-44c9-b624-4462bc5324a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslistfilesanddirectoriesargs213289ee", "directoryasyncapitestslistfilesanddirectoriesargs2772687a", "directoryasyncapitestslistfilesanddirectoriesargs23363954" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles0.json new file mode 100644 index 000000000000..d43f97aed7ed --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles0.json @@ -0,0 +1,72 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslisthandles031351ef53aa1e68?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E972ED08\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf688-c01a-0046-1412-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:57 GMT", + "x-ms-client-request-id" : "83043e5c-caa1-4e15-b4c2-e9933535f336" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslisthandles031351ef53aa1e68/directoryasyncapitestslisthandles09805182ad124fbc?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:57.2063843Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:57 GMT", + "ETag" : "\"0x8D72829E979E263\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:57.2063843Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf68a-c01a-0046-1512-5aeee0000000", + "x-ms-client-request-id" : "3c33f948-9bc0-4cfd-88fa-aacc1f3f79d4", + "x-ms-file-last-write-time" : "2019-08-24T00:27:57.2063843Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslisthandles031351ef53aa1e68/directoryasyncapitestslisthandles09805182ad124fbc?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf68b-c01a-0046-1612-5aeee0000000", + "Body" : "2", + "Date" : "Sat, 24 Aug 2019 00:27:57 GMT", + "x-ms-client-request-id" : "28cb477e-3d21-4161-b707-e9f9d8ca1a53", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslisthandles031351ef53aa1e68", "directoryasyncapitestslisthandles09805182ad124fbc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles1.json new file mode 100644 index 000000000000..dbf85830fe54 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandles1.json @@ -0,0 +1,72 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslisthandles1331347fd63695d1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E99D89CC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf690-c01a-0046-1b12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:57 GMT", + "x-ms-client-request-id" : "554a0f9f-8416-47d3-a364-50c06f04c35f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslisthandles1331347fd63695d1/directoryasyncapitestslisthandles152465d129913271?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:57.5377035Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:57 GMT", + "ETag" : "\"0x8D72829E9AC708B\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:57.5377035Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf692-c01a-0046-1c12-5aeee0000000", + "x-ms-client-request-id" : "b89cf0f9-91bb-4662-9d72-ac98b32685f9", + "x-ms-file-last-write-time" : "2019-08-24T00:27:57.5377035Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslisthandles1331347fd63695d1/directoryasyncapitestslisthandles152465d129913271?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf695-c01a-0046-1f12-5aeee0000000", + "Body" : "", + "Date" : "Sat, 24 Aug 2019 00:27:57 GMT", + "x-ms-client-request-id" : "2aac2418-1e08-45e6-b9f1-026797cc2a15", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslisthandles1331347fd63695d1", "directoryasyncapitestslisthandles152465d129913271" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandlesError.json new file mode 100644 index 000000000000..236293e2a297 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsListHandlesError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslisthandleserror28372a8652fdc?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E9D39B1C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf69a-c01a-0046-2312-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:57 GMT", + "x-ms-client-request-id" : "9bf7c879-588a-4bcf-b2e9-19382d251bd4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestslisthandleserror28372a8652fdc/directoryasyncapitestslisthandleserror84542f15b53e8?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "b02cf69c-c01a-0046-2412-5aeee0000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:b02cf69c-c01a-0046-2412-5aeee0000000\nTime:2019-08-24T00:28:00.5810388Z", + "Date" : "Sat, 24 Aug 2019 00:28:00 GMT", + "x-ms-client-request-id" : "f88569e3-2639-4531-b635-c567f7a7b549", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestslisthandleserror28372a8652fdc", "directoryasyncapitestslisthandleserror84542f15b53e8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadata.json new file mode 100644 index 000000000000..c13ac054f53c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadata.json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestssetmetadata50800dd41fa977c4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E7FD7E0C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf64f-c01a-0046-6112-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-client-request-id" : "06c10071-5341-4c19-be58-044ce2de71db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestssetmetadata50800dd41fa977c4/directoryasyncapitestssetmetadata065138a8d7da4d65?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:54.7550289Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "ETag" : "\"0x8D72829E803D651\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:54.7550289Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf651-c01a-0046-6212-5aeee0000000", + "x-ms-client-request-id" : "aa7ec0a8-aebf-4e92-b9f7-9114c7554428", + "x-ms-file-last-write-time" : "2019-08-24T00:27:54.7550289Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestssetmetadata50800dd41fa977c4/directoryasyncapitestssetmetadata065138a8d7da4d65?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:54.7550289Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72829E803D651\"", + "x-ms-file-attributes" : "Directory", + "x-ms-meta-testmetadata" : "value", + "x-ms-file-change-time" : "2019-08-24T00:27:54.7550289Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf653-c01a-0046-6412-5aeee0000000", + "x-ms-client-request-id" : "1700b3be-c12a-4433-9b4d-50d52e10b8fc", + "x-ms-file-last-write-time" : "2019-08-24T00:27:54.7550289Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestssetmetadata50800dd41fa977c4/directoryasyncapitestssetmetadata065138a8d7da4d65?restype=directory&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E8131C5D\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf654-c01a-0046-6512-5aeee0000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-client-request-id" : "e3fdb59b-b4ea-4138-bc3c-87647008f4bf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestssetmetadata50800dd41fa977c4/directoryasyncapitestssetmetadata065138a8d7da4d65?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-meta-update" : "value", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:54.7550289Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D72829E8131C5D\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:54.8551261Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf655-c01a-0046-6612-5aeee0000000", + "x-ms-client-request-id" : "0bb9b45a-d4e4-4a73-89d3-148dc54f0227", + "x-ms-file-last-write-time" : "2019-08-24T00:27:54.7550289Z" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestssetmetadata50800dd41fa977c4", "directoryasyncapitestssetmetadata065138a8d7da4d65" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadataError.json new file mode 100644 index 000000000000..7ae42ba177c5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/DirectoryAsyncAPITestsSetMetadataError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestssetmetadataerror13767a81180b6?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E82BC54D\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf658-c01a-0046-6912-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-client-request-id" : "b5d659e9-aadf-4a47-8ec6-21e54c4c4992" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestssetmetadataerror13767a81180b6/directoryasyncapitestssetmetadataerror09060fae747a7?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:55.0653267Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "ETag" : "\"0x8D72829E8332F53\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:55.0653267Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf65a-c01a-0046-6a12-5aeee0000000", + "x-ms-client-request-id" : "499f7177-7548-4954-a5f3-c42ded9b9f0b", + "x-ms-file-last-write-time" : "2019-08-24T00:27:55.0653267Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/directoryasyncapitestssetmetadataerror13767a81180b6/directoryasyncapitestssetmetadataerror09060fae747a7?restype=directory&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "b02cf65b-c01a-0046-6b12-5aeee0000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:b02cf65b-c01a-0046-6b12-5aeee0000000\nTime:2019-08-24T00:27:55.1148308Zvalue", + "Date" : "Sat, 24 Aug 2019 00:27:54 GMT", + "x-ms-client-request-id" : "8f0f87a6-1767-4145-a921-4f76fc87c84c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "directoryasyncapitestssetmetadataerror13767a81180b6", "directoryasyncapitestssetmetadataerror09060fae747a7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeError.json new file mode 100644 index 000000000000..f34a57fff7fc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeError.json @@ -0,0 +1,96 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsclearrangeerror84693eec56b16364b4e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297F654B4A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8458e-201a-006e-6512-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:58 GMT", + "x-ms-client-request-id" : "de2a632f-e82b-4e15-8fe7-db857f433769" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsclearrangeerror84693eec56b16364b4e/fileapitestsclearrangeerror734416e4db1d5c1e543", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:59.3004336Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:58 GMT", + "ETag" : "\"0x8D728297F6F9730\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:59.3004336Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84590-201a-006e-6612-5a995f000000", + "x-ms-client-request-id" : "3f78d46d-22bb-4ba3-85f8-b97fd06a11c0", + "x-ms-file-last-write-time" : "2019-08-24T00:24:59.3004336Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsclearrangeerror84693eec56b16364b4e/fileapitestsclearrangeerror734416e4db1d5c1e543?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297F76EC00\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84591-201a-006e-6712-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:58 GMT", + "x-ms-client-request-id" : "430b200e-bf84-455c-a144-ab54bc2070cb", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsclearrangeerror84693eec56b16364b4e/fileapitestsclearrangeerror734416e4db1d5c1e543?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidRange", + "retry-after" : "0", + "Content-Length" : "249", + "StatusCode" : "416", + "x-ms-request-id" : "90b84592-201a-006e-6812-5a995f000000", + "Body" : "InvalidRangeThe range specified is invalid for the current size of the resource.\nRequestId:90b84592-201a-006e-6812-5a995f000000\nTime:2019-08-24T00:25:00.4861499Z", + "Date" : "Sat, 24 Aug 2019 00:24:59 GMT", + "x-ms-client-request-id" : "9f2c7508-607d-47b1-b0a8-7627573082bd", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsclearrangeerror84693eec56b16364b4e", "fileapitestsclearrangeerror734416e4db1d5c1e543" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeErrorArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeErrorArgs.json new file mode 100644 index 000000000000..50966bc6b8de --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsClearRangeErrorArgs.json @@ -0,0 +1,96 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsclearrangeerrorargs23538bece1f0cf939?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829804DE853\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8459b-201a-006e-6b12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:59 GMT", + "x-ms-client-request-id" : "09a3fb56-e0b3-4508-9138-b89333e241fd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsclearrangeerrorargs23538bece1f0cf939/fileapitestsclearrangeerrorargs158389356d4648b22", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:00.8449191Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:59 GMT", + "ETag" : "\"0x8D72829805B42A7\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:00.8449191Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b8459d-201a-006e-6c12-5a995f000000", + "x-ms-client-request-id" : "9685c353-0ef8-42e3-9325-d861b9858d8c", + "x-ms-file-last-write-time" : "2019-08-24T00:25:00.8449191Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsclearrangeerrorargs23538bece1f0cf939/fileapitestsclearrangeerrorargs158389356d4648b22?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829806B733F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8459e-201a-006e-6d12-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:00 GMT", + "x-ms-client-request-id" : "d48daff0-3880-4ca8-a361-7497ffe58a83", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsclearrangeerrorargs23538bece1f0cf939/fileapitestsclearrangeerrorargs158389356d4648b22?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidRange", + "retry-after" : "0", + "Content-Length" : "249", + "StatusCode" : "416", + "x-ms-request-id" : "90b8459f-201a-006e-6e12-5a995f000000", + "Body" : "InvalidRangeThe range specified is invalid for the current size of the resource.\nRequestId:90b8459f-201a-006e-6e12-5a995f000000\nTime:2019-08-24T00:25:00.9956372Z", + "Date" : "Sat, 24 Aug 2019 00:25:00 GMT", + "x-ms-client-request-id" : "766b4ff7-c1d9-49e1-a57e-a7c3d84d1273", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsclearrangeerrorargs23538bece1f0cf939", "fileapitestsclearrangeerrorargs158389356d4648b22" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFile.json new file mode 100644 index 000000000000..e464188862f2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFile.json @@ -0,0 +1,74 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilefileapitestscreatefileeaa3121349ba?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7282969E483AC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "4196420e-c01a-002b-1412-5a44ce000000", + "Date" : "Sat, 24 Aug 2019 00:24:22 GMT", + "x-ms-client-request-id" : "feebf997-ca88-45c0-902a-89b7149770a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilefileapitestscreatefileeaa3121349ba/fileapitestscreatefilefileapitestscreatefileeaa373284924", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "x-ms-error-code" : "OperationTimedOut", + "retry-after" : "0", + "Content-Length" : "245", + "StatusCode" : "500", + "x-ms-request-id" : "41964210-c01a-002b-1512-5a44ce000000", + "Body" : "OperationTimedOutOperation could not be completed within the specified time.\nRequestId:41964210-c01a-002b-1512-5a44ce000000\nTime:2019-08-24T00:24:52.3963206Z", + "Date" : "Sat, 24 Aug 2019 00:24:52 GMT", + "x-ms-client-request-id" : "d14eb954-e978-4932-891e-620c32fad666", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilefileapitestscreatefileeaa3121349ba/fileapitestscreatefilefileapitestscreatefileeaa373284924", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835093239654252544", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:52.7861723Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:52 GMT", + "ETag" : "\"0x8D728297B8D97DB\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:52.7861723Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b8454c-201a-006e-3212-5a995f000000", + "x-ms-client-request-id" : "d14eb954-e978-4932-891e-620c32fad666", + "x-ms-file-last-write-time" : "2019-08-24T00:24:52.7861723Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilefileapitestscreatefileeaa3121349ba", "fileapitestscreatefilefileapitestscreatefileeaa373284924" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileError.json new file mode 100644 index 000000000000..2b0a0f557727 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefileerror72438f1cb23e77cb741?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297C5305B5\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84552-201a-006e-3512-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:53 GMT", + "x-ms-client-request-id" : "24f8ad6e-f654-434e-9c16-a7f575d5b024" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefileerror72438f1cb23e77cb741/fileapitestscreatefileerror52352d9e518a1d38c4b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "90b84554-201a-006e-3612-5a995f000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:90b84554-201a-006e-3612-5a995f000000\nTime:2019-08-24T00:24:54.2251843Z", + "Date" : "Sat, 24 Aug 2019 00:24:53 GMT", + "x-ms-client-request-id" : "ee221ae2-692d-49d3-b95b-83ec8d81162c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefileerror72438f1cb23e77cb741", "fileapitestscreatefileerror52352d9e518a1d38c4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgs.json new file mode 100644 index 000000000000..0eef2cbafa6e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgs.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargs48532bb707cdfcace?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297C8AC52A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84557-201a-006e-3912-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:53 GMT", + "x-ms-client-request-id" : "196f6ecc-6884-4cad-ad8a-5ecff370bef9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargs48532bb707cdfcace/fileapitestscreatefilewithargs299686bcbe073d4b1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:54.5058300Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:53 GMT", + "ETag" : "\"0x8D728297C93FDFC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:54.5058300Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84559-201a-006e-3a12-5a995f000000", + "x-ms-client-request-id" : "1a6091ca-19fb-4bf7-938d-188120f9e087", + "x-ms-file-last-write-time" : "2019-08-24T00:24:54.5058300Z" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilewithargs48532bb707cdfcace", "fileapitestscreatefilewithargs299686bcbe073d4b1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError0.json new file mode 100644 index 000000000000..c245446bdb0a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError0.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargserror045768fe43836a1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297CB2F068\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8455c-201a-006e-3d12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:53 GMT", + "x-ms-client-request-id" : "c9fa0b32-4e1b-4974-b603-25309a4be730" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargserror045768fe43836a1/fileapitestscreatefilewithargserror0185053b854ef27", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "90b8455e-201a-006e-3e12-5a995f000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:90b8455e-201a-006e-3e12-5a995f000000\nTime:2019-08-24T00:24:54.7827147Z", + "Date" : "Sat, 24 Aug 2019 00:24:53 GMT", + "x-ms-client-request-id" : "01216e0b-5f29-425c-bcc2-e85d597a2b44", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilewithargserror045768fe43836a1", "fileapitestscreatefilewithargserror0185053b854ef27" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError1.json new file mode 100644 index 000000000000..3b5a02f241b0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError1.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargserror17690945320cead?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297CF02F70\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84561-201a-006e-4112-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:54 GMT", + "x-ms-client-request-id" : "08de7717-5e6c-4a6a-afe6-4b7f83bf428d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargserror17690945320cead/fileapitestscreatefilewithargserror196898e81caa36e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "1046", + "StatusCode" : "403", + "x-ms-request-id" : "90b84563-201a-006e-4212-5a995f000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:90b84563-201a-006e-4212-5a995f000000\nTime:2019-08-24T00:24:55.1861003ZThe MAC signature found in the HTTP request 'c4FekCXcIH4NSKFWaYIJQV+GcDCMpJw3El+a2yhpyEk=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nSat, 24 Aug 2019 00:24:55 GMT\n\n\n\n\n\nx-ms-client-request-id:22a5bf75-a069-4ced-988f-c5c4b39b1459\nx-ms-content-language:en\nx-ms-content-length:1024\nx-ms-content-type:application/octet-stream\nx-ms-file-attributes:None\nx-ms-file-creation-time:now\nx-ms-file-last-write-time:now\nx-ms-file-permission:inherit\nx-ms-meta-testmeta:value\nx-ms-type:file\nx-ms-version:2019-02-02\n/azstoragesdkaccount/fileapitestscreatefilewithargserror17690945320cead/fileapitestscreatefilewithargserror196898e81caa36e'.", + "Date" : "Sat, 24 Aug 2019 00:24:54 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestscreatefilewithargserror17690945320cead", "fileapitestscreatefilewithargserror196898e81caa36e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError2.json new file mode 100644 index 000000000000..f19efe9637dc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsCreateFileWithArgsError2.json @@ -0,0 +1,40 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargserror24159255f00d5b2?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721C4D36074BB\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec0e84be-b01a-00a7-44ad-530995000000", + "Date" : "Thu, 15 Aug 2019 21:09:13 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestscreatefilewithargserror24159255f00d5b2/fileapitestscreatefilewithargserror24044490d9bcaa1", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "865", + "StatusCode" : "403", + "x-ms-request-id" : "ec0e84c0-b01a-00a7-45ad-530995000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:ec0e84c0-b01a-00a7-45ad-530995000000\nTime:2019-08-15T21:09:14.0445650ZThe MAC signature found in the HTTP request 'JP4ooBRaMLGCKgd7WfBQe+F8eRVIvSqyvgiHYQRjr6k=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nThu, 15 Aug 2019 21:09:14 GMT\n\n\n\n\n\nx-ms-client-request-id:c726219e-d5d0-4af9-b4c3-d52e318c69dc\nx-ms-content-length:1024\nx-ms-meta-testmeta:value\nx-ms-type:file\nx-ms-version:2018-11-09\n/azstoragesdkaccount/fileapitestscreatefilewithargserror24159255f00d5b2/fileapitestscreatefilewithargserror24044490d9bcaa1'.", + "Date" : "Thu, 15 Aug 2019 21:09:13 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "fileapitestscreatefilewithargserror24159255f00d5b2", "fileapitestscreatefilewithargserror24044490d9bcaa1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteDirectory.json new file mode 100644 index 000000000000..35f6e24916e9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteDirectory.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdeletedirectory007969ac26d4558da4b?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CB1CB9064E\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:54:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fdc09854-d01a-003f-07b3-5387aa000000", + "Date" : "Thu, 15 Aug 2019 21:54:14 GMT" + } + } ], + "variables" : [ "fileapitestsdeletedirectory007969ac26d4558da4b", "fileapitestsdeletedirectory26233252b9ad4c1774e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFile.json new file mode 100644 index 000000000000..626796ac1660 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFile.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdeletefilefileapitestsdeletefile85b63799d9ea?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7282997C64A30\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84600-201a-006e-1d12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:39 GMT", + "x-ms-client-request-id" : "a05e7a3b-8a06-4ebb-9f38-c6b6b71b0e58" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdeletefilefileapitestsdeletefile85b63799d9ea/fileapitestsdeletefilefileapitestsdeletefile85b48658c94a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:40.1887216Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:39 GMT", + "ETag" : "\"0x8D7282997CEA5F0\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:40.1887216Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84602-201a-006e-1e12-5a995f000000", + "x-ms-client-request-id" : "da37bcc2-c95a-41a0-af31-7633828c8039", + "x-ms-file-last-write-time" : "2019-08-24T00:25:40.1887216Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdeletefilefileapitestsdeletefile85b63799d9ea/fileapitestsdeletefilefileapitestsdeletefile85b48658c94a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "90b84603-201a-006e-1f12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:45 GMT", + "x-ms-client-request-id" : "a77b2f67-0d74-4615-b05c-47b38a41ecd7" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsdeletefilefileapitestsdeletefile85b63799d9ea", "fileapitestsdeletefilefileapitestsdeletefile85b48658c94a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFileError.json new file mode 100644 index 000000000000..89536c6fa75d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDeleteFileError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdeletefileerror1944649205eab558543?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728299BDD9547\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8460e-201a-006e-2412-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:46 GMT", + "x-ms-client-request-id" : "67fc567e-6a29-4c4b-8d0a-569ca7051b4c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdeletefileerror1944649205eab558543/fileapitestsdeletefileerror6708942e353f89aa542", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "90b84610-201a-006e-2512-5a995f000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:90b84610-201a-006e-2512-5a995f000000\nTime:2019-08-24T00:25:47.2036827Z", + "Date" : "Sat, 24 Aug 2019 00:25:46 GMT", + "x-ms-client-request-id" : "2ea5dbbb-cc0e-481f-bdfb-9379d3f85772", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsdeletefileerror1944649205eab558543", "fileapitestsdeletefileerror6708942e353f89aa542" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataError.json new file mode 100644 index 000000000000..768cb4259d64 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdownloaddataerror109687b53e1cfa4a74?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7282980892B04\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b845a2-201a-006e-7112-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:00 GMT", + "x-ms-client-request-id" : "79ffbcc8-efe9-44f8-8430-f1ec8613c644" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdownloaddataerror109687b53e1cfa4a74/fileapitestsdownloaddataerror605294581c02dffbc4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "90b845a4-201a-006e-7212-5a995f000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:90b845a4-201a-006e-7212-5a995f000000\nTime:2019-08-24T00:25:01.6342461Z", + "Date" : "Sat, 24 Aug 2019 00:25:00 GMT", + "x-ms-client-request-id" : "aa1c9cec-8b9c-4c17-905f-666b3abac361", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsdownloaddataerror109687b53e1cfa4a74", "fileapitestsdownloaddataerror605294581c02dffbc4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataWithInvalidArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataWithInvalidArgs.json new file mode 100644 index 000000000000..e723976e9d0d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsDownloadDataWithInvalidArgs.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsdownloaddatawithinvalidargs883404b1ba4a9?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72207542CAB85\"", + "Last-Modified" : "Fri, 16 Aug 2019 05:05:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "29f7aaf2-c01a-00a3-14f0-53fc17000000", + "Date" : "Fri, 16 Aug 2019 05:05:16 GMT" + } + } ], + "variables" : [ "fileapitestsdownloaddatawithinvalidargs883404b1ba4a9", "fileapitestsdownloaddatawithinvalidargs6633091a82a90" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsForceCloseHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsForceCloseHandlesError.json new file mode 100644 index 000000000000..c23491f64068 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsForceCloseHandlesError.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsforceclosehandleserror47700a59f2d02fa?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721D14B1E5A30\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:38:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "89f9853f-501a-00a6-57ba-530868000000", + "Date" : "Thu, 15 Aug 2019 22:38:28 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsforceclosehandleserror47700a59f2d02fa/fileapitestsforceclosehandleserror92395dc696c9efa", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721D14B718BEA\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:38:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "89f98542-501a-00a6-58ba-530868000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 15 Aug 2019 22:38:29 GMT" + } + } ], + "variables" : [ "fileapitestsforceclosehandleserror47700a59f2d02fa", "fileapitestsforceclosehandleserror92395dc696c9efa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetFileURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetFileURL.json new file mode 100644 index 000000000000..5dc3f9ce4ca0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetFileURL.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsgetfileurlfileapitestsgetfileurle9f918492fd5?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829669948A4\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "41964201-c01a-002b-0f12-5a44ce000000", + "Date" : "Sat, 24 Aug 2019 00:24:20 GMT", + "x-ms-client-request-id" : "beaac3d6-47e0-4ae4-b39c-8cd233c01a2b" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsgetfileurlfileapitestsgetfileurle9f918492fd5", "fileapitestsgetfileurlfileapitestsgetfileurle9f08395eadc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetProperties.json new file mode 100644 index 000000000000..1e3771027259 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetProperties.json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsgetpropertiesfileapitestsgetproperties3df50820b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728299C10BFBD\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84613-201a-006e-2812-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:46 GMT", + "x-ms-client-request-id" : "746ab84f-4bc9-4fe6-b1bc-8a4144305040" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsgetpropertiesfileapitestsgetproperties3df50820b/fileapitestsgetpropertiesfileapitestsgetproperties3df723249", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:47.3766316Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:46 GMT", + "ETag" : "\"0x8D728299C176FAC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:47.3766316Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84615-201a-006e-2912-5a995f000000", + "x-ms-client-request-id" : "c996cce4-e901-43f1-9ed2-3007892334e1", + "x-ms-file-last-write-time" : "2019-08-24T00:25:47.3766316Z" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsgetpropertiesfileapitestsgetproperties3df50820b/fileapitestsgetpropertiesfileapitestsgetproperties3df723249", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:47.3766316Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:25:46 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D728299C176FAC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:47.3766316Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "1024", + "x-ms-request-id" : "90b84616-201a-006e-2a12-5a995f000000", + "x-ms-client-request-id" : "e89734ea-40d2-482e-91f4-fa9457820537", + "x-ms-file-last-write-time" : "2019-08-24T00:25:47.3766316Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsgetpropertiesfileapitestsgetproperties3df50820b", "fileapitestsgetpropertiesfileapitestsgetproperties3df723249" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..6ca9e7961d6c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetPropertiesError.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsgetpropertieserror9000466551c7971d4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728299C3FF192\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84619-201a-006e-2d12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:46 GMT", + "x-ms-client-request-id" : "366b4ed2-07be-4e92-95f6-3ee2f33362f5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsgetpropertieserror9000466551c7971d4/fileapitestsgetpropertieserror9107301c8f71bb870", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "90b8461b-201a-006e-2e12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:46 GMT", + "x-ms-client-request-id" : "8720b5f0-a446-451c-80e5-1bd4c241c735" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsgetpropertieserror9000466551c7971d4", "fileapitestsgetpropertieserror9107301c8f71bb870" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..7fdcb04e8015 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsGetSnapshotId.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsgetsnapshotidfileapitestsgetsnapshotid4dc759855?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AF2EEE00\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84682-201a-006e-6f12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:19 GMT", + "x-ms-client-request-id" : "2f658202-bad1-4045-9fec-e0e9e361c972" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsgetsnapshotidfileapitestsgetsnapshotid4dc759855", "fileapitestsgetsnapshotidfileapitestsgetsnapshotid4dc53973c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles.json new file mode 100644 index 000000000000..f15e96afaad1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles.json @@ -0,0 +1,72 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesfileapitestslisthandlesb9928975d74?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AB9D215C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8466f-201a-006e-6312-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:13 GMT", + "x-ms-client-request-id" : "3fc5837a-6307-46d8-ab88-b826addd3c08" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesfileapitestslisthandlesb9928975d74/fileapitestslisthandlesfileapitestslisthandlesb9980830fd1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:13.4857170Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:13 GMT", + "ETag" : "\"0x8D72829ABA75DD2\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:13.4857170Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84671-201a-006e-6412-5a995f000000", + "x-ms-client-request-id" : "0eb30a87-67f0-4e9c-af08-161b671767ae", + "x-ms-file-last-write-time" : "2019-08-24T00:26:13.4857170Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesfileapitestslisthandlesb9928975d74/fileapitestslisthandlesfileapitestslisthandlesb9980830fd1?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "90b84673-201a-006e-6512-5a995f000000", + "Body" : "", + "Date" : "Sat, 24 Aug 2019 00:26:18 GMT", + "x-ms-client-request-id" : "3da36619-9cbb-45a5-ba30-92dd2908e595", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestslisthandlesfileapitestslisthandlesb9928975d74", "fileapitestslisthandlesfileapitestslisthandlesb9980830fd1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles0.json new file mode 100644 index 000000000000..18a25b48d256 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles0.json @@ -0,0 +1,59 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles0fileapitestslisthandles0b7080097e3?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CB98A1CF9F\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:57:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f878b625-701a-0114-53b4-53b547000000", + "Date" : "Thu, 15 Aug 2019 21:57:41 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles0fileapitestslisthandles0b7080097e3/fileapitestslisthandles0fileapitestslisthandles0b7088309df", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CB98CA2C92\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:57:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f878b628-701a-0114-54b4-53b547000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 15 Aug 2019 21:57:41 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles0fileapitestslisthandles0b7080097e3/fileapitestslisthandles0fileapitestslisthandles0b7088309df?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f878b62a-701a-0114-55b4-53b547000000", + "Body" : "2", + "Date" : "Thu, 15 Aug 2019 21:57:41 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "fileapitestslisthandles0fileapitestslisthandles0b7080097e3", "fileapitestslisthandles0fileapitestslisthandles0b7088309df" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles1.json new file mode 100644 index 000000000000..ae9a0c8e1ca0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandles1.json @@ -0,0 +1,59 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles1fileapitestslisthandles10bf9896712?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CB993DC0B4\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:57:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f878b62e-701a-0114-58b4-53b547000000", + "Date" : "Thu, 15 Aug 2019 21:57:42 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles1fileapitestslisthandles10bf9896712/fileapitestslisthandles1fileapitestslisthandles10bf600114b", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CB9947DF7B\"", + "Last-Modified" : "Thu, 15 Aug 2019 21:57:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f878b630-701a-0114-59b4-53b547000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 15 Aug 2019 21:57:42 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandles1fileapitestslisthandles10bf9896712/fileapitestslisthandles1fileapitestslisthandles10bf600114b?comp=listhandles", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f878b631-701a-0114-5ab4-53b547000000", + "Body" : "", + "Date" : "Thu, 15 Aug 2019 21:57:42 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "fileapitestslisthandles1fileapitestslisthandles10bf9896712", "fileapitestslisthandles1fileapitestslisthandles10bf600114b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesError.json new file mode 100644 index 000000000000..82fee8a48b5b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesError.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandleserror07801581e6d95bb9c4?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CD6E85EC4F\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:10:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5b04ef3f-001a-0036-4eb6-539d24000000", + "Date" : "Thu, 15 Aug 2019 22:10:49 GMT" + } + } ], + "variables" : [ "fileapitestslisthandleserror07801581e6d95bb9c4", "fileapitestslisthandleserror60820f5f3c418ade74" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResult.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResult.json new file mode 100644 index 000000000000..6ce6b3ce62df --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResult.json @@ -0,0 +1,59 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesmaxresult61895e93654bff74?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CD6EA19168\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:10:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5b04ef43-001a-0036-51b6-539d24000000", + "Date" : "Thu, 15 Aug 2019 22:10:50 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesmaxresult61895e93654bff74/fileapitestslisthandlesmaxresult487476599037fe47", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CD6EACB954\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:10:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5b04ef45-001a-0036-52b6-539d24000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 15 Aug 2019 22:10:50 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesmaxresult61895e93654bff74/fileapitestslisthandlesmaxresult487476599037fe47?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "5b04ef46-001a-0036-53b6-539d24000000", + "Body" : "2", + "Date" : "Thu, 15 Aug 2019 22:10:50 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "fileapitestslisthandlesmaxresult61895e93654bff74", "fileapitestslisthandlesmaxresult487476599037fe47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResultError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResultError.json new file mode 100644 index 000000000000..408092c212dd --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesMaxResultError.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandlesmaxresulterror42018bc31c3b7f?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721CDD1554FFC\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:13:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c2a54d87-d01a-0095-03b6-535145000000", + "Date" : "Thu, 15 Aug 2019 22:13:45 GMT" + } + } ], + "variables" : [ "fileapitestslisthandlesmaxresulterror42018bc31c3b7f", "fileapitestslisthandlesmaxresulterror06965ee292517a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesWithMaxResult.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesWithMaxResult.json new file mode 100644 index 000000000000..20ab46f17cf0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListHandlesWithMaxResult.json @@ -0,0 +1,72 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandleswithmaxresult33699756fbbabb?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AEF95207\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8467c-201a-006e-6a12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:19 GMT", + "x-ms-client-request-id" : "3b72340c-f5c5-43eb-8eb2-5e190eebf052" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandleswithmaxresult33699756fbbabb/fileapitestslisthandleswithmaxresult22682d63af10cd", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:19.1001134Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:19 GMT", + "ETag" : "\"0x8D72829AF000E2E\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:19.1001134Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b8467e-201a-006e-6b12-5a995f000000", + "x-ms-client-request-id" : "46113924-f225-40a3-9b06-8d39af7993fd", + "x-ms-file-last-write-time" : "2019-08-24T00:26:19.1001134Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslisthandleswithmaxresult33699756fbbabb/fileapitestslisthandleswithmaxresult22682d63af10cd?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "90b8467f-201a-006e-6c12-5a995f000000", + "Body" : "2", + "Date" : "Sat, 24 Aug 2019 00:26:19 GMT", + "x-ms-client-request-id" : "60de6554-35ee-4166-837a-acda91bd5301", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestslisthandleswithmaxresult33699756fbbabb", "fileapitestslisthandleswithmaxresult22682d63af10cd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRanges.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRanges.json new file mode 100644 index 000000000000..3ff7e361da9a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRanges.json @@ -0,0 +1,98 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangesfileapitestslistranges37e59902e669?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AADA3E4F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8465f-201a-006e-5612-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:12 GMT", + "x-ms-client-request-id" : "b111f5eb-c0f8-440d-a4a2-e02feb466417" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangesfileapitestslistranges37e59902e669/fileapitestslistrangesfileapitestslistranges37e85278055b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:12.1914728Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:12 GMT", + "ETag" : "\"0x8D72829AAE1E168\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:12.1914728Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84661-201a-006e-5712-5a995f000000", + "x-ms-client-request-id" : "b8c41edf-a4c2-4041-8d18-beb5ec7cdf70", + "x-ms-file-last-write-time" : "2019-08-24T00:26:12.1914728Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangesfileapitestslistranges37e59902e669/fileapitestslistrangesfileapitestslistranges37e85278055b?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AAF6F53B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84662-201a-006e-5812-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:12 GMT", + "x-ms-client-request-id" : "c59e9d06-ed17-46e7-801e-4f6fd1af3f41", + "Content-MD5" : "DzQ7CTESaiDxM9Z8KwGKOw==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangesfileapitestslistranges37e59902e669/fileapitestslistrangesfileapitestslistranges37e85278055b?comp=rangelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-length" : "1024", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:12 GMT", + "ETag" : "\"0x8D72829AAF6F53B\"", + "x-ms-request-id" : "90b84663-201a-006e-5912-5a995f000000", + "Body" : "01023", + "x-ms-client-request-id" : "deb75cd6-301e-42aa-9338-6dbb76dfd85f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestslistrangesfileapitestslistranges37e59902e669", "fileapitestslistrangesfileapitestslistranges37e85278055b", "filefileapitestslistranges37e919358dacf17d53d64" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesError.json new file mode 100644 index 000000000000..8845bfcc86b1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesError.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangeserror8797419eac825c17f4e?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721D271C5FE2F\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:46:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "35821212-701a-00f5-02bb-531467000000", + "Date" : "Thu, 15 Aug 2019 22:46:43 GMT" + } + } ], + "variables" : [ "fileapitestslistrangeserror8797419eac825c17f4e", "fileapitestslistrangeserror83842d86070379eba46" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRange.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRange.json new file mode 100644 index 000000000000..1f73e80d5265 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRange.json @@ -0,0 +1,98 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangeswithrange6648624178c2a99b4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AB75445E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84667-201a-006e-5d12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:13 GMT", + "x-ms-client-request-id" : "1207d767-c81f-46b4-bcdc-09418cdd9282" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangeswithrange6648624178c2a99b4/fileapitestslistrangeswithrange184759e39be1644bf", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:13.2034468Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:13 GMT", + "ETag" : "\"0x8D72829AB7C4BA4\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:13.2034468Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84669-201a-006e-5e12-5a995f000000", + "x-ms-client-request-id" : "3aaa0956-d83e-49c8-8474-6975303f9b71", + "x-ms-file-last-write-time" : "2019-08-24T00:26:13.2034468Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangeswithrange6648624178c2a99b4/fileapitestslistrangeswithrange184759e39be1644bf?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AB83A070\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8466a-201a-006e-5f12-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:13 GMT", + "x-ms-client-request-id" : "694acf01-fabd-4cff-87b8-48e3346b7487", + "Content-MD5" : "DzQ7CTESaiDxM9Z8KwGKOw==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangeswithrange6648624178c2a99b4/fileapitestslistrangeswithrange184759e39be1644bf?comp=rangelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-length" : "1024", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:13 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:13 GMT", + "ETag" : "\"0x8D72829AB83A070\"", + "x-ms-request-id" : "90b8466c-201a-006e-6012-5a995f000000", + "Body" : "0511", + "x-ms-client-request-id" : "57241ec0-74ed-4ef8-99a9-43615af58d29", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestslistrangeswithrange6648624178c2a99b4", "fileapitestslistrangeswithrange184759e39be1644bf", "filefileapitestslistrangeswithrange790395797ad69003" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRangeError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRangeError.json new file mode 100644 index 000000000000..466b17f4e1e4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsListRangesWithRangeError.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestslistrangeswithrangeerror77992342914f74?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D721D2256AC5F0\"", + "Last-Modified" : "Thu, 15 Aug 2019 22:44:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe956e2-001a-0014-75ba-53f312000000", + "Date" : "Thu, 15 Aug 2019 22:44:35 GMT" + } + } ], + "variables" : [ "fileapitestslistrangeswithrangeerror77992342914f74", "fileapitestslistrangeswithrangeerror3346158f194879" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeaders.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeaders.json new file mode 100644 index 000000000000..83a3dc91467a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeaders.json @@ -0,0 +1,60 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssethttpheaders31520aa9aa28ab99240?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EA746B2CF\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:51:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1152b5da-c01a-0064-1877-5780d6000000", + "Date" : "Tue, 20 Aug 2019 16:51:31 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssethttpheaders31520aa9aa28ab99240/fileapitestssethttpheaders99135bba7398455394e", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EA74C5433\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:51:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1152b5dc-c01a-0064-1977-5780d6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 16:51:31 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssethttpheaders31520aa9aa28ab99240/fileapitestssethttpheaders99135bba7398455394e?comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EA7586525\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:51:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1152b5dd-c01a-0064-1a77-5780d6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 16:51:31 GMT" + } + } ], + "variables" : [ "fileapitestssethttpheaders31520aa9aa28ab99240", "fileapitestssethttpheaders99135bba7398455394e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersError.json new file mode 100644 index 000000000000..f10d70403395 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetHttpHeadersError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssethttpheaderserror537759e8b76225cd7?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728299C611639\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8461e-201a-006e-3112-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:46 GMT", + "x-ms-client-request-id" : "946f2b31-c041-4c6a-a9a2-10b61df1dd88" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssethttpheaderserror537759e8b76225cd7/fileapitestssethttpheaderserror045555bdecbc20ad6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:47.9231574Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:46 GMT", + "ETag" : "\"0x8D728299C6AD456\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:47.9231574Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84620-201a-006e-3212-5a995f000000", + "x-ms-client-request-id" : "7d51348a-cfc9-4780-b546-d51e178c52ae", + "x-ms-file-last-write-time" : "2019-08-24T00:25:47.9231574Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssethttpheaderserror537759e8b76225cd7/fileapitestssethttpheaderserror045555bdecbc20ad6?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "90b84621-201a-006e-3312-5a995f000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:90b84621-201a-006e-3312-5a995f000000\nTime:2019-08-24T00:25:47.9724162Z", + "Date" : "Sat, 24 Aug 2019 00:25:46 GMT", + "x-ms-client-request-id" : "b8a2dedc-3b7f-45fd-a032-56d1dbc30bb1", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestssethttpheaderserror537759e8b76225cd7", "fileapitestssethttpheaderserror045555bdecbc20ad6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadata.json new file mode 100644 index 000000000000..4a559f92de5b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadata.json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssetmetadatafileapitestssetmetadataf1d5256890a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728299C86337C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84627-201a-006e-3712-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:47 GMT", + "x-ms-client-request-id" : "799ac4f9-0346-47ce-ad03-34c65021fd31" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssetmetadatafileapitestssetmetadataf1d5256890a/fileapitestssetmetadatafileapitestssetmetadataf1d93534d0e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:48.1533773Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:47 GMT", + "ETag" : "\"0x8D728299C8DF54D\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:48.1533773Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84629-201a-006e-3812-5a995f000000", + "x-ms-client-request-id" : "b78d0fcb-a8fa-4399-974d-9798d2eb5367", + "x-ms-file-last-write-time" : "2019-08-24T00:25:48.1533773Z" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssetmetadatafileapitestssetmetadataf1d5256890a/fileapitestssetmetadatafileapitestssetmetadataf1d93534d0e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:48.1533773Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:25:47 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D728299C8DF54D\"", + "x-ms-file-attributes" : "Archive", + "x-ms-meta-testmetadata" : "value", + "x-ms-file-change-time" : "2019-08-24T00:25:48.1533773Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "1024", + "x-ms-request-id" : "90b8462a-201a-006e-3912-5a995f000000", + "x-ms-client-request-id" : "f81e0b91-6784-4947-875e-3f15f512588d", + "x-ms-file-last-write-time" : "2019-08-24T00:25:48.1533773Z", + "Content-Language" : "en", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssetmetadatafileapitestssetmetadataf1d5256890a/fileapitestssetmetadatafileapitestssetmetadataf1d93534d0e?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AA821DBE\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "90b8462b-201a-006e-3a12-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:11 GMT", + "x-ms-client-request-id" : "f0dd4752-ddfb-4254-b3f8-5c1e0b601e3c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssetmetadatafileapitestssetmetadataf1d5256890a/fileapitestssetmetadatafileapitestssetmetadataf1d93534d0e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-meta-update" : "value", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:48.1533773Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:11 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829AA821DBE\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:11.5638718Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "1024", + "x-ms-request-id" : "90b84654-201a-006e-4e12-5a995f000000", + "x-ms-client-request-id" : "9bfbdaf5-796f-455c-9abc-3604b3017389", + "x-ms-file-last-write-time" : "2019-08-24T00:25:48.1533773Z", + "Content-Language" : "en", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestssetmetadatafileapitestssetmetadataf1d5256890a", "fileapitestssetmetadatafileapitestssetmetadataf1d93534d0e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadataError.json new file mode 100644 index 000000000000..ac5ccd367e3e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsSetMetadataError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssetmetadataerror3151310a60dfb218a4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AAB3730A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84659-201a-006e-5112-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:11 GMT", + "x-ms-client-request-id" : "9fd470c3-c694-42b5-8065-b5b8af9a8ef9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssetmetadataerror3151310a60dfb218a4/fileapitestssetmetadataerror79848bf881765e9414", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:11.9392301Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:11 GMT", + "ETag" : "\"0x8D72829AABB642D\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:11.9392301Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b8465b-201a-006e-5212-5a995f000000", + "x-ms-client-request-id" : "4dee24e9-1090-4c68-b89c-223aee50c2c4", + "x-ms-file-last-write-time" : "2019-08-24T00:26:11.9392301Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestssetmetadataerror3151310a60dfb218a4/fileapitestssetmetadataerror79848bf881765e9414?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "90b8465c-201a-006e-5312-5a995f000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:90b8465c-201a-006e-5312-5a995f000000\nTime:2019-08-24T00:26:11.9992876Zvalue", + "Date" : "Sat, 24 Aug 2019 00:26:11 GMT", + "x-ms-client-request-id" : "45659ff1-36cc-466b-a299-38b5a8a6aa45", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestssetmetadataerror3151310a60dfb218a4", "fileapitestssetmetadataerror79848bf881765e9414" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopy.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopy.json new file mode 100644 index 000000000000..fc36e4db241f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopy.json @@ -0,0 +1,74 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsstartcopyfileapitestsstartcopy4e920829122b1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829815A90EA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b845af-201a-006e-7c12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:01 GMT", + "x-ms-client-request-id" : "07dbfe51-97b6-4124-8164-b9679c93785d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsstartcopyfileapitestsstartcopy4e920829122b1/fileapitestsstartcopyfileapitestsstartcopy4e98775238624", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:02.5685740Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:01 GMT", + "ETag" : "\"0x8D72829816244EC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:02.5685740Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b845b1-201a-006e-7d12-5a995f000000", + "x-ms-client-request-id" : "e857edce-a03e-4c02-b755-c0dacc50f5e7", + "x-ms-file-last-write-time" : "2019-08-24T00:25:02.5685740Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsstartcopyfileapitestsstartcopy4e920829122b1/fileapitestsstartcopyfileapitestsstartcopy4e98775238624", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "88c3ed49-97ed-40b0-9e7d-e8d22eef6bac", + "ETag" : "\"0x8D72829963B46FA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "90b845b2-201a-006e-7e12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:38 GMT", + "x-ms-client-request-id" : "a55364c2-a3e9-4414-bc29-9fd97ea76bb2" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsstartcopyfileapitestsstartcopy4e920829122b1", "fileapitestsstartcopyfileapitestsstartcopy4e98775238624" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopyError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopyError.json new file mode 100644 index 000000000000..8e93efb44184 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsStartCopyError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsstartcopyerror309656657fafc482241?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829979FF417\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b845fa-201a-006e-1812-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:38 GMT", + "x-ms-client-request-id" : "d42f7297-bd51-44da-b782-1579f1abb713" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsstartcopyerror309656657fafc482241/fileapitestsstartcopyerror480754e1802e61a844c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:39.9354777Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:38 GMT", + "ETag" : "\"0x8D7282997A80199\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:39.9354777Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b845fc-201a-006e-1912-5a995f000000", + "x-ms-client-request-id" : "eff7870a-8868-48ae-8690-03878061c155", + "x-ms-file-last-write-time" : "2019-08-24T00:25:39.9354777Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsstartcopyerror309656657fafc482241/fileapitestsstartcopyerror480754e1802e61a844c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "330", + "StatusCode" : "400", + "x-ms-request-id" : "90b845fd-201a-006e-1a12-5a995f000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:90b845fd-201a-006e-1a12-5a995f000000\nTime:2019-08-24T00:25:39.9807981Zx-ms-copy-sourcesome url", + "Date" : "Sat, 24 Aug 2019 00:25:39 GMT", + "x-ms-client-request-id" : "ae7a90c4-66ec-4ac6-99ab-0017fd01d5f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsstartcopyerror309656657fafc482241", "fileapitestsstartcopyerror480754e1802e61a844c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRange.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRange.json new file mode 100644 index 000000000000..b1bcd0697e3f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRange.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadandclearrange15644dd70e09bf969?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297E4DA38C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8457c-201a-006e-5712-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:56 GMT", + "x-ms-client-request-id" : "e94f8128-56db-468c-9402-4218298e7a35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadandclearrange15644dd70e09bf969/fileapitestsuploadandclearrange80088401f15b5d1bc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:57.4536596Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:56 GMT", + "ETag" : "\"0x8D728297E55CB94\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:57.4536596Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b8457e-201a-006e-5812-5a995f000000", + "x-ms-client-request-id" : "d3edb478-a27c-4223-bf43-e19cf45fba84", + "x-ms-file-last-write-time" : "2019-08-24T00:24:57.4536596Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadandclearrange15644dd70e09bf969/fileapitestsuploadandclearrange80088401f15b5d1bc?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297E5DE3D9\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8457f-201a-006e-5912-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:56 GMT", + "x-ms-client-request-id" : "bba2ea8d-6833-4922-9f6a-4943a23c65d0", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadandclearrange15644dd70e09bf969/fileapitestsuploadandclearrange80088401f15b5d1bc?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297E697F76\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84580-201a-006e-5a12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:57 GMT", + "x-ms-client-request-id" : "23f6aa15-3130-4be1-8305-b09f48ff9a3d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadandclearrange15644dd70e09bf969/fileapitestsuploadandclearrange80088401f15b5d1bc", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:57.4536596Z", + "Content-Range" : "bytes 0-6/22", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:57 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Sat, 24 Aug 2019 00:24:57 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D728297E697F76\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:57.4536596Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "7", + "x-ms-request-id" : "90b84583-201a-006e-5b12-5a995f000000", + "Body" : "[0, 0, 0, 0, 0, 0, 0]", + "x-ms-client-request-id" : "c5a29e81-39ce-48bd-99bf-e9f57e632398", + "x-ms-file-last-write-time" : "2019-08-24T00:24:57.4536596Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadandclearrange15644dd70e09bf969", "fileapitestsuploadandclearrange80088401f15b5d1bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRangeWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRangeWithArgs.json new file mode 100644 index 000000000000..3526091e490d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndClearRangeWithArgs.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadandclearrangewithargs686787bb5ac21?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297F1E941B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84586-201a-006e-5e12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:57 GMT", + "x-ms-client-request-id" : "77a6e40c-9032-4fc2-803c-0d3828662722" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadandclearrangewithargs686787bb5ac21/fileapitestsuploadandclearrangewithargs11974f13d5289", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:58.8830342Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:57 GMT", + "ETag" : "\"0x8D728297F2FE686\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:58.8830342Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84588-201a-006e-5f12-5a995f000000", + "x-ms-client-request-id" : "21b8d738-6948-4ea8-b863-0677425ecc21", + "x-ms-file-last-write-time" : "2019-08-24T00:24:58.8830342Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadandclearrangewithargs686787bb5ac21/fileapitestsuploadandclearrangewithargs11974f13d5289?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297F384D07\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84589-201a-006e-6012-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:58 GMT", + "x-ms-client-request-id" : "88d17c42-ec8c-4b42-a032-4cc7dbded813", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadandclearrangewithargs686787bb5ac21/fileapitestsuploadandclearrangewithargs11974f13d5289?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297F439A68\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8458a-201a-006e-6112-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:58 GMT", + "x-ms-client-request-id" : "7f3e3778-db41-454f-936f-3ead49b61809" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadandclearrangewithargs686787bb5ac21/fileapitestsuploadandclearrangewithargs11974f13d5289", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:58.8830342Z", + "Content-Range" : "bytes 1-7/22", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:59 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Sat, 24 Aug 2019 00:24:58 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D728297F439A68\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:58.8830342Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "7", + "x-ms-request-id" : "90b8458b-201a-006e-6212-5a995f000000", + "Body" : "[0, 0, 0, 0, 0, 0, 0]", + "x-ms-client-request-id" : "42fc5f86-079e-4348-8981-f027052281d1", + "x-ms-file-last-write-time" : "2019-08-24T00:24:58.8830342Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadandclearrangewithargs686787bb5ac21", "fileapitestsuploadandclearrangewithargs11974f13d5289" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadData.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadData.json new file mode 100644 index 000000000000..25cd97fefd2c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadData.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddata08861cac83ad174c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297D123EBE\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84566-201a-006e-4512-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:54 GMT", + "x-ms-client-request-id" : "2d78d15d-3502-4773-b2f5-fdfd901f639e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddata08861cac83ad174c/fileapitestsuploadanddownloaddata2156249fca18d1fe", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:55.4036894Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:54 GMT", + "ETag" : "\"0x8D728297D1CFE9E\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:55.4036894Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84568-201a-006e-4612-5a995f000000", + "x-ms-client-request-id" : "8361a9dc-4e45-49e6-8607-757bc8b9cbd7", + "x-ms-file-last-write-time" : "2019-08-24T00:24:55.4036894Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddata08861cac83ad174c/fileapitestsuploadanddownloaddata2156249fca18d1fe?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297DB9B35E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84569-201a-006e-4712-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:55 GMT", + "x-ms-client-request-id" : "584d6654-da15-4913-a864-52a212bced1f", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddata08861cac83ad174c/fileapitestsuploadanddownloaddata2156249fca18d1fe", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:55.4036894Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:24:55 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D728297DB9B35E\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:55.4036894Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "7", + "x-ms-request-id" : "90b8456b-201a-006e-4812-5a995f000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "0047054f-b90d-488b-9585-ee5118a1a3f4", + "x-ms-file-last-write-time" : "2019-08-24T00:24:55.4036894Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadanddownloaddata08861cac83ad174c", "fileapitestsuploadanddownloaddata2156249fca18d1fe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs.json new file mode 100644 index 000000000000..9e09b663b614 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs46798e80e255?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297DE70086\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8456e-201a-006e-4b12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:55 GMT", + "x-ms-client-request-id" : "bd8b1142-b4f9-4371-89c6-8d7ce33f6514" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs46798e80e255/fileapitestsuploadanddownloaddatawithargs30298042365e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:56.8060397Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:55 GMT", + "ETag" : "\"0x8D728297DF2F9ED\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:56.8060397Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b84570-201a-006e-4c12-5a995f000000", + "x-ms-client-request-id" : "ff4dcac1-c8d8-4186-91f9-8f35d9290dc3", + "x-ms-file-last-write-time" : "2019-08-24T00:24:56.8060397Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs46798e80e255/fileapitestsuploadanddownloaddatawithargs30298042365e?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297DF9D96A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84571-201a-006e-4d12-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:24:55 GMT", + "x-ms-client-request-id" : "8a5601fa-5ea8-46cd-8c4a-e224b473d65f", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs46798e80e255/fileapitestsuploadanddownloaddatawithargs30298042365e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:24:56.8060397Z", + "Content-Range" : "bytes 1-7/1024", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:56 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Sat, 24 Aug 2019 00:24:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D728297DF9D96A\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:24:56.8060397Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "7", + "x-ms-request-id" : "90b84572-201a-006e-4e12-5a995f000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "935da94a-1b60-484c-bb97-dec4d45c71a5", + "x-ms-file-last-write-time" : "2019-08-24T00:24:56.8060397Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithargs46798e80e255", "fileapitestsuploadanddownloaddatawithargs30298042365e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs0.json new file mode 100644 index 000000000000..0c8a0ffa5b64 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs0.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs085390bdc2eb?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724C76D217E5A\"", + "Last-Modified" : "Mon, 19 Aug 2019 17:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cbbdf281-401a-00b9-0cb0-56d378000000", + "Date" : "Mon, 19 Aug 2019 17:05:23 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs085390bdc2eb/fileapitestsuploadanddownloaddatawithargs081781b03658", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724C76D614771\"", + "Last-Modified" : "Mon, 19 Aug 2019 17:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "cbbdf28d-401a-00b9-16b0-56d378000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 17:05:24 GMT" + } + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithargs085390bdc2eb", "fileapitestsuploadanddownloaddatawithargs081781b03658" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs1.json new file mode 100644 index 000000000000..fff654f66186 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithArgs1.json @@ -0,0 +1,61 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs1211249b3ba2?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724C5E0BF0EED\"", + "Last-Modified" : "Mon, 19 Aug 2019 16:54:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e741bfcc-701a-00b1-0dae-56c80b000000", + "Date" : "Mon, 19 Aug 2019 16:54:18 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs1211249b3ba2/fileapitestsuploadanddownloaddatawithargs123241e54d85", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724C5E0C64520\"", + "Last-Modified" : "Mon, 19 Aug 2019 16:54:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e741bfce-701a-00b1-0eae-56c80b000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 16:54:18 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithargs1211249b3ba2/fileapitestsuploadanddownloaddatawithargs123241e54d85?comp=range", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "e741bfcf-701a-00b1-0fae-56c80b000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:e741bfcf-701a-00b1-0fae-56c80b000000\nTime:2019-08-19T16:54:19.5050337ZContent-Length7", + "Date" : "Mon, 19 Aug 2019 16:54:18 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithargs1211249b3ba2", "fileapitestsuploadanddownloaddatawithargs123241e54d85" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs0.json new file mode 100644 index 000000000000..7b1bd4bc02ae --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs0.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs0438694be?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253D0A70A7D3\"", + "Last-Modified" : "Tue, 20 Aug 2019 07:07:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "02b97ed6-901a-005e-6f25-57c375000000", + "Date" : "Tue, 20 Aug 2019 07:07:18 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs0438694be/fileapitestsuploadanddownloaddatawithinvalidargs082102db9", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253D0B265DCB\"", + "Last-Modified" : "Tue, 20 Aug 2019 07:07:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "02b97eda-901a-005e-7025-57c375000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 07:07:19 GMT" + } + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithinvalidargs0438694be", "fileapitestsuploadanddownloaddatawithinvalidargs082102db9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs1.json new file mode 100644 index 000000000000..814923b2b799 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs1.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs1750279bc?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253B4E0110C1\"", + "Last-Modified" : "Tue, 20 Aug 2019 06:54:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9c4ec858-801a-0086-4824-5764a4000000", + "Date" : "Tue, 20 Aug 2019 06:54:53 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs1750279bc/fileapitestsuploadanddownloaddatawithinvalidargs157651bf8", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253B4E0A0789\"", + "Last-Modified" : "Tue, 20 Aug 2019 06:54:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9c4ec85a-801a-0086-4924-5764a4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 06:54:53 GMT" + } + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithinvalidargs1750279bc", "fileapitestsuploadanddownloaddatawithinvalidargs157651bf8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs2.json new file mode 100644 index 000000000000..a43aa25fa942 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadDataWithInvalidArgs2.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs2910068b3?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253B4E27B50D\"", + "Last-Modified" : "Tue, 20 Aug 2019 06:54:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9c4ec85d-801a-0086-4c24-5764a4000000", + "Date" : "Tue, 20 Aug 2019 06:54:53 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloaddatawithinvalidargs2910068b3/fileapitestsuploadanddownloaddatawithinvalidargs240570680", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7253B4E300F81\"", + "Last-Modified" : "Tue, 20 Aug 2019 06:54:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9c4ec860-801a-0086-4e24-5764a4000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 06:54:53 GMT" + } + } ], + "variables" : [ "fileapitestsuploadanddownloaddatawithinvalidargs2910068b3", "fileapitestsuploadanddownloaddatawithinvalidargs240570680" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadFile.json new file mode 100644 index 000000000000..7d5590524dc1 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadAndDownloadFile.json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloadfile85590e29f75d2bec?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7282980F6AD96\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b845a7-201a-006e-7512-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:25:00 GMT", + "x-ms-client-request-id" : "38dcd202-3e67-4b7c-a2d1-082d8aac736a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloadfile85590e29f75d2bec/fileapitestsuploadanddownloadfile921481030646d3c1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:01.9349635Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:01 GMT", + "ETag" : "\"0x8D7282981019683\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:01.9349635Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "90b845a9-201a-006e-7612-5a995f000000", + "x-ms-client-request-id" : "735190d0-13ea-4b8b-9889-65db5601f6a4", + "x-ms-file-last-write-time" : "2019-08-24T00:25:01.9349635Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloadfile85590e29f75d2bec/fileapitestsuploadanddownloadfile921481030646d3c1?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829810F7CA3\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b845aa-201a-006e-7712-5a995f000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:25:01 GMT", + "x-ms-client-request-id" : "7632a45a-c234-4457-b53e-ed037957c438", + "Content-MD5" : "/CTzx8jXJ1MqqUsC1dJBUQ==" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloadfile85590e29f75d2bec/fileapitestsuploadanddownloadfile921481030646d3c1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:01.9349635Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:02 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:25:01 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829810F7CA3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:01.9349635Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "14", + "x-ms-request-id" : "90b845ab-201a-006e-7812-5a995f000000", + "x-ms-client-request-id" : "e99aedb5-800b-4f79-a571-514bc0f094ff", + "x-ms-file-last-write-time" : "2019-08-24T00:25:01.9349635Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploadanddownloadfile85590e29f75d2bec/fileapitestsuploadanddownloadfile921481030646d3c1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:25:01.9349635Z", + "Content-Range" : "bytes 0-13/14", + "Last-Modified" : "Sat, 24 Aug 2019 00:25:02 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Sat, 24 Aug 2019 00:25:01 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829810F7CA3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:25:01.9349635Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "14", + "x-ms-request-id" : "90b845ac-201a-006e-7912-5a995f000000", + "Body" : "[72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33, 13, 10]", + "x-ms-client-request-id" : "45a2f234-95ba-4e7c-beef-b35fdaf96e12", + "x-ms-file-last-write-time" : "2019-08-24T00:25:01.9349635Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploadanddownloadfile85590e29f75d2bec", "fileapitestsuploadanddownloadfile921481030646d3c1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataError.json new file mode 100644 index 000000000000..2a2844fd393f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataError.json @@ -0,0 +1,46 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddataerror584203af4bef2a8fc4b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D728297E1D8727\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:24:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84575-201a-006e-5112-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:24:56 GMT", + "x-ms-client-request-id" : "566a4ada-6e2e-49c0-9d36-3f3ff21c0495" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddataerror584203af4bef2a8fc4b/fileapitestsuploaddataerror72763c12a663f291c4b?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "90b84577-201a-006e-5212-5a995f000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:90b84577-201a-006e-5212-5a995f000000\nTime:2019-08-24T00:24:57.2420551Z", + "Date" : "Sat, 24 Aug 2019 00:24:56 GMT", + "x-ms-client-request-id" : "07adc92a-b4dd-44f6-881d-6373117ffefb", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileapitestsuploaddataerror584203af4bef2a8fc4b", "fileapitestsuploaddataerror72763c12a663f291c4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs.json new file mode 100644 index 000000000000..0e88a8d6de64 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs57146d3a6d04a7?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D4609A8C32\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:38:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "97febc71-201a-00ed-2ebd-5639f2000000", + "Date" : "Mon, 19 Aug 2019 18:38:06 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs57146d3a6d04a7/fileapitestsuploaddatawithinvalidargs77204babab785a", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D460C7240A\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:38:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "97febc74-201a-00ed-2fbd-5639f2000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:38:06 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs57146d3a6d04a7/fileapitestsuploaddatawithinvalidargs77204babab785a?comp=range", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D460DAB0E4\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:38:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "97febc75-201a-00ed-30bd-5639f2000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:38:06 GMT", + "Content-MD5" : "elk1fjWyWLIF06S9O2lAwA==" + } + } ], + "variables" : [ "fileapitestsuploaddatawithinvalidargs57146d3a6d04a7", "fileapitestsuploaddatawithinvalidargs77204babab785a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs0.json new file mode 100644 index 000000000000..2a24223da39e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs0.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs0047190c269f4a?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D2F57F9DF3\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:27:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5afc17e4-901a-011e-44bb-56acce000000", + "Date" : "Mon, 19 Aug 2019 18:27:57 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs0047190c269f4a/fileapitestsuploaddatawithinvalidargs078827dfe49f97", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D2F5A517DF\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:27:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5afc17e7-901a-011e-45bb-56acce000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:27:57 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs0047190c269f4a/fileapitestsuploaddatawithinvalidargs078827dfe49f97?comp=range", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D2F5AF7AAC\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:27:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5afc17e8-901a-011e-46bb-56acce000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:27:57 GMT", + "Content-MD5" : "elk1fjWyWLIF06S9O2lAwA==" + } + } ], + "variables" : [ "fileapitestsuploaddatawithinvalidargs0047190c269f4a", "fileapitestsuploaddatawithinvalidargs078827dfe49f97" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs1.json new file mode 100644 index 000000000000..f6254e547514 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs1.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs1649912d3c04ff?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D2F5DA7E43\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:27:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5afc17ed-901a-011e-49bb-56acce000000", + "Date" : "Mon, 19 Aug 2019 18:27:58 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs1649912d3c04ff/fileapitestsuploaddatawithinvalidargs18979661b27c94", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D2F5F40EB1\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:27:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5afc17ef-901a-011e-4abb-56acce000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:27:58 GMT" + } + } ], + "variables" : [ "fileapitestsuploaddatawithinvalidargs1649912d3c04ff", "fileapitestsuploaddatawithinvalidargs18979661b27c94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs2.json new file mode 100644 index 000000000000..b7040677138a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs2.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs2013703ba05c2b?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D391BBF830\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:32:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1fb51130-e01a-0133-61bc-562f0e000000", + "Date" : "Mon, 19 Aug 2019 18:32:22 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs2013703ba05c2b/fileapitestsuploaddatawithinvalidargs205558c16bf302", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724D393589438\"", + "Last-Modified" : "Mon, 19 Aug 2019 18:32:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1fb51136-e01a-0133-62bc-562f0e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 18:32:22 GMT" + } + } ], + "variables" : [ "fileapitestsuploaddatawithinvalidargs2013703ba05c2b", "fileapitestsuploaddatawithinvalidargs205558c16bf302" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs3.json new file mode 100644 index 000000000000..2a3f0251973d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAPITestsUploadDataWithInvalidArgs3.json @@ -0,0 +1,41 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs36430439b335f3?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724CB6505836C\"", + "Last-Modified" : "Mon, 19 Aug 2019 17:33:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b2cb19d0-201a-0003-2ab4-563371000000", + "Date" : "Mon, 19 Aug 2019 17:33:48 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileapitestsuploaddatawithinvalidargs36430439b335f3/fileapitestsuploaddatawithinvalidargs305635b423b9e9", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D724CB6510C786\"", + "Last-Modified" : "Mon, 19 Aug 2019 17:33:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b2cb19d5-201a-0003-2db4-563371000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 19 Aug 2019 17:33:48 GMT" + } + } ], + "variables" : [ "fileapitestsuploaddatawithinvalidargs36430439b335f3", "fileapitestsuploaddatawithinvalidargs305635b423b9e9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeError.json new file mode 100644 index 000000000000..62e5cc277081 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeError.json @@ -0,0 +1,96 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsclearrangeerror45921ec879d9d607?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D4CEEB12\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce453-801a-010a-4512-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:22 GMT", + "x-ms-client-request-id" : "6c3c841e-62f7-4c2c-a558-afb68557edef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsclearrangeerror45921ec879d9d607/fileasyncapitestsclearrangeerror9758981ebef82f0e", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:22.5841160Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:22 GMT", + "ETag" : "\"0x8D72829D4D6F208\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:22.5841160Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce455-801a-010a-4612-5a6faa000000", + "x-ms-client-request-id" : "af2013ba-fd53-402c-9511-edb711b5b963", + "x-ms-file-last-write-time" : "2019-08-24T00:27:22.5841160Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsclearrangeerror45921ec879d9d607/fileasyncapitestsclearrangeerror9758981ebef82f0e?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D4DD8365\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce456-801a-010a-4712-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:22 GMT", + "x-ms-client-request-id" : "f8ce05f5-78ed-4f8e-bd69-4d13fc61c146", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsclearrangeerror45921ec879d9d607/fileasyncapitestsclearrangeerror9758981ebef82f0e?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidRange", + "retry-after" : "0", + "Content-Length" : "249", + "StatusCode" : "416", + "x-ms-request-id" : "42bce457-801a-010a-4812-5a6faa000000", + "Body" : "InvalidRangeThe range specified is invalid for the current size of the resource.\nRequestId:42bce457-801a-010a-4812-5a6faa000000\nTime:2019-08-24T00:27:22.8898500Z", + "Date" : "Sat, 24 Aug 2019 00:27:22 GMT", + "x-ms-client-request-id" : "61f7d680-972a-4944-b609-af6e9703f3e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsclearrangeerror45921ec879d9d607", "fileasyncapitestsclearrangeerror9758981ebef82f0e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeErrorArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeErrorArgs.json new file mode 100644 index 000000000000..fef86db870d4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsClearRangeErrorArgs.json @@ -0,0 +1,96 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsclearrangeerrorargs5523603f776d3e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D51AD39D\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce45a-801a-010a-4b12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:22 GMT", + "x-ms-client-request-id" : "3e78d8eb-8fbf-4927-be48-74a2137054ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsclearrangeerrorargs5523603f776d3e/fileasyncapitestsclearrangeerrorargs85901bdeb05e3b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:23.1186286Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:22 GMT", + "ETag" : "\"0x8D72829D528816E\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:23.1186286Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce45d-801a-010a-4c12-5a6faa000000", + "x-ms-client-request-id" : "5485a159-1607-4ac6-94fe-86e68d340a99", + "x-ms-file-last-write-time" : "2019-08-24T00:27:23.1186286Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsclearrangeerrorargs5523603f776d3e/fileasyncapitestsclearrangeerrorargs85901bdeb05e3b?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D54CDB4B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce460-801a-010a-4f12-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:22 GMT", + "x-ms-client-request-id" : "a57fcc6e-f246-4b0c-b5b1-1849f97c357f", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsclearrangeerrorargs5523603f776d3e/fileasyncapitestsclearrangeerrorargs85901bdeb05e3b?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidRange", + "retry-after" : "0", + "Content-Length" : "249", + "StatusCode" : "416", + "x-ms-request-id" : "42bce461-801a-010a-5012-5a6faa000000", + "Body" : "InvalidRangeThe range specified is invalid for the current size of the resource.\nRequestId:42bce461-801a-010a-5012-5a6faa000000\nTime:2019-08-24T00:27:23.3993345Z", + "Date" : "Sat, 24 Aug 2019 00:27:22 GMT", + "x-ms-client-request-id" : "822d2e1b-2ca8-4690-a54a-1be149198077", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsclearrangeerrorargs5523603f776d3e", "fileasyncapitestsclearrangeerrorargs85901bdeb05e3b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFile.json new file mode 100644 index 000000000000..413047ca8349 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFile.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefile7865873e611d586754e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D2CA388F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce414-801a-010a-1512-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:18 GMT", + "x-ms-client-request-id" : "d3ce364e-93f7-4da1-a47a-4f27a1cbd83b" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefile7865873e611d586754e", "fileasyncapitestscreatefile9689055509119023643" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileError.json new file mode 100644 index 000000000000..ad10e2e7ae24 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefileerror6671479681b4f75d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D2EE6B33\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce418-801a-010a-1812-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:18 GMT", + "x-ms-client-request-id" : "3fa6c79c-2136-4902-aefc-894f420c9764" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefileerror6671479681b4f75d/fileasyncapitestscreatefileerror70073a6542b2a11c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "42bce41b-801a-010a-1912-5a6faa000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:42bce41b-801a-010a-1912-5a6faa000000\nTime:2019-08-24T00:27:19.5166346Z", + "Date" : "Sat, 24 Aug 2019 00:27:19 GMT", + "x-ms-client-request-id" : "9c9bf91e-223c-4ee0-a313-ab3fe1a62ded", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefileerror6671479681b4f75d", "fileasyncapitestscreatefileerror70073a6542b2a11c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgs.json new file mode 100644 index 000000000000..4835a5de1370 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgs.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefilewithargs574250f54b380d3?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D3178102\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce41e-801a-010a-1c12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:19 GMT", + "x-ms-client-request-id" : "4779848f-effd-4139-8105-fbbc753e23dd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefilewithargs574250f54b380d3/fileasyncapitestscreatefilewithargs88281c2ef4c336c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:19.7073491Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:19 GMT", + "ETag" : "\"0x8D72829D31FFC53\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:19.7073491Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce420-801a-010a-1d12-5a6faa000000", + "x-ms-client-request-id" : "0b104e88-31c4-4e7a-a296-0e99c8d1b2ea", + "x-ms-file-last-write-time" : "2019-08-24T00:27:19.7073491Z" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefilewithargs574250f54b380d3", "fileasyncapitestscreatefilewithargs88281c2ef4c336c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError0.json new file mode 100644 index 000000000000..c0d138ccdb0c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError0.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefilewithargserror088383948a869?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D338A5B0\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce423-801a-010a-2012-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:19 GMT", + "x-ms-client-request-id" : "9e78b160-ea53-4784-b024-ab1930cd29ce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefilewithargserror088383948a869/fileasyncapitestscreatefilewithargserror0281145933dd7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "42bce425-801a-010a-2112-5a6faa000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:42bce425-801a-010a-2112-5a6faa000000\nTime:2019-08-24T00:27:19.9160148Z", + "Date" : "Sat, 24 Aug 2019 00:27:19 GMT", + "x-ms-client-request-id" : "bf03816e-b567-4f14-94ce-5c3a1a52877c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefilewithargserror088383948a869", "fileasyncapitestscreatefilewithargserror0281145933dd7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError1.json new file mode 100644 index 000000000000..7364df8677bf --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsCreateFileWithArgsError1.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefilewithargserror1026515d319b6?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D35498DA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce428-801a-010a-2412-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:19 GMT", + "x-ms-client-request-id" : "8d4cca63-649d-47bf-a6bf-fdbb8f54d767" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestscreatefilewithargserror1026515d319b6/fileasyncapitestscreatefilewithargserror1232771965e50", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "1052", + "StatusCode" : "403", + "x-ms-request-id" : "42bce42a-801a-010a-2512-5a6faa000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:42bce42a-801a-010a-2512-5a6faa000000\nTime:2019-08-24T00:27:20.0981877ZThe MAC signature found in the HTTP request '4uQ22IXjSct725RNWhNnsBZMx4O/mAr+VwZLZaBbN7s=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nSat, 24 Aug 2019 00:27:20 GMT\n\n\n\n\n\nx-ms-client-request-id:c079a305-bc82-4c5f-baf6-b061d4963941\nx-ms-content-language:en\nx-ms-content-length:1024\nx-ms-content-type:application/octet-stream\nx-ms-file-attributes:None\nx-ms-file-creation-time:now\nx-ms-file-last-write-time:now\nx-ms-file-permission:inherit\nx-ms-meta-testmeta:value\nx-ms-type:file\nx-ms-version:2019-02-02\n/azstoragesdkaccount/fileasyncapitestscreatefilewithargserror1026515d319b6/fileasyncapitestscreatefilewithargserror1232771965e50'.", + "Date" : "Sat, 24 Aug 2019 00:27:19 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestscreatefilewithargserror1026515d319b6", "fileasyncapitestscreatefilewithargserror1232771965e50" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFile.json new file mode 100644 index 000000000000..f7434cb5db3a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFile.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsdeletefile16093e9b7a31ed19b45?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D775351F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce47a-801a-010a-6412-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:26 GMT", + "x-ms-client-request-id" : "42a02e93-07d1-4608-bf80-bb4aafca7ed3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsdeletefile16093e9b7a31ed19b45/fileasyncapitestsdeletefile885949af8965c367a47", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:27.0183757Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:26 GMT", + "ETag" : "\"0x8D72829D77B8F4D\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:27.0183757Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce47c-801a-010a-6512-5a6faa000000", + "x-ms-client-request-id" : "0c4a42be-4525-4595-8a43-295e0a429a61", + "x-ms-file-last-write-time" : "2019-08-24T00:27:27.0183757Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsdeletefile16093e9b7a31ed19b45/fileasyncapitestsdeletefile885949af8965c367a47", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "42bce47d-801a-010a-6612-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:26 GMT", + "x-ms-client-request-id" : "f7f33c50-e9a0-4832-9730-adc83728f1d8" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsdeletefile16093e9b7a31ed19b45", "fileasyncapitestsdeletefile885949af8965c367a47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFileError.json new file mode 100644 index 000000000000..aba393111573 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDeleteFileError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsdeletefileerror40996f3a723a3804?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D794D2B2\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce480-801a-010a-6912-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:26 GMT", + "x-ms-client-request-id" : "31b2403e-2f4c-4209-967e-f8bd5290f8e6" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsdeletefileerror40996f3a723a3804/fileasyncapitestsdeletefileerror84962adbc34796ce", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "42bce482-801a-010a-6a12-5a6faa000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:42bce482-801a-010a-6a12-5a6faa000000\nTime:2019-08-24T00:27:27.3490983Z", + "Date" : "Sat, 24 Aug 2019 00:27:26 GMT", + "x-ms-client-request-id" : "e0a19fac-56f7-4373-af21-878326373bee", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsdeletefileerror40996f3a723a3804", "fileasyncapitestsdeletefileerror84962adbc34796ce" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDownloadDataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDownloadDataError.json new file mode 100644 index 000000000000..18d8f43d908e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsDownloadDataError.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsdownloaddataerror9017614ae5c65ae?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D45E5A79\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce443-801a-010a-3812-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:21 GMT", + "x-ms-client-request-id" : "5f27fdee-974f-463f-a410-3d8a207d5b60" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsdownloaddataerror9017614ae5c65ae", "fileasyncapitestsdownloaddataerror011972b7a2dfa34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetFileURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetFileURL.json new file mode 100644 index 000000000000..32e205617e43 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetFileURL.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsgetfileurl15542bef2dca9ea5248?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D2B6ABCC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce410-801a-010a-1212-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:18 GMT", + "x-ms-client-request-id" : "5183fe12-aeed-4ff4-802c-011007fe1063" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsgetfileurl15542bef2dca9ea5248", "fileasyncapitestsgetfileurl79484a4c2c57e325546" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetProperties.json new file mode 100644 index 000000000000..a8f3099bb388 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetProperties.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsgetproperties79620ecbcb9b8c6d4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D7BF215B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce485-801a-010a-6d12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:26 GMT", + "x-ms-client-request-id" : "035b6599-3299-4da5-827a-4e0b8b04aab2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsgetproperties79620ecbcb9b8c6d4/fileasyncapitestsgetproperties12146b72817e8165c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:27.5128519Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "ETag" : "\"0x8D72829D7C702C7\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:27.5128519Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce487-801a-010a-6e12-5a6faa000000", + "x-ms-client-request-id" : "e3c70303-3a78-484a-96ea-11daa3fee39e", + "x-ms-file-last-write-time" : "2019-08-24T00:27:27.5128519Z" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsgetproperties79620ecbcb9b8c6d4", "fileasyncapitestsgetproperties12146b72817e8165c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..0a3fc0fbe74d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetPropertiesError.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsgetpropertieserror79652d8a71ae2f7?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D7DD8630\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce48a-801a-010a-7112-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "x-ms-client-request-id" : "f228a626-3874-42d2-86c8-bf8ac48fa1c1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsgetpropertieserror79652d8a71ae2f7/fileasyncapitestsgetpropertieserror204176decfba0b1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "42bce48c-801a-010a-7212-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "x-ms-client-request-id" : "00e8c72e-8db2-47ac-b2a2-61ac93b458a8" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsgetpropertieserror79652d8a71ae2f7", "fileasyncapitestsgetpropertieserror204176decfba0b1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..0851ba19f949 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsGetSnapshotId.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsgetsnapshotid6479784306d70eda7?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DC3481EA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4cb-801a-010a-2412-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:34 GMT", + "x-ms-client-request-id" : "4f41ecae-d5e4-407c-9a58-4d8d717ff1b7" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsgetsnapshotid6479784306d70eda7", "fileasyncapitestsgetsnapshotid88247276d2a0dc1a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandles.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandles.json new file mode 100644 index 000000000000..b4fe8fcd7674 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandles.json @@ -0,0 +1,72 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslisthandles64802dcd58203532a4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DBE3DD37\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4bf-801a-010a-1a12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:33 GMT", + "x-ms-client-request-id" : "4e8e73cc-f8b1-4d40-b745-e32791cab484" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslisthandles64802dcd58203532a4/fileasyncapitestslisthandles29267b1dcebaa8e404", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:34.4575243Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:33 GMT", + "ETag" : "\"0x8D72829DBEAAF0B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:34.4575243Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce4c1-801a-010a-1b12-5a6faa000000", + "x-ms-client-request-id" : "10447dbe-a038-46c2-952d-843b6bd1d6c9", + "x-ms-file-last-write-time" : "2019-08-24T00:27:34.4575243Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslisthandles64802dcd58203532a4/fileasyncapitestslisthandles29267b1dcebaa8e404?comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "42bce4c2-801a-010a-1c12-5a6faa000000", + "Body" : "", + "Date" : "Sat, 24 Aug 2019 00:27:34 GMT", + "x-ms-client-request-id" : "49e81311-c03d-44d3-a55b-5e85e85fd457", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestslisthandles64802dcd58203532a4", "fileasyncapitestslisthandles29267b1dcebaa8e404" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandlesWithMaxResult.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandlesWithMaxResult.json new file mode 100644 index 000000000000..b337c2895394 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListHandlesWithMaxResult.json @@ -0,0 +1,72 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslisthandleswithmaxresult0897807a5f87?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DC0F1676\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4c5-801a-010a-1f12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:34 GMT", + "x-ms-client-request-id" : "4f6d5133-e045-4886-a3c3-80fc3cbaa6a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslisthandleswithmaxresult0897807a5f87/fileasyncapitestslisthandleswithmaxresult61046c584e21", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:34.7458003Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:34 GMT", + "ETag" : "\"0x8D72829DC16ABD3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:34.7458003Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce4c7-801a-010a-2012-5a6faa000000", + "x-ms-client-request-id" : "ff71cd82-7bab-4350-958d-20877cc3abd1", + "x-ms-file-last-write-time" : "2019-08-24T00:27:34.7458003Z" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslisthandleswithmaxresult0897807a5f87/fileasyncapitestslisthandleswithmaxresult61046c584e21?maxresults=2&comp=listhandles", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "42bce4c8-801a-010a-2112-5a6faa000000", + "Body" : "2", + "Date" : "Sat, 24 Aug 2019 00:27:34 GMT", + "x-ms-client-request-id" : "9ebfb62e-d05a-46c7-a3ee-12c606d0867f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestslisthandleswithmaxresult0897807a5f87", "fileasyncapitestslisthandleswithmaxresult61046c584e21" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRanges.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRanges.json new file mode 100644 index 000000000000..8069f50a7f46 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRanges.json @@ -0,0 +1,98 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslistranges28137a6a2034eb3b242?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D87E5A33\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4a4-801a-010a-0612-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:28 GMT", + "x-ms-client-request-id" : "0454f451-bedb-4ef1-b894-45a8435be44d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslistranges28137a6a2034eb3b242/fileasyncapitestslistranges425301245fd1523e846", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:28.7640544Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:28 GMT", + "ETag" : "\"0x8D72829D885EDE0\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:28.7640544Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce4a6-801a-010a-0712-5a6faa000000", + "x-ms-client-request-id" : "deae3449-7ae7-45f1-834b-45276a02a9ce", + "x-ms-file-last-write-time" : "2019-08-24T00:27:28.7640544Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslistranges28137a6a2034eb3b242/fileasyncapitestslistranges425301245fd1523e846?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D88FDB5D\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4a7-801a-010a-0812-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:28 GMT", + "x-ms-client-request-id" : "78e5558c-9fab-4539-bfc5-ae61d04944bd", + "Content-MD5" : "DzQ7CTESaiDxM9Z8KwGKOw==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslistranges28137a6a2034eb3b242/fileasyncapitestslistranges425301245fd1523e846?comp=rangelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-length" : "1024", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:33 GMT", + "ETag" : "\"0x8D72829D88FDB5D\"", + "x-ms-request-id" : "42bce4a8-801a-010a-0912-5a6faa000000", + "Body" : "01023", + "x-ms-client-request-id" : "435ee434-de57-4479-b023-160c7d3303c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestslistranges28137a6a2034eb3b242", "fileasyncapitestslistranges425301245fd1523e846", "filefileasyncapitestslistranges6364323652fc6dc323" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRangesWithRange.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRangesWithRange.json new file mode 100644 index 000000000000..f2abde93275d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsListRangesWithRange.json @@ -0,0 +1,98 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslistrangeswithrange27464de83c057e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DB9386A1\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4b8-801a-010a-1412-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:33 GMT", + "x-ms-client-request-id" : "31a35eed-d6e8-4a90-ba85-03d533f720a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslistrangeswithrange27464de83c057e/fileasyncapitestslistrangeswithrange92478a0f2f6582", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:33.9340223Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:33 GMT", + "ETag" : "\"0x8D72829DB9ACDBF\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:33.9340223Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce4ba-801a-010a-1512-5a6faa000000", + "x-ms-client-request-id" : "c88c293d-4767-4cd3-93c1-82a30d62a94f", + "x-ms-file-last-write-time" : "2019-08-24T00:27:33.9340223Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslistrangeswithrange27464de83c057e/fileasyncapitestslistrangeswithrange92478a0f2f6582?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DBA297D6\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4bb-801a-010a-1612-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:33 GMT", + "x-ms-client-request-id" : "36d5bd1e-4b4a-4fb0-9da5-ecf3c2cd90c5", + "Content-MD5" : "DzQ7CTESaiDxM9Z8KwGKOw==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestslistrangeswithrange27464de83c057e/fileasyncapitestslistrangeswithrange92478a0f2f6582?comp=rangelist", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-length" : "1024", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:33 GMT", + "ETag" : "\"0x8D72829DBA297D6\"", + "x-ms-request-id" : "42bce4bc-801a-010a-1712-5a6faa000000", + "Body" : "0511", + "x-ms-client-request-id" : "4a5c3ab1-f862-4534-9b06-d4000de26230", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestslistrangeswithrange27464de83c057e", "fileasyncapitestslistrangeswithrange92478a0f2f6582", "filefileasyncapitestslistrangeswithranged4873311860481" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeaders.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeaders.json new file mode 100644 index 000000000000..7a7a9946c796 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeaders.json @@ -0,0 +1,60 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssethttpheaders467121549c0a0e13c?restype=share", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EC38D19D4\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:52:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "249cbc1a-e01a-005a-5677-5736f7000000", + "Date" : "Tue, 20 Aug 2019 16:52:19 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssethttpheaders467121549c0a0e13c/fileasyncapitestssethttpheaders35140873ebe2bc4bd", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EC392E9A5\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:52:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "249cbc1d-e01a-005a-5777-5736f7000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 16:52:19 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssethttpheaders467121549c0a0e13c/fileasyncapitestssethttpheaders35140873ebe2bc4bd?comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7258EC39A8CA8\"", + "Last-Modified" : "Tue, 20 Aug 2019 16:52:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "249cbc1e-e01a-005a-5877-5736f7000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Tue, 20 Aug 2019 16:52:19 GMT" + } + } ], + "variables" : [ "fileasyncapitestssethttpheaders467121549c0a0e13c", "fileasyncapitestssethttpheaders35140873ebe2bc4bd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersError.json new file mode 100644 index 000000000000..4b124f441c8a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetHttpHeadersError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssethttpheaderserror456586b2b7abdd?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D7FC6058\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce48f-801a-010a-7512-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "x-ms-client-request-id" : "2c4c2524-4650-4371-b998-91d5ca4f5bdd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssethttpheaderserror456586b2b7abdd/fileasyncapitestssethttpheaderserror81183f7182d5e4", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:27.9122371Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "ETag" : "\"0x8D72829D803F3C3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:27.9122371Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce491-801a-010a-7612-5a6faa000000", + "x-ms-client-request-id" : "45042e01-e778-4edd-a09c-dd697c8b8653", + "x-ms-file-last-write-time" : "2019-08-24T00:27:27.9122371Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssethttpheaderserror456586b2b7abdd/fileasyncapitestssethttpheaderserror81183f7182d5e4?comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "42bce492-801a-010a-7712-5a6faa000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:42bce492-801a-010a-7712-5a6faa000000\nTime:2019-08-24T00:27:27.9786980Z", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "x-ms-client-request-id" : "5e4ab12e-e2d3-4522-bc9d-410d5bbceb8d", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestssethttpheaderserror456586b2b7abdd", "fileasyncapitestssethttpheaderserror81183f7182d5e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadata.json new file mode 100644 index 000000000000..ae49aaa8fcdd --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadata.json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssetmetadata011241cac7dd1db704?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D8248B8F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce496-801a-010a-7a12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "x-ms-client-request-id" : "5b8e600e-9af7-452e-af46-4da196c1f2e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssetmetadata011241cac7dd1db704/fileasyncapitestssetmetadata7101029afb567a4664", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:28.1744883Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "ETag" : "\"0x8D72829D82BF7F3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:28.1744883Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce498-801a-010a-7b12-5a6faa000000", + "x-ms-client-request-id" : "90007be7-10e9-42f2-bf08-f51e8c654675", + "x-ms-file-last-write-time" : "2019-08-24T00:27:28.1744883Z" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssetmetadata011241cac7dd1db704/fileasyncapitestssetmetadata7101029afb567a4664", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:28.1744883Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829D82BF7F3\"", + "x-ms-file-attributes" : "Archive", + "x-ms-meta-testmetadata" : "value", + "x-ms-file-change-time" : "2019-08-24T00:27:28.1744883Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "1024", + "x-ms-request-id" : "42bce499-801a-010a-7c12-5a6faa000000", + "x-ms-client-request-id" : "9c3e7a57-1f3d-4b7d-a8a3-381274bf5b9e", + "x-ms-file-last-write-time" : "2019-08-24T00:27:28.1744883Z", + "Content-Language" : "en", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssetmetadata011241cac7dd1db704/fileasyncapitestssetmetadata7101029afb567a4664?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D83A2C3C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "42bce49a-801a-010a-7d12-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "x-ms-client-request-id" : "fd2f3682-71b2-4f22-b866-73bcd9d8fb97" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssetmetadata011241cac7dd1db704/fileasyncapitestssetmetadata7101029afb567a4664", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-meta-update" : "value", + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:28.1744883Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829D83A2C3C\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:28.2675772Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "1024", + "x-ms-request-id" : "42bce49b-801a-010a-7e12-5a6faa000000", + "x-ms-client-request-id" : "6623c4e1-bf3e-4e15-a3bb-3b1a7a80e11a", + "x-ms-file-last-write-time" : "2019-08-24T00:27:28.1744883Z", + "Content-Language" : "en", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestssetmetadata011241cac7dd1db704", "fileasyncapitestssetmetadata7101029afb567a4664" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadataError.json new file mode 100644 index 000000000000..34f4a21a35ef --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsSetMetadataError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssetmetadataerror28466465e077b7c7?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D8514BC3\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce49e-801a-010a-0112-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:27 GMT", + "x-ms-client-request-id" : "d6a5d6fc-c286-4d63-b87b-1ecc1374ed3b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssetmetadataerror28466465e077b7c7/fileasyncapitestssetmetadataerror89085c679be2a5b6", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:28.5048060Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:28 GMT", + "ETag" : "\"0x8D72829D85E5EFC\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:28.5048060Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce4a0-801a-010a-0212-5a6faa000000", + "x-ms-client-request-id" : "4bdc9df2-fd01-4cfb-af83-c54e7db5b8b5", + "x-ms-file-last-write-time" : "2019-08-24T00:27:28.5048060Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestssetmetadataerror28466465e077b7c7/fileasyncapitestssetmetadataerror89085c679be2a5b6?comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "42bce4a1-801a-010a-0312-5a6faa000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:42bce4a1-801a-010a-0312-5a6faa000000\nTime:2019-08-24T00:27:28.5782682Zvalue", + "Date" : "Sat, 24 Aug 2019 00:27:28 GMT", + "x-ms-client-request-id" : "7872f553-6eb2-415c-a3f7-4e669c80deac", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestssetmetadataerror28466465e077b7c7", "fileasyncapitestssetmetadataerror89085c679be2a5b6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopy.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopy.json new file mode 100644 index 000000000000..c88dd447bcc4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopy.json @@ -0,0 +1,74 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsstartcopy50637f3d26d20f1ff48?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D59EA2AA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce46c-801a-010a-5a12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "x-ms-client-request-id" : "28a4f908-455c-4a0d-880a-829abe71ed86" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsstartcopy50637f3d26d20f1ff48/fileasyncapitestsstartcopy07260156c49fe6d2f4c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:23.9334154Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "ETag" : "\"0x8D72829D5A4D50A\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:23.9334154Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce46e-801a-010a-5b12-5a6faa000000", + "x-ms-client-request-id" : "5055b5c3-4787-44db-a239-011db101b60a", + "x-ms-file-last-write-time" : "2019-08-24T00:27:23.9334154Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsstartcopy50637f3d26d20f1ff48/fileasyncapitestsstartcopy07260156c49fe6d2f4c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "fee63cc2-e27e-42a0-8fc1-36588f52e807", + "ETag" : "\"0x8D72829D726A3BB\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "42bce46f-801a-010a-5c12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:25 GMT", + "x-ms-client-request-id" : "9d7395f5-5020-4edf-8ee2-3b08e1e02a95" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsstartcopy50637f3d26d20f1ff48", "fileasyncapitestsstartcopy07260156c49fe6d2f4c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopyError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopyError.json new file mode 100644 index 000000000000..d7fe7c4dc108 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsStartCopyError.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsstartcopyerror260587fd73ed9f9e2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D73D0060\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce474-801a-010a-5f12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:26 GMT", + "x-ms-client-request-id" : "433e082d-aca1-4c46-ba93-701aa57764a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsstartcopyerror260587fd73ed9f9e2/fileasyncapitestsstartcopyerror78135aa3dc9a45e0d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:26.6630347Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:26 GMT", + "ETag" : "\"0x8D72829D74556CB\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:26.6630347Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce476-801a-010a-6012-5a6faa000000", + "x-ms-client-request-id" : "3a8b0a6c-8515-48af-b2f2-30728b51581a", + "x-ms-file-last-write-time" : "2019-08-24T00:27:26.6630347Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsstartcopyerror260587fd73ed9f9e2/fileasyncapitestsstartcopyerror78135aa3dc9a45e0d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "330", + "StatusCode" : "400", + "x-ms-request-id" : "42bce477-801a-010a-6112-5a6faa000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:42bce477-801a-010a-6112-5a6faa000000\nTime:2019-08-24T00:27:26.8356096Zx-ms-copy-sourcesome url", + "Date" : "Sat, 24 Aug 2019 00:27:26 GMT", + "x-ms-client-request-id" : "317dba6a-ee84-41e7-94a6-96e5212abac6", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsstartcopyerror260587fd73ed9f9e2", "fileasyncapitestsstartcopyerror78135aa3dc9a45e0d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRange.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRange.json new file mode 100644 index 000000000000..a3b286ce8ebc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRange.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadandclearrange2749861335cdfe?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D47123B9\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce447-801a-010a-3b12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:21 GMT", + "x-ms-client-request-id" : "13de2c55-4e52-4ad2-b3a8-1bf9d702af44" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadandclearrange2749861335cdfe/fileasyncapitestsuploadandclearrange90344c3dfd83b2", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:21.9625211Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:21 GMT", + "ETag" : "\"0x8D72829D47818FB\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:21.9625211Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce449-801a-010a-3c12-5a6faa000000", + "x-ms-client-request-id" : "8106abf1-3b50-4a2f-a0b9-4c4ae6b52cda", + "x-ms-file-last-write-time" : "2019-08-24T00:27:21.9625211Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadandclearrange2749861335cdfe/fileasyncapitestsuploadandclearrange90344c3dfd83b2?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D47E34F6\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce44a-801a-010a-3d12-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:21 GMT", + "x-ms-client-request-id" : "f7df555f-e2eb-458e-b3c2-18f49773546b", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadandclearrange2749861335cdfe", "fileasyncapitestsuploadandclearrange90344c3dfd83b2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRangeWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRangeWithArgs.json new file mode 100644 index 000000000000..4ea8c0f36143 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndClearRangeWithArgs.json @@ -0,0 +1,75 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadandclearrangewithargs70246964b2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D49752B0\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce44d-801a-010a-4012-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:21 GMT", + "x-ms-client-request-id" : "ac6dae19-a73e-41d7-81ce-db62cfecf438" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadandclearrangewithargs70246964b2/fileasyncapitestsuploadandclearrangewithargs16465ff470", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:22.2848293Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:21 GMT", + "ETag" : "\"0x8D72829D4A94725\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:22.2848293Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce44f-801a-010a-4112-5a6faa000000", + "x-ms-client-request-id" : "660e7eff-c43a-494d-8d54-6ed9a5d33442", + "x-ms-file-last-write-time" : "2019-08-24T00:27:22.2848293Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadandclearrangewithargs70246964b2/fileasyncapitestsuploadandclearrangewithargs16465ff470?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D4AFD873\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce450-801a-010a-4212-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:21 GMT", + "x-ms-client-request-id" : "818ee8b9-c325-4ae5-a99b-5deb0c4bbff0", + "Content-MD5" : "A5momLrihyOacM8O00uT1g==" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadandclearrangewithargs70246964b2", "fileasyncapitestsuploadandclearrangewithargs16465ff470" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadData.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadData.json new file mode 100644 index 000000000000..af342ec55d3c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadData.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloaddata65220c1c669d2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D370B345\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce42d-801a-010a-2812-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:19 GMT", + "x-ms-client-request-id" : "494699c2-97fb-4083-9f45-f41f3b1a4322" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloaddata65220c1c669d2/fileasyncapitestsuploadanddownloaddata2230188df38f7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:20.4290427Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:19 GMT", + "ETag" : "\"0x8D72829D38E1B7B\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:20.4290427Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce42f-801a-010a-2912-5a6faa000000", + "x-ms-client-request-id" : "25e592a7-000a-4479-876a-c5036759d8c0", + "x-ms-file-last-write-time" : "2019-08-24T00:27:20.4290427Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloaddata65220c1c669d2/fileasyncapitestsuploadanddownloaddata2230188df38f7?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D3A1A84E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce430-801a-010a-2a12-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:20 GMT", + "x-ms-client-request-id" : "f31b1b68-6974-4ac8-8715-a1a0685078bc", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloaddata65220c1c669d2/fileasyncapitestsuploadanddownloaddata2230188df38f7", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:20.4290427Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:20 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829D3A1A84E\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:20.4290427Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "7", + "x-ms-request-id" : "42bce432-801a-010a-2b12-5a6faa000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "a4a32f3d-9c69-4f9e-b16e-24f4546f47e8", + "x-ms-file-last-write-time" : "2019-08-24T00:27:20.4290427Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadanddownloaddata65220c1c669d2", "fileasyncapitestsuploadanddownloaddata2230188df38f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadDataWithArgs.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadDataWithArgs.json new file mode 100644 index 000000000000..30aec5c9fade --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadDataWithArgs.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloaddatawithargs602834dec?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D3D5A81B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce435-801a-010a-2e12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:20 GMT", + "x-ms-client-request-id" : "9e474fbd-35e7-4385-a137-2f0ce93925f0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloaddatawithargs602834dec/fileasyncapitestsuploadanddownloaddatawithargs33706602d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:20.9435386Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:20 GMT", + "ETag" : "\"0x8D72829D3DC9CFA\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:20.9435386Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce437-801a-010a-2f12-5a6faa000000", + "x-ms-client-request-id" : "1cf9ffa6-c07a-4bf1-9d32-184e45c0db9b", + "x-ms-file-last-write-time" : "2019-08-24T00:27:20.9435386Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloaddatawithargs602834dec/fileasyncapitestsuploadanddownloaddatawithargs33706602d?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D3E578CA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce438-801a-010a-3012-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:20 GMT", + "x-ms-client-request-id" : "a73521de-e20b-4941-84a0-791b8180bfff", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloaddatawithargs602834dec/fileasyncapitestsuploadanddownloaddatawithargs33706602d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:20.9435386Z", + "Content-Range" : "bytes 1-7/1024", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:21 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Sat, 24 Aug 2019 00:27:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829D3E578CA\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:20.9435386Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "7", + "x-ms-request-id" : "42bce439-801a-010a-3112-5a6faa000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "b47ec24a-d989-4826-a987-7a87e7328f72", + "x-ms-file-last-write-time" : "2019-08-24T00:27:20.9435386Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadanddownloaddatawithargs602834dec", "fileasyncapitestsuploadanddownloaddatawithargs33706602d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadFile.json new file mode 100644 index 000000000000..a0342f59bf93 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadAndDownloadFile.json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloadfile3442535644b75?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D5686A47\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce464-801a-010a-5312-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "x-ms-client-request-id" : "0d9215b3-71c3-40da-b21b-0299f7fa2d61" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloadfile3442535644b75/fileasyncapitestsuploadanddownloadfile426393d2d82df", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:23.5860803Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "ETag" : "\"0x8D72829D56FD543\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:23.5860803Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "42bce466-801a-010a-5412-5a6faa000000", + "x-ms-client-request-id" : "3753e638-b01e-417e-ba59-4f60bb88d5fd", + "x-ms-file-last-write-time" : "2019-08-24T00:27:23.5860803Z" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloadfile3442535644b75/fileasyncapitestsuploadanddownloadfile426393d2d82df?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D577512F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce467-801a-010a-5512-5a6faa000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "x-ms-client-request-id" : "e5720200-126a-406e-b08d-9dcad5329801", + "Content-MD5" : "/CTzx8jXJ1MqqUsC1dJBUQ==" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloadfile3442535644b75/fileasyncapitestsuploadanddownloadfile426393d2d82df", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:23.5860803Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829D577512F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:23.5860803Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "14", + "x-ms-request-id" : "42bce468-801a-010a-5612-5a6faa000000", + "x-ms-client-request-id" : "5fe729c5-4987-491d-a0b1-91e96903cc61", + "x-ms-file-last-write-time" : "2019-08-24T00:27:23.5860803Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploadanddownloadfile3442535644b75/fileasyncapitestsuploadanddownloadfile426393d2d82df", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:23.5860803Z", + "Content-Range" : "bytes 0-13/14", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:23 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Sat, 24 Aug 2019 00:27:23 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", + "ETag" : "\"0x8D72829D577512F\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:23.5860803Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "14", + "x-ms-request-id" : "42bce469-801a-010a-5712-5a6faa000000", + "Body" : "[72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33, 13, 10]", + "x-ms-client-request-id" : "38868217-e85c-443a-a704-60144361e150", + "x-ms-file-last-write-time" : "2019-08-24T00:27:23.5860803Z", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploadanddownloadfile3442535644b75", "fileasyncapitestsuploadanddownloadfile426393d2d82df" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataError.json new file mode 100644 index 000000000000..5cbe3e20a43e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileAsyncAPITestsUploadDataError.json @@ -0,0 +1,46 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploaddataerror18927c1731c9fdb1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829D404B2D5\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce43c-801a-010a-3412-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:20 GMT", + "x-ms-client-request-id" : "d7a3dcb8-4905-4bb8-bcab-f19f59f8bbd4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileasyncapitestsuploaddataerror18927c1731c9fdb1/fileasyncapitestsuploaddataerror5159665ca37aaf75?comp=range", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "42bce43e-801a-010a-3512-5a6faa000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:42bce43e-801a-010a-3512-5a6faa000000\nTime:2019-08-24T00:27:21.5765964Z", + "Date" : "Sat, 24 Aug 2019 00:27:21 GMT", + "x-ms-client-request-id" : "dc89737b-72f7-43fe-98c2-d756f6eae46c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileasyncapitestsuploaddataerror18927c1731c9fdb1", "fileasyncapitestsuploaddataerror5159665ca37aaf75" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShare.json new file mode 100644 index 000000000000..b2ea1a037290 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShare.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestscreateshare74835a168de07eaa2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E21C751B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf591-c01a-0046-5412-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:44 GMT", + "x-ms-client-request-id" : "a9d4b45e-68e1-428b-988d-b650df5e80ae" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestscreateshare74835a168de07eaa2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareMaxOverloads.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareMaxOverloads.json new file mode 100644 index 000000000000..7a2955229524 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareMaxOverloads.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestscreatesharemaxoverloads553695b4074?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E22EA1F8\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf595-c01a-0046-5712-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:44 GMT", + "x-ms-client-request-id" : "d6a62ff3-a774-4bd1-8279-1e5e8ae9c214" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestscreatesharemaxoverloads553695b4074" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs0.json new file mode 100644 index 000000000000..2ee75261a6b5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestscreatesharewithinvalidargs028683bf30?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "b02cf599-c01a-0046-5a12-5aeee0000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:b02cf599-c01a-0046-5a12-5aeee0000000\nTime:2019-08-24T00:27:45.0872760Z", + "Date" : "Sat, 24 Aug 2019 00:27:44 GMT", + "x-ms-client-request-id" : "6f1f9aba-11a4-4a80-ad14-c4ef5b59485e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestscreatesharewithinvalidargs028683bf30" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs1.json new file mode 100644 index 000000000000..e72eb566ff31 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsCreateShareWithInvalidArgs1.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestscreatesharewithinvalidargs1696291639?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "x-ms-request-id" : "b02cf59b-c01a-0046-5c12-5aeee0000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:b02cf59b-c01a-0046-5c12-5aeee0000000\nTime:2019-08-24T00:27:45.2043888Zx-ms-share-quota-1", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "c15c78ad-e20e-40a5-a46f-f5be52fe4508", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestscreatesharewithinvalidargs1696291639" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShare.json new file mode 100644 index 000000000000..435289d42fce --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShare.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestsdeleteshare161423132adcdfbba?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E266887F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf59d-c01a-0046-5e12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "ac8c4567-6858-4014-a267-fe012f870542" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestsdeleteshare161423132adcdfbba?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b02cf59f-c01a-0046-5f12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "0a06f99a-ca28-46a7-85d3-d5167ecb7dde" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestsdeleteshare161423132adcdfbba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShareDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShareDoesNotExist.json new file mode 100644 index 000000000000..0e63946e231e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsDeleteShareDoesNotExist.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestsdeletesharedoesnotexist6141547e720?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b02cf5a1-c01a-0046-6112-5aeee0000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:b02cf5a1-c01a-0046-6112-5aeee0000000\nTime:2019-08-24T00:27:45.4726439Z", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "4115b637-b6aa-44f0-b265-a9cf92a77a5f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestsdeletesharedoesnotexist82080d49cd7", "fileserviceapitestsdeletesharedoesnotexist6141547e720" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetFileServiceURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetFileServiceURL.json new file mode 100644 index 000000000000..576818929ced --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetFileServiceURL.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceapitestsgetfileserviceurl231925540f9e1f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetShareDoesNotCreateAShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetShareDoesNotCreateAShare.json new file mode 100644 index 000000000000..09db0abb7326 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsGetShareDoesNotCreateAShare.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceapitestsgetsharedoesnotcreateashare440584177" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs0.json new file mode 100644 index 000000000000..f94915f64ef6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs0.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs039938433535f90?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E3923240\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5d1-c01a-0046-0412-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:47 GMT", + "x-ms-client-request-id" : "19b8dd85-01e1-40bb-bf09-000a5830eb87" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs039938433535f91?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E399AE0E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5d3-c01a-0046-0512-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:47 GMT", + "x-ms-client-request-id" : "266459f9-d0a4-486a-b114-73652a8ce568" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs039938433535f92?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E39FA2F9\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5d5-c01a-0046-0612-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:47 GMT", + "x-ms-client-request-id" : "c46d1503-58eb-41e6-9e43-8925b0158518" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs039938433535f92?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-24T00:27:47.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E39FA2F9\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5d7-c01a-0046-0712-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:47 GMT", + "x-ms-client-request-id" : "beaddb6e-7be3-40a8-9329-8780e3372502" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceapitestslistshareswithargs&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf5dc-c01a-0046-0a12-5aeee0000000", + "Body" : "fileserviceapitestslistshareswithargsfileserviceapitestslistshareswithargs039938433535f90Sat, 24 Aug 2019 00:27:47 GMT\"0x8D72829E3923240\"2fileserviceapitestslistshareswithargs039938433535f91Sat, 24 Aug 2019 00:27:47 GMT\"0x8D72829E399AE0E\"2fileserviceapitestslistshareswithargs039938433535f92Sat, 24 Aug 2019 00:27:47 GMT\"0x8D72829E39FA2F9\"2", + "Date" : "Sat, 24 Aug 2019 00:27:47 GMT", + "x-ms-client-request-id" : "753a55e5-eedb-45fb-bb89-a2967461da21", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithargs039938433535f9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs1.json new file mode 100644 index 000000000000..794aeb9816c7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs1.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs154364e4e843040?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E407CCFD\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5e2-c01a-0046-1012-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:47 GMT", + "x-ms-client-request-id" : "73fcd7a1-0823-43d5-8928-d8fb4f267378" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs154364e4e843041?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E40E3732\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5e4-c01a-0046-1112-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:47 GMT", + "x-ms-client-request-id" : "9cf6e9b0-e27f-42b8-999c-5ae31d18f56b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs154364e4e843042?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E4145334\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5e6-c01a-0046-1212-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:48 GMT", + "x-ms-client-request-id" : "bfe6c27b-ce6b-435f-89d2-7c70752f1f82" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs154364e4e843042?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-24T00:27:48.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E4145334\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5e8-c01a-0046-1312-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:48 GMT", + "x-ms-client-request-id" : "af201596-5841-4d6e-8c65-76a2f9036239" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceapitestslistshareswithargs&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf5ea-c01a-0046-1412-5aeee0000000", + "Body" : "fileserviceapitestslistshareswithargsfileserviceapitestslistshareswithargs154364e4e843040Sat, 24 Aug 2019 00:27:48 GMT\"0x8D72829E407CCFD\"2valuefileserviceapitestslistshareswithargs154364e4e843041Sat, 24 Aug 2019 00:27:48 GMT\"0x8D72829E40E3732\"2valuefileserviceapitestslistshareswithargs154364e4e843042Sat, 24 Aug 2019 00:27:48 GMT\"0x8D72829E4145334\"2value", + "Date" : "Sat, 24 Aug 2019 00:27:48 GMT", + "x-ms-client-request-id" : "4574449c-42a5-419c-9a88-cf0fb0781338", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithargs154364e4e84304" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs2.json new file mode 100644 index 000000000000..e576ea2a338e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithArgs2.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs228200edd38a1a0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E456EAA9\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5f3-c01a-0046-1c12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:48 GMT", + "x-ms-client-request-id" : "de85faaf-b7e8-40a2-a44b-b4acbec973ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs228200edd38a1a1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E45D2DCC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5f5-c01a-0046-1d12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:48 GMT", + "x-ms-client-request-id" : "f1ed0bba-6735-4da7-afa6-15b172cec5f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs228200edd38a1a2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E46322A9\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5f7-c01a-0046-1e12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:48 GMT", + "x-ms-client-request-id" : "742d3a8b-5bf5-4af7-824e-7b5f7b659c8e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithargs228200edd38a1a2?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-24T00:27:48.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E46322A9\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5f9-c01a-0046-1f12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:48 GMT", + "x-ms-client-request-id" : "fb37de7e-f9a4-4326-9007-c8d01e059930" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceapitestslistshareswithargs&include=metadata%2csnapshots&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf5fa-c01a-0046-2012-5aeee0000000", + "Body" : "fileserviceapitestslistshareswithargsfileserviceapitestslistshareswithargs228200edd38a1a0Sat, 24 Aug 2019 00:27:48 GMT\"0x8D72829E456EAA9\"2valuefileserviceapitestslistshareswithargs228200edd38a1a1Sat, 24 Aug 2019 00:27:48 GMT\"0x8D72829E45D2DCC\"2valuefileserviceapitestslistshareswithargs228200edd38a1a22019-08-24T00:27:48.0000000ZSat, 24 Aug 2019 00:27:48 GMT\"0x8D72829E46322A9\"2valuefileserviceapitestslistshareswithargs228200edd38a1a2Sat, 24 Aug 2019 00:27:48 GMT\"0x8D72829E46322A9\"2value", + "Date" : "Sat, 24 Aug 2019 00:27:48 GMT", + "x-ms-client-request-id" : "19e0f165-8a77-4d94-b17d-94d09e1bcefd", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithargs228200edd38a1a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter0.json new file mode 100644 index 000000000000..b44547542a62 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter0.json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter028145b22e48d0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E28CDE7D\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5a3-c01a-0046-6312-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "379371de-1af3-4193-955f-c95fd820a5ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter028145b22e48d1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E29396EA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5a5-c01a-0046-6412-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "6a879c79-37c6-406b-9be1-67afe9a51dc5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter028145b22e48d2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E2993D9D\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5a7-c01a-0046-6512-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "76d340e3-ff57-4c8e-ae9c-9da1efed1b3a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceapitestslistshareswithfilter&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf5aa-c01a-0046-6612-5aeee0000000", + "Body" : "fileserviceapitestslistshareswithfilterfileserviceapitestslistshareswithfilter028145b22e48d0Sat, 24 Aug 2019 00:27:45 GMT\"0x8D72829E28CDE7D\"1fileserviceapitestslistshareswithfilter028145b22e48d1Sat, 24 Aug 2019 00:27:45 GMT\"0x8D72829E29396EA\"2fileserviceapitestslistshareswithfilter028145b22e48d2Sat, 24 Aug 2019 00:27:45 GMT\"0x8D72829E2993D9D\"3", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "b071fef2-f023-406a-9d69-f3b6f6cf107c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithfilter028145b22e48d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter1.json new file mode 100644 index 000000000000..1e3c6c6d8654 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter1.json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter18833344fb90b0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E2C27A83\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5af-c01a-0046-6b12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "47114031-a64b-47be-9947-cd184319427a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter18833344fb90b1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E2C82132\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5b2-c01a-0046-6d12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "b0aa0e66-85e4-4a3f-8745-5e7aacbc304c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter18833344fb90b2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E2CDC7E5\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5b4-c01a-0046-6e12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "bcfe653c-f6ef-4a38-b4ea-c350b8a2ba15" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceapitestslistshareswithfilter&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf5b6-c01a-0046-6f12-5aeee0000000", + "Body" : "fileserviceapitestslistshareswithfilterfileserviceapitestslistshareswithfilter18833344fb90b0Sat, 24 Aug 2019 00:27:45 GMT\"0x8D72829E2C27A83\"1fileserviceapitestslistshareswithfilter18833344fb90b1Sat, 24 Aug 2019 00:27:45 GMT\"0x8D72829E2C82132\"2fileserviceapitestslistshareswithfilter18833344fb90b2Sat, 24 Aug 2019 00:27:46 GMT\"0x8D72829E2CDC7E5\"3value", + "Date" : "Sat, 24 Aug 2019 00:27:45 GMT", + "x-ms-client-request-id" : "56e8c810-99b3-4606-a8f9-dcb5f897725f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithfilter18833344fb90b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter2.json new file mode 100644 index 000000000000..00c4556823ff --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter2.json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter286806e7c85c00?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E31DD02F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5bb-c01a-0046-7412-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:46 GMT", + "x-ms-client-request-id" : "d3f5e069-ac45-468a-9174-206a7f5ee55c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter286806e7c85c01?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E3239DF9\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5bd-c01a-0046-7512-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:46 GMT", + "x-ms-client-request-id" : "5c5a0d76-5b77-4726-94fd-805011884835" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter286806e7c85c02?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E3296BBF\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5bf-c01a-0046-7612-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:46 GMT", + "x-ms-client-request-id" : "f06645f3-362d-49e1-b0fe-5c754353e606" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceapitestslistshareswithfilter&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf5c1-c01a-0046-7712-5aeee0000000", + "Body" : "fileserviceapitestslistshareswithfilterfileserviceapitestslistshareswithfilter286806e7c85c00Sat, 24 Aug 2019 00:27:46 GMT\"0x8D72829E31DD02F\"1fileserviceapitestslistshareswithfilter286806e7c85c01Sat, 24 Aug 2019 00:27:46 GMT\"0x8D72829E3239DF9\"2fileserviceapitestslistshareswithfilter286806e7c85c02Sat, 24 Aug 2019 00:27:46 GMT\"0x8D72829E3296BBF\"3", + "Date" : "Sat, 24 Aug 2019 00:27:46 GMT", + "x-ms-client-request-id" : "9a70f545-309b-407e-a9e2-42a95590a25e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithfilter286806e7c85c0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter3.json new file mode 100644 index 000000000000..d1cf37f21dd3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsListSharesWithFilter3.json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter354300dd3b50c0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E34FC1CB\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5c6-c01a-0046-7c12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:46 GMT", + "x-ms-client-request-id" : "fda88996-0223-49a3-9b7d-d8d9b7a69c3c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter354300dd3b50c1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E3554162\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5c8-c01a-0046-7d12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:46 GMT", + "x-ms-client-request-id" : "69eb219a-0768-43f8-804a-b6a0e15c38a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceapitestslistshareswithfilter354300dd3b50c2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E35AC0F5\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf5ca-c01a-0046-7e12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:46 GMT", + "x-ms-client-request-id" : "c98bee79-0b68-4880-96a8-437e18f49d12" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceapitestslistshareswithfilter&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf5cc-c01a-0046-7f12-5aeee0000000", + "Body" : "fileserviceapitestslistshareswithfilter2fileserviceapitestslistshareswithfilter354300dd3b50c0Sat, 24 Aug 2019 00:27:46 GMT\"0x8D72829E34FC1CB\"1fileserviceapitestslistshareswithfilter354300dd3b50c1Sat, 24 Aug 2019 00:27:46 GMT\"0x8D72829E3554162\"2/azstoragesdkaccount/fileserviceapitestslistshareswithfilter354300dd3b50c2", + "Date" : "Sat, 24 Aug 2019 00:27:46 GMT", + "x-ms-client-request-id" : "de1a4e50-34f3-496f-a6d8-3e745d286095", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestslistshareswithfilter354300dd3b50c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetProperties.json new file mode 100644 index 000000000000..f3ea10cbf281 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetProperties.json @@ -0,0 +1,83 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf5ff-c01a-0046-2512-5aeee0000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Sat, 24 Aug 2019 00:27:48 GMT", + "x-ms-client-request-id" : "a9ffe1ee-2897-4ee0-a415-3d5754001da2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf600-c01a-0046-2612-5aeee0000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Sat, 24 Aug 2019 00:27:48 GMT", + "x-ms-client-request-id" : "86e4f228-2cdf-430d-89a0-654213469e1e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b02cf601-c01a-0046-2712-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:49 GMT", + "x-ms-client-request-id" : "96d13047-60c8-4477-84be-404fe6c46872" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b02cf606-c01a-0046-2812-5aeee0000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Sat, 24 Aug 2019 00:27:49 GMT", + "x-ms-client-request-id" : "771027e6-03bb-4daa-a6ca-abb1868985ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetproperties6406911607937" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs0.json new file mode 100644 index 000000000000..94ba90707400 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs0.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "b02cf608-c01a-0046-2a12-5aeee0000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:b02cf608-c01a-0046-2a12-5aeee0000000\nTime:2019-08-24T00:27:50.1561066Z00", + "Date" : "Sat, 24 Aug 2019 00:27:50 GMT", + "x-ms-client-request-id" : "ff416575-a8fc-4838-9903-0e76c9b83f08", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertieswithinvalidargs037876" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs1.json new file mode 100644 index 000000000000..100cd065991e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs1.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "b02cf60a-c01a-0046-2c12-5aeee0000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:b02cf60a-c01a-0046-2c12-5aeee0000000\nTime:2019-08-24T00:27:50.2451907Z00", + "Date" : "Sat, 24 Aug 2019 00:27:50 GMT", + "x-ms-client-request-id" : "57f7f288-3c8b-411c-80ce-ae789ad4c6b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertieswithinvalidargs172618" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs2.json new file mode 100644 index 000000000000..eea48efcdc3a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs2.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "b02cf60c-c01a-0046-2e12-5aeee0000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:b02cf60c-c01a-0046-2e12-5aeee0000000\nTime:2019-08-24T00:27:50.3272694Z00", + "Date" : "Sat, 24 Aug 2019 00:27:50 GMT", + "x-ms-client-request-id" : "0c79b6d6-85ab-4a74-9027-cc081e0ee5e2", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertieswithinvalidargs277423" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs3.json new file mode 100644 index 000000000000..6b3d7477d8b8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs3.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "b02cf60e-c01a-0046-3012-5aeee0000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:b02cf60e-c01a-0046-3012-5aeee0000000\nTime:2019-08-24T00:27:50.4103479Z00", + "Date" : "Sat, 24 Aug 2019 00:27:50 GMT", + "x-ms-client-request-id" : "18479bc0-7637-4edc-83ba-0c5c7b665264", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertieswithinvalidargs303395" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs4.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs4.json new file mode 100644 index 000000000000..fe8ad9d89ab3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesWithInvalidArgs4.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlNodeValue", + "retry-after" : "0", + "Content-Length" : "340", + "StatusCode" : "400", + "x-ms-request-id" : "b02cf610-c01a-0046-3212-5aeee0000000", + "Body" : "InvalidXmlNodeValueThe value for one of the XML nodes is not in the correct format.\nRequestId:b02cf610-c01a-0046-3212-5aeee0000000\nTime:2019-08-24T00:27:51.6895672ZAllowedMethodsNOTAREALHTTPMETHOD", + "Date" : "Sat, 24 Aug 2019 00:27:51 GMT", + "x-ms-client-request-id" : "ea157333-9872-482a-aa03-ab449e8e8002", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertieswithinvalidargs432679" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShare.json new file mode 100644 index 000000000000..8ac74e8658ec --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShare.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestscreateshare9361253b1579119?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829EFE83AC5\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548ad-601a-008c-3412-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:07 GMT", + "x-ms-client-request-id" : "9b250789-0a31-4bc8-b36c-cebeaa26617e" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestscreateshare9361253b1579119" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs0.json new file mode 100644 index 000000000000..68f35bd6c69e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestscreatesharewithinvalidargs04351008?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "efe548b7-601a-008c-3c12-5a7d2d000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:efe548b7-601a-008c-3c12-5a7d2d000000\nTime:2019-08-24T00:28:08.4132561Z", + "Date" : "Sat, 24 Aug 2019 00:28:08 GMT", + "x-ms-client-request-id" : "232d7de9-a336-4a63-b54d-a690b81606ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestscreatesharewithinvalidargs04351008" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs1.json new file mode 100644 index 000000000000..fd3dfffd8373 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs1.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestscreatesharewithinvalidargs100623ab?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "x-ms-request-id" : "efe548b9-601a-008c-3e12-5a7d2d000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:efe548b9-601a-008c-3e12-5a7d2d000000\nTime:2019-08-24T00:28:08.5123451Zx-ms-share-quota-1", + "Date" : "Sat, 24 Aug 2019 00:28:08 GMT", + "x-ms-client-request-id" : "239e9d9f-5173-42d0-a47d-b6159cf15f5f", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestscreatesharewithinvalidargs100623ab" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs2.json new file mode 100644 index 000000000000..de9f1fb606e4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs2.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestscreatesharewithinvalidargs23164170?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "323", + "StatusCode" : "400", + "x-ms-request-id" : "efe548bb-601a-008c-4012-5a7d2d000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:efe548bb-601a-008c-4012-5a7d2d000000\nTime:2019-08-24T00:28:08.6084335Zx-ms-share-quota0", + "Date" : "Sat, 24 Aug 2019 00:28:08 GMT", + "x-ms-client-request-id" : "f9d4bddc-ca2a-4aac-9b20-bbbe66db906e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestscreatesharewithinvalidargs23164170" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs3.json new file mode 100644 index 000000000000..3f9aa614fd00 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithInvalidArgs3.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestscreatesharewithinvalidargs362872c2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "efe548bd-601a-008c-4212-5a7d2d000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:efe548bd-601a-008c-4212-5a7d2d000000\nTime:2019-08-24T00:28:08.6925105Zx-ms-share-quota5200", + "Date" : "Sat, 24 Aug 2019 00:28:08 GMT", + "x-ms-client-request-id" : "9ff81be1-060d-4b11-8e1b-0c54e8677bbf", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestscreatesharewithinvalidargs362872c2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata0.json new file mode 100644 index 000000000000..aedc64f2045f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata0.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestscreatesharewithmetadata05642598c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata1.json new file mode 100644 index 000000000000..04838227f616 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata1.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestscreatesharewithmetadata108430f4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata2.json new file mode 100644 index 000000000000..786e00151645 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata2.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestscreatesharewithmetadata257924bce" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata3.json new file mode 100644 index 000000000000..131d187e7d1d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsCreateShareWithMetadata3.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestscreatesharewithmetadata394229836" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShare.json new file mode 100644 index 000000000000..4473c5ba404d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShare.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestsdeleteshare048505cb1b436a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShareDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShareDoesNotExist.json new file mode 100644 index 000000000000..cbc79e6bd922 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsDeleteShareDoesNotExist.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestsdeletesharedoesnotexist08600a710?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "efe548c0-601a-008c-4512-5a7d2d000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:efe548c0-601a-008c-4512-5a7d2d000000\nTime:2019-08-24T00:28:08.8766795Z", + "Date" : "Sat, 24 Aug 2019 00:28:08 GMT", + "x-ms-client-request-id" : "bd1f8c0c-b882-40d3-92d1-7e3ad36b4155", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestsdeletesharedoesnotexist768323526", "fileserviceasyncapitestsdeletesharedoesnotexist08600a710" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetFileServiceURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetFileServiceURL.json new file mode 100644 index 000000000000..dcf47acd36b2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetFileServiceURL.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestsgetfileserviceurl66641463ff42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetShareDoesNotCreateAShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetShareDoesNotCreateAShare.json new file mode 100644 index 000000000000..d68301f700c9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsGetShareDoesNotCreateAShare.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "fileserviceasyncapitestsgetsharedoesnotcreateashare48431c9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs0.json new file mode 100644 index 000000000000..2f642cee7885 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs0.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs04992277362a0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F163C206\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548f1-601a-008c-6812-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "ee108614-0ae7-439b-86f4-4d129c993dbe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs04992277362a1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F169418B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548f3-601a-008c-6912-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "6211e20c-80dd-4bbf-a32d-2f3e64918540" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs04992277362a2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F16E72EC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548f5-601a-008c-6a12-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "5e852702-ffe9-4467-ab67-a2ea9338aacc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs04992277362a2?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-24T00:28:10.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F16E72EC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548f7-601a-008c-6b12-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "ff3c8dda-4ba0-44cc-86aa-00c2999e2a3f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithargs&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "efe548f8-601a-008c-6c12-5a7d2d000000", + "Body" : "fileserviceasyncapitestslistshareswithargsfileserviceasyncapitestslistshareswithargs04992277362a0Sat, 24 Aug 2019 00:28:10 GMT\"0x8D72829F163C206\"2fileserviceasyncapitestslistshareswithargs04992277362a1Sat, 24 Aug 2019 00:28:10 GMT\"0x8D72829F169418B\"2fileserviceasyncapitestslistshareswithargs04992277362a2Sat, 24 Aug 2019 00:28:10 GMT\"0x8D72829F16E72EC\"2", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "898546da-e9df-4709-9e79-2691cea578b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithargs04992277362a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs1.json new file mode 100644 index 000000000000..6cc5019e39b6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs1.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs1678672cd73a0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F1976139\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548fd-601a-008c-7112-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "8f2814a3-3810-45af-ab01-e8c718d567b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs1678672cd73a1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F19D07E3\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548ff-601a-008c-7212-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "1f4d18eb-848b-4465-8fb4-9a5a1f85fb7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs1678672cd73a2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F1A323D1\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe54902-601a-008c-7312-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "fd21a1ce-f8cd-4485-8982-898200e4d24d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs1678672cd73a2?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-24T00:28:10.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F1A323D1\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe54904-601a-008c-7412-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "9b840ad6-f51c-482f-95a0-71278d3c6b53" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithargs&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "efe54905-601a-008c-7512-5a7d2d000000", + "Body" : "fileserviceasyncapitestslistshareswithargsfileserviceasyncapitestslistshareswithargs1678672cd73a0Sat, 24 Aug 2019 00:28:10 GMT\"0x8D72829F1976139\"2valuefileserviceasyncapitestslistshareswithargs1678672cd73a1Sat, 24 Aug 2019 00:28:10 GMT\"0x8D72829F19D07E3\"2valuefileserviceasyncapitestslistshareswithargs1678672cd73a2Sat, 24 Aug 2019 00:28:10 GMT\"0x8D72829F1A323D1\"2value", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "8fa07902-7187-462f-a992-e8a183d6c628", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithargs1678672cd73a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs2.json new file mode 100644 index 000000000000..94feceb345b6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithArgs2.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs2016438151220?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F1D11C64\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe5490a-601a-008c-7a12-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "a2f9ad3e-5a18-476d-8970-d570de7a2b5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs2016438151221?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F1D6EA20\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe5490c-601a-008c-7b12-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:11 GMT", + "x-ms-client-request-id" : "80c50505-be65-4cc6-ab64-5d1de2b0c6c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs2016438151222?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F1DCDEF8\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe5490e-601a-008c-7c12-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:11 GMT", + "x-ms-client-request-id" : "2e7cfa05-7eff-4ac6-92fb-193e46a9a167" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithargs2016438151222?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-24T00:28:11.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F1DCDEF8\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe54910-601a-008c-7d12-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:11 GMT", + "x-ms-client-request-id" : "62ef83f4-7fe9-409b-a2d7-aac1d43b4eca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithargs&include=metadata%2csnapshots&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "efe54911-601a-008c-7e12-5a7d2d000000", + "Body" : "fileserviceasyncapitestslistshareswithargsfileserviceasyncapitestslistshareswithargs2016438151220Sat, 24 Aug 2019 00:28:11 GMT\"0x8D72829F1D11C64\"2valuefileserviceasyncapitestslistshareswithargs2016438151221Sat, 24 Aug 2019 00:28:11 GMT\"0x8D72829F1D6EA20\"2valuefileserviceasyncapitestslistshareswithargs20164381512222019-08-24T00:28:11.0000000ZSat, 24 Aug 2019 00:28:11 GMT\"0x8D72829F1DCDEF8\"2valuefileserviceasyncapitestslistshareswithargs2016438151222Sat, 24 Aug 2019 00:28:11 GMT\"0x8D72829F1DCDEF8\"2value", + "Date" : "Sat, 24 Aug 2019 00:28:11 GMT", + "x-ms-client-request-id" : "28350b91-fba9-4117-876e-051d6fcbfce0", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithargs201643815122" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter0.json new file mode 100644 index 000000000000..56cebed3110b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter0.json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter0031124cdd50?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F07B2750\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548c3-601a-008c-4712-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:08 GMT", + "x-ms-client-request-id" : "abcef134-d17c-4c46-8130-5ea4bc0f8fb7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter0031124cdd51?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F0811C28\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548c5-601a-008c-4812-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:08 GMT", + "x-ms-client-request-id" : "837ee163-6e05-467d-bbb9-d6445e202ac3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter0031124cdd52?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F086E9E9\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548c7-601a-008c-4912-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:08 GMT", + "x-ms-client-request-id" : "13547300-db2a-458f-be63-8ee4d763c033" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithfilter&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "efe548c9-601a-008c-4a12-5a7d2d000000", + "Body" : "fileserviceasyncapitestslistshareswithfilterfileserviceasyncapitestslistshareswithfilter0031124cdd50Sat, 24 Aug 2019 00:28:08 GMT\"0x8D72829F07B2750\"1fileserviceasyncapitestslistshareswithfilter0031124cdd51Sat, 24 Aug 2019 00:28:08 GMT\"0x8D72829F0811C28\"2fileserviceasyncapitestslistshareswithfilter0031124cdd52Sat, 24 Aug 2019 00:28:09 GMT\"0x8D72829F086E9E9\"3", + "Date" : "Sat, 24 Aug 2019 00:28:08 GMT", + "x-ms-client-request-id" : "abd64158-a28d-4940-a3b1-416fd945de4e", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithfilter0031124cdd5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter1.json new file mode 100644 index 000000000000..09c9220c20c7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter1.json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter1854682dfca0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F0AF8A04\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548cf-601a-008c-5012-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:09 GMT", + "x-ms-client-request-id" : "3d608920-8e8b-4664-80f2-b9b0364081fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter1854682dfca1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F0B530B2\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548d1-601a-008c-5112-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:09 GMT", + "x-ms-client-request-id" : "7553467a-86b7-4ee8-ba66-d80a8d48ff39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter1854682dfca2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F0BB9ACA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548d3-601a-008c-5212-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:09 GMT", + "x-ms-client-request-id" : "585639bf-8f83-4096-ab1c-50f9951d1745" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithfilter&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "efe548d5-601a-008c-5312-5a7d2d000000", + "Body" : "fileserviceasyncapitestslistshareswithfilterfileserviceasyncapitestslistshareswithfilter1854682dfca0Sat, 24 Aug 2019 00:28:09 GMT\"0x8D72829F0AF8A04\"1fileserviceasyncapitestslistshareswithfilter1854682dfca1Sat, 24 Aug 2019 00:28:09 GMT\"0x8D72829F0B530B2\"2fileserviceasyncapitestslistshareswithfilter1854682dfca2Sat, 24 Aug 2019 00:28:09 GMT\"0x8D72829F0BB9ACA\"3value", + "Date" : "Sat, 24 Aug 2019 00:28:09 GMT", + "x-ms-client-request-id" : "2a6a9c07-5da7-42b9-8c1a-d2560e47b630", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithfilter1854682dfca" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter2.json new file mode 100644 index 000000000000..f83f63a170f6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter2.json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter28719916d910?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F0F33295\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548db-601a-008c-5812-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:09 GMT", + "x-ms-client-request-id" : "8fdb2046-06af-4522-8ede-e3645bc7ebad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter28719916d911?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F0F8D935\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548dd-601a-008c-5912-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:09 GMT", + "x-ms-client-request-id" : "ec53e849-ea81-480e-8885-c934af21cb68" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter28719916d912?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F0FEA6F1\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548df-601a-008c-5a12-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:09 GMT", + "x-ms-client-request-id" : "7b4bb098-f5f2-4ea7-b910-3bc27c8da4de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithfilter&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "efe548e1-601a-008c-5b12-5a7d2d000000", + "Body" : "fileserviceasyncapitestslistshareswithfilterfileserviceasyncapitestslistshareswithfilter28719916d910Sat, 24 Aug 2019 00:28:09 GMT\"0x8D72829F0F33295\"1fileserviceasyncapitestslistshareswithfilter28719916d911Sat, 24 Aug 2019 00:28:09 GMT\"0x8D72829F0F8D935\"2fileserviceasyncapitestslistshareswithfilter28719916d912Sat, 24 Aug 2019 00:28:09 GMT\"0x8D72829F0FEA6F1\"3", + "Date" : "Sat, 24 Aug 2019 00:28:09 GMT", + "x-ms-client-request-id" : "a25ebc50-e2b6-43ba-ba5f-b4997148d3d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithfilter28719916d91" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter3.json new file mode 100644 index 000000000000..b1040bf92430 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsListSharesWithFilter3.json @@ -0,0 +1,84 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter356774695fa0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F121EEA8\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548e6-601a-008c-6012-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:09 GMT", + "x-ms-client-request-id" : "a37f60c3-77b6-4bb2-812e-c7be77dad6f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter356774695fa1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F131347B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548e8-601a-008c-6112-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:09 GMT", + "x-ms-client-request-id" : "b8796c05-d2ec-40a7-98f3-66a080cfa91a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/fileserviceasyncapitestslistshareswithfilter356774695fa2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829F1407A59\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:28:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "efe548ea-601a-008c-6212-5a7d2d000000", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "78ffb3f2-9a6f-46f1-a128-842fb090e273" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=fileserviceasyncapitestslistshareswithfilter&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "efe548ec-601a-008c-6312-5a7d2d000000", + "Body" : "fileserviceasyncapitestslistshareswithfilter2fileserviceasyncapitestslistshareswithfilter356774695fa0Sat, 24 Aug 2019 00:28:10 GMT\"0x8D72829F121EEA8\"1fileserviceasyncapitestslistshareswithfilter356774695fa1Sat, 24 Aug 2019 00:28:10 GMT\"0x8D72829F131347B\"2/azstoragesdkaccount/fileserviceasyncapitestslistshareswithfilter356774695fa2", + "Date" : "Sat, 24 Aug 2019 00:28:10 GMT", + "x-ms-client-request-id" : "3a1b133d-2391-40b7-a3b9-ca3e73c48fef", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestslistshareswithfilter356774695fa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetProperties.json new file mode 100644 index 000000000000..2cb09b511167 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetProperties.json @@ -0,0 +1,64 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "efe54916-601a-008c-0312-5a7d2d000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Sat, 24 Aug 2019 00:28:11 GMT", + "x-ms-client-request-id" : "e847887a-51bf-4039-8efe-983880afa161", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "efe54917-601a-008c-0412-5a7d2d000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Sat, 24 Aug 2019 00:28:11 GMT", + "x-ms-client-request-id" : "d7438296-3ee2-40d0-a3de-4924188d2564", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "efe54918-601a-008c-0512-5a7d2d000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3", + "Date" : "Sat, 24 Aug 2019 00:28:11 GMT", + "x-ms-client-request-id" : "60bdd48a-bcaa-4854-a07f-fb5da346c6f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceasyncapitestssetandgetproperties5641609cad8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs0.json new file mode 100644 index 000000000000..7d121c2bf724 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs0.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "efe5491b-601a-008c-0812-5a7d2d000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:efe5491b-601a-008c-0812-5a7d2d000000\nTime:2019-08-24T00:28:12.4069103Z00", + "Date" : "Sat, 24 Aug 2019 00:28:12 GMT", + "x-ms-client-request-id" : "9f4853b0-fb83-4fb0-8eb3-ff1265bb1ecf", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "687ce632d9144de39442585ae0b929bfe54712427bea496cbd57f9e7337fbe2c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs1.json new file mode 100644 index 000000000000..31560d6d166b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs1.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "efe5491e-601a-008c-0a12-5a7d2d000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:efe5491e-601a-008c-0a12-5a7d2d000000\nTime:2019-08-24T00:28:12.4959907Z00", + "Date" : "Sat, 24 Aug 2019 00:28:12 GMT", + "x-ms-client-request-id" : "0d5477cf-df85-4c6c-9f58-ab3d6495c44a", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "61a5d2faa6bf4abebf62d063a6ca4fb25062406d924e4967ad75329667ed5c96" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs2.json new file mode 100644 index 000000000000..10b95d5eace8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs2.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "efe54920-601a-008c-0c12-5a7d2d000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:efe54920-601a-008c-0c12-5a7d2d000000\nTime:2019-08-24T00:28:12.5840713Z00", + "Date" : "Sat, 24 Aug 2019 00:28:12 GMT", + "x-ms-client-request-id" : "bc0f1f9b-818b-40d0-85ca-a7e1bad7433b", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "85718547acce45179749534def17a4feba1a271762224412ab54897677fb7a1c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs3.json new file mode 100644 index 000000000000..e520c63268dd --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs3.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "efe54922-601a-008c-0e12-5a7d2d000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:efe54922-601a-008c-0e12-5a7d2d000000\nTime:2019-08-24T00:28:12.7061849Z00", + "Date" : "Sat, 24 Aug 2019 00:28:12 GMT", + "x-ms-client-request-id" : "313529ec-179c-427a-972d-0b4e42195808", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "721b57646cd14c90af804d57c56f3d14005a4f776a60412e8dd81421b940e105" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs4.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs4.json new file mode 100644 index 000000000000..fc8613282ea4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/FileServiceAsyncAPITestsSetAndGetPropertiesWithInvalidArgs4.json @@ -0,0 +1,26 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlNodeValue", + "retry-after" : "0", + "Content-Length" : "340", + "StatusCode" : "400", + "x-ms-request-id" : "efe54924-601a-008c-1012-5a7d2d000000", + "Body" : "InvalidXmlNodeValueThe value for one of the XML nodes is not in the correct format.\nRequestId:efe54924-601a-008c-1012-5a7d2d000000\nTime:2019-08-24T00:28:13.8372190ZAllowedMethodsNOTAREALHTTPMETHOD", + "Date" : "Sat, 24 Aug 2019 00:28:13 GMT", + "x-ms-client-request-id" : "f2064efa-6376-479e-af47-13d264cf4944", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "29224450209b46f897c78a52544ec136f5905157c33d4a9b8bf6e3dfd8bc1196" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectory.json new file mode 100644 index 000000000000..5a5496ac764d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectory.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatedirectory314949adf35744f8c4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B5CC61DD\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fcb-b01a-0060-6a12-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:30 GMT", + "x-ms-client-request-id" : "98d254bc-049f-4b30-ac84-567a4faeadca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatedirectory314949adf35744f8c4/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:30.7022597Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:30 GMT", + "ETag" : "\"0x8D72829B5EA6705\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:30.7022597Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "28c90fcd-b01a-0060-6b12-5a7554000000", + "x-ms-client-request-id" : "c5741d98-f0ad-4e90-b05d-4cbc3fd0af87", + "x-ms-file-last-write-time" : "2019-08-24T00:26:30.7022597Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatedirectory314949adf35744f8c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryInvalidName.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryInvalidName.json new file mode 100644 index 000000000000..433935e57d15 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryInvalidName.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatedirectoryinvalidname40789b30bed5f?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B60336D0\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fd1-b01a-0060-6e12-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:30 GMT", + "x-ms-client-request-id" : "8b5e1e48-2843-40d2-b214-d19f2646dbd1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatedirectoryinvalidname40789b30bed5f/test%2fdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ParentNotFound", + "retry-after" : "0", + "Content-Length" : "224", + "StatusCode" : "404", + "x-ms-request-id" : "28c90fd3-b01a-0060-6f12-5a7554000000", + "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:28c90fd3-b01a-0060-6f12-5a7554000000\nTime:2019-08-24T00:26:31.4083913Z", + "Date" : "Sat, 24 Aug 2019 00:26:30 GMT", + "x-ms-client-request-id" : "5c5be76b-1fc7-4a47-bd5f-416772b5f56a", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatedirectoryinvalidname40789b30bed5f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadata.json new file mode 100644 index 000000000000..c6b96e69cee9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadata.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatedirectorymetadata299208eac1e95d?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B68A145B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fd7-b01a-0060-7212-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:31 GMT", + "x-ms-client-request-id" : "72f3641f-e7fb-4e13-985e-81250297b236" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatedirectorymetadata299208eac1e95d/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:31.7973132Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:31 GMT", + "ETag" : "\"0x8D72829B6917E8C\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:31.7973132Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "28c90fd9-b01a-0060-7312-5a7554000000", + "x-ms-client-request-id" : "20ee1f2e-f7e0-4e41-9f2d-8685f0efce99", + "x-ms-file-last-write-time" : "2019-08-24T00:26:31.7973132Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatedirectorymetadata299208eac1e95d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadataError.json new file mode 100644 index 000000000000..9269d205c77d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateDirectoryMetadataError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatedirectorymetadataerror92514f73444a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B6A8C769\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fdc-b01a-0060-7612-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:31 GMT", + "x-ms-client-request-id" : "d1244193-c3d8-4e29-9f4b-e3d8967ec1b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatedirectorymetadataerror92514f73444a/testdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "28c90fde-b01a-0060-7712-5a7554000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:28c90fde-b01a-0060-7712-5a7554000000\nTime:2019-08-24T00:26:31.9959555Zvalue", + "Date" : "Sat, 24 Aug 2019 00:26:31 GMT", + "x-ms-client-request-id" : "55791ea9-3b92-4bb7-825f-976b0d17b549", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatedirectorymetadataerror92514f73444a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFile.json new file mode 100644 index 000000000000..67e0af889c64 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFile.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefileshareapitestscreatefile7b2771588fe?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B6C6B708\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fe1-b01a-0060-7a12-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:31 GMT", + "x-ms-client-request-id" : "c4bc6bfe-6f1d-485a-b300-9a4d43a3fc98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefileshareapitestscreatefile7b2771588fe/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:32.1916938Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:31 GMT", + "ETag" : "\"0x8D72829B6CDAC0A\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:32.1916938Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "28c90fe3-b01a-0060-7b12-5a7554000000", + "x-ms-client-request-id" : "ed53c6a2-f3e4-4a77-b72d-d84bd7ba5764", + "x-ms-file-last-write-time" : "2019-08-24T00:26:32.1916938Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefileshareapitestscreatefile7b2771588fe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs0.json new file mode 100644 index 000000000000..332b8b0808f8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs0.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefileinvalidargs07905960cc45af6b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B6E9B0E8\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fe9-b01a-0060-0112-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:31 GMT", + "x-ms-client-request-id" : "d9d38534-f364-4a70-8392-d35bb3671e2f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefileinvalidargs07905960cc45af6b/test%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:26:32 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefileinvalidargs07905960cc45af6b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs1.json new file mode 100644 index 000000000000..e1c542016363 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileInvalidArgs1.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefileinvalidargs1706898af6acbcd5?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B8AE22F7\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "522bba33-101a-0044-5512-5aec1a000000", + "Date" : "Sat, 24 Aug 2019 00:26:34 GMT", + "x-ms-client-request-id" : "d24d9c8e-45de-4828-8072-54b44f635c8e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefileinvalidargs1706898af6acbcd5/fileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "522bba35-101a-0044-5612-5aec1a000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:522bba35-101a-0044-5612-5aec1a000000\nTime:2019-08-24T00:26:35.7008023Z", + "Date" : "Sat, 24 Aug 2019 00:26:35 GMT", + "x-ms-client-request-id" : "999e2152-c737-4c1a-983a-91397894c363", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefileinvalidargs1706898af6acbcd5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverload.json new file mode 100644 index 000000000000..22c614740a06 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverload.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefilemaxoverload98594f3a38c2201?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B90A89DC\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "522bba38-101a-0044-5912-5aec1a000000", + "Date" : "Sat, 24 Aug 2019 00:26:35 GMT", + "x-ms-client-request-id" : "0d97f8b0-60c2-4e0b-b0ab-04d1abdd343c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefilemaxoverload98594f3a38c2201/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:35.9963495Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:35 GMT", + "ETag" : "\"0x8D72829B9123767\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:35.9963495Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "522bba3a-101a-0044-5a12-5aec1a000000", + "x-ms-client-request-id" : "fe0617cc-8505-443b-a631-d9a0d04e9ddd", + "x-ms-file-last-write-time" : "2019-08-24T00:26:35.9963495Z" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilemaxoverload98594f3a38c2201" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs0.json new file mode 100644 index 000000000000..08b7e6f3a294 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs0.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs0983623348?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B934FF5A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "522bba3d-101a-0044-5d12-5aec1a000000", + "Date" : "Sat, 24 Aug 2019 00:26:35 GMT", + "x-ms-client-request-id" : "151396ec-81c3-48ae-951a-e269c2179c21" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs0983623348/test%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:26:35 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilemaxoverloadinvalidargs0983623348" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs1.json new file mode 100644 index 000000000000..c4fbb50eaf16 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs1.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs103824a821?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BC00E555\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6f7a89d9-a01a-0134-4f12-5ad98b000000", + "Date" : "Sat, 24 Aug 2019 00:26:40 GMT", + "x-ms-client-request-id" : "8e270111-803b-4cfb-88c3-798c47e075e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs103824a821/test%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:26:40 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilemaxoverloadinvalidargs103824a821" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs2.json new file mode 100644 index 000000000000..65986dfb1e0d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs2.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs243718b6c8?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BC3F12D7\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6c4fb301-f01a-0028-4612-5a47c9000000", + "Date" : "Sat, 24 Aug 2019 00:26:40 GMT", + "x-ms-client-request-id" : "53e03599-05a1-48b8-bf09-d601af868a20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs243718b6c8/test%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:26:40 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilemaxoverloadinvalidargs243718b6c8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs3.json new file mode 100644 index 000000000000..6557102fb768 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateFileMaxOverloadInvalidArgs3.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs3538089dd0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BC933E6F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c61e32ff-f01a-006c-6112-5a9ba5000000", + "Date" : "Sat, 24 Aug 2019 00:26:41 GMT", + "x-ms-client-request-id" : "dae20ef5-ece2-4c0b-8327-184361398704" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatefilemaxoverloadinvalidargs3538089dd0/test%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:26:41 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatefilemaxoverloadinvalidargs3538089dd0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShare.json new file mode 100644 index 000000000000..fafba75c2722 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShare.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreateshareshareapitestscreatesharedbb7459424?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AF6A30A5\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84689-201a-006e-7512-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:19 GMT", + "x-ms-client-request-id" : "1be62962-5bcf-4af7-8a46-571fab66869e" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreateshareshareapitestscreatesharedbb7459424" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs0.json new file mode 100644 index 000000000000..dd487c458622 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs0.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesharewithargs005664006fcaa9f0c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AF7C0F44\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b8468d-201a-006e-7812-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:19 GMT", + "x-ms-client-request-id" : "704c1f28-96ea-4160-a754-9d26f32c13d5" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithargs005664006fcaa9f0c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs1.json new file mode 100644 index 000000000000..2883f6c27248 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs1.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesharewithargs1996523c17c01179a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AF8F26BD\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b84691-201a-006e-7b12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:20 GMT", + "x-ms-client-request-id" : "88e62dc1-2d25-465a-9769-8249069468e3" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithargs1996523c17c01179a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs2.json new file mode 100644 index 000000000000..dfb5cfe4089f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs2.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesharewithargs214989894c3bc3c1a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AFA1538E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b846a3-201a-006e-0a12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:20 GMT", + "x-ms-client-request-id" : "4c522bf7-7554-4f62-a146-da1d14eaa35a" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithargs214989894c3bc3c1a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs3.json new file mode 100644 index 000000000000..903c1fc51ef0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithArgs3.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesharewithargs35064239aa879a44b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829AFBA38C6\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "90b846a7-201a-006e-0d12-5a995f000000", + "Date" : "Sat, 24 Aug 2019 00:26:20 GMT", + "x-ms-client-request-id" : "51f80f8a-c1a1-483d-ae90-b5df1749542c" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithargs35064239aa879a44b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs0.json new file mode 100644 index 000000000000..9cccc371e4bd --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesharewithinvalidargs040210fe33a52?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "90b846ab-201a-006e-1012-5a995f000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:90b846ab-201a-006e-1012-5a995f000000\nTime:2019-08-24T00:26:20.4673136Zvalue", + "Date" : "Sat, 24 Aug 2019 00:26:20 GMT", + "x-ms-client-request-id" : "00ae003d-a0b3-4050-9349-135216199729", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithinvalidargs040210fe33a52" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs1.json new file mode 100644 index 000000000000..e1d54625fa0c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs1.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesharewithinvalidargs11390835888ff?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "339", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid Header

            \r\n

            HTTP Error 400. The request has an invalid header name.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:26:20 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithinvalidargs11390835888ff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs2.json new file mode 100644 index 000000000000..8d000dc0a924 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateShareWithInvalidArgs2.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesharewithinvalidargs204037e857191?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "28c90f91-b01a-0060-3f12-5a7554000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:28c90f91-b01a-0060-3f12-5a7554000000\nTime:2019-08-24T00:26:20.8282294Zx-ms-share-quota6000", + "Date" : "Sat, 24 Aug 2019 00:26:20 GMT", + "x-ms-client-request-id" : "53cf3beb-bb1e-4825-a3dc-9cceeea448ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesharewithinvalidargs204037e857191" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshot.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshot.json new file mode 100644 index 000000000000..13a5087301f0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshot.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesnapshot44120be792b5471974a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B11F8E25\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90f94-b01a-0060-4112-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:22 GMT", + "x-ms-client-request-id" : "3bf03e1d-fedf-4217-a511-09ca0fb94a9d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesnapshot44120be792b5471974a?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-24T00:26:23.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B11F8E25\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90f96-b01a-0060-4212-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:25 GMT", + "x-ms-client-request-id" : "2a820890-1e36-4de3-ae67-098690fc1273" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesnapshot44120be792b5471974a", "shareapitestscreatesnapshot3086930738fd74a7b4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotError.json new file mode 100644 index 000000000000..fb08c699ecaf --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesnapshoterror10660df1136d1e12?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "28c90f9d-b01a-0060-4512-5a7554000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:28c90f9d-b01a-0060-4512-5a7554000000\nTime:2019-08-24T00:26:26.7769419Z", + "Date" : "Sat, 24 Aug 2019 00:26:26 GMT", + "x-ms-client-request-id" : "556b2c68-0041-4d9e-a31f-1c66f01a2d14", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesnapshoterror10660df1136d1e12" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadata.json new file mode 100644 index 000000000000..ef54e6fb692e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadata.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesnapshotmetadata1302105b8452346?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B3AA0D1D\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fa0-b01a-0060-4712-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:26 GMT", + "x-ms-client-request-id" : "03a86df6-50f8-449e-8c6e-f52ebda4fd5d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesnapshotmetadata1302105b8452346?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-24T00:26:26.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B31CE500\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fa3-b01a-0060-4912-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:26 GMT", + "x-ms-client-request-id" : "6689a16c-e861-479c-8094-9b5c464c361e" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesnapshotmetadata1302105b8452346", "shareapitestscreatesnapshotmetadata5599951a8a2a605" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadataError.json new file mode 100644 index 000000000000..49aa29e01fc0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsCreateSnapshotMetadataError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestscreatesnapshotmetadataerror69575f1453b3?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "28c90fa6-b01a-0060-4c12-5a7554000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:28c90fa6-b01a-0060-4c12-5a7554000000\nTime:2019-08-24T00:26:27.2443901Zvalue", + "Date" : "Sat, 24 Aug 2019 00:26:26 GMT", + "x-ms-client-request-id" : "014a966b-7618-4a0d-a481-0550fae06b56", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestscreatesnapshotmetadataerror69575f1453b3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectory.json new file mode 100644 index 000000000000..ca6f3a8337ee --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectory.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeletedirectory111900b6c0fa6568d4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BD4B9E02\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28a6-e01a-00d9-4812-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:42 GMT", + "x-ms-client-request-id" : "92eb5b23-f281-47b7-acf1-b7370715f4df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeletedirectory111900b6c0fa6568d4/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:43.9429834Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:43 GMT", + "ETag" : "\"0x8D72829BDCEC6CA\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:26:43.9429834Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c28ab-e01a-00d9-4912-5a965a000000", + "x-ms-client-request-id" : "d986f848-4324-41c1-919f-9b2d36794b78", + "x-ms-file-last-write-time" : "2019-08-24T00:26:43.9429834Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeletedirectory111900b6c0fa6568d4/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "799c28ad-e01a-00d9-4b12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:43 GMT", + "x-ms-client-request-id" : "a7ad4588-f521-4ce9-8c30-d912531fe4f0" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeletedirectory111900b6c0fa6568d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectoryError.json new file mode 100644 index 000000000000..a03b7c5fea8d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteDirectoryError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeletedirectoryerror85143bc82138e58b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BDFE29E7\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28b1-e01a-00d9-4f12-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:43 GMT", + "x-ms-client-request-id" : "13d9ace2-b45c-4bce-a657-ce2ca8ea34c9" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeletedirectoryerror85143bc82138e58b/testdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "799c28b4-e01a-00d9-5012-5a965a000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:799c28b4-e01a-00d9-5012-5a965a000000\nTime:2019-08-24T00:26:44.9742311Z", + "Date" : "Sat, 24 Aug 2019 00:26:44 GMT", + "x-ms-client-request-id" : "6ced5d36-15d3-4c63-9319-4cf43f69dd63", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeletedirectoryerror85143bc82138e58b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFile.json new file mode 100644 index 000000000000..e70139f7daae --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFile.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeletefileshareapitestsdeletefile11b30380550?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BE88B192\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28b7-e01a-00d9-5312-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:44 GMT", + "x-ms-client-request-id" : "0d23b68f-f675-4ae1-9c42-fb815c46254d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeletefileshareapitestsdeletefile11b30380550/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:26:45.2082010Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:26:44 GMT", + "ETag" : "\"0x8D72829BE8FD55A\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:26:45.2082010Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "799c28b9-e01a-00d9-5412-5a965a000000", + "x-ms-client-request-id" : "0565b07a-593c-4d79-a07d-488385678900", + "x-ms-file-last-write-time" : "2019-08-24T00:26:45.2082010Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeletefileshareapitestsdeletefile11b30380550/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "799c28ba-e01a-00d9-5512-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:44 GMT", + "x-ms-client-request-id" : "da40fe51-6ec3-47ce-8d78-038559f07c31" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeletefileshareapitestsdeletefile11b30380550" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFileError.json new file mode 100644 index 000000000000..bda5e9756e15 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteFileError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeletefileerror63383e4c90c3f387f4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829BEACBD25\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "799c28bd-e01a-00d9-5812-5a965a000000", + "Date" : "Sat, 24 Aug 2019 00:26:44 GMT", + "x-ms-client-request-id" : "f48757c2-1c40-4360-84e4-3f29752edfb5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeletefileerror63383e4c90c3f387f4/testdirectory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "799c28bf-e01a-00d9-5912-5a965a000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:799c28bf-e01a-00d9-5912-5a965a000000\nTime:2019-08-24T00:26:45.8760985Z", + "Date" : "Sat, 24 Aug 2019 00:26:45 GMT", + "x-ms-client-request-id" : "2323ed0d-a1e4-4007-acfb-085b2eda8e70", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeletefileerror63383e4c90c3f387f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShare.json new file mode 100644 index 000000000000..5cb95c66cdbb --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShare.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeleteshareshareapitestsdeletesharec1657962aa?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B3EE049B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fa8-b01a-0060-4e12-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:26 GMT", + "x-ms-client-request-id" : "937339b3-1e1b-492d-ab4c-65e274e36cfb" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeleteshareshareapitestsdeletesharec1657962aa?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "28c90faa-b01a-0060-4f12-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:27 GMT", + "x-ms-client-request-id" : "f6b365ec-2618-4adc-a577-e8349ee02d62" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeleteshareshareapitestsdeletesharec1657962aa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShareError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShareError.json new file mode 100644 index 000000000000..1072efecfe07 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsDeleteShareError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsdeleteshareerror62116821a46a409df4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "28c90fac-b01a-0060-5112-5a7554000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:28c90fac-b01a-0060-5112-5a7554000000\nTime:2019-08-24T00:26:27.5346685Z", + "Date" : "Sat, 24 Aug 2019 00:26:27 GMT", + "x-ms-client-request-id" : "f743aa71-10ae-4d81-b125-af1f9942e689", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsdeleteshareerror62116821a46a409df4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetFileClientDoesNotCreateAFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetFileClientDoesNotCreateAFile.json new file mode 100644 index 000000000000..27c34297959b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetFileClientDoesNotCreateAFile.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareapitestsgetfileclientdoesnotcreateafile477356d19b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetProperties.json new file mode 100644 index 000000000000..7326e9c51065 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetProperties.json @@ -0,0 +1,48 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsgetproperties02636f24f8ee2c23440?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B418051A\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90faf-b01a-0060-5412-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:27 GMT", + "x-ms-client-request-id" : "00cc4d2e-ce39-4ad7-9088-c303df20f908" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsgetproperties02636f24f8ee2c23440?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:27 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "1", + "ETag" : "\"0x8D72829B418051A\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-meta-testmetadata" : "value", + "Content-Length" : "0", + "x-ms-request-id" : "28c90fb1-b01a-0060-5512-5a7554000000", + "x-ms-client-request-id" : "fb5aa2ca-4b90-42ee-99cf-d2336653bc9a" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsgetproperties02636f24f8ee2c23440" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..939b6075cd66 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetPropertiesError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestsgetpropertieserror44424846bd087a756?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "28c90fb4-b01a-0060-5812-5a7554000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:28c90fb4-b01a-0060-5812-5a7554000000\nTime:2019-08-24T00:26:28.0311453Z", + "Date" : "Sat, 24 Aug 2019 00:26:27 GMT", + "x-ms-client-request-id" : "5da38a4f-8f88-4f14-ae2b-6cada698cde3", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestsgetpropertieserror44424846bd087a756" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetRootDirectoryClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetRootDirectoryClient.json new file mode 100644 index 000000000000..5ad409ca5ea5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetRootDirectoryClient.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareapitestsgetrootdirectoryclient04644f52b15627d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetShareURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetShareURL.json new file mode 100644 index 000000000000..da43350c223c --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetShareURL.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareapitestsgetshareurlshareapitestsgetshareurl6426486354" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..7925509da544 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsGetSnapshotId.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareapitestsgetsnapshotid7507841505cffe82b4d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadata.json new file mode 100644 index 000000000000..d9d1fef47f62 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadata.json @@ -0,0 +1,92 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestssetmetadatashareapitestssetmetadata9f0882023a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B4B26F33\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fc2-b01a-0060-6212-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:28 GMT", + "x-ms-client-request-id" : "dbdcd94f-b337-40cb-84b4-9065f1c16fe3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestssetmetadatashareapitestssetmetadata9f0882023a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:28 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "5120", + "ETag" : "\"0x8D72829B4B26F33\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-meta-testmetadata" : "value", + "Content-Length" : "0", + "x-ms-request-id" : "28c90fc4-b01a-0060-6312-5a7554000000", + "x-ms-client-request-id" : "cc354db3-518a-416d-8d0b-71f2c04bb972" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestssetmetadatashareapitestssetmetadata9f0882023a?restype=share&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B590901F\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "28c90fc5-b01a-0060-6412-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:29 GMT", + "x-ms-client-request-id" : "0e42f9d3-bf10-4714-8e9f-3619952df961" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestssetmetadatashareapitestssetmetadata9f0882023a?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:29 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "5120", + "ETag" : "\"0x8D72829B590901F\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-meta-afterset" : "value", + "Content-Length" : "0", + "x-ms-request-id" : "28c90fc6-b01a-0060-6512-5a7554000000", + "x-ms-client-request-id" : "b1ac4a15-0f77-439f-99e3-e1aa431c856f" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestssetmetadatashareapitestssetmetadata9f0882023a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadataError.json new file mode 100644 index 000000000000..e82831941359 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetMetadataError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestssetmetadataerror3451984c2678b35a94?restype=share&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "28c90fc9-b01a-0060-6812-5a7554000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:28c90fc9-b01a-0060-6812-5a7554000000\nTime:2019-08-24T00:26:30.4144314Z", + "Date" : "Sat, 24 Aug 2019 00:26:30 GMT", + "x-ms-client-request-id" : "168ce75f-9835-4f22-9800-ba1785845e70", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestssetmetadataerror3451984c2678b35a94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuota.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuota.json new file mode 100644 index 000000000000..936ee5e4bca2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuota.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestssetquotashareapitestssetquotac4614252fc6fe?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B4643C03\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "28c90fb7-b01a-0060-5a12-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:27 GMT", + "x-ms-client-request-id" : "bab1999e-27fc-43b1-9dad-887efe1ac9f5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestssetquotashareapitestssetquotac4614252fc6fe?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:27 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "1", + "ETag" : "\"0x8D72829B4643C03\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "28c90fb9-b01a-0060-5b12-5a7554000000", + "x-ms-client-request-id" : "356a71f1-1000-4219-932b-67bc6dee38b8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestssetquotashareapitestssetquotac4614252fc6fe?restype=share&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829B4828831\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "28c90fba-b01a-0060-5c12-5a7554000000", + "Date" : "Sat, 24 Aug 2019 00:26:27 GMT", + "x-ms-client-request-id" : "58492c1b-3cc2-417b-bd66-433548e014d6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestssetquotashareapitestssetquotac4614252fc6fe?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Sat, 24 Aug 2019 00:26:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:26:27 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "2", + "ETag" : "\"0x8D72829B4828831\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "28c90fbb-b01a-0060-5d12-5a7554000000", + "x-ms-client-request-id" : "10bbb6a6-9bab-4db5-835d-c794857c5b74" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestssetquotashareapitestssetquotac4614252fc6fe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuotaError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuotaError.json new file mode 100644 index 000000000000..0f7b35c04168 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAPITestsSetQuotaError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareapitestssetquotaerror37898c2081c075cc242?restype=share&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "28c90fc0-b01a-0060-6012-5a7554000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:28c90fc0-b01a-0060-6012-5a7554000000\nTime:2019-08-24T00:26:28.5486415Z", + "Date" : "Sat, 24 Aug 2019 00:26:28 GMT", + "x-ms-client-request-id" : "8c8631e4-e279-483f-a625-733ad27bc1a3", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareapitestssetquotaerror37898c2081c075cc242" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectory.json new file mode 100644 index 000000000000..1d22558452f4 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectory.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatedirectory03332765a00f6799?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DE2CCF76\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179c9c-201a-00cf-5512-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:37 GMT", + "x-ms-client-request-id" : "6a92f412-057a-4634-b3f3-d944d8ca7615" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatedirectory03332765a00f6799/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:38.3953100Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:37 GMT", + "ETag" : "\"0x8D72829DE438ACC\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:38.3953100Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "ab179c9e-201a-00cf-5612-5a57c4000000", + "x-ms-client-request-id" : "91474123-c9b1-4c79-a20b-dae7f4f9b0c3", + "x-ms-file-last-write-time" : "2019-08-24T00:27:38.3953100Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectory03332765a00f6799" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryInvalidName.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryInvalidName.json new file mode 100644 index 000000000000..016621227f02 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryInvalidName.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatedirectoryinvalidname4438973bb4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DE626B91\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179ca2-201a-00cf-5912-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:37 GMT", + "x-ms-client-request-id" : "2da627c0-e099-44a0-956c-ff722952372d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatedirectoryinvalidname4438973bb4/test%2fdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ParentNotFound", + "retry-after" : "0", + "Content-Length" : "224", + "StatusCode" : "404", + "x-ms-request-id" : "ab179ca4-201a-00cf-5a12-5a57c4000000", + "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:ab179ca4-201a-00cf-5a12-5a57c4000000\nTime:2019-08-24T00:27:38.6497215Z", + "Date" : "Sat, 24 Aug 2019 00:27:37 GMT", + "x-ms-client-request-id" : "4ec95217-c032-44a5-be33-f68400ff3b68", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectoryinvalidname4438973bb4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadata.json new file mode 100644 index 000000000000..2204f0be2d79 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadata.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatedirectorymetadata446183bf2c8e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DE7F496E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179ca7-201a-00cf-5d12-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:37 GMT", + "x-ms-client-request-id" : "911fbd32-5253-4795-92e6-ae5a73327ff5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatedirectorymetadata446183bf2c8e/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:38.8547527Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:37 GMT", + "ETag" : "\"0x8D72829DE89A5C7\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:38.8547527Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "ab179ca9-201a-00cf-5e12-5a57c4000000", + "x-ms-client-request-id" : "380f2c27-e7fb-4530-8c1a-a55b73f727c5", + "x-ms-file-last-write-time" : "2019-08-24T00:27:38.8547527Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectorymetadata446183bf2c8e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataError.json new file mode 100644 index 000000000000..ce27905cefd8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateDirectoryMetadataError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatedirectorymetadataerror15677e39c?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DEACA615\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179cac-201a-00cf-6112-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:38 GMT", + "x-ms-client-request-id" : "88562efc-4725-49de-9e5b-7eb3c1c421a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatedirectorymetadataerror15677e39c/testdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "ab179cae-201a-00cf-6212-5a57c4000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:ab179cae-201a-00cf-6212-5a57c4000000\nTime:2019-08-24T00:27:39.1341858Zvalue", + "Date" : "Sat, 24 Aug 2019 00:27:38 GMT", + "x-ms-client-request-id" : "192004c8-2c06-4c4f-a0c3-d7e0ab74b8b0", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatedirectorymetadataerror15677e39c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFile.json new file mode 100644 index 000000000000..1a43156ae844 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFile.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefile0656657f6cdbeec3f4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DECA2066\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179cb1-201a-00cf-6512-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:38 GMT", + "x-ms-client-request-id" : "8073c0a5-56f3-4d62-8fcd-8502866446de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefile0656657f6cdbeec3f4/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:39.3342130Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:38 GMT", + "ETag" : "\"0x8D72829DED2CEB2\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:39.3342130Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "ab179cb3-201a-00cf-6612-5a57c4000000", + "x-ms-client-request-id" : "6159ddf8-d608-47e8-a222-a34745462ba7", + "x-ms-file-last-write-time" : "2019-08-24T00:27:39.3342130Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefile0656657f6cdbeec3f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs0.json new file mode 100644 index 000000000000..3630cde9bcb3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs0.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefileinvalidargs0290994559348?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DEEACFBF\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179cb6-201a-00cf-6912-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:38 GMT", + "x-ms-client-request-id" : "8a445710-efaf-4534-8fdf-55c270352e72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefileinvalidargs0290994559348/test%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:27:38 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefileinvalidargs0290994559348" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs1.json new file mode 100644 index 000000000000..a8e3040772f0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileInvalidArgs1.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefileinvalidargs1502508eb1506?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DF189E87\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fa95787b-b01a-006b-6912-5a6d20000000", + "Date" : "Sat, 24 Aug 2019 00:27:39 GMT", + "x-ms-client-request-id" : "3fe5b75b-8b63-427a-a972-9d1a5d0cc33e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefileinvalidargs1502508eb1506/fileName", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "236", + "StatusCode" : "400", + "x-ms-request-id" : "fa95787d-b01a-006b-6a12-5a6d20000000", + "Body" : "OutOfRangeInputThe file size exceeds the maximum permissible limit.\nRequestId:fa95787d-b01a-006b-6a12-5a6d20000000\nTime:2019-08-24T00:27:39.8577953Z", + "Date" : "Sat, 24 Aug 2019 00:27:39 GMT", + "x-ms-client-request-id" : "ab6da204-608a-4ea0-ac7c-25bc0808a181", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefileinvalidargs1502508eb1506" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverload.json new file mode 100644 index 000000000000..296c503bde2e --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverload.json @@ -0,0 +1,52 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefilemaxoverload84585a39edba2?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DF4F4C42\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fa957881-b01a-006b-6d12-5a6d20000000", + "Date" : "Sat, 24 Aug 2019 00:27:39 GMT", + "x-ms-client-request-id" : "9c00872b-e274-4a55-b725-2b8885347cc7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefilemaxoverload84585a39edba2/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:40.2090514Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:39 GMT", + "ETag" : "\"0x8D72829DF584C12\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:40.2090514Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "fa957883-b01a-006b-6e12-5a6d20000000", + "x-ms-client-request-id" : "f2c84521-13b3-40e9-a1de-fc8978c44ed7", + "x-ms-file-last-write-time" : "2019-08-24T00:27:40.2090514Z" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilemaxoverload84585a39edba2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json new file mode 100644 index 000000000000..196018da928f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs0.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs08708515?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DF6F1101\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fa95788a-b01a-006b-7212-5a6d20000000", + "Date" : "Sat, 24 Aug 2019 00:27:40 GMT", + "x-ms-client-request-id" : "6d7d2610-4350-42e2-8512-0de92c7e42a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs08708515/test%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:27:40 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilemaxoverloadinvalidargs08708515" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json new file mode 100644 index 000000000000..b8359d57ec1d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs1.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs194529d1?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DF9D4F7B\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6d487860-801a-004a-7a12-5a0011000000", + "Date" : "Sat, 24 Aug 2019 00:27:40 GMT", + "x-ms-client-request-id" : "05507e2c-8f01-4604-befa-c925eff9a59e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs194529d1/test%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:27:40 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilemaxoverloadinvalidargs194529d1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json new file mode 100644 index 000000000000..fbf18c52301d --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs2.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs25143349?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E02252F7\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ef4a4537-901a-011e-4412-5aacce000000", + "Date" : "Sat, 24 Aug 2019 00:27:41 GMT", + "x-ms-client-request-id" : "552f7adc-3d5f-46fd-928c-f042a1d81969" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs25143349/test%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:27:41 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilemaxoverloadinvalidargs25143349" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json new file mode 100644 index 000000000000..eaeba450d068 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateFileMaxOverloadInvalidArgs3.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs393389bf?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E0DB24C4\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "a99ecb83-201a-004c-5b12-5af769000000", + "Date" : "Sat, 24 Aug 2019 00:27:42 GMT", + "x-ms-client-request-id" : "b1ace825-318a-4ccf-bd60-9a3504da9006" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatefilemaxoverloadinvalidargs393389bf/test%0cile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "324", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid URL

            \r\n

            HTTP Error 400. The request URL is invalid.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:27:42 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatefilemaxoverloadinvalidargs393389bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShare.json new file mode 100644 index 000000000000..bf49fb0c2370 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShare.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreateshare2081705e46b5ae7c84?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DC6F765C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4d2-801a-010a-2a12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:34 GMT", + "x-ms-client-request-id" : "f36cfb5c-40c8-4519-af52-b9b5d4c91367" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreateshare2081705e46b5ae7c84" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs0.json new file mode 100644 index 000000000000..668ca9ce317a --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs0.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesharewithargs010133be9dab4b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DC80DFC8\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4d6-801a-010a-2d12-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:34 GMT", + "x-ms-client-request-id" : "70334852-abc3-47a8-bf87-0370607da35c" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithargs010133be9dab4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs1.json new file mode 100644 index 000000000000..83fbdb3a01f6 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs1.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesharewithargs177147328c5a48?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DC93D017\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4da-801a-010a-3012-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "x-ms-client-request-id" : "ca4fa4b6-cf84-4514-b2d9-f6f50e035b6f" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithargs177147328c5a48" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs2.json new file mode 100644 index 000000000000..d78059086f18 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs2.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesharewithargs271807e3853018?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DCA9CE72\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4df-801a-010a-3312-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "x-ms-client-request-id" : "22799d43-e867-4477-97e1-cdbf673eefbd" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithargs271807e3853018" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs3.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs3.json new file mode 100644 index 000000000000..edb353d6f1ca --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithArgs3.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesharewithargs3456653cfee5ed?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DCBC97B3\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "42bce4e3-801a-010a-3612-5a6faa000000", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "x-ms-client-request-id" : "12c120ed-6bf1-4114-abec-76068500ba18" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithargs3456653cfee5ed" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs0.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs0.json new file mode 100644 index 000000000000..b2e8e9810cef --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesharewithinvalidargs056303340e6?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "42bce4e7-801a-010a-3912-5a6faa000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:42bce4e7-801a-010a-3912-5a6faa000000\nTime:2019-08-24T00:27:35.9893308Zvalue", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "x-ms-client-request-id" : "8db37f9a-35f4-4424-9529-3a2907df2f9c", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithinvalidargs056303340e6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs1.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs1.json new file mode 100644 index 000000000000..c0cac04c84d5 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs1.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesharewithinvalidargs168377f63d6?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "339", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid Header

            \r\n

            HTTP Error 400. The request has an invalid header name.

            \r\n\r\n", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "Content-Type" : "text/html; charset=us-ascii" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithinvalidargs168377f63d6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs2.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs2.json new file mode 100644 index 000000000000..8ee839c45bd2 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateShareWithInvalidArgs2.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesharewithinvalidargs297674169b0?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "ab179c6d-201a-00cf-2f12-5a57c4000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:ab179c6d-201a-00cf-2f12-5a57c4000000\nTime:2019-08-24T00:27:36.3945672Zx-ms-share-quota6000", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "x-ms-client-request-id" : "172575b0-b55d-4f42-a903-655e17427f37", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesharewithinvalidargs297674169b0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshot.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshot.json new file mode 100644 index 000000000000..4c31c143733b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshot.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesnapshot187331a929748430?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DD209C36\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179c6f-201a-00cf-3112-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "x-ms-client-request-id" : "74a2da13-61e7-437b-862e-792be40e5aee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesnapshot187331a929748430?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-24T00:27:36.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DD209C36\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179c71-201a-00cf-3212-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "x-ms-client-request-id" : "d385cdd6-08c1-4040-9b4b-b39c21cbd305" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesnapshot187331a929748430", "shareasyncapitestscreatesnapshot83298fda2dad6c6e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotError.json new file mode 100644 index 000000000000..cc45db9159dc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesnapshoterror215189980a1136?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "ab179c74-201a-00cf-3512-5a57c4000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:ab179c74-201a-00cf-3512-5a57c4000000\nTime:2019-08-24T00:27:36.7108714Z", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "x-ms-client-request-id" : "30e65792-2383-4761-968e-2a44c168e732", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesnapshoterror215189980a1136" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadata.json new file mode 100644 index 000000000000..303ce308fdcc --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadata.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesnapshotmetadata0672436c4a64?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DD4E4715\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179c77-201a-00cf-3712-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "x-ms-client-request-id" : "25ff798e-6a78-45a0-beec-086d95ee4524" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesnapshotmetadata0672436c4a64?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-24T00:27:36.0000000Z", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DCD60C00\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179c79-201a-00cf-3812-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:35 GMT", + "x-ms-client-request-id" : "1234cdf8-e511-4981-86e9-e58f30b5a82c" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesnapshotmetadata0672436c4a64", "shareasyncapitestscreatesnapshotmetadata362446cb1528" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadataError.json new file mode 100644 index 000000000000..3aede14d6be3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsCreateSnapshotMetadataError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestscreatesnapshotmetadataerror288669910b?restype=share&comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "ab179c7c-201a-00cf-3b12-5a57c4000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:ab179c7c-201a-00cf-3b12-5a57c4000000\nTime:2019-08-24T00:27:36.9821297Zvalue", + "Date" : "Sat, 24 Aug 2019 00:27:36 GMT", + "x-ms-client-request-id" : "120013bc-b48c-411e-9b5e-aeef4d24fd03", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestscreatesnapshotmetadataerror288669910b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectory.json new file mode 100644 index 000000000000..a03fb3631635 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectory.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeletedirectory3999222479088b68?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E11B1A07\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf575-c01a-0046-3e12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:43 GMT", + "x-ms-client-request-id" : "443f0df2-60b6-4253-a5c2-35b835a4b69e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeletedirectory3999222479088b68/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "16004293428625128841*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:43.2099359Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:43 GMT", + "ETag" : "\"0x8D72829E122321F\"", + "x-ms-file-attributes" : "Directory", + "x-ms-file-change-time" : "2019-08-24T00:27:43.2099359Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf578-c01a-0046-3f12-5aeee0000000", + "x-ms-client-request-id" : "34667a13-1116-45f6-b9d4-59bdefb701af", + "x-ms-file-last-write-time" : "2019-08-24T00:27:43.2099359Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeletedirectory3999222479088b68/testCreateDirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b02cf579-c01a-0046-4012-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:43 GMT", + "x-ms-client-request-id" : "4d89a98b-bd17-4cde-8cb9-2e3820fef30f" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeletedirectory3999222479088b68" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectoryError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectoryError.json new file mode 100644 index 000000000000..f83edecf2f45 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteDirectoryError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeletedirectoryerror1352060aa5f1b?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E13D776E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf57d-c01a-0046-4412-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:43 GMT", + "x-ms-client-request-id" : "c04655b0-98a5-4b05-9f53-46e07893428e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeletedirectoryerror1352060aa5f1b/testdirectory?restype=directory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "b02cf57f-c01a-0046-4512-5aeee0000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:b02cf57f-c01a-0046-4512-5aeee0000000\nTime:2019-08-24T00:27:44.0392777Z", + "Date" : "Sat, 24 Aug 2019 00:27:43 GMT", + "x-ms-client-request-id" : "0dc04467-9918-4dbc-bb22-5565cd467a6b", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeletedirectoryerror1352060aa5f1b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFile.json new file mode 100644 index 000000000000..96392b354aa9 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFile.json @@ -0,0 +1,70 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeletefile803025fee3cde7b124?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E1BE116C\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf583-c01a-0046-4812-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:44 GMT", + "x-ms-client-request-id" : "8e30087a-d808-4361-bf08-9817d8c6607e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeletefile803025fee3cde7b124/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-file-permission-key" : "2189138948451189390*13168958551941065216", + "x-ms-file-id" : "13835128424026341376", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-file-creation-time" : "2019-08-24T00:27:44.2789621Z", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Sat, 24 Aug 2019 00:27:44 GMT", + "ETag" : "\"0x8D72829E1C550F5\"", + "x-ms-file-attributes" : "Archive", + "x-ms-file-change-time" : "2019-08-24T00:27:44.2789621Z", + "x-ms-file-parent-id" : "0", + "Content-Length" : "0", + "x-ms-request-id" : "b02cf585-c01a-0046-4912-5aeee0000000", + "x-ms-client-request-id" : "180b139a-1847-4839-ab75-cb69bf92bad1", + "x-ms-file-last-write-time" : "2019-08-24T00:27:44.2789621Z" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeletefile803025fee3cde7b124/testCreateFile", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b02cf586-c01a-0046-4a12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:44 GMT", + "x-ms-client-request-id" : "9c3007d4-dadd-4a2d-9db2-825b64bbc80e" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeletefile803025fee3cde7b124" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFileError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFileError.json new file mode 100644 index 000000000000..f319034fea67 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteFileError.json @@ -0,0 +1,45 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeletefileerror76215d6e5c307529?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829E1E0E442\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b02cf589-c01a-0046-4d12-5aeee0000000", + "Date" : "Sat, 24 Aug 2019 00:27:44 GMT", + "x-ms-client-request-id" : "a2b6e9fa-2b73-4682-bf9a-32690cdb56f5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeletefileerror76215d6e5c307529/testdirectory", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "b02cf58b-c01a-0046-4e12-5aeee0000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:b02cf58b-c01a-0046-4e12-5aeee0000000\nTime:2019-08-24T00:27:44.5307462Z", + "Date" : "Sat, 24 Aug 2019 00:27:44 GMT", + "x-ms-client-request-id" : "77760412-a44a-4299-9cee-ffedd504f1bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeletefileerror76215d6e5c307529" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShare.json new file mode 100644 index 000000000000..4b1fbaf9c9d0 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShare.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeleteshare782836ffe666183c94?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DD7C4019\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179c7e-201a-00cf-3d12-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:36 GMT", + "x-ms-client-request-id" : "e44b5e19-9e90-48c9-9325-ca34a87a371f" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeleteshare782836ffe666183c94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShareError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShareError.json new file mode 100644 index 000000000000..12ddd4c0698b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsDeleteShareError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsdeleteshareerror33490c5fbd2e369?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "ab179c82-201a-00cf-4012-5a57c4000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:ab179c82-201a-00cf-4012-5a57c4000000\nTime:2019-08-24T00:27:37.2734061Z", + "Date" : "Sat, 24 Aug 2019 00:27:36 GMT", + "x-ms-client-request-id" : "752a91da-0962-4059-b6e8-bf54fe0879b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsdeleteshareerror33490c5fbd2e369" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetFileClientDoesNotCreateAFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetFileClientDoesNotCreateAFile.json new file mode 100644 index 000000000000..744cd360438b --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetFileClientDoesNotCreateAFile.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareasyncapitestsgetfileclientdoesnotcreateafile325421c3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetProperties.json new file mode 100644 index 000000000000..b92deabed2b8 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetProperties.json @@ -0,0 +1,48 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsgetproperties90194c80807720792?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DDA75245\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179c84-201a-00cf-4212-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:36 GMT", + "x-ms-client-request-id" : "fac4c082-8c87-4c39-8d98-8453451aa07b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsgetproperties90194c80807720792?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Sat, 24 Aug 2019 00:27:36 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-share-quota" : "1", + "ETag" : "\"0x8D72829DDA75245\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-meta-testmetadata" : "value", + "Content-Length" : "0", + "x-ms-request-id" : "ab179c86-201a-00cf-4312-5a57c4000000", + "x-ms-client-request-id" : "b59f43ed-1f4f-4455-8e97-b5e6465368bc" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsgetproperties90194c80807720792" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..a87e5ac029d3 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetPropertiesError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestsgetpropertieserror36577569790686?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "ab179c89-201a-00cf-4612-5a57c4000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:ab179c89-201a-00cf-4612-5a57c4000000\nTime:2019-08-24T00:27:37.5666853Z", + "Date" : "Sat, 24 Aug 2019 00:27:36 GMT", + "x-ms-client-request-id" : "3d4de2a8-089c-4e98-abe4-ffea41b6d91d", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestsgetpropertieserror36577569790686" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetRootDirectoryClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetRootDirectoryClient.json new file mode 100644 index 000000000000..53cc54834336 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetRootDirectoryClient.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareasyncapitestsgetrootdirectoryclient15165a495abc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetShareURL.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetShareURL.json new file mode 100644 index 000000000000..88be48038627 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetShareURL.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareasyncapitestsgetshareurl086658051a760f3f44" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetSnapshotId.json new file mode 100644 index 000000000000..826b3d194e29 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsGetSnapshotId.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "shareasyncapitestsgetsnapshotid08330c2253f33fc26" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadata.json new file mode 100644 index 000000000000..5b5f0240911f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadata.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestssetmetadata44359b8571b61d54f4?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DE0C955E\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179c93-201a-00cf-4e12-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:37 GMT", + "x-ms-client-request-id" : "d7726656-bc57-42f6-b0ae-9904c9b30175" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestssetmetadata44359b8571b61d54f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadataError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadataError.json new file mode 100644 index 000000000000..a3dc18a3303f --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetMetadataError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestssetmetadataerror43755a3141227ff?restype=share&comp=metadata", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "ab179c99-201a-00cf-5212-5a57c4000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:ab179c99-201a-00cf-5212-5a57c4000000\nTime:2019-08-24T00:27:38.1682598Z", + "Date" : "Sat, 24 Aug 2019 00:27:37 GMT", + "x-ms-client-request-id" : "5c9f1300-022e-41bf-903c-53bf9a40bc57", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestssetmetadataerror43755a3141227ff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuota.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuota.json new file mode 100644 index 000000000000..9ba6a5b70bda --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuota.json @@ -0,0 +1,24 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestssetquota8122246c2ce41c6524e?restype=share", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72829DDD487BA\"", + "Last-Modified" : "Sat, 24 Aug 2019 00:27:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ab179c8c-201a-00cf-4812-5a57c4000000", + "Date" : "Sat, 24 Aug 2019 00:27:36 GMT", + "x-ms-client-request-id" : "eda6f34e-696d-451a-ac68-1658d75002a8" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestssetquota8122246c2ce41c6524e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuotaError.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuotaError.json new file mode 100644 index 000000000000..1c951658e1c7 --- /dev/null +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/ShareAsyncAPITestsSetQuotaError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/shareasyncapitestssetquotaerror95408106cca188f0b?restype=share&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ShareNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "ab179c91-201a-00cf-4c12-5a57c4000000", + "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:ab179c91-201a-00cf-4c12-5a57c4000000\nTime:2019-08-24T00:27:37.9460466Z", + "Date" : "Sat, 24 Aug 2019 00:27:36 GMT", + "x-ms-client-request-id" : "1fd2aecc-b25b-436d-868a-e0d6b3ccabd3", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "shareasyncapitestssetquotaerror95408106cca188f0b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/abortCopy.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/abortCopy.json deleted file mode 100644 index b5ea8ea29e31..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/abortCopy.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "file59336dc2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/clearMetadataFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/clearMetadataFromDirClient.json deleted file mode 100644 index 7d422400647c..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/clearMetadataFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory909922?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CAC84923\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c3b-901a-0077-060a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory909922?restype=directory&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CACDEFC8\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c3c-901a-0077-070a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - } ], - "variables" : [ "directory909922" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryAlreadyExistsFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryAlreadyExistsFromShareClient.json deleted file mode 100644 index a99f682b4b55..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryAlreadyExistsFromShareClient.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share592387fe?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A138CAF\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e089-301a-00db-150a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share592387fe/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A1A6700\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e08b-301a-00db-160a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share592387fe/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceAlreadyExists", - "retry-after" : "0", - "Content-Length" : "228", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e08c-301a-00db-170a-4794a0000000", - "Body" : "ResourceAlreadyExistsThe specified resource already exists.\nRequestId:7f75e08c-301a-00db-170a-4794a0000000\nTime:2019-07-30T19:10:09.1716444Z", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share592387fe?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e08d-301a-00db-180a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - } ], - "variables" : [ "share592387fe" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryFromShareClient.json deleted file mode 100644 index e121e223a546..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share83224048?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A7CAE60B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:58 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b16-901a-0077-470a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share83224048/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A7D2774E\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:58 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b18-901a-0077-480a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share83224048?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b19-901a-0077-490a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT" - } - } ], - "variables" : [ "share83224048" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryInvalidNameFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryInvalidNameFromShareClient.json deleted file mode 100644 index b6b3eee03ea7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createDirectoryInvalidNameFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share46557ae3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218861EE83\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e03f-301a-00db-5e0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share46557ae3/test%2fshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ParentNotFound", - "retry-after" : "0", - "Content-Length" : "224", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e041-301a-00db-5f0a-4794a0000000", - "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:7f75e041-301a-00db-5f0a-4794a0000000\nTime:2019-07-30T19:10:06.3499048Z", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share46557ae3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e042-301a-00db-600a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - } ], - "variables" : [ "share46557ae3" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createExcessMaxSizeFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createExcessMaxSizeFromFileClient.json deleted file mode 100644 index 6e3aa0334742..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createExcessMaxSizeFromFileClient.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile9991231b", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150BA6C94\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df90-301a-00db-120a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:32 GMT" - } - }, { - "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile9991231b", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:08:32 GMT", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D7152150BA6C94\"", - "Content-Length" : "0", - "x-ms-request-id" : "7f75df91-301a-00db-130a-4794a0000000", - "Body" : "", - "Content-Type" : "application/octet-stream" - } - } ], - "variables" : [ "file9991231b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileAlreadyExistsFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileAlreadyExistsFromShareClient.json deleted file mode 100644 index abb8c1ed3489..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileAlreadyExistsFromShareClient.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share169076f6?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FEC55F2363\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:33:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "fe3f8c52-901a-00ff-29e7-470dee000000", - "Date" : "Wed, 31 Jul 2019 21:33:46 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share169076f6/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FEC582A3F0\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:33:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "fe3f8c56-901a-00ff-2ae7-470dee000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 31 Jul 2019 21:33:47 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share169076f6/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FEC58D7BFB\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:33:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "fe3f8c57-901a-00ff-2be7-470dee000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 31 Jul 2019 21:33:47 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share169076f6?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "fe3f8c58-901a-00ff-2ce7-470dee000000", - "Date" : "Wed, 31 Jul 2019 21:33:48 GMT" - } - } ], - "variables" : [ "share169076f6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromDirClient.json deleted file mode 100644 index b04154bc9821..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory792505?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9DF1003\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c1a-901a-0077-680a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory792505%2ftestfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9E70138\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c1b-901a-0077-690a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - } ], - "variables" : [ "directory792505" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromShareClient.json deleted file mode 100644 index 7c76401154cf..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share03861d68?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FC88DCA072\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:17:46 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "126db5f9-301a-0118-74e5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:17:46 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share03861d68/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FC88E2D9BC\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:17:46 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "126db5fb-301a-0118-75e5-475bb6000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 31 Jul 2019 21:17:46 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share03861d68?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "126db5fc-301a-0118-76e5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:17:46 GMT" - } - } ], - "variables" : [ "share03861d68" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileInvalidNameFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileInvalidNameFromShareClient.json deleted file mode 100644 index 6eb31f9d2af7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileInvalidNameFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90366cf0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FCA71C0432\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:18:37 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "126db6d0-301a-0118-7ae5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:18:37 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90366cf0/my%2fFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ParentNotFound", - "retry-after" : "0", - "Content-Length" : "224", - "StatusCode" : "404", - "x-ms-request-id" : "126db6d2-301a-0118-7be5-475bb6000000", - "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:126db6d2-301a-0118-7be5-475bb6000000\nTime:2019-07-31T21:18:37.6207977Z", - "Date" : "Wed, 31 Jul 2019 21:18:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90366cf0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "126db6d3-301a-0118-7ce5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:18:37 GMT" - } - } ], - "variables" : [ "share90366cf0" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileWithoutCreateDirFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileWithoutCreateDirFromDirClient.json deleted file mode 100644 index 2ec9e509b42a..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFileWithoutCreateDirFromDirClient.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory356143%2ftestfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ParentNotFound", - "retry-after" : "0", - "Content-Length" : "224", - "StatusCode" : "404", - "x-ms-request-id" : "260a2c3a-901a-0077-050a-47b537000000", - "Body" : "ParentNotFoundThe specified parent path does not exist.\nRequestId:260a2c3a-901a-0077-050a-47b537000000\nTime:2019-07-30T19:11:57.6002640Z", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory356143" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromFileClient.json index a18a5e25bc67..290acd437ef4 100644 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromFileClient.json +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromFileClient.json @@ -1,45 +1,46 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile295428e2", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile46052765", "Headers" : { "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-11-09", "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150C80472\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", + "ETag" : "\"0x8D724DE73E05B70\"", + "Last-Modified" : "Mon, 19 Aug 2019 19:50:14 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "7f75df92-301a-00db-140a-4794a0000000", + "x-ms-request-id" : "07d2b78c-e01a-0111-17c7-564138000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:32 GMT" - } + "Date" : "Mon, 19 Aug 2019 19:50:13 GMT" + }, + "Exception" : null }, { "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile295428e2", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile46052765", "Headers" : { "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" }, "Response" : { + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", "x-ms-version" : "2018-11-09", "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", + "ETag" : "\"0x8D724DE73E05B70\"", + "Last-Modified" : "Mon, 19 Aug 2019 19:50:14 GMT", "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:08:32 GMT", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D7152150C80472\"", "Content-Length" : "1024", - "x-ms-request-id" : "7f75df93-301a-00db-150a-4794a0000000", - "Body" : "", + "StatusCode" : "200", + "x-ms-request-id" : "07d2b78d-e01a-0111-18c7-564138000000", + "Date" : "Mon, 19 Aug 2019 19:50:13 GMT", "Content-Type" : "application/octet-stream" - } + }, + "Exception" : null } ], - "variables" : [ "file295428e2" ] + "variables" : [ "file46052765" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromShareClient.json deleted file mode 100644 index 72644e036310..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createFromShareClient.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share00216e0e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A817B8FD\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b22-901a-0077-500a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share00216e0e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b24-901a-0077-510a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - } ], - "variables" : [ "share00216e0e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createInvalidQuotaFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createInvalidQuotaFromShareClient.json deleted file mode 100644 index 6c5fc9f4e725..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createInvalidQuotaFromShareClient.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share43293a8e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "324", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e0db-301a-00db-370a-4794a0000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:7f75e0db-301a-00db-370a-4794a0000000\nTime:2019-07-30T19:10:55.3593903Zx-ms-share-quota-1", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share43293a8e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "323", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e0dc-301a-00db-380a-4794a0000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:7f75e0dc-301a-00db-380a-4794a0000000\nTime:2019-07-30T19:10:55.3894192Zx-ms-share-quota0", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share43293a8e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e0dd-301a-00db-390a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e0dd-301a-00db-390a-4794a0000000\nTime:2019-07-30T19:10:55.4264552Z", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share43293a8e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createMinFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createMinFromDirClient.json deleted file mode 100644 index 23ca0bd5d774..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createMinFromDirClient.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory691924?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9C603AF\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c16-901a-0077-650a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - } ], - "variables" : [ "directory691924" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createShare.json deleted file mode 100644 index 320eb32cca07..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShare.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share91577f17?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152202777831\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1d9-b01a-000d-690a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share91577f17&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1db-b01a-000d-6a0a-47df7a000000", - "Body" : "share91577f17share91577f17Tue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202777831\"5120", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share91577f17?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1dc-b01a-000d-6b0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - } ], - "variables" : [ "share91577f17" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareInvalidQuota.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareInvalidQuota.json deleted file mode 100644 index dcbdfdc66401..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareInvalidQuota.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share46048d7b?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "324", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed1d4-b01a-000d-640a-47df7a000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:9ebed1d4-b01a-000d-640a-47df7a000000\nTime:2019-07-30T19:13:30.7817153Zx-ms-share-quota-1", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share46048d7b?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "329", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed1d5-b01a-000d-650a-47df7a000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:9ebed1d5-b01a-000d-650a-47df7a000000\nTime:2019-07-30T19:13:30.8077419Zx-ms-share-quota9999999", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share46048d7b&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1d6-b01a-000d-660a-47df7a000000", - "Body" : "share46048d7b", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share46048d7b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceDifferentMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceDifferentMetadata.json deleted file mode 100644 index 1a39d6ada921..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceDifferentMetadata.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share2239261e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152200C98FA6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:28 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2cb6-901a-0077-280a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share2239261e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "260a2cb8-901a-0077-290a-47b537000000", - "Body" : "ShareAlreadyExistsThe specified share already exists.\nRequestId:260a2cb8-901a-0077-290a-47b537000000\nTime:2019-07-30T19:13:28.2855742Z", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share2239261e&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2cb9-901a-0077-2a0a-47b537000000", - "Body" : "share2239261eshare2239261eTue, 30 Jul 2019 19:13:28 GMT\"0x8D7152200C98FA6\"5120", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share2239261e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Connection" : "close", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2cba-901a-0077-2b0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT" - } - } ], - "variables" : [ "share2239261e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceSameMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceSameMetadata.json deleted file mode 100644 index 9c6ccdc075eb..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createShareTwiceSameMetadata.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80585a06?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521E5C4F58C\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:12:42 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c6c-901a-0077-150a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80585a06?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "260a2c6f-901a-0077-160a-47b537000000", - "Body" : "ShareAlreadyExistsThe specified share already exists.\nRequestId:260a2c6f-901a-0077-160a-47b537000000\nTime:2019-07-30T19:12:42.9539281Z", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share80585a06&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c70-901a-0077-170a-47b537000000", - "Body" : "share80585a06share80585a06Tue, 30 Jul 2019 19:12:42 GMT\"0x8D71521E5C4F58C\"5120", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80585a06?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2c71-901a-0077-180a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT" - } - } ], - "variables" : [ "share80585a06" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectory.json deleted file mode 100644 index a9f6935503ee..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectory.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory68944e?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9963569\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c10-901a-0077-5f0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory68944e%2fdir429318274?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C99B8DEE\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c11-901a-0077-600a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - } ], - "variables" : [ "directory68944e", "dir429318274" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryTwiceSameMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryTwiceSameMetadata.json deleted file mode 100644 index 402ab876c4f6..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryTwiceSameMetadata.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory07490f?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CAA3A12D\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c37-901a-0077-020a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory07490f%2fdir8393011e2?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CAAB442C\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c38-901a-0077-030a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory07490f%2fdir8393011e2?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceAlreadyExists", - "retry-after" : "0", - "Content-Length" : "228", - "StatusCode" : "409", - "x-ms-request-id" : "260a2c39-901a-0077-040a-47b537000000", - "Body" : "ResourceAlreadyExistsThe specified resource already exists.\nRequestId:260a2c39-901a-0077-040a-47b537000000\nTime:2019-07-30T19:11:57.4971668Z", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory07490f", "dir8393011e2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryWithMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryWithMetadata.json deleted file mode 100644 index 1474ed7f798a..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createSubDirectoryWithMetadata.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory090720?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA96A5BA\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c35-901a-0077-800a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory090720%2fdir9733962ce?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA9C7382\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c36-901a-0077-010a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - } ], - "variables" : [ "directory090720", "dir9733962ce" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceDifferentMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceDifferentMetadataFromShareClient.json deleted file mode 100644 index e3995b2568b1..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceDifferentMetadataFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share92856abd?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521AA260921\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b41-901a-0077-660a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share92856abd?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "260a2b43-901a-0077-670a-47b537000000", - "Body" : "ShareAlreadyExistsThe specified share already exists.\nRequestId:260a2b43-901a-0077-670a-47b537000000\nTime:2019-07-30T19:11:02.9268321Z", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share92856abd?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b44-901a-0077-680a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - } ], - "variables" : [ "share92856abd" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceFromDirClient.json deleted file mode 100644 index 2d886a08bd02..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory907393?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA27754C\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c25-901a-0077-710a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory907393?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceAlreadyExists", - "retry-after" : "0", - "Content-Length" : "228", - "StatusCode" : "409", - "x-ms-request-id" : "260a2c26-901a-0077-720a-47b537000000", - "Body" : "ResourceAlreadyExistsThe specified resource already exists.\nRequestId:260a2c26-901a-0077-720a-47b537000000\nTime:2019-07-30T19:11:56.6343556Z", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory907393" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceSameMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceSameMetadataFromShareClient.json deleted file mode 100644 index 0d6d8afe7014..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createTwiceSameMetadataFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share00092d21?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A77705C\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e09b-301a-00db-220a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share00092d21?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e09d-301a-00db-230a-4794a0000000", - "Body" : "ShareAlreadyExistsThe specified share already exists.\nRequestId:7f75e09d-301a-00db-230a-4794a0000000\nTime:2019-07-30T19:10:09.7802336Z", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share00092d21?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e09e-301a-00db-240a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - } ], - "variables" : [ "share00092d21" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/createWithMetadataFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/createWithMetadataFromDirClient.json deleted file mode 100644 index 5b44d12dd44b..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/createWithMetadataFromDirClient.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory68447d?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C94409DA\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c0e-901a-0077-5d0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:54 GMT" - } - } ], - "variables" : [ "directory68447d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryDoesNotExistFromShareClient.json deleted file mode 100644 index 45fc238ad453..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryDoesNotExistFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share15381a85?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152189C903AB\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e07f-301a-00db-0e0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share15381a85/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "Content-Length" : "223", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e081-301a-00db-0f0a-4794a0000000", - "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:7f75e081-301a-00db-0f0a-4794a0000000\nTime:2019-07-30T19:10:08.6351223Z", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share15381a85?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e082-301a-00db-100a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - } ], - "variables" : [ "share15381a85" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryFromShareClient.json deleted file mode 100644 index 51bdcbddf639..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDirectoryFromShareClient.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share98706a53?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188CCFFEA\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e053-301a-00db-6d0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share98706a53/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188D5FFA0\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e055-301a-00db-6e0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share98706a53/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e056-301a-00db-6f0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share98706a53?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e057-301a-00db-700a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - } ], - "variables" : [ "share98706a53" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDoesNotExistFromShareClient.json deleted file mode 100644 index 7cd633a6a484..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteDoesNotExistFromShareClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share613453e7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "126db60b-301a-0118-01e5-475bb6000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:126db60b-301a-0118-01e5-475bb6000000\nTime:2019-07-31T21:17:47.3892164Z", - "Date" : "Wed, 31 Jul 2019 21:17:47 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share613453e7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "126db60c-301a-0118-02e5-475bb6000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:126db60c-301a-0118-02e5-475bb6000000\nTime:2019-07-31T21:17:47.4222491Z", - "Date" : "Wed, 31 Jul 2019 21:17:47 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share613453e7" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileDoesNotExistFromShareClient.json deleted file mode 100644 index 28894ccec7ee..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileDoesNotExistFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share696227b2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715FCA613C8AD\"", - "Last-Modified" : "Wed, 31 Jul 2019 21:18:35 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "126db6a0-301a-0118-57e5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:18:35 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share696227b2/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "Content-Length" : "223", - "StatusCode" : "404", - "x-ms-request-id" : "126db6a2-301a-0118-58e5-475bb6000000", - "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:126db6a2-301a-0118-58e5-475bb6000000\nTime:2019-07-31T21:18:35.8921267Z", - "Date" : "Wed, 31 Jul 2019 21:18:35 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share696227b2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "126db6a3-301a-0118-59e5-475bb6000000", - "Date" : "Wed, 31 Jul 2019 21:18:35 GMT" - } - } ], - "variables" : [ "share696227b2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromDirClient.json deleted file mode 100644 index d8d41fbecc15..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromDirClient.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory084674?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CAD3E4B3\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c3d-901a-0077-080a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory084674%2ftestfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CADBD5E4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c3e-901a-0077-090a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory084674%2ftestfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2c3f-901a-0077-0a0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:57 GMT" - } - } ], - "variables" : [ "directory084674" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromShareClient.json deleted file mode 100644 index c0eeca93d2f9..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileFromShareClient.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share6980996a?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7160701B60EB4\"", - "Last-Modified" : "Wed, 31 Jul 2019 22:32:44 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "044b4925-801a-00af-6eef-4712e6000000", - "Date" : "Wed, 31 Jul 2019 22:32:44 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share6980996a/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7160701E1F516\"", - "Last-Modified" : "Wed, 31 Jul 2019 22:32:44 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "044b4928-801a-00af-6fef-4712e6000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Wed, 31 Jul 2019 22:32:44 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share6980996a/myFile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "044b4929-801a-00af-70ef-4712e6000000", - "Date" : "Wed, 31 Jul 2019 22:32:44 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share6980996a?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "044b492a-801a-00af-71ef-4712e6000000", - "Date" : "Wed, 31 Jul 2019 22:32:44 GMT" - } - } ], - "variables" : [ "share6980996a" ] -} diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileWithoutCreateFileFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileWithoutCreateFileFromDirClient.json deleted file mode 100644 index b1b2b8682809..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFileWithoutCreateFileFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory807235?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA0DA578\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c22-901a-0077-6f0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory807235%2ftestfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "Content-Length" : "223", - "StatusCode" : "404", - "x-ms-request-id" : "260a2c24-901a-0077-700a-47b537000000", - "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:260a2c24-901a-0077-700a-47b537000000\nTime:2019-07-30T19:11:56.5472730Z", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory807235" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromDirClient.json deleted file mode 100644 index 6c38f8842eaa..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromDirClient.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory731760?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA019494\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c20-901a-0077-6d0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory731760?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2c21-901a-0077-6e0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - } ], - "variables" : [ "directory731760" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromFileClient.json deleted file mode 100644 index bcf1220e6c9b..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromFileClient.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile016195dc", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715214FFE691A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df79-301a-00db-7b0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile016195dc", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75df7a-301a-00db-7c0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - } ], - "variables" : [ "file016195dc" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromShareClient.json deleted file mode 100644 index 9ab7a0d97981..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75870091?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A80208E9\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b1e-901a-0077-4d0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75870091?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b20-901a-0077-4e0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75870091?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareBeingDeleted", - "retry-after" : "0", - "Content-Length" : "244", - "StatusCode" : "409", - "x-ms-request-id" : "260a2b21-901a-0077-4f0a-47b537000000", - "Body" : "ShareBeingDeletedThe specified share is being deleted. Try operation later.\nRequestId:260a2b21-901a-0077-4f0a-47b537000000\nTime:2019-07-30T19:10:59.3814970Z", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share75870091" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteNotExistFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteNotExistFromDirClient.json deleted file mode 100644 index 3d35290624d3..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteNotExistFromDirClient.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory856262?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "Content-Length" : "223", - "StatusCode" : "404", - "x-ms-request-id" : "260a2c0f-901a-0077-5e0a-47b537000000", - "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:260a2c0f-901a-0077-5e0a-47b537000000\nTime:2019-07-30T19:11:55.5983809Z", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory856262" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShare.json deleted file mode 100644 index a26969eeac6e..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShare.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share0412801a?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522023B9912\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:30 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1d0-b01a-000d-610a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share0412801a?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1d2-b01a-000d-620a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share0412801a&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1d3-b01a-000d-630a-47df7a000000", - "Body" : "share0412801a", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share0412801a" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShareDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShareDoesNotExist.json deleted file mode 100644 index fa326a49e821..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteShareDoesNotExist.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share19157f4f?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "9ebed1ea-b01a-000d-760a-47df7a000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:9ebed1ea-b01a-000d-760a-47df7a000000\nTime:2019-07-30T19:13:32.1069780Z", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share19157f4f&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1eb-b01a-000d-770a-47df7a000000", - "Body" : "share19157f4f", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share19157f4f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSnapshotFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSnapshotFromShareClient.json deleted file mode 100644 index b39728fa3863..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSnapshotFromShareClient.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share105415aa?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521897A0CB6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e06f-301a-00db-030a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share105415aa?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:08.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521897A0CB6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e071-301a-00db-040a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share105415aa?sharesnapshot=2019-07-30T19%3a10%3a08.0000000Z&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "d2e4b9d9-f01a-00c6-7a0a-474d4a000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share105415aa?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:08.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521897A0CB6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e072-301a-00db-050a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share105415aa?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e073-301a-00db-060a-4794a0000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:7f75e073-301a-00db-060a-4794a0000000\nTime:2019-07-30T19:10:08.2517510Z", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share105415aa" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSubDirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSubDirectory.json deleted file mode 100644 index 82bac73b9529..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteSubDirectory.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory007945?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9EECB51\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c1c-901a-0077-6a0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory007945%2fdir6451491d7?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9F50E61\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c1d-901a-0077-6b0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory007945%2fdir6451491d7?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2c1f-901a-0077-6c0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - } ], - "variables" : [ "directory007945", "dir6451491d7" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateFromShareClient.json deleted file mode 100644 index 5c022530b510..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateFromShareClient.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share51575bf5?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218AA0AD7B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:10 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e0a4-301a-00db-280a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share51575bf5?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e0a6-301a-00db-290a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:10 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share51575bf5?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A58DA5A9\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e0d7-301a-00db-350a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share51575bf5?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e0da-301a-00db-360a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT" - } - } ], - "variables" : [ "share51575bf5" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareFromFileServiceClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareFromFileServiceClient.json deleted file mode 100644 index ff7d9eb38386..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareFromFileServiceClient.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share57757e81?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521E5D91EA7\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:12:43 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c72-901a-0077-190a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share57757e81?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2c74-901a-0077-1a0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:12:42 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share57757e81?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152200B789E5\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:28 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2cb1-901a-0077-250a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share57757e81&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2cb4-901a-0077-260a-47b537000000", - "Body" : "share57757e81share57757e81Tue, 30 Jul 2019 19:13:28 GMT\"0x8D7152200B789E5\"5120", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share57757e81?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2cb5-901a-0077-270a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:13:27 GMT" - } - } ], - "variables" : [ "share57757e81" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareTooSoonFromFileServiceClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareTooSoonFromFileServiceClient.json deleted file mode 100644 index 08ac48f0b7dd..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateShareTooSoonFromFileServiceClient.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90227151?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203248439\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1ec-b01a-000d-780a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90227151?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1ee-b01a-000d-790a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share90227151?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareBeingDeleted", - "retry-after" : "0", - "Content-Length" : "244", - "StatusCode" : "409", - "x-ms-request-id" : "9ebed1ef-b01a-000d-7a0a-47df7a000000", - "Body" : "ShareBeingDeletedThe specified share is being deleted. Try operation later.\nRequestId:9ebed1ef-b01a-000d-7a0a-47df7a000000\nTime:2019-07-30T19:13:32.2811453Z", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share90227151&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1f0-b01a-000d-7b0a-47df7a000000", - "Body" : "share90227151", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share90227151" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateTooSoonFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateTooSoonFromShareClient.json deleted file mode 100644 index cee9fe4bb908..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/deleteThenCreateTooSoonFromShareClient.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share499478c3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218920B2F5\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e060-301a-00db-770a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share499478c3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e062-301a-00db-780a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share499478c3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareBeingDeleted", - "retry-after" : "0", - "Content-Length" : "244", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e063-301a-00db-790a-4794a0000000", - "Body" : "ShareBeingDeletedThe specified share is being deleted. Try operation later.\nRequestId:7f75e063-301a-00db-790a-4794a0000000\nTime:2019-07-30T19:10:07.5791005Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share499478c3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareBeingDeleted", - "retry-after" : "0", - "Content-Length" : "244", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e064-301a-00db-7a0a-4794a0000000", - "Body" : "ShareBeingDeletedThe specified share is being deleted. Try operation later.\nRequestId:7f75e064-301a-00db-7a0a-4794a0000000\nTime:2019-07-30T19:10:07.6201383Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share499478c3" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/downloadWithProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/downloadWithProperties.json index 17dfc3abd6b7..98a6ad000a80 100644 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/downloadWithProperties.json +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/downloadWithProperties.json @@ -1,46 +1,49 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile81843a37", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile01908600", "Headers" : { "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-11-09", "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150ACADA4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", + "ETag" : "\"0x8D724DE73C3F2CF\"", + "Last-Modified" : "Mon, 19 Aug 2019 19:50:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "7f75df8e-301a-00db-100a-4794a0000000", + "x-ms-request-id" : "07d2b788-e01a-0111-13c7-564138000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } + "Date" : "Mon, 19 Aug 2019 19:50:13 GMT" + }, + "Exception" : null }, { "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile81843a37", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile01908600", "Headers" : { "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-11-09", "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", + "Content-Range" : "bytes 0-1023/1024", + "Last-Modified" : "Mon, 19 Aug 2019 19:50:13 GMT", "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", + "StatusCode" : "206", + "Date" : "Mon, 19 Aug 2019 19:50:13 GMT", "Accept-Ranges" : "bytes", "x-ms-server-encrypted" : "true", "x-ms-type" : "File", - "ETag" : "\"0x8D7152150ACADA4\"", + "ETag" : "\"0x8D724DE73C3F2CF\"", "Content-Length" : "1024", - "x-ms-request-id" : "7f75df8f-301a-00db-110a-4794a0000000", - "Body" : "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000", + "x-ms-request-id" : "07d2b789-e01a-0111-14c7-564138000000", + "Body" : "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", "Content-Type" : "application/octet-stream" - } + }, + "Exception" : null } ], - "variables" : [ "file81843a37" ] + "variables" : [ "file01908600" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromDirClient.json deleted file mode 100644 index 687ffd4b639d..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromDirClient.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory640660?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA7B7608\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c32-901a-0077-7e0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory640660?comp=listhandles", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c33-901a-0077-7f0a-47b537000000", - "Body" : "", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory640660" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromFileClient.json deleted file mode 100644 index 4bcc904154c2..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/forceCloseHandlesFromFileClient.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile63321504", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715215067A4A9\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df86-301a-00db-080a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile63321504?maxresults=10&comp=listhandles", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75df87-301a-00db-090a-4794a0000000", - "Body" : "10", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "file63321504" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getDirectoryDoesNotCreateADirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getDirectoryDoesNotCreateADirectory.json deleted file mode 100644 index 24d9d561ab0b..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getDirectoryDoesNotCreateADirectory.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53691dc7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A71090F0\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b0c-901a-0077-400a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:57 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53691dc7/testshare?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "Content-Length" : "223", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b0e-901a-0077-410a-47b537000000", - "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:260a2b0e-901a-0077-410a-47b537000000\nTime:2019-07-30T19:10:57.7569685Z", - "Date" : "Tue, 30 Jul 2019 19:10:57 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53691dc7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b0f-901a-0077-420a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:57 GMT" - } - } ], - "variables" : [ "share53691dc7" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientDoesNotCreateAFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientDoesNotCreateAFile.json deleted file mode 100644 index ca78855ea5bc..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientDoesNotCreateAFile.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share23449c28?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71605E15365B6\"", - "Last-Modified" : "Wed, 31 Jul 2019 22:24:40 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "896ce915-f01a-0001-3bee-47318b000000", - "Date" : "Wed, 31 Jul 2019 22:24:40 GMT" - } - }, { - "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share23449c28/testfile", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ResourceNotFound", - "retry-after" : "0", - "StatusCode" : "404", - "x-ms-request-id" : "896ce919-f01a-0001-3cee-47318b000000", - "Date" : "Wed, 31 Jul 2019 22:24:40 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share23449c28?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "896ce91a-f01a-0001-3dee-47318b000000", - "Date" : "Wed, 31 Jul 2019 22:24:40 GMT" - } - } ], - "variables" : [ "share23449c28" ] -} diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientFromDirClient.json deleted file mode 100644 index ed4d423a67bd..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getFileClientFromDirClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory928652", "12595a0a2d3d431b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getHandlesFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getHandlesFromDirClient.json deleted file mode 100644 index 65c17db3a4a2..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getHandlesFromDirClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory941872" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataDoesNotExistFromShareClient.json deleted file mode 100644 index 9a0c8d060967..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataDoesNotExistFromShareClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share044643e9?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e05d-301a-00db-750a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e05d-301a-00db-750a-4794a0000000\nTime:2019-07-30T19:10:07.3899144Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share044643e9?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e05f-301a-00db-760a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e05f-301a-00db-760a-4794a0000000\nTime:2019-07-30T19:10:07.4249477Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share044643e9" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataFromShareClient.json deleted file mode 100644 index 094f668b5ab7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getMetadataFromShareClient.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share887838fa?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521899C6A52\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e074-301a-00db-070a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share887838fa?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-meta-test" : "metadata", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D71521899C6A52\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "7f75e076-301a-00db-080a-4794a0000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share887838fa?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e077-301a-00db-090a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - } ], - "variables" : [ "share887838fa" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPolicies.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPolicies.json deleted file mode 100644 index c5ef0b99231f..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPolicies.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share715985cb?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521889F2DCC\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e04b-301a-00db-670a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share715985cb?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521889F2DCC\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75e04d-301a-00db-680a-4794a0000000", - "Body" : "", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share715985cb?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e04e-301a-00db-690a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - } ], - "variables" : [ "share715985cb" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPoliciesDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPoliciesDoesNotExist.json deleted file mode 100644 index 98b5424c58ba..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPoliciesDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share29090b5d?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e03c-301a-00db-5c0a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e03c-301a-00db-5c0a-4794a0000000\nTime:2019-07-30T19:10:06.1256868Z", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share29090b5d?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e03e-301a-00db-5d0a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e03e-301a-00db-5d0a-4794a0000000\nTime:2019-07-30T19:10:06.1707307Z", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share29090b5d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesDoesNotExistFromShareClient.json deleted file mode 100644 index 4586711ec1bd..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesDoesNotExistFromShareClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share919227b1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b12-901a-0077-450a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b12-901a-0077-450a-47b537000000\nTime:2019-07-30T19:10:58.8499972Z", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share919227b1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b15-901a-0077-460a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b15-901a-0077-460a-47b537000000\nTime:2019-07-30T19:10:58.8820269Z", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share919227b1" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromDirClient.json deleted file mode 100644 index d6f1d8dbea3c..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory018517?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9D102E3\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c18-901a-0077-660a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory018517?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-server-encrypted" : "true", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9D102E3\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c19-901a-0077-670a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - } ], - "variables" : [ "directory018517" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromFileClient.json index b15329724259..be1d4554735c 100644 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromFileClient.json +++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromFileClient.json @@ -1,45 +1,46 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile92927fc9", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile6226590e", "Headers" : { "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-11-09", "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715215089B3D8\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", + "ETag" : "\"0x8D724DE73AE1B77\"", + "Last-Modified" : "Mon, 19 Aug 2019 19:50:13 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "7f75df8a-301a-00db-0c0a-4794a0000000", + "x-ms-request-id" : "07d2b784-e01a-0111-0fc7-564138000000", "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } + "Date" : "Mon, 19 Aug 2019 19:50:12 GMT" + }, + "Exception" : null }, { "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile92927fc9", + "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile6226590e", "Headers" : { "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" }, "Response" : { + "x-ms-server-encrypted" : "true", + "x-ms-type" : "File", "x-ms-version" : "2018-11-09", "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", + "ETag" : "\"0x8D724DE73AE1B77\"", + "Last-Modified" : "Mon, 19 Aug 2019 19:50:13 GMT", "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D715215089B3D8\"", "Content-Length" : "1024", - "x-ms-request-id" : "7f75df8b-301a-00db-0d0a-4794a0000000", - "Body" : "", + "StatusCode" : "200", + "x-ms-request-id" : "07d2b785-e01a-0111-10c7-564138000000", + "Date" : "Mon, 19 Aug 2019 19:50:12 GMT", "Content-Type" : "application/octet-stream" - } + }, + "Exception" : null } ], - "variables" : [ "file92927fc9" ] + "variables" : [ "file6226590e" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromShareClient.json deleted file mode 100644 index bcaae7e72c30..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getPropertiesFromShareClient.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share73430a8d?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A8C360A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e0a0-301a-00db-250a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share73430a8d?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-meta-test" : "metadata", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D715218A8C360A\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "7f75e0a2-301a-00db-260a-4794a0000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share73430a8d?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e0a3-301a-00db-270a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - } ], - "variables" : [ "share73430a8d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getRootDirectoryDoesNotCreateADirectory.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getRootDirectoryDoesNotCreateADirectory.json deleted file mode 100644 index a828607985c8..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getRootDirectoryDoesNotCreateADirectory.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share221471e7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A7E6D93D\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b1a-901a-0077-4a0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share221471e7/?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-server-encrypted" : "false", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A7EFF17C\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2b1c-901a-0077-4b0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share221471e7?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b1d-901a-0077-4c0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - } ], - "variables" : [ "share221471e7" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getShareDoesNotCreateAShare.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getShareDoesNotCreateAShare.json deleted file mode 100644 index 31e9cad618f7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getShareDoesNotCreateAShare.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share76626429?restype=share&comp=stats", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "9ebed1fd-b01a-000d-040a-47df7a000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:9ebed1fd-b01a-000d-040a-47df7a000000\nTime:2019-07-30T19:13:32.6575025Z", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share76626429&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1ff-b01a-000d-050a-47df7a000000", - "Body" : "share76626429", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share76626429" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotId.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotId.json deleted file mode 100644 index e0a5518d0a87..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotId.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share430933e3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188B4B6F4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e04f-301a-00db-6a0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share430933e3?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:06.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188B4B6F4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e051-301a-00db-6b0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share430933e3?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e052-301a-00db-6c0a-4794a0000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:7f75e052-301a-00db-6c0a-4794a0000000\nTime:2019-07-30T19:10:06.8834219Z", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share430933e3" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataDoesNotExistFromShareClient.json deleted file mode 100644 index dfc3538fffda..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataDoesNotExistFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share842043e9?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A4C0FDE\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e094-301a-00db-1d0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share842043e9?sharesnapshot=snapshot&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "445", - "StatusCode" : "400", - "x-ms-request-id" : "d2e4b9e9-f01a-00c6-7d0a-474d4a000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:d2e4b9e9-f01a-00c6-7d0a-474d4a000000\nTime:2019-07-30T19:10:09.4966470ZsharesnapshotsnapshotMust be in the specific snapshot date time format.", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share842043e9?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e096-301a-00db-1e0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - } ], - "variables" : [ "share842043e9" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataFromShareClient.json deleted file mode 100644 index e5e9cc43e1d0..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotMetadataFromShareClient.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share33704195?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521895DA407\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e06b-301a-00db-800a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share33704195?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:07.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521895DA407\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e06d-301a-00db-010a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share33704195?sharesnapshot=2019-07-30T19%3a10%3a07.0000000Z&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-meta-test" : "metadata", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D71521895DA407\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "d2e4b9d6-f01a-00c6-790a-474d4a000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share33704195?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e06e-301a-00db-020a-4794a0000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:7f75e06e-301a-00db-020a-4794a0000000\nTime:2019-07-30T19:10:08.0135198Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share33704195" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesDoesNotExist.json deleted file mode 100644 index e5477d08bdf5..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesDoesNotExist.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share44011f3c?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A82AD064\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b25-901a-0077-520a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share44011f3c?sharesnapshot=snapshot&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "445", - "StatusCode" : "400", - "x-ms-request-id" : "d2e4ba3a-f01a-00c6-170a-474d4a000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:d2e4ba3a-f01a-00c6-170a-474d4a000000\nTime:2019-07-30T19:10:59.6107609ZsharesnapshotsnapshotMust be in the specific snapshot date time format.", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share44011f3c?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b27-901a-0077-530a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - } ], - "variables" : [ "share44011f3c" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesFromShareClient.json deleted file mode 100644 index fa366b9b3d00..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSnapshotPropertiesFromShareClient.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53196c07?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521AA0E359B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b3d-901a-0077-630a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53196c07?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:11:02.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A99DA700\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b3f-901a-0077-640a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53196c07?sharesnapshot=2019-07-30T19%3a11%3a02.0000000Z&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-meta-snapshot" : "metadata", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D71521A99DA700\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "d2e4ba45-f01a-00c6-1b0a-474d4a000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share53196c07?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "260a2b40-901a-0077-650a-47b537000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:260a2b40-901a-0077-650a-47b537000000\nTime:2019-07-30T19:11:02.8497599Z", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share53196c07" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getStats.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getStats.json deleted file mode 100644 index 713dffd115dd..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getStats.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share13839f90?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521AA57AC5F\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:03 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b45-901a-0077-690a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:03 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share13839f90?restype=share&comp=stats", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2b47-901a-0077-6a0a-47b537000000", - "Body" : "0", - "Date" : "Tue, 30 Jul 2019 19:11:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share13839f90?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b48-901a-0077-6b0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:03 GMT" - } - } ], - "variables" : [ "share13839f90" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getStatsDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getStatsDoesNotExist.json deleted file mode 100644 index 819bd8455219..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getStatsDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share87413c75?restype=share&comp=stats", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b05-901a-0077-3e0a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b05-901a-0077-3e0a-47b537000000\nTime:2019-07-30T19:10:55.9893061Z", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share87413c75?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b08-901a-0077-3f0a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b08-901a-0077-3f0a-47b537000000\nTime:2019-07-30T19:10:57.6828989Z", - "Date" : "Tue, 30 Jul 2019 19:10:57 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share87413c75" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSubDirectoryClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/getSubDirectoryClient.json deleted file mode 100644 index ed36d7e22125..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/getSubDirectoryClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory891026" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json deleted file mode 100644 index b93a05fb499d..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA34BEF2\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c27-901a-0077-730a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274510?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA3ADAF2\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c28-901a-0077-740a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fsamelayer5122560", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA40F6E8\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c29-901a-0077-750a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274510%2fnextlayer4592830", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA46C4B5\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2a-901a-0077-760a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274511?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA4CE0B5\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2b-901a-0077-770a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fsamelayer51225601", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA543577\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2c-901a-0077-780a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274511%2fnextlayer45928301", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA5A7889\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2d-901a-0077-790a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274512?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA601F36\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2e-901a-0077-7a0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fsamelayer512256012", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA65C5E6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:56 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c2f-901a-0077-7b0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451%2fdirectory7274512%2fnextlayer459283012", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521CA6C08F9\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:57 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c30-901a-0077-7c0a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory727451?restype=directory&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c31-901a-0077-7d0a-47b537000000", - "Body" : "directory7274510directory7274511directory7274512samelayer51225601024samelayer512256011024samelayer5122560121024", - "Date" : "Tue, 30 Jul 2019 19:11:56 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory727451", "samelayer512256", "nextlayer459283" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listHandlesFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listHandlesFromFileClient.json deleted file mode 100644 index 3660f01e88fe..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listHandlesFromFileClient.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile9917633c", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521500DD620\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df7b-301a-00db-7d0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile9917633c?comp=listhandles", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75df7c-301a-00db-7e0a-4794a0000000", - "Body" : "", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "file9917633c" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listRangesFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listRangesFromFileClient.json deleted file mode 100644 index e9dc3d0fe023..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listRangesFromFileClient.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile62564f32", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521501C3184\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df7d-301a-00db-7f0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile62564f32?comp=range", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/octet-stream" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715215023D474\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df7e-301a-00db-800a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile62564f32?comp=rangelist", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-content-length" : "512", - "ETag" : "\"0x8D715215023D474\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75df7f-301a-00db-010a-4794a0000000", - "Body" : "0511", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "file62564f32" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listShares.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listShares.json deleted file mode 100644 index f019f2469aae..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listShares.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851700?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522033B4614\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1f2-b01a-000d-7c0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851701?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715220340C5B4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1f4-b01a-000d-7d0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851702?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203461E2B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1f6-b01a-000d-7e0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share46185170&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1f8-b01a-000d-7f0a-47df7a000000", - "Body" : "share46185170share461851700Tue, 30 Jul 2019 19:13:32 GMT\"0x8D71522033B4614\"2share461851701Tue, 30 Jul 2019 19:13:32 GMT\"0x8D715220340C5B4\"2share461851702Tue, 30 Jul 2019 19:13:32 GMT\"0x8D7152203461E2B\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share46185170&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1f9-b01a-000d-800a-47df7a000000", - "Body" : "share46185170share461851700Tue, 30 Jul 2019 19:13:32 GMT\"0x8D71522033B4614\"2share461851701Tue, 30 Jul 2019 19:13:32 GMT\"0x8D715220340C5B4\"2share461851702Tue, 30 Jul 2019 19:13:32 GMT\"0x8D7152203461E2B\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851700?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1fa-b01a-000d-010a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851701?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1fb-b01a-000d-020a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share461851702?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1fc-b01a-000d-030a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - } ], - "variables" : [ "share46185170" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadata.json deleted file mode 100644 index e385c897d512..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadata.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f100?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203F0B869\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed21c-b01a-000d-1b0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f101?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203F63803\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed21e-b01a-000d-1c0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f102?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203FC05C2\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed220-b01a-000d-1d0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share17297f10&include=metadata&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed222-b01a-000d-1e0a-47df7a000000", - "Body" : "share17297f10share17297f100Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203F0B869\"2metadatashare17297f101Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203F63803\"2share17297f102Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203FC05C2\"2metadata", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share17297f10&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed223-b01a-000d-1f0a-47df7a000000", - "Body" : "share17297f10share17297f100Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203F0B869\"2share17297f101Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203F63803\"2share17297f102Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203FC05C2\"2", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f100?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed224-b01a-000d-200a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f101?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed225-b01a-000d-210a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share17297f102?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed226-b01a-000d-220a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - } ], - "variables" : [ "share17297f10" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json deleted file mode 100644 index 2940b73ebac9..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e080?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522028956ED\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1dd-b01a-000d-6c0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e080?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:13:31.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522028956ED\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1df-b01a-000d-6d0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e081?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152202D9D46F\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1e0-b01a-000d-6e0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e082?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152202EC2863\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1e2-b01a-000d-6f0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e082?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:13:31.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152202EC2863\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1e4-b01a-000d-700a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share16415e08&include=metadata%2csnapshots&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1e5-b01a-000d-710a-47df7a000000", - "Body" : "share16415e08share16415e0802019-07-30T19:13:31.0000000ZTue, 30 Jul 2019 19:13:31 GMT\"0x8D71522028956ED\"2metadatashare16415e080Tue, 30 Jul 2019 19:13:31 GMT\"0x8D71522028956ED\"2metadatashare16415e081Tue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202D9D46F\"2share16415e0822019-07-30T19:13:31.0000000ZTue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202EC2863\"2metadatashare16415e082Tue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202EC2863\"2metadata", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share16415e08&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1e6-b01a-000d-720a-47df7a000000", - "Body" : "share16415e08share16415e080Tue, 30 Jul 2019 19:13:31 GMT\"0x8D71522028956ED\"2share16415e081Tue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202D9D46F\"2share16415e082Tue, 30 Jul 2019 19:13:31 GMT\"0x8D7152202EC2863\"2", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e080?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "9ebed1e7-b01a-000d-730a-47df7a000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:9ebed1e7-b01a-000d-730a-47df7a000000\nTime:2019-07-30T19:13:31.9728507Z", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e081?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1e8-b01a-000d-740a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16415e082?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "9ebed1e9-b01a-000d-750a-47df7a000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:9ebed1e9-b01a-000d-750a-47df7a000000\nTime:2019-07-30T19:13:32.0449189Z", - "Date" : "Tue, 30 Jul 2019 19:13:31 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share16415e08" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeSnapshots.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeSnapshots.json deleted file mode 100644 index b903937d0588..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesIncludeSnapshots.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715220378850D\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed200-b01a-000d-060a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec0?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:13:32.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715220378850D\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed202-b01a-000d-070a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203850B40\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed203-b01a-000d-080a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522038A8AD6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed205-b01a-000d-090a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec2?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:13:32.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522038A8AD6\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed207-b01a-000d-0a0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share598295ec&include=snapshots&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed208-b01a-000d-0b0a-47df7a000000", - "Body" : "share598295ecshare598295ec02019-07-30T19:13:32.0000000ZTue, 30 Jul 2019 19:13:32 GMT\"0x8D715220378850D\"2share598295ec0Tue, 30 Jul 2019 19:13:32 GMT\"0x8D715220378850D\"2share598295ec1Tue, 30 Jul 2019 19:13:32 GMT\"0x8D7152203850B40\"2share598295ec22019-07-30T19:13:32.0000000ZTue, 30 Jul 2019 19:13:32 GMT\"0x8D71522038A8AD6\"2share598295ec2Tue, 30 Jul 2019 19:13:32 GMT\"0x8D71522038A8AD6\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share598295ec&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed209-b01a-000d-0c0a-47df7a000000", - "Body" : "share598295ecshare598295ec0Tue, 30 Jul 2019 19:13:32 GMT\"0x8D715220378850D\"2share598295ec1Tue, 30 Jul 2019 19:13:32 GMT\"0x8D7152203850B40\"2share598295ec2Tue, 30 Jul 2019 19:13:32 GMT\"0x8D71522038A8AD6\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "9ebed20a-b01a-000d-0d0a-47df7a000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:9ebed20a-b01a-000d-0d0a-47df7a000000\nTime:2019-07-30T19:13:33.0058344Z", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed20b-b01a-000d-0e0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share598295ec2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "9ebed20c-b01a-000d-0f0a-47df7a000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:9ebed20c-b01a-000d-0f0a-47df7a000000\nTime:2019-07-30T19:13:33.0829066Z", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share598295ec" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesInvalidMaxResults.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesInvalidMaxResults.json deleted file mode 100644 index 2beb5fd80fa4..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesInvalidMaxResults.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share85200d7d&maxresults=-1&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "OutOfRangeQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "461", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed237-b01a-000d-2f0a-47df7a000000", - "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:9ebed237-b01a-000d-2f0a-47df7a000000\nTime:2019-07-30T19:13:34.7895274Zmaxresults-112147483647", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share85200d7d&maxresults=0&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "OutOfRangeQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "460", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed238-b01a-000d-300a-47df7a000000", - "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:9ebed238-b01a-000d-300a-47df7a000000\nTime:2019-07-30T19:13:34.8155527Zmaxresults012147483647", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share85200d7d&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed239-b01a-000d-310a-47df7a000000", - "Body" : "share85200d7d", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share85200d7d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithLimit.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithLimit.json deleted file mode 100644 index 6be5b68ae78a..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithLimit.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71522018BF475\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:29 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1bf-b01a-000d-570a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:29 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152201A10830\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:29 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1c2-b01a-000d-580a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:29 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152201A6AEE5\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:29 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed1c4-b01a-000d-590a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:29 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share259041ce&maxresults=2&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1c6-b01a-000d-5a0a-47df7a000000", - "Body" : "share259041ce2share259041ce0Tue, 30 Jul 2019 19:13:29 GMT\"0x8D71522018BF475\"2share259041ce1Tue, 30 Jul 2019 19:13:29 GMT\"0x8D7152201A10830\"2/azstoragesdkaccount/share259041ce2", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share259041ce&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1c9-b01a-000d-5c0a-47df7a000000", - "Body" : "share259041ceshare259041ce0Tue, 30 Jul 2019 19:13:29 GMT\"0x8D71522018BF475\"2share259041ce1Tue, 30 Jul 2019 19:13:29 GMT\"0x8D7152201A10830\"2share259041ce2Tue, 30 Jul 2019 19:13:29 GMT\"0x8D7152201A6AEE5\"2", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1ca-b01a-000d-5d0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1cb-b01a-000d-5e0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share259041ce2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed1cc-b01a-000d-5f0a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT" - } - } ], - "variables" : [ "share259041ce" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithPrefix.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithPrefix.json deleted file mode 100644 index c103a309d2c6..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/listSharesWithPrefix.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6fprefix0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203B43D11\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed20d-b01a-000d-100a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6f1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203BA0ACA\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed20f-b01a-000d-110a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6fprefix2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152203BF3C3A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:13:33 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "9ebed212-b01a-000d-130a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share71892b6fprefix&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed214-b01a-000d-140a-47df7a000000", - "Body" : "share71892b6fprefixshare71892b6fprefix0Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203B43D11\"2share71892b6fprefix2Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203BF3C3A\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share71892b6f&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed216-b01a-000d-150a-47df7a000000", - "Body" : "share71892b6fshare71892b6f1Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203BA0ACA\"2share71892b6fprefix0Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203B43D11\"2share71892b6fprefix2Tue, 30 Jul 2019 19:13:33 GMT\"0x8D7152203BF3C3A\"2", - "Date" : "Tue, 30 Jul 2019 19:13:32 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6f1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed217-b01a-000d-160a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6fprefix0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed218-b01a-000d-170a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share71892b6fprefix2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed219-b01a-000d-180a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT" - } - } ], - "variables" : [ "share71892b6f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setFileServiceProperties.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setFileServiceProperties.json deleted file mode 100644 index 2e0fc5377a60..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setFileServiceProperties.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed227-b01a-000d-230a-47df7a000000", - "Body" : "1.0truetruetrue71.0falsefalse", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed228-b01a-000d-240a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed22d-b01a-000d-250a-47df7a000000", - "Body" : "1.0truefalsetrue31.0truefalsetrue3", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "9ebed22e-b01a-000d-260a-47df7a000000", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed22f-b01a-000d-270a-47df7a000000", - "Body" : "1.0truetruetrue71.0falsefalse", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share33310c2f&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed230-b01a-000d-280a-47df7a000000", - "Body" : "share33310c2f", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share33310c2f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setHttpHeadersFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setHttpHeadersFromFileClient.json deleted file mode 100644 index 8d4483aa1aa1..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setHttpHeadersFromFileClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile12606bdf", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715215077D535\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df88-301a-00db-0a0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile12606bdf?comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521508089E4\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75df89-301a-00db-0b0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - } ], - "variables" : [ "file12606bdf" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMeatadataFromFileClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMeatadataFromFileClient.json deleted file mode 100644 index b234518e7cf3..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMeatadataFromFileClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile70778cc8", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521509A0B80\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df8c-301a-00db-0e0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile70778cc8?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150A1AE7A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75df8d-301a-00db-0f0a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - } ], - "variables" : [ "file70778cc8" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataDoesNotExistFromShareClient.json deleted file mode 100644 index 87a7fd88db4e..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataDoesNotExistFromShareClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share39749379?restype=share&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b10-901a-0077-430a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b10-901a-0077-430a-47b537000000\nTime:2019-07-30T19:10:58.7609132Z", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share39749379?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b11-901a-0077-440a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b11-901a-0077-440a-47b537000000\nTime:2019-07-30T19:10:58.7909414Z", - "Date" : "Tue, 30 Jul 2019 19:10:58 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share39749379" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromDirClient.json deleted file mode 100644 index 7bc79062363c..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory183331?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9B3AFB2\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c14-901a-0077-630a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory183331?restype=directory&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9BBEF19\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2c15-901a-0077-640a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - } ], - "variables" : [ "directory183331" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromShareClient.json deleted file mode 100644 index 9f443d394def..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataFromShareClient.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75652b90?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A2F8018\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e08e-301a-00db-190a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75652b90?restype=share&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A363931\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75e090-301a-00db-1a0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75652b90?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "5120", - "ETag" : "\"0x8D715218A363931\"", - "x-ms-has-immutability-policy" : "false", - "x-ms-meta-setting" : "metadata", - "Content-Length" : "0", - "x-ms-request-id" : "7f75e091-301a-00db-1b0a-4794a0000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share75652b90?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e092-301a-00db-1c0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - } ], - "variables" : [ "share75652b90" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidKeyFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidKeyFromDirClient.json deleted file mode 100644 index 3e6a99736af3..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidKeyFromDirClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory858094?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521C9A2948A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2c12-901a-0077-610a-47b537000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/dirsharename/directory858094?restype=directory&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidMetadata", - "retry-after" : "0", - "Content-Length" : "260", - "StatusCode" : "400", - "x-ms-request-id" : "260a2c13-901a-0077-620a-47b537000000", - "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:260a2c13-901a-0077-620a-47b537000000\nTime:2019-07-30T19:11:55.7765485Z", - "Date" : "Tue, 30 Jul 2019 19:11:55 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory858094" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidMetadataFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidMetadataFromShareClient.json deleted file mode 100644 index 7d7b382328f3..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setMetadataInvalidMetadataFromShareClient.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share52103857?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A9FDB6DE\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b39-901a-0077-600a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share52103857?restype=share&comp=metadata", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "EmptyMetadataKey", - "retry-after" : "0", - "Content-Length" : "281", - "StatusCode" : "400", - "x-ms-request-id" : "260a2b3b-901a-0077-610a-47b537000000", - "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:260a2b3b-901a-0077-610a-47b537000000\nTime:2019-07-30T19:11:02.6625831Zmetadata", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share52103857?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b3c-901a-0077-620a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - } ], - "variables" : [ "share52103857" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPolicies.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPolicies.json deleted file mode 100644 index 4c58ad1d9bd6..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPolicies.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share554792f6?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218881B367\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e045-301a-00db-630a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share554792f6?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521888930E8\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75e048-301a-00db-640a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share554792f6?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521888930E8\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:06 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "7f75e049-301a-00db-650a-4794a0000000", - "Body" : "test2000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zr", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share554792f6?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e04a-301a-00db-660a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT" - } - } ], - "variables" : [ "share554792f6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesDoesNotExist.json deleted file mode 100644 index ac5c956d274e..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesDoesNotExist.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share10194f73?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e083-301a-00db-110a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e083-301a-00db-110a-4794a0000000\nTime:2019-07-30T19:10:08.7081930Z", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share10194f73?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e084-301a-00db-120a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e084-301a-00db-120a-4794a0000000\nTime:2019-07-30T19:10:08.7382231Z", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share10194f73" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesInvalidPermission.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesInvalidPermission.json deleted file mode 100644 index 715ea390de82..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesInvalidPermission.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share990513c2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A5BA17CE\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:55 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e0de-301a-00db-3a0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share990513c2?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e0e0-301a-00db-3b0a-4794a0000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:7f75e0e0-301a-00db-3b0a-4794a0000000\nTime:2019-07-30T19:10:55.5105372Z00", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share990513c2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Connection" : "close", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e0e1-301a-00db-3c0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:55 GMT" - } - } ], - "variables" : [ "share990513c2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesTooManyPermissions.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesTooManyPermissions.json deleted file mode 100644 index d573484b4abd..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPoliciesTooManyPermissions.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16077c14?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218949057A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e067-301a-00db-7d0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16077c14?restype=share&comp=acl", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e069-301a-00db-7e0a-4794a0000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:7f75e069-301a-00db-7e0a-4794a0000000\nTime:2019-07-30T19:10:07.8003122Z00", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share16077c14?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e06a-301a-00db-7f0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - } ], - "variables" : [ "share16077c14" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesDoesNotExistFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesDoesNotExistFromShareClient.json deleted file mode 100644 index 1f9aa5404995..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesDoesNotExistFromShareClient.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share804506e6?restype=share&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b31-901a-0077-590a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b31-901a-0077-590a-47b537000000\nTime:2019-07-30T19:11:02.3733121Z", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share804506e6?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "260a2b32-901a-0077-5a0a-47b537000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:260a2b32-901a-0077-5a0a-47b537000000\nTime:2019-07-30T19:11:02.4103463Z", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share804506e6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesFromShareClient.json deleted file mode 100644 index a57945bad8b7..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesFromShareClient.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share291723a2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A9E23903\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b33-901a-0077-5b0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share291723a2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-share-quota" : "2", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A9E23903\"", - "x-ms-has-immutability-policy" : "false", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2b35-901a-0077-5c0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "x-ms-has-legal-hold" : "false" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share291723a2?restype=share&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A9EC63FB\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2b36-901a-0077-5d0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share291723a2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-share-quota" : "4", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A9EC63FB\"", - "x-ms-has-immutability-policy" : "false", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "260a2b37-901a-0077-5e0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "x-ms-has-legal-hold" : "false" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share291723a2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "260a2b38-901a-0077-5f0a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT" - } - } ], - "variables" : [ "share291723a2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedHeader.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedHeader.json deleted file mode 100644 index 9b0443b1009a..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedHeader.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed21a-b01a-000d-190a-47df7a000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:9ebed21a-b01a-000d-190a-47df7a000000\nTime:2019-07-30T19:13:33.4682715Z00", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share515698b3&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed21b-b01a-000d-1a0a-47df7a000000", - "Body" : "share515698b3", - "Date" : "Tue, 30 Jul 2019 19:13:33 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share515698b3" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedMethod.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedMethod.json deleted file mode 100644 index 2774b86d722c..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedMethod.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlNodeValue", - "retry-after" : "0", - "Content-Length" : "340", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed231-b01a-000d-290a-47df7a000000", - "Body" : "InvalidXmlNodeValueThe value for one of the XML nodes is not in the correct format.\nRequestId:9ebed231-b01a-000d-290a-47df7a000000\nTime:2019-07-30T19:13:34.5983455ZAllowedMethodsNOTAREALHTTPMETHOD", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share33180966&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed232-b01a-000d-2a0a-47df7a000000", - "Body" : "share33180966", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share33180966" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedOrigin.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedOrigin.json deleted file mode 100644 index 942aba65db1b..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidAllowedOrigin.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed233-b01a-000d-2b0a-47df7a000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:9ebed233-b01a-000d-2b0a-47df7a000000\nTime:2019-07-30T19:13:34.6614058Z00", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share28616d87&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed234-b01a-000d-2c0a-47df7a000000", - "Body" : "share28616d87", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share28616d87" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidExposedHeader.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidExposedHeader.json deleted file mode 100644 index 949ad86ece86..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidExposedHeader.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed235-b01a-000d-2d0a-47df7a000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:9ebed235-b01a-000d-2d0a-47df7a000000\nTime:2019-07-30T19:13:34.7244657Z00", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share3940172f&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed236-b01a-000d-2e0a-47df7a000000", - "Body" : "share3940172f", - "Date" : "Tue, 30 Jul 2019 19:13:34 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share3940172f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidQuotaFromShareClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidQuotaFromShareClient.json deleted file mode 100644 index 2e6a1ceb5ca5..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesInvalidQuotaFromShareClient.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share1339920e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152189B15717\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:08 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e07a-301a-00db-0a0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share1339920e?restype=share&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "324", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e07c-301a-00db-0b0a-4794a0000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:7f75e07c-301a-00db-0b0a-4794a0000000\nTime:2019-07-30T19:10:08.4799715Zx-ms-share-quota-1", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share1339920e?restype=share&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidHeaderValue", - "retry-after" : "0", - "Content-Length" : "326", - "StatusCode" : "400", - "x-ms-request-id" : "7f75e07d-301a-00db-0c0a-4794a0000000", - "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:7f75e07d-301a-00db-0c0a-4794a0000000\nTime:2019-07-30T19:10:08.5079992Zx-ms-share-quota9999", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share1339920e?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "7f75e07e-301a-00db-0d0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT" - } - } ], - "variables" : [ "share1339920e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesTooManyRules.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesTooManyRules.json deleted file mode 100644 index a5b7693f19ff..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/setPropertiesTooManyRules.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "9ebed1d7-b01a-000d-670a-47df7a000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:9ebed1d7-b01a-000d-670a-47df7a000000\nTime:2019-07-30T19:13:30.9779017Z00", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net?prefix=share49855583&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "9ebed1d8-b01a-000d-680a-47df7a000000", - "Body" : "share49855583", - "Date" : "Tue, 30 Jul 2019 19:13:30 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share49855583" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshot.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshot.json deleted file mode 100644 index b9d45b179291..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshot.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share66242c38?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A628397\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e097-301a-00db-1f0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share66242c38?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:09.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715218A628397\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:09 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e099-301a-00db-200a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share66242c38?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e09a-301a-00db-210a-4794a0000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:7f75e09a-301a-00db-210a-4794a0000000\nTime:2019-07-30T19:10:09.6971528Z", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share66242c38" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDifferentMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDifferentMetadata.json deleted file mode 100644 index 6d1902728e91..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDifferentMetadata.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80587c91?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188EF5D81\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e058-301a-00db-710a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80587c91?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:10:07.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152188D55180\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75e05a-301a-00db-720a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80587c91?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-meta-create" : "metadata", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D7152188EF5D81\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "7f75e05b-301a-00db-730a-4794a0000000" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80587c91?sharesnapshot=2019-07-30T19%3a10%3a07.0000000Z&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-meta-update" : "metadata", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:07 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:10:06 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D7152188D55180\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "d2e4b9d1-f01a-00c6-780a-474d4a000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share80587c91?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "7f75e05c-301a-00db-740a-4794a0000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:7f75e05c-301a-00db-740a-4794a0000000\nTime:2019-07-30T19:10:07.3318585Z", - "Date" : "Tue, 30 Jul 2019 19:10:07 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share80587c91" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDoesNotExist.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDoesNotExist.json deleted file mode 100644 index 38bd90e2f283..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share39064b26?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e085-301a-00db-130a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e085-301a-00db-130a-4794a0000000\nTime:2019-07-30T19:10:09.0014779Z", - "Date" : "Tue, 30 Jul 2019 19:10:08 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share39064b26?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "7f75e088-301a-00db-140a-4794a0000000", - "Body" : "ShareNotFoundThe specified share does not exist.\nRequestId:7f75e088-301a-00db-140a-4794a0000000\nTime:2019-07-30T19:10:09.0355109Z", - "Date" : "Tue, 30 Jul 2019 19:10:09 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share39064b26" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotSameMetadata.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotSameMetadata.json deleted file mode 100644 index e580cd8f500e..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/snapshotSameMetadata.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share77185685?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A8416B16\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:10:59 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b28-901a-0077-540a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:10:59 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share77185685?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-30T19:11:02.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521A99DA700\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "260a2b2a-901a-0077-550a-47b537000000", - "Date" : "Tue, 30 Jul 2019 19:11:01 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share77185685?sharesnapshot=2019-07-30T19%3a11%3a02.0000000Z&restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-meta-test" : "metadata", - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:11:02 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:11:01 GMT", - "x-ms-has-legal-hold" : "false", - "x-ms-share-quota" : "2", - "ETag" : "\"0x8D71521A99DA700\"", - "x-ms-has-immutability-policy" : "false", - "Content-Length" : "0", - "x-ms-request-id" : "d2e4ba40-f01a-00c6-190a-474d4a000000" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/share77185685?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "ShareHasSnapshots", - "retry-after" : "0", - "Content-Length" : "250", - "StatusCode" : "409", - "x-ms-request-id" : "260a2b30-901a-0077-580a-47b537000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:260a2b30-901a-0077-580a-47b537000000\nTime:2019-07-30T19:11:02.2862300Z", - "Date" : "Tue, 30 Jul 2019 19:11:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share77185685" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/startCopy.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/startCopy.json deleted file mode 100644 index ab7930ece536..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/startCopy.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile915691d2", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D715214FD29388\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df77-301a-00db-790a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile915691d2", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-copy-id" : "018a4780-d459-45ef-9817-a418018f33fc", - "ETag" : "\"0x8D715214FF7628A\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-copy-status" : "success", - "StatusCode" : "202", - "x-ms-request-id" : "7f75df78-301a-00db-7a0a-4794a0000000", - "Date" : "Tue, 30 Jul 2019 19:08:30 GMT" - } - } ], - "variables" : [ "file915691d2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/upload.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/upload.json deleted file mode 100644 index 121bfdcd3639..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/upload.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile69101ec0", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150338FB7\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:31 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df80-301a-00db-020a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile69101ec0?comp=range", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/octet-stream" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521503A964B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df81-301a-00db-030a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" - } - } ], - "variables" : [ "file69101ec0" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/uploadToStorageAndDownloadToFile.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/uploadToStorageAndDownloadToFile.json deleted file mode 100644 index 27a99dece195..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/uploadToStorageAndDownloadToFile.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile72051979", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D7152150452030\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df82-301a-00db-040a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile72051979?comp=range", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/octet-stream" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D71521504E713B\"", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "7f75df83-301a-00db-050a-4794a0000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Content-MD5" : "/CTzx8jXJ1MqqUsC1dJBUQ==" - } - }, { - "Method" : "HEAD", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile72051979", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D71521504E713B\"", - "Content-Length" : "14", - "x-ms-request-id" : "7f75df84-301a-00db-060a-4794a0000000", - "Body" : "", - "Content-Type" : "application/octet-stream" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.file.core.windows.net/filesharename/testdir%2ffile72051979", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "Content-Range" : "bytes 0-13/14", - "Last-Modified" : "Tue, 30 Jul 2019 19:08:32 GMT", - "retry-after" : "0", - "StatusCode" : "206", - "Date" : "Tue, 30 Jul 2019 19:08:31 GMT", - "Accept-Ranges" : "bytes", - "x-ms-server-encrypted" : "true", - "x-ms-type" : "File", - "ETag" : "\"0x8D71521504E713B\"", - "Content-Length" : "14", - "x-ms-request-id" : "7f75df85-301a-00db-070a-4794a0000000", - "Body" : "Hello world!\r\n", - "Content-Type" : "application/octet-stream" - } - } ], - "variables" : [ "file72051979" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/urlFromDirClient.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/urlFromDirClient.json deleted file mode 100644 index 28d83f0a0211..000000000000 --- a/sdk/storage/azure-storage-file/src/test/resources/session-records/urlFromDirClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory16915c" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file/swagger/README.md b/sdk/storage/azure-storage-file/swagger/README.md new file mode 100644 index 000000000000..f4a4e1bf71ec --- /dev/null +++ b/sdk/storage/azure-storage-file/swagger/README.md @@ -0,0 +1,537 @@ +# Azure File Storage for Java + +> see https://aka.ms/autorest + +### Setup +```ps +cd C:\work +git clone --recursive https://github.com/Azure/autorest.java/ +cd autorest.java +git checkout v3 +npm install +cd .. +git clone --recursive https://github.com/jianghaolu/autorest.modeler/ +cd autorest.modeler +git checkout headerprefixfix +npm install +``` + +### Generation +```ps +cd +autorest --use=C:/work/autorest.java --use=C:/work/autorest.modeler --version=2.0.4280 +``` + +### Code generation settings +``` yaml +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.FileStorage/preview/2019-02-02/file.json +java: true +output-folder: ../ +namespace: com.azure.storage.file +enable-xml: true +generate-client-interfaces: false +sync-methods: none +license-header: MICROSOFT_MIT_SMALL +add-context-parameter: true +``` + +### Query Parameters +``` yaml +directive: +- from: swagger-document + where: $.parameters + transform: > + if (!$.DirectoryPath) { + $.DirectoryPath = { + "name": "directoryPath", + "in": "path", + "description": "The path of the target directory.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "x-ms-skip-url-encoding": false + }; + } + if (!$.FilePath) { + $.FilePath = { + "name": "filePath", + "in": "path", + "description": "The path of the target file.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "x-ms-skip-url-encoding": false + }; + } + if (!$.ShareName) { + $.ShareName = { + "name": "shareName", + "in": "path", + "description": "The name of the target share.", + "required": true, + "type": "string", + "x-ms-parameter-location": "method" + }; + } +``` + +### /?restype=service&comp=properties +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.FileServiceProperties) { + const props = $.FileServiceProperties = $.StorageServiceProperties; + props.xml = { "name": "StorageServiceProperties" }; + delete $.StorageServiceProperties; + } +- from: swagger-document + where: $.parameters + transform: > + if (!$.FileServiceProperties) { + const props = $.FileServiceProperties = $.StorageServiceProperties; + props.name = "FileServiceProperties"; + props.description = "The FileStorage properties."; + props.schema = { "$ref": props.schema.$ref.replace(/[#].*$/, "#/definitions/FileServiceProperties") }; + delete $.StorageServiceProperties; + } +- from: swagger-document + where: $["x-ms-paths"]["/?restype=service&comp=properties"] + transform: > + const param = $.put.parameters[0]; + if (param && param["$ref"] && param["$ref"].endsWith("StorageServiceProperties")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/FileServiceProperties"); + $.put.parameters[0] = { "$ref": path }; + } + const def = $.get.responses["200"].schema; + if (def && def["$ref"] && def["$ref"].endsWith("StorageServiceProperties")) { + const path = def["$ref"].replace(/[#].*$/, "#/definitions/FileServiceProperties"); + $.get.responses["200"].schema = { "$ref": path }; + } +``` + +### /{shareName}?restype=share +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + $.delete.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}?restype=share&comp=filepermission +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=filepermission"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}?restype=share&comp=properties +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=properties"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}?restype=share&comp=snapshot +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=snapshot"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}?restype=share&comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=metadata"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}?restype=share&comp=acl +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=acl"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + + +### /{shareName}?restype=share&comp=stats +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{shareName}?restype=share&comp=stats"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ShareName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ShareName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{shareName}/{directoryPath}?restype=directory +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?restype=directory"]) { + const op = $["/{shareName}/{directoryPath}?restype=directory"] = $["/{shareName}/{directory}?restype=directory"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + op.delete.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.delete.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?restype=directory"]; + op.put.responses["201"].headers["x-ms-file-creation-time"].format = "date-time"; + op.put.responses["201"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.put.responses["201"].headers["x-ms-file-change-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-creation-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-change-time"].format = "date-time"; + } +``` + +### /{shareName}/{directoryPath}?restype=directory&comp=properties +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?restype=directory&comp=properties"]) { + const op = $["/{shareName}/{directoryPath}?restype=directory&comp=properties"] = $["/{shareName}/{directory}?restype=directory&comp=properties"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?restype=directory&comp=properties"]; + op.put.responses["200"].headers["x-ms-file-creation-time"].format = "date-time"; + op.put.responses["200"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.put.responses["200"].headers["x-ms-file-change-time"].format = "date-time"; + } +``` + +### /{shareName}/{directoryPath}?restype=directory&comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?restype=directory&comp=metadata"]) { + const op = $["/{shareName}/{directoryPath}?restype=directory&comp=metadata"] = $["/{shareName}/{directory}?restype=directory&comp=metadata"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?restype=directory&comp=metadata"]; + } +``` + +### /{shareName}/{directoryPath}?restype=directory&comp=list +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?restype=directory&comp=list"]) { + const op = $["/{shareName}/{directoryPath}?restype=directory&comp=list"] = $["/{shareName}/{directory}?restype=directory&comp=list"]; + const path = op.get.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?restype=directory&comp=list"]; + } +``` + +### /{shareName}/{directoryPath}?comp=listhandles +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?comp=listhandles"]) { + const op = $["/{shareName}/{directoryPath}?comp=listhandles"] = $["/{shareName}/{directory}?comp=listhandles"]; + const path = op.get.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?comp=listhandles"]; + } +``` + +### /{shareName}/{directoryPath}?comp=forceclosehandles +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{directoryPath}?comp=forceclosehandles"]) { + const op = $["/{shareName}/{directoryPath}?comp=forceclosehandles"] = $["/{shareName}/{directory}?comp=forceclosehandles"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "DirectoryPath" }); + delete $["/{shareName}/{directory}?comp=forceclosehandles"]; + } +``` + +### /{shareName}/{filePath} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}"]) { + const op = $["/{shareName}/{filePath}"] = $["/{shareName}/{directory}/{fileName}"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + op.head.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.head.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete op.head.responses.default.schema; + op.delete.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.delete.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}"]; + op.put.responses["201"].headers["x-ms-file-creation-time"].format = "date-time"; + op.put.responses["201"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.put.responses["201"].headers["x-ms-file-change-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-creation-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.get.responses["200"].headers["x-ms-file-change-time"].format = "date-time"; + op.get.responses["206"].headers["x-ms-file-creation-time"].format = "date-time"; + op.get.responses["206"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.get.responses["206"].headers["x-ms-file-change-time"].format = "date-time"; + op.head.responses["200"].headers["x-ms-file-creation-time"].format = "date-time"; + op.head.responses["200"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.head.responses["200"].headers["x-ms-file-change-time"].format = "date-time"; + } +``` + +### /{shareName}/{filePath}?comp=properties +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=properties"]) { + const op = $["/{shareName}/{filePath}?comp=properties"] = $["/{shareName}/{directory}/{fileName}?comp=properties"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=properties"]; + op.put.responses["200"].headers["x-ms-file-creation-time"].format = "date-time"; + op.put.responses["200"].headers["x-ms-file-last-write-time"].format = "date-time"; + op.put.responses["200"].headers["x-ms-file-change-time"].format = "date-time"; + } +``` + +### /{shareName}/{filePath}?comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=metadata"]) { + const op = $["/{shareName}/{filePath}?comp=metadata"] = $["/{shareName}/{directory}/{fileName}?comp=metadata"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=metadata"]; + } +``` + +### /{shareName}/{filePath}?comp=range +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=range"]) { + const op = $["/{shareName}/{filePath}?comp=range"] = $["/{shareName}/{directory}/{fileName}?comp=range"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=range"]; + } +``` + +### /{shareName}/{filePath}?comp=range&fromURL +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=range&fromURL"]) { + const op = $["/{shareName}/{filePath}?comp=range&fromURL"] = $["/{shareName}/{directory}/{fileName}?comp=range&fromURL"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=range&fromURL"]; + } +``` + +### /{shareName}/{filePath}?comp=rangelist +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=rangelist"]) { + const op = $["/{shareName}/{filePath}?comp=rangelist"] = $["/{shareName}/{directory}/{fileName}?comp=rangelist"]; + const path = op.get.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=rangelist"]; + } +``` + +### /{shareName}/{filePath}?comp=copy +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=copy"]) { + const op = $["/{shareName}/{filePath}?comp=copy"] = $["/{shareName}/{directory}/{fileName}?comp=copy"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=copy"]; + } +``` + +### /{shareName}/{filePath}?comp=copy©id={CopyId} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=copy©id={CopyId}"]) { + const op = $["/{shareName}/{filePath}?comp=copy©id={CopyId}"] = $["/{shareName}/{directory}/{fileName}?comp=copy©id={CopyId}"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=copy©id={CopyId}"]; + } +``` + +### /{shareName}/{filePath}?comp=listhandles +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=listhandles"]) { + const op = $["/{shareName}/{filePath}?comp=listhandles"] = $["/{shareName}/{directory}/{fileName}?comp=listhandles"]; + const path = op.get.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.get.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.get.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=listhandles"]; + } +``` + +### /{shareName}/{filePath}?comp=forceclosehandles +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + if (!$["/{shareName}/{filePath}?comp=forceclosehandles"]) { + const op = $["/{shareName}/{filePath}?comp=forceclosehandles"] = $["/{shareName}/{directory}/{fileName}?comp=forceclosehandles"]; + const path = op.put.parameters[0].$ref.replace(/[#].*$/, "#/parameters/"); + op.put.parameters.splice(0, 0, { "$ref": path + "ShareName" }); + op.put.parameters.splice(1, 0, { "$ref": path + "FilePath" }); + delete $["/{shareName}/{directory}/{fileName}?comp=forceclosehandles"]; + } +``` + +### ShareProperties +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.ShareProperties.properties.Metadata) { + const path = $.ShareItem.properties.Metadata.$ref; + $.ShareProperties.properties.Metadata = { "$ref": path }; + } +``` + +### ShareUsageBytes +``` yaml +directive: +- from: swagger-document + where: $.definitions.ShareStats.properties.ShareUsageBytes + transform: > + $.description = "The approximate size of the data stored in bytes, rounded up to the nearest gigabyte. Note that this value may not include all recently created or recently resized files."; + $.format = "int64"; +``` + +### ApiVersionParameter +``` yaml +directive: +- from: swagger-document + where: $.parameters.ApiVersionParameter + transform: > + $.enum = [ "2019-02-02" ]; +``` + +### Convert FileCreationTime and FileLastWriteTime to String to Support 'now' +``` yaml +directive: +- from: swagger-document + where: $.parameters.FileCreationTime + transform: > + delete $.format; +- from: swagger-document + where: $.parameters.FileLastWriteTime + transform: > + delete $.format; +``` + +### FileRangeWriteFromUrl Constant +``` yaml +directive: +- from: swagger-document + where: $.parameters.FileRangeWriteFromUrl + transform: > + delete $.default; + delete $["x-ms-enum"]; + $["x-ms-parameter-location"] = "method"; +``` diff --git a/sdk/storage/azure-storage-file/swagger/file.json b/sdk/storage/azure-storage-file/swagger/file.json deleted file mode 100644 index 26efc70f6af0..000000000000 --- a/sdk/storage/azure-storage-file/swagger/file.json +++ /dev/null @@ -1,3810 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Azure File Storage", - "version": "2018-11-09", - "x-ms-code-generation-settings": { - "header": "MIT", - "strictSpecAdherence": false - } - }, - "x-ms-parameterized-host": { - "hostTemplate": "{url}", - "useSchemePrefix": false, - "positionInOperation": "first", - "parameters": [{ - "$ref": "#/parameters/Url" - }] - }, - "securityDefinitions": { - "File_shared_key": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - }, - "schemes": [ - "https" - ], - "consumes": [ - "application/xml" - ], - "produces": [ - "application/xml" - ], - "paths": { - - }, - "x-ms-paths": { - "/?restype=service&comp=properties": { - "put": { - "tags": [ - "service" - ], - "operationId": "Service_SetProperties", - "description": "Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules.", - "parameters": [{ - "$ref": "#/parameters/FileServiceProperties" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "202": { - "description": "Success (Accepted)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetProperties", - "description": "Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules.", - "parameters": [{ - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - } - }, - "schema": { - "$ref": "#/definitions/FileServiceProperties" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/?comp=list": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_ListSharesSegment", - "description": "The List Shares Segment operation returns a list of the shares and share snapshots under the specified account.", - "parameters": [{ - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListSharesInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - } - }, - "schema": { - "$ref": "#/definitions/ListSharesResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [{ - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - }] - }, - "/{shareName}?restype=share": { - "put": { - "tags": [ - "share" - ], - "operationId": "Share_Create", - "description": "Creates a new share under the specified account. If the share with the same name already exists, the operation fails.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ShareQuota" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "201": { - "description": "Success, Share created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the share, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties or metadata updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "share" - ], - "operationId": "Share_GetProperties", - "description": "Returns all user-defined metadata and system properties for the specified share or share snapshot. The data returned does not include the share's list of files.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "x-ms-meta": { - "type": "string", - "description": "A set of name-value pairs that contain the user-defined metadata of the share.", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-share-quota": { - "x-ms-client-name": "Quota", - "type": "integer", - "description": "Returns the current share quota in GB." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "share" - ], - "operationId": "Share_Delete", - "description": "Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files contained within it are later deleted during garbage collection.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/DeleteSnapshots" - } - ], - "responses": { - "202": { - "description": "Accepted", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "share" - ] - }] - }, - "/{shareName}?restype=share&comp=snapshot": { - "put": { - "tags": [ - "share" - ], - "operationId": "Share_CreateSnapshot", - "description": "Creates a read-only snapshot of a share.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "201": { - "description": "Success, Share snapshot created.", - "headers": { - "x-ms-snapshot": { - "x-ms-client-name": "Snapshot", - "type": "string", - "description": "This header is a DateTime value that uniquely identifies the share snapshot. The value of this header may be used in subsequent requests to access the share snapshot. This value is opaque." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the share snapshot, in quotes. A share snapshot cannot be modified, so the ETag of a given share snapshot never changes. However, if new metadata was supplied with the Snapshot Share request then the ETag of the share snapshot differs from that of the base share. If no metadata was specified with the request, the ETag of the share snapshot is identical to that of the base share at the time the share snapshot was taken." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. A share snapshot cannot be modified, so the last modified time of a given share snapshot never changes. However, if new metadata was supplied with the Snapshot Share request then the last modified time of the share snapshot differs from that of the base share. If no metadata was specified with the request, the last modified time of the share snapshot is identical to that of the base share at the time the share snapshot was taken." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "share" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "snapshot" - ] - } - ] - }, - "/{shareName}?restype=share&comp=properties": { - "put": { - "tags": [ - "share" - ], - "operationId": "Share_SetQuota", - "description": "Sets quota for the specified share.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ShareQuota" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "share" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{shareName}?restype=share&comp=metadata": { - "put": { - "tags": [ - "share" - ], - "operationId": "Share_SetMetadata", - "description": "Sets one or more user-defined name-value pairs for the specified share.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "share" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{shareName}?restype=share&comp=acl": { - "get": { - "tags": [ - "share" - ], - "operationId": "Share_GetAccessPolicy", - "description": "Returns information about stored access policies specified on the share.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "put": { - "tags": [ - "share" - ], - "operationId": "Share_SetAccessPolicy", - "description": "Sets a stored access policy for use with shared access signatures.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/ShareAcl" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "share" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "acl" - ] - } - ] - }, - "/{shareName}?restype=share&comp=stats": { - "get": { - "tags": [ - "share" - ], - "operationId": "Share_GetStatistics", - "description": "Retrieves statistics related to the share.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the share or its properties updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/ShareStats" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "share" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "stats" - ] - } - ] - }, - "/{shareName}/{directoryPath}?restype=directory": { - "put": { - "tags": [ - "directory" - ], - "operationId": "Directory_Create", - "description": "Creates a new directory under the specified share or parent directory.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "201": { - "description": "Success, Directory created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the directory, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the directory or its properties updates the last modified time. Operations on files do not affect the last modified time of the directory." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "directory" - ], - "operationId": "Directory_GetProperties", - "description": "Returns all system properties for the specified directory, and can also be used to check the existence of a directory. The data returned does not include the files in the directory or any subdirectories.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-meta": { - "type": "string", - "description": "A set of name-value pairs that contain metadata for the directory.", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the Directory was last modified. Operations on files within the directory do not affect the last modified time of the directory." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is set to false." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "directory" - ], - "operationId": "Directory_Delete", - "description": "Removes the specified empty directory. Note that the directory must be empty before it can be deleted.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "202": { - "description": "Success (Accepted).", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "directory" - ] - }] - }, - "/{shareName}/{directoryPath}?restype=directory&comp=metadata": { - "put": { - "tags": [ - "directory" - ], - "operationId": "Directory_SetMetadata", - "description": "Updates user defined metadata for the specified directory.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK).", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the directory, in quotes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "directory" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{shareName}/{directoryPath}?restype=directory&comp=list": { - "get": { - "tags": [ - "directory" - ], - "operationId": "Directory_ListFilesAndDirectoriesSegment", - "description": "Returns a list of files or directories under the specified share or directory. It lists the contents only for a single level of the directory hierarchy.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "Specifies the format in which the results are returned. Currently this value is 'application/xml'." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/ListFilesAndDirectoriesSegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [{ - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "directory" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/{shareName}/{directoryPath}?comp=listhandles": { - "get":{ - "tags": [ - "directory" - ], - "operationId": "Directory_ListHandles", - "description": "Lists handles for directory.", - "parameters":[ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Recursive" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "Specifies the format in which the results are returned. Currently this value is 'application/xml'." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/ListHandlesResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "listhandles" - ] - } - ] - }, - "/{shareName}/{directoryPath}?comp=forceclosehandles": { - "put": { - "tags": [ - "directory" - ], - "operationId": "Directory_ForceCloseHandles", - "description": "Closes all handles open for given directory.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/DirectoryPath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/HandleId" - }, - { - "$ref": "#/parameters/Recursive" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-marker": { - "x-ms-client-name": "marker", - "type": "string", - "description": "A string describing next handle to be closed. It is returned when more handles need to be closed to complete the request." - }, - "x-ms-number-of-handles-closed": { - "x-ms-client-name": "numberOfHandlesClosed", - "type": "integer", - "description": "Contains count of number of handles closed." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "forceclosehandles" - ] - } - ] - }, - "/{shareName}/{filePath}": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_Create", - "description": "Creates a new file or replaces a file. Note it only initializes the file with no content.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "name": "x-ms-content-length", - "x-ms-client-name": "fileContentLength", - "in": "header", - "description": "Specifies the maximum size for the file, up to 1 TB.", - "required": true, - "type": "integer", - "format": "int64" - }, - { - "$ref": "#/parameters/FileType" - }, - { - "$ref": "#/parameters/FileContentType" - }, - { - "$ref": "#/parameters/FileContentEncoding" - }, - { - "$ref": "#/parameters/FileContentLanguage" - }, - { - "$ref": "#/parameters/FileCacheControl" - }, - { - "$ref": "#/parameters/FileContentMD5" - }, - { - "$ref": "#/parameters/FileContentDisposition" - }, - { - "$ref": "#/parameters/Metadata" - } - ], - "responses": { - "201": { - "description": "Success, File created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the file, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the share was last modified. Any operation that modifies the directory or its properties updates the last modified time. Operations on files do not affect the last modified time of the directory." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "file" - ], - "operationId": "File_Download", - "description": "Reads or downloads a file from the system, including its metadata and properties.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/GetRangeContentMD5" - } - ], - "responses": { - "200": { - "description": "Succeeded to read the entire file.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the file was last modified. Any operation that modifies the file or its properties updates the last modified time." - }, - "x-ms-meta": { - "type": "string", - "description": "A set of name-value pairs associated with this file as user-defined metadata.", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The content type specified for the file. The default content type is 'application/octet-stream'" - }, - "Content-Range": { - "type": "string", - "description": "Indicates the range of bytes returned if the client requested a subset of the file by setting the Range request header." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the file has an MD5 hash and the request is to read the full file, this response header is returned so that the client can check for message content integrity. If the request is to read a specified range and the 'x-ms-range-get-content-md5' is set to true, then the request returns an MD5 hash for the range, as long as the range size is less than or equal to 4 MB. If neither of these sets of conditions is true, then no value is returned for the 'Content-MD5' header." - }, - "Content-Encoding": { - "type": "string", - "description": "Returns the value that was specified for the Content-Encoding request header." - }, - "Cache-Control": { - "type": "string", - "description": "Returned if it was previously specified for the file." - }, - "Content-Disposition": { - "type": "string", - "description": "Returns the value that was specified for the 'x-ms-content-disposition' header and specifies how to process the response." - }, - "Content-Language": { - "type": "string", - "description": "Returns the value that was specified for the Content-Language request header." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial file content." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy File operation where this file was the destination file. This value can specify the time of a completed, aborted, or failed copy attempt." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operation failure." - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for the last attempted Copy File operation where this file was the destination file." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy File operation where this file was the destination file. Can show between 0 and Content-Length bytes copied." - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by 'x-ms-copy-id'.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-content-md5": { - "x-ms-client-name": "FileContentMD5", - "type": "string", - "format": "byte", - "description": "If the file has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned with the value of the whole file's MD5 value. This value may or may not be equal to the value returned in Content-MD5 header, with the latter calculated from the requested range." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the file is unencrypted, or if only parts of the file/application metadata are encrypted)." - } - }, - "schema": { - "type": "object", - "format": "file" - } - }, - "206": { - "description": "Succeeded to read a specified range of the file.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the file was last modified. Any operation that modifies the file or its properties updates the last modified time." - }, - "x-ms-meta": { - "type": "string", - "description": "A set of name-value pairs associated with this file as user-defined metadata.", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The content type specified for the file. The default content type is 'application/octet-stream'" - }, - "Content-Range": { - "type": "string", - "description": "Indicates the range of bytes returned if the client requested a subset of the file by setting the Range request header." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the file has an MD5 hash and the request is to read the full file, this response header is returned so that the client can check for message content integrity. If the request is to read a specified range and the 'x-ms-range-get-content-md5' is set to true, then the request returns an MD5 hash for the range, as long as the range size is less than or equal to 4 MB. If neither of these sets of conditions is true, then no value is returned for the 'Content-MD5' header." - }, - "Content-Encoding": { - "type": "string", - "description": "Returns the value that was specified for the Content-Encoding request header." - }, - "Cache-Control": { - "type": "string", - "description": "Returned if it was previously specified for the file." - }, - "Content-Disposition": { - "type": "string", - "description": "Returns the value that was specified for the 'x-ms-content-disposition' header and specifies how to process the response." - }, - "Content-Language": { - "type": "string", - "description": "Returns the value that was specified for the Content-Language request header." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial file content." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy File operation where this file was the destination file. This value can specify the time of a completed, aborted, or failed copy attempt." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operation failure." - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for the last attempted Copy File operation where this file was the destination file." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy File operation where this file was the destination file. Can show between 0 and Content-Length bytes copied." - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by 'x-ms-copy-id'.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-content-md5": { - "x-ms-client-name": "FileContentMD5", - "type": "string", - "format": "byte", - "description": "If the file has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned with the value of the whole file's MD5 value. This value may or may not be equal to the value returned in Content-MD5 header, with the latter calculated from the requested range." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the file is unencrypted, or if only parts of the file/application metadata are encrypted)." - } - }, - "schema": { - "type": "object", - "format": "file" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "head": { - "tags": [ - "file" - ], - "operationId": "File_GetProperties", - "description": "Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not return the content of the file.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the file was last modified. The date format follows RFC 1123. Any operation that modifies the file or its properties updates the last modified time." - }, - "x-ms-meta": { - "type": "string", - "description": "A set of name-value pairs associated with this file as user-defined metadata.", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "x-ms-type": { - "x-ms-client-name": "FileType", - "description": "Returns the type File. Reserved for future use.", - "type": "string", - "enum": [ - "File" - ] - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The size of the file in bytes. This header returns the value of the 'x-ms-content-length' header that is stored with the file." - }, - "Content-Type": { - "type": "string", - "description": "The content type specified for the file. The default content type is 'application/octet-stream'" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value that you can use to perform operations conditionally, in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the Content-MD5 header has been set for the file, the Content-MD5 response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "If the Content-Encoding request header has previously been set for the file, the Content-Encoding value is returned in this header." - }, - "Cache-Control": { - "type": "string", - "description": "If the Cache-Control request header has previously been set for the file, the Cache-Control value is returned in this header." - }, - "Content-Disposition": { - "type": "string", - "description": "Returns the value that was specified for the 'x-ms-content-disposition' header and specifies how to process the response." - }, - "Content-Language": { - "type": "string", - "description": "Returns the value that was specified for the Content-Language request header." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy File operation where this file was the destination file. This value can specify the time of a completed, aborted, or failed copy attempt." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operation failure." - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for the last attempted Copy File operation where this file was the destination file." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy File operation where this file was the destination file. Can show between 0 and Content-Length bytes copied." - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by 'x-ms-copy-id'.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the file is unencrypted, or if only parts of the file/application metadata are encrypted)." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - } - } - }, - "delete": { - "tags": [ - "file" - ], - "operationId": "File_Delete", - "description": "removes the file from the storage account.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "202": { - "description": "Success (Accepted).", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - - ] - }, - "/{shareName}/{filePath}?comp=properties": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_SetHTTPHeaders", - "description": "Sets HTTP headers on the file.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "name": "x-ms-content-length", - "x-ms-client-name": "fileContentLength", - "in": "header", - "description": "Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared.", - "required": false, - "type": "integer", - "format": "int64" - }, - { - "$ref": "#/parameters/FileContentType" - }, - { - "$ref": "#/parameters/FileContentEncoding" - }, - { - "$ref": "#/parameters/FileContentLanguage" - }, - { - "$ref": "#/parameters/FileCacheControl" - }, - { - "$ref": "#/parameters/FileContentMD5" - }, - { - "$ref": "#/parameters/FileContentDisposition" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the file, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the directory was last modified. Any operation that modifies the directory or its properties updates the last modified time. Operations on files do not affect the last modified time of the directory." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - }] - }, - "/{shareName}/{filePath}?comp=metadata": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_SetMetadata", - "description": "Updates user-defined metadata for the specified file.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK).", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the file, in quotes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - }] - }, - "/{shareName}/{filePath}?comp=range": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_UploadRange", - "description": "Upload a range of bytes to a file.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/OptionalBody" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "description": "Specifies the range of bytes to be written. Both the start and end of the range must be specified. For an update operation, the range can be up to 4 MB in size. For a clear operation, the range can be up to the value of the file's full size. The File service accepts only a single byte range for the Range and 'x-ms-range' headers, and the byte range must be specified in the following format: bytes=startByte-endByte.", - "required": true, - "type": "string" - }, - { - "name": "x-ms-write", - "x-ms-client-name": "FileRangeWrite", - "in": "header", - "description": "Specify one of the following options: - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update. - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and set the Range header to a value that indicates the range to clear, up to maximum file size.", - "required": true, - "type": "string", - "enum": [ - "update", - "clear" - ], - "default": "update", - "x-ms-enum": { - "name": "FileRangeWriteType", - "modelAsString": false - } - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "201": { - "description": "Success (Created).", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the file, in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the directory was last modified. Any operation that modifies the share or its properties or metadata updates the last modified time. Operations on files do not affect the last modified time of the share." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "This header is returned so that the client can check for message content integrity. The value of this header is computed by the File service; it is not necessarily the same value as may have been specified in the request headers." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "range" - ] - }] - }, - "/{shareName}/{filePath}?comp=rangelist": { - "get": { - "tags": [ - "file" - ], - "operationId": "File_GetRangeList", - "description": "Returns the list of valid ranges for a file.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "description": "Specifies the range of bytes over which to list ranges, inclusively.", - "required": false, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The date/time that the file was last modified. Any operation that modifies the file, including an update of the file's metadata or properties, changes the file's last modified time." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "The ETag contains a value which represents the version of the file, in quotes." - }, - "x-ms-content-length": { - "x-ms-client-name": "FileContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the file in bytes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/RangeList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "rangelist" - ] - }] - }, - "/{shareName}/{filePath}?comp=copy": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_StartCopy", - "description": "Copies a blob or file to a destination file within the storage account.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/CopySource" - } - ], - "responses": { - "202": { - "description": "The copy file has been accepted with the specified copy status.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "If the copy is completed, contains the ETag of the destination file. If the copy is not complete, contains the ETag of the empty file created at the start of the copy." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date/time that the copy operation to the destination file completed." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get File or Get File Properties to check the status of this copy operation, or pass to Abort Copy File to abort a pending copy." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - - ] - }, - "/{shareName}/{filePath}?comp=copy©id={CopyId}": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_AbortCopy", - "description": "Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata.", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/CopyId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/CopyActionAbort" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "204": { - "description": "The delete request was accepted and the file will be deleted.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "copy" - ] - }] - }, - "/{shareName}/{filePath}?comp=listhandles": { - "get":{ - "tags": [ - "file" - ], - "operationId": "File_ListHandles", - "description": "Lists handles for file", - "parameters":[ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "Specifies the format in which the results are returned. Currently this value is 'application/xml'." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - }, - "schema": { - "$ref": "#/definitions/ListHandlesResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "listhandles" - ] - } - ] - }, - "/{shareName}/{filePath}?comp=forceclosehandles": { - "put": { - "tags": [ - "file" - ], - "operationId": "File_ForceCloseHandles", - "description": "Closes all handles open for given file", - "parameters": [ - { - "$ref": "#/parameters/ShareName" - }, - { - "$ref": "#/parameters/FilePath" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/ShareSnapshot" - }, - { - "$ref": "#/parameters/HandleId" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the File service used to execute the request." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value generated by the service that indicates the time at which the response was initiated." - }, - "x-ms-marker": { - "x-ms-client-name": "marker", - "type": "string", - "description": "A string describing next handle to be closed. It is returned when more handles need to be closed to complete the request." - }, - "x-ms-number-of-handles-closed": { - "x-ms-client-name": "numberOfHandlesClosed", - "type": "integer", - "description": "Contains count of number of handles closed." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [{ - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "forceclosehandles" - ] - } - ] - } - }, - "definitions": { - "AccessPolicy": { - "description": "An Access policy.", - "type": "object", - "properties": { - "Start": { - "description": "The date-time the policy is active.", - "type": "string", - "format": "date-time" - }, - "Expiry": { - "description": "The date-time the policy expires.", - "type": "string", - "format": "date-time" - }, - "Permission": { - "description": "The permissions for the ACL policy.", - "type": "string" - } - } - }, - "CorsRule": { - "description": "CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain.", - "type": "object", - "required": [ - "AllowedOrigins", - "AllowedMethods", - "AllowedHeaders", - "ExposedHeaders", - "MaxAgeInSeconds" - ], - "properties": { - "AllowedOrigins": { - "description": "The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS.", - "type": "string" - }, - "AllowedMethods": { - "description": "The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated)", - "type": "string" - }, - "AllowedHeaders": { - "description": "The request headers that the origin domain may specify on the CORS request.", - "type": "string" - }, - "ExposedHeaders": { - "description": "The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer.", - "type": "string" - }, - "MaxAgeInSeconds": { - "description": "The maximum amount time that a browser should cache the preflight OPTIONS request.", - "type": "integer", - "minimum": 0 - } - } - }, - "ErrorCode": { - "description": "Error codes returned by the service", - "type": "string", - "enum": [ - "AccountAlreadyExists", - "AccountBeingCreated", - "AccountIsDisabled", - "AuthenticationFailed", - "AuthorizationFailure", - "ConditionHeadersNotSupported", - "ConditionNotMet", - "EmptyMetadataKey", - "InsufficientAccountPermissions", - "InternalError", - "InvalidAuthenticationInfo", - "InvalidHeaderValue", - "InvalidHttpVerb", - "InvalidInput", - "InvalidMd5", - "InvalidMetadata", - "InvalidQueryParameterValue", - "InvalidRange", - "InvalidResourceName", - "InvalidUri", - "InvalidXmlDocument", - "InvalidXmlNodeValue", - "Md5Mismatch", - "MetadataTooLarge", - "MissingContentLengthHeader", - "MissingRequiredQueryParameter", - "MissingRequiredHeader", - "MissingRequiredXmlNode", - "MultipleConditionHeadersNotSupported", - "OperationTimedOut", - "OutOfRangeInput", - "OutOfRangeQueryParameterValue", - "RequestBodyTooLarge", - "ResourceTypeMismatch", - "RequestUrlFailedToParse", - "ResourceAlreadyExists", - "ResourceNotFound", - "ServerBusy", - "UnsupportedHeader", - "UnsupportedXmlNode", - "UnsupportedQueryParameter", - "UnsupportedHttpVerb", - "CannotDeleteFileOrDirectory", - "ClientCacheFlushDelay", - "DeletePending", - "DirectoryNotEmpty", - "FileLockConflict", - "InvalidFileOrDirectoryPathName", - "ParentNotFound", - "ReadOnlyAttribute", - "ShareAlreadyExists", - "ShareBeingDeleted", - "ShareDisabled", - "ShareNotFound", - "SharingViolation", - "ShareSnapshotInProgress", - "ShareSnapshotCountExceeded", - "ShareSnapshotOperationNotSupported", - "ShareHasSnapshots", - "ContainerQuotaDowngradeNotAllowed" - ], - "x-ms-enum": { - "name": "StorageErrorCode", - "modelAsString": true - } - }, - "FilesAndDirectoriesListSegment": { - "description": "Abstract for entries that can be listed from Directory.", - "type": "object", - "required": [ - "DirectoryItems", - "FileItems" - ], - "properties": { - "DirectoryItems": { - "type": "array", - "items": { - "$ref": "#/definitions/DirectoryItem" - } - }, - "FileItems": { - "type": "array", - "items": { - "$ref": "#/definitions/FileItem" - } - } - }, - "xml": { - "name": "Entries" - } - }, - "DirectoryItem": { - "xml": { - "name": "Directory" - }, - "description": "A listed directory item.", - "type": "object", - "required": [ - "Name" - ], - "properties": { - "Name": { - "type": "string" - } - } - }, - "FileItem": { - "xml": { - "name": "File" - }, - "description": "A listed file item.", - "type": "object", - "required": [ - "Name", - "Properties" - ], - "properties": { - "Name": { - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/FileProperty" - } - } - }, - "FileProperty": { - "description": "File properties.", - "type": "object", - "required": [ - "Content-Length" - ], - "properties": { - "Content-Length": { - "description": "Content length of the file. This value may not be up-to-date since an SMB client may have modified the file locally. The value of Content-Length may not reflect that fact until the handle is closed or the op-lock is broken. To retrieve current property values, call Get File Properties.", - "type": "integer", - "format": "int64" - } - } - }, - "HandleItem" : { - "xml": { - "name": "Handle" - }, - "description": "A listed Azure Storage handle item.", - "type": "object", - "required": [ - "HandleId", - "Path", - "FileId", - "SessionId", - "ClientIp", - "OpenTime" - ], - "properties": { - "HandleId": { - "type": "string", - "description": "XSMB service handle ID" - }, - "Path": { - "type": "string", - "description": "File or directory name including full path starting from share root" - }, - "FileId": { - "type": "string", - "description": "FileId uniquely identifies the file or directory." - }, - "ParentId": { - "type": "string", - "description": "ParentId uniquely identifies the parent directory of the object." - }, - "SessionId": { - "type": "string", - "description": "SMB session ID in context of which the file handle was opened" - }, - "ClientIp": { - "type": "string", - "description": "Client IP that opened the handle" - }, - "OpenTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Time when the session that previously opened the handle has last been reconnected. (UTC)" - }, - "LastReconnectTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Time handle was last connected to (UTC)" - } - } - }, - "ListFilesAndDirectoriesSegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of directories and files.", - "type": "object", - "required": [ - "ServiceEndpoint", - "ShareName", - "DirectoryPath", - "Prefix", - "NextMarker", - "Segment" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "ShareName": { - "type": "string", - "xml": { - "attribute": true - } - }, - "ShareSnapshot": { - "type": "string", - "xml": { - "attribute": true - } - }, - "DirectoryPath": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "Segment": { - "$ref": "#/definitions/FilesAndDirectoriesListSegment" - }, - "NextMarker": { - "type": "string" - } - } - }, - "ListHandlesResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of handles.", - "type": "object", - "required": [ - "NextMarker" - ], - "properties": { - "HandleList": { - "type": "array", - "items": { - "$ref": "#/definitions/HandleItem" - }, - "xml": { - "name": "Entries", - "wrapped": true - } - }, - "NextMarker": { - "type": "string" - } - } - }, - "ListSharesResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of shares.", - "type": "object", - "required": [ - "ServiceEndpoint", - "NextMarker" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "ShareItems": { - "type": "array", - "items": { - "$ref": "#/definitions/ShareItem" - }, - "xml": { - "name": "Shares", - "wrapped": true - } - }, - "NextMarker": { - "type": "string" - } - } - }, - "Metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "Metrics": { - "description": "Storage Analytics metrics for file service.", - "required": [ - "Version", - "Enabled" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Enabled": { - "description": "Indicates whether metrics are enabled for the File service.", - "type": "boolean" - }, - "IncludeAPIs": { - "description": "Indicates whether metrics should generate summary statistics for called API operations.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "Range": { - "description": "An Azure Storage file range.", - "type": "object", - "required": [ - "Start", - "End" - ], - "properties": { - "Start": { - "type": "integer", - "format": "int64", - "description": "Start of the range." - }, - "End": { - "type": "integer", - "format": "int64", - "description": "End of the range." - } - }, - "xml": { - "name": "Range" - } - }, - "RangeList": { - "description": "A list of non-overlapping valid ranges, sorted by increasing address range.", - "type": "array", - "items": { - "$ref": "#/definitions/Range" - }, - "xml": { - "wrapped": true, - "name": "Ranges" - } - }, - "StorageError": { - "type": "object", - "properties": { - "Message": { - "type": "string" - } - } - }, - "RetentionPolicy": { - "description": "The retention policy.", - "type": "object", - "required": [ - "Enabled" - ], - "properties": { - "Enabled": { - "description": "Indicates whether a retention policy is enabled for the File service. If false, metrics data is retained, and the user is responsible for deleting it.", - "type": "boolean" - }, - "Days": { - "description": "Indicates the number of days that metrics data should be retained. All data older than this value will be deleted. Metrics data is deleted on a best-effort basis after the retention period expires.", - "type": "integer", - "minimum": 1, - "maximum": 365 - } - } - }, - "ShareItem": { - "xml": { - "name": "Share" - }, - "description": "A listed Azure Storage share item.", - "type": "object", - "required": [ - "Name", - "Properties" - ], - "properties": { - "Name": { - "type": "string" - }, - "Snapshot": { - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/ShareProperties" - }, - "Metadata": { - "$ref": "#/definitions/Metadata" - } - } - }, - "ShareProperties": { - "description": "Properties of a share.", - "type": "object", - "required": [ - "Last-Modified", - "Etag", - "Quota" - ], - "properties": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Etag": { - "type": "string", - "format": "etag" - }, - "Quota": { - "type": "integer" - }, - "Metadata": { - "$ref": "#/definitions/Metadata" - } - } - }, - "ShareStats": { - "description": "Stats for the share.", - "type": "object", - "required": [ - "ShareUsageBytes" - ], - "properties": { - "ShareUsageBytes": { - "description": "The approximate size of the data stored in bytes, rounded up to the nearest gigabyte. Note that this value may not include all recently created or recently resized files.", - "type": "integer", - "format": "int64" - } - } - }, - "SignedIdentifier": { - "description": "Signed identifier.", - "type": "object", - "required": [ - "Id" - ], - "properties": { - "Id": { - "type": "string", - "description": "A unique id." - }, - "AccessPolicy": { - "description": "The access policy.", - "$ref": "#/definitions/AccessPolicy" - } - } - }, - "SignedIdentifiers": { - "description": "A collection of signed identifiers.", - "type": "array", - "items": { - "$ref": "#/definitions/SignedIdentifier", - "xml": { - "name": "SignedIdentifier" - } - }, - "xml": { - "wrapped": true, - "name": "SignedIdentifiers" - } - }, - "FileServiceProperties": { - "description": "Storage service properties.", - "type": "object", - "properties": { - "HourMetrics": { - "description": "A summary of request statistics grouped by API in hourly aggregates for files.", - "$ref": "#/definitions/Metrics" - }, - "MinuteMetrics": { - "description": "A summary of request statistics grouped by API in minute aggregates for files.", - "$ref": "#/definitions/Metrics" - }, - "Cors": { - "description": "The set of CORS rules.", - "type": "array", - "items": { - "$ref": "#/definitions/CorsRule" - }, - "xml": { - "wrapped": true - } - } - }, - "xml": { - "name": "StorageServiceProperties" - } - } - }, - "parameters": { - "ApiVersionParameter": { - "name": "x-ms-version", - "x-ms-client-name": "version", - "in": "header", - "description": "Specifies the version of the operation to use for this request.", - "required": true, - "type": "string", - "enum": [ - "2018-11-09" - ] - }, - "ContentLength": { - "name": "Content-Length", - "x-ms-client-name": "contentLength", - "in": "header", - "description": "Specifies the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of this header must be set to zero.", - "required": true, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method" - }, - "ContentMD5": { - "name": "Content-MD5", - "x-ms-client-name": "contentMD5", - "in": "header", - "description": "An MD5 hash of the content. This hash is used to verify the integrity of the data during transport. When the Content-MD5 header is specified, the File service compares the hash of the content that has arrived with the header value that was sent. If the two hashes do not match, the operation will fail with error code 400 (Bad Request).", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method" - }, - "CopyActionAbort": { - "name": "x-ms-copy-action", - "x-ms-client-name": "copyActionAbortConstant", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "abort" - ], - "x-ms-parameter-location": "method" - }, - "CopyId": { - "name": "copyid", - "x-ms-client-name": "copyId", - "in": "query", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The copy identifier provided in the x-ms-copy-id header of the original Copy File operation." - }, - "CopySource": { - "name": "x-ms-copy-source", - "x-ms-client-name": "copySource", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source." - }, - "DeleteSnapshots": { - "name": "x-ms-delete-snapshots", - "x-ms-client-name": "deleteSnapshots", - "description": "Specifies the option include to delete the base share and all of its snapshots.", - "in": "header", - "required": false, - "type": "string", - "enum": [ - "include" - ], - "x-ms-enum": { - "name": "DeleteSnapshotsOptionType", - "modelAsString": false - }, - "x-ms-parameter-location": "method" - }, - "DirectoryPath": { - "name": "directoryPath", - "in": "path", - "description": "The path of the target directory.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-skip-url-encoding": false - }, - "FileCacheControl": { - "name": "x-ms-cache-control", - "x-ms-client-name": "fileCacheControl", - "description": "Sets the file's cache control. The File service stores this value but does not use or modify it.", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FileContentDisposition": { - "name": "x-ms-content-disposition", - "x-ms-client-name": "fileContentDisposition", - "description": "Sets the file's Content-Disposition header.", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FileContentEncoding": { - "name": "x-ms-content-encoding", - "x-ms-client-name": "fileContentEncoding", - "in": "header", - "description": "Specifies which content encodings have been applied to the file.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FileContentLanguage": { - "name": "x-ms-content-language", - "x-ms-client-name": "fileContentLanguage", - "in": "header", - "description": "Specifies the natural languages used by this resource.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FileContentMD5": { - "name": "x-ms-content-md5", - "x-ms-client-name": "fileContentMD5", - "in": "header", - "description": "Sets the file's MD5 hash.", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FileContentType": { - "name": "x-ms-content-type", - "x-ms-client-name": "fileContentType", - "in": "header", - "description": "Sets the MIME content type of the file. The default type is 'application/octet-stream'.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "file-HTTP-headers" - } - }, - "FilePath": { - "name": "filePath", - "in": "path", - "description": "The path of the target file.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-skip-url-encoding": false - }, - "FileType": { - "name": "x-ms-type", - "x-ms-client-name": "fileTypeConstant", - "in": "header", - "required": true, - "description": "Dummy constant parameter, file type can only be file.", - "type": "string", - "enum": [ - "file" - ], - "x-ms-parameter-location": "method" - }, - "GetRangeContentMD5": { - "name": "x-ms-range-get-content-md5", - "x-ms-client-name": "rangeGetContentMD5", - "in": "header", - "required": false, - "type": "boolean", - "x-ms-parameter-location": "method", - "description": "When this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size." - }, - "HandleId": { - "name": "x-ms-handle-id", - "x-ms-client-name": "handleId", - "in": "header", - "description": "Specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that specifies all handles.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "ListSharesInclude": { - "name": "include", - "in": "query", - "description": "Include this parameter to specify one or more datasets to include in the response.", - "required": false, - "type": "array", - "collectionFormat": "csv", - "items": { - "type": "string", - "enum": [ - "snapshots", - "metadata" - ], - "x-ms-enum": { - "name": "ListSharesIncludeType", - "modelAsString": false - } - }, - "x-ms-parameter-location": "method" - }, - "Marker": { - "name": "marker", - "in": "query", - "description": "A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "MaxResults": { - "name": "maxresults", - "in": "query", - "description": "Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 items.", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method" - }, - "Metadata": { - "name": "x-ms-meta", - "x-ms-client-name": "metadata", - "in": "header", - "description": "A name-value pair to associate with a file storage object.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "OptionalBody": { - "name": "optionalbody", - "in": "body", - "description": "Initial data.", - "required": false, - "schema": { - "type": "object", - "format": "file" - }, - "x-ms-parameter-location": "method" - }, - "Prefix": { - "name": "prefix", - "in": "query", - "description": "Filters the results to return only entries whose name begins with the specified prefix.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "Range": { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "description": "Return file data only from the specified byte range.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "Recursive": { - "name": "x-ms-recursive", - "x-ms-client-name": "recursive", - "in": "header", - "description": "Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files.", - "required": false, - "type": "boolean", - "x-ms-parameter-location": "method" - }, - "Url": { - "name": "url", - "in": "path", - "description": "The URL of the service account, share, directory or file that is the target of the desired operation.", - "required": true, - "type": "string", - "x-ms-skip-url-encoding": true - }, - "ShareAcl": { - "name": "shareAcl", - "in": "body", - "description": "The ACL for the share.", - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - }, - "x-ms-parameter-location": "method" - }, - "ShareName": { - "name": "shareName", - "in": "path", - "description": "The name of the target share.", - "required": true, - "type": "string", - "x-ms-parameter-location": "method" - }, - "ShareQuota": { - "name": "x-ms-share-quota", - "x-ms-client-name": "quota", - "in": "header", - "description": "Specifies the maximum size of the share, in gigabytes.", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method" - }, - "ShareSnapshot": { - "name": "sharesnapshot", - "in": "query", - "description": "The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query.", - "required": false, - "type": "string", - "x-ms-parameter-location": "method" - }, - "FileServiceProperties": { - "name": "FileServiceProperties", - "in": "body", - "description": "The FileStorage properties.", - "required": true, - "schema": { - "$ref": "#/definitions/FileServiceProperties" - }, - "x-ms-parameter-location": "method" - }, - "Timeout": { - "name": "timeout", - "in": "query", - "description": "The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations.", - "required": false, - "type": "integer", - "minimum": 0, - "x-ms-parameter-location": "method" - } - } -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/README.md b/sdk/storage/azure-storage-queue/README.md index f80a2c884c44..5bd15bfd46a6 100644 --- a/sdk/storage/azure-storage-queue/README.md +++ b/sdk/storage/azure-storage-queue/README.md @@ -1,5 +1,5 @@ # Azure Storage Queue client library for Java -Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. +Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. A single queue message can be up to 64 KB in size, and a queue can contain millions of messages, up to the total capacity limit of a storage account. [Source code][source_code] | [API reference documentation][api_documentation] | [Product documentation][storage_docs] | @@ -32,13 +32,13 @@ az group create --name storage-resource-group --location westus ### Authenticate the client -In order to interact with the Storage service (Blob, Queue, Message, MessageId, File) you'll need to create an instance of the Service Client class. +In order to interact with the Storage service (Blob, Queue, Message, MessageId, File) you'll need to create an instance of the Service Client class. To make this possible you'll need the Account SAS (shared access signature) string of Storage account. Learn more at [SAS Token][sas_token] #### Get Credentials - **SAS Token** - + a. Use the [Azure CLI][azure_cli] snippet below to get the SAS token from the Storage account. ```Powershell @@ -77,7 +77,6 @@ Go to your storage account -> Access Keys -> Keys 1/ Key 2 -> Connection string ## Key concepts ### URL format Queues are addressable using the following URL format: -https://.queue.core.windows.net/ The following URL addresses a queue in the diagram: https://myaccount.queue.core.windows.net/images-to-download @@ -105,7 +104,7 @@ Every queue within an account must have a unique name. The queue name must be a 1. A queue name must be from 3 through 63 characters long. ### Queue Services -The queue service do operations on the queues in the storage account and manage the queue properties. +The queue service do operations on the queues in the storage account and manage the queue properties. ### Queue Service Client @@ -115,7 +114,7 @@ Once you have the value of the SASToken you can create the queue service client String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName) QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueURL).credential(SASToken).build(); -QueueClient newQueueServiceClient = queueServiceClient.createQueue("myqueue"); +QueueClient newQueueClient = queueServiceClient.createQueue("myqueue"); ``` or @@ -137,7 +136,7 @@ queueServiceAsyncClient.createQueue("newAsyncQueue").subscribe( ``` ### Queue -Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. +Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. A single queue message can be up to 64 KB in size, and a queue can contain millions of messages, up to the total capacity limit of a storage account. ### QueueClient @@ -145,8 +144,8 @@ Once you have the value of the SASToken you can create the queue service client ```Java String queueURL = String.format("https://%s.queue.core.windows.net/%s", accountName, queueName); QueueClient queueClient = QueueClient.builder().endpoint(queueURL).credential(SASToken).build(); -// metadata is map of key-value pair, timeout is client side timeout -QueueClient newQueueClient = queueClient.create(metadata, timeout); +// metadata is map of key-value pair +queueClient.createWithResponse(metadata, null); ``` or @@ -154,7 +153,7 @@ or ```Java String queueAsyncURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueAsyncName, sasToken) QueueAsyncClient queueAsyncClient = QueueAsyncClient.builder().endpoint(queueAsyncURL).build(); -queueAsyncClient.create(metadata, timeout).subscribe( +queueAsyncClient.createWithResponse(metadata).subscribe( result -> { // do something when new queue created }, @@ -164,8 +163,7 @@ queueAsyncClient.create(metadata, timeout).subscribe( () -> { // completed, do something }); -``` - +``` ## Examples The following sections provide several code snippets covering some of the most common Configuration Service tasks, including: @@ -205,24 +203,24 @@ QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint ### Create a queue -Create a queue in the Storage Account using `${SASToken}` as credential. +Create a queue in the Storage Account using `${SASToken}` as credential. Throws StorageErrorException If the queue fails to be created. ```Java String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName); QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).credential(SASToken).buildClient(); -QueueClient newQueueServiceClient = queueServiceClient.createQueue("myqueue"); +QueueClient newQueueClient = queueServiceClient.createQueue("myqueue"); ``` ### Delete a queue -Delete a queue in the Storage Account using `${SASToken}` as credential. +Delete a queue in the Storage Account using `${SASToken}` as credential. Throws StorageErrorException If the queue fails to be deleted. ```Java String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName); QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).credential(SASToken).buildClient(); -QueueClient newQueueServiceClient = queueServiceClient.deleteQueue("myqueue"); +queueServiceClient.deleteQueue("myqueue"); ``` ### List queues in account @@ -247,7 +245,7 @@ Use `${SASToken}` as credential. String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName); QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).credential(SASToken).buildClient(); -Response properties = queueServiceClient.getProperties(); +StorageServiceProperties properties = queueServiceClient.getProperties(); ``` ### Set properties in queue account @@ -269,8 +267,8 @@ StorageServiceProperties properties = new StorageServiceProperties() { queueServiceClient.setProperties(properties); ``` -### Get queue service statistics -The `Get Queue Service Stats` operation retrieves statistics related to replication for the Queue service. +### Get queue service statistics +The `Get Queue Service Stats` operation retrieves statistics related to replication for the Queue service. Use `${SASToken}` as credential. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. @@ -278,11 +276,11 @@ It is only available on the secondary location endpoint when read-access geo-red String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName); QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).credential(SASToken).buildClient(); -Response queueStats = queueServiceClient.getStatistics(); +StorageServiceStats queueStats = queueServiceClient.getStatistics(); ``` ### Enqueue message into a queue -The operation adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message invisible until the visibility timeout expires. +The operation adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message invisible until the visibility timeout expires. Use `${SASToken}` as credential. A message must be in a format that can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size for previous versions. @@ -301,7 +299,7 @@ QueueClient queueClient = new QueueClientBuilder().endpoint(queueURL).credential // @param messageId Id of the message // @param popReceipt Unique identifier that must match the message for it to be updated // @param visibilityTimeout How long the message will be invisible in the queue in seconds -queueClient.updateMessage(messageId, "new message", popReceipt, visibilityTimeout); +queueClient.updateMessage("new message", messageId, popReceipt, visibilityTimeout); ``` ### Peek at messages in a queue @@ -341,7 +339,7 @@ Use `${SASToken}` as credential. String queueSURL = String.format("https://%s.queue.core.windows.net", accountName); QueueClient queueClient = new QueueClientBuilder().endpoint(queueURL).credential(SASToken).queueName("myqueue").buildClient(); -Response properties = queueClient.getProperties(); +StorageServiceProperties properties = queueClient.getProperties(); ``` ### Set a queue metadata @@ -411,3 +409,5 @@ If you would like to become an active contributor to this project please follow [samples_message]: src/samples/java/com/azure/storage/queue/MessageSamples.java [samples_queue_exception]: src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java [samples_async]: src/samples/java/com/azure/storage/queue/AsyncSamples.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/storage/azure-storage-queue/README.png) \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/pom.xml b/sdk/storage/azure-storage-queue/pom.xml index 8956e06c351c..efe0eddf51a4 100644 --- a/sdk/storage/azure-storage-queue/pom.xml +++ b/sdk/storage/azure-storage-queue/pom.xml @@ -15,7 +15,8 @@ azure-storage-queue 12.0.0-preview.3 - azure-storage-queue + Microsoft Azure client library for Queue Storage + This module contains client library for Microsoft Azure Queue Storage. https://github.com/Azure/azure-sdk-for-java @@ -31,6 +32,10 @@ HEAD + + com.azure.storage.queue + + com.azure @@ -55,18 +60,15 @@ com.azure - azure-identity - 1.0.0-preview.3 - test - - - junit - junit + azure-core-http-netty + 1.0.0-preview.4 test + - org.slf4j - slf4j-simple + org.spockframework + spock-core + 1.3-groovy-2.5 test @@ -74,10 +76,38 @@ reactor-test test - - com.microsoft.azure - adal4j - test - + + + + src/main/java + src/test/java + + + + + org.apache.maven.plugins + maven-compiler-plugin + + groovy-eclipse-compiler + -Xlint:unchecked + 1.8 + 1.8 + true + + + + org.codehaus.groovy + groovy-eclipse-compiler + ${groovy-eclipse-compiler.version} + + + org.codehaus.groovy + groovy-eclipse-batch + ${groovy-eclipse-batch.version} + + + + + diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java index 659d128dc243..b27ff642fa17 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java @@ -6,6 +6,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.credentials.SASTokenCredential; @@ -24,6 +25,7 @@ import com.azure.storage.queue.models.SignedIdentifier; import com.azure.storage.queue.models.StorageErrorException; import com.azure.storage.queue.models.UpdatedMessage; +import java.util.Objects; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -33,6 +35,8 @@ import java.util.List; import java.util.Map; +import static com.azure.core.implementation.util.FluxUtil.withContext; + /** * This class provides a client that contains all the operations for interacting with a queue in Azure Storage Queue. * Operations allowed by the client are creating and deleting the queue, retrieving and updating metadata and access @@ -50,7 +54,7 @@ * @see SASTokenCredential */ public final class QueueAsyncClient { - private static final ClientLogger LOGGER = new ClientLogger(QueueAsyncClient.class); + private final ClientLogger logger = new ClientLogger(QueueAsyncClient.class); private final AzureQueueStorageImpl client; private final String queueName; @@ -62,6 +66,7 @@ public final class QueueAsyncClient { * @param queueName Name of the queue */ QueueAsyncClient(AzureQueueStorageImpl client, String queueName) { + Objects.requireNonNull(queueName); this.queueName = queueName; this.client = new AzureQueueStorageBuilder().pipeline(client.getHttpPipeline()) @@ -79,6 +84,7 @@ public final class QueueAsyncClient { * @param queueName Name of the queue */ QueueAsyncClient(URL endpoint, HttpPipeline httpPipeline, String queueName) { + Objects.requireNonNull(queueName); this.queueName = queueName; this.client = new AzureQueueStorageBuilder().pipeline(httpPipeline) @@ -94,8 +100,8 @@ public URL getQueueUrl() { try { return new URL(client.getUrl()); } catch (MalformedURLException ex) { - LOGGER.error("Queue URL is malformed"); - throw new RuntimeException("Queue URL is malformed"); + logger.error("Queue URL is malformed"); + throw logger.logExceptionAsError(new RuntimeException("Queue URL is malformed")); } } @@ -111,11 +117,11 @@ public URL getQueueUrl() { *

            For more information, see the * Azure Docs.

            * - * @return A response that only contains headers and response status code + * @return An empty response * @throws StorageErrorException If a queue with the same name already exists in the queue service. */ - public Mono create() { - return create(null); + public Mono create() { + return createWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -125,7 +131,7 @@ public Mono create() { * *

            Create a queue with metadata "queue:metadataMap"

            * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.create#map} + * {@codesnippet com.azure.storage.queue.queueAsyncClient.createWithResponse#map} * *

            For more information, see the * Azure Docs.

            @@ -134,8 +140,12 @@ public Mono create() { * @return A response that only contains headers and response status code * @throws StorageErrorException If a queue with the same name and different metadata already exists in the queue service. */ - public Mono create(Map metadata) { - return client.queues().createWithRestResponseAsync(queueName, null, metadata, null, Context.NONE) + public Mono createWithResponse(Map metadata) { + return withContext(context -> createWithResponse(metadata, context)); + } + + Mono createWithResponse(Map metadata, Context context) { + return client.queues().createWithRestResponseAsync(queueName, null, metadata, null, context) .map(VoidResponse::new); } @@ -151,11 +161,34 @@ public Mono create(Map metadata) { *

            For more information, see the * Azure Docs.

            * + * @return An empty response + * @throws StorageErrorException If the queue doesn't exist + */ + public Mono delete() { + return deleteWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Permanently deletes the queue. + * + *

            Code Samples

            + * + *

            Delete a queue

            + * + * {@codesnippet com.azure.storage.queue.queueAsyncClient.deleteWithResponse} + * + *

            For more information, see the + * Azure Docs.

            + * * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist */ - public Mono delete() { - return client.queues().deleteWithRestResponseAsync(queueName, Context.NONE) + public Mono deleteWithResponse() { + return withContext(context -> deleteWithResponse(context)); + } + + Mono deleteWithResponse(Context context) { + return client.queues().deleteWithRestResponseAsync(queueName, context) .map(VoidResponse::new); } @@ -175,7 +208,31 @@ public Mono delete() { * messages count of the queue. * @throws StorageErrorException If the queue doesn't exist */ - public Mono> getProperties() { + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves metadata and approximate message count of the queue. + * + *

            Code Samples

            + * + *

            Get the properties of the queue

            + * + * {@codesnippet com.azure.storage.queue.queueAsyncClient.getPropertiesWithResponse} + * + *

            For more information, see the + * Azure Docs.

            + * + * @return A response containing a {@link QueueProperties} value which contains the metadata and approximate + * messages count of the queue. + * @throws StorageErrorException If the queue doesn't exist + */ + public Mono> getPropertiesWithResponse() { + return withContext(context -> getPropertiesWithResponse(context)); + } + + Mono> getPropertiesWithResponse(Context context) { return client.queues().getPropertiesWithRestResponseAsync(queueName, Context.NONE) .map(this::getQueuePropertiesResponse); } @@ -202,8 +259,38 @@ public Mono> getProperties() { * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist */ - public Mono setMetadata(Map metadata) { - return client.queues().setMetadataWithRestResponseAsync(queueName, null, metadata, null, Context.NONE) + public Mono setMetadata(Map metadata) { + return setMetadataWithResponse(metadata).flatMap(FluxUtil::toMono); + } + + /** + * Sets the metadata of the queue. + * + * Passing in a {@code null} value for metadata will clear the metadata associated with the queue. + * + *

            Code Samples

            + * + *

            Set the queue's metadata to "queue:metadataMap"

            + * + * {@codesnippet com.azure.storage.queue.queueAsyncClient.setMetadataWithResponse#map} + * + *

            Clear the queue's metadata

            + * + * {@codesnippet com.azure.storage.queue.queueAsyncClient.clearMetadataWithResponse#map} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param metadata Metadata to set on the queue + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the queue doesn't exist + */ + public Mono setMetadataWithResponse(Map metadata) { + return withContext(context -> setMetadataWithResponse(metadata, context)); + } + + Mono setMetadataWithResponse(Map metadata, Context context) { + return client.queues().setMetadataWithRestResponseAsync(queueName, null, metadata, null, context) .map(VoidResponse::new); } @@ -234,7 +321,28 @@ public Flux getAccessPolicy() { * *

            Set a read only stored access policy

            * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.setAccessPolicy} + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.setAccessPolicy#List} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param permissions Access policies to set on the queue + * @return An empty response + * @throws StorageErrorException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, + * or the queue will have more than five policies. + */ + public Mono setAccessPolicy(List permissions) { + return setAccessPolicyWithResponse(permissions).flatMap(FluxUtil::toMono); + } + + /** + * Sets stored access policies on the queue. + * + *

            Code Samples

            + * + *

            Set a read only stored access policy

            + * + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.setAccessPolicyWithResponse#List} * *

            For more information, see the * Azure Docs.

            @@ -244,8 +352,12 @@ public Flux getAccessPolicy() { * @throws StorageErrorException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, * or the queue will have more than five policies. */ - public Mono setAccessPolicy(List permissions) { - return client.queues().setAccessPolicyWithRestResponseAsync(queueName, permissions, null, null, Context.NONE) + public Mono setAccessPolicyWithResponse(List permissions) { + return withContext(context -> setAccessPolicyWithResponse(permissions, context)); + } + + Mono setAccessPolicyWithResponse(List permissions, Context context) { + return client.queues().setAccessPolicyWithRestResponseAsync(queueName, permissions, null, null, context) .map(VoidResponse::new); } @@ -261,11 +373,34 @@ public Mono setAccessPolicy(List permissions) { *

            For more information, see the * Azure Docs.

            * + * @return An empty response + * @throws StorageErrorException If the queue doesn't exist + */ + public Mono clearMessages() { + return clearMessagesWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Deletes all messages in the queue. + * + *

            Code Samples

            + * + *

            Clear the messages

            + * + * {@codesnippet com.azure.storage.queue.queueAsyncClient.clearMessagesWithResponse} + * + *

            For more information, see the + * Azure Docs.

            + * * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist */ - public Mono clearMessages() { - return client.messages().clearWithRestResponseAsync(queueName, Context.NONE) + public Mono clearMessagesWithResponse() { + return withContext(context -> clearMessagesWithResponse(context)); + } + + Mono clearMessagesWithResponse(Context context) { + return client.messages().clearWithRestResponseAsync(queueName, context) .map(VoidResponse::new); } @@ -287,8 +422,8 @@ public Mono clearMessages() { * about the enqueued message. * @throws StorageErrorException If the queue doesn't exist */ - public Mono> enqueueMessage(String messageText) { - return enqueueMessage(messageText, Duration.ofSeconds(0), Duration.ofDays(7)); + public Mono enqueueMessage(String messageText) { + return enqueueMessageWithResponse(messageText, null, null).flatMap(FluxUtil::toMono); } /** @@ -298,11 +433,11 @@ public Mono> enqueueMessage(String messageText) { * *

            Add a message of "Hello, Azure" that has a timeout of 5 seconds

            * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessage#string-duration-duration} + * {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessageWithResponse#string-duration-duration} * *

            Add a message of "Goodbye, Azure" that has a time to live of 5 seconds

            * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessageLiveTime#string-duration-duration} + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration} * *

            For more information, see the * Azure Docs.

            @@ -319,12 +454,16 @@ public Mono> enqueueMessage(String messageText) { * @throws StorageErrorException If the queue doesn't exist or the {@code visibilityTimeout} or {@code timeToLive} * are outside of the allowed limits. */ - public Mono> enqueueMessage(String messageText, Duration visibilityTimeout, Duration timeToLive) { + public Mono> enqueueMessageWithResponse(String messageText, Duration visibilityTimeout, Duration timeToLive) { + return withContext(context -> enqueueMessageWithResponse(messageText, visibilityTimeout, timeToLive, context)); + } + + Mono> enqueueMessageWithResponse(String messageText, Duration visibilityTimeout, Duration timeToLive, Context context) { Integer visibilityTimeoutInSeconds = (visibilityTimeout == null) ? null : (int) visibilityTimeout.getSeconds(); Integer timeToLiveInSeconds = (timeToLive == null) ? null : (int) timeToLive.getSeconds(); QueueMessage message = new QueueMessage().messageText(messageText); - return client.messages().enqueueWithRestResponseAsync(queueName, message, visibilityTimeoutInSeconds, timeToLiveInSeconds, null, null, Context.NONE) + return client.messages().enqueueWithRestResponseAsync(queueName, message, visibilityTimeoutInSeconds, timeToLiveInSeconds, null, null, context) .map(response -> new SimpleResponse<>(response, response.value().get(0))); } @@ -458,7 +597,7 @@ public Flux peekMessages(Integer maxMessages) { * *

            Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds

            * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.updateMessage} + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.updateMessage#String-String-String-Duration} * *

            For more information, see the * Azure Docs.

            @@ -473,9 +612,39 @@ public Flux peekMessages(Integer maxMessages) { * @throws StorageErrorException If the queue or messageId don't exist, the popReceipt doesn't match on the message, * or the {@code visibilityTimeout} is outside the allowed bounds */ - public Mono> updateMessage(String messageText, String messageId, String popReceipt, Duration visibilityTimeout) { + public Mono updateMessage(String messageText, String messageId, String popReceipt, Duration visibilityTimeout) { + return updateMessageWithResponse(messageText, messageId, popReceipt, visibilityTimeout).flatMap(FluxUtil::toMono); + } + + /** + * Updates the specific message in the queue with a new message and resets the visibility timeout. + * + *

            Code Samples

            + * + *

            Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds

            + * + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.updateMessageWithResponse#String-String-String-Duration} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param messageText Updated value for the message + * @param messageId Id of the message to update + * @param popReceipt Unique identifier that must match for the message to be updated + * @param visibilityTimeout The timeout period for how long the message is invisible in the queue in seconds. The + * timeout period must be between 1 second and 7 days. + * @return A {@link UpdatedMessage} that contains the new {@link UpdatedMessage#popReceipt() popReceipt} to interact + * with the message, additionally contains the updated metadata about the message. + * @throws StorageErrorException If the queue or messageId don't exist, the popReceipt doesn't match on the message, + * or the {@code visibilityTimeout} is outside the allowed bounds + */ + public Mono> updateMessageWithResponse(String messageText, String messageId, String popReceipt, Duration visibilityTimeout) { + return withContext(context -> updateMessageWithResponse(messageText, messageId, popReceipt, visibilityTimeout, context)); + } + + Mono> updateMessageWithResponse(String messageText, String messageId, String popReceipt, Duration visibilityTimeout, Context context) { QueueMessage message = new QueueMessage().messageText(messageText); - return client.messageIds().updateWithRestResponseAsync(queueName, messageId, message, popReceipt, (int) visibilityTimeout.getSeconds(), Context.NONE) + return client.messageIds().updateWithRestResponseAsync(queueName, messageId, message, popReceipt, (int) visibilityTimeout.getSeconds(), context) .map(this::getUpdatedMessageResponse); } @@ -486,7 +655,28 @@ public Mono> updateMessage(String messageText, String m * *

            Delete the first message

            * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.deleteMessage} + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.deleteMessage#String-String} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param messageId Id of the message to deleted + * @param popReceipt Unique identifier that must match for the message to be deleted + * @return An empty response + * @throws StorageErrorException If the queue or messageId don't exist or the popReceipt doesn't match on the message + */ + public Mono deleteMessage(String messageId, String popReceipt) { + return deleteMessageWithResponse(messageId, popReceipt).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the specified message in the queue + * + *

            Code Samples

            + * + *

            Delete the first message

            + * + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.deleteMessageWithResponse#String-String} * *

            For more information, see the * Azure Docs.

            @@ -496,8 +686,12 @@ public Mono> updateMessage(String messageText, String m * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue or messageId don't exist or the popReceipt doesn't match on the message */ - public Mono deleteMessage(String messageId, String popReceipt) { - return client.messageIds().deleteWithRestResponseAsync(queueName, messageId, popReceipt, Context.NONE) + public Mono deleteMessageWithResponse(String messageId, String popReceipt) { + return withContext(context -> deleteMessageWithResponse(messageId, popReceipt, context)); + } + + Mono deleteMessageWithResponse(String messageId, String popReceipt, Context context) { + return client.messageIds().deleteWithRestResponseAsync(queueName, messageId, popReceipt, context) .map(VoidResponse::new); } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java index 3e55da311b15..865be06f413f 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java @@ -4,6 +4,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.queue.models.DequeuedMessage; @@ -13,6 +14,7 @@ import com.azure.storage.queue.models.SignedIdentifier; import com.azure.storage.queue.models.StorageErrorException; import com.azure.storage.queue.models.UpdatedMessage; + import java.net.URL; import java.time.Duration; import java.util.List; @@ -66,11 +68,10 @@ public URL getQueueUrl() { *

            For more information, see the * Azure Docs.

            * - * @return A response that only contains headers and response status code * @throws StorageErrorException If a queue with the same name already exists in the queue service. */ - public VoidResponse create() { - return create(null); + public void create() { + createWithResponse(null, Context.NONE); } /** @@ -80,17 +81,18 @@ public VoidResponse create() { * *

            Create a queue with metadata "queue:metadataMap"

            * - * {@codesnippet com.azure.storage.queue.queueClient.create#map} + * {@codesnippet com.azure.storage.queue.queueClient.createWithResponse#map-Context} * *

            For more information, see the * Azure Docs.

            * * @param metadata Metadata to associate with the queue + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException If a queue with the same name and different metadata already exists in the queue service. */ - public VoidResponse create(Map metadata) { - return client.create(metadata).block(); + public VoidResponse createWithResponse(Map metadata, Context context) { + return client.createWithResponse(metadata, context).block(); } /** @@ -105,11 +107,30 @@ public VoidResponse create(Map metadata) { *

            For more information, see the * Azure Docs.

            * + * @throws StorageErrorException If the queue doesn't exist + */ + public void delete() { + deleteWithResponse(Context.NONE); + } + + /** + * Permanently deletes the queue. + * + *

            Code Samples

            + * + *

            Delete a queue

            + * + * {@codesnippet com.azure.storage.queue.queueClient.deleteWithResponse#Context} + * + *

            For more information, see the + * Azure Docs.

            + * * @return A response that only contains headers and response status code + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws StorageErrorException If the queue doesn't exist */ - public VoidResponse delete() { - return client.delete().block(); + public VoidResponse deleteWithResponse(Context context) { + return client.deleteWithResponse(context).block(); } /** @@ -128,8 +149,29 @@ public VoidResponse delete() { * messages count of the queue. * @throws StorageErrorException If the queue doesn't exist */ - public Response getProperties() { - return client.getProperties().block(); + public QueueProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * Retrieves metadata and approximate message count of the queue. + * + *

            Code Samples

            + * + *

            Get the properties of the queue

            + * + * {@codesnippet com.azure.storage.queue.queueClient.getPropertiesWithResponse#Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing a {@link QueueProperties} value which contains the metadata and approximate + * messages count of the queue. + * @throws StorageErrorException If the queue doesn't exist + */ + public Response getPropertiesWithResponse(Context context) { + return client.getPropertiesWithResponse(context).block(); } /** @@ -151,11 +193,37 @@ public Response getProperties() { * Azure Docs.

            * * @param metadata Metadata to set on the queue + * @throws StorageErrorException If the queue doesn't exist + */ + public void setMetadata(Map metadata) { + setMetadataWithResponse(metadata, Context.NONE); + } + + /** + * Sets the metadata of the queue. + * + * Passing in a {@code null} value for metadata will clear the metadata associated with the queue. + * + *

            Code Samples

            + * + *

            Set the queue's metadata to "queue:metadataMap"

            + * + * {@codesnippet com.azure.storage.queue.queueClient.setMetadataWithResponse#map-Context} + * + *

            Clear the queue's metadata

            + * + * {@codesnippet com.azure.storage.queue.queueClient.clearMetadataWithResponse#map-Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param metadata Metadata to set on the queue + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist */ - public VoidResponse setMetadata(Map metadata) { - return client.setMetadata(metadata).block(); + public VoidResponse setMetadataWithResponse(Map metadata, Context context) { + return client.setMetadataWithResponse(metadata, context).block(); } /** @@ -184,18 +252,39 @@ public Iterable getAccessPolicy() { * *

            Set a read only stored access policy

            * - * {@codesnippet com.azure.storage.queue.queueClient.setAccessPolicy} + * {@codesnippet com.azure.storage.queue.QueueClient.setAccessPolicy#List} * *

            For more information, see the * Azure Docs.

            * * @param permissions Access policies to set on the queue + * @throws StorageErrorException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, + * or the queue will have more than five policies. + */ + public void setAccessPolicy(List permissions) { + setAccessPolicyWithResponse(permissions, Context.NONE); + } + + /** + * Sets stored access policies on the queue. + * + *

            Code Samples

            + * + *

            Set a read only stored access policy

            + * + * {@codesnippet com.azure.storage.queue.queueClient.setAccessPolicyWithResponse#List-Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param permissions Access policies to set on the queue + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, * or the queue will have more than five policies. */ - public VoidResponse setAccessPolicy(List permissions) { - return client.setAccessPolicy(permissions).block(); + public VoidResponse setAccessPolicyWithResponse(List permissions, Context context) { + return client.setAccessPolicyWithResponse(permissions, context).block(); } /** @@ -210,11 +299,30 @@ public VoidResponse setAccessPolicy(List permissions) { *

            For more information, see the * Azure Docs.

            * + * @throws StorageErrorException If the queue doesn't exist + */ + public void clearMessages() { + clearMessagesWithResponse(Context.NONE); + } + + /** + * Deletes all messages in the queue. + * + *

            Code Samples

            + * + *

            Clear the messages

            + * + * {@codesnippet com.azure.storage.queue.queueClient.clearMessagesWithResponse#Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist */ - public VoidResponse clearMessages() { - return client.clearMessages().block(); + public VoidResponse clearMessagesWithResponse(Context context) { + return client.clearMessagesWithResponse(context).block(); } /** @@ -235,8 +343,8 @@ public VoidResponse clearMessages() { * about the enqueued message. * @throws StorageErrorException If the queue doesn't exist */ - public Response enqueueMessage(String messageText) { - return enqueueMessage(messageText, Duration.ofSeconds(0), Duration.ofDays(7)); + public EnqueuedMessage enqueueMessage(String messageText) { + return enqueueMessageWithResponse(messageText, null, null, Context.NONE).value(); } /** @@ -246,11 +354,11 @@ public Response enqueueMessage(String messageText) { * *

            Add a message of "Hello, Azure" that has a timeout of 5 seconds

            * - * {@codesnippet com.azure.storage.queue.queueClient.enqueueMessage#string-duration-duration} + * {@codesnippet com.azure.storage.queue.queueClient.enqueueMessageWithResponse#string-duration-duration-Context} * *

            Add a message of "Goodbye, Azure" that has a time to live of 5 seconds

            * - * {@codesnippet com.azure.storage.queue.queueClient.enqueueMessageLiveTime#string-duration-duration} + * {@codesnippet com.azure.storage.queue.QueueClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration-Context} * *

            For more information, see the * Azure Docs.

            @@ -261,14 +369,15 @@ public Response enqueueMessage(String messageText) { * seconds and 7 days. * @param timeToLive Optional. How long the message will stay alive in the queue in seconds. If unset the value will * default to 7 days, if -1 is passed the message will not expire. The time to live must be -1 or any positive number. - * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and * {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata * about the enqueued message. * @throws StorageErrorException If the queue doesn't exist or the {@code visibilityTimeout} or {@code timeToLive} * are outside of the allowed limits. */ - public Response enqueueMessage(String messageText, Duration visibilityTimeout, Duration timeToLive) { - return client.enqueueMessage(messageText, visibilityTimeout, timeToLive).block(); + public Response enqueueMessageWithResponse(String messageText, Duration visibilityTimeout, Duration timeToLive, Context context) { + return client.enqueueMessageWithResponse(messageText, visibilityTimeout, timeToLive, context).block(); } /** @@ -398,7 +507,7 @@ public Iterable peekMessages(Integer maxMessages) { * *

            Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds

            * - * {@codesnippet com.azure.storage.queue.queueClient.updateMessage} + * {@codesnippet com.azure.storage.queue.QueueClient.updateMessage#String-String-String-Duration} * *

            For more information, see the * Azure Docs.

            @@ -413,8 +522,55 @@ public Iterable peekMessages(Integer maxMessages) { * @throws StorageErrorException If the queue or messageId don't exist, the popReceipt doesn't match on the message, * or the {@code visibilityTimeout} is outside the allowed bounds */ - public Response updateMessage(String messageText, String messageId, String popReceipt, Duration visibilityTimeout) { - return client.updateMessage(messageText, messageId, popReceipt, visibilityTimeout).block(); + public UpdatedMessage updateMessage(String messageText, String messageId, String popReceipt, Duration visibilityTimeout) { + return updateMessageWithResponse(messageText, messageId, popReceipt, visibilityTimeout, Context.NONE).value(); + } + + /** + * Updates the specific message in the queue with a new message and resets the visibility timeout. + * + *

            Code Samples

            + * + *

            Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds

            + * + * {@codesnippet com.azure.storage.queue.QueueClient.updateMessageWithResponse#String-String-String-Duration-Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param messageText Updated value for the message + * @param messageId Id of the message to update + * @param popReceipt Unique identifier that must match for the message to be updated + * @param visibilityTimeout The timeout period for how long the message is invisible in the queue in seconds. The + * timeout period must be between 1 second and 7 days. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link UpdatedMessage} that contains the new {@link UpdatedMessage#popReceipt() popReceipt} to interact + * with the message, additionally contains the updated metadata about the message. + * @throws StorageErrorException If the queue or messageId don't exist, the popReceipt doesn't match on the message, + * or the {@code visibilityTimeout} is outside the allowed bounds + */ + public Response updateMessageWithResponse(String messageText, String messageId, String popReceipt, Duration visibilityTimeout, Context context) { + return client.updateMessageWithResponse(messageText, messageId, popReceipt, visibilityTimeout, context).block(); + } + + /** + * Deletes the specified message in the queue + * + *

            Code Samples

            + * + *

            Delete the first message

            + * + * {@codesnippet com.azure.storage.queue.QueueClient.deleteMessage#String-String} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param messageId Id of the message to deleted + * @param popReceipt Unique identifier that must match for the message to be deleted + * @throws StorageErrorException If the queue or messageId don't exist or the popReceipt doesn't match on the message + */ + public void deleteMessage(String messageId, String popReceipt) { + deleteMessageWithResponse(messageId, popReceipt, Context.NONE); } /** @@ -424,17 +580,18 @@ public Response updateMessage(String messageText, String message * *

            Delete the first message

            * - * {@codesnippet com.azure.storage.queue.queueClient.deleteMessage} + * {@codesnippet com.azure.storage.queue.QueueClient.deleteMessageWithResponse#String-String-Context} * *

            For more information, see the * Azure Docs.

            * * @param messageId Id of the message to deleted * @param popReceipt Unique identifier that must match for the message to be deleted + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue or messageId don't exist or the popReceipt doesn't match on the message */ - public VoidResponse deleteMessage(String messageId, String popReceipt) { - return client.deleteMessage(messageId, popReceipt).block(); + public VoidResponse deleteMessageWithResponse(String messageId, String popReceipt, Context context) { + return client.deleteMessageWithResponse(messageId, popReceipt, context).block(); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java index 944bba023606..e85fce73080d 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java @@ -14,6 +14,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.configuration.Configuration; @@ -76,8 +77,9 @@ * @see SASTokenCredential * @see SharedKeyCredential */ +@ServiceClientBuilder(serviceClients = {QueueClient.class, QueueAsyncClient.class}) public final class QueueClientBuilder { - private static final ClientLogger LOGGER = new ClientLogger(QueueClientBuilder.class); + private final ClientLogger logger = new ClientLogger(QueueClientBuilder.class); private static final String ACCOUNT_NAME = "accountname"; private final List policies; @@ -89,7 +91,7 @@ public final class QueueClientBuilder { private HttpClient httpClient; private HttpPipeline pipeline; private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -140,11 +142,9 @@ public QueueClient buildClient() { */ public QueueAsyncClient buildAsyncClient() { Objects.requireNonNull(endpoint); - Objects.requireNonNull(queueName); if (sasTokenCredential == null && sharedKeyCredential == null && bearerTokenCredential == null) { - LOGGER.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); - return null; + throw logger.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); } if (pipeline != null) { @@ -213,8 +213,7 @@ public QueueClientBuilder endpoint(String endpoint) { this.bearerTokenCredential = null; } } catch (MalformedURLException ex) { - LOGGER.logExceptionAsError(new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed. Endpoint: " + endpoint)); - return null; + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed. Endpoint: " + endpoint)); } return this; @@ -298,7 +297,7 @@ private void getEndPointFromConnectionString(String connectionString) { try { this.endpoint = new URL(String.format("https://%s.queue.core.windows.net", accountName)); } catch (MalformedURLException e) { - LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("There is no valid account for the connection string. " + throw logger.logExceptionAsError(new IllegalArgumentException(String.format("There is no valid account for the connection string. " + "Connection String: %s", connectionString))); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java index 5c5a78f2dc0c..e6e0cc12d79d 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java @@ -6,6 +6,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.credentials.SASTokenCredential; @@ -21,6 +22,7 @@ import com.azure.storage.queue.models.StorageErrorException; import com.azure.storage.queue.models.StorageServiceProperties; import com.azure.storage.queue.models.StorageServiceStats; +import java.util.Objects; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -30,6 +32,8 @@ import java.util.List; import java.util.Map; +import static com.azure.core.implementation.util.FluxUtil.withContext; + /** * This class provides a client that contains all the operations for interacting with a queue account in Azure Storage. * Operations allowed by the client are creating, listing, and deleting queues, retrieving and updating properties of the account, @@ -47,7 +51,7 @@ * @see SASTokenCredential */ public final class QueueServiceAsyncClient { - private static final ClientLogger LOGGER = new ClientLogger(QueueServiceAsyncClient.class); + private final ClientLogger logger = new ClientLogger(QueueServiceAsyncClient.class); private final AzureQueueStorageImpl client; /** @@ -71,8 +75,8 @@ public URL getQueueServiceUrl() { try { return new URL(client.getUrl()); } catch (MalformedURLException ex) { - LOGGER.error("Queue Service URL is malformed"); - throw new RuntimeException("Storage account URL is malformed"); + logger.error("Queue Service URL is malformed"); + throw logger.logExceptionAsError(new RuntimeException("Storage account URL is malformed")); } } @@ -99,11 +103,11 @@ public QueueAsyncClient getQueueAsyncClient(String queueName) { * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.createQueue#string} * * @param queueName Name of the queue - * @return A response containing the QueueAsyncClient and the status of creating the queue + * @return The {@link QueueAsyncClient QueueAsyncClient} * @throws StorageErrorException If a queue with the same name and different metadata already exists */ - public Mono> createQueue(String queueName) { - return createQueue(queueName, null); + public Mono createQueue(String queueName) { + return createQueueWithResponse(queueName, null).flatMap(FluxUtil::toMono); } /** @@ -114,17 +118,22 @@ public Mono> createQueue(String queueName) { * *

            Create the queue "test" with metadata "queue:metadata"

            * - * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.createQueue#string-map} + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.createQueueWithResponse#string-map} * * @param queueName Name of the queue * @param metadata Metadata to associate with the queue - * @return A response containing the QueueAsyncClient and the status of creating the queue + * @return A response containing the {@link QueueAsyncClient QueueAsyncClient} and the status of creating the queue * @throws StorageErrorException If a queue with the same name and different metadata already exists */ - public Mono> createQueue(String queueName, Map metadata) { + public Mono> createQueueWithResponse(String queueName, Map metadata) { + Objects.requireNonNull(queueName); + return withContext(context -> createQueueWithResponse(queueName, metadata, context)); + } + + Mono> createQueueWithResponse(String queueName, Map metadata, Context context) { QueueAsyncClient queueAsyncClient = new QueueAsyncClient(client, queueName); - return queueAsyncClient.create(metadata) + return queueAsyncClient.createWithResponse(metadata, context) .map(response -> new SimpleResponse<>(response, queueAsyncClient)); } @@ -138,11 +147,32 @@ public Mono> createQueue(String queueName, Map deleteQueue(String queueName) { + return deleteQueueWithResponse(queueName).flatMap(FluxUtil::toMono); + } + + /** + * Deletes a queue in the storage account + * + *

            Code Samples

            + * + *

            Delete the queue "test"

            + * + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.deleteQueueWithResponse#string} + * + * @param queueName Name of the queue * @return A response that only contains headers and response status code * @throws StorageErrorException If the queue doesn't exist */ - public Mono deleteQueue(String queueName) { - return new QueueAsyncClient(client, queueName).delete(); + public Mono deleteQueueWithResponse(String queueName) { + return withContext(context -> deleteQueueWithResponse(queueName, context)); + } + + Mono deleteQueueWithResponse(String queueName, Context context) { + return new QueueAsyncClient(client, queueName).deleteWithResponse(context); } /** @@ -250,10 +280,33 @@ private Flux extractAndFetchQueues(ServicesListQueuesSegmentResponse *

            For more information, see the * Azure Docs.

            * - * @return Storage account Queue service properties + * @return Storage account {@link StorageServiceProperties Queue service properties} */ - public Mono> getProperties() { - return client.services().getPropertiesWithRestResponseAsync(Context.NONE) + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves the properties of the storage account's Queue service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + *

            Code Samples

            + * + *

            Retrieve Queue service properties

            + * + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getPropertiesWithResponse} + * + *

            For more information, see the + * Azure Docs.

            + * + * @return A response containing the Storage account {@link StorageServiceProperties Queue service properties} + */ + public Mono> getPropertiesWithResponse() { + return withContext(context -> getPropertiesWithResponse(context)); + } + + Mono> getPropertiesWithResponse(Context context) { + return client.services().getPropertiesWithRestResponseAsync(context) .map(response -> new SimpleResponse<>(response, response.value())); } @@ -278,6 +331,44 @@ public Mono> getProperties() { * Azure Docs.

            * * @param properties Storage account Queue service properties + * @return An empty response + * @throws StorageErrorException When one of the following is true + *
              + *
            • A CORS rule is missing one of its fields
            • + *
            • More than five CORS rules will exist for the Queue service
            • + *
            • Size of all CORS rules exceeds 2KB
            • + *
            • + * Length of {@link CorsRule#allowedHeaders() allowed headers}, {@link CorsRule#exposedHeaders() exposed headers}, + * or {@link CorsRule#allowedOrigins() allowed origins} exceeds 256 characters. + *
            • + *
            • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
            • + *
            + */ + public Mono setProperties(StorageServiceProperties properties) { + return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); + } + + /** + * Sets the properties for the storage account's Queue service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + * To maintain the CORS in the Queue service pass a {@code null} value for {@link StorageServiceProperties#cors() CORS}. + * To disable all CORS in the Queue service pass an empty list for {@link StorageServiceProperties#cors() CORS}. + * + *

            Code Sample

            + * + *

            Clear CORS in the Queue service

            + * + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponse#storageServiceProperties} + * + *

            Enable Minute and Hour Metrics

            + * + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param properties Storage account Queue service properties * @return A response that only contains headers and response status code * @throws StorageErrorException When one of the following is true *
              @@ -291,8 +382,12 @@ public Mono> getProperties() { *
            • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
            • *
            */ - public Mono setProperties(StorageServiceProperties properties) { - return client.services().setPropertiesWithRestResponseAsync(properties, Context.NONE) + public Mono setPropertiesWithResponse(StorageServiceProperties properties) { + return withContext(context -> setPropertiesWithResponse(properties, context)); + } + + Mono setPropertiesWithResponse(StorageServiceProperties properties, Context context) { + return client.services().setPropertiesWithRestResponseAsync(properties, context) .map(VoidResponse::new); } @@ -310,8 +405,30 @@ public Mono setProperties(StorageServiceProperties properties) { * * @return The geo replication information about the Queue service */ - public Mono> getStatistics() { - return client.services().getStatisticsWithRestResponseAsync(Context.NONE) + public Mono getStatistics() { + return getStatisticsWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves the geo replication information about the Queue service. + * + *

            Code Samples

            + * + *

            Retrieve the geo replication information

            + * + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getStatisticsWithResponse} + * + *

            For more information, see the + * Azure Docs.

            + * + * @return A response containing the geo replication information about the Queue service + */ + public Mono> getStatisticsWithResponse() { + return withContext(context -> getStatisticsWithResponse(context)); + } + + Mono> getStatisticsWithResponse(Context context) { + return client.services().getStatisticsWithRestResponseAsync(context) .map(response -> new SimpleResponse<>(response, response.value())); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java index 78ef5b204281..273f5003ab19 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java @@ -5,6 +5,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.queue.models.CorsRule; @@ -76,8 +77,8 @@ public QueueClient getQueueClient(String queueName) { * @return A response containing the QueueClient and the status of creating the queue * @throws StorageErrorException If a queue with the same name and different metadata already exists */ - public Response createQueue(String queueName) { - return createQueue(queueName, null); + public QueueClient createQueue(String queueName) { + return createQueueWithResponse(queueName, null, Context.NONE).value(); } /** @@ -88,15 +89,16 @@ public Response createQueue(String queueName) { * *

            Create the queue "test" with metadata "queue:metadata"

            * - * {@codesnippet com.azure.storage.queue.queueServiceClient.createQueue#string-map} + * {@codesnippet com.azure.storage.queue.queueServiceClient.createQueueWithResponse#string-map-Context} * * @param queueName Name of the queue * @param metadata Metadata to associate with the queue + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing the QueueClient and the status of creating the queue * @throws StorageErrorException If a queue with the same name and different metadata already exists */ - public Response createQueue(String queueName, Map metadata) { - Response response = client.createQueue(queueName, metadata).block(); + public Response createQueueWithResponse(String queueName, Map metadata, Context context) { + Response response = client.createQueueWithResponse(queueName, metadata, context).block(); return new SimpleResponse<>(response, new QueueClient(response.value())); } @@ -111,11 +113,28 @@ public Response createQueue(String queueName, Map m * {@codesnippet com.azure.storage.queue.queueServiceClient.deleteQueue#string} * * @param queueName Name of the queue + * @throws StorageErrorException If the queue doesn't exist + */ + public void deleteQueue(String queueName) { + deleteQueueWithResponse(queueName, Context.NONE); + } + + /** + * Deletes a queue in the storage account + * + *

            Code Samples

            + * + *

            Delete the queue "test"

            + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.deleteQueueWithResponse#string-Context} + * + * @param queueName Name of the queue + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing the status of deleting the queue * @throws StorageErrorException If the queue doesn't exist */ - public VoidResponse deleteQueue(String queueName) { - return client.deleteQueue(queueName).block(); + public VoidResponse deleteQueueWithResponse(String queueName, Context context) { + return client.deleteQueueWithResponse(queueName, context).block(); } /** @@ -187,8 +206,28 @@ Iterable listQueues(String marker, QueuesSegmentOptions options) { * * @return Storage account Queue service properties */ - public Response getProperties() { - return client.getProperties().block(); + public StorageServiceProperties getProperties() { + return getPropertiesWithResponse(Context.NONE).value(); + } + + /** + * Retrieves the properties of the storage account's Queue service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + *

            Code Samples

            + * + *

            Retrieve Queue service properties

            + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.getPropertiesWithResponse#Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the Storage account Queue service properties + */ + public Response getPropertiesWithResponse(Context context) { + return client.getPropertiesWithResponse(context).block(); } /** @@ -212,6 +251,44 @@ public Response getProperties() { * Azure Docs.

            * * @param properties Storage account Queue service properties + * @throws StorageErrorException When one of the following is true + *
              + *
            • A CORS rule is missing one of its fields
            • + *
            • More than five CORS rules will exist for the Queue service
            • + *
            • Size of all CORS rules exceeds 2KB
            • + *
            • + * Length of {@link CorsRule#allowedHeaders() allowed headers}, {@link CorsRule#exposedHeaders() exposed headers}, + * or {@link CorsRule#allowedOrigins() allowed origins} exceeds 256 characters. + *
            • + *
            • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
            • + *
            + */ + public void setProperties(StorageServiceProperties properties) { + setPropertiesWithResponse(properties, Context.NONE); + } + + /** + * Sets the properties for the storage account's Queue service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + * To maintain the CORS in the Queue service pass a {@code null} value for {@link StorageServiceProperties#cors() CORS}. + * To disable all CORS in the Queue service pass an empty list for {@link StorageServiceProperties#cors() CORS}. + * + *

            Code Sample

            + * + *

            Clear CORS in the Queue service

            + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesWithResponse#storageServiceProperties-Context} + * + *

            Enable Minute and Hour Metrics

            + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties-Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param properties Storage account Queue service properties + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code * @throws StorageErrorException When one of the following is true *
              @@ -225,8 +302,8 @@ public Response getProperties() { *
            • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
            • *
            */ - public VoidResponse setProperties(StorageServiceProperties properties) { - return client.setProperties(properties).block(); + public VoidResponse setPropertiesWithResponse(StorageServiceProperties properties, Context context) { + return client.setPropertiesWithResponse(properties, context).block(); } /** @@ -243,7 +320,27 @@ public VoidResponse setProperties(StorageServiceProperties properties) { * * @return The geo replication information about the Queue service */ - public Response getStatistics() { - return client.getStatistics().block(); + public StorageServiceStats getStatistics() { + return getStatisticsWithResponse(Context.NONE).value(); } + + /** + * Retrieves the geo replication information about the Queue service. + * + *

            Code Samples

            + * + *

            Retrieve the geo replication information

            + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.getStatisticsWithResponse#Context} + * + *

            For more information, see the + * Azure Docs.

            + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the geo replication information about the Queue service + */ + public Response getStatisticsWithResponse(Context context) { + return client.getStatisticsWithResponse(context).block(); + } + } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java index a196de2964b3..51e3a8334528 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java @@ -14,6 +14,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; @@ -73,8 +74,9 @@ * @see SASTokenCredential * @see SharedKeyCredential */ +@ServiceClientBuilder(serviceClients = {QueueServiceClient.class, QueueServiceAsyncClient.class}) public final class QueueServiceClientBuilder { - private static final ClientLogger LOGGER = new ClientLogger(QueueServiceClientBuilder.class); + private final ClientLogger logger = new ClientLogger(QueueServiceClientBuilder.class); private static final String ACCOUNT_NAME = "accountname"; private final List policies; @@ -85,7 +87,7 @@ public final class QueueServiceClientBuilder { private HttpClient httpClient; private HttpPipeline pipeline; private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -117,8 +119,7 @@ public QueueServiceAsyncClient buildAsyncClient() { Objects.requireNonNull(endpoint); if (sasTokenCredential == null && sharedKeyCredential == null && bearerTokenCredential == null) { - LOGGER.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); - return null; + logger.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); } if (pipeline != null) { @@ -197,8 +198,7 @@ public QueueServiceClientBuilder endpoint(String endpoint) { this.bearerTokenCredential = null; } } catch (MalformedURLException ex) { - LOGGER.logExceptionAsError(new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed.")); - return null; + logger.logExceptionAsError(new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed.")); } return this; @@ -269,8 +269,8 @@ private void getEndPointFromConnectionString(String connectionString) { try { this.endpoint = new URL(String.format("https://%s.queue.core.windows.net", accountName)); } catch (MalformedURLException e) { - LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("There is no valid account for the connection string. " - + "Connection String: %s", connectionString))); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format("There is no valid account for the " + + "connection string. Connection String: %s", connectionString))); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageException.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageException.java new file mode 100644 index 000000000000..e46ff19bd8e3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageException.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.models; + +import com.azure.core.exception.HttpResponseException; + +/** + * A {@code StorageException} 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 StorageException}. 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 StorageException extends HttpResponseException { + private static final String ERROR_CODE = "x-ms-error-code"; + + private final StorageErrorCode errorCode; + private final String message; + + StorageException(StorageErrorException e, String responseBody) { + super(e.getMessage(), e.response(), e); + this.errorCode = StorageErrorCode.fromString(e.response().headers().value(ERROR_CODE)); + this.message = responseBody; + } + + /** + * @return The error code returned by the service. + */ + public StorageErrorCode errorCode() { + return this.errorCode; + } + + /** + * @return The message returned by the service. + */ + public String serviceMessage() { + return this.message; + } + + /** + * @return The status code on the response. + */ + public int statusCode() { + return super.response().statusCode(); + } +} diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java index 39cc17db37ca..a729ca372eac 100644 --- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java @@ -29,7 +29,7 @@ public static void main(String[] args) { .then(queueAsyncClient.enqueueMessage("This is message 2")) .subscribe( response -> { - System.out.println("Message successfully equeueed by queueAsyncClient. Message id:" + response.value().messageId()); + System.out.println("Message successfully equeueed by queueAsyncClient. Message id:" + response.messageId()); }, err -> { System.out.println("Error thrown when enqueue the message. Error message: " + err.getMessage()); diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/MessageSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/MessageSamples.java index 1372d45b9e80..c45260edbc34 100644 --- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/MessageSamples.java +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/MessageSamples.java @@ -3,9 +3,7 @@ package com.azure.storage.queue; -import com.azure.core.http.rest.Response; import com.azure.storage.queue.models.DequeuedMessage; - import java.time.Duration; import static com.azure.storage.queue.SampleHelper.generateRandomName; @@ -25,9 +23,7 @@ public static void main(String[] args) throws InterruptedException { QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).buildClient(); // Create a queue client - Response queueClientResponse = queueServiceClient.createQueue(generateRandomName("enqueue", 16)); - QueueClient queueClient = queueClientResponse.value(); - // Using queue client to enqueue several "Hello World" messages into queue. + QueueClient queueClient = queueServiceClient.createQueue(generateRandomName("enqueue", 16)); for (int i = 0; i < 3; i++) { queueClient.enqueueMessage("Hello World"); } @@ -36,7 +32,7 @@ public static void main(String[] args) throws InterruptedException { // TODO // Get the total count of msg in the queue - int count = queueClient.getProperties().value().approximateMessagesCount(); + int count = queueClient.getProperties().approximateMessagesCount(); // Peek all messages in queue. It is supposed to print "Hello World" 3 times. queueClient.peekMessages(count).forEach( diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java new file mode 100644 index 000000000000..8a216a555f8e --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.storage.queue.javadoc; + +import com.azure.storage.common.Utility; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.queue.QueueAsyncClient; +import com.azure.storage.queue.QueueClientBuilder; +import com.azure.storage.queue.models.AccessPolicy; +import com.azure.storage.queue.models.QueueProperties; +import com.azure.storage.queue.models.SignedIdentifier; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Contains code snippets when generating javadocs through doclets for {@link QueueAsyncClient}. + */ + +public class QueueAsyncJavaDocCodeSamples { + + /** + * Generates code sample for creating a {@link QueueAsyncClient}. + */ + public void buildQueueAsyncClient() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation + QueueAsyncClient client = new QueueClientBuilder() + .connectionString("connectionstring") + .endpoint("endpoint") + .buildAsyncClient(); + // END: com.azure.storage.queue.queueAsyncClient.instantiation + } + + /** + * Generates code sample for creating a {@link QueueAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link QueueAsyncClient} + */ + public QueueAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.sastoken + QueueAsyncClient queueAsyncClient = new QueueClientBuilder() + .endpoint("https://{accountName}.queue.core.windows.net?{SASToken}") + .buildAsyncClient(); + // END: com.azure.storage.queue.queueAsyncClient.instantiation.sastoken + return queueAsyncClient; + } + + /** + * Generates code sample for creating a {@link QueueAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link QueueAsyncClient} + */ + public QueueAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.credential + QueueAsyncClient queueAsyncClient = new QueueClientBuilder() + .endpoint("https://{accountName}.queue.core.windows.net") + .queueName("myqueue") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("{SASTokenQueryParams}"))) + .buildAsyncClient(); + // END: com.azure.storage.queue.queueAsyncClient.instantiation.credential + return queueAsyncClient; + } + + /** + * Generates code sample for creating a {@link QueueAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * @return An instance of {@link QueueAsyncClient} + */ + public QueueAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};" + + "AccountKey={key};EndpointSuffix={core.windows.net}"; + QueueAsyncClient queueAsyncClient = new QueueClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + // END: com.azure.storage.queue.queueAsyncClient.instantiation.connectionstring + return queueAsyncClient; + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#create()} + */ + public void createQueueAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.create + queueAsyncClient.create().subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the queue!") + ); + // END: com.azure.storage.queue.queueAsyncClient.create + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#create()} + */ + public void createQueueAsyncMaxOverload() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.create#map + queueAsyncClient.create().subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the queue!") + ); + // END: com.azure.storage.queue.queueAsyncClient.create#map + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#createWithResponse(Map)} + */ + public void createWithResponse() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.createWithResponse#map + queueAsyncClient.createWithResponse(Collections.singletonMap("queue", "metadataMap")).subscribe( + response -> System.out.println("Complete creating the queue with status code:" + response.statusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.queue.queueAsyncClient.createWithResponse#map + } + + + /** + * Generates a code sample for using {@link QueueAsyncClient#enqueueMessage(String)} + */ + public void enqueueMessageAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string + queueAsyncClient.enqueueMessage("Hello, Azure").subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete enqueuing the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#enqueueMessageWithResponse(String, Duration, Duration)} + */ + public void enqueueMessageAsyncWithTimeoutOverload() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.enqueueMessageWithResponse#string-duration-duration + queueAsyncClient.enqueueMessageWithResponse("Hello, Azure", + Duration.ofSeconds(5), null).subscribe( + response -> System.out.printf("Message %s expires at %s", response.value().messageId(), + response.value().expirationTime()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete enqueuing the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.enqueueMessageWithResponse#string-duration-duration + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#enqueueMessageWithResponse(String, Duration, Duration)} + */ + public void enqueueMessageAsyncWithLiveTimeOverload() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueAsyncClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration + queueAsyncClient.enqueueMessageWithResponse("Goodbye, Azure", + null, Duration.ofSeconds(5)).subscribe( + response -> System.out.printf("Message %s expires at %s", response.value().messageId(), + response.value().expirationTime()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete enqueuing the message!") + ); + // END: com.azure.storage.queue.QueueAsyncClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages()} + */ + public void dequeueMessageAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages + queueAsyncClient.dequeueMessages().subscribe( + dequeuedMessage -> System.out.println("The message got from dequeue operation: " + + dequeuedMessage.messageText()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete dequeuing the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages(Integer)} + */ + public void dequeueMessageAsyncWithOverload() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer + queueAsyncClient.dequeueMessages(5).subscribe( + dequeuedMessage -> System.out.println("The message got from dequeue operation: " + + dequeuedMessage.messageText()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete dequeuing the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages(Integer, Duration)} + */ + public void dequeueMessageAsyncMaxOverload() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration + queueAsyncClient.dequeueMessages(5, Duration.ofSeconds(60)).subscribe( + dequeuedMessage -> System.out.println("The message got from dequeue operation: " + + dequeuedMessage.messageText()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete dequeuing the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration + } + + + /** + * Generates a code sample for using {@link QueueAsyncClient#peekMessages()} + */ + public void peekMessageAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.peekMessages + queueAsyncClient.peekMessages().subscribe( + peekMessages -> System.out.println("The message got from peek operation: " + peekMessages.messageText()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete peeking the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.peekMessages + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#peekMessages(Integer)} + */ + public void peekMessageAsyncMaxOverload() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.peekMessages#integer + queueAsyncClient.peekMessages(5).subscribe( + peekMessage -> System.out.printf("Peeked message %s has been dequeued %d times", + peekMessage.messageId(), peekMessage.dequeueCount()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete peeking the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.peekMessages#integer + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#updateMessage(String, String, String, Duration)} + */ + public void updateMessageAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueAsyncClient.updateMessage#String-String-String-Duration + queueAsyncClient.dequeueMessages().subscribe( + dequeuedMessage -> { + queueAsyncClient.updateMessage("newText", dequeuedMessage.messageId(), + dequeuedMessage.popReceipt(), null).subscribe( + response -> { }, + updateError -> System.err.print(updateError.toString()), + () -> System.out.println("Complete updating the message!") + ); + }, + dequeueError -> System.err.print(dequeueError.toString()), + () -> System.out.println("Complete dequeueing the message!") + ); + // END: com.azure.storage.queue.QueueAsyncClient.updateMessage#String-String-String-Duration + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#updateMessageWithResponse(String, String, String, Duration)} + */ + public void updateMessageWithResponse() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueAsyncClient.updateMessageWithResponse#String-String-String-Duration + queueAsyncClient.dequeueMessages().subscribe( + dequeuedMessage -> { + queueAsyncClient.updateMessageWithResponse("newText", dequeuedMessage.messageId(), + dequeuedMessage.popReceipt(), null).subscribe( + response -> System.out.println("Complete updating the message with status code:" + + response.statusCode()), + updateError -> System.err.print(updateError.toString()), + () -> System.out.println("Complete updating the message!") + ); + }, + dequeueError -> System.err.print(dequeueError.toString()), + () -> System.out.println("Complete dequeueing the message!") + ); + // END: com.azure.storage.queue.QueueAsyncClient.updateMessageWithResponse#String-String-String-Duration + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#deleteMessage(String, String)} + */ + public void deleteMessageAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueAsyncClient.deleteMessage#String-String + queueAsyncClient.dequeueMessages().subscribe( + dequeuedMessage -> { + queueAsyncClient.deleteMessage(dequeuedMessage.messageId(), dequeuedMessage.popReceipt()).subscribe( + response -> { }, + deleteError -> System.err.print(deleteError.toString()), + () -> System.out.println("Complete deleting the message!") + ); + }, + dequeueError -> System.err.print(dequeueError.toString()), + () -> System.out.println("Complete dequeueing the message!") + ); + // END: com.azure.storage.queue.QueueAsyncClient.deleteMessage#String-String + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#deleteMessageWithResponse(String, String)} + */ + public void deleteMessageWithResponse() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueAsyncClient.deleteMessageWithResponse#String-String + queueAsyncClient.dequeueMessages().subscribe( + dequeuedMessage -> { + queueAsyncClient.deleteMessageWithResponse(dequeuedMessage.messageId(), dequeuedMessage.popReceipt()).subscribe( + response -> System.out.println("Complete deleting the message with status code: " + response.statusCode()), + deleteError -> System.err.print(deleteError.toString()), + () -> System.out.println("Complete deleting the message!") + ); + }, + dequeueError -> System.err.print(dequeueError.toString()), + () -> System.out.println("Complete dequeueing the message!") + ); + // END: com.azure.storage.queue.QueueAsyncClient.deleteMessageWithResponse#String-String + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#delete()} + */ + public void deleteQueueAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.delete + queueAsyncClient.delete().doOnSuccess( + response -> System.out.println("Deleting the queue completed.") + ); + // END: com.azure.storage.queue.queueAsyncClient.delete + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#deleteWithResponse()} + */ + public void deleteWithResponse() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.deleteWithResponse + queueAsyncClient.deleteWithResponse().subscribe( + response -> System.out.println("Deleting the queue completed with status code: " + response.statusCode()) + ); + // END: com.azure.storage.queue.queueAsyncClient.deleteWithResponse + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.getProperties + queueAsyncClient.getProperties() + .subscribe(properties -> { + System.out.printf("Metadata: %s, Approximate message count: %d", properties.metadata(), + properties.approximateMessagesCount()); + }); + // END: com.azure.storage.queue.queueAsyncClient.getProperties + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#getProperties()} + */ + public void getPropertiesWithResponse() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.getPropertiesWithResponse + queueAsyncClient.getPropertiesWithResponse() + .subscribe(response -> { + QueueProperties properties = response.value(); + System.out.printf("Metadata: %s, Approximate message count: %d", properties.metadata(), + properties.approximateMessagesCount()); + }); + // END: com.azure.storage.queue.queueAsyncClient.getPropertiesWithResponse + } + + /** + * Generate a code sample for using {@link QueueAsyncClient#setMetadata(Map)} to set metadata. + */ + public void setMetadataAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.setMetadata#map + queueAsyncClient.setMetadata(Collections.singletonMap("queue", "metadataMap")) + .subscribe(response -> System.out.printf("Setting metadata completed.")); + // END: com.azure.storage.queue.queueAsyncClient.setMetadata#map + } + + /** + * Generate a code sample for using {@link QueueAsyncClient#setMetadataWithResponse(Map)} to set metadata. + */ + public void setMetadataWithResponse() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.setMetadataWithResponse#map + queueAsyncClient.setMetadataWithResponse(Collections.singletonMap("queue", "metadataMap")) + .subscribe(response -> System.out.printf("Setting metadata completed with status code %d", + response.statusCode())); + // END: com.azure.storage.queue.queueAsyncClient.setMetadataWithResponse#map + } + + /** + * Generate a code sample for using {@link QueueAsyncClient#setMetadata(Map)} to clear metadata. + */ + public void clearMetadataAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMetadata#map + queueAsyncClient.setMetadata(null) + .subscribe(response -> System.out.printf("Clearing metadata completed.")); + // END: com.azure.storage.queue.queueAsyncClient.clearMetadata#map + } + + /** + * Generate a code sample for using {@link QueueAsyncClient#setMetadata(Map)} to clear metadata. + */ + public void clearMetadataWithResponse() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMetadataWithResponse#map + queueAsyncClient.setMetadataWithResponse(null) + .subscribe(response -> System.out.printf("Clearing metadata completed with status code %d", + response.statusCode())); + // END: com.azure.storage.queue.queueAsyncClient.clearMetadataWithResponse#map + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#getAccessPolicy()} + */ + public void getAccessPolicyAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.getAccessPolicy + queueAsyncClient.getAccessPolicy() + .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", + result.id(), result.accessPolicy().permission())); + // END: com.azure.storage.queue.queueAsyncClient.getAccessPolicy + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#setAccessPolicyWithResponse(List)} + */ + public void setAccessPolicyWithResponse() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueAsyncClient.setAccessPolicyWithResponse#List + AccessPolicy accessPolicy = new AccessPolicy().permission("r") + .start(OffsetDateTime.now(ZoneOffset.UTC)) + .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + + SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); + queueAsyncClient.setAccessPolicyWithResponse(Collections.singletonList(permission)) + .subscribe(response -> System.out.printf("Setting access policies completed with status code %d", + response.statusCode())); + // END: com.azure.storage.queue.QueueAsyncClient.setAccessPolicyWithResponse#List + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#setAccessPolicy(List)} + */ + public void setAccessPolicyAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueAsyncClient.setAccessPolicy#List + AccessPolicy accessPolicy = new AccessPolicy().permission("r") + .start(OffsetDateTime.now(ZoneOffset.UTC)) + .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + + SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); + queueAsyncClient.setAccessPolicy(Collections.singletonList(permission)) + .subscribe(response -> System.out.printf("Setting access policies completed.")); + // END: com.azure.storage.queue.QueueAsyncClient.setAccessPolicy#List + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#clearMessagesWithResponse()} + */ + public void clearMessagesWithResponse() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMessagesWithResponse + queueAsyncClient.clearMessagesWithResponse().doOnSuccess( + response -> System.out.println("Clearing messages completed with status code: " + response.statusCode()) + ); + // END: com.azure.storage.queue.queueAsyncClient.clearMessagesWithResponse + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#clearMessages()} + */ + public void clearMessagesAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMessages + queueAsyncClient.clearMessages().subscribe( + response -> System.out.println("Clearing messages completed.")); + // END: com.azure.storage.queue.queueAsyncClient.clearMessages + } +} diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java index d0ee4c8f2aed..36a8d2b568e0 100644 --- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java @@ -4,6 +4,7 @@ package com.azure.storage.queue; import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; import com.azure.storage.queue.models.StorageErrorCode; import com.azure.storage.queue.models.StorageErrorException; @@ -26,7 +27,7 @@ public static void main(String[] args) { // Create queue client. Response queueClientResponse; try { - queueClientResponse = queueServiceClient.createQueue(generateRandomName("delete-not-exist", 16)); + queueClientResponse = queueServiceClient.createQueueWithResponse(generateRandomName("delete-not-exist", 16), null, new Context("key1", "value1")); System.out.println("Successfully create the queue! Status code: " + String.valueOf(queueClientResponse.statusCode())); } catch (StorageErrorException e) { System.out.println(String.format("Error creating a queue. Error message: %s", e.value().message())); diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java index 2a140935fbc2..1f3daec0921d 100644 --- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java @@ -4,6 +4,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -13,7 +14,6 @@ import com.azure.storage.queue.models.QueueProperties; import com.azure.storage.queue.models.SignedIdentifier; import com.azure.storage.queue.models.UpdatedMessage; - import java.time.Duration; import java.time.OffsetDateTime; import java.time.ZoneOffset; @@ -22,10 +22,14 @@ import java.util.Map; /** - * Contains code snippets when generating javadocs through doclets for {@link QueueClient} and {@link QueueAsyncClient}. + * Contains code snippets when generating javadocs through doclets for {@link QueueClient}. */ public class QueueJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for creating a {@link QueueClient}. */ @@ -38,18 +42,6 @@ public void buildQueueClient() { // END: com.azure.storage.queue.queueClient.instantiation } - /** - * Generates code sample for creating a {@link QueueAsyncClient}. - */ - public void buildQueueAsyncClient() { - // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation - QueueAsyncClient client = new QueueClientBuilder() - .connectionString("connectionstring") - .endpoint("endpoint") - .buildAsyncClient(); - // END: com.azure.storage.queue.queueAsyncClient.instantiation - } - /** * Generates code sample for creating a {@link QueueClient} with {@link QueueClient} * @return An instance of {@link QueueClient} @@ -63,19 +55,6 @@ public QueueClient createClientWithSASToken() { return queueClient; } - /** - * Generates code sample for creating a {@link QueueAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link QueueAsyncClient} - */ - public QueueAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.sastoken - QueueAsyncClient queueAsyncClient = new QueueClientBuilder() - .endpoint("https://{accountName}.queue.core.windows.net?{SASToken}") - .buildAsyncClient(); - // END: com.azure.storage.queue.queueAsyncClient.instantiation.sastoken - return queueAsyncClient; - } - /** * Generates code sample for creating a {@link QueueClient} with {@link SASTokenCredential} * @return An instance of {@link QueueClient} @@ -91,21 +70,6 @@ public QueueClient createClientWithCredential() { return queueClient; } - /** - * Generates code sample for creating a {@link QueueAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link QueueAsyncClient} - */ - public QueueAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.credential - QueueAsyncClient queueAsyncClient = new QueueClientBuilder() - .endpoint("https://{accountName}.queue.core.windows.net") - .queueName("myqueue") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("{SASTokenQueryParams}"))) - .buildAsyncClient(); - // END: com.azure.storage.queue.queueAsyncClient.instantiation.credential - return queueAsyncClient; - } - /** * Generates code sample for creating a {@link QueueClient} with {@code connectionString} which turns into {@link SharedKeyCredential} * @return An instance of {@link QueueClient} @@ -121,69 +85,27 @@ public QueueClient createClientWithConnectionString() { return queueClient; } - /** - * Generates code sample for creating a {@link QueueAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link QueueAsyncClient} - */ - public QueueAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};" - + "AccountKey={key};EndpointSuffix={core.windows.net}"; - QueueAsyncClient queueAsyncClient = new QueueClientBuilder() - .connectionString(connectionString) - .buildAsyncClient(); - // END: com.azure.storage.queue.queueAsyncClient.instantiation.connectionstring - return queueAsyncClient; - } - /** * Generates a code sample for using {@link QueueClient#create()} */ public void createQueue() { QueueClient queueClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueClient.create - VoidResponse response = queueClient.create(); - System.out.println("Complete creating queue with status code: " + response.statusCode()); + queueClient.create(); + System.out.println("Complete creating queue."); // END: com.azure.storage.queue.queueClient.create } /** - * Generates a code sample for using {@link QueueAsyncClient#create()} - */ - public void createQueueAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.create - queueAsyncClient.create().subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the queue!") - ); - // END: com.azure.storage.queue.queueAsyncClient.create - } - - /** - * Generates a code sample for using {@link QueueClient#create(Map)} + * Generates a code sample for using {@link QueueClient#createWithResponse(Map, Context)} */ public void createQueueMaxOverload() { QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.create#map - VoidResponse response = queueClient.create(Collections.singletonMap("queue", "metadataMap")); + // BEGIN: com.azure.storage.queue.queueClient.createWithResponse#map-Context + VoidResponse response = queueClient.createWithResponse(Collections.singletonMap("queue", "metadataMap"), + new Context(key1, value1)); System.out.println("Complete creating queue with status code: " + response.statusCode()); - // END: com.azure.storage.queue.queueClient.create#map - } - - /** - * Generates a code sample for using {@link QueueAsyncClient#create(Map)} - */ - public void createQueueAsyncMaxOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.create#map - queueAsyncClient.create(Collections.singletonMap("queue", "metadataMap")).subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the queue!") - ); - // END: com.azure.storage.queue.queueAsyncClient.create#map + // END: com.azure.storage.queue.queueClient.createWithResponse#map-Context } /** @@ -192,79 +114,33 @@ public void createQueueAsyncMaxOverload() { public void enqueueMessage() { QueueClient queueClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueClient.enqueueMessage#string - Response response = queueClient.enqueueMessage("hello msg"); - System.out.println("Complete enqueuing the message with status code: " + response.statusCode()); + EnqueuedMessage response = queueClient.enqueueMessage("hello msg"); + System.out.println("Complete enqueuing the message with message Id" + response.messageId()); // END: com.azure.storage.queue.queueClient.enqueueMessage#string } /** - * Generates a code sample for using {@link QueueAsyncClient#enqueueMessage(String)} - */ - public void enqueueMessageAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string - queueAsyncClient.enqueueMessage("Hello, Azure").subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete enqueuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string - } - - /** - * Generates a code sample for using {@link QueueClient#enqueueMessage(String, Duration, Duration)} + * Generates a code sample for using {@link QueueClient#enqueueMessageWithResponse(String, Duration, Duration, Context)} */ public void enqueueMessageWithTimeoutOverload() { QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.enqueueMessage#string-duration-duration - EnqueuedMessage enqueuedMessage = queueClient.enqueueMessage("Hello, Azure", - Duration.ofSeconds(5), null).value(); + // BEGIN: com.azure.storage.queue.queueClient.enqueueMessageWithResponse#string-duration-duration-Context + EnqueuedMessage enqueuedMessage = queueClient.enqueueMessageWithResponse("Hello, Azure", + Duration.ofSeconds(5), null, new Context(key1, value1)).value(); System.out.printf("Message %s expires at %s", enqueuedMessage.messageId(), enqueuedMessage.expirationTime()); - // END: com.azure.storage.queue.queueClient.enqueueMessage#string-duration-duration - } - - /** - * Generates a code sample for using {@link QueueAsyncClient#enqueueMessage(String, Duration, Duration)} - */ - public void enqueueMessageAsyncWithTimeoutOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string-duration-duration - queueAsyncClient.enqueueMessage("Hello, Azure", - Duration.ofSeconds(5), null).subscribe( - response -> System.out.printf("Message %s expires at %s", response.value().messageId(), - response.value().expirationTime()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete enqueuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string-duration-duration + // END: com.azure.storage.queue.queueClient.enqueueMessageWithResponse#string-duration-duration-Context } /** - * Generates a code sample for using {@link QueueClient#enqueueMessage(String, Duration, Duration)} + * Generates a code sample for using {@link QueueClient#enqueueMessageWithResponse(String, Duration, Duration, Context)} */ public void enqueueMessageWithLiveTimeOverload() { QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.enqueueMessageLiveTime#string-duration-duration - EnqueuedMessage enqueuedMessage = queueClient.enqueueMessage("Goodbye, Azure", - null, Duration.ofSeconds(5)).value(); + // BEGIN: com.azure.storage.queue.QueueClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration-Context + EnqueuedMessage enqueuedMessage = queueClient.enqueueMessageWithResponse("Goodbye, Azure", + null, Duration.ofSeconds(5), new Context(key1, value1)).value(); System.out.printf("Message %s expires at %s", enqueuedMessage.messageId(), enqueuedMessage.expirationTime()); - // END: com.azure.storage.queue.queueClient.enqueueMessageLiveTime#string-duration-duration - } - - /** - * Generates a code sample for using {@link QueueAsyncClient#enqueueMessage(String, Duration, Duration)} - */ - public void enqueueMessageAsyncWithLiveTimeOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.enqueueMessageLiveTime#string-duration-duration - queueAsyncClient.enqueueMessage("Goodbye, Azure", - null, Duration.ofSeconds(5)).subscribe( - response -> System.out.printf("Message %s expires at %s", response.value().messageId(), - response.value().expirationTime()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete enqueuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.enqueueMessageLiveTime#string-duration-duration + // END: com.azure.storage.queue.QueueClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration-Context } /** @@ -281,22 +157,6 @@ public void dequeueMessage() { // END: com.azure.storage.queue.queueClient.dequeueMessages } - - /** - * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages()} - */ - public void dequeueMessageAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages - queueAsyncClient.dequeueMessages().subscribe( - dequeuedMessage -> System.out.println("The message got from dequeue operation: " - + dequeuedMessage.messageText()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete dequeuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages - } - /** * Generates a code sample for using {@link QueueClient#dequeueMessages(Integer)} */ @@ -310,21 +170,6 @@ public void dequeueMessageWithOverload() { // END: com.azure.storage.queue.queueClient.dequeueMessages#integer } - /** - * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages(Integer)} - */ - public void dequeueMessageAsyncWithOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer - queueAsyncClient.dequeueMessages(5).subscribe( - dequeuedMessage -> System.out.println("The message got from dequeue operation: " - + dequeuedMessage.messageText()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete dequeuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer - } - /** * Generates a code sample for using {@link QueueClient#dequeueMessages(Integer, Duration)} */ @@ -338,21 +183,6 @@ public void dequeueMessageMaxOverload() { // END: com.azure.storage.queue.queueClient.dequeueMessages#integer-duration } - /** - * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages(Integer, Duration)} - */ - public void dequeueMessageAsyncMaxOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration - queueAsyncClient.dequeueMessages(5, Duration.ofSeconds(60)).subscribe( - dequeuedMessage -> System.out.println("The message got from dequeue operation: " - + dequeuedMessage.messageText()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete dequeuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration - } - /** * Generates a code sample for using {@link QueueClient#peekMessages()} */ @@ -367,21 +197,6 @@ public void peekMessage() { // END: com.azure.storage.queue.queueClient.peekMessages } - - /** - * Generates a code sample for using {@link QueueAsyncClient#peekMessages()} - */ - public void peekMessageAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.peekMessages - queueAsyncClient.peekMessages().subscribe( - peekMessages -> System.out.println("The message got from peek operation: " + peekMessages.messageText()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete peeking the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.peekMessages - } - /** * Generates a code sample for using {@link QueueClient#peekMessages(Integer)} */ @@ -395,58 +210,37 @@ public void peekMessageMaxOverload() { // END: com.azure.storage.queue.queueClient.peekMessages#integer } - - /** - * Generates a code sample for using {@link QueueAsyncClient#peekMessages(Integer)} - */ - public void peekMessageAsyncMaxOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.peekMessages#integer - queueAsyncClient.peekMessages(5).subscribe( - peekMessage -> System.out.printf("Peeked message %s has been dequeued %d times", - peekMessage.messageId(), peekMessage.dequeueCount()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete peeking the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.peekMessages#integer - } - /** * Generates a code sample for using {@link QueueClient#updateMessage(String, String, String, Duration)} */ public void updateMessage() { QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.updateMessage + // BEGIN: com.azure.storage.queue.QueueClient.updateMessage#String-String-String-Duration queueClient.dequeueMessages().forEach( dequeuedMessage -> { - Response response = queueClient.updateMessage("newText", - dequeuedMessage.messageId(), dequeuedMessage.popReceipt(), null); - System.out.println("Complete updating the message with status code " + response.statusCode()); + UpdatedMessage response = queueClient.updateMessage("newText", + dequeuedMessage.messageId(), dequeuedMessage.popReceipt(), Duration.ofSeconds(5)); + System.out.println("Complete updating the message."); } ); - // END: com.azure.storage.queue.queueClient.updateMessage + // END: com.azure.storage.queue.QueueClient.updateMessage#String-String-String-Duration } - /** - * Generates a code sample for using {@link QueueAsyncClient#updateMessage(String, String, String, Duration)} + * Generates a code sample for using {@link QueueClient#updateMessageWithResponse(String, String, String, Duration, Context)} */ - public void updateMessageAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.updateMessage - queueAsyncClient.dequeueMessages().subscribe( + public void updateMessageWithResponse() { + QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueClient.updateMessageWithResponse#String-String-String-Duration-Context + queueClient.dequeueMessages().forEach( dequeuedMessage -> { - queueAsyncClient.updateMessage("newText", dequeuedMessage.messageId(), - dequeuedMessage.popReceipt(), null).subscribe( - response -> { }, - updateError -> System.err.print(updateError.toString()), - () -> System.out.println("Complete updating the message!") - ); - }, - dequeueError -> System.err.print(dequeueError.toString()), - () -> System.out.println("Complete dequeueing the message!") + Response response = queueClient.updateMessageWithResponse("newText", + dequeuedMessage.messageId(), dequeuedMessage.popReceipt(), + Duration.ofSeconds(5), new Context(key1, value1)); + System.out.println("Complete updating the message with status code " + response.statusCode()); + } ); - // END: com.azure.storage.queue.queueAsyncClient.updateMessage + // END: com.azure.storage.queue.QueueClient.updateMessageWithResponse#String-String-String-Duration-Context } /** @@ -454,36 +248,30 @@ public void updateMessageAsync() { */ public void deleteMessage() { QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.deleteMessage + // BEGIN: com.azure.storage.queue.QueueClient.deleteMessage#String-String queueClient.dequeueMessages().forEach( dequeuedMessage -> { - VoidResponse response = queueClient.deleteMessage(dequeuedMessage.messageId(), - dequeuedMessage.popReceipt()); - System.out.println("Complete deleting the message with status code " + response.statusCode()); + queueClient.deleteMessage(dequeuedMessage.messageId(), dequeuedMessage.popReceipt()); + System.out.println("Complete deleting the message."); } ); - // END: com.azure.storage.queue.queueClient.deleteMessage + // END: com.azure.storage.queue.QueueClient.deleteMessage#String-String } - /** - * Generates a code sample for using {@link QueueAsyncClient#deleteMessage(String, String)} + * Generates a code sample for using {@link QueueClient#deleteMessageWithResponse(String, String, Context)} */ - public void deleteMessageAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.deleteMessage - queueAsyncClient.dequeueMessages().subscribe( + public void deleteMessageWithResponse() { + QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueClient.deleteMessageWithResponse#String-String-Context + queueClient.dequeueMessages().forEach( dequeuedMessage -> { - queueAsyncClient.deleteMessage(dequeuedMessage.messageId(), dequeuedMessage.popReceipt()).subscribe( - response -> { }, - deleteError -> System.err.print(deleteError.toString()), - () -> System.out.println("Complete deleting the message!") - ); - }, - dequeueError -> System.err.print(dequeueError.toString()), - () -> System.out.println("Complete dequeueing the message!") + VoidResponse response = queueClient.deleteMessageWithResponse(dequeuedMessage.messageId(), + dequeuedMessage.popReceipt(), new Context(key1, value1)); + System.out.println("Complete deleting the message with status code " + response.statusCode()); + } ); - // END: com.azure.storage.queue.queueAsyncClient.deleteMessage + // END: com.azure.storage.queue.QueueClient.deleteMessageWithResponse#String-String-Context } /** @@ -492,22 +280,20 @@ public void deleteMessageAsync() { public void deleteQueue() { QueueClient queueClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueClient.delete - VoidResponse response = queueClient.delete(); - System.out.println("Complete deleting the queue with status code: " + response.statusCode()); + queueClient.delete(); + System.out.println("Complete deleting the queue."); // END: com.azure.storage.queue.queueClient.delete } - /** - * Generates a code sample for using {@link QueueAsyncClient#delete()} + * Generates a code sample for using {@link QueueClient#deleteWithResponse(Context)} */ - public void deleteQueueAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.delete - queueAsyncClient.delete().subscribe( - response -> System.out.println("Deleting the queue completed with status code: " + response.statusCode()) - ); - // END: com.azure.storage.queue.queueAsyncClient.delete + public void deleteWithResponse() { + QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.deleteWithResponse#Context + VoidResponse response = queueClient.deleteWithResponse(new Context(key1, value1)); + System.out.println("Complete deleting the queue with status code: " + response.statusCode()); + // END: com.azure.storage.queue.queueClient.deleteWithResponse#Context } /** @@ -516,25 +302,22 @@ public void deleteQueueAsync() { public void getProperties() { QueueClient queueClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueClient.getProperties - QueueProperties properties = queueClient.getProperties().value(); + QueueProperties properties = queueClient.getProperties(); System.out.printf("Metadata: %s, Approximate message count: %d", properties.metadata(), properties.approximateMessagesCount()); // END: com.azure.storage.queue.queueClient.getProperties } /** - * Generates a code sample for using {@link QueueAsyncClient#getProperties()} + * Generates a code sample for using {@link QueueClient#getPropertiesWithResponse(Context)} */ - public void getPropertiesAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.getProperties - queueAsyncClient.getProperties() - .subscribe(response -> { - QueueProperties properties = response.value(); - System.out.printf("Metadata: %s, Approximate message count: %d", properties.metadata(), - properties.approximateMessagesCount()); - }); - // END: com.azure.storage.queue.queueAsyncClient.getProperties + public void getPropertiesWithResponse() { + QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.getPropertiesWithResponse#Context + QueueProperties properties = queueClient.getPropertiesWithResponse(new Context(key1, value1)).value(); + System.out.printf("Metadata: %s, Approximate message count: %d", properties.metadata(), + properties.approximateMessagesCount()); + // END: com.azure.storage.queue.queueClient.getPropertiesWithResponse#Context } /** @@ -543,21 +326,20 @@ public void getPropertiesAsync() { public void setMetadata() { QueueClient queueClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueClient.setMetadata#map - VoidResponse response = queueClient.setMetadata(Collections.singletonMap("queue", "metadataMap")); - System.out.printf("Setting metadata completed with status code %d", response.statusCode()); + queueClient.setMetadata(Collections.singletonMap("queue", "metadataMap")); + System.out.printf("Setting metadata completed."); // END: com.azure.storage.queue.queueClient.setMetadata#map } /** - * Generate a code sample for using {@link QueueAsyncClient#setMetadata(Map)} to set metadata. + * Generate a code sample for using {@link QueueClient#setMetadataWithResponse(Map, Context)} to set metadata. */ - public void setMetadataAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.setMetadata#map - queueAsyncClient.setMetadata(Collections.singletonMap("queue", "metadataMap")) - .subscribe(response -> System.out.printf("Setting metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.queue.queueAsyncClient.setMetadata#map + public void setMetadataWithResponse() { + QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.setMetadataWithResponse#map-Context + queueClient.setMetadataWithResponse(Collections.singletonMap("queue", "metadataMap"), new Context(key1, value1)); + System.out.printf("Setting metadata completed."); + // END: com.azure.storage.queue.queueClient.setMetadataWithResponse#map-Context } /** @@ -566,21 +348,20 @@ public void setMetadataAsync() { public void clearMetadata() { QueueClient queueClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueClient.clearMetadata#map - VoidResponse response = queueClient.setMetadata(null); - System.out.printf("Clearing metadata completed with status code %d", response.statusCode()); + queueClient.setMetadata(null); + System.out.printf("Clearing metadata completed."); // END: com.azure.storage.queue.queueClient.clearMetadata#map } /** - * Generate a code sample for using {@link QueueAsyncClient#setMetadata(Map)} to clear metadata. + * Generate a code sample for using {@link QueueClient#setMetadataWithResponse(Map, Context)} to clear metadata. */ - public void clearMetadataAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMetadata#map - queueAsyncClient.setMetadata(null) - .subscribe(response -> System.out.printf("Clearing metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.queue.queueAsyncClient.clearMetadata#map + public void clearMetadataWithResponse() { + QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.clearMetadataWithResponse#map-Context + VoidResponse response = queueClient.setMetadataWithResponse(null, new Context(key1, value1)); + System.out.printf("Clearing metadata completed with status code %d", response.statusCode()); + // END: com.azure.storage.queue.queueClient.clearMetadataWithResponse#map-Context } /** @@ -596,48 +377,35 @@ public void getAccessPolicy() { // END: com.azure.storage.queue.queueClient.getAccessPolicy } - /** - * Generates a code sample for using {@link QueueAsyncClient#getAccessPolicy()} - */ - public void getAccessPolicyAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.getAccessPolicy - queueAsyncClient.getAccessPolicy() - .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", - result.id(), result.accessPolicy().permission())); - // END: com.azure.storage.queue.queueAsyncClient.getAccessPolicy - } - /** * Generates a code sample for using {@link QueueClient#setAccessPolicy(List)} */ public void setAccessPolicy() { QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.setAccessPolicy + // BEGIN: com.azure.storage.queue.QueueClient.setAccessPolicy#List AccessPolicy accessPolicy = new AccessPolicy().permission("r") .start(OffsetDateTime.now(ZoneOffset.UTC)) .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); - VoidResponse response = queueClient.setAccessPolicy(Collections.singletonList(permission)); - System.out.printf("Setting access policies completed with status code %d", response.statusCode()); - // END: com.azure.storage.queue.queueClient.setAccessPolicy + queueClient.setAccessPolicy(Collections.singletonList(permission)); + System.out.printf("Setting access policies completed."); + // END: com.azure.storage.queue.QueueClient.setAccessPolicy#List } /** - * Generates a code sample for using {@link QueueAsyncClient#setAccessPolicy(List)} + * Generates a code sample for using {@link QueueClient#setAccessPolicyWithResponse(List, Context)} */ - public void setAccessPolicyAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.setAccessPolicy + public void setAccessPolicyWithResponse() { + QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.setAccessPolicyWithResponse#List-Context AccessPolicy accessPolicy = new AccessPolicy().permission("r") .start(OffsetDateTime.now(ZoneOffset.UTC)) .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); - SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); - queueAsyncClient.setAccessPolicy(Collections.singletonList(permission)) - .subscribe(response -> System.out.printf("Setting access policies completed with status code %d", - response.statusCode())); - // END: com.azure.storage.queue.queueAsyncClient.setAccessPolicy + VoidResponse response = queueClient.setAccessPolicyWithResponse(Collections.singletonList(permission), + new Context(key1, value1)); + System.out.printf("Setting access policies completed with status code %d", response.statusCode()); + // END: com.azure.storage.queue.queueClient.setAccessPolicyWithResponse#List-Context } /** @@ -646,22 +414,19 @@ public void setAccessPolicyAsync() { public void clearMessages() { QueueClient queueClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueClient.clearMessages - VoidResponse response = queueClient.clearMessages(); - System.out.printf("Clearing messages completed with status code %d", response.statusCode()); + queueClient.clearMessages(); + System.out.printf("Clearing messages completed."); // END: com.azure.storage.queue.queueClient.clearMessages } - /** - * Generates a code sample for using {@link QueueAsyncClient#clearMessages()} + * Generates a code sample for using {@link QueueClient#clearMessagesWithResponse(Context)} */ - public void clearMessagesAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMessages - queueAsyncClient.clearMessages().subscribe( - response -> System.out.println("Clearing messages completed with status code: " + response.statusCode()) - ); - // END: com.azure.storage.queue.queueAsyncClient.clearMessages + public void clearMessagesWithResponse() { + QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.clearMessagesWithResponse#Context + VoidResponse response = queueClient.clearMessagesWithResponse(new Context(key1, value1)); + System.out.printf("Clearing messages completed with status code %d", response.statusCode()); + // END: com.azure.storage.queue.queueClient.clearMessagesWithResponse#Context } - } diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java new file mode 100644 index 000000000000..aa6be4f8c1d7 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.storage.queue.javadoc; + +import com.azure.storage.common.Utility; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.queue.QueueServiceAsyncClient; +import com.azure.storage.queue.QueueServiceClient; +import com.azure.storage.queue.QueueServiceClientBuilder; +import com.azure.storage.queue.models.QueuesSegmentOptions; +import com.azure.storage.queue.models.StorageServiceProperties; +import com.azure.storage.queue.models.StorageServiceStats; +import java.util.Collections; +import java.util.Map; + +/** + * Contains code snippets when generating javadocs through doclets for {@link QueueServiceClient} and {@link QueueServiceAsyncClient}. + */ +public class QueueServiceAsyncJavaDocCodeSamples { + + /** + * Generates code sample for creating a {@link QueueServiceAsyncClient}. + */ + public void buildQueueServiceAsyncClient() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation + QueueServiceAsyncClient client = new QueueServiceClientBuilder() + .connectionString("connectionstring") + .endpoint("endpoint") + .buildAsyncClient(); + // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation + } + + /** + * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link QueueServiceAsyncClient} + */ + public QueueServiceAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.sastoken + QueueServiceAsyncClient queueServiceAsyncClient = new QueueServiceClientBuilder() + .endpoint("https://{accountName}.queue.core.windows.net?{SASToken}") + .buildAsyncClient(); + // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.sastoken + return queueServiceAsyncClient; + } + + /** + * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@link SASTokenCredential} + * @return An instance of {@link QueueServiceAsyncClient} + */ + public QueueServiceAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential + QueueServiceAsyncClient queueServiceAsyncClient = new QueueServiceClientBuilder() + .endpoint("https://{accountName}.queue.core.windows.net") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("{SASTokenQueryParams}"))) + .buildAsyncClient(); + // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential + return queueServiceAsyncClient; + } + + /** + * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * @return An instance of {@link QueueServiceAsyncClient} + */ + public QueueServiceAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};" + + "AccountKey={key};EndpointSuffix={core.windows.net}"; + QueueServiceAsyncClient queueServiceAsyncClient = new QueueServiceClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.connectionstring + return queueServiceAsyncClient; + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#createQueue(String)} + */ + public void createQueueAsync() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string + queueServiceAsyncClient.createQueue("myqueue").subscribe( + response -> { }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the queue!") + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#createQueueWithResponse(String, Map)} + */ + public void createQueueAsyncMaxOverload() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.createQueueWithResponse#string-map + queueServiceAsyncClient.createQueueWithResponse("myqueue", Collections.singletonMap("queue", "metadata")) + .subscribe( + response -> System.out.printf("Creating the queue with status code %d", response.statusCode()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the queue!") + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.createQueueWithResponse#string-map + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#listQueues()} + */ + public void listQueuesAsync() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.listQueues + queueServiceAsyncClient.listQueues().subscribe( + queueItem -> System.out.printf("Queue %s exists in the account", queueItem.name()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete listing the queues!") + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.listQueues + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#listQueues(QueuesSegmentOptions)} + */ + public void listQueuesAsyncWithOverload() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions + queueServiceAsyncClient.listQueues(new QueuesSegmentOptions().prefix("azure")).subscribe( + queueItem -> System.out.printf("Queue %s exists in the account and has metadata %s", + queueItem.name(), queueItem.metadata()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete listing the queues!") + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#deleteQueue(String)} + */ + public void deleteQueueAsync() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.deleteQueue#string + queueServiceAsyncClient.deleteQueue("myshare").subscribe( + response -> System.out.println("Deleting the queue completed.") + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.deleteQueue#string + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#deleteQueueWithResponse(String)} + */ + public void deleteQueueWithResponse() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.deleteQueueWithResponse#string + queueServiceAsyncClient.deleteQueueWithResponse("myshare").subscribe( + response -> System.out.println("Deleting the queue completed with status code: " + response.statusCode()) + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.deleteQueueWithResponse#string + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getProperties + queueServiceAsyncClient.getProperties() + .subscribe(properties -> { + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); + }); + // END: com.azure.storage.queue.queueServiceAsyncClient.getProperties + } + + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getPropertiesWithResponse + queueServiceAsyncClient.getPropertiesWithResponse() + .subscribe(response -> { + StorageServiceProperties properties = response.value(); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); + }); + // END: com.azure.storage.queue.queueServiceAsyncClient.getPropertiesWithResponse + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#setProperties(StorageServiceProperties)} + */ + public void setPropertiesAsync() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setProperties#storageServiceProperties + StorageServiceProperties properties = queueServiceAsyncClient.getProperties().block(); + queueServiceAsyncClient.setProperties(properties) + .doOnSuccess(response -> System.out.println("Setting Queue service properties completed.")); + // END: com.azure.storage.queue.queueServiceAsyncClient.setProperties#storageServiceProperties + } + + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#setPropertiesWithResponse(StorageServiceProperties)} + */ + public void setPropertiesWithResponse() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponse#storageServiceProperties + StorageServiceProperties properties = queueServiceAsyncClient.getProperties().block(); + queueServiceAsyncClient.setPropertiesWithResponse(properties) + .subscribe(response -> System.out.printf("Setting Queue service properties completed with status code %d", + response.statusCode())); + // END: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponse#storageServiceProperties + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#setProperties(StorageServiceProperties)} with metrics enabled. + */ + public void setPropertiesEnableMetrics() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties + queueServiceAsyncClient.getProperties().subscribe(properties -> { + properties.minuteMetrics().enabled(true); + properties.hourMetrics().enabled(true); + + queueServiceAsyncClient.setProperties(properties).subscribe(response -> + System.out.println("Setting Queue service properties completed.")); + }); + // END: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#setPropertiesWithResponse(StorageServiceProperties)} with metrics enabled. + */ + public void setPropertiesAsyncEnableMetrics() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties + queueServiceAsyncClient.getProperties().subscribe(properties -> { + properties.minuteMetrics().enabled(true); + properties.hourMetrics().enabled(true); + + queueServiceAsyncClient.setPropertiesWithResponse(properties).subscribe(response -> + System.out.printf("Setting Queue service properties completed with status code %d", + response.statusCode())); + }); + // END: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#getStatistics()} + */ + public void getStatisticsAsync() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getStatistics + queueServiceAsyncClient.getStatistics() + .subscribe(stats -> { + System.out.printf("Geo replication status: %s, Last synced: %s", + stats.geoReplication().status(), stats.geoReplication().lastSyncTime()); + }); + // END: com.azure.storage.queue.queueServiceAsyncClient.getStatistics + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#getStatisticsWithResponse()} + */ + public void getStatisticsWithResponse() { + QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getStatisticsWithResponse + queueServiceAsyncClient.getStatisticsWithResponse() + .subscribe(response -> { + StorageServiceStats stats = response.value(); + System.out.printf("Geo replication status: %s, Last synced: %s", + stats.geoReplication().status(), stats.geoReplication().lastSyncTime()); + }); + // END: com.azure.storage.queue.queueServiceAsyncClient.getStatisticsWithResponse + } +} diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java index 52a214439206..8a3ad480820e 100644 --- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java @@ -4,13 +4,13 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.queue.models.QueuesSegmentOptions; import com.azure.storage.queue.models.StorageServiceProperties; import com.azure.storage.queue.models.StorageServiceStats; - import java.util.Collections; import java.util.Map; @@ -18,6 +18,10 @@ * Contains code snippets when generating javadocs through doclets for {@link QueueServiceClient} and {@link QueueServiceAsyncClient}. */ public class QueueServiceJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for creating a {@link QueueServiceClient}. */ @@ -30,18 +34,6 @@ public void buildQueueServiceClient() { // END: com.azure.storage.queue.queueServiceClient.instantiation } - /** - * Generates code sample for creating a {@link QueueServiceAsyncClient}. - */ - public void buildQueueServiceAsyncClient() { - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation - QueueServiceAsyncClient client = new QueueServiceClientBuilder() - .connectionString("connectionstring") - .endpoint("endpoint") - .buildAsyncClient(); - // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation - } - /** * Generates code sample for creating a {@link QueueServiceClient} with {@link SASTokenCredential} * @return An instance of {@link QueueServiceClient} @@ -55,19 +47,6 @@ public QueueServiceClient createClientWithSASToken() { return queueServiceClient; } - /** - * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link QueueServiceAsyncClient} - */ - public QueueServiceAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.sastoken - QueueServiceAsyncClient queueServiceAsyncClient = new QueueServiceClientBuilder() - .endpoint("https://{accountName}.queue.core.windows.net?{SASToken}") - .buildAsyncClient(); - // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.sastoken - return queueServiceAsyncClient; - } - /** * Generates code sample for creating a {@link QueueServiceClient} with {@link SASTokenCredential} * @return An instance of {@link QueueServiceClient} @@ -82,20 +61,6 @@ public QueueServiceClient createClientWithCredential() { return queueServiceClient; } - /** - * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link QueueServiceAsyncClient} - */ - public QueueServiceAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential - QueueServiceAsyncClient queueServiceAsyncClient = new QueueServiceClientBuilder() - .endpoint("https://{accountName}.queue.core.windows.net") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("{SASTokenQueryParams}"))) - .buildAsyncClient(); - // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential - return queueServiceAsyncClient; - } - /** * Generates code sample for creating a {@link QueueServiceClient} with {@code connectionString} which turns into {@link SharedKeyCredential} * @return An instance of {@link QueueServiceClient} @@ -111,71 +76,27 @@ public QueueServiceClient createClientWithConnectionString() { return queueServiceClient; } - /** - * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link QueueServiceAsyncClient} - */ - public QueueServiceAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};" - + "AccountKey={key};EndpointSuffix={core.windows.net}"; - QueueServiceAsyncClient queueServiceAsyncClient = new QueueServiceClientBuilder() - .connectionString(connectionString) - .buildAsyncClient(); - // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.connectionstring - return queueServiceAsyncClient; - } - /** * Generates a code sample for using {@link QueueServiceClient#createQueue(String)} */ public void createQueue() { QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.createQueue#string - Response response = queueServiceClient.createQueue("myqueue"); - System.out.println("Complete creating queue with status code: " + response.statusCode()); + queueServiceClient.createQueue("myqueue"); + System.out.println("Complete creating queue."); // END: com.azure.storage.queue.queueServiceClient.createQueue#string } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#createQueue(String)} - */ - public void createQueueAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string - queueServiceAsyncClient.createQueue("myqueue").subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the queue!") - ); - // END: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string - } - - /** - * Generates a code sample for using {@link QueueServiceClient#createQueue(String, Map)} + * Generates a code sample for using {@link QueueServiceClient#createQueueWithResponse(String, Map, Context)} */ public void createQueueMaxOverload() { QueueServiceClient queueServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceClient.createQueue#string-map - Response response = queueServiceClient.createQueue("myqueue", - Collections.singletonMap("queue", "metadata")); + // BEGIN: com.azure.storage.queue.queueServiceClient.createQueueWithResponse#string-map-Context + Response response = queueServiceClient.createQueueWithResponse("myqueue", + Collections.singletonMap("queue", "metadata"), new Context(key1, value1)); System.out.println("Complete creating queue with status code: " + response.statusCode()); - // END: com.azure.storage.queue.queueServiceClient.createQueue#string-map - } - - /** - * Generates a code sample for using {@link QueueServiceAsyncClient#createQueue(String, Map)} - */ - public void createQueueAsyncMaxOverload() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string-map - queueServiceAsyncClient.createQueue("myqueue", Collections.singletonMap("queue", "metadata")) - .subscribe( - response -> System.out.printf("Creating the queue with status code %d", response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the queue!") - ); - // END: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string-map + // END: com.azure.storage.queue.queueServiceClient.createQueueWithResponse#string-map-Context } /** @@ -190,20 +111,6 @@ public void listQueues() { // END: com.azure.storage.queue.queueServiceClient.listQueues } - /** - * Generates a code sample for using {@link QueueServiceAsyncClient#listQueues()} - */ - public void listQueuesAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.listQueues - queueServiceAsyncClient.listQueues().subscribe( - queueItem -> System.out.printf("Queue %s exists in the account", queueItem.name()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete listing the queues!") - ); - // END: com.azure.storage.queue.queueServiceAsyncClient.listQueues - } - /** * Generates a code sample for using {@link QueueServiceClient#listQueues(QueuesSegmentOptions)} )} */ @@ -217,42 +124,27 @@ public void listQueuesWithOverload() { // END: com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions } - /** - * Generates a code sample for using {@link QueueServiceAsyncClient#listQueues(QueuesSegmentOptions)} - */ - public void listQueuesAsyncWithOverload() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions - queueServiceAsyncClient.listQueues(new QueuesSegmentOptions().prefix("azure")).subscribe( - queueItem -> System.out.printf("Queue %s exists in the account and has metadata %s", - queueItem.name(), queueItem.metadata()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete listing the queues!") - ); - // END: com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions - } - /** * Generates a code sample for using {@link QueueServiceClient#deleteQueue(String)} */ public void deleteQueue() { QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.deleteQueue#string - VoidResponse response = queueServiceClient.deleteQueue("myqueue"); - System.out.println("Complete deleting the queue with status code: " + response.statusCode()); + queueServiceClient.deleteQueue("myqueue"); + System.out.println("Complete deleting the queue."); // END: com.azure.storage.queue.queueServiceClient.deleteQueue#string } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#deleteQueue(String)} + * Generates a code sample for using {@link QueueServiceClient#deleteQueueWithResponse(String, Context)} */ - public void deleteQueueAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.deleteQueue#string - queueServiceAsyncClient.deleteQueue("myshare").subscribe( - response -> System.out.println("Deleting the queue completed with status code: " + response.statusCode()) - ); - // END: com.azure.storage.queue.queueServiceAsyncClient.deleteQueue#string + public void deleteQueueWithResponse() { + QueueServiceClient queueServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceClient.deleteQueueWithResponse#string-Context + VoidResponse response = queueServiceClient.deleteQueueWithResponse("myqueue", + new Context(key1, value1)); + System.out.println("Complete deleting the queue with status code: " + response.statusCode()); + // END: com.azure.storage.queue.queueServiceClient.deleteQueueWithResponse#string-Context } /** @@ -261,25 +153,23 @@ public void deleteQueueAsync() { public void getProperties() { QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.getProperties - StorageServiceProperties properties = queueServiceClient.getProperties().value(); + StorageServiceProperties properties = queueServiceClient.getProperties(); System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); // END: com.azure.storage.queue.queueServiceClient.getProperties } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#getProperties()} + * Generates a code sample for using {@link QueueServiceClient#getPropertiesWithResponse(Context)} */ - public void getPropertiesAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getProperties - queueServiceAsyncClient.getProperties() - .subscribe(response -> { - StorageServiceProperties properties = response.value(); - System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", - properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); - }); - // END: com.azure.storage.queue.queueServiceAsyncClient.getProperties + public void getPropertiesWithResponse() { + QueueServiceClient queueServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceClient.getPropertiesWithResponse#Context + StorageServiceProperties properties = queueServiceClient.getPropertiesWithResponse( + new Context(key1, value1)).value(); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); + // END: com.azure.storage.queue.queueServiceClient.getPropertiesWithResponse#Context } /** @@ -288,54 +178,53 @@ public void getPropertiesAsync() { public void setProperties() { QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.setProperties#storageServiceProperties - StorageServiceProperties properties = queueServiceClient.getProperties().value(); + StorageServiceProperties properties = queueServiceClient.getProperties(); properties.cors(Collections.emptyList()); - VoidResponse response = queueServiceClient.setProperties(properties); - System.out.printf("Setting Queue service properties completed with status code %d", response.statusCode()); + queueServiceClient.setProperties(properties); + System.out.printf("Setting Queue service properties completed."); // END: com.azure.storage.queue.queueServiceClient.setProperties#storageServiceProperties } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#setProperties(StorageServiceProperties)} + * Generates a code sample for using {@link QueueServiceClient#setPropertiesWithResponse(StorageServiceProperties, Context)} */ - public void setPropertiesAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setProperties#storageServiceProperties - StorageServiceProperties properties = queueServiceAsyncClient.getProperties().block().value(); - queueServiceAsyncClient.setProperties(properties) - .subscribe(response -> System.out.printf("Setting Queue service properties completed with status code %d", - response.statusCode())); - // END: com.azure.storage.queue.queueServiceAsyncClient.setProperties#storageServiceProperties + public void setPropertiesWithResponse() { + QueueServiceClient queueServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponse#storageServiceProperties-Context + StorageServiceProperties properties = queueServiceClient.getProperties(); + properties.cors(Collections.emptyList()); + VoidResponse response = queueServiceClient.setPropertiesWithResponse(properties, new Context(key1, value1)); + System.out.printf("Setting Queue service properties completed with status code %d", response.statusCode()); + // END: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponse#storageServiceProperties-Context } /** - * Generates a code sample for using {@link QueueServiceClient#setProperties(StorageServiceProperties)} with metrics enabled. + * Generates a code sample for using {@link QueueServiceClient#setPropertiesWithResponse(StorageServiceProperties, Context)} with metrics enabled. */ - public void setPropertiesEnableMetrics() { + public void setPropertiesWithResponseEnableMetrics() { QueueServiceClient queueServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties - StorageServiceProperties properties = queueServiceClient.getProperties().value(); + // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties-Context + StorageServiceProperties properties = queueServiceClient.getProperties(); properties.minuteMetrics().enabled(true); properties.hourMetrics().enabled(true); - VoidResponse response = queueServiceClient.setProperties(properties); + VoidResponse response = queueServiceClient.setPropertiesWithResponse(properties, new Context(key1, value1)); System.out.printf("Setting Queue service properties completed with status code %d", response.statusCode()); - // END: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties + // END: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties-Context } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#setProperties(StorageServiceProperties)} with metrics enabled. + * Generates a code sample for using {@link QueueServiceClient#setProperties(StorageServiceProperties)} with metrics enabled. */ - public void setPropertiesAsyncEnableMetrics() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties - StorageServiceProperties properties = queueServiceAsyncClient.getProperties().block().value(); + public void setPropertiesEnableMetrics() { + QueueServiceClient queueServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties + StorageServiceProperties properties = queueServiceClient.getProperties(); properties.minuteMetrics().enabled(true); properties.hourMetrics().enabled(true); - queueServiceAsyncClient.setProperties(properties) - .subscribe(response -> System.out.printf("Setting Queue service properties completed with status code %d", - response.statusCode())); - // END: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties + queueServiceClient.setProperties(properties); + System.out.printf("Setting Queue service properties completed."); + // END: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties } /** @@ -344,24 +233,21 @@ public void setPropertiesAsyncEnableMetrics() { public void getStatistics() { QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.getStatistics - StorageServiceStats stats = queueServiceClient.getStatistics().value(); + StorageServiceStats stats = queueServiceClient.getStatistics(); System.out.printf("Geo replication status: %s, Last synced: %s", stats.geoReplication().status(), stats.geoReplication().lastSyncTime()); // END: com.azure.storage.queue.queueServiceClient.getStatistics } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#getStatistics()} + * Generates a code sample for using {@link QueueServiceClient#getStatisticsWithResponse(Context)} */ - public void getStatisticsAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getStatistics - queueServiceAsyncClient.getStatistics() - .subscribe(response -> { - StorageServiceStats stats = response.value(); - System.out.printf("Geo replication status: %s, Last synced: %s", - stats.geoReplication().status(), stats.geoReplication().lastSyncTime()); - }); - // END: com.azure.storage.queue.queueServiceAsyncClient.getStatistics + public void getStatisticsWithResponse() { + QueueServiceClient queueServiceClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueServiceClient.getStatisticsWithResponse#Context + StorageServiceStats stats = queueServiceClient.getStatisticsWithResponse(new Context(key1, value1)).value(); + System.out.printf("Geo replication status: %s, Last synced: %s", + stats.geoReplication().status(), stats.geoReplication().lastSyncTime()); + // END: com.azure.storage.queue.queueServiceClient.getStatisticsWithResponse#Context } } diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncClientTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncClientTests.java deleted file mode 100644 index e2b4b9529d00..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncClientTests.java +++ /dev/null @@ -1,693 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.queue.models.AccessPolicy; -import com.azure.storage.queue.models.DequeuedMessage; -import com.azure.storage.queue.models.SignedIdentifier; -import com.azure.storage.queue.models.StorageErrorException; -import reactor.test.StepVerifier; - -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -public class QueueAsyncClientTests extends QueueClientTestsBase { - private final ClientLogger logger = new ClientLogger(QueueAsyncClientTests.class); - - private QueueAsyncClient client; - - @Override - protected void beforeTest() { - queueName = getQueueName(); - helper = new TestHelpers(); - - if (interceptorManager.isPlaybackMode()) { - client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() - .connectionString(connectionString) - .queueName(queueName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, logger); - } else { - client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() - .connectionString(connectionString) - .queueName(queueName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, logger); - } - } - - @Override - protected void afterTest() { - try { - client.clearMessages().block(); - client.delete().block(); - } catch (StorageErrorException ex) { - // Queue already delete, that's what we wanted anyways. - } - } - - @Override - public void createWithSharedKey() { - - } - - @Override - public void createWithSASToken() { - // Need to find a way to get SAS tokens from the storage account - } - - @Override - public void createWithMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void createTwiceSameMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.create(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - } - - @Override - public void createTwiceDifferentMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.create(metadata)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void deleteExisting() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.enqueueMessage("This queue will be deleted")) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.delete()) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - helper.sleepInRecordMode(Duration.ofSeconds(30)); - - StepVerifier.create(client.enqueueMessage("This should fail")) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void deleteNonExistent() { - StepVerifier.create(client.delete()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getProperties() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getPropertiesQueueDoesNotExist() { - StepVerifier.create(client.getProperties()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void setMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.setMetadata(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void setMetadataQueueDoesNotExist() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.setMetadata(metadata)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void setInvalidMetadata() { - Map badMetadata = Collections.singletonMap("", "bad metadata"); - - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.setMetadata(badMetadata)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void deleteMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - - StepVerifier.create(client.setMetadata(null)) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(Collections.EMPTY_MAP, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getAccessPolicy() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.getAccessPolicy()) - .expectNextCount(0) - .verifyComplete(); - } - - @Override - public void getAccessPolicyQueueDoesNotExist() { - StepVerifier.create(client.getAccessPolicy()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void setAccessPolicy() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - AccessPolicy accessPolicy = new AccessPolicy() - .permission("raup") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier() - .id("testpermission") - .accessPolicy(accessPolicy); - - StepVerifier.create(client.setAccessPolicy(Collections.singletonList(permission))) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.getAccessPolicy()) - .assertNext(response -> helper.assertPermissionsAreEqual(permission, response)) - .verifyComplete(); - } - - @Override - public void setAccessPolicyQueueDoesNotExist() { - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.now()) - .expiry(OffsetDateTime.now()); - - SignedIdentifier permission = new SignedIdentifier() - .id("test-permission") - .accessPolicy(accessPolicy); - - StepVerifier.create(client.setAccessPolicy(Collections.singletonList(permission))) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setInvalidAccessPolicy() { - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier() - .id("theidofthispermissionislongerthanwhatisallowedbytheserviceandshouldfail") - .accessPolicy(accessPolicy); - - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.setAccessPolicy(Collections.singletonList(permission))) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setTooManyAccessPolicies() { - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - List permissions = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - permissions.add(new SignedIdentifier() - .id("policy" + i) - .accessPolicy(accessPolicy)); - } - - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.setAccessPolicy(permissions)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void enqueueMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages()) - .assertNext(peekedMessage -> assertEquals(messageText, peekedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void enqueueEmptyMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = ""; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages()) - .assertNext(peekedMessage -> assertNull(peekedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void enqueueShortTimeToLiveMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText, Duration.ofSeconds(0), Duration.ofSeconds(2))) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages().delaySubscription(Duration.ofSeconds(5))) - .expectNextCount(0) - .verifyComplete(); - } - - @Override - public void enqueueQueueDoesNotExist() { - StepVerifier.create(client.enqueueMessage("this should fail")) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void dequeueMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.dequeueMessages()) - .assertNext(dequeuedMessage -> assertEquals(messageText, dequeuedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void dequeueMultipleMessages() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - String messageText2 = "test message 2"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.enqueueMessage(messageText2)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.dequeueMessages(2)) - .assertNext(dequeuedMessage -> assertEquals(messageText, dequeuedMessage.messageText())) - .assertNext(dequeuedMessage -> assertEquals(messageText2, dequeuedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void dequeueTooManyMessages() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.dequeueMessages(64)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void dequeueQueueDoesNotExist() { - StepVerifier.create(client.dequeueMessages()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void peekMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages()) - .assertNext(peekedMessage -> assertEquals(messageText, peekedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void peekMultipleMessages() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - String messageText2 = "test message 2"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.enqueueMessage(messageText2)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages(2)) - .assertNext(peekedMessage -> assertEquals(messageText, peekedMessage.messageText())) - .assertNext(peekedMessage -> assertEquals(messageText2, peekedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void peekTooManyMessages() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages(64)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void peekQueueDoesNotExist() { - StepVerifier.create(client.peekMessages()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void clearMessages() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.enqueueMessage("test message")) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.enqueueMessage("test message")) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.enqueueMessage("test message")) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(3, response.value().approximateMessagesCount()); - }) - .verifyComplete(); - - StepVerifier.create(client.clearMessages()) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - }) - .verifyComplete(); - } - - @Override - public void clearMessagesQueueDoesNotExist() { - StepVerifier.create(client.clearMessages()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void deleteMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = client.dequeueMessages().blockFirst(); - assertEquals(messageText, dequeuedMessage.messageText()); - StepVerifier.create(client.deleteMessage(dequeuedMessage.messageId(), dequeuedMessage.popReceipt())) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - }) - .verifyComplete(); - } - - @Override - public void deleteMessageInvalidMessageId() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = new DequeuedMessage(); - StepVerifier.create(client.dequeueMessages()) - .assertNext(response -> { - assertEquals(messageText, response.messageText()); - dequeuedMessage.popReceipt(response.popReceipt()).messageId(response.messageId()); - }) - .verifyComplete(); - - StepVerifier.create(client.deleteMessage(dequeuedMessage.messageId() + "random", dequeuedMessage.popReceipt())) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void deleteMessageInvalidPopReceipt() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = new DequeuedMessage(); - StepVerifier.create(client.dequeueMessages()) - .assertNext(response -> { - assertEquals(messageText, response.messageText()); - dequeuedMessage.popReceipt(response.popReceipt()).messageId(response.messageId()); - }) - .verifyComplete(); - - StepVerifier.create(client.deleteMessage(dequeuedMessage.messageId(), dequeuedMessage.popReceipt() + "random")) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void deleteMessageQueueDoesNotExist() { - StepVerifier.create(client.deleteMessage("invalid", "call")) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void updateMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = client.dequeueMessages().blockFirst(); - assertEquals(messageText, dequeuedMessage.messageText()); - - String updatedMessageText = "updated test message"; - StepVerifier.create(client.updateMessage(updatedMessageText, dequeuedMessage.messageId(), dequeuedMessage.popReceipt(), Duration.ofSeconds(1))) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages().delaySubscription(Duration.ofSeconds(2))) - .assertNext(response -> assertEquals(updatedMessageText, response.messageText())) - .verifyComplete(); - } - - @Override - public void updateMessageInvalidMessageId() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = client.dequeueMessages().blockFirst(); - assertEquals(messageText, dequeuedMessage.messageText()); - - String updatedMessageText = "updated test message"; - StepVerifier.create(client.updateMessage(updatedMessageText, dequeuedMessage.messageId() + "random", dequeuedMessage.popReceipt(), Duration.ofSeconds(1))) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void updateMessageInvalidPopReceipt() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = client.dequeueMessages().blockFirst(); - assertEquals(messageText, dequeuedMessage.messageText()); - - String updatedMessageText = "updated test message"; - StepVerifier.create(client.updateMessage(updatedMessageText, dequeuedMessage.messageId(), dequeuedMessage.popReceipt() + "random", Duration.ofSeconds(1))) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void updateMessageQueueDoesNotExist() { - StepVerifier.create(client.updateMessage("queue", "doesn't", "exist", Duration.ofSeconds(5))) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTests.java deleted file mode 100644 index 4e3f782d7ec6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTests.java +++ /dev/null @@ -1,653 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.rest.Response; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.queue.models.AccessPolicy; -import com.azure.storage.queue.models.DequeuedMessage; -import com.azure.storage.queue.models.PeekedMessage; -import com.azure.storage.queue.models.QueueProperties; -import com.azure.storage.queue.models.SignedIdentifier; -import com.azure.storage.queue.models.StorageErrorException; -import com.azure.storage.queue.models.UpdatedMessage; - -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - -public class QueueClientTests extends QueueClientTestsBase { - private final ClientLogger logger = new ClientLogger(QueueClientTests.class); - - private QueueClient client; - - @Override - protected void beforeTest() { - queueName = getQueueName(); - helper = new TestHelpers(); - - if (interceptorManager.isPlaybackMode()) { - client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() - .connectionString(connectionString) - .queueName(queueName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, logger); - } else { - client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() - .connectionString(connectionString) - .queueName(queueName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, logger); - } - } - - @Override - protected void afterTest() { - try { - client.clearMessages(); - client.delete(); - } catch (StorageErrorException ex) { - // Queue already delete, that's what we wanted anyways. - } - } - - @Override - public void createWithSharedKey() { - - } - - @Override - public void createWithSASToken() { - // Need to find a way to get SAS tokens from the storage account - } - - @Override - public void createWithMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(metadata), 201); - - QueueProperties properties = client.getProperties().value(); - assertEquals(metadata, properties.metadata()); - } - - @Override - public void createTwiceSameMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(metadata), 201); - helper.assertResponseStatusCode(client.create(metadata), 204); - } - - @Override - public void createTwiceDifferentMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(), 201); - - try { - client.create(metadata); - fail("Creating a queue twice with different metadata values should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 409); - } - } - - @Override - public void deleteExisting() { - helper.assertResponseStatusCode(client.create(), 201); - helper.assertResponseStatusCode(client.enqueueMessage("This queue will be deleted"), 201); - helper.assertResponseStatusCode(client.delete(), 204); - - helper.sleepInRecordMode(Duration.ofSeconds(30)); - - try { - client.enqueueMessage("This should fail"); - fail("Attempting to work with a queue that has been deleted should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void deleteNonExistent() { - try { - client.delete(); - fail("Attempting to delete a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void getProperties() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(metadata), 201); - - Response response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - } - - @Override - public void getPropertiesQueueDoesNotExist() { - try { - client.getProperties(); - fail("Attempting to get properties of a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void setMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(), 201); - - helper.assertResponseStatusCode(client.setMetadata(metadata), 204); - - Response response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - } - - @Override - public void setMetadataQueueDoesNotExist() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - try { - client.setMetadata(metadata); - fail("Attempting to set metadata on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void setInvalidMetadata() { - Map badMetadata = Collections.singletonMap("", "bad metadata"); - - helper.assertResponseStatusCode(client.create(), 201); - try { - client.setMetadata(badMetadata); - fail("Attempting to set invalid metadata on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void deleteMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(metadata), 201); - - Response response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - - helper.assertResponseStatusCode(client.setMetadata(null), 204); - - response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(Collections.EMPTY_MAP, response.value().metadata()); - } - - @Override - public void getAccessPolicy() { - helper.assertResponseStatusCode(client.create(), 201); - - Iterable accessPolicies = client.getAccessPolicy(); - assertFalse(accessPolicies.iterator().hasNext()); - } - - @Override - public void getAccessPolicyQueueDoesNotExist() { - try { - client.getAccessPolicy().iterator().hasNext(); - fail("Attempting to get access policies on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void setAccessPolicy() { - helper.assertResponseStatusCode(client.create(), 201); - - AccessPolicy accessPolicy = new AccessPolicy() - .permission("raup") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier() - .id("testpermission") - .accessPolicy(accessPolicy); - - helper.assertResponseStatusCode(client.setAccessPolicy(Collections.singletonList(permission)), 204); - - Iterator accessPolicies = client.getAccessPolicy().iterator(); - helper.assertPermissionsAreEqual(permission, accessPolicies.next()); - assertFalse(accessPolicies.hasNext()); - } - - @Override - public void setAccessPolicyQueueDoesNotExist() { - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.now()) - .expiry(OffsetDateTime.now()); - - SignedIdentifier permission = new SignedIdentifier() - .id("test-permission") - .accessPolicy(accessPolicy); - - try { - client.setAccessPolicy(Collections.singletonList(permission)); - fail("Attempting to set access policies on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setInvalidAccessPolicy() { - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier() - .id("theidofthispermissionislongerthanwhatisallowedbytheserviceandshouldfail") - .accessPolicy(accessPolicy); - - helper.assertResponseStatusCode(client.create(), 201); - - try { - client.setAccessPolicy(Collections.singletonList(permission)); - fail("Attempting to set invalid access policies on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setTooManyAccessPolicies() { - List permissions = new ArrayList<>(); - - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - for (int i = 0; i < 6; i++) { - permissions.add(new SignedIdentifier() - .id("policy" + i) - .accessPolicy(accessPolicy)); - } - - helper.assertResponseStatusCode(client.create(), 201); - - try { - client.setAccessPolicy(permissions); - fail("Attempting to set more than five access policies on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void enqueueMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.peekMessages().iterator(); - assertEquals(messageText, response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void enqueueEmptyMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = ""; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.peekMessages().iterator(); - assertNull(response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void enqueueShortTimeToLiveMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText, Duration.ofSeconds(0), Duration.ofSeconds(2)), 201); - - helper.sleepInRecordMode(Duration.ofSeconds(5)); - Iterator response = client.peekMessages().iterator(); - assertFalse(response.hasNext()); - } - - @Override - public void enqueueQueueDoesNotExist() { - try { - client.enqueueMessage("This should fail"); - fail("Attempting to enqueue a message on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void dequeueMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - assertEquals(messageText, response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void dequeueMultipleMessages() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - String messageText2 = "test message 2"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - helper.assertResponseStatusCode(client.enqueueMessage(messageText2), 201); - - Iterator response = client.dequeueMessages(2).iterator(); - assertEquals(messageText, response.next().messageText()); - assertEquals(messageText2, response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void dequeueTooManyMessages() { - helper.assertResponseStatusCode(client.create(), 201); - - try { - client.dequeueMessages(64).iterator().hasNext(); - fail("Attempting to get more than 32 messages from a queue should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void dequeueQueueDoesNotExist() { - try { - client.dequeueMessages().iterator().hasNext(); - fail("Attempting to get messages from a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void peekMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.peekMessages().iterator(); - assertEquals(messageText, response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void peekMultipleMessages() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - String messageText2 = "test message 2"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - helper.assertResponseStatusCode(client.enqueueMessage(messageText2), 201); - - Iterator response = client.peekMessages(2).iterator(); - assertEquals(messageText, response.next().messageText()); - assertEquals(messageText2, response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void peekTooManyMessages() { - helper.assertResponseStatusCode(client.create(), 201); - - try { - client.peekMessages(64).iterator().hasNext(); - fail("Attempting to peek more than 32 messages from a queue should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void peekQueueDoesNotExist() { - try { - client.peekMessages().iterator().hasNext(); - fail("Attempting to peek messages from a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void clearMessages() { - helper.assertResponseStatusCode(client.create(), 201); - - for (int i = 0; i < 3; i++) { - helper.assertResponseStatusCode(client.enqueueMessage("test message"), 201); - } - - Response response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(3, response.value().approximateMessagesCount()); - - helper.assertResponseStatusCode(client.clearMessages(), 204); - - response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - } - - @Override - public void clearMessagesQueueDoesNotExist() { - try { - client.clearMessages(); - fail("Attempting to clear messages of a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void deleteMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertFalse(response.hasNext()); - assertEquals(messageText, message.messageText()); - - helper.assertResponseStatusCode(client.deleteMessage(message.messageId(), message.popReceipt()), 204); - - Response propertiesResponse = client.getProperties(); - helper.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(0, propertiesResponse.value().approximateMessagesCount()); - } - - @Override - public void deleteMessageInvalidMessageId() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertFalse(response.hasNext()); - assertEquals(messageText, message.messageText()); - - try { - client.deleteMessage(message.messageId() + "random", message.popReceipt()); - fail("Attempting to delete a message with an invalid ID should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void deleteMessageInvalidPopReceipt() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertFalse(response.hasNext()); - assertEquals(messageText, message.messageText()); - - try { - client.deleteMessage(message.messageId(), message.popReceipt() + "random"); - fail("Attempting to delete a message with an invalid popReceipt should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void deleteMessageQueueDoesNotExist() { - try { - client.deleteMessage("invalid", "call"); - fail("Attempting to delete a message from a queue that doesn't exist should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void updateMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertEquals(messageText, message.messageText()); - assertFalse(response.hasNext()); - - String updatedMessageText = "updated test message"; - Response updatedMessageResponse = client.updateMessage(updatedMessageText, message.messageId(), message.popReceipt(), Duration.ofSeconds(1)); - helper.assertResponseStatusCode(updatedMessageResponse, 204); - - helper.sleepInRecordMode(Duration.ofSeconds(2)); - - Iterator peekedMessageIterator = client.peekMessages().iterator(); - PeekedMessage peekedMessage = peekedMessageIterator.next(); - assertEquals(updatedMessageText, peekedMessage.messageText()); - assertFalse(peekedMessageIterator.hasNext()); - } - - @Override - public void updateMessageInvalidMessageId() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertEquals(messageText, message.messageText()); - assertFalse(response.hasNext()); - - String updatedMessageText = "updated test message"; - try { - client.updateMessage(updatedMessageText, message.messageId() + "random", message.popReceipt(), Duration.ofSeconds(1)); - fail("Attempting to update a message with an invalid ID should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void updateMessageInvalidPopReceipt() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertEquals(messageText, message.messageText()); - assertFalse(response.hasNext()); - - String updatedMessageText = "updated test message"; - try { - client.updateMessage(updatedMessageText, message.messageId(), message.popReceipt() + "random", Duration.ofSeconds(1)); - fail("Attempting to update a message with an invalid popReceipt should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void updateMessageQueueDoesNotExist() { - try { - client.updateMessage("queue", "doesn't", "exist", Duration.ofSeconds(5)); - fail("Attempting to update a message on a queue that doesn't exist should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTestsBase.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTestsBase.java deleted file mode 100644 index b83d9a1459bb..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTestsBase.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.test.TestBase; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; - -public abstract class QueueClientTestsBase extends TestBase { - String queueName; - TestHelpers helper; - - @Rule - public TestName testName = new TestName(); - - @Override - public String testName() { - return testName.getMethodName(); - } - - String getQueueName() { - return testResourceNamer.randomName("queue", 16).toLowerCase(); - } - - @Test - public abstract void createWithSharedKey(); - - @Test - public abstract void createWithSASToken(); - - @Test - public abstract void createWithMetadata(); - - @Test - public abstract void createTwiceSameMetadata(); - - @Test - public abstract void createTwiceDifferentMetadata(); - - @Test - public abstract void deleteExisting(); - - @Test - public abstract void deleteNonExistent(); - - @Test - public abstract void getProperties(); - - @Test - public abstract void getPropertiesQueueDoesNotExist(); - - @Test - public abstract void setMetadata(); - - @Test - public abstract void setMetadataQueueDoesNotExist(); - - @Test - public abstract void setInvalidMetadata(); - - @Test - public abstract void deleteMetadata(); - - @Test - public abstract void getAccessPolicy(); - - @Test - public abstract void getAccessPolicyQueueDoesNotExist(); - - @Test - public abstract void setAccessPolicy(); - - @Test - public abstract void setAccessPolicyQueueDoesNotExist(); - - @Test - public abstract void setInvalidAccessPolicy(); - - @Test - public abstract void setTooManyAccessPolicies(); - - @Test - public abstract void enqueueMessage(); - - @Test - public abstract void enqueueEmptyMessage(); - - @Test - public abstract void enqueueShortTimeToLiveMessage(); - - @Test - public abstract void enqueueQueueDoesNotExist(); - - @Test - public abstract void dequeueMessage(); - - @Test - public abstract void dequeueMultipleMessages(); - - @Test - public abstract void dequeueTooManyMessages(); - - @Test - public abstract void dequeueQueueDoesNotExist(); - - @Test - public abstract void peekMessage(); - - @Test - public abstract void peekMultipleMessages(); - - @Test - public abstract void peekTooManyMessages(); - - @Test - public abstract void peekQueueDoesNotExist(); - - @Test - public abstract void clearMessages(); - - @Test - public abstract void clearMessagesQueueDoesNotExist(); - - @Test - public abstract void deleteMessage(); - - @Test - public abstract void deleteMessageInvalidMessageId(); - - @Test - public abstract void deleteMessageInvalidPopReceipt(); - - @Test - public abstract void deleteMessageQueueDoesNotExist(); - - @Test - public abstract void updateMessage(); - - @Test - public abstract void updateMessageInvalidMessageId(); - - @Test - public abstract void updateMessageInvalidPopReceipt(); - - @Test - public abstract void updateMessageQueueDoesNotExist(); -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncClientTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncClientTests.java deleted file mode 100644 index 1be35f6a8910..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncClientTests.java +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.queue.models.Logging; -import com.azure.storage.queue.models.Metrics; -import com.azure.storage.queue.models.QueueItem; -import com.azure.storage.queue.models.QueuesSegmentOptions; -import com.azure.storage.queue.models.RetentionPolicy; -import com.azure.storage.queue.models.StorageErrorException; -import com.azure.storage.queue.models.StorageServiceProperties; -import reactor.test.StepVerifier; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; - -import static org.junit.Assert.assertEquals; - -public class QueueServiceAsyncClientTests extends QueueServiceClientTestsBase { - private final ClientLogger logger = new ClientLogger(QueueServiceAsyncClientTests.class); - - private QueueServiceAsyncClient serviceClient; - - @Override - protected void beforeTest() { - queueName = getQueueName(); - helper = new TestHelpers(); - - if (interceptorManager.isPlaybackMode()) { - serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() - .connectionString(connectionString) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, logger); - } else { - serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() - .connectionString(connectionString) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, logger); - } - } - - @Override - protected void afterTest() { - serviceClient.listQueues(new QueuesSegmentOptions().prefix(queueName)) - .collectList() - .block() - .forEach(queue -> { - QueueAsyncClient client = serviceClient.getQueueAsyncClient(queue.name()); - try { - client.clearMessages().then(client.delete()).block(); - } catch (StorageErrorException ex) { - // Queue already delete, that's what we wanted anyways. - } - }); - } - - @Override - public void getQueueDoesNotCreateAQueue() { - StepVerifier.create(serviceClient.getQueueAsyncClient(queueName).enqueueMessage("Expecting an exception")); - } - - @Override - public void createQueue() { - StepVerifier.create(serviceClient.createQueue(queueName).block().value().enqueueMessage("Testing service client creating a queue")) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createQueueWithMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - QueueAsyncClient client = serviceClient.createQueue(queueName, metadata).block().value(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void createQueueTwiceSameMetadata() { - final String messageText = "Testing service client creating the same queue twice does not modify the queue"; - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(serviceClient.createQueue(queueName, metadata).block().value().enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(serviceClient.createQueue(queueName, metadata).block().value().peekMessages()) - .assertNext(response -> assertEquals(messageText, response.messageText())) - .verifyComplete(); - } - - @Override - public void createQueueTwiceDifferentMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - try { - serviceClient.createQueue(queueName); - serviceClient.createQueue(queueName, metadata); - } catch (Exception exception) { - } - } - - @Override - public void deleteExistingQueue() { - QueueAsyncClient client = serviceClient.createQueue(queueName).block().value(); - serviceClient.deleteQueue(queueName).block(); - - StepVerifier.create(client.enqueueMessage("Expecting an exception")); - } - - @Override - public void deleteNonExistentQueue() { - try { - serviceClient.deleteQueue(queueName); - } catch (Exception exception) { - } - } - - @Override - public void listQueues() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()).block(); - } - - StepVerifier.create(serviceClient.listQueues(defaultSegmentOptions())) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .verifyComplete(); - } - - @Override - public void listQueuesIncludeMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - if (i % 2 == 0) { - queue.metadata(metadata); - } - - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()).block(); - } - - StepVerifier.create(serviceClient.listQueues(defaultSegmentOptions().includeMetadata(true))) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .verifyComplete(); - } - - @Override - public void listQueuesWithPrefix() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem(); - if (i % 2 == 0) { - queue.name(queueName + "prefix" + i); - testQueues.add(queue); - } else { - queue.name(queueName + i); - } - - serviceClient.createQueue(queue.name(), queue.metadata()).block(); - } - - StepVerifier.create(serviceClient.listQueues(defaultSegmentOptions().prefix(queueName + "prefix"))) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .verifyComplete(); - } - - @Override - public void listQueuesWithLimit() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()).block(); - } - - StepVerifier.create(serviceClient.listQueues(defaultSegmentOptions().maxResults(2))) - .assertNext(queueItem -> helper.assertQueuesAreEqual(queueItem, testQueues.pop())) - .assertNext(queueItem -> helper.assertQueuesAreEqual(queueItem, testQueues.pop())) - .assertNext(queueItem -> helper.assertQueuesAreEqual(queueItem, testQueues.pop())) - .verifyComplete(); - } - - @Override - public void setProperties() { - StorageServiceProperties originalProperties = serviceClient.getProperties().block().value(); - - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Logging logging = new Logging().version("1.0") - .delete(true) - .write(true) - .retentionPolicy(retentionPolicy); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - StorageServiceProperties updatedProperties = new StorageServiceProperties().logging(logging) - .hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(new ArrayList<>()); - - StepVerifier.create(serviceClient.setProperties(updatedProperties)) - .assertNext(response -> helper.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(serviceClient.getProperties()) - .assertNext(response -> helper.assertQueueServicePropertiesAreEqual(updatedProperties, response.value())) - .verifyComplete(); - - StepVerifier.create(serviceClient.setProperties(originalProperties)) - .assertNext(response -> helper.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(serviceClient.getProperties()) - .assertNext(response -> helper.assertQueueServicePropertiesAreEqual(originalProperties, response.value())) - .verifyComplete(); - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTests.java deleted file mode 100644 index 39e1b9d2beb4..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTests.java +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.VoidResponse; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.queue.models.EnqueuedMessage; -import com.azure.storage.queue.models.Logging; -import com.azure.storage.queue.models.Metrics; -import com.azure.storage.queue.models.PeekedMessage; -import com.azure.storage.queue.models.QueueItem; -import com.azure.storage.queue.models.QueueProperties; -import com.azure.storage.queue.models.QueuesSegmentOptions; -import com.azure.storage.queue.models.RetentionPolicy; -import com.azure.storage.queue.models.StorageErrorException; -import com.azure.storage.queue.models.StorageServiceProperties; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class QueueServiceClientTests extends QueueServiceClientTestsBase { - private final ClientLogger logger = new ClientLogger(QueueServiceClientTests.class); - - private QueueServiceClient serviceClient; - - @Override - protected void beforeTest() { - queueName = getQueueName(); - helper = new TestHelpers(); - - if (interceptorManager.isPlaybackMode()) { - serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() - .connectionString(connectionString) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, logger); - } else { - serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() - .connectionString(connectionString) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, logger); - } - } - - @Override - protected void afterTest() { - serviceClient.listQueues(new QueuesSegmentOptions().prefix(queueName)) - .forEach(queueToDelete -> { - try { - QueueClient client = serviceClient.getQueueClient(queueToDelete.name()); - client.clearMessages(); - client.delete(); - } catch (StorageErrorException ex) { - // Queue already delete, that's what we wanted anyways. - } - }); - } - - @Override - public void getQueueDoesNotCreateAQueue() { - try { - serviceClient.getQueueClient(queueName).enqueueMessage("Expecting an exception"); - fail("getQueueClient doesn't create a queue in Azure Storage."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void createQueue() { - QueueClient client = serviceClient.createQueue(queueName).value(); - Response response = client.enqueueMessage("Testing service client creating a queue"); - helper.assertResponseStatusCode(response, 201); - } - - @Override - public void createQueueWithMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - QueueClient client = serviceClient.createQueue(queueName, metadata).value(); - - Response propertiesResponse = client.getProperties(); - helper.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void createQueueTwiceSameMetadata() { - final String messageText = "Testing service client creating the same queue twice does not modify the queue"; - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - EnqueuedMessage enqueuedMessage = serviceClient.createQueue(queueName, metadata).value().enqueueMessage(messageText).value(); - assertNotNull(enqueuedMessage); - - PeekedMessage peekedMessage = serviceClient.createQueue(queueName, metadata).value().peekMessages().iterator().next(); - assertEquals(messageText, peekedMessage.messageText()); - } - - @Override - public void createQueueTwiceDifferentMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - try { - serviceClient.createQueue(queueName); - serviceClient.createQueue(queueName, metadata); - fail("Creating a queue twice with different metadata should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 409); - } - } - - @Override - public void deleteExistingQueue() { - QueueClient client = serviceClient.createQueue(queueName).value(); - serviceClient.deleteQueue(queueName); - - try { - client.enqueueMessage("Expecting an exception"); - fail("Attempting to enqueue a message on a client that has been delete should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void deleteNonExistentQueue() { - try { - serviceClient.deleteQueue(queueName); - fail("Attempting to delete a queue that doesn't exist should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void listQueues() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()); - } - - for (QueueItem queue : serviceClient.listQueues(defaultSegmentOptions())) { - helper.assertQueuesAreEqual(testQueues.pop(), queue); - } - } - - @Override - public void listQueuesIncludeMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - if (i % 2 == 0) { - queue.metadata(metadata); - } - - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()); - } - - for (QueueItem queue : serviceClient.listQueues(defaultSegmentOptions().includeMetadata(true))) { - helper.assertQueuesAreEqual(testQueues.pop(), queue); - } - } - - @Override - public void listQueuesWithPrefix() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem(); - if (i % 2 == 0) { - queue.name(queueName + "prefix" + i); - testQueues.add(queue); - } else { - queue.name(queueName + i); - } - - serviceClient.createQueue(queue.name(), queue.metadata()); - } - - for (QueueItem queue : serviceClient.listQueues(defaultSegmentOptions().prefix(queueName + "prefix"))) { - helper.assertQueuesAreEqual(testQueues.pop(), queue); - } - } - - @Override - public void listQueuesWithLimit() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()); - } - - for (QueueItem queue : serviceClient.listQueues(defaultSegmentOptions().maxResults(2))) { - helper.assertQueuesAreEqual(testQueues.pop(), queue); - } - } - - @Override - public void setProperties() { - StorageServiceProperties originalProperties = serviceClient.getProperties().value(); - - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Logging logging = new Logging().version("1.0") - .delete(true) - .write(true) - .retentionPolicy(retentionPolicy); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - StorageServiceProperties updatedProperties = new StorageServiceProperties().logging(logging) - .hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(new ArrayList<>()); - - VoidResponse setResponse = serviceClient.setProperties(updatedProperties); - helper.assertResponseStatusCode(setResponse, 202); - - Response getResponse = serviceClient.getProperties(); - helper.assertQueueServicePropertiesAreEqual(updatedProperties, getResponse.value()); - - setResponse = serviceClient.setProperties(originalProperties); - helper.assertResponseStatusCode(setResponse, 202); - - getResponse = serviceClient.getProperties(); - helper.assertQueueServicePropertiesAreEqual(originalProperties, getResponse.value()); - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTestsBase.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTestsBase.java deleted file mode 100644 index f090814fbfc9..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTestsBase.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.test.TestBase; -import com.azure.storage.queue.models.QueuesSegmentOptions; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; - -public abstract class QueueServiceClientTestsBase extends TestBase { - String queueName; - TestHelpers helper; - - @Rule - public TestName testName = new TestName(); - - @Override - public String testName() { - return testName.getMethodName(); - } - - String getQueueName() { - return testResourceNamer.randomName("queue", 16).toLowerCase(); - } - - @Test - public abstract void getQueueDoesNotCreateAQueue(); - - @Test - public abstract void createQueue(); - - @Test - public abstract void createQueueWithMetadata(); - - @Test - public abstract void createQueueTwiceSameMetadata(); - - @Test - public abstract void createQueueTwiceDifferentMetadata(); - - @Test - public abstract void deleteExistingQueue(); - - @Test - public abstract void deleteNonExistentQueue(); - - @Test - public abstract void listQueues(); - - @Test - public abstract void listQueuesIncludeMetadata(); - - @Test - public abstract void listQueuesWithPrefix(); - - @Test - public abstract void listQueuesWithLimit(); - - @Test - public abstract void setProperties(); - - QueuesSegmentOptions defaultSegmentOptions() { - return new QueuesSegmentOptions().prefix(queueName); - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/TestHelpers.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/TestHelpers.java deleted file mode 100644 index 48639715112f..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/TestHelpers.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.http.rest.Response; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.queue.models.CorsRule; -import com.azure.storage.queue.models.Logging; -import com.azure.storage.queue.models.Metrics; -import com.azure.storage.queue.models.QueueItem; -import com.azure.storage.queue.models.RetentionPolicy; -import com.azure.storage.queue.models.SignedIdentifier; -import com.azure.storage.queue.models.StorageErrorException; -import com.azure.storage.queue.models.StorageServiceProperties; - -import java.time.Duration; -import java.util.List; -import java.util.function.BiFunction; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -/** - * Contains helper methods for unit tests. - */ -class TestHelpers { - private final String azureStorageConnectionString = "AZURE_STORAGE_CONNECTION_STRING"; - private final String azureStorageQueueEndpoint = "AZURE_STORAGE_QUEUE_ENDPOINT"; - - T setupClient(BiFunction clientBuilder, boolean isPlaybackMode, ClientLogger logger) { - String connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;AccountKey=atestaccountkey;EndpointSuffix=core.windows.net"; - String queueEndpoint = "https://teststorage.queue.core.windows.net/"; - - if (!isPlaybackMode) { - connectionString = ConfigurationManager.getConfiguration().get(azureStorageConnectionString); - queueEndpoint = ConfigurationManager.getConfiguration().get(azureStorageQueueEndpoint); - } - - if (ImplUtils.isNullOrEmpty(connectionString) && ImplUtils.isNullOrEmpty(queueEndpoint)) { - logger.warning("{} and {} must be set to build the testing client", azureStorageConnectionString, azureStorageQueueEndpoint); - fail(); - return null; - } - - return clientBuilder.apply(connectionString, queueEndpoint); - } - - void assertQueuesAreEqual(QueueItem expected, QueueItem actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.name(), actual.name()); - - if (expected.metadata() != null && !ImplUtils.isNullOrEmpty(actual.metadata())) { - assertEquals(expected.metadata(), actual.metadata()); - } - } - } - - void assertQueueServicePropertiesAreEqual(StorageServiceProperties expected, StorageServiceProperties actual) { - if (expected == null) { - assertNull(actual); - } else { - assertMetricsAreEqual(expected.hourMetrics(), actual.hourMetrics()); - assertMetricsAreEqual(expected.minuteMetrics(), actual.minuteMetrics()); - assertLoggingAreEqual(expected.logging(), actual.logging()); - assertCorsAreEqual(expected.cors(), actual.cors()); - } - } - - private void assertMetricsAreEqual(Metrics expected, Metrics actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.enabled(), actual.enabled()); - assertEquals(expected.includeAPIs(), actual.includeAPIs()); - assertEquals(expected.version(), actual.version()); - assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()); - } - } - - private void assertLoggingAreEqual(Logging expected, Logging actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.read(), actual.read()); - assertEquals(expected.write(), actual.write()); - assertEquals(expected.delete(), actual.delete()); - assertEquals(expected.version(), actual.version()); - assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()); - } - } - - private void assertRetentionPoliciesAreEqual(RetentionPolicy expected, RetentionPolicy actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.days(), actual.days()); - assertEquals(expected.enabled(), actual.enabled()); - } - } - - private void assertCorsAreEqual(List expected, List actual) { - if (expected == null) { - assertTrue(ImplUtils.isNullOrEmpty(actual)); - } else { - assertEquals(expected.size(), actual.size()); - for (int i = 0; i < expected.size(); i++) { - assertCorRulesAreEqual(expected.get(i), actual.get(i)); - } - } - } - - private void assertCorRulesAreEqual(CorsRule expected, CorsRule actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.allowedHeaders(), actual.allowedHeaders()); - assertEquals(expected.allowedMethods(), actual.allowedMethods()); - assertEquals(expected.allowedOrigins(), actual.allowedOrigins()); - assertEquals(expected.exposedHeaders(), actual.exposedHeaders()); - assertEquals(expected.maxAgeInSeconds(), actual.maxAgeInSeconds()); - } - } - - void assertPermissionsAreEqual(SignedIdentifier expected, SignedIdentifier actual) { - assertEquals(expected.id(), actual.id()); - assertEquals(expected.accessPolicy().permission(), actual.accessPolicy().permission()); - assertEquals(expected.accessPolicy().start(), actual.accessPolicy().start()); - assertEquals(expected.accessPolicy().expiry(), actual.accessPolicy().expiry()); - } - - void assertResponseStatusCode(Response response, int expectedStatusCode) { - assertEquals(expectedStatusCode, response.statusCode()); - } - - void assertExceptionStatusCode(Throwable throwable, int expectedStatusCode) { - assertTrue(throwable instanceof StorageErrorException); - StorageErrorException storageErrorException = (StorageErrorException) throwable; - assertEquals(expectedStatusCode, storageErrorException.response().statusCode()); - } - - void sleepInRecordMode(Duration duration) { - String azureTestMode = ConfigurationManager.getConfiguration().get("AZURE_TEST_MODE"); - if ("RECORD".equalsIgnoreCase(azureTestMode)) { - sleep(duration); - } - } - - void sleep(Duration duration) { - try { - Thread.sleep(duration.toMillis()); - } catch (InterruptedException ex) { - // Ignore the error - } - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/APISpec.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/APISpec.groovy new file mode 100644 index 000000000000..1850e439222f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/APISpec.groovy @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.core.test.InterceptorManager +import com.azure.core.test.TestMode +import com.azure.core.test.utils.TestResourceNamer +import com.azure.core.util.configuration.ConfigurationManager +import com.azure.core.util.logging.ClientLogger +import com.azure.storage.queue.QueueClientBuilder +import com.azure.storage.queue.QueueServiceAsyncClient +import com.azure.storage.queue.QueueServiceClient +import com.azure.storage.queue.QueueServiceClientBuilder +import com.azure.storage.queue.models.QueuesSegmentOptions +import spock.lang.Specification + +class APISpec extends Specification { + // Field common used for all APIs. + def logger = new ClientLogger(APISpec.class) + def AZURE_TEST_MODE = "AZURE_TEST_MODE" + def interceptorManager + def testResourceName + + // Clients for API tests + QueueServiceClient primaryQueueServiceClient + QueueServiceAsyncClient primaryQueueServiceAsyncClient + + + // Test name for test method name. + def methodName + def testMode = getTestMode() + def connectionString + + /** + * Setup the QueueServiceClient and QueueClient common used for the API tests. + */ + def setup() { + String testName = refactorName(specificationContext.currentIteration.getName()) + String className = specificationContext.getCurrentSpec().getName() + methodName = className + testName + logger.info("Test Mode: {}, Name: {}", testMode, methodName) + interceptorManager = new InterceptorManager(methodName, testMode) + testResourceName = new TestResourceNamer(methodName, testMode, + interceptorManager.getRecordedData()) + if (getTestMode() == TestMode.RECORD) { + connectionString = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_QUEUE_CONNECTION_STRING") + } else { + connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;AccountKey=atestaccountkey;" + + "EndpointSuffix=core.windows.net" + } + } + + /** + * Clean up the test queues and messages for the account. + */ + def cleanup() { + + interceptorManager.close() + if (getTestMode() == TestMode.RECORD) { + QueueServiceClient cleanupQueueServiceClient = new QueueServiceClientBuilder() + .connectionString(connectionString) + .buildClient() + cleanupQueueServiceClient.listQueues(new QueuesSegmentOptions().prefix(methodName.toLowerCase())).each { + queueItem -> cleanupQueueServiceClient.deleteQueue(queueItem.name()) + } + } + } + + /** + * Test mode is initialized whenever test is executed. Helper method which is used to determine what to do under + * certain test mode. + * @return The TestMode: + *
              + *
            • Playback: (default if no test mode setup)
            • + *
            + */ + def getTestMode() { + def azureTestMode = ConfigurationManager.getConfiguration().get(AZURE_TEST_MODE) + + if (azureTestMode != null) { + try { + return TestMode.valueOf(azureTestMode.toUpperCase(Locale.US)) + } catch (IllegalArgumentException e) { + logger.error("Could not parse '{}' into TestEnum. Using 'Playback' mode.", azureTestMode) + return TestMode.PLAYBACK + } + } + + logger.info("Environment variable '{}' has not been set yet. Using 'Playback' mode.", AZURE_TEST_MODE) + return TestMode.PLAYBACK + } + + def queueServiceBuilderHelper(final InterceptorManager interceptorManager) { + if (testMode == TestMode.RECORD) { + return new QueueServiceClientBuilder() + .connectionString(connectionString) + .addPolicy(interceptorManager.getRecordPolicy()) + } else { + return new QueueServiceClientBuilder() + .connectionString(connectionString) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + def queueBuilderHelper(final InterceptorManager interceptorManager) { + def queueName = testResourceName.randomName("queue", 16) + if (testMode == TestMode.RECORD) { + return new QueueClientBuilder() + .connectionString(connectionString) + .queueName(queueName) + .addPolicy(interceptorManager.getRecordPolicy()) + } else { + return new QueueClientBuilder() + .connectionString(connectionString) + .queueName(queueName) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + private def refactorName(String text) { + def fullName = text.split(" ").collect { it.capitalize() }.join("") + def matcher = (fullName =~ /(.*)(\[)(.*)(\])/) + + if (!matcher.find()) { + return fullName + } + return matcher[0][1] + matcher[0][3] + } +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAPITests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAPITests.groovy new file mode 100644 index 000000000000..6c4d52182aa0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAPITests.groovy @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.storage.queue.QueueClient +import com.azure.storage.queue.models.AccessPolicy +import com.azure.storage.queue.models.SignedIdentifier +import com.azure.storage.queue.models.StorageErrorCode +import com.azure.storage.queue.models.StorageErrorException +import reactor.test.StepVerifier +import spock.lang.Ignore +import spock.lang.Unroll + +import java.time.Duration +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class QueueAPITests extends APISpec { + QueueClient queueClient + + static def testMetadata = Collections.singletonMap("metadata", "value") + static def createMetadata = Collections.singletonMap("metadata1", "value") + + def setup() { + primaryQueueServiceClient = queueServiceBuilderHelper(interceptorManager).buildClient() + queueClient = primaryQueueServiceClient.getQueueClient(testResourceName.randomName(methodName, 60)) + } + + def "Create queue with shared key"() { + expect: + QueueTestHelper.assertResponseStatusCode(queueClient.createWithResponse(null, null), 201) + } + + // TODO: Will implement the test after introduce the sas token generator + @Ignore + def "Create queue with sas token"() { + + } + + def "Delete exist queue"() { + given: + queueClient.create() + when: + def deleteQueueResponse = queueClient.deleteWithResponse(null) + then: + QueueTestHelper.assertResponseStatusCode(deleteQueueResponse, 204) + + } + + def "Delete queue error"() { + when: + queueClient.delete() + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + def "Get properties"() { + given: + queueClient.createWithResponse(testMetadata, null) + when: + def getPropertiesResponse = queueClient.getPropertiesWithResponse(null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.value().approximateMessagesCount() == 0 + testMetadata.equals(getPropertiesResponse.value().metadata()) + } + + def "Get properties error"() { + when: + queueClient.getProperties() + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + @Unroll + def "Set and clear metadata"() { + given: + queueClient.createWithResponse(matadataInCreate, null) + when: + def getPropertiesResponseBefore = queueClient.getPropertiesWithResponse(null) + def setMetadataResponse = queueClient.setMetadataWithResponse(metadataInSet, null) + def getPropertiesResponseAfter = queueClient.getPropertiesWithResponse(null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponseBefore, 200) + expectMetadataInCreate.equals(getPropertiesResponseBefore.value().metadata()) + QueueTestHelper.assertResponseStatusCode(setMetadataResponse, 204) + QueueTestHelper.assertResponseStatusCode(getPropertiesResponseAfter, 200) + expectMetadataInSet.equals(getPropertiesResponseAfter.value().metadata) + where: + matadataInCreate | metadataInSet | expectMetadataInCreate | expectMetadataInSet + null | testMetadata | Collections.emptyMap() | testMetadata + createMetadata | testMetadata | createMetadata | testMetadata + createMetadata | null | createMetadata | Collections.emptyMap() + testMetadata | testMetadata | testMetadata | testMetadata + null | null | Collections.emptyMap() | Collections.emptyMap() + } + + def "Set metadata queue error"() { + when: + queueClient.setMetadata(testMetadata) + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + @Unroll + def "Set invalid meta"() { + given: + def invalidMetadata = Collections.singletonMap(invalidKey, "value") + queueClient.create() + when: + queueClient.setMetadata(invalidMetadata) + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMessage) + where: + invalidKey | statusCode | errMessage + "invalidMeta" | 403 | StorageErrorCode.fromString("AuthenticationError") // TODO (alzimmer): Get this enum into the Swagger + "invalid-meta" | 400 | StorageErrorCode.INVALID_METADATA + "12345" | 400 | StorageErrorCode.INVALID_METADATA + "" | 400 | StorageErrorCode.EMPTY_METADATA_KEY + } + + def "Get access policy"() { + given: + queueClient.create() + when: + def accessPolicies = queueClient.getAccessPolicy() + then: + !accessPolicies.iterator().hasNext() + } + + def "Get access policy error"() { + when: + queueClient.getAccessPolicy().iterator().next() + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + def "Set access policy"() { + given: + queueClient.create() + def accessPolicy = new AccessPolicy() + .permission("raup") + .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + def permission = new SignedIdentifier() + .id("testpermission") + .accessPolicy(accessPolicy) + when: + def setAccessPolicyResponse = queueClient.setAccessPolicyWithResponse(Collections.singletonList(permission), null) + def nextAccessPolicy = queueClient.getAccessPolicy().iterator().next() + then: + QueueTestHelper.assertResponseStatusCode(setAccessPolicyResponse, 204) + QueueTestHelper.assertPermissionsAreEqual(permission, nextAccessPolicy) + } + + def "Set invalid access policy"() { + given: + def accessPolicy = new AccessPolicy() + .permission("r") + .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permission = new SignedIdentifier() + .id("theidofthispermissionislongerthanwhatisallowedbytheserviceandshouldfail") + .accessPolicy(accessPolicy) + queueClient.create() + when: + queueClient.setAccessPolicy(Collections.singletonList(permission)) + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.INVALID_XML_DOCUMENT) + } + + def "Set multiple access policies"() { + given: + def accessPolicy = new AccessPolicy() + .permission("r") + .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 3; i++) { + permissions.add(new SignedIdentifier() + .id("policy" + i) + .accessPolicy(accessPolicy)) + } + queueClient.create() + when: + def setAccessPolicyResponse = queueClient.setAccessPolicyWithResponse(permissions, null) + def nextAccessPolicy = queueClient.getAccessPolicy().iterator() + then: + QueueTestHelper.assertResponseStatusCode(setAccessPolicyResponse, 204) + QueueTestHelper.assertPermissionsAreEqual(permissions[0], nextAccessPolicy.next()) + QueueTestHelper.assertPermissionsAreEqual(permissions[1], nextAccessPolicy.next()) + QueueTestHelper.assertPermissionsAreEqual(permissions[2], nextAccessPolicy.next()) + !nextAccessPolicy.hasNext() + } + + def "Set too many access policies"() { + given: + def accessPolicy = new AccessPolicy() + .permission("r") + .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 6; i++) { + permissions.add(new SignedIdentifier() + .id("policy" + i) + .accessPolicy(accessPolicy)) + } + queueClient.create() + when: + queueClient.setAccessPolicyWithResponse(permissions, null) + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.INVALID_XML_DOCUMENT) + } + + def "Enqueue message"() { + given: + queueClient.create() + def expectMsg = "test message" + when: + def enqueueMsgResponse = queueClient.enqueueMessageWithResponse(expectMsg, null, null, null) + def peekMsgIter = queueClient.peekMessages().iterator() + then: + QueueTestHelper.assertResponseStatusCode(enqueueMsgResponse, 201) + expectMsg.equals(peekMsgIter.next().messageText()) + !peekMsgIter.hasNext() + } + + def "Enqueue empty message"() { + given: + queueClient.create() + def expectMsg = "" + when: + def enqueueMsgResponse = queueClient.enqueueMessageWithResponse(expectMsg, null, null, null) + def peekMsgIter = queueClient.peekMessages().iterator() + then: + QueueTestHelper.assertResponseStatusCode(enqueueMsgResponse, 201) + peekMsgIter.next().messageText() == null + !peekMsgIter.hasNext() + } + + def "Enqueue time to live"() { + given: + queueClient.create() + when: + def enqueueMsgResponse = queueClient.enqueueMessageWithResponse("test message", + Duration.ofSeconds(0), Duration.ofSeconds(2), null) + then: + QueueTestHelper.assertResponseStatusCode(enqueueMsgResponse, 201) + } + + def "Dequeue message"() { + given: + queueClient.create() + def expectMsg = "test message" + queueClient.enqueueMessage(expectMsg) + when: + def dequeueMsgResponse = queueClient.dequeueMessages().iterator().next() + then: + expectMsg.equals(dequeueMsgResponse.messageText()) + } + + def "Dequeue multiple messages"() { + given: + queueClient.create() + def expectMsg1 = "test message 1" + def expectMsg2 = "test message 2" + queueClient.enqueueMessage(expectMsg1) + queueClient.enqueueMessage(expectMsg2) + when: + def dequeueMsgIter = queueClient.dequeueMessages(2).iterator() + then: + expectMsg1.equals(dequeueMsgIter.next().messageText()) + expectMsg2.equals(dequeueMsgIter.next().messageText()) + } + + def "Dequeue too many message"() { + given: + queueClient.create() + when: + queueClient.dequeueMessages(33).iterator().next() + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.OUT_OF_RANGE_QUERY_PARAMETER_VALUE) + } + + def "Peek message"() { + given: + queueClient.create() + def expectMsg = "test message" + queueClient.enqueueMessage(expectMsg) + when: + def peekMsgIter = queueClient.peekMessages().iterator().next() + then: + expectMsg.equals(peekMsgIter.messageText()) + } + + def "Peek multiple messages"() { + given: + queueClient.create() + def expectMsg1 = "test message 1" + def expectMsg2 = "test message 2" + queueClient.enqueueMessage(expectMsg1) + queueClient.enqueueMessage(expectMsg2) + when: + def peekMsgIter = queueClient.peekMessages(2).iterator() + then: + expectMsg1.equals(peekMsgIter.next().messageText()) + expectMsg2.equals(peekMsgIter.next().messageText()) + !peekMsgIter.hasNext() + } + + def "Peek too many message"() { + given: + queueClient.create() + when: + queueClient.peekMessages(33).iterator().next() + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.OUT_OF_RANGE_QUERY_PARAMETER_VALUE) + } + + def "Peek messages error"() { + when: + queueClient.peekMessages().iterator().next() + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + def "Clear messages"() { + given: + queueClient.create() + queueClient.enqueueMessage("test message 1") + queueClient.enqueueMessage("test message 2") + queueClient.enqueueMessage("test message 3") + when: + def getPropertiesResponse = queueClient.getPropertiesWithResponse(null) + def clearMsgResponse = queueClient.clearMessagesWithResponse(null) + def getPropertiesAfterResponse = queueClient.getPropertiesWithResponse(null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.value().approximateMessagesCount() == 3 + QueueTestHelper.assertResponseStatusCode(clearMsgResponse, 204) + QueueTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200) + getPropertiesAfterResponse.value().approximateMessagesCount() == 0 + } + + def "Clear messages error"() { + when: + StepVerifier.create(queueClient.clearMessagesWithResponse(null)) + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + def "Delete message"() { + given: + queueClient.create() + queueClient.enqueueMessage("test message 1") + queueClient.enqueueMessage("test message 2") + queueClient.enqueueMessage("test message 3") + def dequeueMsg = queueClient.dequeueMessages().iterator().next() + when: + def getPropertiesResponse = queueClient.getPropertiesWithResponse(null) + def deleteMsgResponse = queueClient.deleteMessageWithResponse(dequeueMsg.messageId(), dequeueMsg.popReceipt(), null) + def getPropertiesAfterResponse = queueClient.getPropertiesWithResponse(null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.value().approximateMessagesCount() == 3 + QueueTestHelper.assertResponseStatusCode(deleteMsgResponse, 204) + QueueTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200) + getPropertiesAfterResponse.value().approximateMessagesCount() == 2 + } + + @Unroll + def "Delete message invalid args"() { + given: + queueClient.create() + def expectMsg = "test message" + queueClient.enqueueMessage(expectMsg) + def dequeueMessageIter = queueClient.dequeueMessages().iterator().next() + when: + def deleteMessageId = messageId ? dequeueMessageIter.messageId() : dequeueMessageIter.messageId() + "Random" + def deletePopReceipt = popReceipt ? dequeueMessageIter.popReceipt() : dequeueMessageIter.popReceipt() + "Random" + queueClient.deleteMessage(deleteMessageId, deletePopReceipt) + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + messageId | popReceipt | statusCode | errMsg + true | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + false | true | 404 | StorageErrorCode.MESSAGE_NOT_FOUND + false | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + } + + def "Update message"() { + given: + def updateMsg = "Updated test message" + queueClient.create() + queueClient.enqueueMessage("test message before update") + + def dequeueMsg = queueClient.dequeueMessages().iterator().next() + when: + def updateMsgResponse = queueClient.updateMessageWithResponse(updateMsg, + dequeueMsg.messageId(), dequeueMsg.popReceipt(), Duration.ofSeconds(1), null) + QueueTestHelper.sleepInRecord(Duration.ofSeconds(2)) + def peekMsgIter = queueClient.peekMessages().iterator().next() + then: + QueueTestHelper.assertResponseStatusCode(updateMsgResponse, 204) + updateMsg.equals(peekMsgIter.messageText()) + } + + @Unroll + def "Update message invalid args"() { + given: + queueClient.create() + def updateMsg = "Updated test message" + queueClient.enqueueMessage("test message before update") + def dequeueMessageIter = queueClient.dequeueMessages().iterator().next() + when: + def updateMessageId = messageId ? dequeueMessageIter.messageId() : dequeueMessageIter.messageId() + "Random" + def updatePopReceipt = popReceipt ? dequeueMessageIter.popReceipt() : dequeueMessageIter.popReceipt() + "Random" + queueClient.updateMessage(updateMsg, updateMessageId, updatePopReceipt, Duration.ofSeconds(1)) + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + messageId | popReceipt | statusCode | errMsg + true | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + false | true | 404 | StorageErrorCode.MESSAGE_NOT_FOUND + false | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + } + +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAysncAPITests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAysncAPITests.groovy new file mode 100644 index 000000000000..6ba80346e98e --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAysncAPITests.groovy @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.storage.queue.QueueAsyncClient +import com.azure.storage.queue.models.AccessPolicy +import com.azure.storage.queue.models.SignedIdentifier +import com.azure.storage.queue.models.StorageErrorCode +import reactor.test.StepVerifier +import spock.lang.Ignore +import spock.lang.Unroll + +import java.time.Duration +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class QueueAysncAPITests extends APISpec { + QueueAsyncClient queueAsyncClient + + static def testMetadata = Collections.singletonMap("metadata", "value") + static def createMetadata = Collections.singletonMap("metadata1", "value") + + def setup() { + primaryQueueServiceAsyncClient = queueServiceBuilderHelper(interceptorManager).buildAsyncClient() + queueAsyncClient = primaryQueueServiceAsyncClient.getQueueAsyncClient(testResourceName.randomName(methodName, 60)) + } + + def "Create queue with shared key"() { + expect: + StepVerifier.create(queueAsyncClient.createWithResponse(null)).assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) } + .verifyComplete() + } + + // TODO: Will implement the test after introduce the sas token generator + @Ignore + def "Create queue with sas token"() { + + } + + def "Delete exist queue"() { + given: + queueAsyncClient.createWithResponse(null).block() + when: + def deleteQueueVerifier = StepVerifier.create(queueAsyncClient.deleteWithResponse()) + then: + deleteQueueVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) } + .verifyComplete() + } + + def "Delete queue error"() { + when: + def deleteQueueVerifier = StepVerifier.create(queueAsyncClient.deleteWithResponse()) + then: + deleteQueueVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + def "Get properties"() { + given: + queueAsyncClient.createWithResponse(testMetadata).block() + when: + def getPropertiesVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.value().approximateMessagesCount() == 0 + assert testMetadata.equals(it.value().metadata()) + }.verifyComplete() + } + + def "Get properties error"() { + when: + def getPropertiesVerifier = StepVerifier.create(queueAsyncClient.getProperties()) + then: + getPropertiesVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + @Unroll + def "Set and clear metadata"() { + given: + queueAsyncClient.createWithResponse(matadataInCreate).block() + when: + def getPropertiesVerifierBefore = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + def setMetadataVerifier = StepVerifier.create(queueAsyncClient.setMetadataWithResponse(metadataInSet)) + def getPropertiesVerifierAfter = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifierBefore.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert expectMetadataInCreate.equals(it.value().metadata()) + }.verifyComplete() + setMetadataVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) } + .verifyComplete() + getPropertiesVerifierAfter.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert expectMetadataInSet.equals(it.value().metadata) + }.verifyComplete() + where: + matadataInCreate | metadataInSet | expectMetadataInCreate | expectMetadataInSet + null | testMetadata | Collections.emptyMap() | testMetadata + createMetadata | testMetadata | createMetadata | testMetadata + createMetadata | null | createMetadata | Collections.emptyMap() + testMetadata | testMetadata | testMetadata | testMetadata + null | null | Collections.emptyMap() | Collections.emptyMap() + } + + def "Set metadata queue error"() { + when: + def setMetadataVerifier = StepVerifier.create(queueAsyncClient.setMetadataWithResponse(testMetadata)) + then: + setMetadataVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + @Unroll + def "Set invalid meta"() { + given: + def invalidMetadata = Collections.singletonMap(invalidKey, "value") + queueAsyncClient.create().block() + when: + def setMetadataVerifier = StepVerifier.create(queueAsyncClient.setMetadataWithResponse(invalidMetadata)) + then: + setMetadataVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMessage) + } + where: + invalidKey | statusCode | errMessage + "invalidMeta" | 403 | StorageErrorCode.fromString("AuthenticationError") // TODO (alzimmer): Get this enum into the Swagger + "invalid-meta" | 400 | StorageErrorCode.INVALID_METADATA + "12345" | 400 | StorageErrorCode.INVALID_METADATA + "" | 400 | StorageErrorCode.EMPTY_METADATA_KEY + } + + def "Get access policy"() { + given: + queueAsyncClient.create().block() + when: + def getAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.getAccessPolicy()) + then: + getAccessPolicyVerifier.verifyComplete() + } + + def "Get access policy does error"() { + when: + def getAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.getAccessPolicy()) + then: + getAccessPolicyVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + def "Set access policy"() { + given: + queueAsyncClient.create().block() + def accessPolicy = new AccessPolicy() + .permission("raup") + .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + def permission = new SignedIdentifier() + .id("testpermission") + .accessPolicy(accessPolicy) + when: + def setAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.setAccessPolicyWithResponse(Collections.singletonList(permission))) + def getAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.getAccessPolicy()) + then: + setAccessPolicyVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + getAccessPolicyVerifier.assertNext { + assert QueueTestHelper.assertPermissionsAreEqual(permission, it) + }.verifyComplete() + } + + def "Set invalid access policy"() { + given: + def accessPolicy = new AccessPolicy() + .permission("r") + .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permission = new SignedIdentifier() + .id("theidofthispermissionislongerthanwhatisallowedbytheserviceandshouldfail") + .accessPolicy(accessPolicy) + queueAsyncClient.create().block() + when: + def setAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.setAccessPolicyWithResponse(Collections.singletonList(permission))) + then: + setAccessPolicyVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.INVALID_XML_DOCUMENT) + } + } + + def "Set multiple access policies"() { + given: + def accessPolicy = new AccessPolicy() + .permission("r") + .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 3; i++) { + permissions.add(new SignedIdentifier() + .id("policy" + i) + .accessPolicy(accessPolicy)) + } + queueAsyncClient.create().block() + when: + def setAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.setAccessPolicyWithResponse(permissions)) + def getAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.getAccessPolicy()) + then: + setAccessPolicyVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + getAccessPolicyVerifier.assertNext { + assert QueueTestHelper.assertPermissionsAreEqual(permissions[0], it) + }.assertNext { + assert QueueTestHelper.assertPermissionsAreEqual(permissions[1], it) + }.assertNext { + assert QueueTestHelper.assertPermissionsAreEqual(permissions[2], it) + }.verifyComplete() + } + + def "Set too many access policies"() { + given: + def accessPolicy = new AccessPolicy() + .permission("r") + .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 6; i++) { + permissions.add(new SignedIdentifier() + .id("policy" + i) + .accessPolicy(accessPolicy)) + } + queueAsyncClient.create().block() + when: + def setAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.setAccessPolicyWithResponse(permissions)) + then: + setAccessPolicyVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.INVALID_XML_DOCUMENT) + } + } + + def "Enqueue message"() { + given: + queueAsyncClient.create().block() + def expectMsg = "test message" + when: + def enqueueMsgVerifier = StepVerifier.create(queueAsyncClient.enqueueMessageWithResponse(expectMsg, null, null)) + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages()) + then: + enqueueMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + peekMsgVerifier.assertNext { + assert expectMsg.equals(it.messageText()) + assert !it.hasNext() + } + } + + def "Enqueue empty message"() { + given: + queueAsyncClient.create().block() + when: + def enqueueMsgVerifier = StepVerifier.create(queueAsyncClient.enqueueMessageWithResponse("", null, null)) + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages()) + then: + enqueueMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + peekMsgVerifier.assertNext { + assert it.messageText() == null + assert !it.hasNext() + } + } + + def "Enqueue time to live"() { + given: + queueAsyncClient.create().block() + when: + def enqueueMsgVerifier = StepVerifier.create(queueAsyncClient.enqueueMessageWithResponse("test message", + Duration.ofSeconds(0), Duration.ofSeconds(2))) + then: + enqueueMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Dequeue message"() { + given: + queueAsyncClient.create().block() + def expectMsg = "test message" + queueAsyncClient.enqueueMessage(expectMsg).block() + when: + def dequeueMsgVerifier = StepVerifier.create(queueAsyncClient.dequeueMessages()) + then: + dequeueMsgVerifier.assertNext { + assert expectMsg.equals(it.messageText()) + }.verifyComplete() + } + + def "Dequeue multiple messages"() { + given: + queueAsyncClient.create().block() + def expectMsg1 = "test message 1" + def expectMsg2 = "test message 2" + queueAsyncClient.enqueueMessage(expectMsg1).block() + queueAsyncClient.enqueueMessage(expectMsg2).block() + when: + def dequeueMsgVerifier = StepVerifier.create(queueAsyncClient.dequeueMessages(2)) + then: + dequeueMsgVerifier.assertNext { + assert expectMsg1.equals(it.messageText()) + }.assertNext { + assert expectMsg2.equals(it.messageText()) + }.verifyComplete() + } + + def "Dequeue too many message"() { + given: + queueAsyncClient.create().block() + when: + def dequeueMsgVerifier = StepVerifier.create(queueAsyncClient.dequeueMessages(33)) + then: + dequeueMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.OUT_OF_RANGE_QUERY_PARAMETER_VALUE) + } + } + + def "Peek message"() { + given: + queueAsyncClient.create().block() + def expectMsg = "test message" + queueAsyncClient.enqueueMessage(expectMsg).block() + when: + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages()) + then: + peekMsgVerifier.assertNext { + assert expectMsg.equals(it.messageText()) + }.verifyComplete() + } + + def "Peek multiple messages"() { + given: + queueAsyncClient.create().block() + def expectMsg1 = "test message 1" + def expectMsg2 = "test message 2" + queueAsyncClient.enqueueMessage(expectMsg1).block() + queueAsyncClient.enqueueMessage(expectMsg2).block() + when: + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages(2)) + then: + peekMsgVerifier.assertNext { + assert expectMsg1.equals(it.messageText()) + }.assertNext { + assert expectMsg2.equals(it.messageText()) + }.verifyComplete() + } + + def "Peek too many message"() { + given: + queueAsyncClient.create().block() + when: + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages(33)) + then: + peekMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.OUT_OF_RANGE_QUERY_PARAMETER_VALUE) + } + } + + def "Peek messages error"() { + when: + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages()) + then: + peekMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + def "Clear messages"() { + given: + queueAsyncClient.create().block() + queueAsyncClient.enqueueMessage("test message 1").block() + queueAsyncClient.enqueueMessage("test message 2").block() + queueAsyncClient.enqueueMessage("test message 3").block() + when: + def getPropertiesVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + def clearMsgVerifier = StepVerifier.create(queueAsyncClient.clearMessagesWithResponse()) + def getPropertiesAfterVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.value().approximateMessagesCount() == 3 + }.verifyComplete() + clearMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + getPropertiesAfterVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.value().approximateMessagesCount() == 0 + }.verifyComplete() + } + + def "Clear messages error"() { + when: + def clearMsgVerifier = StepVerifier.create(queueAsyncClient.clearMessagesWithResponse()) + then: + clearMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + def "Delete message"() { + given: + queueAsyncClient.create().block() + queueAsyncClient.enqueueMessage("test message 1").block() + queueAsyncClient.enqueueMessage("test message 2").block() + queueAsyncClient.enqueueMessage("test message 3").block() + def dequeueMsg = queueAsyncClient.dequeueMessages().blockFirst() + when: + def getPropertiesVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + def deleteMsgVerifier = StepVerifier.create(queueAsyncClient.deleteMessageWithResponse(dequeueMsg.messageId(), dequeueMsg.popReceipt())) + def getPropertiesAfterVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.value().approximateMessagesCount() == 3 + + }.verifyComplete() + deleteMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + getPropertiesAfterVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.value().approximateMessagesCount() == 2 + }.verifyComplete() + } + + @Unroll + def "Delete message invalid args"() { + given: + queueAsyncClient.create().block() + def expectMsg = "test message" + queueAsyncClient.enqueueMessage(expectMsg).block() + def dequeueMessage = queueAsyncClient.dequeueMessages().blockFirst() + when: + def deleteMessageId = messageId ? dequeueMessage.messageId() : dequeueMessage.messageId() + "Random" + def deletePopReceipt = popReceipt ? dequeueMessage.popReceipt() : dequeueMessage.popReceipt() + "Random" + def deleteMsgVerifier = StepVerifier.create(queueAsyncClient.deleteMessageWithResponse(deleteMessageId, deletePopReceipt)) + then: + deleteMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + messageId | popReceipt | statusCode | errMsg + true | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + false | true | 404 | StorageErrorCode.MESSAGE_NOT_FOUND + false | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + } + + def "Update message"() { + given: + def updateMsg = "Updated test message" + queueAsyncClient.create().block() + queueAsyncClient.enqueueMessage("test message before update").block() + + def dequeueMsg = queueAsyncClient.dequeueMessages().blockFirst() + when: + def updateMsgVerifier = StepVerifier.create(queueAsyncClient.updateMessageWithResponse(updateMsg, + dequeueMsg.messageId(), dequeueMsg.popReceipt(), Duration.ofSeconds(1))) + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages().delaySubscription(Duration.ofSeconds(2))) + then: + updateMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + peekMsgVerifier.assertNext { + assert updateMsg.equals(it.messageText()) + }.verifyComplete() + } + + @Unroll + def "Update message invalid args"() { + given: + queueAsyncClient.create().block() + def updateMsg = "Updated test message" + queueAsyncClient.enqueueMessage("test message before update").block() + def dequeueMessage = queueAsyncClient.dequeueMessages().blockFirst() + when: + def updateMessageId = messageId ? dequeueMessage.messageId() : dequeueMessage.messageId() + "Random" + def updatePopReceipt = popReceipt ? dequeueMessage.popReceipt() : dequeueMessage.popReceipt() + "Random" + def updateMsgVerifier = StepVerifier.create(queueAsyncClient.updateMessageWithResponse(updateMsg, updateMessageId, updatePopReceipt, Duration.ofSeconds(1))) + then: + updateMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + messageId | popReceipt | statusCode | errMsg + true | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + false | true | 404 | StorageErrorCode.MESSAGE_NOT_FOUND + false | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + } + +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAPITests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAPITests.groovy new file mode 100644 index 000000000000..1f7db444461d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAPITests.groovy @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.storage.queue.QueueClient +import com.azure.storage.queue.models.Logging +import com.azure.storage.queue.models.Metrics +import com.azure.storage.queue.models.QueueItem +import com.azure.storage.queue.models.QueuesSegmentOptions +import com.azure.storage.queue.models.RetentionPolicy +import com.azure.storage.queue.models.StorageErrorCode +import com.azure.storage.queue.models.StorageErrorException +import com.azure.storage.queue.models.StorageServiceProperties +import spock.lang.Unroll + +class QueueServiceAPITests extends APISpec { + + def setup() { + primaryQueueServiceClient = queueServiceBuilderHelper(interceptorManager).buildClient() + } + + def "Get queue client"() { + given: + def queueClient = primaryQueueServiceClient.getQueueClient(testResourceName.randomName(methodName, 60)) + expect: + queueClient instanceof QueueClient + } + + def "Create queue"() { + when: + def queueClientResponse = primaryQueueServiceClient.createQueueWithResponse(testResourceName.randomName(methodName, 60), null, null) + def enqueueMessageResponse = queueClientResponse.value().enqueueMessageWithResponse("Testing service client creating a queue", null, null, null) + then: + QueueTestHelper.assertResponseStatusCode(queueClientResponse, 201) + QueueTestHelper.assertResponseStatusCode(enqueueMessageResponse, 201) + } + + @Unroll + def "Create queue with invalid name"() { + when: + primaryQueueServiceClient.createQueue(queueName) + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMesage) + where: + queueName | statusCode | errMesage + "a_b" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "-ab" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "a--b" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "Abc" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "ab" | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + "verylong" * 8 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + } + + def "Create null"() { + when: + primaryQueueServiceClient.createQueue(null) + then: + thrown(NullPointerException) + } + + @Unroll + def "Create queue maxOverload"() { + when: + def queueClientResponse = primaryQueueServiceClient.createQueueWithResponse(testResourceName.randomName(methodName, 60), metadata, null) + def enqueueMessageResponse = queueClientResponse.value().enqueueMessageWithResponse("Testing service client creating a queue", null, null, null) + then: + QueueTestHelper.assertResponseStatusCode(queueClientResponse, 201) + QueueTestHelper.assertResponseStatusCode(enqueueMessageResponse, 201) + where: + metadata | _ + null | _ + Collections.singletonMap("metadata", "value") | _ + Collections.singletonMap("metadata", "va@lue") | _ + } + + def "Create queue with invalid metadata"() { + given: + def queueName = testResourceName.randomName(methodName, 16) + when: + primaryQueueServiceClient.createQueueWithResponse(queueName, Collections.singletonMap("meta@data", "value"), null) + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 400, "Bad Request") + } + + def "Delete queue"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + when: + def queueClient = primaryQueueServiceClient.createQueue(queueName) + def deleteQueueResponse = primaryQueueServiceClient.deleteQueueWithResponse(queueName, null) + queueClient.enqueueMessage("Expecting exception as queue has been deleted.") + then: + QueueTestHelper.assertResponseStatusCode(deleteQueueResponse, 204) + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + def "Delete queue error"() { + when: + primaryQueueServiceClient.deleteQueueWithResponse(testResourceName.randomName(methodName, 60), null) + then: + def e = thrown(StorageErrorException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + @Unroll + def "List queues"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + LinkedList testQueues = new LinkedList<>() + for (int i = 0; i < 3; i++) { + String version = Integer.toString(i) + QueueItem queue = new QueueItem().name(queueName + version) + .metadata(Collections.singletonMap("metadata" + version, "value" + version)) + testQueues.add(queue) + primaryQueueServiceClient.createQueueWithResponse(queue.name(), queue.metadata(), null) + } + when: + def queueListIter = primaryQueueServiceClient.listQueues(options) + then: + queueListIter.each { + QueueTestHelper.assertQueuesAreEqual(it, testQueues.pop()) + primaryQueueServiceClient.deleteQueue(it.name()) + } + testQueues.size() == 0 + where: + options | _ + new QueuesSegmentOptions().prefix("queueserviceapitestslistqueues") | _ + new QueuesSegmentOptions().prefix("queueserviceapitestslistqueues").maxResults(2) | _ + new QueuesSegmentOptions().prefix("queueserviceapitestslistqueues").includeMetadata(true) | _ + } + + def "List empty queues"() { + when: + primaryQueueServiceClient.getQueueClient(testResourceName.randomName(methodName, 60)) + then: + !primaryQueueServiceClient.listQueues(new QueuesSegmentOptions().prefix(methodName)).iterator().hasNext() + } + + def "Get and set properties"() { + given: + def originalProperties = primaryQueueServiceClient.getProperties() + def retentionPolicy = new RetentionPolicy().enabled(true) + .days(3) + def logging = new Logging().version("1.0") + .delete(true) + .write(true) + .retentionPolicy(retentionPolicy) + def metrics = new Metrics().enabled(true) + .includeAPIs(false) + .retentionPolicy(retentionPolicy) + .version("1.0") + def updatedProperties = new StorageServiceProperties().logging(logging) + .hourMetrics(metrics) + .minuteMetrics(metrics) + .cors(new ArrayList<>()) + + when: + def getResponseBefore = primaryQueueServiceClient.getProperties() + def setResponse = primaryQueueServiceClient.setPropertiesWithResponse(updatedProperties, null) + def getResponseAfter = primaryQueueServiceClient.getProperties() + then: + QueueTestHelper.assertQueueServicePropertiesAreEqual(originalProperties, getResponseBefore) + QueueTestHelper.assertResponseStatusCode(setResponse, 202) + QueueTestHelper.assertQueueServicePropertiesAreEqual(updatedProperties, getResponseAfter) + } +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAsyncAPITests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAsyncAPITests.groovy new file mode 100644 index 000000000000..a564010596e1 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAsyncAPITests.groovy @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.storage.queue.QueueAsyncClient +import com.azure.storage.queue.models.Logging +import com.azure.storage.queue.models.Metrics +import com.azure.storage.queue.models.QueueItem +import com.azure.storage.queue.models.QueuesSegmentOptions +import com.azure.storage.queue.models.RetentionPolicy +import com.azure.storage.queue.models.StorageErrorCode +import com.azure.storage.queue.models.StorageServiceProperties +import reactor.test.StepVerifier +import spock.lang.Unroll + +class QueueServiceAsyncAPITests extends APISpec { + + def setup() { + primaryQueueServiceAsyncClient = queueServiceBuilderHelper(interceptorManager).buildAsyncClient() + } + + def "Get queue client"() { + given: + def queueAsyncClient = primaryQueueServiceAsyncClient.getQueueAsyncClient(testResourceName.randomName(methodName, 60)) + expect: + queueAsyncClient instanceof QueueAsyncClient + } + + def "Create queue"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + expect: + StepVerifier.create(primaryQueueServiceAsyncClient.createQueueWithResponse(queueName, null)).assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + StepVerifier.create(primaryQueueServiceAsyncClient.getQueueAsyncClient(queueName).enqueueMessageWithResponse("Testing service client creating a queue", null, null)) + .assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create queue with invalid name"() { + when: + def createQueueVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.createQueue(queueName)) + then: + createQueueVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMesage) + } + where: + queueName | statusCode | errMesage + "a_b" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "-ab" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "a--b" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "Abc" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "ab" | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + "verylong" * 8 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + } + + def "Create null"() { + when: + primaryQueueServiceAsyncClient.createQueue(null) + then: + thrown(NullPointerException) + } + + @Unroll + def "Create queue maxOverload"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + when: + def createQueueVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.createQueueWithResponse(queueName, metadata)) + def enqueueMessageVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.getQueueAsyncClient(queueName) + .enqueueMessageWithResponse("Testing service client creating a queue", null, null)) + then: + createQueueVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + enqueueMessageVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + + + where: + metadata | _ + null | _ + Collections.singletonMap("metadata", "value") | _ + Collections.singletonMap("metadata", "va@lue") | _ + } + + def "Create queue with invalid metadata"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + when: + def createQueueVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.createQueueWithResponse(queueName, Collections.singletonMap("meta@data", "value"))) + then: + createQueueVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 400, "Bad Request") + } + } + + def "Delete queue"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + primaryQueueServiceAsyncClient.createQueue(queueName).block() + when: + def deleteQueueVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.deleteQueueWithResponse(queueName)) + def enqueueMessageVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.getQueueAsyncClient(queueName) + .enqueueMessageWithResponse("Expecting exception as queue has been deleted.", null, null)) + then: + deleteQueueVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + enqueueMessageVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + def "Delete queue error"() { + when: + def deleteQueueVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.deleteQueueWithResponse(testResourceName.randomName(methodName, 16))) + then: + deleteQueueVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + @Unroll + def "List queues"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + LinkedList testQueues = new LinkedList<>() + for (int i = 0; i < 3; i++) { + String version = Integer.toString(i) + QueueItem queue = new QueueItem().name(queueName + version) + .metadata(Collections.singletonMap("metadata" + version, "value" + version)) + testQueues.add(queue) + primaryQueueServiceAsyncClient.createQueueWithResponse(queue.name(), queue.metadata()).block() + } + when: + def queueListVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.listQueues(options)) + then: + queueListVerifier.assertNext { + assert QueueTestHelper.assertQueuesAreEqual(it, testQueues.pop()) + }.assertNext { + assert QueueTestHelper.assertQueuesAreEqual(it, testQueues.pop()) + }.assertNext { + assert QueueTestHelper.assertQueuesAreEqual(it, testQueues.pop()) + }.verifyComplete() + where: + options | _ + new QueuesSegmentOptions().prefix("queueserviceasyncapitestslistqueues") | _ + new QueuesSegmentOptions().prefix("queueserviceasyncapitestslistqueues").maxResults(2) | _ + new QueuesSegmentOptions().prefix("queueserviceasyncapitestslistqueues").includeMetadata(true) | _ + } + + def "List empty queues"() { + when: + def listQueueVerifier = StepVerifier.create((primaryQueueServiceAsyncClient.listQueues(new QueuesSegmentOptions()))) + then: + listQueueVerifier.assertNext { + !it.iterator().hasNext() + } + } + + def "Get and set properties"() { + given: + def originalProperties = primaryQueueServiceAsyncClient.getProperties().block() + def retentionPolicy = new RetentionPolicy().enabled(true) + .days(3) + def logging = new Logging().version("1.0") + .delete(true) + .write(true) + .retentionPolicy(retentionPolicy) + def metrics = new Metrics().enabled(true) + .includeAPIs(false) + .retentionPolicy(retentionPolicy) + .version("1.0") + def updatedProperties = new StorageServiceProperties().logging(logging) + .hourMetrics(metrics) + .minuteMetrics(metrics) + .cors(new ArrayList<>()) + when: + def getPropertiesBeforeVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.getProperties()) + def setPropertiesVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.setPropertiesWithResponse(updatedProperties)) + def getPropertiesAfterVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.getProperties()) + then: + getPropertiesBeforeVerifier.assertNext { + assert QueueTestHelper.assertQueueServicePropertiesAreEqual(originalProperties, it) + } + setPropertiesVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + + getPropertiesAfterVerifier.assertNext { + assert QueueTestHelper.assertQueueServicePropertiesAreEqual(updatedProperties, it) + }.verifyComplete() + } +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueTestHelper.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueTestHelper.groovy new file mode 100644 index 000000000000..63d6afeed4e4 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueTestHelper.groovy @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.core.http.rest.Response +import com.azure.core.implementation.util.ImplUtils +import com.azure.core.util.configuration.ConfigurationManager +import com.azure.storage.queue.models.CorsRule +import com.azure.storage.queue.models.Logging +import com.azure.storage.queue.models.Metrics +import com.azure.storage.queue.models.QueueItem +import com.azure.storage.queue.models.RetentionPolicy +import com.azure.storage.queue.models.SignedIdentifier +import com.azure.storage.queue.models.StorageErrorCode +import com.azure.storage.queue.models.StorageErrorException +import com.azure.storage.queue.models.StorageServiceProperties + +import java.time.Duration + +class QueueTestHelper { + static boolean assertResponseStatusCode(Response response, int expectedStatusCode) { + return expectedStatusCode == response.statusCode() + } + + static boolean assertExceptionStatusCodeAndMessage(Throwable throwable, int expectedStatusCode, String errMessage) { + return assertExceptionStatusCode(throwable, expectedStatusCode) && assertExceptionErrorMessage(throwable, errMessage) + } + + static boolean assertExceptionStatusCodeAndMessage(Throwable throwable, int expectedStatusCode, StorageErrorCode errMessage) { + return assertExceptionStatusCode(throwable, expectedStatusCode) && assertExceptionErrorMessage(throwable, errMessage) + } + + static boolean assertExceptionStatusCode(Throwable throwable, int expectedStatusCode) { + if (!throwable instanceof StorageErrorException) { + return false + } + StorageErrorException storageErrorException = (StorageErrorException) throwable + return expectedStatusCode == storageErrorException.response().statusCode() + } + + static boolean assertExceptionErrorMessage(Throwable throwable, String errMessage) { + return throwable instanceof StorageErrorException && throwable.getMessage().contains(errMessage) + } + + static boolean assertExceptionErrorMessage(Throwable throwable, StorageErrorCode errMessage) { + return throwable instanceof StorageErrorException && throwable.getMessage().contains(errMessage.toString()) + } + + static boolean assertQueuesAreEqual(QueueItem expected, QueueItem actual) { + if (expected == null) { + return actual == null + } else { + if (!Objects.equals(expected.name(), actual.name())) { + return false + } + if (expected.metadata() != null && !ImplUtils.isNullOrEmpty(actual.metadata())) { + return expected.metadata().equals(actual.metadata()) + } + return true + } + } + + static boolean assertQueueServicePropertiesAreEqual(StorageServiceProperties expected, StorageServiceProperties actual) { + if (expected == null) { + return actual == null + } else { + return assertMetricsAreEqual(expected.hourMetrics(), actual.hourMetrics()) && + assertMetricsAreEqual(expected.minuteMetrics(), actual.minuteMetrics()) && + assertLoggingAreEqual(expected.logging(), actual.logging()) && + assertCorsAreEqual(expected.cors(), actual.cors()) + } + } + + static boolean assertMetricsAreEqual(Metrics expected, Metrics actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.enabled(), actual.enabled()) && + Objects.equals(expected.includeAPIs(), actual.includeAPIs()) && + Objects.equals(expected.version(), actual.version()) && + assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()) + } + } + + static boolean assertLoggingAreEqual(Logging expected, Logging actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.read(), actual.read()) && + Objects.equals(expected.write(), actual.write()) && + Objects.equals(expected.delete(), actual.delete()) && + Objects.equals(expected.version(), actual.version()) && + assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()) + } + } + + static boolean assertRetentionPoliciesAreEqual(RetentionPolicy expected, RetentionPolicy actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.days(), actual.days()) && + Objects.equals(expected.enabled(), actual.enabled()) + } + } + + static boolean assertCorsAreEqual(List expected, List actual) { + if (expected == null) { + return actual == null + } else { + if (expected.size() != actual.size()) { + return false + } + for (int i = 0; i < expected.size(); i++) { + if (!assertCorRulesAreEqual(expected.get(i), actual.get(i))) { + return false + } + } + return true + } + } + + static boolean assertCorRulesAreEqual(CorsRule expected, CorsRule actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.allowedHeaders(), actual.allowedHeaders()) && + Objects.equals(expected.allowedMethods(), actual.allowedMethods()) && + Objects.equals(expected.allowedOrigins(), actual.allowedOrigins()) && + Objects.equals(expected.maxAgeInSeconds(), actual.maxAgeInSeconds()) + } + } + + static boolean assertPermissionsAreEqual(SignedIdentifier expected, SignedIdentifier actual) { + if (expected == null) { + return actual == null + } + if (expected.accessPolicy() == null) { + return actual.accessPolicy() == null + } + return Objects.equals(expected.id(), actual.id()) && + Objects.equals(expected.accessPolicy().permission(), actual.accessPolicy().permission()) && + Objects.equals(expected.accessPolicy().start(), actual.accessPolicy().start()) && + Objects.equals(expected.accessPolicy().expiry(), actual.accessPolicy().expiry()) + } + + static void sleepInRecord(Duration time) { + String azureTestMode = ConfigurationManager.getConfiguration().get("AZURE_TEST_MODE") + if ("RECORD".equalsIgnoreCase(azureTestMode)) { + sleep(time) + } + } + + private static void sleep(Duration time) { + try { + Thread.sleep(time.toMillis()) + } catch (InterruptedException ex) { + // Ignore the error + } + } +} diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessages.json new file mode 100644 index 000000000000..d1f7c7198ee0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessages.json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages760048928b27d09ce47", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1b9c8d93-4003-00b9-22a0-58d378000000", + "Date" : "Thu, 22 Aug 2019 04:13:51 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages760048928b27d09ce47/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1b9c8e97-4003-00b9-1ca0-58d378000000", + "Body" : "ffe86202-b35c-4a1c-86c5-90731317d426Thu, 22 Aug 2019 04:13:52 GMTThu, 29 Aug 2019 04:13:52 GMTAgAAAAMAAAAAAAAAkAutAaBY1QE=Thu, 22 Aug 2019 04:13:52 GMT", + "Date" : "Thu, 22 Aug 2019 04:13:51 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages760048928b27d09ce47/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1b9c8efd-4003-00b9-7fa0-58d378000000", + "Body" : "002bbbd2-5487-4c2f-825b-21853da4f5fdThu, 22 Aug 2019 04:13:52 GMTThu, 29 Aug 2019 04:13:52 GMTAgAAAAMAAAAAAAAAGHTJAaBY1QE=Thu, 22 Aug 2019 04:13:52 GMT", + "Date" : "Thu, 22 Aug 2019 04:13:52 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages760048928b27d09ce47/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1b9c8f15-4003-00b9-16a0-58d378000000", + "Body" : "6849f8e8-6c31-4901-8b2f-f8d126122b84Thu, 22 Aug 2019 04:13:52 GMTThu, 29 Aug 2019 04:13:52 GMTAgAAAAMAAAAAAAAABPDQAaBY1QE=Thu, 22 Aug 2019 04:13:52 GMT", + "Date" : "Thu, 22 Aug 2019 04:13:52 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages760048928b27d09ce47?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "3", + "StatusCode" : "200", + "x-ms-request-id" : "1b9c8f3b-4003-00b9-3ba0-58d378000000", + "Date" : "Thu, 22 Aug 2019 04:13:52 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages760048928b27d09ce47/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "1b9c8f74-4003-00b9-73a0-58d378000000", + "Date" : "Thu, 22 Aug 2019 04:13:54 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages760048928b27d09ce47?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "1b9c9399-4003-00b9-71a0-58d378000000", + "Date" : "Thu, 22 Aug 2019 04:13:54 GMT" + } + } ], + "variables" : [ "queueapitestsclearmessages760048928b27d09ce47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessagesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessagesError.json new file mode 100644 index 000000000000..feb60836c10b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessagesError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessageserror122895bd11a3c794a/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0b046-d003-0034-2e88-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0b046-d003-0034-2e88-539fde000000\nTime:2019-08-15T16:40:24.6890548Z", + "Date" : "Thu, 15 Aug 2019 16:40:24 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsclearmessageserror122895bd11a3c794a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsCreateQueueWithSharedKey.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsCreateQueueWithSharedKey.json new file mode 100644 index 000000000000..371a132c6bb3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsCreateQueueWithSharedKey.json @@ -0,0 +1,20 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestscreatequeuewithsharedkey08458bcc81be1e", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0a973-d003-0034-2088-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:11 GMT" + } + } ], + "variables" : [ "queueapitestscreatequeuewithsharedkey08458bcc81be1e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteExistQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteExistQueue.json new file mode 100644 index 000000000000..b40ca18da630 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteExistQueue.json @@ -0,0 +1,36 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeleteexistqueue16092c5b3100623794", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0aaa8-d003-0034-3a88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:12 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeleteexistqueue16092c5b3100623794", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0aaab-d003-0034-3c88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:12 GMT" + } + } ], + "variables" : [ "queueapitestsdeleteexistqueue16092c5b3100623794" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessage.json new file mode 100644 index 000000000000..518df74cae35 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessage.json @@ -0,0 +1,148 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage746965256d5a7596e43", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "63b51f60-0003-005b-149f-58370a000000", + "Date" : "Thu, 22 Aug 2019 04:13:33 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage746965256d5a7596e43/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "63b52083-0003-005b-139f-58370a000000", + "Body" : "c3fe0e64-092f-4f2a-9511-4ff091498e1eThu, 22 Aug 2019 04:13:34 GMTThu, 29 Aug 2019 04:13:34 GMTAgAAAAMAAAAAAAAAvRck959Y1QE=Thu, 22 Aug 2019 04:13:34 GMT", + "Date" : "Thu, 22 Aug 2019 04:13:34 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage746965256d5a7596e43/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "63b520a0-0003-005b-2d9f-58370a000000", + "Body" : "9e5e2eaa-d429-49fc-979d-e5bb333e9a18Thu, 22 Aug 2019 04:13:34 GMTThu, 29 Aug 2019 04:13:34 GMTAgAAAAMAAAAAAAAAuzU+959Y1QE=Thu, 22 Aug 2019 04:13:34 GMT", + "Date" : "Thu, 22 Aug 2019 04:13:34 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage746965256d5a7596e43/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "63b520aa-0003-005b-369f-58370a000000", + "Body" : "5aa9d890-c4f5-44af-aeca-84eba806eb8bThu, 22 Aug 2019 04:13:34 GMTThu, 29 Aug 2019 04:13:34 GMTAgAAAAMAAAAAAAAABE5G959Y1QE=Thu, 22 Aug 2019 04:13:34 GMT", + "Date" : "Thu, 22 Aug 2019 04:13:34 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage746965256d5a7596e43/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "63b520b7-0003-005b-429f-58370a000000", + "Body" : "c3fe0e64-092f-4f2a-9511-4ff091498e1eThu, 22 Aug 2019 04:13:34 GMTThu, 29 Aug 2019 04:13:34 GMTAgAAAAMAAAAAAAAAFdc1CaBY1QE=Thu, 22 Aug 2019 04:14:04 GMT1test message 1", + "Date" : "Thu, 22 Aug 2019 04:13:34 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage746965256d5a7596e43?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "3", + "StatusCode" : "200", + "x-ms-request-id" : "63b520ce-0003-005b-569f-58370a000000", + "Date" : "Thu, 22 Aug 2019 04:13:34 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage746965256d5a7596e43/messages/c3fe0e64-092f-4f2a-9511-4ff091498e1e?popreceipt=AgAAAAMAAAAAAAAAFdc1CaBY1QE%3d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "63b520e0-0003-005b-679f-58370a000000", + "Date" : "Thu, 22 Aug 2019 04:13:34 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage746965256d5a7596e43?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "2", + "StatusCode" : "200", + "x-ms-request-id" : "63b520eb-0003-005b-729f-58370a000000", + "Date" : "Thu, 22 Aug 2019 04:13:34 GMT" + } + } ], + "variables" : [ "queueapitestsdeletemessage746965256d5a7596e43" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs0.json new file mode 100644 index 000000000000..5df40689c608 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs0.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs0323923de6fafd", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6647a003-b003-000d-375b-54df7a000000", + "Date" : "Fri, 16 Aug 2019 17:50:25 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs0323923de6fafd/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6647a00a-b003-000d-3d5b-54df7a000000", + "Body" : "fb05a7ad-0aea-4f9f-8deb-8fda9b26a197Fri, 16 Aug 2019 17:50:26 GMTFri, 23 Aug 2019 17:50:26 GMTAgAAAAMAAAAAAAAAkm/pFVtU1QE=Fri, 16 Aug 2019 17:50:26 GMT", + "Date" : "Fri, 16 Aug 2019 17:50:26 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs0323923de6fafd/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "6647a011-b003-000d-445b-54df7a000000", + "Body" : "fb05a7ad-0aea-4f9f-8deb-8fda9b26a197Fri, 16 Aug 2019 17:50:26 GMTFri, 23 Aug 2019 17:50:26 GMTAgAAAAMAAAAAAAAAynzRJ1tU1QE=Fri, 16 Aug 2019 17:50:56 GMT1test message", + "Date" : "Fri, 16 Aug 2019 17:50:26 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs0323923de6fafd/messages/fb05a7ad-0aea-4f9f-8deb-8fda9b26a197?popreceipt=AgAAAAMAAAAAAAAAynzRJ1tU1QE%3dRandom", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "6647a018-b003-000d-4b5b-54df7a000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:6647a018-b003-000d-4b5b-54df7a000000\nTime:2019-08-16T17:50:26.4485779ZpopreceiptAgAAAAMAAAAAAAAAynzRJ1tU1QE=RandomInvalid pop receipt format", + "Date" : "Fri, 16 Aug 2019 17:50:26 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsdeletemessageinvalidargs0323923de6fafd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs1.json new file mode 100644 index 000000000000..a56ffbacf18f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs1.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs1638117132ce8c", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6647a027-b003-000d-595b-54df7a000000", + "Date" : "Fri, 16 Aug 2019 17:50:26 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs1638117132ce8c/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6647a02d-b003-000d-5d5b-54df7a000000", + "Body" : "064db906-fca5-46bb-9891-2dcc41dba658Fri, 16 Aug 2019 17:50:26 GMTFri, 23 Aug 2019 17:50:26 GMTAgAAAAMAAAAAAAAAHQIPFltU1QE=Fri, 16 Aug 2019 17:50:26 GMT", + "Date" : "Fri, 16 Aug 2019 17:50:26 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs1638117132ce8c/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "6647a035-b003-000d-655b-54df7a000000", + "Body" : "064db906-fca5-46bb-9891-2dcc41dba658Fri, 16 Aug 2019 17:50:26 GMTFri, 23 Aug 2019 17:50:26 GMTAgAAAAMAAAAAAAAA85n2J1tU1QE=Fri, 16 Aug 2019 17:50:56 GMT1test message", + "Date" : "Fri, 16 Aug 2019 17:50:26 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs1638117132ce8c/messages/064db906-fca5-46bb-9891-2dcc41dba658Random?popreceipt=AgAAAAMAAAAAAAAA85n2J1tU1QE%3d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MessageNotFound", + "retry-after" : "0", + "Content-Length" : "221", + "StatusCode" : "404", + "x-ms-request-id" : "6647a03d-b003-000d-6d5b-54df7a000000", + "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:6647a03d-b003-000d-6d5b-54df7a000000\nTime:2019-08-16T17:50:29.6586178Z", + "Date" : "Fri, 16 Aug 2019 17:50:29 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsdeletemessageinvalidargs1638117132ce8c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs2.json new file mode 100644 index 000000000000..354671a8c514 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs2.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs244000add4302d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6647a228-b003-000d-245b-54df7a000000", + "Date" : "Fri, 16 Aug 2019 17:50:29 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs244000add4302d/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "6647a22f-b003-000d-295b-54df7a000000", + "Body" : "6e27cb73-32b7-46fb-88f8-4dc338d63dcfFri, 16 Aug 2019 17:50:29 GMTFri, 23 Aug 2019 17:50:29 GMTAgAAAAMAAAAAAAAASz30F1tU1QE=Fri, 16 Aug 2019 17:50:29 GMT", + "Date" : "Fri, 16 Aug 2019 17:50:29 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs244000add4302d/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "6647a237-b003-000d-315b-54df7a000000", + "Body" : "6e27cb73-32b7-46fb-88f8-4dc338d63dcfFri, 16 Aug 2019 17:50:29 GMTFri, 23 Aug 2019 17:50:29 GMTAgAAAAMAAAAAAAAAesPaKVtU1QE=Fri, 16 Aug 2019 17:50:59 GMT1test message", + "Date" : "Fri, 16 Aug 2019 17:50:29 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs244000add4302d/messages/6e27cb73-32b7-46fb-88f8-4dc338d63dcfRandom?popreceipt=AgAAAAMAAAAAAAAAesPaKVtU1QE%3dRandom", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "6647a23f-b003-000d-395b-54df7a000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:6647a23f-b003-000d-395b-54df7a000000\nTime:2019-08-16T17:50:29.8548035ZpopreceiptAgAAAAMAAAAAAAAAesPaKVtU1QE=RandomInvalid pop receipt format", + "Date" : "Fri, 16 Aug 2019 17:50:29 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsdeletemessageinvalidargs244000add4302d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteQueueError.json new file mode 100644 index 000000000000..ca2f032e1942 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteQueueError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletequeueerror47957ce5611a14cab4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0aabe-d003-0034-4c88-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0aabe-d003-0034-4c88-539fde000000\nTime:2019-08-15T16:40:13.4041901Z", + "Date" : "Thu, 15 Aug 2019 16:40:12 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsdeletequeueerror47957ce5611a14cab4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMessage.json new file mode 100644 index 000000000000..1089d1b98b2d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMessage.json @@ -0,0 +1,58 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemessage52177b09020183ba340", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c71acf3a-c003-002b-06a0-5844ce000000", + "Date" : "Thu, 22 Aug 2019 04:14:46 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemessage52177b09020183ba340/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c71acff8-c003-002b-29a0-5844ce000000", + "Body" : "89f9a952-4b06-4b56-a03d-a27c39d768a5Thu, 22 Aug 2019 04:14:48 GMTThu, 29 Aug 2019 04:14:48 GMTAgAAAAMAAAAAAAAAmE/gIqBY1QE=Thu, 22 Aug 2019 04:14:48 GMT", + "Date" : "Thu, 22 Aug 2019 04:14:47 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemessage52177b09020183ba340/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c71ad05e-c003-002b-05a0-5844ce000000", + "Body" : "89f9a952-4b06-4b56-a03d-a27c39d768a5Thu, 22 Aug 2019 04:14:48 GMTThu, 29 Aug 2019 04:14:48 GMTAgAAAAMAAAAAAAAAC6HtNKBY1QE=Thu, 22 Aug 2019 04:15:18 GMT1test message", + "Date" : "Thu, 22 Aug 2019 04:14:47 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsdequeuemessage52177b09020183ba340" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMultipleMessages.json new file mode 100644 index 000000000000..688920783052 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMultipleMessages.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemultiplemessages84877b2d41434a", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "06c6b7db-7003-0136-4da0-58db71000000", + "Date" : "Thu, 22 Aug 2019 04:14:29 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemultiplemessages84877b2d41434a/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "06c6b7f3-7003-0136-62a0-58db71000000", + "Body" : "db13b07c-5929-44eb-8655-7ef119f3a35bThu, 22 Aug 2019 04:14:30 GMTThu, 29 Aug 2019 04:14:30 GMTAgAAAAMAAAAAAAAAp02zGKBY1QE=Thu, 22 Aug 2019 04:14:30 GMT", + "Date" : "Thu, 22 Aug 2019 04:14:30 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemultiplemessages84877b2d41434a/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "06c6b7fd-7003-0136-6ca0-58db71000000", + "Body" : "4f050273-66d8-4632-b766-66cfe3cf328eThu, 22 Aug 2019 04:14:31 GMTThu, 29 Aug 2019 04:14:31 GMTAgAAAAMAAAAAAAAASsPdGKBY1QE=Thu, 22 Aug 2019 04:14:31 GMT", + "Date" : "Thu, 22 Aug 2019 04:14:30 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemultiplemessages84877b2d41434a/messages?numofmessages=2&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "06c6b805-7003-0136-72a0-58db71000000", + "Body" : "db13b07c-5929-44eb-8655-7ef119f3a35bThu, 22 Aug 2019 04:14:30 GMTThu, 29 Aug 2019 04:14:30 GMTAgAAAAMAAAAAAAAADuXPKqBY1QE=Thu, 22 Aug 2019 04:15:01 GMT1test message 14f050273-66d8-4632-b766-66cfe3cf328eThu, 22 Aug 2019 04:14:31 GMTThu, 29 Aug 2019 04:14:31 GMTAgAAAAMAAAAAAAAADuXPKqBY1QE=Thu, 22 Aug 2019 04:15:01 GMT1test message 2", + "Date" : "Thu, 22 Aug 2019 04:14:30 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsdequeuemultiplemessages84877b2d41434a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueTooManyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueTooManyMessage.json new file mode 100644 index 000000000000..6ff627a06894 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueTooManyMessage.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuetoomanymessage820232eb14b1658", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0aee4-d003-0034-7f88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:21 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuetoomanymessage820232eb14b1658/messages?numofmessages=33&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "456", + "StatusCode" : "400", + "x-ms-request-id" : "86d0aee9-d003-0034-0388-539fde000000", + "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:86d0aee9-d003-0034-0388-539fde000000\nTime:2019-08-15T16:40:22.1496102Znumofmessages33132", + "Date" : "Thu, 15 Aug 2019 16:40:21 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsdequeuetoomanymessage820232eb14b1658" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueEmptyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueEmptyMessage.json new file mode 100644 index 000000000000..ac02af2e3977 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueEmptyMessage.json @@ -0,0 +1,58 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueueemptymessage717359ecd4698c3c", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5a885889-7003-0114-4ba0-58b547000000", + "Date" : "Thu, 22 Aug 2019 04:14:58 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueueemptymessage717359ecd4698c3c/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "5a8858f3-7003-0114-2ca0-58b547000000", + "Body" : "4027b73b-ed6a-480d-aab0-e20900de4d4cThu, 22 Aug 2019 04:14:59 GMTThu, 29 Aug 2019 04:14:59 GMTAgAAAAMAAAAAAAAA8gSrKaBY1QE=Thu, 22 Aug 2019 04:14:59 GMT", + "Date" : "Thu, 22 Aug 2019 04:14:58 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueueemptymessage717359ecd4698c3c/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "5a885920-7003-0114-55a0-58b547000000", + "Body" : "4027b73b-ed6a-480d-aab0-e20900de4d4cThu, 22 Aug 2019 04:14:59 GMTThu, 29 Aug 2019 04:14:59 GMT0", + "Date" : "Thu, 22 Aug 2019 04:14:59 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsenqueueemptymessage717359ecd4698c3c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueMessage.json new file mode 100644 index 000000000000..671d32496a8e --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueMessage.json @@ -0,0 +1,58 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueuemessage56018c1be8097b99b4e", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b19dbe9a-9003-00bb-61a1-58d182000000", + "Date" : "Thu, 22 Aug 2019 04:27:00 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueuemessage56018c1be8097b99b4e/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b19dbefd-9003-00bb-28a1-58d182000000", + "Body" : "12108ce3-ca30-41c5-810b-bf44c2de377fThu, 22 Aug 2019 04:27:01 GMTThu, 29 Aug 2019 04:27:01 GMTAgAAAAMAAAAAAAAAEYzP16FY1QE=Thu, 22 Aug 2019 04:27:01 GMT", + "Date" : "Thu, 22 Aug 2019 04:27:00 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueuemessage56018c1be8097b99b4e/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b19dbf15-9003-00bb-3ea1-58d182000000", + "Body" : "12108ce3-ca30-41c5-810b-bf44c2de377fThu, 22 Aug 2019 04:27:01 GMTThu, 29 Aug 2019 04:27:01 GMT0test message", + "Date" : "Thu, 22 Aug 2019 04:27:00 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsenqueuemessage56018c1be8097b99b4e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueTimeToLive.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueTimeToLive.json new file mode 100644 index 000000000000..31e4c78f7180 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueTimeToLive.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueuetimetolive94210574071164c6f", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ae88-d003-0034-3088-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:20 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueuetimetolive94210574071164c6f/messages?visibilitytimeout=0&messagettl=2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ae97-d003-0034-3d88-539fde000000", + "Body" : "06a2ea01-3dc2-4a7d-b352-2a0471fface0Thu, 15 Aug 2019 16:40:21 GMTThu, 15 Aug 2019 16:40:23 GMTAgAAAAMAAAAAAAAAdiMiIYhT1QE=Thu, 15 Aug 2019 16:40:21 GMT", + "Date" : "Thu, 15 Aug 2019 16:40:20 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsenqueuetimetolive94210574071164c6f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicy.json new file mode 100644 index 000000000000..7c104d49cf6b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicy.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetaccesspolicy3986549d9a11fe03c4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ac98-d003-0034-0188-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:16 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetaccesspolicy3986549d9a11fe03c4?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0aca0-d003-0034-0888-539fde000000", + "Body" : "", + "Date" : "Thu, 15 Aug 2019 16:40:17 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsgetaccesspolicy3986549d9a11fe03c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicyError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicyError.json new file mode 100644 index 000000000000..fb065f326b17 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicyError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetaccesspolicyerror58413efeb5fdae94?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0ad6f-d003-0034-3f88-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0ad6f-d003-0034-3f88-539fde000000\nTime:2019-08-15T16:40:18.6602495Z", + "Date" : "Thu, 15 Aug 2019 16:40:18 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsgetaccesspolicyerror58413efeb5fdae94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetProperties.json new file mode 100644 index 000000000000..81502bd84d67 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetProperties.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetproperties49283bebfe496c1124d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0aad7-d003-0034-6388-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:13 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetproperties49283bebfe496c1124d?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0aae0-d003-0034-6b88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:13 GMT" + } + } ], + "variables" : [ "queueapitestsgetproperties49283bebfe496c1124d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..f2a64cf9961d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetPropertiesError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetpropertieserror86495a85dbf5a65c1?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0ab03-d003-0034-0988-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0ab03-d003-0034-0988-539fde000000\nTime:2019-08-15T16:40:13.7735459Z", + "Date" : "Thu, 15 Aug 2019 16:40:13 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsgetpropertieserror86495a85dbf5a65c1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessage.json new file mode 100644 index 000000000000..9601f15ccb25 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessage.json @@ -0,0 +1,58 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmessagequeueapitestspeekmessage0814896993", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "04579b2e-6003-0004-80a0-58c5f4000000", + "Date" : "Thu, 22 Aug 2019 04:15:39 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmessagequeueapitestspeekmessage0814896993/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "04579b4b-6003-0004-16a0-58c5f4000000", + "Body" : "2046f6f4-e550-4ca4-8459-25e6e93db4d5Thu, 22 Aug 2019 04:15:40 GMTThu, 29 Aug 2019 04:15:40 GMTAgAAAAMAAAAAAAAAcqDyQaBY1QE=Thu, 22 Aug 2019 04:15:40 GMT", + "Date" : "Thu, 22 Aug 2019 04:15:39 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmessagequeueapitestspeekmessage0814896993/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "04579b68-6003-0004-33a0-58c5f4000000", + "Body" : "2046f6f4-e550-4ca4-8459-25e6e93db4d5Thu, 22 Aug 2019 04:15:40 GMTThu, 29 Aug 2019 04:15:40 GMT0test message", + "Date" : "Thu, 22 Aug 2019 04:15:40 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestspeekmessagequeueapitestspeekmessage0814896993" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessagesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessagesError.json new file mode 100644 index 000000000000..716f59b91442 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessagesError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmessageserror659934ae7b76e1ec7/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0af82-d003-0034-0988-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0af82-d003-0034-0988-539fde000000\nTime:2019-08-15T16:40:23.3367515Z", + "Date" : "Thu, 15 Aug 2019 16:40:22 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestspeekmessageserror659934ae7b76e1ec7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMultipleMessages.json new file mode 100644 index 000000000000..6b295ca26458 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMultipleMessages.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmultiplemessages2406977720c9e38a", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fb0b63d6-e003-009d-08a0-584a36000000", + "Date" : "Thu, 22 Aug 2019 04:14:12 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmultiplemessages2406977720c9e38a/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fb0b666b-e003-009d-5da0-584a36000000", + "Body" : "477e1312-237a-4643-84c8-6ec2f3f83ddfThu, 22 Aug 2019 04:14:13 GMTThu, 29 Aug 2019 04:14:13 GMTAgAAAAMAAAAAAAAAaoBfDqBY1QE=Thu, 22 Aug 2019 04:14:13 GMT", + "Date" : "Thu, 22 Aug 2019 04:14:12 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmultiplemessages2406977720c9e38a/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "fb0b668d-e003-009d-7da0-584a36000000", + "Body" : "76f1716d-2efe-4e2a-80ca-35d4e5ceaaf1Thu, 22 Aug 2019 04:14:13 GMTThu, 29 Aug 2019 04:14:13 GMTAgAAAAMAAAAAAAAAPdd6DqBY1QE=Thu, 22 Aug 2019 04:14:13 GMT", + "Date" : "Thu, 22 Aug 2019 04:14:13 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmultiplemessages2406977720c9e38a/messages?numofmessages=2&peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "fb0b66ae-e003-009d-1ba0-584a36000000", + "Body" : "477e1312-237a-4643-84c8-6ec2f3f83ddfThu, 22 Aug 2019 04:14:13 GMTThu, 29 Aug 2019 04:14:13 GMT0test message 176f1716d-2efe-4e2a-80ca-35d4e5ceaaf1Thu, 22 Aug 2019 04:14:13 GMTThu, 29 Aug 2019 04:14:13 GMT0test message 2", + "Date" : "Thu, 22 Aug 2019 04:14:13 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestspeekmultiplemessages2406977720c9e38a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekTooManyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekTooManyMessage.json new file mode 100644 index 000000000000..2e0cc4207f4c --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekTooManyMessage.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeektoomanymessage8011625e0f9c2fd32", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0af60-d003-0034-6c88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:22 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeektoomanymessage8011625e0f9c2fd32/messages?numofmessages=33&peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "456", + "StatusCode" : "400", + "x-ms-request-id" : "86d0af66-d003-0034-7088-539fde000000", + "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:86d0af66-d003-0034-7088-539fde000000\nTime:2019-08-15T16:40:23.2106294Znumofmessages33132", + "Date" : "Thu, 15 Aug 2019 16:40:22 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestspeektoomanymessage8011625e0f9c2fd32" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAccessPolicy.json new file mode 100644 index 000000000000..96f21b61b602 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAccessPolicy.json @@ -0,0 +1,56 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetaccesspolicy7404808264b0d36334", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ad7a-d003-0034-4688-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:18 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetaccesspolicy7404808264b0d36334?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0ad9a-d003-0034-5f88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:18 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetaccesspolicy7404808264b0d36334?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0ad9e-d003-0034-6388-539fde000000", + "Body" : "testpermission2000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zraup", + "Date" : "Thu, 15 Aug 2019 16:40:18 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestssetaccesspolicy7404808264b0d36334" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata0.json new file mode 100644 index 000000000000..7b3c4ae923c0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata0.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata069712b1b824a4f5a", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ab14-d003-0034-1888-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:13 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata069712b1b824a4f5a?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0ab1c-d003-0034-1f88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:13 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata069712b1b824a4f5a?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0ab22-d003-0034-2588-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:13 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata069712b1b824a4f5a?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0ab36-d003-0034-3988-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:13 GMT" + } + } ], + "variables" : [ "queueapitestssetandclearmetadata069712b1b824a4f5a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata1.json new file mode 100644 index 000000000000..0a9eb98b06e5 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata1.json @@ -0,0 +1,74 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata1133922d063e915d5", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ab5e-d003-0034-5f88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata1133922d063e915d5?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "x-ms-meta-metadata1" : "value", + "StatusCode" : "200", + "x-ms-request-id" : "86d0ab66-d003-0034-6688-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata1133922d063e915d5?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0ab6d-d003-0034-6d88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata1133922d063e915d5?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0ab74-d003-0034-7488-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + } ], + "variables" : [ "queueapitestssetandclearmetadata1133922d063e915d5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata2.json new file mode 100644 index 000000000000..7eb7f876733b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata2.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata2975245e5d3767672", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ab8b-d003-0034-0a88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata2975245e5d3767672?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "x-ms-meta-metadata1" : "value", + "StatusCode" : "200", + "x-ms-request-id" : "86d0ab97-d003-0034-1588-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata2975245e5d3767672?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0ab9f-d003-0034-1d88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata2975245e5d3767672?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0aba3-d003-0034-2188-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + } ], + "variables" : [ "queueapitestssetandclearmetadata2975245e5d3767672" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata3.json new file mode 100644 index 000000000000..1ccfd178abb2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata3.json @@ -0,0 +1,74 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata3109857c8883f83ac", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0abc0-d003-0034-3d88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata3109857c8883f83ac?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0abc8-d003-0034-4488-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata3109857c8883f83ac?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0abcb-d003-0034-4788-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata3109857c8883f83ac?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0abdb-d003-0034-5588-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:14 GMT" + } + } ], + "variables" : [ "queueapitestssetandclearmetadata3109857c8883f83ac" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata4.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata4.json new file mode 100644 index 000000000000..41a4e1aaeb97 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata4.json @@ -0,0 +1,72 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata4441364d33a3358d9", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0abf5-d003-0034-6d88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata4441364d33a3358d9?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0abf9-d003-0034-7088-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata4441364d33a3358d9?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0ac00-d003-0034-7788-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata4441364d33a3358d9?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0ac04-d003-0034-7b88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT" + } + } ], + "variables" : [ "queueapitestssetandclearmetadata4441364d33a3358d9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidAccessPolicy.json new file mode 100644 index 000000000000..69072b76cfb7 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidAccessPolicy.json @@ -0,0 +1,40 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidaccesspolicy272461d7c8ddd05", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0adb1-d003-0034-7588-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:18 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidaccesspolicy272461d7c8ddd05?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "371", + "StatusCode" : "400", + "x-ms-request-id" : "86d0adb5-d003-0034-7888-539fde000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:86d0adb5-d003-0034-7888-539fde000000\nTime:2019-08-15T16:40:19.3749389Z1304Signed identifier ID cannot be empty or over 64 characters in length", + "Date" : "Thu, 15 Aug 2019 16:40:18 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestssetinvalidaccesspolicy272461d7c8ddd05" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta0.json new file mode 100644 index 000000000000..d67771bd47f4 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta0.json @@ -0,0 +1,38 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta086912efa51a8ecf394", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ac2d-d003-0034-2288-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta086912efa51a8ecf394?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "787", + "StatusCode" : "403", + "x-ms-request-id" : "86d0ac31-d003-0034-2588-539fde000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:86d0ac31-d003-0034-2588-539fde000000\nTime:2019-08-15T16:40:15.9366308ZThe MAC signature found in the HTTP request 'eFSCtqZMmfvr497wo8VI4QmqpGPc177ZljiKa2e1R9U=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nThu, 15 Aug 2019 16:40:15 GMT\n\n\n\n\n\nx-ms-client-request-id:0fc39ac3-c8b7-4559-9dc7-d7626792fc6c\nx-ms-meta-invalidmeta:value\nx-ms-version:2018-03-28\n/azstoragesdkaccount/queueapitestssetinvalidmeta086912efa51a8ecf394\ncomp:metadata'.", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestssetinvalidmeta086912efa51a8ecf394" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta1.json new file mode 100644 index 000000000000..9bc7be9b6093 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta1.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta113448acbafb9121ae4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ac44-d003-0034-3888-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta113448acbafb9121ae4?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "86d0ac47-d003-0034-3a88-539fde000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:86d0ac47-d003-0034-3a88-539fde000000\nTime:2019-08-15T16:40:16.1618482Z", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestssetinvalidmeta113448acbafb9121ae4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta2.json new file mode 100644 index 000000000000..f382dd8feb4a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta2.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta2080827789296bb3fb4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ac5d-d003-0034-4d88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta2080827789296bb3fb4?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "86d0ac62-d003-0034-5188-539fde000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:86d0ac62-d003-0034-5188-539fde000000\nTime:2019-08-15T16:40:16.3650438Z", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestssetinvalidmeta2080827789296bb3fb4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta3.json new file mode 100644 index 000000000000..e9408913c72f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta3.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta34802248c56de5d4824", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ac7c-d003-0034-6688-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:16 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta34802248c56de5d4824?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "86d0ac84-d003-0034-6d88-539fde000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:86d0ac84-d003-0034-6d88-539fde000000\nTime:2019-08-15T16:40:16.5552281Zvalue", + "Date" : "Thu, 15 Aug 2019 16:40:16 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestssetinvalidmeta34802248c56de5d4824" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMetadataQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMetadataQueueError.json new file mode 100644 index 000000000000..2db96a476326 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMetadataQueueError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetmetadataqueueerror215410bb255310f?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0ac1d-d003-0034-1488-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0ac1d-d003-0034-1488-539fde000000\nTime:2019-08-15T16:40:15.7774776Z", + "Date" : "Thu, 15 Aug 2019 16:40:15 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestssetmetadataqueueerror215410bb255310f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMultipleAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMultipleAccessPolicies.json new file mode 100644 index 000000000000..a9505d0667f9 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMultipleAccessPolicies.json @@ -0,0 +1,56 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetmultipleaccesspolicies16522a4462e10", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0adcb-d003-0034-0c88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:19 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetmultipleaccesspolicies16522a4462e10?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0ade0-d003-0034-1f88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:19 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetmultipleaccesspolicies16522a4462e10?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0adfb-d003-0034-3788-539fde000000", + "Body" : "policy02000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zrpolicy12000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zrpolicy22000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zr", + "Date" : "Thu, 15 Aug 2019 16:40:19 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestssetmultipleaccesspolicies16522a4462e10" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetTooManyAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetTooManyAccessPolicies.json new file mode 100644 index 000000000000..751949a2a5e5 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetTooManyAccessPolicies.json @@ -0,0 +1,40 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssettoomanyaccesspolicies3701347c5c1a20", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0ae24-d003-0034-5688-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:19 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssettoomanyaccesspolicies3701347c5c1a20?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "86d0ae2b-d003-0034-5c88-539fde000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:86d0ae2b-d003-0034-5c88-539fde000000\nTime:2019-08-15T16:40:20.2267603Z00", + "Date" : "Thu, 15 Aug 2019 16:40:19 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestssettoomanyaccesspolicies3701347c5c1a20" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessage.json new file mode 100644 index 000000000000..78c7962005a6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessage.json @@ -0,0 +1,96 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessage95419cc48c1bf915842", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d6eb61ab-0003-003d-059f-588550000000", + "Date" : "Thu, 22 Aug 2019 04:13:08 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessage95419cc48c1bf915842/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d6eb6319-0003-003d-5f9f-588550000000", + "Body" : "b74a7f0b-dba6-483e-adf5-c3e78bddf919Thu, 22 Aug 2019 04:13:09 GMTThu, 29 Aug 2019 04:13:09 GMTAgAAAAMAAAAAAAAAZOlG6J9Y1QE=Thu, 22 Aug 2019 04:13:09 GMT", + "Date" : "Thu, 22 Aug 2019 04:13:09 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessage95419cc48c1bf915842/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d6eb6371-0003-003d-349f-588550000000", + "Body" : "b74a7f0b-dba6-483e-adf5-c3e78bddf919Thu, 22 Aug 2019 04:13:09 GMTThu, 29 Aug 2019 04:13:09 GMTAgAAAAMAAAAAAAAAPlBT+p9Y1QE=Thu, 22 Aug 2019 04:13:40 GMT1test message before update", + "Date" : "Thu, 22 Aug 2019 04:13:09 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessage95419cc48c1bf915842/messages/b74a7f0b-dba6-483e-adf5-c3e78bddf919?popreceipt=AgAAAAMAAAAAAAAAPlBT%2bp9Y1QE%3d&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-time-next-visible" : "Thu, 22 Aug 2019 04:13:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "d6eb639d-0003-003d-609f-588550000000", + "x-ms-popreceipt" : "AwAAAAMAAAAAAAAAL00a6Z9Y1QEBAAAA", + "Date" : "Thu, 22 Aug 2019 04:13:09 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessage95419cc48c1bf915842/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d6eb67b5-0003-003d-4f9f-588550000000", + "Body" : "b74a7f0b-dba6-483e-adf5-c3e78bddf919Thu, 22 Aug 2019 04:13:09 GMTThu, 29 Aug 2019 04:13:09 GMT1Updated test message", + "Date" : "Thu, 22 Aug 2019 04:13:11 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsupdatemessage95419cc48c1bf915842" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs0.json new file mode 100644 index 000000000000..c659b712ab60 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs0.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs006722d021c146", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c6602c-f003-010e-6c9f-589a28000000", + "Date" : "Thu, 22 Aug 2019 04:10:30 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs006722d021c146/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c660d5-f003-010e-699f-589a28000000", + "Body" : "439e7c1e-3c46-4f43-85e9-576ea749b676Thu, 22 Aug 2019 04:10:31 GMTThu, 29 Aug 2019 04:10:31 GMTAgAAAAMAAAAAAAAAVbICip9Y1QE=Thu, 22 Aug 2019 04:10:31 GMT", + "Date" : "Thu, 22 Aug 2019 04:10:31 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs006722d021c146/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c660e8-f003-010e-789f-589a28000000", + "Body" : "439e7c1e-3c46-4f43-85e9-576ea749b676Thu, 22 Aug 2019 04:10:31 GMTThu, 29 Aug 2019 04:10:31 GMTAgAAAAMAAAAAAAAAd1kMnJ9Y1QE=Thu, 22 Aug 2019 04:11:01 GMT1test message before update", + "Date" : "Thu, 22 Aug 2019 04:10:31 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs006722d021c146/messages/439e7c1e-3c46-4f43-85e9-576ea749b676?popreceipt=AgAAAAMAAAAAAAAAd1kMnJ9Y1QE%3dRandom&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "c5c660f1-f003-010e-7f9f-589a28000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:c5c660f1-f003-010e-7f9f-589a28000000\nTime:2019-08-22T04:10:31.9550369ZpopreceiptAgAAAAMAAAAAAAAAd1kMnJ9Y1QE=RandomInvalid pop receipt format", + "Date" : "Thu, 22 Aug 2019 04:10:31 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsupdatemessageinvalidargs006722d021c146" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs1.json new file mode 100644 index 000000000000..47c1ad1145b9 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs1.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs156931e2264b7b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c66125-f003-010e-289f-589a28000000", + "Date" : "Thu, 22 Aug 2019 04:10:32 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs156931e2264b7b/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c66129-f003-010e-2b9f-589a28000000", + "Body" : "91921531-1f0f-421e-af05-b790db72cbd9Thu, 22 Aug 2019 04:10:33 GMTThu, 29 Aug 2019 04:10:33 GMTAgAAAAMAAAAAAAAAVJ4Ki59Y1QE=Thu, 22 Aug 2019 04:10:33 GMT", + "Date" : "Thu, 22 Aug 2019 04:10:32 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs156931e2264b7b/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c6612e-f003-010e-2e9f-589a28000000", + "Body" : "91921531-1f0f-421e-af05-b790db72cbd9Thu, 22 Aug 2019 04:10:33 GMTThu, 29 Aug 2019 04:10:33 GMTAgAAAAMAAAAAAAAAaZL1nJ9Y1QE=Thu, 22 Aug 2019 04:11:03 GMT1test message before update", + "Date" : "Thu, 22 Aug 2019 04:10:32 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs156931e2264b7b/messages/91921531-1f0f-421e-af05-b790db72cbd9Random?popreceipt=AgAAAAMAAAAAAAAAaZL1nJ9Y1QE%3d&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MessageNotFound", + "retry-after" : "0", + "Content-Length" : "221", + "StatusCode" : "404", + "x-ms-request-id" : "c5c66130-f003-010e-309f-589a28000000", + "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:c5c66130-f003-010e-309f-589a28000000\nTime:2019-08-22T04:10:33.9389106Z", + "Date" : "Thu, 22 Aug 2019 04:10:33 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsupdatemessageinvalidargs156931e2264b7b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs2.json new file mode 100644 index 000000000000..a972b773cfaa --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs2.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs251260f631e650", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c6614d-f003-010e-469f-589a28000000", + "Date" : "Thu, 22 Aug 2019 04:10:33 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs251260f631e650/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c66152-f003-010e-4a9f-589a28000000", + "Body" : "5383b4e0-755a-4220-a970-7847d7ce5dafThu, 22 Aug 2019 04:10:34 GMTThu, 29 Aug 2019 04:10:34 GMTAgAAAAMAAAAAAAAAAdCYi59Y1QE=Thu, 22 Aug 2019 04:10:34 GMT", + "Date" : "Thu, 22 Aug 2019 04:10:33 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs251260f631e650/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c66159-f003-010e-4f9f-589a28000000", + "Body" : "5383b4e0-755a-4220-a970-7847d7ce5dafThu, 22 Aug 2019 04:10:34 GMTThu, 29 Aug 2019 04:10:34 GMTAgAAAAMAAAAAAAAAd2CEnZ9Y1QE=Thu, 22 Aug 2019 04:11:04 GMT1test message before update", + "Date" : "Thu, 22 Aug 2019 04:10:33 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs251260f631e650/messages/5383b4e0-755a-4220-a970-7847d7ce5dafRandom?popreceipt=AgAAAAMAAAAAAAAAd2CEnZ9Y1QE%3dRandom&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "c5c6615c-f003-010e-519f-589a28000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:c5c6615c-f003-010e-519f-589a28000000\nTime:2019-08-22T04:10:34.3703182ZpopreceiptAgAAAAMAAAAAAAAAd2CEnZ9Y1QE=RandomInvalid pop receipt format", + "Date" : "Thu, 22 Aug 2019 04:10:33 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueapitestsupdatemessageinvalidargs251260f631e650" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessages.json new file mode 100644 index 000000000000..57c65f78e3b7 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessages.json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99132a2dd07626c50", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912193ea-8003-0128-4f5d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:53 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99132a2dd07626c50/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912193ef-8003-0128-535d-54019c000000", + "Body" : "47563d58-c733-4142-886f-c5bd05235e41Fri, 16 Aug 2019 18:05:53 GMTFri, 23 Aug 2019 18:05:53 GMTAgAAAAMAAAAAAAAAsgKhPl1U1QE=Fri, 16 Aug 2019 18:05:53 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:53 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99132a2dd07626c50/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912193f2-8003-0128-565d-54019c000000", + "Body" : "1bb4d9fb-fd44-49b7-ad96-37211afa321fFri, 16 Aug 2019 18:05:53 GMTFri, 23 Aug 2019 18:05:53 GMTAgAAAAMAAAAAAAAAnfemPl1U1QE=Fri, 16 Aug 2019 18:05:53 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:53 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99132a2dd07626c50/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912193f7-8003-0128-5a5d-54019c000000", + "Body" : "f897a418-dae6-46e9-af53-0b71e3047745Fri, 16 Aug 2019 18:05:53 GMTFri, 23 Aug 2019 18:05:53 GMTAgAAAAMAAAAAAAAAZMWsPl1U1QE=Fri, 16 Aug 2019 18:05:53 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:53 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99132a2dd07626c50?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "3", + "StatusCode" : "200", + "x-ms-request-id" : "912193fc-8003-0128-5f5d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:53 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99132a2dd07626c50/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "91219400-8003-0128-635d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:53 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99132a2dd07626c50?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "91219438-8003-0128-175d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:53 GMT" + } + } ], + "variables" : [ "queueaysncapitestsclearmessages99132a2dd07626c50" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessagesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessagesError.json new file mode 100644 index 000000000000..5d910550c22a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessagesError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessageserror568252add7763d/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0b769-d003-0034-0c88-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0b769-d003-0034-0c88-539fde000000\nTime:2019-08-15T16:40:38.4563063Z", + "Date" : "Thu, 15 Aug 2019 16:40:37 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsclearmessageserror568252add7763d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsCreateQueueWithSharedKey.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsCreateQueueWithSharedKey.json new file mode 100644 index 000000000000..c0b23667f8c5 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsCreateQueueWithSharedKey.json @@ -0,0 +1,20 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestscreatequeuewithsharedkey2100736fe3e", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b2d8-d003-0034-7c88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:30 GMT" + } + } ], + "variables" : [ "queueaysncapitestscreatequeuewithsharedkey2100736fe3e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteExistQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteExistQueue.json new file mode 100644 index 000000000000..a20509a553ac --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteExistQueue.json @@ -0,0 +1,36 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeleteexistqueue35019918c3a4f50", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b2e9-d003-0034-0c88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:30 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeleteexistqueue35019918c3a4f50", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0b2f1-d003-0034-1388-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:30 GMT" + } + } ], + "variables" : [ "queueaysncapitestsdeleteexistqueue35019918c3a4f50" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessage.json new file mode 100644 index 000000000000..bdb68060c5c8 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessage.json @@ -0,0 +1,148 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage27369f8c32c1f5b7a", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219444-8003-0128-225d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:54 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage27369f8c32c1f5b7a/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219448-8003-0128-255d-54019c000000", + "Body" : "25dd02d8-51f6-45ed-9873-ca134944ce1fFri, 16 Aug 2019 18:05:54 GMTFri, 23 Aug 2019 18:05:54 GMTAgAAAAMAAAAAAAAAE+9JP11U1QE=Fri, 16 Aug 2019 18:05:54 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:54 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage27369f8c32c1f5b7a/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9121944c-8003-0128-295d-54019c000000", + "Body" : "697c001a-5b3d-4154-8df2-dbffaa6c8ff1Fri, 16 Aug 2019 18:05:54 GMTFri, 23 Aug 2019 18:05:54 GMTAgAAAAMAAAAAAAAAPtJOP11U1QE=Fri, 16 Aug 2019 18:05:54 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:54 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage27369f8c32c1f5b7a/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9121944e-8003-0128-2b5d-54019c000000", + "Body" : "b536228e-5275-4bdc-8807-16aa802da912Fri, 16 Aug 2019 18:05:54 GMTFri, 23 Aug 2019 18:05:54 GMTAgAAAAMAAAAAAAAAWo5TP11U1QE=Fri, 16 Aug 2019 18:05:54 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:54 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage27369f8c32c1f5b7a/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "91219452-8003-0128-2f5d-54019c000000", + "Body" : "25dd02d8-51f6-45ed-9873-ca134944ce1fFri, 16 Aug 2019 18:05:54 GMTFri, 23 Aug 2019 18:05:54 GMTAgAAAAMAAAAAAAAA6b49UV1U1QE=Fri, 16 Aug 2019 18:06:24 GMT1test message 1", + "Date" : "Fri, 16 Aug 2019 18:05:54 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage27369f8c32c1f5b7a?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "3", + "StatusCode" : "200", + "x-ms-request-id" : "91219456-8003-0128-335d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:54 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage27369f8c32c1f5b7a/messages/25dd02d8-51f6-45ed-9873-ca134944ce1f?popreceipt=AgAAAAMAAAAAAAAA6b49UV1U1QE%3d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "9121945b-8003-0128-375d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:54 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage27369f8c32c1f5b7a?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "2", + "StatusCode" : "200", + "x-ms-request-id" : "91219462-8003-0128-3b5d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:54 GMT" + } + } ], + "variables" : [ "queueaysncapitestsdeletemessage27369f8c32c1f5b7a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs0.json new file mode 100644 index 000000000000..471a0d4cbfc8 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs0.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs033650da2e83", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "364f3bc6-9003-011e-2d9f-58acce000000", + "Date" : "Thu, 22 Aug 2019 04:07:10 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs033650da2e83/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "364f3c14-9003-011e-689f-58acce000000", + "Body" : "2a449811-e11f-494c-a50a-7d2b3ec78aa3Thu, 22 Aug 2019 04:07:11 GMTThu, 29 Aug 2019 04:07:11 GMTAgAAAAMAAAAAAAAAHSO/Ep9Y1QE=Thu, 22 Aug 2019 04:07:11 GMT", + "Date" : "Thu, 22 Aug 2019 04:07:10 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs033650da2e83/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "364f3c21-9003-011e-759f-58acce000000", + "Body" : "2a449811-e11f-494c-a50a-7d2b3ec78aa3Thu, 22 Aug 2019 04:07:11 GMTThu, 29 Aug 2019 04:07:11 GMTAgAAAAMAAAAAAAAAuvrYJJ9Y1QE=Thu, 22 Aug 2019 04:07:41 GMT1test message", + "Date" : "Thu, 22 Aug 2019 04:07:11 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs033650da2e83/messages/2a449811-e11f-494c-a50a-7d2b3ec78aa3?popreceipt=AgAAAAMAAAAAAAAAuvrYJJ9Y1QE%3dRandom", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "364f3c36-9003-011e-079f-58acce000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:364f3c36-9003-011e-079f-58acce000000\nTime:2019-08-22T04:07:12.0722158ZpopreceiptAgAAAAMAAAAAAAAAuvrYJJ9Y1QE=RandomInvalid pop receipt format", + "Date" : "Thu, 22 Aug 2019 04:07:11 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsdeletemessageinvalidargs033650da2e83" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs1.json new file mode 100644 index 000000000000..c6bdb54c96b1 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs1.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs181211d12eef", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "364f3c7b-9003-011e-429f-58acce000000", + "Date" : "Thu, 22 Aug 2019 04:07:12 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs181211d12eef/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "364f3c7f-9003-011e-459f-58acce000000", + "Body" : "19995db2-cb55-434f-9f92-e142aedb3200Thu, 22 Aug 2019 04:07:12 GMTThu, 29 Aug 2019 04:07:12 GMTAgAAAAMAAAAAAAAA1BeDE59Y1QE=Thu, 22 Aug 2019 04:07:12 GMT", + "Date" : "Thu, 22 Aug 2019 04:07:12 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs181211d12eef/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "364f3c86-9003-011e-4c9f-58acce000000", + "Body" : "19995db2-cb55-434f-9f92-e142aedb3200Thu, 22 Aug 2019 04:07:12 GMTThu, 29 Aug 2019 04:07:12 GMTAgAAAAMAAAAAAAAAyV1sJZ9Y1QE=Thu, 22 Aug 2019 04:07:42 GMT1test message", + "Date" : "Thu, 22 Aug 2019 04:07:12 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs181211d12eef/messages/19995db2-cb55-434f-9f92-e142aedb3200Random?popreceipt=AgAAAAMAAAAAAAAAyV1sJZ9Y1QE%3d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MessageNotFound", + "retry-after" : "0", + "Content-Length" : "221", + "StatusCode" : "404", + "x-ms-request-id" : "364f3c8a-9003-011e-509f-58acce000000", + "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:364f3c8a-9003-011e-509f-58acce000000\nTime:2019-08-22T04:07:12.9740745Z", + "Date" : "Thu, 22 Aug 2019 04:07:12 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsdeletemessageinvalidargs181211d12eef" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs2.json new file mode 100644 index 000000000000..b3a83e1a4036 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs2.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs2588132938bc", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "364f3cb2-9003-011e-6e9f-58acce000000", + "Date" : "Thu, 22 Aug 2019 04:07:12 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs2588132938bc/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "364f3cb6-9003-011e-719f-58acce000000", + "Body" : "c1fc6a67-685e-4c94-942d-89d6e41cd927Thu, 22 Aug 2019 04:07:13 GMTThu, 29 Aug 2019 04:07:13 GMTAgAAAAMAAAAAAAAA1QbWE59Y1QE=Thu, 22 Aug 2019 04:07:13 GMT", + "Date" : "Thu, 22 Aug 2019 04:07:12 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs2588132938bc/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "364f3cbb-9003-011e-769f-58acce000000", + "Body" : "c1fc6a67-685e-4c94-942d-89d6e41cd927Thu, 22 Aug 2019 04:07:13 GMTThu, 29 Aug 2019 04:07:13 GMTAgAAAAMAAAAAAAAA9HO/JZ9Y1QE=Thu, 22 Aug 2019 04:07:43 GMT1test message", + "Date" : "Thu, 22 Aug 2019 04:07:12 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs2588132938bc/messages/c1fc6a67-685e-4c94-942d-89d6e41cd927Random?popreceipt=AgAAAAMAAAAAAAAA9HO/JZ9Y1QE%3dRandom", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "364f3cbe-9003-011e-789f-58acce000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:364f3cbe-9003-011e-789f-58acce000000\nTime:2019-08-22T04:07:13.4194990ZpopreceiptAgAAAAMAAAAAAAAA9HO/JZ9Y1QE=RandomInvalid pop receipt format", + "Date" : "Thu, 22 Aug 2019 04:07:12 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsdeletemessageinvalidargs2588132938bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteQueueError.json new file mode 100644 index 000000000000..28150a0ec5eb --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteQueueError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletequeueerror841810489e711bf", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0b2f9-d003-0034-1b88-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0b2f9-d003-0034-1b88-539fde000000\nTime:2019-08-15T16:40:30.9681013Z", + "Date" : "Thu, 15 Aug 2019 16:40:30 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsdeletequeueerror841810489e711bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMessage.json new file mode 100644 index 000000000000..bd66e308eea4 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMessage.json @@ -0,0 +1,58 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemessage73141a25e7999662", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219355-8003-0128-525d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemessage73141a25e7999662/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9121935c-8003-0128-585d-54019c000000", + "Body" : "92da5438-c023-49f2-a272-87f0e247f900Fri, 16 Aug 2019 18:05:52 GMTFri, 23 Aug 2019 18:05:52 GMTAgAAAAMAAAAAAAAAtAm1PV1U1QE=Fri, 16 Aug 2019 18:05:52 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemessage73141a25e7999662/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9121935e-8003-0128-5a5d-54019c000000", + "Body" : "92da5438-c023-49f2-a272-87f0e247f900Fri, 16 Aug 2019 18:05:52 GMTFri, 23 Aug 2019 18:05:52 GMTAgAAAAMAAAAAAAAA4hadT11U1QE=Fri, 16 Aug 2019 18:06:22 GMT1test message", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsdequeuemessage73141a25e7999662" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMultipleMessages.json new file mode 100644 index 000000000000..873a3b561542 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMultipleMessages.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemultiplemessages255061b7b3b7", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9121936a-8003-0128-665d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemultiplemessages255061b7b3b7/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9121936e-8003-0128-685d-54019c000000", + "Body" : "f0348d53-9a41-499e-97a1-1cf03cb0e6e7Fri, 16 Aug 2019 18:05:52 GMTFri, 23 Aug 2019 18:05:52 GMTAgAAAAMAAAAAAAAAtFHYPV1U1QE=Fri, 16 Aug 2019 18:05:52 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemultiplemessages255061b7b3b7/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219370-8003-0128-6a5d-54019c000000", + "Body" : "bf028132-12a0-4fac-a920-8bd751a9381dFri, 16 Aug 2019 18:05:52 GMTFri, 23 Aug 2019 18:05:52 GMTAgAAAAMAAAAAAAAAlEbePV1U1QE=Fri, 16 Aug 2019 18:05:52 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemultiplemessages255061b7b3b7/messages?numofmessages=2&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "91219374-8003-0128-6e5d-54019c000000", + "Body" : "f0348d53-9a41-499e-97a1-1cf03cb0e6e7Fri, 16 Aug 2019 18:05:52 GMTFri, 23 Aug 2019 18:05:52 GMTAgAAAAMAAAAAAAAApbPHT11U1QE=Fri, 16 Aug 2019 18:06:22 GMT1test message 1bf028132-12a0-4fac-a920-8bd751a9381dFri, 16 Aug 2019 18:05:52 GMTFri, 23 Aug 2019 18:05:52 GMTAgAAAAMAAAAAAAAApbPHT11U1QE=Fri, 16 Aug 2019 18:06:22 GMT1test message 2", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsdequeuemultiplemessages255061b7b3b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueTooManyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueTooManyMessage.json new file mode 100644 index 000000000000..88673523a9ef --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueTooManyMessage.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuetoomanymessage93456993efa0c", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b5f1-d003-0034-3e88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:36 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuetoomanymessage93456993efa0c/messages?numofmessages=33&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "456", + "StatusCode" : "400", + "x-ms-request-id" : "86d0b5ff-d003-0034-4b88-539fde000000", + "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:86d0b5ff-d003-0034-4b88-539fde000000\nTime:2019-08-15T16:40:36.7857017Znumofmessages33132", + "Date" : "Thu, 15 Aug 2019 16:40:36 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsdequeuetoomanymessage93456993efa0c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueEmptyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueEmptyMessage.json new file mode 100644 index 000000000000..ec5367031b66 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueEmptyMessage.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueueemptymessage216013d05d05a6", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219340-8003-0128-405d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueueemptymessage216013d05d05a6/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219342-8003-0128-415d-54019c000000", + "Body" : "25265028-8417-40f3-af62-760b16bf1c28Fri, 16 Aug 2019 18:05:51 GMTFri, 23 Aug 2019 18:05:51 GMTAgAAAAMAAAAAAAAA1LCFPV1U1QE=Fri, 16 Aug 2019 18:05:51 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsenqueueemptymessage216013d05d05a6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueMessage.json new file mode 100644 index 000000000000..ec146093c39d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueMessage.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueuemessage4754410cf5bbe050", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219332-8003-0128-345d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueuemessage4754410cf5bbe050/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219335-8003-0128-365d-54019c000000", + "Body" : "0f7c71cd-8917-4767-a1bd-3c32da479d60Fri, 16 Aug 2019 18:05:51 GMTFri, 23 Aug 2019 18:05:51 GMTAgAAAAMAAAAAAAAANyFpPV1U1QE=Fri, 16 Aug 2019 18:05:51 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:51 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsenqueuemessage4754410cf5bbe050" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueTimeToLive.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueTimeToLive.json new file mode 100644 index 000000000000..e05acbb8dae2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueTimeToLive.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueuetimetolive942001ea0bb1007", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b55d-d003-0034-3988-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:35 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueuetimetolive942001ea0bb1007/messages?visibilitytimeout=0&messagettl=2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b564-d003-0034-3f88-539fde000000", + "Body" : "4dfa6c0e-0faa-4f92-9327-4fc14c151027Thu, 15 Aug 2019 16:40:35 GMTThu, 15 Aug 2019 16:40:37 GMTAgAAAAMAAAAAAAAAKzm1KYhT1QE=Thu, 15 Aug 2019 16:40:35 GMT", + "Date" : "Thu, 15 Aug 2019 16:40:35 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsenqueuetimetolive942001ea0bb1007" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicy.json new file mode 100644 index 000000000000..3288923c2dd0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicy.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetaccesspolicy13402477ddf897a6", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b45e-d003-0034-5388-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:33 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetaccesspolicy13402477ddf897a6?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b469-d003-0034-5b88-539fde000000", + "Body" : "", + "Date" : "Thu, 15 Aug 2019 16:40:33 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsgetaccesspolicy13402477ddf897a6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicyDoesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicyDoesError.json new file mode 100644 index 000000000000..af256fc76af8 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicyDoesError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetaccesspolicydoeserror56212d23d22?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0b489-d003-0034-7888-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0b489-d003-0034-7888-539fde000000\nTime:2019-08-15T16:40:34.0060234Z", + "Date" : "Thu, 15 Aug 2019 16:40:33 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsgetaccesspolicydoeserror56212d23d22" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetProperties.json new file mode 100644 index 000000000000..d9603b7d9e31 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetProperties.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetproperties7430531cdaa42d19a", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b303-d003-0034-2388-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:30 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetproperties7430531cdaa42d19a?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b30e-d003-0034-2a88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:30 GMT" + } + } ], + "variables" : [ "queueaysncapitestsgetproperties7430531cdaa42d19a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..457195c34d0f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetPropertiesError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetpropertieserror93872b7a1476bc?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0b326-d003-0034-3c88-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0b326-d003-0034-3c88-539fde000000\nTime:2019-08-15T16:40:31.3074281Z", + "Date" : "Thu, 15 Aug 2019 16:40:30 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsgetpropertieserror93872b7a1476bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessage.json new file mode 100644 index 000000000000..54eb7e446383 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessage.json @@ -0,0 +1,58 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmessage9735106f1fdf7215b4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219399-8003-0128-0c5d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:52 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmessage9735106f1fdf7215b4/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912193a1-8003-0128-125d-54019c000000", + "Body" : "12b08c03-821b-4cd4-8cb9-c73833de908fFri, 16 Aug 2019 18:05:52 GMTFri, 23 Aug 2019 18:05:52 GMTAgAAAAMAAAAAAAAAfaEhPl1U1QE=Fri, 16 Aug 2019 18:05:52 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:52 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmessage9735106f1fdf7215b4/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "912193a7-8003-0128-175d-54019c000000", + "Body" : "12b08c03-821b-4cd4-8cb9-c73833de908fFri, 16 Aug 2019 18:05:52 GMTFri, 23 Aug 2019 18:05:52 GMT0test message", + "Date" : "Fri, 16 Aug 2019 18:05:52 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestspeekmessage9735106f1fdf7215b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessagesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessagesError.json new file mode 100644 index 000000000000..7126fe327311 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessagesError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmessageserror93819ee1f00a5b7/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0b707-d003-0034-3488-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0b707-d003-0034-3488-539fde000000\nTime:2019-08-15T16:40:37.8036777Z", + "Date" : "Thu, 15 Aug 2019 16:40:37 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestspeekmessageserror93819ee1f00a5b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMultipleMessages.json new file mode 100644 index 000000000000..d7ab0420d884 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMultipleMessages.json @@ -0,0 +1,77 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmultiplemessages7820061928ef4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912193b5-8003-0128-245d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:52 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmultiplemessages7820061928ef4/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912193b8-8003-0128-265d-54019c000000", + "Body" : "05a487d7-c198-4baf-904e-0924d6343696Fri, 16 Aug 2019 18:05:53 GMTFri, 23 Aug 2019 18:05:53 GMTAgAAAAMAAAAAAAAAdNBHPl1U1QE=Fri, 16 Aug 2019 18:05:53 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:52 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmultiplemessages7820061928ef4/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912193bd-8003-0128-2b5d-54019c000000", + "Body" : "0290cad4-34fd-4032-a6f0-8772a7ffcaa8Fri, 16 Aug 2019 18:05:53 GMTFri, 23 Aug 2019 18:05:53 GMTAgAAAAMAAAAAAAAAUsVNPl1U1QE=Fri, 16 Aug 2019 18:05:53 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:52 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmultiplemessages7820061928ef4/messages?numofmessages=2&peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "912193c1-8003-0128-2d5d-54019c000000", + "Body" : "05a487d7-c198-4baf-904e-0924d6343696Fri, 16 Aug 2019 18:05:53 GMTFri, 23 Aug 2019 18:05:53 GMT0test message 10290cad4-34fd-4032-a6f0-8772a7ffcaa8Fri, 16 Aug 2019 18:05:53 GMTFri, 23 Aug 2019 18:05:53 GMT0test message 2", + "Date" : "Fri, 16 Aug 2019 18:05:52 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestspeekmultiplemessages7820061928ef4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekTooManyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekTooManyMessage.json new file mode 100644 index 000000000000..13518cbf820a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekTooManyMessage.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeektoomanymessage67437d1be16832", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b6e1-d003-0034-1088-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:37 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeektoomanymessage67437d1be16832/messages?numofmessages=33&peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "456", + "StatusCode" : "400", + "x-ms-request-id" : "86d0b6f1-d003-0034-1f88-539fde000000", + "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:86d0b6f1-d003-0034-1f88-539fde000000\nTime:2019-08-15T16:40:37.6515310Znumofmessages33132", + "Date" : "Thu, 15 Aug 2019 16:40:37 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestspeektoomanymessage67437d1be16832" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAccessPolicy.json new file mode 100644 index 000000000000..a9be7cf8b45d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAccessPolicy.json @@ -0,0 +1,56 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetaccesspolicy18055e6054856759", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b493-d003-0034-0188-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:33 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetaccesspolicy18055e6054856759?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0b49b-d003-0034-0888-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:33 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetaccesspolicy18055e6054856759?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b49f-d003-0034-0c88-539fde000000", + "Body" : "testpermission2000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zraup", + "Date" : "Thu, 15 Aug 2019 16:40:33 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestssetaccesspolicy18055e6054856759" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata0.json new file mode 100644 index 000000000000..39a66b3fea58 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata0.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata0775692feb2e02", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b330-d003-0034-4588-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:30 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata0775692feb2e02?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b33b-d003-0034-4f88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata0775692feb2e02?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0b346-d003-0034-5a88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata0775692feb2e02?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b34c-d003-0034-6088-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + } ], + "variables" : [ "queueaysncapitestssetandclearmetadata0775692feb2e02" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata1.json new file mode 100644 index 000000000000..7ed34369afe8 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata1.json @@ -0,0 +1,74 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata16389313ee0457", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b35e-d003-0034-7288-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata16389313ee0457?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "x-ms-meta-metadata1" : "value", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b364-d003-0034-7788-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata16389313ee0457?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0b369-d003-0034-7c88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata16389313ee0457?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b36d-d003-0034-8088-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + } ], + "variables" : [ "queueaysncapitestssetandclearmetadata16389313ee0457" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata2.json new file mode 100644 index 000000000000..f65ae6875bfb --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata2.json @@ -0,0 +1,73 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata2207469fbef13f", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b382-d003-0034-1188-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata2207469fbef13f?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "x-ms-meta-metadata1" : "value", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b388-d003-0034-1688-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata2207469fbef13f?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0b38c-d003-0034-1a88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata2207469fbef13f?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b390-d003-0034-1e88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + } ], + "variables" : [ "queueaysncapitestssetandclearmetadata2207469fbef13f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata3.json new file mode 100644 index 000000000000..76ba1d97280a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata3.json @@ -0,0 +1,74 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata3352166135e768", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b3a5-d003-0034-3088-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata3352166135e768?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b3ab-d003-0034-3588-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata3352166135e768?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0b3b1-d003-0034-3a88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:31 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata3352166135e768?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b3b6-d003-0034-3e88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT" + } + } ], + "variables" : [ "queueaysncapitestssetandclearmetadata3352166135e768" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata4.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata4.json new file mode 100644 index 000000000000..5910a551d6c3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata4.json @@ -0,0 +1,72 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata4960994418e531", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b3c7-d003-0034-4f88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata4960994418e531?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b3cf-d003-0034-5688-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata4960994418e531?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0b3d3-d003-0034-5a88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata4960994418e531?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b3d7-d003-0034-5e88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT" + } + } ], + "variables" : [ "queueaysncapitestssetandclearmetadata4960994418e531" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidAccessPolicy.json new file mode 100644 index 000000000000..9c6ac803b9f8 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidAccessPolicy.json @@ -0,0 +1,40 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidaccesspolicy33486e6d29ea", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b4b6-d003-0034-2088-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:33 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidaccesspolicy33486e6d29ea?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "371", + "StatusCode" : "400", + "x-ms-request-id" : "86d0b4c0-d003-0034-2788-539fde000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:86d0b4c0-d003-0034-2788-539fde000000\nTime:2019-08-15T16:40:34.4924928Z1304Signed identifier ID cannot be empty or over 64 characters in length", + "Date" : "Thu, 15 Aug 2019 16:40:34 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestssetinvalidaccesspolicy33486e6d29ea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta0.json new file mode 100644 index 000000000000..b88111954c67 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta0.json @@ -0,0 +1,38 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta01683215ccccf91c2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b3f6-d003-0034-7988-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta01683215ccccf91c2?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "790", + "StatusCode" : "403", + "x-ms-request-id" : "86d0b401-d003-0034-0288-539fde000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:86d0b401-d003-0034-0288-539fde000000\nTime:2019-08-15T16:40:33.1201697ZThe MAC signature found in the HTTP request 'e+GF4D6YPu1FAAvKG8lumPMuaoEpcPbaCCWI3NCVxQ8=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nThu, 15 Aug 2019 16:40:33 GMT\n\n\n\n\n\nx-ms-client-request-id:5d04df0d-c387-4de8-8021-1db1a744ee09\nx-ms-meta-invalidmeta:value\nx-ms-version:2018-03-28\n/azstoragesdkaccount/queueaysncapitestssetinvalidmeta01683215ccccf91c2\ncomp:metadata'.", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestssetinvalidmeta01683215ccccf91c2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta1.json new file mode 100644 index 000000000000..6ee282eda8d3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta1.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta1355070856bfd3545", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b414-d003-0034-1288-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta1355070856bfd3545?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "86d0b416-d003-0034-1388-539fde000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:86d0b416-d003-0034-1388-539fde000000\nTime:2019-08-15T16:40:33.2923348Z", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestssetinvalidmeta1355070856bfd3545" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta2.json new file mode 100644 index 000000000000..da2ee9274904 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta2.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta275909d41ee97d45b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b428-d003-0034-2288-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta275909d41ee97d45b?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "86d0b42e-d003-0034-2788-539fde000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:86d0b42e-d003-0034-2788-539fde000000\nTime:2019-08-15T16:40:33.4715096Z", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestssetinvalidmeta275909d41ee97d45b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta3.json new file mode 100644 index 000000000000..e55852f38e1f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta3.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta350468db0a5487ffa", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b43c-d003-0034-3588-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:33 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta350468db0a5487ffa?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "86d0b446-d003-0034-3e88-539fde000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:86d0b446-d003-0034-3e88-539fde000000\nTime:2019-08-15T16:40:33.6326628Zvalue", + "Date" : "Thu, 15 Aug 2019 16:40:33 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestssetinvalidmeta350468db0a5487ffa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMetadataQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMetadataQueueError.json new file mode 100644 index 000000000000..3ae851d04a98 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMetadataQueueError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetmetadataqueueerror74958551a725e?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "86d0b3e6-d003-0034-6c88-539fde000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:86d0b3e6-d003-0034-6c88-539fde000000\nTime:2019-08-15T16:40:32.9049634Z", + "Date" : "Thu, 15 Aug 2019 16:40:32 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestssetmetadataqueueerror74958551a725e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMultipleAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMultipleAccessPolicies.json new file mode 100644 index 000000000000..4e1877b8f62d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMultipleAccessPolicies.json @@ -0,0 +1,56 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetmultipleaccesspolicies342073fd3a7", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b4d8-d003-0034-3d88-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:34 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetmultipleaccesspolicies342073fd3a7?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "86d0b4e0-d003-0034-4488-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:34 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetmultipleaccesspolicies342073fd3a7?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "86d0b4ee-d003-0034-5288-539fde000000", + "Body" : "policy02000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zrpolicy12000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zrpolicy22000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zr", + "Date" : "Thu, 15 Aug 2019 16:40:34 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestssetmultipleaccesspolicies342073fd3a7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetTooManyAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetTooManyAccessPolicies.json new file mode 100644 index 000000000000..666a75494585 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetTooManyAccessPolicies.json @@ -0,0 +1,40 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssettoomanyaccesspolicies064709aed35", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "86d0b503-d003-0034-6688-539fde000000", + "Date" : "Thu, 15 Aug 2019 16:40:34 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssettoomanyaccesspolicies064709aed35?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "86d0b50d-d003-0034-6d88-539fde000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:86d0b50d-d003-0034-6d88-539fde000000\nTime:2019-08-15T16:40:35.0590380Z00", + "Date" : "Thu, 15 Aug 2019 16:40:34 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestssettoomanyaccesspolicies064709aed35" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessage.json new file mode 100644 index 000000000000..ff09e743fc8b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessage.json @@ -0,0 +1,96 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessage99209ac49cd86918f", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9121951a-8003-0128-625d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:57 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessage99209ac49cd86918f/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9121951e-8003-0128-655d-54019c000000", + "Body" : "e2640f0e-267b-40db-b55b-68ed88ab95bfFri, 16 Aug 2019 18:05:57 GMTFri, 23 Aug 2019 18:05:57 GMTAgAAAAMAAAAAAAAA3EkJQV1U1QE=Fri, 16 Aug 2019 18:05:57 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:57 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessage99209ac49cd86918f/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9121951f-8003-0128-665d-54019c000000", + "Body" : "e2640f0e-267b-40db-b55b-68ed88ab95bfFri, 16 Aug 2019 18:05:57 GMTFri, 23 Aug 2019 18:05:57 GMTAgAAAAMAAAAAAAAATB7wUl1U1QE=Fri, 16 Aug 2019 18:06:27 GMT1test message before update", + "Date" : "Fri, 16 Aug 2019 18:05:57 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessage99209ac49cd86918f/messages/e2640f0e-267b-40db-b55b-68ed88ab95bf?popreceipt=AgAAAAMAAAAAAAAATB7wUl1U1QE%3d&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-time-next-visible" : "Fri, 16 Aug 2019 18:05:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "91219525-8003-0128-6c5d-54019c000000", + "x-ms-popreceipt" : "AwAAAAMAAAAAAAAA5+vFQV1U1QEBAAAA", + "Date" : "Fri, 16 Aug 2019 18:05:57 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessage99209ac49cd86918f/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9121958f-8003-0128-465d-54019c000000", + "Body" : "e2640f0e-267b-40db-b55b-68ed88ab95bfFri, 16 Aug 2019 18:05:57 GMTFri, 23 Aug 2019 18:05:57 GMT1Updated test message", + "Date" : "Fri, 16 Aug 2019 18:05:59 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsupdatemessage99209ac49cd86918f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs0.json new file mode 100644 index 000000000000..8f316d15265a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs0.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs0071688f249c", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219595-8003-0128-4c5d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:59 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs0071688f249c/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "91219598-8003-0128-4e5d-54019c000000", + "Body" : "c9910a68-4d73-4ea3-8c1b-81eb8c37fc55Fri, 16 Aug 2019 18:06:00 GMTFri, 23 Aug 2019 18:06:00 GMTAgAAAAMAAAAAAAAAMEd8Ql1U1QE=Fri, 16 Aug 2019 18:06:00 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:59 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs0071688f249c/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9121959b-8003-0128-515d-54019c000000", + "Body" : "c9910a68-4d73-4ea3-8c1b-81eb8c37fc55Fri, 16 Aug 2019 18:06:00 GMTFri, 23 Aug 2019 18:06:00 GMTAgAAAAMAAAAAAAAAVs1iVF1U1QE=Fri, 16 Aug 2019 18:06:30 GMT1test message before update", + "Date" : "Fri, 16 Aug 2019 18:05:59 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs0071688f249c/messages/c9910a68-4d73-4ea3-8c1b-81eb8c37fc55?popreceipt=AgAAAAMAAAAAAAAAVs1iVF1U1QE%3dRandom&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "9121959e-8003-0128-545d-54019c000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:9121959e-8003-0128-545d-54019c000000\nTime:2019-08-16T18:06:00.2095740ZpopreceiptAgAAAAMAAAAAAAAAVs1iVF1U1QE=RandomInvalid pop receipt format", + "Date" : "Fri, 16 Aug 2019 18:05:59 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsupdatemessageinvalidargs0071688f249c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs1.json new file mode 100644 index 000000000000..21e593f92376 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs1.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs19698615d38e", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912195a4-8003-0128-5a5d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:05:59 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs19698615d38e/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912195a8-8003-0128-5d5d-54019c000000", + "Body" : "9802de95-942c-4bc0-962a-f05ee941895cFri, 16 Aug 2019 18:06:00 GMTFri, 23 Aug 2019 18:06:00 GMTAgAAAAMAAAAAAAAABu+gQl1U1QE=Fri, 16 Aug 2019 18:06:00 GMT", + "Date" : "Fri, 16 Aug 2019 18:05:59 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs19698615d38e/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "912195ab-8003-0128-605d-54019c000000", + "Body" : "9802de95-942c-4bc0-962a-f05ee941895cFri, 16 Aug 2019 18:06:00 GMTFri, 23 Aug 2019 18:06:00 GMTAgAAAAMAAAAAAAAAmxGIVF1U1QE=Fri, 16 Aug 2019 18:06:30 GMT1test message before update", + "Date" : "Fri, 16 Aug 2019 18:05:59 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs19698615d38e/messages/9802de95-942c-4bc0-962a-f05ee941895cRandom?popreceipt=AgAAAAMAAAAAAAAAmxGIVF1U1QE%3d&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MessageNotFound", + "retry-after" : "0", + "Content-Length" : "221", + "StatusCode" : "404", + "x-ms-request-id" : "912195ad-8003-0128-625d-54019c000000", + "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:912195ad-8003-0128-625d-54019c000000\nTime:2019-08-16T18:06:00.4608159Z", + "Date" : "Fri, 16 Aug 2019 18:05:59 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsupdatemessageinvalidargs19698615d38e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs2.json new file mode 100644 index 000000000000..b2084994c227 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs2.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs209898cf67dd", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912195b8-8003-0128-6d5d-54019c000000", + "Date" : "Fri, 16 Aug 2019 18:06:00 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs209898cf67dd/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "912195ba-8003-0128-6e5d-54019c000000", + "Body" : "ee64e4ce-2a62-4520-8b20-451bceb91ce1Fri, 16 Aug 2019 18:06:00 GMTFri, 23 Aug 2019 18:06:00 GMTAgAAAAMAAAAAAAAABlPKQl1U1QE=Fri, 16 Aug 2019 18:06:00 GMT", + "Date" : "Fri, 16 Aug 2019 18:06:00 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs209898cf67dd/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "912195be-8003-0128-725d-54019c000000", + "Body" : "ee64e4ce-2a62-4520-8b20-451bceb91ce1Fri, 16 Aug 2019 18:06:00 GMTFri, 23 Aug 2019 18:06:00 GMTAgAAAAMAAAAAAAAAZ66yVF1U1QE=Fri, 16 Aug 2019 18:06:30 GMT1test message before update", + "Date" : "Fri, 16 Aug 2019 18:06:00 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs209898cf67dd/messages/ee64e4ce-2a62-4520-8b20-451bceb91ce1Random?popreceipt=AgAAAAMAAAAAAAAAZ66yVF1U1QE%3dRandom&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "912195c6-8003-0128-785d-54019c000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:912195c6-8003-0128-785d-54019c000000\nTime:2019-08-16T18:06:00.7380840ZpopreceiptAgAAAAMAAAAAAAAAZ66yVF1U1QE=RandomInvalid pop receipt format", + "Date" : "Fri, 16 Aug 2019 18:06:00 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueaysncapitestsupdatemessageinvalidargs209898cf67dd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateNull.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateNull.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateNull.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueue.json new file mode 100644 index 000000000000..ff49df271c5d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueue.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeue200307ec51897b5ab", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c3c63d02-4003-011c-175e-54ae34000000", + "Date" : "Fri, 16 Aug 2019 18:16:46 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeue200307ec51897b5ab/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c3c64018-4003-011c-485e-54ae34000000", + "Body" : "8d38b72b-0d4d-4042-b161-6e29d8371de3Fri, 16 Aug 2019 18:16:46 GMTFri, 23 Aug 2019 18:16:46 GMTAgAAAAMAAAAAAAAAkuzxw15U1QE=Fri, 16 Aug 2019 18:16:46 GMT", + "Date" : "Fri, 16 Aug 2019 18:16:46 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceapitestscreatequeue200307ec51897b5ab" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload0.json new file mode 100644 index 000000000000..719772df2278 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload0.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload077378a2199a", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d2e7d8d1-1003-00ee-1414-593af5000000", + "Date" : "Thu, 22 Aug 2019 18:08:10 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload077378a2199a/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d2e7d8e3-1003-00ee-2414-593af5000000", + "Body" : "9caa14aa-04db-479a-83ba-fc090498f781Thu, 22 Aug 2019 18:08:11 GMTThu, 29 Aug 2019 18:08:11 GMTAgAAAAMAAAAAAAAAr9H8jhRZ1QE=Thu, 22 Aug 2019 18:08:11 GMT", + "Date" : "Thu, 22 Aug 2019 18:08:10 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceapitestscreatequeuemaxoverload077378a2199a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload1.json new file mode 100644 index 000000000000..3850eb8a999f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload1.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload102435ef5dfb", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d2e7d911-1003-00ee-5014-593af5000000", + "Date" : "Thu, 22 Aug 2019 18:08:10 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload102435ef5dfb/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d2e7d920-1003-00ee-5e14-593af5000000", + "Body" : "dcc173dd-69b9-49c8-8870-00b6c37dc155Thu, 22 Aug 2019 18:08:11 GMTThu, 29 Aug 2019 18:08:11 GMTAgAAAAMAAAAAAAAA5y8UjxRZ1QE=Thu, 22 Aug 2019 18:08:11 GMT", + "Date" : "Thu, 22 Aug 2019 18:08:10 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceapitestscreatequeuemaxoverload102435ef5dfb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload2.json new file mode 100644 index 000000000000..94d28b0c74dc --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload2.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload209964e6e10f", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d2e7d95a-1003-00ee-1514-593af5000000", + "Date" : "Thu, 22 Aug 2019 18:08:10 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload209964e6e10f/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d2e7d96a-1003-00ee-2414-593af5000000", + "Body" : "be798fce-c60d-44c9-b1cc-ede4a1c4bf13Thu, 22 Aug 2019 18:08:11 GMTThu, 29 Aug 2019 18:08:11 GMTAgAAAAMAAAAAAAAAoNgtjxRZ1QE=Thu, 22 Aug 2019 18:08:11 GMT", + "Date" : "Thu, 22 Aug 2019 18:08:10 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceapitestscreatequeuemaxoverload209964e6e10f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidMetadata.json new file mode 100644 index 000000000000..54410b10741f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidMetadata.json @@ -0,0 +1,21 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/3fb1a9c3baec4586", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "339", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid Header

            \r\n

            HTTP Error 400. The request has an invalid header name.

            \r\n\r\n", + "Date" : "Thu, 15 Aug 2019 16:40:44 GMT", + "Content-Type" : "text/html; charset=us-ascii" + } + } ], + "variables" : [ "3fb1a9c3baec4586" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName0.json new file mode 100644 index 000000000000..525fd6e4ea87 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName0.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/a_b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "86d0bb53-d003-0034-2088-539fde000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:86d0bb53-d003-0034-2088-539fde000000\nTime:2019-08-15T16:40:44.2939271Z", + "Date" : "Thu, 15 Aug 2019 16:40:43 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName1.json new file mode 100644 index 000000000000..18fd8e02e7f3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName1.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/-ab", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "86d0bb5d-d003-0034-2988-539fde000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:86d0bb5d-d003-0034-2988-539fde000000\nTime:2019-08-15T16:40:44.3950248Z", + "Date" : "Thu, 15 Aug 2019 16:40:43 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName2.json new file mode 100644 index 000000000000..6dc9821c78d2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName2.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/a--b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "86d0bb69-d003-0034-3488-539fde000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:86d0bb69-d003-0034-3488-539fde000000\nTime:2019-08-15T16:40:44.4961229Z", + "Date" : "Thu, 15 Aug 2019 16:40:44 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName3.json new file mode 100644 index 000000000000..e63f4a5b7881 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName3.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/Abc", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "86d0bb7c-d003-0034-4788-539fde000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:86d0bb7c-d003-0034-4788-539fde000000\nTime:2019-08-15T16:40:44.5872096Z", + "Date" : "Thu, 15 Aug 2019 16:40:44 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName4.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName4.json new file mode 100644 index 000000000000..cd17d136fdfe --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName4.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/ab", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "86d0bb88-d003-0034-5288-539fde000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:86d0bb88-d003-0034-5288-539fde000000\nTime:2019-08-15T16:40:44.6823024Z", + "Date" : "Thu, 15 Aug 2019 16:40:44 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName5.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName5.json new file mode 100644 index 000000000000..ed1dfa6d0392 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName5.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/verylongverylongverylongverylongverylongverylongverylongverylong", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "86d0bb9f-d003-0034-6488-539fde000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:86d0bb9f-d003-0034-6488-539fde000000\nTime:2019-08-15T16:40:44.7723883Z", + "Date" : "Thu, 15 Aug 2019 16:40:44 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueue.json new file mode 100644 index 000000000000..24282989db91 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueue.json @@ -0,0 +1,56 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestsdeletequeue71149947a5329b7bf", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ffcee794-b003-0024-5c5e-54a938000000", + "Date" : "Fri, 16 Aug 2019 18:16:50 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestsdeletequeue71149947a5329b7bf", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "ffcee7a8-b003-0024-6d5e-54a938000000", + "Date" : "Fri, 16 Aug 2019 18:16:50 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestsdeletequeue71149947a5329b7bf/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 11.0.3; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "ffcee7b1-b003-0024-745e-54a938000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:ffcee7b1-b003-0024-745e-54a938000000\nTime:2019-08-16T18:16:50.6535102Z", + "Date" : "Fri, 16 Aug 2019 18:16:50 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceapitestsdeletequeue71149947a5329b7bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueueError.json new file mode 100644 index 000000000000..4dcc7458529f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueueError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestsdeletequeueerror1100262e3172b5", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b9c9c827-2003-0008-0988-532b05000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b9c9c827-2003-0008-0988-532b05000000\nTime:2019-08-15T16:40:45.9754728Z", + "Date" : "Thu, 15 Aug 2019 16:40:45 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceapitestsdeletequeueerror1100262e3172b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetAndSetProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetAndSetProperties.json new file mode 100644 index 000000000000..d0be4644da50 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetAndSetProperties.json @@ -0,0 +1,78 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "14882d4f-6003-00ea-4088-53cf77000000", + "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 15 Aug 2019 16:40:47 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "14882d82-6003-00ea-6f88-53cf77000000", + "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 15 Aug 2019 16:40:47 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "14882da7-6003-00ea-1288-53cf77000000", + "Date" : "Thu, 15 Aug 2019 16:40:48 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "14882ebe-6003-00ea-1488-53cf77000000", + "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 15 Aug 2019 16:40:48 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetQueueClient.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetQueueClient.json new file mode 100644 index 000000000000..dbb9e99a8d2a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetQueueClient.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queueserviceapitestsgetqueueclient02320715bfd10cd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListEmptyQueues.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListEmptyQueues.json new file mode 100644 index 000000000000..de513b4009ee --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListEmptyQueues.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=QueueServiceAPITestsListEmptyQueues&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "14882d28-6003-00ea-1b88-53cf77000000", + "Body" : "QueueServiceAPITestsListEmptyQueues", + "Date" : "Thu, 15 Aug 2019 16:40:47 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceapitestslistemptyqueues28264ca30cb29e2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues0.json new file mode 100644 index 000000000000..84f3a0f6abae --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues0.json @@ -0,0 +1,119 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues0197608aaded4b7b220", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9c84f-2003-0008-2b88-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues0197608aaded4b7b221", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9c86a-2003-0008-4488-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues0197608aaded4b7b222", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9c86f-2003-0008-4888-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceapitestslistqueues&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b9c9c87b-2003-0008-5188-532b05000000", + "Body" : "queueserviceapitestslistqueuesqueueserviceapitestslistqueues0197608aaded4b7b220queueserviceapitestslistqueues0197608aaded4b7b221queueserviceapitestslistqueues0197608aaded4b7b222", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues0197608aaded4b7b220", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b9c9c880-2003-0008-5688-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues0197608aaded4b7b221", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b9c9c888-2003-0008-5c88-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues0197608aaded4b7b222", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b9c9c895-2003-0008-6788-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + } ], + "variables" : [ "queueserviceapitestslistqueues0197608aaded4b7b22" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues1.json new file mode 100644 index 000000000000..d529b881dd91 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues1.json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1262287461f7bb9c2c0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9c89f-2003-0008-6f88-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1262287461f7bb9c2c1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9c8ab-2003-0008-7788-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1262287461f7bb9c2c2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9c8b0-2003-0008-7b88-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceapitestslistqueues&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b9c9c8bd-2003-0008-0588-532b05000000", + "Body" : "queueserviceapitestslistqueues2queueserviceapitestslistqueues1262287461f7bb9c2c0queueserviceapitestslistqueues1262287461f7bb9c2c1/azstoragesdkaccount/queueserviceapitestslistqueues1262287461f7bb9c2c2", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceapitestslistqueues&marker=/azstoragesdkaccount/queueserviceapitestslistqueues1262287461f7bb9c2c2&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b9c9c8c6-2003-0008-0b88-532b05000000", + "Body" : "queueserviceapitestslistqueues/azstoragesdkaccount/queueserviceapitestslistqueues1262287461f7bb9c2c22queueserviceapitestslistqueues1262287461f7bb9c2c2", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1262287461f7bb9c2c0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "14882a79-6003-00ea-1088-53cf77000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1262287461f7bb9c2c1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "14882b6a-6003-00ea-7588-53cf77000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1262287461f7bb9c2c2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "14882b7e-6003-00ea-0988-53cf77000000", + "Date" : "Thu, 15 Aug 2019 16:40:46 GMT" + } + } ], + "variables" : [ "queueserviceapitestslistqueues1262287461f7bb9c2c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues2.json new file mode 100644 index 000000000000..0284f7c87a30 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues2.json @@ -0,0 +1,119 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2335005ecce17d3f5b0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "14882bad-6003-00ea-3688-53cf77000000", + "Date" : "Thu, 15 Aug 2019 16:40:47 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2335005ecce17d3f5b1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "14882ca0-6003-00ea-1b88-53cf77000000", + "Date" : "Thu, 15 Aug 2019 16:40:47 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2335005ecce17d3f5b2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "14882cb8-6003-00ea-2e88-53cf77000000", + "Date" : "Thu, 15 Aug 2019 16:40:47 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceapitestslistqueues&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "14882ccc-6003-00ea-4188-53cf77000000", + "Body" : "queueserviceapitestslistqueuesqueueserviceapitestslistqueues2335005ecce17d3f5b0value0queueserviceapitestslistqueues2335005ecce17d3f5b1value1queueserviceapitestslistqueues2335005ecce17d3f5b2value2", + "Date" : "Thu, 15 Aug 2019 16:40:47 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2335005ecce17d3f5b0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "14882cde-6003-00ea-5388-53cf77000000", + "Date" : "Thu, 15 Aug 2019 16:40:47 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2335005ecce17d3f5b1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "14882cee-6003-00ea-6288-53cf77000000", + "Date" : "Thu, 15 Aug 2019 16:40:47 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2335005ecce17d3f5b2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "14882cfe-6003-00ea-7288-53cf77000000", + "Date" : "Thu, 15 Aug 2019 16:40:47 GMT" + } + } ], + "variables" : [ "queueserviceapitestslistqueues2335005ecce17d3f5b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateNull.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateNull.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateNull.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueue.json new file mode 100644 index 000000000000..c43ca22fe176 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueue.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeue521554a9cfcc30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "daf2fcf9-5003-0007-6b17-59c6f3000000", + "Date" : "Thu, 22 Aug 2019 18:30:21 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeue521554a9cfcc30/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "daf2fda1-5003-0007-0517-59c6f3000000", + "Body" : "32773691-e38e-4dd7-a68a-b8e0f381a0a7Thu, 22 Aug 2019 18:30:21 GMTThu, 29 Aug 2019 18:30:21 GMTAgAAAAMAAAAAAAAAWrcbqBdZ1QE=Thu, 22 Aug 2019 18:30:21 GMT", + "Date" : "Thu, 22 Aug 2019 18:30:21 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceasyncapitestscreatequeue521554a9cfcc30" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload0.json new file mode 100644 index 000000000000..b53f1fab3b9d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload0.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload0329150ba", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2f3b5c73-6003-0087-6e15-596559000000", + "Date" : "Thu, 22 Aug 2019 18:16:36 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload0329150ba/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2f3b5c96-6003-0087-0915-596559000000", + "Body" : "e182e244-b790-4ce6-adf3-cedf08aa3966Thu, 22 Aug 2019 18:16:36 GMTThu, 29 Aug 2019 18:16:36 GMTAgAAAAMAAAAAAAAA1zJlvBVZ1QE=Thu, 22 Aug 2019 18:16:36 GMT", + "Date" : "Thu, 22 Aug 2019 18:16:36 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceasyncapitestscreatequeuemaxoverload0329150ba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload1.json new file mode 100644 index 000000000000..e99cb7da76f2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload1.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload196131d17", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2f3b5cfd-6003-0087-6215-596559000000", + "Date" : "Thu, 22 Aug 2019 18:16:38 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload196131d17/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2f3b5d06-6003-0087-6715-596559000000", + "Body" : "b15c10e0-64a3-4c61-9d4e-c27dd4ff1735Thu, 22 Aug 2019 18:16:38 GMTThu, 29 Aug 2019 18:16:38 GMTAgAAAAMAAAAAAAAAjA+qvRVZ1QE=Thu, 22 Aug 2019 18:16:38 GMT", + "Date" : "Thu, 22 Aug 2019 18:16:38 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceasyncapitestscreatequeuemaxoverload196131d17" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload2.json new file mode 100644 index 000000000000..4294ef15cf03 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload2.json @@ -0,0 +1,39 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload262696c10", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2f3b5d18-6003-0087-7615-596559000000", + "Date" : "Thu, 22 Aug 2019 18:16:38 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload262696c10/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2f3b5d1c-6003-0087-7915-596559000000", + "Body" : "422b1734-939a-4bcc-88ea-31f9cbcdfd60Thu, 22 Aug 2019 18:16:39 GMTThu, 29 Aug 2019 18:16:39 GMTAgAAAAMAAAAAAAAA4JTBvRVZ1QE=Thu, 22 Aug 2019 18:16:39 GMT", + "Date" : "Thu, 22 Aug 2019 18:16:38 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceasyncapitestscreatequeuemaxoverload262696c10" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidMetadata.json new file mode 100644 index 000000000000..eec802198892 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidMetadata.json @@ -0,0 +1,21 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuewithinvalidmetadata80018", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "Connection" : "close", + "retry-after" : "0", + "Content-Length" : "339", + "StatusCode" : "400", + "Body" : "\r\nBad Request\r\n\r\n

            Bad Request - Invalid Header

            \r\n

            HTTP Error 400. The request has an invalid header name.

            \r\n\r\n", + "Date" : "Thu, 15 Aug 2019 16:40:50 GMT", + "Content-Type" : "text/html; charset=us-ascii" + } + } ], + "variables" : [ "queueserviceasyncapitestscreatequeuewithinvalidmetadata80018" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName0.json new file mode 100644 index 000000000000..e37d99fa4008 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName0.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/a_b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "14882fb9-6003-00ea-7f88-53cf77000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:14882fb9-6003-00ea-7f88-53cf77000000\nTime:2019-08-15T16:40:50.2152332Z", + "Date" : "Thu, 15 Aug 2019 16:40:49 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName1.json new file mode 100644 index 000000000000..ae1b42f193e9 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName1.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/-ab", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "14882fd5-6003-00ea-1888-53cf77000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:14882fd5-6003-00ea-1888-53cf77000000\nTime:2019-08-15T16:40:50.2873012Z", + "Date" : "Thu, 15 Aug 2019 16:40:49 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName2.json new file mode 100644 index 000000000000..9e2488e28e65 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName2.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/a--b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "14882fed-6003-00ea-2f88-53cf77000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:14882fed-6003-00ea-2f88-53cf77000000\nTime:2019-08-15T16:40:50.3633721Z", + "Date" : "Thu, 15 Aug 2019 16:40:49 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName3.json new file mode 100644 index 000000000000..8e94c068e5c7 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName3.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/Abc", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "14883007-6003-00ea-4888-53cf77000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:14883007-6003-00ea-4888-53cf77000000\nTime:2019-08-15T16:40:50.4464512Z", + "Date" : "Thu, 15 Aug 2019 16:40:49 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName4.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName4.json new file mode 100644 index 000000000000..6fc511f8d939 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName4.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/ab", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "1488302b-6003-00ea-6a88-53cf77000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:1488302b-6003-00ea-6a88-53cf77000000\nTime:2019-08-15T16:40:50.5385381Z", + "Date" : "Thu, 15 Aug 2019 16:40:49 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName5.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName5.json new file mode 100644 index 000000000000..5ecbd0458ed2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName5.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/verylongverylongverylongverylongverylongverylongverylongverylong", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "14883049-6003-00ea-0788-53cf77000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:14883049-6003-00ea-0788-53cf77000000\nTime:2019-08-15T16:40:50.6326265Z", + "Date" : "Thu, 15 Aug 2019 16:40:49 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueue.json new file mode 100644 index 000000000000..1901f3349eee --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueue.json @@ -0,0 +1,56 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestsdeletequeue221912e6b7bae4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "daede43e-5003-0007-4d15-59c6f3000000", + "Date" : "Thu, 22 Aug 2019 18:13:53 GMT" + } + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestsdeletequeue221912e6b7bae4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "daede4a8-5003-0007-2f15-59c6f3000000", + "Date" : "Thu, 22 Aug 2019 18:13:53 GMT" + } + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestsdeletequeue221912e6b7bae4/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "daede4c7-5003-0007-4b15-59c6f3000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:daede4c7-5003-0007-4b15-59c6f3000000\nTime:2019-08-22T18:13:53.7720240Z", + "Date" : "Thu, 22 Aug 2019 18:13:53 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceasyncapitestsdeletequeue221912e6b7bae4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueueError.json new file mode 100644 index 000000000000..a07d9d72098a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueueError.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/5686b8e172374fd8", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b9c9cbcf-2003-0008-2388-532b05000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b9c9cbcf-2003-0008-2388-532b05000000\nTime:2019-08-15T16:40:51.5867065Z", + "Date" : "Thu, 15 Aug 2019 16:40:51 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "5686b8e172374fd8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetAndSetProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetAndSetProperties.json new file mode 100644 index 000000000000..47c703d98b5f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetAndSetProperties.json @@ -0,0 +1,59 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b9c9ccbc-2003-0008-6b88-532b05000000", + "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 15 Aug 2019 16:40:52 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "b9c9ccc0-2003-0008-6f88-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:55 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b9c9cf1c-2003-0008-7788-532b05000000", + "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", + "Date" : "Thu, 15 Aug 2019 16:40:56 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetQueueClient.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetQueueClient.json new file mode 100644 index 000000000000..a9126688e816 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetQueueClient.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queueserviceasyncapitestsgetqueueclient2398679f4afbe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListEmptyQueues.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListEmptyQueues.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListEmptyQueues.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues0.json new file mode 100644 index 000000000000..2c54e0279c11 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues0.json @@ -0,0 +1,71 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues009680da03558a90", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9cbdd-2003-0008-3088-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:51 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues009680da03558a91", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9cbe6-2003-0008-3788-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:51 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues009680da03558a92", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9cbf2-2003-0008-3f88-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:51 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceasyncapitestslistqueues&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b9c9cbfa-2003-0008-4688-532b05000000", + "Body" : "queueserviceasyncapitestslistqueuesqueueserviceasyncapitestslistqueues009680da03558a90queueserviceasyncapitestslistqueues009680da03558a91queueserviceasyncapitestslistqueues009680da03558a92", + "Date" : "Thu, 15 Aug 2019 16:40:51 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceasyncapitestslistqueues009680da03558a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues1.json new file mode 100644 index 000000000000..e1af0b2334f9 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues1.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues104635a5e67dfac0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9cc1f-2003-0008-6888-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:51 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues104635a5e67dfac1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9cc2b-2003-0008-7188-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:52 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues104635a5e67dfac2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9cc33-2003-0008-7788-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:52 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceasyncapitestslistqueues&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b9c9cc4e-2003-0008-0d88-532b05000000", + "Body" : "queueserviceasyncapitestslistqueues2queueserviceasyncapitestslistqueues104635a5e67dfac0queueserviceasyncapitestslistqueues104635a5e67dfac1/azstoragesdkaccount/queueserviceasyncapitestslistqueues104635a5e67dfac2", + "Date" : "Thu, 15 Aug 2019 16:40:52 GMT", + "Content-Type" : "application/xml" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceasyncapitestslistqueues&marker=/azstoragesdkaccount/queueserviceasyncapitestslistqueues104635a5e67dfac2&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b9c9cc55-2003-0008-1488-532b05000000", + "Body" : "queueserviceasyncapitestslistqueues/azstoragesdkaccount/queueserviceasyncapitestslistqueues104635a5e67dfac22queueserviceasyncapitestslistqueues104635a5e67dfac2", + "Date" : "Thu, 15 Aug 2019 16:40:52 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceasyncapitestslistqueues104635a5e67dfac" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues2.json new file mode 100644 index 000000000000..f42927acdd60 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues2.json @@ -0,0 +1,71 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues25858399726d6ba0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9cc71-2003-0008-2e88-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:52 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues25858399726d6ba1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9cc77-2003-0008-3188-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:52 GMT" + } + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues25858399726d6ba2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b9c9cc86-2003-0008-3e88-532b05000000", + "Date" : "Thu, 15 Aug 2019 16:40:52 GMT" + } + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceasyncapitestslistqueues&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_201; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b9c9cc8c-2003-0008-4388-532b05000000", + "Body" : "queueserviceasyncapitestslistqueuesqueueserviceasyncapitestslistqueues25858399726d6ba0value0queueserviceasyncapitestslistqueues25858399726d6ba1value1queueserviceasyncapitestslistqueues25858399726d6ba2value2", + "Date" : "Thu, 15 Aug 2019 16:40:52 GMT", + "Content-Type" : "application/xml" + } + } ], + "variables" : [ "queueserviceasyncapitestslistqueues25858399726d6ba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessages.json deleted file mode 100644 index cebb31166bc9..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessages.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d18f-4003-00b9-5e03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d1bb-4003-00b9-0603-47d378000000", - "Body" : "1a1dabd1-b690-42c7-a22a-665c69ceffccTue, 30 Jul 2019 18:19:02 GMTTue, 06 Aug 2019 18:19:02 GMTAgAAAAMAAAAAAAAAi1HbQwNH1QE=Tue, 30 Jul 2019 18:19:02 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d1dd-4003-00b9-2503-47d378000000", - "Body" : "c10ecce0-b3b6-4098-96ae-8aa611501ffbTue, 30 Jul 2019 18:19:02 GMTTue, 06 Aug 2019 18:19:02 GMTAgAAAAMAAAAAAAAAVabiQwNH1QE=Tue, 30 Jul 2019 18:19:02 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d201-4003-00b9-4603-47d378000000", - "Body" : "962a6b38-e375-4fae-a052-8d25207ff09bTue, 30 Jul 2019 18:19:02 GMTTue, 06 Aug 2019 18:19:02 GMTAgAAAAMAAAAAAAAAv9fnQwNH1QE=Tue, 30 Jul 2019 18:19:02 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "3", - "StatusCode" : "200", - "x-ms-request-id" : "8071d225-4003-00b9-6903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d23d-4003-00b9-8003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071d257-4003-00b9-1703-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d26d-4003-00b9-2d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d283-4003-00b9-4303-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - } ], - "variables" : [ "queue78895e13" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json deleted file mode 100644 index d5ff4fab7281..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue95540dc6/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071dd7c-4003-00b9-4f03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071dd7c-4003-00b9-4f03-47d378000000\nTime:2019-07-30T18:19:06.4682531Z", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue95540dc6/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071dd94-4003-00b9-6603-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071dd94-4003-00b9-6603-47d378000000\nTime:2019-07-30T18:19:06.4982809Z", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue95540dc6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueue.json deleted file mode 100644 index 6ace1ebfcc3d..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueue.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41192d54", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd818b-e003-0073-5309-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41192d54/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd818f-e003-0073-5609-4740b5000000", - "Body" : "0f84abde-fb8c-4049-b6de-4e353f4af767Tue, 30 Jul 2019 19:01:03 GMTTue, 06 Aug 2019 19:01:03 GMTAgAAAAMAAAAAAAAAnQ1cIglH1QE=Tue, 30 Jul 2019 19:01:03 GMT", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue41192d54&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8195-e003-0073-5b09-4740b5000000", - "Body" : "queue41192d54queue41192d54", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41192d54/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8199-e003-0073-5f09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41192d54", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd81bb-e003-0073-7c09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT" - } - } ], - "variables" : [ "queue41192d54" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json deleted file mode 100644 index 104f97276190..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd82fd-e003-0073-1609-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "1cdd8301-e003-0073-1909-4740b5000000", - "Body" : "QueueAlreadyExistsThe specified queue already exists.\nRequestId:1cdd8301-e003-0073-1909-4740b5000000\nTime:2019-07-30T19:01:07.1007793Z", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue88691a05&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd830a-e003-0073-2009-4740b5000000", - "Body" : "queue88691a05queue88691a05", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd830e-e003-0073-2409-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8317-e003-0073-2d09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - } ], - "variables" : [ "queue88691a05" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceSameMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceSameMetadata.json deleted file mode 100644 index cc245715abd6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceSameMetadata.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd82b9-e003-0073-5c09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd82bd-e003-0073-5f09-4740b5000000", - "Body" : "a1a192f0-d5b6-4a03-8365-eafbc589b4b0Tue, 30 Jul 2019 19:01:06 GMTTue, 06 Aug 2019 19:01:06 GMTAgAAAAMAAAAAAAAAW6ZEJAlH1QE=Tue, 30 Jul 2019 19:01:06 GMT", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82c6-e003-0073-6609-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd82cc-e003-0073-6c09-4740b5000000", - "Body" : "a1a192f0-d5b6-4a03-8365-eafbc589b4b0Tue, 30 Jul 2019 19:01:06 GMTTue, 06 Aug 2019 19:01:06 GMT0Testing service client creating the same queue twice does not modify the queue", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue74324182&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd82d9-e003-0073-7909-4740b5000000", - "Body" : "queue74324182queue74324182", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82e0-e003-0073-7f09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82e9-e003-0073-0709-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - } ], - "variables" : [ "queue74324182" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueWithMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueWithMetadata.json deleted file mode 100644 index a884a0d89d21..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueWithMetadata.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd81fa-e003-0073-3209-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:04 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "x-ms-meta-metadata1" : "value1", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd824c-e003-0073-7709-4740b5000000", - "x-ms-meta-metadata2" : "value2", - "Date" : "Tue, 30 Jul 2019 19:01:04 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue84974cab&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8258-e003-0073-0209-4740b5000000", - "Body" : "queue84974cabqueue84974cab", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8260-e003-0073-0a09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8267-e003-0073-1109-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - } ], - "variables" : [ "queue84974cab" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceDifferentMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceDifferentMetadata.json deleted file mode 100644 index 70bd9c8373e7..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceDifferentMetadata.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "807246c6-4003-00b9-5d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "807246f2-4003-00b9-0403-47d378000000", - "Body" : "QueueAlreadyExistsThe specified queue already exists.\nRequestId:807246f2-4003-00b9-0403-47d378000000\nTime:2019-07-30T18:19:37.7522623Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724708-4003-00b9-1a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724714-4003-00b9-2503-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - } ], - "variables" : [ "queue60199648" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceSameMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceSameMetadata.json deleted file mode 100644 index 49af0912970a..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceSameMetadata.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8072446f-4003-00b9-1303-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:36 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724495-4003-00b9-3803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:36 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "807244ad-4003-00b9-5003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:36 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "807244ca-4003-00b9-6d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - } ], - "variables" : [ "queue8880966a" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithMetadata.json deleted file mode 100644 index de90dd17f28c..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithMetadata.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071dcea-4003-00b9-4003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "x-ms-meta-metadata1" : "value1", - "StatusCode" : "200", - "x-ms-request-id" : "8071dd11-4003-00b9-6603-47d378000000", - "x-ms-meta-metadata2" : "value2", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dd3b-4003-00b9-0f03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dd54-4003-00b9-2703-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - } ], - "variables" : [ "queue23765c5d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSASToken.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSASToken.json deleted file mode 100644 index 06af19821b53..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSASToken.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue95805f24/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071d154-4003-00b9-2803-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071d154-4003-00b9-2803-47d378000000\nTime:2019-07-30T18:19:02.4945662Z", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue95805f24" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSharedKey.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSharedKey.json deleted file mode 100644 index f7db9ce0ce35..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSharedKey.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue07130666/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "807249d1-4003-00b9-4903-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:807249d1-4003-00b9-4903-47d378000000\nTime:2019-07-30T18:19:38.6260705Z", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue07130666" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExisting.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExisting.json deleted file mode 100644 index 326bd01d83b8..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExisting.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071de75-4003-00b9-4103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071dea3-4003-00b9-6e03-47d378000000", - "Body" : "30cc479a-af92-4451-8a41-8413a8f9c095Tue, 30 Jul 2019 18:19:06 GMTTue, 06 Aug 2019 18:19:06 GMTAgAAAAMAAAAAAAAAFWldRgNH1QE=Tue, 30 Jul 2019 18:19:06 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071debe-4003-00b9-0903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724410-4003-00b9-3903-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724410-4003-00b9-3903-47d378000000\nTime:2019-07-30T18:19:36.9024744Z", - "Date" : "Tue, 30 Jul 2019 18:19:36 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724439-4003-00b9-6003-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724439-4003-00b9-6003-47d378000000\nTime:2019-07-30T18:19:36.9335030Z", - "Date" : "Tue, 30 Jul 2019 18:19:36 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue11519005" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExistingQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExistingQueue.json deleted file mode 100644 index d711d370bf2b..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExistingQueue.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue520260d0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8083-e003-0073-6a09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:01 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue520260d0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8163-e003-0073-3009-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue520260d0/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "1cdd8174-e003-0073-4009-4740b5000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:1cdd8174-e003-0073-4009-4740b5000000\nTime:2019-07-30T19:01:03.1630238Z", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue520260d0&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd817e-e003-0073-4809-4740b5000000", - "Body" : "queue520260d0", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue520260d0" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessage.json deleted file mode 100644 index f3bcf1a4fbf6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessage.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "807248e4-4003-00b9-6403-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724919-4003-00b9-1703-47d378000000", - "Body" : "70decbfa-af3b-453f-b291-f78c97eb512dTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAA9GMvWQNH1QE=Tue, 30 Jul 2019 18:19:38 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724936-4003-00b9-3103-47d378000000", - "Body" : "70decbfa-af3b-453f-b291-f78c97eb512dTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAA8psVawNH1QE=Tue, 30 Jul 2019 18:20:08 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355/messages/70decbfa-af3b-453f-b291-f78c97eb512d?popreceipt=AgAAAAMAAAAAAAAA8psVawNH1QE%3d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724958-4003-00b9-5103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724972-4003-00b9-6a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724985-4003-00b9-7d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8072499e-4003-00b9-1603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - } ], - "variables" : [ "queue60865355" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidMessageId.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidMessageId.json deleted file mode 100644 index 02698922bb52..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidMessageId.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bd76-4003-00b9-5603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bda8-4003-00b9-0603-47d378000000", - "Body" : "6c6a6f5b-e93c-4712-a9e6-9d882ef2725dTue, 30 Jul 2019 18:18:56 GMTTue, 06 Aug 2019 18:18:56 GMTAgAAAAMAAAAAAAAAJ00nQANH1QE=Tue, 30 Jul 2019 18:18:56 GMT", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071bdd6-4003-00b9-3403-47d378000000", - "Body" : "6c6a6f5b-e93c-4712-a9e6-9d882ef2725dTue, 30 Jul 2019 18:18:56 GMTTue, 06 Aug 2019 18:18:56 GMTAgAAAAMAAAAAAAAAb4EPUgNH1QE=Tue, 30 Jul 2019 18:19:26 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f/messages/6c6a6f5b-e93c-4712-a9e6-9d882ef2725drandom?popreceipt=AgAAAAMAAAAAAAAAb4EPUgNH1QE%3d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "MessageNotFound", - "retry-after" : "0", - "Content-Length" : "221", - "StatusCode" : "404", - "x-ms-request-id" : "8071be01-4003-00b9-5f03-47d378000000", - "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:8071be01-4003-00b9-5f03-47d378000000\nTime:2019-07-30T18:18:56.4930009Z", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071be28-4003-00b9-0603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071be47-4003-00b9-2403-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - } ], - "variables" : [ "queue5582925f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidPopReceipt.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidPopReceipt.json deleted file mode 100644 index 875c4a238ffb..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidPopReceipt.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bc63-4003-00b9-4d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bc9c-4003-00b9-0403-47d378000000", - "Body" : "9a59b835-0fa6-4bcb-8094-61e61a4120c2Tue, 30 Jul 2019 18:18:56 GMTTue, 06 Aug 2019 18:18:56 GMTAgAAAAMAAAAAAAAAGXD/PwNH1QE=Tue, 30 Jul 2019 18:18:56 GMT", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071bcc5-4003-00b9-2b03-47d378000000", - "Body" : "9a59b835-0fa6-4bcb-8094-61e61a4120c2Tue, 30 Jul 2019 18:18:56 GMTTue, 06 Aug 2019 18:18:56 GMTAgAAAAMAAAAAAAAAb6TnUQNH1QE=Tue, 30 Jul 2019 18:19:26 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09/messages/9a59b835-0fa6-4bcb-8094-61e61a4120c2?popreceipt=AgAAAAMAAAAAAAAAb6TnUQNH1QE%3drandom", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "444", - "StatusCode" : "400", - "x-ms-request-id" : "8071bcf4-4003-00b9-5803-47d378000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:8071bcf4-4003-00b9-5803-47d378000000\nTime:2019-07-30T18:18:56.2297573ZpopreceiptAgAAAAMAAAAAAAAAb6TnUQNH1QE=randomInvalid pop receipt format", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071bd1d-4003-00b9-7e03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071bd3c-4003-00b9-1c03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - } ], - "variables" : [ "queue76680d09" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json deleted file mode 100644 index 287a17ccf8f1..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5543243d/messages/invalid?popreceipt=call", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724c3c-4003-00b9-2003-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724c3c-4003-00b9-2003-47d378000000\nTime:2019-07-30T18:19:39.3217165Z", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5543243d/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724c62-4003-00b9-4503-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724c62-4003-00b9-4503-47d378000000\nTime:2019-07-30T18:19:39.3547455Z", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue5543243d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMetadata.json deleted file mode 100644 index 705c7722d081..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMetadata.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724d57-4003-00b9-3403-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "x-ms-meta-metadata1" : "value1", - "StatusCode" : "200", - "x-ms-request-id" : "80724d80-4003-00b9-5a03-47d378000000", - "x-ms-meta-metadata2" : "value2", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724d98-4003-00b9-7203-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724db1-4003-00b9-0b03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724dd4-4003-00b9-2d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724dec-4003-00b9-4503-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - } ], - "variables" : [ "queue743794d9" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistent.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistent.json deleted file mode 100644 index 525cc82bc6b9..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistent.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue784292a2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724806-4003-00b9-0b03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724806-4003-00b9-0b03-47d378000000\nTime:2019-07-30T18:19:38.1306132Z", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue784292a2/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724826-4003-00b9-2a03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724826-4003-00b9-2a03-47d378000000\nTime:2019-07-30T18:19:38.1606401Z", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue784292a2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistentQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistentQueue.json deleted file mode 100644 index 2e67336c2204..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistentQueue.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5883546e", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "1cdd8355-e003-0073-6209-4740b5000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:1cdd8355-e003-0073-6209-4740b5000000\nTime:2019-07-30T19:01:07.7774261Z", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue5883546e&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8359-e003-0073-6609-4740b5000000", - "Body" : "queue5883546e", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue5883546e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMessage.json deleted file mode 100644 index 235330aad38c..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue854564d6", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bb3b-4003-00b9-2f03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue854564d6/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bb62-4003-00b9-5403-47d378000000", - "Body" : "e019e0ee-2a4a-4a02-ba68-ecd484c51b2cTue, 30 Jul 2019 18:18:55 GMTTue, 06 Aug 2019 18:18:55 GMTAgAAAAMAAAAAAAAAszfJPwNH1QE=Tue, 30 Jul 2019 18:18:55 GMT", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue854564d6/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071bb7d-4003-00b9-6e03-47d378000000", - "Body" : "e019e0ee-2a4a-4a02-ba68-ecd484c51b2cTue, 30 Jul 2019 18:18:55 GMTTue, 06 Aug 2019 18:18:55 GMTAgAAAAMAAAAAAAAAGAywUQNH1QE=Tue, 30 Jul 2019 18:19:25 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue854564d6/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071bb94-4003-00b9-0403-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue854564d6", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071bbb2-4003-00b9-2103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT" - } - } ], - "variables" : [ "queue854564d6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMultipleMessages.json deleted file mode 100644 index aacfeda6c1d6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMultipleMessages.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724a13-4003-00b9-0803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724a33-4003-00b9-2703-47d378000000", - "Body" : "be3d48d4-b018-40ad-85a7-d426fb4d785fTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAAA2tgWQNH1QE=Tue, 30 Jul 2019 18:19:38 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724a57-4003-00b9-4a03-47d378000000", - "Body" : "f39387d0-8ac4-4739-80a3-a1e1f8d118dfTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAANU5lWQNH1QE=Tue, 30 Jul 2019 18:19:38 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f/messages?numofmessages=2&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724a74-4003-00b9-6603-47d378000000", - "Body" : "be3d48d4-b018-40ad-85a7-d426fb4d785fTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAAeftLawNH1QE=Tue, 30 Jul 2019 18:20:08 GMT1test messagef39387d0-8ac4-4739-80a3-a1e1f8d118dfTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAAeftLawNH1QE=Tue, 30 Jul 2019 18:20:08 GMT1test message 2", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724a8f-4003-00b9-7e03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724aa5-4003-00b9-1403-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - } ], - "variables" : [ "queue41164c5f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json deleted file mode 100644 index c92f5ac1b9fb..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue03640269/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "807247b8-4003-00b9-4003-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:807247b8-4003-00b9-4003-47d378000000\nTime:2019-07-30T18:19:38.0495370Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue03640269/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "807247d2-4003-00b9-5803-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:807247d2-4003-00b9-5803-47d378000000\nTime:2019-07-30T18:19:38.0825673Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue03640269" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueTooManyMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueTooManyMessages.json deleted file mode 100644 index c1216be98ccd..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueTooManyMessages.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071cf82-4003-00b9-6203-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725/messages?numofmessages=64&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "OutOfRangeQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "456", - "StatusCode" : "400", - "x-ms-request-id" : "8071cfa7-4003-00b9-0503-47d378000000", - "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:8071cfa7-4003-00b9-0503-47d378000000\nTime:2019-07-30T18:19:01.9911001Znumofmessages64132", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071cfc0-4003-00b9-1d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071cfe1-4003-00b9-3d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - } ], - "variables" : [ "queue33803725" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueEmptyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueEmptyMessage.json deleted file mode 100644 index 015e74ada642..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueEmptyMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue85000300", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724adb-4003-00b9-4903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue85000300/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724b04-4003-00b9-7103-47d378000000", - "Body" : "f1339f74-d98e-4e9c-bfb7-b53cda993323Tue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAApySGWQNH1QE=Tue, 30 Jul 2019 18:19:38 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue85000300/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724b26-4003-00b9-1303-47d378000000", - "Body" : "f1339f74-d98e-4e9c-bfb7-b53cda993323Tue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMT0", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue85000300/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724b3f-4003-00b9-2c03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue85000300", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724b51-4003-00b9-3e03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - } ], - "variables" : [ "queue85000300" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueMessage.json deleted file mode 100644 index 4be6f36d26c0..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue857326bc", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d362-4003-00b9-1a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue857326bc/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d37c-4003-00b9-3203-47d378000000", - "Body" : "f39a6db5-cb4a-4f70-be21-c72803c0253eTue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMTAgAAAAMAAAAAAAAAV6QtRANH1QE=Tue, 30 Jul 2019 18:19:03 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue857326bc/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071d393-4003-00b9-4903-47d378000000", - "Body" : "f39a6db5-cb4a-4f70-be21-c72803c0253eTue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMT0test message", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue857326bc/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d3a6-4003-00b9-5c03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue857326bc", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d3b4-4003-00b9-6a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - } ], - "variables" : [ "queue857326bc" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json deleted file mode 100644 index 9859c91ffdb1..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue50657bc8/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071d2c1-4003-00b9-8003-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071d2c1-4003-00b9-8003-47d378000000\nTime:2019-07-30T18:19:02.9379772Z", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue50657bc8/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071d2ea-4003-00b9-2703-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071d2ea-4003-00b9-2703-47d378000000\nTime:2019-07-30T18:19:02.9770131Z", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue50657bc8" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json deleted file mode 100644 index 5c546664731c..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071be6d-4003-00b9-4a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f/messages?visibilitytimeout=0&messagettl=2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071be9d-4003-00b9-7603-47d378000000", - "Body" : "f2a72af5-11f7-4174-9bca-0c6bbc7a1a4fTue, 30 Jul 2019 18:18:56 GMTTue, 30 Jul 2019 18:18:58 GMTAgAAAAMAAAAAAAAAl7hMQANH1QE=Tue, 30 Jul 2019 18:18:56 GMT", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071cea8-4003-00b9-0e03-47d378000000", - "Body" : "", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071cec0-4003-00b9-2603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071cee0-4003-00b9-4603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" - } - } ], - "variables" : [ "queue4952015f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicy.json deleted file mode 100644 index f4583b3a1ca6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicy.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d4c3-4003-00b9-7003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071d4e3-4003-00b9-0e03-47d378000000", - "Body" : "", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d4fb-4003-00b9-2603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d50b-4003-00b9-3503-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - } ], - "variables" : [ "queue9583269e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json deleted file mode 100644 index f51ee48724c7..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue066060ee?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8072468c-4003-00b9-2603-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8072468c-4003-00b9-2603-47d378000000\nTime:2019-07-30T18:19:37.6481654Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue066060ee/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "807246a7-4003-00b9-3f03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:807246a7-4003-00b9-3f03-47d378000000\nTime:2019-07-30T18:19:37.6781928Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue066060ee" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getProperties.json deleted file mode 100644 index c603492afe88..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getProperties.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d0a9-4003-00b9-7f03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "x-ms-meta-metadata1" : "value1", - "StatusCode" : "200", - "x-ms-request-id" : "8071d0df-4003-00b9-3403-47d378000000", - "x-ms-meta-metadata2" : "value2", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d0ff-4003-00b9-5303-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d123-4003-00b9-7703-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - } ], - "variables" : [ "queue98021a59" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json deleted file mode 100644 index c81fadfa36f6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue89138457?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071cf1e-4003-00b9-0203-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071cf1e-4003-00b9-0203-47d378000000\nTime:2019-07-30T18:19:01.8439650Z", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue89138457/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071cf3f-4003-00b9-2103-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071cf3f-4003-00b9-2103-47d378000000\nTime:2019-07-30T18:19:01.8769939Z", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue89138457" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json deleted file mode 100644 index 0f91979ead55..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue881089d3/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "1cdd82f3-e003-0073-0f09-4740b5000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:1cdd82f3-e003-0073-0f09-4740b5000000\nTime:2019-07-30T19:01:06.9836664Z", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue881089d3&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd82f9-e003-0073-1409-4740b5000000", - "Body" : "queue881089d3", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue881089d3" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueues.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueues.json deleted file mode 100644 index 60f43a830052..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueues.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd50", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8272-e003-0073-1c09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd51", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8278-e003-0073-2109-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd52", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd827e-e003-0073-2609-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue53815dd5&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8286-e003-0073-2d09-4740b5000000", - "Body" : "queue53815dd5queue53815dd50queue53815dd51queue53815dd52", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue53815dd5&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd828a-e003-0073-3109-4740b5000000", - "Body" : "queue53815dd5queue53815dd50queue53815dd51queue53815dd52", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd50/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd828e-e003-0073-3409-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd50", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8292-e003-0073-3809-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd51/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd829b-e003-0073-3f09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd51", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82a2-e003-0073-4509-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd52/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82a8-e003-0073-4b09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd52", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82b1-e003-0073-5409-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - } ], - "variables" : [ "queue53815dd5" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesIncludeMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesIncludeMetadata.json deleted file mode 100644 index a3a8affdfea0..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesIncludeMetadata.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8362-e003-0073-6e09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8373-e003-0073-7b09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8378-e003-0073-7f09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue3555933b&include=metadata&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd837b-e003-0073-0109-4740b5000000", - "Body" : "queue3555933bqueue3555933b0value1value2queue3555933b1queue3555933b2value1value2", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue3555933b&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8382-e003-0073-0409-4740b5000000", - "Body" : "queue3555933bqueue3555933b0queue3555933b1queue3555933b2", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b0/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd838a-e003-0073-0a09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd838d-e003-0073-0d09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b1/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8395-e003-0073-1409-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd839b-e003-0073-1909-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b2/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd83a1-e003-0073-1f09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd83a4-e003-0073-2209-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - } ], - "variables" : [ "queue3555933b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithLimit.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithLimit.json deleted file mode 100644 index fc87bcea2c77..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithLimit.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e780", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "4ab9e4e1-4003-00df-40f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e781", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "4ab9e592-4003-00df-55f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e782", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "4ab9e59c-4003-00df-5df2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue20354e78&maxresults=2&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "4ab9e5a9-4003-00df-66f2-4b6122000000", - "Body" : "queue20354e782queue20354e780queue20354e781/azstoragesdkaccount/queue20354e782", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue20354e78&marker=/azstoragesdkaccount/queue20354e782&maxresults=2&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "4ab9e5b3-4003-00df-6ff2-4b6122000000", - "Body" : "queue20354e78/azstoragesdkaccount/queue20354e7822queue20354e782", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue20354e78&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "4ab9e5b5-4003-00df-71f2-4b6122000000", - "Body" : "queue20354e78queue20354e780queue20354e781queue20354e782", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e780/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5bb-4003-00df-76f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e780", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5bd-4003-00df-78f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:15 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e781/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5d7-4003-00df-0df2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:15 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e781", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5d9-4003-00df-0ff2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:15 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e782/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5df-4003-00df-13f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:15 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e782", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5e4-4003-00df-17f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:15 GMT" - } - } ], - "variables" : [ "queue20354e78" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithPrefix.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithPrefix.json deleted file mode 100644 index 25ab0025e774..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithPrefix.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8322-e003-0073-3709-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b51", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8329-e003-0073-3c09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8330-e003-0073-4109-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue360442b5prefix&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8334-e003-0073-4409-4740b5000000", - "Body" : "queue360442b5prefixqueue360442b5prefix0queue360442b5prefix2", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue360442b5&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8337-e003-0073-4709-4740b5000000", - "Body" : "queue360442b5queue360442b51queue360442b5prefix0queue360442b5prefix2", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b51/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8339-e003-0073-4909-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b51", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd833c-e003-0073-4c09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix0/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd833f-e003-0073-4e09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8343-e003-0073-5209-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix2/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8345-e003-0073-5409-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8349-e003-0073-5709-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - } ], - "variables" : [ "queue360442b5" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMessage.json deleted file mode 100644 index dd793491431d..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9289930b", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724592-4003-00b9-3103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9289930b/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "807245b2-4003-00b9-5003-47d378000000", - "Body" : "4af8da31-fef8-48bb-9c58-e31cb39648bcTue, 30 Jul 2019 18:19:37 GMTTue, 06 Aug 2019 18:19:37 GMTAgAAAAMAAAAAAAAAY9qQWANH1QE=Tue, 30 Jul 2019 18:19:37 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9289930b/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "807245d1-4003-00b9-6f03-47d378000000", - "Body" : "4af8da31-fef8-48bb-9c58-e31cb39648bcTue, 30 Jul 2019 18:19:37 GMTTue, 06 Aug 2019 18:19:37 GMT0test message", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9289930b/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "807245e5-4003-00b9-0303-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9289930b", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "807245f8-4003-00b9-1603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - } ], - "variables" : [ "queue9289930b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMultipleMessages.json deleted file mode 100644 index ec67bb0d5044..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMultipleMessages.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d3de-4003-00b9-1203-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d3fe-4003-00b9-3103-47d378000000", - "Body" : "eb154178-fd28-4e7d-9bb4-502bd3aa9472Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMTAgAAAAMAAAAAAAAAZNBKRANH1QE=Tue, 30 Jul 2019 18:19:03 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d435-4003-00b9-6503-47d378000000", - "Body" : "c2697011-4b18-4aae-b894-92e681fe9af3Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMTAgAAAAMAAAAAAAAAEZNWRANH1QE=Tue, 30 Jul 2019 18:19:03 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05/messages?numofmessages=2&peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071d45c-4003-00b9-0b03-47d378000000", - "Body" : "eb154178-fd28-4e7d-9bb4-502bd3aa9472Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMT0test messagec2697011-4b18-4aae-b894-92e681fe9af3Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMT0test message 2", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d478-4003-00b9-2703-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d495-4003-00b9-4303-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - } ], - "variables" : [ "queue17331e05" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekQueueDoesNotExist.json deleted file mode 100644 index 5efe773a0a36..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue163539f6/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071bbf5-4003-00b9-6403-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071bbf5-4003-00b9-6403-47d378000000\nTime:2019-07-30T18:18:55.9785249Z", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue163539f6/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071bc16-4003-00b9-0303-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071bc16-4003-00b9-0303-47d378000000\nTime:2019-07-30T18:18:56.0175608Z", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue163539f6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekTooManyMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekTooManyMessages.json deleted file mode 100644 index 0e21d3f3e056..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekTooManyMessages.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724850-4003-00b9-5203-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2/messages?numofmessages=64&peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "OutOfRangeQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "456", - "StatusCode" : "400", - "x-ms-request-id" : "8072486a-4003-00b9-6b03-47d378000000", - "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:8072486a-4003-00b9-6b03-47d378000000\nTime:2019-07-30T18:19:38.2327064Znumofmessages64132", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724884-4003-00b9-0503-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "807248a6-4003-00b9-2603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - } ], - "variables" : [ "queue007623b2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicy.json deleted file mode 100644 index cc3a358651b1..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicy.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "807244f3-4003-00b9-1603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724521-4003-00b9-4103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724540-4003-00b9-5f03-47d378000000", - "Body" : "testpermission2000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zraup", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724551-4003-00b9-7003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724569-4003-00b9-0803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - } ], - "variables" : [ "queue392406b1" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json deleted file mode 100644 index 831f07e70edb..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue15204045?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "80724e15-4003-00b9-6d03-47d378000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:80724e15-4003-00b9-6d03-47d378000000\nTime:2019-07-30T18:19:39.7961551Z00", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue15204045/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724e34-4003-00b9-0b03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724e34-4003-00b9-0b03-47d378000000\nTime:2019-07-30T18:19:39.8241820Z", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue15204045" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidAccessPolicy.json deleted file mode 100644 index c053664720a1..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidAccessPolicy.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724b93-4003-00b9-7c03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "371", - "StatusCode" : "400", - "x-ms-request-id" : "80724bb2-4003-00b9-1a03-47d378000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:80724bb2-4003-00b9-1a03-47d378000000\nTime:2019-07-30T18:19:39.1915951Z1304Signed identifier ID cannot be empty or over 64 characters in length", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724bde-4003-00b9-4503-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724bf9-4003-00b9-6003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - } ], - "variables" : [ "queue598515b0" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidMetadata.json deleted file mode 100644 index 5e4a36f56436..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidMetadata.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d01e-4003-00b9-7903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "EmptyMetadataKey", - "retry-after" : "0", - "Content-Length" : "285", - "StatusCode" : "400", - "x-ms-request-id" : "8071d048-4003-00b9-2003-47d378000000", - "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:8071d048-4003-00b9-2003-47d378000000\nTime:2019-07-30T18:19:02.1712670Zbad metadata", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d05e-4003-00b9-3603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d078-4003-00b9-5003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - } ], - "variables" : [ "queue04921afb" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadata.json deleted file mode 100644 index 4f5b33d48612..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadata.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724c9b-4003-00b9-7c03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724cc8-4003-00b9-2803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "x-ms-meta-metadata1" : "value1", - "StatusCode" : "200", - "x-ms-request-id" : "80724ce7-4003-00b9-4503-47d378000000", - "x-ms-meta-metadata2" : "value2", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724d0c-4003-00b9-6903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724d24-4003-00b9-0103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - } ], - "variables" : [ "queue228395ba" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json deleted file mode 100644 index 2403d75b3cd8..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue1023979b?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724760-4003-00b9-7003-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724760-4003-00b9-7003-47d378000000\nTime:2019-07-30T18:19:37.9564505Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue1023979b/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8072477f-4003-00b9-0d03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8072477f-4003-00b9-0d03-47d378000000\nTime:2019-07-30T18:19:37.9904825Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue1023979b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setProperties.json deleted file mode 100644 index 6788bd49edd8..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setProperties.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd81c0-e003-0073-8009-4740b5000000", - "Body" : "1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "1cdd81d5-e003-0073-1309-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd81e5-e003-0073-1d09-4740b5000000", - "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "1cdd81eb-e003-0073-2309-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd81ed-e003-0073-2509-4740b5000000", - "Body" : "1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue30084080&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd81f3-e003-0073-2b09-4740b5000000", - "Body" : "queue30084080", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue30084080" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setTooManyAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setTooManyAccessPolicies.json deleted file mode 100644 index 52ffab91ef1e..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setTooManyAccessPolicies.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724626-4003-00b9-4103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "80724645-4003-00b9-5f03-47d378000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:80724645-4003-00b9-5f03-47d378000000\nTime:2019-07-30T18:19:37.5430678Z00", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8072465c-4003-00b9-7603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724670-4003-00b9-0a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - } ], - "variables" : [ "queue02682f2a" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessage.json deleted file mode 100644 index a0d2027ab04f..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessage.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d53d-4003-00b9-6703-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d56d-4003-00b9-1003-47d378000000", - "Body" : "5e400587-ca00-4a0e-a557-f8c4d2e2c6c7Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMTAgAAAAMAAAAAAAAAzOOURANH1QE=Tue, 30 Jul 2019 18:19:03 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071d58c-4003-00b9-2f03-47d378000000", - "Body" : "5e400587-ca00-4a0e-a557-f8c4d2e2c6c7Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMTAgAAAAMAAAAAAAAAMD99VgNH1QE=Tue, 30 Jul 2019 18:19:33 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231/messages/5e400587-ca00-4a0e-a557-f8c4d2e2c6c7?popreceipt=AgAAAAMAAAAAAAAAMD99VgNH1QE%3d&visibilitytimeout=1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-time-next-visible" : "Tue, 30 Jul 2019 18:19:04 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d5ad-4003-00b9-5003-47d378000000", - "x-ms-popreceipt" : "AwAAAAMAAAAAAAAA+cM6RQNH1QEBAAAA", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071dba1-4003-00b9-0a03-47d378000000", - "Body" : "5e400587-ca00-4a0e-a557-f8c4d2e2c6c7Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMT1updated test message", - "Date" : "Tue, 30 Jul 2019 18:19:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dbb7-4003-00b9-2003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dbd1-4003-00b9-3a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:05 GMT" - } - } ], - "variables" : [ "queue20800231" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidMessageId.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidMessageId.json deleted file mode 100644 index 849ea36b90c2..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidMessageId.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071dc01-4003-00b9-6903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071dc22-4003-00b9-0703-47d378000000", - "Body" : "2d1bf643-019d-41da-8a3e-635dba5df867Tue, 30 Jul 2019 18:19:06 GMTTue, 06 Aug 2019 18:19:06 GMTAgAAAAMAAAAAAAAAtDTwRQNH1QE=Tue, 30 Jul 2019 18:19:06 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071dc41-4003-00b9-2503-47d378000000", - "Body" : "2d1bf643-019d-41da-8a3e-635dba5df867Tue, 30 Jul 2019 18:19:06 GMTTue, 06 Aug 2019 18:19:06 GMTAgAAAAMAAAAAAAAA6kHYVwNH1QE=Tue, 30 Jul 2019 18:19:36 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12/messages/2d1bf643-019d-41da-8a3e-635dba5df867random?popreceipt=AgAAAAMAAAAAAAAA6kHYVwNH1QE%3d&visibilitytimeout=1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "MessageNotFound", - "retry-after" : "0", - "Content-Length" : "221", - "StatusCode" : "404", - "x-ms-request-id" : "8071dc6d-4003-00b9-5003-47d378000000", - "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:8071dc6d-4003-00b9-5003-47d378000000\nTime:2019-07-30T18:19:06.1889942Z", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dc88-4003-00b9-6b03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dca6-4003-00b9-0803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - } ], - "variables" : [ "queue70821c12" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidPopReceipt.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidPopReceipt.json deleted file mode 100644 index 960abdc79ba2..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidPopReceipt.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071ddb6-4003-00b9-0603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071dddf-4003-00b9-2d03-47d378000000", - "Body" : "af0f96cb-a19e-4f9a-b1ba-08e6c27944dbTue, 30 Jul 2019 18:19:06 GMTTue, 06 Aug 2019 18:19:06 GMTAgAAAAMAAAAAAAAAzks4RgNH1QE=Tue, 30 Jul 2019 18:19:06 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071ddf9-4003-00b9-4703-47d378000000", - "Body" : "af0f96cb-a19e-4f9a-b1ba-08e6c27944dbTue, 30 Jul 2019 18:19:06 GMTTue, 06 Aug 2019 18:19:06 GMTAgAAAAMAAAAAAAAA5KoeWANH1QE=Tue, 30 Jul 2019 18:19:36 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02/messages/af0f96cb-a19e-4f9a-b1ba-08e6c27944db?popreceipt=AgAAAAMAAAAAAAAA5KoeWANH1QE%3drandom&visibilitytimeout=1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "444", - "StatusCode" : "400", - "x-ms-request-id" : "8071de13-4003-00b9-6103-47d378000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:8071de13-4003-00b9-6103-47d378000000\nTime:2019-07-30T18:19:06.6474193ZpopreceiptAgAAAAMAAAAAAAAA5KoeWANH1QE=randomInvalid pop receipt format", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071de2b-4003-00b9-7803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071de43-4003-00b9-1003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - } ], - "variables" : [ "queue12446d02" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json deleted file mode 100644 index b87cef21fed8..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue960895d5/messages/doesn't?popreceipt=exist&visibilitytimeout=5", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "415", - "StatusCode" : "400", - "x-ms-request-id" : "8071d32f-4003-00b9-6803-47d378000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:8071d32f-4003-00b9-6803-47d378000000\nTime:2019-07-30T18:19:03.0460773ZpopreceiptexistInvalid pop receipt format", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue960895d5/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071d341-4003-00b9-7a03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071d341-4003-00b9-7a03-47d378000000\nTime:2019-07-30T18:19:03.0771058Z", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue960895d5" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/swagger/README.md b/sdk/storage/azure-storage-queue/swagger/README.md new file mode 100644 index 000000000000..390763ea64a3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/swagger/README.md @@ -0,0 +1,175 @@ +# Azure Queue Storage for Java + +> see https://aka.ms/autorest + +### Setup +```ps +cd C:\work +git clone --recursive https://github.com/Azure/autorest.java/ +cd autorest.java +git checkout v3 +npm install +cd .. +git clone --recursive https://github.com/jianghaolu/autorest.modeler/ +cd autorest.modeler +git checkout headerprefixfix +npm install +``` + +### Generation +```ps +cd +autorest --use=C:/work/autorest.java --use=C:/work/autorest.modeler --version=2.0.4280 +``` + +### Code generation settings +``` yaml +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.QueueStorage/preview/2018-03-28/queue.json +java: true +output-folder: ../ +namespace: com.azure.storage.queue +enable-xml: true +generate-client-interfaces: false +sync-methods: none +license-header: MICROSOFT_MIT_SMALL +add-context-parameter: true +``` + +### /{queueName} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.delete.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}?comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}?comp=metadata"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}?comp=acl +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}?comp=acl"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}/messages +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}/messages"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + $.delete.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}/messages?visibilitytimeout={visibilityTimeout}&messagettl={messageTimeToLive} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}/messages?visibilitytimeout={visibilityTimeout}&messagettl={messageTimeToLive}"] + transform: > + let param = $.post.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.post.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}/messages?peekonly=true +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}/messages?peekonly=true"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}/messages/{messageid}?popreceipt={popReceipt}&visibilitytimeout={visibilityTimeout} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}/messages/{messageid}?popreceipt={popReceipt}&visibilitytimeout={visibilityTimeout}"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const queueNamePath = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + const messageIdPath = param["$ref"].replace(/[#].*$/, "#/parameters/MessageId"); + $.put.parameters.splice(0, 0, { "$ref": queueNamePath }); + $.put.parameters.splice(1, 0, { "$ref": messageIdPath }); + } +``` + +### /{queueName}/messages/{messageid}?popreceipt={popReceipt} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}/messages/{messageid}?popreceipt={popReceipt}"] + transform: > + let param = $.delete.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const queueNamePath = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + const messageIdPath = param["$ref"].replace(/[#].*$/, "#/parameters/MessageId"); + $.delete.parameters.splice(0, 0, { "$ref": queueNamePath }); + $.delete.parameters.splice(1, 0, { "$ref": messageIdPath }); + } +``` + +### Rename MessageItems +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.DequeuedMessage) { + $.DequeuedMessage = $.DequeuedMessageItem; + delete $.DequeuedMessageItem; + $.DequeuedMessagesList.items.$ref = $.DequeuedMessagesList.items.$ref.replace("DequeuedMessageItem", "DequeuedMessage"); + } + if (!$.PeekedMessage) { + $.PeekedMessage = $.PeekedMessageItem; + delete $.PeekedMessageItem; + $.PeekedMessagesList.items.$ref = $.PeekedMessagesList.items.$ref.replace("PeekedMessageItem", "PeekedMessage"); + } +``` + +### MessageId +``` yaml +directive: +- from: swagger-document + where: $.parameters.MessageId + transform: > + $.description = "The message ID name."; +``` diff --git a/sdk/storage/azure-storage-queue/swagger/queue.json b/sdk/storage/azure-storage-queue/swagger/queue.json deleted file mode 100644 index 977d767b9f84..000000000000 --- a/sdk/storage/azure-storage-queue/swagger/queue.json +++ /dev/null @@ -1,1898 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Azure Queue Storage", - "version": "2018-03-28", - "x-ms-code-generation-settings": { - "header": "MIT", - "strictSpecAdherence": false - } - }, - "x-ms-parameterized-host": { - "hostTemplate": "{url}", - "useSchemePrefix": false, - "positionInOperation": "first", - "parameters": [ - { - "$ref": "#/parameters/Url" - } - ] - }, - "securityDefinitions": { - "queue_shared_key": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - }, - "schemes": [ - "https" - ], - "consumes": [ - "application/xml" - ], - "produces": [ - "application/xml" - ], - "paths": {}, - "x-ms-paths": { - "/?restype=service&comp=properties": { - "put": { - "tags": [ - "service" - ], - "operationId": "Service_SetProperties", - "description": "Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules", - "parameters": [ - { - "$ref": "#/parameters/StorageServiceProperties" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "Success (Accepted)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetProperties", - "description": "gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - }, - "schema": { - "$ref": "#/definitions/StorageServiceProperties" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/?restype=service&comp=stats": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetStatistics", - "description": "Retrieves statistics related to replication for the Queue service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/StorageServiceStats" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "stats" - ] - } - ] - }, - "/?comp=list": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_ListQueuesSegment", - "description": "The List Queues Segment operation returns a list of the queues under the specified account", - "parameters": [ - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListQueuesInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/ListQueuesSegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/{queueName}": { - "put": { - "tags": [ - "service" - ], - "operationId": "Queue_Create", - "description": "creates a new queue under the given account.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "Success, queue created.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "204": { - "description": "Success, queue created.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "queue" - ], - "operationId": "Queue_Delete", - "description": "operation permanently deletes the specified queue", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{queueName}?comp=metadata": { - "get": { - "tags": [ - "queue" - ], - "operationId": "Queue_GetProperties", - "description": "Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-values pairs.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "x-ms-approximate-messages-count": { - "type": "integer", - "x-ms-client-name": "ApproximateMessagesCount", - "description": "The approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "put": { - "tags": [ - "queue" - ], - "operationId": "Queue_SetMetadata", - "description": "sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{queueName}?comp=acl": { - "get": { - "tags": [ - "queue" - ], - "operationId": "Queue_GetAccessPolicy", - "description": "returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "put": { - "tags": [ - "queue" - ], - "operationId": "Queue_SetAccessPolicy", - "description": "sets stored access policies for the queue that may be used with Shared Access Signatures", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/QueueAcl" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "acl" - ] - } - ] - }, - "/{queueName}/messages": { - "get": { - "tags": [ - "message" - ], - "operationId": "Messages_Dequeue", - "description": "The Dequeue operation retrieves one or more messages from the front of the queue.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/NumOfMessages" - }, - { - "$ref": "#/parameters/VisibilityTimeout" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "OK", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/DequeuedMessagesList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "message" - ], - "operationId": "Messages_Clear", - "description": "The Clear operation deletes all messages from the specified queue.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{queueName}/messages?visibilitytimeout={visibilityTimeout}&messagettl={messageTimeToLive}": { - "post": { - "tags": [ - "message" - ], - "operationId": "Messages_Enqueue", - "description": "The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message invisible until the visibility timeout expires. A message must be in a format that can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size for previous versions.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/QueueMessage" - }, - { - "$ref": "#/parameters/VisibilityTimeout" - }, - { - "$ref": "#/parameters/MessageTTL" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "Created", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/EnqueuedMessageList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{queueName}/messages?peekonly=true": { - "get": { - "tags": [ - "message" - ], - "operationId": "Messages_Peek", - "description": "The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility of the message.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/NumOfMessages" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "OK", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/PeekedMessagesList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "peekonly", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "true" - ] - } - ] - }, - "/{queueName}/messages/{messageid}?popreceipt={popReceipt}&visibilitytimeout={visibilityTimeout}": { - "put": { - "tags": [ - "messageId" - ], - "operationId": "MessageId_Update", - "description": "The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message operation updates the visibility timeout of a message. You can also use this operation to update the contents of a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the encoded message can be up to 64KB in size.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/MessageId" - }, - { - "$ref": "#/parameters/QueueMessage" - }, - { - "$ref": "#/parameters/PopReceipt" - }, - { - "$ref": "#/parameters/VisibilityTimeoutRequired" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-popreceipt": { - "x-ms-client-name": "PopReceipt", - "type": "string", - "description": "The pop receipt of the queue message." - }, - "x-ms-time-next-visible": { - "x-ms-client-name": "TimeNextVisible", - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value that represents when the message will be visible on the queue." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{queueName}/messages/{messageid}?popreceipt={popReceipt}": { - "delete": { - "tags": [ - "messageId" - ], - "operationId": "MessageId_Delete", - "description": "The Delete operation deletes the specified message.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/MessageId" - }, - { - "$ref": "#/parameters/PopReceipt" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - } - }, - "definitions": { - "AccessPolicy": { - "type": "object", - "required": [ - "Start", - "Expiry", - "Permission" - ], - "description": "An Access policy", - "properties": { - "Start": { - "description": "the date-time the policy is active", - "type": "string", - "format": "date-time" - }, - "Expiry": { - "description": "the date-time the policy expires", - "type": "string", - "format": "date-time" - }, - "Permission": { - "description": "the permissions for the acl policy", - "type": "string" - } - } - }, - "ListQueuesSegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "The object returned when calling List Queues on a Queue Service.", - "type": "object", - "required": [ - "ServiceEndpoint", - "Prefix", - "MaxResults", - "NextMarker" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "QueueItems": { - "xml": { - "wrapped": true, - "name": "Queues" - }, - "type": "array", - "items": { - "$ref": "#/definitions/QueueItem" - } - }, - "NextMarker": { - "type": "string" - } - } - }, - "CorsRule": { - "description": "CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain", - "type": "object", - "required": [ - "AllowedOrigins", - "AllowedMethods", - "AllowedHeaders", - "ExposedHeaders", - "MaxAgeInSeconds" - ], - "properties": { - "AllowedOrigins": { - "description": "The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS.", - "type": "string" - }, - "AllowedMethods": { - "description": "The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated)", - "type": "string" - }, - "AllowedHeaders": { - "description": "the request headers that the origin domain may specify on the CORS request.", - "type": "string" - }, - "ExposedHeaders": { - "description": "The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer", - "type": "string" - }, - "MaxAgeInSeconds": { - "description": "The maximum amount time that a browser should cache the preflight OPTIONS request.", - "type": "integer", - "minimum": 0 - } - } - }, - "ErrorCode": { - "description": "Error codes returned by the service", - "type": "string", - "enum": [ - "AccountAlreadyExists", - "AccountBeingCreated", - "AccountIsDisabled", - "AuthenticationFailed", - "AuthorizationFailure", - "ConditionHeadersNotSupported", - "ConditionNotMet", - "EmptyMetadataKey", - "InsufficientAccountPermissions", - "InternalError", - "InvalidAuthenticationInfo", - "InvalidHeaderValue", - "InvalidHttpVerb", - "InvalidInput", - "InvalidMd5", - "InvalidMetadata", - "InvalidQueryParameterValue", - "InvalidRange", - "InvalidResourceName", - "InvalidUri", - "InvalidXmlDocument", - "InvalidXmlNodeValue", - "Md5Mismatch", - "MetadataTooLarge", - "MissingContentLengthHeader", - "MissingRequiredQueryParameter", - "MissingRequiredHeader", - "MissingRequiredXmlNode", - "MultipleConditionHeadersNotSupported", - "OperationTimedOut", - "OutOfRangeInput", - "OutOfRangeQueryParameterValue", - "RequestBodyTooLarge", - "ResourceTypeMismatch", - "RequestUrlFailedToParse", - "ResourceAlreadyExists", - "ResourceNotFound", - "ServerBusy", - "UnsupportedHeader", - "UnsupportedXmlNode", - "UnsupportedQueryParameter", - "UnsupportedHttpVerb", - "InvalidMarker", - "MessageNotFound", - "MessageTooLarge", - "PopReceiptMismatch", - "QueueAlreadyExists", - "QueueBeingDeleted", - "QueueDisabled", - "QueueNotEmpty", - "QueueNotFound" - ], - "x-ms-enum": { - "name": "StorageErrorCode", - "modelAsString": true - } - }, - "GeoReplication": { - "type": "object", - "required": [ - "Status", - "LastSyncTime" - ], - "properties": { - "Status": { - "description": "The status of the secondary location", - "type": "string", - "enum": [ - "live", - "bootstrap", - "unavailable" - ], - "x-ms-enum": { - "name": "GeoReplicationStatusType", - "modelAsString": true - } - }, - "LastSyncTime": { - "description": "A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads.", - "type": "string", - "format": "date-time-rfc1123" - } - } - }, - "Logging": { - "description": "Azure Analytics Logging settings.", - "type": "object", - "required": [ - "Version", - "Delete", - "Read", - "Write", - "RetentionPolicy" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Delete": { - "description": "Indicates whether all delete requests should be logged.", - "type": "boolean" - }, - "Read": { - "description": "Indicates whether all read requests should be logged.", - "type": "boolean" - }, - "Write": { - "description": "Indicates whether all write requests should be logged.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "Metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "StorageError": { - "type": "object", - "properties": { - "Message": { - "type": "string" - } - } - }, - "Metrics": { - "description": "", - "required": [ - "Enabled" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Enabled": { - "description": "Indicates whether metrics are enabled for the Queue service.", - "type": "boolean" - }, - "IncludeAPIs": { - "description": "Indicates whether metrics should generate summary statistics for called API operations.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "QueueItem": { - "description": "An Azure Storage Queue.", - "type": "object", - "required": [ - "Name" - ], - "properties": { - "Name": { - "type": "string", - "description": "The name of the Queue." - }, - "Metadata": { - "$ref": "#/definitions/Metadata" - } - }, - "xml": { - "name": "Queue" - } - }, - "QueueMessage": { - "description": "A Message object which can be stored in a Queue", - "type": "object", - "required": [ - "MessageText" - ], - "properties": { - "MessageText": { - "type": "string", - "description": "The content of the message" - } - } - }, - "DequeuedMessage": { - "description": "The object returned in the QueueMessageList array when calling Get Messages on a Queue.", - "type": "object", - "required": [ - "MessageId", - "InsertionTime", - "ExpirationTime", - "PopReceipt", - "TimeNextVisible", - "DequeueCount", - "MessageText" - ], - "properties": { - "MessageId": { - "type": "string", - "description": "The Id of the Message." - }, - "InsertionTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time the Message was inserted into the Queue." - }, - "ExpirationTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time that the Message will expire and be automatically deleted." - }, - "PopReceipt": { - "type": "string", - "description": "This value is required to delete the Message. If deletion fails using this popreceipt then the message has been dequeued by another client." - }, - "TimeNextVisible": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time that the message will again become visible in the Queue." - }, - "DequeueCount": { - "type": "integer", - "format": "int64", - "description": "The number of times the message has been dequeued." - }, - "MessageText": { - "type": "string", - "description": "The content of the Message." - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessage" - } - }, - "PeekedMessage": { - "description": "The object returned in the QueueMessageList array when calling Peek Messages on a Queue", - "type": "object", - "required": [ - "MessageId", - "InsertionTime", - "ExpirationTime", - "DequeueCount", - "MessageText" - ], - "properties": { - "MessageId": { - "type": "string", - "description": "The Id of the Message." - }, - "InsertionTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time the Message was inserted into the Queue." - }, - "ExpirationTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time that the Message will expire and be automatically deleted." - }, - "DequeueCount": { - "type": "integer", - "format": "int64", - "description": "The number of times the message has been dequeued." - }, - "MessageText": { - "type": "string", - "description": "The content of the Message." - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessage" - } - }, - "EnqueuedMessage": { - "description": "The object returned in the QueueMessageList array when calling Put Message on a Queue", - "type": "object", - "required": [ - "MessageId", - "InsertionTime", - "ExpirationTime", - "PopReceipt", - "TimeNextVisible" - ], - "properties": { - "MessageId": { - "type": "string", - "description": "The Id of the Message." - }, - "InsertionTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time the Message was inserted into the Queue." - }, - "ExpirationTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time that the Message will expire and be automatically deleted." - }, - "PopReceipt": { - "type": "string", - "description": "This value is required to delete the Message. If deletion fails using this popreceipt then the message has been dequeued by another client." - }, - "TimeNextVisible": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time that the message will again become visible in the Queue." - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessage" - } - }, - "DequeuedMessagesList": { - "description": "The object returned when calling Get Messages on a Queue", - "type": "array", - "items": { - "$ref": "#/definitions/DequeuedMessage", - "xml": { - "name": "QueueMessage" - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessagesList" - } - }, - "PeekedMessagesList": { - "description": "The object returned when calling Peek Messages on a Queue", - "type": "array", - "items": { - "$ref": "#/definitions/PeekedMessage", - "xml": { - "name": "QueueMessage" - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessagesList" - } - }, - "EnqueuedMessageList": { - "description": "The object returned when calling Put Message on a Queue", - "type": "array", - "items": { - "$ref": "#/definitions/EnqueuedMessage", - "xml": { - "name": "QueueMessage" - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessagesList" - } - }, - "RetentionPolicy": { - "description": "the retention policy", - "type": "object", - "required": [ - "Enabled" - ], - "properties": { - "Enabled": { - "description": "Indicates whether a retention policy is enabled for the storage service", - "type": "boolean" - }, - "Days": { - "description": "Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted", - "type": "integer", - "minimum": 1 - } - } - }, - "SignedIdentifier": { - "description": "signed identifier", - "type": "object", - "required": [ - "Id", - "AccessPolicy" - ], - "properties": { - "Id": { - "type": "string", - "description": "a unique id" - }, - "AccessPolicy": { - "description": "The access policy", - "$ref": "#/definitions/AccessPolicy" - } - } - }, - "SignedIdentifiers": { - "description": "a collection of signed identifiers", - "type": "array", - "items": { - "$ref": "#/definitions/SignedIdentifier", - "xml": { - "name": "SignedIdentifier" - } - }, - "xml": { - "wrapped": true, - "name": "SignedIdentifiers" - } - }, - "StorageServiceProperties": { - "description": "Storage Service Properties.", - "type": "object", - "properties": { - "Logging": { - "description": "Azure Analytics Logging settings", - "$ref": "#/definitions/Logging" - }, - "HourMetrics": { - "description": "A summary of request statistics grouped by API in hourly aggregates for queues", - "$ref": "#/definitions/Metrics" - }, - "MinuteMetrics": { - "description": "a summary of request statistics grouped by API in minute aggregates for queues", - "$ref": "#/definitions/Metrics" - }, - "Cors": { - "description": "The set of CORS rules.", - "type": "array", - "items": { - "$ref": "#/definitions/CorsRule", - "xml": { - "name": "CorsRule" - } - }, - "xml": { - "wrapped": true - } - } - } - }, - "StorageServiceStats": { - "description": "Stats for the storage service.", - "type": "object", - "properties": { - "GeoReplication": { - "description": "Geo-Replication information for the Secondary Storage Service", - "$ref": "#/definitions/GeoReplication" - } - } - } - }, - "parameters": { - "Url": { - "name": "url", - "description": "The URL of the service account, queue or message that is the targe of the desired operation.", - "required": true, - "type": "string", - "in": "path", - "x-ms-skip-url-encoding": true - }, - "ApiVersionParameter": { - "name": "x-ms-version", - "x-ms-client-name": "version", - "in": "header", - "required": true, - "type": "string", - "description": "Specifies the version of the operation to use for this request.", - "enum": [ - "2018-03-28" - ] - }, - "Body": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "format": "file" - }, - "x-ms-parameter-location": "method", - "description": "Initial data" - }, - "QueueAcl": { - "name": "queueAcl", - "in": "body", - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - }, - "x-ms-parameter-location": "method", - "description": "the acls for the queue" - }, - "ClientRequestId": { - "name": "x-ms-client-request-id", - "x-ms-client-name": "requestId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled." - }, - "ContentLength": { - "name": "Content-Length", - "in": "header", - "required": true, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "The length of the request." - }, - "ListQueuesInclude": { - "name": "include", - "in": "query", - "required": false, - "type": "array", - "collectionFormat": "csv", - "items": { - "type": "string", - "enum": [ - "metadata" - ], - "x-ms-enum": { - "name": "ListQueuesIncludeType", - "modelAsString": false - } - }, - "x-ms-parameter-location": "method", - "description": "Include this parameter to specify that the queues's metadata be returned as part of the response body." - }, - "Marker": { - "name": "marker", - "in": "query", - "required": false, - "type": "string", - "description": "A string value that identifies the portion of the list of queues to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client.", - "x-ms-parameter-location": "method" - }, - "MaxResults": { - "name": "maxresults", - "in": "query", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method", - "description": "Specifies the maximum number of queues to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000." - }, - "MessageId": { - "name": "messageid", - "in": "path", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The message ID name." - }, - "MessageTTL": { - "name": "messagettl", - "x-ms-client-name": "MessageTimeToLive", - "in": "query", - "required": false, - "type": "integer", - "minimum": -1, - "x-ms-parameter-location": "method", - "description": "Optional. Specifies the time-to-live interval for the message, in seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this parameter is omitted, the default time-to-live is 7 days." - }, - "Metadata": { - "name": "x-ms-meta", - "x-ms-client-name": "metadata", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. Note that metadata requested with this parameter must be stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata names must adhere to the naming conventions for C# identifiers.", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "NumOfMessages": { - "name": "numofmessages", - "x-ms-client-name": "numberOfMessages", - "in": "query", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method", - "description": "Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation." - }, - "PopReceipt": { - "name": "popreceipt", - "x-ms-client-name": "popReceipt", - "in": "query", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation.", - "type": "string" - }, - "Prefix": { - "name": "prefix", - "in": "query", - "required": false, - "type": "string", - "description": "Filters the results to return only queues whose name begins with the specified prefix.", - "x-ms-parameter-location": "method" - }, - "QueueMessage": { - "name": "QueueMessage", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/QueueMessage" - }, - "x-ms-parameter-location": "method", - "description": "A Message object which can be stored in a Queue" - }, - "QueueName": { - "name": "queueName", - "in": "path", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The queue name." - }, - "StorageServiceProperties": { - "name": "StorageServiceProperties", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/StorageServiceProperties" - }, - "x-ms-parameter-location": "method", - "description": "The StorageService properties." - }, - "Timeout": { - "name": "timeout", - "in": "query", - "required": false, - "type": "integer", - "minimum": 0, - "x-ms-parameter-location": "method", - "description": "The The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Queue Service Operations." - }, - "VisibilityTimeout": { - "name": "visibilitytimeout", - "in": "query", - "required": false, - "type": "integer", - "minimum": 0, - "maximum": 604800, - "x-ms-parameter-location": "method", - "description": "Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry time." - }, - "VisibilityTimeoutRequired": { - "name": "visibilitytimeout", - "in": "query", - "required": true, - "type": "integer", - "minimum": 0, - "maximum": 604800, - "x-ms-parameter-location": "method", - "description": "Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry time." - } - } -} \ No newline at end of file diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 4279cde3364c..70ef8754925a 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -36,9 +36,13 @@ stages: Artifacts: - name: azure-storage-common safeName: azurestoragecommon + stagingProfileId: 88192f04117501 - name: azure-storage-blob safeName: azurestorageblob + stagingProfileId: 88192f04117501 - name: azure-storage-file safeName: azurestoragefile + stagingProfileId: 88192f04117501 - name: azure-storage-queue safeName: azurestoragequeue + stagingProfileId: 88192f04117501 diff --git a/sdk/storage/microsoft-azure-storage-blob/README.md b/sdk/storage/microsoft-azure-storage-blob/README.md index 0e3e9f986828..c62b4a02cb4b 100644 --- a/sdk/storage/microsoft-azure-storage-blob/README.md +++ b/sdk/storage/microsoft-azure-storage-blob/README.md @@ -186,3 +186,5 @@ When sending pull requests, please send non-breaking PRs to the dev branch and b * [Azure Storage Service](http://azure.microsoft.com/en-us/documentation/services/storage/) * [Azure Storage Team Blog](http://blogs.msdn.com/b/windowsazurestorage/) * [Javadoc](http://azure.github.io/azure-storage-java/) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/storage/microsoft-azure-storage-blob/README.png) \ No newline at end of file diff --git a/sdk/storage/pom.service.xml b/sdk/storage/pom.service.xml index 6f995e563f24..147f70964743 100644 --- a/sdk/storage/pom.service.xml +++ b/sdk/storage/pom.service.xml @@ -12,6 +12,7 @@ ../core/azure-core ../core/azure-core-test + ../core/azure-core-http-netty ../identity/azure-identity azure-storage-common azure-storage-blob diff --git a/sdk/storage/tests.yml b/sdk/storage/tests.yml index 846f46380ee6..1e8102699c2e 100644 --- a/sdk/storage/tests.yml +++ b/sdk/storage/tests.yml @@ -14,4 +14,6 @@ jobs: BLOB_STORAGE_ACCOUNT_NAME: $(java-storage-test-blob-account-name) BLOB_STORAGE_ACCOUNT_KEY: $(java-storage-test-blob-account-key) PREMIUM_STORAGE_ACCOUNT_NAME: $(java-storage-test-premium-account-name) - PREMIUM_STORAGE_ACCOUNT_KEY: $(java-storage-test-premium-account-key) \ No newline at end of file + PREMIUM_STORAGE_ACCOUNT_KEY: $(java-storage-test-premium-account-key) + AZURE_STORAGE_ACCESS_KEY: $(java-storage-test-access-key) + AZURE_STORAGE_FILE_ENDPOINT: $(java-storage-test-file-endpoint) diff --git a/sdk/template/azure-sdk-template/pom.xml b/sdk/template/azure-sdk-template/pom.xml index 3c5ff41f6fc2..0d15dd67d620 100644 --- a/sdk/template/azure-sdk-template/pom.xml +++ b/sdk/template/azure-sdk-template/pom.xml @@ -1,17 +1,16 @@ - + 4.0.0 com.azure azure-client-sdk-parent - 1.1.0 + 1.3.0 ../../../pom.client.xml azure-sdk-template - 1.0.2-SNAPSHOT - jar + 1.0.2 Microsoft Azure SDK for Template This package contains Microsoft Azure SDK for Template. @@ -23,9 +22,16 @@
            - https://github.com/Azure/azure-sdk-for-java + + https://github.com/Azure/azure-sdk-for-java + + + com.azure + azure-core + 1.0.0-preview.3 + junit junit diff --git a/sdk/template/ci.yml b/sdk/template/ci.yml index e854b76faf06..6490793c6b4f 100644 --- a/sdk/template/ci.yml +++ b/sdk/template/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: template Artifacts: - name: azure-sdk-template - safeName: azuresdktemplate \ No newline at end of file + safeName: azuresdktemplate + stagingProfileId: 88192f04117501 \ No newline at end of file diff --git a/sdk/tracing/README.md b/sdk/tracing/README.md index 2dcebf573318..9676eba059f7 100644 --- a/sdk/tracing/README.md +++ b/sdk/tracing/README.md @@ -17,3 +17,5 @@ This project welcomes contributions and suggestions. Most contributions require When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/tracing/README.png) \ No newline at end of file diff --git a/sdk/tracing/ci.yml b/sdk/tracing/ci.yml index 02de6fb1c6ef..bfa200bea0af 100644 --- a/sdk/tracing/ci.yml +++ b/sdk/tracing/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: tracing Artifacts: - name: tracing-opentelemetry - safeName: tracingopentelemetry \ No newline at end of file + safeName: tracingopentelemetry + stagingProfileId: 88192f04117501 \ No newline at end of file diff --git a/sdk/tracing/tracing-opentelemetry/README.md b/sdk/tracing/tracing-opentelemetry/README.md index 63e6bf28991f..32f1ffca0789 100644 --- a/sdk/tracing/tracing-opentelemetry/README.md +++ b/sdk/tracing/tracing-opentelemetry/README.md @@ -11,3 +11,5 @@ ## Next steps ## Contributing + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/tracing/tracing-opentelemetry/README.png) \ No newline at end of file